ozone core API

org.ozoneDB.core.storage.classicStore
Class ClassicObjectContainer

java.lang.Object
  extended byorg.ozoneDB.core.AbstractObjectContainer
      extended byorg.ozoneDB.core.storage.classicStore.ClassicObjectContainer
All Implemented Interfaces:
java.io.Externalizable, Lockable, ObjectContainer, java.io.Serializable

public final class ClassicObjectContainer
extends AbstractObjectContainer
implements java.io.Externalizable

Author:
SMB
See Also:
Serialized Form

Field Summary
protected  ClusterID clusterID
          the cluster id where the object is stored
protected  ClusterSpace clusterSpace
           
protected  boolean created
           
protected  boolean deleted
           
protected  Env env
          The environment of this object.
protected static boolean keepObjectsAlive
          objekte werden nach transaktion nicht geloescht
protected  Lock lock
          the lock of the object
private static DxHashMap methodTable
          global method cache
protected  java.lang.String name
          a possible name for the object
protected  ObjectID objID
          the id of the object
protected  Permissions permissions
          permissions
protected static long serialVersionUID
          magic number for streaming
protected static byte subSerialVersionUID
           
protected  org.ozoneDB.OzoneCompatible target
          null, if not activted
protected  byte[] targetBackup
           
protected  org.ozoneDB.OzoneCompatible targetShadow
           
protected  short touchCount
           
protected  boolean touched
           
protected  long touchTime
          time of last invoke
 
Fields inherited from class org.ozoneDB.core.AbstractObjectContainer
shouldCallOnActivate, shouldCallOnPassivate, state
 
Fields inherited from interface org.ozoneDB.core.ObjectContainer
IMPLNAME_POSTFIX, PROXYNAME_POSTFIX, STATE_CLEAN, STATE_CREATED, STATE_DELETED, STATE_MODIFIED, STATE_READ
 
Constructor Summary
ClassicObjectContainer()
          constructor fuer streaming
ClassicObjectContainer(org.ozoneDB.OzoneCompatible _target, ObjectID _objID, Permissions _permissions)
          constructor; name ist optional
 
Method Summary
protected  void abortTarget(Transaction ta)
           
protected  org.ozoneDB.OzoneCompatible activatedObject()
          Liefert referenz auf das eigentliche objekt; das objekt wird nachgeladen, wenn es gerade nicht aktiv ist; waehrend einer update-ta wird nur der clone bearbeitet und somit auch nicht nachgeladen
 DxCollection allLockers()
          Returns a collection of Locker objects that currently lock this Lockable object.
protected  ClusterID clusterID()
           
protected  void commitTarget(Transaction ta)
           
protected  void createShadow()
           
 void deleteTarget()
           
 int ensureGarbageCollectionLevel(int newGarbageCollectionLevel)
          Ensures that the garbageCollectionLevel is at least the given currentGarbageCollectionLevel.
 boolean equals(java.lang.Object obj)
          True, when bouth OzoneCompatibles have the same ID.
 void finalizeTarget()
           
 int getGarbageCollectionLevel()
          Returns the garbageCollectionLevel this ObjectContainer has reached due to (not) calling ensureGarbageCollectionLevel(int).
 ObjectID id()
           
 java.lang.Object invokeTarget(Env env, java.lang.String methodName, java.lang.String sig, java.lang.Object[] args)
           
 boolean isCreated()
           
 boolean isDeleted()
           
 boolean isPinned()
          Returns wether this ObjectContainer is pinned.
protected  void loadExternal(java.io.ObjectInput in)
          Read from the stream - fuer ClusterSpace.
 Lock lock()
           
 int lockLevel(Transaction ta)
           
private  java.lang.reflect.Method methodFor(java.lang.String methodName, java.lang.String sig, java.lang.Object[] args)
          Search the method with the specified name and signature.
 long modTime()
          Returns the time when the container was last commited with lock level greater than Lock.LEVEL_READ.
 java.lang.String name()
           
 void nameTarget(java.lang.String _name)
           
 void notifyAllTAs(Transaction ta)
           
protected  java.lang.Class objectClass()
           
 org.ozoneDB.OzoneProxy ozoneProxy()
          Return a proxy for the receiver.
 Permissions permissions()
           
 void pin()
          Pins this ObjectContainer.
 void readExternal(java.io.ObjectInput in)
          Read from the stream - fuer DxDiskHashtable.
protected  void setClusterID(ClusterID _clusterID)
           
 void setName(java.lang.String _name)
           
protected  org.ozoneDB.OzoneCompatible setObject(org.ozoneDB.OzoneCompatible obj)
          Setzen oder loeschen des objektes.
protected  void setOwner(User newOwner)
           
 void setTarget(org.ozoneDB.OzoneCompatible _target)
           
protected  void storeExternal(java.io.ObjectOutput out)
          Write to the Stream.
 org.ozoneDB.OzoneCompatible target()
          Liefert referenz auf das eigentliche objekt.
 java.lang.Class targetClass()
           
 org.ozoneDB.OzoneCompatible targetClone()
          Build a copy of the encap object.
 org.ozoneDB.OzoneCompatible targetShadow()
           
 void touch()
           
protected  int touchCount()
           
protected  boolean touched()
           
protected  long touchTime()
           
 void unpin()
          Unpins this ObjectContainer.
protected  void upgradeLockLevel(Transaction ta, int lockLevel)
           
 void writeExternal(java.io.ObjectOutput out)
          In stream schreiben - fuer DxDiskHashtable
 
Methods inherited from class org.ozoneDB.core.AbstractObjectContainer
clearState, constructorFor, createTarget, database, flushMethodCache, getCurrentDatabase, getCurrrentTransaction, getEnv, invokeOnActivate, invokeOnPassivate, invokeTarget, methodFor, raiseState, requireWriteLocking, setShouldCallOnActivate, setShouldCallOnPassivate, shouldOnActivateBeCalled, shouldOnPassivateBeCalled, state
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

serialVersionUID

protected static final long serialVersionUID
magic number for streaming

See Also:
Constant Field Values

subSerialVersionUID

protected static final byte subSerialVersionUID
See Also:
Constant Field Values

methodTable

private static DxHashMap methodTable
global method cache


keepObjectsAlive

protected static boolean keepObjectsAlive
objekte werden nach transaktion nicht geloescht


env

protected transient Env env
The environment of this object.


clusterSpace

protected transient ClusterSpace clusterSpace

permissions

protected Permissions permissions
permissions


target

protected org.ozoneDB.OzoneCompatible target
null, if not activted


targetShadow

protected org.ozoneDB.OzoneCompatible targetShadow

targetBackup

protected byte[] targetBackup

touchTime

protected long touchTime
time of last invoke


touchCount

protected short touchCount

touched

protected boolean touched

name

protected java.lang.String name
a possible name for the object


objID

protected ObjectID objID
the id of the object


clusterID

protected ClusterID clusterID
the cluster id where the object is stored


lock

protected Lock lock
the lock of the object


deleted

protected boolean deleted

created

protected boolean created
Constructor Detail

ClassicObjectContainer

public ClassicObjectContainer()
constructor fuer streaming


ClassicObjectContainer

public ClassicObjectContainer(org.ozoneDB.OzoneCompatible _target,
                              ObjectID _objID,
                              Permissions _permissions)
constructor; name ist optional

Method Detail

modTime

public long modTime()
Returns the time when the container was last commited with lock level greater than Lock.LEVEL_READ. The value returned by this method should only be compared against return values of this method.

Specified by:
modTime in interface ObjectContainer

lock

public Lock lock()
Specified by:
lock in interface ObjectContainer

setTarget

public void setTarget(org.ozoneDB.OzoneCompatible _target)
Specified by:
setTarget in interface ObjectContainer

targetClass

public java.lang.Class targetClass()
Specified by:
targetClass in interface ObjectContainer

pin

public void pin()
Pins this ObjectContainer. Every caller of this method must pair this call with a call to unpin(). An ObjectContainer remains in main memory at least as long as it is pinned.

Specified by:
pin in interface ObjectContainer

unpin

public void unpin()
Unpins this ObjectContainer. This method must be called exactly once for every call to pin().

Specified by:
unpin in interface ObjectContainer

isPinned

public boolean isPinned()
Returns wether this ObjectContainer is pinned.

Specified by:
isPinned in interface ObjectContainer

ensureGarbageCollectionLevel

public int ensureGarbageCollectionLevel(int newGarbageCollectionLevel)
Ensures that the garbageCollectionLevel is at least the given currentGarbageCollectionLevel. The return value is meaningful if the supplied newGarbageCollectionLevel is the currentGarbageCollectionLevel

Specified by:
ensureGarbageCollectionLevel in interface ObjectContainer
Returns:
<=0 if this object still has to be processed. This is the case if it belongs to the surelyReachable set but not to the processedReachable set > otherwise <0 if this object has been updated =0 if this object has not been updated, it is surelyReachable >0 if this object has not been updated, it is processedReachable

getGarbageCollectionLevel

public int getGarbageCollectionLevel()
Returns the garbageCollectionLevel this ObjectContainer has reached due to (not) calling ensureGarbageCollectionLevel(int).

Specified by:
getGarbageCollectionLevel in interface ObjectContainer

equals

public boolean equals(java.lang.Object obj)
True, when bouth OzoneCompatibles have the same ID.

Specified by:
equals in interface ObjectContainer

finalizeTarget

public void finalizeTarget()
                    throws java.lang.Exception
Throws:
java.lang.Exception

id

public ObjectID id()
Specified by:
id in interface ObjectContainer

isCreated

public boolean isCreated()

deleteTarget

public void deleteTarget()
Specified by:
deleteTarget in interface ObjectContainer

isDeleted

public boolean isDeleted()

invokeTarget

public java.lang.Object invokeTarget(Env env,
                                     java.lang.String methodName,
                                     java.lang.String sig,
                                     java.lang.Object[] args)
                              throws java.lang.Exception
Specified by:
invokeTarget in interface ObjectContainer
Overrides:
invokeTarget in class AbstractObjectContainer
Throws:
java.lang.Exception

touch

public void touch()
Specified by:
touch in interface ObjectContainer

name

public java.lang.String name()
Specified by:
name in interface ObjectContainer

setName

public void setName(java.lang.String _name)
Specified by:
setName in interface ObjectContainer

nameTarget

public void nameTarget(java.lang.String _name)
Specified by:
nameTarget in interface ObjectContainer

permissions

public Permissions permissions()
Specified by:
permissions in interface ObjectContainer

targetClone

public org.ozoneDB.OzoneCompatible targetClone()
                                        throws java.lang.Exception
Build a copy of the encap object. This is based on serialization, so no clone() method must be implemented by OzoneObjects.

Specified by:
targetClone in interface ObjectContainer
Overrides:
targetClone in class AbstractObjectContainer
Throws:
java.lang.Exception

ozoneProxy

public org.ozoneDB.OzoneProxy ozoneProxy()
Description copied from interface: ObjectContainer
Return a proxy for the receiver.

Specified by:
ozoneProxy in interface ObjectContainer
Overrides:
ozoneProxy in class AbstractObjectContainer

lockLevel

public int lockLevel(Transaction ta)

allLockers

public DxCollection allLockers()
Description copied from interface: Lockable
Returns a collection of Locker objects that currently lock this Lockable object.

Specified by:
allLockers in interface Lockable
Returns:
a collection with holders of writeLocker or all readLocks, i.e. all potential hindering transactions

notifyAllTAs

public void notifyAllTAs(Transaction ta)

targetShadow

public org.ozoneDB.OzoneCompatible targetShadow()

target

public org.ozoneDB.OzoneCompatible target()
Liefert referenz auf das eigentliche objekt. Darf nicht targetShadow beruecksichtigen, da ClusterSPace darauf aufbaut.

Specified by:
target in interface ObjectContainer

setObject

protected org.ozoneDB.OzoneCompatible setObject(org.ozoneDB.OzoneCompatible obj)
Setzen oder loeschen des objektes. commit() ist unteilbar, deshalb kein snchronized. Achtung: object ist evtl. gerade geclustert und muss vorher eingelagert werden; das darf nicht hier gemacht werden, da diese methode auch vom store benutzt wird.


setOwner

protected void setOwner(User newOwner)

touchCount

protected int touchCount()

touched

protected boolean touched()

touchTime

protected long touchTime()

clusterID

protected ClusterID clusterID()

setClusterID

protected void setClusterID(ClusterID _clusterID)

objectClass

protected java.lang.Class objectClass()
                               throws java.lang.Exception
Throws:
java.lang.Exception

activatedObject

protected org.ozoneDB.OzoneCompatible activatedObject()
                                               throws java.lang.Exception
Liefert referenz auf das eigentliche objekt; das objekt wird nachgeladen, wenn es gerade nicht aktiv ist; waehrend einer update-ta wird nur der clone bearbeitet und somit auch nicht nachgeladen

Throws:
java.lang.Exception

commitTarget

protected void commitTarget(Transaction ta)

abortTarget

protected void abortTarget(Transaction ta)

upgradeLockLevel

protected void upgradeLockLevel(Transaction ta,
                                int lockLevel)
                         throws java.lang.Exception
Throws:
java.lang.Exception

createShadow

protected void createShadow()
                     throws java.lang.Exception
Throws:
java.lang.Exception

writeExternal

public void writeExternal(java.io.ObjectOutput out)
                   throws java.io.IOException
In stream schreiben - fuer DxDiskHashtable

Specified by:
writeExternal in interface java.io.Externalizable
Throws:
java.io.IOException

readExternal

public void readExternal(java.io.ObjectInput in)
                  throws java.io.IOException,
                         java.lang.ClassNotFoundException
Read from the stream - fuer DxDiskHashtable. The objID is normally referensed from the objID of the object.

Specified by:
readExternal in interface java.io.Externalizable
Throws:
java.io.IOException
java.lang.ClassNotFoundException

storeExternal

protected void storeExternal(java.io.ObjectOutput out)
                      throws java.io.IOException
Write to the Stream. Wird vom ClusterSpace verwendet.

Throws:
java.io.IOException

loadExternal

protected void loadExternal(java.io.ObjectInput in)
                     throws java.io.IOException,
                            java.lang.ClassNotFoundException
Read from the stream - fuer ClusterSpace. Normally, objID is a referenz of the objID in the object.

Throws:
java.io.IOException
java.lang.ClassNotFoundException

methodFor

private java.lang.reflect.Method methodFor(java.lang.String methodName,
                                           java.lang.String sig,
                                           java.lang.Object[] args)
                                    throws java.lang.Exception
Search the method with the specified name and signature. Ones a method has been invoked it is stored in a global cache that holds the method objects of all database classes.

Throws:
java.lang.Exception

ozone core API

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