com.opensymphony.workflow.spi.hibernate
Class SpringBeanNameWorkflowFactory

java.lang.Object
  extended by com.opensymphony.workflow.spi.hibernate.SpringBeanNameWorkflowFactory
All Implemented Interfaces:
WorkflowFactory, org.springframework.context.ApplicationContextAware

public class SpringBeanNameWorkflowFactory
extends Object
implements WorkflowFactory, org.springframework.context.ApplicationContextAware

Spring-compliant implementation of AbstractWorkflowFactory. This workflow factory retrieves WorkflowDescriptors from the Spring's ApplicationContext. The name of the WorkflowDescriptors is the name of the bean in the applicationContext.
Motivation: reduce number of external configuration files leaving only workflow definitions files.

Usage:
 <bean id="myworkflow" class="com.opensymphony.workflow.spi.hibernate.WorkflowDescriptorFactoryBean">
     <property name="descriptorResource">
         <value>classpath:/META-INF/workflow/myworkflow.xml</value>
     </property>
 </bean>

 <bean id="workflowFactory" class="com.opensymphony.workflow.spi.hibernate.BeanNameWorkflowFactory"/>
 

Author:
xd

Constructor Summary
SpringBeanNameWorkflowFactory()
           
 
Method Summary
 void createWorkflow(String name)
           
 Object getLayout(String workflowName)
           
 String getName()
           
 Properties getProperties()
           
 WorkflowDescriptor getWorkflow(String inName)
           
 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 init(Properties p)
           
 void initDone()
           
 boolean isModifiable(String name)
           
 boolean removeWorkflow(String inName)
           
 void renameWorkflow(String oldName, String newName)
           
 void save()
           
 boolean saveWorkflow(String inName, WorkflowDescriptor inDescriptor, boolean inReplace)
          Save the workflow.
 void setApplicationContext(org.springframework.context.ApplicationContext inApplicationContext)
           
 void setLayout(String workflowName, Object layout)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SpringBeanNameWorkflowFactory

public SpringBeanNameWorkflowFactory()
Method Detail

setApplicationContext

public void setApplicationContext(org.springframework.context.ApplicationContext inApplicationContext)
Specified by:
setApplicationContext in interface org.springframework.context.ApplicationContextAware

setLayout

public void setLayout(String workflowName,
                      Object layout)
Specified by:
setLayout in interface WorkflowFactory

getLayout

public Object getLayout(String workflowName)
Specified by:
getLayout in interface WorkflowFactory

isModifiable

public boolean isModifiable(String name)
Specified by:
isModifiable in interface WorkflowFactory

getName

public String getName()
Specified by:
getName in interface WorkflowFactory

getProperties

public Properties getProperties()
Specified by:
getProperties in interface WorkflowFactory

getWorkflow

public WorkflowDescriptor getWorkflow(String inName)
Specified by:
getWorkflow in interface WorkflowFactory

getWorkflow

public WorkflowDescriptor getWorkflow(String name,
                                      boolean validate)
                               throws FactoryException
Description copied from interface: WorkflowFactory
Get a workflow descriptor given a workflow name.

Specified by:
getWorkflow in interface WorkflowFactory
Parameters:
name - The name of the workflow to get.
Returns:
The descriptor for the specified workflow.
Throws:
FactoryException - if the specified workflow name does not exist or cannot be located.

getWorkflowNames

public String[] getWorkflowNames()
Description copied from interface: WorkflowFactory
Get all workflow names in the current factory

Specified by:
getWorkflowNames in interface WorkflowFactory
Returns:
An array of all workflow names

createWorkflow

public void createWorkflow(String name)
Specified by:
createWorkflow in interface WorkflowFactory

init

public void init(Properties p)
Specified by:
init in interface WorkflowFactory

initDone

public void initDone()
              throws FactoryException
Specified by:
initDone in interface WorkflowFactory
Throws:
FactoryException

removeWorkflow

public boolean removeWorkflow(String inName)
                       throws FactoryException
Specified by:
removeWorkflow in interface WorkflowFactory
Throws:
FactoryException

renameWorkflow

public void renameWorkflow(String oldName,
                           String newName)
Specified by:
renameWorkflow in interface WorkflowFactory

save

public void save()
Specified by:
save in interface WorkflowFactory

saveWorkflow

public boolean saveWorkflow(String inName,
                            WorkflowDescriptor inDescriptor,
                            boolean inReplace)
                     throws FactoryException
Description copied from interface: WorkflowFactory
Save the workflow. Is it the responsibility of the caller to ensure that the workflow is valid, through the WorkflowDescriptor.validate() method. Invalid workflows will be saved without being checked.

Specified by:
saveWorkflow in interface WorkflowFactory
Parameters:
inName - The name of the workflow to same.
inDescriptor - The descriptor for the workflow.
inReplace - true if an existing workflow with this name should be replaced.
Returns:
true if the workflow was saved.
Throws:
FactoryException - if there was an error saving the workflow
InvalidWorkflowDescriptorException - if the descriptor specified is invalid

OpenSymphony Workflow Project Page