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

  Modified:    jboss.net/src/main/org/jboss/net/axis
                        XMLResourceProvider.java
  Added:       jboss.net/src/main/org/jboss/net/axis
                        AxisInvocationHandler.java package.html
  Removed:     jboss.net/src/main/org/jboss/net/axis AxisService.java
                        AxisServiceMBean.java AxisServiceServlet.java
                        ClassLoaderAwareAxisServer.java
                        ClassLoaderAwareMessageContext.java Constants.java
                        DefaultResourceBundle.java
  Log:
  restructured server/client parts, invocationhandler support.
  
  MBeanProvider for exposing MBeans as web-services.
  
  JMXConnector.
  
  Revision  Changes    Path
  1.2       +9 -10     
contrib/jboss.net/src/main/org/jboss/net/axis/XMLResourceProvider.java
  
  Index: XMLResourceProvider.java
  ===================================================================
  RCS file: 
/cvsroot/jboss/contrib/jboss.net/src/main/org/jboss/net/axis/XMLResourceProvider.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- XMLResourceProvider.java  2001/09/29 16:17:07     1.1
  +++ XMLResourceProvider.java  2001/10/03 13:20:31     1.2
  @@ -1,16 +1,14 @@
   /*
  - * jBoss, the OpenSource EJB server
  - *
  - * Distributable under LGPL license.
  - * See terms of license at gnu.org.
  - */
  +* JBoss, the OpenSource J2EE webOS
  +*
  +* Distributable under LGPL license.
  +* See terms of license at gnu.org.
  +*/
   
  -// $Id: XMLResourceProvider.java,v 1.1 2001/09/29 16:17:07 cgjung Exp $
  +// $Id: XMLResourceProvider.java,v 1.2 2001/10/03 13:20:31 cgjung Exp $
   
   package org.jboss.net.axis;
   
  -import java.io.*;
  -import java.util.*;
   import org.apache.axis.ConfigurationProvider;
   import org.apache.axis.AxisEngine;
   import org.apache.axis.utils.Admin;
  @@ -19,12 +17,13 @@
   import org.w3c.dom.Document;
   
   import java.net.URL;
  +import java.io.InputStreamReader;
   
   /**
    * A ConfigurationProvider that accesses an immutable XML file given as a URL.
  - * @date 28. September 2001
    * @author <a href="mailto:[EMAIL PROTECTED]";>Christoph G. Jung</a>
  - * @version $Revision: 1.1 $
  + * @created 28. September 2001
  + * @version $Revision: 1.2 $
    */
   
   public class XMLResourceProvider implements ConfigurationProvider {
  
  
  
  1.1                  
contrib/jboss.net/src/main/org/jboss/net/axis/AxisInvocationHandler.java
  
  Index: AxisInvocationHandler.java
  ===================================================================
  /*
  * JBoss, the OpenSource J2EE webOS
  *
  * Distributable under LGPL license.
  * See terms of license at gnu.org.
  */
  
  // $Id: AxisInvocationHandler.java,v 1.1 2001/10/03 13:20:31 cgjung Exp $
  
  package org.jboss.net.axis;
  
  import org.apache.axis.client.ServiceClient;
  import org.apache.axis.AxisEngine;
  import org.apache.axis.AxisFault;
  
  import java.lang.reflect.InvocationHandler;
  import java.lang.reflect.Method;
  import java.lang.reflect.Proxy;
  
  import java.util.Map;
  import java.net.URL;
  
  /**
   * An invocation handler that allows typed client access to
   * remote SOAP/Axis services.
   * @created  1. Oktober 2001, 09:29
   * @author <a href="mailto:[EMAIL PROTECTED]";>Christoph G. Jung</a>
   * @version $Revision: 1.1 $
   */
  
  public class AxisInvocationHandler implements InvocationHandler {
      
      /** mapping of interface names to namespaces */
      final protected Map interfaceToNameSpace;
      /** mapping of methods to method names */
      final protected Map methodToName;
      /** the "session" management underneath */
      final protected ServiceClient serviceClient;
      
      /** Creates new AxisInvocationHandler */
      public AxisInvocationHandler(ServiceClient client, Map methodMap, Map 
interfaceMap) {
          this.serviceClient=client;
          this.interfaceToNameSpace=interfaceMap;
          this.methodToName=methodMap;
      }
  
      /** Creates new AxisInvocationHandler */
      public AxisInvocationHandler(ServiceClient client, Map methodMap) {
          this(client,methodMap,IDENTITY_MAP);
      }
      
      /** Creates new AxisInvocationHandler */
      public AxisInvocationHandler(ServiceClient client) {
          this(client,IDENTITY_MAP);
      }
      
      /** Creates new AxisInvocationHandler pointing to a given url, using the given 
engine */
      public AxisInvocationHandler(URL endpoint, AxisEngine engine, Map methodMap, Map 
interfaceMap) throws AxisFault {
          this(new ServiceClient(endpoint.toString(),engine),methodMap,interfaceMap);
      }
  
      /** Creates new AxisInvocationHandler pointing to a given url, using the given 
engine */
      public AxisInvocationHandler(URL endpoint, AxisEngine engine, Map methodMap) 
throws AxisFault {
          this(endpoint,engine,methodMap, IDENTITY_MAP);
      }
  
      /** Creates new AxisInvocationHandler pointing to a given url, using the given 
engine */
      public AxisInvocationHandler(URL endpoint, AxisEngine engine) throws AxisFault {
          this(endpoint,engine,IDENTITY_MAP);
      }
  
      /** Creates new AxisInvocationHandler pointing to a given url, using the given 
engine */
      public AxisInvocationHandler(URL endpoint, Map methodMap, Map interfaceMap) 
throws AxisFault {
          this(new ServiceClient(endpoint.toString()),methodMap,interfaceMap);
      }
  
      /** Creates new AxisInvocationHandler pointing to a given url, using the given 
engine */
      public AxisInvocationHandler(URL endpoint, Map methodMap) throws AxisFault {
          this(endpoint,methodMap,IDENTITY_MAP);
      }
  
      /** Creates new AxisInvocationHandler pointing to a given url */
      public AxisInvocationHandler(URL endpoint) throws AxisFault {
          this(endpoint,IDENTITY_MAP);
      }
     
      /** invoke given namespace+method+args */
      public Object invoke(String serviceName, String methodName, Object[] args) 
throws AxisFault {
          return serviceClient.invoke(serviceName,methodName,args);
      }
  
      /** invoke with additional method parameter signature */
      public Object invoke(String serviceName, String methodName, Object[] args, 
Class[] parameters) throws AxisFault {
          // ignored
          return invoke(serviceName,methodName,args);
      }
      
      /** generic invocation method */
      public java.lang.Object invoke(java.lang.Object target, 
              java.lang.reflect.Method method, java.lang.Object[] args) 
                  throws java.lang.Throwable {
              return invoke((String) 
interfaceToNameSpace.get(method.getDeclaringClass()),
                  (String) methodToName.get(method), args,method.getParameterTypes());
      }
      
      /** default creation of services */
      public static Object createAxisService(Class _interface, URL endpoint) throws 
AxisFault {
          return createAxisService(_interface,new AxisInvocationHandler(endpoint));
      }
  
      /** default creation of services */
      public static Object createAxisService(Class _interface, AxisInvocationHandler 
handler) throws AxisFault {
          return Proxy.newProxyInstance(_interface.getClassLoader(),new Class[] 
{_interface},handler);
      }
  
      /** a tiny helper map that does some default mapping of class and
       *  method names to namespaces and tag names 
       */
      
      static class IdentityMap implements Map {
          
          public java.lang.Object put(java.lang.Object obj, java.lang.Object obj1) {
              return null;
          }
          
          public java.lang.Object remove(java.lang.Object obj) {
              return null;
          }
          
          public java.util.Set keySet() {
              return null;
          }
          
          public void clear() {
          }
          
          public java.util.Collection values() {
              return null;
          }
                  
          public boolean containsKey(java.lang.Object obj) {
              return true;
          }
          
          public int size() {
              return 0;
          }
          
          public java.util.Set entrySet() {
              return null;
          }
          
          public boolean containsValue(java.lang.Object obj) {
              return true;
          }
          
          public void putAll(java.util.Map map) {
          }
          
          public boolean isEmpty() {
              return false;
          }
          
          public java.lang.Object get(java.lang.Object obj) {
              if(obj instanceof Class) {
                  String result=((Class) obj).getName();
                  if(result.indexOf(".")!=-1)
                      result=result.substring(result.lastIndexOf(".")+1);
                  return result;
              } else if(obj instanceof Method) {
                  return ((Method) obj).getName();
              } else
                  return obj;
          }        
      }
      
      /** its a flyweight */
      protected static final Map IDENTITY_MAP=new IdentityMap();
          
      /** demo client */
      public static void main(String[] args) throws Exception {
          // test fully untyped access
          AxisInvocationHandler handler=new AxisInvocationHandler(new URL(args[0]));
          System.out.println(handler.invoke("JMXConnector","getDefaultDomain",new 
Object[0]));
      }
  }
  
  
  1.1                  contrib/jboss.net/src/main/org/jboss/net/axis/package.html
  
  Index: package.html
  ===================================================================
  <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  
  <HTML>
    <HEAD>
      <TITLE>Axis package</TITLE>
    </HEAD>
    <BODY>
    This package contains server- as well as client-side glue code to integrate the 
Axis
    project into JBoss.
    </BODY>
  </HTML>
  
  
  

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

Reply via email to