You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by pr...@apache.org on 2008/02/15 19:48:25 UTC

svn commit: r628145 - in /webservices/axis2/trunk/java/modules: jaxws/src/org/apache/axis2/jaxws/binding/ jaxws/src/org/apache/axis2/jaxws/client/config/ jaxws/src/org/apache/axis2/jaxws/feature/ jaxws/src/org/apache/axis2/jaxws/registry/ metadata/src/...

Author: pradine
Date: Fri Feb 15 10:48:23 2008
New Revision: 628145

URL: http://svn.apache.org/viewvc?rev=628145&view=rev
Log:
Make JAX-WS 2.1 feature configurators pluggable.

Added:
    webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/registry/ClientConfiguratorRegistry.java   (with props)
    webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/registry/
    webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/registry/ServerConfiguratorRegistry.java   (with props)
Modified:
    webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/binding/BindingImpl.java
    webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/binding/SOAPBinding.java
    webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/config/AddressingConfigurator.java
    webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/config/MTOMConfigurator.java
    webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/config/RespectBindingConfigurator.java
    webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/feature/ClientConfigurator.java
    webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/ClientConfigurationFactory.java
    webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/EndpointDescriptionImpl.java
    webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/feature/ServerConfigurator.java
    webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/server/config/AddressingConfigurator.java
    webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/server/config/MTOMConfigurator.java
    webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/server/config/RespectBindingConfigurator.java

Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/binding/BindingImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/binding/BindingImpl.java?rev=628145&r1=628144&r2=628145&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/binding/BindingImpl.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/binding/BindingImpl.java Fri Feb 15 10:48:23 2008
@@ -22,16 +22,15 @@
 import java.util.List;
 import java.util.Set;
 
-import javax.xml.ws.RespectBindingFeature;
 import javax.xml.ws.WebServiceFeature;
 import javax.xml.ws.handler.Handler;
 
-import org.apache.axis2.jaxws.client.config.RespectBindingConfigurator;
 import org.apache.axis2.jaxws.core.MessageContext;
 import org.apache.axis2.jaxws.description.EndpointDescription;
 import org.apache.axis2.jaxws.feature.ClientConfigurator;
 import org.apache.axis2.jaxws.feature.ClientFramework;
 import org.apache.axis2.jaxws.handler.HandlerResolverImpl;
+import org.apache.axis2.jaxws.registry.ClientConfiguratorRegistry;
 import org.apache.axis2.jaxws.spi.Binding;
 import org.apache.axis2.jaxws.spi.BindingProvider;
 
@@ -40,19 +39,16 @@
  * should extend this class instead.
  */
 public abstract class BindingImpl implements Binding {
-    private static final ClientConfigurator RESPECT_BINDING_CONFIGURATOR =
-        new RespectBindingConfigurator();
-
     // an unsorted list of handlers
-    private List<Handler> handlers = null;
-
-    protected String bindingId = null;
+    private List<Handler> handlers;
 
     private EndpointDescription endpointDesc;
-
-    protected Set<String> roles = null;
     
-    protected ClientFramework framework = null;
+    private ClientFramework framework = new ClientFramework();
+
+    protected String bindingId;
+
+    protected Set<String> roles;
 
     protected static final String SOAP11_ENV_NS = "http://schemas.xmlsoap.org/soap/envelope/";
 
@@ -67,8 +63,14 @@
             this.bindingId = endpointDesc.getBindingType();
         }
         
-        framework = new ClientFramework();
-        framework.addConfigurator(RespectBindingFeature.ID, RESPECT_BINDING_CONFIGURATOR);
+        Set<String> ids = ClientConfiguratorRegistry.getIds();
+        
+        for (String id : ids) {
+            ClientConfigurator configurator = ClientConfiguratorRegistry.getConfigurator(id);
+            
+            if (configurator.supports(this))
+                framework.addConfigurator(id, configurator);
+        }
     }
 
     public List<Handler> getHandlerChain() {

Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/binding/SOAPBinding.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/binding/SOAPBinding.java?rev=628145&r1=628144&r2=628145&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/binding/SOAPBinding.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/binding/SOAPBinding.java Fri Feb 15 10:48:23 2008
@@ -19,11 +19,7 @@
 package org.apache.axis2.jaxws.binding;
 
 import org.apache.axis2.jaxws.ExceptionFactory;
-import org.apache.axis2.jaxws.addressing.SubmissionAddressingFeature;
-import org.apache.axis2.jaxws.client.config.AddressingConfigurator;
-import org.apache.axis2.jaxws.client.config.MTOMConfigurator;
 import org.apache.axis2.jaxws.description.EndpointDescription;
-import org.apache.axis2.jaxws.feature.ClientConfigurator;
 import org.apache.axis2.jaxws.i18n.Messages;
 import org.apache.axis2.jaxws.utility.SAAJFactory;
 import org.apache.commons.logging.Log;
@@ -34,8 +30,6 @@
 import javax.xml.soap.SOAPException;
 import javax.xml.soap.SOAPFactory;
 import javax.xml.ws.WebServiceException;
-import javax.xml.ws.soap.AddressingFeature;
-import javax.xml.ws.soap.MTOMFeature;
 
 import java.util.HashSet;
 import java.util.Set;
@@ -47,21 +41,12 @@
  * explicitly specificied.
  */
 public class SOAPBinding extends BindingImpl implements javax.xml.ws.soap.SOAPBinding {
-    private static final ClientConfigurator ADDRESSING_CONFIGURATOR =
-        new AddressingConfigurator();
-    private static final ClientConfigurator MTOM_CONFIGURATOR =
-        new MTOMConfigurator();
-
     private boolean mtomEnabled = false;
 
     private static Log log = LogFactory.getLog(SOAPBinding.class);
 
     public SOAPBinding(EndpointDescription endpointDesc) {
         super(endpointDesc);
-        
-        framework.addConfigurator(AddressingFeature.ID, ADDRESSING_CONFIGURATOR);
-        framework.addConfigurator(SubmissionAddressingFeature.ID, ADDRESSING_CONFIGURATOR);
-        framework.addConfigurator(MTOMFeature.ID, MTOM_CONFIGURATOR);
     }
 
     /*

Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/config/AddressingConfigurator.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/config/AddressingConfigurator.java?rev=628145&r1=628144&r2=628145&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/config/AddressingConfigurator.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/config/AddressingConfigurator.java Fri Feb 15 10:48:23 2008
@@ -28,6 +28,7 @@
 import org.apache.axis2.engine.AxisConfiguration;
 import org.apache.axis2.jaxws.ExceptionFactory;
 import org.apache.axis2.jaxws.addressing.SubmissionAddressingFeature;
+import org.apache.axis2.jaxws.binding.SOAPBinding;
 import org.apache.axis2.jaxws.core.MessageContext;
 import org.apache.axis2.jaxws.description.ServiceDescription;
 import org.apache.axis2.jaxws.feature.ClientConfigurator;
@@ -143,5 +144,13 @@
 
         messageContext.setProperty(AddressingConstants.WS_ADDRESSING_VERSION, addressingNamespace);                        
         messageContext.setProperty(AddressingConstants.DISABLE_ADDRESSING_FOR_OUT_MESSAGES, disableAddressing);
+    }
+
+    /*
+     *  (non-Javadoc)
+     * @see org.apache.axis2.jaxws.feature.ClientConfigurator#supports(org.apache.axis2.jaxws.spi.Binding)
+     */
+    public boolean supports(Binding binding) {
+        return binding instanceof SOAPBinding;
     }
 }

Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/config/MTOMConfigurator.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/config/MTOMConfigurator.java?rev=628145&r1=628144&r2=628145&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/config/MTOMConfigurator.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/config/MTOMConfigurator.java Fri Feb 15 10:48:23 2008
@@ -26,6 +26,7 @@
 import javax.xml.ws.soap.MTOMFeature;
 
 import org.apache.axis2.jaxws.ExceptionFactory;
+import org.apache.axis2.jaxws.binding.SOAPBinding;
 import org.apache.axis2.jaxws.core.MessageContext;
 import org.apache.axis2.jaxws.feature.ClientConfigurator;
 import org.apache.axis2.jaxws.message.Message;
@@ -109,5 +110,13 @@
                 log.debug("The MTOMFeature was found, but not enabled.");
             }
         }
+    }
+
+    /*
+     *  (non-Javadoc)
+     * @see org.apache.axis2.jaxws.feature.ClientConfigurator#supports(org.apache.axis2.jaxws.spi.Binding)
+     */
+    public boolean supports(Binding binding) {
+        return binding instanceof SOAPBinding;
     }
 }

Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/config/RespectBindingConfigurator.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/config/RespectBindingConfigurator.java?rev=628145&r1=628144&r2=628145&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/config/RespectBindingConfigurator.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/config/RespectBindingConfigurator.java Fri Feb 15 10:48:23 2008
@@ -47,4 +47,12 @@
             //TODO Implementation required.
         }
     }
+
+    /*
+     *  (non-Javadoc)
+     * @see org.apache.axis2.jaxws.feature.ClientConfigurator#supports(org.apache.axis2.jaxws.spi.Binding)
+     */
+    public boolean supports(Binding binding) {
+        return true;
+    }
 }

Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/feature/ClientConfigurator.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/feature/ClientConfigurator.java?rev=628145&r1=628144&r2=628145&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/feature/ClientConfigurator.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/feature/ClientConfigurator.java Fri Feb 15 10:48:23 2008
@@ -19,6 +19,7 @@
 package org.apache.axis2.jaxws.feature;
 
 import org.apache.axis2.jaxws.core.MessageContext;
+import org.apache.axis2.jaxws.spi.Binding;
 import org.apache.axis2.jaxws.spi.BindingProvider;
 
 /**
@@ -32,4 +33,13 @@
      * @param provider
      */
     public void configure(MessageContext messageContext, BindingProvider provider);
+    
+    /**
+     * Indicates whether the configurator supports the specified binding.
+     * 
+     * @param binding the binding to test
+     * @return <code>true</code> if the configurator supports the binding, <code>false</code>
+     * otherwise.
+     */
+    public boolean supports(Binding binding);
 }

Added: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/registry/ClientConfiguratorRegistry.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/registry/ClientConfiguratorRegistry.java?rev=628145&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/registry/ClientConfiguratorRegistry.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/registry/ClientConfiguratorRegistry.java Fri Feb 15 10:48:23 2008
@@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.axis2.jaxws.registry;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+
+import javax.xml.ws.RespectBindingFeature;
+import javax.xml.ws.soap.AddressingFeature;
+import javax.xml.ws.soap.MTOMFeature;
+
+import org.apache.axis2.jaxws.addressing.SubmissionAddressingFeature;
+import org.apache.axis2.jaxws.client.config.AddressingConfigurator;
+import org.apache.axis2.jaxws.client.config.MTOMConfigurator;
+import org.apache.axis2.jaxws.client.config.RespectBindingConfigurator;
+import org.apache.axis2.jaxws.feature.ClientConfigurator;
+
+public class ClientConfiguratorRegistry {
+    private static Map<String, ClientConfigurator> map =
+        new HashMap<String, ClientConfigurator>();
+    
+    static {
+        map.put(AddressingFeature.ID, new AddressingConfigurator());
+        map.put(SubmissionAddressingFeature.ID, new AddressingConfigurator());
+        map.put(MTOMFeature.ID, new MTOMConfigurator());
+        map.put(RespectBindingFeature.ID, new RespectBindingConfigurator());
+    }
+    
+    public static void setConfigurator(String id, ClientConfigurator configurator) {
+        map.put(id, configurator);
+    }
+    
+    public static ClientConfigurator getConfigurator(String id) {
+        return map.get(id);
+    }
+    
+    public static Set<String> getIds() {
+        return map.keySet();
+    }
+}

Propchange: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/registry/ClientConfiguratorRegistry.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/ClientConfigurationFactory.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/ClientConfigurationFactory.java?rev=628145&r1=628144&r2=628145&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/ClientConfigurationFactory.java (original)
+++ webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/ClientConfigurationFactory.java Fri Feb 15 10:48:23 2008
@@ -81,13 +81,13 @@
         }
         
         // If they are not specified, create a default one from the axis2_default.xml inside the kernel jar.
-        if (repoPath == null && axisConfigPath == null) {
-            try {
-                configContext = ConfigurationContextFactory.createDefaultConfigurationContext();
-            } catch (Exception e) {
-                throw ExceptionFactory.makeWebServiceException(Messages.getMessage("clientConfigCtxtErr", e.getMessage()));
-            }
-        }
+//        if (repoPath == null && axisConfigPath == null) {
+//            try {
+//                configContext = ConfigurationContextFactory.createDefaultConfigurationContext();
+//            } catch (Exception e) {
+//                throw ExceptionFactory.makeWebServiceException(Messages.getMessage("clientConfigCtxtErr", e.getMessage()));
+//            }
+//        }
         
         // Try the file system with the specified system properties.
         try {

Modified: webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/EndpointDescriptionImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/EndpointDescriptionImpl.java?rev=628145&r1=628144&r2=628145&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/EndpointDescriptionImpl.java (original)
+++ webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/EndpointDescriptionImpl.java Fri Feb 15 10:48:23 2008
@@ -31,7 +31,6 @@
 import org.apache.axis2.engine.AxisConfiguration;
 import org.apache.axis2.java.security.AccessController;
 import org.apache.axis2.jaxws.ExceptionFactory;
-import org.apache.axis2.jaxws.addressing.SubmissionAddressingFeature;
 import org.apache.axis2.jaxws.description.EndpointDescription;
 import org.apache.axis2.jaxws.description.EndpointDescriptionJava;
 import org.apache.axis2.jaxws.description.EndpointDescriptionWSDL;
@@ -47,9 +46,7 @@
 import org.apache.axis2.jaxws.feature.ServerConfigurator;
 import org.apache.axis2.jaxws.feature.ServerFramework;
 import org.apache.axis2.jaxws.i18n.Messages;
-import org.apache.axis2.jaxws.server.config.AddressingConfigurator;
-import org.apache.axis2.jaxws.server.config.MTOMConfigurator;
-import org.apache.axis2.jaxws.server.config.RespectBindingConfigurator;
+import org.apache.axis2.jaxws.registry.ServerConfiguratorRegistry;
 import org.apache.axis2.jaxws.util.WSDL4JWrapper;
 import org.apache.axis2.wsdl.util.WSDLDefinitionWrapper;
 import org.apache.commons.logging.Log;
@@ -67,13 +64,10 @@
 import javax.wsdl.extensions.soap12.SOAP12Binding;
 import javax.xml.namespace.QName;
 import javax.xml.ws.BindingType;
-import javax.xml.ws.RespectBindingFeature;
 import javax.xml.ws.Service;
 import javax.xml.ws.ServiceMode;
 import javax.xml.ws.WebServiceProvider;
 import javax.xml.ws.handler.PortInfo;
-import javax.xml.ws.soap.AddressingFeature;
-import javax.xml.ws.soap.MTOMFeature;
 import javax.xml.ws.soap.SOAPBinding;
 import java.io.InputStream;
 import java.lang.annotation.Annotation;
@@ -86,6 +80,7 @@
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
+import java.util.Set;
 import java.util.TreeSet;
 
 /** @see ../EndpointDescription */
@@ -97,13 +92,6 @@
  */
 class EndpointDescriptionImpl
         implements EndpointDescription, EndpointDescriptionJava, EndpointDescriptionWSDL {
-    private static final ServerConfigurator RESPECT_BINDING_CONFIGURATOR =
-        new RespectBindingConfigurator();
-    private static final ServerConfigurator ADDRESSING_CONFIGURATOR =
-        new AddressingConfigurator();
-    private static final ServerConfigurator MTOM_CONFIGURATOR =
-        new MTOMConfigurator();
-
     private ServiceDescriptionImpl parentServiceDescription;
     private AxisService axisService;
 
@@ -1431,15 +1419,15 @@
     //configuration can be overridden. Should only be called on the
     //server side.
     private void configureWebServiceFeatures() {
-    	framework.addConfigurator(RespectBindingFeature.ID, RESPECT_BINDING_CONFIGURATOR);
-    	
-    	String binding = getBindingType();
-    	
-    	if (isSOAPBinding(binding)) {
-    		framework.addConfigurator(AddressingFeature.ID, ADDRESSING_CONFIGURATOR);
-    		framework.addConfigurator(SubmissionAddressingFeature.ID, ADDRESSING_CONFIGURATOR);
-    		framework.addConfigurator(MTOMFeature.ID, MTOM_CONFIGURATOR);
-    	}
+        String bindingType = getBindingType();
+        Set<String> ids = ServerConfiguratorRegistry.getIds();
+        
+        for (String id : ids) {
+            ServerConfigurator configurator = ServerConfiguratorRegistry.getConfigurator(id);
+            
+            if (configurator.supports(bindingType))
+                framework.addConfigurator(id, configurator);
+        }
     	
         // The feature instances are stored on the composite from either the 
         // Java class or from something else building the list and setting it there.
@@ -1585,16 +1573,6 @@
             throw ExceptionFactory.makeWebServiceException(
                     Messages.getMessage("addPortErr0", getPortQName().toString()));
         }
-    }
-    
-    public static boolean isSOAPBinding(String url) {
-        if (url != null && (url.equals(SOAPBinding.SOAP11HTTP_BINDING) ||
-                url.equals(SOAPBinding.SOAP11HTTP_MTOM_BINDING) ||
-                url.equals(SOAPBinding.SOAP12HTTP_BINDING)|| 
-                url.equals(SOAPBinding.SOAP12HTTP_MTOM_BINDING))) {
-            return true;
-        }
-        return false;
     }
 
     private boolean validateClientBindingID(String bindingId) {

Modified: webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/feature/ServerConfigurator.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/feature/ServerConfigurator.java?rev=628145&r1=628144&r2=628145&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/feature/ServerConfigurator.java (original)
+++ webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/feature/ServerConfigurator.java Fri Feb 15 10:48:23 2008
@@ -30,4 +30,13 @@
      * @param endpointDescription
      */
     public void configure(EndpointDescription endpointDescription);
+    
+    /**
+     * Indicates whether the configurator supports the specified binding.
+     * 
+     * @param bindingId the binding id to test
+     * @return <code>true</code> if the configurator supports the binding id, <code>false</code>
+     * otherwise.
+     */
+    public boolean supports(String bindingId);
 }

Added: webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/registry/ServerConfiguratorRegistry.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/registry/ServerConfiguratorRegistry.java?rev=628145&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/registry/ServerConfiguratorRegistry.java (added)
+++ webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/registry/ServerConfiguratorRegistry.java Fri Feb 15 10:48:23 2008
@@ -0,0 +1,73 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.axis2.jaxws.registry;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+
+import javax.xml.ws.RespectBindingFeature;
+import javax.xml.ws.soap.AddressingFeature;
+import javax.xml.ws.soap.MTOMFeature;
+import javax.xml.ws.soap.SOAPBinding;
+
+import org.apache.axis2.jaxws.addressing.SubmissionAddressingFeature;
+import org.apache.axis2.jaxws.server.config.AddressingConfigurator;
+import org.apache.axis2.jaxws.server.config.MTOMConfigurator;
+import org.apache.axis2.jaxws.server.config.RespectBindingConfigurator;
+import org.apache.axis2.jaxws.description.builder.MDQConstants;
+import org.apache.axis2.jaxws.feature.ServerConfigurator;
+
+public class ServerConfiguratorRegistry {
+    private static Map<String, ServerConfigurator> map =
+        new HashMap<String, ServerConfigurator>();
+    
+    static {
+        map.put(AddressingFeature.ID, new AddressingConfigurator());
+        map.put(SubmissionAddressingFeature.ID, new AddressingConfigurator());
+        map.put(MTOMFeature.ID, new MTOMConfigurator());
+        map.put(RespectBindingFeature.ID, new RespectBindingConfigurator());
+    }
+    
+    public static void setConfigurator(String id, ServerConfigurator configurator) {
+        map.put(id, configurator);
+    }
+    
+    public static ServerConfigurator getConfigurator(String id) {
+        return map.get(id);
+    }
+    
+    public static Set<String> getIds() {
+        return map.keySet();
+    }
+    
+    public static boolean isSOAPBinding(String url) {
+        if (url != null && (url.equals(SOAPBinding.SOAP11HTTP_BINDING) ||
+                url.equals(SOAPBinding.SOAP11HTTP_MTOM_BINDING) ||
+                url.equals(SOAPBinding.SOAP12HTTP_BINDING)|| 
+                url.equals(SOAPBinding.SOAP12HTTP_MTOM_BINDING) ||
+                url.equals(MDQConstants.SOAP11JMS_BINDING) ||
+                url.equals(MDQConstants.SOAP11JMS_MTOM_BINDING) ||
+                url.equals(MDQConstants.SOAP12JMS_BINDING) ||
+                url.equals(MDQConstants.SOAP12JMS_MTOM_BINDING) )) {
+            return true;
+        }
+        return false;
+    }
+}

Propchange: webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/registry/ServerConfiguratorRegistry.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/server/config/AddressingConfigurator.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/server/config/AddressingConfigurator.java?rev=628145&r1=628144&r2=628145&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/server/config/AddressingConfigurator.java (original)
+++ webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/server/config/AddressingConfigurator.java Fri Feb 15 10:48:23 2008
@@ -34,6 +34,7 @@
 import org.apache.axis2.jaxws.description.EndpointDescriptionJava;
 import org.apache.axis2.jaxws.description.ServiceDescription;
 import org.apache.axis2.jaxws.feature.ServerConfigurator;
+import org.apache.axis2.jaxws.registry.ServerConfiguratorRegistry;
 
 /**
  *
@@ -135,5 +136,13 @@
             //TODO NLS enable.
             throw ExceptionFactory.makeWebServiceException("Unable to engage the addressing module.", e);    		
     	}
+    }
+
+    /*
+     *  (non-Javadoc)
+     * @see org.apache.axis2.jaxws.feature.ServerConfigurator#supports(java.lang.String)
+     */
+    public boolean supports(String bindingId) {
+        return ServerConfiguratorRegistry.isSOAPBinding(bindingId);
     }
 }

Modified: webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/server/config/MTOMConfigurator.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/server/config/MTOMConfigurator.java?rev=628145&r1=628144&r2=628145&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/server/config/MTOMConfigurator.java (original)
+++ webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/server/config/MTOMConfigurator.java Fri Feb 15 10:48:23 2008
@@ -28,6 +28,7 @@
 import org.apache.axis2.jaxws.description.EndpointDescription;
 import org.apache.axis2.jaxws.description.EndpointDescriptionJava;
 import org.apache.axis2.jaxws.feature.ServerConfigurator;
+import org.apache.axis2.jaxws.registry.ServerConfiguratorRegistry;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
@@ -80,4 +81,12 @@
             throw ExceptionFactory.makeWebServiceException("Unable to enable MTOM.", e);    		
     	}
     }    
+
+    /*
+     *  (non-Javadoc)
+     * @see org.apache.axis2.jaxws.feature.ServerConfigurator#supports(java.lang.String)
+     */
+    public boolean supports(String bindingId) {
+        return ServerConfiguratorRegistry.isSOAPBinding(bindingId);
+    }
 }

Modified: webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/server/config/RespectBindingConfigurator.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/server/config/RespectBindingConfigurator.java?rev=628145&r1=628144&r2=628145&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/server/config/RespectBindingConfigurator.java (original)
+++ webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/server/config/RespectBindingConfigurator.java Fri Feb 15 10:48:23 2008
@@ -40,4 +40,12 @@
     		(RespectBinding) ((EndpointDescriptionJava) endpointDescription).getAnnoFeature(RespectBindingFeature.ID);
     	AxisService service = endpointDescription.getAxisService();
     }
+
+    /*
+     *  (non-Javadoc)
+     * @see org.apache.axis2.jaxws.feature.ServerConfigurator#supports(java.lang.String)
+     */
+    public boolean supports(String bindingId) {
+        return true;
+    }
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org