|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.craftforge.commons.database.memory.InMemoryDbManager
public class InMemoryDbManager
An in-memory database manager manages several in-memory database instances of the same database setup. This allows test- and demo-databases which can be booted from the scratch with the same scheme and data but are exclusive for users or processes although running at the same time.
The database in-memory manager is unique in respect an SQL setup-script. All databases are setup using this setup-script. An in-memory database itself is unique in respect to its name within an in-memory manager.
It is to the user of this class to find an appropriate way of naming the databases in a way which makes them exclusive in the context of their purpose. Examples: thread id, user id, remote ip address (Base64 encoded).
| Method Summary | |
|---|---|
boolean |
existsInMemoryDb(String databaseName)
Whether an in-memory database with the given database name is already managed by this manager or not. |
org.hibernate.ejb.Ejb3Configuration |
getConfiguration()
Gets the EJB3 configuration used by this in-memory manager to create entity-manager factories. |
protected String[] |
getDbSetupStatements()
Gets the database setup statements used to set up in-memory databases instances. |
InMemoryDb |
getInMemoryDb(String databaseName)
Gets an in-memory database with the given name. |
InMemoryDb |
getInMemoryDb(String databaseName,
long timeout,
long timeoutCheckInterval)
Gets an in-memory database with the given name. |
static InMemoryDbManager |
getInstance(String dbSetupScriptResource,
org.hibernate.ejb.Ejb3Configuration configuration)
Gets or creates and gets The in-memory database manager associated to the given database setup script resource. |
protected void |
removeInMemoryDb(String databaseName)
Removes the in-memory database with the given database name from the entity manager. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static InMemoryDbManager getInstance(String dbSetupScriptResource,
org.hibernate.ejb.Ejb3Configuration configuration)
dbSetupScriptResource - The database setup script resourceconfiguration - The EJB3 configuration for the entity-manager factory creation
public InMemoryDb getInMemoryDb(String databaseName)
databaseName - The database name
public InMemoryDb getInMemoryDb(String databaseName,
long timeout,
long timeoutCheckInterval)
databaseName - The database nametimeout - The timeout (in milliseconds)timeoutCheckInterval - (in milliseconds)
public boolean existsInMemoryDb(String databaseName)
databaseName - The database name
public org.hibernate.ejb.Ejb3Configuration getConfiguration()
protected String[] getDbSetupStatements()
protected void removeInMemoryDb(String databaseName)
databaseName - The database name
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||