Java Code Examples for org.apache.tomcat.util.modeler.ManagedBean#createMBean()
The following examples show how to use
org.apache.tomcat.util.modeler.ManagedBean#createMBean() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MBeanUtils.java From tomcatsrc with Apache License 2.0 | 6 votes |
/** * Create, register, and return an MBean for this * <code>NamingResources</code> object. * * @param resource The NamingResources to be managed * * @exception Exception if an MBean cannot be created or registered * * @deprecated Unused. Will be removed in Tomcat 8.0.x */ @Deprecated static DynamicMBean createMBean(NamingResources resource) throws Exception { String mname = createManagedName(resource); 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(resource); ObjectName oname = createObjectName(domain, resource); if( mserver.isRegistered( oname )) { mserver.unregisterMBean(oname); } mserver.registerMBean(mbean, oname); return (mbean); }
Example 2
Source File: MBeanUtils.java From tomcatsrc with Apache License 2.0 | 6 votes |
/** * Create, register, and return an MBean for this * <code>UserDatabase</code> object. * * @param userDatabase The UserDatabase to be managed * * @exception Exception if an MBean cannot be created or registered */ static DynamicMBean createMBean(UserDatabase userDatabase) throws Exception { String mname = createManagedName(userDatabase); 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(userDatabase); ObjectName oname = createObjectName(domain, userDatabase); if( mserver.isRegistered( oname )) { mserver.unregisterMBean(oname); } mserver.registerMBean(mbean, oname); return (mbean); }
Example 3
Source File: MBeanUtils.java From tomcatsrc with Apache License 2.0 | 6 votes |
/** * Create, register, and return an MBean for this * <code>Role</code> object. * * @param role The Role to be managed * * @exception Exception if an MBean cannot be created or registered */ static DynamicMBean createMBean(Role role) throws Exception { String mname = createManagedName(role); 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(role); ObjectName oname = createObjectName(domain, role); if( mserver.isRegistered( oname )) { mserver.unregisterMBean(oname); } mserver.registerMBean(mbean, oname); return (mbean); }
Example 4
Source File: MBeanUtils.java From tomcatsrc with Apache License 2.0 | 6 votes |
/** * Create, register, and return an MBean for this * <code>User</code> object. * * @param user The User to be managed * * @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); }
Example 5
Source File: MBeanUtils.java From Tomcat7.0.67 with Apache License 2.0 | 6 votes |
/** * Create, register, and return an MBean for this * <code>NamingResources</code> object. * * @param resource The NamingResources to be managed * * @exception Exception if an MBean cannot be created or registered * * @deprecated Unused. Will be removed in Tomcat 8.0.x */ @Deprecated static DynamicMBean createMBean(NamingResources resource) throws Exception { String mname = createManagedName(resource); 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(resource); ObjectName oname = createObjectName(domain, resource); if( mserver.isRegistered( oname )) { mserver.unregisterMBean(oname); } mserver.registerMBean(mbean, oname); return (mbean); }
Example 6
Source File: MBeanUtils.java From Tomcat7.0.67 with Apache License 2.0 | 6 votes |
/** * Create, register, and return an MBean for this * <code>MBeanFactory</code> object. * * @param factory The MBeanFactory to be managed * * @exception Exception if an MBean cannot be created or registered * * @deprecated Unused. Will be removed in Tomcat 8.0.x */ @Deprecated static DynamicMBean createMBean(MBeanFactory factory) throws Exception { String mname = createManagedName(factory); 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(factory); ObjectName oname = createObjectName(domain, factory); if( mserver.isRegistered(oname )) { mserver.unregisterMBean(oname); } mserver.registerMBean(mbean, oname); return (mbean); }
Example 7
Source File: MBeanUtils.java From Tomcat7.0.67 with Apache License 2.0 | 6 votes |
/** * Create, register, and return an MBean for this * <code>Loader</code> object. * * @param loader The Loader to be managed * * @exception Exception if an MBean cannot be created or registered * * @deprecated Unused. Will be removed in Tomcat 8.0.x */ @Deprecated static DynamicMBean createMBean(Loader loader) throws Exception { String mname = createManagedName(loader); 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(loader); ObjectName oname = createObjectName(domain, loader); if( mserver.isRegistered( oname )) { // side effect: stop it mserver.unregisterMBean( oname ); } mserver.registerMBean(mbean, oname); return (mbean); }
Example 8
Source File: MBeanUtils.java From Tomcat7.0.67 with Apache License 2.0 | 6 votes |
/** * Create, register, and return an MBean for this * <code>Group</code> object. * * @param group The Group to be managed * * @exception Exception if an MBean cannot be created or registered */ static DynamicMBean createMBean(Group group) throws Exception { String mname = createManagedName(group); 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(group); ObjectName oname = createObjectName(domain, group); if( mserver.isRegistered( oname )) { mserver.unregisterMBean(oname); } mserver.registerMBean(mbean, oname); return (mbean); }
Example 9
Source File: MBeanUtils.java From Tomcat7.0.67 with Apache License 2.0 | 6 votes |
/** * Create, register, and return an MBean for this * <code>ContextResourceLink</code> object. * * @param resourceLink The ContextResourceLink to be managed * * @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); }
Example 10
Source File: MBeanUtils.java From Tomcat7.0.67 with Apache License 2.0 | 6 votes |
/** * Create, register, and return an MBean for this * <code>ContextResource</code> object. * * @param resource The ContextResource to be managed * * @exception Exception if an MBean cannot be created or registered */ public static DynamicMBean createMBean(ContextResource resource) throws Exception { String mname = createManagedName(resource); 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(resource); ObjectName oname = createObjectName(domain, resource); if( mserver.isRegistered( oname )) { mserver.unregisterMBean(oname); } mserver.registerMBean(mbean, oname); return (mbean); }
Example 11
Source File: MBeanUtils.java From Tomcat7.0.67 with Apache License 2.0 | 6 votes |
/** * Create, register, and return an MBean for this * <code>ContextEnvironment</code> object. * * @param environment The ContextEnvironment to be managed * * @exception Exception if an MBean cannot be created or registered */ public static DynamicMBean createMBean(ContextEnvironment environment) throws Exception { String mname = createManagedName(environment); 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(environment); ObjectName oname = createObjectName(domain, environment); if( mserver.isRegistered( oname )) { mserver.unregisterMBean(oname); } mserver.registerMBean(mbean, oname); return (mbean); }
Example 12
Source File: MBeanUtils.java From tomcatsrc with Apache License 2.0 | 6 votes |
/** * Create, register, and return an MBean for this * <code>MBeanFactory</code> object. * * @param factory The MBeanFactory to be managed * * @exception Exception if an MBean cannot be created or registered * * @deprecated Unused. Will be removed in Tomcat 8.0.x */ @Deprecated static DynamicMBean createMBean(MBeanFactory factory) throws Exception { String mname = createManagedName(factory); 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(factory); ObjectName oname = createObjectName(domain, factory); if( mserver.isRegistered(oname )) { mserver.unregisterMBean(oname); } mserver.registerMBean(mbean, oname); return (mbean); }
Example 13
Source File: MBeanUtils.java From tomcatsrc with Apache License 2.0 | 6 votes |
/** * Create, register, and return an MBean for this * <code>ContextResourceLink</code> object. * * @param resourceLink The ContextResourceLink to be managed * * @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); }
Example 14
Source File: MBeanUtils.java From Tomcat8-Source-Read with MIT License | 6 votes |
/** * 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; }
Example 15
Source File: MBeanUtils.java From Tomcat8-Source-Read with MIT License | 6 votes |
/** * Create, register, and return an MBean for this * <code>Role</code> object. * * @param role The Role to be managed * @return a new MBean * @exception Exception if an MBean cannot be created or registered */ static DynamicMBean createMBean(Role role) throws Exception { String mname = createManagedName(role); 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(role); ObjectName oname = createObjectName(domain, role); if( mserver.isRegistered( oname )) { mserver.unregisterMBean(oname); } mserver.registerMBean(mbean, oname); return mbean; }
Example 16
Source File: MBeanUtils.java From Tomcat8-Source-Read with MIT License | 6 votes |
/** * Create, register, and return an MBean for this * <code>Group</code> object. * * @param group The Group to be managed * @return a new MBean * @exception Exception if an MBean cannot be created or registered */ static DynamicMBean createMBean(Group group) throws Exception { String mname = createManagedName(group); 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(group); ObjectName oname = createObjectName(domain, group); if( mserver.isRegistered( oname )) { mserver.unregisterMBean(oname); } mserver.registerMBean(mbean, oname); return mbean; }
Example 17
Source File: MBeanUtils.java From Tomcat8-Source-Read with MIT License | 6 votes |
/** * 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; }
Example 18
Source File: MBeanUtils.java From Tomcat8-Source-Read with MIT License | 6 votes |
/** * Create, register, and return an MBean for this * <code>ContextEnvironment</code> object. * * @param environment The ContextEnvironment to be managed * @return a new MBean * @exception Exception if an MBean cannot be created or registered */ public static DynamicMBean createMBean(ContextEnvironment environment) throws Exception { String mname = createManagedName(environment); 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(environment); ObjectName oname = createObjectName(domain, environment); if( mserver.isRegistered( oname )) { mserver.unregisterMBean(oname); } mserver.registerMBean(mbean, oname); return mbean; }
Example 19
Source File: ClusterJmxHelper.java From Tomcat7.0.67 with Apache License 2.0 | 5 votes |
public static DynamicMBean getManagedBean(Object object) throws Exception { DynamicMBean mbean = null; if (getRegistry() != null) { ManagedBean managedBean = registry.findManagedBean(object.getClass().getName()); mbean = managedBean.createMBean(object); } return mbean; }
Example 20
Source File: ClusterJmxHelper.java From tomcatsrc with Apache License 2.0 | 5 votes |
public static DynamicMBean getManagedBean(Object object) throws Exception { DynamicMBean mbean = null; if (getRegistry() != null) { ManagedBean managedBean = registry.findManagedBean(object.getClass().getName()); mbean = managedBean.createMBean(object); } return mbean; }