Package javax.management.modelmbean

Examples of javax.management.modelmbean.ModelMBeanInfo


        // Retrieve a ManagedBean
        ManagedBean http = registry.findManagedBean("HttpConnector");
        assertNotNull("Found HttpConnector managed bean");

        // Create the associated ModelMBeanInfo
        ModelMBeanInfo info = http.createMBeanInfo();
        assertNotNull("Found HttpConnector ModelMBeanInfo", info);

        // Retrieve the specified ModelMBeanNotificationInfo
        ModelMBeanNotificationInfo mmninfo = info.getNotification("Problem");
        assertNotNull("Found HttpConnector problem info", mmninfo);

        // Get the Descriptor
        Descriptor desc = mmninfo.getDescriptor();
        assertNotNull("Found HttpConnector problem descriptor", desc);
View Full Code Here


        // Retrieve a ManagedBean
        ManagedBean http = registry.findManagedBean("HttpConnector");
        assertNotNull("Found HttpConnector managed bean");

        // Create the associated ModelMBeanInfo
        ModelMBeanInfo info = http.createMBeanInfo();
        assertNotNull("Found HttpConnector ModelMBeanInfo", info);

        // Retrieve the specified ModelMBeanOperationInfo
        ModelMBeanOperationInfo mmoinfo = info.getOperation("initialize");
        assertNotNull("Found HttpConnector initialize info", mmoinfo);

        // Get the Descriptor
        Descriptor desc = mmoinfo.getDescriptor();
        assertNotNull("Found HttpConnector initialize descriptor", desc);
View Full Code Here

        try {
            registerMBeanWithServer(obj, name, forceRegistration);
        } catch (NotCompliantMBeanException e) {
            // If this is not a "normal" MBean, then try to deploy it using JMX
            // annotations
            ModelMBeanInfo mbi = null;
            mbi = assembler.getMBeanInfo(obj, name.toString());
            RequiredModelMBean mbean = (RequiredModelMBean)server.instantiate(RequiredModelMBean.class
                .getName());
            mbean.setModelMBeanInfo(mbi);
            try {
View Full Code Here

        try {
            registerMBeanWithServer(obj, persist(name), forceRegistration);          
        } catch (NotCompliantMBeanException e) {       
            //If this is not a "normal" MBean, then try to deploy it using JMX annotations
            ModelMBeanAssembler assembler = new ModelMBeanAssembler();
            ModelMBeanInfo mbi = assembler.getModelMbeanInfo(obj.getClass());
            register(obj, name, mbi, forceRegistration);
        }               
    }
View Full Code Here

            new ModelMBeanConstructorInfo[]  { constr1, constr2, constr3 },
            new ModelMBeanOperationInfo[]    { operation },
            null
      );

      ModelMBeanInfo clone = (ModelMBeanInfo)info.clone();     
     
      assertTrue(clone.getDescriptors(null).length == info.getDescriptors(null).length);
     
      // FIXME: equality not implemented to match field, value pairs
      //assertTrue(clone.getDescriptor("FirstConstructor", "constructor")
      //               .equals(
      //           info.getDescriptor("FirstConstructor", "constructor"))
      //);
     
      assertTrue(
            clone.getDescriptor("AnOperation", "operation")
            .getFieldValue("descriptorType")
            .equals(
            info.getDescriptor("AnOperation", "operation")
            .getFieldValue("descriptorType"))
      );
     
      assertTrue(
            clone.getDescriptor("AnOperation", "operation")
            .getFieldValue("name")
            .equals(
            info.getDescriptor("AnOperation", "operation")
            .getFieldValue("name"))
      );
View Full Code Here

   public void testCreatedRMMSetManagedResourceAfterRegisterViaServer()
      throws Exception
   {
      MBeanServer server = MBeanServerFactory.createMBeanServer();
      ObjectName name = new ObjectName("rmm:invocationTest=true");
      ModelMBeanInfo info = getModelMBeanInfo();
      Object[] ctorArgs = { info };
      String[] ctorSig = { "javax.management.modelmbean.ModelMBeanInfo" };
      server.createMBean("javax.management.modelmbean.RequiredModelMBean",
         name, ctorArgs, ctorSig);
View Full Code Here

   public void testCreatedRMMSetManagedResourceAfterRegisterViaServerListener()
      throws Exception
   {
      MBeanServer server = MBeanServerFactory.createMBeanServer();
      ObjectName name = new ObjectName("rmm:invocationTest=true");
      ModelMBeanInfo info = getModelMBeanInfo();
      Object[] ctorArgs = { info };
      String[] ctorSig = { "javax.management.modelmbean.ModelMBeanInfo" };
      server.createMBean("javax.management.modelmbean.RequiredModelMBean",
         name, ctorArgs, ctorSig);
View Full Code Here

      Descriptor descr4 = new DescriptorSupport();
      descr4.setField("name", RequiredModelMBean.class.getName());
      descr4.setField("descriptorType", "MBean");

      // create ModelMBeanInfo
      ModelMBeanInfo info = new ModelMBeanInfoSupport(
                               RequiredModelMBean.class.getName()// class name
                               "Printer",                           // description
                               new ModelMBeanAttributeInfo[] {      // attributes
                                  roomNameInfo,
                                  activeInfo
View Full Code Here

      if (isLoading())
      {
         return;
      }

      ModelMBeanInfo mmeta =
         MBeanInfoConversion.toModelMBeanInfo(metadata, true);

      log.debug("store");
      if (log.isTraceEnabled())
         log.trace("metadata: " + metadata);
      File storeFile = getStoreFile(metadata, true);
      if (storeFile == null)
      {
         return;
      }

      try
      {
         log.debug("Storing to file: " + storeFile.getAbsolutePath());
         FileOutputStream fos = new FileOutputStream(storeFile);
         MBeanAttributeInfo[] mais = mmeta.getAttributes();
         StringBuffer buf = new StringBuffer();
         buf.append("<attributes>\n");
         for (int i = 0; i < mais.length; i++)
         {
            ModelMBeanAttributeInfo mai = (ModelMBeanAttributeInfo) mais[i];
View Full Code Here

      String clazz = mbean.getClassName();
      assertTrue("class is org.jboss.naming.JNDIBindingService",
         clazz.equals("org.jboss.naming.JNDIBindingService"));

      ModelMBeanInfo info = mbean.getMBeanInfo();
      MBeanAttributeInfo[] attrs = info.getAttributes();
      assertTrue("There are 2 attributes", attrs.length == 2);
      MBeanAttributeInfo rn = info.getAttribute("RootName");
      assertNotNull(rn);
      assertEquals("RootName.name", rn.getName(), "RootName");
      assertEquals("RootName.type", rn.getType(), "java.lang.String");
      MBeanAttributeInfo bindings = info.getAttribute("Bindings");
      assertNotNull(bindings);
      assertEquals("Bindings.name", bindings.getName(), "Bindings");
      assertEquals("Bindings.type", bindings.getType(), "org.jboss.naming.JNDIBindings");

      MBeanConstructorInfo[] ctors = info.getConstructors();
      assertEquals("ctors length", ctors.length, 1);
      assertEquals("description",
         "An xmbean description with custom interceptors that are handled by the JavaBeanSchemaInitializer",
         info.getDescription().trim());
      MBeanNotificationInfo[] notices = info.getNotifications();
      assertEquals("notices length", notices.length, 1);
      assertEquals("notices[0].name", notices[0].getName(), "bindEvent");
      assertEquals("notices[0].description",
         notices[0].getDescription(), "The bind event notification");
      String[] types = {"org.jboss.naming.JNDIBindingService.bindEvent"};
      assertEquals("notices[0].types",
         notices[0].getNotifTypes(), types);
      MBeanOperationInfo[] ops = info.getOperations();
      assertEquals("ops length", ops.length, 2);
      assertEquals("ops[0].name", ops[0].getName(), "start");
      assertEquals("ops[1].name", ops[1].getName(), "stop");
   }
View Full Code Here

TOP

Related Classes of javax.management.modelmbean.ModelMBeanInfo

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.