goodslib
Class ObjectClosure

java.lang.Object
  extended bygoodsjpi.Persistent
      extended bygoodslib.ObjectClosure
All Implemented Interfaces:
java.io.Serializable

public class ObjectClosure
extends Persistent

This class can be used to save in persistent storage cluster of transient Java objects using serialization mecahnism. Class java.io.ObjectOutputStream is used to pack all objects reachable from some specified root object into stream of bytes. Data is stored in GOODS persistent object as array of bytes. It can be restored lately by java.io.ObjectInputStream (classes of all packed objects should be available in application).

See Also:
Serialized Form

Field Summary
protected  byte[] buf
           
 
Fields inherited from class goodsjpi.Persistent
defaultMetaobject, metaobject
 
Constructor Summary
ObjectClosure(java.lang.Object root)
          Create new instance of object closure given specified root object.
 
Method Summary
 java.lang.Object extract()
          Extract objects from object closure and returns reference to root object and return reference to root object.
 void store(java.lang.Object root)
          Pack objects into array of bytes to be placed in storage.
 
Methods inherited from class goodsjpi.Persistent
attachToStorage, clone, clusterWith, finalize, getDatabase, getOid, getStorageId, hashCode, onLoad
 
Methods inherited from class java.lang.Object
equals, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

buf

protected byte[] buf
Constructor Detail

ObjectClosure

public ObjectClosure(java.lang.Object root)
Create new instance of object closure given specified root object.

Method Detail

store

public void store(java.lang.Object root)
Pack objects into array of bytes to be placed in storage. All objects accessible by refernces from root objects will be placed in this object closure.


extract

public java.lang.Object extract()
Extract objects from object closure and returns reference to root object and return reference to root object. After been extracted from the closure, these objects will have no differenecs with normal Java transparent objects.