Hyperic HQ Plugin API v. 4.4.0.2

org.hyperic.hq.agent
Class AgentConfig

java.lang.Object
  extended by org.hyperic.hq.agent.AgentConfig

public class AgentConfig
extends java.lang.Object

The configuration object for the AgentDaemon. This class performs validation on application properties, and provides a type-specific API for consumption by the Agent.


Field Summary
static java.lang.String AGENT_BUNDLE_HOME
           
static java.lang.String BUNDLE_PROPFILE
           
static java.lang.String DEFAULT_AGENT_PROPFILE_NAME
           
static java.lang.String DEFAULT_PROPFILE
           
static java.lang.String DEFAULT_ROLLBACKPROPFILE
           
static java.lang.String HQ_PRODUCT_JAR_KEY
           
static java.lang.String IP_GLOBAL
           
static java.lang.String JSW_PROP_AGENT_BUNDLE
           
static java.lang.String JSW_PROP_AGENT_ROLLBACK_BUNDLE
           
static java.lang.String PDK_DIR_KEY
           
static java.lang.String PDK_LIB_DIR_KEY
           
static java.lang.String PDK_PLUGIN_DIR_KEY
           
static java.lang.String PDK_WORK_DIR_KEY
           
static java.lang.String[] PROP_BUNDLEHOME
           
static java.lang.String[] PROP_DATADIR
           
static java.lang.String[] PROP_INSTALLHOME
           
static java.lang.String[] PROP_KEYSTORE
           
static java.lang.String PROP_LATHER_PROXYHOST
           
static java.lang.String PROP_LATHER_PROXYPORT
           
static java.lang.String[] PROP_LIB_HANDLERS
           
static java.lang.String[] PROP_LIB_HANDLERS_LIB
           
static java.lang.String[] PROP_LISTENIP
           
static java.lang.String[] PROP_LISTENPORT
           
static java.lang.String[] PROP_LOGDIR
           
static java.lang.String[] PROP_PDK_DIR
           
static java.lang.String[] PROP_PDK_LIB_DIR
           
static java.lang.String[] PROP_PDK_PLUGIN_DIR
           
static java.lang.String[] PROP_PDK_WORK_DIR
           
static java.lang.String PROP_PROPFILE
           
static java.lang.String[] PROP_PROXYHOST
           
static java.lang.String[] PROP_PROXYPORT
           
static java.lang.String[] PROP_ROLLBACK_AGENT_BUNDLE_UPGRADE
           
static java.lang.String[] PROP_STORAGEPROVIDER
           
static java.lang.String[] PROP_STORAGEPROVIDERINFO
           
static java.lang.String[] PROP_TMPDIR
           
static java.lang.String ROLLBACK_PROPFILE
           
 
Method Summary
 java.util.Properties getBootProperties()
          Get the boot properties used when creating the agent configuration.
static java.util.Properties getDefaultProperties()
          Get a Properties object with default invocation properties for the Agent.
 java.lang.String getListenIp()
          Get the Agent listening address.
 java.net.InetAddress getListenIpAsAddr()
          Get the listen IP address as an InetAddress object.
 int getListenPort()
          Get the Agent listening port.
 int getNotifyUpPort()
           
static java.util.Properties getProperties(java.lang.String propsFile)
          Return a Properties object that is the merged result all possible locations for agent.properties.
static java.io.File[] getPropertyFiles(java.lang.String propsFile)
          Return an ordered list of property files used to configure the agent.
 java.lang.String getProxyIp()
          Get the IP for the proxy server.
 int getProxyPort()
          Get the proxy port.
 java.lang.String getStorageProvider()
          Gets the storage provider the Agent will use.
 java.lang.String getStorageProviderInfo()
          Get the info string passed to the init() function of the storage provider.
 java.lang.String getTokenFile()
           
 boolean isProxyServerSet()
           
static AgentConfig newInstance()
          Create a new config object with default settings.
static AgentConfig newInstance(java.util.Properties props)
          Create a new config object with settings specified by a properties object.
static AgentConfig newInstance(java.lang.String propsFile)
           
 void setListenIp(java.lang.String ip)
          Sets the IP that the agent should listen on.
 void setListenPort(int port)
          Sets the port the Agent should listen on.
 void setNotifyUpPort(int port)
          Sets the port which the AgentClient defines where the CommandServer can connect to notify it of successful startup.
 void setProxyIp(java.lang.String ip)
          Set the IP for the proxy server.
 void setProxyPort(int port)
          Sets the proxy port.
 void setStorageProvider(java.lang.String storageProvider)
          Set the classpath of the storage provider.
 void setStorageProviderInfo(java.lang.String info)
          Sets the info string that the Agent will use to pass to the init() function of the storage provider.
 void useProperties(java.util.Properties appProps)
          Set the configuration based on a properties object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

JSW_PROP_AGENT_BUNDLE

public static final java.lang.String JSW_PROP_AGENT_BUNDLE
See Also:
Constant Field Values

JSW_PROP_AGENT_ROLLBACK_BUNDLE

public static final java.lang.String JSW_PROP_AGENT_ROLLBACK_BUNDLE
See Also:
Constant Field Values

PROP_LATHER_PROXYHOST

public static final java.lang.String PROP_LATHER_PROXYHOST
See Also:
Constant Field Values

PROP_LATHER_PROXYPORT

public static final java.lang.String PROP_LATHER_PROXYPORT
See Also:
Constant Field Values

IP_GLOBAL

public static final java.lang.String IP_GLOBAL
See Also:
Constant Field Values

PDK_DIR_KEY

public static final java.lang.String PDK_DIR_KEY
See Also:
Constant Field Values

PDK_LIB_DIR_KEY

public static final java.lang.String PDK_LIB_DIR_KEY
See Also:
Constant Field Values

PDK_PLUGIN_DIR_KEY

public static final java.lang.String PDK_PLUGIN_DIR_KEY
See Also:
Constant Field Values

PDK_WORK_DIR_KEY

public static final java.lang.String PDK_WORK_DIR_KEY
See Also:
Constant Field Values

AGENT_BUNDLE_HOME

public static final java.lang.String AGENT_BUNDLE_HOME
See Also:
Constant Field Values

HQ_PRODUCT_JAR_KEY

public static final java.lang.String HQ_PRODUCT_JAR_KEY
See Also:
Constant Field Values

PROP_LISTENPORT

public static final java.lang.String[] PROP_LISTENPORT

PROP_LISTENIP

public static final java.lang.String[] PROP_LISTENIP

PROP_STORAGEPROVIDER

public static final java.lang.String[] PROP_STORAGEPROVIDER

PROP_STORAGEPROVIDERINFO

public static final java.lang.String[] PROP_STORAGEPROVIDERINFO

PROP_INSTALLHOME

public static final java.lang.String[] PROP_INSTALLHOME

PROP_BUNDLEHOME

public static final java.lang.String[] PROP_BUNDLEHOME

PROP_TMPDIR

public static final java.lang.String[] PROP_TMPDIR

PROP_LOGDIR

public static final java.lang.String[] PROP_LOGDIR

PROP_DATADIR

public static final java.lang.String[] PROP_DATADIR

PROP_KEYSTORE

public static final java.lang.String[] PROP_KEYSTORE

PROP_LIB_HANDLERS

public static final java.lang.String[] PROP_LIB_HANDLERS

PROP_LIB_HANDLERS_LIB

public static final java.lang.String[] PROP_LIB_HANDLERS_LIB

PROP_PDK_DIR

public static final java.lang.String[] PROP_PDK_DIR

PROP_PDK_LIB_DIR

public static final java.lang.String[] PROP_PDK_LIB_DIR

PROP_PDK_PLUGIN_DIR

public static final java.lang.String[] PROP_PDK_PLUGIN_DIR

PROP_PDK_WORK_DIR

public static final java.lang.String[] PROP_PDK_WORK_DIR

PROP_PROXYHOST

public static final java.lang.String[] PROP_PROXYHOST

PROP_PROXYPORT

public static final java.lang.String[] PROP_PROXYPORT

PROP_ROLLBACK_AGENT_BUNDLE_UPGRADE

public static final java.lang.String[] PROP_ROLLBACK_AGENT_BUNDLE_UPGRADE

PROP_PROPFILE

public static final java.lang.String PROP_PROPFILE
See Also:
Constant Field Values

DEFAULT_AGENT_PROPFILE_NAME

public static final java.lang.String DEFAULT_AGENT_PROPFILE_NAME
See Also:
Constant Field Values

DEFAULT_PROPFILE

public static final java.lang.String DEFAULT_PROPFILE

ROLLBACK_PROPFILE

public static final java.lang.String ROLLBACK_PROPFILE
See Also:
Constant Field Values

DEFAULT_ROLLBACKPROPFILE

public static final java.lang.String DEFAULT_ROLLBACKPROPFILE

BUNDLE_PROPFILE

public static final java.lang.String BUNDLE_PROPFILE
Method Detail

newInstance

public static AgentConfig newInstance()
Create a new config object with default settings.

Returns:
A newly initialized AgentConfig object

getPropertyFiles

public static java.io.File[] getPropertyFiles(java.lang.String propsFile)
Return an ordered list of property files used to configure the agent. Only the default agent.properties is required, all other files will not be added if they do not exist.

Parameters:
propsFile - The default agent.properties
Returns:
The ordered list of Files to read for agent.properties.

getProperties

public static java.util.Properties getProperties(java.lang.String propsFile)
                                          throws AgentConfigException
Return a Properties object that is the merged result all possible locations for agent.properties.

Parameters:
propsFile - The default agent.properties.
Returns:
The merge Properties object.
Throws:
AgentConfigException
See Also:
getPropertyFiles(String)

newInstance

public static AgentConfig newInstance(java.lang.String propsFile)
                               throws java.io.IOException,
                                      AgentConfigException
Throws:
java.io.IOException
AgentConfigException

newInstance

public static AgentConfig newInstance(java.util.Properties props)
                               throws AgentConfigException
Create a new config object with settings specified by a properties object.

Parameters:
props - Properties to use when setting up the config object
Returns:
A AgentConfig object with settings as setup by the passed properties
Throws:
AgentConfigException - indicating the passed configuration was invalid.

getDefaultProperties

public static java.util.Properties getDefaultProperties()
Get a Properties object with default invocation properties for the Agent.

Returns:
a Properties object with all the default parameters that the Agent will need to execute.

useProperties

public void useProperties(java.util.Properties appProps)
                   throws AgentConfigException
Set the configuration based on a properties object.

Parameters:
appProps - Properties to use to setup the object
Throws:
AgentConfigException - indicating the passed configuration was invalid.

setListenPort

public void setListenPort(int port)
                   throws AgentConfigException
Sets the port the Agent should listen on.

Parameters:
port - New port to set. The port should be in the range of 1 to 65535
Throws:
AgentConfigException - indicating the port was not within a valid range

getListenPort

public int getListenPort()
Get the Agent listening port.

Returns:
The port the Agent will listen on.

setListenIp

public void setListenIp(java.lang.String ip)
Sets the IP that the agent should listen on.

Parameters:
ip - The IP to bind to. If it is '*', then the agent will listen on all interfaces

getListenIp

public java.lang.String getListenIp()
Get the Agent listening address.

Returns:
The address the Agent will listen on.

setProxyPort

public void setProxyPort(int port)
                  throws AgentConfigException
Sets the proxy port.

Parameters:
port - New port to set. The port should be in the range of 1 to 65535
Throws:
AgentConfigException - indicating the port was not within a valid range

isProxyServerSet

public boolean isProxyServerSet()
Returns:
true if a proxy server is configured; false otherwise.

getProxyPort

public int getProxyPort()
Get the proxy port.

Returns:
The port or -1 if no proxy server is set.

setProxyIp

public void setProxyIp(java.lang.String ip)
Set the IP for the proxy server.

Parameters:
ip - The IP for the proxy server.

getProxyIp

public java.lang.String getProxyIp()
Get the IP for the proxy server.

Returns:
The IP or the empty string if no proxy server is set.

getListenIpAsAddr

public java.net.InetAddress getListenIpAsAddr()
                                       throws java.net.UnknownHostException
Get the listen IP address as an InetAddress object.

Returns:
null if the listen IP is for all interfaces, else an InetAddress referencing a specific IP.
Throws:
java.net.UnknownHostException - if the listenIP lookup fails.

getNotifyUpPort

public int getNotifyUpPort()
Returns:
The notify up port or -1 if not set.

setNotifyUpPort

public void setNotifyUpPort(int port)
                     throws AgentConfigException
Sets the port which the AgentClient defines where the CommandServer can connect to notify it of successful startup.

Parameters:
port - New port to set. The port should be in the range of 1 to 65535
Throws:
AgentConfigException - indicating the port was not within a valid range

setStorageProvider

public void setStorageProvider(java.lang.String storageProvider)
Set the classpath of the storage provider.

Parameters:
storageProvider - Fully qualified classname for a class implementing the AgentStorageProvider interface

getStorageProvider

public java.lang.String getStorageProvider()
Gets the storage provider the Agent will use.

Returns:
The fully qualified classname the AgentConfig object was previously configured with.

setStorageProviderInfo

public void setStorageProviderInfo(java.lang.String info)
Sets the info string that the Agent will use to pass to the init() function of the storage provider.

Parameters:
info - Info string to pass to init()

getStorageProviderInfo

public java.lang.String getStorageProviderInfo()
Get the info string passed to the init() function of the storage provider.

Returns:
The info string previously configured for the config object.

getBootProperties

public java.util.Properties getBootProperties()
Get the boot properties used when creating the agent configuration.

Returns:
a Properties object containing the argument to useProperties, or, if newInstance was called with a properties object, those Properties.

getTokenFile

public java.lang.String getTokenFile()

Hyperic HQ Plugin API v. 4.4.0.2

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