axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ngalla...@apache.org
Subject svn commit: r636473 - in /webservices/axis2/trunk/java/modules/metadata: src/org/apache/axis2/jaxws/description/ src/org/apache/axis2/jaxws/description/impl/ src/org/apache/axis2/jaxws/feature/ src/org/apache/axis2/jaxws/server/config/ test/org/apache/...
Date Wed, 12 Mar 2008 19:26:56 GMT
Author: ngallardo
Date: Wed Mar 12 12:26:53 2008
New Revision: 636473

URL: http://svn.apache.org/viewvc?rev=636473&view=rev
Log:
AXIS2-3449, some initial support for @RespectBinding on the server side.

Added:
    webservices/axis2/trunk/java/modules/metadata/test/org/apache/axis2/jaxws/description/feature/RespectBindingFeatureTests.java
Modified:
    webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/EndpointDescription.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/ServerFramework.java
    webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/server/config/RespectBindingConfigurator.java

Modified: webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/EndpointDescription.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/EndpointDescription.java?rev=636473&r1=636472&r2=636473&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/EndpointDescription.java
(original)
+++ webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/EndpointDescription.java
Wed Mar 12 12:26:53 2008
@@ -172,6 +172,18 @@
      */
     public int getMTOMThreshold();
     
+    /**
+     * Returns true if the contents of the <code>&lt;wsdl:binding&gt;</code>
must be 
+     * strictly respected by the runtime.
+     * 
+     * @return a boolean value
+     */
+    public boolean respectBinding();
+    
+    /**
+     * Indicate whether or not strict binding support should be used.
+     */
+    public void setRespectBinding(boolean respect);
     
     /**
      * Return the DescriptionBuilderComposite, if any, used to build this service description.

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=636473&r1=636472&r2=636473&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
Wed Mar 12 12:26:53 2008
@@ -172,6 +172,9 @@
     public static final String BindingType_DEFAULT =
             javax.xml.ws.soap.SOAPBinding.SOAP11HTTP_BINDING;
     
+    // ANNOTATION: @RespectBinding
+    private boolean respectBinding = true;
+    
     private List<CustomAnnotationInstance> customAnnotations;
     
     private Map<String, CustomAnnotationProcessor> customAnnotationProcessors;
@@ -1463,6 +1466,18 @@
         }
         
         return false;
+    }
+    
+    // ===========================================
+    // ANNOTATION: MTOM
+    // ===========================================
+    
+    public boolean respectBinding() {
+        return respectBinding;
+    }
+    
+    public void setRespectBinding(boolean r) {
+        respectBinding = r;
     }
     
     /*

Modified: webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/feature/ServerFramework.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/feature/ServerFramework.java?rev=636473&r1=636472&r2=636473&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/feature/ServerFramework.java
(original)
+++ webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/feature/ServerFramework.java
Wed Mar 12 12:26:53 2008
@@ -20,6 +20,8 @@
 
 import org.apache.axis2.jaxws.ExceptionFactory;
 import org.apache.axis2.jaxws.description.EndpointDescription;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 
 import javax.xml.ws.spi.WebServiceFeatureAnnotation;
 
@@ -28,6 +30,8 @@
 import java.util.Map;
 
 public class ServerFramework {
+    private static final Log log = LogFactory.getLog(ServerFramework.class);
+    
     private static final Annotation[] ZERO_LENGTH_ARRAY = new Annotation[0];
 
     private Map<String, ServerConfigurator> configuratorMap;
@@ -78,11 +82,24 @@
         for (Annotation annotation : getAllAnnotations()) {
             WebServiceFeatureAnnotation wsfAnnotation = getWebServiceFeatureAnnotation(annotation);
             ServerConfigurator configurator = configuratorMap.get(wsfAnnotation.id());
+            if (log.isDebugEnabled()) {
+                log.debug("Found ServerConfigurator: " + configurator.getClass().getName());
+            }
+            
+            if (log.isDebugEnabled()) {
+                log.debug("Starting " + configurator.getClass().getName() + ".configure()");
+            }
             configurator.configure(endpointDescription);
+            if (log.isDebugEnabled()) {
+                log.debug("Completed " + configurator.getClass().getName() + ".configure()");
+            }
         }
     }
     
     private WebServiceFeatureAnnotation getWebServiceFeatureAnnotation(Annotation annotation)
{
+        if (log.isDebugEnabled()) {
+            log.debug("Looking up WebServiceFeature annotation for " + annotation.annotationType());
+        }
         return annotation.annotationType().getAnnotation(WebServiceFeatureAnnotation.class);
     }
 }

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=636473&r1=636472&r2=636473&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
Wed Mar 12 12:26:53 2008
@@ -21,28 +21,44 @@
 import javax.xml.ws.RespectBinding;
 import javax.xml.ws.RespectBindingFeature;
 
-import org.apache.axis2.description.AxisService;
 import org.apache.axis2.jaxws.description.EndpointDescription;
 import org.apache.axis2.jaxws.description.EndpointDescriptionJava;
 import org.apache.axis2.jaxws.feature.ServerConfigurator;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 
 /**
- *
+ * An implementation of the <code>ServerConfigurator</code> interface that will
+ * configure the endpoint based on the presence of a <code>RespectBinding</code>
+ * attribute.
  */
 public class RespectBindingConfigurator implements ServerConfigurator {
 
+    private static final Log log = LogFactory.getLog(RespectBindingConfigurator.class); 
+    
     /*
-     *  (non-Javadoc)
+     * (non-Javadoc)
      * @see org.apache.axis2.jaxws.feature.WebServiceFeatureConfigurator#configure(org.apache.axis2.jaxws.description.EndpointDescription)
      */
     public void configure(EndpointDescription endpointDescription) {
-    	RespectBinding mtomAnnoation =
+    	RespectBinding annotation =
     		(RespectBinding) ((EndpointDescriptionJava) endpointDescription).getAnnoFeature(RespectBindingFeature.ID);
-    	AxisService service = endpointDescription.getAxisService();
+    	
+        if (annotation != null) {
+            if (log.isDebugEnabled()) {
+                log.debug("Setting respectBinding to " + annotation.enabled());
+            }
+            endpointDescription.setRespectBinding(annotation.enabled());
+        }
+        else {
+            if (log.isDebugEnabled()) {
+                log.debug("No @RespectBinding annotation was found.");
+            }
+        }
     }
 
     /*
-     *  (non-Javadoc)
+     * (non-Javadoc)
      * @see org.apache.axis2.jaxws.feature.ServerConfigurator#supports(java.lang.String)
      */
     public boolean supports(String bindingId) {

Added: webservices/axis2/trunk/java/modules/metadata/test/org/apache/axis2/jaxws/description/feature/RespectBindingFeatureTests.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/metadata/test/org/apache/axis2/jaxws/description/feature/RespectBindingFeatureTests.java?rev=636473&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/metadata/test/org/apache/axis2/jaxws/description/feature/RespectBindingFeatureTests.java
(added)
+++ webservices/axis2/trunk/java/modules/metadata/test/org/apache/axis2/jaxws/description/feature/RespectBindingFeatureTests.java
Wed Mar 12 12:26:53 2008
@@ -0,0 +1,75 @@
+/*
+ * 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.description.feature;
+
+import org.apache.axis2.jaxws.description.DescriptionFactory;
+import org.apache.axis2.jaxws.description.EndpointDescription;
+import org.apache.axis2.jaxws.description.ServiceDescription;
+
+import javax.jws.WebService;
+import javax.xml.namespace.QName;
+import javax.xml.ws.RespectBinding;
+
+import junit.framework.TestCase;
+
+public class RespectBindingFeatureTests extends TestCase {
+
+    private static final String ns = "http://jaxws.axis2.apache.org/metadata/feature/respectbinding";
+    
+    private static final String plainServicePortName = "PlainServicePort";
+    private static final String disabledServicePortName = "DisabledServicePort";
+
+    public void testDefaultConfig() {
+        ServiceDescription sd = DescriptionFactory.createServiceDescription(PlainService.class);
+        
+        EndpointDescription ed = sd.getEndpointDescription(new QName(ns, plainServicePortName));
+        assertTrue("The EndpointDescription should not be null.", ed != null);
+
+        boolean respect = ed.respectBinding();
+        assertTrue("Strict binding support should be ENABLED.", respect);
+    }
+    
+    public void testRespectBindingDisabled() {
+        ServiceDescription sd = DescriptionFactory.createServiceDescription(DisabledService.class);
+        
+        EndpointDescription ed = sd.getEndpointDescription(new QName(ns, disabledServicePortName));
+        assertTrue("The EndpointDescription should not be null.", ed != null);
+
+        boolean respect = ed.respectBinding();
+        assertFalse("Strict binding support should be DISABLED.", respect);
+    }
+    
+    @WebService(targetNamespace=ns, portName=plainServicePortName)
+    @RespectBinding
+    class PlainService {
+        public double getQuote(String symbol) {
+            return 101.01;
+        }
+    }
+    
+    @WebService(targetNamespace=ns, portName=disabledServicePortName)
+    @RespectBinding(enabled=false)
+    class DisabledService {
+        public double getQuote(String symbol) {
+            return 101.01;
+        }
+    }
+}
+
+



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


Mime
View raw message