Author: alessio.soldano(a)jboss.com
Date: 2009-01-31 22:48:00 -0500 (Sat, 31 Jan 2009)
New Revision: 9180
Added:
stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/tools/
stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/tools/CXFConsumerFactoryImpl.java
stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/tools/CXFConsumerImpl.java
stack/cxf/trunk/modules/client/src/main/resources/META-INF/services/org.jboss.wsf.spi.tools.ConsumerFactoryImpl
Modified:
stack/cxf/trunk/modules/resources/src/main/resources/bin/wsconsume.bat
stack/cxf/trunk/modules/resources/src/main/resources/bin/wsconsume.sh
Log:
[JBWS-1774] CXF WSContractConsumer, first cut
Added:
stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/tools/CXFConsumerFactoryImpl.java
===================================================================
---
stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/tools/CXFConsumerFactoryImpl.java
(rev 0)
+++
stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/tools/CXFConsumerFactoryImpl.java 2009-02-01
03:48:00 UTC (rev 9180)
@@ -0,0 +1,39 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.wsf.stack.cxf.tools;
+
+import org.jboss.wsf.spi.tools.WSContractConsumer;
+import org.jboss.wsf.spi.tools.WSContractConsumerFactory;
+
+/**
+ * A WSContractConsumerFactory for CXF stack
+ *
+ * @author alessio.soldano(a)jboss.com
+ * @since 01-Feb-2009
+ */
+public class CXFConsumerFactoryImpl implements WSContractConsumerFactory
+{
+ public WSContractConsumer createConsumer()
+ {
+ return new CXFConsumerImpl();
+ }
+}
Property changes on:
stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/tools/CXFConsumerFactoryImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/tools/CXFConsumerImpl.java
===================================================================
---
stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/tools/CXFConsumerImpl.java
(rev 0)
+++
stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/tools/CXFConsumerImpl.java 2009-02-01
03:48:00 UTC (rev 9180)
@@ -0,0 +1,239 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.wsf.stack.cxf.tools;
+
+import java.io.File;
+import java.io.PrintStream;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.cxf.tools.common.ToolContext;
+import org.apache.cxf.tools.wsdlto.WSDLToJava;
+import org.jboss.ws.tools.io.NullPrintStream;
+import org.jboss.wsf.spi.tools.WSContractConsumer;
+
+/**
+ * A WSContractConsumer for CXF stack
+ *
+ * @author alessio.soldano(a)jboss.com
+ * @since 01-Feb-2009
+ */
+public class CXFConsumerImpl extends WSContractConsumer
+{
+ private List<File> bindingFiles = null;
+ private File catalog = null;
+ private boolean extension;
+ private boolean generateSource = false;
+ private File outputDir = new File("output");
+ private File sourceDir = null;
+ private String targetPackage = null;
+ private PrintStream messageStream = null;
+ private String wsdlLocation = null;
+ private List<String> additionalCompilerClassPath = new
ArrayList<String>();
+ private String target = null;
+ private boolean nocompile = false;
+
+ @Override
+ public void setBindingFiles(List<File> bindingFiles)
+ {
+ this.bindingFiles = bindingFiles;
+ }
+
+ @Override
+ public void setCatalog(File catalog)
+ {
+ this.catalog = catalog;
+ }
+
+ @Override
+ public void setExtension(boolean extension)
+ {
+ this.extension = extension;
+ }
+
+ @Override
+ public void setGenerateSource(boolean generateSource)
+ {
+ this.generateSource = generateSource;
+ }
+
+ @Override
+ public void setMessageStream(PrintStream messageStream)
+ {
+ this.messageStream = messageStream;
+ }
+
+ @Override
+ public void setOutputDirectory(File directory)
+ {
+ outputDir = directory;
+ }
+
+ @Override
+ public void setSourceDirectory(File directory)
+ {
+ sourceDir = directory;
+ }
+
+ @Override
+ public void setTargetPackage(String targetPackage)
+ {
+ this.targetPackage = targetPackage;
+ }
+
+ @Override
+ public void setWsdlLocation(String wsdlLocation)
+ {
+ this.wsdlLocation = wsdlLocation;
+ }
+
+ public void setAdditionalCompilerClassPath(List<String>
additionalCompilerClassPath)
+ {
+ this.additionalCompilerClassPath = additionalCompilerClassPath;
+ }
+
+ @Override
+ public void setTarget(String target)
+ {
+ this.target = target;
+ }
+
+ @Override
+ public void setNoCompile(boolean nocompile)
+ {
+ this.nocompile = nocompile;
+ }
+
+ @Override
+ public void consume(URL wsdl)
+ {
+ List<String> args = new ArrayList<String>();
+ if (bindingFiles != null)
+ {
+ for (File file : bindingFiles)
+ {
+ args.add("-b");
+ args.add(file.getAbsolutePath());
+
+ }
+ }
+
+ if (catalog != null)
+ {
+ args.add("-catalog");
+ args.add(catalog.getAbsolutePath());
+ }
+
+ if (extension)
+ {
+ messageStream.println("TODO! Cheek SOAP 1.2 extension");
+ }
+
+ if (!nocompile)
+ {
+ args.add("-compile");
+ }
+
+ if (generateSource && sourceDir == null)
+ {
+ sourceDir = outputDir;
+ }
+
+ if (sourceDir != null)
+ {
+ if (!sourceDir.exists() && !sourceDir.mkdirs())
+ throw new IllegalStateException("Could not make directory: " +
sourceDir.getName());
+
+ args.add("-d");
+ args.add(sourceDir.getAbsolutePath());
+ }
+
+ if (targetPackage != null)
+ {
+ args.add("-p");
+ args.add(targetPackage);
+ }
+
+ if (wsdlLocation != null)
+ {
+ args.add("-wsdlLocation");
+ args.add(wsdlLocation);
+ }
+
+ PrintStream stream = messageStream;
+ if (stream != null)
+ {
+ args.add("-verbose");
+ }
+ else
+ {
+ stream = NullPrintStream.getInstance();
+ }
+
+ if (!outputDir.exists() && !outputDir.mkdirs())
+ throw new IllegalStateException("Could not make directory: " +
outputDir.getName());
+
+ // Always add the output directory and the wsdl location
+ args.add("-classdir");
+ args.add(outputDir.getAbsolutePath());
+
+ // Always set the target
+ if (target != null)
+ {
+ messageStream.println("WSConsume (CXF) does not allow to setup the JAX-WS
specification target, using JAX-WS 2.1.");
+ }
+
+ // finally the WSDL file
+ args.add(wsdl.toString());
+
+ // See WsimportTool#compileGeneratedClasses()
+ if (!additionalCompilerClassPath.isEmpty())
+ {
+ StringBuffer javaCP = new StringBuffer();
+ for (String s : additionalCompilerClassPath)
+ {
+ javaCP.append(s).append(File.pathSeparator);
+ }
+ System.setProperty("java.class.path", javaCP.toString());
+ }
+
+
+ WSDLToJava w2j = new WSDLToJava(args.toArray(new String[0]));
+ try
+ {
+ w2j.run(new ToolContext());
+ }
+ catch (Throwable t)
+ {
+ if (messageStream != null)
+ {
+ messageStream.println("Failed to invoke WSDLToJava");
+ t.printStackTrace(messageStream);
+ }
+ else
+ {
+ t.printStackTrace();
+ }
+ }
+ }
+}
Property changes on:
stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/tools/CXFConsumerImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
stack/cxf/trunk/modules/client/src/main/resources/META-INF/services/org.jboss.wsf.spi.tools.ConsumerFactoryImpl
===================================================================
---
stack/cxf/trunk/modules/client/src/main/resources/META-INF/services/org.jboss.wsf.spi.tools.ConsumerFactoryImpl
(rev 0)
+++
stack/cxf/trunk/modules/client/src/main/resources/META-INF/services/org.jboss.wsf.spi.tools.ConsumerFactoryImpl 2009-02-01
03:48:00 UTC (rev 9180)
@@ -0,0 +1 @@
+org.jboss.wsf.stack.cxf.tools.CXFConsumerFactoryImpl
\ No newline at end of file
Modified: stack/cxf/trunk/modules/resources/src/main/resources/bin/wsconsume.bat
===================================================================
--- stack/cxf/trunk/modules/resources/src/main/resources/bin/wsconsume.bat 2009-01-30
16:43:57 UTC (rev 9179)
+++ stack/cxf/trunk/modules/resources/src/main/resources/bin/wsconsume.bat 2009-02-01
03:48:00 UTC (rev 9180)
@@ -50,7 +50,27 @@
set WSCONSUME_CLASSPATH=%WSCONSUME_CLASSPATH%;%JBOSS_HOME%/client/stax-ex.jar
rem stack specific libs
-set
WSCONSUME_CLASSPATH=%WSCONSUME_CLASSPATH%;%JBOSS_HOME%/client/jbossws-metro-client.jar
+set WSCONSUME_CLASSPATH=%WSCONSUME_CLASSPATH%;%JBOSS_HOME%/client/jbossws-cxf-client.jar
+set
WSCONSUME_CLASSPATH=%WSCONSUME_CLASSPATH%;%JBOSS_HOME%/client/commons-collections.jar
+set WSCONSUME_CLASSPATH=%WSCONSUME_CLASSPATH%;%JBOSS_HOME%/client/commons-lang.jar
+set WSCONSUME_CLASSPATH=%WSCONSUME_CLASSPATH%;%JBOSS_HOME%/client/cxf-api.jar
+set
WSCONSUME_CLASSPATH=%WSCONSUME_CLASSPATH%;%JBOSS_HOME%/client/cxf-common-utilities.jar
+set
WSCONSUME_CLASSPATH=%WSCONSUME_CLASSPATH%;%JBOSS_HOME%/client/cxf-rt-bindings-xml.jar
+set WSCONSUME_CLASSPATH=%WSCONSUME_CLASSPATH%;%JBOSS_HOME%/client/cxf-rt-core.jar
+set WSCONSUME_CLASSPATH=%WSCONSUME_CLASSPATH%;%JBOSS_HOME%/client/cxf-rt-management.jar
+set
WSCONSUME_CLASSPATH=%WSCONSUME_CLASSPATH%;%JBOSS_HOME%/client/cxf-rt-bindings-soap.jar
+set
WSCONSUME_CLASSPATH=%WSCONSUME_CLASSPATH%;%JBOSS_HOME%/client/cxf-rt-transports-jms.jar
+set
WSCONSUME_CLASSPATH=%WSCONSUME_CLASSPATH%;%JBOSS_HOME%/client/cxf-rt-transports-http.jar
+set WSCONSUME_CLASSPATH=%WSCONSUME_CLASSPATH%;%JBOSS_HOME%/client/cxf-tools-common.jar
+set
WSCONSUME_CLASSPATH=%WSCONSUME_CLASSPATH%;%JBOSS_HOME%/client/cxf-tools-validator.jar
+set
WSCONSUME_CLASSPATH=%WSCONSUME_CLASSPATH%;%JBOSS_HOME%/client/cxf-tools-wsdlto-core.jar
+set
WSCONSUME_CLASSPATH=%WSCONSUME_CLASSPATH%;%JBOSS_HOME%/client/cxf-tools-wsdlto-databinding-jaxb.jar
+set
WSCONSUME_CLASSPATH=%WSCONSUME_CLASSPATH%;%JBOSS_HOME%/client/cxf-tools-wsdlto-frontend-jaxws.jar
+set
WSCONSUME_CLASSPATH=%WSCONSUME_CLASSPATH%;%JBOSS_HOME%/client/geronimo-ws-metadata_2.0_spec.jar
+set WSCONSUME_CLASSPATH=%WSCONSUME_CLASSPATH%;%JBOSS_HOME%/client/jaxws-api.jar
+set WSCONSUME_CLASSPATH=%WSCONSUME_CLASSPATH%;%JBOSS_HOME%/client/velocity.jar
+set WSCONSUME_CLASSPATH=%WSCONSUME_CLASSPATH%;%JBOSS_HOME%/client/XmlSchema.jar
+set WSCONSUME_CLASSPATH=%WSCONSUME_CLASSPATH%;%JBOSS_HOME%/client/wsdl4j.jar
rem Execute the JVM
"%JAVA%" %JAVA_OPTS% -Djava.endorsed.dirs="%JBOSS_ENDORSED_DIRS%"
-Dlog4j.configuration=wstools-log4j.xml -classpath "%WSCONSUME_CLASSPATH%"
org.jboss.wsf.spi.tools.cmd.WSConsume %*
Modified: stack/cxf/trunk/modules/resources/src/main/resources/bin/wsconsume.sh
===================================================================
--- stack/cxf/trunk/modules/resources/src/main/resources/bin/wsconsume.sh 2009-01-30
16:43:57 UTC (rev 9179)
+++ stack/cxf/trunk/modules/resources/src/main/resources/bin/wsconsume.sh 2009-02-01
03:48:00 UTC (rev 9180)
@@ -84,7 +84,27 @@
WSCONSUME_CLASSPATH="$WSCONSUME_CLASSPATH:$LIBDIR/stax-ex.jar"
# Stack specific dependencies
-WSCONSUME_CLASSPATH="$WSCONSUME_CLASSPATH:$LIBDIR/jbossws-metro-client.jar"
+WSCONSUME_CLASSPATH="$WSCONSUME_CLASSPATH:$LIBDIR/jbossws-cxf-client.jar"
+WSCONSUME_CLASSPATH="$WSCONSUME_CLASSPATH:$LIBDIR/commons-collections.jar"
+WSCONSUME_CLASSPATH="$WSCONSUME_CLASSPATH:$LIBDIR/commons-lang.jar"
+WSCONSUME_CLASSPATH="$WSCONSUME_CLASSPATH:$LIBDIR/cxf-api.jar"
+WSCONSUME_CLASSPATH="$WSCONSUME_CLASSPATH:$LIBDIR/cxf-common-utilities.jar"
+WSCONSUME_CLASSPATH="$WSCONSUME_CLASSPATH:$LIBDIR/cxf-rt-bindings-xml.jar"
+WSCONSUME_CLASSPATH="$WSCONSUME_CLASSPATH:$LIBDIR/cxf-rt-core.jar"
+WSCONSUME_CLASSPATH="$WSCONSUME_CLASSPATH:$LIBDIR/cxf-rt-management.jar"
+WSCONSUME_CLASSPATH="$WSCONSUME_CLASSPATH:$LIBDIR/cxf-rt-bindings-soap.jar"
+WSCONSUME_CLASSPATH="$WSCONSUME_CLASSPATH:$LIBDIR/cxf-rt-transports-jms.jar"
+WSCONSUME_CLASSPATH="$WSCONSUME_CLASSPATH:$LIBDIR/cxf-rt-transports-http.jar"
+WSCONSUME_CLASSPATH="$WSCONSUME_CLASSPATH:$LIBDIR/cxf-tools-common.jar"
+WSCONSUME_CLASSPATH="$WSCONSUME_CLASSPATH:$LIBDIR/cxf-tools-validator.jar"
+WSCONSUME_CLASSPATH="$WSCONSUME_CLASSPATH:$LIBDIR/cxf-tools-wsdlto-core.jar"
+WSCONSUME_CLASSPATH="$WSCONSUME_CLASSPATH:$LIBDIR/cxf-tools-wsdlto-databinding-jaxb.jar"
+WSCONSUME_CLASSPATH="$WSCONSUME_CLASSPATH:$LIBDIR/cxf-tools-wsdlto-frontend-jaxws.jar"
+WSCONSUME_CLASSPATH="$WSCONSUME_CLASSPATH:$LIBDIR/geronimo-ws-metadata_2.0_spec.jar"
+WSCONSUME_CLASSPATH="$WSCONSUME_CLASSPATH:$LIBDIR/jaxws-api.jar"
+WSCONSUME_CLASSPATH="$WSCONSUME_CLASSPATH:$LIBDIR/velocity.jar"
+WSCONSUME_CLASSPATH="$WSCONSUME_CLASSPATH:$LIBDIR/XmlSchema.jar"
+WSCONSUME_CLASSPATH="$WSCONSUME_CLASSPATH:$LIBDIR/wsdl4j.jar"
###
# Execute the JVM