Package com.netscape.cmscore.dbs
Class DBSSession
- java.lang.Object
-
- com.netscape.cmscore.dbs.DBSSession
-
- All Implemented Interfaces:
IDBSSession,java.lang.AutoCloseable
public class DBSSession extends java.lang.Object implements IDBSSession
A class represents the database session. Operations can be performed with a session. Transaction and Caching support can be integrated into session.- Version:
- $Revision$, $Date$
- Author:
- thomask
-
-
Field Summary
Fields Modifier and Type Field Description static org.slf4j.Loggerlogger
-
Constructor Summary
Constructors Constructor Description DBSSession(DBSubsystem dbSubsystem, netscape.ldap.LDAPConnection c)Constructs a database session.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidabandon(netscape.ldap.LDAPSearchResults results)voidadd(java.lang.String name, IDBObj obj)Adds object to backend database.voidclose()Closes this session.<T extends IDBObj>
IDBVirtualList<T>createVirtualList(java.lang.String base, java.lang.String filter, java.lang.String[] attrs)Retrieves a list of objects.<T extends IDBObj>
IDBVirtualList<T>createVirtualList(java.lang.String base, java.lang.String filter, java.lang.String[] attrs, java.lang.String sortKey)Retrieves a list of objects.<T extends IDBObj>
IDBVirtualList<T>createVirtualList(java.lang.String base, java.lang.String filter, java.lang.String[] attrs, java.lang.String[] sortKey)Retrieves a list of objects.<T extends IDBObj>
IDBVirtualList<T>createVirtualList(java.lang.String base, java.lang.String filter, java.lang.String[] attrs, java.lang.String[] sortKey, int pageSize)Retrieves a list of objects.<T extends IDBObj>
IDBVirtualList<T>createVirtualList(java.lang.String base, java.lang.String filter, java.lang.String[] attrs, java.lang.String sortKey, int pageSize)Retrieves a list of objects.<T extends IDBObj>
IDBVirtualList<T>createVirtualList(java.lang.String base, java.lang.String filter, java.lang.String[] attrs, java.lang.String startFrom, java.lang.String sortKey, int pageSize)Retrieves a list of objects.voiddelete(java.lang.String name)Deletes object from database.ISubsystemgetDBSubsystem()Returns database subsystem.voidmodify(java.lang.String name, ModificationSet mods)Modify an object in the database.netscape.ldap.LDAPSearchResultspersistentSearch(java.lang.String base, java.lang.String filter, java.lang.String[] attrs)Sets persistent search to retrieve modified certificate records.IDBObjread(java.lang.String name)Reads an object from the database.IDBObjread(java.lang.String name, java.lang.String[] attrs)Reads an object from the database, and only populates the selected attributes.voidrelease(java.lang.Object obj)Releases object to this interface.IDBSearchResultssearch(java.lang.String base, java.lang.String filter)Searchs for a list of objects that match the filter.IDBSearchResultssearch(java.lang.String base, java.lang.String filter, int maxSize)Searchs for a list of objects that match the filter.IDBSearchResultssearch(java.lang.String base, java.lang.String filter, int maxSize, int timeLimit)Searchs for a list of objects that match the filter.IDBSearchResultssearch(java.lang.String base, java.lang.String filter, int maxSize, int timeLimit, java.lang.String sortAttribute)Searchs for a list of objects that match the filter.IDBSearchResultssearch(java.lang.String base, java.lang.String filter, int maxSize, java.lang.String sortAttribute)Searchs for a list of objects that match the filter.IDBSearchResultssearch(java.lang.String base, java.lang.String filter, java.lang.String[] attrs)Retrieves a list of object that satifies the given filter.
-
-
-
Constructor Detail
-
DBSSession
public DBSSession(DBSubsystem dbSubsystem, netscape.ldap.LDAPConnection c) throws EDBException
Constructs a database session.- Parameters:
dbSubsystem- the database subsytemc- the ldap connection- Throws:
EDBException
-
-
Method Detail
-
getDBSubsystem
public ISubsystem getDBSubsystem()
Returns database subsystem.- Specified by:
getDBSubsystemin interfaceIDBSSession- Returns:
- subsystem
-
close
public void close() throws EDBExceptionCloses this session.- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfaceIDBSSession- Throws:
EDBException- failed to close session
-
add
public void add(java.lang.String name, IDBObj obj) throws EBaseExceptionAdds object to backend database. For example,session.add("cn=123459,o=certificate repository,o=airius.com", certRec);- Specified by:
addin interfaceIDBSSession- Parameters:
name- the name of the ldap entryobj- the DBobj that can be mapped to ldap attrubute set- Throws:
EDBException- failed to add objectEBaseException
-
read
public IDBObj read(java.lang.String name) throws EBaseException
Reads an object from the database. all attributes will be returned- Specified by:
readin interfaceIDBSSession- Parameters:
name- the name of the ldap entry- Returns:
- database object
- Throws:
EBaseException- failed to read object
-
read
public IDBObj read(java.lang.String name, java.lang.String[] attrs) throws EBaseException
Reads an object from the database, and only populates the selected attributes.- Specified by:
readin interfaceIDBSSession- Parameters:
name- the name of the ldap entryattrs- the attributes to be selected- Returns:
- database object
- Throws:
EBaseException- failed to read object
-
delete
public void delete(java.lang.String name) throws EBaseExceptionDeletes object from database.- Specified by:
deletein interfaceIDBSSession- Parameters:
name- name of the object that is to be deleted- Throws:
EBaseException- failed to delete object
-
modify
public void modify(java.lang.String name, ModificationSet mods) throws EBaseExceptionModify an object in the database.- Specified by:
modifyin interfaceIDBSSession- Parameters:
name- name of the object that is to be modifiedmods- modifications- Throws:
EBaseException- failed to modify
-
search
public IDBSearchResults search(java.lang.String base, java.lang.String filter) throws EBaseException
Searchs for a list of objects that match the filter.- Specified by:
searchin interfaceIDBSSession- Parameters:
base- starting point of the searchfilter- search filter- Returns:
- search results
- Throws:
EBaseException- failed to search
-
search
public IDBSearchResults search(java.lang.String base, java.lang.String filter, int maxSize) throws EBaseException
Description copied from interface:IDBSSessionSearchs for a list of objects that match the filter.- Specified by:
searchin interfaceIDBSSession- Parameters:
base- starting point of the searchfilter- search filtermaxSize- max number of entries- Returns:
- search results
- Throws:
EBaseException- failed to search
-
search
public IDBSearchResults search(java.lang.String base, java.lang.String filter, int maxSize, java.lang.String sortAttribute) throws EBaseException
Description copied from interface:IDBSSessionSearchs for a list of objects that match the filter.- Specified by:
searchin interfaceIDBSSession- Parameters:
base- starting point of the searchfilter- search filtermaxSize- max number of entriessortAttribute- Field to sort the records on- Returns:
- search results
- Throws:
EBaseException- failed to search
-
search
public IDBSearchResults search(java.lang.String base, java.lang.String filter, int maxSize, int timeLimit) throws EBaseException
Description copied from interface:IDBSSessionSearchs for a list of objects that match the filter.- Specified by:
searchin interfaceIDBSSession- Parameters:
base- starting point of the searchfilter- search filtermaxSize- max number of entriestimeLimit- timeout limit- Returns:
- search results
- Throws:
EBaseException- failed to search
-
search
public IDBSearchResults search(java.lang.String base, java.lang.String filter, int maxSize, int timeLimit, java.lang.String sortAttribute) throws EBaseException
Description copied from interface:IDBSSessionSearchs for a list of objects that match the filter.- Specified by:
searchin interfaceIDBSSession- Parameters:
base- starting point of the searchfilter- search filtermaxSize- max number of entriestimeLimit- timeout limitsortAttribute- Field to sort the records on- Returns:
- search results
- Throws:
EBaseException- failed to search
-
search
public IDBSearchResults search(java.lang.String base, java.lang.String filter, java.lang.String[] attrs) throws EBaseException
Retrieves a list of object that satifies the given filter.- Specified by:
searchin interfaceIDBSSession- Parameters:
base- starting point of the searchfilter- search filterattrs- selected attributes- Returns:
- search results
- Throws:
EBaseException- failed to search
-
persistentSearch
public netscape.ldap.LDAPSearchResults persistentSearch(java.lang.String base, java.lang.String filter, java.lang.String[] attrs) throws EBaseExceptionDescription copied from interface:IDBSSessionSets persistent search to retrieve modified certificate records.- Specified by:
persistentSearchin interfaceIDBSSession- Parameters:
base- starting point of the searchfilter- search filterattrs- selected attributes- Returns:
- LDAP search results
- Throws:
EBaseException- failed to search
-
abandon
public void abandon(netscape.ldap.LDAPSearchResults results) throws EBaseException- Specified by:
abandonin interfaceIDBSSession- Throws:
EBaseException
-
createVirtualList
public <T extends IDBObj> IDBVirtualList<T> createVirtualList(java.lang.String base, java.lang.String filter, java.lang.String[] attrs) throws EBaseException
Retrieves a list of objects.- Specified by:
createVirtualListin interfaceIDBSSession- Parameters:
base- starting point of the searchfilter- search filterattrs- selected attributes- Returns:
- search results in virtual list
- Throws:
EBaseException- failed to search
-
createVirtualList
public <T extends IDBObj> IDBVirtualList<T> createVirtualList(java.lang.String base, java.lang.String filter, java.lang.String[] attrs, java.lang.String[] sortKey) throws EBaseException
Retrieves a list of objects.- Throws:
EBaseException
-
createVirtualList
public <T extends IDBObj> IDBVirtualList<T> createVirtualList(java.lang.String base, java.lang.String filter, java.lang.String[] attrs, java.lang.String sortKey) throws EBaseException
Retrieves a list of objects.- Throws:
EBaseException
-
createVirtualList
public <T extends IDBObj> IDBVirtualList<T> createVirtualList(java.lang.String base, java.lang.String filter, java.lang.String[] attrs, java.lang.String[] sortKey, int pageSize) throws EBaseException
Retrieves a list of objects.- Specified by:
createVirtualListin interfaceIDBSSession- Parameters:
base- starting point of the searchfilter- search filterattrs- selected attributessortKey- keys used to sort the listpageSize- page size in the virtual list- Returns:
- search results in virtual list
- Throws:
EBaseException- failed to search
-
createVirtualList
public <T extends IDBObj> IDBVirtualList<T> createVirtualList(java.lang.String base, java.lang.String filter, java.lang.String[] attrs, java.lang.String sortKey, int pageSize) throws EBaseException
Retrieves a list of objects.- Specified by:
createVirtualListin interfaceIDBSSession- Parameters:
base- starting point of the searchfilter- search filterattrs- selected attributessortKey- key used to sort the listpageSize- page size in the virtual list- Returns:
- search results in virtual list
- Throws:
EBaseException- failed to search
-
createVirtualList
public <T extends IDBObj> IDBVirtualList<T> createVirtualList(java.lang.String base, java.lang.String filter, java.lang.String[] attrs, java.lang.String startFrom, java.lang.String sortKey, int pageSize) throws EBaseException
Description copied from interface:IDBSSessionRetrieves a list of objects.- Specified by:
createVirtualListin interfaceIDBSSession- Parameters:
base- starting point of the searchfilter- search filterattrs- selected attributesstartFrom- starting pointsortKey- key used to sort the listpageSize- page size in the virtual list- Returns:
- search results in virtual list
- Throws:
EBaseException- failed to search
-
release
public void release(java.lang.Object obj)
Releases object to this interface. This allows us to use memory more efficiently.
-
-