Class LocalTriggerManager.ScriptAgentBean

  • All Implemented Interfaces:
    mks.frame.triggers.ScriptExposableBean
    Enclosing class:
    LocalTriggerManager

    public static class LocalTriggerManager.ScriptAgentBean
    extends LocalTriggerManager.ScriptIMBaseBean
    implements mks.frame.triggers.ScriptExposableBean
    This bean represents an MKS Agent which can be used to perform tasks on a remote system.

    This bean may be obtained from the server bean, via the getAgentBean call.

    Since:
    Integrity Solution 2009
    • Constructor Detail

      • ScriptAgentBean

        public ScriptAgentBean​(java.lang.String agentHostname,
                               int agentPort,
                               java.lang.String agentUser,
                               java.lang.String agentPassword,
                               int userId,
                               java.sql.Connection c)
                        throws mks.frame.triggers.TriggerException
        Throws:
        mks.frame.triggers.TriggerException
    • Method Detail

      • getExposedName

        public java.lang.String getExposedName()
        Returns the name of this bean that is exposed to the scripting language.
        Specified by:
        getExposedName in interface mks.frame.triggers.ScriptExposableBean
        Specified by:
        getExposedName in class ScriptBaseBean
        Returns:
        This bean is named imAgentBean.
      • connect

        public void connect()
                     throws mks.frame.triggers.TriggerException
        Establish a connection to the Agent.
        Throws:
        mks.frame.triggers.TriggerException - If the connection to the Agent could not be established.
      • disconnect

        public void disconnect()
                        throws mks.frame.triggers.TriggerException
        Disconnect from the Agent.
        Throws:
        mks.frame.triggers.TriggerException - If the connection to the Agent could not disconnected.
      • isUpdating

        public boolean isUpdating()
                           throws mks.frame.triggers.TriggerException
        Determine if the Agent is in the process of updating (via an application of a service pack). An updating Agent will not have new tasks assigned to it, allowing it to be come idle so it can be restarted to start the updating process.
        Returns:
        true if the Agent has a service pack that should be applied and will refuse any new tasks, false otherwise.
        Throws:
        mks.frame.triggers.TriggerException - If the request for this information from the Agent failed.
      • getHostname

        public java.lang.String getHostname()
                                     throws mks.frame.triggers.TriggerException
        Get the hostname of the Agent.
        Returns:
        The hostname of the Agent.
        Throws:
        mks.frame.triggers.TriggerException - Reserved exception.
      • getPort

        public int getPort()
                    throws mks.frame.triggers.TriggerException
        Get the port of the Agent.
        Returns:
        The port of the Agent.
        Throws:
        mks.frame.triggers.TriggerException - Reserved exception.
      • getUsername

        public java.lang.String getUsername()
                                     throws mks.frame.triggers.TriggerException
        Get the name of the user used to connect to the Agent.
        Returns:
        The name of the user used to connect to the Agent.
        Throws:
        mks.frame.triggers.TriggerException - Reserved exception.
      • runTestSession

        public void runTestSession​(int sessionId,
                                   java.lang.String adapterName,
                                   boolean secure,
                                   java.util.Properties adapterProperties)
                            throws mks.frame.triggers.TriggerException
        Request that a test run be performed for the provided tests session on an Agent.
        Parameters:
        sessionId - The ID of the test session item.
        adapterName - The name of the adapter on the Agent to run the test session.
        secure - true if the secure port of the server should be used for the underlying API session from the Agent back into the Windchill RV&S Server, otherwise the clear port of the server will be used.
        adapterProperties - An optional set of adapter properties that overlay the adapter properties defined on the MKS Agent in the tm.properties file.
        Throws:
        mks.frame.triggers.TriggerException - If the ID provided is not for a test session issue, the connection to the Agent can't be established, a test run for the provide session is already in progress on the Agent, the API session back into this server can't be established or an error is encountered within the session adapter initialize method. An exception will also be thrown if this method is called outside of a pre event trigger. If the Agent is in the process of updating this method call will also throw an exception since no new tasks can be assigned to an Agent once it is determined that a service pack must be applied.
      • cancelTestSession

        public void cancelTestSession​(int sessionID,
                                      java.lang.String adapterName)
                               throws mks.frame.triggers.TriggerException
        Request the cancellation of a test run being performed for the provided tests session on an Agent. Note that cancellation of a test session that is no longer running in the Agent is considered an error.
        Parameters:
        sessionID - The ID of the test session item.
        adapterName - The name of the adapter on the Agent to run the test session.
        Throws:
        mks.frame.triggers.TriggerException - If the ID provided is not for a test session issue, the connection to the agent can't be established, the test session to be cancelled can not be found or the test session adapter cancel() method encountered an exception. An exception will also be thrown if this method is outside of a post event trigger.
      • cancelTestSession

        public void cancelTestSession​(LocalTriggerManager.ScriptTestSessionRunBean bean)
                               throws mks.frame.triggers.TriggerException
        Request the cancellation of a test run being performed for the provided tests session on an Agent. Note that cancellation of a test session that is no longer running in the Agent is considered an error.
        Parameters:
        bean - The test session run bean.
        Throws:
        mks.frame.triggers.TriggerException - If the ID provided is not for a test session issue, the connection to the agent can't be established, the test session to be cancelled can not be found or the test session adapter cancel() method encountered an exception. An exception will also be thrown if this method is outside of a post event trigger.
      • getTestSessionAdapters

        public java.lang.String[] getTestSessionAdapters()
                                                  throws mks.frame.triggers.TriggerException
        Get the names of the test session adapters installed on the Agent.
        Returns:
        The names of the test session adapters installed on the Agent.
        Throws:
        mks.frame.triggers.TriggerException - If the connection to the Agent can't be established or there was an error in fetching the adapters from the Agent.
      • getRunningTestSessions

        public LocalTriggerManager.ScriptTestSessionRunBean[] getRunningTestSessions()
                                                                              throws mks.frame.triggers.TriggerException
        Get the test sessions in progress on the Agent. Only test sessions for this server will be provided.
        Returns:
        The beans representing running test sessions within the Agent.
        Throws:
        mks.frame.triggers.TriggerException - If the connection to the Agent can't be established or there was an error in fetching the running test sesions from the Agent.