public interface GraphEngineFacade
GraphEngineFacade is the interface that external systems should use
to communicated with a graph engine.
An graph engine executes a workflow. A Graph specifies how it should
be executed and a GraphInstance tracks the current state of
execution. It is an graph engine which creates instances of
GraphInstance and Token.
Engines must be thread-safe. Thus implementations of interface may be safely
shared among threads.
| Modifier and Type | Method and Description |
|---|---|
void |
abort(GraphInstance instance)
Aborts the given
GraphInstance's execution and cancels all
associated tokens and work items. |
void |
complete(GraphWorkItem workItem)
Completes the executed work item and continues execution until another
wait state is reached or until the graph instance is completed.
|
BeanResolver |
getBeanResolver()
Returns the engine's
BeanResolver, or null
if the engine does not support to resolve beans. |
NewGraphInstanceCreator |
getNewGraphInstanceCreator()
Returns the engine's
NewGraphInstanceCreator, or null
if the engine does not support to create sub graph instances. |
GraphRepository |
getRepository()
Returns the engine's
GraphRepository. |
void |
registerInstanceEventListener(GraphInstanceEventListener listener)
Adds a
GraphInstanceEventListener to the engine. |
void |
registerNodeEventListener(NodeEventListener listener)
Adds a
NodeEventListener to the engine. |
void |
registerWorkItemEventListener(GraphWorkItemEventListener listener)
Adds a
GraphWorkItemEventListener to the engine. |
GraphInstance |
start(Graph graph)
A shorthand for
#start(Graph, Environment, String) using an empty
initial environment and a null external id. |
GraphInstance |
start(Graph graph,
Environment initialEnvironment) |
GraphInstanceImpl |
start(Graph graph,
Environment initialEnvironment,
Long externalId)
|
GraphInstance |
start(String graphName)
A shorthand for
#start(String, Integer, Environment, String) using
the latest graph with the given name and an empty initial environment and
a null external id. |
GraphInstance |
start(String graphName,
Integer version)
A shorthand for
#start(String, Integer, Environment, String) using
an empty initial environment and a null external id. |
GraphInstance |
start(String graphName,
Integer version,
Environment initialEnvironment)
A shorthand for
#start(String, Integer, Environment, String) using a
null external id. |
GraphInstance |
start(String graphName,
Integer version,
Environment initialEnvironment,
Long externalId)
Starts a
GraphInstance of the Graph with the given name
and version and using the given Environment and associates the created
GraphInstance with the given external. |
GraphInstance start(String graphName)
#start(String, Integer, Environment, String) using
the latest graph with the given name and an empty initial environment and
a null external id.GraphInstance start(String graphName, Integer version)
#start(String, Integer, Environment, String) using
an empty initial environment and a null external id.GraphInstance start(String graphName, Integer version, Environment initialEnvironment)
#start(String, Integer, Environment, String) using a
null external id.GraphInstance start(String graphName, Integer version, Environment initialEnvironment, Long externalId)
GraphInstance of the Graph with the given name
and version and using the given Environment and associates the created
GraphInstance with the given external. Is the equivalent of doing
Graph graph = engine.getRepository().getLatestGraph(graphName);
GraphInstance graphInstance = engine.start(graph, initialEnvironment,
externalId);
If no graph is found for the given graphName, a WorkflowException
will be thrown.graphName - the name of the graph to executeversion - the version of the graph to execute of null for
the latest graph with the given name.initialEnvironment - A starting environment for the GraphInstance. All
attributes from this environment will be copied into the new
graph instance's environment before execution starts.externalId - the external id that the graph instance is associated withGraphInstance of the latest Graph with the
given name and using the given Environment which has
already been started (and, given that no wait states were
entered, is already completed).WorkflowException - If no graph is found with the given graphNameGraphInstance start(Graph graph)
#start(Graph, Environment, String) using an empty
initial environment and a null external id.GraphInstance start(Graph graph, Environment initialEnvironment)
GraphInstanceImpl start(Graph graph, Environment initialEnvironment, Long externalId)
GraphInstance of the given Graph using the given
Environment. A Token will be generated for the start node
(determined by Graph.getStartNode()), and this token will be
executed. If the graph does not contain nodes which go into a wait state,
the GraphInstance returned will be completed.
Before the graph instance is started, the given initial environment will be copied into the one of the new graph instance.
graph - the graph to create a graph instance ofinitialEnvironment - an initial environment for the graph instanceexternalId - the external id that the graph instance is associated withvoid abort(GraphInstance instance)
GraphInstance's execution and cancels all
associated tokens and work items.instance - the graph instance to abortvoid complete(GraphWorkItem workItem)
workItem - the work item to completeGraphRepository getRepository()
GraphRepository.GraphRepositoryBeanResolver getBeanResolver()
BeanResolver, or null
if the engine does not support to resolve beans.BeanResolver, or null
if the engine does not support to resolve beans.NewGraphInstanceCreator getNewGraphInstanceCreator()
NewGraphInstanceCreator, or null
if the engine does not support to create sub graph instances.NewGraphInstanceCreator, or null
if the engine does not support to create sub graph instances.void registerInstanceEventListener(GraphInstanceEventListener listener)
GraphInstanceEventListener to the engine.listener - listener to be addedvoid registerWorkItemEventListener(GraphWorkItemEventListener listener)
GraphWorkItemEventListener to the engine.listener - listener to be addedvoid registerNodeEventListener(NodeEventListener listener)
NodeEventListener to the engine.listener - listener to be addedCopyright © 2018. All rights reserved.