ozone API

org.ozoneDB
Class OzoneObject

java.lang.Object
  extended byorg.ozoneDB.OzoneObject
All Implemented Interfaces:
OzoneCompatible, OzoneCompatibleOrProxy, java.io.Serializable

public class OzoneObject
extends java.lang.Object
implements OzoneCompatible

This class can be extended to build actual database objects. It provides a default implementation of the OzoneCompatible interface.

Version:
$Revision: 1.15 $Date: 2003/12/06 20:59:44 $
Author:
SMB
See Also:
Serialized Form

Constructor Summary
OzoneObject()
           
 
Method Summary
 org.ozoneDB.core.ObjectContainer container()
          Return the container of the receiver.
 OzoneInterface database()
          Return the database link
 void deleteRecursive()
           
 boolean equals(java.lang.Object o)
          Returns wether or not the passed object is equal to this object.
 java.lang.String getHandle()
          Retrieves a handle to a specific instance of an OzoneObject.
 org.ozoneDB.core.ObjectID getObjectID()
          Returns the ObjectID of the represented ozone object.
 java.lang.String handle()
          Deprecated. use getHandle()
 int hashCode()
           
 void onActivate()
          This method will be automaticly called immediately after this object is loaded (deserialized) from storage.
 void onCreate()
          This default implementation of the onCreate() method does nothing.
 void onDelete()
          This default implementation of the onDelete() method does nothing.
 void onPassivate()
          This method will be automaticly called immediately before this object is stored (serialized) to storage.
 OzoneProxy self()
          Return a proxy for the receiver.
 void setContainer(org.ozoneDB.core.ObjectContainer _container)
          Set the container of the receiver.
 java.lang.String toString()
           
 boolean toXML(org.xml.sax.ContentHandler ch)
          This default implementation of the toSAX() method.
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

OzoneObject

public OzoneObject()
Method Detail

hashCode

public int hashCode()

setContainer

public void setContainer(org.ozoneDB.core.ObjectContainer _container)
Description copied from interface: OzoneCompatible
Set the container of the receiver. The member that holds the actual reference must be transient.

Specified by:
setContainer in interface OzoneCompatible

self

public OzoneProxy self()
Description copied from interface: OzoneCompatible
Return a proxy for the receiver.

Specified by:
self in interface OzoneCompatible

container

public org.ozoneDB.core.ObjectContainer container()
Description copied from interface: OzoneCompatible
Return the container of the receiver.

Specified by:
container in interface OzoneCompatible

getHandle

public java.lang.String getHandle()
Retrieves a handle to a specific instance of an OzoneObject. A handle is the externalizeable equivalent of OzoneProxy. The purpose of handles is to enable detached systems (such as web interfaces) that are not able to use OzoneProxy objects directly a means to access specific objects where object naming is not practical or convenient. A handle is valid for the lifetime of the OzoneObject it references. Unlike OzoneProxy, retrieving a handle on an object does nothing to guarantee its existence. While the handle is valid for the lifetime of the object it refers to, that object's lifetime may be shorter than the handle's.

The resultant string representation will be composed entirely of alphanumeric characters [A-Z], [a-z], and [0-9]; as such, it can safely and reliably be used in URLs without need for escaping.


handle

public java.lang.String handle()
Deprecated. use getHandle()


database

public OzoneInterface database()
Description copied from interface: OzoneCompatible
Return the database link

Specified by:
database in interface OzoneCompatible

toString

public java.lang.String toString()

onCreate

public void onCreate()
This default implementation of the onCreate() method does nothing.

Specified by:
onCreate in interface OzoneCompatible

onActivate

public void onActivate()
This method will be automaticly called immediately after this object is loaded (deserialized) from storage. This default implementation of the onActivate() method does nothing.

Specified by:
onActivate in interface OzoneCompatible

onPassivate

public void onPassivate()
This method will be automaticly called immediately before this object is stored (serialized) to storage.

Specified by:
onPassivate in interface OzoneCompatible

onDelete

public void onDelete()
This default implementation of the onDelete() method does nothing.

Specified by:
onDelete in interface OzoneCompatible

toXML

public boolean toXML(org.xml.sax.ContentHandler ch)
              throws org.xml.sax.SAXException
This default implementation of the toSAX() method. It returns just false to signal that a default value should be used.

Specified by:
toXML in interface OzoneCompatible
Returns:
The to be expected size of the object or -1 if a default value should be used. public int size() throws Exception;
Throws:
org.xml.sax.SAXException

deleteRecursive

public void deleteRecursive()

getObjectID

public org.ozoneDB.core.ObjectID getObjectID()
Returns the ObjectID of the represented ozone object. ObjectIDs are equal for equal ozone objects and different for different ozone objects. They are comparable, so that ozone objects may use ObjectID.compareTo(Object) in comparison functions.

Currently, ObjectID exposes other methods than ObjectID.equals(Object) and ObjectID.compareTo(Object). However, they should not be used, as ObjectIDs should be, apart from this method, opaque.

Specified by:
getObjectID in interface OzoneCompatibleOrProxy
Returns:
the ObjectID of the represented ozone object

equals

public boolean equals(java.lang.Object o)
Returns wether or not the passed object is equal to this object. Two ozone objects are considered equal when their object ids are equal. If you pass on OzoneObject, its getObjectID() will be called and compared with this.getObjectID(). The same goes for OzoneProxy instances.

Parameters:
o - the object to test for equality

ozone API

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