org.omegahat.Environment.Databases
Interface Database

All Superinterfaces:
Activable
All Known Subinterfaces:
BasicFrameInt, DatabaseNotifier, DataFrameInt, TypedDatabaseInt
All Known Implementing Classes:
ObjectDatabase, OrderedTable, AttachableSearchPath, ModelPointDatabase, NamingServiceDatabase, AttachableInterfaceRepository

public interface Database
extends Activable

Interface for object databases

Object databases in Omegahat extend the concept of hash-table databases in Java (e.g.,

See Also:
)

Additional concepts include the notion of attaching/detaching the database from the Omegahat interactive session, the use of listeners to detect events on the database, and a more general attitude to what can be assigned.


Field Summary
static int ALL
           
static int ASSIGN
           
static int ATTACH
           
static int DETACH
          This and following fields, down through ALL are used to identify event types for listeners.
static java.lang.String NULL_ENTRY
          the constant object stored to correspond to a null assignment.
static int READ
           
static int READ_WRITE
          database access constants, thinking about a multi-user system.
static int REMOVE
           
 
Fields inherited from interface org.omegahat.Environment.Databases.Activable
ACTIVE, INACTIVE
 
Method Summary
 boolean assign(java.lang.String name, java.lang.Object obj)
          assigns obj to the database under name.
 boolean attach(DatabaseCustomer e)
           
 void clear()
          remove all the objects from the database.
 boolean detach(DatabaseCustomer e)
           
 boolean exists(java.lang.String name)
          does the object exist in the database?
 java.lang.Object get(java.lang.String name)
          returns the object in the database assigned under the name.
 java.lang.String getName()
           
 java.lang.String[] objects()
          the array of object names.
 java.lang.Object remove(java.lang.String name)
          remove the object from the database
 java.lang.String setName(java.lang.String name)
           
 int size()
          what is the size (in bytes?) of the database.
 
Methods inherited from interface org.omegahat.Environment.Databases.Activable
getState, setState
 

Field Detail

DETACH

public static final int DETACH
This and following fields, down through ALL are used to identify event types for listeners.

ATTACH

public static final int ATTACH

ASSIGN

public static final int ASSIGN

REMOVE

public static final int REMOVE

ALL

public static final int ALL

READ_WRITE

public static final int READ_WRITE
database access constants, thinking about a multi-user system.

READ

public static final int READ

NULL_ENTRY

public static final java.lang.String NULL_ENTRY
the constant object stored to correspond to a null assignment.
Method Detail

objects

public java.lang.String[] objects()
the array of object names.

get

public java.lang.Object get(java.lang.String name)
returns the object in the database assigned under the name. or null if none.

assign

public boolean assign(java.lang.String name,
                      java.lang.Object obj)
               throws java.lang.Exception
assigns obj to the database under name.
Parameters:
obj - any object, including null
name - a string (preferably non-empty) to locate the object in the database.

remove

public java.lang.Object remove(java.lang.String name)
remove the object from the database
Parameters:
name - any string, matching the one used in a previous assignment.

exists

public boolean exists(java.lang.String name)
does the object exist in the database?

clear

public void clear()
remove all the objects from the database.

size

public int size()
what is the size (in bytes?) of the database.

detach

public boolean detach(DatabaseCustomer e)

attach

public boolean attach(DatabaseCustomer e)

getName

public java.lang.String getName()

setName

public java.lang.String setName(java.lang.String name)