org.ogf.graap.wsag.server.persistence
Class EmfRegistry

java.lang.Object
  extended by org.ogf.graap.wsag.server.persistence.EmfRegistry

public class EmfRegistry
extends Object

Author:
T.Weuffel

Field Summary
static String PERSISTENCE_MODE_FILE
          Persistence mode file This mode starts wsag4j with an file database.
static String PERSISTENCE_MODE_FILE_PU_NAME
          Persistence unit name for file mode (see wsag4j-server-resources /META-INF/persistence.xml)
static String PERSISTENCE_MODE_MEM
          Persistence mode memory This mode starts wsag4j with an in-memory database.
static String PERSISTENCE_MODE_MEM_PU_NAME
          Persistence unit name for memory mode (see wsag4j-server-resources /META-INF/persistence.xml)
static String PERSISTENCE_MODE_MEM_SERVER
          Persistence mode memory for server tests This mode starts wsag4j with an in-memory database.
static String PERSISTENCE_MODE_MEM_SERVER_PU_NAME
          Persistence unit name for memory mode for server tests (see wsag4j-server-resources /META-INF/persistence.xml)
static String WSAG4J_DATAPATH
          System property to set the WSAG4J database location.
static String WSAG4J_DATAPATH_DEFAULT
          Default location of the wsag4j hsql database.
 
Constructor Summary
EmfRegistry()
           
 
Method Summary
static void finalizeEmfRegistry()
          Closes the entity manager factory and all entity managers.
static javax.persistence.EntityManager getEntityManager()
          Creates a new entity manager.
static String printInfo()
          Returns the operation mode info message.
static void setPersistenceMode(String persistenceMode)
          Sets the persistence mode.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

WSAG4J_DATAPATH

public static final String WSAG4J_DATAPATH
System property to set the WSAG4J database location.

See Also:
Constant Field Values

WSAG4J_DATAPATH_DEFAULT

public static final String WSAG4J_DATAPATH_DEFAULT
Default location of the wsag4j hsql database.


PERSISTENCE_MODE_MEM

public static final String PERSISTENCE_MODE_MEM
Persistence mode memory

This mode starts wsag4j with an in-memory database. It supports persistence for the wsag4j-server and wsag4j-webservice modules. Since an in-memory db is used agreements will not be stored on disk. After restarting the wsag4j engine all agreements disappear. This mode is usually used for unit testing.

See Also:
Constant Field Values

PERSISTENCE_MODE_MEM_PU_NAME

public static final String PERSISTENCE_MODE_MEM_PU_NAME
Persistence unit name for memory mode (see wsag4j-server-resources /META-INF/persistence.xml)

See Also:
Constant Field Values

PERSISTENCE_MODE_MEM_SERVER

public static final String PERSISTENCE_MODE_MEM_SERVER
Persistence mode memory for server tests

This mode starts wsag4j with an in-memory database. It supports persistence for the wsag4j-server module only. Since an in-memory db is used agreements will not be stored on disk. After restarting the wsag4j engine all agreements disappear. This mode is usually used for unit testing.

See Also:
Constant Field Values

PERSISTENCE_MODE_MEM_SERVER_PU_NAME

public static final String PERSISTENCE_MODE_MEM_SERVER_PU_NAME
Persistence unit name for memory mode for server tests (see wsag4j-server-resources /META-INF/persistence.xml)

See Also:
Constant Field Values

PERSISTENCE_MODE_FILE

public static final String PERSISTENCE_MODE_FILE
Persistence mode file

This mode starts wsag4j with an file database. It supports persistence for the wsag4j-server and wsag4j-webservice modules. Since an file db is used agreements will be stored on disk. After restarting the wsag4j engine all agreements are reloaded. This mode is usually used for productive mode.

Important: Make sure that the org.wsag4j.persistence.datapath system property is set to the correct location of the hsqldb database directory. Otherwise the database will be stored in {java.io.tmpdir}/wsag-data

See Also:
Constant Field Values

PERSISTENCE_MODE_FILE_PU_NAME

public static final String PERSISTENCE_MODE_FILE_PU_NAME
Persistence unit name for file mode (see wsag4j-server-resources /META-INF/persistence.xml)

See Also:
Constant Field Values
Constructor Detail

EmfRegistry

public EmfRegistry()
Method Detail

setPersistenceMode

public static void setPersistenceMode(String persistenceMode)
Sets the persistence mode.

Parameters:
persistenceMode - the persistence mode to set

getEntityManager

public static javax.persistence.EntityManager getEntityManager()
Creates a new entity manager.

Returns:
the new entity manager

printInfo

public static String printInfo()
Returns the operation mode info message.

Returns:
info message

finalizeEmfRegistry

public static void finalizeEmfRegistry()
Closes the entity manager factory and all entity managers.



Copyright © 2008-2012. All Rights Reserved.