Class AssemblyLineImpl

  • All Implemented Interfaces:
    AssemblyLine, java.io.Serializable, java.rmi.Remote, java.rmi.server.Unreferenced

    public class AssemblyLineImpl
    extends APIRemoteObject
    implements AssemblyLine, java.rmi.server.Unreferenced
    Implements an AssemblyLine instance.
    See Also:
    Serialized Form
    • Field Summary

      • Fields inherited from class java.rmi.server.RemoteObject

        ref
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addListener​(AssemblyLineListener listener, boolean getLogs, boolean getEntryOnEachCycle)
      Register a listener for AssemblyLine events.
      void attachDebugger​(int port, java.lang.String host, boolean onerror)
      Attach a debugger to the AssemblyLine.
      static AssemblyLineImpl createInstance​(AssemblyLine aLocalAssemblyLine, SessionImpl aSession)
      Creates new instance of this class.
      void detachDebugger​(java.lang.Object msg)
      Detach the current debugger from the AssemblyLine.
      boolean getComponentDebugMode​(java.lang.String componentName)
      Query the debug mode setting of the specified component (Connector or Function Component).
      AssemblyLineConfig getConfig()
      Returns configuration information about the AssemblyLine.
      ConfigInstance getConfigInstance()
      Returns the configuration instance of the AssemblyLine.
      java.lang.String getGlobalUniqueID()
      Returns AssemblyLine GUID.
      java.lang.String getName()
      Returns the name of the AssemblyLine.
      java.lang.String getNullBehavior()
      Gets the nullBehavior attribute of the AssemblyLine object
      java.lang.String getNullBehaviorValue()
      Gets the nullBehaviorValue attribute of the AssemblyLine object.
      Entry getResult()
      This method returns the result entry object.
      TaskStatistics getStatistics()
      This method returns the TaskStatistics object for this AssemblyLine.
      java.lang.String getSystemLog()
      Retrieves the current AssemblyLine's system log.
      java.lang.String getSystemLogFileName()
      Returns the name of the log file of the AssemblyLine (not prefixed by folders path).
      java.lang.String getSystemLogFilePath()
      Returns the fully-qualified path of the log file of the AssemblyLine.
      java.lang.String getSystemLogLastChunk​(int aLastKilobytes)
      Retrieves the last chunk from the current AssemblyLine's system log.
      int getUniqueCode()
      Returns the unique code of the AssemblyLine.
      boolean isActive()
      Checks if the AssemblyLine is active.
      boolean isSimulating()
      Check weather the AssemblyLine is simulating or not
      void removeListener​(AssemblyLineListener listener)
      Unregister a listener for AssemblyLine events.
      void setComponentDebugMode​(java.lang.String componentName, boolean debug)
      Modify the debug mode setting of the specified component (Connector or Function Component).
      void setSimulating​(boolean simulate)
      Changes the way the AssemblyLine treats the target systems it is connectig/interacting to/with.
      void stop()
      Stops the execution of the AssemblyLine.
      void stop​(boolean sync)
      Stops the execution of the AssemblyLine, and waits for it to stop.
      void unreferenced()  
      • Methods inherited from class java.rmi.server.UnicastRemoteObject

        clone, exportObject, exportObject, exportObject, exportObject, exportObject, unexportObject
      • Methods inherited from class java.rmi.server.RemoteServer

        getClientHost, getLog, setLog
      • Methods inherited from class java.rmi.server.RemoteObject

        equals, getRef, hashCode, toString, toStub
      • Methods inherited from class java.lang.Object

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

      • getConfigInstance

        public ConfigInstance getConfigInstance()
                                         throws DIException,
                                                java.rmi.RemoteException
        Returns the configuration instance of the AssemblyLine.

        Example

         var sessionFactory = java.rmi.Naming.lookup("rmi://127.0.0.1:1099/SessionFactory");
         var remoteSession = sessionFactory.createSession();
         var mAssemblyLine = remoteSession.getAssemblyLines()[0];
         
         if (mAssemblyLine != null) {
                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());
         } else {
                main.logmsg("No Remote Assembly Lines Running");
         }
         
        Specified by:
        getConfigInstance in interface AssemblyLine
        Returns:
        Returns ConfigInstance object representing the configuration instance of the AssemblyLine.
        Throws:
        DIException - if an error occurs while retrieving the configuration instance information.
        java.rmi.RemoteException - if a communication-related exception occurs.
      • getName

        public java.lang.String getName()
                                 throws DIException,
                                        java.rmi.RemoteException
        Returns the name of the AssemblyLine.

        Example

         var sessionFactory = java.rmi.Naming.lookup("rmi://127.0.0.1:1099/SessionFactory");
         var remoteSession = sessionFactory.createSession();
         var mAssemblyLine = remoteSession.getAssemblyLines()[0];
         
         if (mAssemblyLine != null) {
                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());
         } else {
                main.logmsg("No Remote Assembly Lines Running");
         }
         
        Specified by:
        getName in interface AssemblyLine
        Returns:
        String object representing the AssemblyLine's name.
        Throws:
        DIException - if an error occurs while retrieving the name of the AssemblyLine.
        java.rmi.RemoteException - if a communication-related exception occurs.
      • getUniqueCode

        public int getUniqueCode()
                          throws DIException,
                                 java.rmi.RemoteException
        Returns the unique code of the AssemblyLine.

        Example

         var sessionFactory = java.rmi.Naming.lookup("rmi://127.0.0.1:1099/SessionFactory");
         var remoteSession = sessionFactory.createSession();
         var remALListener = new com.ibm.di.admin.remote.RemoteALListener(remoteSession, false);
         var runningAL = session.getAssemblyLines()[0];
         remALListener.setCode(runningAL.getUniqueCode());
         
        Specified by:
        getUniqueCode in interface AssemblyLine
        Returns:
        int value representing the unique code of the AssemblyLine.
        Throws:
        DIException - if an error occurs while retrieving the unique code of the AssemblyLine.
        java.rmi.RemoteException - if a communication-related exception occurs.
      • getConfig

        public AssemblyLineConfig getConfig()
                                     throws DIException,
                                            java.rmi.RemoteException
        Returns configuration information about the AssemblyLine.
        Specified by:
        getConfig in interface AssemblyLine
        Returns:
        AssemblyLineConfig representing the configuration information of the AssemblyLine.
        Throws:
        DIException - if an error occurs while retrieving the configuration information of the AssemblyLine.
        java.rmi.RemoteException - if a communication-related exception occurs.
      • getNullBehavior

        public java.lang.String getNullBehavior()
                                         throws DIException,
                                                java.rmi.RemoteException
        Gets the nullBehavior attribute of the AssemblyLine object
        Specified by:
        getNullBehavior in interface AssemblyLine
        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.
        java.rmi.RemoteException - if a communication-related exception occurs.
      • getNullBehaviorValue

        public java.lang.String getNullBehaviorValue()
                                              throws DIException,
                                                     java.rmi.RemoteException
        Gets the nullBehaviorValue attribute of the AssemblyLine object.
        Specified by:
        getNullBehaviorValue in interface AssemblyLine
        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.
        java.rmi.RemoteException - if a communication-related exception occurs.
      • getStatistics

        public TaskStatistics getStatistics()
                                     throws DIException,
                                            java.rmi.RemoteException
        This method returns the TaskStatistics object for this AssemblyLine.

        Example

         var runningALs = null;
         var stats = null;
         var result = null;
         var sessionFactory = java.rmi.Naming.lookup("rmi://127.0.0.1:1099/SessionFactory");
         var remoteSession = sessionFactory.createSession();
         var runningConfigs = remoteSession.getConfigInstances();
         if (runningConfigs != null) {
                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();
                                }
                        }
                }
         } else {
                main.logmsg("No remote config instances available");
         }
         
        Specified by:
        getStatistics in interface AssemblyLine
        Returns:
        The accumulated TaskStatistics object.
        Throws:
        DIException - if an error occurs while getting the AssemblyLine statistics.
        java.rmi.RemoteException - if a communication-related exception occurs.
      • isActive

        public boolean isActive()
                         throws DIException,
                                java.rmi.RemoteException
        Checks if the AssemblyLine is active.

        Example

         var runningALs = null;
         var stats = null;
         var result = null;
         var sessionFactory = java.rmi.Naming.lookup("rmi://127.0.0.1:1099/SessionFactory");
         var remoteSession = sessionFactory.createSession();
         var runningConfigs = remoteSession.getConfigInstances();
         if (runningConfigs != null) {
                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();
                                }
                        }
                }
         } else {
                main.logmsg("No remote config instances available");
         }
         
        Specified by:
        isActive in interface AssemblyLine
        Returns:
        true if the AssemblyLine's thread is alive, false otherwise.
        Throws:
        DIException - if an error occurs while getting the AssemblyLine state.
        java.rmi.RemoteException - if a communication-related exception occurs.
      • getResult

        public Entry getResult()
                        throws DIException,
                               java.rmi.RemoteException
        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 sessionFactory = java.rmi.Naming.lookup("rmi://127.0.0.1:1099/SessionFactory");
         var remoteSession = sessionFactory.createSession();
         var runningConfigs = remoteSession.getConfigInstances();
         if (runningConfigs != null) {
                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();
                                }
                        }
                }
         } else {
                main.logmsg("No remote config instances available");
         }
         
        Specified by:
        getResult in interface AssemblyLine
        Returns:
        The last "work" entry object.
        Throws:
        DIException - if an error occurs while getting the result Entry.
        java.rmi.RemoteException - if a communication-related exception occurs.
      • stop

        public void stop()
                  throws DIException,
                         java.rmi.RemoteException
        Stops the execution of the AssemblyLine.

        Example

         var runningALs = null;
         var stats = null;
         var result = null;
         var sessionFactory = java.rmi.Naming.lookup("rmi://127.0.0.1:1099/SessionFactory");
         var remoteSession = sessionFactory.createSession();
         var runningConfigs = remoteSession.getConfigInstances();
         if (runningConfigs != null) {
                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();
                                }
                        }
                }
         } else {
                main.logmsg("No remote config instances available");
         }
         
        Specified by:
        stop in interface AssemblyLine
        Throws:
        DIException - if an error occurs while stopping the AssemblyLine.
        java.rmi.RemoteException - if a communication-related exception occurs.
      • stop

        public void stop​(boolean sync)
                  throws DIException,
                         java.rmi.RemoteException
        Stops the execution of the AssemblyLine, and waits for it to stop.

        Example

         var stats = null;
         var sessionFactory = java.rmi.Naming.lookup("rmi://127.0.0.1:1099/SessionFactory");
         var remoteSession = sessionFactory.createSession();
         var runningConfigs = remoteSession.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:
        stop in interface AssemblyLine
        Parameters:
        sync - If true, create a new Thread on the server to do the waiting.
        Throws:
        DIException - if an error occurs while stopping the AssemblyLine.
        java.rmi.RemoteException
      • getSystemLogFilePath

        public java.lang.String getSystemLogFilePath()
                                              throws DIException,
                                                     java.rmi.RemoteException
        Returns the fully-qualified path of the log file of the AssemblyLine.
        Specified by:
        getSystemLogFilePath in interface AssemblyLine
        Returns:
        the fully-qualified log file path.
        Throws:
        DIException - if an error occurs while obtaining AssemblyLine log file path.
        java.rmi.RemoteException - if a communication-related exception occurs.
      • getSystemLogFileName

        public java.lang.String getSystemLogFileName()
                                              throws DIException,
                                                     java.rmi.RemoteException
        Returns the name of the log file of the AssemblyLine (not prefixed by folders path).
        Specified by:
        getSystemLogFileName in interface AssemblyLine
        Returns:
        the log file name.
        Throws:
        DIException - if an error occurs while obtaining AssemblyLine log file name.
        java.rmi.RemoteException - if a communication-related exception occurs.
      • getSystemLog

        public java.lang.String getSystemLog()
                                      throws DIException,
                                             java.rmi.RemoteException
        Retrieves the current AssemblyLine's system log.
        Specified by:
        getSystemLog in interface AssemblyLine
        Returns:
        the log generated by the AssemblyLine so far.
        Throws:
        DIException - if an error occurs while obtaining AssemblyLine's log.
        java.rmi.RemoteException - if a communication-related exception occurs.
      • getSystemLogLastChunk

        public java.lang.String getSystemLogLastChunk​(int aLastKilobytes)
                                               throws DIException,
                                                      java.rmi.RemoteException
        Retrieves the last chunk from the current AssemblyLine's system log.
        Specified by:
        getSystemLogLastChunk in interface AssemblyLine
        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.
        java.rmi.RemoteException - if a communication-related exception occurs.
      • createInstance

        public static AssemblyLineImpl createInstance​(AssemblyLine aLocalAssemblyLine,
                                                      SessionImpl aSession)
                                               throws DIException,
                                                      java.rmi.RemoteException
        Creates new instance of this class.
        Parameters:
        aLocalAssemblyLine - local assembly line
        aSession - the SessionImpl object
        Returns:
        AssemblyLineImpl object
        Throws:
        DIException - if error occurs while creating instance.
        java.rmi.RemoteException - if a communication-related exception occurs.
      • getGlobalUniqueID

        public java.lang.String getGlobalUniqueID()
                                           throws DIException,
                                                  java.rmi.RemoteException
        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 sessionFactory = java.rmi.Naming.lookup("rmi://127.0.0.1:1099/SessionFactory");
         var remoteSession = sessionFactory.createSession();
         var runningConfigs = remoteSession.getConfigInstances();
         if (runningConfigs != null) {
                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();
                                }
                        }
                }
         } else {
                main.logmsg("No remote config instances available");
         }
         
        Specified by:
        getGlobalUniqueID in interface AssemblyLine
        Returns:
        The AssemblyLine GUID value.
        Throws:
        DIException - if an error occurs while obtaining the AssemblyLine GUID value.
        java.rmi.RemoteException - if a communication-related exception occurs.
      • isSimulating

        public boolean isSimulating()
                             throws DIException,
                                    java.rmi.RemoteException
        Check weather the AssemblyLine is simulating or not
        Specified by:
        isSimulating in interface AssemblyLine
        Returns:
        true if the AssemblyLine is simulating, false if it is not.
        Throws:
        DIException - if an error occurs while obtaining the simulation state
        java.rmi.RemoteException - if connection error occurs.
      • setSimulating

        public void setSimulating​(boolean simulate)
                           throws DIException,
                                  java.rmi.RemoteException
        Changes the way the AssemblyLine treats the target systems it is connectig/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:
        setSimulating in interface AssemblyLine
        Parameters:
        simulate - true switches the simulation on, false switches it off
        Throws:
        DIException - if an error occurs while changing the simulation state
        java.rmi.RemoteException - if connection error occurs.
      • addListener

        public void addListener​(AssemblyLineListener listener,
                                boolean getLogs,
                                boolean getEntryOnEachCycle)
                         throws DIException,
                                java.rmi.RemoteException
        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:
        addListener in interface AssemblyLine
        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.
        java.rmi.RemoteException - if connection error occurs.
        See Also:
        AssemblyLine.removeListener(AssemblyLineListener)
      • removeListener

        public void removeListener​(AssemblyLineListener listener)
                            throws DIException,
                                   java.rmi.RemoteException

        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:
        removeListener in interface AssemblyLine
        Parameters:
        listener - The listener that needs to be removed.
        Throws:
        DIException - if the listener cannot be unregistered.
        java.rmi.RemoteException - if connection error occurs.
        See Also:
        #addListener(AssemblyLineListener, boolean)
      • attachDebugger

        public void attachDebugger​(int port,
                                   java.lang.String host,
                                   boolean onerror)
                            throws DIException,
                                   java.rmi.RemoteException
        Attach a debugger to the AssemblyLine. You must be admin to execute this method.
        Specified by:
        attachDebugger in interface AssemblyLine
        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.
        java.rmi.RemoteException - If connection error occurs.
      • detachDebugger

        public void detachDebugger​(java.lang.Object msg)
                            throws DIException,
                                   java.rmi.RemoteException
        Detach the current debugger from the AssemblyLine. You must be admin to execute this method.
        Specified by:
        detachDebugger in interface AssemblyLine
        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.
        java.rmi.RemoteException - If connection error occurs.
      • getComponentDebugMode

        public boolean getComponentDebugMode​(java.lang.String componentName)
                                      throws DIException,
                                             java.rmi.RemoteException
        Query 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:
        getComponentDebugMode in interface AssemblyLine
        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.
        java.rmi.RemoteException - If connection error occurs.
      • setComponentDebugMode

        public void setComponentDebugMode​(java.lang.String componentName,
                                          boolean debug)
                                   throws DIException,
                                          java.rmi.RemoteException
        Modify 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:
        setComponentDebugMode in interface AssemblyLine
        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.
        java.rmi.RemoteException - If connection error occurs.
        See Also:
        AssemblyLine.getComponentDebugMode(String)
      • unreferenced

        public void unreferenced()
        Specified by:
        unreferenced in interface java.rmi.server.Unreferenced