Package javax.management

Examples of javax.management.ObjectInstance


         // Refresh also ObjectInstance.getClassName(), if it's the case
         String className = info.getClassName();
         if (!metadata.instance.getClassName().equals(className))
         {
            metadata.instance = new ObjectInstance(metadata.name, className);
         }
      }

      return (MBeanInfo)metadata.info.clone();
   }
View Full Code Here


                e.printStackTrace();
            }
        } else {
            try {
                m_objectName = new ObjectName(getObjectNameString());
                ObjectInstance instance = ManagementFactory
                    .getPlatformMBeanServer().registerMBean(m_MBean,
                        m_objectName);

                // we must retrieve object name used to register the MBean.
                // It can have been changed by preRegister method of
                // MBeanRegistration interface.
                if (m_registerCallbacks) {
                    m_objectName = instance.getObjectName();
                }

                m_registered = true;
            } catch (Exception e) {
                error("Registration of MBean failed.", e);
View Full Code Here

      {
         // With this call, the MBean implementor can replace the ObjectName with a subclass that is not secure, secure it again
         head.registration(metadata, MBeanServerInterceptor.PRE_REGISTER);
         metadata.name = secureObjectName(metadata.name);

         metadata.instance = new ObjectInstance(metadata.name, metadata.info.getClassName());

         register(metadata, privileged);

         head.registration(metadata, MBeanServerInterceptor.POST_REGISTER_TRUE);
      }
View Full Code Here

  }

  private static class ObjectInstanceComparator implements Comparator {
    private ToStringComparator comp = new ToStringComparator();
    public int compare(Object o1, Object o2) {
      ObjectInstance oi1 = (ObjectInstance)o1;
      ObjectInstance oi2 = (ObjectInstance)o2;
      return comp.compare(oi1.getObjectName(), oi2.getObjectName());
    }
View Full Code Here

      mbeans.addAll(server.queryMBeans(null, null));
    }
    Iterator i = mbeans.iterator();
    while (i.hasNext())
    {
      ObjectInstance instance = (ObjectInstance)i.next();
      if (classVariable != null && !classVariable.equals(instance.getClassName()))
      {
        continue;
      }
      Element mBeanElement = document.createElement("MBean");
      mBeanElement.setAttribute("objectname", instance.getObjectName().toString());
      mBeanElement.setAttribute("classname", instance.getClassName());
      MBeanInfo info = server.getMBeanInfo(instance.getObjectName());
      mBeanElement.setAttribute("description", info.getDescription());
      root.appendChild(mBeanElement);
    }
    return document;
  }
View Full Code Here

    Iterator i = mbeans.iterator();
    // this will order the domains
    Map domains = new TreeMap();
    while (i.hasNext())
    {
      ObjectInstance instance = (ObjectInstance)i.next();
      ObjectName name = instance.getObjectName();
      String domain = name.getDomain();
      if (domains.containsKey(domain))
      {
        ((Set)domains.get(domain)).add(name);
      }
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

                LOG.debug("MBean already registered with ObjectName: {}", name);
            }
        }

        // register bean if by force or not exists
        ObjectInstance instance = null;
        if (forceRegistration || !exists) {
            LOG.trace("Registering MBean with ObjectName: {}", name);
            instance = server.registerMBean(obj, name);
        }

        // need to use the name returned from the server as some JEE servers may modify the name
        if (instance != null) {
            ObjectName registeredName = instance.getObjectName();
            LOG.debug("Registered MBean with ObjectName: {}", registeredName);
            mbeansRegistered.put(name, registeredName);
        }
    }
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

    }
   
    private void registerMBeanWithServer(Object obj, ObjectName name, boolean forceRegistration)
        throws JMException {
     
      ObjectInstance instance = null;
      try {
          instance = server.registerMBean(obj, name);          
      } catch (InstanceAlreadyExistsException e) {           
          if (forceRegistration) {
            server.unregisterMBean(name);              
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.