org.rhq.enterprise.agent
Class AgentUtils

java.lang.Object
  extended by org.rhq.enterprise.agent.AgentUtils

public abstract class AgentUtils
extends Object

Just a place where utility methods are placed for use by the agent and its related classes.

Author:
John Mazzitelli

Nested Class Summary
static class AgentUtils.ServerEndpoint
          A very simple object that encapsulates server endpoint information that can be used to connect to a server.
 
Constructor Summary
AgentUtils()
           
 
Method Summary
static AgentUtils.ServerEndpoint getServerEndpoint(AgentConfiguration agentConfig, String server)
          Given a server string with an agent's configuration (used to obtain defaults), this will return an object that contains information that can be used to communicate with the server (such as its transport, hostname, port, etc).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AgentUtils

public AgentUtils()
Method Detail

getServerEndpoint

public static AgentUtils.ServerEndpoint getServerEndpoint(AgentConfiguration agentConfig,
                                                          String server)
Given a server string with an agent's configuration (used to obtain defaults), this will return an object that contains information that can be used to communicate with the server (such as its transport, hostname, port, etc). If the agentConfig is not provided (i.e. null), it will be ignored - but if the server string does not contain all the necessary information, this method will throw an exception. The purpose of this method is to allow users to provide a simpler server hostname string and just have the agent configuration provide the rest of the information. But it also allows a user to provide a full server URI in case the server in question is configured differently than the one the agent is, by default, going to talk to (for example, if by default the agent talks to its server unencrypted but the server string identifies a server that requires SSL to be communicated with - in that case, the transports are different).

Parameters:
agentConfig - the configuration of the agent (may be null)
server - identifies the server; this may be a full server endpoint URI that has all the information this method needs, or it may just be a hostname string in which case the agent configuration will be used to determine the rest of the server endpoint information (such as the port the server is listening on, the transport to be used and the transport parameters)
Returns:
the server endpoint information that can be used to talk to the server
Throws:
IllegalArgumentException - if agentConfig is null and server is only a hostname string and as such does not provide everything this method needs. This exception may also be throw if server is a full, but invalid, URI.


Copyright © 2008-2011 Red Hat, Inc.. All Rights Reserved.