|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.opensymphony.workflow.loader.AbstractWorkflowFactory
com.opensymphony.workflow.loader.XMLWorkflowFactory
com.opensymphony.workflow.loader.JDBCWorkflowFactory
public class JDBCWorkflowFactory
Workflow Factory that stores workflows in a database. The database requires a property called 'datasource' which is the JNDI name of the datasource for this factory.
Also required is a database table called OS_WORKFLOWDEFS with two columns, WF_NAME which contains the workflow name, and WF_DEFINITION which will contain the xml workflow descriptor, the latter can be either a TEXT or BINARY type.
Note that this class is provided as an example, and users are encouraged to use their own implementations that are more suited to their particular needs.
| Field Summary | |
|---|---|
protected javax.sql.DataSource |
ds
|
protected boolean |
reload
|
protected Map |
workflows
|
| Fields inherited from class com.opensymphony.workflow.loader.AbstractWorkflowFactory |
|---|
properties |
| Constructor Summary | |
|---|---|
JDBCWorkflowFactory()
|
|
| Method Summary | |
|---|---|
void |
execute(Map transientVars,
Map args,
com.opensymphony.module.propertyset.PropertySet ps)
Execute this function |
WorkflowDescriptor |
getWorkflow(String name,
boolean validate)
Get a workflow descriptor given a workflow name. |
String[] |
getWorkflowNames()
Get all workflow names in the current factory |
void |
initDone()
Invoked after the properties of the factory have been set. |
byte[] |
read(String workflowname)
|
boolean |
removeWorkflow(String name)
|
boolean |
saveWorkflow(String name,
WorkflowDescriptor descriptor,
boolean replace)
Save the workflow. |
boolean |
write(String workflowname,
byte[] wf)
|
| Methods inherited from class com.opensymphony.workflow.loader.XMLWorkflowFactory |
|---|
createWorkflow, getBaseDir, getInputStream, getLayout, getName, isModifiable, renameWorkflow, save, setLayout, writeXML |
| Methods inherited from class com.opensymphony.workflow.loader.AbstractWorkflowFactory |
|---|
getProperties, getWorkflow, init |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected javax.sql.DataSource ds
protected Map workflows
protected boolean reload
| Constructor Detail |
|---|
public JDBCWorkflowFactory()
| Method Detail |
|---|
public WorkflowDescriptor getWorkflow(String name,
boolean validate)
throws FactoryException
WorkflowFactory
getWorkflow in interface WorkflowFactorygetWorkflow in class XMLWorkflowFactoryname - The name of the workflow to get.
FactoryException - if the specified workflow name does not exist or cannot be located.public String[] getWorkflowNames()
WorkflowFactory
getWorkflowNames in interface WorkflowFactorygetWorkflowNames in class XMLWorkflowFactory
public void execute(Map transientVars,
Map args,
com.opensymphony.module.propertyset.PropertySet ps)
FunctionProvider
execute in interface FunctionProvidertransientVars - Variables that will not be persisted. These include inputs
given in the Workflow.initialize(java.lang.String, int, java.util.Map) and Workflow.doAction(long, int, java.util.Map) method calls.
There are a number of special variable names:
entry: (object type: WorkflowEntry)
The workflow instance
context:
(object type: WorkflowContext). The workflow context.
actionId: The Integer ID of the current action that was take (if applicable).
currentSteps: A Collection of the current steps in the workflow instance.
store: The WorkflowStore.
descriptor: The WorkflowDescriptor.
Register), will also be
available in the transient map, no matter what. These transient variables only last through
the method call that they were invoked in, such as Workflow.initialize(java.lang.String, int, java.util.Map)
and Workflow.doAction(long, int, java.util.Map).args - The properties for this function invocation. Properties are created
from arg nested elements within the xml, an arg element takes in a name attribute
which is the properties key, and the CDATA text contents of the element map to
the property value.ps - The persistent variables that are associated with the current
instance of the workflow. Any change made to the propertyset are persisted to
the propertyset implementation's persistent store.
public void initDone()
throws FactoryException
AbstractWorkflowFactory
initDone in interface WorkflowFactoryinitDone in class XMLWorkflowFactoryFactoryException - if there was an error during initialization.
public byte[] read(String workflowname)
throws SQLException
SQLException
public boolean removeWorkflow(String name)
throws FactoryException
removeWorkflow in interface WorkflowFactoryremoveWorkflow in class XMLWorkflowFactoryFactoryException
public boolean saveWorkflow(String name,
WorkflowDescriptor descriptor,
boolean replace)
throws FactoryException
WorkflowFactoryWorkflowDescriptor.validate() method. Invalid workflows will
be saved without being checked.
saveWorkflow in interface WorkflowFactorysaveWorkflow in class XMLWorkflowFactoryname - The name of the workflow to same.descriptor - The descriptor for the workflow.replace - true if an existing workflow with this name should be replaced.
FactoryException - if there was an error saving the workflow
InvalidWorkflowDescriptorException - if the descriptor specified is invalid
public boolean write(String workflowname,
byte[] wf)
throws SQLException
SQLException
|
OpenSymphony Workflow Project Page | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||