Author: veithen
Date: Thu Jan  5 17:14:00 2012
New Revision: 1227702

URL: http://svn.apache.org/viewvc?rev=1227702&view=rev
Log:
Improved the flexibility of WSDD deployment in the start-server mojo.

Added:
    
axis/axis1/java/trunk/axis-maven-plugin/src/main/java/org/apache/axis/maven/WSDD.java
   (with props)
Modified:
    
axis/axis1/java/trunk/axis-maven-plugin/src/main/java/org/apache/axis/maven/StartServerMojo.java
    axis/axis1/java/trunk/integration/pom.xml

Modified: 
axis/axis1/java/trunk/axis-maven-plugin/src/main/java/org/apache/axis/maven/StartServerMojo.java
URL: 
http://svn.apache.org/viewvc/axis/axis1/java/trunk/axis-maven-plugin/src/main/java/org/apache/axis/maven/StartServerMojo.java?rev=1227702&r1=1227701&r2=1227702&view=diff
==============================================================================
--- 
axis/axis1/java/trunk/axis-maven-plugin/src/main/java/org/apache/axis/maven/StartServerMojo.java
 (original)
+++ 
axis/axis1/java/trunk/axis-maven-plugin/src/main/java/org/apache/axis/maven/StartServerMojo.java
 Thu Jan  5 17:14:00 2012
@@ -20,7 +20,7 @@ package org.apache.axis.maven;
 
 import java.io.File;
 import java.io.IOException;
-import java.util.Arrays;
+import java.util.ArrayList;
 import java.util.List;
 
 import org.apache.axis.transport.http.SimpleAxisServer;
@@ -74,11 +74,11 @@ public class StartServerMojo extends Abs
     private File workDirBase;
     
     /**
-     * Directory with WSDD files for services to deploy.
+     * A set of WSDD files for services to deploy.
      * 
      * @parameter
      */
-    private File wsddDir;
+    private WSDD[] wsdds;
     
     public void execute() throws MojoExecutionException, MojoFailureException {
         Log log = getLog();
@@ -107,19 +107,23 @@ public class StartServerMojo extends Abs
         }
         
         // Select WSDD files
-        String[] wsddFiles;
-        if (wsddDir != null) {
-            DirectoryScanner scanner = new DirectoryScanner();
-            scanner.setBasedir(wsddDir);
-            scanner.setIncludes(new String[] { "**/deploy.wsdd" });
-            scanner.scan();
-            String[] includedFiles = scanner.getIncludedFiles();
-            wsddFiles = new String[includedFiles.length];
-            for (int i=0; i<includedFiles.length; i++) {
-                wsddFiles[i] = new File(wsddDir, includedFiles[i]).getPath();
+        List wsddFiles;
+        if (wsdds != null && wsdds.length > 0) {
+            wsddFiles = new ArrayList();
+            for (int i=0; i<wsdds.length; i++) {
+                WSDD wsdd = wsdds[i];
+                DirectoryScanner scanner = new DirectoryScanner();
+                scanner.setBasedir(wsdd.getDirectory());
+                scanner.setIncludes(wsdd.getIncludes());
+                scanner.setExcludes(wsdd.getExcludes());
+                scanner.scan();
+                String[] includedFiles = scanner.getIncludedFiles();
+                for (int j=0; j<includedFiles.length; j++) {
+                    wsddFiles.add(new File(wsdd.getDirectory(), 
includedFiles[j]).getPath());
+                }
             }
             if (log.isDebugEnabled()) {
-                log.debug("WSDD files: " + Arrays.asList(wsddFiles));
+                log.debug("WSDD files: " + wsddFiles);
             }
         } else {
             wsddFiles = null;
@@ -139,7 +143,11 @@ public class StartServerMojo extends Abs
         
         // Start the server
         try {
-            getServerManager().startServer(executable, 
(String[])classPathElements.toArray(new String[classPathElements.size()]), 
getPort(), workDir, wsddFiles);
+            getServerManager().startServer(executable,
+                    (String[])classPathElements.toArray(new 
String[classPathElements.size()]),
+                    getPort(),
+                    workDir,
+                    wsddFiles == null ? null : (String[])wsddFiles.toArray(new 
String[wsddFiles.size()]));
         } catch (Exception ex) {
             throw new MojoFailureException("Failed to start server", ex);
         }

Added: 
axis/axis1/java/trunk/axis-maven-plugin/src/main/java/org/apache/axis/maven/WSDD.java
URL: 
http://svn.apache.org/viewvc/axis/axis1/java/trunk/axis-maven-plugin/src/main/java/org/apache/axis/maven/WSDD.java?rev=1227702&view=auto
==============================================================================
--- 
axis/axis1/java/trunk/axis-maven-plugin/src/main/java/org/apache/axis/maven/WSDD.java
 (added)
+++ 
axis/axis1/java/trunk/axis-maven-plugin/src/main/java/org/apache/axis/maven/WSDD.java
 Thu Jan  5 17:14:00 2012
@@ -0,0 +1,51 @@
+/*
+ * 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.axis.maven;
+
+import java.io.File;
+
+public class WSDD {
+    private File directory;
+    private String[] includes;
+    private String[] excludes;
+    
+    public File getDirectory() {
+        return directory;
+    }
+    
+    public void setDirectory(File directory) {
+        this.directory = directory;
+    }
+    
+    public String[] getIncludes() {
+        return includes;
+    }
+    
+    public void setIncludes(String[] includes) {
+        this.includes = includes;
+    }
+    
+    public String[] getExcludes() {
+        return excludes;
+    }
+    
+    public void setExcludes(String[] excludes) {
+        this.excludes = excludes;
+    }
+}

Propchange: 
axis/axis1/java/trunk/axis-maven-plugin/src/main/java/org/apache/axis/maven/WSDD.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: axis/axis1/java/trunk/integration/pom.xml
URL: 
http://svn.apache.org/viewvc/axis/axis1/java/trunk/integration/pom.xml?rev=1227702&r1=1227701&r2=1227702&view=diff
==============================================================================
--- axis/axis1/java/trunk/integration/pom.xml (original)
+++ axis/axis1/java/trunk/integration/pom.xml Thu Jan  5 17:14:00 2012
@@ -879,7 +879,14 @@
                             <goal>start-server</goal>
                         </goals>
                         <configuration>
-                            <wsddDir>${project.build.directory}/work</wsddDir>
+                            <wsdds>
+                                <wsdd>
+                                    
<directory>${project.build.directory}/work</directory>
+                                    <includes>
+                                        <include>**/deploy.wsdd</include>
+                                    </includes>
+                                </wsdd>
+                            </wsdds>
                         </configuration>
                     </execution>
                     <execution>


Reply via email to