ojb.odmg
Class DatabaseImpl

java.lang.Object
  |
  +--ojb.odmg.DatabaseImpl
All Implemented Interfaces:
Database

public class DatabaseImpl
extends java.lang.Object
implements Database

Class declaration

Version:
%I%, %G%
Author:

Field Summary
 
Fields inherited from interface org.odmg.Database
NOT_OPEN, OPEN_EXCLUSIVE, OPEN_READ_ONLY, OPEN_READ_WRITE
 
Constructor Summary
DatabaseImpl()
          Creates new DatabaseImpl
 
Method Summary
 void bind(java.lang.Object object, java.lang.String name)
          Associate a name with an object and make it persistent.
 void close()
          Close the database.
 void deletePersistent(java.lang.Object object)
          Deletes an object from the database.
 NamedRootsMap getNamedRootsMap()
          Insert the method's description here.
 java.lang.Object lookup(java.lang.String name)
          Lookup an object via its name.
 void makePersistent(java.lang.Object object)
          Make a transient object durable in the database.
 void open(java.lang.String name, int accessMode)
          Open the named database with the specified access mode.
 void unbind(java.lang.String name)
          Disassociate a name with an object
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DatabaseImpl

public DatabaseImpl()
Creates new DatabaseImpl

Method Detail

open

public void open(java.lang.String name,
                 int accessMode)
          throws ODMGException
Open the named database with the specified access mode. Attempts to open a database when it has already been opened will result in the throwing of the exception DatabaseOpenException. A DatabaseNotFoundException is thrown if the database does not exist. Some implementations may throw additional exceptions that are also derived from ODMGException.

Specified by:
open in interface Database
Parameters:
name - The name of the database.
accessMode - The access mode, which should be one of the static fields: OPEN_READ_ONLY, OPEN_READ_WRITE, or OPEN_EXCLUSIVE.
Throws:
ODMGException - The database could not be opened.

close

public void close()
           throws ODMGException
Close the database. After you have closed a database, further attempts to access objects in the database will cause the exception DatabaseClosedException to be thrown. Some implementations may throw additional exceptions that are also derived from ODMGException.

Specified by:
close in interface Database
Throws:
ODMGException - Unable to close the database.

bind

public void bind(java.lang.Object object,
                 java.lang.String name)
          throws ObjectNameNotUniqueException
Associate a name with an object and make it persistent. An object instance may be bound to more than one name. Binding a previously transient object to a name makes that object persistent.

Specified by:
bind in interface Database
Parameters:
object - The object to be named.
name - The name to be given to the object.
Throws:
ObjectNameNotUniqueException - If an attempt is made to bind a name to an object and that name is already bound to an object.

lookup

public java.lang.Object lookup(java.lang.String name)
                        throws ObjectNameNotFoundException
Lookup an object via its name.

Specified by:
lookup in interface Database
Parameters:
name - The name of an object.
Returns:
The object with that name.
Throws:
ObjectNameNotFoundExceptionThere - is no object with the specified name. ObjectNameNotFoundException
ObjectNameNotFoundException - There is no object with the specified name.
See Also:
ObjectNameNotFoundException

unbind

public void unbind(java.lang.String name)
            throws ObjectNameNotFoundException
Disassociate a name with an object

Specified by:
unbind in interface Database
Parameters:
name - The name of an object.
Throws:
ObjectNameNotFoundException - No object exists in the database with that name.

makePersistent

public void makePersistent(java.lang.Object object)
Make a transient object durable in the database. It must be executed in the context of an open transaction. If the transaction in which this method is executed commits, then the object is made durable. If the transaction aborts, then the makePersistent operation is considered not to have been executed, and the target object is again transient. ClassNotPersistenceCapableException is thrown if the implementation cannot make the object persistent because of the type of the object.

Specified by:
makePersistent in interface Database
Parameters:
object - The object to make persistent.
Throws:
TransactionNotInProgressException - if there is no current transaction.

deletePersistent

public void deletePersistent(java.lang.Object object)
Deletes an object from the database. It must be executed in the context of an open transaction. If the object is not persistent, then ObjectNotPersistent is thrown. If the transaction in which this method is executed commits, then the object is removed from the database. If the transaction aborts, then the deletePersistent operation is considered not to have been executed, and the target object is again in the database.

Specified by:
deletePersistent in interface Database
Parameters:
object - The object to delete.

getNamedRootsMap

public NamedRootsMap getNamedRootsMap()
Insert the method's description here. Creation date: (11.01.2001 19:31:17)

Returns:
ojb.server.NamedRootsMap


Authors: Thomas Mahler and others. (C) 2000, 2001.
All rights reserved. Published under the Gnu Public License.
http://objectbridge.sourceforge.net
Version: 0.8.375, 2002-04-04