|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectde.mguennewig.pobjects.AbstractContainer
de.mguennewig.pobjects.memdb.MemoryContainer
public class MemoryContainer
A simple object container that simulates a database, but stores everything in memory.
This container is more based on a feasibility study and was quite
helpful to cleanup the Container and Query infrastructure,
then to be a useful tool.
The implementation is very naive and in no way optimized for speed or memory usage. Possible improvements:
SelectExpr and ViewDecl are not supported.
| Field Summary |
|---|
| Fields inherited from interface de.mguennewig.pobjects.Container |
|---|
SUPPORTS_BOOLEAN, SUPPORTS_INHERITS, SUPPORTS_JOIN, SUPPORTS_LIMIT_OFFSET, SUPPORTS_ORACLE_JOIN, SUPPORTS_SQL99_JOIN, USE_ARRAY_FOR_LOB, USE_STREAM_TO_INSERT_LOB |
| Constructor Summary | |
|---|---|
MemoryContainer(PObjDictionary dict,
java.lang.String schema)
Creates a new MemoryContainer. |
|
| Method Summary | |
|---|---|
void |
close()
|
void |
commitTransaction()
Commits all statements since the last Container.beginTransaction(). |
int |
deleteAll(ClassDecl te)
Deletes all entries within the specified table. |
int |
deleteAll(ClassDecl te,
Column fk,
java.lang.Object value)
Deletes all entries within the specified table whose foreign key fk equals the given value. |
void |
deleteObject(PObject obj)
Deletes the given persistent object from the database. |
boolean |
deleteRecord(Record obj)
|
void |
dump(java.io.PrintStream out,
java.lang.String name)
|
int |
getCapabilities()
Returns the capabilities of the DBMS. |
java.lang.String |
getSequenceCurrentValue(Sequence seq)
Returns the current value of the given sequence. |
java.lang.String |
getSequenceNextValue(Sequence seq)
Returns a new value of the given sequence. |
java.lang.String |
insertObject(PObject obj)
Inserts the given object into the database. |
boolean |
insertRecord(Record obj)
|
EvalContext |
newEvalContext(int numColumns)
|
Query |
newQuery()
Creates a new empty query. |
void |
reset()
Resets the container. |
void |
retrieveData(PObject obj)
Retrieves the data for the given persistent object from the database. |
void |
rollbackTransaction()
Rolls back all statements since the last Container.beginTransaction(). |
void |
updateObject(PObject obj)
Updates the given persistent object in the database. |
| Methods inherited from class de.mguennewig.pobjects.AbstractContainer |
|---|
beginTransaction, createObject, deleteAll, getClassDecl, getClassDecls, getData, getDictionary, getObject, getObject, getQualifiedName, getSchema, getTableExpr, isStrictMode, makePersistent, newQuery, newQuery, newQuery, newQuery, newQuery, newQuery, newQuery, newQuery, notifyChange, setStrictMode, storeAll, supportsBoolean, supportsInherits, supportsLimitOffset, supportsOracleJoin, supportsSQL99Join, useArrayForLob, useStreamToInsertLob |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public MemoryContainer(PObjDictionary dict,
java.lang.String schema)
| Method Detail |
|---|
public void close()
public int getCapabilities()
SUPPORTS_* constants."
public java.lang.String getSequenceCurrentValue(Sequence seq)
throws PObjSQLException
PObjSQLException - if any database error occurs.
public java.lang.String getSequenceNextValue(Sequence seq)
throws PObjSQLException
PObjSQLException - if any database error occurs.
public java.lang.String insertObject(PObject obj)
throws PObjConstraintException,
PObjSQLException
PObjConstraintException - if a database constraint will be violated.
PObjSQLException - if any other database error occurs.
public void updateObject(PObject obj)
throws PObjConstraintException,
PObjSQLException
PObjConstraintException - if a database constraint will be violated.
PObjSQLException - if any other database error occurs.PObject.isPersistent()
public void deleteObject(PObject obj)
throws PObjConstraintException,
PObjSQLException
PObjConstraintException - if a database constraint will be violated.
PObjSQLException - if any other database error occurs.PObject.isPersistent()
public boolean insertRecord(Record obj)
throws PObjConstraintException,
PObjSQLException
PObjConstraintException
PObjSQLException
public boolean deleteRecord(Record obj)
throws PObjConstraintException,
PObjSQLException
PObjConstraintException
PObjSQLExceptionpublic void retrieveData(PObject obj)
public void commitTransaction()
throws PObjSQLException
Container.beginTransaction().
If Container.isStrictMode() yields false then just a
warning for each dirty object is written, otherwise an exception is
raised.
commitTransaction in interface ContainercommitTransaction in class AbstractContainerPObjSQLException - if the DBMS in unable to finish the current
transaction by committing it or if an modified but unstored object is
detected while in strict mode.
public void rollbackTransaction()
throws PObjSQLException
Container.beginTransaction().
The in-memory data will be reverted also as far as possible.
rollbackTransaction in interface ContainerrollbackTransaction in class AbstractContainerPObjSQLException - if the DBMS is unable to stop the current
transaction by rolling back all made changes within it.PObject.revert()
public int deleteAll(ClassDecl te)
throws PObjSQLException,
PObjConstraintException
NOTE: The objects which represent a row of this table or refer
to rows within it aren't updated. So the best way to ensure consistency
is to finish the current active transaction before calling this method and
afterwards doing a Container.reset().
PObjSQLException - if any other database error occurs.
PObjConstraintException - if a database constraint will be violated.
public int deleteAll(ClassDecl te,
Column fk,
java.lang.Object value)
throws PObjSQLException,
PObjConstraintException
fk equals the given value.
NOTE: The objects which represent a row of this table or refer
to rows within it aren't updated. So the best way to ensure consistency
is to finish the current active transaction before calling this method and
afterwards doing a Container.reset().
PObjSQLException - if any other database error occurs.
PObjConstraintException - if a database constraint will be violated.public void reset()
Use this method to forget all changes made to any object.
NOTE: Any running transaction will be rolled back.
reset in interface Containerreset in class AbstractContainerContainer.rollbackTransaction()public EvalContext newEvalContext(int numColumns)
public Query newQuery()
public final void dump(java.io.PrintStream out,
java.lang.String name)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||