Java 类javax.management.modelmbean.ModelMBean 实例源码

项目:lams    文件:MBeanExporter.java   
@Override
public void registerManagedResource(Object managedResource, ObjectName objectName) throws MBeanExportException {
    Assert.notNull(managedResource, "Managed resource must not be null");
    Assert.notNull(objectName, "ObjectName must not be null");
    try {
        if (isMBean(managedResource.getClass())) {
            doRegister(managedResource, objectName);
        }
        else {
            ModelMBean mbean = createAndConfigureMBean(managedResource, managedResource.getClass().getName());
            doRegister(mbean, objectName);
            injectNotificationPublisherIfNecessary(managedResource, mbean, objectName);
        }
    }
    catch (JMException ex) {
        throw new UnableToRegisterMBeanException(
                "Unable to register MBean [" + managedResource + "] with object name [" + objectName + "]", ex);
    }
}
项目:jerrydog    文件:MBeanUtils.java   
/**
 * Create, register, and return an MBean for this
 * <code>Connector</code> object.
 *
 * @param connector The Connector to be managed
 *
 * @exception Exception if an MBean cannot be created or registered
 */
public static ModelMBean createMBean(Connector connector)
    throws Exception {

    String mname = createManagedName(connector);
    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();
    ModelMBean mbean = managed.createMBean(connector);
    ObjectName oname = createObjectName(domain, connector);
    mserver.registerMBean(mbean, oname);
    return (mbean);

}
项目:jerrydog    文件:MBeanUtils.java   
/**
 * Create, register, and return an MBean for this
 * <code>Context</code> object.
 *
 * @param context The Context to be managed
 *
 * @exception Exception if an MBean cannot be created or registered
 */
public static ModelMBean createMBean(Context context)
    throws Exception {

    String mname = createManagedName(context);
    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();
    ModelMBean mbean = managed.createMBean(context);
    ObjectName oname = createObjectName(domain, context);
    mserver.registerMBean(mbean, oname);
    return (mbean);

}
项目:jerrydog    文件:MBeanUtils.java   
/**
 * 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 ModelMBean 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();
    ModelMBean mbean = managed.createMBean(environment);
    ObjectName oname = createObjectName(domain, environment);
    mserver.registerMBean(mbean, oname);
    return (mbean);

}
项目:jerrydog    文件:MBeanUtils.java   
/**
 * 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 ModelMBean 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();
    ModelMBean mbean = managed.createMBean(resource);
    ObjectName oname = createObjectName(domain, resource);
    mserver.registerMBean(mbean, oname);
    return (mbean);

}
项目:jerrydog    文件:MBeanUtils.java   
/**
 * 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 ModelMBean 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();
    ModelMBean mbean = managed.createMBean(resourceLink);
    ObjectName oname = createObjectName(domain, resourceLink);
    mserver.registerMBean(mbean, oname);
    return (mbean);

}
项目:jerrydog    文件:MBeanUtils.java   
/**
 * Create, register, and return an MBean for this
 * <code>DefaultContext</code> object.
 *
 * @param context The DefaultContext to be managed
 *
 * @exception Exception if an MBean cannot be created or registered
 */
public static ModelMBean createMBean(DefaultContext context)
    throws Exception {

    String mname = createManagedName(context);
    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();
    ModelMBean mbean = managed.createMBean(context);
    ObjectName oname = createObjectName(domain, context);
    mserver.registerMBean(mbean, oname);
    return (mbean);

}
项目:jerrydog    文件:MBeanUtils.java   
/**
 * Create, register, and return an MBean for this
 * <code>Engine</code> object.
 *
 * @param engine The Engine to be managed
 *
 * @exception Exception if an MBean cannot be created or registered
 */
public static ModelMBean createMBean(Engine engine)
    throws Exception {

    String mname = createManagedName(engine);
    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();
    ModelMBean mbean = managed.createMBean(engine);
    ObjectName oname = createObjectName(domain, engine);
    mserver.registerMBean(mbean, oname);
    return (mbean);

}
项目:jerrydog    文件:MBeanUtils.java   
/**
 * 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
 */
public static ModelMBean 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();
    ModelMBean mbean = managed.createMBean(group);
    ObjectName oname = createObjectName(domain, group);
    mserver.registerMBean(mbean, oname);
    return (mbean);

}
项目:jerrydog    文件:MBeanUtils.java   
/**
 * Create, register, and return an MBean for this
 * <code>Host</code> object.
 *
 * @param host The Host to be managed
 *
 * @exception Exception if an MBean cannot be created or registered
 */
public static ModelMBean createMBean(Host host)
    throws Exception {

    String mname = createManagedName(host);
    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();
    ModelMBean mbean = managed.createMBean(host);
    ObjectName oname = createObjectName(domain, host);
    mserver.registerMBean(mbean, oname);
    return (mbean);

}
项目:jerrydog    文件:MBeanUtils.java   
/**
 * 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
 */
public static ModelMBean 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();
    ModelMBean mbean = managed.createMBean(loader);
    ObjectName oname = createObjectName(domain, loader);
    mserver.registerMBean(mbean, oname);
    return (mbean);       
}
项目:jerrydog    文件:MBeanUtils.java   
/**
 * Create, register, and return an MBean for this
 * <code>Logger</code> object.
 *
 * @param logger The Logger to be managed
 *
 * @exception Exception if an MBean cannot be created or registered
 */
public static ModelMBean createMBean(Logger logger)
    throws Exception {

    String mname = createManagedName(logger);
    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();
    ModelMBean mbean = managed.createMBean(logger);
    ObjectName oname = createObjectName(domain, logger);
    mserver.registerMBean(mbean, oname);
    return (mbean);

}
项目:jerrydog    文件:MBeanUtils.java   
/**
 * Create, register, and return an MBean for this
 * <code>Manager</code> object.
 *
 * @param manager The Manager to be managed
 *
 * @exception Exception if an MBean cannot be created or registered
 */
public static ModelMBean createMBean(Manager manager)
    throws Exception {

    String mname = createManagedName(manager);
    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();
    ModelMBean mbean = managed.createMBean(manager);
    ObjectName oname = createObjectName(domain, manager);
    mserver.registerMBean(mbean, oname);
    return (mbean);

}
项目:jerrydog    文件:MBeanUtils.java   
/**
 * 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
 */
public static ModelMBean 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();
    ModelMBean mbean = managed.createMBean(factory);
    ObjectName oname = createObjectName(domain, factory);
    mserver.registerMBean(mbean, oname);
    return (mbean);

}
项目:jerrydog    文件:MBeanUtils.java   
/**
 * 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
 */
public static ModelMBean 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();
    ModelMBean mbean = managed.createMBean(resource);
    ObjectName oname = createObjectName(domain, resource);
    mserver.registerMBean(mbean, oname);
    return (mbean);

}
项目:jerrydog    文件:MBeanUtils.java   
/**
 * Create, register, and return an MBean for this
 * <code>Realm</code> object.
 *
 * @param realm The Realm to be managed
 *
 * @exception Exception if an MBean cannot be created or registered
 */
public static ModelMBean createMBean(Realm realm)
    throws Exception {

    String mname = createManagedName(realm);
    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();
    ModelMBean mbean = managed.createMBean(realm);
    ObjectName oname = createObjectName(domain, realm);
    mserver.registerMBean(mbean, oname);
    return (mbean);

}
项目:jerrydog    文件:MBeanUtils.java   
/**
 * 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
 */
public static ModelMBean 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();
    ModelMBean mbean = managed.createMBean(role);
    ObjectName oname = createObjectName(domain, role);
    mserver.registerMBean(mbean, oname);
    return (mbean);

}
项目:jerrydog    文件:MBeanUtils.java   
/**
 * Create, register, and return an MBean for this
 * <code>Server</code> object.
 *
 * @param server The Server to be managed
 *
 * @exception Exception if an MBean cannot be created or registered
 */
public static ModelMBean createMBean(Server server)
    throws Exception {

    String mname = createManagedName(server);
    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();
    ModelMBean mbean = managed.createMBean(server);
    ObjectName oname = createObjectName(domain, server);
    mserver.registerMBean(mbean, oname);
    return (mbean);

}
项目:jerrydog    文件:MBeanUtils.java   
/**
 * Create, register, and return an MBean for this
 * <code>Service</code> object.
 *
 * @param service The Service to be managed
 *
 * @exception Exception if an MBean cannot be created or registered
 */
public static ModelMBean createMBean(Service service)
    throws Exception {

    String mname = createManagedName(service);
    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();
    ModelMBean mbean = managed.createMBean(service);
    ObjectName oname = createObjectName(domain, service);
    mserver.registerMBean(mbean, oname);
    return (mbean);

}
项目:jerrydog    文件:MBeanUtils.java   
/**
 * 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
 */
public static ModelMBean 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();
    ModelMBean mbean = managed.createMBean(user);
    ObjectName oname = createObjectName(domain, user);
    mserver.registerMBean(mbean, oname);
    return (mbean);

}
项目:jerrydog    文件:MBeanUtils.java   
/**
 * 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
 */
public static ModelMBean 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();
    ModelMBean mbean = managed.createMBean(userDatabase);
    ObjectName oname = createObjectName(domain, userDatabase);
    mserver.registerMBean(mbean, oname);
    return (mbean);

}
项目:jerrydog    文件:MBeanUtils.java   
/**
 * Create, register, and return an MBean for this
 * <code>Valve</code> object.
 *
 * @param valve The Valve to be managed
 *
 * @exception Exception if an MBean cannot be created or registered
 */
public static ModelMBean createMBean(Valve valve)
    throws Exception {

    String mname = createManagedName(valve);
    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();
    ModelMBean mbean = managed.createMBean(valve);
    ObjectName oname = createObjectName(domain, valve);
    mserver.registerMBean(mbean, oname);
    return (mbean);

}
项目:spring4-understanding    文件:MBeanExporter.java   
@Override
public void registerManagedResource(Object managedResource, ObjectName objectName) throws MBeanExportException {
    Assert.notNull(managedResource, "Managed resource must not be null");
    Assert.notNull(objectName, "ObjectName must not be null");
    try {
        if (isMBean(managedResource.getClass())) {
            doRegister(managedResource, objectName);
        }
        else {
            ModelMBean mbean = createAndConfigureMBean(managedResource, managedResource.getClass().getName());
            doRegister(mbean, objectName);
            injectNotificationPublisherIfNecessary(managedResource, mbean, objectName);
        }
    }
    catch (JMException ex) {
        throw new UnableToRegisterMBeanException(
                "Unable to register MBean [" + managedResource + "] with object name [" + objectName + "]", ex);
    }
}
项目:my-spring-cache-redis    文件:MBeanExporter.java   
@Override
public void registerManagedResource(Object managedResource, ObjectName objectName) throws MBeanExportException {
    Assert.notNull(managedResource, "Managed resource must not be null");
    Assert.notNull(objectName, "ObjectName must not be null");
    try {
        if (isMBean(managedResource.getClass())) {
            doRegister(managedResource, objectName);
        }
        else {
            ModelMBean mbean = createAndConfigureMBean(managedResource, managedResource.getClass().getName());
            doRegister(mbean, objectName);
            injectNotificationPublisherIfNecessary(managedResource, mbean, objectName);
        }
    }
    catch (JMException ex) {
        throw new UnableToRegisterMBeanException(
                "Unable to register MBean [" + managedResource + "] with object name [" + objectName + "]", ex);
    }
}
项目:spring    文件:MBeanExporter.java   
@Override
public void registerManagedResource(Object managedResource, ObjectName objectName) throws MBeanExportException {
    Assert.notNull(managedResource, "Managed resource must not be null");
    Assert.notNull(objectName, "ObjectName must not be null");
    try {
        if (isMBean(managedResource.getClass())) {
            doRegister(managedResource, objectName);
        }
        else {
            ModelMBean mbean = createAndConfigureMBean(managedResource, managedResource.getClass().getName());
            doRegister(mbean, objectName);
            injectNotificationPublisherIfNecessary(managedResource, mbean, objectName);
        }
    }
    catch (JMException ex) {
        throw new UnableToRegisterMBeanException(
                "Unable to register MBean [" + managedResource + "] with object name [" + objectName + "]", ex);
    }
}
项目:flowable-engine    文件:DefaultManagementMBeanAssemblerTest.java   
@Test
public void testHappyPath() throws MalformedObjectNameException, JMException {
    TestMbean testMbean = new TestMbean();
    ModelMBean mbean = defaultManagementMBeanAssembler.assemble(testMbean, new ObjectName("org.flowable.jmx.Mbeans:type=something"));
    assertNotNull(mbean);
    assertNotNull(mbean.getMBeanInfo());
    assertNotNull(mbean.getMBeanInfo().getAttributes());
    MBeanAttributeInfo[] attributes = mbean.getMBeanInfo().getAttributes();
    assertEquals(2, attributes.length);
    assertTrue((attributes[0].getName().equals("TestAttributeString") && attributes[1].getName().equals("TestAttributeBoolean") || (attributes[1].getName().equals("TestAttributeString") && attributes[0]
            .getName().equals("TestAttributeBoolean"))));
    assertNotNull(mbean.getMBeanInfo().getOperations());
    MBeanOperationInfo[] operations = mbean.getMBeanInfo().getOperations();
    assertNotNull(operations);
    assertEquals(3, operations.length);

}
项目:GemFireLite    文件:TestAnnotations.java   
public static void main(String[] args)
{
  RemoteServiceStat rss = new RemoteServiceStat();
  ModelMBean mmb =  MBeanHelper.createModelMBean(rss);
  MBeanAttributeInfo[] attrs= mmb.getMBeanInfo().getAttributes();
  for(MBeanAttributeInfo inf:attrs)
  {
    String getMethodName = (String) inf.getDescriptor().getFieldValue("getMethod");
    try
    {
      Method m= rss.getClass().getMethod(getMethodName);
      AggregateAttribute aa= m.getAnnotation(AggregateAttribute.class);
      System.out.println(inf.getName()+" "+aa.value()+" "+inf.getType() );
    }
    catch (NoSuchMethodException | SecurityException e)
    {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }

  }
}
项目:class-guard    文件:MBeanExporter.java   
public void registerManagedResource(Object managedResource, ObjectName objectName) throws MBeanExportException {
    Assert.notNull(managedResource, "Managed resource must not be null");
    Assert.notNull(objectName, "ObjectName must not be null");
    try {
        if (isMBean(managedResource.getClass())) {
            doRegister(managedResource, objectName);
        }
        else {
            ModelMBean mbean = createAndConfigureMBean(managedResource, managedResource.getClass().getName());
            doRegister(mbean, objectName);
            injectNotificationPublisherIfNecessary(managedResource, mbean, objectName);
        }
    }
    catch (JMException ex) {
        throw new UnableToRegisterMBeanException(
                "Unable to register MBean [" + managedResource + "] with object name [" + objectName + "]", ex);
    }
}
项目:HowTomcatWorks    文件:MBeanUtils.java   
/**
 * Create, register, and return an MBean for this
 * <code>Connector</code> object.
 *
 * @param connector The Connector to be managed
 *
 * @exception Exception if an MBean cannot be created or registered
 */
public static ModelMBean createMBean(Connector connector)
    throws Exception {

    String mname = createManagedName(connector);
    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();
    ModelMBean mbean = managed.createMBean(connector);
    ObjectName oname = createObjectName(domain, connector);
    mserver.registerMBean(mbean, oname);
    return (mbean);

}
项目:HowTomcatWorks    文件:MBeanUtils.java   
/**
 * Create, register, and return an MBean for this
 * <code>Context</code> object.
 *
 * @param context The Context to be managed
 *
 * @exception Exception if an MBean cannot be created or registered
 */
public static ModelMBean createMBean(Context context)
    throws Exception {

    String mname = createManagedName(context);
    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();
    ModelMBean mbean = managed.createMBean(context);
    ObjectName oname = createObjectName(domain, context);
    mserver.registerMBean(mbean, oname);
    return (mbean);

}
项目:HowTomcatWorks    文件:MBeanUtils.java   
/**
 * 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 ModelMBean 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();
    ModelMBean mbean = managed.createMBean(environment);
    ObjectName oname = createObjectName(domain, environment);
    mserver.registerMBean(mbean, oname);
    return (mbean);

}
项目:HowTomcatWorks    文件:MBeanUtils.java   
/**
 * 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 ModelMBean 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();
    ModelMBean mbean = managed.createMBean(resource);
    ObjectName oname = createObjectName(domain, resource);
    mserver.registerMBean(mbean, oname);
    return (mbean);

}
项目:HowTomcatWorks    文件:MBeanUtils.java   
/**
 * 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 ModelMBean 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();
    ModelMBean mbean = managed.createMBean(resourceLink);
    ObjectName oname = createObjectName(domain, resourceLink);
    mserver.registerMBean(mbean, oname);
    return (mbean);

}
项目:HowTomcatWorks    文件:MBeanUtils.java   
/**
 * Create, register, and return an MBean for this
 * <code>DefaultContext</code> object.
 *
 * @param context The DefaultContext to be managed
 *
 * @exception Exception if an MBean cannot be created or registered
 */
public static ModelMBean createMBean(DefaultContext context)
    throws Exception {

    String mname = createManagedName(context);
    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();
    ModelMBean mbean = managed.createMBean(context);
    ObjectName oname = createObjectName(domain, context);
    mserver.registerMBean(mbean, oname);
    return (mbean);

}
项目:HowTomcatWorks    文件:MBeanUtils.java   
/**
 * Create, register, and return an MBean for this
 * <code>Engine</code> object.
 *
 * @param engine The Engine to be managed
 *
 * @exception Exception if an MBean cannot be created or registered
 */
public static ModelMBean createMBean(Engine engine)
    throws Exception {

    String mname = createManagedName(engine);
    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();
    ModelMBean mbean = managed.createMBean(engine);
    ObjectName oname = createObjectName(domain, engine);
    mserver.registerMBean(mbean, oname);
    return (mbean);

}
项目:HowTomcatWorks    文件:MBeanUtils.java   
/**
 * 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
 */
public static ModelMBean 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();
    ModelMBean mbean = managed.createMBean(group);
    ObjectName oname = createObjectName(domain, group);
    mserver.registerMBean(mbean, oname);
    return (mbean);

}
项目:HowTomcatWorks    文件:MBeanUtils.java   
/**
 * Create, register, and return an MBean for this
 * <code>Host</code> object.
 *
 * @param host The Host to be managed
 *
 * @exception Exception if an MBean cannot be created or registered
 */
public static ModelMBean createMBean(Host host)
    throws Exception {

    String mname = createManagedName(host);
    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();
    ModelMBean mbean = managed.createMBean(host);
    ObjectName oname = createObjectName(domain, host);
    mserver.registerMBean(mbean, oname);
    return (mbean);

}
项目:HowTomcatWorks    文件:MBeanUtils.java   
/**
 * 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
 */
public static ModelMBean 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();
    ModelMBean mbean = managed.createMBean(loader);
    ObjectName oname = createObjectName(domain, loader);
    mserver.registerMBean(mbean, oname);
    return (mbean);       
}
项目:HowTomcatWorks    文件:MBeanUtils.java   
/**
 * Create, register, and return an MBean for this
 * <code>Logger</code> object.
 *
 * @param logger The Logger to be managed
 *
 * @exception Exception if an MBean cannot be created or registered
 */
public static ModelMBean createMBean(Logger logger)
    throws Exception {

    String mname = createManagedName(logger);
    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();
    ModelMBean mbean = managed.createMBean(logger);
    ObjectName oname = createObjectName(domain, logger);
    mserver.registerMBean(mbean, oname);
    return (mbean);

}
项目:HowTomcatWorks    文件:MBeanUtils.java   
/**
 * Create, register, and return an MBean for this
 * <code>Manager</code> object.
 *
 * @param manager The Manager to be managed
 *
 * @exception Exception if an MBean cannot be created or registered
 */
public static ModelMBean createMBean(Manager manager)
    throws Exception {

    String mname = createManagedName(manager);
    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();
    ModelMBean mbean = managed.createMBean(manager);
    ObjectName oname = createObjectName(domain, manager);
    mserver.registerMBean(mbean, oname);
    return (mbean);

}