| java.lang.Object org.ozoneDB.AbstractDatabase org.ozoneDB.ExternalDatabase
All known Subclasses: org.ozoneDB.RemoteDatabase, org.ozoneDB.LocalDatabase, org.ozoneDB.ClientCacheDatabase,
ExternalDatabase | abstract public class ExternalDatabase extends AbstractDatabase implements OzoneInterface(Code) | | Base class for implementations of the OzoneInterface which are used from
a client application to access an ozone.
Each thread is associated with a server connection. This connection is used
if the thread is not associated with a transaction. Otherwise the connection
of the transaction is used. So in case the thread has *joined* a transaction
it does not use its own connection but the connection of the transaction.
The prepare/commit/abort methods don't need to be called from the thread that
is joined to the transaction.
Impl. note: The OzoneInterface methods don't need to be synchronized any
longer because each threads has its own connection.
author: SMB author: Medium.net version: $Revision: 1.5 $Date: 2002/06/25 11:34:38 $ See Also: OzoneInterface |
Method Summary | |
final protected DbClient | acquirePooledConnection() Get a connection from the connection pool.
Earlier versions kept one connection for each client thread. | public Admin | admin() Return the administration object for this database. | public void | beginTX(AbstractTransaction tx) This method is never directly called from the client code. | public void | checkpointTX(AbstractTransaction tx) This method is never directly called from the client code. | public synchronized void | close() Close this database. | final protected Object | commandTX(AbstractTransaction tx, DbTransaction command) This method is never directly called from the client code. | public void | commitTX(AbstractTransaction tx, boolean onePhase) This method is never directly called from the client code. | public OzoneProxy | copyObject(OzoneRemote obj) | public OzoneProxy | createObject(String className, int access, String name, String sig, Object[] args) | protected static Hashtable | createProps(String _url) | public ExternalTransaction | currentExternalTransaction() Obtain the
ExternalTransaction that is assocaited to the
caller's thread or null, if there is no such transaction. | public AbstractTransaction | currentTransaction() Obtain the transaction that is assocaited to the caller's thread or null,
if there is no such transaction. | public void | deleteObject(OzoneRemote obj) | public OzoneCompatible | fetch(OzoneProxy rObj, int lockLevel) | protected void | finalize() | public static ExternalDatabase | forThread(Thread _thread) Static method to find a database connection that has an associated
transaction that has been joined by the given thread. | final public int | getStatusTX(AbstractTransaction tx) Obtain the _internal_ server status of this transaction.
Status of the transaction. | final public XAResource | getXAResource() Return a new XAResource for this database connection. | public Object | invoke(OzoneProxy rObj, String methodName, String sig, Object[] args, int lockLevel) | public Object | invoke(OzoneProxy rObj, int methodIndex, Object[] args, int lockLevel) | public boolean | isOpen() | public void | joinTX(AbstractTransaction tx) This method is never directly called from the client code. | public boolean | leaveTX(AbstractTransaction tx) This method is never directly called from the client code. | protected ExternalDatabase | linkForProxy(OzoneProxy proxy) | public void | nameObject(OzoneRemote obj, String name) | abstract protected DbClient | newConnection() The way for the actual database types to create a corresponding
connection. | public ExternalTransaction | newTransaction() Create a new transaction. | public void | notifyProxyDeath(OzoneProxy proxy) Internal method. | public OzoneProxy | objectForHandle(String handle) | public OzoneProxy | objectForName(String name) | public OzoneProxy[] | objectsOfClass(String name) | protected void | open(Hashtable _props) Open this database connection according to the specified properties. | public static ExternalDatabase | openDatabase(String _url, String _username, String _passwd) Factory method that creates a new database object. | public static ExternalDatabase | openDatabase(String _url) Factory method that creates a new database object. | public void | prepareTX(AbstractTransaction tx) This method is never directly called from the client code. | final protected void | releasePooledConnection(DbClient connection) Release a formerly acquired pooled connection so that it may used by
another request. | public void | reloadClasses() | public void | rollbackTX(AbstractTransaction tx) This method is never directly called from the client code. | final protected Object | sendCommand(DbCommand command, boolean waitForResult) Send the specified command to the server. | protected Object | sendCommand(DbCommand command, boolean waitForResult, DbClient connection) Send the specified command to the server. | protected synchronized void | setWrapper(ExternalDatabase _wrapper) | final protected AbstractTransaction | txForThread(Thread thread) | public Node | xmlForObject(OzoneRemote rObj, Document domFactory) | public void | xmlForObject(OzoneRemote rObj, ContentHandler ch) |
ExternalDatabase | public ExternalDatabase()(Code) | | |
acquirePooledConnection | final protected DbClient acquirePooledConnection() throws Exception(Code) | | Get a connection from the connection pool.
Earlier versions kept one connection for each client thread. That is,
client threads were directly mapped to server threads. Especially for
servlet environment this produces a lot of connections (server threads),
which in fact is not needed.
So we are using a pool of connections now. Connections are actually
created and added to the pool when the pool is empty. Currently connections
are never closed once they are added to the pool.
Parameters: DbClient - A connection from the pool. |
admin | public Admin admin() throws Exception(Code) | | Return the administration object for this database.
The admin object for this database; |
close | public synchronized void close() throws Exception(Code) | | Close this database.
|
currentExternalTransaction | public ExternalTransaction currentExternalTransaction()(Code) | | Obtain the
ExternalTransaction that is assocaited to the
caller's thread or null, if there is no such transaction. This does not
necessarily mean that there is no transaction associated to this
thread at all. For example there might be an XA transaction.
The transaction that is associated to the caller's thread. See Also: ExternalDatabase.currentTransaction() |
forThread | public static ExternalDatabase forThread(Thread _thread)(Code) | | Static method to find a database connection that has an associated
transaction that has been joined by the given thread. Used by proxy
constructors to determine its database. This method returns the first
database that was found.
Parameters: _thread - The thread for which to find the corresponding database. The database for the given thread. |
getXAResource | final public XAResource getXAResource()(Code) | | Return a new XAResource for this database connection.
new XAResource. |
newConnection | abstract protected DbClient newConnection() throws Exception(Code) | | The way for the actual database types to create a corresponding
connection.
|
newTransaction | public ExternalTransaction newTransaction()(Code) | | Create a new transaction. Before using this transaction it must be started.
The newly created transaction. |
notifyProxyDeath | public void notifyProxyDeath(OzoneProxy proxy)(Code) | | Internal method. This method is called by
OzoneProxy s when they are dying (during finalize()). This
is required, as the database may track the references the database client has to objects within the database
in order to properly support garbage collection. If this method is called from anyone else than from the
OzoneProxy .finalize()-Method, data loss may occur!
Parameters: proxy - the OzoneProxy object which is dying. It may call this method exaclty once. |
open | protected void open(Hashtable _props) throws Exception(Code) | | Open this database connection according to the specified properties.
|
releasePooledConnection | final protected void releasePooledConnection(DbClient connection)(Code) | | Release a formerly acquired pooled connection so that it may used by
another request.
Parameters: connection - The pooled connection to be released See Also: ExternalDatabase.acquirePooledConnection |
sendCommand | final protected Object sendCommand(DbCommand command, boolean waitForResult) throws Exception(Code) | | Send the specified command to the server. If there is a global
transaction, its connection is used. Else, if the current thread is joined
to a transaction the connection of the transaction is used. Otherwise a
connection from the pool is used.
|
sendCommand | protected Object sendCommand(DbCommand command, boolean waitForResult, DbClient connection) throws Exception, ExceptionInOzoneObjectException(Code) | | Send the specified command to the server. Use the specified connection.
While working the connection is synchronized to allow multiple threads
to use this connection.
Parameters: waitForResult - true: read the result from the external database and return itfalse: do not read the result from the external database and return null.This is dangerous if not properly used. In this case, the resultis not read from the stream and left to be read from the next reader.As this is not desireable, only supply false if the command does not return any result. |
Fields inherited from org.ozoneDB.AbstractDatabase | final public static int DefaultAccessRight(Code)(Java Doc)
|
Methods inherited from org.ozoneDB.AbstractDatabase | public OzoneProxy createObject(String className) throws RuntimeException(Code)(Java Doc) public OzoneProxy createObject(String className, int access) throws RuntimeException(Code)(Java Doc) public OzoneProxy createObject(String className, int access, String objName) throws RuntimeException(Code)(Java Doc) public OzoneProxy createObject(String className, String sig, Object[] args) throws RuntimeException(Code)(Java Doc) public OzoneProxy createObject(Class type) throws RuntimeException(Code)(Java Doc) public OzoneProxy createObject(Class type, int access) throws RuntimeException(Code)(Java Doc) public OzoneProxy createObject(Class type, int access, String objName) throws RuntimeException(Code)(Java Doc) public OzoneProxy createObject(Class type, int access, String objName, String sig, Object[] args) throws RuntimeException(Code)(Java Doc) public OzoneProxy createObject(Class type, String sig, Object[] args) throws RuntimeException(Code)(Java Doc)
|
|
|