Examples of MBeanServerConnection


Examples of javax.management.MBeanServerConnection

   public void testScoped1() throws Exception
   {
      deploy("aop-scopedattachtest1.aop");
      try
      {
         MBeanServerConnection server = getServer();
         ObjectName testerName = new ObjectName("jboss.aop:name=ScopedTester1");
         Object[] params = {};
         String[] sig = {};
         server.invoke(testerName, "testScoped", params, sig);
      }
      finally
      {
         undeploy("aop-scopedattachtest1.aop");
      }
View Full Code Here

Examples of javax.management.MBeanServerConnection

   public void testScoped2() throws Exception
   {
      deploy("aop-scopedattachtest2.aop");
      try
      {
         MBeanServerConnection server = getServer();
         ObjectName testerName = new ObjectName("jboss.aop:name=ScopedTester2");
         Object[] params = {};
         String[] sig = {};
         server.invoke(testerName, "testScoped", params, sig);
      }
      finally
      {
         undeploy("aop-scopedattachtest2.aop");
      }
View Full Code Here

Examples of javax.management.MBeanServerConnection

   }
  
   @SuppressWarnings("unchecked")
   private List<String> hasClassLoaders(String[] keys) throws Exception
   {
      MBeanServerConnection adaptor = delegate.getServer();
      ObjectName on = new ObjectName(ClassLoaderTrackerMBean.OBJECT_NAME);
      Object[] params = { keys };
      String[] signature = new String[] { String[].class.getName() };
      return ((List) adaptor.invoke(on, "hasClassLoaders", params, signature));
   }
View Full Code Here

Examples of javax.management.MBeanServerConnection

//      return ((Boolean) adaptor.invoke(on, "hasClassLoader", params, signature)).booleanValue();
//   }
  
   private boolean hasClassLoaderBeenReleased(String key) throws Exception
   {
      MBeanServerConnection adaptor = delegate.getServer();
      ObjectName on = new ObjectName(ClassLoaderTrackerMBean.OBJECT_NAME);
      Object[] params = { key };
      String[] signature = new String[] { String.class.getName() };
      return ((Boolean) adaptor.invoke(on, "hasClassLoaderBeenReleased", params, signature)).booleanValue();
   }
View Full Code Here

Examples of javax.management.MBeanServerConnection

  
   private void removeClassLoader(String key) throws Exception
   {
      try
      {
         MBeanServerConnection adaptor = delegate.getServer();
         ObjectName on = new ObjectName(ClassLoaderTrackerMBean.OBJECT_NAME);
         Object[] params = { key };
         String[] signature = new String[] { String.class.getName() };
         adaptor.invoke(on, "removeClassLoader", params, signature);
      }
      catch (Exception e)
      {
         log.error("Caught exception removing classloader under key " + key, e);
      }
View Full Code Here

Examples of javax.management.MBeanServerConnection

   }
  
   protected void flushSecurityCache(String domain) throws Exception
   {
      log.debug("Flushing security cache " + domain);
      MBeanServerConnection adaptor = delegate.getServer();
      ObjectName on = new ObjectName(ClassLoaderTrackerMBean.OBJECT_NAME);
      Object[] params = { domain };
      String[] signature = new String[] { String.class.getName() };
      adaptor.invoke(on, "flushSecurityCache", params, signature);
   }
View Full Code Here

Examples of javax.management.MBeanServerConnection

         //Since the dependencies are not there, we get an exception...
      }
     
      try
      {
         MBeanServerConnection server = getServer();
         ObjectName testerName = new ObjectName("jboss.aop:name=ScopedTester");
         try
         {
            server.getMBeanInfo(testerName);
            fail(testerName + " should not have been found");
         }
         catch (InstanceNotFoundException expected)
         {
         }
  
         deploy("aop-scopeddependency-global.jar");
         try
         {
            server.setAttribute(testerName, new Attribute("Property", 42));
            assertEquals(42, server.getAttribute(testerName, "Property"));
            String ret = (String)server.invoke(testerName, "someAction", new Object[0], new String[0]);
            assertNotNull(ret);
            assertEquals("true", ret);
         }
         finally
         {
            undeploy("aop-scopeddependency-global.jar");
         }
  
         try
         {
            server.getMBeanInfo(testerName);
            fail(testerName + " should not have been found");
         }
         catch (InstanceNotFoundException expected)
         {
         }
View Full Code Here

Examples of javax.management.MBeanServerConnection

   {
      ObjectName name = new ObjectName("jboss.test:test=JavaClassIsolation");
      deploy("test-java-class-isolation.sar");
      try
      {
         MBeanServerConnection server = getServer();
         server.invoke(name, "test", null, null);
      }
      finally
      {
         undeploy("test-java-class-isolation.sar");
      }
View Full Code Here

Examples of javax.management.MBeanServerConnection

      log.info("+++ testAvailableServices, jndiURL="+jndiURL);

      Properties env = new Properties();
      env.setProperty(Context.PROVIDER_URL, jndiURL);
      InitialContext ctx = new InitialContext(env);
      MBeanServerConnection server = (MBeanServerConnection) ctx.lookup("jmx/invoker/RMIAdaptor");
      ObjectName all = new ObjectName("*:*");
      Set allNames = server.queryNames(all, null);
      ArrayList serverErrors = new ArrayList();
      Iterator names = allNames.iterator();
      int serviceCount = 0;
      while( names.hasNext() )
      {
         ObjectName name = (ObjectName) names.next();
         try
         {
            // BarrierController Barriers can be in CREATED or STOPPED state
            // e.g. if the controller's startup notification hasn't been received,
            // so log a message and exclude them from the search.
            boolean isBarrier = server.isInstanceOf(name, BarrierController.Barrier.class.getName());
            if( isBarrier )
            {
               log.debug("Skipping BarrierController.Barrier service: '" + name
                     + "', in state: " + (String) server.getAttribute(name, "StateString"));
               continue;
            }
            /* If this is a JSR-77 mbean, only the StateManageable types
             have a meaningful state string
            */
            boolean jsr77State = server.isInstanceOf(name, StateManageable.class.getName());
            if( jsr77State )
            {
               // the stateManageable also needs to be true
               Boolean flag = (Boolean) server.getAttribute(name, "stateManageable");
               jsr77State = flag.booleanValue();
            }
            boolean mbeanService = server.isInstanceOf(name, ServiceMBean.class.getName());
            if( jsr77State == true || mbeanService == true )
            {
               serviceCount ++;
               String state = (String) server.getAttribute(name, "StateString");              
               if( VALID_STATES.contains(state) == false )
               {
                     String msg = name+" is not Started, state="+state;
                     log.error(msg);
                     serverErrors.add(msg);
View Full Code Here

Examples of javax.management.MBeanServerConnection

    */
   public void testConfigurableRolesAuthorizedAccess() throws Exception
   {
      LoginContext lc = login("admin", "admin".toCharArray());
      InitialContext ctx = getInitialContext();
      MBeanServerConnection conn = (MBeanServerConnection) ctx.lookup("jmx/invoker/ConfigurableAuthorizedRMIAdaptor");
      ObjectName server = new ObjectName("jboss.system:type=Server");
      String version = (String) conn.getAttribute(server, "Version");
      log.info("Obtained server version: "+version);
      MBeanInfo info = conn.getMBeanInfo(server);
      assertNotNull("MBeanInfo != null", info);
      Integer mbeanCount = conn.getMBeanCount();
      assertNotNull("mbeanCount != null", mbeanCount);
      lc.logout();
   }
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.