net.sf.jso.storage
Class JSOObjectManager

java.lang.Object
  extended bynet.sf.jso.storage.JSOObjectManager
All Implemented Interfaces:
ObjectManager

public class JSOObjectManager
extends java.lang.Object
implements ObjectManager

Manager responsible for object storage.


Constructor Summary
JSOObjectManager(StorageManager aManager, StorageController aController, SchemaProxy aSchema, DatabaseInterface aDatabase, ConnectionPool aPool, int cacheSize)
          Constructs the object manager.
 
Method Summary
 void batchStore(java.util.Collection objs, boolean deep, Transaction tx)
          Stores a collection of objects in one only "batch" operation.
 int delete(java.util.List objs, Transaction tx)
          Deletes objects according to parameters.
 void delete(java.lang.Object obj, Transaction tx)
          Deletes an object.
 void delete(OID oid, Transaction tx)
          Deletes an object.
 CacheInfo getCacheInfo()
          Gets cache information.
 OID getOID(java.lang.Object obj)
          Returns OID of a transient storable object.
 void invalidate()
          Invalidates all cached data.
 void invalidate(java.lang.Class cls)
          Invalidates cached data of all objects of a class.
 void invalidate(OID oid)
          Invalidates cached data of an object.
 java.lang.Object retrieve(OID oid, boolean summary, boolean lazy, boolean refresh, boolean useProxy, Transaction tx)
          Retrieves an object.
 OID store(java.lang.Object obj, boolean deep, Transaction tx)
          Stores an object.
 void unlinkTransientObjects()
          Unlinks transient storable objects from stored ones.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JSOObjectManager

public JSOObjectManager(StorageManager aManager,
                        StorageController aController,
                        SchemaProxy aSchema,
                        DatabaseInterface aDatabase,
                        ConnectionPool aPool,
                        int cacheSize)
Constructs the object manager.

Method Detail

getOID

public OID getOID(java.lang.Object obj)
           throws StorageException
Returns OID of a transient storable object.

Specified by:
getOID in interface ObjectManager
Parameters:
obj - The object to be identified.
Returns:
Storable object's OID.
Throws:
StorageException

unlinkTransientObjects

public void unlinkTransientObjects()
Unlinks transient storable objects from stored ones.

Specified by:
unlinkTransientObjects in interface ObjectManager

store

public OID store(java.lang.Object obj,
                 boolean deep,
                 Transaction tx)
          throws StorageException
Stores an object.

Specified by:
store in interface ObjectManager
Parameters:
obj - Object to be stored.
deep - Indicates if referenced objects should also be stored.
tx - Transaction within which operation will be executed.
Throws:
StorageException

batchStore

public void batchStore(java.util.Collection objs,
                       boolean deep,
                       Transaction tx)
                throws StorageException
Stores a collection of objects in one only "batch" operation.

Specified by:
batchStore in interface ObjectManager
Parameters:
objs - The collection of object to be stored.
tx - Transaction within which operation will be executed.
deep - Indicates if referenced objects should also be stored.
Throws:
StorageException

retrieve

public java.lang.Object retrieve(OID oid,
                                 boolean summary,
                                 boolean lazy,
                                 boolean refresh,
                                 boolean useProxy,
                                 Transaction tx)
                          throws StorageException
Retrieves an object.

Specified by:
retrieve in interface ObjectManager
Parameters:
oid - Identification of the object to be retrieved.
summary - Indicates if only summary fields should be retrieved. filled with elements/references (true) or only references to them (false).
lazy - Indicates if referenced objects should be lazy loaded, by proxy objetcs.
refresh - Indicates if an existent transient version of storable object should be refreshd with data from database.
useProxy - Indicates if a proxy may be returned instead of a real storable object.
tx - Transaction within which operation will be executed.
Throws:
StorageException

delete

public void delete(java.lang.Object obj,
                   Transaction tx)
            throws StorageException
Deletes an object.

Specified by:
delete in interface ObjectManager
Parameters:
obj - Object to be deleted.
tx - Transaction within which operation will be executed.
Throws:
StorageException

delete

public void delete(OID oid,
                   Transaction tx)
            throws StorageException
Deletes an object.

Specified by:
delete in interface ObjectManager
Parameters:
oid - Identification of the object to be deleted.
tx - Transaction within which operation will be executed.
Throws:
StorageException

delete

public int delete(java.util.List objs,
                  Transaction tx)
           throws StorageException
Deletes objects according to parameters.

Specified by:
delete in interface ObjectManager
Parameters:
objs - List of objects to be deleted.
tx - Transaction within which operation will be executed.
Throws:
StorageException

invalidate

public void invalidate()
Invalidates all cached data.

Specified by:
invalidate in interface ObjectManager

invalidate

public void invalidate(OID oid)
Invalidates cached data of an object.

Specified by:
invalidate in interface ObjectManager
Parameters:
oid - Object's identification.

invalidate

public void invalidate(java.lang.Class cls)
Invalidates cached data of all objects of a class.

Specified by:
invalidate in interface ObjectManager
Parameters:
cls - Object's class.

getCacheInfo

public CacheInfo getCacheInfo()
Gets cache information.

Specified by:
getCacheInfo in interface ObjectManager
Returns:
Information about the cache.