1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * The contents of this file are subject to the terms of the Liferay Enterprise
5    * Subscription License ("License"). You may not use this file except in
6    * compliance with the License. You can obtain a copy of the License by
7    * contacting Liferay, Inc. See the License for the specific language governing
8    * permissions and limitations under the License, including but not limited to
9    * distribution rights of the Software.
10   *
11   *
12   *
13   */
14  
15  package com.liferay.util.ant;
16  
17  import java.io.File;
18  
19  import org.apache.axis.tools.ant.wsdl.NamespaceMapping;
20  import org.apache.axis.tools.ant.wsdl.Wsdl2javaAntTask;
21  
22  /**
23   * <a href="Wsdl2JavaTask.java.html"><b><i>View Source</i></b></a>
24   *
25   * @author Brian Wing Shun Chan
26   */
27  public class Wsdl2JavaTask {
28  
29      public static void generateJava(String url, String output) {
30          generateJava(url, output, null);
31      }
32  
33      public static void generateJava(String url, String output, String mapping) {
34          Wsdl2javaAntTask wsdl2Java = new Wsdl2javaAntTask();
35  
36          wsdl2Java.setProject(AntUtil.getProject());
37          wsdl2Java.setURL(url);
38          wsdl2Java.setOutput(new File(output));
39          wsdl2Java.setServerSide(true);
40          wsdl2Java.setTestCase(false);
41          wsdl2Java.setVerbose(false);
42  
43          if (mapping != null) {
44              NamespaceMapping namespaceMapping = new NamespaceMapping();
45  
46              namespaceMapping.setFile(new File(mapping));
47  
48              wsdl2Java.addMapping(namespaceMapping);
49          }
50  
51          wsdl2Java.execute();
52      }
53  
54  }