Package javax.management

Examples of javax.management.MBeanServerConnection.createMBean()


      System.out.println("MBeanServer specification vendor is " + delegate.getSpecificationVendor());
      System.out.println("MBeanServer specification version is " + delegate.getSpecificationVersion());
      System.out.println("MBeanServer MBeanCount is " + connection.getMBeanCount());

      ObjectName objName = new ObjectName("test:name=sample");
      connection.createMBean(Sample.class.getName(), objName);
      Object ret = connection.invoke(objName, "doSomething", new Object[] {"foo"}, new String[] {String.class.getName()});
      System.out.println("Return to doSomething() is " + ret);

      NotificationListener listener = new Listener();
      connection.addNotificationListener(objName,listener, null, null);
View Full Code Here


      log.info("+++ testClassNotFoundException");
      MBeanServerConnection server = (MBeanServerConnection) getInitialContext().lookup("jmx/invoker/RMIAdaptor");
      ObjectName name = new ObjectName("jboss.test:test=testClassNotFoundException");
      try
      {
         server.createMBean("org.jboss.text.jmx.DoesNotExist", name);
         fail("Was able to create org.jboss.text.jmx.DoesNotExist mbean");
      }
      catch (ReflectionException e)
      {
         Exception ex = e.getTargetException();
View Full Code Here

      final MBeanServerConnection conn = getMBeanServerConnection();
     
      if ( ! conn.isRegistered( objectName ) )
      {
          objectName  =
              conn.createMBean( IMPL_CLASSNAME, objectName ).getObjectName();
      }
     
      return objectName;
  }
 
View Full Code Here

         addPermission(new MBeanTrustPermission("*"));
         policy.addServerPermission(new JMXPrincipal("test"), new MBeanPermission("*", "instantiate, registerMBean, getAttribute"));
         MBeanServerConnection cntion = cntor.getMBeanServerConnection();
         ObjectName name = ObjectName.getInstance(":name=subject");
         cntion.createMBean(SubjectCheck.class.getName(), name, null);
         policy.addServerPermission(new JMXPrincipal("test"), new AuthPermission("getSubject"));
         Subject subject = (Subject)cntion.getAttribute(name, "Subject");

         Set principals = subject.getPrincipals();
         assertNotNull(principals);
View Full Code Here

         Set delegates = new HashSet();
         delegates.add(new JMXPrincipal("delegate"));
         Subject delegate = new Subject(true, delegates, Collections.EMPTY_SET, Collections.EMPTY_SET);
         MBeanServerConnection cntion = cntor.getMBeanServerConnection(delegate);
         ObjectName name = ObjectName.getInstance(":name=subject");
         cntion.createMBean(SubjectCheck.class.getName(), name, null);
         policy.addServerPermission(new JMXPrincipal("delegate"), new AuthPermission("getSubject"));
         Subject subject = (Subject)cntion.getAttribute(name, "Subject");

         Set principals = subject.getPrincipals();
         assertNotNull(principals);
View Full Code Here

   public void testCreateMBeanWith3Params() throws Exception
   {
      MBeanServerConnection mbsc = getMBeanServerConnection(newMBeanServer());
      ObjectName name = ObjectName.getInstance("", "test", "invocation");
      ObjectInstance instance = mbsc.createMBean(Support.class.getName(), name, null);
      assertNotNull(instance);
   }

   public void testCreateMBeanWith5Params() throws Exception
   {
View Full Code Here

   public void testCreateMBeanWith5Params() throws Exception
   {
      MBeanServerConnection mbsc = getMBeanServerConnection(newMBeanServer());
      String value = "mx4j";
      ObjectName name = ObjectName.getInstance("", "test", "invocation");
      ObjectInstance instance = mbsc.createMBean(Support.class.getName(), name, null, new Object[]{value}, new String[]{String.class.getName()});
      assertNotNull(instance);

      // Be sure the argument arrived to the MBean
      String result = (String)mbsc.getAttribute(name, "Name");
      assertEquals(result, value);
View Full Code Here

   public void testGetAttribute() throws Exception
   {
      MBeanServerConnection mbsc = getMBeanServerConnection(newMBeanServer());
      String value = "mx4j";
      ObjectName name = ObjectName.getInstance("", "test", "invocation");
      ObjectInstance instance = mbsc.createMBean(Support.class.getName(), name, null, new Object[]{value}, new String[]{String.class.getName()});
      assertNotNull(instance);

      // Be sure the argument arrived to the MBean
      String result = (String)mbsc.getAttribute(name, "Name");
      assertEquals(result, value);
View Full Code Here

   public void testGetAttributes() throws Exception
   {
      MBeanServerConnection mbsc = getMBeanServerConnection(newMBeanServer());
      String value = "mx4j";
      ObjectName name = ObjectName.getInstance("", "test", "invocation");
      ObjectInstance instance = mbsc.createMBean(Support.class.getName(), name, null, new Object[]{value}, new String[]{String.class.getName()});
      assertNotNull(instance);

      // Be sure the argument arrived to the MBean
      String attribute = "Name";
      String[] attributes = new String[]{attribute};
View Full Code Here

   public void testGetObjectInstance() throws Exception
   {
      MBeanServerConnection mbsc = getMBeanServerConnection(newMBeanServer());
      ObjectName name = ObjectName.getInstance("", "test", "invocation");
      ObjectInstance instance = mbsc.createMBean(Support.class.getName(), name, null);
      assertNotNull(instance);

      ObjectInstance result = mbsc.getObjectInstance(name);
      assertNotNull(result);
      assertEquals(result, instance);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.