public class BaseCascade extends Object implements ProcessLogger, Cascade
Modifier and Type | Class and Description |
---|---|
protected class |
BaseCascade.CascadeJob
Class CascadeJob manages Flow execution in the current Cascade instance.
|
NULL
Modifier | Constructor and Description |
---|---|
protected |
BaseCascade()
for testing
|
Modifier and Type | Method and Description |
---|---|
void |
addListener(CascadeListener cascadeListener) |
void |
cleanup() |
void |
complete()
Method complete begins the current Cascade process if method
Cascade.start() was not previously called. |
List<Flow> |
findFlows(String regex)
Method findFlows returns a List of flows whose names match the given regex pattern.
|
Collection<Flow> |
findFlowsSinkingTo(String identifier)
Method findFlowsSinkingTo returns all Flow instances that writes to a sink with the given identifier.
|
Collection<Flow> |
findFlowsSourcingFrom(String identifier)
Method findFlowsSourcingFrom returns all Flow instances that reads from a source with the given identifier.
|
protected void |
fireOnStarting() |
protected void |
fireOnStopping() |
Collection<Tap> |
getAllTaps()
Method getAllTaps returns all source, sink, and checkpoint Tap instances associated with the managed
Flow instances in this Cascade instance.
|
CascadeStats |
getCascadeStats()
Method getCascadeStats returns the cascadeStats of this Cascade object.
|
Collection<Tap> |
getCheckpointsTaps()
Method getCheckpointTaps returns all checkpoint Tap instances from all the Flow instances in this Cascade instance.
|
protected FlowGraph |
getFlowGraph() |
List<Flow> |
getFlows()
Method getFlows returns the flows managed by this Cascade object.
|
FlowSkipStrategy |
getFlowSkipStrategy()
Method getFlowSkipStrategy returns the current
FlowSkipStrategy used by this Flow. |
Collection<Flow> |
getHeadFlows()
Method getHeadFlows returns all Flow instances that are at the "head" of the flow graph.
|
String |
getID()
Method getID returns the ID of this Cascade object.
|
protected IdentifierGraph |
getIdentifierGraph() |
Collection<Flow> |
getIntermediateFlows()
Method getIntermediateFlows returns all Flow instances that are neither at the "tail" or "tail" of the flow graph.
|
Collection<Tap> |
getIntermediateTaps()
Method getIntermediateTaps returns all Tap instances that are neither at the source or sink of the flow graph.
|
String |
getName()
Method getName returns the name of this Cascade object.
|
Collection<Flow> |
getPredecessorFlows(Flow flow)
Method getPredecessorFlows returns a Collection of all the Flow instances that will be
executed before the given Flow instance.
|
Collection<Tap> |
getSinkTaps()
Method getSinkTaps returns all sink Tap instances in this Cascade instance.
|
Collection<Tap> |
getSourceTaps()
Method getSourceTaps returns all source Tap instances in this Cascade instance.
|
UnitOfWorkSpawnStrategy |
getSpawnStrategy() |
CascadeStats |
getStats() |
Collection<Flow> |
getSuccessorFlows(Flow flow)
Method getSuccessorFlows returns a Collection of all the Flow instances that will be
executed after the given Flow instance.
|
String |
getTags()
Method getTags returns the tags associated with this Cascade object.
|
Collection<Flow> |
getTailFlows()
Method getTailFlows returns all Flow instances that are at the "tail" of the flow graph.
|
protected TapGraph |
getTapGraph() |
boolean |
hasListeners() |
boolean |
isDebugEnabled() |
boolean |
isInfoEnabled() |
void |
logDebug(String message,
Object... arguments) |
void |
logError(String message,
Object... arguments) |
void |
logError(String message,
Throwable throwable) |
void |
logInfo(String message,
Object... arguments) |
void |
logWarn(String message) |
void |
logWarn(String message,
Object... arguments) |
void |
logWarn(String message,
Throwable throwable) |
void |
prepare() |
protected void |
printElementGraph(String filename,
org.jgrapht.graph.SimpleDirectedGraph<String,BaseFlow.FlowHolder> graph) |
boolean |
removeListener(CascadeListener flowListener) |
FlowSkipStrategy |
setFlowSkipStrategy(FlowSkipStrategy flowSkipStrategy)
Method setFlowSkipStrategy sets a new
FlowSkipStrategy , the current strategy, if any, is returned. |
void |
setSpawnStrategy(UnitOfWorkSpawnStrategy spawnStrategy) |
void |
start()
Method start begins the current Cascade process.
|
void |
stop() |
String |
toString() |
void |
writeDOT(String filename)
Method writeDOT writes this element graph to a DOT file for easy visualization and debugging.
|
protected BaseCascade()
public String getName()
getName
in interface UnitOfWork<CascadeStats>
public String getID()
getID
in interface UnitOfWork<CascadeStats>
public String getTags()
getTags
in interface UnitOfWork<CascadeStats>
public boolean hasListeners()
hasListeners
in interface Cascade
public void addListener(CascadeListener cascadeListener)
addListener
in interface Cascade
public boolean removeListener(CascadeListener flowListener)
removeListener
in interface Cascade
protected void fireOnStopping()
protected void fireOnStarting()
public CascadeStats getCascadeStats()
Cascade
getCascadeStats
in interface Cascade
public CascadeStats getStats()
getStats
in interface UnitOfWork<CascadeStats>
protected FlowGraph getFlowGraph()
protected IdentifierGraph getIdentifierGraph()
public List<Flow> getFlows()
Cascade
Flow
instances
will be in topological order.public List<Flow> findFlows(String regex)
Cascade
public Collection<Flow> getHeadFlows()
Cascade
getHeadFlows
in interface Cascade
public Collection<Flow> getTailFlows()
Cascade
getTailFlows
in interface Cascade
public Collection<Flow> getIntermediateFlows()
Cascade
getIntermediateFlows
in interface Cascade
protected TapGraph getTapGraph()
public Collection<Tap> getSourceTaps()
Cascade
CompositeTap
instances are unwound if addressed directly by a managed Flow instance.getSourceTaps
in interface Cascade
public Collection<Tap> getSinkTaps()
Cascade
CompositeTap
instances are unwound if addressed directly by a managed Flow instance.
This method will return checkpoint Taps managed by Flow instances if not used as a source by other Flow instances.getSinkTaps
in interface Cascade
public Collection<Tap> getCheckpointsTaps()
Cascade
getCheckpointsTaps
in interface Cascade
public Collection<Tap> getIntermediateTaps()
Cascade
getIntermediateTaps
in interface Cascade
public Collection<Tap> getAllTaps()
Cascade
getAllTaps
in interface Cascade
public Collection<Flow> getSuccessorFlows(Flow flow)
Cascade
getSuccessorFlows
in interface Cascade
flow
- of type Flowpublic Collection<Flow> getPredecessorFlows(Flow flow)
Cascade
getPredecessorFlows
in interface Cascade
flow
- of type Flowpublic Collection<Flow> findFlowsSourcingFrom(String identifier)
Cascade
findFlowsSourcingFrom
in interface Cascade
identifier
- of type Stringpublic Collection<Flow> findFlowsSinkingTo(String identifier)
Cascade
findFlowsSinkingTo
in interface Cascade
identifier
- of type Stringpublic FlowSkipStrategy getFlowSkipStrategy()
Cascade
FlowSkipStrategy
used by this Flow.getFlowSkipStrategy
in interface Cascade
public FlowSkipStrategy setFlowSkipStrategy(FlowSkipStrategy flowSkipStrategy)
Cascade
FlowSkipStrategy
, the current strategy, if any, is returned.
If a strategy is given, it will be used as the strategy for all BaseFlow
instances managed by this Cascade instance.
To revert back to consulting the strategies associated with each Flow instance, re-set this value to null
, its
default value.
FlowSkipStrategy instances define when a Flow instance should be skipped. The default strategy is FlowSkipIfSinkNotStale
and is inherited from the Flow instance in question. An alternative strategy would be FlowSkipIfSinkExists
.
A FlowSkipStrategy will not be consulted when executing a Flow directly through Cascade.start()
setFlowSkipStrategy
in interface Cascade
flowSkipStrategy
- of type FlowSkipStrategypublic void prepare()
prepare
in interface UnitOfWork<CascadeStats>
public void start()
Cascade
Cascade.complete()
to block
until the Cascade completes.start
in interface Cascade
start
in interface UnitOfWork<CascadeStats>
public void complete()
Cascade
Cascade.start()
was not previously called. This method
blocks until the process completes.complete
in interface Cascade
complete
in interface UnitOfWork<CascadeStats>
public void stop()
stop
in interface Cascade
stop
in interface UnitOfWork<CascadeStats>
public void cleanup()
cleanup
in interface UnitOfWork<CascadeStats>
public void writeDOT(String filename)
Cascade
protected void printElementGraph(String filename, org.jgrapht.graph.SimpleDirectedGraph<String,BaseFlow.FlowHolder> graph)
public boolean isInfoEnabled()
isInfoEnabled
in interface ProcessLogger
public boolean isDebugEnabled()
isDebugEnabled
in interface ProcessLogger
public void logInfo(String message, Object... arguments)
logInfo
in interface ProcessLogger
public void logDebug(String message, Object... arguments)
logDebug
in interface ProcessLogger
public void logWarn(String message)
logWarn
in interface ProcessLogger
public void logWarn(String message, Throwable throwable)
logWarn
in interface ProcessLogger
public void logWarn(String message, Object... arguments)
logWarn
in interface ProcessLogger
public void logError(String message, Object... arguments)
logError
in interface ProcessLogger
public void logError(String message, Throwable throwable)
logError
in interface ProcessLogger
public UnitOfWorkSpawnStrategy getSpawnStrategy()
getSpawnStrategy
in interface UnitOfWork<CascadeStats>
public void setSpawnStrategy(UnitOfWorkSpawnStrategy spawnStrategy)
setSpawnStrategy
in interface UnitOfWork<CascadeStats>
Copyright © 2007-2015 Concurrent, Inc. All Rights Reserved.