org.exolab.core.foundation
Interface DatabaseIfc

All Known Implementing Classes:
PageManagedDatabase

public interface DatabaseIfc

This interface attempts to abstract the database layer so that is can support several types of persistent storss. including file, OODBMS and RDBMS. It concept of root objects is borrowed from the OODBMS to represent named objects,

A database works on PersistentObjects, which have unique object identifier. and can be inserted, updated or removed from the database. They can also be fetched if the 'id' of the particular object is known. In some instances an object can be bound to a name.Similarly, the same object can be unbound or looked by name. Unbinding an object does not remove the object from the database since it can still be located by object id.

Version:
$Revision: 1.3 $ $Date: 2000/03/09 23:52:43 $
Author:
Jim Alateras
See Also:
DatabaseManagerIfc, PersistentCapableIfc

Method Summary
 void bind(java.lang.String name, PersistentCapableIfc object)
          Bind the specified name to an object.
 void close()
          Close this database.
 void delete(PersistentCapableIfc object)
          Delete the specified object form the database.
 java.util.Enumeration getRootNames()
          Return an enumeration of all the database root names.
 void insert(PersistentCapableIfc object)
          Insert the specified object into the database.
 boolean isBound(java.lang.String name)
          Check if an object is already bound to the specified name
 boolean isOpen()
          Test if the database is open
 PersistentCapableIfc lookup(java.lang.String name)
          Lookup the object specified by name.
 void open()
          Opens the specified database.
 void unbind(java.lang.String name)
          Unbind the object associated with the specified name.
 void update(PersistentCapableIfc object)
          Update the specified object form the database.
 

Method Detail

open

void open()
          throws FailedToOpenDatabaseException
Opens the specified database. If it fails to open the database then it throws the FailedToOpenDatabase

Throws:
FailedToOpenDatabaseException

close

void close()
Close this database. If it is already closed then this becomes a no-op


isOpen

boolean isOpen()
Test if the database is open

Returns:
boolean true if it open and false otherwise

getRootNames

java.util.Enumeration getRootNames()
Return an enumeration of all the database root names. A database root is one that is bound by name and represents an entry point in the database.

Returns:
Enumeration collection of root names (i.e .string)

bind

void bind(java.lang.String name,
          PersistentCapableIfc object)
          throws ObjectNameExistsException,
                 DatabaseIOException
Bind the specified name to an object. All bound objects are actually database roots. If an object is already bound to this name the method throws the ObjectNameExistsException .

Parameters:
name - binding name
object - object to bind
Throws:
ObjectNameExistsException
DatabaseIOException

unbind

void unbind(java.lang.String name)
            throws ObjectNameNotFoundException,
                   DatabaseIOException
Unbind the object associated with the specified name. IF the name does not exist then throw the ObjectNameNotFoundException

Parameters:
name - binding name
Throws:
ObjectNameNotFoundException
DatabaseIOException

lookup

PersistentCapableIfc lookup(java.lang.String name)
Lookup the object specified by name. If the object does not exists then return null.

Parameters:
name - lookup name
Returns:
PersistentCapableIfc

isBound

boolean isBound(java.lang.String name)
Check if an object is already bound to the specified name

Parameters:
name - lookup name
Returns:
boolean true if name is bound to object

insert

void insert(PersistentCapableIfc object)
            throws DatabaseIOException
Insert the specified object into the database. Throw DatabaseIOException if there is any problem

Parameters:
object - object to store
Throws:
DatabaseIOException

delete

void delete(PersistentCapableIfc object)
            throws DatabaseIOException
Delete the specified object form the database. Throw DatabaseIOException if there are any errors

Parameters:
object - object to delete
Throws:
DatabaseIOException

update

void update(PersistentCapableIfc object)
            throws DatabaseIOException
Update the specified object form the database. Throw DatabaseIOException if there are any errors

Parameters:
object - object to update
Throws:
DatabaseIOException


Copyright © 1999-2012 The Exolab Group. All Rights Reserved.