Author: veithen
Date: Sun Feb 19 15:05:10 2012
New Revision: 1291010

URL: http://svn.apache.org/viewvc?rev=1291010&view=rev
Log:
Mavenized test.wsdl.arrays3.

Added:
    axis/axis1/java/trunk/integration/src/main/java/test/wsdl/arrays3/
    
axis/axis1/java/trunk/integration/src/main/java/test/wsdl/arrays3/AddrBookService.java
      - copied unchanged from r1291001, 
axis/axis1/java/trunk/test/wsdl/arrays3/AddrBookService.java
    
axis/axis1/java/trunk/integration/src/main/java/test/wsdl/arrays3/AddrBookServiceImpl.java
      - copied unchanged from r1291001, 
axis/axis1/java/trunk/test/wsdl/arrays3/AddrBookServiceImpl.java
    
axis/axis1/java/trunk/integration/src/main/java/test/wsdl/arrays3/Address.java
      - copied unchanged from r1291001, 
axis/axis1/java/trunk/test/wsdl/arrays3/Address.java
    
axis/axis1/java/trunk/integration/src/main/java/test/wsdl/arrays3/AddressBookImpl.java
      - copied unchanged from r1291001, 
axis/axis1/java/trunk/test/wsdl/arrays3/AddressBookImpl.java
    axis/axis1/java/trunk/integration/src/main/java/test/wsdl/arrays3/Phone.java
      - copied unchanged from r1291001, 
axis/axis1/java/trunk/test/wsdl/arrays3/Phone.java
    
axis/axis1/java/trunk/integration/src/main/java/test/wsdl/arrays3/StateType.java
      - copied unchanged from r1291001, 
axis/axis1/java/trunk/test/wsdl/arrays3/StateType.java
    axis/axis1/java/trunk/integration/src/test/java/test/wsdl/arrays3/
    
axis/axis1/java/trunk/integration/src/test/java/test/wsdl/arrays3/AddrBookServiceImplServiceTestCase.java
      - copied unchanged from r1291001, 
axis/axis1/java/trunk/test/wsdl/arrays3/AddrBookServiceImplServiceTestCase.java
Removed:
    axis/axis1/java/trunk/test/wsdl/arrays3/
Modified:
    axis/axis1/java/trunk/integration/pom.xml
    
axis/axis1/java/trunk/maven/maven-java2wsdl-plugin/src/main/java/org/apache/axis/maven/java2wsdl/GenerateWsdlMojo.java

Modified: axis/axis1/java/trunk/integration/pom.xml
URL: 
http://svn.apache.org/viewvc/axis/axis1/java/trunk/integration/pom.xml?rev=1291010&r1=1291009&r2=1291010&view=diff
==============================================================================
--- axis/axis1/java/trunk/integration/pom.xml (original)
+++ axis/axis1/java/trunk/integration/pom.xml Sun Feb 19 15:05:10 2012
@@ -75,6 +75,27 @@
                             </mappings>
                         </configuration>
                     </execution>
+                    <execution>
+                        <id>arrays3</id>
+                        <goals>
+                            <goal>generate-wsdl</goal>
+                        </goals>
+                        <configuration>
+                            
<output>${project.build.directory}/work/test/wsdl/arrays3/generated/arrays3.wsdl</output>
+                            
<className>test.wsdl.arrays3.AddrBookServiceImpl</className>
+                            <namespace>http://arrays3.test</namespace>
+                            
<location>http://localhost:8080/axis/services/arrays3</location>
+                            <style>WRAPPED</style>
+                            <use>literal</use>
+                            <deploy>true</deploy>
+                            <mappings>
+                                <mapping>
+                                    <package>test.wsdl.arrays3</package>
+                                    <namespace>http://arrays3.test</namespace>
+                                </mapping>
+                            </mappings>
+                        </configuration>
+                    </execution>
                 </executions>
             </plugin>
             <plugin>
@@ -317,6 +338,21 @@
                         </configuration>
                     </execution>
                     <execution>
+                        <id>arrays3</id>
+                        <goals>
+                            <goal>wsdl2java-test</goal>
+                        </goals>
+                        <configuration>
+                            
<file>${project.build.directory}/work/test/wsdl/arrays3/generated/arrays3.wsdl</file>
+                            <mappings>
+                                <mapping>
+                                    <namespace>http://arrays3.test</namespace>
+                                    
<package>test.wsdl.arrays3.testclient</package>
+                                </mapping>
+                            </mappings>
+                        </configuration>
+                    </execution>
+                    <execution>
                         <id>arrays4</id>
                         <goals>
                             <goal>wsdl2java-test</goal>

Modified: 
axis/axis1/java/trunk/maven/maven-java2wsdl-plugin/src/main/java/org/apache/axis/maven/java2wsdl/GenerateWsdlMojo.java
URL: 
http://svn.apache.org/viewvc/axis/axis1/java/trunk/maven/maven-java2wsdl-plugin/src/main/java/org/apache/axis/maven/java2wsdl/GenerateWsdlMojo.java?rev=1291010&r1=1291009&r2=1291010&view=diff
==============================================================================
--- 
axis/axis1/java/trunk/maven/maven-java2wsdl-plugin/src/main/java/org/apache/axis/maven/java2wsdl/GenerateWsdlMojo.java
 (original)
+++ 
axis/axis1/java/trunk/maven/maven-java2wsdl-plugin/src/main/java/org/apache/axis/maven/java2wsdl/GenerateWsdlMojo.java
 Sun Feb 19 15:05:10 2012
@@ -22,7 +22,9 @@ import java.io.File;
 import java.net.MalformedURLException;
 import java.net.URL;
 import java.net.URLClassLoader;
+import java.util.Iterator;
 import java.util.List;
+import java.util.Map;
 
 import org.apache.axis.maven.shared.nsmap.Mapping;
 import org.apache.axis.maven.shared.nsmap.MappingUtil;
@@ -84,6 +86,23 @@ public class GenerateWsdlMojo extends Ab
     private Mapping[] mappings;
     
     /**
+     * The style of the WSDL document: RPC, DOCUMENT or WRAPPED.
+     * If RPC, a rpc/encoded wsdl is generated. If DOCUMENT, a
+     * document/literal wsdl is generated. If WRAPPED, a
+     * document/literal wsdl is generated using the wrapped approach.
+     *
+     * @parameter
+     */
+    private String style;
+
+    /**
+     * Set the use option
+     * 
+     * @parameter
+     */
+    private String use;
+    
+    /**
      * The url of the location of the service. The name after the last slash or
      * backslash is the name of the service port (unless overridden by the -s
      * option). The service port address location attribute is assigned the
@@ -102,6 +121,13 @@ public class GenerateWsdlMojo extends Ab
      */
     private File output;
     
+    /**
+     * Sets the deploy flag
+     * 
+     * @parameter default-value="false"
+     */
+    private boolean deploy;
+    
     public void execute() throws MojoExecutionException, MojoFailureException {
         List classpath;
         try {
@@ -129,11 +155,20 @@ public class GenerateWsdlMojo extends Ab
             } catch (ClassNotFoundException ex) {
                 throw new MojoFailureException("Class " + className + " not 
found");
             }
+            if (style != null) {
+                emitter.setStyle(style);
+            }
+            if (use != null) {
+                emitter.setUse(use);
+            }
             emitter.setIntfNamespace(namespace);
             emitter.setLocationUrl(location);
             output.getParentFile().mkdirs();
             try {
                 emitter.emit(output.getAbsolutePath(), Emitter.MODE_ALL);
+                if (deploy) {
+                    generateServerSide(emitter, /*(outputImpl != null) ? 
outputImpl :*/ output.getAbsolutePath());
+                }
             } catch (Exception ex) {
                 throw new MojoFailureException("java2wsdl failed", ex);
             }
@@ -142,4 +177,57 @@ public class GenerateWsdlMojo extends Ab
             ClassUtils.setDefaultClassLoader(null);
         }
     }
+
+    // Copy & paste from Java2WsdlAntTask
+    /**
+     * Generate the server side artifacts from the generated WSDL
+     * 
+     * @param j2w the Java2WSDL emitter
+     * @param wsdlFileName the generated WSDL file
+     * @throws Exception
+     */
+    protected void generateServerSide(Emitter j2w, String wsdlFileName) throws 
Exception {
+        org.apache.axis.wsdl.toJava.Emitter w2j = new 
org.apache.axis.wsdl.toJava.Emitter();
+        File wsdlFile = new File(wsdlFileName);
+        w2j.setServiceDesc(j2w.getServiceDesc());
+        w2j.setQName2ClassMap(j2w.getQName2ClassMap());
+        w2j.setOutputDir(wsdlFile.getParent());
+        w2j.setServerSide(true);   
+        w2j.setDeploy(true);
+        w2j.setHelperWanted(true);
+
+        // setup namespace-to-package mapping
+        String ns = j2w.getIntfNamespace();
+        String clsName = j2w.getCls().getName();
+        int idx = clsName.lastIndexOf(".");
+        String pkg = null;
+        if (idx > 0) {
+            pkg = clsName.substring(0, idx);            
+            w2j.getNamespaceMap().put(ns, pkg);
+        }
+        
+        Map nsmap = j2w.getNamespaceMap();
+        if (nsmap != null) {
+            for (Iterator i = nsmap.keySet().iterator(); i.hasNext(); ) {
+                pkg = (String) i.next();
+                ns = (String) nsmap.get(pkg);
+                w2j.getNamespaceMap().put(ns, pkg);
+            }
+        }
+        
+        // set 'deploy' mode
+        w2j.setDeploy(true);
+        
+        if (j2w.getImplCls() != null) {
+            w2j.setImplementationClassName(j2w.getImplCls().getName());
+        } else {
+            if (!j2w.getCls().isInterface()) {
+                w2j.setImplementationClassName(j2w.getCls().getName());
+            } else {
+                throw new Exception("implementation class is not specified.");
+            }
+        }
+        
+        w2j.run(wsdlFileName);
+    }
 }


Reply via email to