use of org.apache.tomcat.util.modeler.ManagedBean in project tomcat by apache.
the class MBeanUtils method destroyMBean.
/**
* Deregister the MBean for this
* <code>Role</code> object.
*
* @param role The Role to be managed
*
* @exception Exception if an MBean cannot be deregistered
*/
static void destroyMBean(Role role) throws Exception {
String mname = createManagedName(role);
ManagedBean managed = registry.findManagedBean(mname);
if (managed == null) {
return;
}
String domain = managed.getDomain();
if (domain == null)
domain = mserver.getDefaultDomain();
ObjectName oname = createObjectName(domain, role);
if (mserver.isRegistered(oname))
mserver.unregisterMBean(oname);
}
use of org.apache.tomcat.util.modeler.ManagedBean in project tomcat by apache.
the class MBeanUtils method createMBean.
/**
* Create, register, and return an MBean for this
* <code>ContextResourceLink</code> object.
*
* @param resourceLink The ContextResourceLink to be managed
* @return a new MBean
* @exception Exception if an MBean cannot be created or registered
*/
public static DynamicMBean createMBean(ContextResourceLink resourceLink) throws Exception {
String mname = createManagedName(resourceLink);
ManagedBean managed = registry.findManagedBean(mname);
if (managed == null) {
Exception e = new Exception("ManagedBean is not found with " + mname);
throw new MBeanException(e);
}
String domain = managed.getDomain();
if (domain == null)
domain = mserver.getDefaultDomain();
DynamicMBean mbean = managed.createMBean(resourceLink);
ObjectName oname = createObjectName(domain, resourceLink);
if (mserver.isRegistered(oname)) {
mserver.unregisterMBean(oname);
}
mserver.registerMBean(mbean, oname);
return (mbean);
}
use of org.apache.tomcat.util.modeler.ManagedBean in project tomcat by apache.
the class MBeanUtils method destroyMBean.
/**
* Deregister the MBean for this
* <code>User</code> object.
*
* @param user The User to be managed
*
* @exception Exception if an MBean cannot be deregistered
*/
static void destroyMBean(User user) throws Exception {
String mname = createManagedName(user);
ManagedBean managed = registry.findManagedBean(mname);
if (managed == null) {
return;
}
String domain = managed.getDomain();
if (domain == null)
domain = mserver.getDefaultDomain();
ObjectName oname = createObjectName(domain, user);
if (mserver.isRegistered(oname))
mserver.unregisterMBean(oname);
}
use of org.apache.tomcat.util.modeler.ManagedBean in project tomcat by apache.
the class MBeanUtils method createMBean.
/**
* Create, register, and return an MBean for this
* <code>User</code> object.
*
* @param user The User to be managed
* @return a new MBean
* @exception Exception if an MBean cannot be created or registered
*/
static DynamicMBean createMBean(User user) throws Exception {
String mname = createManagedName(user);
ManagedBean managed = registry.findManagedBean(mname);
if (managed == null) {
Exception e = new Exception("ManagedBean is not found with " + mname);
throw new MBeanException(e);
}
String domain = managed.getDomain();
if (domain == null)
domain = mserver.getDefaultDomain();
DynamicMBean mbean = managed.createMBean(user);
ObjectName oname = createObjectName(domain, user);
if (mserver.isRegistered(oname)) {
mserver.unregisterMBean(oname);
}
mserver.registerMBean(mbean, oname);
return (mbean);
}
use of org.apache.tomcat.util.modeler.ManagedBean in project tomcat by apache.
the class MBeanUtils method destroyMBean.
/**
* Deregister the MBean for this
* <code>ContextResource</code> object.
*
* @param resource The ContextResource to be managed
*
* @exception Exception if an MBean cannot be deregistered
*/
public static void destroyMBean(ContextResource resource) throws Exception {
// users and UserDatabase mbean
if ("org.apache.catalina.UserDatabase".equals(resource.getType())) {
destroyMBeanUserDatabase(resource.getName());
}
String mname = createManagedName(resource);
ManagedBean managed = registry.findManagedBean(mname);
if (managed == null) {
return;
}
String domain = managed.getDomain();
if (domain == null)
domain = mserver.getDefaultDomain();
ObjectName oname = createObjectName(domain, resource);
if (mserver.isRegistered(oname))
mserver.unregisterMBean(oname);
}
Aggregations