public class ProcessStoreImpl extends java.lang.Object implements ProcessStore
JDBC-based implementation of a process store. Also provides an "in-memory" store by way of H2 database.
The philsophy here is to keep things simple. Process store operations are relatively infrequent. Performance of the public
methods is not a concern. However, note that the ProcessConf
objects returned by the class are
going to be used from within the engine runtime, and hence their performance needs to be very good. Similarly, these objects
should be immutable so as not to confuse the engine.
Note the way that the database is used in this class, it is more akin to a recovery log, this is intentional: we want to start
up, load stuff from the database and then pretty much forget about it when it comes to reads.
Modifier and Type | Field and Description |
---|---|
protected java.io.File |
_configDir |
protected java.io.File |
_deployDir |
Constructor and Description |
---|
ProcessStoreImpl() |
ProcessStoreImpl(EndpointReferenceContext eprContext,
javax.sql.DataSource inMemDs)
Constructor that hardwires OpenJPA on a new in-memory database.
|
ProcessStoreImpl(EndpointReferenceContext eprContext,
javax.sql.DataSource ds,
java.lang.String persistenceType,
OdeConfigProperties props,
boolean createDatamodel) |
Modifier and Type | Method and Description |
---|---|
static java.util.Map<javax.xml.namespace.QName,org.w3c.dom.Node> |
calcInitialProperties(java.util.Properties properties,
TDeployment.Process dd)
Create a property mapping based on the initial values in the deployment descriptor.
|
static javax.sql.DataSource |
createInternalDS(java.lang.String guid) |
java.util.Collection<javax.xml.namespace.QName> |
deploy(java.io.File deploymentUnitDirectory)
Deploys a process from the filesystem.
|
java.util.Collection<javax.xml.namespace.QName> |
deploy(java.io.File deploymentUnitDirectory,
boolean autoincrementVersion)
Deploys a process.
|
java.util.Collection<javax.xml.namespace.QName> |
deploy(java.io.File deploymentUnitDirectory,
boolean activate,
java.lang.String duName,
boolean autoincrementVersion)
Deploys a process.
|
protected void |
finalize() |
protected java.io.File |
findDeployDir(DeploymentUnitDAO dudao) |
protected void |
fireEvent(ProcessStoreEvent pse) |
java.io.File |
getConfigDir() |
long |
getCurrentVersion()
Gets the version used by the store for the last deployment.
|
java.io.File |
getDeployDir() |
java.util.Collection<java.lang.String> |
getPackages()
Lists the names of all the packages that have been deployed (corresponds
to a directory name on the file system).
|
ProcessConf |
getProcessConfiguration(javax.xml.namespace.QName processId)
Gets all the details of a process configuration (properties, deploy dates, ...)
|
java.util.List<javax.xml.namespace.QName> |
getProcesses()
Get the list of processes known to the store.
|
java.util.List<javax.xml.namespace.QName> |
listProcesses(java.lang.String packageName)
Lists all processe ids in a given package.
|
protected java.util.List<ProcessConfImpl> |
load(DeploymentUnitDAO dudao)
Load a deployment unit record stored in the db into memory.
|
protected boolean |
load(java.lang.String duName)
Make sure that the deployment unit is loaded.
|
void |
loadAll()
Load all the deployment units out of the store.
|
void |
refreshSchedules(java.lang.String packageName) |
void |
registerListener(ProcessStoreListener psl)
Register a configuration store listener.
|
void |
setConfigDir(java.io.File configDir) |
void |
setDeployDir(java.io.File depDir) |
void |
setProperty(javax.xml.namespace.QName pid,
javax.xml.namespace.QName propName,
org.w3c.dom.Node value) |
void |
setProperty(javax.xml.namespace.QName pid,
javax.xml.namespace.QName propName,
java.lang.String value)
Set a process property.
|
void |
setRetiredPackage(java.lang.String packageName,
boolean retired)
Retires all processes in a given package.
|
void |
setState(javax.xml.namespace.QName pid,
ProcessState state)
Marks a process as active / retired or disabled
|
void |
shutdown() |
static void |
shutdownInternalDB(javax.sql.DataSource ds) |
java.util.Collection<javax.xml.namespace.QName> |
undeploy(java.io.File dir)
Undeploys a package.
|
java.util.Collection<javax.xml.namespace.QName> |
undeploy(java.lang.String duName) |
void |
unregisterListener(ProcessStoreListener psl)
Unregister a configuration store listener.
|
protected java.io.File _deployDir
protected java.io.File _configDir
public ProcessStoreImpl()
public ProcessStoreImpl(EndpointReferenceContext eprContext, javax.sql.DataSource ds, java.lang.String persistenceType, OdeConfigProperties props, boolean createDatamodel)
public ProcessStoreImpl(EndpointReferenceContext eprContext, javax.sql.DataSource inMemDs)
public void shutdown()
protected void finalize() throws java.lang.Throwable
finalize
in class java.lang.Object
java.lang.Throwable
public java.util.Collection<javax.xml.namespace.QName> deploy(java.io.File deploymentUnitDirectory, boolean autoincrementVersion)
public java.util.Collection<javax.xml.namespace.QName> deploy(java.io.File deploymentUnitDirectory)
ProcessStore
deploy
in interface ProcessStore
deploymentUnitDirectory
- directory containing all deployment filespublic java.util.Collection<javax.xml.namespace.QName> deploy(java.io.File deploymentUnitDirectory, boolean activate, java.lang.String duName, boolean autoincrementVersion)
public java.util.Collection<javax.xml.namespace.QName> undeploy(java.io.File dir)
ProcessStore
undeploy
in interface ProcessStore
dir
- packagepublic java.util.Collection<javax.xml.namespace.QName> undeploy(java.lang.String duName)
public java.util.Collection<java.lang.String> getPackages()
ProcessStore
getPackages
in interface ProcessStore
public java.util.List<javax.xml.namespace.QName> listProcesses(java.lang.String packageName)
ProcessStore
listProcesses
in interface ProcessStore
public void setState(javax.xml.namespace.QName pid, ProcessState state)
ProcessStore
setState
in interface ProcessStore
state
- true for active, false for inactivepublic void setRetiredPackage(java.lang.String packageName, boolean retired)
ProcessStore
setRetiredPackage
in interface ProcessStore
public ProcessConf getProcessConfiguration(javax.xml.namespace.QName processId)
ProcessStore
getProcessConfiguration
in interface ProcessStore
public void setProperty(javax.xml.namespace.QName pid, javax.xml.namespace.QName propName, org.w3c.dom.Node value)
setProperty
in interface ProcessStore
public void setProperty(javax.xml.namespace.QName pid, javax.xml.namespace.QName propName, java.lang.String value)
ProcessStore
setProperty
in interface ProcessStore
public void loadAll()
public java.util.List<javax.xml.namespace.QName> getProcesses()
ProcessStore
getProcesses
in interface ProcessStore
public long getCurrentVersion()
ProcessStore
getCurrentVersion
in interface ProcessStore
protected void fireEvent(ProcessStoreEvent pse)
public void registerListener(ProcessStoreListener psl)
ProcessStore
registerListener
in interface ProcessStore
psl
- ProcessStoreListener
public void unregisterListener(ProcessStoreListener psl)
ProcessStore
unregisterListener
in interface ProcessStore
psl
- ProcessStoreListener
public static java.util.Map<javax.xml.namespace.QName,org.w3c.dom.Node> calcInitialProperties(java.util.Properties properties, TDeployment.Process dd)
dd
- protected java.util.List<ProcessConfImpl> load(DeploymentUnitDAO dudao)
dudao
- protected java.io.File findDeployDir(DeploymentUnitDAO dudao)
protected boolean load(java.lang.String duName)
duName
- deployment unit namepublic void setDeployDir(java.io.File depDir)
public java.io.File getDeployDir()
public java.io.File getConfigDir()
public void setConfigDir(java.io.File configDir)
public static javax.sql.DataSource createInternalDS(java.lang.String guid)
public static void shutdownInternalDB(javax.sql.DataSource ds)
public void refreshSchedules(java.lang.String packageName)
refreshSchedules
in interface ProcessStore