You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by em...@apache.org on 2007/04/29 12:06:11 UTC

svn commit: r533493 - in /incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory: Messages.properties ReflectionServiceFactoryBean.java

Author: ema
Date: Sun Apr 29 03:06:09 2007
New Revision: 533493

URL: http://svn.apache.org/viewvc?view=rev&rev=533493
Log:
[CXF-563] Validate if the service class can be forced wrapper style 

Modified:
    incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/Messages.properties
    incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java

Modified: incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/Messages.properties
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/Messages.properties?view=diff&rev=533493&r1=533492&r2=533493
==============================================================================
--- incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/Messages.properties (original)
+++ incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/Messages.properties Sun Apr 29 03:06:09 2007
@@ -19,4 +19,5 @@
 #
 #
 COULD_NOT_FIND_PORTTYPE = Could not find portType named {0}
-NO_METHOD_FOR_OP = Could not find a matching method for operation {0}
\ No newline at end of file
+NO_METHOD_FOR_OP = Could not find a matching method for operation {0}
+COULD_NOT_SET_WRAPPER_STYLE = Service class : {0} contains overloaded operation can not use wrapper style
\ No newline at end of file

Modified: incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java?view=diff&rev=533493&r1=533492&r2=533493
==============================================================================
--- incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java (original)
+++ incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java Sun Apr 29 03:06:09 2007
@@ -218,9 +218,21 @@
         
         getDataBinding().initialize(service);
         
-        if (isWrapped()) {
+        
+        boolean overLoaded = containsOverloadedMethod();
+        boolean isWrapped = isWrapped();
+        if (isWrapped && !overLoaded) {
             initializeWrappedSchema(serviceInfo);
-        } 
+        }  else if (isWrapped && overLoaded) {
+            if (wrappedStyle != null && wrappedStyle) {
+                throw new ServiceConstructionException(new Message("COULD_NOT_SET_WRAPPER_STYLE", 
+                                                                   BUNDLE, serviceClass.getName()));
+            }
+            if (wrappedStyle == null) {
+                setWrapped(false);
+            }
+            
+        }
 
         for (OperationInfo opInfo : serviceInfo.getInterface().getOperations()) {
             Method m = (Method)opInfo.getProperty(METHOD);
@@ -236,7 +248,22 @@
         }
         
     }
-
+    
+    private boolean containsOverloadedMethod() {
+        Method[] methods = serviceClass.getDeclaredMethods();
+        List<String> methodList = new ArrayList<String>();
+        for (int i = 0; i < methods.length; i++) {
+            String name = methods[i].getName();
+            if (!methodList.contains(name)) {
+                methodList.add(name);
+            } else if (!name.endsWith("Async")) {               
+                return true;
+            }
+            
+        }
+        return false;
+    }
+    
     protected void initializeServiceModel() {
         String wsdlurl = getWsdlURL();