|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Database
The 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 method lookup
facilitates
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.
Field Summary | |
---|---|
static int |
NOT_OPEN
The database is not open. |
static int |
OPEN_EXCLUSIVE
The database is open for exclusive access. |
static int |
OPEN_READ_ONLY
The database is opened for read-only access. |
static int |
OPEN_READ_WRITE
The database is opened for reading and writing. |
Method Summary | |
---|---|
void |
bind(Object object,
String name)
Associate a name with an object and make it persistent. |
void |
close()
Close the database. |
void |
deletePersistent(Object object)
Deletes an object from the database. |
Object |
lookup(String name)
Lookup an object via its name. |
void |
makePersistent(Object object)
Make a transient object durable in the database. |
void |
open(String name,
int accessMode)
Open the named database with the specified access mode. |
void |
unbind(String name)
Disassociate a name with an object |
Field Detail |
---|
static final int NOT_OPEN
static final int OPEN_READ_ONLY
static final int OPEN_READ_WRITE
static final int OPEN_EXCLUSIVE
Method Detail |
---|
void open(String name, int accessMode) throws ODMGException
DatabaseOpenException
.
A DatabaseNotFoundException
is thrown if the database does not exist.
Some implementations may throw additional exceptions that are also derived from
ODMGException
.
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
.
ODMGException
- The database could not be opened.void close() throws ODMGException
DatabaseClosedException
to be thrown.
Some implementations may throw additional exceptions that are also derived
from ODMGException
.
ODMGException
- Unable to close the database.void bind(Object object, String name) throws ObjectNameNotUniqueException
object
- The object to be named.name
- The name to be given to the object.
ObjectNameNotUniqueException
- If an attempt is made to bind a name to an object and that name is already bound
to an object.Object lookup(String name) throws ObjectNameNotFoundException
name
- The name of an object.
ObjectNameNotFoundException
- There is no object with the specified name.ObjectNameNotFoundException
void unbind(String name) throws ObjectNameNotFoundException
name
- The name of an object.
ObjectNameNotFoundException
- No object exists in the database with that name.void makePersistent(Object object)
object
- The object to make persistent.void deletePersistent(Object object)
object
- The object to delete.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |