cascading.cascade

## Class BaseCascade

- java.lang.Object
- - cascading.cascade.BaseCascade

All Implemented Interfaces:
  Cascade, UnitOfWork<CascadeStats>, ProcessLogger

    public class BaseCascade
    extends java.lang.Object
    implements ProcessLogger, Cascade

### Nested Class Summary

Nested Classes
`protected class` `BaseCascade.CascadeJob` Class CascadeJob manages Flow execution in the current Cascade instance.

### Field Summary

### Fields inherited from interface cascading.util.ProcessLogger

`NULL`

### Constructor Summary

Constructors
`protected` `BaseCascade()` for testing

### Method Summary

Methods
`void` `addListener(CascadeListener cascadeListener)`
`void` `cleanup()`
`void` `complete()` Method complete begins the current Cascade process if method `Cascade.start()` was not previously called.
`java.util.List<Flow>` `findFlows(java.lang.String regex)` Method findFlows returns a List of flows whose names match the given regex pattern.
`java.util.Collection<Flow>` `findFlowsSinkingTo(java.lang.String identifier)` Method findFlowsSinkingTo returns all Flow instances that writes to a sink with the given identifier.
`java.util.Collection<Flow>` `findFlowsSourcingFrom(java.lang.String identifier)` Method findFlowsSourcingFrom returns all Flow instances that reads from a source with the given identifier.
`protected void` `fireOnStarting()`
`protected void` `fireOnStopping()`
`java.util.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.
`java.util.Collection<Tap>` `getCheckpointsTaps()` Method getCheckpointTaps returns all checkpoint Tap instances from all the Flow instances in this Cascade instance.
`protected FlowGraph` `getFlowGraph()`
`java.util.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.
`java.util.Collection<Flow>` `getHeadFlows()` Method getHeadFlows returns all Flow instances that are at the "head" of the flow graph.
`java.lang.String` `getID()` Method getID returns the ID of this Cascade object.
`protected IdentifierGraph` `getIdentifierGraph()`
`java.util.Collection<Flow>` `getIntermediateFlows()` Method getIntermediateFlows returns all Flow instances that are neither at the "tail" or "tail" of the flow graph.
`java.util.Collection<Tap>` `getIntermediateTaps()` Method getIntermediateTaps returns all Tap instances that are neither at the source or sink of the flow graph.
`java.lang.String` `getName()` Method getName returns the name of this Cascade object.
`java.util.Collection<Flow>` `getPredecessorFlows(Flow flow)` Method getPredecessorFlows returns a Collection of all the Flow instances that will be executed before the given Flow instance.
`java.util.Collection<Tap>` `getSinkTaps()` Method getSinkTaps returns all sink Tap instances in this Cascade instance.
`java.util.Collection<Tap>` `getSourceTaps()` Method getSourceTaps returns all source Tap instances in this Cascade instance.
`UnitOfWorkSpawnStrategy` `getSpawnStrategy()`
`CascadeStats` `getStats()`
`java.util.Collection<Flow>` `getSuccessorFlows(Flow flow)` Method getSuccessorFlows returns a Collection of all the Flow instances that will be executed after the given Flow instance.
`java.lang.String` `getTags()` Method getTags returns the tags associated with this Cascade object.
`java.util.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(java.lang.String message, java.lang.Object... arguments)`
`void` `logError(java.lang.String message, java.lang.Object... arguments)`
`void` `logError(java.lang.String message, java.lang.Throwable throwable)`
`void` `logInfo(java.lang.String message, java.lang.Object... arguments)`
`void` `logWarn(java.lang.String message)`
`void` `logWarn(java.lang.String message, java.lang.Object... arguments)`
`void` `logWarn(java.lang.String message, java.lang.Throwable throwable)`
`void` `prepare()`
`protected void` `printElementGraph(java.lang.String filename, org.jgrapht.graph.SimpleDirectedGraph<java.lang.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()`
`java.lang.String` `toString()`
`void` `writeDOT(java.lang.String filename)` Method writeDOT writes this element graph to a DOT file for easy visualization and debugging.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

### Constructor Detail

#### BaseCascade

    protected BaseCascade()

for testing

### Method Detail

#### getName

    public java.lang.String getName()

Method getName returns the name of this Cascade object.

Specified by:
  `getName` in interface `UnitOfWork<CascadeStats>`
Returns:
  the name (type String) of this Cascade object.

#### getID

    public java.lang.String getID()

Method getID returns the ID of this Cascade object.

The ID value is a long HEX String used to identify this instance globally. Subsequent Cascade instances created with identical parameters will not return the same ID.

Specified by:
  `getID` in interface `UnitOfWork<CascadeStats>`
Returns:
  the ID (type String) of this Cascade object.

#### getTags

    public java.lang.String getTags()

Method getTags returns the tags associated with this Cascade object.

Specified by:
  `getTags` in interface `UnitOfWork<CascadeStats>`
Returns:
  the tags (type String) of this Cascade object.

#### hasListeners

    public boolean hasListeners()

Specified by:
  `hasListeners` in interface `Cascade`

#### addListener

    public void addListener(CascadeListener cascadeListener)

Specified by:
  `addListener` in interface `Cascade`

#### removeListener

    public boolean removeListener(CascadeListener flowListener)

Specified by:
  `removeListener` in interface `Cascade`

#### fireOnStopping

    protected void fireOnStopping()

#### fireOnStarting

    protected void fireOnStarting()

#### getCascadeStats

    public CascadeStats getCascadeStats()

Description copied from interface: `Cascade`
Method getCascadeStats returns the cascadeStats of this Cascade object.

Specified by:
  `getCascadeStats` in interface `Cascade`
Returns:
  the cascadeStats (type CascadeStats) of this Cascade object.

#### getStats

    public CascadeStats getStats()

Specified by:
  `getStats` in interface `UnitOfWork<CascadeStats>`

#### getFlowGraph

    protected FlowGraph getFlowGraph()

#### getIdentifierGraph

    protected IdentifierGraph getIdentifierGraph()

#### getFlows

    public java.util.List<Flow> getFlows()

Description copied from interface: `Cascade`
Method getFlows returns the flows managed by this Cascade object. The returned `Flow` instances will be in topological order.

Specified by:
  `getFlows` in interface `Cascade`
Returns:
  the flows (type Collection<Flow>) of this Cascade object.

#### findFlows

    public java.util.List<Flow> findFlows(java.lang.String regex)

Description copied from interface: `Cascade`
Method findFlows returns a List of flows whose names match the given regex pattern.

Specified by:
  `findFlows` in interface `Cascade`
Parameters:
  `regex` - of type String
Returns:
  List<Flow>

#### getHeadFlows

    public java.util.Collection<Flow> getHeadFlows()

Description copied from interface: `Cascade`
Method getHeadFlows returns all Flow instances that are at the "head" of the flow graph.

That is, they are the first to execute and have no Tap source dependencies with Flow instances in the this Cascade instance.

Specified by:
  `getHeadFlows` in interface `Cascade`
Returns:
  Collection<Flow>

#### getTailFlows

    public java.util.Collection<Flow> getTailFlows()

Description copied from interface: `Cascade`
Method getTailFlows returns all Flow instances that are at the "tail" of the flow graph.

That is, they are the last to execute and have no Tap sink dependencies with Flow instances in the this Cascade instance.

Specified by:
  `getTailFlows` in interface `Cascade`
Returns:
  Collection<Flow>

#### getIntermediateFlows

    public java.util.Collection<Flow> getIntermediateFlows()

Description copied from interface: `Cascade`
Method getIntermediateFlows returns all Flow instances that are neither at the "tail" or "tail" of the flow graph.

Specified by:
  `getIntermediateFlows` in interface `Cascade`
Returns:
  Collection<Flow>

#### getTapGraph

    protected TapGraph getTapGraph()

#### getSourceTaps

    public java.util.Collection<Tap> getSourceTaps()

Description copied from interface: `Cascade`
Method getSourceTaps returns all source Tap instances in this Cascade instance.

That is, none of returned Tap instances are the sinks of other Flow instances in this Cascade.

All `CompositeTap` instances are unwound if addressed directly by a managed Flow instance.

Specified by:
  `getSourceTaps` in interface `Cascade`
Returns:
  Collection<Tap>

#### getSinkTaps

    public java.util.Collection<Tap> getSinkTaps()

Description copied from interface: `Cascade`
Method getSinkTaps returns all sink Tap instances in this Cascade instance.

That is, none of returned Tap instances are the sources of other Flow instances in this Cascade.

All `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.

Specified by:
  `getSinkTaps` in interface `Cascade`
Returns:
  Collection<Tap>

#### getCheckpointsTaps

    public java.util.Collection<Tap> getCheckpointsTaps()

Description copied from interface: `Cascade`
Method getCheckpointTaps returns all checkpoint Tap instances from all the Flow instances in this Cascade instance.

Specified by:
  `getCheckpointsTaps` in interface `Cascade`
Returns:
  Collection<Tap>

#### getIntermediateTaps

    public java.util.Collection<Tap> getIntermediateTaps()

Description copied from interface: `Cascade`
Method getIntermediateTaps returns all Tap instances that are neither at the source or sink of the flow graph.

This method does consider checkpoint Taps managed by Flow instances in this Cascade instance.

Specified by:
  `getIntermediateTaps` in interface `Cascade`
Returns:
  Collection<Flow>

#### getAllTaps

    public java.util.Collection<Tap> getAllTaps()

Description copied from interface: `Cascade`
Method getAllTaps returns all source, sink, and checkpoint Tap instances associated with the managed Flow instances in this Cascade instance.

Specified by:
  `getAllTaps` in interface `Cascade`
Returns:
  Collection<Tap>

#### getSuccessorFlows

    public java.util.Collection<Flow> getSuccessorFlows(Flow flow)

Description copied from interface: `Cascade`
Method getSuccessorFlows returns a Collection of all the Flow instances that will be executed after the given Flow instance.

Specified by:
  `getSuccessorFlows` in interface `Cascade`
Parameters:
  `flow` - of type Flow
Returns:
  Collection<Flow>

#### getPredecessorFlows

    public java.util.Collection<Flow> getPredecessorFlows(Flow flow)

Description copied from interface: `Cascade`
Method getPredecessorFlows returns a Collection of all the Flow instances that will be executed before the given Flow instance.

Specified by:
  `getPredecessorFlows` in interface `Cascade`
Parameters:
  `flow` - of type Flow
Returns:
  Collection<Flow>

#### findFlowsSourcingFrom

    public java.util.Collection<Flow> findFlowsSourcingFrom(java.lang.String identifier)

Description copied from interface: `Cascade`
Method findFlowsSourcingFrom returns all Flow instances that reads from a source with the given identifier.

Specified by:
  `findFlowsSourcingFrom` in interface `Cascade`
Parameters:
  `identifier` - of type String
Returns:
  Collection<Flow>

#### findFlowsSinkingTo

    public java.util.Collection<Flow> findFlowsSinkingTo(java.lang.String identifier)

Description copied from interface: `Cascade`
Method findFlowsSinkingTo returns all Flow instances that writes to a sink with the given identifier.

Specified by:
  `findFlowsSinkingTo` in interface `Cascade`
Parameters:
  `identifier` - of type String
Returns:
  Collection<Flow>

#### getFlowSkipStrategy

    public FlowSkipStrategy getFlowSkipStrategy()

Description copied from interface: `Cascade`
Method getFlowSkipStrategy returns the current `FlowSkipStrategy` used by this Flow.

Specified by:
  `getFlowSkipStrategy` in interface `Cascade`
Returns:
  FlowSkipStrategy

#### setFlowSkipStrategy

    public FlowSkipStrategy setFlowSkipStrategy(FlowSkipStrategy flowSkipStrategy)

Description copied from interface: `Cascade`
Method setFlowSkipStrategy sets a new `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()`

Specified by:
  `setFlowSkipStrategy` in interface `Cascade`
Parameters:
  `flowSkipStrategy` - of type FlowSkipStrategy
Returns:
  FlowSkipStrategy

#### prepare

    public void prepare()

Specified by:
  `prepare` in interface `UnitOfWork<CascadeStats>`

#### start

    public void start()

Description copied from interface: `Cascade`
Method start begins the current Cascade process. It returns immediately. See method `Cascade.complete()` to block until the Cascade completes.

Specified by:
  `start` in interface `Cascade`
Specified by:
  `start` in interface `UnitOfWork<CascadeStats>`

#### complete

    public void complete()

Description copied from interface: `Cascade`
Method complete begins the current Cascade process if method `Cascade.start()` was not previously called. This method blocks until the process completes.

Specified by:
  `complete` in interface `Cascade`
Specified by:
  `complete` in interface `UnitOfWork<CascadeStats>`

#### stop

    public void stop()

Specified by:
  `stop` in interface `Cascade`
Specified by:
  `stop` in interface `UnitOfWork<CascadeStats>`

#### cleanup

    public void cleanup()

Specified by:
  `cleanup` in interface `UnitOfWork<CascadeStats>`

#### writeDOT

    public void writeDOT(java.lang.String filename)

Description copied from interface: `Cascade`
Method writeDOT writes this element graph to a DOT file for easy visualization and debugging.

Specified by:
  `writeDOT` in interface `Cascade`
Parameters:
  `filename` - of type String

#### printElementGraph

    protected void printElementGraph(java.lang.String filename,
                         org.jgrapht.graph.SimpleDirectedGraph<java.lang.String,BaseFlow.FlowHolder> graph)

#### toString

    public java.lang.String toString()

Overrides:
  `toString` in class `java.lang.Object`

#### isInfoEnabled

    public boolean isInfoEnabled()

Specified by:
  `isInfoEnabled` in interface `ProcessLogger`

#### isDebugEnabled

    public boolean isDebugEnabled()

Specified by:
  `isDebugEnabled` in interface `ProcessLogger`

#### logInfo

    public void logInfo(java.lang.String message,
               java.lang.Object... arguments)

Specified by:
  `logInfo` in interface `ProcessLogger`

#### logDebug

    public void logDebug(java.lang.String message,
                java.lang.Object... arguments)

Specified by:
  `logDebug` in interface `ProcessLogger`

#### logWarn

    public void logWarn(java.lang.String message)

Specified by:
  `logWarn` in interface `ProcessLogger`

#### logWarn

    public void logWarn(java.lang.String message,
               java.lang.Throwable throwable)

Specified by:
  `logWarn` in interface `ProcessLogger`

#### logWarn

    public void logWarn(java.lang.String message,
               java.lang.Object... arguments)

Specified by:
  `logWarn` in interface `ProcessLogger`

#### logError

    public void logError(java.lang.String message,
                java.lang.Object... arguments)

Specified by:
  `logError` in interface `ProcessLogger`

#### logError

    public void logError(java.lang.String message,
                java.lang.Throwable throwable)

Specified by:
  `logError` in interface `ProcessLogger`

#### getSpawnStrategy

    public UnitOfWorkSpawnStrategy getSpawnStrategy()

Specified by:
  `getSpawnStrategy` in interface `UnitOfWork<CascadeStats>`

#### setSpawnStrategy

    public void setSpawnStrategy(UnitOfWorkSpawnStrategy spawnStrategy)

Specified by:
  `setSpawnStrategy` in interface `UnitOfWork<CascadeStats>`