public class DefaultManagementAgent extends ServiceSupport implements ManagementAgent, CamelContextAware
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_CONNECTION_PORT |
static String |
DEFAULT_DOMAIN |
static String |
DEFAULT_HOST |
static int |
DEFAULT_REGISTRY_PORT |
static String |
DEFAULT_SERVICE_URL_PATH |
shutdown, shuttingdown, started, starting, stopped, stopping, suspended, suspending
Constructor and Description |
---|
DefaultManagementAgent() |
DefaultManagementAgent(CamelContext camelContext) |
Modifier and Type | Method and Description |
---|---|
protected void |
createJmxConnector(String host) |
protected void |
createMBeanServer() |
protected void |
doStart()
Implementations override this method to support customized start/stop.
|
protected void |
doStop()
Implementations override this method to support customized start/stop.
|
protected void |
finalizeSettings() |
protected MBeanServer |
findOrCreateMBeanServer() |
CamelContext |
getCamelContext()
Get the
CamelContext |
Integer |
getConnectorPort()
Gets the port clients must use to connect
|
Boolean |
getCreateConnector()
Whether connector is created, allowing clients to connect remotely
|
Boolean |
getMask()
Whether to remove detected sensitive information (such as passwords) from MBean names and attributes.
|
String |
getMBeanObjectDomainName()
Get domain name for Camel MBeans.
|
MBeanServer |
getMBeanServer()
Get the MBeanServer which hosts managed objects.
|
String |
getMBeanServerDefaultDomain()
Gets the default domain on the MBean server
|
Boolean |
getOnlyRegisterProcessorWithCustomId()
Whether to only register processors which has a custom id assigned.
|
Boolean |
getRegisterAlways()
Whether to always register mbeans.
|
Boolean |
getRegisterNewRoutes()
Whether to register mbeans when starting a new route
This option is default true.
|
Integer |
getRegistryPort()
Gets the port used by
LocateRegistry . |
String |
getServiceUrlPath()
Gets the service url
|
Boolean |
getUsePlatformMBeanServer()
Whether to use the platform MBean Server.
|
boolean |
isRegistered(ObjectName name)
Is the given object registered
|
void |
register(Object obj,
ObjectName name)
Registers object with management infrastructure with a specific name.
|
void |
register(Object obj,
ObjectName name,
boolean forceRegistration)
Registers object with management infrastructure with a specific name.
|
void |
setCamelContext(CamelContext camelContext)
Injects the
CamelContext |
void |
setConnectorPort(Integer port)
Sets the port clients must use to connect
|
void |
setCreateConnector(Boolean flag)
Whether connector should be created, allowing clients to connect remotely
|
void |
setMask(Boolean mask)
Whether to remove detected sensitive information (such as passwords) from MBean names and attributes.
|
void |
setMBeanObjectDomainName(String domainName)
Sets the object domain name
|
void |
setMBeanServer(MBeanServer mbeanServer)
Sets a custom mbean server to use
|
void |
setMBeanServerDefaultDomain(String domain)
Sets the default domain on the MBean server
|
void |
setOnlyRegisterProcessorWithCustomId(Boolean onlyRegisterProcessorWithCustomId)
Whether to only register processors which has a custom id assigned.
|
void |
setRegisterAlways(Boolean registerAlways)
Whether to always register mbeans.
|
void |
setRegisterNewRoutes(Boolean registerNewRoutes)
Whether to register mbeans when starting a new route
This option is default true.
|
void |
setRegistryPort(Integer port)
Sets the port used by
LocateRegistry . |
void |
setServiceUrlPath(String url)
Sets the service url
|
void |
setUsePlatformMBeanServer(Boolean flag)
Whether to use the platform MBean Server.
|
void |
unregister(ObjectName name)
Unregisters object based upon registered name
|
doResume, doShutdown, doSuspend, getStatus, getVersion, isRunAllowed, isStarted, isStarting, isStopped, isStopping, isStoppingOrStopped, isSuspended, isSuspending, resume, shutdown, start, stop, suspend
public static final String DEFAULT_DOMAIN
public static final String DEFAULT_HOST
public static final int DEFAULT_REGISTRY_PORT
public static final int DEFAULT_CONNECTION_PORT
public static final String DEFAULT_SERVICE_URL_PATH
public DefaultManagementAgent()
public DefaultManagementAgent(CamelContext camelContext)
protected void finalizeSettings()
public void setRegistryPort(Integer port)
ManagementAgent
LocateRegistry
.setRegistryPort
in interface ManagementAgent
port
- the portpublic Integer getRegistryPort()
ManagementAgent
LocateRegistry
.getRegistryPort
in interface ManagementAgent
public void setConnectorPort(Integer port)
ManagementAgent
setConnectorPort
in interface ManagementAgent
port
- the portpublic Integer getConnectorPort()
ManagementAgent
getConnectorPort
in interface ManagementAgent
public void setMBeanServerDefaultDomain(String domain)
ManagementAgent
setMBeanServerDefaultDomain
in interface ManagementAgent
domain
- the domainpublic String getMBeanServerDefaultDomain()
ManagementAgent
getMBeanServerDefaultDomain
in interface ManagementAgent
public void setMBeanObjectDomainName(String domainName)
ManagementAgent
setMBeanObjectDomainName
in interface ManagementAgent
domainName
- the object domain namepublic String getMBeanObjectDomainName()
ManagementAgent
getMBeanObjectDomainName
in interface ManagementAgent
public void setServiceUrlPath(String url)
ManagementAgent
setServiceUrlPath
in interface ManagementAgent
url
- the service urlpublic String getServiceUrlPath()
ManagementAgent
getServiceUrlPath
in interface ManagementAgent
public void setCreateConnector(Boolean flag)
ManagementAgent
setCreateConnector
in interface ManagementAgent
flag
- true to create connectorpublic Boolean getCreateConnector()
ManagementAgent
getCreateConnector
in interface ManagementAgent
public void setUsePlatformMBeanServer(Boolean flag)
ManagementAgent
setUsePlatformMBeanServer
in interface ManagementAgent
flag
- true to use platform MBean serverpublic Boolean getUsePlatformMBeanServer()
ManagementAgent
getUsePlatformMBeanServer
in interface ManagementAgent
public Boolean getOnlyRegisterProcessorWithCustomId()
ManagementAgent
getOnlyRegisterProcessorWithCustomId
in interface ManagementAgent
public void setOnlyRegisterProcessorWithCustomId(Boolean onlyRegisterProcessorWithCustomId)
ManagementAgent
setOnlyRegisterProcessorWithCustomId
in interface ManagementAgent
onlyRegisterProcessorWithCustomId
- true to only register if custom id has been assignedpublic void setMBeanServer(MBeanServer mbeanServer)
ManagementAgent
setMBeanServer
in interface ManagementAgent
mbeanServer
- the custom mbean serverpublic MBeanServer getMBeanServer()
ManagementAgent
getMBeanServer
in interface ManagementAgent
public Boolean getRegisterAlways()
ManagementAgent
getRegisterAlways
in interface ManagementAgent
public void setRegisterAlways(Boolean registerAlways)
ManagementAgent
setRegisterAlways
in interface ManagementAgent
registerAlways
- true to always registerpublic Boolean getRegisterNewRoutes()
ManagementAgent
getRegisterNewRoutes
in interface ManagementAgent
public void setRegisterNewRoutes(Boolean registerNewRoutes)
ManagementAgent
setRegisterNewRoutes
in interface ManagementAgent
registerNewRoutes
- true to register when starting a new routepublic Boolean getMask()
ManagementAgent
getMask
in interface ManagementAgent
public void setMask(Boolean mask)
ManagementAgent
setMask
in interface ManagementAgent
public CamelContext getCamelContext()
CamelContextAware
CamelContext
getCamelContext
in interface CamelContextAware
public void setCamelContext(CamelContext camelContext)
CamelContextAware
CamelContext
setCamelContext
in interface CamelContextAware
camelContext
- the Camel contextpublic void register(Object obj, ObjectName name) throws JMException
ManagementAgent
register
in interface ManagementAgent
obj
- the object to registername
- the nameJMException
- is thrown if the registration failedpublic void register(Object obj, ObjectName name, boolean forceRegistration) throws JMException
ManagementAgent
register
in interface ManagementAgent
obj
- the object to registername
- the nameforceRegistration
- if set to true, then object will be registered despite
existing object is already registered with the name.JMException
- is thrown if the registration failedpublic void unregister(ObjectName name) throws JMException
ManagementAgent
unregister
in interface ManagementAgent
name
- the nameJMException
- is thrown if the unregistration failedpublic boolean isRegistered(ObjectName name)
ManagementAgent
isRegistered
in interface ManagementAgent
name
- the nameprotected void doStart() throws Exception
ServiceSupport
ServiceSupport.doStop()
for more details.doStart
in class ServiceSupport
Exception
ServiceSupport.doStop()
protected void doStop() throws Exception
ServiceSupport
ServiceSupport.doStop()
method when
the service is being stopped. This method will also be invoked
if the service is still in uninitialized state (eg has not
been started). The method is always called to allow the service
to do custom logic when the service is being stopped, such as when
CamelContext
is shutting down.doStop
in class ServiceSupport
Exception
ServiceSupport.doStart()
protected void createMBeanServer()
protected MBeanServer findOrCreateMBeanServer()
protected void createJmxConnector(String host) throws IOException
IOException
Apache Camel