geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ga...@apache.org
Subject svn commit: r719385 - /geronimo/server/trunk/plugins/jaxws/geronimo-jaxws-builder/src/main/java/org/apache/geronimo/jaxws/wsdl/WsdlGeneratorUtils.java
Date Thu, 20 Nov 2008 21:42:35 GMT
Author: gawor
Date: Thu Nov 20 13:42:34 2008
New Revision: 719385

URL: http://svn.apache.org/viewvc?rev=719385&view=rev
Log:
use slightly different way of finding the generated wsdl file (part of GERONIMO-4351)

Modified:
    geronimo/server/trunk/plugins/jaxws/geronimo-jaxws-builder/src/main/java/org/apache/geronimo/jaxws/wsdl/WsdlGeneratorUtils.java

Modified: geronimo/server/trunk/plugins/jaxws/geronimo-jaxws-builder/src/main/java/org/apache/geronimo/jaxws/wsdl/WsdlGeneratorUtils.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jaxws/geronimo-jaxws-builder/src/main/java/org/apache/geronimo/jaxws/wsdl/WsdlGeneratorUtils.java?rev=719385&r1=719384&r2=719385&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/jaxws/geronimo-jaxws-builder/src/main/java/org/apache/geronimo/jaxws/wsdl/WsdlGeneratorUtils.java
(original)
+++ geronimo/server/trunk/plugins/jaxws/geronimo-jaxws-builder/src/main/java/org/apache/geronimo/jaxws/wsdl/WsdlGeneratorUtils.java
Thu Nov 20 13:42:34 2008
@@ -163,35 +163,38 @@
         }               
     }
     
-    public static File getFirstWsdlFile(File baseDir) {
+    private static File[] getWsdlFiles(File baseDir) {
         File[] files = baseDir.listFiles(new FileFilter() {
             public boolean accept(File file) {
                 return (file.isFile() && file.getName().endsWith(".wsdl"));
             }
         });
-
-        if (files != null && files.length == 1) {
-            return files[0];
-        } else {
-            return null;
-        }
+        return files;
     }
     
     public static File findWsdlFile(File baseDir, String serviceName) {
-        if (serviceName != null) {
-            // check if serviceName.wsdl locates at the baseDir, if so, return its path.
-            String wsdlFileName = serviceName + ".wsdl";
-            if (Character.isLowerCase(wsdlFileName.charAt(0))) {
-                wsdlFileName = Character.toUpperCase(wsdlFileName.charAt(0)) + wsdlFileName.substring(1);
-            }
-            File wsdlFile = new File(baseDir, wsdlFileName);
-            if (wsdlFile.exists()) {
-                return wsdlFile;
+        File[] files = getWsdlFiles(baseDir);
+        if (files == null || files.length == 0) {
+            // no wsdl files found
+            return null;
+        } else {
+            if (files.length == 1) {
+                // found one wsdl file, must be it
+                return files[0];
+            } else if (serviceName != null) {
+                // found multiple wsdl files, check filenames to match serviceName      
   
+                String wsdlFileName = serviceName + ".wsdl";
+                for (File file : files) {
+                    if (wsdlFileName.equalsIgnoreCase(file.getName())) {
+                        return file;
+                    }
+                }
+                return null;
             } else {
-                return getFirstWsdlFile(baseDir);
+                // found multiple wsdl files and serviceName is not specified 
+                // so we don't know which wsdl file is the right one
+                return null;
             }
-        } else {
-            return getFirstWsdlFile(baseDir);
         }
     }
     



Mime
View raw message