Class ConfigInstanceImpl

  • All Implemented Interfaces:
    ConfigInstance

    public class ConfigInstanceImpl
    extends java.lang.Object
    implements ConfigInstance
    Represents a configuration instance and implements various methods for manipulating the configuration.
    • Constructor Detail

    • Method Detail

      • getConfigId

        public java.lang.String getConfigId()
                                     throws DIException
        Returns the configuration ID generated by the server.

        Example:

                for( ci in session.getConfigInstances()){
                task.logmsg("Name: " + ci.getConfigId());
                }
         //Sample output: Name: C__Documents and Settings_username_My Documents_TDI_rs.xml
         
        Specified by:
        getConfigId in interface ConfigInstance
        Returns:
        String object representing the configuration ID.
        Throws:
        DIException - if an error occurs while getting the configuration ID.
      • getConfiguration

        public MetamergeConfig getConfiguration()
                                         throws DIException
        Returns configuration instance representing this configuration.
        Specified by:
        getConfiguration in interface ConfigInstance
        Returns:
        MetamergeConfig object representing this configuration.
        Throws:
        DIException - if an error occurs while getting the configuration.
      • setConfiguration

        public void setConfiguration​(MetamergeConfig aConfiguration)
                              throws DIException
        Sets given configuration to this configuration.
        Specified by:
        setConfiguration in interface ConfigInstance
        Parameters:
        aConfiguration - The new configuration.
        Throws:
        DIException - if an error occurs while setting the configuration.
      • getExternalProperties

        public ExternalPropertiesConfig getExternalProperties​(java.lang.String aKey)
                                                       throws DIException
        Returns the ExternalPropertiesConfig object for the named external properties object.
        Specified by:
        getExternalProperties in interface ConfigInstance
        Parameters:
        aKey - The external property object name.
        Returns:
        ExternalPropertiesConfig object representing the configuration's external properties specified by the external property object name.
        Throws:
        DIException - if an error occurs while getting the external properties.
      • getExternalPropertiesKeys

        public java.lang.String[] getExternalPropertiesKeys()
                                                     throws DIException
        Returns the external properties object names.
        Specified by:
        getExternalPropertiesKeys in interface ConfigInstance
        Returns:
        String array each value representing one external property object name.
        Throws:
        DIException - if an error occurs while getting the external properties names.
      • getAssemblyLineNames

        public java.lang.String[] getAssemblyLineNames()
                                                throws DIException
        Returns the AssemblyLines' names.

        Example:

                var ci = session.getConfigInstance("C__Documents and Settings_username_My Documents_TDI_rs.xml");
         
                for(al in ci.getAssemblyLineNames()){
                task.logmsg("Al name: " + al);
                }
         
          //Sample output:Al name: csv2xml
                        Al name: test
         
        Specified by:
        getAssemblyLineNames in interface ConfigInstance
        Returns:
        String array each value representing AssemblyLine name.
        Throws:
        DIException - if an error occurs while getting the AssemblyLines' names.
      • getAssemblyLineUniqueCodes

        public int[] getAssemblyLineUniqueCodes()
                                         throws DIException
        Returns a list of integers uniquely identify all the AssemblyLines within the ConfigInstance.

        Example:

                var ci = session.getConfigInstance("C__Documents and Settings_username_My Documents_TDI_rs.xml");
         
                for(al in ci.getAssemblyLineUniqueCodes()){
                task.logmsg("Al id: " + al);
                }
         
          //Sample output:Al name: csv2xml
                        Al id: 2312
         
        Specified by:
        getAssemblyLineUniqueCodes in interface ConfigInstance
        Returns:
        integer list each value representing AssemblyLine id.
        Throws:
        DIException - if an error occurs while getting the AssemblyLines' IDs.
      • getAssemblyLineInputParameters

        public SchemaConfig getAssemblyLineInputParameters​(java.lang.String aAssemblyLineName)
                                                    throws DIException
        Returns the AssemblyLine's input parameters.
        Specified by:
        getAssemblyLineInputParameters in interface ConfigInstance
        Parameters:
        aAssemblyLineName - the name of the AssemblyLine.
        Returns:
        SchemaConfig representing the schema input of the AssemblyLine.
        Throws:
        DIException - if an error occurs while getting the AssemblyLine's input parameters.
      • getAssemblyLineOutputParameters

        public SchemaConfig getAssemblyLineOutputParameters​(java.lang.String aAssemblyLineName)
                                                     throws DIException
        Returns the AssemblyLine's output parameters.
        Specified by:
        getAssemblyLineOutputParameters in interface ConfigInstance
        Parameters:
        aAssemblyLineName - the name of the AssemblyLine.
        Returns:
        SchemaConfig representing the schema output of the AssemblyLine.
        Throws:
        DIException - if an error occurs while getting the AssemblyLine's output parameters.
      • getAssemblyLines

        public AssemblyLine[] getAssemblyLines()
                                        throws DIException
        Returns currently started AssemblyLines of the configuration instance.

        Example:

                var ci = session.getConfigInstance("C__Documents and Settings_username_My Documents_TDI_rs.xml");
         
                for(al in ci.getAssemblyLines()){
                task.logmsg("Al running: " + al.getName());
                }
         
          //Sample output: Al running: AssemblyLines/test
         
         
        Specified by:
        getAssemblyLines in interface ConfigInstance
        Returns:
        AssemblyLine array object each value represents currently started AssemblyLine.
        Throws:
        DIException - if an error occurs while getting the AssemblyLines.
      • startAssemblyLine

        public AssemblyLine startAssemblyLine​(java.lang.String aAssemblyLineName)
                                       throws DIException
        Starts the specified AssemblyLine asynchronously.

        Example:

         var ci = session.getConfigInstance("C__Documents and Settings_username_My Documents_TDI_rs.xml");
         
         var al = ci.startAssemblyLine("csv2xml");//assembly line is started
         //do something with al
         
        Specified by:
        startAssemblyLine in interface ConfigInstance
        Parameters:
        aAssemblyLineName - The name of the AssemblyLine.
        Returns:
        the AssemblyLine object.
        Throws:
        DIException - if an error occurs when starting the AssemblyLine.
      • startAssemblyLine

        public AssemblyLine startAssemblyLine​(java.lang.String aAssemblyLineName,
                                              boolean aSync)
                                       throws DIException
        Starts the specified AssemblyLine.

        Example:

         var ci = session.getConfigInstance("C__Documents and Settings_username_My Documents_TDI_rs.xml");
         
         var al = ci.startAssemblyLine("csv2xml", false);//assembly line is started in new thread
         //do something with al
         
        Specified by:
        startAssemblyLine in interface ConfigInstance
        Parameters:
        aAssemblyLineName - The name of the AssemblyLine.
        aSync - when true the AssemblyLine is started synchronously, when false the AssemblyLine is started asynchronously.
        Returns:
        the AssemblyLine object.
        Throws:
        DIException - if an error occurs when starting the AssemblyLine.
      • startAssemblyLine

        public AssemblyLine startAssemblyLine​(java.lang.String aAssemblyLineName,
                                              Entry aInputData)
                                       throws DIException
        Starts the specified AssemblyLine with the given input data asynchronously.

        Example:

         var ci = session.getConfigInstance("C__Documents and Settings_username_My Documents_TDI_rs.xml");
         
         var al = ci.startAssemblyLine("csv2xml", work);
         
         //assembly line "csv2xml" is started with the current entry of the current running assembly line
         //do something with al
         
        Specified by:
        startAssemblyLine in interface ConfigInstance
        Parameters:
        aAssemblyLineName - The name of the AssemblyLine.
        aInputData - Initial Work Entry to run the AssemblyLine with.
        Returns:
        the AssemblyLine object.
        Throws:
        DIException - if an error occurs when starting the AssemblyLine.
      • startAssemblyLine

        public AssemblyLine startAssemblyLine​(java.lang.String aAssemblyLineName,
                                              Entry aInputData,
                                              boolean aSync)
                                       throws DIException
        Starts the specified AssemblyLine with the given input data.

        Example:

         var ci = session.getConfigInstance("C__Documents and Settings_username_My Documents_TDI_rs.xml");
         
         var al = ci.startAssemblyLine("csv2xml", work, false);
         
         //assembly line "csv2xml" is started with the current entry of the current running assembly line
         //do something with al
         
        Specified by:
        startAssemblyLine in interface ConfigInstance
        Parameters:
        aAssemblyLineName - The name of the AssemblyLine.
        aInputData - Initial Work Entry to run the AssemblyLine with.
        aSync - when true the AssemblyLine is started synchronously, when false the AssemblyLine is started asynchronously.
        Returns:
        the AssemblyLine object.
        Throws:
        DIException - if an error occurs when starting the AssemblyLine.
      • startAssemblyLine

        public AssemblyLine startAssemblyLine​(java.lang.String aAssemblyLineName,
                                              Entry aInputData,
                                              AssemblyLineListener aListener,
                                              boolean aGetLogs)
                                       throws DIException
        Starts asynchronously the specified AssemblyLine with the given input data and results listener.
        Specified by:
        startAssemblyLine in interface ConfigInstance
        Parameters:
        aAssemblyLineName - The name of the AssemblyLine.
        aInputData - Initial Work Entry to run the AssemblyLine with.
        aListener - A listener for Entries produced by the AssemblyLine.
        aGetLogs - when true the AssemblyLineListener is delivered log messages, when false log messages are not delivered.
        Returns:
        the AssemblyLine object.
        Throws:
        DIException - if an error occurs when starting the AssemblyLine.
      • startAssemblyLine

        public AssemblyLine startAssemblyLine​(java.lang.String aAssemblyLineName,
                                              Entry aInputData,
                                              AssemblyLineListener aListener,
                                              boolean aGetLogs,
                                              boolean aSync)
                                       throws DIException
        Starts the specified AssemblyLine with the given input data and results listener.
        Specified by:
        startAssemblyLine in interface ConfigInstance
        Parameters:
        aAssemblyLineName - The name of the AssemblyLine.
        aInputData - Initial Work Entry to run the AssemblyLine with.
        aListener - A listener for Entries produced by the AssemblyLine.
        aGetLogs - when true the AssemblyLineListener delivers log messages, when false log messages are not delivered.
        aSync - when true the AssemblyLine is started synchronously, when false the AssemblyLine is started asynchronously.
        Returns:
        the AssemblyLine object.
        Throws:
        DIException - if an error occurs when starting the AssemblyLine.
      • startAssemblyLine

        public AssemblyLine startAssemblyLine​(java.lang.String aAssemblyLineName,
                                              Entry aInputData,
                                              AssemblyLineListener aListener,
                                              boolean aGetLogs,
                                              boolean aSync,
                                              boolean aGetEntryOnEachCycle)
                                       throws DIException
        Starts the specified AssemblyLine with the given input data and results listener.
        Specified by:
        startAssemblyLine in interface ConfigInstance
        Parameters:
        aAssemblyLineName - The name of the AssemblyLine.
        aInputData - Initial Work Entry to run the AssemblyLine with.
        aListener - A listener for Entries produced by the AssemblyLine.
        aGetLogs - when true the AssemblyLineListener delivers log messages, when false log messages are not delivered.
        aSync - when true the AssemblyLine is started synchronously, when false the AssemblyLine is started asynchronously.
        aGetEntryOnEachCycle - when true the AssemblyLineListener delivers the current entry on each AssemblyLine cycle, when false the entries are not delivered.
        Returns:
        the AssemblyLine object.
        Throws:
        DIException - if an error occurs when starting the AssemblyLine.
      • startAssemblyLineManual

        public AssemblyLineHandler startAssemblyLineManual​(java.lang.String aAssemblyLineName,
                                                           Entry aInputData)
                                                    throws DIException
        Starts the specified AssemblyLine with the given input data in manual mode.
        Specified by:
        startAssemblyLineManual in interface ConfigInstance
        Parameters:
        aAssemblyLineName - The name of the AssemblyLine.
        aInputData - Initial Work Entry to run the AssemblyLine with.
        Returns:
        the AssemblyLineHandler object for AssemblyLine manipulation in manual mode.
        Throws:
        DIException - if an error occurs when starting the AssemblyLine.
      • startAssemblyLine

        public AssemblyLine startAssemblyLine​(java.lang.String aAssemblyLineName,
                                              TaskCallBlock aTcb)
                                       throws DIException
        Starts asynchronously the specified AssemblyLine with the given TaskCallBlock.
        Specified by:
        startAssemblyLine in interface ConfigInstance
        Parameters:
        aAssemblyLineName - The name of the AssemblyLine.
        aTcb - The TaskCallBlock object to start the AL with.
        Returns:
        the AssemblyLine object.
        Throws:
        DIException - if an error occurs when starting the AssemblyLine.
      • startAssemblyLine

        public AssemblyLine startAssemblyLine​(java.lang.String aAssemblyLineName,
                                              TaskCallBlock aTcb,
                                              boolean aSync)
                                       throws DIException
        Starts the specified AssemblyLine with the given TaskCallBlock.
        Specified by:
        startAssemblyLine in interface ConfigInstance
        Parameters:
        aAssemblyLineName - The name of the AssemblyLine.
        aTcb - The TaskCallBlock object to start the AL with.
        aSync - when true the AssemblyLine is started synchronously, when false the AssemblyLine is started asynchronously.
        Returns:
        the AssemblyLine object.
        Throws:
        DIException - if an error occurs when starting the AssemblyLine.
      • reload

        public void reload()
                    throws DIException
        Reloads the Config Instance with its current configuration.
        Specified by:
        reload in interface ConfigInstance
        Throws:
        DIException - if an error occurs while reloading the server.
      • stop

        public void stop()
                  throws DIException
        Stops the Config Instance.

        Example:

         var ci = session.getConfigInstance("C__Documents and Settings_username_My Documents_TDI_rs.xml");
         ci.stop();
         
        Specified by:
        stop in interface ConfigInstance
        Throws:
        DIException - if an error occurs while stopping.
      • stop

        public void stop​(boolean sync)
                  throws DIException
        Stops the Config Instance and all AssemblyLines run by it, and waits a while for the stopping to finish.

        Example:

         var ci = session.getConfigInstance("myProject");
         ci.stop(false);
         
        Specified by:
        stop in interface ConfigInstance
        Parameters:
        sync - If true, waiting will occur in new Threads.
        Throws:
        DIException - if an error occurs while stopping.
      • getALLogFileNames

        public java.lang.String[] getALLogFileNames​(java.lang.String aALName)
                                             throws DIException
        Returns the names of all available log files for a given AssemblyLine.
        Specified by:
        getALLogFileNames in interface ConfigInstance
        Parameters:
        aALName - the name of the AssemblyLine.
        Returns:
        a String array, each of its elements specifying the name of a log file.
        Throws:
        DIException - if an error occurs while obtaining AssemblyLine's log file names.
      • getALLastLogFileName

        public java.lang.String getALLastLogFileName​(java.lang.String aALName)
                                              throws DIException
        Returns the name of the log file created on the last run of a given AssemblyLine.
        Specified by:
        getALLastLogFileName in interface ConfigInstance
        Parameters:
        aALName - the name of the AssemblyLine.
        Returns:
        the name of the log file created on the last AssemblyLine's run.
        Throws:
        DIException - if an error occurs while obtaining the log file name.
      • getALLog

        public java.lang.String getALLog​(java.lang.String aALName,
                                         java.lang.String aLogFileName)
                                  throws DIException
        Given an AssemblyLine name, and a log file name, retrieves the log of this AssemblyLine, stored in the specified file.
        Specified by:
        getALLog in interface ConfigInstance
        Parameters:
        aALName - the name of the AssemblyLine.
        aLogFileName - the name of the log file; no file path should be specified - just the file name.
        Returns:
        the specified log of the AssemblyLine.
        Throws:
        DIException - if an error occurs while obtaining AssemblyLine's log.
      • getALLogLastChunk

        public java.lang.String getALLogLastChunk​(java.lang.String aALName,
                                                  java.lang.String aLogFileName,
                                                  int aKilobytes)
                                           throws DIException
        Retrieves the last chunk from a specified AssemblyLine's log file.
        Specified by:
        getALLogLastChunk in interface ConfigInstance
        Parameters:
        aALName - the name of the AssemblyLine.
        aLogFileName - the name of the log file; no file path should be specified - just the file name.
        aKilobytes - specifies in kilobytes the size of the log's last chunk that will be read.
        Returns:
        the last chunk of the specified AssemblyLine's log.
        Throws:
        DIException - if an error occurs while obtaining AssemblyLine's log.
      • getInstanceBootTime

        public java.util.Date getInstanceBootTime()
                                           throws DIException
        Returns the Instance boot time.
        Specified by:
        getInstanceBootTime in interface ConfigInstance
        Returns:
        a java.util.Date specifying the date and time the instance was started.
        Throws:
        DIException - if an error occurs while retrieving instance's boot time.
      • getGlobalUniqueID

        public java.lang.String getGlobalUniqueID()
        Returns the Config Instance GUID. The GUID is a string value that is unique for each component ever created by a particular TDI Server.

        Example:

         var ci = session.getConfigInstance("C__Documents and Settings_username_My Documents_TDI_rs.xml");
         task.logmsg("Config ID: " + ci.getGlobalUniqueID());
         
         //Sample output: Config ID: 19245595421206360821315
         
        Specified by:
        getGlobalUniqueID in interface ConfigInstance
        Returns:
        The Config Instance GUID value.
      • getConnectorPoolNames

        public java.lang.String[] getConnectorPoolNames()
                                                 throws DIException
        Returns the names of all Connector Pools in the Config Instance.
        Specified by:
        getConnectorPoolNames in interface ConfigInstance
        Returns:
        String array containing the Connector Pool names.
        Throws:
        DIException - if an error occurs while retrieving the names of all Connector Pools.
      • getConnectorPoolSize

        public int getConnectorPoolSize​(java.lang.String aConnectorPoolName)
                                 throws DIException
        Returns the size of the specified Connector Pool.
        Specified by:
        getConnectorPoolSize in interface ConfigInstance
        Parameters:
        aConnectorPoolName - the name of the Connector Pool.
        Returns:
        The current size of the specified Connector Pool.
        Throws:
        DIException - if an error occurs while retrieving the size of the specified Connector Pool.
      • getConnectorPoolFreeNum

        public int getConnectorPoolFreeNum​(java.lang.String aConnectorPoolName)
                                    throws DIException
        Returns the number of free Connectors in the specified Connector Pool.
        Specified by:
        getConnectorPoolFreeNum in interface ConfigInstance
        Parameters:
        aConnectorPoolName - the name of the Connector Pool.
        Returns:
        The number of free Connectors in the specified Connector Pool.
        Throws:
        DIException - if an error occurs while retrieving the number of free Connectors in the specified Connector Pool.
      • getConnectorPoolConfig

        public PoolDefConfig getConnectorPoolConfig​(java.lang.String aConnectorPoolName)
                                             throws DIException
        Returns the Connector Pool configuration object.
        Specified by:
        getConnectorPoolConfig in interface ConfigInstance
        Parameters:
        aConnectorPoolName - the name of the Connector Pool.
        Returns:
        The configuration object for the specified Connector Pool.
        Throws:
        DIException - if an error occurs while retrieving the Connector Pool configuration object.
      • purgeConnectorPool

        public int purgeConnectorPool​(java.lang.String aConnectorPoolName)
                               throws DIException
        Unused Connectors will be released so that the Pool is shrunk to its minimum size.
        Specified by:
        purgeConnectorPool in interface ConfigInstance
        Parameters:
        aConnectorPoolName - the name of the Connector Pool.
        Returns:
        The size of the Connector Pool after shrinking.
        Throws:
        DIException - if an error occurs while shrinking the Connector Pool.
      • getTDIProperties

        public TDIProperties getTDIProperties()
                                       throws java.lang.Exception
        Used to obtain a reference to TDIProperties for managing properties / property stores.
        Specified by:
        getTDIProperties in interface ConfigInstance
        Returns:
        A reference to the TDIProperties interface.
        Throws:
        java.lang.Exception - if an error occurs while obtaining a reference to TDIProperties.
      • genGUID

        public static java.lang.String genGUID​(RS aConfigInstance)
        This method is for internal Server API usage.
        Parameters:
        aConfigInstance -
        Returns:
        the globally unique identifier string
      • getConfigPath

        public java.lang.String getConfigPath()
        Retrieves the absolute path of the configuration.

        Example:

         var ci = session.getConfigInstance("C__Documents and Settings_Username_My Documents_TDI_rs.xml");
         
         task.logmsg("CI path: " + ci.getConfigPath());
         //Sample output: CI path: "C:\Documents and Settings\Username\My Documents\TDI"
         
         
        Specified by:
        getConfigPath in interface ConfigInstance
        Returns:
        the absolute path of the configuration file.
      • getConfigurationFile

        public java.lang.String getConfigurationFile()
                                              throws DIException
        Description copied from interface: ConfigInstance
        Retrieves a reference to the Configuration file used to load this instance from. This string is in the form of what Session.listAllConfigurations() would return. It could be either a solution name or a path relative to the base config folder.
        Specified by:
        getConfigurationFile in interface ConfigInstance
        Returns:
        the configuration file reference or null if this is a temporary instance from an in-memory configuration.
        Throws:
        DIException - if an error occurs while retrieving configuration file reference
      • removeLogListener

        public void removeLogListener​(LogListener listener)
                               throws DIException

        Unregister listener for messages logged by this configuration instance. 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 ConfigInstance.addLogListener(LogListener) method on the same object.

        Do not invoke this method from within the listener while the listener is being notified because a deadlock may occur.

        Specified by:
        removeLogListener in interface ConfigInstance
        Parameters:
        listener - Registered listener.
        Throws:
        DIException - If an error occurs while unregistering the listener, e.g. the listener is null or is not registered.
        See Also:
        ConfigInstance.addLogListener(LogListener)
      • startSequence

        public Sequence startSequence​(java.lang.String name)
                               throws DIException
        Description copied from interface: ConfigInstance
        Starts the specified Sequence.

        Example:

         var ci = session.getConfigInstance("C__Documents and Settings_username_My Documents_TDI_rs.xml");
         
         var seq = ci.startSequence("csv2xml");//Sequence is started
         
        Specified by:
        startSequence in interface ConfigInstance
        Parameters:
        name - The name of the Sequence.
        Returns:
        the Sequence object.
        Throws:
        DIException - if an error occurs when starting the Sequence.
      • startSequence

        public Sequence startSequence​(java.lang.String name,
                                      TaskCallBlock tcb,
                                      boolean sync)
                               throws DIException
        Description copied from interface: ConfigInstance
        Starts the specified Sequence specifying a TaskCallBlock, synchronous or asynchronous.

        Example:

         var ci = session.getConfigInstance("C__Documents and Settings_username_My Documents_TDI_rs.xml");
         
         var seq = ci.startSequence("csv2xml", null, true);//Sequence is started in new thread, and has now run to completion
         //do something with seq
         
        Specified by:
        startSequence in interface ConfigInstance
        Parameters:
        name - The name of the Sequence.
        tcb - The TaskCallBlock object to start the Sequence with. If null, ignored.
        sync - when true the Sequence is started synchronously, when false the Sequence is started asynchronously.
        Returns:
        the Sequence object.
        Throws:
        DIException - if an error occurs when starting the Sequence.
      • startSequence

        public Sequence startSequence​(java.lang.String name,
                                      TaskCallBlock tcb,
                                      AssemblyLineListener listener)
                               throws DIException
        Description copied from interface: ConfigInstance
        Starts the specified Sequence with the given TaskCallBlock and a Listener
        Specified by:
        startSequence in interface ConfigInstance
        Parameters:
        name - The name of the Sequence.
        tcb - The TaskCallBlock object to start the Sequence with.
        listener - A listener to know when the Sequence has stopped.
        Returns:
        the Sequence object.
        Throws:
        DIException - if an error occurs when starting the Sequence.
      • getSchedulerInfo

        public java.util.Map<java.lang.String,​java.lang.Object> getSchedulerInfo​(java.lang.String name)
        Description copied from interface: ConfigInstance
        Returns information about the named Scheduler. If the Scheduler is not found, returns null.
        Specified by:
        getSchedulerInfo in interface ConfigInstance
        Parameters:
        name - - Name of Scheduler
      • getSchedulersInfo

        public java.util.List<java.util.Map<java.lang.String,​java.lang.Object>> getSchedulersInfo()
        Description copied from interface: ConfigInstance
        Returns information about all Schedulers in this RS. If no Schedulers are found, returns an empty List.
        Specified by:
        getSchedulersInfo in interface ConfigInstance