Class TaskCallBlock

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable, org.w3c.dom.Document, org.w3c.dom.Node

    public class TaskCallBlock
    extends Entry
    The TaskCallBlock (TCB) is used by a caller to set a number of parameters for an AssemblyLine. The TCB can provide the user with a list of input/output parameters specified by an AssemblyLine and also all the connectors and their parameters the user can set. You can use this feature to discover dynamically what an AssemblyLine is expecting as its initial work entry and also what it will return in its result entry. The TCB consists of the following logical sections:
    1. The Initial Work Entry passed to the AssemblyLine
    2. The connector parameters
    3. The input/output mapping rules for the AssemblyLine
    4. An optional user provided accumulator object that receives all work entries from the AL
    Calling an AssemblyLine with an initial work entry and setting the input connector's filePath parameter to 'd:/myinput.txt' is accomplished with the following code:
     var tcb = system.newTCB();
     tcb.setInitialWorkEntry(iwe);
     tcb.setConnectorParameter("input", "filePath", "d:/myinput.txt");
     
     var al = main.startAL("MyAssemblyLine", tcb);
     
    The TCB is also called by the AssemblyLine for each work entry in the AL. This work entry can be accumulated by the TCB into an object called the accumulator. The accumulator can be one of the following:
    • java.util.Collection - All work entries are cloned and added to the collection (e.g. ArrayList, Vector ..)
    • ConnectorInterface - The putEntry() method is called
    • ParserInterface - The writeEntry() method is called
    • AssemblyLineComponent - The add() method is called
    If the accumulator is not of the above classes/interfaces an exception is thrown. To accumulate all work entries in an AssemblyLine into an XML file you could do this:
     
     var parser = system.getParser ( "ibmdi.XML" );
     parser.setOutputStream ( new java.io.FileOutputStream ( "d:/accum.xml" );
     parser.initParser();
     tcb.setAccumulator ( parser );
     
     var al = main.startAL ( "MyAssemblyLine", tcb );
     al.join();
     
     parser.closeParser();
     
     
    Of course, you could configure a connector instead of programming the parser manually as in:
     
      var connector = system.getConnector ("MypreconfiguredOutputConnectorWithXMLParser");
      tcb.setAccumulator ( connector );
      ...
      connector.terminate();
     
     
    The TCB is typically initialized by the user and then used by the assemblyline. If the assemblyline has a call/return specification the TCB will remap input attributes (initial work entry) into what the AL expects internally and likewise for setting the result object. This is done so that the external call interface to an assemblyline can remain the same even though the internal work entry names change in the assemblyline itself. Once the TCB is passed to an assemblyline you should not expect anything more from the TCB. Use the assemblyline's getResult() and getStats() to retrieve the result object and statistics. The TCB result mapping is performed before the Epilog so you can still access the final result before the caller of the AL gets to it.
    See Also:
    Serialized Form
    • Constructor Detail

      • TaskCallBlock

        public TaskCallBlock()
      • TaskCallBlock

        public TaskCallBlock​(java.lang.String assemblyLine)
                      throws java.lang.Exception
        Constructor - Populate object with assemblyline input/output parameters and connector parameters.
        Throws:
        java.lang.Exception
      • TaskCallBlock

        public TaskCallBlock​(java.lang.String assemblyLine,
                             TaskInterface task)
                      throws java.lang.Exception
        Throws:
        java.lang.Exception
      • TaskCallBlock

        public TaskCallBlock​(java.lang.String assemblyLine,
                             AssemblyLineConfig alc,
                             TaskInterface task)
                      throws java.lang.Exception
        Constructor - Populate object with assemblyline input/output parameters and connector parameters, and a task context.
        Throws:
        java.lang.Exception
    • Method Detail

      • setTask

        public void setTask​(TaskInterface task)
        Sets the logger from the given task context
      • loadMapping

        public void loadMapping()
        Set the Call/Return mapping
      • getAssemblyLineName

        public java.lang.String getAssemblyLineName()
        Returns the assemblyline name this TCB was built from
      • setAssemblyLineName

        public void setAssemblyLineName​(java.lang.String assemblyLine)
        Sets the assemblyline name this TCB applies to
      • getInitialWorkEntry

        public Entry getInitialWorkEntry()
        Returns the initial work entry provided by caller
      • setInitialWorkEntry

        public void setInitialWorkEntry​(Entry entry)
        Sets the initial work entry
      • buildInitialWorkEntry

        public Entry buildInitialWorkEntry()
                                    throws java.lang.Exception
        Constructs a new initial work entry if there are an input parameter specification in the assemblyline. Otherwise, uses the provided IWE asis.
        Throws:
        java.lang.Exception
      • getInputParameters

        public Entry getInputParameters()
        Returns the input parameter entry (from the AssemblyLine specification)
      • setInputParameters

        public void setInputParameters​(Entry entry)
        Sets the input parameter entry (from the AssemblyLine specification)
      • getOutputParameters

        public Entry getOutputParameters()
      • setOutputParameters

        public void setOutputParameters​(Entry entry)
        Sets the output parameter entry (from the AssemblyLine specification)
      • getResultEntry

        public Entry getResultEntry()
        Returns the result entry provided by the caller
      • setResultEntry

        public void setResultEntry​(Entry entry)
      • buildResultEntry

        public Entry buildResultEntry()
                               throws java.lang.Exception
        Builds the result object based on AL's result object and the output parameter specification.
        Throws:
        java.lang.Exception
      • getConnectorParameters

        public Entry getConnectorParameters()
      • getConnectorParameters

        public Entry getConnectorParameters​(java.lang.String connectorName)
        Returns the parameters Entry for a specific connector.
      • getConnectorParameter

        public java.lang.Object getConnectorParameter​(java.lang.String connectorName,
                                                      java.lang.String connectorParameter)
        Returns the current value for a connector parameter as a String
      • getConnectorParameter

        public java.lang.Object getConnectorParameter​(java.lang.String connectorName,
                                                      java.lang.String connectorParameter,
                                                      boolean string)
        Returns the current value for a connector parameter.
      • setConnectorParameters

        public void setConnectorParameters​(AssemblyLine task)
                                    throws java.lang.Exception
        Modifies connector configurations in the AssemblyLine (method is called by AssemblyLine)
        Throws:
        java.lang.Exception
      • setConnectorParameters

        public void setConnectorParameters​(java.lang.String connectorName,
                                           BaseConfiguration parameters)
        Populates the parameter Entry for a specific connector with names from the configuration.
      • setConnectorParameter

        public void setConnectorParameter​(java.lang.String connectorName,
                                          java.lang.String parameterName,
                                          java.lang.Object parameterValue)
        Sets a connector parameter.
        Parameters:
        connectorName - The Connector's name
        parameterName - The name of the parameter for the Connector
        parameterValue - The new value for the parameter
      • setComponentParameter

        public void setComponentParameter​(java.lang.String componentName,
                                          java.lang.String parameterName,
                                          java.lang.Object parameterValue)
        Sets a component parameter.
        Parameters:
        componentName - The Component's name
        parameterName - The name of the parameter for the Component
        parameterValue - The new value for the parameter
      • setConnectorParameter

        public void setConnectorParameter​(java.lang.String connectorName,
                                          java.lang.String parameterName,
                                          java.lang.Object parameterValue,
                                          boolean protect)
        Sets a connector parameter.
        Parameters:
        connectorName - The Connector's name
        parameterName - The name of the parameter for the Connector
        parameterValue - The new value for the parameter
        protect - If true, do not print the value of this parameter in log files
      • setComponentParameter

        public void setComponentParameter​(java.lang.String componentName,
                                          java.lang.String parameterName,
                                          java.lang.Object parameterValue,
                                          boolean protect)
        Sets a component parameter, with a possibility to protect the parameter.
        Parameters:
        componentName - The Component's name
        parameterName - The name of the parameter for the Component
        parameterValue - The new value for the parameter
        protect - If true, do not print the value of this parameter in log files
      • setRuntimeConnector

        public void setRuntimeConnector​(java.lang.String connectorName,
                                        ConnectorInterface runtimeConnector)
        Sets the runtime connector for a named connector. If connectorName is null, the runtimeConnector is anonymous.
      • getRuntimeConnector

        public ConnectorInterface getRuntimeConnector​(java.lang.String connectorName)
        Returns the runtime connector for a named connector
      • setRuntimeFunction

        public void setRuntimeFunction​(java.lang.String name,
                                       FunctionInterface function)
        Sets the runtime function for a named function. If name is null, the runtime function is anonymous.
      • getRuntimeFunction

        public FunctionInterface getRuntimeFunction​(java.lang.String name)
        Returns the runtime function for a named function
      • setRunMode

        public void setRunMode​(java.lang.String value)
        Sets the runmode.
        Parameters:
        value - The runmode to set. Legal values are "normal", "record", "playback", "manual" and "simulate".
      • getRunMode

        public java.lang.String getRunMode()
        Returns the runmode
        Returns:
        The RunMode for this AssemblyLine, "normal" if not set
      • buildTCBEntry

        public Entry buildTCBEntry​(Entry input,
                                   boolean inputMap)
                            throws java.lang.Exception
        Constructs a new Entry based on the parameter descriptors in params and source attributes in input entry.
        Throws:
        java.lang.Exception
      • setAccumulator

        public void setAccumulator​(java.lang.Object accumulator)
        Set the accumulator object to the provided object. This must be an instance of java.util.Collection, ConnectorInterface, ParserInterface or AssemblyLineComponent.
        Parameters:
        accumulator - The Object to use as the accumulator object.
      • setAccumulatorObject

        public void setAccumulatorObject​(java.lang.Object accumulator)
        Set the accumulator object to the provided object.
        See Also:
        setAccumulator(Object )
      • accumulateEntry

        public void accumulateEntry​(Entry work)
                             throws java.lang.Exception
        Adds an entry to the accumulator object (if any configured).
        Throws:
        java.lang.Exception
      • getStringProperty

        public java.lang.String getStringProperty​(java.lang.String propname,
                                                  java.lang.String defval)
      • getIntProperty

        public int getIntProperty​(java.lang.String propname,
                                  int defval)
                           throws java.lang.Exception
        Throws:
        java.lang.Exception
      • getBoolProperty

        public boolean getBoolProperty​(java.lang.String propname,
                                       boolean defval)
                                throws java.lang.Exception
        Throws:
        java.lang.Exception
      • getALSettings

        public Entry getALSettings()
        Returns the Entry containing the user specified AL settings.
      • setALSetting

        public void setALSetting​(java.lang.String paramname,
                                 java.lang.Object value)
        Sets the AL Settings parameter to value. The settings are the AL config section where you can set things like debug level, max reads etc.
      • getALSetting

        public java.lang.Object getALSetting​(java.lang.String paramname)
        Returns the AL Settings parameter to value. The settings are the AL config section where you can set things like debug level, max reads etc.
      • applyALSettings

        public void applyALSettings​(AssemblyLineConfig alc)
        Applies the user defined AL settings to the AssemblyLineConfig. Also sets the components to enabled/disabled as specified by setComponentEnabled(). This method is used by AssemblyLine on a cloned AssemblyLineConfig.
        Parameters:
        alc - The AssemblyLineConfig to modify
        See Also:
        setComponentEnabled(String, boolean )
      • setALOperation

        public void setALOperation​(java.lang.String operation)
        Sets the AL Operation.
        Parameters:
        operation - The AL operations
      • getALOperation

        public java.lang.String getALOperation()
        Returns the AL operation
        Returns:
        The operation for this AssemblyLine (null if not specified)
      • setOperationInitParams

        public void setOperationInitParams​(Entry params)
        Sets the AL Operation initialize parameters. This call replaces all previous init params
        Parameters:
        params - The AL operations
      • setOperationInitParam

        public void setOperationInitParam​(java.lang.String paramName,
                                          java.lang.Object paramValue)
        Sets an operation init parameter - this call creates the init param entry if not present and adds/replaces the param if one has already been set.
        Parameters:
        paramName - The name of the parameter
        paramValue - The value for the parameter
      • getOperationInitParams

        public Entry getOperationInitParams()
        Returns the operation init parameters
        Returns:
        The operation init parameters ( an empty Entry if nothing is specified )
      • setComponentEnabled

        public void setComponentEnabled​(java.lang.String name,
                                        boolean enabled)
        Set the named component to enabled or disabled status.
        Parameters:
        name - The name of the Component
        enabled - True if this component should be enabled, false if it should be disabled
      • getALInitializationParameters

        public SchemaConfig getALInitializationParameters()
        Returns the SchemaConfig for the Published AssemblyLine Initialization Parameters.
        Since:
        7.0
      • getALOperations

        public java.lang.String[] getALOperations()
        Returns a String[] with names of operations for the AssemblyLine.
        Since:
        7.0
      • getALOperationConfig

        public OperationConfig getALOperationConfig()
        Returns the AssemblyLine's OperationConfig for the current operation
        Since:
        7.0
      • getALOperationConfig

        public OperationConfig getALOperationConfig​(java.lang.String name)
        Returns the OperationConfig for the named operation in the AssemblyLine.
        Parameters:
        name - Name of the operation
        Since:
        7.0
      • clone

        public TaskCallBlock clone()
        Description copied from class: Entry
        Creates a shallow clone of the receiver. The Hierarchical Attributes contained in the data structures however are complete clones.
        Overrides:
        clone in class Entry
        Returns:
        a clone of the receiver.
      • setRegressionInputName

        public void setRegressionInputName​(java.lang.String fileName)
        Sets the filename to use when reading regression info.
        Parameters:
        fileName -
        Since:
        7.2
      • getRegressionInputName

        public java.lang.String getRegressionInputName()
        Returns the filename to use when reading regression info.
        Since:
        7.2
      • setRegressionOutputName

        public void setRegressionOutputName​(java.lang.String fileName)
        Sets the filename to use when writing regression info.
        Parameters:
        fileName -
        Since:
        7.2
      • getRegressionOutputName

        public java.lang.String getRegressionOutputName()
        Returns the filename to use when writing regression info.
        Since:
        7.2
      • setRegressionIgnoreWork

        public void setRegressionIgnoreWork​(boolean value)
        Sets if the work Entry should be ignored when reading or writing regression info.
        Parameters:
        value -
      • getRegressionIgnoreWork

        public boolean getRegressionIgnoreWork()
        Returns true if the work Entry should be ignored when reading or writing regression info. The default value is false.
        Returns:
      • setAddLogAppenders

        public void setAddLogAppenders​(boolean value)
        Sets the value returned by getAddLogAppenders()
        Parameters:
        value -
      • getAddLogAppenders

        public boolean getAddLogAppenders()
        Returns true if the configured AssemblyLine Log Appenders should be added to the Logger. The default value is true.
        Returns:
      • setTaskName

        public void setTaskName​(java.lang.String name)
        Sets the name the AL will get while running. This may be useful to give the AL a unique name, instead of the default name which is the same as the config name.
        Parameters:
        name -
      • getTaskName

        public java.lang.String getTaskName()
        Returns the name the AL will get while running.
        Returns:
        The specific AL name, or null if not set