|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.exolab.core.database.recman.PMDSession
This is an implementation of the SessionIfc interface for the page managed database. A session is a single-threaded entity that is only accessible through the PMDSessionManager (this is where the constraint is enforced).
A Session is a mediating class to the pagem managed database and delegates the request to the appropriate component.
There is a lack of synchronization in this class and hence lacks thread safety since it is expected that only one thread will be accessing an instance of this class at any one time.
PMDSessionManager| Field Summary |
| Fields inherited from interface org.exolab.core.foundation.SessionIfc |
DEFAULT_LOCK_TIMEOUT |
| Method Summary | |
void |
abort()
Abort the current transaction. |
void |
acquireLock(PersistentCapableIfc object,
int timeout)
Acquire an exclusive lock on the specified object. |
void |
begin()
Put the transaction in the open state. |
void |
bind(java.lang.String name,
PersistentCapableIfc object)
Bind the specified name to an object. |
void |
commit()
Close the current transaction. |
HandleIfc |
createHandle(PersistentCapableIfc object)
Create a handle for the specified PersistentCapableIfc object. |
void |
createObject(PersistentCapableIfc object)
Create the specified persistent object in the database for this session. |
void |
deleteObject(PersistentCapableIfc object)
Delete the specified persistent object in the database for this session. |
CollectionManagerIfc |
getCollectionManager()
Return a reference to the collection manager, which is used to allocate different collection types includinng queues and vectors. |
TransactionIfc |
getCurrentTransaction()
Return the current transaction for this session. |
DatabaseIfc |
getDatabase()
Return the database that this session is associated with. |
java.util.Enumeration |
getRootNames()
Return an enumeration of all the database root names. |
long |
getSessionId()
Return the session id associated with this object |
SessionManagerIfc |
getSessionManager()
Return the session manager responsible for allocating this session |
TransactionContext |
getTransactionContext()
Return the transaction context assoicated with this transaction |
boolean |
isBound(java.lang.String name)
Check if an object is already bound to the specified name |
boolean |
isOpened()
Test if the transaction is opened. |
boolean |
isValid()
Check the validity of the session |
PersistentCapableIfc |
lookup(java.lang.String name)
Lookup the object specified by name. |
PersistentCapableIfc |
retrieveObject(long id)
Retrieve the persistent object associated with the id. |
void |
rollback()
Rollback the current transaction. |
void |
setRollbackOnly(boolean status)
Set the transaction so that the only outcome is rollback. |
void |
setSessionManager(SessionManagerIfc manager)
Set the session manager that allocated this session. |
void |
unbind(java.lang.String name)
Unbind the object associated with the specified name. |
void |
updateObject(PersistentCapableIfc object)
Update the specified persistent object in the database for this session. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
public java.util.Enumeration getRootNames()
SessionIfc
getRootNames in interface SessionIfc
public void bind(java.lang.String name,
PersistentCapableIfc object)
throws ObjectNameExistsException,
DatabaseIOException,
TransactionNotInProgressException
SessionIfcThe TransactionNotInProgressException is thrown when bind is called outside a transaction.
bind in interface SessionIfcname - binding nameobject - object to bind
DatabaseIOException
ObjectNameExistsException
TransactionNotInProgressException
public void unbind(java.lang.String name)
throws ObjectNameNotFoundException,
DatabaseIOException,
TransactionNotInProgressException
SessionIfcThe TransactionNotInProgressException is thrown when unbind is called outside a transaction.
unbind in interface SessionIfcname - binding name
ObjectNameNotFoundException
TransactionNotInProgressException
DatabaseIOExceptionpublic PersistentCapableIfc lookup(java.lang.String name)
SessionIfc
lookup in interface SessionIfcname - lookup name
public boolean isBound(java.lang.String name)
SessionIfc
isBound in interface SessionIfcname - lookup name
public void acquireLock(PersistentCapableIfc object,
int timeout)
throws FailedToAcquireLockException,
FailedToCreateLockException,
TransactionNotInProgressException
SessionIfcThe timeout determines how long to wait for the lock. A value of DEFAULT_LOCK_TIMEOUT is used to wait the default time.
All locks granted to a session will be automatically released in an abort, commit or rollback
acquireLock in interface SessionIfcobject - object to lock
TransactionNotInProgressException
FailedToAcquireLockException
FailedToCreateLockException
public void begin()
throws TransactionInProgressException
TransactionIfc
begin in interface TransactionIfcTransactionInProgressException
public void commit()
throws TransactionNotInProgressException,
TransactionException,
DatabaseIOException
TransactionIfcIf the transaction is not currently opened then TransactionNotInProg- ressException is raised.
commit in interface TransactionIfcDatabaseIOException
TransactionNotInProgressException
TransactionException
public void abort()
throws TransactionNotInProgressException,
DatabaseIOException
TransactionIfc
abort in interface TransactionIfcTransactionNotInProgressException
DatabaseIOException
public void rollback()
throws TransactionNotInProgressException,
DatabaseIOException
TransactionIfc
rollback in interface TransactionIfcTransactionNotInProgressException
DatabaseIOException
public void setRollbackOnly(boolean status)
throws TransactionNotInProgressException
TransactionIfc
setRollbackOnly in interface TransactionIfcstatus - true to set rollback only; false to
clear the rollback only flag
TransactionNotInProgressExceptionpublic boolean isOpened()
TransactionIfc
isOpened in interface TransactionIfcpublic TransactionContext getTransactionContext()
TransactionIfc
getTransactionContext in interface TransactionIfcpublic TransactionIfc getCurrentTransaction()
SessionIfc
getCurrentTransaction in interface SessionIfcpublic DatabaseIfc getDatabase()
SessionIfc
getDatabase in interface SessionIfcpublic SessionManagerIfc getSessionManager()
SessionIfc
getSessionManager in interface SessionIfcpublic void setSessionManager(SessionManagerIfc manager)
SessionIfc
setSessionManager in interface SessionIfcmanager - session manager
public void createObject(PersistentCapableIfc object)
throws TransactionNotInProgressException,
DatabaseIOException
SessionIfc
createObject in interface SessionIfcobject - object to create
TransactionNotInProgressException
DatabaseIOException
public void updateObject(PersistentCapableIfc object)
throws TransactionNotInProgressException,
DatabaseIOException
SessionIfc
updateObject in interface SessionIfcobject - object to update
TransactionNotInProgressException
DatabaseIOException
public void deleteObject(PersistentCapableIfc object)
throws TransactionNotInProgressException,
DatabaseIOException
SessionIfc
deleteObject in interface SessionIfcobject - object to delete
DatabaseIOException
TransactionNotInProgressException
public PersistentCapableIfc retrieveObject(long id)
throws TransactionNotInProgressException,
DatabaseIOException
SessionIfc
retrieveObject in interface SessionIfcid - identity of object to retrieve
DatabaseIOException
TransactionNotInProgressException
public HandleIfc createHandle(PersistentCapableIfc object)
throws FailedToCreateHandleException,
TransactionNotInProgressException
A handle can be used to reference a persistent entity and can be carried across transactions...although there is some more code that needs to be done in order to make this a reality. (i.e clear the cached object between transactions).
createHandle in interface SessionIfcobject - PersistentCapableIfc
FailedToCreateHandleException
TransactionNotInProgressExceptionpublic CollectionManagerIfc getCollectionManager()
getCollectionManager in interface SessionIfcpublic long getSessionId()
SessionIfc
getSessionId in interface SessionIfcpublic boolean isValid()
SessionIfc
isValid in interface SessionIfc
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||