|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.neodatis.odb.impl.main.ThreadSafeLocalODB
public class ThreadSafeLocalODB
Used to synchronized access to the db in multi thread.
Field Summary | |
---|---|
protected ODB |
localOdb
|
protected boolean |
multiThreadExclusive
neodatiesee : when true, the mutex is only released on commit or close, which would prevent another thread acessing the db before commit. |
protected Mutex |
mutex
|
protected static java.lang.String |
THREAD_MUTEX_PREFIX
time out to acquire the mutex |
Constructor Summary | |
---|---|
ThreadSafeLocalODB(ODB odb)
|
Method Summary | ||
---|---|---|
protected void |
acquireMutex()
|
|
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 |
|
ODB |
getNonThreadSafeOdb()
|
|
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 |
|
|
getObjects(java.lang.Class clazz)
Get all objects of a specific type |
|
|
getObjects(java.lang.Class clazz,
boolean inMemory)
Get all objects of a specific type |
|
|
getObjects(java.lang.Class clazz,
boolean inMemory,
int startIndex,
int endIndex)
|
|
|
getObjects(IQuery query)
Search for objects that matches the query. |
|
|
getObjects(IQuery query,
boolean inMemory)
Search for objects that matches the native query. |
|
|
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. |
|
protected boolean |
holdsTheMutex(java.lang.String threadName)
|
|
boolean |
isClosed()
|
|
void |
reconnect(java.lang.Object object)
|
|
protected void |
releaseMutex()
|
|
void |
rollback()
Undo all uncommitted changes |
|
OID |
store(java.lang.Object object)
Store a plain java Object in the ODB Database |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected ODB localOdb
protected static final java.lang.String THREAD_MUTEX_PREFIX
protected Mutex mutex
protected boolean multiThreadExclusive
Constructor Detail |
---|
public ThreadSafeLocalODB(ODB odb)
Method Detail |
---|
public ODB getNonThreadSafeOdb()
protected boolean holdsTheMutex(java.lang.String threadName)
protected void acquireMutex()
protected void releaseMutex()
public void addDeleteTrigger(java.lang.Class clazz, DeleteTrigger trigger)
ODB
addDeleteTrigger
in interface ODB
public void addInsertTrigger(java.lang.Class clazz, InsertTrigger trigger)
ODB
addInsertTrigger
in interface ODB
public void addSelectTrigger(java.lang.Class clazz, SelectTrigger trigger)
ODB
addSelectTrigger
in interface ODB
public void addUpdateTrigger(java.lang.Class clazz, UpdateTrigger trigger)
ODB
addUpdateTrigger
in interface ODB
public void close()
ODB
close
in interface ODB
public void commit()
ODB
commit
in interface ODB
public java.math.BigInteger count(CriteriaQuery query)
ODB
count
in interface ODB
public CriteriaQuery criteriaQuery(java.lang.Class clazz, ICriterion criterio)
criteriaQuery
in interface ODB
public CriteriaQuery criteriaQuery(java.lang.Class clazz)
criteriaQuery
in interface ODB
public void defragmentTo(java.lang.String newFileName)
ODB
defragmentTo
in interface ODB
public OID delete(java.lang.Object object)
ODB
delete
in interface ODB
public OID deleteCascade(java.lang.Object object)
ODB
deleteCascade
in interface ODB
public void deleteObjectWithId(OID oid)
ODB
deleteObjectWithId
in interface ODB
oid
- The object id to be deletedpublic void disconnect(java.lang.Object object)
ODB
disconnect
in interface ODB
public ODBExt ext()
ODB
ext
in interface ODB
public ClassRepresentation getClassRepresentation(java.lang.Class clazz)
ODB
getClassRepresentation
in interface ODB
public ClassRepresentation getClassRepresentation(java.lang.String fullClassName)
ODB
getClassRepresentation
in interface ODB
public ClassRepresentation getClassRepresentation(java.lang.String fullClassName, boolean laodClass)
getClassRepresentation
in interface ODB
public java.lang.String getName()
ODB
getName
in interface ODB
public java.lang.Object getObjectFromId(OID id)
ODB
getObjectFromId
in interface ODB
public OID getObjectId(java.lang.Object object)
ODB
getObjectId
in interface ODB
public <T> Objects<T> getObjects(java.lang.Class clazz, boolean inMemory, int startIndex, int endIndex)
getObjects
in interface ODB
clazz
- The type of the objectsinMemory
- if true, preload all objects,if false,load on demandstartIndex
- The index of the first objectendIndex
- The index of the last object that must be returned
public <T> Objects<T> getObjects(java.lang.Class clazz, boolean inMemory)
ODB
getObjects
in interface ODB
clazz
- The type of the objectsinMemory
- if true, preload all objects,if false,load on demand
public <T> Objects<T> getObjects(java.lang.Class clazz)
ODB
getObjects
in interface ODB
clazz
- The type of the objects
public <T> Objects<T> getObjects(IQuery query, boolean inMemory, int startIndex, int endIndex)
ODB
getObjects
in interface ODB
inMemory
- if true, preload all objects,if false,load on demandstartIndex
- The index of the first objectendIndex
- The index of the last object that must be returned
public <T> Objects<T> getObjects(IQuery query, boolean inMemory)
ODB
getObjects
in interface ODB
public <T> Objects<T> getObjects(IQuery query)
ODB
getObjects
in interface ODB
public IRefactorManager getRefactorManager()
ODB
getRefactorManager
in interface ODB
public Values getValues(IValuesQuery query)
ODB
getValues
in interface ODB
public boolean isClosed()
isClosed
in interface ODB
public void reconnect(java.lang.Object object)
reconnect
in interface ODB
public void rollback()
ODB
rollback
in interface ODB
public OID store(java.lang.Object object)
ODB
store
in interface ODB
object
- A plain Java Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |