ozone API

org.ozoneDB
Class Database

java.lang.Object
  |
  +--org.ozoneDB.AbstractDatabase
        |
        +--org.ozoneDB.Database
All Implemented Interfaces:
OzoneInterface

public final class Database
extends org.ozoneDB.AbstractDatabase
implements OzoneInterface

This class represents the database for OzoneObjects within the server.

Note: The method parameters of type OzoneRemote are supposed to by proxy objects (of type OzoneProxy). However, since we are inside the server it's possible to pass an database object (of type OzoneCompatible) as a parameter. In this case the parameter should be substituted. Currently this is done by the invoke() method only.

Version:
$Revision: 1.3 $Date: 2002/06/08 00:49:38 $
Author:
SMB
, Medium.net
See Also:
OzoneInterface

Field Summary
static int DefaultAccessRight
           
 
Fields inherited from interface org.ozoneDB.OzoneInterface
AllLock, AllRead, GroupLock, GroupRead, Private, Public
 
Constructor Summary
Database()
           
Database(org.ozoneDB.core.Env _env)
           
 
Method Summary
 OzoneProxy copyObject(OzoneRemote rObj)
          Copy an object.
 OzoneProxy createObject(java.lang.Class type)
          Creates a database object of the specified class without a name and with default permissions.
 OzoneProxy createObject(java.lang.Class type, int access)
          Creates a database object of the specified class without a name and with the specified access rights.
 OzoneProxy createObject(java.lang.Class type, int access, java.lang.String objName)
          Creates a database object of the specified class with the specified name and the specified access rights.
 OzoneProxy createObject(java.lang.Class type, int access, java.lang.String objName, java.lang.String sig, java.lang.Object[] args)
          Creates an object by calling the constructor with the specified signature with the specified parameters.
 OzoneProxy createObject(java.lang.Class type, java.lang.String sig, java.lang.Object[] args)
          Creates an object by calling the constructor with the specified signature with the specified parameters and default permissions.
 OzoneProxy createObject(java.lang.String className)
          Creates a database object of the specified class without a name and with default permissions.
 OzoneProxy createObject(java.lang.String className, int access)
          Creates a database object of the specified class without a name and with the specified access rights.
 OzoneProxy createObject(java.lang.String className, int access, java.lang.String objName)
          Creates a database object of the specified class with the specified name and the specified access rights.
 OzoneProxy createObject(java.lang.String className, int access, java.lang.String objName, java.lang.String sig, java.lang.Object[] args)
          Creates an object by calling the constructor with the specified signature with the specified parameters.
 OzoneProxy createObject(java.lang.String className, java.lang.String sig, java.lang.Object[] args)
          Creates an object by calling the constructor with the specified signature with the specified parameters and default permissions.
 org.ozoneDB.core.User currentOwner()
           
 void deleteObject(OzoneRemote rObj)
          Deletes the specified database object.
 OzoneCompatible fetch(OzoneProxy rObj, int lockLevel)
          Returns the actual target of the given proxy if the actual implementation is able to do so.
 java.lang.Object invoke(OzoneProxy rObj, int methodIndex, java.lang.Object[] args, int lockLevel)
           
 java.lang.Object invoke(OzoneProxy rObj, java.lang.String methodName, java.lang.String sig, java.lang.Object[] args, int lockLevel)
          Invokes a method on the specified object.
 void nameObject(OzoneRemote rObj, java.lang.String name)
          Assigns the specified object with the specified name.
 void notifyProxyDeath(OzoneProxy proxy)
          Internal method.
 OzoneProxy objectForHandle(java.lang.String handle)
          Returns the object for the specified handle or null if there is no such object.
 OzoneProxy objectForName(java.lang.String name)
          Returns the object for the specifies name or null if there is no such object.
 OzoneProxy[] objectsOfClass(java.lang.String name)
          Gives all objects of the specified class as array.
 void reloadClasses()
          Force the database server to reload all classes which extend OzoneObject.
 void xmlForObject(OzoneRemote rObj, org.xml.sax.ContentHandler ch)
          Converts the specified object into XML.
 org.w3c.dom.Node xmlForObject(OzoneRemote rObj, org.w3c.dom.Document domFactory)
          Convert the specified object into XML.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.ozoneDB.OzoneInterface
createObject, createObject, createObject, createObject, createObject, createObject, createObject, createObject, createObject
 

Field Detail

DefaultAccessRight

public static final int DefaultAccessRight
See Also:
Constant Field Values
Constructor Detail

Database

public Database()

Database

public Database(org.ozoneDB.core.Env _env)
Method Detail

reloadClasses

public void reloadClasses()
                   throws java.lang.Exception
Description copied from interface: OzoneInterface
Force the database server to reload all classes which extend OzoneObject. This is particularly useful while testing new classes.

Specified by:
reloadClasses in interface OzoneInterface
java.lang.Exception

currentOwner

public org.ozoneDB.core.User currentOwner()

createObject

public OzoneProxy createObject(java.lang.String className,
                               int access,
                               java.lang.String objName,
                               java.lang.String sig,
                               java.lang.Object[] args)
                        throws java.lang.RuntimeException,
                               ExceptionInOzoneObjectException
Description copied from interface: OzoneInterface
Creates an object by calling the constructor with the specified signature with the specified parameters. Generated proxy objects use this method.

Specified by:
createObject in interface OzoneInterface
Parameters:
className - fully qualified name of the class
access - access right (ORed)
objName - name of the object (optional
sig - The signature string of the constructor.
args - The parameter that are passed to the constructor.
Returns:
proxy A OzoneProxy object for the newly created object.
java.lang.RuntimeException
ExceptionInOzoneObjectException

copyObject

public OzoneProxy copyObject(OzoneRemote rObj)
                      throws java.lang.Exception
Description copied from interface: OzoneInterface
Copy an object. The new objects gets its own object ID. The specified object is an instance of OzoneProxy which you may have created by createObject().

Specified by:
copyObject in interface OzoneInterface
Parameters:
rObj -
Returns:
proxy for the newly created object
java.lang.Exception

deleteObject

public void deleteObject(OzoneRemote rObj)
                  throws java.lang.RuntimeException,
                         ExceptionInOzoneObjectException
Description copied from interface: OzoneInterface
Deletes the specified database object. The specified object is an instance of OzoneProxy which you may have created by createObject().

Specified by:
deleteObject in interface OzoneInterface
Parameters:
rObj -
java.lang.RuntimeException
ExceptionInOzoneObjectException

nameObject

public void nameObject(OzoneRemote rObj,
                       java.lang.String name)
                throws java.lang.Exception
Description copied from interface: OzoneInterface
Assigns the specified object with the specified name. This can also be done at object creation time. The specified object is an instance of OzoneProxy which you may have created by createObject().

Specified by:
nameObject in interface OzoneInterface
Parameters:
rObj -
name -
java.lang.Exception

objectForName

public OzoneProxy objectForName(java.lang.String name)
                         throws java.lang.Exception
Description copied from interface: OzoneInterface
Returns the object for the specifies name or null if there is no such object.

Specified by:
objectForName in interface OzoneInterface
Returns:
A proxy object for the found object or null.
java.lang.Exception

objectForHandle

public OzoneProxy objectForHandle(java.lang.String handle)
                           throws java.lang.Exception
Description copied from interface: OzoneInterface
Returns the object for the specified handle or null if there is no such object.

Specified by:
objectForHandle in interface OzoneInterface
Returns:
A proxy object for the found object or null.
java.lang.Exception

objectsOfClass

public OzoneProxy[] objectsOfClass(java.lang.String name)
                            throws java.lang.Exception
Description copied from interface: OzoneInterface
Gives all objects of the specified class as array.

Specified by:
objectsOfClass in interface OzoneInterface
Parameters:
name -
Returns:
java.lang.Exception

invoke

public java.lang.Object invoke(OzoneProxy rObj,
                               java.lang.String methodName,
                               java.lang.String sig,
                               java.lang.Object[] args,
                               int lockLevel)
                        throws java.lang.Exception
Description copied from interface: OzoneInterface
Invokes a method on the specified object. This method is called by proxy objects to route the call to the corresponding database object. A client will never call this method explicitly.

Specified by:
invoke in interface OzoneInterface
Parameters:
rObj - OzoneProxy on which to call the method
methodName -
sig - signature of the method as String
args - array of arguments
Returns:
regular object or proxy
java.lang.Exception

invoke

public java.lang.Object invoke(OzoneProxy rObj,
                               int methodIndex,
                               java.lang.Object[] args,
                               int lockLevel)
                        throws java.lang.Exception
Specified by:
invoke in interface OzoneInterface
java.lang.Exception

fetch

public OzoneCompatible fetch(OzoneProxy rObj,
                             int lockLevel)
                      throws java.lang.Exception
Description copied from interface: OzoneInterface
Returns the actual target of the given proxy if the actual implementation is able to do so. A client will never call this method explicitly.

Specified by:
fetch in interface OzoneInterface
java.lang.Exception

xmlForObject

public org.w3c.dom.Node xmlForObject(OzoneRemote rObj,
                                     org.w3c.dom.Document domFactory)
                              throws java.lang.Exception
Description copied from interface: OzoneInterface
Convert the specified object into XML. This method returns the generated XML data as DOM tree. For performance reasons you should try to use OzoneInterface.xmlForObject(OzoneRemote, ContentHandler), which returns SAX events, instead of DOM. See the doc directory of ozone for a detailed description (XML Schema) of the XML output of this method.

Specified by:
xmlForObject in interface OzoneInterface
Parameters:
rObj - The database object to be converted.
java.lang.Exception

xmlForObject

public void xmlForObject(OzoneRemote rObj,
                         org.xml.sax.ContentHandler ch)
                  throws java.lang.Exception
Description copied from interface: OzoneInterface
Converts the specified object into XML. This method returns the generated XML data as SAX events. See the doc directory of ozone for a detailed description (XML Schema) of the XML output of this method.

Specified by:
xmlForObject in interface OzoneInterface
Parameters:
rObj - The database object to be converted.
ch - The SAX ContentHandler to which the result is sent.
java.lang.Exception

notifyProxyDeath

public void notifyProxyDeath(OzoneProxy proxy)
Internal method. This method is called by OzoneProxys when they are dying (during finalize()). This is required, as the database may track the references the database client has to objects within the database in order to properly support garbage collection. If this method is called from anyone else than from the OzoneProxy.finalize()-Method, data loss may occur!

Specified by:
notifyProxyDeath in interface OzoneInterface
Parameters:
proxy - the OzoneProxy object which is dying. It may call this method exaclty once.

createObject

public OzoneProxy createObject(java.lang.String className)
                        throws java.lang.RuntimeException
Description copied from interface: OzoneInterface
Creates a database object of the specified class without a name and with default permissions.

Specified by:
createObject in interface OzoneInterface
Parameters:
className - The fully qualified name of the class.
Returns:
A proxy object for the newly created object.
java.lang.RuntimeException

createObject

public OzoneProxy createObject(java.lang.String className,
                               int access)
                        throws java.lang.RuntimeException
Description copied from interface: OzoneInterface
Creates a database object of the specified class without a name and with the specified access rights.

Specified by:
createObject in interface OzoneInterface
Parameters:
className - The fully qualified name of the class.
access - The access rights (ORed).
Returns:
proxy A proxy object for the newly created database object.
java.lang.RuntimeException

createObject

public OzoneProxy createObject(java.lang.String className,
                               int access,
                               java.lang.String objName)
                        throws java.lang.RuntimeException
Description copied from interface: OzoneInterface
Creates a database object of the specified class with the specified name and the specified access rights.

Specified by:
createObject in interface OzoneInterface
Parameters:
className - The fully qualified name of the class.
access - The access right. (ORed)
objName - The name of the object. (optional)
Returns:
A proxy object for the newly created object.
java.lang.RuntimeException

createObject

public OzoneProxy createObject(java.lang.String className,
                               java.lang.String sig,
                               java.lang.Object[] args)
                        throws java.lang.RuntimeException
Description copied from interface: OzoneInterface
Creates an object by calling the constructor with the specified signature with the specified parameters and default permissions.

Specified by:
createObject in interface OzoneInterface
Parameters:
className - fully qualified name of the class
sig - The signature string of the constructor.
args - The parameter that are passed to the constructor.
Returns:
proxy A OzoneProxy object for the newly created object.
java.lang.RuntimeException

createObject

public OzoneProxy createObject(java.lang.Class type)
                        throws java.lang.RuntimeException
Description copied from interface: OzoneInterface
Creates a database object of the specified class without a name and with default permissions.

Specified by:
createObject in interface OzoneInterface
Parameters:
type - the type of the object to be created
Returns:
A proxy object for the newly created object.
java.lang.RuntimeException

createObject

public OzoneProxy createObject(java.lang.Class type,
                               int access)
                        throws java.lang.RuntimeException
Description copied from interface: OzoneInterface
Creates a database object of the specified class without a name and with the specified access rights.

Specified by:
createObject in interface OzoneInterface
Parameters:
type - the type of the object to be created
access - The access rights (ORed).
Returns:
proxy A proxy object for the newly created database object.
java.lang.RuntimeException

createObject

public OzoneProxy createObject(java.lang.Class type,
                               int access,
                               java.lang.String objName)
                        throws java.lang.RuntimeException
Description copied from interface: OzoneInterface
Creates a database object of the specified class with the specified name and the specified access rights.

Specified by:
createObject in interface OzoneInterface
Parameters:
type - the type of the object to be created
access - The access right. (ORed)
objName - The name of the object. (optional)
Returns:
A proxy object for the newly created object.
java.lang.RuntimeException

createObject

public OzoneProxy createObject(java.lang.Class type,
                               int access,
                               java.lang.String objName,
                               java.lang.String sig,
                               java.lang.Object[] args)
                        throws java.lang.RuntimeException
Description copied from interface: OzoneInterface
Creates an object by calling the constructor with the specified signature with the specified parameters. Generated proxy objects use this method.

Specified by:
createObject in interface OzoneInterface
Parameters:
type - the type of the object to be created
access - access right (ORed)
objName - name of the object (optional
sig - The signature string of the constructor.
args - The parameter that are passed to the constructor.
Returns:
proxy A OzoneProxy object for the newly created object.
java.lang.RuntimeException

createObject

public OzoneProxy createObject(java.lang.Class type,
                               java.lang.String sig,
                               java.lang.Object[] args)
                        throws java.lang.RuntimeException
Description copied from interface: OzoneInterface
Creates an object by calling the constructor with the specified signature with the specified parameters and default permissions.

Specified by:
createObject in interface OzoneInterface
Parameters:
type - the type of the object to be created
sig - The signature string of the constructor.
args - The parameter that are passed to the constructor.
Returns:
proxy A OzoneProxy object for the newly created object.
java.lang.RuntimeException

ozone API

Copyright (C) The Ozone Database Project - www.ozone-db.org. All rights reserved.