com.mobixess.jodb.core
Class JODBSessionContainer

java.lang.Object
  extended by com.mobixess.jodb.core.JODBSessionContainer
All Implemented Interfaces:
ObjectContainer

public class JODBSessionContainer
extends java.lang.Object
implements ObjectContainer


Method Summary
 void activate(java.lang.Object obj, int depth)
          Activates all members on a stored object to the specified depth.
 boolean close()
          closes the ObjectContainer.
 void commit()
          Commits the running transaction.
 void commit(JODBIndexingRootAgent indexingRootAgent)
           
 void configureIndex(java.lang.Class clazz, java.lang.String fieldName, boolean enable)
           
 void configureIndex(java.lang.reflect.Field field, boolean enable)
           
 void deactivate(java.lang.Object obj, int depth)
          deactivates a stored object by setting all members to NULL.
 void delete(java.lang.Object obj)
          deletes a stored object permanently.
 void delete(java.lang.Object obj, int depth)
           
protected  void finalize()
           
<T> ObjectSet<T>
get(java.lang.Object template)
          Query-By-Example interface to retrieve objects.
 JODBQueryList getAllObjects()
           
 int getCachedObjectsCount()
           
 IDatabaseStatistics getDatabaseStatistics()
           
 JODBIndexingAgent getIndexingAgent(java.lang.reflect.Field field)
           
 IPersistentObjectStatistics getPersistenceStatistics(java.lang.Object object)
           
 java.lang.Object getSyncObject(java.lang.Object activeObject)
           
 void printFileMap()
           
 Query query()
          creates a new S.O.D.A.
<Type> ObjectSet<Type>
query(java.lang.Class<Type> clazz)
          queries for all instances of a class.
 void rollback()
          rolls back the running transaction.
 void set(java.lang.Object obj)
          Newly stores objects or updates stored objects.
 void set(java.lang.Object obj, int depth)
          Newly stores objects or updates stored objects.
 void setClassLoader(java.lang.ClassLoader classLoader)
           
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

printFileMap

public void printFileMap()
                  throws java.io.IOException
Throws:
java.io.IOException

configureIndex

public void configureIndex(java.lang.Class clazz,
                           java.lang.String fieldName,
                           boolean enable)
                    throws java.lang.SecurityException,
                           java.lang.NoSuchFieldException,
                           java.io.IOException
Throws:
java.lang.SecurityException
java.lang.NoSuchFieldException
java.io.IOException

getIndexingAgent

public JODBIndexingAgent getIndexingAgent(java.lang.reflect.Field field)
                                   throws java.io.IOException
Throws:
java.io.IOException

configureIndex

public void configureIndex(java.lang.reflect.Field field,
                           boolean enable)
                    throws java.io.IOException
Throws:
java.io.IOException

activate

public void activate(java.lang.Object obj,
                     int depth)
              throws java.io.IOException
Description copied from interface: ObjectContainer
Activates all members on a stored object to the specified depth.

Specified by:
activate in interface ObjectContainer
Throws:
java.io.IOException

getCachedObjectsCount

public int getCachedObjectsCount()

close

public boolean close()
              throws java.io.IOException
Description copied from interface: ObjectContainer
closes the ObjectContainer.

A call to close() automatically performs a commit().

Every session opened with JODB.openFile() requires one close()call, even if the same filename was used multiple times.

Use while(!close()){} to close all sessions using this container.

Specified by:
close in interface ObjectContainer
Returns:
success - true denotes that the last used instance of this container and the database file were closed.
Throws:
java.io.IOException

commit

public void commit()
            throws java.io.IOException
Description copied from interface: ObjectContainer
Commits the running transaction.

Specified by:
commit in interface ObjectContainer
Throws:
java.io.IOException

commit

public void commit(JODBIndexingRootAgent indexingRootAgent)
            throws java.io.IOException
Throws:
java.io.IOException

getSyncObject

public java.lang.Object getSyncObject(java.lang.Object activeObject)

deactivate

public void deactivate(java.lang.Object obj,
                       int depth)
Description copied from interface: ObjectContainer
deactivates a stored object by setting all members to NULL.
Primitive types will be set to their default values. The method has no effect, if the passed object is not stored in the ObjectContainer

Specified by:
deactivate in interface ObjectContainer
Parameters:
obj - the object to be deactivated.
depth - the member to which deactivate is to cascade.

delete

public void delete(java.lang.Object obj)
            throws java.io.IOException
Description copied from interface: ObjectContainer
deletes a stored object permanently.

Note that this method has to be called for every single object individually. Delete does not recurse to object members. Simple and array member types are destroyed. The method has no effect, if the passed object is not stored in the ObjectContainer. which can be also used for cascaded deletes.

Specified by:
delete in interface ObjectContainer
Parameters:
obj - the object to be deleted from the ObjectContainer.
Throws:
java.io.IOException

delete

public void delete(java.lang.Object obj,
                   int depth)
            throws java.io.IOException
Throws:
java.io.IOException

get

public <T> ObjectSet<T> get(java.lang.Object template)
                 throws java.io.IOException,
                        IllegalClassTypeException
Description copied from interface: ObjectContainer
Query-By-Example interface to retrieve objects.

get() creates an ObjectSet containing all objects in the ObjectContainer that match the passed template object.

Calling get(NULL) returns all objects stored in the ObjectContainer.


Query Evaluation
All non-null members of the template object are compared against all stored objects of the same class. Primitive type members are ignored if they are 0 or false respectively.

Returned Objects
The objects returned in the ObjectSet are instantiated and activated to the preconfigured depth. The activation depth may be configured globally via com.mobixess.jodb.core.JODBConfig#setDefaultActivationDepth() .

The database keeps track of all instantiatied objects. Queries will return references to these objects instead of instantiating them a second time.

Specified by:
get in interface ObjectContainer
Parameters:
template - object to be used as an example to find all matching objects.

Returns:
ObjectSet containing all found objects.

Throws:
java.io.IOException
IllegalClassTypeException

query

public Query query()
Description copied from interface: ObjectContainer
creates a new S.O.D.A. Query.

Use get(Object template) for simple Query-By-Example.



Specified by:
query in interface ObjectContainer
Returns:
a new Query object

query

public <Type> ObjectSet<Type> query(java.lang.Class<Type> clazz)
                      throws java.io.IOException,
                             IllegalClassTypeException
Description copied from interface: ObjectContainer
queries for all instances of a class.

Specified by:
query in interface ObjectContainer
Parameters:
clazz - the class to query for.
Returns:
the ObjectSet returned by the query.
Throws:
java.io.IOException
IllegalClassTypeException

rollback

public void rollback()
Description copied from interface: ObjectContainer
rolls back the running transaction.

Modified application objects im memory are not restored. Use combined calls to deactivate() and activate() to reload an objects member values.

Specified by:
rollback in interface ObjectContainer

set

public void set(java.lang.Object obj)
         throws IllegalClassTypeException,
                java.io.IOException
Description copied from interface: ObjectContainer
Newly stores objects or updates stored objects.

An object not yet stored in the ObjectContainer will be stored when it is passed to set(). An object already stored in the ObjectContainer will be updated.

Specified by:
set in interface ObjectContainer
Parameters:
obj - the object to be stored or updated.
Throws:
java.io.IOException
IllegalClassTypeException

set

public void set(java.lang.Object obj,
                int depth)
         throws IllegalClassTypeException,
                java.io.IOException
Description copied from interface: ObjectContainer
Newly stores objects or updates stored objects.

An object not yet stored in the ObjectContainer will be stored when it is passed to set(). An object already stored in the ObjectContainer will be updated.

Specified by:
set in interface ObjectContainer
Parameters:
obj - the object to be stored or updated.
depth - the depth to which the object is to be updated
Throws:
IllegalClassTypeException
java.io.IOException

getAllObjects

public JODBQueryList getAllObjects()
                            throws java.io.IOException
Throws:
java.io.IOException

getPersistenceStatistics

public IPersistentObjectStatistics getPersistenceStatistics(java.lang.Object object)
                                                     throws java.io.IOException
Throws:
java.io.IOException

getDatabaseStatistics

public IDatabaseStatistics getDatabaseStatistics()

setClassLoader

public void setClassLoader(java.lang.ClassLoader classLoader)

finalize

protected void finalize()
                 throws java.lang.Throwable
Overrides:
finalize in class java.lang.Object
Throws:
java.lang.Throwable


Copyright © Mobixess Inc. All Rights Reserved.