org.apache.lenya.workflow.impl
Class WorkflowBuilder

java.lang.Object
  extended by org.apache.avalon.framework.logger.AbstractLogEnabled
      extended by org.apache.lenya.workflow.impl.WorkflowBuilder
All Implemented Interfaces:
org.apache.avalon.framework.logger.LogEnabled

public class WorkflowBuilder
extends org.apache.avalon.framework.logger.AbstractLogEnabled

Utility class to build a workflow schema from a file.


Field Summary
protected static java.lang.String ASSIGNMENT_ELEMENT
           
protected static java.lang.String CLASS_ATTRIBUTE
           
protected static java.lang.String CONDITION_ELEMENT
           
protected static java.lang.String DESTINATION_ATTRIBUTE
           
protected static java.lang.String EVENT_ELEMENT
           
protected static java.lang.String ID_ATTRIBUTE
           
protected static java.lang.String INITIAL_ATTRIBUTE
           
protected static java.lang.String NAME_ATTRIBUTE
           
protected static java.lang.String SOURCE_ATTRIBUTE
           
protected static java.lang.String STATE_ELEMENT
           
protected static java.lang.String SYNCHRONIZED_ATTRIBUTE
           
protected static java.lang.String TRANSITION_ELEMENT
           
protected static java.lang.String VALUE_ATTRIBUTE
           
protected static java.lang.String VARIABLE_ATTRIBUTE
           
protected static java.lang.String VARIABLE_ELEMENT
           
 
Constructor Summary
WorkflowBuilder(org.apache.avalon.framework.logger.Logger logger)
          Ctor.
 
Method Summary
protected  BooleanVariableAssignmentImpl buildAssignment(org.w3c.dom.Element element)
          Builds an assignment object from an XML element.
protected  org.apache.lenya.workflow.Condition buildCondition(org.w3c.dom.Element element)
          Builds a condition from an XML element.
protected  java.lang.String buildEvent(org.w3c.dom.Element element)
          Builds an event from an XML element.
protected  java.lang.String buildState(org.w3c.dom.Element element)
          Builds a state from an XML element.
protected  TransitionImpl buildTransition(org.w3c.dom.Element element)
          Builds a transition from an XML element.
protected  BooleanVariableImpl buildVariable(org.w3c.dom.Element element)
          Builds a boolean variable from an XML element.
protected  WorkflowImpl buildWorkflow(java.lang.String name, org.w3c.dom.Document document)
          Builds a workflow object from an XML document.
 WorkflowImpl buildWorkflow(java.lang.String name, java.io.File file)
          Builds a workflow schema from a file.
protected  boolean isInitialStateElement(org.w3c.dom.Element element)
          Checks if a state element contains the initial state.
 
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

STATE_ELEMENT

protected static final java.lang.String STATE_ELEMENT
See Also:
Constant Field Values

TRANSITION_ELEMENT

protected static final java.lang.String TRANSITION_ELEMENT
See Also:
Constant Field Values

EVENT_ELEMENT

protected static final java.lang.String EVENT_ELEMENT
See Also:
Constant Field Values

CONDITION_ELEMENT

protected static final java.lang.String CONDITION_ELEMENT
See Also:
Constant Field Values

ID_ATTRIBUTE

protected static final java.lang.String ID_ATTRIBUTE
See Also:
Constant Field Values

INITIAL_ATTRIBUTE

protected static final java.lang.String INITIAL_ATTRIBUTE
See Also:
Constant Field Values

SOURCE_ATTRIBUTE

protected static final java.lang.String SOURCE_ATTRIBUTE
See Also:
Constant Field Values

DESTINATION_ATTRIBUTE

protected static final java.lang.String DESTINATION_ATTRIBUTE
See Also:
Constant Field Values

CLASS_ATTRIBUTE

protected static final java.lang.String CLASS_ATTRIBUTE
See Also:
Constant Field Values

VARIABLE_ELEMENT

protected static final java.lang.String VARIABLE_ELEMENT
See Also:
Constant Field Values

ASSIGNMENT_ELEMENT

protected static final java.lang.String ASSIGNMENT_ELEMENT
See Also:
Constant Field Values

VARIABLE_ATTRIBUTE

protected static final java.lang.String VARIABLE_ATTRIBUTE
See Also:
Constant Field Values

VALUE_ATTRIBUTE

protected static final java.lang.String VALUE_ATTRIBUTE
See Also:
Constant Field Values

NAME_ATTRIBUTE

protected static final java.lang.String NAME_ATTRIBUTE
See Also:
Constant Field Values

SYNCHRONIZED_ATTRIBUTE

protected static final java.lang.String SYNCHRONIZED_ATTRIBUTE
See Also:
Constant Field Values
Constructor Detail

WorkflowBuilder

public WorkflowBuilder(org.apache.avalon.framework.logger.Logger logger)
Ctor.

Parameters:
logger - The logger to use.
Method Detail

buildWorkflow

public WorkflowImpl buildWorkflow(java.lang.String name,
                                  java.io.File file)
                           throws org.apache.lenya.workflow.WorkflowException
Builds a workflow schema from a file.

Parameters:
name - The workflow name.
file - The file.
Returns:
A workflow schema implementation.
Throws:
org.apache.lenya.workflow.WorkflowException - if the file does not represent a valid workflow schema.

buildWorkflow

protected WorkflowImpl buildWorkflow(java.lang.String name,
                                     org.w3c.dom.Document document)
                              throws org.apache.lenya.workflow.WorkflowException
Builds a workflow object from an XML document.

Parameters:
name - The workflow name.
document - The XML document.
Returns:
A workflow implementation.
Throws:
org.apache.lenya.workflow.WorkflowException - when something went wrong.

isInitialStateElement

protected boolean isInitialStateElement(org.w3c.dom.Element element)
Checks if a state element contains the initial state.

Parameters:
element - An XML element.
Returns:
A boolean value.

buildState

protected java.lang.String buildState(org.w3c.dom.Element element)
Builds a state from an XML element.

Parameters:
element - An XML element.
Returns:
A state.

buildTransition

protected TransitionImpl buildTransition(org.w3c.dom.Element element)
                                  throws org.apache.lenya.workflow.WorkflowException
Builds a transition from an XML element.

Parameters:
element - An XML element.
Returns:
A transition.
Throws:
org.apache.lenya.workflow.WorkflowException - when something went wrong.

buildEvent

protected java.lang.String buildEvent(org.w3c.dom.Element element)
Builds an event from an XML element.

Parameters:
element - An XML element.
Returns:
An event.

buildCondition

protected org.apache.lenya.workflow.Condition buildCondition(org.w3c.dom.Element element)
                                                      throws org.apache.lenya.workflow.WorkflowException
Builds a condition from an XML element.

Parameters:
element - An XML element.
Returns:
A condition.
Throws:
org.apache.lenya.workflow.WorkflowException - when something went wrong.

buildVariable

protected BooleanVariableImpl buildVariable(org.w3c.dom.Element element)
Builds a boolean variable from an XML element.

Parameters:
element - An XML element.
Returns:
A boolean variable.

buildAssignment

protected BooleanVariableAssignmentImpl buildAssignment(org.w3c.dom.Element element)
                                                 throws org.apache.lenya.workflow.WorkflowException
Builds an assignment object from an XML element.

Parameters:
element - An XML element.
Returns:
An assignment object.
Throws:
org.apache.lenya.workflow.WorkflowException - when something went wrong.


Copyright $ Apache Software Foundation. All Rights Reserved.