Package com.ibm.di.api.local.impl
Class AssemblyLineImpl
- java.lang.Object
-
- com.ibm.di.api.local.impl.AssemblyLineImpl
-
- All Implemented Interfaces:
AssemblyLine
public class AssemblyLineImpl extends java.lang.Object implements AssemblyLine
Implements an AssemblyLine instance.
-
-
Constructor Summary
Constructors Constructor Description AssemblyLineImpl(AssemblyLine aAssemblyLine, ConfigInstanceImpl aConfigInstance, SessionImpl aSession)Class constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddListener(AssemblyLineListener listener, boolean getLogs, boolean getEntryOnEachCycle)Register a listener for AssemblyLine events.voidattachDebugger(int port, java.lang.String host, boolean onerror)Attach a debugger to the AssemblyLine.voiddetachDebugger(java.lang.Object msg)Detach the current debugger from the AssemblyLine.static java.lang.StringgenGUID(AssemblyLine aAssemblyLine)Generates unique GUID for a specified assembly line.booleangetComponentDebugMode(java.lang.String componentName)Query the debug mode setting of the specified component (Connector or Function Component).AssemblyLineConfiggetConfig()Returns configuration information about the AssemblyLine.ConfigInstancegetConfigInstance()Returns the configuration instance of the AssemblyLine.java.lang.StringgetGlobalUniqueID()Returns AssemblyLine GUID.java.lang.StringgetName()Returns the name of the AssemblyLine.java.lang.StringgetNullBehavior()Gets the nullBehavior attribute of the AssemblyLine objectjava.lang.StringgetNullBehaviorValue()Gets the nullBehaviorValue attribute of the AssemblyLine object.EntrygetResult()This method returns the result entry object.TaskStatisticsgetStatistics()This method returns the TaskStatistics object for this AssemblyLine.java.lang.StringgetSystemLog()Retrieves the current AssemblyLine's system log.java.lang.StringgetSystemLogFileName()Returns the name of the log file of the AssemblyLine (not prefixed by folders path).java.lang.StringgetSystemLogFilePath()Returns the fully-qualified path of the log file of the AssemblyLine.java.lang.StringgetSystemLogLastChunk(int aLastKilobytes)Retrieves the last chunk from the current AssemblyLine's system log.intgetUniqueCode()Returns the unique code of the AssemblyLine.booleanisActive()Checks if the AssemblyLine is active.booleanisSimulating()Check whether the AssemblyLine is simulating or notvoidremoveListener(AssemblyLineListener listener)Unregister a listener for AssemblyLine events.voidsetComponentDebugMode(java.lang.String componentName, boolean debug)Modify the debug mode setting of the specified component (Connector or Function Component).voidsetSimulating(boolean simulate)Changes the way the AssemblyLine treats the target systems it is connecting/interacting to/with.voidstop()Stops the execution of the AssemblyLine.voidstop(boolean sync)Stops the execution of the AssemblyLine, and waits for it to stop.
-
-
-
Constructor Detail
-
AssemblyLineImpl
public AssemblyLineImpl(AssemblyLine aAssemblyLine, ConfigInstanceImpl aConfigInstance, SessionImpl aSession) throws DIException
Class constructor.- Parameters:
aAssemblyLine-AssemblyLineinstanceaConfigInstance-ConfigInstanceImplinstanceaSession-SessionImplinstance- Throws:
DIException- if any of the parameter isnull
-
-
Method Detail
-
getConfigInstance
public ConfigInstance getConfigInstance() throws DIException
Returns the configuration instance of the AssemblyLine.Example
var mAssemblyLine = session.getAssemblyLines()[0]; var mConfigInstance = mAssemblyLine.getConfigInstance(); var configId = mConfigInstance.getConfigId(); var aAssemblyLineName = "AssemblyLine"; var assemblyLine = mConfigInstance.startAssemblyLine(aAssemblyLineName); var objectName = com.ibm.di.api.jmx.mbeans.AssemblyLine.genObjectName(assemblyLine.getName(), assemblyLine.getUniqueCode());
- Specified by:
getConfigInstancein interfaceAssemblyLine- Returns:
- Returns ConfigInstance object representing the configuration instance of the AssemblyLine.
- Throws:
DIException- if an error occurs while retrieving the configuration instance information.
-
getName
public java.lang.String getName() throws DIExceptionReturns the name of the AssemblyLine.Example
var mAssemblyLine = session.getAssemblyLines()[0]; var mConfigInstance = mAssemblyLine.getConfigInstance(); var configId = mConfigInstance.getConfigId(); var aAssemblyLineName = "AssemblyLine"; var assemblyLine = mConfigInstance.startAssemblyLine(aAssemblyLineName); var objectName = com.ibm.di.api.jmx.mbeans.AssemblyLine.genObjectName(assemblyLine.getName(), assemblyLine.getUniqueCode());
- Specified by:
getNamein interfaceAssemblyLine- Returns:
- String object representing the AssemblyLine's name.
- Throws:
DIException- if an error occurs while retrieving the name of the AssemblyLine.
-
getUniqueCode
public int getUniqueCode() throws DIExceptionReturns the unique code of the AssemblyLine.Example
var mAssemblyLine = session.getAssemblyLines()[0]; var mConfigInstance = mAssemblyLine.getConfigInstance(); var configId = mConfigInstance.getConfigId(); var aAssemblyLineName = "AssemblyLine"; var assemblyLine = mConfigInstance.startAssemblyLine(aAssemblyLineName); var objectName = com.ibm.di.api.jmx.mbeans.AssemblyLine.genObjectName(assemblyLine.getName(), assemblyLine.getUniqueCode());
- Specified by:
getUniqueCodein interfaceAssemblyLine- Returns:
- int value representing the unique code of the AssemblyLine.
- Throws:
DIException- if an error occurs while retrieving the unique code of the AssemblyLine.
-
getConfig
public AssemblyLineConfig getConfig() throws DIException
Returns configuration information about the AssemblyLine.- Specified by:
getConfigin interfaceAssemblyLine- Returns:
- AssemblyLineConfig representing the configuration information of the AssemblyLine.
- Throws:
DIException- if an error occurs while retrieving the configuration information of the AssemblyLine.
-
getNullBehavior
public java.lang.String getNullBehavior() throws DIExceptionGets the nullBehavior attribute of the AssemblyLine object- Specified by:
getNullBehaviorin interfaceAssemblyLine- Returns:
- String object representing the nullBehavior attribute value or null if no setting values are available for the AssemblyLine.
- Throws:
DIException- if an error occurs while getting the nullBehavior attribute.
-
getNullBehaviorValue
public java.lang.String getNullBehaviorValue() throws DIExceptionGets the nullBehaviorValue attribute of the AssemblyLine object.- Specified by:
getNullBehaviorValuein interfaceAssemblyLine- Returns:
- String object representing the nullBehaviorValue attribute value or null if no setting values are available for the AssemblyLine.
- Throws:
DIException- if an error occurs while getting the nullBehaviorValue attribute.
-
getStatistics
public TaskStatistics getStatistics() throws DIException
This method returns the TaskStatistics object for this AssemblyLine.Example
var runningALs = null; var stats = null; var result = null; var runningConfigs = session.getConfigInstances(); for (var i = 0; i < runningConfigs.length; i++) { runningALs = runningConfigs[i].getAssemblyLines(); for (var j = 0; j < runningALs.length; j++) { if (runningALs[j].isActive()) { stats = runningALs[j].getStatistics().toString(); main.logmsg("statistics[" + j + "] = " + stats); result = runningALs[j].getResult(); var attr = new com.ibm.di.entry.Attribute("LogURL", "/log/" + runningALs[j].getGlobalUniqueID()); runningALs[j].stop(); } } }- Specified by:
getStatisticsin interfaceAssemblyLine- Returns:
- The accumulated TaskStatistics object.
- Throws:
DIException- if an error occurs while getting the AssemblyLine statistics.
-
isActive
public boolean isActive() throws DIExceptionChecks if the AssemblyLine is active.Example
var runningALs = null; var stats = null; var result = null; var runningConfigs = session.getConfigInstances(); for (var i = 0; i < runningConfigs.length; i++) { runningALs = runningConfigs[i].getAssemblyLines(); for (var j = 0; j < runningALs.length; j++) { if (runningALs[j].isActive()) { stats = runningALs[j].getStatistics().toString(); main.logmsg("statistics[" + j + "] = " + stats); result = runningALs[j].getResult(); var attr = new com.ibm.di.entry.Attribute("LogURL", "/log/" + runningALs[j].getGlobalUniqueID()); runningALs[j].stop(); } } }- Specified by:
isActivein interfaceAssemblyLine- Returns:
- true if the AssemblyLine's thread is alive, false otherwise.
- Throws:
DIException- if an error occurs while getting the AssemblyLine state.
-
getResult
public Entry getResult() throws DIException
This method returns the result entry object. This object is a copy of the working entry as it were when the AssemblyLine finished processing the connectors.Example
var runningALs = null; var stats = null; var result = null; var runningConfigs = session.getConfigInstances(); for (var i = 0; i < runningConfigs.length; i++) { runningALs = runningConfigs[i].getAssemblyLines(); for (var j = 0; j < runningALs.length; j++) { if (runningALs[j].isActive()) { stats = runningALs[j].getStatistics().toString(); main.logmsg("statistics[" + j + "] = " + stats); result = runningALs[j].getResult(); var attr = new com.ibm.di.entry.Attribute("LogURL", "/log/" + runningALs[j].getGlobalUniqueID()); runningALs[j].stop(); } } }- Specified by:
getResultin interfaceAssemblyLine- Returns:
- The last "work" entry object.
- Throws:
DIException- if an error occurs while getting the result Entry.
-
stop
public void stop() throws DIExceptionStops the execution of the AssemblyLine.Example
var runningALs = null; var stats = null; var result = null; var runningConfigs = session.getConfigInstances(); for (var i = 0; i < runningConfigs.length; i++) { runningALs = runningConfigs[i].getAssemblyLines(); for (var j = 0; j < runningALs.length; j++) { if (runningALs[j].isActive()) { stats = runningALs[j].getStatistics().toString(); main.logmsg("statistics[" + j + "] = " + stats); result = runningALs[j].getResult(); var attr = new com.ibm.di.entry.Attribute("LogURL", "/log/" + runningALs[j].getGlobalUniqueID()); runningALs[j].stop(); } } }- Specified by:
stopin interfaceAssemblyLine- Throws:
DIException- if an error occurs while stopping the AssemblyLine.
-
stop
public void stop(boolean sync) throws DIExceptionStops the execution of the AssemblyLine, and waits for it to stop.Example
var stats = null; var runningConfigs = session.getConfigInstances(); for (var i = 0; i < runningConfigs.length; i++) { var runningALs = runningConfigs[i].getAssemblyLines(); for (var j = 0; j < runningALs.length; j++) { if (runningALs[j].isActive()) { main.logmsg("Stopping [" + j + "]: " + runningALs[j].getName()); runningALs[j].stop(false); stats = runningALs[j].getStatistics().toString(); main.logmsg("statistics[" + j + "] = " + stats); } } }- Specified by:
stopin interfaceAssemblyLine- Parameters:
sync- If true, create a new Thread to do the waiting.- Throws:
DIException- if an error occurs while stopping the AssemblyLine.
-
getSystemLogFilePath
public java.lang.String getSystemLogFilePath() throws DIExceptionReturns the fully-qualified path of the log file of the AssemblyLine.- Specified by:
getSystemLogFilePathin interfaceAssemblyLine- Returns:
- the fully-qualified log file path.
- Throws:
DIException- if an error occurs while obtaining AssemblyLine log file path.
-
getSystemLogFileName
public java.lang.String getSystemLogFileName() throws DIExceptionReturns the name of the log file of the AssemblyLine (not prefixed by folders path).- Specified by:
getSystemLogFileNamein interfaceAssemblyLine- Returns:
- the log file name.
- Throws:
DIException- if an error occurs while obtaining AssemblyLine log file name.
-
getSystemLog
public java.lang.String getSystemLog() throws DIExceptionRetrieves the current AssemblyLine's system log.- Specified by:
getSystemLogin interfaceAssemblyLine- Returns:
- the log generated by the AssemblyLine so far.
- Throws:
DIException- if an error occurs while obtaining AssemblyLine's log.
-
getSystemLogLastChunk
public java.lang.String getSystemLogLastChunk(int aLastKilobytes) throws DIExceptionRetrieves the last chunk from the current AssemblyLine's system log.- Specified by:
getSystemLogLastChunkin interfaceAssemblyLine- Parameters:
aLastKilobytes- Specifies in kilobytes the size of the log's last chunk that will be read.- Returns:
- the last chunk of the AssemblyLine's log, generated so far.
- Throws:
DIException- if an error occurs while obtaining AssemblyLine's log.
-
getGlobalUniqueID
public java.lang.String getGlobalUniqueID()
Returns AssemblyLine GUID. The GUID is a string value that is unique for each component ever created by a particular TDI Server.Example
var runningALs = null; var stats = null; var result = null; var runningConfigs = session.getConfigInstances(); for (var i = 0; i < runningConfigs.length; i++) { runningALs = runningConfigs[i].getAssemblyLines(); for (var j = 0; j < runningALs.length; j++) { if (runningALs[j].isActive()) { stats = runningALs[j].getStatistics().toString(); main.logmsg("statistics[" + j + "] = " + stats); result = runningALs[j].getResult(); var attr = new com.ibm.di.entry.Attribute("LogURL", "/log/" + runningALs[j].getGlobalUniqueID()); runningALs[j].stop(); } } }- Specified by:
getGlobalUniqueIDin interfaceAssemblyLine- Returns:
- The AssemblyLine GUID value.
-
genGUID
public static java.lang.String genGUID(AssemblyLine aAssemblyLine)
Generates unique GUID for a specified assembly line.- Parameters:
aAssemblyLine- the assembly line name- Returns:
- generated GUID as String object
-
isSimulating
public boolean isSimulating() throws DIExceptionCheck whether the AssemblyLine is simulating or not- Specified by:
isSimulatingin interfaceAssemblyLine- Returns:
- true if the AssemblyLine is simulating, false if it is not.
- Throws:
DIException- if an error occurs while obtaining the simulation state
-
setSimulating
public void setSimulating(boolean simulate) throws DIExceptionChanges the way the AssemblyLine treats the target systems it is connecting/interacting to/with. Turning the simulation on will make the AssemblyLine use the SimulationConfig child of the AssemblyLineConfig in order to properly handle sensitive data.- Specified by:
setSimulatingin interfaceAssemblyLine- Parameters:
simulate- true switches the simulation on, false switches it off- Throws:
DIException- if an error occurs while changing the simulation state
-
addListener
public void addListener(AssemblyLineListener listener, boolean getLogs, boolean getEntryOnEachCycle) throws DIException
Register a listener for AssemblyLine events. You must be admin to execute this method. Beware that there is no automatic removal of orphaned listeners.- Specified by:
addListenerin interfaceAssemblyLine- Parameters:
listener- Listener for AssemblyLine events.getLogs- If true, the listener will receive logged messages.getEntryOnEachCycle- If true the listener will receive the current entry at each AssemblyLine cycle's end.- Throws:
DIException- If the listener cannot be registered.- See Also:
AssemblyLine.removeListener(AssemblyLineListener)
-
removeListener
public void removeListener(AssemblyLineListener listener) throws DIException
Unregister a listener for AssemblyLine events. You must be admin to execute this method. Listeners are associated with the API object, not with the AssemblyLine in the Server, so you can remove only listeners added with the
#addListener(AssemblyLineListener, boolean)method on the same object.Beware that the listener may get notified one more time after it was unregistered. The only way to ensure this does not happen is to unregister the listener in one of its callback methods.
- Specified by:
removeListenerin interfaceAssemblyLine- Parameters:
listener- The listener that needs to be removed.- Throws:
DIException- If the listener cannot be unregistered.- See Also:
#addListener(AssemblyLineListener, boolean)
-
attachDebugger
public void attachDebugger(int port, java.lang.String host, boolean onerror) throws DIExceptionAttach a debugger to the AssemblyLine. You must be admin to execute this method.- Specified by:
attachDebuggerin interfaceAssemblyLine- Parameters:
port- Port of the debugger.host- Host of the debugger.onerror- If true breakpoints are disabled except when there is an error.- Throws:
DIException- If the AssemblyLine is already being debugged or the AssemblyLine cannot connect to the debugger.
-
detachDebugger
public void detachDebugger(java.lang.Object msg) throws DIExceptionDetach the current debugger from the AssemblyLine. You must be admin to execute this method.- Specified by:
detachDebuggerin interfaceAssemblyLine- Parameters:
msg- This object will be sent to the debugger before the detaching occurs. Must be serializable. If null, nothing will be sent.- Throws:
DIException- If an error occurs while detaching the debugger.
-
getComponentDebugMode
public boolean getComponentDebugMode(java.lang.String componentName) throws DIExceptionQuery the debug mode setting of the specified component (Connector or Function Component). You must be admin to execute this method. A component will log debug level messages only if it is in debug mode. You can find out the names of the AssemblyLine components from the configuration -AssemblyLine.getConfig().- Specified by:
getComponentDebugModein interfaceAssemblyLine- Parameters:
componentName- The name of a Connector or a Function Component from this AssemblyLine. Must be spelled exactly as it appears in the configuration.- Returns:
- The debug mode of the component.
- Throws:
DIException- If an error occurs while querying the debug mode.
-
setComponentDebugMode
public void setComponentDebugMode(java.lang.String componentName, boolean debug) throws DIExceptionModify the debug mode setting of the specified component (Connector or Function Component). You must be admin to execute this method. Modifications are done on the fly and are not persisted in the configuration -AssemblyLine.getConfig(). If you run the same AssemblyLine again it will use the settings from the configuration.- Specified by:
setComponentDebugModein interfaceAssemblyLine- Parameters:
componentName- The name of a Connector or a Function Component from this AssemblyLine.debug- The new debug mode of the component.- Throws:
DIException- If an error occurs while setting the debug mode.- See Also:
AssemblyLine.getComponentDebugMode(String)
-
-