com.opensymphony.workflow.config
Class DefaultConfiguration

java.lang.Object
  extended by com.opensymphony.workflow.config.DefaultConfiguration
All Implemented Interfaces:
Configuration, Serializable

public class DefaultConfiguration
extends Object
implements Configuration, Serializable

Default implementation for a configuration object. This configuration object is passed to the Workflow.setConfiguration(Configuration) method. If the configuration is not initialized, the load(java.net.URL) method will be called by the workflow. Alternatively, the caller can explicitly load the configuration by calling that method before calling Workflow.setConfiguration(Configuration).

The loading behaviour comes into play when specifying a configuration remotely, for example in an EJB environment. It might be desirable to ensure that the configuration is loaded from within the EJB server, rather than in the calling client.

Version:
$Revision: 1.14 $
Author:
Hani Suleiman
See Also:
Serialized Form

Field Summary
static DefaultConfiguration INSTANCE
           
 
Constructor Summary
DefaultConfiguration()
           
 
Method Summary
protected  InputStream getInputStream(URL url)
          Load the default configuration from the current context classloader.
 String getPersistence()
          Get the fully qualified class name of the persistence store.
 Map getPersistenceArgs()
          Get the persistence args for the persistence store.
 VariableResolver getVariableResolver()
          Return the resolver to use for all variables specified in scripts
 WorkflowDescriptor getWorkflow(String name)
          Get the named workflow descriptor.
 String[] getWorkflowNames()
          Get a list of all available workflow descriptor names.
 WorkflowStore getWorkflowStore()
           
 boolean isInitialized()
           
 boolean isModifiable(String name)
          Check if a particular workflow can be modified or not.
 void load(URL url)
          Load the specified configuration file.
 boolean removeWorkflow(String workflow)
          Remove the specified workflow.
 boolean saveWorkflow(String name, WorkflowDescriptor descriptor, boolean replace)
           
 void setPersistence(String persistence)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INSTANCE

public static DefaultConfiguration INSTANCE
Constructor Detail

DefaultConfiguration

public DefaultConfiguration()
Method Detail

isInitialized

public boolean isInitialized()
Specified by:
isInitialized in interface Configuration
Returns:
true if this factory has been initialised. If the factory is not initialised, then Configuration.load(java.net.URL) will be called.

isModifiable

public boolean isModifiable(String name)
Description copied from interface: Configuration
Check if a particular workflow can be modified or not.

Specified by:
isModifiable in interface Configuration
Parameters:
name - The workflow name.
Returns:
true if the workflow can be modified, false otherwise.

setPersistence

public void setPersistence(String persistence)

getPersistence

public String getPersistence()
Description copied from interface: Configuration
Get the fully qualified class name of the persistence store.

Specified by:
getPersistence in interface Configuration

getPersistenceArgs

public Map getPersistenceArgs()
Description copied from interface: Configuration
Get the persistence args for the persistence store. Note that this returns the actual args and not a copy, so modifications to the returned Map could potentially affect store behaviour.

Specified by:
getPersistenceArgs in interface Configuration

getVariableResolver

public VariableResolver getVariableResolver()
Description copied from interface: Configuration
Return the resolver to use for all variables specified in scripts

Specified by:
getVariableResolver in interface Configuration

getWorkflow

public WorkflowDescriptor getWorkflow(String name)
                               throws FactoryException
Description copied from interface: Configuration
Get the named workflow descriptor.

Specified by:
getWorkflow in interface Configuration
Parameters:
name - the workflow name
Throws:
FactoryException - if there was an error looking up the descriptor or if it could not be found.

getWorkflowNames

public String[] getWorkflowNames()
                          throws FactoryException
Description copied from interface: Configuration
Get a list of all available workflow descriptor names.

Specified by:
getWorkflowNames in interface Configuration
Throws:
FactoryException - if the underlying factory does not support this method or if there was an error looking up workflow names.

getWorkflowStore

public WorkflowStore getWorkflowStore()
                               throws StoreException
Specified by:
getWorkflowStore in interface Configuration
Throws:
StoreException

load

public void load(URL url)
          throws FactoryException
Description copied from interface: Configuration
Load the specified configuration file.

Specified by:
load in interface Configuration
Parameters:
url - url to the configuration file.
Throws:
FactoryException

removeWorkflow

public boolean removeWorkflow(String workflow)
                       throws FactoryException
Description copied from interface: Configuration
Remove the specified workflow.

Specified by:
removeWorkflow in interface Configuration
Parameters:
workflow - The workflow name of the workflow to remove.
Returns:
true if the workflow was removed, false otherwise.
Throws:
FactoryException - If the underlying workflow factory has an error removing the workflow, or if it does not support the removal of workflows.

saveWorkflow

public boolean saveWorkflow(String name,
                            WorkflowDescriptor descriptor,
                            boolean replace)
                     throws FactoryException
Specified by:
saveWorkflow in interface Configuration
Throws:
FactoryException

getInputStream

protected InputStream getInputStream(URL url)
Load the default configuration from the current context classloader. The search order is:
  • Specified URL
  • osworkflow.xml
  • /osworkflow.xml
  • META-INF/osworkflow.xml
  • /META-INF/osworkflow.xml

  • OpenSymphony Workflow Project Page