net.sf.dropboxmq.workflow
Class WorkflowProcessor

java.lang.Object
  extended by net.sf.dropboxmq.workflow.WorkflowProcessor

public class WorkflowProcessor
extends Object

Created: 08 Sep 2010

Version:
$Revision$, $Date$
Author:
Dwayne Schultz

Nested Class Summary
(package private) static class WorkflowProcessor.RuntimeEventType
           
 
Constructor Summary
WorkflowProcessor(String processorName, PersistenceFactory persistenceFactory, WorkflowTransformerFactory transformerFactory)
           
 
Method Summary
(package private) static Node addEvent(Node runHistory, Event event, Map<String,String> properties, boolean current, boolean append, EventAdapter eventAdapter)
           
(package private) static javax.xml.xpath.XPathExpression compileOptionalXPath(String xPath, javax.xml.xpath.XPath xPathCompiler)
           
(package private)  void completeRunHistory(Run run, Node runHistory, Map<Integer,Map<String,String>> eventProperties, EventAdapter eventAdapter)
           
(package private)  Run createNewRun(String key, Node currentContent, WorkflowProcessor.RuntimeEventType eventType)
           
(package private)  Collection<EventPackage> executeTransformer(Document runHistory, String transformerFilePath, EventAdapter eventAdapter)
           
(package private)  void executeTransition(Event event, Map<Integer,Map<String,String>> eventProperties, Run run, Node currentContent, Collection<EventPackage> childEvents, EventAdapter eventAdapter)
           
(package private)  WorkflowProcessor.RuntimeEventType findEventType(Node currentContent)
           
(package private)  Run findParentRun(Node currentContent, WorkflowProcessor.RuntimeEventType eventType)
           
(package private)  List<Run> getBroadcastRuns(Node currentContent, WorkflowProcessor.RuntimeEventType eventType)
           
(package private)  Run getRun(Node currentContent, WorkflowProcessor.RuntimeEventType eventType)
           
 void initialize()
           
(package private) static Element newRunHistory()
           
 void onEvent(String protocol, String content, Map<String,String> properties, EventAdapter eventAdapter)
           
(package private) static WorkflowProcessor.RuntimeEventType prepareEventType(EventType persistenceEventType, SimpleNamespaceContext namespaceContext)
           
(package private)  void prepareEventTypes()
           
(package private) static SimpleNamespaceContext prepareNamespaceContext(Collection<Namespace> namespaces)
           
(package private)  Collection<EventPackage> processEvent(Event event, Map<String,String> properties, Node currentContent, Run run, EventAdapter eventAdapter)
           
(package private)  Transition selectTransition(Document runHistory, Run run)
           
(package private) static Collection<String> sortKeys(NodeList keys)
           
(package private) static void updateCurrentStateAttribute(Element runHistory, Run run)
           
(package private) static void updateEventTimestampAttributes(Event event, Node content)
           
(package private) static void updateEventTransitionAttributes(Event event, Node content)
           
(package private) static void updateEventTypeAttribute(Event event, Node content)
           
(package private) static void updateRunHistory(Element runHistory, Run run)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WorkflowProcessor

public WorkflowProcessor(String processorName,
                         PersistenceFactory persistenceFactory,
                         WorkflowTransformerFactory transformerFactory)
Method Detail

initialize

public void initialize()

prepareNamespaceContext

static SimpleNamespaceContext prepareNamespaceContext(Collection<Namespace> namespaces)

prepareEventTypes

void prepareEventTypes()
                 throws javax.xml.xpath.XPathExpressionException
Throws:
javax.xml.xpath.XPathExpressionException

prepareEventType

static WorkflowProcessor.RuntimeEventType prepareEventType(EventType persistenceEventType,
                                                           SimpleNamespaceContext namespaceContext)
                                                    throws javax.xml.xpath.XPathExpressionException
Throws:
javax.xml.xpath.XPathExpressionException

compileOptionalXPath

static javax.xml.xpath.XPathExpression compileOptionalXPath(String xPath,
                                                            javax.xml.xpath.XPath xPathCompiler)
                                                     throws javax.xml.xpath.XPathExpressionException
Throws:
javax.xml.xpath.XPathExpressionException

onEvent

public void onEvent(String protocol,
                    String content,
                    Map<String,String> properties,
                    EventAdapter eventAdapter)

newRunHistory

static Element newRunHistory()
                      throws ParserConfigurationException
Throws:
ParserConfigurationException

addEvent

static Node addEvent(Node runHistory,
                     Event event,
                     Map<String,String> properties,
                     boolean current,
                     boolean append,
                     EventAdapter eventAdapter)
              throws IOException,
                     SAXException,
                     ParserConfigurationException
Throws:
IOException
SAXException
ParserConfigurationException

updateEventTypeAttribute

static void updateEventTypeAttribute(Event event,
                                     Node content)

updateEventTimestampAttributes

static void updateEventTimestampAttributes(Event event,
                                           Node content)

updateEventTransitionAttributes

static void updateEventTransitionAttributes(Event event,
                                            Node content)

findEventType

WorkflowProcessor.RuntimeEventType findEventType(Node currentContent)
                                           throws javax.xml.xpath.XPathExpressionException
Throws:
javax.xml.xpath.XPathExpressionException

getBroadcastRuns

List<Run> getBroadcastRuns(Node currentContent,
                           WorkflowProcessor.RuntimeEventType eventType)
                     throws javax.xml.xpath.XPathExpressionException
Throws:
javax.xml.xpath.XPathExpressionException

sortKeys

static Collection<String> sortKeys(NodeList keys)

createNewRun

Run createNewRun(String key,
                 Node currentContent,
                 WorkflowProcessor.RuntimeEventType eventType)
           throws javax.xml.xpath.XPathExpressionException
Throws:
javax.xml.xpath.XPathExpressionException

findParentRun

Run findParentRun(Node currentContent,
                  WorkflowProcessor.RuntimeEventType eventType)

getRun

Run getRun(Node currentContent,
           WorkflowProcessor.RuntimeEventType eventType)
     throws javax.xml.xpath.XPathExpressionException
Throws:
javax.xml.xpath.XPathExpressionException

processEvent

Collection<EventPackage> processEvent(Event event,
                                      Map<String,String> properties,
                                      Node currentContent,
                                      Run run,
                                      EventAdapter eventAdapter)
                                throws IOException,
                                       SAXException,
                                       ParserConfigurationException,
                                       javax.xml.xpath.XPathExpressionException,
                                       TransformerException
Throws:
IOException
SAXException
ParserConfigurationException
javax.xml.xpath.XPathExpressionException
TransformerException

updateRunHistory

static void updateRunHistory(Element runHistory,
                             Run run)

updateCurrentStateAttribute

static void updateCurrentStateAttribute(Element runHistory,
                                        Run run)

completeRunHistory

void completeRunHistory(Run run,
                        Node runHistory,
                        Map<Integer,Map<String,String>> eventProperties,
                        EventAdapter eventAdapter)
                  throws IOException,
                         SAXException,
                         ParserConfigurationException
Throws:
IOException
SAXException
ParserConfigurationException

executeTransition

void executeTransition(Event event,
                       Map<Integer,Map<String,String>> eventProperties,
                       Run run,
                       Node currentContent,
                       Collection<EventPackage> childEvents,
                       EventAdapter eventAdapter)
                 throws javax.xml.xpath.XPathExpressionException,
                        TransformerException,
                        ParserConfigurationException,
                        IOException,
                        SAXException
Throws:
javax.xml.xpath.XPathExpressionException
TransformerException
ParserConfigurationException
IOException
SAXException

selectTransition

Transition selectTransition(Document runHistory,
                            Run run)
                      throws javax.xml.xpath.XPathExpressionException
Throws:
javax.xml.xpath.XPathExpressionException

executeTransformer

Collection<EventPackage> executeTransformer(Document runHistory,
                                            String transformerFilePath,
                                            EventAdapter eventAdapter)
                                      throws ParserConfigurationException,
                                             TransformerException
Throws:
ParserConfigurationException
TransformerException