Package org.apache.activemq.broker.jmx
Class ManagementContext
- java.lang.Object
-
- org.apache.activemq.broker.jmx.ManagementContext
-
-
Field Summary
Fields Modifier and Type Field Description static boolean
DEFAULT_CREATE_CONNECTOR
static String
DEFAULT_DOMAIN
Default activemq domainstatic String
DEFAULT_LOOKUP_NAME
Default registry lookup name
-
Constructor Summary
Constructors Constructor Description ManagementContext()
ManagementContext(MBeanServer server)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description ObjectName
createCustomComponentMBeanName(String type, String name)
Formulate and return the MBean ObjectName of a custom control MBeanprotected MBeanServer
createMBeanServer()
protected MBeanServer
findMBeanServer()
MBeanServer
findTigerMBeanServer()
Object
getAttribute(ObjectName name, String attribute)
String
getBrokerName()
Gets the broker name this context is used by, may be null if the broker name was not set.String
getConnectorHost()
Get the connectorHostString
getConnectorPath()
int
getConnectorPort()
Map<String,?>
getEnvironment()
String
getJmxDomainName()
MBeanServer
getMBeanServer()
Get the MBeanServerObjectInstance
getObjectInstance(ObjectName name)
int
getRmiServerPort()
String
getSuppressMBean()
static ObjectName
getSystemObjectName(String domainName, String containerName, Class<?> theClass)
Retrieve an System ObjectNameprotected boolean
isAllowedToRegister(ObjectName name)
boolean
isAllowRemoteAddressInMBeanNames()
boolean
isConnectorStarted()
boolean
isCreateConnector()
boolean
isCreateMBeanServer()
boolean
isFindTigerMbeanServer()
boolean
isUseMBeanServer()
Object
newProxyInstance(ObjectName objectName, Class<?> interfaceClass, boolean notificationBroadcaster)
Set<ObjectName>
queryNames(ObjectName name, QueryExp query)
ObjectInstance
registerMBean(Object bean, ObjectName name)
void
setAllowRemoteAddressInMBeanNames(boolean allowRemoteAddressInMBeanNames)
void
setBrokerName(String brokerName)
Sets the broker name this context is being used by.void
setConnectorHost(String connectorHost)
Set the connectorHostvoid
setConnectorPath(String connectorPath)
void
setConnectorPort(int connectorPort)
void
setCreateConnector(boolean createConnector)
void
setCreateMBeanServer(boolean enableJMX)
void
setEnvironment(Map<String,?> environment)
void
setFindTigerMbeanServer(boolean findTigerMbeanServer)
Enables/disables the searching for the Java 5 platform MBeanServervoid
setJmxDomainName(String jmxDomainName)
void
setMBeanServer(MBeanServer beanServer)
Set the MBeanServervoid
setRmiServerPort(int rmiServerPort)
void
setSuppressMBean(String commaListOfAttributeKeyValuePairs)
Allow selective MBeans registration to be suppressed.void
setUseMBeanServer(boolean useMBeanServer)
void
start()
void
stop()
void
unregisterMBean(ObjectName name)
Unregister an MBean
-
-
-
Field Detail
-
DEFAULT_DOMAIN
public static final String DEFAULT_DOMAIN
Default activemq domain- See Also:
- Constant Field Values
-
DEFAULT_LOOKUP_NAME
public static final String DEFAULT_LOOKUP_NAME
Default registry lookup name- See Also:
- Constant Field Values
-
DEFAULT_CREATE_CONNECTOR
public static final boolean DEFAULT_CREATE_CONNECTOR
-
-
Constructor Detail
-
ManagementContext
public ManagementContext()
-
ManagementContext
public ManagementContext(MBeanServer server)
-
-
Method Detail
-
start
public void start() throws Exception
-
getBrokerName
public String getBrokerName()
Gets the broker name this context is used by, may be null if the broker name was not set.
-
setBrokerName
public void setBrokerName(String brokerName)
Sets the broker name this context is being used by.
-
getJmxDomainName
public String getJmxDomainName()
- Returns:
- Returns the jmxDomainName.
-
setJmxDomainName
public void setJmxDomainName(String jmxDomainName)
- Parameters:
jmxDomainName
- The jmxDomainName to set.
-
getMBeanServer
public MBeanServer getMBeanServer()
Get the MBeanServer- Returns:
- the MBeanServer
-
setMBeanServer
public void setMBeanServer(MBeanServer beanServer)
Set the MBeanServer
-
isUseMBeanServer
public boolean isUseMBeanServer()
- Returns:
- Returns the useMBeanServer.
-
setUseMBeanServer
public void setUseMBeanServer(boolean useMBeanServer)
- Parameters:
useMBeanServer
- The useMBeanServer to set.
-
isCreateMBeanServer
public boolean isCreateMBeanServer()
- Returns:
- Returns the createMBeanServer flag.
-
setCreateMBeanServer
public void setCreateMBeanServer(boolean enableJMX)
- Parameters:
enableJMX
- Set createMBeanServer.
-
isFindTigerMbeanServer
public boolean isFindTigerMbeanServer()
-
isConnectorStarted
public boolean isConnectorStarted()
-
setFindTigerMbeanServer
public void setFindTigerMbeanServer(boolean findTigerMbeanServer)
Enables/disables the searching for the Java 5 platform MBeanServer
-
createCustomComponentMBeanName
public ObjectName createCustomComponentMBeanName(String type, String name)
Formulate and return the MBean ObjectName of a custom control MBean- Returns:
- the JMX ObjectName of the MBean, or
null
ifcustomName
is invalid.
-
getSystemObjectName
public static ObjectName getSystemObjectName(String domainName, String containerName, Class<?> theClass) throws MalformedObjectNameException, NullPointerException
Retrieve an System ObjectName
-
newProxyInstance
public Object newProxyInstance(ObjectName objectName, Class<?> interfaceClass, boolean notificationBroadcaster)
-
getAttribute
public Object getAttribute(ObjectName name, String attribute) throws Exception
- Throws:
Exception
-
registerMBean
public ObjectInstance registerMBean(Object bean, ObjectName name) throws Exception
- Throws:
Exception
-
isAllowedToRegister
protected boolean isAllowedToRegister(ObjectName name)
-
queryNames
public Set<ObjectName> queryNames(ObjectName name, QueryExp query) throws Exception
- Throws:
Exception
-
getObjectInstance
public ObjectInstance getObjectInstance(ObjectName name) throws InstanceNotFoundException
- Throws:
InstanceNotFoundException
-
unregisterMBean
public void unregisterMBean(ObjectName name) throws JMException
Unregister an MBean- Throws:
JMException
-
findMBeanServer
protected MBeanServer findMBeanServer()
-
findTigerMBeanServer
public MBeanServer findTigerMBeanServer()
-
createMBeanServer
protected MBeanServer createMBeanServer() throws MalformedObjectNameException, IOException
- Returns:
- an MBeanServer instance
- Throws:
MalformedObjectNameException
IOException
-
getConnectorPath
public String getConnectorPath()
-
setConnectorPath
public void setConnectorPath(String connectorPath)
-
getConnectorPort
public int getConnectorPort()
-
setConnectorPort
public void setConnectorPort(int connectorPort)
-
getRmiServerPort
public int getRmiServerPort()
-
setRmiServerPort
public void setRmiServerPort(int rmiServerPort)
-
isCreateConnector
public boolean isCreateConnector()
-
setCreateConnector
public void setCreateConnector(boolean createConnector)
-
getConnectorHost
public String getConnectorHost()
Get the connectorHost- Returns:
- the connectorHost
-
setConnectorHost
public void setConnectorHost(String connectorHost)
Set the connectorHost- Parameters:
connectorHost
- the connectorHost to set
-
isAllowRemoteAddressInMBeanNames
public boolean isAllowRemoteAddressInMBeanNames()
-
setAllowRemoteAddressInMBeanNames
public void setAllowRemoteAddressInMBeanNames(boolean allowRemoteAddressInMBeanNames)
-
setSuppressMBean
public void setSuppressMBean(String commaListOfAttributeKeyValuePairs)
Allow selective MBeans registration to be suppressed. Any Mbean ObjectName that matches any of the supplied attribute values will not be registered with the MBeanServer. eg: "endpoint=dynamicProducer,endpoint=Consumer" will suppress the registration of *all* dynamic producer and consumer mbeans.- Parameters:
commaListOfAttributeKeyValuePairs
- the comma separated list of attribute key=value pairs to match.
-
getSuppressMBean
public String getSuppressMBean()
-
-