Author: heiko.braun(a)jboss.com
Date: 2007-05-15 11:38:54 -0400 (Tue, 15 May 2007)
New Revision: 3100
Added:
branches/hbraun/trunk/jbossws-core/src/java/org/jboss/ws/integration/tools/
branches/hbraun/trunk/jbossws-core/src/java/org/jboss/ws/integration/tools/jaxws/
branches/hbraun/trunk/jbossws-core/src/java/org/jboss/ws/integration/tools/jaxws/ant/
branches/hbraun/trunk/jbossws-core/src/java/org/jboss/ws/integration/tools/jaxws/ant/wsconsume.java
branches/hbraun/trunk/jbossws-core/src/java/org/jboss/ws/integration/tools/jaxws/ant/wsprovide.java
branches/hbraun/trunk/jbossws-core/src/java/org/jboss/ws/integration/tools/jaxws/api/
branches/hbraun/trunk/jbossws-core/src/java/org/jboss/ws/integration/tools/jaxws/api/Locator.java
branches/hbraun/trunk/jbossws-core/src/java/org/jboss/ws/integration/tools/jaxws/api/WSContractConsumer.java
branches/hbraun/trunk/jbossws-core/src/java/org/jboss/ws/integration/tools/jaxws/api/WSContractProvider.java
branches/hbraun/trunk/jbossws-core/src/java/org/jboss/ws/integration/tools/jaxws/command/
branches/hbraun/trunk/jbossws-core/src/java/org/jboss/ws/integration/tools/jaxws/command/wsconsume.java
branches/hbraun/trunk/jbossws-core/src/java/org/jboss/ws/integration/tools/jaxws/command/wsprovide.java
branches/hbraun/trunk/jbossws-core/src/java/org/jboss/ws/integration/tools/jaxws/impl/
branches/hbraun/trunk/jbossws-core/src/java/org/jboss/ws/integration/tools/jaxws/impl/BytecodeWrapperGenerator.java
branches/hbraun/trunk/jbossws-core/src/java/org/jboss/ws/integration/tools/jaxws/impl/ChainedWritableWrapperGenerator.java
branches/hbraun/trunk/jbossws-core/src/java/org/jboss/ws/integration/tools/jaxws/impl/JBossWSProviderFactoryImpl.java
branches/hbraun/trunk/jbossws-core/src/java/org/jboss/ws/integration/tools/jaxws/impl/JBossWSProviderImpl.java
branches/hbraun/trunk/jbossws-core/src/java/org/jboss/ws/integration/tools/jaxws/impl/NullPrintStream.java
branches/hbraun/trunk/jbossws-core/src/java/org/jboss/ws/integration/tools/jaxws/impl/SourceWrapperGenerator.java
branches/hbraun/trunk/jbossws-core/src/java/org/jboss/ws/integration/tools/jaxws/impl/SunRIConsumerFactoryImpl.java
branches/hbraun/trunk/jbossws-core/src/java/org/jboss/ws/integration/tools/jaxws/impl/SunRIConsumerImpl.java
branches/hbraun/trunk/jbossws-core/src/java/org/jboss/ws/integration/tools/jaxws/impl/WritableWrapperGenerator.java
branches/hbraun/trunk/jbossws-core/src/java/org/jboss/ws/integration/tools/jaxws/spi/
branches/hbraun/trunk/jbossws-core/src/java/org/jboss/ws/integration/tools/jaxws/spi/WSContractConsumerFactory.java
branches/hbraun/trunk/jbossws-core/src/java/org/jboss/ws/integration/tools/jaxws/spi/WSContractProviderFactory.java
branches/hbraun/trunk/jbossws-core/src/java/org/jboss/ws/tools/wsdl/JAXBWSDLGenerator.java
Modified:
branches/hbraun/trunk/build/ant-import/build-deploy.xml
branches/hbraun/trunk/build/ant-import/build-release.xml
branches/hbraun/trunk/build/ant-import/build-thirdparty.xml
branches/hbraun/trunk/build/etc/component-info/jbossws.xml
branches/hbraun/trunk/build/etc/wsconsume.bat
branches/hbraun/trunk/build/etc/wsconsume.sh
branches/hbraun/trunk/build/etc/wsprovide.bat
branches/hbraun/trunk/build/etc/wsprovide.sh
branches/hbraun/trunk/build/etc/wspublish.sh
branches/hbraun/trunk/build/version.properties
branches/hbraun/trunk/jbossws-core/build.xml
branches/hbraun/trunk/jbossws-core/src/java/org/jboss/ws/metadata/builder/jaxws/JAXWSWebServiceMetaDataBuilder.java
branches/hbraun/trunk/jbossws-core/src/resources/samples/build.xml
branches/hbraun/trunk/jbossws-tests/build.xml
branches/hbraun/trunk/jbossws-tests/src/java/org/jboss/test/ws/tools/jaxws/WSContractProviderTestCase.java
Log:
Fetch binaries from repository. Consolidate package structure
Modified: branches/hbraun/trunk/build/ant-import/build-deploy.xml
===================================================================
--- branches/hbraun/trunk/build/ant-import/build-deploy.xml 2007-05-15 14:01:18 UTC (rev
3099)
+++ branches/hbraun/trunk/build/ant-import/build-deploy.xml 2007-05-15 15:38:54 UTC (rev
3100)
@@ -57,13 +57,15 @@
<include name="jboss-jaxws.jar"/>
<include name="jboss-saaj.jar"/>
<include name="jbossws-client.jar"/>
+ <include name="jbossws-integration-tools.jar"/>
</fileset>
<fileset dir="${thirdparty.dir}">
<include name="jaxb-api.jar"/>
<include name="jaxb-impl.jar"/>
<include name="jaxb-xjc.jar"/>
- <include name="wsdl4j.jar"/>
- <include name="jbossws-wsconsume-impl.jar"/>
+ <include name="jaxws-rt.jar"/>
+ <include name="jaxws-tools.jar"/>
+ <include name="wsdl4j.jar"/>
</fileset>
</copy>
<copy todir="${jboss50.home}/server/${jboss.server.instance}/lib"
overwrite="true">
@@ -106,12 +108,14 @@
<include name="jboss-jaxws.jar"/>
<include name="jboss-saaj.jar"/>
<include name="jbossws-client.jar"/>
+ <include name="jbossws-integration-tools.jar"/>
</fileset>
<fileset dir="${thirdparty.dir}">
<include name="jaxb-api.jar"/>
<include name="jaxb-impl.jar"/>
<include name="jaxb-xjc.jar"/>
- <include name="jbossws-wsconsume-impl.jar"/>
+ <include name="jaxws-rt.jar"/>
+ <include name="jaxws-tools.jar"/>
</fileset>
</copy>
<copy todir="${jboss42.home}/server/${jboss.server.instance}/lib"
overwrite="true">
@@ -153,13 +157,15 @@
<include name="jboss-jaxws.jar" />
<include name="jboss-saaj.jar" />
<include name="jbossws-client.jar" />
+ <include name="jbossws-integration-tools.jar"/>
</fileset>
<!-- Only available on jdk1.5 -->
<fileset dir="${thirdparty.dir}">
<include name="jaxb-api.jar" />
<include name="jaxb-impl.jar" />
<include name="jaxb-xjc.jar" />
- <include name="jbossws-wsconsume-impl.jar" />
+ <include name="jaxws-rt.jar"/>
+ <include name="jaxws-tools.jar"/>
<include name="stax-api.jar"/>
<include name="wstx.jar"/>
</fileset>
Modified: branches/hbraun/trunk/build/ant-import/build-release.xml
===================================================================
--- branches/hbraun/trunk/build/ant-import/build-release.xml 2007-05-15 14:01:18 UTC (rev
3099)
+++ branches/hbraun/trunk/build/ant-import/build-release.xml 2007-05-15 15:38:54 UTC (rev
3100)
@@ -221,7 +221,7 @@
<copy todir="${install.thirdparty.dir}" overwrite="true">
<fileset dir="${thirdparty.dir}">
<include name="activation.jar"/>
- <include name="jbossws-wsconsume-impl.jar"/>
+ <include name="jbossws-integration-tools.jar"/>
<include name="jboss-xml-binding.jar"/>
<include name="jaxb-*.jar"/>
<include name="juddi-service.sar"/>
Modified: branches/hbraun/trunk/build/ant-import/build-thirdparty.xml
===================================================================
--- branches/hbraun/trunk/build/ant-import/build-thirdparty.xml 2007-05-15 14:01:18 UTC
(rev 3099)
+++ branches/hbraun/trunk/build/ant-import/build-thirdparty.xml 2007-05-15 15:38:54 UTC
(rev 3100)
@@ -35,8 +35,8 @@
<get
src="${jboss.repository}/apache-xerces/${apache-xerces}/lib/xml-apis.jar"
dest="${thirdparty.dir}/xml-apis.jar" usetimestamp="true"
verbose="true"/>
<get
src="${jboss.repository}/apache-xmlsec/${apache-xmlsec}/lib/xmlsec.jar"
dest="${thirdparty.dir}/xmlsec.jar" usetimestamp="true"
verbose="true"/>
<get src="${jboss.repository}/dom4j/${dom4j}/lib/dom4j.jar"
dest="${thirdparty.dir}/dom4j.jar" usetimestamp="true"
verbose="true"/>
- <get
src="${jboss.repository}/eclipse-compiler/${eclipse-compiler}/lib/jdtCompilerAdapter.jar"
dest="${thirdparty.dir}/jdtCompilerAdapter.jar" usetimestamp="true"
verbose="true"/>
- <get
src="${jboss.repository}/eclipse-compiler/${eclipse-compiler}/lib/org.eclipse.jdt.core.jar"
dest="${thirdparty.dir}/org.eclipse.jdt.core.jar" usetimestamp="true"
verbose="true"/>
+ <!--get
src="${jboss.repository}/eclipse-compiler/${eclipse-compiler}/lib/jdtCompilerAdapter.jar"
dest="${thirdparty.dir}/jdtCompilerAdapter.jar" usetimestamp="true"
verbose="true"/>
+ <get
src="${jboss.repository}/eclipse-compiler/${eclipse-compiler}/lib/org.eclipse.jdt.core.jar"
dest="${thirdparty.dir}/org.eclipse.jdt.core.jar" usetimestamp="true"
verbose="true"/-->
<get src="${jboss.repository}/gnu-getopt/${gnu-getopt}/lib/getopt.jar"
dest="${thirdparty.dir}/getopt.jar" usetimestamp="true"
verbose="true"/>
<get src="${jboss.repository}/hibernate/${hibernate}/lib/hibernate3.jar"
dest="${thirdparty.dir}/hibernate3.jar" usetimestamp="true"
verbose="true"/>
<get src="${jboss.repository}/ibm-wsdl4j/${ibm-wsdl4j}/lib/wsdl4j.jar"
dest="${thirdparty.dir}/wsdl4j.jar" usetimestamp="true"
verbose="true"/>
@@ -53,8 +53,7 @@
<get
src="${jboss.repository}/jboss/jboss-vfs/${jboss-vfs}/lib/jboss-vfs.jar"
dest="${thirdparty.dir}/jboss-vfs.jar" usetimestamp="true"
verbose="true"/>
<get
src="${jboss.repository}/jboss/jboss-vfs/${jboss-vfs}/lib/jboss-vfs-sources.jar"
dest="${thirdparty.dir}/jboss-vfs-sources.jar" usetimestamp="true"
verbose="true"/>
<get
src="${jboss.repository}/jboss/jbossretro/${jboss-jbossretro}/lib/jbossretro.jar"
dest="${thirdparty.dir}/jbossretro.jar" usetimestamp="true"
verbose="true"/>
- <get
src="${jboss.repository}/jboss/jbossretro/${jboss-jbossretro}/lib/jbossretro-rt.jar"
dest="${thirdparty.dir}/jbossretro-rt.jar" usetimestamp="true"
verbose="true"/>
- <get
src="${jboss.repository}/jboss/jbossws-wsconsume-impl/${jbossws-wsconsume-impl}/lib/jbossws-wsconsume-impl.jar"
dest="${thirdparty.dir}/jbossws-wsconsume-impl.jar"
usetimestamp="true" verbose="true"/>
+ <get
src="${jboss.repository}/jboss/jbossretro/${jboss-jbossretro}/lib/jbossretro-rt.jar"
dest="${thirdparty.dir}/jbossretro-rt.jar" usetimestamp="true"
verbose="true"/>
<get
src="${jboss.repository}/jboss/jbossxb/${jboss-jbossxb}/lib/jboss-xml-binding.jar"
dest="${thirdparty.dir}/jboss-xml-binding.jar" usetimestamp="true"
verbose="true"/>
<get
src="${jboss.repository}/jboss/jbossxb/${jboss-jbossxb}/lib/jboss-xml-binding-sources.jar"
dest="${thirdparty.dir}/jboss-xml-binding-sources.jar"
usetimestamp="true" verbose="true"/>
<get
src="${jboss.repository}/jboss/microcontainer/${jboss-microcontainer}/lib/jboss-container.jar"
dest="${thirdparty.dir}/jboss-container.jar" usetimestamp="true"
verbose="true"/>
@@ -74,6 +73,10 @@
<get src="${jboss.repository}/sun-jaxb/${sun-jaxb}/lib/jaxb-api.jar"
dest="${thirdparty.dir}/jaxb-api.jar" usetimestamp="true"
verbose="true"/>
<get src="${jboss.repository}/sun-jaxb/${sun-jaxb}/lib/jaxb-impl.jar"
dest="${thirdparty.dir}/jaxb-impl.jar" usetimestamp="true"
verbose="true"/>
<get src="${jboss.repository}/sun-jaxb/${sun-jaxb}/lib/jaxb-xjc.jar"
dest="${thirdparty.dir}/jaxb-xjc.jar" usetimestamp="true"
verbose="true"/>
+
+ <get src="${jboss.repository}/sun-jaxws/${sun-jaxws}/lib/jaxws-rt.jar"
dest="${thirdparty.dir}/jaxws-rt.jar" usetimestamp="true"
verbose="true"/>
+ <get
src="${jboss.repository}/sun-jaxws/${sun-jaxws}/lib/jaxws-tools.jar"
dest="${thirdparty.dir}/jaxws-tools.jar" usetimestamp="true"
verbose="true"/>
+
<get
src="${jboss.repository}/sun-servlet/${sun-servlet}/lib/servlet-api.jar"
dest="${thirdparty.dir}/servlet-api.jar" usetimestamp="true"
verbose="true"/>
<get
src="${jboss.repository}/xmlunit-xmlunit/${xmlunit}/lib/xmlunit1.0.jar"
dest="${thirdparty.dir}/xmlunit1.0.jar" usetimestamp="true"
verbose="true"/>
<get
src="${jboss.repository}/wscommons-policy/${wscommons-policy}/lib/policy.jar"
dest="${thirdparty.dir}/policy.jar" usetimestamp="true"
verbose="true"/>
@@ -112,6 +115,9 @@
<pathelement location="${thirdparty.dir}/xmlsec.jar"/>
<pathelement location="${thirdparty.dir}/xercesImpl.jar"/>
<pathelement location="${thirdparty.dir}/xalan.jar"/>
+
+ <pathelement location="${thirdparty.dir}/jaxws-tools.jar"/>
+ <pathelement location="${thirdparty.dir}/jaxws-rt.jar"/>
</path>
<!-- The compile classpath for jboss50 integration -->
Modified: branches/hbraun/trunk/build/etc/component-info/jbossws.xml
===================================================================
--- branches/hbraun/trunk/build/etc/component-info/jbossws.xml 2007-05-15 14:01:18 UTC
(rev 3099)
+++ branches/hbraun/trunk/build/etc/component-info/jbossws.xml 2007-05-15 15:38:54 UTC
(rev 3100)
@@ -28,8 +28,8 @@
<import componentref="jbpm/bpel">
<compatible version="@jbpm-bpel@"/>
</import>
- <import componentref="jboss/jbossws-wsconsume-impl">
- <compatible version="@jbossws-wsconsume-impl@"/>
+ <import componentref="sun-jaxws">
+ <compatible version="@sun-jaxws@"/>
</import>
<import componentref="stax-api">
<compatible version="@stax-api@"/>
Modified: branches/hbraun/trunk/build/etc/wsconsume.bat
===================================================================
--- branches/hbraun/trunk/build/etc/wsconsume.bat 2007-05-15 14:01:18 UTC (rev 3099)
+++ branches/hbraun/trunk/build/etc/wsconsume.bat 2007-05-15 15:38:54 UTC (rev 3100)
@@ -40,7 +40,9 @@
set WSCONSUME_CLASSPATH=%WSCONSUME_CLASSPATH%;%JBOSS_HOME%/client/stax-api.jar
set WSCONSUME_CLASSPATH=%WSCONSUME_CLASSPATH%;%JBOSS_HOME%/client/jaxb-impl.jar
set WSCONSUME_CLASSPATH=%WSCONSUME_CLASSPATH%;%JBOSS_HOME%/client/jaxb-xjc.jar
-set
WSCONSUME_CLASSPATH=%WSCONSUME_CLASSPATH%;%JBOSS_HOME%/client/jbossws-wsconsume-impl.jar
+set WSCONSUME_CLASSPATH=%WSCONSUME_CLASSPATH%;%JBOSS_HOME%/client/jaxws-rt.jar
+set WSCONSUME_CLASSPATH=%WSCONSUME_CLASSPATH%;%JBOSS_HOME%/client/jaxws-tools.jar
+set
WSCONSUME_CLASSPATH=%WSCONSUME_CLASSPATH%;%JBOSS_HOME%/client/jbossws-integration-tools.jar
set WSCONSUME_CLASSPATH=%WSCONSUME_CLASSPATH%;%JBOSS_HOME%/client/jbossall-client.jar
set WSCONSUME_CLASSPATH=%WSCONSUME_CLASSPATH%;%JBOSS_HOME%/client/jboss-saaj.jar
set WSCONSUME_CLASSPATH=%WSCONSUME_CLASSPATH%;%JBOSS_HOME%/client/jboss-jaxrpc.jar
@@ -50,4 +52,4 @@
set WSCONSUME_CLASSPATH=%WSCONSUME_CLASSPATH%;%JBOSS_HOME%/client/mail.jar
rem Execute the JVM
-"%JAVA%" %JAVA_OPTS% -Djava.endorsed.dirs="%JBOSS_ENDORSED_DIRS%"
-Dlog4j.configuration=wstools-log4j.xml -classpath "%WSCONSUME_CLASSPATH%"
org.jboss.ws.tools.jaxws.command.wsconsume %*
+"%JAVA%" %JAVA_OPTS% -Djava.endorsed.dirs="%JBOSS_ENDORSED_DIRS%"
-Dlog4j.configuration=wstools-log4j.xml -classpath "%WSCONSUME_CLASSPATH%"
org.jboss.ws.integration.tools.jaxws.command.wsconsume %*
Modified: branches/hbraun/trunk/build/etc/wsconsume.sh
===================================================================
--- branches/hbraun/trunk/build/etc/wsconsume.sh 2007-05-15 14:01:18 UTC (rev 3099)
+++ branches/hbraun/trunk/build/etc/wsconsume.sh 2007-05-15 15:38:54 UTC (rev 3100)
@@ -50,7 +50,6 @@
WSCONSUME_CLASSPATH="$WSCONSUME_CLASSPATH:$JAVA_HOME/lib/tools.jar"
WSCONSUME_CLASSPATH="$WSCONSUME_CLASSPATH:$JBOSS_HOME/client/jboss-xml-binding.jar"
WSCONSUME_CLASSPATH="$WSCONSUME_CLASSPATH:$JBOSS_HOME/client/wstx.jar"
-WSCONSUME_CLASSPATH="$WSCONSUME_CLASSPATH:$JBOSS_HOME/client/jbossws-wsconsume-impl.jar"
WSCONSUME_CLASSPATH="$WSCONSUME_CLASSPATH:$JBOSS_HOME/client/activation.jar"
WSCONSUME_CLASSPATH="$WSCONSUME_CLASSPATH:$JBOSS_HOME/client/getopt.jar"
WSCONSUME_CLASSPATH="$WSCONSUME_CLASSPATH:$JBOSS_HOME/client/javassist.jar"
@@ -58,6 +57,8 @@
WSCONSUME_CLASSPATH="$WSCONSUME_CLASSPATH:$JBOSS_HOME/client/stax-api.jar"
WSCONSUME_CLASSPATH="$WSCONSUME_CLASSPATH:$JBOSS_HOME/client/jaxb-impl.jar"
WSCONSUME_CLASSPATH="$WSCONSUME_CLASSPATH:$JBOSS_HOME/client/jaxb-xjc.jar"
+WSCONSUME_CLASSPATH="$WSCONSUME_CLASSPATH:$JBOSS_HOME/client/jaxws-rt.jar"
+WSCONSUME_CLASSPATH="$WSCONSUME_CLASSPATH:$JBOSS_HOME/client/jaxws-tools.jar"
WSCONSUME_CLASSPATH="$WSCONSUME_CLASSPATH:$JBOSS_HOME/client/jbossall-client.jar"
WSCONSUME_CLASSPATH="$WSCONSUME_CLASSPATH:$JBOSS_HOME/client/jbossws-client.jar"
WSCONSUME_CLASSPATH="$WSCONSUME_CLASSPATH:$JBOSS_HOME/client/jboss-jaxws.jar"
@@ -65,6 +66,7 @@
WSCONSUME_CLASSPATH="$WSCONSUME_CLASSPATH:$JBOSS_HOME/client/jboss-saaj.jar"
WSCONSUME_CLASSPATH="$WSCONSUME_CLASSPATH:$JBOSS_HOME/client/log4j.jar"
WSCONSUME_CLASSPATH="$WSCONSUME_CLASSPATH:$JBOSS_HOME/client/mail.jar"
+WSPROVIDE_CLASSPATH="$WSPROVIDE_CLASSPATH:$JBOSS_HOME/client/jbossws-integration-tools.jar"
# For Cygwin, switch paths to Windows format before running java
if $cygwin; then
@@ -79,4 +81,4 @@
-Djava.endorsed.dirs="$JBOSS_ENDORSED_DIRS" \
-Dlog4j.configuration=wstools-log4j.xml \
-classpath "$WSCONSUME_CLASSPATH" \
- org.jboss.ws.tools.jaxws.command.wsconsume "$@"
+ org.jboss.ws.integration.tools.jaxws.command.wsconsume "$@"
Modified: branches/hbraun/trunk/build/etc/wsprovide.bat
===================================================================
--- branches/hbraun/trunk/build/etc/wsprovide.bat 2007-05-15 14:01:18 UTC (rev 3099)
+++ branches/hbraun/trunk/build/etc/wsprovide.bat 2007-05-15 15:38:54 UTC (rev 3100)
@@ -45,4 +45,4 @@
set WSPROVIDE_CLASSPATH=%WSPROVIDE_CLASSPATH%;%JBOSS_HOME%/client/mail.jar
rem Execute the JVM
-"%JAVA%" %JAVA_OPTS% -Djava.endorsed.dirs="%JBOSS_ENDORSED_DIRS%"
-Dlog4j.configuration=wstools-log4j.xml -classpath "%WSPROVIDE_CLASSPATH%"
org.jboss.ws.tools.jaxws.command.wsprovide %*
+"%JAVA%" %JAVA_OPTS% -Djava.endorsed.dirs="%JBOSS_ENDORSED_DIRS%"
-Dlog4j.configuration=wstools-log4j.xml -classpath "%WSPROVIDE_CLASSPATH%"
org.jboss.ws.integration.tools.jaxws.command.wsprovide %*
Modified: branches/hbraun/trunk/build/etc/wsprovide.sh
===================================================================
--- branches/hbraun/trunk/build/etc/wsprovide.sh 2007-05-15 14:01:18 UTC (rev 3099)
+++ branches/hbraun/trunk/build/etc/wsprovide.sh 2007-05-15 15:38:54 UTC (rev 3100)
@@ -60,6 +60,7 @@
WSPROVIDE_CLASSPATH="$WSPROVIDE_CLASSPATH:$JBOSS_HOME/client/jboss-saaj.jar"
WSPROVIDE_CLASSPATH="$WSPROVIDE_CLASSPATH:$JBOSS_HOME/client/log4j.jar"
WSPROVIDE_CLASSPATH="$WSPROVIDE_CLASSPATH:$JBOSS_HOME/client/mail.jar"
+WSPROVIDE_CLASSPATH="$WSPROVIDE_CLASSPATH:$JBOSS_HOME/client/jbossws-integration-tools.jar"
# For Cygwin, switch paths to Windows format before running java
if $cygwin; then
@@ -74,4 +75,4 @@
-Djava.endorsed.dirs="$JBOSS_ENDORSED_DIRS" \
-Dlog4j.configuration=wstools-log4j.xml \
-classpath "$WSPROVIDE_CLASSPATH" \
- org.jboss.ws.tools.jaxws.command.wsprovide "$@"
+ org.jboss.ws.integration.tools.jaxws.command.wsprovide "$@"
Modified: branches/hbraun/trunk/build/etc/wspublish.sh
===================================================================
--- branches/hbraun/trunk/build/etc/wspublish.sh 2007-05-15 14:01:18 UTC (rev 3099)
+++ branches/hbraun/trunk/build/etc/wspublish.sh 2007-05-15 15:38:54 UTC (rev 3100)
@@ -43,6 +43,7 @@
WSPUBLISH_CLASSPATH="$WSPUBLISH_CLASSPATH:$TOMCAT_HOME/common/lib/log4j.jar"
WSPUBLISH_CLASSPATH="$WSPUBLISH_CLASSPATH:$TOMCAT_HOME/common/lib/servlet-api.jar"
+
# For Cygwin, switch paths to Windows format before running java
if $cygwin; then
TOMCAT_HOME=`cygpath --path --windows "$TOMCAT_HOME"`
Modified: branches/hbraun/trunk/build/version.properties
===================================================================
--- branches/hbraun/trunk/build/version.properties 2007-05-15 14:01:18 UTC (rev 3099)
+++ branches/hbraun/trunk/build/version.properties 2007-05-15 15:38:54 UTC (rev 3100)
@@ -17,7 +17,6 @@
apache-xmlsec=1.3.0
ibm-wsdl4j=1.6.2
javassist=3.5.0.CR1
-jbossws-wsconsume-impl=2.0.0
jbpm-bpel=1.1.0.Beta5
sun-jaxb=2.0.3jboss
stax-api=1.0
@@ -71,6 +70,7 @@
sun-hudson=1.93
sun-jaf=1.1
sun-javamail=1.4
+sun-jaxws=2.0.0
sun-servlet=2.4
woodstox=3.1.1
wscommons-policy=1.0
Modified: branches/hbraun/trunk/jbossws-core/build.xml
===================================================================
--- branches/hbraun/trunk/jbossws-core/build.xml 2007-05-15 14:01:18 UTC (rev 3099)
+++ branches/hbraun/trunk/jbossws-core/build.xml 2007-05-15 15:38:54 UTC (rev 3100)
@@ -146,13 +146,23 @@
<jar jarfile="${core.output.lib.dir}/jbossws-integration.jar"
manifest="${build.etc.dir}/default.mf">
<fileset dir="${core.output.classes.dir}">
<include name="org/jboss/ws/integration/**"/>
+ <exclude name="org/jboss/ws/integration/tools/**"/>
</fileset>
</jar>
+
+ <!-- Build jbossws-integration.jar -->
+ <mkdir dir="${core.output.lib.dir}"/>
+ <jar jarfile="${core.output.lib.dir}/jbossws-integration-tools.jar"
manifest="${build.etc.dir}/default.mf">
+ <fileset dir="${core.output.classes.dir}">
+ <include name="org/jboss/ws/integration/tools/**"/>
+ </fileset>
+ </jar>
<!-- Build jbossws-client.jar -->
<jar jarfile="${core.output.lib.dir}/jbossws-client.jar"
manifest="${build.etc.dir}/default.mf">
<fileset dir="${core.output.classes.dir}">
<include name="org/jboss/ws/**"/>
+ <exclude name="org/jboss/ws/integration/tools/**"/>
</fileset>
<fileset dir="${core.resources.dir}/jbossws.sar">
<include name="META-INF/standard-jaxrpc-client-config.xml"/>
@@ -202,6 +212,7 @@
<group title="Core" packages="org.jboss.ws.core*"/>
<group title="Metadata"
packages="org.jboss.ws.metadata*"/>
<group title="Integration"
packages="org.jboss.ws.integration*"/>
+ <group title="JAXWS Tools"
packages="org.jboss.ws.integration.tools*"/>
<group title="Extensions"
packages="org.jboss.ws.extensions*"/>
<group title="Tools" packages="org.jboss.ws.tools*"/>
</javadoc>
Added:
branches/hbraun/trunk/jbossws-core/src/java/org/jboss/ws/integration/tools/jaxws/ant/wsconsume.java
===================================================================
---
branches/hbraun/trunk/jbossws-core/src/java/org/jboss/ws/integration/tools/jaxws/ant/wsconsume.java
(rev 0)
+++
branches/hbraun/trunk/jbossws-core/src/java/org/jboss/ws/integration/tools/jaxws/ant/wsconsume.java 2007-05-15
15:38:54 UTC (rev 3100)
@@ -0,0 +1,308 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt 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.ws.integration.tools.jaxws.ant;
+
+import java.io.File;
+import java.io.PrintStream;
+import java.net.MalformedURLException;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tools.ant.AntClassLoader;
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.DirectoryScanner;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.Task;
+import org.apache.tools.ant.taskdefs.ExecuteJava;
+import org.apache.tools.ant.taskdefs.LogOutputStream;
+import org.apache.tools.ant.types.Commandline;
+import org.apache.tools.ant.types.CommandlineJava;
+import org.apache.tools.ant.types.FileSet;
+import org.apache.tools.ant.types.Path;
+import org.jboss.ws.integration.tools.jaxws.api.WSContractConsumer;
+
+/**
+ * Ant task which consumes a Web Service contract.
+ *
+ * <table border="1">
+ * <tr align="left" BGCOLOR="#CCCCFF"
CLASS="TableHeadingColor"><th>Attribute</th><th>Description</th><th>Default</th></tr>
+ * <tr><td>fork</td><td>Whether or not to run the generation
task in a separate VM.</td><td>true</td></tr>
+ * <tr><td>keep</td><td>Keep/Enable Java source code
generation.</td><td>false</td></tr>
+ * <tr><td>catalog</td><td> Oasis XML Catalog file for entity
resolution</td><td>none</td></tr>
+ * <tr><td>package</td><td> The target Java package for
generated code.</td><td>generated</td></tr>
+ * <tr><td>binding</td><td>A JAX-WS or JAXB binding
file</td><td>none</td></tr>
+ * <tr><td>wsdlLocation</td><td>Value to use for
@(a)WebService.wsdlLocation</td><td>generated</td></tr>
+ * <tr><td>destdir</td><td>The output directory for generated
artifacts.</td><td>"output"</td></tr>
+ * <tr><td>sourcedestdir</td><td>The output directory for Java
source.</td><td>value of destdir</td></tr>
+ * <tr><td>verbose</td><td>Enables more informational output
about command progress.</td><td>false</td><tr>
+ * <tr><td>wsdl*</td><td>The WSDL file or
URL</td><td>n/a</td><tr>
+ * </table>
+ * <b>* = required.</b>
+ *
+ * <p>Example:
+ *
+ * <pre>
+ * <wsconsume
+ * fork="true"
+ * verbose="true"
+ * destdir="output"
+ * sourcedestdir="gen-src"
+ * keep="true"
+ * wsdllocation="handEdited.wsdl"
+ * wsdl="foo.wsdl">
+ * <binding dir="binding-files"
includes="*.xml" excludes="bad.xml"/>
+ * </wsimport>
+ * </pre>
+ *
+ * @author <a href="mailto:jason.greene@jboss.com">Jason T.
Greene</a>
+ * @version $Revision$
+ */
+public class wsconsume extends Task
+{
+ private CommandlineJava command = new CommandlineJava();
+ private String wsdl = null;
+ private File destdir = null;
+ private File sourcedestdir = null;
+ private List<File> bindingFiles = new ArrayList<File>();
+ private File catalog = null;
+ private String wsdlLocation = null;
+ private String targetPackage = null;
+ private boolean keep = false;
+ private boolean verbose = false;
+ private boolean fork = false;
+ private boolean debug = false;
+
+ // Not actually used right now
+ public void setDebug(boolean debug)
+ {
+ this.debug = debug;
+ }
+
+ public Commandline.Argument createJvmarg()
+ {
+ return command.createVmArgument();
+ }
+
+ public void setBinding(File bindingFile)
+ {
+ bindingFiles.add(bindingFile);
+ }
+
+ public void setCatalog(File catalog)
+ {
+ this.catalog = catalog;
+ }
+
+ public void setDestdir(File destdir)
+ {
+ this.destdir = destdir;
+ }
+
+ public void setFork(boolean fork)
+ {
+ this.fork = fork;
+ }
+
+ public void setKeep(boolean keep)
+ {
+ this.keep = keep;
+ }
+
+ public void setSourcedestdir(File sourcedestdir)
+ {
+ this.sourcedestdir = sourcedestdir;
+ }
+
+ public void setPackage(String targetPackage)
+ {
+ this.targetPackage = targetPackage;
+ }
+
+ public void setVerbose(boolean verbose)
+ {
+ this.verbose = verbose;
+ }
+
+ public void setWsdl(String wsdl)
+ {
+ this.wsdl = wsdl;
+ }
+
+ public void setWsdlLocation(String wsdlLocation)
+ {
+ this.wsdlLocation = wsdlLocation;
+ }
+
+ public void addConfiguredBinding(FileSet fs)
+ {
+ DirectoryScanner ds = fs.getDirectoryScanner(getProject());
+ File baseDir = ds.getBasedir();
+ for (String file : ds.getIncludedFiles())
+ {
+ bindingFiles.add(new File(baseDir, file));
+ }
+ }
+
+ public void executeNonForked()
+ {
+ ClassLoader prevCL = Thread.currentThread().getContextClassLoader();
+ ClassLoader antLoader = this.getClass().getClassLoader();
+ Thread.currentThread().setContextClassLoader(antLoader);
+ try
+ {
+ WSContractConsumer importer = WSContractConsumer.newInstance();
+ importer.setGenerateSource(keep);
+ if (destdir != null)
+ importer.setOutputDirectory(destdir);
+ if (sourcedestdir != null)
+ importer.setSourceDirectory(sourcedestdir);
+ if (targetPackage != null)
+ importer.setTargetPackage(targetPackage);
+ if (wsdlLocation != null)
+ importer.setWsdlLocation(wsdlLocation);
+ if (catalog != null)
+ importer.setCatalog(catalog);
+ if (bindingFiles != null && bindingFiles.size() > 0)
+ importer.setBindingFiles(bindingFiles);
+
+ if (verbose)
+ {
+ importer.setMessageStream(new PrintStream(new LogOutputStream(this,
Project.MSG_INFO)));
+ log("Generating from wsdl: " + wsdl, Project.MSG_INFO);
+ }
+
+ try
+ {
+ importer.setAdditionalCompilerClassPath(getTaskClassPathStrings());
+ importer.consume(wsdl);
+ }
+ catch (MalformedURLException e)
+ {
+ throw new BuildException(e, getLocation());
+ }
+ }
+ finally
+ {
+ Thread.currentThread().setContextClassLoader(prevCL);
+ }
+ }
+
+ public void execute() throws BuildException
+ {
+ if (wsdl == null)
+ throw new BuildException("The wsdl attribute must be specified!",
getLocation());
+
+ if (fork)
+ executeForked();
+ else
+ executeNonForked();
+ }
+
+ private Path getTaskClassPath()
+ {
+ // Why is everything in the Ant API a big hack???
+ ClassLoader cl = this.getClass().getClassLoader();
+ if (cl instanceof AntClassLoader)
+ {
+ return new Path(getProject(), ((AntClassLoader)cl).getClasspath());
+ }
+
+ return new Path(getProject());
+ }
+
+ private List<String> getTaskClassPathStrings()
+ {
+ // Why is everything in the Ant API a big hack???
+ List<String> strings = new ArrayList<String>();
+ ClassLoader cl = this.getClass().getClassLoader();
+ if (cl instanceof AntClassLoader)
+ {
+ for (String string :
((AntClassLoader)cl).getClasspath().split(File.pathSeparator))
+ strings.add(string);
+ }
+
+ return strings;
+ }
+
+ private void executeForked() throws BuildException
+ {
+
command.setClassname(org.jboss.ws.integration.tools.jaxws.command.wsconsume.class.getName());
+
+ Path path = command.createClasspath(getProject());
+ path.append(getTaskClassPath());
+
+ if (keep)
+ command.createArgument().setValue("-k");
+
+ for (File file : bindingFiles)
+ {
+ command.createArgument().setValue("-b");
+ command.createArgument().setFile(file);
+ }
+
+ if (catalog != null)
+ {
+ command.createArgument().setValue("-c");
+ command.createArgument().setFile(catalog);
+ }
+
+ if (targetPackage != null)
+ {
+ command.createArgument().setValue("-p");
+ command.createArgument().setValue(targetPackage);
+ }
+
+ if (wsdlLocation != null)
+ {
+ command.createArgument().setValue("-w");
+ command.createArgument().setValue(wsdlLocation);
+ }
+
+ if (destdir != null)
+ {
+ command.createArgument().setValue("-o");
+ command.createArgument().setFile(destdir);
+ }
+
+ if (sourcedestdir != null)
+ {
+ command.createArgument().setValue("-s");
+ command.createArgument().setFile(sourcedestdir);
+ }
+
+ if (!verbose)
+ command.createArgument().setValue("-q");
+
+ // Always dump traces
+ command.createArgument().setValue("-t");
+ command.createArgument().setValue(wsdl);
+
+ if (verbose)
+ log("Command invoked: " + command.getJavaCommand().toString());
+
+ ExecuteJava execute = new ExecuteJava();
+ execute.setClasspath(path);
+ execute.setJavaCommand(command.getJavaCommand());
+ if (execute.fork(this) != 0)
+ throw new BuildException("Could not invoke wsconsume",
getLocation());
+ }
+}
\ No newline at end of file
Property changes on:
branches/hbraun/trunk/jbossws-core/src/java/org/jboss/ws/integration/tools/jaxws/ant/wsconsume.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
branches/hbraun/trunk/jbossws-core/src/java/org/jboss/ws/integration/tools/jaxws/ant/wsprovide.java
===================================================================
---
branches/hbraun/trunk/jbossws-core/src/java/org/jboss/ws/integration/tools/jaxws/ant/wsprovide.java
(rev 0)
+++
branches/hbraun/trunk/jbossws-core/src/java/org/jboss/ws/integration/tools/jaxws/ant/wsprovide.java 2007-05-15
15:38:54 UTC (rev 3100)
@@ -0,0 +1,266 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt 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.ws.integration.tools.jaxws.ant;
+
+import java.io.File;
+import java.io.PrintStream;
+
+import org.apache.tools.ant.AntClassLoader;
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.Task;
+import org.apache.tools.ant.taskdefs.ExecuteJava;
+import org.apache.tools.ant.taskdefs.LogOutputStream;
+import org.apache.tools.ant.types.Commandline;
+import org.apache.tools.ant.types.CommandlineJava;
+import org.apache.tools.ant.types.Path;
+import org.apache.tools.ant.types.Reference;
+import org.jboss.ws.integration.tools.jaxws.api.WSContractProvider;
+
+/**
+ * Ant task which invokes provides a Web Service contract and portable JAX-WS wrapper
classes.
+ *
+ * <table border="1">
+ * <tr align="left" BGCOLOR="#CCCCFF"
CLASS="TableHeadingColor"><th>Attribute</th><th>Description</th><th>Default</th></tr>
+ * <tr><td>fork</td><td>Whether or not to run the generation
task in a separate VM.</td><td>true</td></tr>
+ * <tr><td>keep</td><td>Keep/Enable Java source code
generation.</td><td>false</td></tr>
+ * <tr><td>destdir</td><td>The output directory for generated
artifacts.</td><td>"output"</td></tr>
+ * <tr><td>resourcedestdir</td><td>The output directory for
resource artifacts (WSDL/XSD).</td><td>value of destdir</td></tr>
+ * <tr><td>sourcedestdir</td><td>The output directory for Java
source.</td><td>value of destdir</td></tr>
+ * <tr><td>genwsdl</td><td>Whether or not to generate
WSDL.</td><td>false</td><tr>
+ * <tr><td>verbose</td><td>Enables more informational output
about command progress.</td><td>false</td><tr>
+ * <tr><td>sei*</td><td>Service Endpoint
Implementation.</td><td></td><tr>
+ * <tr><td>classpath</td><td>The classpath that contains the
service endpoint implementation.</td><td>""</tr>
+ * </table>
+ * <b>* = required.</b>
+ *
+ * <p>Example:
+ *
+ * <pre>
+ * <target name="test-wsproivde"
depends="init">
+ * <taskdef name="wsprovide"
classname="org.jboss.ws.integration.tools.jaxws.ant.wsprovide">
+ * <classpath refid="core.classpath"/>
+ * </taskdef>
+ * <wsprovide
+ * fork="false"
+ * keep="true"
+ * destdir="out"
+ * resourcedestdir="out-resource"
+ * sourcedestdir="out-source"
+ * genwsdl="true"
+ * verbose="true"
+ *
sei="org.jboss.test.ws.jaxws.jsr181.soapbinding.DocWrappedServiceImpl">
+ * <classpath>
+ * <pathelement
path="${tests.output.dir}/classes"/>
+ * </classpath>
+ * </wsprovide>
+ * </target>
+ * </pre>
+ *
+ * @author <a href="mailto:jason.greene@jboss.com">Jason T.
Greene</a>
+ * @version $Revision$
+ */
+public class wsprovide extends Task
+{
+ private Path classpath = new Path(getProject());
+ private CommandlineJava command = new CommandlineJava();
+ private String sei = null;
+ private File destdir = null;
+ private File resourcedestdir = null;
+ private File sourcedestdir = null;
+ private boolean keep = false;
+ private boolean genwsdl = false;
+ private boolean verbose = false;
+ private boolean fork = false;
+ private boolean debug = false;
+
+ // Not actually used right now
+ public void setDebug(boolean debug)
+ {
+ this.debug = debug;
+ }
+
+ public Commandline.Argument createJvmarg()
+ {
+ return command.createVmArgument();
+ }
+
+ public void setClasspath(Path classpath)
+ {
+ this.classpath = classpath;
+ }
+
+ public void setClasspathRef(Reference ref)
+ {
+ createClasspath().setRefid(ref);
+ }
+
+ public Path createClasspath()
+ {
+ return classpath;
+ }
+
+ public void setDestdir(File destdir)
+ {
+ this.destdir = destdir;
+ }
+
+ public void setKeep(boolean keep)
+ {
+ this.keep = keep;
+ }
+
+ public void setSei(String sei)
+ {
+ this.sei = sei;
+ }
+
+ public void setFork(boolean fork)
+ {
+ this.fork = fork;
+ }
+
+ public void setResourcedestdir(File resourcedestdir)
+ {
+ this.resourcedestdir = resourcedestdir;
+ }
+
+ public void setSourcedestdir(File sourcedestdir)
+ {
+ this.sourcedestdir = sourcedestdir;
+ }
+
+ public void setVerbose(boolean verbose)
+ {
+ this.verbose = verbose;
+ }
+
+ public void setGenwsdl(boolean genwsdl)
+ {
+ this.genwsdl = genwsdl;
+ }
+
+ private ClassLoader getClasspathLoader(ClassLoader parent)
+ {
+ return new AntClassLoader(parent, getProject(), classpath, false);
+ }
+
+ public void executeNonForked()
+ {
+ ClassLoader prevCL = Thread.currentThread().getContextClassLoader();
+ ClassLoader antLoader = this.getClass().getClassLoader();
+ Thread.currentThread().setContextClassLoader(antLoader);
+ try
+ {
+ WSContractProvider gen = WSContractProvider.newInstance();
+ gen.setClassLoader(getClasspathLoader(antLoader));
+ if (verbose)
+ gen.setMessageStream(new PrintStream(new LogOutputStream(this,
Project.MSG_INFO)));
+ gen.setGenerateSource(keep);
+ gen.setGenerateWsdl(genwsdl);
+ if (destdir != null)
+ gen.setOutputDirectory(destdir);
+ if (resourcedestdir != null)
+ gen.setResourceDirectory(resourcedestdir);
+ if (sourcedestdir != null)
+ gen.setSourceDirectory(sourcedestdir);
+ if (verbose)
+ log("Generating from endpoint: " + sei, Project.MSG_INFO);
+
+ gen.provide(sei);
+ }
+ finally
+ {
+ Thread.currentThread().setContextClassLoader(prevCL);
+ }
+ }
+
+ public void execute() throws BuildException
+ {
+ if (sei == null)
+ throw new BuildException("The sei attribute must be specified!",
getLocation());
+
+ if (fork)
+ executeForked();
+ else
+ executeNonForked();
+ }
+
+ private Path getTaskClassPath()
+ {
+ // Why is everything in the Ant API a big hack???
+ ClassLoader cl = this.getClass().getClassLoader();
+ if (cl instanceof AntClassLoader)
+ {
+ return new Path(getProject(), ((AntClassLoader)cl).getClasspath());
+ }
+
+ return new Path(getProject());
+ }
+
+ private void executeForked() throws BuildException
+ {
+
command.setClassname(org.jboss.ws.integration.tools.jaxws.command.wsprovide.class.getName());
+
+ Path path = command.createClasspath(getProject());
+ path.append(getTaskClassPath());
+ path.append(classpath);
+
+ if (keep)
+ command.createArgument().setValue("-k");
+
+ if (genwsdl)
+ command.createArgument().setValue("-w");
+
+ if (destdir != null)
+ {
+ command.createArgument().setValue("-o");
+ command.createArgument().setFile(destdir);
+ }
+ if (resourcedestdir != null)
+ {
+ command.createArgument().setValue("-r");
+ command.createArgument().setFile(resourcedestdir);
+ }
+ if (sourcedestdir != null)
+ {
+ command.createArgument().setValue("-s");
+ command.createArgument().setFile(sourcedestdir);
+ }
+
+ if (!verbose)
+ command.createArgument().setValue("-q");
+
+ // Always dump traces
+ command.createArgument().setValue("-t");
+ command.createArgument().setValue(sei);
+
+ if (verbose)
+ log("Command invoked: " + command.getJavaCommand().toString());
+
+ ExecuteJava execute = new ExecuteJava();
+ execute.setClasspath(path);
+ execute.setJavaCommand(command.getJavaCommand());
+ if (execute.fork(this) != 0)
+ throw new BuildException("Could not invoke wsprovide",
getLocation());
+ }
+}
\ No newline at end of file
Property changes on:
branches/hbraun/trunk/jbossws-core/src/java/org/jboss/ws/integration/tools/jaxws/ant/wsprovide.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
branches/hbraun/trunk/jbossws-core/src/java/org/jboss/ws/integration/tools/jaxws/api/Locator.java
===================================================================
---
branches/hbraun/trunk/jbossws-core/src/java/org/jboss/ws/integration/tools/jaxws/api/Locator.java
(rev 0)
+++
branches/hbraun/trunk/jbossws-core/src/java/org/jboss/ws/integration/tools/jaxws/api/Locator.java 2007-05-15
15:38:54 UTC (rev 3100)
@@ -0,0 +1,75 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt 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.ws.integration.tools.jaxws.api;
+
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+
+/**
+ * Locates a provider.
+ *
+ * @author <a href="mailto:jason.greene@jboss.com">Jason T.
Greene</a>
+ *
+ */
+class Locator
+{
+ static <T> T locate(Class<T> providerType, String providerProperty, String
defaultProvider, ClassLoader loader)
+ {
+ String provider = null;
+
+ try
+ {
+
+ PrivilegedAction action = new PropertyAccessAction(providerProperty);
+ provider = (String)AccessController.doPrivileged(action);
+ if (provider == null)
+ provider = defaultProvider;
+
+ Class<?> clazz = loader.loadClass(provider);
+ return (T) clazz.newInstance();
+ }
+ catch (Throwable t)
+ {
+ if (provider == null)
+ throw new IllegalStateException("Failure reading system property: "
+ providerProperty);
+
+ throw new IllegalStateException("Could not load provider:" +
provider);
+ }
+
+ }
+
+ private static class PropertyAccessAction implements PrivilegedAction
+ {
+ private String name;
+
+ PropertyAccessAction(String name)
+ {
+ this.name = name;
+ }
+
+ public Object run()
+ {
+ return System.getProperty(name);
+ }
+ }
+
+}
\ No newline at end of file
Property changes on:
branches/hbraun/trunk/jbossws-core/src/java/org/jboss/ws/integration/tools/jaxws/api/Locator.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
branches/hbraun/trunk/jbossws-core/src/java/org/jboss/ws/integration/tools/jaxws/api/WSContractConsumer.java
===================================================================
---
branches/hbraun/trunk/jbossws-core/src/java/org/jboss/ws/integration/tools/jaxws/api/WSContractConsumer.java
(rev 0)
+++
branches/hbraun/trunk/jbossws-core/src/java/org/jboss/ws/integration/tools/jaxws/api/WSContractConsumer.java 2007-05-15
15:38:54 UTC (rev 3100)
@@ -0,0 +1,178 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt 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.ws.integration.tools.jaxws.api;
+
+import java.io.File;
+import java.io.PrintStream;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.List;
+
+import org.jboss.ws.integration.tools.jaxws.spi.WSContractConsumerFactory;
+
+/**
+ * WSContractConsumer is responsible for generating JAX-WS client and server
+ * artifacts from the specified WSDL file. To implement a client, one would use
+ * the generated ___Service.java file. For a server, one only needs to provide
+ * an implementation class that implements the generated service endpoint
+ * interface.
+ *
+ * @author <a href="mailto:jason.greene@jboss.com">Jason T.
Greene</a>
+ * @version $Revision$
+ */
+public abstract class WSContractConsumer
+{
+ private static String DEFAULT_PROVIDER =
"org.jboss.ws.integration.tools.jaxws.impl.SunRIConsumerFactoryImpl";
+ public static final String PROVIDER_PROPERTY =
"org.jboss.ws.tools.jaxws.SunRIConsumerFactoryImpl";
+
+ /**
+ * Obtain a new instance of a WSContractProvider. This will use the current
+ * thread's context class loader to locate the WSContractProviderFactory
+ * implementation.
+ *
+ * @return a new WSContractProvider
+ */
+ public static WSContractConsumer newInstance()
+ {
+ return newInstance(Thread.currentThread().getContextClassLoader());
+ }
+
+ /**
+ * Obtain a new instance of a WSContractConsumer. The specified ClassLoader will be
used to
+ * locate the WebServiceImporterProvide implementation
+ *
+ * @param loader the ClassLoader to use
+ * @return a new WSContractConsumer
+ */
+ public static WSContractConsumer newInstance(ClassLoader loader)
+ {
+ WSContractConsumerFactory provider =
Locator.locate(WSContractConsumerFactory.class, PROVIDER_PROPERTY, DEFAULT_PROVIDER,
loader);
+ return provider.createConsumer();
+ }
+
+ /**
+ * Specifies the JAX-WS and JAXB binding files to use on import operations.
+ *
+ * @param bindingFiles list of JAX-WS or JAXB binding files
+ */
+ public abstract void setBindingFiles(List<File> bindingFiles);
+
+ /**
+ * Sets the OASIS XML Catalog file to use for entity resolution.
+ *
+ * @param catalog the OASIS XML Catalog file
+ */
+ public abstract void setCatalog(File catalog);
+
+ /**
+ * Sets the main output directory. If the directory does not exist, it will be
created.
+ *
+ * @param directory the root directory for generated files
+ */
+ public abstract void setOutputDirectory(File directory);
+
+ /**
+ * Sets the source directory. This directory will contain any generated Java source.
+ * If the directory does not exist, it will be created. If not specified,
+ * the output directory will be used instead.
+ *
+ * @param directory the root directory for generated source code
+ */
+ public abstract void setSourceDirectory(File directory);
+
+ /**
+ * Enables/Disables Java source generation.
+ *
+ * @param generateSource whether or not to generate Java source.
+ */
+ public abstract void setGenerateSource(boolean generateSource);
+
+
+ /**
+ * Sets the target package for generated source. If not specified the default
+ * is based off of the XML namespace.
+ *
+ * @param targetPackage the target package for generated source
+ */
+ public abstract void setTargetPackage(String targetPackage);
+
+ /**
+ * Sets the @(a)WebService.wsdlLocation and @(a)WebServiceClient.wsdlLocation attributes
to a custom value.
+ *
+ * @param wsdlLocation the custom WSDL location to use in generated source
+ */
+ public abstract void setWsdlLocation(String wsdlLocation);
+
+ /**
+ * Sets the PrintStream to use for status feedback. The simplest example
+ * would be to use System.out.
+ *
+ * @param messageStream the stream to use for status messages:
+ */
+ public abstract void setMessageStream(PrintStream messageStream);
+
+
+ /**
+ * Sets the additional classpath to use if/when invoking the Java compiler.
+ * Typically an implementation will use the system
<code>java.class.path</code>
+ * property. So for most normal applications this method is not needed. However,
+ * if this API is being used from an isolated classloader, then it needs to
+ * be called in order to reference all jars that are required by the
+ * implementation.
+ *
+ * @param classPath a list of strings where each entry references a
+ * single jar or directory
+ */
+ public abstract void setAdditionalCompilerClassPath(List<String> classPath);
+
+ /**
+ * Generate the required artifacts using the specified WSDL URL. This method
+ * may be called more than once, although this is probably not desireable
+ *
+ * @param wsdl the URL of the WSDL
+ */
+ public abstract void consume(URL wsdl);
+
+ /**
+ * Generate the required artifacts using the specified WSDL. This method
+ * may be called more than once, although this is probably not desireable.
+ * The passed string is expect to either be a valid URL, or a local file path.
+ *
+ * @param wsdl a URL or local file path
+ * @throws MalformedURLException if wsdl is not a legal URL or local file
+ */
+ public void consume(String wsdl) throws MalformedURLException
+ {
+ URL url = null;
+ try
+ {
+ url = new URL(wsdl);
+ }
+ catch (MalformedURLException e)
+ {
+ File file = new File(wsdl);
+ url = file.toURL();
+ }
+
+ consume(url);
+ }
+}
Property changes on:
branches/hbraun/trunk/jbossws-core/src/java/org/jboss/ws/integration/tools/jaxws/api/WSContractConsumer.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
branches/hbraun/trunk/jbossws-core/src/java/org/jboss/ws/integration/tools/jaxws/api/WSContractProvider.java
===================================================================
---
branches/hbraun/trunk/jbossws-core/src/java/org/jboss/ws/integration/tools/jaxws/api/WSContractProvider.java
(rev 0)
+++
branches/hbraun/trunk/jbossws-core/src/java/org/jboss/ws/integration/tools/jaxws/api/WSContractProvider.java 2007-05-15
15:38:54 UTC (rev 3100)
@@ -0,0 +1,150 @@
+package org.jboss.ws.integration.tools.jaxws.api;
+
+import java.io.File;
+import java.io.PrintStream;
+
+import org.jboss.ws.WSException;
+import org.jboss.ws.integration.tools.jaxws.spi.WSContractProviderFactory;
+
+
+/**
+ * WSContractProvider is responsible for generating the required portable
+ * JAX-WS artifacts for a service endpoint implementation. This includes class
+ * files for wrapper types and fault beans. WSDL may be optionally generated as
+ * well using this API.
+ *
+ * @author <a href="mailto:jason.greene@jboss.com">Jason T.
Greene</a>
+ *
+ * <p>The following example generates class files, source files and WSDL for an
+ * endpoint:</p>
+ * <pre>
+ * WSContractProvider provider = WSContractProvider.newInstance();
+ * provider.setGenerateSource(true);
+ * provider.setGenerateWsdl(true);
+ * provider.setOutputDirectory(new File("output"));
+ * provider.setMessageStream(System.out);
+ * provider.provide(TestMe.class);
+ * </pre>
+ *
+ * <p>Thread-Safety:</p>
+ * This class expects to be thread-confined, so it can not be shared between threads.
+ */
+public abstract class WSContractProvider
+{
+ private static String DEFAULT_PROVIDER =
"org.jboss.ws.integration.tools.jaxws.impl.JBossWSProviderFactoryImpl";
+ public static final String PROVIDER_PROPERTY =
"org.jboss.ws.tools.jaxws.JBossWSProviderFactoryImpl";
+
+ protected WSContractProvider()
+ {
+
+ }
+
+ /**
+ * Obtain a new instance of a WSContractProvider. This will use the current
+ * thread's context class loader to locate the WSContractProviderFactory
+ * implementation.
+ *
+ * @return a new WSContractProvider
+ */
+ public static WSContractProvider newInstance()
+ {
+ return newInstance(Thread.currentThread().getContextClassLoader());
+ }
+
+ /**
+ * Obtain a new instance of a WSContractProvider. The specified ClassLoader will be
used to
+ * locate the WSContractProviderFactory implementation
+ *
+ * @param loader the ClassLoader to use
+ * @return a new WSContractProvider
+ */
+ public static WSContractProvider newInstance(ClassLoader loader)
+ {
+ WSContractProviderFactory provider =
Locator.locate(WSContractProviderFactory.class, PROVIDER_PROPERTY, DEFAULT_PROVIDER,
loader);
+ return provider.createProvider(loader);
+ }
+
+ /**
+ * Enables/Disables WSDL generation.
+ *
+ * @param generateWsdl whether or not to generate WSDL
+ */
+ public abstract void setGenerateWsdl(boolean generateWsdl);
+
+ /**
+ * Enables/Disables Java source generation.
+ *
+ * @param generateSource whether or not to generate Java source.
+ */
+ public abstract void setGenerateSource(boolean generateSource);
+
+ /**
+ * Sets the main output directory. If the directory does not exist, it will be
created.
+ *
+ * @param directory the root directory for generated files
+ */
+ public abstract void setOutputDirectory(File directory);
+
+ /**
+ * Sets the resource directory. This directory will contain any generated
+ * WSDL and XSD files. If the directory does not exist, it will be created.
+ * If not specified, the output directory will be used instead.
+ *
+ * @param directory the root directory for generated resource files
+ */
+ public abstract void setResourceDirectory(File directory);
+
+ /**
+ * Sets the source directory. This directory will contain any generated Java source.
+ * If the directory does not exist, it will be created. If not specified,
+ * the output directory will be used instead.
+ *
+ * @param directory the root directory for generated source code
+ */
+ public abstract void setSourceDirectory(File directory);
+
+ /**
+ * Sets the ClassLoader used to discover types. This defaults to the one used
+ * in instantiation.
+ *
+ * @param loader the ClassLoader to use
+ */
+ public abstract void setClassLoader(ClassLoader loader);
+
+ /**
+ * Generates artifacts using the current settings. This method may be invoked
+ * more than once (e.g. multiple endpoints).
+ *
+ * @param endpointClass the name of the endpoint implementation bean
+ * @throws WSException if any error occurs during processing, or the class is not
found
+ */
+ public abstract void provide(String endpointClass);
+
+ /**
+ * Generates artifacts using the current settings. This method may be invoked
+ * more than once (e.g. multiple endpoints).
+ *
+ * @param endpointClass the endpoint implementation bean
+ * @throws WSException if any error occurs during processing
+ */
+ public abstract void provide(Class<?> endpointClass);
+
+ /**
+ * Sets the PrintStream to use for status feedback. The simplest example
+ * would be to use System.out.
+ *
+ * <p>Example output:</p>
+ * <pre>
+ * Generating WSDL:
+ * TestMeService.wsdl
+ * Writing Source:
+ * org/jboss/ws/tools/jaxws/TestMe.java
+ * org/jboss/ws/tools/jaxws/TestMeResponse.java
+ * Writing Classes:
+ * org/jboss/ws/tools/jaxws/TestMe.class
+ * org/jboss/ws/tools/jaxws/TestMeResponse.class
+ * </pre>
+ * @param messageStream the stream to use for status messages:
+ */
+ public abstract void setMessageStream(PrintStream messageStream);
+}
Property changes on:
branches/hbraun/trunk/jbossws-core/src/java/org/jboss/ws/integration/tools/jaxws/api/WSContractProvider.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
branches/hbraun/trunk/jbossws-core/src/java/org/jboss/ws/integration/tools/jaxws/command/wsconsume.java
===================================================================
---
branches/hbraun/trunk/jbossws-core/src/java/org/jboss/ws/integration/tools/jaxws/command/wsconsume.java
(rev 0)
+++
branches/hbraun/trunk/jbossws-core/src/java/org/jboss/ws/integration/tools/jaxws/command/wsconsume.java 2007-05-15
15:38:54 UTC (rev 3100)
@@ -0,0 +1,234 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.ws.integration.tools.jaxws.command;
+
+import gnu.getopt.Getopt;
+import gnu.getopt.LongOpt;
+
+import java.io.File;
+import java.io.PrintStream;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jboss.ws.integration.tools.jaxws.api.WSContractConsumer;
+
+/**
+ * wsconsume is a command line tool that generates portable JAX-WS artifacts
+ * from a WSDL file.
+ *
+ * <pre>
+ * usage: wsconsume [options] <wsdl-url>
+ * options:
+ * -h, --help Show this help message
+ * -b, --binding=<file> One or more JAX-WS or JAXB binding files
+ * -k, --keep Keep/Generate Java source
+ * -c --catalog=<file> Oasis XML Catalog file for entity
resolution
+ * -p --package=<name> The target package for generated source
+ * -w --wsdlLocation=<loc> Value to use for @(a)WebService.wsdlLocation
+ * -o, --output=<directory> The directory to put generated artifacts
+ * -s, --source=<directory> The directory to put Java source
+ * -q, --quiet Be somewhat more quiet
+ * -t, --show-traces Show full exception stack traces
+ * </pre>
+ *
+ * @author <a href="mailto:jason.greene@jboss.com">Jason T.
Greene</a>
+ * @version $Revision$
+ */
+public class wsconsume
+{
+ private List<File> bindingFiles = new ArrayList<File>();
+ private boolean generateSource = false;
+ private File catalog = null;
+ private String targetPackage = null;
+ private String wsdlLocation = null;
+ private boolean quiet = false;
+ private boolean showTraces = false;
+ private File outputDir = new File("output");
+ private File sourceDir = null;
+
+ public static String PROGRAM_NAME = System.getProperty("program.name",
wsconsume.class.getName());
+
+ public static void main(String[] args)
+ {
+ wsconsume importer = new wsconsume();
+ URL wsdl = importer.parseArguments(args);
+ System.exit(importer.importServices(wsdl));
+ }
+
+ private URL parseArguments(String[] args)
+ {
+ String shortOpts = "hb:kc:p:w:o:s:qt";
+ LongOpt[] longOpts =
+ {
+ new LongOpt("help", LongOpt.NO_ARGUMENT, null, 'h'),
+ new LongOpt("binding", LongOpt.REQUIRED_ARGUMENT, null, 'b'),
+ new LongOpt("keep", LongOpt.NO_ARGUMENT, null, 'k'),
+ new LongOpt("catalog", LongOpt.REQUIRED_ARGUMENT, null, 'c'),
+ new LongOpt("package", LongOpt.REQUIRED_ARGUMENT, null, 'p'),
+ new LongOpt("wsdlLocation", LongOpt.REQUIRED_ARGUMENT, null,
'w'),
+ new LongOpt("output", LongOpt.REQUIRED_ARGUMENT, null, 'o'),
+ new LongOpt("source", LongOpt.REQUIRED_ARGUMENT, null, 's'),
+ new LongOpt("quiet", LongOpt.NO_ARGUMENT, null, 'q'),
+ new LongOpt("show-traces", LongOpt.NO_ARGUMENT, null, 't'),
+ };
+
+ Getopt getopt = new Getopt(PROGRAM_NAME, args, shortOpts, longOpts);
+ int c;
+ while ((c = getopt.getopt()) != -1)
+ {
+ switch (c)
+ {
+ case 'b':
+ bindingFiles.add(new File(getopt.getOptarg()));
+ break;
+ case 'k':
+ generateSource = true;
+ break;
+ case 'c':
+ catalog = new File(getopt.getOptarg());
+ break;
+ case 'p':
+ targetPackage = getopt.getOptarg();
+ break;
+ case 'w':
+ wsdlLocation = getopt.getOptarg();
+ break;
+ case 'o':
+ outputDir = new File(getopt.getOptarg());
+ break;
+ case 's':
+ sourceDir = new File(getopt.getOptarg());
+ break;
+ case 'q':
+ quiet = true;
+ break;
+ case 't':
+ showTraces = true;
+ break;
+ case 'h':
+ printHelp();
+ System.exit(0);
+ case '?':
+ System.exit(1);
+ }
+ }
+
+ int wsdlPos = getopt.getOptind();
+ if (wsdlPos >= args.length)
+ {
+ System.err.println("Error: WSDL URL was not specified!");
+ printHelp();
+ System.exit(1);
+ }
+
+ URL url = null;
+ try
+ {
+ try
+ {
+ url = new URL(args[wsdlPos]);
+ }
+ catch (MalformedURLException e)
+ {
+ File file = new File(args[wsdlPos]);
+ url = file.toURL();
+ }
+ }
+ catch (MalformedURLException e)
+ {
+ System.err.println("Error: Invalid URI: " + args[wsdlPos]);
+ System.exit(1);
+ }
+
+ return url;
+ }
+
+
+ private int importServices(URL wsdl)
+ {
+ WSContractConsumer importer = WSContractConsumer.newInstance();
+ importer.setGenerateSource(generateSource);
+ importer.setOutputDirectory(outputDir);
+ if (sourceDir != null)
+ importer.setSourceDirectory(sourceDir);
+
+ if (! quiet)
+ importer.setMessageStream(System.out);
+
+ if (catalog != null)
+ importer.setCatalog(catalog);
+
+ if (targetPackage != null)
+ importer.setTargetPackage(targetPackage);
+
+ if (wsdlLocation != null)
+ importer.setWsdlLocation(wsdlLocation);
+
+ if (bindingFiles != null && bindingFiles.size() > 0)
+ importer.setBindingFiles(bindingFiles);
+
+ try
+ {
+ importer.consume(wsdl);
+ return 0;
+ }
+ catch (Throwable t)
+ {
+ System.err.println("Error: Could not import. (use --show-traces to see full
traces)");
+ if (!showTraces)
+ {
+ String message = t.getMessage();
+ if (message == null)
+ message = t.getClass().getSimpleName();
+ System.err.println("Error: " + message);
+ }
+ else
+ {
+ t.printStackTrace(System.err);
+ }
+
+ }
+
+ return 1;
+ }
+
+ private static void printHelp()
+ {
+ PrintStream out = System.out;
+ out.println("wsconsume is a command line tool that generates portable JAX-WS
artifacts from a WSDL file.\n");
+ out.println("usage: " + PROGRAM_NAME + " [options]
<wsdl-url>\n");
+ out.println("options: ");
+ out.println(" -h, --help Show this help message");
+ out.println(" -b, --binding=<file> One or more JAX-WS or JAXB
binding files ");
+ out.println(" -k, --keep Keep/Generate Java
source");
+ out.println(" -c --catalog=<file> Oasis XML Catalog file for
entity resolution");
+ out.println(" -p --package=<name> The target package for
generated source");
+ out.println(" -w --wsdlLocation=<loc> Value to use for
@WebService.wsdlLocation");
+ out.println(" -o, --output=<directory> The directory to put
generated artifacts");
+ out.println(" -s, --source=<directory> The directory to put Java
source");
+ out.println(" -q, --quiet Be somewhat more quiet");
+ out.println(" -t, --show-traces Show full exception stack
traces");
+ out.flush();
+ }
+}
Property changes on:
branches/hbraun/trunk/jbossws-core/src/java/org/jboss/ws/integration/tools/jaxws/command/wsconsume.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
branches/hbraun/trunk/jbossws-core/src/java/org/jboss/ws/integration/tools/jaxws/command/wsprovide.java
===================================================================
---
branches/hbraun/trunk/jbossws-core/src/java/org/jboss/ws/integration/tools/jaxws/command/wsprovide.java
(rev 0)
+++
branches/hbraun/trunk/jbossws-core/src/java/org/jboss/ws/integration/tools/jaxws/command/wsprovide.java 2007-05-15
15:38:54 UTC (rev 3100)
@@ -0,0 +1,225 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.ws.integration.tools.jaxws.command;
+
+import gnu.getopt.Getopt;
+import gnu.getopt.LongOpt;
+
+import java.io.File;
+import java.io.PrintStream;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jboss.ws.core.utils.JavaUtils;
+import org.jboss.ws.integration.tools.jaxws.api.WSContractProvider;
+
+/**
+ * wsprovide is a command line tool that generates portable JAX-WS artifacts
+ * for a service endpoint implementation.
+ *
+ * <pre>
+ * usage: wsprovide [options] <endpoint class name>
+ * options:
+ * -h, --help Show this help message
+ * -k, --keep Keep/Generate Java source
+ * -w, --wsdl Enable WSDL file generation
+ * -c. --classpath=<path< The classpath that contains the endpoint
+ * -o, --output=<directory> The directory to put generated artifacts
+ * -r, --resource=<directory> The directory to put resource artifacts
+ * -s, --source=<directory> The directory to put Java source
+ * -q, --quiet Be somewhat more quiet
+ * -t, --show-traces Show full exception stack traces
+ * </pre>
+ *
+ * @author <a href="mailto:jason.greene@jboss.com">Jason T.
Greene</a>
+ * @version $Revision$
+ */
+public class wsprovide
+{
+ private boolean generateSource = false;
+ private boolean generateWsdl = false;
+ private boolean quiet = false;
+ private boolean showTraces = false;
+ private ClassLoader loader = Thread.currentThread().getContextClassLoader();
+ private File outputDir = new File("output");
+ private File resourceDir = null;
+ private File sourceDir = null;
+
+ public static String PROGRAM_NAME = System.getProperty("program.name",
wsprovide.class.getSimpleName());
+
+ public static void main(String[] args)
+ {
+ wsprovide generate = new wsprovide();
+ String endpoint = generate.parseArguments(args);
+ System.exit(generate.generate(endpoint));
+ }
+
+ private String parseArguments(String[] args)
+ {
+ String shortOpts = "hwko:r:s:c:qt";
+ LongOpt[] longOpts =
+ {
+ new LongOpt("help", LongOpt.NO_ARGUMENT, null, 'h'),
+ new LongOpt("wsdl", LongOpt.NO_ARGUMENT, null, 'w'),
+ new LongOpt("keep", LongOpt.NO_ARGUMENT, null, 'k'),
+ new LongOpt("output", LongOpt.REQUIRED_ARGUMENT, null, 'o'),
+ new LongOpt("resource", LongOpt.REQUIRED_ARGUMENT, null,
'r'),
+ new LongOpt("source", LongOpt.REQUIRED_ARGUMENT, null, 's'),
+ new LongOpt("classpath", LongOpt.REQUIRED_ARGUMENT, null,
'c'),
+ new LongOpt("quiet", LongOpt.NO_ARGUMENT, null, 'q'),
+ new LongOpt("show-traces", LongOpt.NO_ARGUMENT, null, 't'),
+ };
+
+ Getopt getopt = new Getopt(PROGRAM_NAME, args, shortOpts, longOpts);
+ int c;
+ while ((c = getopt.getopt()) != -1)
+ {
+ switch (c)
+ {
+ case 'k':
+ generateSource = true;
+ break;
+ case 's':
+ sourceDir = new File(getopt.getOptarg());
+ break;
+ case 'r':
+ resourceDir = new File(getopt.getOptarg());
+ break;
+ case 'w':
+ generateWsdl = true;
+ break;
+ case 't':
+ showTraces = true;
+ break;
+ case 'o':
+ outputDir = new File(getopt.getOptarg());
+ break;
+ case 'q':
+ quiet = true;
+ break;
+ case 'c':
+ processClassPath(getopt.getOptarg());
+ break;
+ case 'h':
+ printHelp();
+ System.exit(0);
+ case '?':
+ System.exit(1);
+ }
+ }
+
+ int endpointPos = getopt.getOptind();
+ if (endpointPos >= args.length)
+ {
+ System.err.println("Error: endpoint implementation was not
specified!");
+ printHelp();
+ System.exit(1);
+ }
+
+ return args[endpointPos];
+ }
+
+
+ private int generate(String endpoint)
+ {
+ if (!JavaUtils.isLoaded(endpoint, loader))
+ {
+ System.err.println("Error: Could not load class [" + endpoint +
"]. Did you specify a valid --classpath?");
+ return 1;
+ }
+
+ WSContractProvider gen = WSContractProvider.newInstance(loader);
+ gen.setGenerateWsdl(generateWsdl);
+ gen.setGenerateSource(generateSource);
+ gen.setOutputDirectory(outputDir);
+ if (resourceDir != null)
+ gen.setResourceDirectory(resourceDir);
+ if (sourceDir != null)
+ gen.setSourceDirectory(sourceDir);
+
+ if (! quiet)
+ gen.setMessageStream(System.out);
+
+ try
+ {
+ gen.provide(endpoint);
+ return 0;
+ }
+ catch (Throwable t)
+ {
+ System.err.println("Error: Could not generate. (use --show-traces to see
full traces)");
+ if (!showTraces)
+ {
+ String message = t.getMessage();
+ if (message == null)
+ message = t.getClass().getSimpleName();
+ System.err.println("Error: " + message);
+ }
+ else
+ {
+ t.printStackTrace(System.err);
+ }
+
+ }
+
+ return 1;
+ }
+
+ private void processClassPath(String classPath)
+ {
+ String[] entries = classPath.split(File.pathSeparator);
+ List<URL> urls= new ArrayList<URL>(entries.length);
+ for (String entry : entries)
+ {
+ try
+ {
+ urls.add(new File(entry).toURL());
+ }
+ catch (MalformedURLException e)
+ {
+ System.err.println("Error: a classpath entry was malformed: " +
entry);
+ }
+ }
+ loader = new URLClassLoader(urls.toArray(new URL[0]), loader);
+ }
+
+ private static void printHelp()
+ {
+ PrintStream out = System.out;
+ out.println("wsprovide generates portable JAX-WS artifacts for an endpoint
implementation.\n");
+ out.println("usage: " + PROGRAM_NAME + " [options] <endpoint
class name>\n");
+ out.println("options: ");
+ out.println(" -h, --help Show this help message");
+ out.println(" -k, --keep Keep/Generate Java
source");
+ out.println(" -w, --wsdl Enable WSDL file
generation");
+ out.println(" -c. --classpath=<path> The classpath that contains
the endpoint");
+ out.println(" -o, --output=<directory> The directory to put
generated artifacts");
+ out.println(" -r, --resource=<directory> The directory to put
resource artifacts");
+ out.println(" -s, --source=<directory> The directory to put Java
source");
+ out.println(" -q, --quiet Be somewhat more quiet");
+ out.println(" -t, --show-traces Show full exception stack
traces");
+ out.flush();
+ }
+}
Property changes on:
branches/hbraun/trunk/jbossws-core/src/java/org/jboss/ws/integration/tools/jaxws/command/wsprovide.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
branches/hbraun/trunk/jbossws-core/src/java/org/jboss/ws/integration/tools/jaxws/impl/BytecodeWrapperGenerator.java
===================================================================
---
branches/hbraun/trunk/jbossws-core/src/java/org/jboss/ws/integration/tools/jaxws/impl/BytecodeWrapperGenerator.java
(rev 0)
+++
branches/hbraun/trunk/jbossws-core/src/java/org/jboss/ws/integration/tools/jaxws/impl/BytecodeWrapperGenerator.java 2007-05-15
15:38:54 UTC (rev 3100)
@@ -0,0 +1,93 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.ws.integration.tools.jaxws.impl;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.PrintStream;
+import java.util.ArrayList;
+import java.util.List;
+
+import javassist.CannotCompileException;
+import javassist.NotFoundException;
+
+import org.jboss.ws.WSException;
+import org.jboss.ws.core.jaxws.DynamicWrapperGenerator;
+import org.jboss.ws.metadata.umdm.FaultMetaData;
+import org.jboss.ws.metadata.umdm.ParameterMetaData;
+
+public class BytecodeWrapperGenerator extends DynamicWrapperGenerator implements
WritableWrapperGenerator
+{
+ private List<String> typeNames = new ArrayList<String>();
+ PrintStream stream;
+
+ public BytecodeWrapperGenerator(ClassLoader loader, PrintStream stream)
+ {
+ super(loader);
+ this.stream = stream;
+ prune = false;
+ }
+
+ @Override
+ public void reset(ClassLoader loader)
+ {
+ super.reset(loader);
+ typeNames.clear();
+ }
+
+ @Override
+ public void generate(FaultMetaData fmd)
+ {
+ super.generate(fmd);
+
+ typeNames.add(fmd.getFaultBeanName());
+ }
+
+ @Override
+ public void generate(ParameterMetaData pmd)
+ {
+ super.generate(pmd);
+
+ typeNames.add(pmd.getJavaTypeName());
+ }
+
+ public void write(File directory) throws IOException
+ {
+ stream.println("Writing Classes:");
+ for (String name : typeNames)
+ {
+ try
+ {
+ stream.println(name.replace('.', '/') + ".class");
+ pool.get(name).writeFile(directory.getAbsolutePath());
+ }
+ catch (CannotCompileException e)
+ {
+ throw new WSException(e);
+ }
+ catch (NotFoundException e)
+ {
+ throw new WSException(e);
+ }
+ }
+ }
+}
Property changes on:
branches/hbraun/trunk/jbossws-core/src/java/org/jboss/ws/integration/tools/jaxws/impl/BytecodeWrapperGenerator.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
branches/hbraun/trunk/jbossws-core/src/java/org/jboss/ws/integration/tools/jaxws/impl/ChainedWritableWrapperGenerator.java
===================================================================
---
branches/hbraun/trunk/jbossws-core/src/java/org/jboss/ws/integration/tools/jaxws/impl/ChainedWritableWrapperGenerator.java
(rev 0)
+++
branches/hbraun/trunk/jbossws-core/src/java/org/jboss/ws/integration/tools/jaxws/impl/ChainedWritableWrapperGenerator.java 2007-05-15
15:38:54 UTC (rev 3100)
@@ -0,0 +1,81 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.ws.integration.tools.jaxws.impl;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jboss.ws.core.jaxws.WrapperGenerator;
+import org.jboss.ws.metadata.umdm.FaultMetaData;
+import org.jboss.ws.metadata.umdm.ParameterMetaData;
+
+public class ChainedWritableWrapperGenerator implements WrapperGenerator
+{
+ private List<Entry> chain = new ArrayList<Entry>();
+
+ static class Entry
+ {
+ Entry(WritableWrapperGenerator generator, File directory)
+ {
+ this.generator = generator;
+ this.directory = directory;
+ }
+
+ WritableWrapperGenerator generator;
+ File directory;
+ }
+
+ public ChainedWritableWrapperGenerator()
+ {
+ }
+
+ public void reset(ClassLoader loader)
+ {
+ for (Entry entry : chain)
+ entry.generator.reset(loader);
+ }
+
+ public void write() throws IOException
+ {
+ for (Entry entry : chain)
+ entry.generator.write(entry.directory);
+ }
+
+ public void generate(FaultMetaData fmd)
+ {
+ for (Entry entry : chain)
+ entry.generator.generate(fmd);
+ }
+
+ public void generate(ParameterMetaData pmd)
+ {
+ for (Entry entry : chain)
+ entry.generator.generate(pmd);
+ }
+
+ public void add(WritableWrapperGenerator generator, File directory)
+ {
+ chain.add(new Entry(generator, directory));
+ }
+}
Property changes on:
branches/hbraun/trunk/jbossws-core/src/java/org/jboss/ws/integration/tools/jaxws/impl/ChainedWritableWrapperGenerator.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
branches/hbraun/trunk/jbossws-core/src/java/org/jboss/ws/integration/tools/jaxws/impl/JBossWSProviderFactoryImpl.java
===================================================================
---
branches/hbraun/trunk/jbossws-core/src/java/org/jboss/ws/integration/tools/jaxws/impl/JBossWSProviderFactoryImpl.java
(rev 0)
+++
branches/hbraun/trunk/jbossws-core/src/java/org/jboss/ws/integration/tools/jaxws/impl/JBossWSProviderFactoryImpl.java 2007-05-15
15:38:54 UTC (rev 3100)
@@ -0,0 +1,39 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.ws.integration.tools.jaxws.impl;
+
+import org.jboss.ws.integration.tools.jaxws.api.WSContractProvider;
+import org.jboss.ws.integration.tools.jaxws.spi.WSContractProviderFactory;
+
+/**
+ * Creates a JBossWS WSContractProvider implementation.
+ * @see org.jboss.ws.integration.tools.jaxws.impl.JBossWSProviderImpl
+ */
+public class JBossWSProviderFactoryImpl implements WSContractProviderFactory
+{
+ public WSContractProvider createProvider(ClassLoader loader)
+ {
+ JBossWSProviderImpl impl = new JBossWSProviderImpl();
+ impl.setClassLoader(loader);
+ return impl;
+ }
+}
Property changes on:
branches/hbraun/trunk/jbossws-core/src/java/org/jboss/ws/integration/tools/jaxws/impl/JBossWSProviderFactoryImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
branches/hbraun/trunk/jbossws-core/src/java/org/jboss/ws/integration/tools/jaxws/impl/JBossWSProviderImpl.java
===================================================================
---
branches/hbraun/trunk/jbossws-core/src/java/org/jboss/ws/integration/tools/jaxws/impl/JBossWSProviderImpl.java
(rev 0)
+++
branches/hbraun/trunk/jbossws-core/src/java/org/jboss/ws/integration/tools/jaxws/impl/JBossWSProviderImpl.java 2007-05-15
15:38:54 UTC (rev 3100)
@@ -0,0 +1,183 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt 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.ws.integration.tools.jaxws.impl;
+
+import static org.jboss.ws.core.server.UnifiedDeploymentInfo.DeploymentType.JAXWS_EJB3;
+import static org.jboss.ws.core.server.UnifiedDeploymentInfo.DeploymentType.JAXWS_JSE;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.PrintStream;
+import java.net.URL;
+import java.net.URLClassLoader;
+
+import javax.ejb.Stateless;
+
+import org.jboss.ws.WSException;
+import org.jboss.ws.core.server.UnifiedDeploymentInfo;
+import org.jboss.ws.core.server.UnifiedDeploymentInfo.DeploymentType;
+import org.jboss.ws.integration.ResourceLoaderAdapter;
+import org.jboss.ws.metadata.builder.jaxws.JAXWSWebServiceMetaDataBuilder;
+import org.jboss.ws.metadata.umdm.UnifiedMetaData;
+import org.jboss.ws.integration.tools.jaxws.api.WSContractProvider;
+
+/**
+ * The default WSContractProvider implementation.
+ *
+ * @author <a href="mailto:jason.greene@jboss.com">Jason T.
Greene</a>
+ */
+final class JBossWSProviderImpl 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 = new NullPrintStream();
+
+ private void createDirectories(File resourceDir, File sourceDir)
+ {
+ if (!outputDir.exists())
+ if (!outputDir.mkdirs())
+ throw new WSException("Could not create directory: " + outputDir);
+
+ if (generateWsdl && !resourceDir.exists())
+ if (!resourceDir.mkdirs())
+ throw new WSException("Could not create directory: " +
resourceDir);
+
+ if (generateSource && !sourceDir.exists())
+ if (!sourceDir.mkdirs())
+ throw new WSException("Could not create directory: " + sourceDir);
+ }
+
+ private UnifiedDeploymentInfo createUDI(Class<?> endpointClass, ClassLoader
loader)
+ {
+ DeploymentType type = (endpointClass.isAnnotationPresent(Stateless.class)) ?
JAXWS_EJB3 : JAXWS_JSE;
+ UnifiedDeploymentInfo udi = new UnifiedDeploymentInfo(type)
+ {
+ @Override
+ public URL getMetaDataFileURL(String resourcePath) throws IOException
+ {
+ return null;
+ }
+ };
+ udi.classLoader = loader;
+ return udi;
+ }
+
+ @Override
+ public void provide(Class<?> endpointClass)
+ {
+ // Use the output directory as the default
+ File resourceDir = (this.resourceDir != null) ? this.resourceDir : outputDir;
+ File sourceDir = (this.sourceDir != null) ? this.sourceDir : outputDir;
+
+ createDirectories(resourceDir, sourceDir);
+
+ // Create a dummy classloader to catch generated classes
+ ClassLoader loader = new URLClassLoader(new URL[0], this.loader);
+ UnifiedMetaData umd = new UnifiedMetaData(new ResourceLoaderAdapter(loader));
+ umd.setClassLoader(loader);
+
+ ChainedWritableWrapperGenerator generator = new ChainedWritableWrapperGenerator();
+ if (generateSource)
+ generator.add(new SourceWrapperGenerator(loader, messageStream), sourceDir);
+ generator.add(new BytecodeWrapperGenerator(loader, messageStream), outputDir);
+
+ JAXWSWebServiceMetaDataBuilder builder = new JAXWSWebServiceMetaDataBuilder();
+ builder.setWrapperGenerator(generator);
+ builder.setGenerateWsdl(generateWsdl);
+ builder.setToolMode(true);
+ builder.setWsdlDirectory(resourceDir);
+ builder.setMessageStream(messageStream);
+
+ if (generateWsdl)
+ messageStream.println("Generating WSDL:");
+
+ UnifiedDeploymentInfo udi = createUDI(endpointClass, loader);
+ builder.buildWebServiceMetaData(umd, udi, endpointClass, null);
+ try
+ {
+ generator.write();
+ }
+ catch (IOException io)
+ {
+ throw new WSException("Could not write output files:", io);
+ }
+ }
+
+ @Override
+ public void provide(String endpointClass)
+ {
+ try
+ {
+ provide(loader.loadClass(endpointClass));
+ }
+ catch (ClassNotFoundException e)
+ {
+ throw new WSException("Class not found: " + endpointClass);
+ }
+ }
+
+ @Override
+ public void setClassLoader(ClassLoader loader)
+ {
+ this.loader = loader;
+ }
+
+ @Override
+ public void setGenerateWsdl(boolean generateWsdl)
+ {
+ this.generateWsdl = generateWsdl;
+ }
+
+ @Override
+ public void setOutputDirectory(File directory)
+ {
+ outputDir = directory;
+ }
+
+ @Override
+ public void setGenerateSource(boolean generateSource)
+ {
+ this.generateSource = generateSource;
+ }
+
+ @Override
+ public void setResourceDirectory(File directory)
+ {
+ resourceDir = directory;
+ }
+
+ @Override
+ public void setSourceDirectory(File directory)
+ {
+ sourceDir = directory;
+ }
+
+ @Override
+ public void setMessageStream(PrintStream messageStream)
+ {
+ this.messageStream = messageStream;
+ }
+}
Property changes on:
branches/hbraun/trunk/jbossws-core/src/java/org/jboss/ws/integration/tools/jaxws/impl/JBossWSProviderImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
branches/hbraun/trunk/jbossws-core/src/java/org/jboss/ws/integration/tools/jaxws/impl/NullPrintStream.java
===================================================================
---
branches/hbraun/trunk/jbossws-core/src/java/org/jboss/ws/integration/tools/jaxws/impl/NullPrintStream.java
(rev 0)
+++
branches/hbraun/trunk/jbossws-core/src/java/org/jboss/ws/integration/tools/jaxws/impl/NullPrintStream.java 2007-05-15
15:38:54 UTC (rev 3100)
@@ -0,0 +1,209 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.ws.integration.tools.jaxws.impl;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.PrintStream;
+import java.util.Locale;
+
+class NullPrintStream extends PrintStream
+{
+ NullPrintStream()
+ {
+ // Doesn't actually do anything
+ super(new ByteArrayOutputStream());
+ }
+
+ @Override
+ public PrintStream append(char c)
+ {
+ return this;
+ }
+
+ @Override
+ public PrintStream append(CharSequence csq, int start, int end)
+ {
+ return this;
+ }
+
+ @Override
+ public PrintStream append(CharSequence csq)
+ {
+ return this;
+ }
+
+ @Override
+ public boolean checkError()
+ {
+ return false;
+ }
+
+ @Override
+ public void close()
+ {
+ }
+
+ @Override
+ public void flush()
+ {
+ }
+
+ @Override
+ public PrintStream format(Locale l, String format, Object... args)
+ {
+ return this;
+ }
+
+ @Override
+ public PrintStream format(String format, Object... args)
+ {
+ return this;
+ }
+
+ @Override
+ public void print(boolean b)
+ {
+ }
+
+ @Override
+ public void print(char c)
+ {
+ }
+
+ @Override
+ public void print(char[] s)
+ {
+ }
+
+ @Override
+ public void print(double d)
+ {
+ }
+
+ @Override
+ public void print(float f)
+ {
+ }
+
+ @Override
+ public void print(int i)
+ {
+ }
+
+ @Override
+ public void print(long l)
+ {
+ }
+
+ @Override
+ public void print(Object obj)
+ {
+ }
+
+ @Override
+ public void print(String s)
+ {
+ }
+
+ @Override
+ public PrintStream printf(Locale l, String format, Object... args)
+ {
+ return this;
+ }
+
+ @Override
+ public PrintStream printf(String format, Object... args)
+ {
+ return this;
+ }
+
+ @Override
+ public void println()
+ {
+ }
+
+ @Override
+ public void println(boolean x)
+ {
+ }
+
+ @Override
+ public void println(char x)
+ {
+ }
+
+ @Override
+ public void println(char[] x)
+ {
+ }
+
+ @Override
+ public void println(double x)
+ {
+ }
+
+ @Override
+ public void println(float x)
+ {
+ }
+
+ @Override
+ public void println(int x)
+ {
+ }
+
+ @Override
+ public void println(long x)
+ {
+ }
+
+ @Override
+ public void println(Object x)
+ {
+ }
+
+ @Override
+ public void println(String x)
+ {
+ }
+
+ @Override
+ protected void setError()
+ {
+ }
+
+ @Override
+ public void write(byte[] buf, int off, int len)
+ {
+ }
+
+ @Override
+ public void write(int b)
+ {
+ }
+
+ @Override
+ public void write(byte[] b) throws IOException
+ {
+ }
+}
Property changes on:
branches/hbraun/trunk/jbossws-core/src/java/org/jboss/ws/integration/tools/jaxws/impl/NullPrintStream.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
branches/hbraun/trunk/jbossws-core/src/java/org/jboss/ws/integration/tools/jaxws/impl/SourceWrapperGenerator.java
===================================================================
---
branches/hbraun/trunk/jbossws-core/src/java/org/jboss/ws/integration/tools/jaxws/impl/SourceWrapperGenerator.java
(rev 0)
+++
branches/hbraun/trunk/jbossws-core/src/java/org/jboss/ws/integration/tools/jaxws/impl/SourceWrapperGenerator.java 2007-05-15
15:38:54 UTC (rev 3100)
@@ -0,0 +1,184 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.ws.integration.tools.jaxws.impl;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.PrintStream;
+import java.util.List;
+import java.util.SortedMap;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import javax.xml.namespace.QName;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.WSException;
+import org.jboss.ws.core.jaxws.AbstractWrapperGenerator;
+import org.jboss.ws.core.utils.JavaUtils;
+import org.jboss.ws.metadata.umdm.FaultMetaData;
+import org.jboss.ws.metadata.umdm.OperationMetaData;
+import org.jboss.ws.metadata.umdm.ParameterMetaData;
+import org.jboss.ws.metadata.umdm.WrappedParameter;
+
+import com.sun.codemodel.JAnnotationArrayMember;
+import com.sun.codemodel.JAnnotationUse;
+import com.sun.codemodel.JCodeModel;
+import com.sun.codemodel.JDefinedClass;
+import com.sun.codemodel.JExpr;
+import com.sun.codemodel.JFieldVar;
+import com.sun.codemodel.JMethod;
+import com.sun.codemodel.JMod;
+
+/**
+ * Generates source for wrapper beans
+ *
+ * @author <a href="mailto:jason.greene@jboss.com">Jason T.
Greene</a>
+ * @version $Revision$
+ */
+public class SourceWrapperGenerator extends AbstractWrapperGenerator implements
WritableWrapperGenerator
+{
+ private static Logger log = Logger.getLogger(SourceWrapperGenerator.class);
+ private PrintStream stream;
+ private JCodeModel codeModel;
+
+
+ public SourceWrapperGenerator(ClassLoader loader, PrintStream stream)
+ {
+ super(loader);
+ this.stream = stream;
+ codeModel = new JCodeModel();
+ }
+
+ @Override
+ public void reset(ClassLoader loader)
+ {
+ super.reset(loader);
+ codeModel = new JCodeModel();
+ }
+
+ public void write(File directory) throws IOException
+ {
+ stream.println("Writing Source:");
+ codeModel.build(directory, stream);
+ }
+
+ public void generate(ParameterMetaData pmd)
+ {
+ List<WrappedParameter> wrappedParameters = pmd.getWrappedParameters();
+ OperationMetaData operationMetaData = pmd.getOperationMetaData();
+
+ if (operationMetaData.isDocumentWrapped() == false)
+ throw new WSException("Operation is not document/literal (wrapped)");
+
+ if (wrappedParameters == null)
+ throw new WSException("Cannot generate a type when their is no type
information");
+
+ String wrapperName = pmd.getJavaTypeName();
+ if (log.isDebugEnabled())
+ if(log.isDebugEnabled()) log.debug("Generating wrapper: " +
wrapperName);
+
+ try
+ {
+
+ JDefinedClass clazz = codeModel._class(wrapperName);
+ addClassAnnotations(clazz, pmd.getXmlName(), pmd.getXmlType(), null);
+ for (WrappedParameter wrapped : wrappedParameters)
+ {
+ addProperty(clazz, wrapped.getType(), wrapped.getName(),
wrapped.getVariable());
+ }
+ }
+ catch (Exception e)
+ {
+ throw new WSException("Could not generate wrapper type: " +
wrapperName, e);
+ }
+ }
+ public void generate(FaultMetaData fmd)
+ {
+ String faultBeanName = fmd.getFaultBeanName();
+ Class exception = fmd.getJavaType();
+
+ try
+ {
+ SortedMap<String, Class<?>> properties =
getExceptionProperties(exception);
+ String[] propertyOrder = properties.keySet().toArray(new String[0]);
+
+ JDefinedClass clazz = codeModel._class(faultBeanName);
+ addClassAnnotations(clazz, fmd.getXmlName(), fmd.getXmlType(), propertyOrder);
+
+ for (String property : propertyOrder)
+ addProperty(clazz, properties.get(property).getName(), new QName(property),
property);
+ }
+ catch (Exception e)
+ {
+ throw new WSException("Could not generate wrapper type: " +
faultBeanName, e);
+ }
+ }
+
+ private static String getterPrefix(Class type)
+ {
+ return Boolean.TYPE == type || Boolean.class == type ? "is" :
"get";
+ }
+
+ private void addProperty(JDefinedClass clazz, String typeName, QName name, String
variable)
+ throws ClassNotFoundException
+ {
+ Class type = JavaUtils.loadJavaType(typeName, loader);
+ JFieldVar field = clazz.field(JMod.PRIVATE, type, variable);
+ JAnnotationUse annotation = field.annotate(XmlElement.class);
+ if (name.getNamespaceURI() != null)
+ annotation.param("namespace", name.getNamespaceURI());
+ annotation.param("name", name.getLocalPart());
+
+ // Add acessor methods
+ JMethod method = clazz.method(JMod.PUBLIC, type, getterPrefix(type) +
JavaUtils.capitalize(variable));
+ method.body()._return(JExpr._this().ref(variable));
+
+ method = clazz.method(JMod.PUBLIC, type, "set" +
JavaUtils.capitalize(variable));
+ method.body().assign(JExpr._this().ref(variable), method.param(type, variable));
+ }
+
+ private static void addClassAnnotations(JDefinedClass clazz, QName xmlName, QName
xmlType, String[] propertyOrder)
+ {
+ JAnnotationUse annotation = clazz.annotate(XmlRootElement.class);
+ if (xmlName.getNamespaceURI() != null && xmlName.getNamespaceURI().length()
> 0)
+ annotation.param("namespace", xmlName.getNamespaceURI());
+ annotation.param("name", xmlName.getLocalPart());
+
+ annotation = clazz.annotate(XmlType.class);
+ if (xmlType.getNamespaceURI() != null & xmlType.getNamespaceURI().length() >
0)
+ annotation.param("namespace", xmlType.getNamespaceURI());
+ annotation.param("name", xmlType.getLocalPart());
+ if (propertyOrder != null)
+ {
+ JAnnotationArrayMember paramArray =
annotation.paramArray("propOrder");
+ for (String property : propertyOrder)
+ paramArray.param(property);
+ }
+
+ annotation = clazz.annotate(XmlAccessorType.class);
+ annotation.param("value", XmlAccessType.FIELD);
+ }
+}
\ No newline at end of file
Property changes on:
branches/hbraun/trunk/jbossws-core/src/java/org/jboss/ws/integration/tools/jaxws/impl/SourceWrapperGenerator.java
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
branches/hbraun/trunk/jbossws-core/src/java/org/jboss/ws/integration/tools/jaxws/impl/SunRIConsumerFactoryImpl.java
===================================================================
---
branches/hbraun/trunk/jbossws-core/src/java/org/jboss/ws/integration/tools/jaxws/impl/SunRIConsumerFactoryImpl.java
(rev 0)
+++
branches/hbraun/trunk/jbossws-core/src/java/org/jboss/ws/integration/tools/jaxws/impl/SunRIConsumerFactoryImpl.java 2007-05-15
15:38:54 UTC (rev 3100)
@@ -0,0 +1,39 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt 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.ws.integration.tools.jaxws.impl;
+
+import org.jboss.ws.integration.tools.jaxws.api.WSContractConsumer;
+import org.jboss.ws.integration.tools.jaxws.spi.WSContractConsumerFactory;
+
+/**
+ * Creates a WSContractConsumer that delegates to the Sun RI.
+ *
+ * @author <a href="jason.greene(a)jboss.com">Jason T. Greene</a>
+ * @version $Revision:2311 $
+ */
+public class SunRIConsumerFactoryImpl implements WSContractConsumerFactory
+{
+ public WSContractConsumer createConsumer() {
+ return new SunRIConsumerImpl();
+ }
+}
+
Property changes on:
branches/hbraun/trunk/jbossws-core/src/java/org/jboss/ws/integration/tools/jaxws/impl/SunRIConsumerFactoryImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
branches/hbraun/trunk/jbossws-core/src/java/org/jboss/ws/integration/tools/jaxws/impl/SunRIConsumerImpl.java
===================================================================
---
branches/hbraun/trunk/jbossws-core/src/java/org/jboss/ws/integration/tools/jaxws/impl/SunRIConsumerImpl.java
(rev 0)
+++
branches/hbraun/trunk/jbossws-core/src/java/org/jboss/ws/integration/tools/jaxws/impl/SunRIConsumerImpl.java 2007-05-15
15:38:54 UTC (rev 3100)
@@ -0,0 +1,170 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt 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.ws.integration.tools.jaxws.impl;
+
+import java.io.File;
+import java.io.PrintStream;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
+
+import com.sun.tools.ws.wscompile.CompileTool;
+import org.jboss.ws.integration.tools.jaxws.api.WSContractConsumer;
+
+/**
+ * WSContractConsumer that delegates to the Sun CompileTool.
+ *
+ * @author <a href="jason.greene(a)jboss.com">Jason T. Greene</a>
+ * @version $Revision$
+ */
+public class SunRIConsumerImpl extends WSContractConsumer
+{
+ private List<File> bindingFiles = null;
+ private File catalog = null;
+ 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 = null;
+
+ @Override
+ public void setBindingFiles(List<File> bindingFiles) {
+ this.bindingFiles = bindingFiles;
+ }
+
+ @Override
+ public void setCatalog(File catalog) {
+ this.catalog = catalog;
+ }
+
+ @Override
+ public void setGenerateSource(boolean generateSource) {
+ this.generateSource = generateSource;
+ }
+
+ @Override
+ public void setMessageStream(PrintStream messageStream) {
+ // TODO Auto-generated method stub
+ this.messageStream = messageStream;
+ }
+
+ @Override
+ public void setOutputDirectory(File directory) {
+ // TODO Auto-generated method stub
+ 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 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 (generateSource) {
+ args.add("-keep");
+ 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 (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 = new NullPrintStream();
+ }
+
+ 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("-d");
+ args.add(outputDir.getAbsolutePath());
+ args.add(wsdl.toString());
+
+ // WSToolsObjectFactory tools = WSToolsObjectFactory.newInstance();
+ // tools.wsimport(stream, args.toArray(new String[0]));
+
+ // We have to manipulate internals since they don't expose a way to set
+ // the classpath that is used for compilation
+ CompileTool tool = new CompileTool(stream, "wsimport") {
+ @Override
+ public boolean run(String[] args) {
+ StringBuilder builder = new StringBuilder();
+ if (additionalCompilerClassPath != null &&
additionalCompilerClassPath.size() > 0) {
+ for (String entry : additionalCompilerClassPath)
+ builder.append(entry).append(File.pathSeparatorChar);
+ builder.setLength(builder.length() - 1);
+ }
+ userClasspath = builder.toString();
+ return super.run(args);
+ }
+ };
+ tool.run(args.toArray(new String[0]));
+ }
+}
+
Property changes on:
branches/hbraun/trunk/jbossws-core/src/java/org/jboss/ws/integration/tools/jaxws/impl/SunRIConsumerImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
branches/hbraun/trunk/jbossws-core/src/java/org/jboss/ws/integration/tools/jaxws/impl/WritableWrapperGenerator.java
===================================================================
---
branches/hbraun/trunk/jbossws-core/src/java/org/jboss/ws/integration/tools/jaxws/impl/WritableWrapperGenerator.java
(rev 0)
+++
branches/hbraun/trunk/jbossws-core/src/java/org/jboss/ws/integration/tools/jaxws/impl/WritableWrapperGenerator.java 2007-05-15
15:38:54 UTC (rev 3100)
@@ -0,0 +1,32 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.ws.integration.tools.jaxws.impl;
+
+import java.io.File;
+import java.io.IOException;
+
+import org.jboss.ws.core.jaxws.WrapperGenerator;
+
+public interface WritableWrapperGenerator extends WrapperGenerator
+{
+ public void write(File directory) throws IOException;
+}
\ No newline at end of file
Property changes on:
branches/hbraun/trunk/jbossws-core/src/java/org/jboss/ws/integration/tools/jaxws/impl/WritableWrapperGenerator.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
branches/hbraun/trunk/jbossws-core/src/java/org/jboss/ws/integration/tools/jaxws/spi/WSContractConsumerFactory.java
===================================================================
---
branches/hbraun/trunk/jbossws-core/src/java/org/jboss/ws/integration/tools/jaxws/spi/WSContractConsumerFactory.java
(rev 0)
+++
branches/hbraun/trunk/jbossws-core/src/java/org/jboss/ws/integration/tools/jaxws/spi/WSContractConsumerFactory.java 2007-05-15
15:38:54 UTC (rev 3100)
@@ -0,0 +1,40 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.ws.integration.tools.jaxws.spi;
+
+import org.jboss.ws.integration.tools.jaxws.api.WSContractConsumer;
+
+/**
+ * WSContractConsumerFactory defines the contract for a WSContractConsumer factory.
+ *
+ * @author <a href="mailto:jason.greene@jboss.com">Jason T.
Greene</a>
+ */
+public interface WSContractConsumerFactory
+{
+ /**
+ * Create a new WSContractConsumer. There are no restrictions on how this
+ * should be performed.
+ *
+ * @return a new WSContractConsumer
+ */
+ public WSContractConsumer createConsumer();
+}
Property changes on:
branches/hbraun/trunk/jbossws-core/src/java/org/jboss/ws/integration/tools/jaxws/spi/WSContractConsumerFactory.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
branches/hbraun/trunk/jbossws-core/src/java/org/jboss/ws/integration/tools/jaxws/spi/WSContractProviderFactory.java
===================================================================
---
branches/hbraun/trunk/jbossws-core/src/java/org/jboss/ws/integration/tools/jaxws/spi/WSContractProviderFactory.java
(rev 0)
+++
branches/hbraun/trunk/jbossws-core/src/java/org/jboss/ws/integration/tools/jaxws/spi/WSContractProviderFactory.java 2007-05-15
15:38:54 UTC (rev 3100)
@@ -0,0 +1,43 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.ws.integration.tools.jaxws.spi;
+
+import org.jboss.ws.integration.tools.jaxws.api.WSContractProvider;
+
+/**
+ * WSContractProviderFactory defines the contract for a WSContractProvider factory.
+ *
+ * @author <a href="mailto:jason.greene@jboss.com">Jason T.
Greene</a>
+ */
+public interface WSContractProviderFactory
+{
+ /**
+ * Create a new WSContractProvider. There are no restrictions on how this
+ * should be performed. The passed ClassLoader is the one used in
+ * {@link WSContractProvider#newInstance(ClassLoader)}. This loader
+ * should be made available to the generated WSContractProvider.
+ *
+ * @param loader the ClassLoader for type discovery
+ * @return a new WSContractProvider
+ */
+ public WSContractProvider createProvider(ClassLoader loader);
+}
Property changes on:
branches/hbraun/trunk/jbossws-core/src/java/org/jboss/ws/integration/tools/jaxws/spi/WSContractProviderFactory.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified:
branches/hbraun/trunk/jbossws-core/src/java/org/jboss/ws/metadata/builder/jaxws/JAXWSWebServiceMetaDataBuilder.java
===================================================================
---
branches/hbraun/trunk/jbossws-core/src/java/org/jboss/ws/metadata/builder/jaxws/JAXWSWebServiceMetaDataBuilder.java 2007-05-15
14:01:18 UTC (rev 3099)
+++
branches/hbraun/trunk/jbossws-core/src/java/org/jboss/ws/metadata/builder/jaxws/JAXWSWebServiceMetaDataBuilder.java 2007-05-15
15:38:54 UTC (rev 3100)
@@ -52,7 +52,7 @@
import org.jboss.ws.metadata.j2ee.serviceref.UnifiedHandlerMetaData;
import org.jboss.ws.metadata.j2ee.serviceref.UnifiedHandlerChainsMetaData;
import org.jboss.ws.tools.ToolsUtils;
-import org.jboss.ws.tools.jaxws.JAXBWSDLGenerator;
+import org.jboss.ws.tools.wsdl.JAXBWSDLGenerator;
import org.jboss.ws.tools.wsdl.WSDLGenerator;
import org.jboss.ws.tools.wsdl.WSDLWriter;
import org.jboss.ws.tools.wsdl.WSDLWriterResolver;
Added:
branches/hbraun/trunk/jbossws-core/src/java/org/jboss/ws/tools/wsdl/JAXBWSDLGenerator.java
===================================================================
---
branches/hbraun/trunk/jbossws-core/src/java/org/jboss/ws/tools/wsdl/JAXBWSDLGenerator.java
(rev 0)
+++
branches/hbraun/trunk/jbossws-core/src/java/org/jboss/ws/tools/wsdl/JAXBWSDLGenerator.java 2007-05-15
15:38:54 UTC (rev 3100)
@@ -0,0 +1,113 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt 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.ws.tools.wsdl;
+
+import java.io.IOException;
+
+import javax.xml.bind.SchemaOutputResolver;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.transform.Result;
+import javax.xml.transform.dom.DOMResult;
+
+import org.jboss.ws.Constants;
+import org.jboss.ws.WSException;
+import org.jboss.ws.extensions.security.Util;
+import org.jboss.ws.metadata.wsdl.DOMTypes;
+import org.jboss.ws.tools.wsdl.WSDLGenerator;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+import com.sun.xml.bind.api.JAXBRIContext;
+
+/**
+ * JAXBWSDLGenerator provides a JAXB based WSDLGenerator.
+ *
+ * @author <a href="mailto:jason.greene@jboss.com">Jason T.
Greene</a>
+ */
+public class JAXBWSDLGenerator extends WSDLGenerator
+{
+ private JAXBRIContext ctx;
+
+ public JAXBWSDLGenerator(JAXBRIContext ctx)
+ {
+ super();
+ this.ctx = ctx;
+ }
+
+ protected void processTypes()
+ {
+ // Register namespaces
+ for (String ns : ctx.getKnownNamespaceURIs())
+ if (ns.length() > 0)
+ wsdl.registerNamespaceURI(ns, null);
+
+ try
+ {
+ DocumentBuilder builder =
DocumentBuilderFactory.newInstance().newDocumentBuilder();
+ Document doc = builder.newDocument();
+ DOMTypes types = new DOMTypes(doc);
+ final Element element = types.getElement();
+ final Element throwAway = doc.createElement("throw-away");
+
+ ctx.generateSchema(new SchemaOutputResolver()
+ {
+ @Override
+ public Result createOutput(String namespace, String file) throws IOException
+ {
+ // JBWS-1295, getKnownNamespaceURIs is not accurate
+ if (namespace.length() > 0 && wsdl.getPrefix(namespace) ==
null)
+ wsdl.registerNamespaceURI(namespace, null);
+
+ // JAXB creates an empty namespace due to type references, ignore it
+ DOMResult result = new DOMResult((namespace == null || namespace.length()
== 0) ? throwAway : element);
+ result.setSystemId("replace-me");
+ return result;
+ }
+ });
+
+ // Until we stop inlining schema, we will need to filter schemaLocations since
JAXB requires them
+ removeSchemaLocations(element);
+
+ wsdl.setWsdlTypes(types);
+ }
+ catch (Exception exception)
+ {
+ throw new WSException("Could not generate schema: " +
exception.getMessage(), exception);
+ }
+ }
+
+ private void removeSchemaLocations(Element element)
+ {
+ for (Element child = Util.getFirstChildElement(element); child != null; child =
Util.getNextSiblingElement(child))
+ {
+ if ("import".equals(child.getLocalName()) &&
Constants.NS_SCHEMA_XSD.equals(child.getNamespaceURI()) &&
"replace-me".equals(child.getAttribute("schemaLocation")))
+ {
+ child.removeAttribute("schemaLocation");
+ }
+ else
+ {
+ removeSchemaLocations(child);
+ }
+ }
+ }
+}
\ No newline at end of file
Property changes on:
branches/hbraun/trunk/jbossws-core/src/java/org/jboss/ws/tools/wsdl/JAXBWSDLGenerator.java
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: branches/hbraun/trunk/jbossws-core/src/resources/samples/build.xml
===================================================================
--- branches/hbraun/trunk/jbossws-core/src/resources/samples/build.xml 2007-05-15 14:01:18
UTC (rev 3099)
+++ branches/hbraun/trunk/jbossws-core/src/resources/samples/build.xml 2007-05-15 15:38:54
UTC (rev 3100)
@@ -239,7 +239,7 @@
<target name="wsconsume" depends="init"
description="Consume JAX-WS contracts" if="HAVE_JDK_1.5">
<!-- Define the JAX-WS wsconsume task -->
- <taskdef name="wsconsume"
classname="org.jboss.ws.tools.jaxws.ant.wsconsume">
+ <taskdef name="wsconsume"
classname="org.jboss.ws.integration.tools.jaxws.ant.wsconsume">
<classpath refid="core.classpath"/>
<classpath refid="jbossws.classpath"/>
<classpath
location="${thirdparty.dir}/jbossws-wsconsume-impl.jar"/>
@@ -331,7 +331,7 @@
<target name="wsprovide" depends="compile"
description="Provide the JAX-WS contracts." if="HAVE_JDK_1.5">
<!-- Define the JAX-WS wsprovide task -->
- <taskdef name="wsprovide"
classname="org.jboss.ws.tools.jaxws.ant.wsprovide">
+ <taskdef name="wsprovide"
classname="org.jboss.ws.integration.tools.jaxws.ant.wsprovide">
<classpath refid="core.classpath"/>
<classpath refid="jbossws.classpath"/>
<classpath location="${thirdparty.dir}/concurrent.jar"/>
Modified: branches/hbraun/trunk/jbossws-tests/build.xml
===================================================================
--- branches/hbraun/trunk/jbossws-tests/build.xml 2007-05-15 14:01:18 UTC (rev 3099)
+++ branches/hbraun/trunk/jbossws-tests/build.xml 2007-05-15 15:38:54 UTC (rev 3100)
@@ -246,14 +246,14 @@
<target name="wsconsume" depends="init"
description="Consume JAX-WS contracts" if="HAVE_JDK_1.5">
<!-- Define the JAX-WS wsconsume task -->
- <taskdef name="wsconsume"
classname="org.jboss.ws.tools.jaxws.ant.wsconsume">
+ <taskdef name="wsconsume"
classname="org.jboss.ws.integration.tools.jaxws.ant.wsconsume">
<classpath refid="core.classpath"/>
<classpath refid="jbossws.classpath"/>
<classpath
location="${thirdparty.dir}/jbossws-wsconsume-impl.jar"/>
<classpath location="${thirdparty.dir}/jaxb-xjc.jar"/>
</taskdef>
- <wsconsume
wsdl="${tests.resources.dir}/benchmark/jaxws/doclit/WEB-INF/wsdl/BenchmarkWebService.wsdl"
package="org.jboss.test.ws.benchmark.jaxws.doclit"
sourcedestdir="${tests.output.dir}/wsconsume/java" keep="true"
verbose="false"/>
+ <wsconsume
wsdl="${tests.resources.dir}/benchmark/jaxws/doclit/WEB-INF/wsdl/BenchmarkWebService.wsdl"
package="org.jboss.test.ws.benchmark.jaxws.doclit"
sourcedestdir="${tests.output.dir}/wsconsume/java" keep="true"
verbose="true"/>
<wsconsume
wsdl="${tests.resources.dir}/interop/soapwsdl/BaseDataTypesDocLitB/WEB-INF/wsdl/service.wsdl"
package="org.jboss.test.ws.interop.soapwsdl.basedoclitb"
sourcedestdir="${tests.output.dir}/wsconsume/java" keep="true"/>
<wsconsume
wsdl="${tests.resources.dir}/interop/soapwsdl/BaseDataTypesDocLitW/WEB-INF/wsdl/service.wsdl"
package="org.jboss.test.ws.interop.soapwsdl.basedoclitw"
sourcedestdir="${tests.output.dir}/wsconsume/java" keep="true"/>
<wsconsume
wsdl="${tests.resources.dir}/interop/soapwsdl/BaseDataTypesRpcLit/WEB-INF/wsdl/service.wsdl"
package="org.jboss.test.ws.interop.soapwsdl.baserpclit"
sourcedestdir="${tests.output.dir}/wsconsume/java" keep="true"/>
@@ -344,7 +344,7 @@
<target name="wsprovide" depends="compile"
description="Provide the JAX-WS contracts." if="HAVE_JDK_1.5">
<!-- Define the JAX-WS wsprovide task -->
- <taskdef name="wsprovide"
classname="org.jboss.ws.tools.jaxws.ant.wsprovide">
+ <taskdef name="wsprovide"
classname="org.jboss.ws.integration.tools.jaxws.ant.wsprovide">
<classpath refid="core.classpath"/>
<classpath refid="jbossws.classpath"/>
<classpath location="${thirdparty.dir}/concurrent.jar"/>
Modified:
branches/hbraun/trunk/jbossws-tests/src/java/org/jboss/test/ws/tools/jaxws/WSContractProviderTestCase.java
===================================================================
---
branches/hbraun/trunk/jbossws-tests/src/java/org/jboss/test/ws/tools/jaxws/WSContractProviderTestCase.java 2007-05-15
14:01:18 UTC (rev 3099)
+++
branches/hbraun/trunk/jbossws-tests/src/java/org/jboss/test/ws/tools/jaxws/WSContractProviderTestCase.java 2007-05-15
15:38:54 UTC (rev 3100)
@@ -31,7 +31,7 @@
import org.jboss.test.ws.jaxws.samples.soapbinding.PurchaseOrder;
import org.jboss.test.ws.jaxws.samples.soapbinding.PurchaseOrderAck;
import org.jboss.ws.core.utils.JavaUtils;
-import org.jboss.ws.tools.jaxws.api.WSContractProvider;
+import org.jboss.ws.integration.tools.jaxws.api.WSContractProvider;
import org.jboss.ws.tools.wsdl.WSDLDefinitionsFactory;
/**