public class AgentConfiguration extends Object
| Constructor and Description |
|---|
AgentConfiguration(Preferences prefs)
Wraps a preferences object in this instance.
|
| Modifier and Type | Method and Description |
|---|---|
static String |
buildServerLocatorUri(String transport,
String bind_address,
int bind_port,
String transport_params)
This is a static utility method that builds a full remote endpoint string that combines
the given transport, server bind address, server bind port and server transport params.
|
boolean |
doNotEnableManagementServices()
If
true is returned, this will tell the agent it should not create its management services. |
boolean |
doNotInstallShutdownHook()
The default (
false) is that the agent will install a shutdown hook so it can detect
a VM shutdown request and be able to properly shut itself down. |
boolean |
doNotNotifyServerOfShutdown()
If
true is returned, this will tell the agent it should not tell the server that the agent is
shutting down. |
boolean |
doNotOverridePreferencesWithSystemProperties()
If
true is returned, this will tell the agent it should not overlay system properties over the agent
configuration preferences. |
boolean |
doNotStartPluginContainerAtStartup()
If
true is returned, this will tell the agent it should not start the Plugin Container at startup. |
int |
getAgentConfigurationVersion()
Returns the version of the configuration schema.
|
String |
getAgentName()
Returns the unique name that this agent will be known as.
|
String |
getAgentSecurityToken()
This returns the agent's security token that it needs to send with its commands to the server.
|
String |
getAgentUpdateDownloadUrl()
This will return the URL that the agent should use when it needs to download
the latest agent update binary.
|
String |
getAgentUpdateDownloadUrlIfDefined()
This will return the URL that the agent should use when it needs to download
the latest agent update binary.
|
String |
getAgentUpdateVersionUrl()
This will return the URL that the agent should use when it needs to find out
the version information of the latest agent update binary.
|
String |
getAgentUpdateVersionUrlIfDefined()
This will return the URL that the agent should use when it needs to find out
the version information of the latest agent update binary.
|
ClientCommandSenderConfiguration |
getClientCommandSenderConfiguration()
This is a convienence method that returns the full client sender configuration.
|
String |
getClientSenderCommandPreprocessors()
This will return the fully qualified class name of the command preprocessor object that the sender will use to
preprocess all commands that are to be queued and sent.
|
String |
getClientSenderCommandSpoolFileName()
This will return the name of the command spool file (to be located in the
data directory). |
long[] |
getClientSenderCommandSpoolFileParams()
Returns an array of command spool file parameters.
|
long |
getClientSenderCommandTimeout()
Returns the default timeout that the client sender will wait for a command to be processed by the server.
|
int |
getClientSenderMaxConcurrent()
Returns the maximum number of concurrent commands that the client sender will send at any one time.
|
int |
getClientSenderMaxRetries()
Returns the number of times a guaranteed message is retried, if it fails for a reason other than a "cannot
connect" to server.
|
int |
getClientSenderQueueSize()
Returns the client sender queue size which determines how many commands can be queued up for sending.
|
long[] |
getClientSenderQueueThrottling()
Returns an array of queue throttling parameters or
null if queue throttling is to be disabled. |
long |
getClientSenderRetryInterval()
Returns the time in milliseconds the client sender should wait in between retries of commands that have failed.
|
String |
getClientSenderSecurityKeystoreAlgorithm()
Returns the algorithm used to manage the keys in the keystore.
|
String |
getClientSenderSecurityKeystoreAlias()
Returns the alias to the client's key in the keystore.
|
String |
getClientSenderSecurityKeystoreFile()
Returns the path to the keystore file.
|
String |
getClientSenderSecurityKeystoreKeyPassword()
Returns the password to gain access to the key in the keystore.
|
String |
getClientSenderSecurityKeystorePassword()
Returns the password of the keystore file itself.
|
String |
getClientSenderSecurityKeystoreType()
Returns the type of the keystore file.
|
String |
getClientSenderSecuritySocketProtocol()
Returns the protocol used over the secure socket.
|
String |
getClientSenderSecurityTruststoreAlgorithm()
Returns the algorithm used to manage the keys in the truststore.
|
String |
getClientSenderSecurityTruststoreFile()
Returns the path to the truststore file.
|
String |
getClientSenderSecurityTruststorePassword()
Returns the password of the truststore file itself.
|
String |
getClientSenderSecurityTruststoreType()
Returns the type of the truststore file.
|
long[] |
getClientSenderSendThrottling()
Returns an array of send throttling parameters or
null if send throttling is to be disabled. |
long |
getClientSenderServerPollingInterval()
Returns the interval the client sender should wait in between polling the server.
|
File |
getDataDirectory()
Returns the data directory where all internally persisted data can be written to.
|
String |
getDataDirectoryIfDefined()
This will return the data directory string as found in the preferences.
|
PluginContainerConfiguration |
getPluginContainerConfiguration()
This will return all the individual plugin container configuration preferences in a configuration object.
|
Preferences |
getPreferences()
Returns the raw preferences containing the agent configuration.
|
long |
getPrimaryServerSwitchoverCheckIntervalMsecs()
This defines how many milliseconds the agent should wait between each check that ensures it is connected
to the primary server, as opposed to one of its failure servers.
|
String |
getServerBindAddress()
Returns the RHQ Server's bind address on which it is listening for incoming commands.
|
int |
getServerBindPort()
Returns the RHQ Server's bind port on which it is listening for incoming commands.
|
String |
getServerLocatorUri()
This is a convienence method that builds a full remote endpoint string that combines
getServerTransport(), getServerBindAddress(), getServerBindPort(), and
getServerTransportParams(). |
String |
getServerTransport()
Returns the RHQ Server's transport type (socket, http, etc).
|
String |
getServerTransportParams()
Returns the RHQ Server's transport parameters which are used to further customize the RHQ Server and its
transport subsystem.
|
ServiceContainerConfiguration |
getServiceContainerPreferences()
Returns the service container configuration object that provides strongly typed methods to retrieve the
server-side communications preferences as configured by the agent.
|
long |
getVMHealthCheckIntervalMsecs()
This defines how many milliseconds the agent should wait between each check that determines
if the VM is healthy or not (such as if the VM is critically low on memory).
|
float |
getVMHealthCheckLowHeapMemThreshold()
This defines when the VM health check will consider the heap memory to be critically low.
|
float |
getVMHealthCheckLowNonHeapMemThreshold()
This defines when the VM health check will consider the nonheap memory to be critically low.
|
long |
getWaitForServerAtStartupMsecs()
This defines how many milliseconds the agent should wait at startup for the RHQ Server to be detected.
|
boolean |
isAgentConfigurationSetup()
This returns
true if the agent has already been setup - meaning the user has properly configured the
agent with the appropriate preferences. |
boolean |
isAgentUpdateEnabled()
Returns
true if the agent is allowed to apply updates to itself. |
boolean |
isClientSenderCommandSpoolFileCompressed()
Returns the command spool file compression flag that, if true, indicates the data in the command spool file
should be compressed.
|
long[] |
isClientSenderCommandSpoolFileParamsValueValid(String pref_value)
Given a command spool file parameters value, will determine if its valid or not.
|
long[] |
isClientSenderQueueThrottlingValueValid(String pref_value)
Given a queue throttling parameters value, will determine if its valid or not.
|
boolean |
isClientSenderSecurityServerAuthMode()
Returns
true if the server authentication mode is enabled. |
long[] |
isClientSenderSendThrottlingValueValid(String pref_value)
Given a send throttling parameters value, will determine if its valid or not.
|
boolean |
isNativeSystemDisabled()
Returns
true if the native system should be disabled and not used by the agent or its plugin
container. |
boolean |
isRegisterWithServerAtStartupEnabled()
Returns
true if the agent should register itself with the RHQ Server when the agent starts up. |
boolean |
isServerAutoDetectionEnabled()
Returns the auto-detection flag that, if true, tells the agent to attempt to auto-detect the RHQ Server coming
online and going offline.
|
boolean |
isTestFailoverListAtStartupEnabled()
Returns
true if the agent should test connectivity to all servers in
its failover list. |
boolean |
isUpdatePluginsAtStartupEnabled()
Returns
true if the agent should update its plugins when the agent starts up. |
void |
setAgentConfigurationSetup(boolean flag)
Sets the flag to indicate if the agent configuration has already been setup or not.
|
void |
setAgentSecurityToken(String value)
Sets the agent's security token that was received from the server during agent registration.
|
void |
setServerLocatorUri(String transport,
String bindAddress,
int bindPort,
String transportParams)
Convienence method that sets the transport, bind address, bind port and transport parameters
for a new server endpoint.
|
void |
tagWithAgentConfigurationVersion()
This tags the existing preferences by setting the configuration schema version preference appropriately.
|
String |
toString() |
public AgentConfiguration(Preferences prefs)
prefs - the agent configuration preferencesIllegalArgumentException - if props is nullpublic static String buildServerLocatorUri(String transport, String bind_address, int bind_port, String transport_params)
full server URI but can be used to
any other caller if they happen to have those four pieces of data.transport - bind_address - bind_port - transport_params - public Preferences getPreferences()
public ServiceContainerConfiguration getServiceContainerPreferences()
public int getAgentConfigurationVersion()
public void tagWithAgentConfigurationVersion()
public boolean isAgentConfigurationSetup()
true if the agent has already been setup - meaning the user has properly configured the
agent with the appropriate preferences. This is done either through custom configuration file or the setup prompt
command.true if the agent configuration was already setup, false if it has not been
setuppublic void setAgentConfigurationSetup(boolean flag)
true means the
agent has already been setup with the user-provided configuration preference values. false means the
user has not setup the agent.flag - public String getAgentName()
null will be returned, which is
usually a bad condition. An agent should never be started unless it had an agent name defined.public String getServerTransport()
public String getServerBindAddress()
public int getServerBindPort()
public String getServerTransportParams()
public String getServerLocatorUri()
getServerTransport(), getServerBindAddress(), getServerBindPort(), and
getServerTransportParams().buildServerLocatorUri(String, String, int, String)public void setServerLocatorUri(String transport, String bindAddress, int bindPort, String transportParams)
transport - see getServerTransport()bindAddress - see getServerBindAddress()bindPort - see getServerBindPort()transportParams - see getServerTransportParams()public boolean isServerAutoDetectionEnabled()
true if the agent should listen for the server coming online and going offline;
false if the agent won't attempt to auto-discover the server (which means some other mechanism
must be used to know when the client command sender should start and stop sending messages)public boolean isRegisterWithServerAtStartupEnabled()
true if the agent should register itself with the RHQ Server when the agent starts up. If
false, the agent will not automatically attempt to register itself at startup - in which case the
agent will assume it is either already registered or it will get registered by some other mechanism.true if the agent should try to register itself when it starts uppublic long getWaitForServerAtStartupMsecs()
getClientCommandSenderConfiguration()public boolean isAgentUpdateEnabled()
true if the agent is allowed to apply updates to itself. This means that
the agent will be enabled to process agent update binaries, effectively upgrading the agent
to a newer version.true if the agent is allowed to update itselfpublic String getAgentUpdateVersionUrlIfDefined()
null if not definedpublic String getAgentUpdateVersionUrl()
If the URL is not defined, this will return a default URL that points to this agent's server.
If the server transport is secure, the URL returned
will be over "https", otherwise, it will go over "http". The
server address and server port
will be the same regardless of the security transport.
public String getAgentUpdateDownloadUrlIfDefined()
null if not definedpublic String getAgentUpdateDownloadUrl()
If the URL is not defined, this will return a default URL that points to this agent's server.
If the server transport is secure, the URL returned
will be over "https", otherwise, it will go over "http". The
server address and server port
will be the same regardless of the security transport.
public long getPrimaryServerSwitchoverCheckIntervalMsecs()
public long getVMHealthCheckIntervalMsecs()
public float getVMHealthCheckLowHeapMemThreshold()
public float getVMHealthCheckLowNonHeapMemThreshold()
public boolean isUpdatePluginsAtStartupEnabled()
true if the agent should update its plugins when the agent starts up. If false,
the agent will not automatically update the plugins and will use it current plugins. Note that the side effect of
this being true is that the agent will block waiting for at least one plugin to be available before
the plugin container starts. In other words, if this flag is true, a newly installed agent will not
fully complete its startup until it has downloaded its plugins.true if the agent should try to update its plugins at startuppublic boolean isTestFailoverListAtStartupEnabled()
true if the agent should test connectivity to all servers in
its failover list. Warning messages will be logged if one or more servers cannot be
connected to.true if the agent should try to test connectivity to all servers in the failover list.public File getDataDirectory()
Because this does alittle extra work, it may not be suitable to call if you just want to get the value of the
data directory or if you just want to know if its defined or not. In those instances, use
getDataDirectoryIfDefined() instead.
public String getDataDirectoryIfDefined()
null is returned.null if it is not definedgetDataDirectory()public boolean isNativeSystemDisabled()
true if the native system should be disabled and not used by the agent or its plugin
container. false means the agent/plugin container is allowed to load in and use the native
libraries.true if the native system should not be loaded or usedpublic int getClientSenderQueueSize()
getClientCommandSenderConfiguration()public int getClientSenderMaxConcurrent()
getClientCommandSenderConfiguration()public long getClientSenderCommandTimeout()
getClientCommandSenderConfiguration()public long getClientSenderServerPollingInterval()
getClientCommandSenderConfiguration()public long getClientSenderRetryInterval()
getClientCommandSenderConfiguration()public int getClientSenderMaxRetries()
getClientCommandSenderConfiguration()public String getClientSenderCommandSpoolFileName()
data directory). If this is not defined, null is returned to indicate
that commands should not be spooled to disk (thus implicitly disabling guaranteed delivery).null if it is not definedpublic long[] getClientSenderCommandSpoolFileParams()
PersistentFifo for the meanings of these
settings.
Because this is a weakly typed method (i.e. you have to know what the elements in the returned array
represent), it is recommended that you call getClientCommandSenderConfiguration() because it will return
all the configuration, including the spool file parameters, in a more strongly typed data object.
getClientCommandSenderConfiguration()public long[] isClientSenderCommandSpoolFileParamsValueValid(String pref_value)
null is returned.pref_value - the command spool file parameters valuenull if not validpublic boolean isClientSenderCommandSpoolFileCompressed()
true if the command spool file should compress its data; false means the data
should be stored in its uncompressed format.public long[] getClientSenderSendThrottling()
null if send throttling is to be disabled. The
first element of the array is the maximum number of commands that can be sent before the quiet period must start.
The second element is the length of time (in milliseconds) that each quiet period lasts. Once that time period
expires, commands can again be sent, up to the maximum (and the cycle repeats).
Because this is a weakly typed method (i.e. you have to know what the elements in the returned array
represent), it is recommended that you call getClientCommandSenderConfiguration() because it will return
all the configuration, including the throttling configuration, in a more strongly typed data object.
null if send throttling is disabledgetClientCommandSenderConfiguration()public long[] isClientSenderSendThrottlingValueValid(String pref_value)
null is returned. Note that if pref_value
is null, then null will be immediately returned.pref_value - the send throttling parameters valuenull if not valid or the preference value was
nullpublic long[] getClientSenderQueueThrottling()
null if queue throttling is to be disabled. The
first element of the array is the maximum number of commands that can be dequeued in a burst period before the
client sender must pause (i.e. cannot dequeue any more commands). The second element is the length of time (in
milliseconds) that each burst period lasts. Once that time period expires, commands can again be dequeued, up to
the maximum (and the cycle repeats).
Because this is a weakly typed method (i.e. you have to know what the elements in the returned array
represent), it is recommended that you call getClientCommandSenderConfiguration() because it will return
all the configuration, including the throttling configuration, in a more strongly typed data object.
null if queue throttling is disabledgetClientCommandSenderConfiguration()public long[] isClientSenderQueueThrottlingValueValid(String pref_value)
null is returned. Note that if pref_value
is null, then null will be immediately returned.pref_value - the queue throttling parameters valuenull if not valid or the preference value was
nullpublic String getClientSenderCommandPreprocessors()
null)public ClientCommandSenderConfiguration getClientCommandSenderConfiguration()
public String getClientSenderSecuritySocketProtocol()
public String getClientSenderSecurityKeystoreAlias()
public String getClientSenderSecurityKeystoreFile()
String as opposed to File since
some underlying remoting code may allow for this filepath to be relative to a jar inside the classloader.public String getClientSenderSecurityKeystoreAlgorithm()
public String getClientSenderSecurityKeystoreType()
public String getClientSenderSecurityKeystorePassword()
public String getClientSenderSecurityKeystoreKeyPassword()
keystore password.public String getClientSenderSecurityTruststoreFile()
String as opposed to File since
some underlying remoting code may allow for this filepath to be relative to a jar inside the classloader.public String getClientSenderSecurityTruststoreAlgorithm()
public String getClientSenderSecurityTruststoreType()
public String getClientSenderSecurityTruststorePassword()
public boolean isClientSenderSecurityServerAuthMode()
true if the server authentication mode is enabled. If this is enabled, it means when using
secure communications, the server certificate will be authenticated with the certificates found in the agent's
truststore. If this is false, the server does not have to authenticate itself with a trusted
certificate; the agent will trust any remote server (in other words, the secure communications repo will only
be used for encryption and not authentication).public PluginContainerConfiguration getPluginContainerConfiguration()
public String getAgentSecurityToken()
null, it means the agent has not yet been registered with the server.null)public void setAgentSecurityToken(String value)
null which removes the agent token; however, this does not mean the agent itself is no longer
registered with the server. The server will still maintain a registration for the agent.value - public boolean doNotEnableManagementServices()
true is returned, this will tell the agent it should not create its management services. In this
case, the agent cannot monitor itself, since the agent plugin will need these management MBean services.
This is usually used only during testing - not really of practical use.
public boolean doNotStartPluginContainerAtStartup()
true is returned, this will tell the agent it should not start the Plugin Container at startup.
In this case, the only way for the agent to start the plugin container would be with the plugin container prompt
command via the agent command line.
This is usually used only during testing - not really of practical use.
public boolean doNotNotifyServerOfShutdown()
true is returned, this will tell the agent it should not tell the server that the agent is
shutting down. In this case, the agent shutdown will be faster because it won't try to send a message to the
server, however, it will cause the server to not know of the agent's unavailability.
This is usually used only during testing - not really of practical use.
public boolean doNotOverridePreferencesWithSystemProperties()
true is returned, this will tell the agent it should not overlay system properties over the agent
configuration preferences. The default is that the agent will look at system properties and, if there is one that
is the same name as a preference, the system property will take effect and override the preference. If this is
true, system properties will be ignored and never override preferences.public boolean doNotInstallShutdownHook()
false) is that the agent will install a shutdown hook so it can detect
a VM shutdown request and be able to properly shut itself down.
However, if this returns true, it is assumed the agent itself is embedded in a container
and that container will ensure that it tells the agent to shut itself down at the proper time.true is returned, this will tell the agent it
should not install its own shutdown hook.public String toString()
toString in class ObjectObject.toString()Copyright © 2008-2014 Red Hat, Inc.. All Rights Reserved.