User: cgjung  
  Date: 01/10/03 06:20:31

  Added:       jboss.net/src/main/org/jboss/net/jmx
                        MBeanInvocationHandler.java package.html
  Log:
  restructured server/client parts, invocationhandler support.
  
  MBeanProvider for exposing MBeans as web-services.
  
  JMXConnector.
  
  Revision  Changes    Path
  1.1                  
contrib/jboss.net/src/main/org/jboss/net/jmx/MBeanInvocationHandler.java
  
  Index: MBeanInvocationHandler.java
  ===================================================================
  /*
   * JBoss, the OpenSource J2EE webOS
   *
   * Distributable under LGPL license.
   * See terms of license at gnu.org.
   */
  
  // $Id: MBeanInvocationHandler.java,v 1.1 2001/10/03 13:20:31 cgjung Exp $
  
  package org.jboss.net.jmx;
  
  import org.jboss.net.axis.AxisInvocationHandler;
  
  import javax.management.ObjectName;
  
  import org.apache.axis.client.ServiceClient;
  import org.apache.axis.AxisFault;
  import org.apache.axis.AxisEngine;
  
  import java.lang.reflect.InvocationHandler;
  import java.lang.reflect.Proxy;
  import java.lang.reflect.Method;
  
  import java.net.URL;
  import java.util.Map;
  
  /*
   * Helper class for dealing with remote JMX beans in typed or untyped ways.
   * @created  1. Oktober 2001, 18:22
   * @author <a href="mailto:[EMAIL PROTECTED]";>Christoph G. Jung</a>
   * @version $Revision: 1.1 $
   */
  
  public class MBeanInvocationHandler extends AxisInvocationHandler {
          
      /** Creates new MBeanInvocationHandler */
      public MBeanInvocationHandler(ServiceClient client, Map interfaceMap) {
          super(client,IDENTITY_MAP,interfaceMap);
      }
      
      /** Creates new MBeanInvocationHandler */
      public MBeanInvocationHandler(ServiceClient client) {
          super(client);
      }
      
      /** Creates new MBeanInvocationHandler pointing to a given url, using the given 
engine */
      public MBeanInvocationHandler(URL endpoint, AxisEngine engine, Map interfaceMap) 
throws AxisFault {
          super(endpoint,engine,IDENTITY_MAP,interfaceMap);
      }
  
      /** Creates new MBeanInvocationHandler pointing to a given url, using the given 
engine */
      public MBeanInvocationHandler(URL endpoint, AxisEngine engine) throws AxisFault {
          super(endpoint,engine);
      }
  
      /** Creates new MBeanInvocationHandler pointing to a given url, using the given 
engine */
      public MBeanInvocationHandler(URL endpoint, Map interfaceMap) throws AxisFault {
          super(endpoint,IDENTITY_MAP,interfaceMap);
      }
  
      /** Creates new MBeanInvocationHandler pointing to a given url, using the given 
engine */
      public MBeanInvocationHandler(URL endpoint) throws AxisFault {
          super(endpoint);
      }
  
      /** invocation using method signature */
      public Object invoke(String serviceName, String methodName, Object[] arguments, 
Class[] classes) 
          throws AxisFault {
              // convert classes to strings
              String[] classNames=new String[classes.length];
              for(int count=0;count<classes.length;count++)
                  classNames[count]=classes[count].getName();
              // we convert the parameter structure
              Object[] realArgs= arguments!=null ? new Object[arguments.length+1] : 
new Object[1];        
              realArgs[0]=classNames;
              if(arguments!=null)
                  System.arraycopy(arguments,0,realArgs,1,arguments.length);
              return invoke(serviceName,methodName,realArgs);
      }
          
       /** default creation of services */
      public static Object createMBeanService(Class _interface, URL endpoint) throws 
AxisFault {
          return createAxisService(_interface,new MBeanInvocationHandler(endpoint));
      }
      
      /** sample client program */
      public static void main(String[] args) throws Exception {
          MBeanInvocationHandler handler=new MBeanInvocationHandler(new URL(args[0]));
          System.out.println(handler.invoke("JMXConnector","getDefaultDomain",new 
Object[0],new Class[0]));
          System.out.println(handler.invoke("JMXConnector","isRegistered",new Object[] 
{new ObjectName("JBOSS-SYSTEM:service=Axis")},
          new Class[] {ObjectName.class}));
      }    
  }
  
  
  1.1                  contrib/jboss.net/src/main/org/jboss/net/jmx/package.html
  
  Index: package.html
  ===================================================================
  <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  
  <HTML>
    <HEAD>
      <TITLE>JBoss.net JMX package</TITLE>
    </HEAD>
    <BODY>
    This package hosts XML-interoperability code especially for the JMX-API.
    </BODY>
  </HTML>
  
  
  

_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to