Class AssemblyLine

  • All Implemented Interfaces:
    Listenable<AssemblyLine.AssemblyLineListener>, RecordPlaybackInterface, TaskInterface, java.lang.Runnable

    public final class AssemblyLine
    extends Monitor
    implements TaskInterface, RecordPlaybackInterface, Listenable<AssemblyLine.AssemblyLineListener>
    This class represents a IBM Tivoli Directory Integrator AssemblyLine. When an AssemblyLine needs to be started the com.ibm.di.server.RS object creates an instance of the AssemblyLine class and then calls the start() method on this instance. Since AssemblyLine inherits (indirectly) from java.lang.Thread this causes the run() method of the AssemblyLine to be called. An alternative method of running AssemblyLines is running them manually. This means that only a single cycle of the AssemblyLine is executed at a time, returning the work Entry result at the end of the cycle. An AssemblyLine can be run in manual mode by using the AssemblyLine constructor which is passed a com.ibm.di.server.TaskCallBlock object. This TaskCallBlock object must have had its AssemblyLine.TCB_RUNMODE_PROPNAME property set to the value of AssemblyLine.RUNMODE_MANUAL. Then a cycle can be executed by invoking the Entry executeCycle(Entry workEntry) AssemblyLine method.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static interface  AssemblyLine.AssemblyLineListener
      This interface is for internal use only.
      • Nested classes/interfaces inherited from class java.lang.Thread

        java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
    • Constructor Summary

      Constructors 
      Constructor Description
      AssemblyLine()
      Constructor for the AssemblyLine object that is available in JavaScript via the pre-registered variable task.
      AssemblyLine​(RSInterface parent, java.lang.String taskName, java.lang.Object param, Log log)
      Constructor for the AssemblyLine object that is available in JavaScript via the pre-registered variable task.
      AssemblyLine​(RSInterface parent, java.lang.String taskName, java.lang.Object param, Log log, AssemblyLineConfig alc)
      Constructor for the AssemblyLine object that is available in JavaScript via the pre-registered variable task.
    • Method Summary

      All Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      void addListener​(AssemblyLine.AssemblyLineListener listener)
      This method is for internal use only.
      void addRuntimeConnector​(java.lang.String name, ConnectorConfig config, boolean executeProlog)
      This method creates an ALComponent from the provided connector config.
      void addRuntimeIterator​(java.lang.String name, ConnectorInterface conn, boolean executeProlog)
      This method inserts a connector interface as an Iterator in the current AL.
      boolean autoActivateDebugger()
      This method will activate the AL debugger based on java system properties.
      void bailout​(java.lang.Throwable error)
      This method is used for handling thrown during the AL's work-flow errors.
      void debug​(java.lang.Object msg)
      Logs a message to the AssemblyLine log file
      void debugBreak​(java.lang.Object obj)
      This method sends an object for display to the debug panel and waits for a continue/stop message.
      void debugBreakError​(java.lang.Object obj)
      This method forces the debugger to stop if it runs in OnError mode.
      boolean debuggerEnabled()
      Returns status of the debugger session
      void debugMsg​(java.lang.Object obj)
      This method sends an object for display to the debug panel.
      void disableDebug()
      Remove the current debugger.
      void disableDebug​(java.lang.Object msg)
      This method sends a message to the remote UI and closes the debugger connection if it is open.
      void disableDebug​(java.lang.Object msg, boolean async)
      This method sends a message to the remote UI and closes the debugger connection if it is open.
      void dump​(java.lang.Object o)
      This method dumps an object to whatever Log Appenders have been defined for this AssemblyLine.
      void dumpAssemblyLineState​(java.lang.String file, boolean append)
      Dumps the state of the AssemblyLine to the log or the output file specified.
      void dumpEntry​(Entry entry)
      Prints the contents of an entry to whatever Log Appenders have been defined for this AssemblyLine.
      void enableDebug​(int port, java.lang.String host, boolean onerror)
      This method establishes a debugging session between this AL and a remote debugger client (e.g.
      void enableDebug​(int port, java.lang.String host, boolean onerror, boolean async)
      This method establishes a debugging session between this AL and a remote debugger client (e.g.
      boolean equals​(java.lang.Object o)
      Entry executeCycle()
      This method call executeCycle with a null initial work and processTCB set to true.
      Entry executeCycle​(Entry workEntry)
      This method call executeCycle with the provided work entry and processTCB set to true.
      Entry executeCycle​(Entry workEntry, boolean processTCB)
      This method is called by scripts and other classes that run the assemblyline in its own context.
      void executeInitializeAL()
      Internal method used by AssemblyLinePool.
      void executeMainLoop()
      This method is automatically called by the AL when it is started in mode different than RUNMODE_MANUAL
      void executeMainLoop​(int untilState)
      This method runs the AL and continue running until the specific state is reached.
      void executeTerminateAL()
      Call this method when you want to terminate the AL that was started in Cycle mode.
      void executeWithALPool()
      Used if there is a Server Mode Connector.
      AssemblyLinePool getALPool()
      return the current assemblyline pool
      boolean getComponentDebugMode​(java.lang.String componentName)
      Query the debug mode of a component from this AssemblyLine.
      java.lang.Object getConfig​(java.lang.String name)
      getConfig returns a named value from the AssemblyLine's configuration.
      AssemblyLineConfig getConfigClone()
      Gets a cone of the configuration object of this AssemblyLine
      java.lang.String getConfigStr​(java.lang.String name)
      getConfigStr returns a named string value from the AssemblyLine's configuration.
      AssemblyLineComponent getConnector​(java.lang.String name)
      Returns the AssemblyLineComponent with the given name.
      int getConnectorIndex​(java.lang.String name)
      Returns a connectors index
      int getConnectorIndex2​(java.lang.String name)
      Returns a connectors index
      java.util.List<AssemblyLineComponent> getConnectors()
      Gets the list of AssemblyLineComponent objects this AssemblyLine hosts.
      java.lang.String getCurrentState()
      Returns the current AssemblyLine step position.
      int getCurrentStep()  
      Entry getCurrentWork()
      This method returns the current work Entry object.
      java.lang.String getDatabase()
      Returns the database path/url where obj is recorded/played back.
      DebugServer getDebugger()
      return the current debugger, if any
      Log getLog()
      Gets the log attribute of the AssemblyLine object
      java.lang.String getLogCategory()
      Retrieves log4j category name.
      java.lang.String getLogFilePath()
      Returns the logfile path relative to the working directory.
      java.lang.String getNullBehavior()
      Gets the nullBehavior attribute of the AssemblyLine object
      java.lang.String getNullBehaviorValue()
      Gets the nullBehaviorValue attribute of the AssemblyLine object
      java.lang.String getNullDefinition()
      Gets the nullDefinition attribute of the AssemblyLine object
      java.lang.String getNullDefinitionValue()
      Gets the nullDefinitionValue attribute of the AssemblyLine object
      Entry getOpEntry()
      Retrieves operational entry.
      java.lang.Object getParam​(java.lang.String name)
      getParam returns the value for a user-defined parameter.
      RSInterface getParent()
      This method returns the RSInterface (main) object.
      AssemblyLine getParentAL()
      Returns the AssemblyLine Thread that started this AssemblyLine.
      int getParentHash()
      Returns the hash value for the Thread that started this AL.
      java.lang.String getPerfStats​(java.lang.String component)
      Gets the performance statistics for a component.
      boolean getResetCheckpoint()
      Deprecated. 
      Entry getResult()
      This method returns the result Entry object.
      int getRunMode()
      Returns the runMode for the AL.
      Scheduler getScheduler()
      Returns the Scheduler that started this AssemblyLine.
      ScriptEngine getScriptEngine()
      getScriptEngine returns the ScriptEngine object for the AssemblyLine.
      java.lang.String getShortName()
      This method returns the short name of this AL.
      SimulationConfig getSimulationConfig()  
      TaskStatistics getStats()
      This method returns the TaskStatistics object for this AssemblyLine.
      TaskCallBlock getTCB()
      Returns the TaskCallBlock for this AssemblyLine.
      boolean getTerminationRequested()  
      java.lang.String getTombstoneUserMessage()
      Retrieves a custom user message, used when storing TombStones.
      Entry getUserCheckpoint()
      Deprecated. 
      Entry getWork()
      This method returns the initial work Entry object.
      int hashCode()  
      void initExecuteProlog()
      This method is automatically called for AssemblyLines running in manual mode by the startAL() method.
      void initScriptEngine()
      This method creates the script engine instance.
      boolean isPlaying()
      Checks if the runmode is playback mode;
      boolean isPlaying​(java.lang.Object obj)
      Returns true if the object obj should be played back from server store.
      boolean isRecording()
      Checks if the runmode is record mode.
      boolean isRecording​(java.lang.Object obj)
      Returns true if the object obj should be recorded.
      boolean isRestarting()
      Deprecated. 
      boolean isSimulating()
      Retrieves flag for AL's simulation.
      AssemblyLineComponent loadConnector​(BaseConfiguration config)
      This method enables the user to load an AssemblyLine component given a configuration.
      void logmonitor​(java.lang.String msg)
      Logs a message to the monitor.
      void logmsg​(java.lang.Object msg)
      This method sends the specified message (msg) to whatever Log Appenders have been defined for this AssemblyLine.
      void logmsg​(java.lang.String level, java.lang.String msg)
      This method sends the specified message (msg) to whatever Log Appenders have been defined for this AssemblyLine.
      void logPerfStats()
      Dumps a formatted message to the log file the contents of a performance entry.
      void removeDebugger()
      Remove the current debugger.
      AssemblyLine.AssemblyLineListener removeListener​(AssemblyLine.AssemblyLineListener listener)
      This method is for internal use only.
      void removeRuntimeConnector​(java.lang.String name)
      This method removes a runtime connector from the AL.
      void resetIterators()
      Resets each of the Iterator Connectors.
      void run()
      The run method for the AssemblyLine thread.
      void saveParams()
      This method saves the current AL params to the file configured in the AL settings
      void setComponentDebugMode​(java.lang.String componentName, boolean debug)
      Modify the debug mode of a component from this AssemblyLine.
      void setConfig​(java.lang.String name, java.lang.Object value)
      setConfig sets a named parameter value in the AssemblyLine's configuration.
      void setIgnoreInputComponents​(boolean value)
      Sets the flag that tells whether the Feed Components should be loaded and used during the AL cycle.
      boolean setLogCategory​(java.lang.String categoryName)
      Sets the log4j category name used when requesting a logger.
      boolean setNextConnector​(AssemblyLineComponent alc)
      Sets the next connector to execute.
      boolean setNextConnector​(AssemblyLineComponent alc, boolean continueAfter)
      Deprecated. 
      void setParam​(java.lang.String name, java.lang.Object value)
      setParam sets the value for the user-defined parameter.
      void setPerfEnabled()
      Enable the performance statistics recording.
      void setProxyALOperationParam​(java.lang.String paramName, java.lang.Object paramValue)
      Sets an operation parameter that will be passed as an Attribute to the called Proxy AL in its "op-entry" Entry object on the next execution of the Proxy AL.
      void setProxyALOperationParams​(Entry opentry)
      This method transfers the Attributes from the passed entry object to the op-entry object of the Proxy AL.
      void setResetCheckpoint​(boolean resetCheckpointStore)
      Deprecated. 
      void setSimulating​(boolean mSimulating)
      Define the simulation behaviour of the AL.
      void setTombstoneUserMessage​(java.lang.String aUserMessage)
      Sets a custom user message, used when storing TombStones.
      java.lang.Exception setUserCheckpoint​(Entry cp)
      Deprecated. 
      void setWork​(Entry entry)
      This method sets the initial work entry object.
      void shutdown()
      Request controlled shutdown of AssemblyLine
      void shutdown​(boolean async)
      Shutdown an AssemblyLine, and wait a while for it to stop.
      void startPerfRecording​(java.lang.String component)
      Starts Performance Recording
      java.lang.String stopPerfRecording​(java.lang.String component)
      Stops Performance Recording
      void terminate()
      Deprecated.
      Use shutdown()
      boolean wasRestarted()
      Deprecated. 
      • Methods inherited from class java.lang.Thread

        activeCount, checkAccess, clone, countStackFrames, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, suspend, toString, yield
      • Methods inherited from class java.lang.Object

        finalize, getClass, notify, notifyAll, wait, wait, wait
    • Field Detail

      • RUNMODE_NORMAL

        public static final java.lang.String RUNMODE_NORMAL
        This constant is used when passing parameters to the AL using the TCB object.
        This constant have the meaning of starting the AL in normal mode.
        See Also:
        Constant Field Values
      • RUNMODE_RECORD

        public static final java.lang.String RUNMODE_RECORD
        This constant is used when passing parameters to the AL using the TCB object.
        This constant have the meaning of starting the AL in record mode.
        See Also:
        Constant Field Values
      • RUNMODE_PLAYBACK

        public static final java.lang.String RUNMODE_PLAYBACK
        This constant is used when passing parameters to the AL using the TCB object.
        This constant have the meaning of starting the AL in playback mode.
        See Also:
        Constant Field Values
      • RUNMODE_MANUAL

        public static final java.lang.String RUNMODE_MANUAL
        This constant is used when passing parameters to the AL using the TCB object.
        This constant have the meaning of starting the AL in manual mode.
        See Also:
        Constant Field Values
      • RUNMODE_NODEBUG

        public static final java.lang.String RUNMODE_NODEBUG
        This constant is used when autodebug has been configured for the config instance. To force a non-debug run callers can explicitly override the autodebug behaviour.
        This constant have the meaning of starting the AL in normal mode.
        See Also:
        Constant Field Values
      • RUNMODES

        public static final java.lang.String[] RUNMODES
        This array contains all the run modes as strings.
      • TCB_SIMULATE_MODE

        public static final java.lang.String TCB_SIMULATE_MODE
        When this flag is set in the TaskCallBlock object, and then the TCB is passed to the AssemblyLine, the AL will not make any changes to external systems (e.g. Databases, LDAP servers, etc.). This flag is not used instead of any of the provided run modes.

        Script Example:
         // construct the object used for configurating the AL
         TaskCallBlock tcb = new TaskCallBlock();
        
         // set the name of the AL to be started
         tcb.setAssemblyLineName("anALName");
         // set the run mode of the AL
         tcb.setRunMode(AssemblyLine.RUNMODE_NORMAL);
         // tell the AL to skip the changes in any of the back-end systems used in the AL, just simulate the changes
         tcb.setProperty(AsseblyLine.TCB_SIMULATE_MODE, Boolean.valueOf(true));
        
         // kick off the AL thread
         main.startAL(tcb);
        
         
        See Also:
        Constant Field Values
      • TCB_CP_FORCECLEAN

        public static final java.lang.String TCB_CP_FORCECLEAN
        Deprecated.
        CheckPoint/Restart is deprecated
        See Also:
        Constant Field Values
      • TCB_CP_CHECKPOINTID

        public static final java.lang.String TCB_CP_CHECKPOINTID
        Deprecated.
        CheckPoint/Restart is deprecated
        See Also:
        Constant Field Values
      • TCB_CP_CHECKPOINTOBJECT

        public static final java.lang.String TCB_CP_CHECKPOINTOBJECT
        Deprecated.
        CheckPoint/Restart is deprecated
        See Also:
        Constant Field Values
      • TCB_CP_DISCARD_IWE

        public static final java.lang.String TCB_CP_DISCARD_IWE
        Discard IWE? Typically used when IWE contains params but should not be used in the cycle.

        Usage:
         tcb.setProperty(TCB_CP_DISCARD_IWE, Boolean.valueOf(true));
         
        See Also:
        Constant Field Values
      • TCB_FORCE_REPLYCHANNEL

        public static final java.lang.String TCB_FORCE_REPLYCHANNEL
        Force replay channel.
        See Also:
        Constant Field Values
      • OPENTRY_OPERATION

        public static final java.lang.String OPENTRY_OPERATION
        The name of the attribute in the op-entry which value tells the operation the called AL is running in.
        See Also:
        Constant Field Values
      • TCB_DEBUG_PORT

        public static final java.lang.String TCB_DEBUG_PORT
        The TCP port number of the remote debugger client. Used when establishing session between this AL and a remote debugger client (e.g. CE).
        See Also:
        Constant Field Values
      • TCB_DEBUG_HOST

        public static final java.lang.String TCB_DEBUG_HOST
        The host of the remote debugger client. Used when establishing session between this AL and a remote debugger client (e.g. CE).
        See Also:
        Constant Field Values
      • TCB_DEBUG_ONERROR

        public static final java.lang.String TCB_DEBUG_ONERROR
        Used to set the onerror flag. When true breakpoints are disabled except when there is an error. Used when establishing session between this AL and a remote debugger client (e.g. CE).
        See Also:
        Constant Field Values
      • TCB_DEBUG_JAVASCRIPT

        public static final java.lang.String TCB_DEBUG_JAVASCRIPT
        Used to prepare the Javascript engine for debugging. Set this property (to any value) to enable stepping through Javascript statements when debugging.
        See Also:
        Constant Field Values
      • PROPERTIES_FILE

        public static final java.lang.String PROPERTIES_FILE
        The name of the properties file from which this component will read its localized message strings.
        See Also:
        Constant Field Values
      • AUTODEBUG_PREFIX

        public static final java.lang.String AUTODEBUG_PREFIX
        The key name of the java system property used for the AutoDebug
        See Also:
        Constant Field Values
    • Constructor Detail

      • AssemblyLine

        public AssemblyLine()
        Constructor for the AssemblyLine object that is available in JavaScript via the pre-registered variable task. Note that if you want to run an AssemblyLine then use the startAL() method of the com.ibm.di.server.RS class.
      • AssemblyLine

        public AssemblyLine​(RSInterface parent,
                            java.lang.String taskName,
                            java.lang.Object param,
                            Log log)
                     throws java.lang.Exception
        Constructor for the AssemblyLine object that is available in JavaScript via the pre-registered variable task. Note that if you want to run an AssemblyLine then use the startAL() method of the com.ibm.di.server.RS class.
        Parameters:
        parent - RSInterface of caller/creator
        taskName - Name of AssemblyLine to run
        param - Optional parameter(s)
        log - Optional Log object. Will be used as the parent of the logger of this AssemblyLine.
        Throws:
        java.lang.Exception - if taskName is an unknown AssemblyLine or if any of the connectors cannot be initialized
      • AssemblyLine

        public AssemblyLine​(RSInterface parent,
                            java.lang.String taskName,
                            java.lang.Object param,
                            Log log,
                            AssemblyLineConfig alc)
                     throws java.lang.Exception
        Constructor for the AssemblyLine object that is available in JavaScript via the pre-registered variable task. Note that if you want to run an AssemblyLine then use the startAL() method of the com.ibm.di.server.RS class.
        Parameters:
        parent - RSInterface of caller/creator
        taskName - Name of AssemblyLine to run
        param - Optional parameter(s)
        log - Optional Log object. Will be used as the parent of the logger of this AssemblyLine.
        alc - Optional AssemblyLine configuration object. This object will be owned by the AssemblyLine - no private copy will be created. If null is specified the AssemblyLine will make its own copy of the master configuration. Note that copying the configuration object is expensive.
        Throws:
        java.lang.Exception - if taskName is an unknown AssemblyLine or if any of the connectors cannot be initialized
    • Method Detail

      • setProxyALOperationParam

        public void setProxyALOperationParam​(java.lang.String paramName,
                                             java.lang.Object paramValue)
                                      throws java.lang.Exception
        Sets an operation parameter that will be passed as an Attribute to the called Proxy AL in its "op-entry" Entry object on the next execution of the Proxy AL.
        Passing a null as the paramValue parameter will remove the Attribute named with the value of paramName
        Note: There are some reserved attribute names as $operation, $method, search, etc. that are set using that method. They are set just before the Proxy AL is called by the connector, so they might replace any existing, user defined, Attributes.
        Parameters:
        paramName - the name of the attribute, if this is null the call will be ignored
        paramValue - the attribute value, if this is null the attribute found by the paramName will be removed
        Throws:
        java.lang.Exception - if an error occurs.
        Since:
        7.0
      • setProxyALOperationParams

        public void setProxyALOperationParams​(Entry opentry)
                                       throws java.lang.Exception
        This method transfers the Attributes from the passed entry object to the op-entry object of the Proxy AL.

        Note: There are some reserved attribute names as $operation, $method, search, etc. that are set using that method. They are set just before the Proxy AL is called by the connector, so they might replace any existing, user defined, Attributes.
        Parameters:
        opentry - the entry which Attribute will be merged
        Throws:
        java.lang.Exception - if an error occurs.
        Since:
        7.0
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
        Returns:
        the unique identifier for this AL object. All the AL objects in the JVM they run have a different number.
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • setWork

        public void setWork​(Entry entry)
        This method sets the initial work entry object. On the first/next cycle of the AssemblyLine, this object will present itself as the "work" object in the AssemblyLine. Any Iterators will be ignored for that cycle.If you wish to remove the Initial Work Entry and restore normal operation of Iterators for that cycle, use
         task.setWork(null)
         
        .
        Parameters:
        entry - The initial work entry
      • setParam

        public void setParam​(java.lang.String name,
                             java.lang.Object value)
        setParam sets the value for the user-defined parameter. The user-defined parameter list is persisted between runs in the file specified in the AssemblyLine settings panel. This file is a simple text file with a "keyword:value" pair on each line.
        Parameters:
        name - The user-defined parameter name
        value - The value associated with name
      • setConfig

        public void setConfig​(java.lang.String name,
                              java.lang.Object value)
        setConfig sets a named parameter value in the AssemblyLine's configuration. The AssemblyLine configuration is not persisted between runs.
        Parameters:
        name - The AssemblyLine configuration parameter name
        value - The value associated with name
      • getParent

        public RSInterface getParent()
        This method returns the RSInterface (main) object.
        Specified by:
        getParent in interface TaskInterface
        Returns:
        The main thread
      • getResult

        public Entry getResult()
        This method returns the result Entry object. This object is the working Entry left from the last cycle of the AssemblyLine.
        Specified by:
        getResult in interface TaskInterface
        Returns:
        The last "work" Entry object
      • getWork

        public Entry getWork()
        This method returns the initial work Entry object. If there are no Iterators in the AssemblyLine then this object should be set with the setWork method.
        Specified by:
        getWork in interface TaskInterface
        Returns:
        The initial work Entry object
      • getCurrentWork

        public Entry getCurrentWork()
        This method returns the current work Entry object.
        Specified by:
        getCurrentWork in interface TaskInterface
        Returns:
        The current work Entry object
      • getLogFilePath

        public java.lang.String getLogFilePath()
        Returns the logfile path relative to the working directory.
        Returns:
        The logfile path to which this AssemblyLine is logging information
      • getParam

        public java.lang.Object getParam​(java.lang.String name)
        getParam returns the value for a user-defined parameter. The user-defined parameter list is persisted between runs in the file specified in the AssemblyLine settings panel. This file is a simple text file with a "keyword:value" pair on each line.
        Parameters:
        name - The user-defined parameter name
        Returns:
        The value or null if the parameter is undefined
      • getConfig

        public java.lang.Object getConfig​(java.lang.String name)
        getConfig returns a named value from the AssemblyLine's configuration.
        Specified by:
        getConfig in interface TaskInterface
        Parameters:
        name - The AssemblyLine parameter name
        Returns:
        The value or null if the parameter is undefined
      • getConfigStr

        public java.lang.String getConfigStr​(java.lang.String name)
        getConfigStr returns a named string value from the AssemblyLine's configuration.
        Parameters:
        name - The AssemblyLine parameter name
        Returns:
        The value or null if the parameter is undefined
        See Also:
        getConfig(java.lang.String)
      • getScriptEngine

        public ScriptEngine getScriptEngine()
        getScriptEngine returns the ScriptEngine object for the AssemblyLine. The ScriptEngine object allows you to define additional beans and also execute script code on the fly.
        Specified by:
        getScriptEngine in interface TaskInterface
        Returns:
        The com.ibm.di.script.ScriptEngine object
      • getStats

        public TaskStatistics getStats()
        This method returns the TaskStatistics object for this AssemblyLine.
        Returns:
        The accumulated TaskStatistics object
      • getConnector

        public AssemblyLineComponent getConnector​(java.lang.String name)

        Returns the AssemblyLineComponent with the given name. Mostly for internal use, when scripting you already have this object available using the name you gave this component, or the special variable thisConnector that always references the currently scoped component.

        May be called by different threads. Although the method is thread-safe, accessing the returned object is not - see the documentation of AssemblyLineComponent for information on the thread-safety of the returned object.

        Specified by:
        getConnector in interface TaskInterface
        Parameters:
        name - The connector name as specified in the configuration
        Returns:
        The AssemblyLineComponent
      • getConnectorIndex

        public int getConnectorIndex​(java.lang.String name)
                              throws java.lang.Exception
        Returns a connectors index
        Parameters:
        name - The connector name as specified in the configuration
        Returns:
        The connectors index
        Throws:
        java.lang.Exception - if the named connector could not be found.
      • getConnectors

        public java.util.List<AssemblyLineComponent> getConnectors()
        Gets the list of AssemblyLineComponent objects this AssemblyLine hosts. AssemblyLineComponent objects can be Connectors, Function Components, Script Components, Loop Components, Branching Components, etc.
        Note: This is not an immutable object. Any changes done over this object and the items in it will affect the AssemblyLine's structure/work-flow.
        Returns:
        The connectors value
      • getLog

        public Log getLog()
        Gets the log attribute of the AssemblyLine object
        Specified by:
        getLog in interface TaskInterface
        Returns:
        The log value
      • getNullBehavior

        public java.lang.String getNullBehavior()
        Gets the nullBehavior attribute of the AssemblyLine object
        Specified by:
        getNullBehavior in interface TaskInterface
        Returns:
        The nullBehavior value
      • getNullBehaviorValue

        public java.lang.String getNullBehaviorValue()
        Gets the nullBehaviorValue attribute of the AssemblyLine object
        Specified by:
        getNullBehaviorValue in interface TaskInterface
        Returns:
        The nullBehaviorValue value
      • getNullDefinition

        public java.lang.String getNullDefinition()
        Gets the nullDefinition attribute of the AssemblyLine object
        Specified by:
        getNullDefinition in interface TaskInterface
        Returns:
        The nullDefinition value
      • getNullDefinitionValue

        public java.lang.String getNullDefinitionValue()
        Gets the nullDefinitionValue attribute of the AssemblyLine object
        Specified by:
        getNullDefinitionValue in interface TaskInterface
        Returns:
        The nullDefinitionValue value
      • run

        public void run()
        The run method for the AssemblyLine thread.
        Specified by:
        run in interface java.lang.Runnable
        Overrides:
        run in class java.lang.Thread
      • terminate

        public void terminate()
                       throws java.lang.Exception
        Deprecated.
        Use shutdown()
        Closes all connectors and releases resources.It is recommended that you use the shutdown() method if you want to halt an AssemblyLine before it's normal completion.
        Throws:
        java.lang.Exception - in case an error occurs.
      • addRuntimeIterator

        public void addRuntimeIterator​(java.lang.String name,
                                       ConnectorInterface conn,
                                       boolean executeProlog)
                                throws java.lang.Exception
        This method inserts a connector interface as an Iterator in the current AL. The name parameter must match a connector in the AL config. The config is cloned and changed to Iterator mode and inherits from Virtual connector to force the ALComponent to use the provided connector interface. No initialize() is called for the connector. This method must be called AFTER the AL has loaded its connectors.
        Parameters:
        name - the name of the ConnectorConfig object used as a configuration object for the connector
        conn - the connector to put in Iterator mode
        executeProlog - tells whether the load/init has completed, if true then the new AssemblyLineComponent will be initialized and added to the iterator list
        Throws:
        java.lang.Exception - if the ConnectorConfig object could not be found using the provided name. If the creation/initialization of the new AssemblyLineComponent fails.
      • addRuntimeConnector

        public void addRuntimeConnector​(java.lang.String name,
                                        ConnectorConfig config,
                                        boolean executeProlog)
                                 throws java.lang.Exception
        This method creates an ALComponent from the provided connector config. The connector must be Iterator or Server mode.
        Parameters:
        name - used for error messaging only.
        config - the connector configuration object used for creating the new AssemblyLineComponent
        executeProlog - tells whether the load/init has completed, if true then the new AssemblyLineComponent will be initialized
        Throws:
        java.lang.Exception - if the connector is not in Iterator or Server mode. If the AssemblyLineComponent creation/initialization fails.
      • removeRuntimeConnector

        public void removeRuntimeConnector​(java.lang.String name)
                                    throws java.lang.Exception
        This method removes a runtime connector from the AL.
        Parameters:
        name - the name of the connector which will be removed
        Throws:
        java.lang.Exception - if a connector with that name does not exists
      • loadConnector

        public AssemblyLineComponent loadConnector​(BaseConfiguration config)
                                            throws java.lang.Exception
        This method enables the user to load an AssemblyLine component given a configuration. This method differs from the system.loadConnector() in that it returns a complete AL connector with attribute maps and hooks enabled. The returned connector is not registered in the scripting environment and is not inserted into the general flow of the AL.
        Parameters:
        config - The component configuration (e.g. ConnectorConfig, FunctionConfig etc).
        Returns:
        The AssemblyLine component
        Throws:
        java.lang.Exception - if the creation of the new AssemblyLineComponent fails.
      • logmsg

        public void logmsg​(java.lang.Object msg)
        This method sends the specified message (msg) to whatever Log Appenders have been defined for this AssemblyLine.
        Specified by:
        logmsg in interface TaskInterface
        Parameters:
        msg - The message
      • logmsg

        public void logmsg​(java.lang.String level,
                           java.lang.String msg)
        This method sends the specified message (msg) to whatever Log Appenders have been defined for this AssemblyLine. This method logs a message with the specified level to the AssemblyLine log.
        Parameters:
        level - Loglevel. Legal values are FATAL, ERROR, WARN, INFO, DEBUG. Unrecognized keyword means DEBUG.
        msg - The message
      • debug

        public void debug​(java.lang.Object msg)
        Logs a message to the AssemblyLine log file
        Parameters:
        msg - The message
      • logmonitor

        public void logmonitor​(java.lang.String msg)
        Logs a message to the monitor. The monitor may be a Metamerge Monitor instance or a topic on the JMS system bus (if one is configured)
        Parameters:
        msg - The message
      • dump

        public void dump​(java.lang.Object o)
        This method dumps an object to whatever Log Appenders have been defined for this AssemblyLine.
        Parameters:
        o - The object to dump
      • dumpEntry

        public void dumpEntry​(Entry entry)
        Prints the contents of an entry to whatever Log Appenders have been defined for this AssemblyLine. .
        Parameters:
        entry - The entry object to print
      • disableDebug

        public void disableDebug()
        Remove the current debugger.
      • disableDebug

        public void disableDebug​(java.lang.Object msg)
        This method sends a message to the remote UI and closes the debugger connection if it is open.
        Parameters:
        msg - Message to be sent
        See Also:
        disableDebug()
      • disableDebug

        public void disableDebug​(java.lang.Object msg,
                                 boolean async)

        This method sends a message to the remote UI and closes the debugger connection if it is open.

        This method is for internal use only. Do not call it from user code.

        Parameters:
        msg - Message to be sent
        async - If true will remove the debugger asynchronously (not right away but on the next AssemblyLine step). Always set to true if you call this method from another thread. Always set to false if you call the method from the AssemblyLine thread.
      • enableDebug

        public void enableDebug​(int port,
                                java.lang.String host,
                                boolean onerror)
                         throws java.lang.Exception

        This method establishes a debugging session between this AL and a remote debugger client (e.g. CE).

        Must not call this method from other threads, while the AssemblyLine is running.

        Parameters:
        port - The TCP port number of the remote debugger client
        host - The host name of the remote debugger client
        onerror - if true breakpoints are disabled except when there is an error.
        Throws:
        java.lang.Exception - If there is already a debugger or if the debugger cannot be initialized.
      • enableDebug

        public void enableDebug​(int port,
                                java.lang.String host,
                                boolean onerror,
                                boolean async)
                         throws java.lang.Exception

        This method establishes a debugging session between this AL and a remote debugger client (e.g. CE).

        This method is for internal use only. Do not call it from user code.

        Parameters:
        port - The TCP port number of the remote debugger client
        host - The host name of the remote debugger client
        onerror - if true breakpoints are disabled except when there is an error.
        async - If true will attach the debugger asynchronously - the debugger will not get attached right away and the AssemblyLine will pick it up after its current step. Always set to true if you call this method from another thread. Always set to false if you call the method from the AssemblyLine thread.
        Throws:
        java.lang.Exception - If there is already a debugger or if the debugger cannot be initialized.
      • debuggerEnabled

        public boolean debuggerEnabled()
        Returns status of the debugger session
        Returns:
        true if there is a debugger session active, false otherwise
      • debugMsg

        public void debugMsg​(java.lang.Object obj)
                      throws java.lang.Exception
        This method sends an object for display to the debug panel.
        Specified by:
        debugMsg in interface TaskInterface
        Parameters:
        obj - The object to display. This object must be Serializable
        Throws:
        java.lang.Exception - Serialization exception
      • debugBreak

        public void debugBreak​(java.lang.Object obj)
                        throws java.lang.Exception
        This method sends an object for display to the debug panel and waits for a continue/stop message. If the AL is running in Step (Paused) mode, then execution is paused and control returned to the user.
        Specified by:
        debugBreak in interface TaskInterface
        Parameters:
        obj - The object to display
        Throws:
        java.lang.Exception - Serialization exception
      • debugBreakError

        public void debugBreakError​(java.lang.Object obj)
                             throws java.lang.Exception
        This method forces the debugger to stop if it runs in OnError mode. Otherwise this method is identical to debugBreak(Object obj).
        Parameters:
        obj - The error
        Throws:
        java.lang.Exception - Serialization exception
      • initScriptEngine

        public void initScriptEngine()
                              throws java.lang.Exception
        This method creates the script engine instance. Main beans are registered and and user defined scripts are included from the library.
        Throws:
        java.lang.Exception - Script engine exceptions
      • saveParams

        public void saveParams()
        This method saves the current AL params to the file configured in the AL settings
      • wasRestarted

        @Deprecated
        public boolean wasRestarted()
        Deprecated.
        Returns:
        false
      • isRestarting

        @Deprecated
        public boolean isRestarting()
        Deprecated.
        Returns:
        false
      • shutdown

        public void shutdown()
        Request controlled shutdown of AssemblyLine
      • shutdown

        public void shutdown​(boolean async)
                      throws AbortALException
        Shutdown an AssemblyLine, and wait a while for it to stop. Then try to provoke a stop of the AssemblyLine if needed. If the parameter aSync is true, create a new Thread to do the waiting. If trying to stop the current AssemblyLine, the method will throw an AbortALException, to force the script calling this method to quit.
        Parameters:
        async - If true, stop the AssemblyLine in a new Thread.
        Throws:
        AbortALException - if this method stops the AssemblyLine that called it.
        Since:
        7.1
      • getTerminationRequested

        public boolean getTerminationRequested()
        Returns:
        the status of termination requested flag
      • getLogCategory

        public java.lang.String getLogCategory()
        Retrieves log4j category name.
        Returns:
        the log4j category name used by this AssemblyLine.
      • setLogCategory

        public boolean setLogCategory​(java.lang.String categoryName)
        Sets the log4j category name used when requesting a logger. If a logger object has been provided to the AL already this method returns false to signal that setting the value has no effect.
        Parameters:
        categoryName - The logj4 category name
        Returns:
        True if setting the value will have effect.
      • executeInitializeAL

        public void executeInitializeAL()
        Internal method used by AssemblyLinePool.
      • executeMainLoop

        public void executeMainLoop()
        This method is automatically called by the AL when it is started in mode different than RUNMODE_MANUAL
      • executeMainLoop

        public void executeMainLoop​(int untilState)
        This method runs the AL and continue running until the specific state is reached.

        Note: the specified state is also executed.
        Parameters:
        untilState - the state until the AL should run.
        See Also:
        ALState
      • executeTerminateAL

        public void executeTerminateAL()
                                throws java.lang.Exception
        Call this method when you want to terminate the AL that was started in Cycle mode.
        Throws:
        java.lang.Exception - if an error occurs.
      • resetIterators

        public void resetIterators()
                            throws java.lang.Throwable
        Resets each of the Iterator Connectors. This call requests from each Iterator Connector to reconnect to its back-end data source.
        Throws:
        java.lang.Throwable - derived from the reseted ALComponent
      • initExecuteProlog

        public void initExecuteProlog()
                               throws java.lang.Exception
        This method is automatically called for AssemblyLines running in manual mode by the startAL() method.
        Throws:
        java.lang.Exception - if an error occurs
      • executeCycle

        public Entry executeCycle()
                           throws java.lang.Throwable
        This method call executeCycle with a null initial work and processTCB set to true.
        Returns:
        The work entry at the end of the cycle.
        Throws:
        java.lang.Throwable - when method is called and AL was not started in "Cycle" mode or this method is called after having returned a null entry (e.g. end of iteration)
      • executeCycle

        public Entry executeCycle​(Entry workEntry)
                           throws java.lang.Throwable
        This method call executeCycle with the provided work entry and processTCB set to true.
        Parameters:
        workEntry - the work entry to use.
        Returns:
        The work entry at the end of the cycle.
        Throws:
        java.lang.Throwable - when method is called and AL was not started in "Cycle" mode or this method is called after having returned a null entry (e.g. end of iteration)
      • executeCycle

        public Entry executeCycle​(Entry workEntry,
                                  boolean processTCB)
                           throws java.lang.Throwable
        This method is called by scripts and other classes that run the assemblyline in its own context. The AL must be created in "Cycle" mode to execute this method. If the workEntry is provided then this becomes the work entry and any iterators in the AL is not called. If the AL contains iterator(s) and you don't provide a work entry, the AL will keep returning results as long as the iterator(s) return data. At end of data, a null entry is returned.
        Parameters:
        workEntry - The work entry to use, or null to use an empty work entry/iterator entry
        processTCB - If true, the AL's call/return attribute maps are applied to the provided entry and returned entry
        Returns:
        The work entry at the end of the cycle
        Throws:
        java.lang.Throwable - when method is called and AL was not started in "Cycle" mode or this method is called after having returned a null entry (e.g. end of iteration)
      • getCurrentState

        public java.lang.String getCurrentState()
        Returns the current AssemblyLine step position.
        Returns:
        the current state as String
      • bailout

        public void bailout​(java.lang.Throwable error)
        This method is used for handling thrown during the AL's work-flow errors. The first step that is done is to give the debugger a chance to react. After that the error is accumulated in the statistics object. As a final step the AL state jumps to the ALState.MS_EPILOG and prepares for closure.
        Parameters:
        error - the error which have to be handled.
      • getConnectorIndex2

        public int getConnectorIndex2​(java.lang.String name)
                               throws java.lang.Exception
        Returns a connectors index
        Parameters:
        name - The connector name as specified in the configuration
        Returns:
        The connectors index
        Throws:
        java.lang.Exception - if the connector could not be found by the provided name
      • getUserCheckpoint

        @Deprecated
        public Entry getUserCheckpoint()
                                throws java.lang.Exception
        Deprecated.
        Returns:
        null
        Throws:
        java.lang.Exception - never
      • setUserCheckpoint

        @Deprecated
        public java.lang.Exception setUserCheckpoint​(Entry cp)
                                              throws java.lang.Exception
        Deprecated.
        Parameters:
        cp - not used
        Returns:
        null
        Throws:
        java.lang.Exception - never
      • getRunMode

        public int getRunMode()
        Returns the runMode for the AL.
        Returns:
        the runMode index.
      • getResetCheckpoint

        @Deprecated
        public boolean getResetCheckpoint()
        Deprecated.
        Returns:
        false
      • setResetCheckpoint

        @Deprecated
        public void setResetCheckpoint​(boolean resetCheckpointStore)
        Deprecated.
        This method does nothing
        Parameters:
        resetCheckpointStore - not used
      • isRecording

        public boolean isRecording()
        Checks if the runmode is record mode.
        Returns:
        true if runMode == RUNMODE_I_RECORD.
      • isPlaying

        public boolean isPlaying()
        Checks if the runmode is playback mode;
        Returns:
        true if runMode == RUNMODE_I_PLAYBACK.
      • isRecording

        public boolean isRecording​(java.lang.Object obj)
        Description copied from interface: RecordPlaybackInterface
        Returns true if the object obj should be recorded.
        Specified by:
        isRecording in interface RecordPlaybackInterface
        Parameters:
        obj - the object to check
        Returns:
        true if the object obj should be recorded.
      • isPlaying

        public boolean isPlaying​(java.lang.Object obj)
        Description copied from interface: RecordPlaybackInterface
        Returns true if the object obj should be played back from server store.
        Specified by:
        isPlaying in interface RecordPlaybackInterface
        Parameters:
        obj - the object to check
        Returns:
        true if the object obj should be played back from the server store.
      • getDatabase

        public java.lang.String getDatabase()
        Description copied from interface: RecordPlaybackInterface
        Returns the database path/url where obj is recorded/played back.
        Specified by:
        getDatabase in interface RecordPlaybackInterface
        Returns:
        the database path/url where obj is recorded/played back.
      • getShortName

        public java.lang.String getShortName()
        This method returns the short name of this AL.
        Returns:
        The name without the "AssemblyLines/" prefix.
      • executeWithALPool

        public void executeWithALPool()
        Used if there is a Server Mode Connector. Create an AssemblyLinePool and use this for executing
      • setIgnoreInputComponents

        public void setIgnoreInputComponents​(boolean value)
        Sets the flag that tells whether the Feed Components should be loaded and used during the AL cycle.
        Parameters:
        value - if this is true then the Input Components will be ignored, otherwise they will be used.
      • getCurrentStep

        public int getCurrentStep()
        Returns:
        the ID of the step the AL is currently in.
        See Also:
        ALState
      • setNextConnector

        public boolean setNextConnector​(AssemblyLineComponent alc)
        Sets the next connector to execute.
        Parameters:
        alc - The connector to execute
        Returns:
        Returns true if the next connector to execute is set. Otherwise, false is returned.
      • setNextConnector

        public boolean setNextConnector​(AssemblyLineComponent alc,
                                        boolean continueAfter)
        Deprecated.
      • getConfigClone

        public AssemblyLineConfig getConfigClone()
                                          throws java.lang.Exception
        Gets a cone of the configuration object of this AssemblyLine
        Returns:
        the clone, or null
        Throws:
        java.lang.Exception - if an error occurs while the cloning process.
      • setTombstoneUserMessage

        public void setTombstoneUserMessage​(java.lang.String aUserMessage)
        Sets a custom user message, used when storing TombStones.
        Parameters:
        aUserMessage - message to set.
      • getTombstoneUserMessage

        public java.lang.String getTombstoneUserMessage()
        Retrieves a custom user message, used when storing TombStones.
        Returns:
        the tombstone message.
      • getOpEntry

        public Entry getOpEntry()
        Retrieves operational entry.
        Returns:
        the operational entry
      • startPerfRecording

        public void startPerfRecording​(java.lang.String component)
        Starts Performance Recording
        Parameters:
        component - Unique ComponentID
      • stopPerfRecording

        public java.lang.String stopPerfRecording​(java.lang.String component)
        Stops Performance Recording
        Parameters:
        component - Unique ComponentID
        Returns:
        The performance statistics for the component.
      • getPerfStats

        public java.lang.String getPerfStats​(java.lang.String component)
        Gets the performance statistics for a component.
        Parameters:
        component - The name of the component to get the performance statistics for
        Returns:
        A String containing the performance statistics of the specified component
      • logPerfStats

        public void logPerfStats()
        Dumps a formatted message to the log file the contents of a performance entry.
        See Also:
        dump(Object)
      • setPerfEnabled

        public void setPerfEnabled()
        Enable the performance statistics recording.
      • getTCB

        public TaskCallBlock getTCB()
        Returns the TaskCallBlock for this AssemblyLine.
        Returns:
        the TaskCallBlock for this AssemblyLine.
        Since:
        7.0
      • setSimulating

        public void setSimulating​(boolean mSimulating)
        Define the simulation behaviour of the AL.
        Parameters:
        mSimulating -
        + true - turn simulation on.
        + false - turn simulation off.
        Since:
        7.0
      • isSimulating

        public boolean isSimulating()
        Retrieves flag for AL's simulation.
        Returns:
        boolean
        + true - the simulation is on.
        + false - the simulation is off.
        Since:
        7.0
      • getSimulationConfig

        public SimulationConfig getSimulationConfig()
                                             throws java.lang.Exception
        Returns:
        the SimulationConfig for this AL.
        Throws:
        java.lang.Exception - if an error occurs.
        Since:
        7.0
      • autoActivateDebugger

        public boolean autoActivateDebugger()
                                     throws java.lang.Exception
        This method will activate the AL debugger based on java system properties.
         "com.ibm.tdi.autodebug" is the prefix.
         <id> is the configuration id (of the running config instance)
         <name> is the name of the assembly line (short name)
        
                        // Match specific assemblyline in specific config instance
                        prefix.<id>.<name>  = host,port,break-on-error
        
                        // Match all assemblylines in specific config instance
                        prefix.<id>                = host,port,break-on-error
        
                        // Match ALL assemblylines in ALL config instances
                        prefix                          = host,port,break-on-error
         
        Returns:
        true if a new debugger session is activated, false otherwise
        Throws:
        java.lang.Exception
      • removeListener

        public AssemblyLine.AssemblyLineListener removeListener​(AssemblyLine.AssemblyLineListener listener)

        This method is for internal use only. Users must not rely on it.

        Unregister a listener for AssemblyLine events. Can be called by other threads.

        Beware that the listener may get notified a few times after it was unregistered. The only way to ensure this does not happen is to unregister the listener on the AssemblyLine thread, e.g. in a listener methods.

        Specified by:
        removeListener in interface Listenable<AssemblyLine.AssemblyLineListener>
        Parameters:
        listener - The listener object.
        Returns:
        Since:
        7.0
      • removeDebugger

        public void removeDebugger()
        Remove the current debugger. For internal use, to stop debugging.
      • getComponentDebugMode

        public boolean getComponentDebugMode​(java.lang.String componentName)
                                      throws java.lang.Exception
        Query the debug mode of a component from this AssemblyLine. May be called by different threads.
        Parameters:
        componentName - The name of a component as it appears in the configuration.
        Returns:
        the debug mode of the component
        Throws:
        java.lang.Exception - If the component name is invalid.
      • setComponentDebugMode

        public void setComponentDebugMode​(java.lang.String componentName,
                                          boolean debug)
                                   throws java.lang.Exception
        Modify the debug mode of a component from this AssemblyLine. May be called by different threads.
        Parameters:
        componentName - The name of a component as it appears in the configuration.
        debug - The new debug mode of the component.
        Throws:
        java.lang.Exception - If the component name is invalid.
      • dumpAssemblyLineState

        public void dumpAssemblyLineState​(java.lang.String file,
                                          boolean append)
        Dumps the state of the AssemblyLine to the log or the output file specified.
        Parameters:
        output - Output file name or null. If null the log is used to print out the dump.
        append - In case a file is specified setting this to true will append the dump to the file
      • getParentAL

        public AssemblyLine getParentAL()
        Returns the AssemblyLine Thread that started this AssemblyLine. If the parent AssemblyLine is no longer running, null may be returned.
        Since:
        7.1
      • getScheduler

        public Scheduler getScheduler()
        Returns the Scheduler that started this AssemblyLine. If the Scheduler is no longer running, null may be returned.
        Since:
        7.2.0.1
      • getParentHash

        public int getParentHash()
        Returns the hash value for the Thread that started this AL.
        Since:
        7.2.0.3
      • getALPool

        public AssemblyLinePool getALPool()
        return the current assemblyline pool
        Returns:
        AssemblyLinePool object
        Since:
        7.1.1
      • getDebugger

        public DebugServer getDebugger()
        return the current debugger, if any
        Returns:
        Since:
        7.2