org.neodatis.odb
Interface ODB

All Known Implementing Classes:
LocalODB, ODBAdapter, ODBForTrigger, RemoteODBClient, SameVMODBClient, ThreadSafeLocalODB

public interface ODB

The main ODB public interface: It is what the user sees.

Author:
osmadja

Method Summary
 void addDeleteTrigger(java.lang.Class clazz, DeleteTrigger trigger)
          USed to add a delete trigger callback for the specific class
 void addInsertTrigger(java.lang.Class clazz, InsertTrigger trigger)
          Used to add an insert trigger callback for the specific class
 void addSelectTrigger(java.lang.Class clazz, SelectTrigger trigger)
          Used to add a select trigger callback for the specific class
 void addUpdateTrigger(java.lang.Class clazz, UpdateTrigger trigger)
          Used to add an update trigger callback for the specific class
 void close()
          Closes the database.
 void commit()
          Commit all the change of the database @
 java.math.BigInteger count(CriteriaQuery query)
          Returns the number of objects that satisfy the query
 CriteriaQuery criteriaQuery(java.lang.Class clazz)
           
 CriteriaQuery criteriaQuery(java.lang.Class clazz, ICriterion criterio)
           
 void defragmentTo(java.lang.String newFileName)
          Defragment ODB Database
 OID delete(java.lang.Object object)
          Delete an object from database
 OID deleteCascade(java.lang.Object object)
          Delete an object and all its sub objects
 void deleteObjectWithId(OID oid)
          Delete an object from the database with the id
 void disconnect(java.lang.Object object)
          Used to disconnect the object from the current session.
 ODBExt ext()
          Get the extension of ODB to get access to advanced functions
 ClassRepresentation getClassRepresentation(java.lang.Class clazz)
          Get an abstract representation of a class
 ClassRepresentation getClassRepresentation(java.lang.String fullClassName)
          Get an abstract representation of a class
 ClassRepresentation getClassRepresentation(java.lang.String fullClassName, boolean laodClass)
           
 java.lang.String getName()
          Return the name of the database
 java.lang.Object getObjectFromId(OID id)
          Get the object with a specific id *
 OID getObjectId(java.lang.Object object)
          Get the id of an ODB-aware object
<T> Objects<T>
getObjects(java.lang.Class clazz)
          Get all objects of a specific type
<T> Objects<T>
getObjects(java.lang.Class clazz, boolean inMemory)
          Get all objects of a specific type
<T> Objects<T>
getObjects(java.lang.Class clazz, boolean inMemory, int startIndex, int endIndex)
           
<T> Objects<T>
getObjects(IQuery query)
          Search for objects that matches the query.
<T> Objects<T>
getObjects(IQuery query, boolean inMemory)
          Search for objects that matches the native query.
<T> Objects<T>
getObjects(IQuery query, boolean inMemory, int startIndex, int endIndex)
          Return a list of objects that matches the query
 IRefactorManager getRefactorManager()
          Returns the object used to refactor the database
 Values getValues(IValuesQuery query)
          Search for objects that matches the query.
 boolean isClosed()
           
 void reconnect(java.lang.Object object)
          Deprecated. Reconnection is now automatic Used to reconnect an object to the current session
 void rollback()
          Undo all uncommitted changes
 OID store(java.lang.Object object)
          Store a plain java Object in the ODB Database
 

Method Detail

commit

void commit()
Commit all the change of the database @


rollback

void rollback()
Undo all uncommitted changes


close

void close()
Closes the database. Automatically commit uncommitted changes


store

OID store(java.lang.Object object)
Store a plain java Object in the ODB Database

Parameters:
object - A plain Java Object

getObjects

<T> Objects<T> getObjects(java.lang.Class clazz)
Get all objects of a specific type

Parameters:
clazz - The type of the objects
Returns:
The list of objects

getObjects

<T> Objects<T> getObjects(java.lang.Class clazz,
                          boolean inMemory)
Get all objects of a specific type

Parameters:
clazz - The type of the objects
inMemory - if true, preload all objects,if false,load on demand
Returns:
The list of objects

getObjects

<T> Objects<T> getObjects(java.lang.Class clazz,
                          boolean inMemory,
                          int startIndex,
                          int endIndex)
Parameters:
clazz - The type of the objects
inMemory - if true, preload all objects,if false,load on demand
startIndex - The index of the first object
endIndex - The index of the last object that must be returned
Returns:
A List of objects

delete

OID delete(java.lang.Object object)
Delete an object from database

Parameters:
object -

deleteCascade

OID deleteCascade(java.lang.Object object)
Delete an object and all its sub objects

Parameters:
object -
cascade -
Returns:

deleteObjectWithId

void deleteObjectWithId(OID oid)
Delete an object from the database with the id

Parameters:
oid - The object id to be deleted

getValues

Values getValues(IValuesQuery query)
Search for objects that matches the query.

Parameters:
query -
Returns:
The list of values

getObjects

<T> Objects<T> getObjects(IQuery query)
Search for objects that matches the query.

Parameters:
query -
Returns:
The list of objects

getObjects

<T> Objects<T> getObjects(IQuery query,
                          boolean inMemory)
Search for objects that matches the native query.

Parameters:
query -
inMemory -
Returns:
The list of objects

getObjects

<T> Objects<T> getObjects(IQuery query,
                          boolean inMemory,
                          int startIndex,
                          int endIndex)
Return a list of objects that matches the query

Parameters:
query -
inMemory - if true, preload all objects,if false,load on demand
startIndex - The index of the first object
endIndex - The index of the last object that must be returned
Returns:
A List of objects, if start index and end index are -1, they are ignored. If not, the length of the sublist is endIndex - startIndex

count

java.math.BigInteger count(CriteriaQuery query)
Returns the number of objects that satisfy the query

Parameters:
query -
Returns:
The number of objects that satisfy the query

getObjectId

OID getObjectId(java.lang.Object object)
Get the id of an ODB-aware object

Parameters:
object -
Returns:
The ODB internal object id

getObjectFromId

java.lang.Object getObjectFromId(OID id)
Get the object with a specific id *

Parameters:
id -
Returns:
The object with the specific id @

defragmentTo

void defragmentTo(java.lang.String newFileName)
Defragment ODB Database

Parameters:
newFileName -

getClassRepresentation

ClassRepresentation getClassRepresentation(java.lang.Class clazz)
Get an abstract representation of a class

Parameters:
clazz -
Returns:
a public meta-representation of a class

getClassRepresentation

ClassRepresentation getClassRepresentation(java.lang.String fullClassName)
Get an abstract representation of a class

Parameters:
fullClassName -
Returns:
a public meta-representation of a class

getClassRepresentation

ClassRepresentation getClassRepresentation(java.lang.String fullClassName,
                                           boolean laodClass)

addUpdateTrigger

void addUpdateTrigger(java.lang.Class clazz,
                      UpdateTrigger trigger)
Used to add an update trigger callback for the specific class

Parameters:
trigger -

addInsertTrigger

void addInsertTrigger(java.lang.Class clazz,
                      InsertTrigger trigger)
Used to add an insert trigger callback for the specific class

Parameters:
trigger -

addDeleteTrigger

void addDeleteTrigger(java.lang.Class clazz,
                      DeleteTrigger trigger)
USed to add a delete trigger callback for the specific class

Parameters:
trigger -

addSelectTrigger

void addSelectTrigger(java.lang.Class clazz,
                      SelectTrigger trigger)
Used to add a select trigger callback for the specific class

Parameters:
trigger -

getRefactorManager

IRefactorManager getRefactorManager()
Returns the object used to refactor the database


ext

ODBExt ext()
Get the extension of ODB to get access to advanced functions


reconnect

void reconnect(java.lang.Object object)
Deprecated. Reconnection is now automatic Used to reconnect an object to the current session


disconnect

void disconnect(java.lang.Object object)
Used to disconnect the object from the current session. The object is removed from the cache


isClosed

boolean isClosed()
Returns:

criteriaQuery

CriteriaQuery criteriaQuery(java.lang.Class clazz,
                            ICriterion criterio)

criteriaQuery

CriteriaQuery criteriaQuery(java.lang.Class clazz)

getName

java.lang.String getName()
Return the name of the database

Returns:
the file name in local mode and the base id (alias) in client server mode.