Package javax.management

Examples of javax.management.StandardMBean$MBeanInfoSafeAction

In either case, the class Impl must implement the interface Intf.

Standard MBeans based on the naming relationship between implementation and interface classes are of course still available.

This class may also be used to construct MXBeans. The usage is exactly the same as for Standard MBeans except that in the examples above, the {@code false} parameter to the constructor or{@code super(...)} invocation is instead {@code true}.

@since 1.5

      if (jmx != null)
      {
         intfClass = jmx.exposedInterface();
         registerDirectly = jmx.registerDirectly();
      }
      Object mbean = (registerDirectly ? context.getTarget() : new StandardMBean(context.getTarget(), intfClass));
      mbeanServer.registerMBean(mbean, objectName);
      try
      {
         serviceController.start(objectName);
      }
View Full Code Here


   public void testSpecifyManagementInterface()
      throws Exception
   {
      MBeanServer server = MBeanServerFactory.newMBeanServer();
      ObjectName name = new ObjectName("test:test=test");
      server.registerMBean(new StandardMBean(new MyRunnable(), Runnable.class), name);
      server.invoke(name, "run", new Object[0], new String[0]);
   }
View Full Code Here

   public void testDontSpecifyManagementInterface()
      throws Exception
   {
      MBeanServer server = MBeanServerFactory.newMBeanServer();
      ObjectName name = new ObjectName("test:test=test");
      server.registerMBean(new StandardMBean(new Trivial(), null), name);
      server.invoke(name, "doOperation", new Object[] { "arg" }, new String[] { String.class.getName() });
   }
View Full Code Here

   }

   public void testGetImplementationImplied()
      throws Exception
   {
      StandardMBean std = new MBeanRunnable();
      assertTrue("MBeanRunnable is its own implementation", std == std.getImplementation());
      assertTrue("MBeanRunnable is its own implementation class", std.getClass() == std.getImplementationClass());
   }
View Full Code Here

   public void testGetImplementationSpecified()
      throws Exception
   {
      Runnable obj = new MyRunnable();
      StandardMBean std = new StandardMBean(obj, Runnable.class);
      assertTrue("MyRunnable is the implementation", obj == std.getImplementation());
      assertTrue("MyRunnable is the implementation class", obj.getClass() == std.getImplementationClass());
   }
View Full Code Here

   }

   public void testMBeanInterfaceImplied()
      throws Exception
   {
      StandardMBean std = new MBeanRunnable();
      assertTrue("MBeanRunnable has Runnable as a management interface", Runnable.class == std.getMBeanInterface());
   }
View Full Code Here

   public void testMBeanInterfaceSpecified()
      throws Exception
   {
      Runnable obj = new MyRunnable();
      StandardMBean std = new StandardMBean(obj, Runnable.class);
      assertTrue("MyRunnable has Runnable as a management interface", Runnable.class == std.getMBeanInterface());
   }
View Full Code Here

   public void testMBeanInterfaceOldStyle()
      throws Exception
   {
      Object obj = new Trivial();
      StandardMBean std = new StandardMBean(obj, null);
      assertTrue("Trivial has TrivialMBean as a management interface", TrivialMBean.class == std.getMBeanInterface());
   }
View Full Code Here

   }

   public void testMetaData()
      throws Exception
   {
      StandardMBean std = new MyStandardMBean();
      MBeanInfo info = std.getMBeanInfo();
      assertEquals(MyStandardMBean.MBEAN_CLASSNAME, info.getClassName());
      assertEquals(MyStandardMBean.MBEAN_DESCRIPTION, info.getDescription());

      MBeanAttributeInfo[] attributes = info.getAttributes();
      assertEquals(attributes.length, 1);
View Full Code Here

   }

   public void testNoConstructorsMetaData()
      throws Exception
   {
      StandardMBean std = new NoConstructorsStandardMBean();
      MBeanInfo info = std.getMBeanInfo();

      MBeanConstructorInfo[] constructors = info.getConstructors();
      assertEquals(constructors.length, 0);
   }
View Full Code Here

TOP

Related Classes of javax.management.StandardMBean$MBeanInfoSafeAction

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.