qat.parser
Class AgentInstance

java.lang.Object
  extended byqat.parser.AgentInstance

public class AgentInstance
extends java.lang.Object


Constructor Summary
AgentInstance(java.lang.String name, int port, java.lang.String dir, boolean mode)
          This sets up an instance for communicating with an agent
 
Method Summary
 java.lang.String CHECKFILE(java.lang.String filename)
          This method returns "0" if filename exists, and "1" if it doesn't.
 void CMDCLEAN(java.lang.String processID)
           
 java.lang.String CMDGETTRACE(java.lang.String processID, java.lang.String fileName)
           
 java.lang.String CMDSTART(java.lang.String[] command, java.lang.String timeout)
          This starts a command on the agent corresponding to this agent instance
 java.lang.String CMDSTATUS(java.lang.String processID)
           
 java.lang.String CMDSTOP(java.lang.String processID)
          If the process is still running, it will be killed and the return will be * negative, else if it wasn't running, the exit status will be returned.
 void DAEMONCLEAN()
           
 void DAEMONSTART(java.lang.String[] command)
          This starts a command on the agent corresponding to this agent instance
 void DELAGENT()
          * This method is called to clean up any trace, stdout & stderror files created * by calls to STARTCMD.
 void DELFILE(java.lang.String filename)
           
 void DELPROP(java.lang.String key, java.lang.String value)
          This deletes a property previously set by a call to SETPROP
 java.lang.String ENVTRACECONTAINS(java.lang.String processID, java.lang.String fileName, java.lang.String grepString)
           
 java.lang.String getAgentName()
          This returns the name of the machine corresponding to this agent instance.
 int getAgentPort()
          This returns the port of the machine running the agent corresponding to this agent instance.
 java.lang.String getAgentWorkDirectory()
          This returns the working directory of the agent corresponding to * this agent instance.
 void GETFILE(java.lang.String src, java.lang.String dest)
           
 java.lang.String[] GETTRACEPATHS(java.lang.String processID)
           
 boolean inEvaluationMode()
          Returns true if this agent instance is currently in evaluation mode, else it returns false.
 boolean isHandlingProcess(java.lang.String processID)
          Looks through currently running processes for an identifier matching processID
 boolean isHandlingZip(java.lang.String zipID)
          Looks through sent zip lists for an identifier matching zipID
 void KILLALL()
          This method will kill all process running in this agent, whether related to this AgentInstace or not.
 void KILLSTARTEDPROCESSES()
          This method will kill any processes started by this AgentInstance, but will leave others running * in the agent alone.
 void MKDIR(java.lang.String filename)
           
 void SENDFILE(java.lang.String src, java.lang.String dest)
           
 void setAgentName(java.lang.String name)
          This sets the name of the machine corresponding to this agent instance
 void setAgentPort(int port)
          This sets the name of the machine corresponding to this agent instance
 void setAgentWorkDirectory(java.lang.String dir)
          This sets the working directory of the agent corresponding to this agent instance
 void setEvaluationMode(boolean mode)
          Sets this agent instance to evaluation mode, else it returns false
 void SETPROP(java.lang.String key, java.lang.String value)
          This sets a property which will be visible to any process executed on the agent * machine by this agent instance
 java.lang.String STDERRCONTAINS(java.lang.String processID, java.lang.String fileName, java.lang.String grepString)
           
 java.lang.String STDOUTCONTAINS(java.lang.String processID, java.lang.String fileName, java.lang.String grepString)
           
 void ZIPCLEAN(java.lang.String zipID)
          This method cleans a zip file previously sent to the agent matching this agent instance
 java.lang.String ZIPSEND(java.lang.String zipFile)
          Sends a zip file to the agent machine, places it in the working directory, * and unzips it
 java.lang.String ZIPSEND(java.lang.String zipFile, java.lang.String zipID)
          Sends a zip file to the agent machine, places it in the working directory, * and unzips it
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AgentInstance

public AgentInstance(java.lang.String name,
                     int port,
                     java.lang.String dir,
                     boolean mode)
              throws java.lang.Exception
This sets up an instance for communicating with an agent. * @param name the name of the agent machine * @param port the port of the agent machine to connect to * @param dir a dir path on the agent machine which will be used as a base * to store any temporary files. This dir will be deleted by a call to DELAGENT * @param mode if true, evaluation mode is selected, and no communication is actually * required with an agent. Otherwise, a live agent is expected.

Method Detail

inEvaluationMode

public boolean inEvaluationMode()
Returns true if this agent instance is currently in evaluation mode, else it returns false.


setEvaluationMode

public void setEvaluationMode(boolean mode)
Sets this agent instance to evaluation mode, else it returns false. * If true, evaluation mode is selected, and no communication is actually * required with an agent. Otherwise, a live agent is expected. * @param mode if true, evaluation mode is activated.


getAgentName

public java.lang.String getAgentName()
This returns the name of the machine corresponding to this agent instance.


setAgentName

public void setAgentName(java.lang.String name)
This sets the name of the machine corresponding to this agent instance. * @param name the name of the agent machine


getAgentPort

public int getAgentPort()
This returns the port of the machine running the agent corresponding to this agent instance.


setAgentPort

public void setAgentPort(int port)
This sets the name of the machine corresponding to this agent instance. * @param port the port on the agent machine


getAgentWorkDirectory

public java.lang.String getAgentWorkDirectory()
This returns the working directory of the agent corresponding to * this agent instance.


setAgentWorkDirectory

public void setAgentWorkDirectory(java.lang.String dir)
                           throws java.lang.Exception
This sets the working directory of the agent corresponding to this agent instance. * This should normally be done only once per agent instance. * If the dir does not exist on the agent, it will be created, and then deleted * by the matching call to DELAGENT. If it already exists, it will not be deleted by a call to * DELAGENT. * @param dir the name of the working directory on the agent machine

Throws:
java.lang.Exception

isHandlingProcess

public boolean isHandlingProcess(java.lang.String processID)
Looks through currently running processes for an identifier matching processID. * Returns the true if it was found. * @param processID the processID to look for


isHandlingZip

public boolean isHandlingZip(java.lang.String zipID)
Looks through sent zip lists for an identifier matching zipID. * Returns the true if it was found. * @param zipID the zipID to look for


DELAGENT

public void DELAGENT()
              throws java.lang.Exception
* This method is called to clean up any trace, stdout & stderror files created * by calls to STARTCMD.

Throws:
java.lang.Exception

ZIPSEND

public java.lang.String ZIPSEND(java.lang.String zipFile,
                                java.lang.String zipID)
                         throws java.lang.Exception
Sends a zip file to the agent machine, places it in the working directory, * and unzips it. * Returns a zipID for use for future deletion. * @param zipFile the local path to the zip file. * @return the zipID for later reference and deletion

Throws:
java.lang.Exception

ZIPSEND

public java.lang.String ZIPSEND(java.lang.String zipFile)
                         throws java.lang.Exception
Sends a zip file to the agent machine, places it in the working directory, * and unzips it. * Returns a zipID for use for future deletion. * @param zipFile the local path to the zip file. * @return the zipID for later reference and deletion

Throws:
java.lang.Exception

ZIPCLEAN

public void ZIPCLEAN(java.lang.String zipID)
              throws java.lang.Exception
This method cleans a zip file previously sent to the agent matching this agent instance. * @param zipRequestID the id returned when the ZIPSEND command was called

Throws:
java.lang.Exception

SETPROP

public void SETPROP(java.lang.String key,
                    java.lang.String value)
This sets a property which will be visible to any process executed on the agent * machine by this agent instance. * @param key the key of the key-property pair * @param value the value of the key-value pair


DELPROP

public void DELPROP(java.lang.String key,
                    java.lang.String value)
This deletes a property previously set by a call to SETPROP. * so that future execution commands will no longer have this variable set in their environment. * This will not affect processes already started.


CMDSTART

public java.lang.String CMDSTART(java.lang.String[] command,
                                 java.lang.String timeout)
                          throws java.lang.Exception
This starts a command on the agent corresponding to this agent instance. * @param command command to be started, relative to the agent * @param timeout the timeout, in seconds, afeter which a call to GETSTATUS will * return failed. * @return an processID used for future queries on the process state, trace file * retrieval etc.

Throws:
java.lang.Exception

CMDSTOP

public java.lang.String CMDSTOP(java.lang.String processID)
                         throws java.lang.Exception
If the process is still running, it will be killed and the return will be * negative, else if it wasn't running, the exit status will be returned.

Throws:
java.lang.Exception

CMDSTATUS

public java.lang.String CMDSTATUS(java.lang.String processID)
                           throws java.lang.Exception
Throws:
java.lang.Exception

DAEMONSTART

public void DAEMONSTART(java.lang.String[] command)
                 throws java.lang.Exception
This starts a command on the agent corresponding to this agent instance. * @param command command to be started, relative to the agent * @param timeout the timeout, in seconds, afeter which a call to GETSTATUS will * return failed. * @return an processID used for future queries on the process state, trace file * retrieval etc.

Throws:
java.lang.Exception

GETFILE

public void GETFILE(java.lang.String src,
                    java.lang.String dest)
             throws java.lang.Exception
Throws:
java.lang.Exception

SENDFILE

public void SENDFILE(java.lang.String src,
                     java.lang.String dest)
              throws java.lang.Exception
Throws:
java.lang.Exception

CHECKFILE

public java.lang.String CHECKFILE(java.lang.String filename)
                           throws java.lang.Exception
This method returns "0" if filename exists, and "1" if it doesn't.

Throws:
java.lang.Exception

DELFILE

public void DELFILE(java.lang.String filename)
             throws java.lang.Exception
Throws:
java.lang.Exception

MKDIR

public void MKDIR(java.lang.String filename)
           throws java.lang.Exception
Throws:
java.lang.Exception

CMDGETTRACE

public java.lang.String CMDGETTRACE(java.lang.String processID,
                                    java.lang.String fileName)
                             throws java.lang.Exception
Throws:
java.lang.Exception

CMDCLEAN

public void CMDCLEAN(java.lang.String processID)
              throws java.lang.Exception
Throws:
java.lang.Exception

DAEMONCLEAN

public void DAEMONCLEAN()
                 throws java.lang.Exception
Throws:
java.lang.Exception

ENVTRACECONTAINS

public java.lang.String ENVTRACECONTAINS(java.lang.String processID,
                                         java.lang.String fileName,
                                         java.lang.String grepString)
                                  throws java.lang.Exception
Throws:
java.lang.Exception

STDOUTCONTAINS

public java.lang.String STDOUTCONTAINS(java.lang.String processID,
                                       java.lang.String fileName,
                                       java.lang.String grepString)
                                throws java.lang.Exception
Throws:
java.lang.Exception

STDERRCONTAINS

public java.lang.String STDERRCONTAINS(java.lang.String processID,
                                       java.lang.String fileName,
                                       java.lang.String grepString)
                                throws java.lang.Exception
Throws:
java.lang.Exception

GETTRACEPATHS

public java.lang.String[] GETTRACEPATHS(java.lang.String processID)
                                 throws java.lang.Exception
Throws:
java.lang.Exception

KILLALL

public void KILLALL()
             throws java.lang.Exception
This method will kill all process running in this agent, whether related to this AgentInstace or not.

Throws:
java.lang.Exception

KILLSTARTEDPROCESSES

public void KILLSTARTEDPROCESSES()
                          throws java.lang.Exception
This method will kill any processes started by this AgentInstance, but will leave others running * in the agent alone. Also cleans the corresponding traces files created * by the started processes.

Throws:
java.lang.Exception


See QAT project for licensing details