aspoev.manager
Class DatabaseManager

java.lang.Object
  extended byaspoev.manager.DatabaseManager

public class DatabaseManager
extends java.lang.Object

This class acts as an intermedary between a database system and the Vejal interpreter (aspoev.interpreter.Interpreter). This class stores not only persistent application objects, but also intermediary classes that describe schema evolution, instance adaptation, etc. The actual purpose of this class, however, is to provide a clear point of access (hot spots) for Schema Evolution and Instance adaptation aspects that will comprise the 'AspOEv' framework.


Field Summary
protected  pJ.jasmine.Transaction currentTransaction
           
protected  pJ.jasmine.Database database
           
protected  java.lang.String description
           
static int READ_ONLY
           
static int READ_WRITE
           
protected  int TRANS_NUM
           
protected  java.lang.Thread transactionThread
           
protected  pJ.jasmine.Hashtab typeMap
           
 
Constructor Summary
DatabaseManager()
          Connect to local Database.
DatabaseManager(java.lang.String remoteMethodInvocation)
           
 
Method Summary
 void abortTransaction()
          Aborts the transaciton in progress.
 void addType(ClassDeclarationElement newClass)
          Add the given class version to the database.
 java.lang.String bind(java.lang.String name, java.lang.Object object)
          Creates an association in the database between the specified string and object, much like a Hash table entry.
 void close()
          Commits state objects and closes database.
 void commitTransaction()
          Closes the transaciton in progress.
 void deletePersistent(java.lang.Object discard)
          Removes the argument object from the persistent store.
 MetaObject getByObjectID(java.lang.Object OID)
          Retrieve an object by its unique identifier.
 ClassDeclarationElement getClassDeclaration(TypeReferenceElement type)
          Returns the persistent class declaration for the specified type.
 TypeReferenceElement getCurrentVersion(TypeReferenceElement type)
          Returns the highest version number of the type defined in the database.
 QueryEnumeration getDefinedClasses()
           
 QueryEnumeration getTypeExtent()
          Returns all persistent types.
 QueryEnumeration getTypeVersionExtent(TypeReferenceElement type)
          Retrieves all defined versions of the type stored in the database.
 QueryEnumeration getVersionObjectExtent(TypeReferenceElement type)
          Retrieves all objects of the specified type in the database.
 java.lang.Object lookup(java.lang.String name)
          Returns the object associated with the specified name in the database.
 MetaObject makePersistent(MetaObject mo)
          Makes the argument object persistent.
 void open()
          Creates a local connection to the database.
 void open(java.lang.String name)
          Opens a local connection to the database with the specified name.
 pJ.jasmine.Transaction startTransaction()
          Start a transaction without specifing a name.
 pJ.jasmine.Transaction startTransaction(java.lang.String transName)
          This method creates a transaction within the database.
 java.lang.String toString()
           
 java.lang.Object unbind(java.lang.String name)
           
 QueryEnumeration where(TypeReferenceElement type)
           
 QueryEnumeration where(TypeReferenceElement type, int count)
           
 QueryEnumeration where(TypeReferenceElement type, java.lang.String condition)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

READ_ONLY

public static final int READ_ONLY
See Also:
Constant Field Values

READ_WRITE

public static final int READ_WRITE
See Also:
Constant Field Values

TRANS_NUM

protected int TRANS_NUM

currentTransaction

protected pJ.jasmine.Transaction currentTransaction

transactionThread

protected java.lang.Thread transactionThread

database

protected pJ.jasmine.Database database

description

protected java.lang.String description

typeMap

protected pJ.jasmine.Hashtab typeMap
Constructor Detail

DatabaseManager

public DatabaseManager()
Connect to local Database.


DatabaseManager

public DatabaseManager(java.lang.String remoteMethodInvocation)
Method Detail

abortTransaction

public void abortTransaction()
Aborts the transaciton in progress.


addType

public void addType(ClassDeclarationElement newClass)
Add the given class version to the database.

Parameters:
newClass - The type definition to be made persistent

bind

public java.lang.String bind(java.lang.String name,
                             java.lang.Object object)
Creates an association in the database between the specified string and object, much like a Hash table entry. Returns previous name associated with the object

Parameters:
name - The name to be associated with the object in the database
object - The object to be bound to the provided name

close

public void close()
Commits state objects and closes database.


commitTransaction

public void commitTransaction()
Closes the transaciton in progress. Permits threads waiting to start a transaction to continue.


deletePersistent

public void deletePersistent(java.lang.Object discard)
Removes the argument object from the persistent store.

Parameters:
discard - The object to be removed from the persistent store

getByObjectID

public MetaObject getByObjectID(java.lang.Object OID)
Retrieve an object by its unique identifier.


getClassDeclaration

public ClassDeclarationElement getClassDeclaration(TypeReferenceElement type)
Returns the persistent class declaration for the specified type.

Parameters:
type - The type to retrieve the declaration of.

getCurrentVersion

public TypeReferenceElement getCurrentVersion(TypeReferenceElement type)
Returns the highest version number of the type defined in the database.

Parameters:
type - The type to retrieve the current version of.

getDefinedClasses

public QueryEnumeration getDefinedClasses()

getTypeExtent

public QueryEnumeration getTypeExtent()
Returns all persistent types. (Including all versions of types)


getTypeVersionExtent

public QueryEnumeration getTypeVersionExtent(TypeReferenceElement type)
Retrieves all defined versions of the type stored in the database.

Parameters:
type - The type to retrieve the version extent of.

getVersionObjectExtent

public QueryEnumeration getVersionObjectExtent(TypeReferenceElement type)
Retrieves all objects of the specified type in the database.

Parameters:
type - The type to retrieve the object extent of.

lookup

public java.lang.Object lookup(java.lang.String name)
Returns the object associated with the specified name in the database.

Parameters:
name - The associated name of the object to retrieve

makePersistent

public MetaObject makePersistent(MetaObject mo)
Makes the argument object persistent.

Parameters:
mo - The meta object to make persistent.

open

public void open()
Creates a local connection to the database.


open

public void open(java.lang.String name)
Opens a local connection to the database with the specified name. This operation is currently unsupported.

Parameters:
name - The name of the database to open.

startTransaction

public pJ.jasmine.Transaction startTransaction()
Start a transaction without specifing a name.


startTransaction

public pJ.jasmine.Transaction startTransaction(java.lang.String transName)
This method creates a transaction within the database. If a transaction is already in progress in another thread, this method causes the current method to wait until the transaction finishes. Note that nested transactions are not supported by the underlying database Jasmine.

Parameters:
transName - The name of the transaction to start
Returns:
A Transaction object representing the transaction started.
See Also:
Transaction

unbind

public java.lang.Object unbind(java.lang.String name)

where

public QueryEnumeration where(TypeReferenceElement type)

where

public QueryEnumeration where(TypeReferenceElement type,
                              java.lang.String condition)

where

public QueryEnumeration where(TypeReferenceElement type,
                              int count)

toString

public java.lang.String toString()