org.rhq.enterprise.communications
Class ServiceContainerConfiguration

java.lang.Object
  extended by org.rhq.enterprise.communications.ServiceContainerConfiguration

public class ServiceContainerConfiguration
extends Object

Just provides some convienence methods to extract the service container configuration properties. These are remoting server configuration properties that are common on both the RHQ Server and RHQ Agent used to configure the communications services.

Author:
John Mazzitelli

Constructor Summary
ServiceContainerConfiguration(Preferences prefs)
          Wraps a preferences object in this instance.
 
Method Summary
 CommandAuthenticator getCommandAuthenticator()
          Returns an implementation of the configured CommandAuthenticator that should be used to authenticate incoming commands.
 String getConnectorBindAddress()
          Returns the connector's bind address.
 int getConnectorBindPort()
          Returns the connector's bind port.
 long getConnectorLeasePeriod()
          Returns the connector's lease period, in milliseconds.
 String getConnectorRemoteEndpoint()
          This is a convienence method that builds a full remote endpoint string that combines getConnectorTransport(), getConnectorBindAddress(), getConnectorBindPort(), getConnectorTransportParams() and getConnectorRHQType().
 String getConnectorRHQType()
          Returns the connector's RHQ type (indicating if the remoting server resides in the RHQ Server or RHQ Agent).
 String getConnectorSecurityClientAuthMode()
          Returns the client authentication mode.
 String getConnectorSecurityKeystoreAlgorithm()
          Returns the algorithm used to manage the keys in the keystore.
 String getConnectorSecurityKeystoreAlias()
          Returns the key alias of the key in the keystore.
 String getConnectorSecurityKeystoreFile()
          Returns the path to the keystore file.
 String getConnectorSecurityKeystoreKeyPassword()
          Returns the password to gain access to the key in the keystore.
 String getConnectorSecurityKeystorePassword()
          Returns the password to the keystore file itself.
 String getConnectorSecurityKeystoreType()
          Returns the type of keystore.
 String getConnectorSecuritySocketProtocol()
          Returns the protocol used over the secure socket.
 String getConnectorSecurityTruststoreAlgorithm()
          Returns the algorithm used to manage the keys in the truststore.
 String getConnectorSecurityTruststoreFile()
          Returns the path to the truststore file.
 String getConnectorSecurityTruststorePassword()
          Returns the password of the truststore file itself.
 String getConnectorSecurityTruststoreType()
          Returns the type of the truststore file.
 String getConnectorTransport()
          Returns the connector's transport type (socket, http, etc).
 String getConnectorTransportParams()
          Returns the connector's transport parameters which are used to further customize the connector and its transport subsystem.
 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.
 int getGlobalConcurrencyLimit()
          Returns the global concurrency limit on the number of commands that are allowed to be received concurrently (i.e.
 String getMBeanServerName()
          Returns the name of the MBeanServer that will be created to house all the services.
 String getMulticastDetectorBindAddress()
          Returns the multicast detector's bind address which is what the network interface binds to.
 long getMulticastDetectorDefaultTimeDelay()
          Returns the multicast detector's default time delay.
 long getMulticastDetectorHeartbeatTimeDelay()
          Returns the multicast detector's heartbeat time delay.
 String getMulticastDetectorMulticastAddress()
          Returns the multicast detector's multicast address used for network registry messages (servers coming and going).
 int getMulticastDetectorPort()
          Returns the multicast detector's port.
 Preferences getPreferences()
          Returns the raw preferences containing the service container configuration.
 long getRemoteStreamMaxIdleTime()
          Returns the maximum amount of milliseconds a remote output or input stream server-side component hosted in a RemoteOutputStreamCommandService or RemoteInputStreamCommandService is allowed to be idle before it is automatically closed and removed.
 int getServiceContainerConfigurationVersion()
          Returns the version of the configuration schema.
 String getStartupCommandServices()
          Returns the command services that are to be automatically deployed when the services are started up.
 String getStartupRemotePojos()
          Returns the definitions of the POJOs that are to be automatically deployed as remote services at start up.
 boolean isCommandServiceDirectoryDynamicDiscoveryEnabled()
          Returns the flag to indicate if the command service directory has been enabled to perform dynamic discovery of new command services that are added to (or old services removed from) the system after the initial startup discovery.
 boolean isCommunicationsDisabled()
          Returns true if the communication services should be disabled, false if they should be created normally.
 boolean isMulticastDetectorEnabled()
          Returns the flag to indicate if the multicast detector should be enabled or not.
 void tagWithServiceContainerConfigurationVersion()
          This tags the existing preferences by setting the configuration schema version preference appropriately.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ServiceContainerConfiguration

public ServiceContainerConfiguration(Preferences prefs)
Wraps a preferences object in this instance.

Parameters:
prefs - the service container configuration preferences
Throws:
IllegalArgumentException - if prefs is null
Method Detail

getPreferences

public Preferences getPreferences()
Returns the raw preferences containing the service container configuration.

Returns:
the configuration preferences

getServiceContainerConfigurationVersion

public int getServiceContainerConfigurationVersion()
Returns the version of the configuration schema.

Returns:
configuration version; if the configuration isn't versioned, 0 is returned

tagWithServiceContainerConfigurationVersion

public void tagWithServiceContainerConfigurationVersion()
This tags the existing preferences by setting the configuration schema version preference appropriately.


getGlobalConcurrencyLimit

public int getGlobalConcurrencyLimit()
Returns the global concurrency limit on the number of commands that are allowed to be received concurrently (i.e. the counting semaphore name as known to the ConcurrencyManager).

If this returns a value of 0 or less, there will be no global limit on the number of messages that can be received and processed concurrently.

Returns:
the global concurrency limit value

getMBeanServerName

public String getMBeanServerName()
Returns the name of the MBeanServer that will be created to house all the services. This is actually the default domain name of the MBeanServer. If an MBeanServer already exists and is registered with this default domain name, it will be used to house the communications services. If the MBeanServer name does not exist in the configuration, null will be returned, which indicates that the JVM's platform MBeanServer should be used.

Returns:
the MBeanServer name

isCommunicationsDisabled

public boolean isCommunicationsDisabled()
Returns true if the communication services should be disabled, false if they should be created normally. It is rare that you would want to configure this setting to be true.

Returns:
the flag to indicate if communications should be disabled

getDataDirectory

public File getDataDirectory()
Returns the data directory where all internally persisted data can be written to. If the data directory does not exist, it will be created.

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.

Returns:
the data directory

getDataDirectoryIfDefined

public String getDataDirectoryIfDefined()
This will return the data directory string as found in the preferences. If the data directory is not defined in the preferences, null is returned.

Returns:
the data directory string as defined in the preferences or null if it is not defined
See Also:
getDataDirectory()

isMulticastDetectorEnabled

public boolean isMulticastDetectorEnabled()
Returns the flag to indicate if the multicast detector should be enabled or not.

Returns:
the multicast detector enable flag (true means the detector should be enabled)

getMulticastDetectorMulticastAddress

public String getMulticastDetectorMulticastAddress()
Returns the multicast detector's multicast address used for network registry messages (servers coming and going). This is the IP of the multicast group that the detector will join.

Returns:
the multicast detector multicast address (null if not set in the preferences)

getMulticastDetectorBindAddress

public String getMulticastDetectorBindAddress()
Returns the multicast detector's bind address which is what the network interface binds to.

Returns:
the multicast detector bind address (null if not set in the preferences)

getMulticastDetectorDefaultTimeDelay

public long getMulticastDetectorDefaultTimeDelay()
Returns the multicast detector's default time delay. This is the amount of time, in milliseconds, which can elapse without receiving a detection event before suspecting that a server is dead and performing an explicit invocation on it to verify it is alive. If this invocation, or ping, fails, the server will be removed from the network registry. This should be greater than getMulticastDetectorHeartbeatTimeDelay().

Returns:
the multicast detector default time delay (Long.MIN_VALUE if not set in the preferences)

getMulticastDetectorHeartbeatTimeDelay

public long getMulticastDetectorHeartbeatTimeDelay()
Returns the multicast detector's heartbeat time delay. This is the amount of time to wait between sending (and sometimes receiving) detection messages. This should be less than getMulticastDetectorDefaultTimeDelay() .

Returns:
the multicast detector heartbeat time delay (Long.MIN_VALUE if not set in the preferences)

getMulticastDetectorPort

public int getMulticastDetectorPort()
Returns the multicast detector's port.

Returns:
the multicast detector port (Integer.MIN_VALUE if not set in the preferences)

getConnectorRHQType

public String getConnectorRHQType()
Returns the connector's RHQ type (indicating if the remoting server resides in the RHQ Server or RHQ Agent).

Returns:
the RHQ type

getConnectorTransport

public String getConnectorTransport()
Returns the connector's transport type (socket, http, etc).

Returns:
the connector transport type

getConnectorBindAddress

public String getConnectorBindAddress()
Returns the connector's bind address.

Returns:
the connector bind address

getConnectorBindPort

public int getConnectorBindPort()
Returns the connector's bind port.

Returns:
the connector's bind port

getConnectorTransportParams

public String getConnectorTransportParams()
Returns the connector's transport parameters which are used to further customize the connector and its transport subsystem.

Returns:
the connector transport parameters

getConnectorRemoteEndpoint

public String getConnectorRemoteEndpoint()
This is a convienence method that builds a full remote endpoint string that combines getConnectorTransport(), getConnectorBindAddress(), getConnectorBindPort(), getConnectorTransportParams() and getConnectorRHQType().

Returns:
a remote endpoint string that can be used by remote clients to connect to the connector.

getConnectorLeasePeriod

public long getConnectorLeasePeriod()
Returns the connector's lease period, in milliseconds. When this period is greater than 0, it enables the capability for the connector to detect when a client is no longer available. This is done by estabilishing a lease with the remoting clients.

Returns:
the connector's lease period (Long.MIN_VALUE if not set in the preferences)

getConnectorSecuritySocketProtocol

public String getConnectorSecuritySocketProtocol()
Returns the protocol used over the secure socket.

Returns:
protocol name

getConnectorSecurityClientAuthMode

public String getConnectorSecurityClientAuthMode()
Returns the client authentication mode. It is either:} The default is SSLSocketBuilder.CLIENT_AUTH_MODE_NONE - that will be returned if the client auth mode was not found in the configuration. Note: To support Tomcat syntax, the client authentication mode value is allowed to be "true" or "false". "true" maps to SSLSocketBuilder.CLIENT_AUTH_MODE_NEED, "false" maps to SSLSocketBuilder.CLIENT_AUTH_MODE_NONE.

Returns:
the client authentication mode

getConnectorSecurityKeystoreFile

public String getConnectorSecurityKeystoreFile()
Returns the path to the keystore file. This returns a String as opposed to File since some underlying remoting code may allow for this filepath to be relative to a jar inside the classloader.

Returns:
keystore file path

getConnectorSecurityKeystoreAlgorithm

public String getConnectorSecurityKeystoreAlgorithm()
Returns the algorithm used to manage the keys in the keystore.

Returns:
key manager algorithm

getConnectorSecurityKeystoreType

public String getConnectorSecurityKeystoreType()
Returns the type of keystore.

Returns:
keystore type

getConnectorSecurityKeystorePassword

public String getConnectorSecurityKeystorePassword()
Returns the password to the keystore file itself.

Returns:
keystore password

getConnectorSecurityKeystoreKeyPassword

public String getConnectorSecurityKeystoreKeyPassword()
Returns the password to gain access to the key in the keystore. If no key password is configured, this returns the keystore password.

Returns:
password to the key

getConnectorSecurityKeystoreAlias

public String getConnectorSecurityKeystoreAlias()
Returns the key alias of the key in the keystore.

Returns:
key alias name

getConnectorSecurityTruststoreFile

public String getConnectorSecurityTruststoreFile()
Returns the path to the truststore file. This returns a String as opposed to File since some underlying remoting code may allow for this filepath to be relative to a jar inside the classloader.

Returns:
truststore file path

getConnectorSecurityTruststoreAlgorithm

public String getConnectorSecurityTruststoreAlgorithm()
Returns the algorithm used to manage the keys in the truststore.

Returns:
algorithm name

getConnectorSecurityTruststoreType

public String getConnectorSecurityTruststoreType()
Returns the type of the truststore file.

Returns:
truststore file type

getConnectorSecurityTruststorePassword

public String getConnectorSecurityTruststorePassword()
Returns the password of the truststore file itself.

Returns:
truststore file password

getStartupCommandServices

public String getStartupCommandServices()
Returns the command services that are to be automatically deployed when the services are started up.

Returns:
the set of command services to be automatically deployed at startup

getStartupRemotePojos

public String getStartupRemotePojos()
Returns the definitions of the POJOs that are to be automatically deployed as remote services at start up.

Returns:
the set of POJOs to remote at startup

getRemoteStreamMaxIdleTime

public long getRemoteStreamMaxIdleTime()
Returns the maximum amount of milliseconds a remote output or input stream server-side component hosted in a RemoteOutputStreamCommandService or RemoteInputStreamCommandService is allowed to be idle before it is automatically closed and removed. This means that a client must attempt to access the remote stream every X milliseconds (where X is the value this method returns) or that stream will no longer be available. Note that this does not mean a client must read/write the entire stream in this amount of time, it only means a client must make a request on the stream every X milliseconds (be it to read or write a byte, mark it, see how many bytes are available, etc).

Returns:
the max idle time in milliseconds

isCommandServiceDirectoryDynamicDiscoveryEnabled

public boolean isCommandServiceDirectoryDynamicDiscoveryEnabled()
Returns the flag to indicate if the command service directory has been enabled to perform dynamic discovery of new command services that are added to (or old services removed from) the system after the initial startup discovery.

Returns:
true if dynamic discovery of command services is enabled; false if the initial set of getStartupCommandServices() are the only ones that will be enabled during the lifetime of the service container

getCommandAuthenticator

public CommandAuthenticator getCommandAuthenticator()
                                             throws Exception
Returns an implementation of the configured CommandAuthenticator that should be used to authenticate incoming commands.

Returns:
command authenticator object instance or null if no authenticator is configured
Throws:
Exception - if failed to instantiate the configured class name

toString

public String toString()
Overrides:
toString in class Object
See Also:
Object.toString()


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