Author: alessio.soldano(a)jboss.com
Date: 2009-02-02 09:28:41 -0500 (Mon, 02 Feb 2009)
New Revision: 9197
Added:
stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/tools/CXFProviderFactoryImpl.java
stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/tools/CXFProviderImpl.java
stack/cxf/trunk/modules/client/src/main/resources/META-INF/services/org.jboss.wsf.spi.tools.ProviderFactoryImpl
Modified:
stack/cxf/trunk/modules/resources/src/main/resources/bin/wsprovide.bat
stack/cxf/trunk/modules/resources/src/main/resources/bin/wsprovide.sh
Log:
[JBWS-1774] CXF WSProvider, first cut
Added:
stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/tools/CXFProviderFactoryImpl.java
===================================================================
---
stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/tools/CXFProviderFactoryImpl.java
(rev 0)
+++
stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/tools/CXFProviderFactoryImpl.java 2009-02-02
14:28:41 UTC (rev 9197)
@@ -0,0 +1,41 @@
+/*
+ * 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.WSContractProvider;
+import org.jboss.wsf.spi.tools.WSContractProviderFactory;
+
+/**
+ * A WSContractProviderFactory for the CXF stack
+ *
+ * @author alessio.soldano(a)jboss.com
+ * @since 01-Feb-2009
+ */
+public class CXFProviderFactoryImpl implements WSContractProviderFactory
+{
+ public WSContractProvider createProvider(ClassLoader loader)
+ {
+ WSContractProvider metroProvider = new CXFProviderImpl();
+ metroProvider.setClassLoader(loader);
+ return metroProvider;
+ }
+}
Property changes on:
stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/tools/CXFProviderFactoryImpl.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/CXFProviderImpl.java
===================================================================
---
stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/tools/CXFProviderImpl.java
(rev 0)
+++
stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/tools/CXFProviderImpl.java 2009-02-02
14:28:41 UTC (rev 9197)
@@ -0,0 +1,221 @@
+/*
+ * 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.net.URLClassLoader;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.cxf.tools.java2ws.JavaToWS;
+import org.jboss.ws.tools.io.NullPrintStream;
+import org.jboss.wsf.spi.tools.WSContractProvider;
+
+/**
+ * A WSContractProvider for the CXF stack
+ *
+ * @author alessio.soldano(a)jboss.com
+ * @since 01-Feb-2009
+ */
+public class CXFProviderImpl extends WSContractProvider
+{
+ private ClassLoader loader;
+ private boolean generateWsdl = false;
+ private boolean generateSource = false;
+ private File outputDir = new File("output");
+ private File resourceDir = null;
+ private File sourceDir = null;
+ private PrintStream messageStream;
+
+ public CXFProviderImpl()
+ {
+ }
+
+ public void setGenerateWsdl(boolean generateWsdl)
+ {
+ this.generateWsdl = generateWsdl;
+ }
+
+ public void setGenerateSource(boolean generateSource)
+ {
+ this.generateSource = generateSource;
+ }
+
+ public void setOutputDirectory(File directory)
+ {
+ this.outputDir = directory;
+ }
+
+ public void setResourceDirectory(File directory)
+ {
+ this.resourceDir = directory;
+ }
+
+ public void setSourceDirectory(File directory)
+ {
+ this.sourceDir = directory;
+ }
+
+ public void setClassLoader(ClassLoader loader)
+ {
+ this.loader = loader;
+ }
+
+ public void setMessageStream(PrintStream messageStream)
+ {
+ this.messageStream = messageStream;
+ }
+
+ public void provide(String endpointClass)
+ {
+ try
+ {
+ provide(loader.loadClass(endpointClass));
+ }
+ catch (ClassNotFoundException e)
+ {
+ throw new IllegalArgumentException("Class not found: " +
endpointClass);
+ }
+ }
+
+ public void provide(Class<?> endpointClass)
+ {
+ // Swap the context classloader
+ // The '--classpath' switch might provide an URLClassLoader
+ ClassLoader oldLoader = Thread.currentThread().getContextClassLoader();
+
+ if (loader != null)
+ Thread.currentThread().setContextClassLoader(loader);
+
+ try
+ {
+ List<String> args = new ArrayList<String>();
+
+ // Use the output directory as the default
+ File resourceDir = (this.resourceDir != null) ? this.resourceDir : outputDir;
+ File sourceDir = (this.sourceDir != null) ? this.sourceDir : outputDir;
+
+ if (generateSource)
+ {
+
+ }
+
+ if (sourceDir != null)
+ {
+ if (!sourceDir.exists() && !sourceDir.mkdirs())
+ throw new IllegalStateException("Could not make directory: " +
sourceDir.getName());
+
+ args.add("-s");
+ args.add(sourceDir.getAbsolutePath());
+ }
+
+ if (!outputDir.exists() && !outputDir.mkdirs())
+ throw new IllegalStateException("Could not make directory: " +
outputDir.getName());
+
+ args.add("-classdir");
+ args.add(outputDir.getAbsolutePath());
+
+ if (resourceDir != null)
+ {
+ if (!resourceDir.exists() && !resourceDir.mkdirs())
+ throw new IllegalStateException("Could not make directory: " +
resourceDir.getName());
+ args.add("-d");
+ args.add(resourceDir.getAbsolutePath());
+ }
+
+ PrintStream stream = messageStream;
+ if (stream != null)
+ {
+ args.add("-verbose");
+ }
+ else
+ {
+ stream = NullPrintStream.getInstance();
+ }
+
+ if (generateWsdl)
+ {
+ args.add("-wsdl");
+ }
+
+ String cp = buildClasspathString(loader);
+ if (cp != null)
+ {
+ args.add("-cp");
+ args.add(cp);
+ }
+
+ args.add("-wrapperbean");
+
+ // the SEI
+ args.add(endpointClass.getCanonicalName());
+
+ JavaToWS j2w = new JavaToWS(args.toArray(new String[0]));
+ j2w.run();
+ }
+ catch (Throwable t)
+ {
+ if (messageStream != null)
+ {
+ messageStream.println("Failed to invoke JavaToWS");
+ t.printStackTrace(messageStream);
+ }
+ else
+ {
+ t.printStackTrace();
+ }
+ }
+ finally
+ {
+ Thread.currentThread().setContextClassLoader(oldLoader);
+ }
+ }
+
+ private String buildClasspathString(ClassLoader cl)
+ {
+ String cp = null;
+
+ if (cl instanceof URLClassLoader)
+ {
+ StringBuilder builder = new StringBuilder();
+ URLClassLoader urlLoader = (URLClassLoader)cl;
+ for (URL url : urlLoader.getURLs())
+ {
+ builder.append(url.getPath());
+ builder.append(File.pathSeparator);
+ }
+
+ if (cl.getParent() != null)
+ {
+ String parentPath = buildClasspathString(cl.getParent());
+ if (parentPath != null)
+ builder.append(parentPath);
+ }
+
+ cp = builder.toString();
+ }
+
+ return cp;
+ }
+}
Property changes on:
stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/tools/CXFProviderImpl.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.ProviderFactoryImpl
===================================================================
---
stack/cxf/trunk/modules/client/src/main/resources/META-INF/services/org.jboss.wsf.spi.tools.ProviderFactoryImpl
(rev 0)
+++
stack/cxf/trunk/modules/client/src/main/resources/META-INF/services/org.jboss.wsf.spi.tools.ProviderFactoryImpl 2009-02-02
14:28:41 UTC (rev 9197)
@@ -0,0 +1 @@
+org.jboss.wsf.stack.cxf.tools.CXFProviderFactoryImpl
\ No newline at end of file
Modified: stack/cxf/trunk/modules/resources/src/main/resources/bin/wsprovide.bat
===================================================================
--- stack/cxf/trunk/modules/resources/src/main/resources/bin/wsprovide.bat 2009-02-02
14:22:48 UTC (rev 9196)
+++ stack/cxf/trunk/modules/resources/src/main/resources/bin/wsprovide.bat 2009-02-02
14:28:41 UTC (rev 9197)
@@ -48,11 +48,41 @@
set WSPROVIDE_CLASSPATH=%WSPROVIDE_CLASSPATH%;%JBOSS_HOME%/client/stax-ex.jar
rem stack specific libs
-set
WSPROVIDE_CLASSPATH=%WSPROVIDE_CLASSPATH%;%JBOSS_HOME%/client/jbossws-metro-client.jar
+set WSPROVIDE_CLASSPATH=%WSPROVIDE_CLASSPATH%;%JBOSS_HOME%/client/jbossws-cxf-client.jar
+set WSPROVIDE_CLASSPATH=%WSPROVIDE_CLASSPATH%;%JBOSS_HOME%/client/cxf-api.jar
+set
WSPROVIDE_CLASSPATH=%WSPROVIDE_CLASSPATH%;%JBOSS_HOME%/client/cxf-common-utilities.jar
+set
WSPROVIDE_CLASSPATH=%WSPROVIDE_CLASSPATH%;%JBOSS_HOME%/client/cxf-rt-bindings-corba.jar
+set
WSPROVIDE_CLASSPATH=%WSPROVIDE_CLASSPATH%;%JBOSS_HOME%/client/cxf-rt-bindings-xml.jar
+set
WSPROVIDE_CLASSPATH=%WSPROVIDE_CLASSPATH%;%JBOSS_HOME%/client/cxf-rt-bindings-soap.jar
+set WSPROVIDE_CLASSPATH=%WSPROVIDE_CLASSPATH%;%JBOSS_HOME%/client/cxf-rt-core.jar
+set
WSPROVIDE_CLASSPATH=%WSPROVIDE_CLASSPATH%;%JBOSS_HOME%/client/cxf-rt-databinding-jaxb.jar
+set
WSPROVIDE_CLASSPATH=%WSPROVIDE_CLASSPATH%;%JBOSS_HOME%/client/cxf-rt-frontend-jaxws.jar
+set
WSPROVIDE_CLASSPATH=%WSPROVIDE_CLASSPATH%;%JBOSS_HOME%/client/cxf-rt-frontend-simple.jar
+set WSPROVIDE_CLASSPATH=%WSPROVIDE_CLASSPATH%;%JBOSS_HOME%/client/cxf-rt-javascript.jar
+set WSPROVIDE_CLASSPATH=%WSPROVIDE_CLASSPATH%;%JBOSS_HOME%/client/cxf-rt-management.jar
+set
WSPROVIDE_CLASSPATH=%WSPROVIDE_CLASSPATH%;%JBOSS_HOME%/client/cxf-rt-transports-http.jar
+set
WSPROVIDE_CLASSPATH=%WSPROVIDE_CLASSPATH%;%JBOSS_HOME%/client/cxf-rt-transports-http-jetty.jar
+set
WSPROVIDE_CLASSPATH=%WSPROVIDE_CLASSPATH%;%JBOSS_HOME%/client/cxf-rt-transports-jms.jar
+set WSPROVIDE_CLASSPATH=%WSPROVIDE_CLASSPATH%;%JBOSS_HOME%/client/cxf-rt-ws-addr.jar
+set WSPROVIDE_CLASSPATH=%WSPROVIDE_CLASSPATH%;%JBOSS_HOME%/client/cxf-rt-ws-policy.jar
+set WSPROVIDE_CLASSPATH=%WSPROVIDE_CLASSPATH%;%JBOSS_HOME%/client/cxf-rt-ws-rm.jar
+set WSPROVIDE_CLASSPATH=%WSPROVIDE_CLASSPATH%;%JBOSS_HOME%/client/cxf-tools-java2ws.jar
+set WSPROVIDE_CLASSPATH=%WSPROVIDE_CLASSPATH%;%JBOSS_HOME%/client/cxf-tools-common.jar
+set
WSPROVIDE_CLASSPATH=%WSPROVIDE_CLASSPATH%;%JBOSS_HOME%/client/commons-collections.jar
+set WSPROVIDE_CLASSPATH=%WSPROVIDE_CLASSPATH%;%JBOSS_HOME%/client/commons-lang.jar
+set WSPROVIDE_CLASSPATH=%WSPROVIDE_CLASSPATH%;%JBOSS_HOME%/client/FastInfoset.jar
+set
WSPROVIDE_CLASSPATH=%WSPROVIDE_CLASSPATH%;%JBOSS_HOME%/client/geronimo-ws-metadata_2.0_spec.jar
set WSPROVIDE_CLASSPATH=%WSPROVIDE_CLASSPATH%;%JBOSS_HOME%/client/jaxws-api.jar
-set WSPROVIDE_CLASSPATH=%WSPROVIDE_CLASSPATH%;%JBOSS_HOME%/client/jsr181-api.jar
+set WSPROVIDE_CLASSPATH=%WSPROVIDE_CLASSPATH%;%JBOSS_HOME%/client/neethi.jar
+set WSPROVIDE_CLASSPATH=%WSPROVIDE_CLASSPATH%;%JBOSS_HOME%/client/spring-beans.jar
+set WSPROVIDE_CLASSPATH=%WSPROVIDE_CLASSPATH%;%JBOSS_HOME%/client/spring-context.jar
+set WSPROVIDE_CLASSPATH=%WSPROVIDE_CLASSPATH%;%JBOSS_HOME%/client/spring-core.jar
set WSPROVIDE_CLASSPATH=%WSPROVIDE_CLASSPATH%;%JBOSS_HOME%/client/saaj-api.jar
set WSPROVIDE_CLASSPATH=%WSPROVIDE_CLASSPATH%;%JBOSS_HOME%/client/saaj-impl.jar
+set WSPROVIDE_CLASSPATH=%WSPROVIDE_CLASSPATH%;%JBOSS_HOME%/client/velocity.jar
+set WSPROVIDE_CLASSPATH=%WSPROVIDE_CLASSPATH%;%JBOSS_HOME%/client/XmlSchema.jar
+set WSPROVIDE_CLASSPATH=%WSPROVIDE_CLASSPATH%;%JBOSS_HOME%/client/wsdl4j.jar
+set WSPROVIDE_CLASSPATH=%WSPROVIDE_CLASSPATH%;%JBOSS_HOME%/client/wstx.jar
rem Execute the JVM
"%JAVA%" %JAVA_OPTS% -Djava.endorsed.dirs="%JBOSS_ENDORSED_DIRS%"
-Dlog4j.configuration=wstools-log4j.xml -classpath "%WSPROVIDE_CLASSPATH%"
org.jboss.wsf.spi.tools.cmd.WSProvide %*
Modified: stack/cxf/trunk/modules/resources/src/main/resources/bin/wsprovide.sh
===================================================================
--- stack/cxf/trunk/modules/resources/src/main/resources/bin/wsprovide.sh 2009-02-02
14:22:48 UTC (rev 9196)
+++ stack/cxf/trunk/modules/resources/src/main/resources/bin/wsprovide.sh 2009-02-02
14:28:41 UTC (rev 9197)
@@ -84,11 +84,41 @@
WSPROVIDE_CLASSPATH="$WSPROVIDE_CLASSPATH:$LIBDIR/stax-ex.jar"
# stack specific dependencies
-WSPROVIDE_CLASSPATH="$WSPROVIDE_CLASSPATH:$LIBDIR/jbossws-metro-client.jar"
+WSPROVIDE_CLASSPATH="$WSPROVIDE_CLASSPATH:$LIBDIR/jbossws-cxf-client.jar"
+WSPROVIDE_CLASSPATH="$WSPROVIDE_CLASSPATH:$LIBDIR/cxf-api.jar"
+WSPROVIDE_CLASSPATH="$WSPROVIDE_CLASSPATH:$LIBDIR/cxf-common-utilities.jar"
+WSPROVIDE_CLASSPATH="$WSPROVIDE_CLASSPATH:$LIBDIR/cxf-rt-bindings-corba.jar"
+WSPROVIDE_CLASSPATH="$WSPROVIDE_CLASSPATH:$LIBDIR/cxf-rt-bindings-xml.jar"
+WSPROVIDE_CLASSPATH="$WSPROVIDE_CLASSPATH:$LIBDIR/cxf-rt-bindings-soap.jar"
+WSPROVIDE_CLASSPATH="$WSPROVIDE_CLASSPATH:$LIBDIR/cxf-rt-core.jar"
+WSPROVIDE_CLASSPATH="$WSPROVIDE_CLASSPATH:$LIBDIR/cxf-rt-databinding-jaxb.jar"
+WSPROVIDE_CLASSPATH="$WSPROVIDE_CLASSPATH:$LIBDIR/cxf-rt-frontend-jaxws.jar"
+WSPROVIDE_CLASSPATH="$WSPROVIDE_CLASSPATH:$LIBDIR/cxf-rt-frontend-simple.jar"
+WSPROVIDE_CLASSPATH="$WSPROVIDE_CLASSPATH:$LIBDIR/cxf-rt-javascript.jar"
+WSPROVIDE_CLASSPATH="$WSPROVIDE_CLASSPATH:$LIBDIR/cxf-rt-management.jar"
+WSPROVIDE_CLASSPATH="$WSPROVIDE_CLASSPATH:$LIBDIR/cxf-rt-transports-http.jar"
+WSPROVIDE_CLASSPATH="$WSPROVIDE_CLASSPATH:$LIBDIR/cxf-rt-transports-http-jetty.jar"
+WSPROVIDE_CLASSPATH="$WSPROVIDE_CLASSPATH:$LIBDIR/cxf-rt-transports-jms.jar"
+WSPROVIDE_CLASSPATH="$WSPROVIDE_CLASSPATH:$LIBDIR/cxf-rt-ws-addr.jar"
+WSPROVIDE_CLASSPATH="$WSPROVIDE_CLASSPATH:$LIBDIR/cxf-rt-ws-policy.jar"
+WSPROVIDE_CLASSPATH="$WSPROVIDE_CLASSPATH:$LIBDIR/cxf-rt-ws-rm.jar"
+WSPROVIDE_CLASSPATH="$WSPROVIDE_CLASSPATH:$LIBDIR/cxf-tools-java2ws.jar"
+WSPROVIDE_CLASSPATH="$WSPROVIDE_CLASSPATH:$LIBDIR/cxf-tools-common.jar"
+WSPROVIDE_CLASSPATH="$WSPROVIDE_CLASSPATH:$LIBDIR/commons-collections.jar"
+WSPROVIDE_CLASSPATH="$WSPROVIDE_CLASSPATH:$LIBDIR/commons-lang.jar"
+WSPROVIDE_CLASSPATH="$WSPROVIDE_CLASSPATH:$LIBDIR/FastInfoset.jar"
+WSPROVIDE_CLASSPATH="$WSPROVIDE_CLASSPATH:$LIBDIR/geronimo-ws-metadata_2.0_spec.jar"
WSPROVIDE_CLASSPATH="$WSPROVIDE_CLASSPATH:$LIBDIR/jaxws-api.jar"
-WSPROVIDE_CLASSPATH="$WSPROVIDE_CLASSPATH:$LIBDIR/jsr181-api.jar"
+WSPROVIDE_CLASSPATH="$WSPROVIDE_CLASSPATH:$LIBDIR/neethi.jar"
+WSPROVIDE_CLASSPATH="$WSPROVIDE_CLASSPATH:$LIBDIR/spring-beans.jar"
+WSPROVIDE_CLASSPATH="$WSPROVIDE_CLASSPATH:$LIBDIR/spring-context.jar"
+WSPROVIDE_CLASSPATH="$WSPROVIDE_CLASSPATH:$LIBDIR/spring-core.jar"
WSPROVIDE_CLASSPATH="$WSPROVIDE_CLASSPATH:$LIBDIR/saaj-api.jar"
WSPROVIDE_CLASSPATH="$WSPROVIDE_CLASSPATH:$LIBDIR/saaj-impl.jar"
+WSPROVIDE_CLASSPATH="$WSPROVIDE_CLASSPATH:$LIBDIR/velocity.jar"
+WSPROVIDE_CLASSPATH="$WSPROVIDE_CLASSPATH:$LIBDIR/XmlSchema.jar"
+WSPROVIDE_CLASSPATH="$WSPROVIDE_CLASSPATH:$LIBDIR/wsdl4j.jar"
+WSPROVIDE_CLASSPATH="$WSPROVIDE_CLASSPATH:$LIBDIR/wstx.jar"
###
# Execute the JVM