Package org.odmg
Interface Database
-
- All Known Implementing Classes:
RasDatabase
public interface DatabaseThe interface for interacting with an ODMG database. Databases must be opened before starting any transactions that use the database and closed after ending these transactions.A database application generally begins processing by accessing one or more critical objects and proceeding from there. These objects are root objects, because they lead to interconnected webs of other objects. The ability to name an object (using method
bind) and retrieve it later by that name (using methodlookupfacilitates this start-up capability. A name is not explicitly defined as an attribute of an object. Naming an object also makes it persistent.There is a single flat name scope per database; thus all names in a particular database are unique.
- Author:
- David Jordan (as Java Editor of the Object Data Management Group)
-
-
Field Summary
Fields Modifier and Type Field Description static intNOT_OPENThe database is not open.static intOPEN_EXCLUSIVEThe database is open for exclusive access.static intOPEN_READ_ONLYThe database is opened for read-only access.static intOPEN_READ_WRITEThe database is opened for reading and writing.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidbind(java.lang.Object object, java.lang.String name)Associate a name with an object and make it persistent,
not yet available in RasDaMan.voidclose()Close the database.voiddeletePersistent(java.lang.Object object)Deletes an object from the database,
not yet available in RasDaMan.java.lang.Objectlookup(java.lang.String name)Lookup an object via its name,
not yet available in RasDaMan.voidmakePersistent(java.lang.Object object)Make a transient object durable in the database,
not yet available in RasDaMan.voidopen(java.lang.String name, int accessMode)Open the named database with the specified access mode.voidunbind(java.lang.String name)Disassociate a name with an object,
not yet available in RasDaMan.
-
-
-
Field Detail
-
NOT_OPEN
static final int NOT_OPEN
The database is not open.- See Also:
- Constant Field Values
-
OPEN_READ_ONLY
static final int OPEN_READ_ONLY
The database is opened for read-only access.- See Also:
- Constant Field Values
-
OPEN_READ_WRITE
static final int OPEN_READ_WRITE
The database is opened for reading and writing.- See Also:
- Constant Field Values
-
OPEN_EXCLUSIVE
static final int OPEN_EXCLUSIVE
The database is open for exclusive access.- See Also:
- Constant Field Values
-
-
Method Detail
-
open
void open(java.lang.String name, int accessMode) throws ODMGExceptionOpen 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 exceptionDatabaseOpenException. ADatabaseNotFoundExceptionis thrown if the database does not exist. Some implementations may throw additional exceptions that are also derived fromODMGException.- 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, orOPEN_EXCLUSIVE.- Throws:
ODMGException- The database could not be opened.
-
close
void close() throws ODMGExceptionClose the database. After you have closed a database, further attempts to access objects in the database will cause the exceptionDatabaseClosedExceptionto be thrown. Some implementations may throw additional exceptions that are also derived fromODMGException.- Throws:
ODMGException- Unable to close the database.
-
bind
void bind(java.lang.Object object, java.lang.String name) throws ObjectNameNotUniqueExceptionAssociate a name with an object and make it persistent,
not yet available in RasDaMan. An object instance may be bound to more than one name. Binding a previously transient object to a name makes that object persistent.- 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
java.lang.Object lookup(java.lang.String name) throws ObjectNameNotFoundExceptionLookup an object via its name,
not yet available in RasDaMan.- Parameters:
name- The name of an object.- Returns:
- The object with that name.
- Throws:
ObjectNameNotFoundException- There is no object with the specified name.- See Also:
ObjectNameNotFoundException
-
unbind
void unbind(java.lang.String name) throws ObjectNameNotFoundExceptionDisassociate a name with an object,
not yet available in RasDaMan.- Parameters:
name- The name of an object.- Throws:
ObjectNameNotFoundException- No object exists in the database with that name.
-
makePersistent
void makePersistent(java.lang.Object object)
Make a transient object durable in the database,
not yet available in RasDaMan. 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.- Parameters:
object- The object to make persistent.
-
deletePersistent
void deletePersistent(java.lang.Object object)
Deletes an object from the database,
not yet available in RasDaMan. 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.- Parameters:
object- The object to delete.
-
-