com.opensymphony.workflow.loader
Class HTTPWorkflowFactory

java.lang.Object
  extended by com.opensymphony.workflow.loader.AbstractWorkflowFactory
      extended by com.opensymphony.workflow.loader.HTTPWorkflowFactory
All Implemented Interfaces:
WorkflowFactory

public class HTTPWorkflowFactory
extends AbstractWorkflowFactory

Author:
Hani Suleiman Date: Dec 17, 2004 Time: 12:00:36 AM

Field Summary
protected  boolean reload
           
protected  Map workflows
           
 
Fields inherited from class com.opensymphony.workflow.loader.AbstractWorkflowFactory
properties
 
Constructor Summary
HTTPWorkflowFactory()
           
 
Method Summary
 void createWorkflow(String name)
           
protected static String get(String urlValue, Map data)
           
 Object getLayout(String workflowName)
           
 String getName()
           
 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.
 boolean isModifiable(String name)
           
protected static String post(String urlValue, Map data)
           
protected  String readLayoutBuffer(String url, String docId)
           
protected  String readWorkflowBuffer(String url, String docId)
           
 boolean removeWorkflow(String name)
           
 void renameWorkflow(String oldName, String newName)
           
 void save()
           
 boolean saveWorkflow(String name, WorkflowDescriptor descriptor, boolean replace)
          Save the workflow.
 void setLayout(String workflowName, Object layout)
           
protected  String writeWorkflowDescriptor(String url, String docId, String name, String workflowXML)
           
protected  String writeWorkflowLayout(String url, String docId, String name, String layoutXML)
           
protected  void writeXML(WorkflowDescriptor descriptor, Writer out)
           
 
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

workflows

protected Map workflows

reload

protected boolean reload
Constructor Detail

HTTPWorkflowFactory

public HTTPWorkflowFactory()
Method Detail

setLayout

public void setLayout(String workflowName,
                      Object layout)

getLayout

public Object getLayout(String workflowName)

isModifiable

public boolean isModifiable(String name)

getName

public String getName()

getWorkflow

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

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()
                          throws FactoryException
Description copied from interface: WorkflowFactory
Get all workflow names in the current factory

Returns:
An array of all workflow names
Throws:
FactoryException - if the factory cannot determine the names of the workflows it has.

createWorkflow

public void createWorkflow(String name)

initDone

public void initDone()
              throws FactoryException
Description copied from class: AbstractWorkflowFactory
Invoked after the properties of the factory have been set. Subclasses should override this method and add any specific setup code required. For example, connecting to an external resource or database.

Specified by:
initDone in interface WorkflowFactory
Overrides:
initDone in class AbstractWorkflowFactory
Throws:
FactoryException - if there was an error during initialization.

removeWorkflow

public boolean removeWorkflow(String name)
                       throws FactoryException
Throws:
FactoryException

renameWorkflow

public void renameWorkflow(String oldName,
                           String newName)

save

public void save()

saveWorkflow

public boolean saveWorkflow(String name,
                            WorkflowDescriptor descriptor,
                            boolean replace)
                     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.

Parameters:
name - 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.
Returns:
true if the workflow was saved.
Throws:
FactoryException - if there was an error saving the workflow
InvalidWorkflowDescriptorException - if the descriptor specified is invalid

get

protected static String get(String urlValue,
                            Map data)
                     throws IOException
Throws:
IOException

post

protected static String post(String urlValue,
                             Map data)
                      throws IOException
Throws:
IOException

readLayoutBuffer

protected String readLayoutBuffer(String url,
                                  String docId)
                           throws Exception
Throws:
Exception

readWorkflowBuffer

protected String readWorkflowBuffer(String url,
                                    String docId)
                             throws Exception
Throws:
Exception

writeWorkflowDescriptor

protected String writeWorkflowDescriptor(String url,
                                         String docId,
                                         String name,
                                         String workflowXML)
                                  throws Exception
Throws:
Exception

writeWorkflowLayout

protected String writeWorkflowLayout(String url,
                                     String docId,
                                     String name,
                                     String layoutXML)
                              throws Exception
Throws:
Exception

writeXML

protected void writeXML(WorkflowDescriptor descriptor,
                        Writer out)

OpenSymphony Workflow Project Page