Package javax.management

Examples of javax.management.ObjectInstance


        // Training
        ServicePoint sp1 = ((MBeanRegistrationContribution) mBeanList.get(0)).getServicePoint();
        Object mBean1 = registry.getService("test.management.MBean1", Runnable.class);
        ObjectName on1 = objectNameBuilder.createServiceObjectName(sp1);
        server.registerMBean(mBean1, on1);
        ObjectInstance oin1 = new ObjectInstance(on1, mBean1.getClass().getName());
        serverControl.setReturnValue(oin1);

        Object mBean2 = registry.getService("test.management.MBean2", Runnable.class);
        ObjectName on2 = new ObjectName("hivemind:name=bean2");
        server.registerMBean(mBean2, on2);
        serverControl.setReturnValue(new ObjectInstance(on2, mBean2.getClass().getName()));

        // This is a special case. A class without interface
        Object mBean3 = registry.getService("test.management.MBean3", MBeanNonInterfaceTestService.class);
        ObjectName on3 = new ObjectName("hivemind:name=bean3");
        server.registerMBean(mBean3, on3);
        serverControl.setReturnValue(new ObjectInstance(on3, mBean3.getClass().getName()));
       
        // Call from unregisterBean
        server.getObjectInstance(on1);
        serverControl.setReturnValue(oin1);
View Full Code Here


    public ObjectInstance getObjectInstance(ObjectName objectName) throws InstanceNotFoundException {
        AbstractName abstractName = toAbstractName(objectName);
        try {
            GBeanInfo gbeanInfo = kernel.getGBeanInfo(abstractName);
            return new ObjectInstance(objectName, gbeanInfo.getClassName());
        } catch (GBeanNotFoundException e) {
            throw (InstanceNotFoundException)new InstanceNotFoundException(objectName.getCanonicalName()).initCause(e);
        }
    }
View Full Code Here

     * @see org.apache.hivemind.management.MBeanRegistry#unregisterMBean(javax.management.ObjectName)
     */
    public void unregisterMBean(ObjectName objectName) throws InstanceNotFoundException,
            MBeanRegistrationException
    {
        ObjectInstance instance = _beanServer.getObjectInstance(objectName);
        _objectInstances.remove(instance);
        _beanServer.unregisterMBean(objectName);
    }
View Full Code Here

    {
        // Unregister objects in reversed order. Otherwise the
        // Jsr 160 connector gets problems after the namingservice is unregistered
        for (int i = _objectInstances.size() - 1; i >= 0; i--)
        {
            ObjectInstance objectInstance = (ObjectInstance) _objectInstances.get(i);
            try
            {
                _beanServer.unregisterMBean(objectInstance.getObjectName());
            }
            catch (JMException e)
            {
                // Uncritical error, just warn
                _log.warn(ManagementMessages.errorUnregisteringMBean(
                        objectInstance.getObjectName(),
                        e));
            }
        }
    }
View Full Code Here

                + ":j2eeType=Servlet,WebModule=" + webModuleName + ",*";
            ObjectName servletObjectName = new ObjectName(onStr);
            Set set = mBeanServer.queryMBeans(servletObjectName, null);
            Iterator iterator = set.iterator();
            while (iterator.hasNext()) {
                ObjectInstance oi = (ObjectInstance) iterator.next();
                writeWrapper(writer, oi.getObjectName(), mBeanServer, mode);
            }

        } else if (mode == 1){
            // for now we don't write out the context in XML
        }
View Full Code Here

            String onStr = domain + ":type=Host,*";
            ObjectName objectName = new ObjectName(onStr);
            Set set = mBeanServer.queryMBeans(objectName, null);
            Iterator iterator = set.iterator();
            while (iterator.hasNext()) {
                ObjectInstance oi = (ObjectInstance) iterator.next();
                registerHost(oi.getObjectName());
            }


            // Query contexts
            onStr = "*:j2eeType=WebModule,*";
            objectName = new ObjectName(onStr);
            set = mBeanServer.queryMBeans(objectName, null);
            iterator = set.iterator();
            while (iterator.hasNext()) {
                ObjectInstance oi = (ObjectInstance) iterator.next();
                registerContext(oi.getObjectName());
            }

            // Query wrappers
            onStr = "*:j2eeType=Servlet,*";
            objectName = new ObjectName(onStr);
            set = mBeanServer.queryMBeans(objectName, null);
            iterator = set.iterator();
            while (iterator.hasNext()) {
                ObjectInstance oi = (ObjectInstance) iterator.next();
                registerWrapper(oi.getObjectName());
            }

            onStr = "JMImplementation:type=MBeanServerDelegate";
            objectName = new ObjectName(onStr);
            mBeanServer.addNotificationListener(objectName, this, null, null);
View Full Code Here

           
            while (iterator.hasNext()) {

                if (isRegisteredWithAlias) break;
           
                ObjectInstance oi = (ObjectInstance) iterator.next();
                hostName = oi.getObjectName();
                aliases = (String[])
                    mBeanServer.invoke(hostName, "findAliases", null, null);

                for (int i=0; i < aliases.length; i++){
                    if (aliases[i].equalsIgnoreCase(defaultHost)){
View Full Code Here

                    return false;
                }
                ObjectName resourceName = ObjectNameAddressUtil.createObjectName(address);
                if (name == null || name.apply(resourceName)) {
                    //TODO check query
                    set.add(new ObjectInstance(resourceName, CLASS_NAME));
                }
                return true;
            }

            @Override
View Full Code Here

    ObjectInstance getObjectInstance(ObjectName name) throws InstanceNotFoundException {
        if (resolvePathAddress(name) == null) {
            throw createInstanceNotFoundException(name);
        }
        return new ObjectInstance(name, CLASS_NAME);
    }
View Full Code Here

      Set mbeans = mbeanServer.queryMBeans(null, null);
      Iterator it = mbeans.iterator();
      int i = 0;
      while (it.hasNext())
      {
         ObjectInstance mbean = (ObjectInstance) it.next();
         log.info("MBean " + i++ + ": " + mbean.getObjectName());
      }
   }
View Full Code Here

TOP

Related Classes of javax.management.ObjectInstance

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.