Package javax.management.modelmbean

Examples of javax.management.modelmbean.ModelMBean


            if (objMBean instanceof ConnectorSupport) {
                Method method = cls.getMethod("initialize", new Class[] {Map.class});
                Map props = config.getParamValues();
                method.invoke(objMBean, new Object[] {props});
            }
            ModelMBean mm = managed.createMBean(objMBean);

            String beanObjName = domain + ":name=" + mbeans[i];
            server.registerMBean(mm, new ObjectName(beanObjName));
        }
View Full Code Here


     * @param o The object to create an MBean for
     * @return The ModelMBean for the given object
     */
    public static ModelMBean createModelMBean(Object o) {
        try {
            ModelMBean mbean = new RequiredModelMBean();
            JmxManaged annotation = o.getClass().getAnnotation(JmxManaged.class);
            String description = annotation == null ? "" : annotation.description();
            ModelMBeanInfo info = new ModelMBeanInfoSupport(o.getClass().getName(),
                                                            description,
                                                            extractAttributeInfo(o),
                                                            new ModelMBeanConstructorInfo[0],
                                                            extractOperationInfo(o),
                                                            new ModelMBeanNotificationInfo[0]);
            mbean.setModelMBeanInfo(info);
            mbean.setManagedResource(o, "ObjectReference");

            return mbean;
        } catch(MBeanException e) {
            throw new VoldemortException(e);
        } catch(InvalidTargetObjectTypeException e) {
View Full Code Here

            System.out.println("Creating MBeans ...");

            // Create the MBean for the top-level Server object
            String domain = server.getDefaultDomain();
            ManagedBean managed = registry.findManagedBean("StandardServer");
            ModelMBean mm = managed.createMBean(tree);
            mm.addAttributeChangeNotificationListener(demo, "shutdown", tree);
            mm.addAttributeChangeNotificationListener(demo, "port", tree);
            server.registerMBean(mm, createName(domain, tree));

            // Create the MBean for each associated Service and friendes
            Service services[] = tree.findServices();
            for (int i = 0; i < services.length; i++) {

                // The MBean for the Service itself
                managed = registry.findManagedBean("StandardService");
                mm = managed.createMBean(services[i]);
                mm.addAttributeChangeNotificationListener(demo, "name",
                                                          services[i]);
                server.registerMBean(mm, createName(domain, services[i]));

                // The MBean for the corresponding Engine
                managed = registry.findManagedBean("StandardEngine");
                Engine container = (Engine) services[i].getContainer();
                mm = managed.createMBean(container);
                mm.addAttributeChangeNotificationListener(demo, "name",
                                                          container);
                server.registerMBean(mm, createName(domain, container));

                // The MBeans for the corresponding Connectors
                managed = registry.findManagedBean("HttpConnector");
                Connector connectors[] = services[i].findConnectors();
                for (int j = 0; j < connectors.length; j++) {
                    mm = managed.createMBean(connectors[j]);
                    mm.addAttributeChangeNotificationListener(demo, "port",
                                                              connectors[j]);
                    server.registerMBean
                        (mm, createName(domain, connectors[j]));
                }
View Full Code Here

            throw new MBeanException
                (ex, "Cannot load ModelMBean class " + getClassName());
        }

        // Create a new ModelMBean instance
        ModelMBean mbean = null;
        try {
            mbean = (ModelMBean) clazz.newInstance();
            mbean.setModelMBeanInfo(createMBeanInfo());
        } catch (MBeanException e) {
            throw e;
        } catch (RuntimeOperationsException e) {
            throw e;
        } catch (Exception e) {
            throw new MBeanException
                (e, "Cannot instantiate ModelMBean of class " +
                 getClassName());
        }

        // Set the managed resource (if any)
        try {
            if (instance != null)
                mbean.setManagedResource(instance, "ObjectReference");
        } catch (InstanceNotFoundException e) {
            throw e;
        } catch (InvalidTargetObjectTypeException e) {
            throw e;
        }
View Full Code Here

     * @return The ModelMBean
     * @throws Exception
     *             If an error occurs this constructors throws this exception
     */
    protected ModelMBean getManagedBean(Object object) throws Exception {
        ModelMBean mbean = null;
        if (registry != null) {
            ManagedBean managedBean = registry.findManagedBean(object
                    .getClass().getName());
            mbean = managedBean.createMBean(object);
        }
View Full Code Here

            }

            ManagedBean managed = findManagedBean(bean.getClass(), type);

            // The real mbean is created and registered
            ModelMBean mbean = managed.createMBean(bean);

            ifgetMBeanServer().isRegistered( oname )) {
                if( log.isDebugEnabled()) {
                    log.debug("Unregistering existing component " + oname );
                }
View Full Code Here

            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);

    }
View Full Code Here

            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);
        if( jsr77Names ) {
            oname = createObjectName77(domain, context);
            mserver.registerMBean(mbean, oname);
View Full Code Here

            throw new MBeanException(e);
        }
        String domain = managed.getDomain();
        if (domain == null)
            domain = mserver.getDefaultDomain();
        ModelMBean mbean = managed.createMBean(wrapper);
        ObjectName oname = createObjectName(domain, wrapper);
        mserver.registerMBean(mbean, oname);
        return (mbean);

    }
View Full Code Here

            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);

    }
View Full Code Here

TOP

Related Classes of javax.management.modelmbean.ModelMBean

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.