public class Flow
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.util.List<javax.swing.filechooser.FileFilter> |
FLOW_FILE_EXTENSIONS
Holds available file extensions for flow files handled
|
Constructor and Description |
---|
Flow() |
Modifier and Type | Method and Description |
---|---|
void |
addAll(java.util.List<StepManagerImpl> steps)
All all steps in the supplied list to this Flow
|
void |
addStep(StepManagerImpl manager)
Add the given Step to this flow
|
boolean |
connectSteps(StepManagerImpl source,
StepManagerImpl target,
java.lang.String connectionType)
Connect the supplied source and target steps using the given
connectionType.
|
boolean |
connectSteps(StepManagerImpl source,
StepManagerImpl target,
java.lang.String connectionType,
boolean force)
Connect the supplied source and target steps using the given
connectionType.
|
Flow |
copyFlow()
Make a copy of this Flow
|
java.util.List<StepManagerImpl> |
findPotentialStartPoints()
Get a list of potential start points in this Flow.
|
StepManagerImpl |
findStep(java.lang.String stepName)
Find a Step by name
|
java.lang.String |
getFlowID()
Get an ID string for this flow.
|
static FlowLoader |
getFlowLoader(java.lang.String flowFileExtension,
Logger log)
Utility method to get a FlowLoader implementation suitable for loading a
flow with the supplied file extension.
|
java.lang.String |
getFlowName()
Get the name of this Flow
|
java.util.List<StepManagerImpl> |
getSteps()
Get a list of the Steps in this Flow
|
boolean |
initFlow(FlowExecutor executor)
Initialize the flow by setting the execution environment and calling the
init() method of each step
|
java.util.Iterator<StepManagerImpl> |
iterator()
Get an Iterator over the Steps in this flow
|
static Flow |
JSONToFlow(java.lang.String flowJSON)
Parse a Flow from the supplied JSON string
|
static Flow |
JSONToFlow(java.lang.String flowJSON,
boolean dontComplainAboutMissingConnections)
Parse a Flow from the supplied JSON string
|
static Flow |
loadFlow(java.io.File flowFile,
Logger log)
Utility method to load a flow from a file
|
static Flow |
loadFlow(java.io.InputStream is,
FlowLoader loader)
Utility method to load a flow from the supplied input stream using the
supplied FlowLoader
|
static Flow |
loadFlow(java.io.Reader r,
FlowLoader loader)
Utility method to load a flow from the supplied reader using the supplied
FlowLoader
|
void |
removeStep(StepManagerImpl manager)
Remove the supplied Step from this flow
|
void |
renameStep(StepManagerImpl step,
java.lang.String newName)
Rename the supplied step with the supplied name
|
void |
renameStep(java.lang.String oldName,
java.lang.String newName)
Rename a Step.
|
void |
saveFlow(java.io.File file)
Save this Flow to the supplied File
|
void |
setFlowName(java.lang.String name)
Set the name of this Flow
|
int |
size()
Get the number of steps in this flow
|
java.lang.String |
toJSON()
Return the JSON encoded version of this Flow
|
public static final java.util.List<javax.swing.filechooser.FileFilter> FLOW_FILE_EXTENSIONS
public static FlowLoader getFlowLoader(java.lang.String flowFileExtension, Logger log) throws WekaException
flowFileExtension
- the file extension to get a FlowLoader forlog
- the log in useWekaException
- if a problem occurspublic static Flow loadFlow(java.io.File flowFile, Logger log) throws WekaException
flowFile
- the file to load fromlog
- the log to useWekaException
- if a problem occurspublic static Flow loadFlow(java.io.InputStream is, FlowLoader loader) throws WekaException
is
- the input stream to load fromloader
- the FlowLoader to useWekaException
- if a problem occurspublic static Flow loadFlow(java.io.Reader r, FlowLoader loader) throws WekaException
r
- the reader to load fromloader
- the FlowLoader to useWekaException
- if a problem occurspublic static Flow JSONToFlow(java.lang.String flowJSON) throws WekaException
flowJSON
- the JSON string to parseWekaException
- if a problem occurspublic static Flow JSONToFlow(java.lang.String flowJSON, boolean dontComplainAboutMissingConnections) throws WekaException
flowJSON
- the JSON string to parsedontComplainAboutMissingConnections
- true to not raise an exception
if there are connections to non-existent Steps in the JSON flowWekaException
- if a problem occurspublic void saveFlow(java.io.File file) throws WekaException
file
- the File to save toWekaException
- if a problem occurspublic java.lang.String getFlowName()
public void setFlowName(java.lang.String name)
name
- the name to setpublic java.lang.String getFlowID()
public void addAll(java.util.List<StepManagerImpl> steps)
steps
- a list of StepManagers for the steps to addpublic void addStep(StepManagerImpl manager)
manager
- the StepManager containing the Step to addpublic boolean connectSteps(StepManagerImpl source, StepManagerImpl target, java.lang.String connectionType)
source
- the StepManager for the source steptarget
- the StepManager for the target stepconnectionType
- the connection type to use
says it can accept the connection type at this time)public boolean connectSteps(StepManagerImpl source, StepManagerImpl target, java.lang.String connectionType, boolean force)
source
- the StepManager for the source steptarget
- the StepManager for the target stepconnectionType
- the connection type to useforce
- true to force the connection (i.e. even if the target step
says it can accept the connection type at this time)public void renameStep(StepManagerImpl step, java.lang.String newName) throws WekaException
step
- the StepManager of the Step to renamenewName
- the new name to give the stepWekaException
- if the Step is not part of this Flow.public void renameStep(java.lang.String oldName, java.lang.String newName) throws WekaException
oldName
- the name of the Step to renamenewName
- the new name to useWekaException
- if the named Step is not part of this flowpublic void removeStep(StepManagerImpl manager) throws WekaException
manager
- the StepManager of the Step to removeWekaException
- if the step is not part of this flowpublic java.util.List<StepManagerImpl> getSteps()
public java.util.Iterator<StepManagerImpl> iterator()
public int size()
public StepManagerImpl findStep(java.lang.String stepName)
stepName
- the name of the Step to findpublic java.util.List<StepManagerImpl> findPotentialStartPoints()
public boolean initFlow(FlowExecutor executor) throws WekaException
executor
- the flow executor being used to execute the flowWekaException
- if a problem occurs during flow initializationpublic java.lang.String toJSON() throws WekaException
WekaException
- if a problem occurspublic Flow copyFlow() throws WekaException
WekaException
- if a problem occurs