axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject cvs commit: xml-axis/java/src/org/apache/axis/deployment/wsdd WSDDConstants.java WSDDProvider.java
Date Fri, 25 Oct 2002 17:18:35 GMT
dims        2002/10/25 10:18:35

  Modified:    java/src/org/apache/axis/deployment/wsdd/providers
                        WSDDBsfProvider.java WSDDComProvider.java
                        WSDDHandlerProvider.java WSDDJavaEJBProvider.java
                        WSDDJavaMsgProvider.java WSDDJavaRPCProvider.java
               java/src/org/apache/axis/deployment/wsdd WSDDConstants.java
                        WSDDProvider.java
  Log:
  Patch for Bug 13857 - There is no standard way to plug in providers
  from vishy@borland.com (Vishy Kasar)
  
  Revision  Changes    Path
  1.20      +6 -0      xml-axis/java/src/org/apache/axis/deployment/wsdd/providers/WSDDBsfProvider.java
  
  Index: WSDDBsfProvider.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/deployment/wsdd/providers/WSDDBsfProvider.java,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- WSDDBsfProvider.java	26 Jun 2002 18:19:08 -0000	1.19
  +++ WSDDBsfProvider.java	25 Oct 2002 17:18:34 -0000	1.20
  @@ -60,6 +60,8 @@
   import org.apache.axis.deployment.wsdd.WSDDService;
   import org.apache.axis.encoding.SerializationContext;
   import org.apache.axis.providers.BSFProvider;
  +import org.apache.axis.deployment.wsdd.WSDDConstants;
  +import org.apache.axis.deployment.wsdd.WSDDConstants;
   
   import java.io.IOException;
   
  @@ -70,6 +72,10 @@
   public class WSDDBsfProvider
       extends WSDDProvider
   {
  +    public String getName() {
  +        return WSDDConstants.PROVIDER_BSF;
  +    }
  +
       public Handler newProviderInstance(WSDDService service,
                                          EngineConfiguration registry)
           throws Exception
  
  
  
  1.20      +6 -0      xml-axis/java/src/org/apache/axis/deployment/wsdd/providers/WSDDComProvider.java
  
  Index: WSDDComProvider.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/deployment/wsdd/providers/WSDDComProvider.java,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- WSDDComProvider.java	26 Jun 2002 18:19:08 -0000	1.19
  +++ WSDDComProvider.java	25 Oct 2002 17:18:34 -0000	1.20
  @@ -61,6 +61,8 @@
   import org.apache.axis.providers.BasicProvider;
   import org.apache.axis.providers.ComProvider;
   import org.apache.axis.utils.ClassUtils;
  +import org.apache.axis.deployment.wsdd.WSDDConstants;
  +import org.apache.axis.deployment.wsdd.WSDDConstants;
   
   
   /**
  @@ -69,6 +71,10 @@
   public class WSDDComProvider
       extends WSDDProvider
   {
  +    public String getName() {
  +        return WSDDConstants.PROVIDER_COM;
  +    }
  +
       public Handler newProviderInstance(WSDDService service,
                                          EngineConfiguration registry)
           throws Exception
  
  
  
  1.11      +5 -0      xml-axis/java/src/org/apache/axis/deployment/wsdd/providers/WSDDHandlerProvider.java
  
  Index: WSDDHandlerProvider.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/deployment/wsdd/providers/WSDDHandlerProvider.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- WSDDHandlerProvider.java	18 Sep 2002 16:10:44 -0000	1.10
  +++ WSDDHandlerProvider.java	25 Oct 2002 17:18:34 -0000	1.11
  @@ -62,6 +62,7 @@
   import org.apache.axis.utils.ClassUtils;
   import org.apache.axis.utils.JavaUtils;
   import org.apache.axis.utils.Messages;
  +import org.apache.axis.deployment.wsdd.WSDDConstants;
   
   /**
    * This is a simple provider for using Handler-based services which don't
  @@ -72,6 +73,10 @@
   public class WSDDHandlerProvider
       extends WSDDProvider
   {
  +    public String getName() {
  +        return WSDDConstants.PROVIDER_HANDLER;
  +    }
  +
       public Handler newProviderInstance(WSDDService service,
                                          EngineConfiguration registry)
           throws Exception
  
  
  
  1.4       +4 -0      xml-axis/java/src/org/apache/axis/deployment/wsdd/providers/WSDDJavaEJBProvider.java
  
  Index: WSDDJavaEJBProvider.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/deployment/wsdd/providers/WSDDJavaEJBProvider.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- WSDDJavaEJBProvider.java	26 Jun 2002 18:19:08 -0000	1.3
  +++ WSDDJavaEJBProvider.java	25 Oct 2002 17:18:34 -0000	1.4
  @@ -58,6 +58,7 @@
   import org.apache.axis.Handler;
   import org.apache.axis.deployment.wsdd.WSDDProvider;
   import org.apache.axis.deployment.wsdd.WSDDService;
  +import org.apache.axis.deployment.wsdd.WSDDConstants;
   
   
   /**
  @@ -68,6 +69,9 @@
   public class WSDDJavaEJBProvider
       extends WSDDProvider
   {
  +    public String getName() {
  +        return WSDDConstants.PROVIDER_EJB;
  +    }
       /**
        *
        */
  
  
  
  1.4       +4 -0      xml-axis/java/src/org/apache/axis/deployment/wsdd/providers/WSDDJavaMsgProvider.java
  
  Index: WSDDJavaMsgProvider.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/deployment/wsdd/providers/WSDDJavaMsgProvider.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- WSDDJavaMsgProvider.java	26 Jun 2002 18:19:08 -0000	1.3
  +++ WSDDJavaMsgProvider.java	25 Oct 2002 17:18:34 -0000	1.4
  @@ -58,6 +58,7 @@
   import org.apache.axis.Handler;
   import org.apache.axis.deployment.wsdd.WSDDProvider;
   import org.apache.axis.deployment.wsdd.WSDDService;
  +import org.apache.axis.deployment.wsdd.WSDDConstants;
   
   
   /**
  @@ -66,6 +67,9 @@
   public class WSDDJavaMsgProvider
       extends WSDDProvider
   {
  +    public String getName() {
  +        return WSDDConstants.PROVIDER_MSG;
  +    }
       /**
        *
        */
  
  
  
  1.4       +4 -0      xml-axis/java/src/org/apache/axis/deployment/wsdd/providers/WSDDJavaRPCProvider.java
  
  Index: WSDDJavaRPCProvider.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/deployment/wsdd/providers/WSDDJavaRPCProvider.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- WSDDJavaRPCProvider.java	26 Jun 2002 18:19:08 -0000	1.3
  +++ WSDDJavaRPCProvider.java	25 Oct 2002 17:18:34 -0000	1.4
  @@ -58,6 +58,7 @@
   import org.apache.axis.Handler;
   import org.apache.axis.deployment.wsdd.WSDDProvider;
   import org.apache.axis.deployment.wsdd.WSDDService;
  +import org.apache.axis.deployment.wsdd.WSDDConstants;
   
   
   /**
  @@ -66,6 +67,9 @@
   public class WSDDJavaRPCProvider
       extends WSDDProvider
   {
  +    public String getName() {
  +        return WSDDConstants.PROVIDER_RPC;
  +    }
       /**
        *
        */
  
  
  
  1.26      +2 -0      xml-axis/java/src/org/apache/axis/deployment/wsdd/WSDDConstants.java
  
  Index: WSDDConstants.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/deployment/wsdd/WSDDConstants.java,v
  retrieving revision 1.25
  retrieving revision 1.26
  diff -u -r1.25 -r1.26
  --- WSDDConstants.java	9 Oct 2002 19:06:29 -0000	1.25
  +++ WSDDConstants.java	25 Oct 2002 17:18:35 -0000	1.26
  @@ -103,6 +103,8 @@
       public static final String PROVIDER_MSG = "MSG";
       public static final String PROVIDER_HANDLER = "Handler";
       public static final String PROVIDER_EJB = "EJB";
  +    public static final String PROVIDER_COM = "COM";
  +    public static final String PROVIDER_BSF = "BSF";
       
       public static final QName QNAME_JAVARPC_PROVIDER = new QName(URI_WSDD_JAVA, PROVIDER_RPC);
       public static final QName QNAME_JAVAMSG_PROVIDER = new QName(URI_WSDD_JAVA, PROVIDER_MSG);
  
  
  
  1.24      +59 -0     xml-axis/java/src/org/apache/axis/deployment/wsdd/WSDDProvider.java
  
  Index: WSDDProvider.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/deployment/wsdd/WSDDProvider.java,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- WSDDProvider.java	18 Sep 2002 16:10:39 -0000	1.23
  +++ WSDDProvider.java	25 Oct 2002 17:18:35 -0000	1.24
  @@ -56,6 +56,7 @@
   
   import org.apache.axis.EngineConfiguration;
   import org.apache.axis.Handler;
  +import org.apache.axis.components.logger.LogFactory;
   import org.apache.axis.deployment.wsdd.providers.WSDDHandlerProvider;
   import org.apache.axis.deployment.wsdd.providers.WSDDJavaEJBProvider;
   import org.apache.axis.deployment.wsdd.providers.WSDDJavaMsgProvider;
  @@ -66,6 +67,11 @@
   import javax.xml.namespace.QName;
   import java.util.Hashtable;
   
  +import org.apache.commons.discovery.resource.names.DiscoverServiceNames;
  +import org.apache.commons.discovery.ResourceNameIterator;
  +import org.apache.commons.discovery.resource.ClassLoaders;
  +import org.apache.commons.logging.Log;
  +
   
   /**
    * WSDD provider element
  @@ -77,11 +83,16 @@
    * by namespace URI.
    *
    * @author James Snell
  + * @author Vishy Kasar
    */
   public abstract class WSDDProvider
   {
  +    protected static Log log =
  +        LogFactory.getLog(WSDDProvider.class.getName());
   
   // ** STATIC PROVIDER REGISTRY ** //
  +    private static final String PLUGABLE_PROVIDER_FILENAME = 
  +       "org.apache.axis.deployment.wsdd.Provider";
   
       /** XXX */
       private static Hashtable providers = new Hashtable();
  @@ -91,6 +102,52 @@
           providers.put(WSDDConstants.QNAME_JAVAMSG_PROVIDER, new WSDDJavaMsgProvider());
           providers.put(WSDDConstants.QNAME_HANDLER_PROVIDER, new WSDDHandlerProvider());
           providers.put(WSDDConstants.QNAME_EJB_PROVIDER, new WSDDJavaEJBProvider());
  +        try {
  +            loadPluggableProviders();
  +        } catch (Throwable t){
  +            String msg=t + JavaUtils.LS + JavaUtils.stackToString(t);
  +            log.info(Messages.getMessage("exception01",msg));
  +        }
  +    }
  +
  +    /**
  +       Look for file META-INF/services/org.apache.axis.deployment.wsdd.Provider
  +       in all the JARS, get the classes listed in those files and add them to 
  +       providers list if they are valid providers. 
  +
  +       Here is how the scheme would work.
  +
  +       A company providing a new provider will jar up their provider related
  +       classes in a JAR file. The following file containing the name of the new 
  +       provider class is also made part of this JAR file. 
  +
  +       META-INF/services/org.apache.axis.deployment.wsdd.Provider
  +
  +       By making this JAR part of the webapp, the new provider will be 
  +       automatically discovered. 
  +    */
  +    private static void loadPluggableProviders() {
  +        ClassLoader clzLoader = WSDDProvider.class.getClassLoader();
  +        ClassLoaders loaders = new ClassLoaders();
  +        loaders.put(clzLoader);
  +        DiscoverServiceNames dsn = new DiscoverServiceNames(loaders);
  +        ResourceNameIterator iter = dsn.findResourceNames(PLUGABLE_PROVIDER_FILENAME);
  +        while (iter.hasNext()) {
  +            String className = (String) iter.nextResourceName();
  +            try {
  +                Object o = Class.forName(className).newInstance();
  +                if (o instanceof WSDDProvider) {
  +                    WSDDProvider provider = (WSDDProvider) o;
  +                    String providerName = provider.getName();
  +                    QName q = new QName(WSDDConstants.URI_WSDD_JAVA, providerName);
  +                    providers.put(q, provider);
  +                }
  +            } catch (Exception e) {
  +                String msg=e + JavaUtils.LS + JavaUtils.stackToString(e);
  +                log.info(Messages.getMessage("exception01",msg));
  +                continue;
  +            }
  +        }
       }
   
       /**
  @@ -154,4 +211,6 @@
       public abstract Handler newProviderInstance(WSDDService service,
                                                   EngineConfiguration registry)
           throws Exception;
  +
  +    public abstract String getName();
   }
  
  
  

Mime
View raw message