AgentConnection (Hyperic HQ Plugin API)
Keywords: org.hyperic.hq.agent.client.AgentConnection class

Overview | Package | Class | Tree | Deprecated | Index | Help
| Hyperic HQ Plugin API v. 4.4.0.2
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.hyperic.hq.agent.client
Class AgentConnection

    java.lang.Object
      org.hyperic.hq.agent.client.AgentConnection

Direct Known Subclasses:
  SecureAgentConnection

    public class AgentConnection

extends java.lang.Object

The object which represents the connection between the client and the Agent. It holds Agent contact information, and may perform connection caching.

Constructor Summary
`AgentConnection(java.lang.String agentAddress, int agentPort)` Create a connection to an Agent with the specified address and port.

Method Summary
`void` | `closeSocket()`
`boolean` | `equals(java.lang.Object o)`
`java.lang.String` | `getAgentAddress()`
`int` | `getAgentPort()`
`AgentRemoteValue` | `getCommandResult(AgentStreamPair inStreamPair)` Get the result of command execution from the remote command handler.
`protected java.net.Socket` | `getSocket()`
`int` | `hashCode()`
`AgentRemoteValue` | `sendCommand(java.lang.String cmdName, int cmdVersion, AgentRemoteValue arg)` Send a command to the remote Agent.
`AgentStreamPair` | `sendCommandHeaders(java.lang.String cmdName, int cmdVersion, AgentRemoteValue arg)` Send the command to the agent, not waiting for it to process the result.

Methods inherited from class java.lang.Object
`clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### AgentConnection

    public AgentConnection(java.lang.String agentAddress,
                           int agentPort)

  Create a connection to an Agent with the specified address and port.

  Parameters:
    `agentAddress` - IP address of the Agent
    `agentPort` - Port the Agent is listening on

Method Detail

### getAgentAddress

    public java.lang.String getAgentAddress()

### getAgentPort

    public int getAgentPort()

### getSocket

    protected java.net.Socket getSocket()
                                 throws AgentConnectionException

  Throws:
    `AgentConnectionException`

### sendCommand

    public AgentRemoteValue sendCommand(java.lang.String cmdName,
                                        int cmdVersion,
                                        AgentRemoteValue arg)
                                 throws AgentRemoteException,
                                        AgentConnectionException

  Send a command to the remote Agent. This routine blocks, while sending the data to the agent and waiting for the result.

  Parameters:
    `cmdName` - Name of the remote method to execute
    `cmdVersion` - API version number belonging to the command
    `arg` - Argument to send to the remote method
  Returns:
    an AgentRemoteValue object, as returned from the Agent.
  Throws:
    `AgentRemoteException` - indicating an error invoking the method.
    `AgentConnectionException` - indicating a failure to connect to, or communicate with the agent.

### sendCommandHeaders

    public AgentStreamPair sendCommandHeaders(java.lang.String cmdName,
                                              int cmdVersion,
                                              AgentRemoteValue arg)
                                       throws AgentConnectionException

  Send the command to the agent, not waiting for it to process the result. This call must be paired with a single 'getCommandResult' which is passed the stream pair which is returned from this routine. By calling sendCommandHeaders and getCommandResult seperately, callers can use the stream pair to perform special communication with the remote handlers, not supported by the agent transportation framework (such as streamed file transfer).

  Parameters:
    `cmdName` - Name of the remote method to execute
    `cmdVersion` - API version number belonging to the command
    `arg` - Argument to send to the remote method
  Returns:
    an AgentRemoteValue object, as returned from the Agent.
  Throws:
    `AgentConnectionException` - indicating a failure to connect to, or communicate with the agent.

### getCommandResult

    public AgentRemoteValue getCommandResult(AgentStreamPair inStreamPair)
                                      throws AgentRemoteException,
                                             AgentConnectionException

  Get the result of command execution from the remote command handler.

  Parameters:
    `inStreamPair` - The pair which was returned from the associated sendCommandHeaders invocation.
  Returns:
    an AgentRemoteValue object, as returned from the Agent.
  Throws:
    `AgentRemoteException` - indicating an error invoking the method.
    `AgentConnectionException` - indicating a failure to communicate with the agent.

### closeSocket

    public void closeSocket()

### equals

    public boolean equals(java.lang.Object o)

  Overrides:
    `equals` in class `java.lang.Object`

### hashCode

    public int hashCode()

  Overrides:
    `hashCode` in class `java.lang.Object`

Overview | Package | Class | Tree | Deprecated | Index | Help
| Hyperic HQ Plugin API v. 4.4.0.2
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2004-2006 Hyperic, Inc. support@hyperic.net, All Rights Reserved.