|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.exolab.core.database.recman.PMDSession
public class 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
SessionIfc
The TransactionNotInProgressException is thrown when bind is called outside a transaction.
bind
in interface SessionIfc
name
- binding nameobject
- object to bind
ObjectNameExistsException
DatabaseIOException
TransactionNotInProgressException
public void unbind(java.lang.String name) throws ObjectNameNotFoundException, DatabaseIOException, TransactionNotInProgressException
SessionIfc
The TransactionNotInProgressException is thrown when unbind is called outside a transaction.
unbind
in interface SessionIfc
name
- binding name
ObjectNameNotFoundException
DatabaseIOException
TransactionNotInProgressException
public PersistentCapableIfc lookup(java.lang.String name)
SessionIfc
lookup
in interface SessionIfc
name
- lookup name
public boolean isBound(java.lang.String name)
SessionIfc
isBound
in interface SessionIfc
name
- lookup name
public void acquireLock(PersistentCapableIfc object, int timeout) throws FailedToAcquireLockException, FailedToCreateLockException, TransactionNotInProgressException
SessionIfc
The 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 SessionIfc
object
- object to lock
FailedToAcquireLockException
FailedToCreateLockException
TransactionNotInProgressException
public void begin() throws TransactionInProgressException
TransactionIfc
begin
in interface TransactionIfc
TransactionInProgressException
public void commit() throws TransactionNotInProgressException, TransactionException, DatabaseIOException
TransactionIfc
If the transaction is not currently opened then TransactionNotInProg- ressException is raised.
commit
in interface TransactionIfc
TransactionNotInProgressException
TransactionException
DatabaseIOException
public void abort() throws TransactionNotInProgressException, DatabaseIOException
TransactionIfc
abort
in interface TransactionIfc
TransactionNotInProgressException
DatabaseIOException
public void rollback() throws TransactionNotInProgressException, DatabaseIOException
TransactionIfc
rollback
in interface TransactionIfc
TransactionNotInProgressException
DatabaseIOException
public void setRollbackOnly(boolean status) throws TransactionNotInProgressException
TransactionIfc
setRollbackOnly
in interface TransactionIfc
status
- true to set rollback only; false to
clear the rollback only flag
TransactionNotInProgressException
public boolean isOpened()
TransactionIfc
isOpened
in interface TransactionIfc
public TransactionContext getTransactionContext()
TransactionIfc
getTransactionContext
in interface TransactionIfc
public TransactionIfc getCurrentTransaction()
SessionIfc
getCurrentTransaction
in interface SessionIfc
public DatabaseIfc getDatabase()
SessionIfc
getDatabase
in interface SessionIfc
public SessionManagerIfc getSessionManager()
SessionIfc
getSessionManager
in interface SessionIfc
public void setSessionManager(SessionManagerIfc manager)
SessionIfc
setSessionManager
in interface SessionIfc
manager
- session managerpublic void createObject(PersistentCapableIfc object) throws TransactionNotInProgressException, DatabaseIOException
SessionIfc
createObject
in interface SessionIfc
object
- object to create
TransactionNotInProgressException
DatabaseIOException
public void updateObject(PersistentCapableIfc object) throws TransactionNotInProgressException, DatabaseIOException
SessionIfc
updateObject
in interface SessionIfc
object
- object to update
TransactionNotInProgressException
DatabaseIOException
public void deleteObject(PersistentCapableIfc object) throws TransactionNotInProgressException, DatabaseIOException
SessionIfc
deleteObject
in interface SessionIfc
object
- object to delete
TransactionNotInProgressException
DatabaseIOException
public PersistentCapableIfc retrieveObject(long id) throws TransactionNotInProgressException, DatabaseIOException
SessionIfc
retrieveObject
in interface SessionIfc
id
- identity of object to retrieve
TransactionNotInProgressException
DatabaseIOException
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 SessionIfc
object
- PersistentCapableIfcHandleIfc
-
FailedToCreateHandleException
TransactionNotInProgressException
public CollectionManagerIfc getCollectionManager()
getCollectionManager
in interface SessionIfc
public long getSessionId()
SessionIfc
getSessionId
in interface SessionIfc
public boolean isValid()
SessionIfc
isValid
in interface SessionIfc
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |