ozone API

org.ozoneDB
Interface OzoneCompatible

All Superinterfaces:
OzoneCompatibleOrProxy, java.io.Serializable
All Known Implementing Classes:
OzoneObject

public interface OzoneCompatible
extends java.io.Serializable, OzoneCompatibleOrProxy

All objects that are stored in ozone have to implement this interface. The easiest way to build database objects is to extend the OzoneObject class, which implements OzoneCompatible already.

Version:
$Revision: 1.11 $Date: 2003/04/11 13:38:53 $
Author:
SMB, Per Nyfelt

Method Summary
 org.ozoneDB.core.ObjectContainer container()
          Return the container of the receiver.
 OzoneInterface database()
          Return the database link
 void onActivate()
          This method will be automatically called after this object is loaded (deserialized) from storage.
 void onCreate()
          This method will be automaticly called when this object is created using createObject().
 void onDelete()
          This method will be automaticly called when this object is deleted using deleteObject().
 void onPassivate()
          This method will be automaticly called emediately 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.
 boolean toXML(org.xml.sax.ContentHandler ch)
          This method is automatically called by the ozone server to get an idea of the size of this object.
 
Methods inherited from interface org.ozoneDB.OzoneCompatibleOrProxy
getObjectID
 

Method Detail

setContainer

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


container

public org.ozoneDB.core.ObjectContainer container()
Return the container of the receiver.


self

public OzoneProxy self()
Return a proxy for the receiver.


database

public OzoneInterface database()
Return the database link


onCreate

public void onCreate()
This method will be automaticly called when this object is created using createObject().


onActivate

public void onActivate()
This method will be automatically called after this object is loaded (deserialized) from storage.
Note that there is currently a race condition: If another transaction tries to invoke a method on this object as well, it may succeed before this method completes. Thus, it is likely, but not guaranteed, that onActivate() is called before any other method of the object. This may be fixed in the future.
This method may be called with this object being read-locked. That means, that you may not, by default, change any member of this object (more precisely: of any object being member of this ObjectContainer). If you detect within onActivate() that you need to change something, you need to call org.ozoneDB.OzoneObject#requireWriteLocking before the first change. Then, the lock is upgraded to write-locking.
You may not throw declared exceptions, because the method which tries to access you does not know that you do so.


onPassivate

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


onDelete

public void onDelete()
This method will be automaticly called when this object is deleted using deleteObject(). It should delete all database objects that depend on it and that are not otherwise reachable. In other words, this is the persistent destructor of the object.


toXML

public boolean toXML(org.xml.sax.ContentHandler ch)
              throws org.xml.sax.SAXException
This method is automatically called by the ozone server to get an idea of the size of this object. The method should not return the actual current size of the object but the size the object will probably reach during its life time.

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

ozone API

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