Package org.jboss.jmx.adaptor.rmi

Examples of org.jboss.jmx.adaptor.rmi.RMIAdaptor


     */
    public ServerConnection getServerConnection(ApplicationConfig config)
        throws ConnectionFailedException {

        try {
            RMIAdaptor rmiAdaptor = findExternal(config.getURL(),
                    config.getUsername(), config.getPassword());
            return new JBossServerConnection(rmiAdaptor);
        } catch (Throwable e) {
            throw new ConnectionFailedException(e);
        }
View Full Code Here


        // As of 3.2.2 version of JBoss "jmx/invoker/RMIAdaptor" is the new JNDI entry for RMIAdaptor.
        ///  But there is a naming alias setup from jmx/rmi/RMIAdaptor to jmx/invoker/RMIAdaptor,
        ///   so connectivity continues to work fine (last tested with 4.0.4GA).
        Context ctx = new InitialContext(props);
        RMIAdaptor rmiAdaptor = (RMIAdaptor)ctx.lookup("jmx/rmi/RMIAdaptor");
        ctx.close();
        return rmiAdaptor;
    }
View Full Code Here

            connection = (MBeanServer) list.get(0);
        }
        else
        {
            InitialContext ic = new InitialContext();           
            RMIAdaptor adaptor  = (RMIAdaptor) ic.lookup("jmx/invoker/RMIAdaptor");       
            connection = adaptor;
        }
    }
View Full Code Here

   static RMIAdaptor server2;
   public static void main(String args[] ) throws Exception
   {
      String serverName = InetAddress.getLocalHost().getHostName();
      String connectorName = "jmx:" + serverName + ":rmi";
      RMIAdaptor server1 = (RMIAdaptor)new InitialContext().lookup(connectorName);

      Properties p = new Properties();
      p.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
      p.put(Context.URL_PKG_PREFIXES, "jboss.naming:org.jnp.interfaces");
      p.put(Context.PROVIDER_URL, "localhost:11099");
      RMIAdaptor server2 = (RMIAdaptor)new InitialContext(p).lookup(connectorName);
      ObjectName testerName = new ObjectName("jboss.aop:name=CacheTester");

      int baseAge = 32;
     

      for (int j = 0; j < 5; j++)
      {
         {
            // Just to be absolutely sure that server1 and server2 are different VMs
            Object[] params = {};
            String[] sig = {};
            System.out.println("vmid server1: " + server1.invoke(testerName, "getVMID", params, sig));
            System.out.println("vmid server2: " + server2.invoke(testerName, "getVMID", params, sig));
           
         }
         {
            Object[] params = {"Bill"};
            String[] sig = {"java.lang.String"};
            Integer age1 = (Integer)server1.invoke(testerName, "getAge", params, sig);
            System.out.println("server1 age: " + age1);
           
            Integer age2 = (Integer)server2.invoke(testerName, "getAge", params, sig);
            System.out.println("server2 age: " + age2);
         }
         {
            System.out.println("set age to " + ++baseAge + " on server1");
            Object[] params = {"Bill", new Integer(baseAge)};
            String[] sig = {"java.lang.String", "int"};
            server1.invoke(testerName, "setAge", params, sig);
         }
         {
            System.out.println("check age");
            Object[] params = {"Bill"};
            String[] sig = {"java.lang.String"};
            Integer age1 = (Integer)server1.invoke(testerName, "getAge", params, sig);
            System.out.println("server1 age: " + age1);
           
            Integer age2 = (Integer)server2.invoke(testerName, "getAge", params, sig);
            System.out.println("server2 age: " + age2);
         }
         {
            Object[] params = {"Bill"};
            String[] sig = {"java.lang.String"};
            List hobbies = (List)server1.invoke(testerName, "getHobbies", params, sig);
            System.out.println("server1 hobbies: ");
            for (int i = 0; i < hobbies.size(); i++)
            {
               System.out.println("   " + hobbies.get(i));
         }
           
            hobbies = (List)server2.invoke(testerName, "getHobbies", params, sig);
            System.out.println("server2 hobbies: ");
            for (int i = 0; i < hobbies.size(); i++)
            {
               System.out.println("   " + hobbies.get(i));
            }
         }
         {
            System.out.println("addHobby fishing");
            Object[] params = {"Bill", "fishing"};
            String[] sig = {"java.lang.String", "java.lang.String"};
            server1.invoke(testerName, "addHobby", params, sig);
         }
         {
            Object[] params = {"Bill"};
            String[] sig = {"java.lang.String"};
            List hobbies = (List)server1.invoke(testerName, "getHobbies", params, sig);
            System.out.println("server1 hobbies: ");
            for (int i = 0; i < hobbies.size(); i++)
            {
               System.out.println("   " + hobbies.get(i));
            }
           
            hobbies = (List)server2.invoke(testerName, "getHobbies", params, sig);
            System.out.println("server2 hobbies: ");
            for (int i = 0; i < hobbies.size(); i++)
            {
               System.out.println("   " + hobbies.get(i));
            }
         }
         {
            Object[] params = {"Bill"};
            String[] sig = {"java.lang.String"};
            String city1= (String)server1.invoke(testerName, "getCity", params, sig);
            System.out.println("server1 city: " + city1);
           
            String city2 = (String)server2.invoke(testerName, "getCity", params, sig);
            System.out.println("server2 city: " + city2);
         }
         {
            System.out.println("set city to Atlanta");
            Object[] params = {"Bill", "Atlanta" + baseAge};
            String[] sig = {"java.lang.String", "java.lang.String"};
            server1.invoke(testerName, "setCity", params, sig);
         }
         {
            Object[] params = {"Bill"};
            String[] sig = {"java.lang.String"};
            String city1= (String)server1.invoke(testerName, "getCity", params, sig);
            System.out.println("server1 city: " + city1);
           
            String city2 = (String)server2.invoke(testerName, "getCity", params, sig);
            System.out.println("server2 city: " + city2);
         }
      }
   }
View Full Code Here

   public void testGetSomething()
      throws Exception
   {
      log.info("+++ testGetSomething");
      RMIAdaptor server = (RMIAdaptor) getInitialContext().lookup("jmx/invoker/RMIAdaptor");
      assertEquals("something", server.getAttribute(getObjectName(), "Something"));
   }
View Full Code Here

   public void testGetCustom()
      throws Exception
   {
      log.info("+++ testGetCustom");
      RMIAdaptor server = (RMIAdaptor) getInitialContext().lookup("jmx/invoker/RMIAdaptor");
      CustomClass custom = (CustomClass) server.getAttribute(getObjectName(), "Custom");
      assertEquals("InitialValue", custom.getValue());
   }
View Full Code Here

   public void testGetCustomXMBean()
      throws Exception
   {
      log.info("+++ testGetCustomXMBean");
      RMIAdaptor server = (RMIAdaptor) getInitialContext().lookup("jmx/invoker/RMIAdaptor");
      ObjectName xmbean = new ObjectName("jboss.test:service=InvokerTest,type=XMBean");
      CustomClass custom = (CustomClass) server.getAttribute(xmbean, "Custom");
      assertEquals("InitialValue", custom.getValue());
   }
View Full Code Here

   }
   public void testGetXMBeanInfo()
      throws Exception
   {
      log.info("+++ testGetXMBeanInfo");
      RMIAdaptor server = (RMIAdaptor) getInitialContext().lookup("jmx/invoker/RMIAdaptor");
      ObjectName xmbean = new ObjectName("jboss.test:service=InvokerTest,type=XMBean");
      MBeanInfo info = server.getMBeanInfo(xmbean);
      log.info("MBeanInfo: "+info);
   }
View Full Code Here

   }
   public void testXMBeanDoSomething()
      throws Exception
   {
      log.info("+++ testXMBeanDoSomething");
      RMIAdaptor server = (RMIAdaptor) getInitialContext().lookup("jmx/invoker/RMIAdaptor");
      ObjectName xmbean = new ObjectName("jboss.test:service=InvokerTest,type=XMBean");
      Object[] args = {};
      String[] sig = {};
      CustomClass custom = (CustomClass) server.invoke(xmbean, "doSomething", args, sig);
      log.info("doSomething: "+custom);
   }
View Full Code Here

   public void testSetCustom()
      throws Exception
   {
      log.info("+++ testSetCustom");
      RMIAdaptor server = (RMIAdaptor) getInitialContext().lookup("jmx/invoker/RMIAdaptor");
      server.setAttribute(getObjectName(), new Attribute("Custom", new CustomClass("changed")));
      CustomClass custom = (CustomClass) server.getAttribute(getObjectName(), "Custom");
      assertEquals("changed", custom.getValue());
   }
View Full Code Here

TOP

Related Classes of org.jboss.jmx.adaptor.rmi.RMIAdaptor

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.