com.ibm.di.server
Class AssemblyLine

java.lang.Object
  extended by java.lang.Thread
      extended by com.ibm.di.server.Monitor
          extended by com.ibm.di.server.AssemblyLine
All Implemented Interfaces:
Listenable<AssemblyLine.AssemblyLineListener>, RecordPlaybackInterface, TaskInterface, 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
static interface AssemblyLine.AssemblyLineListener
           This interface is for internal use only.
 
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler
 
Field Summary
static String AUTODEBUG_PREFIX
          The key name of the java system property used for the AutoDebug
static String OPENTRY_OPERATION
          The name of the attribute in the op-entry which value tells the operation the called AL is running in.
static String PROPERTIES_FILE
          The name of the properties file from which this component will read its localized message strings.
static int RUNMODE_I_MANUAL
          This is the position of the RUNMODE_MANUAL String in the RUNMODES array
static int RUNMODE_I_NODEBUG
          This is the position of the RUNMODE_MANUAL String in the RUNMODES array
static int RUNMODE_I_NORMAL
          This is the position of the RUNMODE_NORMAL String in the RUNMODES array
static int RUNMODE_I_PLAYBACK
          This is the position of the RUNMODE_PLAYBACK String in the RUNMODES array
static int RUNMODE_I_RECORD
          This is the position of the RUNMODE_RECORD String in the RUNMODES array
static String RUNMODE_MANUAL
          This constant is used when passing parameters to the AL using the TCB object.
static String RUNMODE_NODEBUG
          This constant is used when autodebug has been configured for the config instance.
static String RUNMODE_NORMAL
          This constant is used when passing parameters to the AL using the TCB object.
static String RUNMODE_PLAYBACK
          This constant is used when passing parameters to the AL using the TCB object.
static String RUNMODE_RECORD
          This constant is used when passing parameters to the AL using the TCB object.
static String[] RUNMODES
          This array contains all the run modes as strings.
static String TCB_CP_CHECKPOINTID
          Deprecated. CheckPoint/Restart is deprecated
static String TCB_CP_CHECKPOINTOBJECT
          Deprecated. CheckPoint/Restart is deprecated
static String TCB_CP_DISCARD_IWE
          Discard IWE? Typically used when IWE contains params but should not be used in the cycle.
static String TCB_CP_FORCECLEAN
          Deprecated. CheckPoint/Restart is deprecated
static String TCB_DEBUG_HOST
          The host of the remote debugger client.
static String TCB_DEBUG_JAVASCRIPT
          Used to prepare the Javascript engine for debugging.
static String TCB_DEBUG_ONERROR
          Used to set the onerror flag.
static String TCB_DEBUG_PORT
          The TCP port number of the remote debugger client.
static String TCB_FORCE_REPLYCHANNEL
          Force replay channel.
static String TCB_RUNMODE_PROPNAME
          Deprecated. This kind of usage is deprecated, use the TaskCallBlock.setRunMode(String) method instead.
static 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.
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
AssemblyLine()
          Constructor for the AssemblyLine object that is available in JavaScript via the pre-registered variable task.
AssemblyLine(RSInterface parent, String taskName, Object param, Log log)
          Constructor for the AssemblyLine object that is available in JavaScript via the pre-registered variable task.
AssemblyLine(RSInterface parent, String taskName, Object param, Log log, AssemblyLineConfig alc)
          Constructor for the AssemblyLine object that is available in JavaScript via the pre-registered variable task.
 
Method Summary
 void addListener(AssemblyLine.AssemblyLineListener listener)
           This method is for internal use only.
 void addRuntimeConnector(String name, ConnectorConfig config, boolean executeProlog)
          This method creates an ALComponent from the provided connector config.
 void addRuntimeIterator(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(Throwable error)
          This method is used for handling thrown during the AL's work-flow errors.
 void debug(Object msg)
          Logs a message to the AssemblyLine log file
 void debugBreak(Object obj)
          This method sends an object for display to the debug panel and waits for a continue/stop message.
 void debugBreakError(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(Object obj)
          This method sends an object for display to the debug panel.
 void disableDebug()
          Remove the current debugger.
 void disableDebug(Object msg)
          This method sends a message to the remote UI and closes the debugger connection if it is open.
 void disableDebug(Object msg, boolean async)
           This method sends a message to the remote UI and closes the debugger connection if it is open.
 void dump(Object o)
          This method dumps an object to whatever Log Appenders have been defined for this AssemblyLine.
 void dumpAssemblyLineState(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, String host, boolean onerror)
           This method establishes a debugging session between this AL and a remote debugger client (e.g.
 void enableDebug(int port, String host, boolean onerror, boolean async)
           This method establishes a debugging session between this AL and a remote debugger client (e.g.
 boolean equals(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.
 boolean getComponentDebugMode(String componentName)
          Query the debug mode of a component from this AssemblyLine.
 Object getConfig(String name)
          getConfig returns a named value from the AssemblyLine's configuration.
 AssemblyLineConfig getConfigClone()
          Gets a cone of the configuration object of this AssemblyLine
 String getConfigStr(String name)
          getConfigStr returns a named string value from the AssemblyLine's configuration.
 AssemblyLineComponent getConnector(String name)
           Returns the AssemblyLineComponent with the given name.
 int getConnectorIndex(String name)
          Returns a connectors index
 int getConnectorIndex2(String name)
          Returns a connectors index
 List<AssemblyLineComponent> getConnectors()
          Gets the list of AssemblyLineComponent objects this AssemblyLine hosts.
 String getCurrentState()
          Returns the current AssemblyLine step position.
 int getCurrentStep()
           
 Entry getCurrentWork()
          This method returns the current work Entry object.
 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
 String getLogCategory()
          Retrieves log4j category name.
 String getLogFilePath()
          Returns the logfile path relative to the working directory.
 String getNullBehavior()
          Gets the nullBehavior attribute of the AssemblyLine object
 String getNullBehaviorValue()
          Gets the nullBehaviorValue attribute of the AssemblyLine object
 String getNullDefinition()
          Gets the nullDefinition attribute of the AssemblyLine object
 String getNullDefinitionValue()
          Gets the nullDefinitionValue attribute of the AssemblyLine object
 Entry getOpEntry()
          Retrieves operational entry.
 Object getParam(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.
 String getPerfStats(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.
 ScriptEngine getScriptEngine()
          getScriptEngine returns the ScriptEngine object for the AssemblyLine.
 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()
           
 String getTombstoneUserMessage()
          Retrieves 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(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(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(String msg)
          Logs a message to the monitor.
 void logmsg(Object msg)
          This method sends the specified message (msg) to whatever Log Appenders have been defined for this AssemblyLine.
 void logmsg(String level, 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.
 AssemblyLine.AssemblyLineListener removeListener(AssemblyLine.AssemblyLineListener listener)
           This method is for internal use only.
 void removeRuntimeConnector(String name)
          This method removes a runtime connector from the AL.
 void resetIterators()
          Resets each of the Iterator Connectors.
 void run()
          The run method kicks off the thread and starts AssemblyLine execution.
 void saveParams()
          This method saves the current AL params to the file configured in the AL settings
 void setComponentDebugMode(String componentName, boolean debug)
          Modify the debug mode of a component from this AssemblyLine.
 void setConfig(String name, 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(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(String name, Object value)
          setParam sets the value for the user-defined parameter.
 void setPerfEnabled()
          Enable the performance statistics recording.
 void setProxyALOperationParam(String paramName, 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(String aUserMessage)
          Sets a custom user message, used when storing TombStones.
 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(String component)
          Starts Performance Recording
 String stopPerfRecording(String component)
          Stops Performance Recording
 void terminate()
          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.
 boolean wasRestarted()
          Deprecated.  
 
Methods inherited from class com.ibm.di.server.Monitor
addActionListener, addThread, allThreadsStopped, fireListener, removeActionListener, removeThread, runningALs, runningSequences, setMonitorMessage, threadStarted, threadStopped
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

RUNMODE_NORMAL

public static final 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 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 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 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 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 String[] RUNMODES
This array contains all the run modes as strings.


RUNMODE_I_NORMAL

public static final int RUNMODE_I_NORMAL
This is the position of the RUNMODE_NORMAL String in the RUNMODES array

See Also:
Constant Field Values

RUNMODE_I_RECORD

public static final int RUNMODE_I_RECORD
This is the position of the RUNMODE_RECORD String in the RUNMODES array

See Also:
Constant Field Values

RUNMODE_I_PLAYBACK

public static final int RUNMODE_I_PLAYBACK
This is the position of the RUNMODE_PLAYBACK String in the RUNMODES array

See Also:
Constant Field Values

RUNMODE_I_MANUAL

public static final int RUNMODE_I_MANUAL
This is the position of the RUNMODE_MANUAL String in the RUNMODES array

See Also:
Constant Field Values

RUNMODE_I_NODEBUG

public static final int RUNMODE_I_NODEBUG
This is the position of the RUNMODE_MANUAL String in the RUNMODES array

See Also:
Constant Field Values

TCB_RUNMODE_PROPNAME

public static final String TCB_RUNMODE_PROPNAME
Deprecated. This kind of usage is deprecated, use the TaskCallBlock.setRunMode(String) method instead.
The key parameter passed to the Entry.setProperty(Object, Object) method.

See Also:
Constant Field Values

TCB_SIMULATE_MODE

public static final 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 String TCB_CP_FORCECLEAN
Deprecated. CheckPoint/Restart is deprecated
See Also:
Constant Field Values

TCB_CP_CHECKPOINTID

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

TCB_CP_CHECKPOINTOBJECT

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

TCB_CP_DISCARD_IWE

public static final 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 String TCB_FORCE_REPLYCHANNEL
Force replay channel.

See Also:
Constant Field Values

OPENTRY_OPERATION

public static final 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 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 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 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 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 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 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,
                    String taskName,
                    Object param,
                    Log log)
             throws 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:
Exception - if taskName is an unknown AssemblyLine or if any of the connectors cannot be initialized

AssemblyLine

public AssemblyLine(RSInterface parent,
                    String taskName,
                    Object param,
                    Log log,
                    AssemblyLineConfig alc)
             throws 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:
Exception - if taskName is an unknown AssemblyLine or if any of the connectors cannot be initialized
Method Detail

setProxyALOperationParam

public void setProxyALOperationParam(String paramName,
                                     Object paramValue)
                              throws 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:
Exception - if an error occurs.
Since:
7.0

setProxyALOperationParams

public void setProxyALOperationParams(Entry opentry)
                               throws 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:
Exception - if an error occurs.
Since:
7.0

hashCode

public int hashCode()
Overrides:
hashCode in class 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(Object o)

Overrides:
equals in class 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(String name,
                     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(String name,
                      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 String getLogFilePath()
Returns the logfile path relative to the working directory.

Returns:
The logfile path to which this AssemblyLine is logging information

getParam

public Object getParam(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 Object getConfig(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 String getConfigStr(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(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(String name)
                      throws Exception
Returns a connectors index

Parameters:
name - The connector name as specified in the configuration
Returns:
The connectors index
Throws:
Exception - if the named connector could not be found.

getConnectors

public 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 String getNullBehavior()
Gets the nullBehavior attribute of the AssemblyLine object

Specified by:
getNullBehavior in interface TaskInterface
Returns:
The nullBehavior value

getNullBehaviorValue

public String getNullBehaviorValue()
Gets the nullBehaviorValue attribute of the AssemblyLine object

Specified by:
getNullBehaviorValue in interface TaskInterface
Returns:
The nullBehaviorValue value

getNullDefinition

public String getNullDefinition()
Gets the nullDefinition attribute of the AssemblyLine object

Specified by:
getNullDefinition in interface TaskInterface
Returns:
The nullDefinition value

getNullDefinitionValue

public 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 kicks off the thread and starts AssemblyLine execution.

Specified by:
run in interface Runnable
Overrides:
run in class Thread

terminate

public void terminate()
               throws Exception
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:
Exception - in case an error occurs.

addRuntimeIterator

public void addRuntimeIterator(String name,
                               ConnectorInterface conn,
                               boolean executeProlog)
                        throws 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:
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(String name,
                                ConnectorConfig config,
                                boolean executeProlog)
                         throws 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:
Exception - if the connector is not in Iterator or Server mode. If the AssemblyLineComponent creation/initialization fails.

removeRuntimeConnector

public void removeRuntimeConnector(String name)
                            throws Exception
This method removes a runtime connector from the AL.

Parameters:
name - the name of the connector which will be removed
Throws:
Exception - if a connector with that name does not exists

loadConnector

public AssemblyLineComponent loadConnector(BaseConfiguration config)
                                    throws 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:
Exception - if the creation of the new AssemblyLineComponent fails.

logmsg

public void logmsg(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(String level,
                   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(Object msg)
Logs a message to the AssemblyLine log file

Parameters:
msg - The message

logmonitor

public void logmonitor(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(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(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(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,
                        String host,
                        boolean onerror)
                 throws 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:
Exception - If there is already a debugger or if the debugger cannot be initialized.

enableDebug

public void enableDebug(int port,
                        String host,
                        boolean onerror,
                        boolean async)
                 throws 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:
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(Object obj)
              throws 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:
Exception - Serialization exception

debugBreak

public void debugBreak(Object obj)
                throws 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:
Exception - Serialization exception

debugBreakError

public void debugBreakError(Object obj)
                     throws 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:
Exception - Serialization exception

initScriptEngine

public void initScriptEngine()
                      throws Exception
This method creates the script engine instance. Main beans are registered and and user defined scripts are included from the library.

Throws:
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 String getLogCategory()
Retrieves log4j category name.

Returns:
the log4j category name used by this AssemblyLine.

setLogCategory

public boolean setLogCategory(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 Exception
Call this method when you want to terminate the AL that was started in Cycle mode.

Throws:
Exception - if an error occurs.

resetIterators

public void resetIterators()
                    throws Throwable
Resets each of the Iterator Connectors. This call requests from each Iterator Connector to reconnect to its back-end data source.

Throws:
Throwable - derived from the reseted ALComponent

initExecuteProlog

public void initExecuteProlog()
                       throws Exception
This method is automatically called for AssemblyLines running in manual mode by the startAL() method.

Throws:
Exception - if an error occurs

executeCycle

public Entry executeCycle()
                   throws 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:
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 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:
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 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:
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 String getCurrentState()
Returns the current AssemblyLine step position.

Returns:
the current state as String

bailout

public void bailout(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(String name)
                       throws Exception
Returns a connectors index

Parameters:
name - The connector name as specified in the configuration
Returns:
The connectors index
Throws:
Exception - if the connector could not be found by the provided name

getUserCheckpoint

@Deprecated
public Entry getUserCheckpoint()
                        throws Exception
Deprecated. 

Returns:
null
Throws:
Exception - never

setUserCheckpoint

@Deprecated
public Exception setUserCheckpoint(Entry cp)
                            throws Exception
Deprecated. 

Parameters:
cp - not used
Returns:
null
Throws:
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(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(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 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 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 Exception
Gets a cone of the configuration object of this AssemblyLine

Returns:
the clone, or null
Throws:
Exception - if an error occurs while the cloning process.

setTombstoneUserMessage

public void setTombstoneUserMessage(String aUserMessage)
Sets a custom user message, used when storing TombStones.

Parameters:
aUserMessage - message to set.

getTombstoneUserMessage

public String getTombstoneUserMessage()
Retrieves 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(String component)
Starts Performance Recording

Parameters:
component - Unique ComponentID

stopPerfRecording

public String stopPerfRecording(String component)
Stops Performance Recording

Parameters:
component - Unique ComponentID
Returns:
The performance statistics for the component.

getPerfStats

public String getPerfStats(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 Exception
Returns:
the SimulationConfig for this AL.
Throws:
Exception - if an error occurs.
Since:
7.0

autoActivateDebugger

public boolean autoActivateDebugger()
                             throws 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:
Exception

addListener

public void addListener(AssemblyLine.AssemblyLineListener listener)

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

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

Specified by:
addListener in interface Listenable<AssemblyLine.AssemblyLineListener>
Parameters:
listener - A listener.
Since:
7.0

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

getComponentDebugMode

public boolean getComponentDebugMode(String componentName)
                              throws 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:
Exception - If the component name is invalid.

setComponentDebugMode

public void setComponentDebugMode(String componentName,
                                  boolean debug)
                           throws 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:
Exception - If the component name is invalid.

dumpAssemblyLineState

public void dumpAssemblyLineState(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

getDebugger

public DebugServer getDebugger()
return the current debugger, if any

Returns:
Since:
7.2