Class FlowRunner

  • All Implemented Interfaces:
    RevisionHandler

    public class FlowRunner
    extends Object
    implements RevisionHandler
    Small utility class for executing KnowledgeFlow flows outside of the KnowledgeFlow application
    Version:
    $Revision$
    Author:
    Mark Hall (mhall{[at]}pentaho{[dot]}org)
    • Constructor Detail

      • FlowRunner

        public FlowRunner()
        Constructor
      • FlowRunner

        public FlowRunner​(boolean loadProps,
                          boolean registerLog)
    • Method Detail

      • setLog

        public void setLog​(Logger log)
      • stopAllFlows

        public void stopAllFlows()
      • waitUntilFinished

        public void waitUntilFinished()
        Waits until all flows have finished executing before returning
      • load

        public void load​(String fileName)
                  throws Exception
        Load a serialized KnowledgeFlow (either binary or xml)
        Parameters:
        fileName - the name of the file to load from
        Throws:
        Exception - if something goes wrong
      • loadBinary

        public void loadBinary​(String fileName)
                        throws Exception
        Load a binary serialized KnowledgeFlow
        Parameters:
        fileName - the name of the file to load from
        Throws:
        Exception - if something goes wrong
      • loadXML

        public void loadXML​(String fileName)
                     throws Exception
        Load an XML serialized KnowledgeFlow
        Parameters:
        fileName - the name of the file to load from
        Throws:
        Exception - if something goes wrong
      • getFlows

        public Vector<Object> getFlows()
        Get the vector holding the flow(s)
        Returns:
        the Vector holding the flow(s)
      • setFlows

        public void setFlows​(Vector<Object> beans)
        Set the vector holding the flows(s) to run
        Parameters:
        beans - the Vector holding the flows to run
      • setEnvironment

        public void setEnvironment​(Environment env)
        Set the environment variables to use. NOTE: this needs to be called BEFORE a load method is invoked to ensure that the ${Internal.knowledgeflow.directory} variable get set in the supplied Environment object.
        Parameters:
        env - the environment variables to use.
      • getEnvironment

        public Environment getEnvironment()
        Get the environment variables that are in use.
        Returns:
        the environment variables that are in ues.
      • setStartSequentially

        public void setStartSequentially​(boolean s)
        Set whether to launch Startable beans one after the other or all in parallel.
        Parameters:
        s - true if Startable beans are to be launched sequentially
      • getStartSequentially

        public boolean getStartSequentially()
        Gets whether Startable beans will be launched sequentially or all in parallel.
        Returns:
        true if Startable beans will be launched sequentially
      • run

        public void run()
                 throws Exception
        Launch all loaded KnowledgeFlow
        Throws:
        Exception - if something goes wrong during execution
      • main

        public static void main​(String[] args)
        Main method for testing this class.
         Usage:\n\nFlowRunner 
         
        Parameters:
        args - command line arguments