Author: bimargulies
Date: Thu Dec 15 02:32:28 2011
New Revision: 1214599
URL: http://svn.apache.org/viewvc?rev=1214599&view=rev
Log:
[CXF-3972] Revert "Hide wsdl2js mojo because it introduces a dependency loop."
This reverts commit 8de9a1db837c973eea15f5e32cd4682eb19377d3.
Added:
cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/wsdl2js/ForkOnceWSDL2Javascript.java
(with props)
cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/wsdl2js/Option.java
(with props)
cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/wsdl2js/WSDL2JavaScriptMojo.java
(with props)
cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/wsdl2js/WsdlArtifact.java
(with props)
cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/wsdl2js/WsdlOption.java
(with props)
Modified:
cxf/trunk/maven-plugins/codegen-plugin/pom.xml
Modified: cxf/trunk/maven-plugins/codegen-plugin/pom.xml
URL:
http://svn.apache.org/viewvc/cxf/trunk/maven-plugins/codegen-plugin/pom.xml?rev=1214599&r1=1214598&r2=1214599&view=diff
==============================================================================
--- cxf/trunk/maven-plugins/codegen-plugin/pom.xml (original)
+++ cxf/trunk/maven-plugins/codegen-plugin/pom.xml Thu Dec 15 02:32:28 2011
@@ -104,6 +104,13 @@
</dependency>
<dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-tools-wsdlto-frontend-javascript</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+
+ <dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<optional>true</optional>
Added:
cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/wsdl2js/ForkOnceWSDL2Javascript.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/wsdl2js/ForkOnceWSDL2Javascript.java?rev=1214599&view=auto
==============================================================================
---
cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/wsdl2js/ForkOnceWSDL2Javascript.java
(added)
+++
cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/wsdl2js/ForkOnceWSDL2Javascript.java
Thu Dec 15 02:32:28 2011
@@ -0,0 +1,55 @@
+/**
+ * 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.cxf.maven_plugin.wsdl2js;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileReader;
+
+import org.apache.cxf.tools.common.ToolContext;
+import org.apache.cxf.tools.wsdlto.javascript.WSDLToJavaScript;
+
+/**
+ *
+ */
+public final class ForkOnceWSDL2Javascript {
+ private ForkOnceWSDL2Javascript() {
+ //utility
+ }
+ public static void main(String args[]) throws Exception {
+ File file = new File(args[0]);
+ BufferedReader reader = new BufferedReader(new FileReader(file));
+ String line = reader.readLine();
+ while (line != null) {
+ int i = Integer.parseInt(line);
+ if (i == -1) {
+ return;
+ }
+ String wargs[] = new String[i];
+ for (int x = 0; x < i; x++) {
+ wargs[x] = reader.readLine();
+ }
+
+ new WSDLToJavaScript(wargs).run(new ToolContext());
+
+ line = reader.readLine();
+ }
+ }
+}
Propchange:
cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/wsdl2js/ForkOnceWSDL2Javascript.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/wsdl2js/ForkOnceWSDL2Javascript.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added:
cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/wsdl2js/Option.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/wsdl2js/Option.java?rev=1214599&view=auto
==============================================================================
---
cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/wsdl2js/Option.java
(added)
+++
cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/wsdl2js/Option.java
Thu Dec 15 02:32:28 2011
@@ -0,0 +1,197 @@
+/**
+ * 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.cxf.maven_plugin.wsdl2js;
+
+import java.io.File;
+
+public class Option {
+
+ /**
+ * Since an arbitrary URI can't be an XML element name,
+ * these pairs are used to specify a mapping from URI
+ * to prefix.
+ */
+ public static class UriPrefixPair {
+ /**
+ * The namespace URI.
+ */
+ String uri;
+ /**
+ * The identifier prefix.
+ */
+ String prefix;
+ /**
+ * @return the uri
+ */
+ public String getUri() {
+ return uri;
+ }
+ /**
+ * Set the URI.
+ * @param uri the uri.
+ */
+ public void setUri(String uri) {
+ this.uri = uri;
+ }
+ /**
+ * @return the prefix.
+ */
+ public String getPrefix() {
+ return prefix;
+ }
+ /**
+ * Set the prefix.
+ * @param prefix the prefix.
+ */
+ public void setPrefix(String prefix) {
+ this.prefix = prefix;
+ }
+
+ }
+
+ /**
+ * mappings from namespace URIs to javascript identifier prefixes.
+ */
+ UriPrefixPair[] packagePrefixes;
+ /**
+ * OASIS catalog file for use when reading the WSDL.
+ */
+ File catalog;
+ /**
+ * Destination directory for the output.
+ */
+ File output;
+ /**
+ * Whether to validate the WSDL.
+ */
+ Boolean validate;
+ /**
+ * The wsdl version.
+ */
+ String wsdlVersion;
+ /**
+ * A set of dependent files used to detect that the generator must process
WSDL, even
+ * if generator marker files are up to date.
+ */
+ File dependencies[];
+
+ public Option() {
+ }
+
+ public void merge(Option other) {
+ if (catalog == null) {
+ catalog = other.getCatalog();
+ }
+ if (output == null) {
+ output = other.getOutput();
+ }
+ if (validate == null) {
+ validate = other.isValidate();
+ }
+ if (wsdlVersion == null) {
+ wsdlVersion = other.getWsdlVersion();
+ }
+ }
+
+ /**
+ * @return mappings from namespace URI to javascript name prefix.
+ */
+ public UriPrefixPair[] getPackagePrefixes() {
+ return packagePrefixes;
+ }
+
+ /**
+ * Set the mappings from namespace URI to Javascript name prefixes.
+ * @param packagePrefixes
+ */
+ public void setPackagePrefixes(UriPrefixPair[] packagePrefixes) {
+ this.packagePrefixes = packagePrefixes;
+ }
+
+ /**
+ * @return catalog used to resolve XML URIs in the wsdl.
+ */
+ public File getCatalog() {
+ return catalog;
+ }
+
+ /**
+ * Set catalog used to resolve XML URIs in the wsdl.
+ * @param catalog catalog.
+ */
+ public void setCatalog(File catalog) {
+ this.catalog = catalog;
+ }
+
+ /**
+ * @return output directory. Default is set
+ * at the plugin level.
+ */
+ public File getOutput() {
+ return output;
+ }
+
+ /**
+ * Set the output directory.
+ * @param output output directory.
+ */
+ public void setOutput(File output) {
+ this.output = output;
+ }
+
+ /**
+ * @return Validating the WSDL?
+ */
+ public boolean isValidate() {
+ return validate;
+ }
+
+ /**
+ * Control WSDL validation.
+ * @param validate true to validate.
+ */
+ public void setValidate(boolean validate) {
+ this.validate = validate;
+ }
+
+ public File getOutputDir() {
+ return output;
+ }
+
+ public void setOutputDir(File outputDir) {
+ output = outputDir;
+ }
+
+ public String getWsdlVersion() {
+ return wsdlVersion;
+ }
+
+ public void setWsdlVersion(String wsdlVersion) {
+ this.wsdlVersion = wsdlVersion;
+ }
+
+ public File[] getDependencies() {
+ return dependencies;
+ }
+
+ public void setDependencies(File[] dependencies) {
+ this.dependencies = dependencies;
+ }
+
+}
Propchange:
cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/wsdl2js/Option.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/wsdl2js/Option.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added:
cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/wsdl2js/WSDL2JavaScriptMojo.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/wsdl2js/WSDL2JavaScriptMojo.java?rev=1214599&view=auto
==============================================================================
---
cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/wsdl2js/WSDL2JavaScriptMojo.java
(added)
+++
cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/wsdl2js/WSDL2JavaScriptMojo.java
Thu Dec 15 02:32:28 2011
@@ -0,0 +1,282 @@
+/**
+ * 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.cxf.maven_plugin.wsdl2js;
+
+import java.io.File;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.BusFactory;
+import org.apache.cxf.helpers.CastUtils;
+import org.apache.cxf.maven_plugin.AbstractCodegenMoho;
+import org.apache.cxf.maven_plugin.GenericWsdlOption;
+import org.apache.cxf.maven_plugin.WsdlUtilities;
+import org.apache.cxf.tools.common.ToolContext;
+import org.apache.cxf.tools.wsdlto.javascript.WSDLToJavaScript;
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.project.MavenProject;
+
+/**
+ * @goal wsdl2js
+ * @phase generate-sources
+ * @description CXF WSDL To JavaScript Tool
+ * @requiresDependencyResolution test
+ * @threadSafe
+ */
+public class WSDL2JavaScriptMojo extends AbstractCodegenMoho {
+
+ /**
+ * WSDL files to process. Each wsdl file is specified as an option
element, with possible options.
+ *
+ * @parameter
+ * @required
+ */
+ WsdlOption[] wsdls;
+
+ /**
+ * @parameter expression="${cxf.testJavascriptRoot}"
+ */
+ File testSourceRoot;
+
+ /**
+ * Path where the generated sources should be placed
+ *
+ * @parameter expression="${cxf.sourceJavascriptRoot}"
+ *
default-value="${project.build.directory}/generated-sources/cxf-js"
+ * @required
+ */
+ File sourceRoot;
+
+ /**
+ * Default options to be applied to all of the wsdls.
+ *
+ * @parameter
+ */
+ Option defaultOptions;
+
+ /**
+ * @parameter
+ */
+ WsdlOption wsdlOptions[];
+
+ @Override
+ protected Bus generate(GenericWsdlOption genericWsdlOption,
+ Bus bus, Set<URI> classPath)
+ throws MojoExecutionException {
+
+ WsdlOption wsdlOption = (WsdlOption)genericWsdlOption;
+ File outputDirFile = wsdlOption.getOutputDir();
+ outputDirFile.mkdirs();
+ URI basedir = project.getBasedir().toURI();
+ URI wsdlURI;
+ try {
+ wsdlURI = new URI(wsdlOption.getUri());
+ } catch (URISyntaxException e) {
+ throw new MojoExecutionException("Failed to get URI for wsdl " +
wsdlOption.getUri(), e);
+ }
+ File doneFile = getDoneFile(basedir, wsdlURI, "js");
+
+ if (!shouldRun(wsdlOption, doneFile, wsdlURI)) {
+ return bus;
+ }
+ doneFile.delete();
+
+ List<String> list = wsdlOption.generateCommandLine(outputDirFile,
basedir, wsdlURI, getLog()
+ .isDebugEnabled());
+ String[] args = (String[])list.toArray(new String[list.size()]);
+ getLog().debug("Calling wsdl2js with args: " + Arrays.toString(args));
+
+ if (!"false".equals(fork)) {
+ Set<URI> artifactsPath = new LinkedHashSet<URI>();
+ for (Artifact a : pluginArtifacts) {
+ File file = a.getFile();
+ if (file == null) {
+ throw new MojoExecutionException("Unable to find " + file
+ " for artifact "
+ + a.getGroupId() + ":" +
a.getArtifactId() + ":"
+ + a.getVersion());
+ }
+ artifactsPath.add(file.toURI());
+ }
+ addPluginArtifact(artifactsPath);
+ artifactsPath.addAll(classPath);
+
+ runForked(artifactsPath, WSDLToJavaScript.class.getName(), args);
+
+ } else {
+ if (bus == null) {
+ bus = BusFactory.newInstance().createBus();
+ BusFactory.setThreadDefaultBus(bus);
+ }
+ try {
+ new WSDLToJavaScript(args).run(new ToolContext());
+ } catch (Throwable e) {
+ getLog().debug(e);
+ throw new MojoExecutionException(e.getMessage(), e);
+ }
+ }
+
+ try {
+ doneFile.createNewFile();
+ } catch (Throwable e) {
+ getLog().warn("Could not create marker file " +
doneFile.getAbsolutePath());
+ getLog().debug(e);
+ throw new MojoExecutionException("Failed to create marker file " +
doneFile.getAbsolutePath());
+ }
+ if (project != null && getGeneratedSourceRoot() != null &&
getGeneratedSourceRoot().exists()) {
+
project.addCompileSourceRoot(getGeneratedSourceRoot().getAbsolutePath());
+ }
+ if (project != null && getGeneratedTestRoot() != null &&
getGeneratedTestRoot().exists()) {
+
project.addTestCompileSourceRoot(getGeneratedTestRoot().getAbsolutePath());
+ }
+ return bus;
+ }
+
+ @Override
+ protected File getGeneratedSourceRoot() {
+ return sourceRoot;
+ }
+
+ @Override
+ protected File getGeneratedTestRoot() {
+ return testSourceRoot;
+ }
+
+ @Override
+ protected boolean shouldRun(GenericWsdlOption genericWsdlOption, File
doneFile,
+ URI wsdlURI) {
+ WsdlOption wsdlOption = (WsdlOption)genericWsdlOption;
+ long timestamp = 0;
+ if ("file".equals(wsdlURI.getScheme())) {
+ timestamp = new File(wsdlURI).lastModified();
+ } else {
+ try {
+ timestamp = wsdlURI.toURL().openConnection().getDate();
+ } catch (Exception e) {
+ // ignore
+ }
+ }
+ boolean doWork = false;
+ if (!doneFile.exists()) {
+ doWork = true;
+ } else if (timestamp > doneFile.lastModified()) {
+ doWork = true;
+ } else {
+ File files[] = wsdlOption.getDependencies();
+ if (files != null) {
+ for (int z = 0; z < files.length; ++z) {
+ if (files[z].lastModified() > doneFile.lastModified()) {
+ doWork = true;
+ }
+ }
+ }
+ }
+ return doWork;
+ }
+
+ protected void mergeOptions(List<GenericWsdlOption> effectiveWsdlOptions) {
+ for (GenericWsdlOption wo : wsdls) {
+ WsdlOption option = (WsdlOption)wo;
+ option.merge(defaultOptions);
+ }
+ }
+
+ @Override
+ protected List<GenericWsdlOption>
createWsdlOptionsFromScansAndExplicitWsdlOptions()
+ throws MojoExecutionException {
+ List<GenericWsdlOption> effectiveWsdlOptions = new
ArrayList<GenericWsdlOption>();
+ List<GenericWsdlOption> temp;
+
+ for (WsdlOption wo : wsdlOptions) {
+ effectiveWsdlOptions.add(wo);
+ }
+
+ if (wsdlRoot != null && wsdlRoot.exists() && !disableDirectoryScan) {
+ temp = loadWsdlOptionsFromFiles(wsdlRoot,
getGeneratedSourceRoot());
+ effectiveWsdlOptions.addAll(temp);
+ }
+ if (testWsdlRoot != null && testWsdlRoot.exists() &&
!disableDirectoryScan) {
+ temp = loadWsdlOptionsFromFiles(testWsdlRoot,
getGeneratedTestRoot());
+ effectiveWsdlOptions.addAll(temp);
+ }
+ if (!disableDependencyScan) {
+ temp = loadWsdlOptionsFromDependencies(project, defaultOptions,
getGeneratedSourceRoot());
+ effectiveWsdlOptions.addAll(temp);
+ }
+ mergeOptions(effectiveWsdlOptions);
+ downloadRemoteWsdls(effectiveWsdlOptions);
+ return effectiveWsdlOptions;
+ }
+
+ private List<GenericWsdlOption> loadWsdlOptionsFromFiles(File wsdlBasedir,
File defaultOutputDir)
+ throws MojoExecutionException {
+
+ if (wsdlBasedir == null) {
+ return Collections.emptyList();
+ }
+
+ if (!wsdlBasedir.exists()) {
+ throw new MojoExecutionException(wsdlBasedir + " does not exist");
+ }
+
+ List<File> wsdlFiles = WsdlUtilities.getWsdlFiles(wsdlBasedir,
includes, excludes);
+ List<GenericWsdlOption> options = new ArrayList<GenericWsdlOption>();
+ for (File wsdl : wsdlFiles) {
+ WsdlOption wsdlOption = new WsdlOption();
+ wsdlOption.setOutputDir(defaultOutputDir);
+ wsdlOption.setUri(wsdl.toURI().toString());
+ options.add(wsdlOption);
+ }
+ return options;
+ }
+
+ public static List<GenericWsdlOption>
+ loadWsdlOptionsFromDependencies(MavenProject project,
+ Option defaultOptions,
+ File outputDir) {
+ List<GenericWsdlOption> options
+ = new ArrayList<GenericWsdlOption>();
+ Set<Artifact> dependencies =
CastUtils.cast(project.getDependencyArtifacts());
+ for (Artifact artifact : dependencies) {
+ WsdlOption option = new WsdlOption();
+ WsdlUtilities.fillWsdlOptionFromArtifact(new WsdlOption(),
artifact, outputDir);
+ if (option != null) {
+ if (defaultOptions != null) {
+ option.merge(defaultOptions);
+ }
+ options.add(option);
+ }
+ }
+ return options;
+ }
+
+ @Override
+ protected Class<?> getForkClass() {
+ return ForkOnceWSDL2Javascript.class;
+ }
+
+}
Propchange:
cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/wsdl2js/WSDL2JavaScriptMojo.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/wsdl2js/WSDL2JavaScriptMojo.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added:
cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/wsdl2js/WsdlArtifact.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/wsdl2js/WsdlArtifact.java?rev=1214599&view=auto
==============================================================================
---
cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/wsdl2js/WsdlArtifact.java
(added)
+++
cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/wsdl2js/WsdlArtifact.java
Thu Dec 15 02:32:28 2011
@@ -0,0 +1,30 @@
+/**
+ * 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.cxf.maven_plugin.wsdl2js;
+
+/**
+ * This exists to move this into the same package as the mojo.
+ */
+public class WsdlArtifact extends org.apache.cxf.maven_plugin.WsdlArtifact {
+
+ public WsdlArtifact() {
+ }
+
+}
Propchange:
cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/wsdl2js/WsdlArtifact.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/wsdl2js/WsdlArtifact.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added:
cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/wsdl2js/WsdlOption.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/wsdl2js/WsdlOption.java?rev=1214599&view=auto
==============================================================================
---
cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/wsdl2js/WsdlOption.java
(added)
+++
cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/wsdl2js/WsdlOption.java
Thu Dec 15 02:32:28 2011
@@ -0,0 +1,115 @@
+/**
+ * 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.cxf.maven_plugin.wsdl2js;
+
+import java.io.File;
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.cxf.maven_plugin.WsdlArtifact;
+
+/**
+ * An option for javascript generation.
+ */
+public class WsdlOption extends Option implements
org.apache.cxf.maven_plugin.GenericWsdlOption {
+
+ private String wsdl;
+ private WsdlArtifact artifact;
+
+ /**
+ * @return Pathname or URI to wsdl.
+ */
+ public String getWsdl() {
+ return wsdl;
+ }
+
+ /**
+ * Set pathname or URI to WSDL.
+ * @param wsdl path.
+ */
+ public void setWsdl(String wsdl) {
+ this.wsdl = wsdl;
+ }
+
+ /**
+ * Maven coordinates
+ * @return
+ */
+ public WsdlArtifact getArtifact() {
+ return artifact;
+ }
+ public void setArtifact(WsdlArtifact artifact) {
+ this.artifact = artifact;
+ }
+
+ public String getUri() {
+ return wsdl;
+ }
+
+ public void setUri(String uri) {
+ this.wsdl = uri;
+ }
+
+ public File[] getDeleteDirs() {
+ /*
+ * Until we figure out what this amounts to. I suspect it stays null
for Javascript.
+ */
+ return new File[0];
+ }
+
+ public List<String> generateCommandLine(File outputDirFile, URI basedir,
URI wsdlURI, boolean debug) {
+ List<String> options = new ArrayList<String>();
+ if (wsdlVersion != null && !"".equals(wsdlVersion)) {
+ options.add("-wv");
+ options.add(wsdlVersion);
+ }
+ if (packagePrefixes != null) {
+ for (UriPrefixPair upp : packagePrefixes) {
+ options.add("-p");
+ options.add(String.format("%s=%s", upp.getPrefix(),
upp.getUri()));
+ }
+ }
+ if (catalog != null && !"".equals(catalog)) {
+ options.add("-catalog");
+ options.add(catalog.getAbsolutePath());
+ }
+
+ options.add("-d");
+ if (output != null) {
+ options.add(output.getAbsolutePath());
+ } else {
+ options.add(outputDirFile.getAbsolutePath());
+ }
+ if (validate != null && validate) {
+ options.add("-validate");
+ }
+ if (debug) {
+ options.add("-v");
+ options.add("-V");
+ }
+ /*
+ * By the time we get here there's supposed to be a string
+ * in 'wsdl' that we can use as the uri.
+ */
+ options.add(wsdl);
+ return options;
+ }
+}
Propchange:
cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/wsdl2js/WsdlOption.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/wsdl2js/WsdlOption.java
------------------------------------------------------------------------------
svn:mime-type = text/plain