Package com.adaptris.core.jmx
Class JmxConnection
- java.lang.Object
-
- com.adaptris.core.AdaptrisConnectionImp
-
- com.adaptris.core.AllowsRetriesConnection
-
- com.adaptris.core.jmx.JmxConnection
-
- All Implemented Interfaces:
AdaptrisComponent
,AdaptrisConnection
,ComponentLifecycle
,ComponentLifecycleExtension
,StateManagedComponent
@ComponentProfile(summary="Connect to a JMX MBeanServer instance", tag="connections,jmx") public class JmxConnection extends AllowsRetriesConnection
-
-
Field Summary
-
Fields inherited from class com.adaptris.core.AdaptrisConnectionImp
log
-
-
Constructor Summary
Constructors Constructor Description JmxConnection()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected boolean
additionalDebug()
protected void
closeConnection()
Close the underlying connection.java.lang.Boolean
getAdditionalDebug()
KeyValuePairSet
getJmxProperties()
java.lang.String
getJmxServiceUrl()
java.lang.String
getPassword()
java.lang.String
getUsername()
protected void
initConnection()
Initialise the underlying connection.javax.management.MBeanServerConnection
mbeanServerConnection()
protected void
prepareConnection()
void
setAdditionalDebug(java.lang.Boolean b)
Whether or not to generate additional TRACE level debug when attempting connections.void
setJmxProperties(KeyValuePairSet s)
void
setJmxServiceUrl(java.lang.String s)
Set the JMX ServiceURL.void
setPassword(java.lang.String s)
Set the password.void
setUsername(java.lang.String s)
Set the username for accessing JMX.protected void
startConnection()
Start the underlying connection.protected void
stopConnection()
Stop the underlying connection.JmxConnection
withAdditionalDebug(java.lang.Boolean b)
JmxConnection
withJmxProperties(KeyValuePairSet kvps)
JmxConnection
withJmxServiceUrl(java.lang.String s)
JmxConnection
withPassword(java.lang.String s)
JmxConnection
withRetries(java.lang.Integer maxRetries, TimeInterval retryInterval)
JmxConnection
withUsername(java.lang.String s)
-
Methods inherited from class com.adaptris.core.AllowsRetriesConnection
connectionAttempts, connectionRetryInterval, createLoggingStatement, getConnectionAttempts, getConnectionRetryInterval, logWarning, setConnectionAttempts, setConnectionRetryInterval
-
Methods inherited from class com.adaptris.core.AdaptrisConnectionImp
addExceptionListener, addMessageConsumer, addMessageProducer, changeState, cloneForTesting, close, connectionErrorHandler, getConnectionErrorHandler, getUniqueId, getWorkersFirstOnShutdown, init, prepare, requestClose, requestInit, requestStart, requestStop, retrieveComponentState, retrieveConnection, retrieveExceptionListeners, retrieveMessageConsumers, retrieveMessageProducers, setConnectionErrorHandler, setUniqueId, setWorkersFirstOnShutdown, start, stop, workersFirstOnShutdown
-
-
-
-
Method Detail
-
prepareConnection
protected void prepareConnection() throws CoreException
- Specified by:
prepareConnection
in classAdaptrisConnectionImp
- Throws:
CoreException
-
initConnection
protected void initConnection() throws CoreException
Description copied from class:AdaptrisConnectionImp
Initialise the underlying connection.- Specified by:
initConnection
in classAdaptrisConnectionImp
- Throws:
CoreException
- wrapping any exception.
-
startConnection
protected void startConnection() throws CoreException
Description copied from class:AdaptrisConnectionImp
Start the underlying connection.- Specified by:
startConnection
in classAdaptrisConnectionImp
- Throws:
CoreException
- wrapping any exception.
-
stopConnection
protected void stopConnection()
Description copied from class:AdaptrisConnectionImp
Stop the underlying connection.- Specified by:
stopConnection
in classAdaptrisConnectionImp
-
closeConnection
protected void closeConnection()
Description copied from class:AdaptrisConnectionImp
Close the underlying connection.- Specified by:
closeConnection
in classAdaptrisConnectionImp
-
mbeanServerConnection
public javax.management.MBeanServerConnection mbeanServerConnection() throws CoreException
- Throws:
CoreException
-
getJmxServiceUrl
public java.lang.String getJmxServiceUrl()
- Returns:
- the jmxServiceUrl
-
setJmxServiceUrl
public void setJmxServiceUrl(java.lang.String s)
Set the JMX ServiceURL.- Parameters:
s
- the jmxServiceUrl to set; if not specified, then a local JMX connector is assumed.
-
getJmxProperties
public KeyValuePairSet getJmxProperties()
- Returns:
- the jmxProperties
-
setJmxProperties
public void setJmxProperties(KeyValuePairSet s)
- Parameters:
s
- the additional jmx properties to set
-
getUsername
public java.lang.String getUsername()
- Returns:
- the username
-
setUsername
public void setUsername(java.lang.String s)
Set the username for accessing JMX.If both the username / password are set, then a
jmx.remote.profiles="SASL/PLAIN"
is added to the environment if it doesn't already exist.- Parameters:
s
- the username to set
-
getPassword
public java.lang.String getPassword()
- Returns:
- the password
-
setPassword
public void setPassword(java.lang.String s)
Set the password.If both the username / password are set, then a
jmx.remote.profiles="SASL/PLAIN"
is added to the environment if it doesn't already exist.- Parameters:
s
- the password to set
-
getAdditionalDebug
public java.lang.Boolean getAdditionalDebug()
-
setAdditionalDebug
public void setAdditionalDebug(java.lang.Boolean b)
Whether or not to generate additional TRACE level debug when attempting connections.- Parameters:
b
- true to enable additional logging; default false.
-
additionalDebug
protected boolean additionalDebug()
-
withJmxServiceUrl
public JmxConnection withJmxServiceUrl(java.lang.String s)
-
withUsername
public JmxConnection withUsername(java.lang.String s)
-
withPassword
public JmxConnection withPassword(java.lang.String s)
-
withJmxProperties
public JmxConnection withJmxProperties(KeyValuePairSet kvps)
-
withAdditionalDebug
public JmxConnection withAdditionalDebug(java.lang.Boolean b)
-
withRetries
public JmxConnection withRetries(java.lang.Integer maxRetries, TimeInterval retryInterval)
-
-