You are viewing a plain text version of this content. The canonical link for it is here.
Posted to muse-dev@ws.apache.org by wi...@apache.org on 2005/08/12 22:45:46 UTC
svn commit: r232376 [102/112] - in
/webservices/muse/trunk/src/examples/client: ./ bin/ bin/axis/
bin/axis/com/ bin/axis/com/xyz/ bin/org/ bin/org/apache/ bin/org/apache/ws/
bin/org/apache/ws/client/ bin/org/apache/ws/client/async/
bin/org/apache/ws/cl...
Added: webservices/muse/trunk/src/examples/client/target/wsdmclient-1.0/src/wsdmclient-1.0/build.xml
URL: http://svn.apache.org/viewcvs/webservices/muse/trunk/src/examples/client/target/wsdmclient-1.0/src/wsdmclient-1.0/build.xml?rev=232376&view=auto
==============================================================================
--- webservices/muse/trunk/src/examples/client/target/wsdmclient-1.0/src/wsdmclient-1.0/build.xml (added)
+++ webservices/muse/trunk/src/examples/client/target/wsdmclient-1.0/src/wsdmclient-1.0/build.xml Fri Aug 12 13:38:04 2005
@@ -0,0 +1,199 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--build.xml generated by maven from project.xml version 1.0
+ on date December 21 2004, time 1705-->
+
+<project default="jar" name="wsdmclient" basedir=".">
+ <property name="defaulttargetdir" value="C:\home\wire\projects\apache_workspace\client/target">
+ </property>
+ <property name="libdir" value="C:\home\wire\projects\apache_workspace\client/target/lib">
+ </property>
+ <property name="classesdir" value="C:\home\wire\projects\apache_workspace\client/target/classes">
+ </property>
+ <property name="testclassesdir" value="C:\home\wire\projects\apache_workspace\client/target/test-classes">
+ </property>
+ <property name="testclassesdir" value="C:\home\wire\projects\apache_workspace\client/target/test-classes">
+ </property>
+ <property name="testreportdir" value="C:\home\wire\projects\apache_workspace\client/target/test-reports">
+ </property>
+ <property name="distdir" value="dist">
+ </property>
+ <property name="javadocdir" value="dist/docs/api">
+ </property>
+ <property name="final.name" value="wsdmclient-1.0">
+ </property>
+ <target name="init" description="o Initializes some properties">
+ <mkdir dir="${libdir}">
+ </mkdir>
+ <condition property="noget">
+ <equals arg2="only" arg1="${build.sysclasspath}">
+ </equals>
+ </condition>
+ </target>
+ <target name="compile" description="o Compile the code" depends="get-deps">
+ <mkdir dir="${classesdir}">
+ </mkdir>
+ <javac destdir="${classesdir}" deprecation="true" debug="true" optimize="false" excludes="**/package.html">
+ <src>
+ <pathelement location="src/java">
+ </pathelement>
+ </src>
+ <classpath>
+ <fileset dir="${libdir}">
+ <include name="*.jar">
+ </include>
+ </fileset>
+ </classpath>
+ </javac>
+ </target>
+ <target name="jar" description="o Create the jar" depends="compile,test">
+ <jar jarfile="${defaulttargetdir}/${final.name}.jar" excludes="**/package.html" basedir="${classesdir}">
+ </jar>
+ </target>
+ <target name="clean" description="o Clean up the generated directories">
+ <delete dir="${defaulttargetdir}">
+ </delete>
+ <delete dir="${distdir}">
+ </delete>
+ </target>
+ <target name="dist" description="o Create a distribution" depends="jar, javadoc">
+ <mkdir dir="dist">
+ </mkdir>
+ <copy todir="dist">
+ <fileset dir="${defaulttargetdir}" includes="*.jar">
+ </fileset>
+ <fileset dir="${basedir}" includes="LICENSE*, README*">
+ </fileset>
+ </copy>
+ </target>
+ <target name="test" description="o Run the test cases" if="test.failure" depends="internal-test">
+ <fail message="There were test failures.">
+ </fail>
+ </target>
+ <target name="internal-test" depends="compile-tests">
+ <mkdir dir="${testreportdir}">
+ </mkdir>
+ <junit dir="./" failureproperty="test.failure" printSummary="yes" fork="true" haltonerror="true">
+ <sysproperty key="basedir" value=".">
+ </sysproperty>
+ <formatter type="xml">
+ </formatter>
+ <formatter usefile="false" type="plain">
+ </formatter>
+ <classpath>
+ <fileset dir="${libdir}">
+ <include name="*.jar">
+ </include>
+ </fileset>
+ <pathelement path="${testclassesdir}">
+ </pathelement>
+ <pathelement path="${classesdir}">
+ </pathelement>
+ </classpath>
+ <batchtest todir="${testreportdir}">
+ <fileset dir="src/test">
+ <include name="**/*TestCase.java">
+ </include>
+ <exclude name="**/Abstract*TestCase.java">
+ </exclude>
+ </fileset>
+ </batchtest>
+ </junit>
+ </target>
+ <target name="compile-tests" depends="compile">
+ <mkdir dir="${testclassesdir}">
+ </mkdir>
+ <javac destdir="${testclassesdir}" deprecation="true" debug="true" optimize="false" excludes="**/package.html">
+ <src>
+ <pathelement location="src/test">
+ </pathelement>
+ </src>
+ <classpath>
+ <fileset dir="${libdir}">
+ <include name="*.jar">
+ </include>
+ </fileset>
+ <pathelement path="${classesdir}">
+ </pathelement>
+ </classpath>
+ </javac>
+ </target>
+ <target name="javadoc" description="o Generate javadoc">
+ <mkdir dir="${javadocdir}">
+ </mkdir>
+ <tstamp>
+ <format pattern="2004-yyyy" property="year">
+ </format>
+ </tstamp>
+ <property name="copyright" value="Copyright &copy; 2004 Apache. All Rights Reserved.">
+ </property>
+ <property name="title" value="wsdmclient 1.0 API">
+ </property>
+ <javadoc bottom="Copyright &copy; 2004 Apache. All Rights Reserved." use="true" private="true" destdir="${javadocdir}" author="true" version="true" sourcepath="src/java" packagenames="org.apache.ws.*">
+ <classpath>
+ <fileset dir="${libdir}">
+ <include name="*.jar">
+ </include>
+ </fileset>
+ <pathelement location="${defaulttargetdir}/${final.name}.jar">
+ </pathelement>
+ </classpath>
+ </javadoc>
+ </target>
+ <target name="get-deps" unless="noget" depends="init">
+ <get dest="${libdir}/muse-disk-types-SNAPSHOT.jar" usetimestamp="true" ignoreerrors="true" src="http://www.apache.org/dist/java-repository//muse/jars/muse-disk-types-SNAPSHOT.jar">
+ </get>
+ <get dest="${libdir}/addressing-SNAPSHOT.jar" usetimestamp="true" ignoreerrors="true" src="http://www.apache.org/dist/java-repository//addressing/jars/addressing-SNAPSHOT.jar">
+ </get>
+ <get dest="${libdir}/ant-1.6.2.jar" usetimestamp="true" ignoreerrors="true" src="http://www.apache.org/dist/java-repository//ant/jars/ant-1.6.2.jar">
+ </get>
+ <get dest="${libdir}/axis-1.2-RC2.jar" usetimestamp="true" ignoreerrors="true" src="http://www.apache.org/dist/java-repository//axis/jars/axis-1.2-RC2.jar">
+ </get>
+ <get dest="${libdir}/axis-saaj-1.2-RC2.jar" usetimestamp="true" ignoreerrors="true" src="http://www.apache.org/dist/java-repository//axis/jars/axis-saaj-1.2-RC2.jar">
+ </get>
+ <get dest="${libdir}/axis-jaxrpc-1.2-RC2.jar" usetimestamp="true" ignoreerrors="true" src="http://www.apache.org/dist/java-repository//axis/jars/axis-jaxrpc-1.2-RC2.jar">
+ </get>
+ <get dest="${libdir}/commons-discovery-0.2.jar" usetimestamp="true" ignoreerrors="true" src="http://www.apache.org/dist/java-repository//commons-discovery/jars/commons-discovery-0.2.jar">
+ </get>
+ <get dest="${libdir}/commons-httpclient-2.0.2.jar" usetimestamp="true" ignoreerrors="true" src="http://www.apache.org/dist/java-repository//commons-httpclient/jars/commons-httpclient-2.0.2.jar">
+ </get>
+ <get dest="${libdir}/commons-lang-2.0.jar" usetimestamp="true" ignoreerrors="true" src="http://www.apache.org/dist/java-repository//commons-lang/jars/commons-lang-2.0.jar">
+ </get>
+ <get dest="${libdir}/commons-logging-1.0.4.jar" usetimestamp="true" ignoreerrors="true" src="http://www.apache.org/dist/java-repository//commons-logging/jars/commons-logging-1.0.4.jar">
+ </get>
+ <get dest="${libdir}/concurrent-1.3.4.jar" usetimestamp="true" ignoreerrors="true" src="http://www.apache.org/dist/java-repository//concurrent/jars/concurrent-1.3.4.jar">
+ </get>
+ <get dest="${libdir}/wsfx-xmlbeans-SNAPSHOT.jar" usetimestamp="true" ignoreerrors="true" src="http://www.apache.org/dist/java-repository//ws-fx/jars/wsfx-xmlbeans-SNAPSHOT.jar">
+ </get>
+ <get dest="${libdir}/wsfx-axis-types-SNAPSHOT.jar" usetimestamp="true" ignoreerrors="true" src="http://www.apache.org/dist/java-repository//ws-fx/jars/wsfx-axis-types-SNAPSHOT.jar">
+ </get>
+ <get dest="${libdir}/jaxen-1.1-beta-4.jar" usetimestamp="true" ignoreerrors="true" src="http://www.apache.org/dist/java-repository//jaxen/jars/jaxen-1.1-beta-4.jar">
+ </get>
+ <get dest="${libdir}/log4j-1.2.8.jar" usetimestamp="true" ignoreerrors="true" src="http://www.apache.org/dist/java-repository//log4j/jars/log4j-1.2.8.jar">
+ </get>
+ <get dest="${libdir}/servletapi-2.3.jar" usetimestamp="true" ignoreerrors="true" src="http://www.apache.org/dist/java-repository//servletapi/jars/servletapi-2.3.jar">
+ </get>
+ <get dest="${libdir}/wsdl4j-1.5-SNAPSHOT.jar" usetimestamp="true" ignoreerrors="true" src="http://www.apache.org/dist/java-repository//wsdl4j/jars/wsdl4j-1.5-SNAPSHOT.jar">
+ </get>
+ <get dest="${libdir}/xalan-2.4.1.jar" usetimestamp="true" ignoreerrors="true" src="http://www.apache.org/dist/java-repository//xalan/jars/xalan-2.4.1.jar">
+ </get>
+ <get dest="${libdir}/xbean-v1HEAD-SNAPSHOT-20041129.jar" usetimestamp="true" ignoreerrors="true" src="http://www.apache.org/dist/java-repository//xmlbeans/jars/xbean-v1HEAD-SNAPSHOT-20041129.jar">
+ </get>
+ <get dest="${libdir}/xbean_xpath-v1HEAD-SNAPSHOT-20041129.jar" usetimestamp="true" ignoreerrors="true" src="http://www.apache.org/dist/java-repository//xmlbeans/jars/xbean_xpath-v1HEAD-SNAPSHOT-20041129.jar">
+ </get>
+ <get dest="${libdir}/incubating-muse-0.5-SNAPSHOT.jar" usetimestamp="true" ignoreerrors="true" src="http://www.apache.org/dist/java-repository//muse/jars/incubating-muse-0.5-SNAPSHOT.jar">
+ </get>
+ <get dest="${libdir}/junit-3.8.1.jar" usetimestamp="true" ignoreerrors="true" src="http://www.apache.org/dist/java-repository//junit/jars/junit-3.8.1.jar">
+ </get>
+ <get dest="${libdir}/ant-1.5.jar" usetimestamp="true" ignoreerrors="true" src="http://www.apache.org/dist/java-repository//ant/jars/ant-1.5.jar">
+ </get>
+ <get dest="${libdir}/ant-optional-1.5.jar" usetimestamp="true" ignoreerrors="true" src="http://www.apache.org/dist/java-repository//ant/jars/ant-optional-1.5.jar">
+ </get>
+ </target>
+ <target name="install-maven">
+ <get dest="${user.home}/maven-install-latest.jar" usetimestamp="true" src="${repo}/maven/maven-install-latest.jar">
+ </get>
+ <unjar dest="${maven.home}" src="${user.home}/maven-install-latest.jar">
+ </unjar>
+ </target>
+</project>
\ No newline at end of file
Added: webservices/muse/trunk/src/examples/client/target/wsdmclient-1.0/src/wsdmclient-1.0/maven.xml
URL: http://svn.apache.org/viewcvs/webservices/muse/trunk/src/examples/client/target/wsdmclient-1.0/src/wsdmclient-1.0/maven.xml?rev=232376&view=auto
==============================================================================
--- webservices/muse/trunk/src/examples/client/target/wsdmclient-1.0/src/wsdmclient-1.0/maven.xml (added)
+++ webservices/muse/trunk/src/examples/client/target/wsdmclient-1.0/src/wsdmclient-1.0/maven.xml Fri Aug 12 13:38:04 2005
@@ -0,0 +1,47 @@
+<?xml version="1.0"?>
+
+<!--
+ For the definitions of Jelly tags, see these as reference
+ * http://jakarta.apache.org/commons/jelly/libs/
+ * http://jakarta.apache.org/commons/jelly/tags.html
+-->
+
+<project default="java:compile"
+ xmlns:j="jelly:core"
+ xmlns:util="jelly:util"
+ xmlns:maven="jelly:maven">
+
+ <!-- ================================================================== -->
+ <!-- CC : C H E C K O U T G O A L -->
+ <!-- ================================================================== -->
+ <!-- Checkout project from CVS. -->
+ <!-- Used by cruisecontrol. -->
+ <!-- ================================================================== -->
+ <goal name="cc:checkout">
+ <mkdir dir="${maven.build.dir}/test-reports"/>
+ <property environment="env" />
+ <!-- property file="${basedir}/internal-build.properties" / -->
+ <cvs command="update -d -P -C"
+ cvsRoot=":pserver:${env.CVS_USR}:${env.CVS_PWD}@${env.CVS_TUNNEL}:/cvs"
+ dest="."
+ quiet="no"
+ />
+ </goal>
+
+ <postGoal name="dist:prepare-bin-filesystem">
+ <attainGoal name="copy.dep" />
+ </postGoal>
+
+ <goal name="copy.dep" description="copy dependencies">
+ <j:forEach var="dep" items="${pom.dependencies}">
+ <copy file="${pom.getDependencyPath(dep.getId())}"
+ todir="${maven.build.dir}/${maven.final.name}/bin/${maven.final.name}/lib"/>
+ </j:forEach>
+ <copy todir="${maven.build.dir}/${maven.final.name}/bin/${maven.final.name}">
+ <fileset dir="bin" />
+ </copy>
+
+ </goal>
+
+</project>
+
\ No newline at end of file
Added: webservices/muse/trunk/src/examples/client/target/wsdmclient-1.0/src/wsdmclient-1.0/project.properties
URL: http://svn.apache.org/viewcvs/webservices/muse/trunk/src/examples/client/target/wsdmclient-1.0/src/wsdmclient-1.0/project.properties?rev=232376&view=auto
==============================================================================
--- webservices/muse/trunk/src/examples/client/target/wsdmclient-1.0/src/wsdmclient-1.0/project.properties (added)
+++ webservices/muse/trunk/src/examples/client/target/wsdmclient-1.0/src/wsdmclient-1.0/project.properties Fri Aug 12 13:38:04 2005
@@ -0,0 +1,65 @@
+# -----------------------------------------------------------------------------
+# Default properties for the Maven build. You can override these properties
+# either by defining a build.properties file with the overriden properties
+# or by passing them on the command line as system parameters (-D).
+# -----------------------------------------------------------------------------
+
+# MAVEN CORE
+##############
+# URL of JAR repository
+maven.repo.remote = http://www.apache.org/dist/java-repository/, http://cvs.apache.org/repository/, http://mirrors.sunsite.dk/maven/
+
+#http://cvs.apache.org/repository/muse/jars/incubating-muse-0.5-SNAPSHOT.jar
+
+#maven.repo.remote = http://mip.esr.hp.com/wsdm/repository,http://www.ibiblio.org/maven,http://maven-plugins.sourceforge.net/maven
+maven.jar.mainclass = WsdmSwingExplorer
+#maven.jar.manifest.classpath.add = true
+#maven.jar.manifest=${basedir}/manifest.mf
+maven.jar.manifest.classpath.add=true
+maven.jar.classpath.prefix=lib/
+jar.manifest.classpath=true
+
+# JAVA PLUGIN
+##############
+maven.compile.target = 1.4
+
+# TEST PLUGIN
+##############
+maven.junit.sysproperties = log4j.configuration
+log4j.configuration = test-log4j.properties
+maven.junit.fork = on
+
+# WAR PLUGIN
+##############
+# Target dir for our webapp
+maven.war.build.dir = ${maven.build.dir}
+maven.war.webapp.dir = ${maven.war.build.dir}/wsdm
+
+# JALOPY PLUGIN
+#################
+# Jalopy code style configuration file
+maven.jalopy.style = jalopy-config.xml
+
+# XDOC PLUGIN
+###############
+# Display project version and date on web site
+maven.xdoc.date = left
+maven.xdoc.version = ${pom.currentVersion}
+
+# setting distribution URL enables generation of download report
+maven.xdoc.distributionUrl = http://mip.esr.hp.com/wsdm/muse/dist/
+
+# CHANGES PLUGIN
+##################
+# For the changes plugin to link issue with Issuezilla
+maven.changes.issue.template = %URL%/issues/show_bug.cgi?id=%ISSUE%
+
+# MAVEN.XML GOALS
+#################
+wsnt.submgr.wsdl.file = ${maven.src.dir}/../wsdl/subscription-manager.wsdl
+registry.wsdl.file = ${maven.src.dir}/../wsdl/registry.wsdl
+
+src.config.wsdd = ${maven.src.dir}/../webapp/WEB-INF/server-config.wsdd
+target.config.wsdd = ${maven.build.dir}/server-config.wsdd
+
+muse.disk.wsdl = ${basedir}/examples/disk/src/wsdl/disk.wsdl
Added: webservices/muse/trunk/src/examples/client/target/wsdmclient-1.0/src/wsdmclient-1.0/project.xml
URL: http://svn.apache.org/viewcvs/webservices/muse/trunk/src/examples/client/target/wsdmclient-1.0/src/wsdmclient-1.0/project.xml?rev=232376&view=auto
==============================================================================
--- webservices/muse/trunk/src/examples/client/target/wsdmclient-1.0/src/wsdmclient-1.0/project.xml (added)
+++ webservices/muse/trunk/src/examples/client/target/wsdmclient-1.0/src/wsdmclient-1.0/project.xml Fri Aug 12 13:38:04 2005
@@ -0,0 +1,330 @@
+<project>
+ <pomVersion>3</pomVersion>
+ <artifactId>wsdmclient</artifactId>
+ <name>wsdmclient</name>
+ <groupId>wsdmclient</groupId>
+ <currentVersion>1.0</currentVersion>
+ <organization>
+ <name>Apache</name>
+ <url>http://www.apache.org</url>
+ </organization>
+ <inceptionYear>2004</inceptionYear>
+ <package>org.apache.ws</package>
+ <logo>/images/logo.gif</logo>
+ <shortDescription>A client library for WSDM.</shortDescription>
+ <url>http://incubator.apache.org/muse</url>
+ <issueTrackingUrl>https://ws-rp.hpsen.com/servlets/ProjectIssues</issueTrackingUrl>
+
+ <mailingLists>
+ <mailingList>
+ <name>${pom.name} Dev List</name>
+ </mailingList>
+ <mailingList>
+ <name>${pom.name} User List</name>
+ </mailingList>
+ </mailingLists>
+ <developers>
+ <developer>
+ <name>William Reichardt</name>
+ <id>0</id>
+ <email>william.reichardt@hp.com</email>
+ <organization>HP</organization>
+ <roles>
+ <role>Developer</role>
+ </roles>
+ <timezone>-5</timezone>
+ </developer>
+ </developers>
+ <dependencies>
+ <dependency>
+ <groupId>muse</groupId>
+ <artifactId>muse-disk-types</artifactId>
+ <version>SNAPSHOT</version>
+ <url>http://incubator.apache.org/muse/</url>
+ <properties>
+ <license>ApacheLicense-2.0.txt</license>
+ <war.bundle>true</war.bundle>
+ <usage>Needed for Unit Tests. This "could" be eliminated and generated on the fly, but it would make the builds longer.</usage>
+ </properties>
+ </dependency>
+
+ <dependency>
+ <groupId>addressing</groupId>
+ <artifactId>addressing</artifactId>
+ <version>SNAPSHOT</version>
+ <url>http://ws.apache.org/ws-fx/addressing/</url>
+ <properties>
+ <license>ApacheLicense-2.0.txt</license>
+ <war.bundle>true</war.bundle>
+ <usage>Provides support for WS-Addressing</usage>
+ </properties>
+ </dependency>
+
+ <dependency>
+ <groupId>ant</groupId>
+ <artifactId>ant</artifactId>
+ <version>1.6.2</version>
+ <url>http://ant.apache.org/</url>
+ <properties>
+
+ <war.bundle>true</war.bundle>
+ </properties>
+ </dependency>
+
+ <dependency>
+ <groupId>axis</groupId>
+ <artifactId>axis</artifactId>
+ <version>1.2-RC2</version>
+ <url>http://ws.apache.org/axis/</url>
+ <properties>
+ <license>ApacheLicense-2.0.txt</license>
+ <war.bundle>true</war.bundle>
+ <usage>Needed for compiling Axis-specific impls in our codebase. It is also needed for unit tests, etc.</usage>
+ </properties>
+ </dependency>
+
+ <dependency>
+ <groupId>axis</groupId>
+ <artifactId>axis-saaj</artifactId>
+ <version>1.2-RC2</version>
+ <url>http://ws.apache.org/axis/</url>
+ <properties>
+ <license>BinaryCodeLicense-SaajApi.txt</license>
+ <war.bundle>true</war.bundle>
+ <usage>Needed for building classes that reference SAAJ APIs.</usage>
+ </properties>
+ </dependency>
+
+ <dependency>
+ <groupId>axis</groupId>
+ <artifactId>axis-jaxrpc</artifactId>
+ <version>1.2-RC2</version>
+ <url>http://ws.apache.org/axis/</url>
+ <properties>
+ <license>BinaryCodeLicense-JaxRpcApi.txt</license>
+ <war.bundle>true</war.bundle>
+ <usage>Needed for building classes that reference JAX-RPC APIs.</usage>
+ </properties>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-discovery</groupId>
+ <artifactId>commons-discovery</artifactId>
+ <version>0.2</version>
+ <url>http://jakarta.apache.org/commons/discovery/</url>
+ <properties>
+ <license>ApacheLicense-2.0.txt</license>
+ <war.bundle>true</war.bundle>
+ <license>ApacheLicense-2.0.txt</license>
+ </properties>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-httpclient</groupId>
+ <artifactId>commons-httpclient</artifactId>
+ <version>2.0.2</version>
+ <url>http://jakarta.apache.org/commons/httpclient/</url>
+ <properties>
+ <license>ApacheLicense-2.0.txt</license>
+ <war.bundle>true</war.bundle>
+ <usage>Needed for sending HTTP requests, i.e. Notifications.</usage>
+ </properties>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-lang</groupId>
+ <artifactId>commons-lang</artifactId>
+ <version>2.0</version>
+ <url>http://jakarta.apache.org/commons/lang/</url>
+ <properties>
+ <license>ApacheLicense-2.0.txt</license>
+ <war.bundle>true</war.bundle>
+ <src.artifactId>commons-lang-src</src.artifactId>
+ <usage>Needed for utility classes like StringUtils, ExceptionUtils etc.</usage>
+ </properties>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ <version>1.0.4</version>
+ <url>http://jakarta.apache.org/commons/logging/</url>
+ <properties>
+ <license>ApacheLicense-2.0.txt</license>
+ <war.bundle>true</war.bundle>
+ <usage>Needed for logging purposes.</usage>
+ </properties>
+ </dependency>
+
+ <dependency>
+ <groupId>concurrent</groupId>
+ <artifactId>concurrent</artifactId>
+ <version>1.3.4</version>
+ <url>http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/intro.html</url>
+ <properties>
+ <license>DougLeaTechnologyLicense.txt</license>
+ <war.bundle>true</war.bundle>
+ <usage>Needed for threading.</usage>
+ </properties>
+ </dependency>
+
+
+ <!-- dependency>
+ <groupId>hewlett-packard</groupId>
+ <artifactId>muws</artifactId>
+ <version>SNAPSHOT</version>
+ <type>jar</type>
+ <url>https://ws-rp.hpsen.com/</url>
+ <properties>
+ <war.bundle>true</war.bundle>
+ </properties>
+ </dependency -->
+
+ <dependency>
+ <groupId>ws-fx</groupId>
+ <artifactId>wsfx-xmlbeans</artifactId>
+ <version>SNAPSHOT</version>
+ <url>http://ws.apache.org/ws-fx/</url>
+ <properties>
+ <license>ApacheLicense-2.0.txt</license>
+ <war.bundle>true</war.bundle>
+ <usage>Needed for handling requests. This contains the XmlBean types generated from the spec WSDLs. This "could" be eliminated and generated on the fly, but it would make the builds longer.</usage>
+ </properties>
+ </dependency>
+
+ <dependency>
+ <groupId>ws-fx</groupId>
+ <artifactId>wsfx-axis-types</artifactId>
+ <version>SNAPSHOT</version>
+ <url>http://ws.apache.org/ws-fx/</url>
+ <properties>
+ <license>ApacheLicense-2.0.txt</license>
+ <war.bundle>true</war.bundle>
+ <usage>Needed for handling Axis requests. This contains the Axis-generated code from the spec wsdls. This "could" be eliminated and generated on the fly, but it would make the builds longer.</usage>
+ </properties>
+ </dependency>
+
+ <dependency>
+ <groupId>jaxen</groupId>
+ <artifactId>jaxen</artifactId>
+ <version>1.1-beta-4</version>
+ <url>http://jaxen.org/</url>
+ <properties>
+ <license>WerkenPublicLicense-1.3.txt</license>
+ <war.bundle>true</war.bundle>
+ <usage>Needed for handling XPath queries with XmlBeans.</usage>
+ </properties>
+ </dependency>
+
+ <!-- dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>3.8.1</version>
+ <url>http://www.junit.org/</url>
+ <properties>
+ <license>CommonPublicLicense-1.0.txt</license>
+ <classloader>root</classloader>
+ <war.bundle>true</war.bundle>
+ <usage>Needed for running unit tests.</usage>
+ </properties>
+ </dependency -->
+
+ <dependency>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ <version>1.2.8</version>
+ <url>http://logging.apache.org/log4j/</url>
+ <properties>
+ <license>ApacheLicense-2.0.txt</license>
+ <war.bundle>true</war.bundle>
+ <usage>Needed (at runtime) for logging.</usage>
+ </properties>
+ </dependency>
+
+ <dependency>
+ <groupId>servletapi</groupId>
+ <artifactId>servletapi</artifactId>
+ <version>2.3</version>
+ <url>http://java.sun.com/products/servlet/</url>
+ <properties>
+ <license>BinaryCodeLicense-ServletApi.txt</license>
+ <war.bundle>false</war.bundle>
+ <usage>Needed to compile our servlet.</usage>
+ </properties>
+ </dependency>
+
+ <dependency>
+ <groupId>wsdl4j</groupId>
+ <artifactId>wsdl4j</artifactId>
+ <version>1.5-SNAPSHOT</version>
+ <url>http://www-124.ibm.com/developerworks/projects/wsdl4j/</url>
+ <properties>
+ <license>CommonPublicLicense-1.0.txt</license>
+ <war.bundle>true</war.bundle>
+ <usage>Needed for working with WSDL files as objects.</usage>
+ </properties>
+ </dependency>
+
+ <dependency>
+ <groupId>xalan</groupId>
+ <artifactId>xalan</artifactId>
+ <version>2.4.1</version>
+ <url>http://xml.apache.org/xalan-j/</url>
+ <properties>
+ <license>ApacheLicense-2.0.txt</license>
+ <war.bundle>true</war.bundle>
+ <usage>Needed for XSL and report generation.</usage>
+ </properties>
+ </dependency>
+
+ <dependency>
+ <groupId>xmlbeans</groupId>
+ <artifactId>xbean</artifactId>
+ <version>v1HEAD-SNAPSHOT-20041129</version>
+ <url>http://xmlbeans.apache.org/</url>
+ <properties>
+ <license>ApacheLicense-2.0.txt</license>
+ <war.bundle>true</war.bundle>
+ <usage>Needed for handling XML types in a platform agnostic way.</usage>
+ </properties>
+ </dependency>
+
+ <dependency>
+ <groupId>xmlbeans</groupId>
+ <artifactId>xbean_xpath</artifactId>
+ <version>v1HEAD-SNAPSHOT-20041129</version>
+ <url>http://xmlbeans.apache.org/</url>
+ <properties>
+ <license>ApacheLicense-2.0.txt</license>
+ <war.bundle>true</war.bundle>
+ <usage>XMLBeans - used throughout code base.</usage>
+ </properties>
+ </dependency>
+
+ <dependency>
+ <groupId>muse</groupId>
+ <artifactId>incubating-muse</artifactId>
+ <version>0.5-SNAPSHOT</version>
+ <url>http://incubator.apache.org/muse/</url>
+ <properties>
+ <license>ApacheLicense-2.0.txt</license>
+ <war.bundle>true</war.bundle>
+ <usage>Needed for building disk-types.jar and client.</usage>
+ </properties>
+ </dependency>
+
+ </dependencies>
+ <build>
+ <sourceDirectory>src/java</sourceDirectory>
+ <unitTestSourceDirectory>src/test</unitTestSourceDirectory>
+ <unitTest>
+ <includes>
+ <include>**/*TestCase.java</include>
+ </includes>
+ <excludes>
+ <exclude>**/Abstract*TestCase.java</exclude>
+ </excludes>
+ </unitTest>
+ </build>
+ <properties/>
+</project>
\ No newline at end of file
Added: webservices/muse/trunk/src/examples/client/target/wsdmclient-1.0/src/wsdmclient-1.0/src/java/WsdmExplorer.java
URL: http://svn.apache.org/viewcvs/webservices/muse/trunk/src/examples/client/target/wsdmclient-1.0/src/wsdmclient-1.0/src/java/WsdmExplorer.java?rev=232376&view=auto
==============================================================================
--- webservices/muse/trunk/src/examples/client/target/wsdmclient-1.0/src/wsdmclient-1.0/src/java/WsdmExplorer.java (added)
+++ webservices/muse/trunk/src/examples/client/target/wsdmclient-1.0/src/wsdmclient-1.0/src/java/WsdmExplorer.java Fri Aug 12 13:38:04 2005
@@ -0,0 +1,210 @@
+/*=============================================================================*
+ * Confidential Copyright (c) 2004 Hewlett-Packard Development Company, L.P. *
+ *=============================================================================*
+ * Created on Sep 16, 2004
+ *
+ * $RCSfile: WsdmExplorer.java,v $ $Revision: 1.4 $
+ * $Author: scamp $ $Date: 2004/11/12 21:11:48 $
+ * Branch or Tag : $Name: $
+ *
+ * ______________Recent Changes_______________________________
+ *
+ */
+import java.io.IOException;
+
+import javax.wsdl.WSDLException;
+
+import org.apache.xmlbeans.XmlObject;
+import org.apache.xmlbeans.XmlOptions;
+
+import org.apache.ws.client.model.WsdmClient;
+import org.apache.ws.client.model.WsdmClientFactory;
+import org.apache.ws.client.model.WsdmInstance;
+import org.apache.ws.client.model.WsdmResource;
+
+/**
+ * @author wire
+ *
+ */
+public class WsdmExplorer {
+ private String m_serverInfo;
+ private String m_hostname;
+ private String m_servletContext;
+ private String m_resource;
+ private String m_resourceId;
+ private Object m_propertyQName;
+
+ /**
+ * Constructor for ls
+ * @param string
+ * @param string2
+ */
+ public WsdmExplorer(String serverInfo) {
+ this(serverInfo,"","","");
+ }
+
+ /**
+ * Constructor for get.
+ * @param serverInfo
+ * @param resource
+ * @param resource id
+ */
+ public WsdmExplorer(String serverInfo, String resource, String resourceId) {
+ this(serverInfo,resource,resourceId,"");
+
+ }
+
+ /**
+ * Main constructor and also used to get a single property value.
+ * @param serverInfo
+ * @param resource name
+ * @param resource id
+ * @param QName of resource
+ */
+ public WsdmExplorer(String serverInfo, String resource, String resourceId,
+ String propertyQName) {
+ m_serverInfo=serverInfo;
+ m_resource=resource;
+ m_resourceId=resourceId;
+ m_propertyQName=propertyQName;
+ parseServerInfo();
+ }
+
+
+
+ /**
+ * Breaks out serverinfo into hostname and servlet context.
+ */
+ private void parseServerInfo() {
+ String[] serverInfoParts = m_serverInfo.split("/");
+ if(serverInfoParts.length==1){
+ m_servletContext="axis";
+ m_hostname=m_serverInfo;
+ return;
+ }
+ if(serverInfoParts.length==2){
+ m_servletContext=serverInfoParts[1];
+ m_hostname=serverInfoParts[0];
+ return;
+ }
+ }
+
+ /**
+ * Command Line Request Client.
+ *
+ * Arguments. No Argument, help message.
+ *
+ * @param args
+ */
+ public static void main(String[] args) {
+ // If no args are provided, show help.
+ if (args.length == 0) {
+ ShowHelpMessage();
+ System.exit(0);
+ }
+
+ // ls Command
+ if (args.length == 2 || args[1].equals("ls")) {
+ WsdmExplorer client = new WsdmExplorer(args[0]);
+ try {
+ client.ls();
+ } catch (Exception e) {
+ System.err.println(e.getMessage());
+ }
+ System.exit(0);
+ }
+ WsdmExplorer client;
+ if (args.length > 2 || args[1].equals("get")) {
+ if(args.length==3)
+ client = new WsdmExplorer(args[0], args[2], null);
+ else
+ client = new WsdmExplorer(args[0], args[2], args[3]);
+ try {
+ client.get();
+ } catch (Exception e) {
+ System.err.println(e.getMessage());
+ }
+ System.exit(0);
+ }
+
+ if (args.length == 5 || args[1].equals("getvalue")) {
+ client = new WsdmExplorer(args[0], args[2], args[3],
+ args[4]);
+ try {
+ client.get();
+ } catch (Exception e) {
+ System.err.println(e.getMessage());
+ }
+ System.exit(0);
+ }
+
+ System.err.println("Unknown command.");
+ ShowHelpMessage();
+ System.exit(-1);
+ }
+
+ /**
+ *
+ */
+ private void get() throws Exception {
+
+ WsdmClient client=WsdmClientFactory.create(WsdmClientFactory.AXIS_CLIENT_TYPE,m_hostname,m_servletContext);
+ WsdmResource resource=client.getResource(m_resource);
+ WsdmInstance instance=resource.getInstance(m_resourceId);
+ String[] propnames = instance.getPropertyNames();
+ System.out.println("Properties of wsdm://"+m_resource+":"+m_resourceId+"@"+m_hostname+"/"+m_servletContext+"\n");
+ for (int index = 0; index < propnames.length; index++) {
+ String propName = propnames[index];
+ XmlObject value=instance.getPropertyValue(propName);
+ formatPropPrint(propName,value);
+ }
+ System.out.println("<------------------------------------>");
+
+ }
+
+ /**
+ * @param propName
+ * @param value
+ */
+ private void formatPropPrint(String propName, XmlObject value) {
+ System.out.println("<------------------------------------>");
+ System.out.println("Name: "+propName);
+ XmlOptions opts=new XmlOptions();
+ opts.setSaveOuter();
+ String xmlText=value.xmlText(opts);
+ System.out.println("Value: "+xmlText);
+
+ }
+
+ /**
+ * @throws IOException
+ * @throws WSDLException
+ *
+ */
+ private void ls() throws Exception {
+ WsdmClient client=WsdmClientFactory.create(WsdmClientFactory.AXIS_CLIENT_TYPE,m_hostname,m_servletContext);
+ System.out.println("Directory of server "+m_hostname+"\n");
+ WsdmResource[] resources = client.getResources();
+ for (int index = 0; index < resources.length; index++) {
+ WsdmResource resource = resources[index];
+ System.out.println(resource);
+ WsdmInstance[] instances = resource.getInstances();
+ for (int instanceIndex = 0; instanceIndex < instances.length; instanceIndex++) {
+ WsdmInstance instance = instances[instanceIndex];
+ System.out.println(" "+instance.getName());
+ }
+ }
+ }
+
+ public static void ShowHelpMessage() {
+ System.out.println("WsdmExplorer");
+ System.out.println("\nOptions:");
+ System.out
+ .println("<hostname:port/servletcontext> <command> <command_arguments>\n");
+ System.out.println(" Commands Are:");
+ System.out
+ .println(" ls - list all resources and instances on this server.");
+ System.out
+ .println(" get <resource_name> <resource_id> - dumps all properties and operations as a list.\n");
+ }
+}
\ No newline at end of file
Added: webservices/muse/trunk/src/examples/client/target/wsdmclient-1.0/src/wsdmclient-1.0/src/java/WsdmSwingExplorer.java
URL: http://svn.apache.org/viewcvs/webservices/muse/trunk/src/examples/client/target/wsdmclient-1.0/src/wsdmclient-1.0/src/java/WsdmSwingExplorer.java?rev=232376&view=auto
==============================================================================
--- webservices/muse/trunk/src/examples/client/target/wsdmclient-1.0/src/wsdmclient-1.0/src/java/WsdmSwingExplorer.java (added)
+++ webservices/muse/trunk/src/examples/client/target/wsdmclient-1.0/src/wsdmclient-1.0/src/java/WsdmSwingExplorer.java Fri Aug 12 13:38:04 2005
@@ -0,0 +1,255 @@
+/*=============================================================================*
+ * Confidential Copyright (c) 2004 Hewlett-Packard Development Company, L.P. *
+ *=============================================================================*
+ * Created on Sep 14, 2004
+ *
+ * $RCSfile: WsdmSwingExplorer.java,v $ $Revision: 1.3 $
+ * $Author: scamp $ $Date: 2004/11/12 21:11:48 $
+ * Branch or Tag : $Name: $
+ *
+ * ______________Recent Changes_______________________________
+ *
+ */
+import java.beans.PropertyChangeEvent;
+import java.io.IOException;
+import java.util.ArrayList;
+
+import javax.swing.JFrame;
+import javax.swing.tree.TreePath;
+import javax.wsdl.WSDLException;
+
+import org.apache.ws.client.model.impl.WsdmInstanceImpl;
+import org.apache.ws.client.model.impl.WsdmClientImpl;
+import org.apache.ws.client.model.swing.GetServerFrame;
+import org.apache.ws.client.model.swing.OperationsTableModel;
+import org.apache.ws.client.model.swing.PropertiesTableModel;
+import org.apache.ws.client.model.swing.WsdmTreeModel;
+
+/**
+ * @author wire
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+public class WsdmSwingExplorer extends JFrame {
+
+ /** Creates new form WsdmExplorer */
+ public WsdmSwingExplorer(String[] hostnames,String[] contexts) {
+ initComponents();
+ connectTreeModel(hostnames,contexts);
+ addPropTableListener();
+ setTitle("WSDM Explorer (Are U a-MUWS-ed");
+ }
+
+ /**
+ *
+ */
+ private void addOpTableListener() {
+ jTreeResources.addPropertyChangeListener(new java.beans.PropertyChangeListener() {
+ public void propertyChange(java.beans.PropertyChangeEvent evt) {
+ onOperationChanged(evt);
+ }
+ });
+ }
+
+ /**
+ * @param evt
+ */
+ protected void onOperationChanged(PropertyChangeEvent evt) {
+ if(evt.getPropertyName().equals("anchorSelectionPath")){
+ TreePath path=(TreePath)evt.getNewValue();
+ Object treeObject=path.getLastPathComponent();
+ if(treeObject instanceof WsdmInstanceImpl){
+ WsdmInstanceImpl wsdmInstance=(WsdmInstanceImpl)treeObject;
+ jTableProperties.setModel(new OperationsTableModel(wsdmInstance));
+ } else {
+ jTableOperations.setModel(new javax.swing.table.DefaultTableModel(
+ new Object [][] {
+ {null, null, null, null},
+ {null, null, null, null},
+ {null, null, null, null},
+ {null, null, null, null}
+ },
+ new String [] {
+ "Title 1", "Title 2", "Title 3", "Title 4"
+ }
+ ));
+ }
+ }
+
+ }
+
+ /**
+ *
+ */
+ private void addPropTableListener() {
+ jTreeResources.addPropertyChangeListener(new java.beans.PropertyChangeListener() {
+ public void propertyChange(java.beans.PropertyChangeEvent evt) {
+ onPropertyChanged(evt);
+ }
+ });
+ }
+
+ private void onPropertyChanged(java.beans.PropertyChangeEvent evt) {
+// System.out.println();
+ if(evt.getPropertyName().equals("anchorSelectionPath")){
+ TreePath path=(TreePath)evt.getNewValue();
+ Object treeObject=path.getLastPathComponent();
+ if(treeObject instanceof WsdmInstanceImpl){
+ WsdmInstanceImpl wsdmInstance=(WsdmInstanceImpl)treeObject;
+ jTableProperties.setModel(new PropertiesTableModel(wsdmInstance));
+ } else {
+ jTableProperties.setModel(new javax.swing.table.DefaultTableModel(
+ new Object [][] {
+ {null, null, null, null},
+ {null, null, null, null},
+ {null, null, null, null},
+ {null, null, null, null}
+ },
+ new String [] {
+ "Title 1", "Title 2", "Title 3", "Title 4"
+ }
+ ));
+ }
+ }
+ System.out.println(evt);
+ }
+
+ /**
+ *
+ */
+ private void connectTreeModel(String[] hostnames,String[] contexts) {
+ ArrayList servers=new ArrayList();
+ for (int index = 0; index < hostnames.length; index++) {
+ String hostname = hostnames[index];
+ String context = contexts[index];
+ try {
+ servers.add(new WsdmClientImpl(hostname,context));
+ } catch (WSDLException e) {
+ e.printStackTrace();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+ WsdmTreeModel model = new WsdmTreeModel((WsdmClientImpl[])servers.toArray(new WsdmClientImpl[0]));
+ jTreeResources.setModel(model);
+ }
+
+ /** This method is called from within the constructor to
+ * initialize the form.
+ * WARNING: Do NOT modify this code. The content of this method is
+ * always regenerated by the Form Editor.
+ */
+ private void initComponents() {
+ jSplitPaneLeftRight = new javax.swing.JSplitPane();
+ jSplitPaneRightTopBottom = new javax.swing.JSplitPane();
+ jPanelTopRight = new javax.swing.JPanel();
+ jTableProperties = new javax.swing.JTable();
+ jLabelProperties = new javax.swing.JLabel();
+ jPanelBottomRight = new javax.swing.JPanel();
+ jTableOperations = new javax.swing.JTable();
+ jLabelOperations = new javax.swing.JLabel();
+ jPanelLeft = new javax.swing.JPanel();
+ jTreeResources = new javax.swing.JTree();
+
+ setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
+ jSplitPaneLeftRight.setDividerLocation(300);
+ jSplitPaneRightTopBottom.setDividerLocation(150);
+ jSplitPaneRightTopBottom.setOrientation(javax.swing.JSplitPane.VERTICAL_SPLIT);
+ jSplitPaneRightTopBottom.setPreferredSize(new java.awt.Dimension(100, 207));
+ jPanelTopRight.setLayout(new java.awt.BorderLayout());
+
+ jPanelTopRight.setBorder(new javax.swing.border.BevelBorder(javax.swing.border.BevelBorder.RAISED));
+ jPanelTopRight.setPreferredSize(new java.awt.Dimension(100, 100));
+ jTableProperties.setModel(new javax.swing.table.DefaultTableModel(
+ new Object [][] {
+ {null, null, null, null},
+ {null, null, null, null},
+ {null, null, null, null},
+ {null, null, null, null}
+ },
+ new String [] {
+ "Title 1", "Title 2", "Title 3", "Title 4"
+ }
+ ));
+ jPanelTopRight.add(jTableProperties, java.awt.BorderLayout.CENTER);
+
+ jLabelProperties.setFont(new java.awt.Font("MS Sans Serif", 1, 11));
+ jLabelProperties.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
+ jLabelProperties.setText("Properties");
+ jPanelTopRight.add(jLabelProperties, java.awt.BorderLayout.NORTH);
+
+ jSplitPaneRightTopBottom.setLeftComponent(jPanelTopRight);
+
+ jPanelBottomRight.setLayout(new java.awt.BorderLayout());
+
+ jPanelBottomRight.setPreferredSize(new java.awt.Dimension(100, 100));
+ jTableOperations.setModel(new javax.swing.table.DefaultTableModel(
+ new Object [][] {
+ {null, null, null, null},
+ {null, null, null, null},
+ {null, null, null, null},
+ {null, null, null, null}
+ },
+ new String [] {
+ "Title 1", "Title 2", "Title 3", "Title 4"
+ }
+ ));
+ jPanelBottomRight.add(jTableOperations, java.awt.BorderLayout.CENTER);
+
+ jLabelOperations.setFont(new java.awt.Font("MS Sans Serif", 1, 11));
+ jLabelOperations.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
+ jLabelOperations.setText("Operations");
+ jLabelOperations.setBorder(new javax.swing.border.BevelBorder(javax.swing.border.BevelBorder.RAISED));
+ jPanelBottomRight.add(jLabelOperations, java.awt.BorderLayout.NORTH);
+
+ jSplitPaneRightTopBottom.setRightComponent(jPanelBottomRight);
+
+ jSplitPaneLeftRight.setRightComponent(jSplitPaneRightTopBottom);
+
+ jPanelLeft.setLayout(new java.awt.BorderLayout());
+
+ jPanelLeft.setPreferredSize(new java.awt.Dimension(400, 10));
+ jPanelLeft.add(jTreeResources, java.awt.BorderLayout.CENTER);
+
+ jSplitPaneLeftRight.setLeftComponent(jPanelLeft);
+
+ getContentPane().add(jSplitPaneLeftRight, java.awt.BorderLayout.CENTER);
+
+ pack();
+ }
+
+ /**
+ * @param args the command line arguments
+ */
+ public static void main(String args[]) {
+
+ GetServerFrame sn = new GetServerFrame();
+ sn.setModal(true);
+ sn.setVisible(true);
+ if(!sn.isProceed()){
+ System.exit(0);
+ }
+ final String hostname=sn.getHostname();
+ final String context=sn.getContext();
+ java.awt.EventQueue.invokeLater(new Runnable() {
+ public void run() {
+ new WsdmSwingExplorer(new String[]{hostname},new String[]{context}).setVisible(true);
+ }
+ });
+ }
+
+ // Variables declaration - do not modify
+ private javax.swing.JLabel jLabelOperations;
+ private javax.swing.JLabel jLabelProperties;
+ private javax.swing.JPanel jPanelBottomRight;
+ private javax.swing.JPanel jPanelLeft;
+ private javax.swing.JPanel jPanelTopRight;
+ private javax.swing.JSplitPane jSplitPaneLeftRight;
+ private javax.swing.JSplitPane jSplitPaneRightTopBottom;
+ private javax.swing.JTable jTableOperations;
+ private javax.swing.JTable jTableProperties;
+ private javax.swing.JTree jTreeResources;
+ // End of variables declaration
+
+}
Added: webservices/muse/trunk/src/examples/client/target/wsdmclient-1.0/src/wsdmclient-1.0/src/java/org/apache/ws/client/DynamicSchemaClassBuilder.java
URL: http://svn.apache.org/viewcvs/webservices/muse/trunk/src/examples/client/target/wsdmclient-1.0/src/wsdmclient-1.0/src/java/org/apache/ws/client/DynamicSchemaClassBuilder.java?rev=232376&view=auto
==============================================================================
--- webservices/muse/trunk/src/examples/client/target/wsdmclient-1.0/src/wsdmclient-1.0/src/java/org/apache/ws/client/DynamicSchemaClassBuilder.java (added)
+++ webservices/muse/trunk/src/examples/client/target/wsdmclient-1.0/src/wsdmclient-1.0/src/java/org/apache/ws/client/DynamicSchemaClassBuilder.java Fri Aug 12 13:38:04 2005
@@ -0,0 +1,578 @@
+/*=============================================================================*
+ * Confidential Copyright (c) 2004 Hewlett-Packard Development Company, L.P. *
+ *=============================================================================*/
+package org.apache.ws.client;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Properties;
+
+import javax.wsdl.Definition;
+import javax.wsdl.WSDLException;
+import javax.xml.namespace.QName;
+import javax.xml.soap.SOAPElement;
+
+import org.apache.xmlbeans.XmlObject;
+import org.apache.xmlbeans.impl.common.XmlErrorPrinter;
+import org.apache.xmlbeans.impl.tool.SchemaCompiler;
+
+import org.apache.commons.io.IoUtils;
+import org.apache.ws.MuseConstants;
+import org.apache.ws.platform.axis.wsdl.WsdmWsdl2Java;
+import org.apache.ws.util.XmlBeansUtils;
+import org.apache.ws.wsdl.WsdlUtils;
+
+/**
+ * This class takes a WSDL's schema and converts it into a set of XMLBeans.
+ * These XMLBeans can then be used to create requests and deliver responses to
+ * SOAP requests. The java classes generated must be loaded through this classes
+ * private class loader which is populated by XMLBean's schema compiler.
+ *
+ * @author wire
+ */
+public class DynamicSchemaClassBuilder
+{
+ /**
+ * The temp directory that will hold the classes generated by the builder.
+ */
+ static File m_tempDir;
+ static {
+ try {
+ buildTempDirs( );
+ } catch (IOException e) {
+ }
+ }
+
+ /**
+ * The directory that is the root for all generated classes.
+ */
+ static File m_classes;
+
+ /** DOCUMENT_ME */
+ static String[] m_reservedPropNames =
+ new String[]
+ {
+ "get_elementflags",
+ "get_default_attribute_text",
+ "get_default_element_text",
+ "getObjectValue",
+ "getStringValue",
+ "get_schema_type",
+ "get_attribute_type",
+ "get_element_type",
+ "get_element_ending_delimiters",
+ "get_attributeflags",
+ "get_attribute_field",
+ "get_store",
+ "getIntValue",
+ "getByteArrayValue",
+ "getQNameValue",
+ "getFloatValue",
+ "getDoubleValue",
+ "get_wscanon_text",
+ "getBooleanValue",
+ "getByteValue",
+ "getShortValue",
+ "getLongValue",
+ "getBigIntegerValue",
+ "getBigDecimalValue",
+ "getEnumValue",
+ "getCalendarValue",
+ "getDateValue",
+ "getGDateValue",
+ "getGDurationValue",
+ "getListValue",
+ "getClass"
+ };
+
+ /** DOCUMENT_ME */
+ static ArrayList m_reservedList;
+
+ /**
+ * The URL of the WSDL document who's schema we are building classes for.
+ */
+ URL m_wsdlURL;
+
+ /**
+ * The path to a local temp copy of the WSDL document in m_wsdl.
+ */
+ //File m_localWsdl;
+
+ /**
+ * The directory that contains generated source file for the schema
+ * compiler.
+ */
+ File m_src;
+
+ /**
+ * The classpath that the schema compiler should when it invokes javac.
+ */
+ String m_SchemaCompileClassPath;
+
+ /**
+ * Indicates if this class has already generated classes for this wsdl file.
+ */
+ boolean m_compiled = false;
+
+ /**
+ * The WSDL definition created by WSDL4J.
+ */
+ protected Definition m_definition;
+
+ /**
+ * The classloader to use to access classes created by the schema compiler.
+ */
+ ClassLoader m_xmlBeansClassLoader;
+
+ {
+ m_reservedList = new ArrayList( );
+ for ( int index = 0; index < m_reservedPropNames.length; index++ )
+ {
+ String string = m_reservedPropNames[index];
+ m_reservedList.add( string );
+ }
+ }
+
+ public DynamicSchemaClassBuilder(URL wsdlURL )
+ throws WSDLException,
+ IOException
+ {
+ this(null,wsdlURL);
+ }
+
+ /**
+ * Creates a new {@link DynamicSchemaClassBuilder} object.
+ *
+ * @param wsdlURL DOCUMENT_ME
+ *
+ * @throws WSDLException DOCUMENT_ME
+ * @throws IOException DOCUMENT_ME
+ */
+ public DynamicSchemaClassBuilder(String contextUrl, URL wsdlURL )
+ throws WSDLException,
+ IOException
+ {
+ m_wsdlURL = wsdlURL;
+
+ // Download a local copy for use by the schema compiler
+ //String wsdlUrlString = wsdlURL.toString( );
+
+ // Build a definition
+ //System.err.println("Attemted to load def for "+m_wsdlURL);
+ m_definition = WsdlUtils.loadWsdlDefinition(m_wsdlURL );
+
+
+// m_localWsdl =
+// WsdlUtils.writeWsdlToTempDir( wsdlUrlString.substring( wsdlUrlString.lastIndexOf( "/" ) + 1 ),
+// m_definition,
+// m_tempDir );
+// HashMap map1 = new HashMap();
+// HashMap map2=new HashMap();
+// WsdlUtils.iterateWsdlDefinitionImports(m_definition,m_tempDir,map1,map2);
+// System.err.println("Temp for Wsdl is "+m_localWsdl.getPath());
+// if ( !m_localWsdl.exists( ) )
+// {
+// throw new IOException( "Failed to wsdl in temp directory " + m_localWsdl.getPath( ) );
+// }
+
+ // Establish a src directory
+ m_src = new File( m_tempDir.getPath( ) + File.separator + "src" );
+ m_src.mkdir( );
+ if ( !m_src.exists( ) )
+ {
+ throw new IOException( "Failed to create the temp directory " + m_src.getPath( ) );
+ }
+
+ // Establish an XMLBeans classpath based on this VM's cp
+ m_SchemaCompileClassPath = getXMLBeansClasspathFromSystemPath( );
+
+ //set up the classloader for the resulting classes
+ m_xmlBeansClassLoader = getXmlBeanClassLoader( m_classes.getPath( ) );
+ }
+
+ /**
+ * Causes the class to invoke the schema compiler and create
+ * the classes which represent the schema objects.
+ * @throws FileNotFoundException
+ * @throws WSDLException
+ */
+ public void compile( )
+ throws IOException,
+ WSDLException
+ {
+ if ( m_compiled )
+ {
+ return;
+ }
+
+ compileWsdlSchema( WsdlUtils.getAllWsdlFiles( m_wsdlURL, m_tempDir, MuseConstants.WS_SPEC_NSURIS ) );
+ m_compiled = true;
+ }
+
+ /**
+ * Deletes all temp file resources associated with this WSDL. Will prevent
+ * this class from providing any new xmlbeans what have not already been loaded.
+ *
+ */
+ public static void dispose( )
+ {
+ IoUtils.deleteDir( m_tempDir );
+ try {
+ buildTempDirs();
+ } catch (IOException e) {
+ }
+ }
+
+ /**
+ * Builds the class name of the generated XmlBean off of the element's
+ * QName.
+ *
+ * @param resoucePropsDocElemQName
+ * @return
+ */
+ protected static String getElementXmlBeanClassName( QName resoucePropsDocElemQName )
+ throws NoClassDefFoundError
+ {
+ if ( resoucePropsDocElemQName == null )
+ {
+ throw new NoClassDefFoundError( "Could not figure out the name of the Resource Properties Document XML Bean class for document element "
+ + resoucePropsDocElemQName + "." );
+ }
+
+ String resourcePropertiesClassName = XmlBeansUtils.getElementXmlBeanClassName( resoucePropsDocElemQName );
+
+ if ( resourcePropertiesClassName == null )
+ {
+ throw new NoClassDefFoundError( "Could not figure out the name of the Resource Properties Document XML Bean class for document element "
+ + resoucePropsDocElemQName + "." );
+ }
+
+ return resourcePropertiesClassName;
+ }
+
+ /**
+ * Manufactures an instance of an XMLBean that is backed by an empty XML document.
+ * @param schemaElement
+ * @return an XMLObject that is a schema generated class for element.
+ * @throws ClassNotFoundException
+ * @throws SecurityException
+ * @throws NoSuchMethodException
+ * @throws IllegalArgumentException
+ * @throws IllegalAccessException
+ * @throws InvocationTargetException
+ */
+ public XmlObject getEmptyInstanceOfXMLBean( QName schemaElement )
+ throws ClassNotFoundException,
+ SecurityException,
+ NoSuchMethodException,
+ IllegalArgumentException,
+ IllegalAccessException,
+ InvocationTargetException
+ {
+ String className = getElementXmlBeanClassName( schemaElement );
+ if ( className != null )
+ {
+ String factoryName = className.substring( 0,
+ className.lastIndexOf( "." ) ) + "$Factory";
+ Class xmlBeanClass = m_xmlBeansClassLoader.loadClass( factoryName );
+ Method method = xmlBeanClass.getMethod( "newInstance", null );
+ XmlObject requestXmlObject = (XmlObject) method.invoke( xmlBeanClass, null );
+ return requestXmlObject;
+ }
+ else
+ {
+ throw new ClassNotFoundException( schemaElement.toString( ) + " does not have an equivalent class." );
+ }
+ }
+
+ /**
+ * Returns and XmlObject that is an XMLBeans schema based object that is populated
+ * by the soap element passed if they are compatible.
+ * @param schemaElement
+ * @param element
+ * @return an XMLObject that is a schema generated class for element.
+ * @throws ClassNotFoundException
+ * @throws SecurityException
+ * @throws NoSuchMethodException
+ * @throws IllegalArgumentException
+ * @throws IllegalAccessException
+ * @throws InvocationTargetException
+ */
+ protected XmlObject getInstanceOfXMLBean( QName schemaElement,
+ SOAPElement element )
+ throws ClassNotFoundException,
+ SecurityException,
+ NoSuchMethodException,
+ IllegalArgumentException,
+ IllegalAccessException,
+ InvocationTargetException
+ {
+ String className = getElementXmlBeanClassName( schemaElement );
+ if ( className != null )
+ {
+ String factoryName = className.substring( 0,
+ className.lastIndexOf( "." ) ) + "$Factory";
+ Class xmlBeanClass = m_xmlBeansClassLoader.loadClass( factoryName );
+ Method[] methods = xmlBeanClass.getMethods( );
+ Method methodNewInstance = xmlBeanClass.getMethod( "newInstance", null );
+
+ Method methodParse = xmlBeanClass.getMethod( "parse",
+ new Class[]
+ {
+ String.class
+ } );
+
+ XmlObject requestXmlObject =
+ (XmlObject) methodParse.invoke( xmlBeanClass,
+ new Object[]
+ {
+ element.toString( )
+ } );
+
+ // Convert the document to a bean by calling get className /wDocumentImpl
+ return requestXmlObject;
+ }
+ else
+ {
+ throw new ClassNotFoundException( schemaElement.toString( ) + " does not have an equivalent class." );
+ }
+ }
+
+ /**
+ * Given a class returns only the name without its containing packages.
+ * Good for buildiing method names from class names.
+ * @param aClass
+ * @return A string containing just the name of the class.
+ */
+ protected static String getNameFromClass( Class aClass )
+ {
+ String className = aClass.getName( );
+ String[] classparts = className.split( "\\." );
+ return classparts[classparts.length - 1];
+ }
+
+ /**
+ * Applies a simple set of rules to produce a list of properties to set on
+ * and XMLBeans based object.
+ * @param object
+ * @return a list of getters with the word get removed from them that are the "proeprties" of this object.
+ */
+ public static String[] getProperties( XmlObject object )
+ {
+ ArrayList ret = new ArrayList( );
+ Method[] methods = object.getClass( ).getMethods( );
+ for ( int index = 0; index < methods.length; index++ )
+ {
+ Method method = methods[index];
+ if ( method.getName( ).matches( "^get.+" ) )
+ {
+ if ( !( Modifier.isPrivate( method.getModifiers( ) )
+ || Modifier.isProtected( method.getModifiers( ) ) ) )
+ {
+ if ( !isReserved( method.getName( ) ) )
+ {
+ ret.add( method.getName( ).substring( 3 ) );
+ }
+ }
+ }
+ }
+
+ return (String[]) ret.toArray( new String[0] );
+ }
+
+// /**
+// */
+// public static String[] getOperations( XmlObject object )
+// {
+// ArrayList ret = new ArrayList( );
+// Method[] methods = object.getClass( ).getMethods( );
+// for ( int index = 0; index < methods.length; index++ )
+// {
+// Method method = methods[index];
+// if ( !(method.getName( ).matches( "^get.+" )||method.getName( ).matches( "^set.+" )) )
+// {
+// if ( !( Modifier.isPrivate( method.getModifiers( ) )
+// || Modifier.isProtected( method.getModifiers( ) ) ) )
+// {
+// if ( !isReserved( method.getName( ) ) )
+// {
+// ret.add( method.getName( ).substring( 3 ) );
+// }
+// }
+// }
+// }
+//
+// return (String[]) ret.toArray( new String[0] );
+// }
+
+ /**
+ * A utility to do preoprty setting via introspection.
+ * @param object
+ * @param propertyName
+ * @param value
+ * @throws SecurityException
+ * @throws NoSuchMethodException
+ * @throws IllegalArgumentException
+ * @throws IllegalAccessException
+ * @throws InvocationTargetException
+ */
+ public static void setProperty( XmlObject object,
+ String propertyName,
+ Object value )
+ throws SecurityException,
+ NoSuchMethodException,
+ IllegalArgumentException,
+ IllegalAccessException,
+ InvocationTargetException
+ {
+ Method methodGetter =
+ object.getClass( ).getMethod( "set" + propertyName,
+ new Class[]
+ {
+ value.getClass( )
+ } );
+ Object ret = methodGetter.invoke( object, null );
+ }
+
+ /**
+ * A utility used to call get<YourPropName> when you have an XML Object.
+ * Saves on repetitive introspection code.
+ * @param object
+ * @param propertyName
+ * @return
+ * @throws NoSuchMethodException
+ * @throws SecurityException
+ * @throws InvocationTargetException
+ * @throws IllegalAccessException
+ * @throws IllegalArgumentException
+ */
+ public static Object getProperty( XmlObject object,
+ String propertyName )
+ throws SecurityException,
+ NoSuchMethodException,
+ IllegalArgumentException,
+ IllegalAccessException,
+ InvocationTargetException
+ {
+ Method[] methods = object.getClass( ).getMethods( );
+ Method methodGetter = object.getClass( ).getMethod( "get" + propertyName,
+ new Class[] { } );
+ Object ret = methodGetter.invoke( object,
+ new Object[] { } );
+ return ret;
+ }
+
+ /**
+ * Uses the system classpath as the schema compiler classpath.
+ * Can be overridden to provide a different classpath source.
+ * @return
+ */
+ protected String getXMLBeansClasspathFromSystemPath( )
+ {
+ return m_classes+File.pathSeparator+System.getProperty( "java.class.path" );
+ }
+
+ private static boolean isReserved( String propName )
+ {
+ return m_reservedList.contains( propName );
+ }
+
+ /**
+ * Builds a classloader based on the classes output dir used by the XmlBeans
+ * SchemaCompiler. This ensures the classes written by the compiler will be
+ * loaded.
+ *
+ * @param classesPath
+ * @return @throws
+ * MalformedURLException
+ */
+ private static ClassLoader getXmlBeanClassLoader( String classesPath )
+ throws MalformedURLException
+ {
+ final URL classesURL = new File( classesPath ).toURL( );
+
+ return new URLClassLoader( new URL[]
+ {
+ classesURL
+ },
+ WsdmWsdl2Java.class.getClassLoader( ) );
+ }
+
+ /**
+ * Builds the temp dirs for writing files to the filesystem.
+ *
+ * @throws IOException
+ */
+ private static void buildTempDirs( )
+ throws IOException
+ {
+ String hashAsString =
+ DynamicSchemaClassBuilder.class.getName( ) + "@" + DynamicSchemaClassBuilder.class.hashCode( );
+
+ // Build the base temp dir
+ //m_tempDir = new File( System.getProperty( "java.io.tmpdir" ) + File.separator + hashAsString );
+ m_tempDir = new File( System.getProperty( "user.home" ) + File.separator + ".wsdmcache" );
+ //user.home
+ m_tempDir.mkdir( );
+ if ( !m_tempDir.exists( ) )
+ {
+ throw new IOException( "Failed to create the temp directory " + m_tempDir.getPath( ) );
+ }
+
+ m_classes = new File( m_tempDir.getPath( ) + File.separator + "classes" );
+ m_classes.mkdir( );
+ if ( !m_classes.exists( ) )
+ {
+ throw new IOException( "Failed to create the temp directory " + m_classes.getPath( ) );
+ }
+ }
+
+ /**
+ * Builds and compiles the Schema from the WSDL using XmlBeans
+ * SchemaCompiler
+ *
+ * @param wsdlFiles
+ */
+ private void compileWsdlSchema( File[] wsdlFiles )
+ {
+ System.out.println("Schema Compile Request:");
+ for (int index = 0; index < wsdlFiles.length; index++) {
+ File file = wsdlFiles[index];
+ System.out.println(file.getPath());
+ }
+ SchemaCompiler.Parameters sCompParams = new SchemaCompiler.Parameters( );
+ sCompParams.setSrcDir( m_src );
+ sCompParams.setClassesDir( m_classes );
+ sCompParams.setQuiet(true);
+ if ( m_SchemaCompileClassPath != null )
+ {
+ String[] cpparts = m_SchemaCompileClassPath.split( File.pathSeparator );
+ List cpList = new ArrayList( );
+
+ for ( int i = 0; i < cpparts.length; i++ )
+ {
+ cpList.add( new File( cpparts[i] ) );
+ }
+
+ File[] classpath = (File[]) cpList.toArray( new File[cpList.size( )] );
+
+ sCompParams.setClasspath( classpath );
+ }
+
+ sCompParams.setDownload( true );
+ sCompParams.setWsdlFiles( wsdlFiles );
+ sCompParams.setErrorListener( new XmlErrorPrinter( false, null ) );
+ Properties props = System.getProperties();
+ //sCompParams.setCompiler("C:\\java\\j2sdk1.4.2_05\\bin\\javac");
+ SchemaCompiler.compile( sCompParams );
+ }
+}
\ No newline at end of file
Added: webservices/muse/trunk/src/examples/client/target/wsdmclient-1.0/src/wsdmclient-1.0/src/java/org/apache/ws/client/DynamicSoapClient.java
URL: http://svn.apache.org/viewcvs/webservices/muse/trunk/src/examples/client/target/wsdmclient-1.0/src/wsdmclient-1.0/src/java/org/apache/ws/client/DynamicSoapClient.java?rev=232376&view=auto
==============================================================================
--- webservices/muse/trunk/src/examples/client/target/wsdmclient-1.0/src/wsdmclient-1.0/src/java/org/apache/ws/client/DynamicSoapClient.java (added)
+++ webservices/muse/trunk/src/examples/client/target/wsdmclient-1.0/src/wsdmclient-1.0/src/java/org/apache/ws/client/DynamicSoapClient.java Fri Aug 12 13:38:04 2005
@@ -0,0 +1,491 @@
+/*=============================================================================*
+ * Confidential Copyright (c) 2004 Hewlett-Packard Development Company, L.P. *
+ *=============================================================================*/
+package org.apache.ws.client;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import javax.wsdl.Binding;
+import javax.wsdl.Input;
+import javax.wsdl.Message;
+import javax.wsdl.Operation;
+import javax.wsdl.Part;
+import javax.wsdl.PortType;
+import javax.wsdl.WSDLException;
+import javax.xml.namespace.QName;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.soap.MessageFactory;
+import javax.xml.soap.SOAPBody;
+import javax.xml.soap.SOAPConnection;
+import javax.xml.soap.SOAPConnectionFactory;
+import javax.xml.soap.SOAPEnvelope;
+import javax.xml.soap.SOAPMessage;
+
+import org.apache.axis.message.addressing.AddressingHeaders;
+import org.apache.axis.message.addressing.ReferencePropertiesType;
+import org.apache.commons.xml.JaxpUtils;
+import org.apache.ws.client.util.BodyWrapper;
+import org.apache.ws.client.util.EnvelopeWrapper;
+import org.apache.xmlbeans.XmlCursor;
+import org.apache.xmlbeans.XmlObject;
+import org.apache.xmlbeans.XmlOptions;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+import com.ibm.wsdl.MessageImpl;
+
+/**
+ * A SOAP client that can make calls by generating complex types dynamically at
+ * run time using xmlbeans and WSDL schema.
+ *
+ * @author wire
+ */
+public class DynamicSoapClient extends DynamicSchemaClassBuilder {
+
+ protected URL m_targetURL;
+
+ /**
+ * @param wsdlURL
+ * @throws WSDLException
+ * @throws IOException
+ */
+ public DynamicSoapClient(URL wsdlURL, URL targetURL) throws WSDLException,
+ IOException {
+ super(wsdlURL);
+ m_targetURL = targetURL;
+ compile();
+ }
+
+ /**
+ * Returns a list of operations that can be called on this WSDL.
+ *
+ * @return A list off import javax.wsdl.Operation objects
+ */
+ public Operation[] getWsdlOperations() {
+ Map bindings = m_definition.getBindings();
+ Iterator iterator = bindings.values().iterator();
+ List ops = new ArrayList();
+
+ // Iterate though all bindings
+ while (iterator.hasNext()) {
+ Binding binding = (Binding) iterator.next();
+ PortType portType = binding.getPortType();
+ List operations = portType.getOperations();
+
+ // interate all operations in each binding
+ for (int i = 0; i < operations.size(); i++) {
+ Operation operation = (Operation) operations.get(i);
+ ops.add(operation);
+ }
+ }
+
+ return (Operation[])ops.toArray(new Operation[0]);
+
+ }
+
+
+ /**
+ * Searches operations for all the ops with this name.
+ * Returns an array because params of those ops may vary.
+ * @param name
+ * @return
+ */
+ public Operation[] findOperation(String name){
+
+ Operation[] ops=getWsdlOperations();
+ ArrayList ret=new ArrayList();
+ for (int index = 0; index < ops.length; index++) {
+ Operation operation = ops[index];
+ if(operation.getName().equals(name))
+ ret.add(operation);
+ }
+ return (Operation[])ret.toArray(new Operation[0]);
+ }
+
+ /**
+ * Given an operation, returns an array of Parameter names.
+ *
+ * @param op
+ * @return @throws
+ * ClassNotFoundException
+ * @throws InvocationTargetException
+ * @throws IllegalAccessException
+ * @throws NoSuchMethodException
+ * @throws IllegalArgumentException
+ * @throws SecurityException
+ */
+ public String[] getParameters(Operation op) throws SecurityException,
+ IllegalArgumentException, ClassNotFoundException,
+ NoSuchMethodException, IllegalAccessException,
+ InvocationTargetException {
+ Map bindings = m_definition.getBindings();
+ Iterator iterator = bindings.values().iterator();
+ List ops = new ArrayList();
+ ArrayList parameters = new ArrayList();
+
+ // Iterate though all bindings
+ while (iterator.hasNext()) {
+ Binding binding = (Binding) iterator.next();
+ PortType portType = binding.getPortType();
+ List operations = portType.getOperations();
+
+ // iterate all operations in each binding
+ for (int i = 0; i < operations.size(); i++) {
+ Operation operation = (Operation) operations.get(i);
+ if (op == operation) {
+ Input in = operation.getInput();
+ Message message = in.getMessage();
+ Map parts = message.getParts();
+ for (Iterator iter = parts.keySet().iterator(); iter
+ .hasNext();) {
+ Part part = (Part) parts.get(iter.next());
+ QName ElementName = part.getElementName();
+ getParamInfoFromBeanClassName(parameters, ElementName);
+ }
+ }
+ }
+ return (String[]) parameters.toArray(new String[0]);
+ }
+ return null;
+ }
+
+ /**
+ * @param parameters
+ * @param xmlBeanClassName
+ * @throws ClassNotFoundException
+ * @throws NoSuchMethodException
+ * @throws IllegalAccessException
+ * @throws InvocationTargetException
+ */
+ private void getParamInfoFromBeanClassName(ArrayList parameters,
+ QName schemaType) throws ClassNotFoundException,
+ NoSuchMethodException, IllegalAccessException,
+ InvocationTargetException {
+ XmlObject instance = getEmptyInstanceOfXMLBean(schemaType);
+ Class xmlBeanClass = instance.getClass();
+ String docObjMethodName = getMethodNameForDocumentImpl(xmlBeanClass);
+ Method docObjMethod = xmlBeanClass.getMethod(docObjMethodName, null);
+ Class returnType = docObjMethod.getReturnType();
+
+ Method[] methods = returnType.getDeclaredMethods();
+ for (int j = 0; j < methods.length; j++) {
+ Method method = methods[j];
+ String methType = method.getReturnType().getName();
+ if (method.getName().matches("^get.+")) {
+ String paramName = method.getName().replaceFirst("get", "");
+ parameters.add(paramName + "[" + methType + "]");
+
+ }
+ }
+ }
+
+ private String getMethodNameForDocumentImpl(Class ImplClass) {
+ String name = ImplClass.getName();
+ String[] nameParts = name.split("\\.");
+ String rootClassName = nameParts[nameParts.length - 1];
+ String rootNoImpl = rootClassName.replaceFirst("DocumentImpl", "");
+ return "get" + rootNoImpl;
+
+ }
+
+ public XmlObject[] execute(Operation operation, Map parameters)
+ throws Exception {
+ return execute(operation,parameters,null);
+ }
+
+ public XmlObject[] execute(Operation operation, Map parameters,String resourceID)
+ throws Exception {
+
+ // Use the operation to get the first part element name
+ Input input = operation.getInput();
+ String textRequest="";
+
+ if(operation.getInput().getMessage().getParts().size()>0){
+ QName element = getFirstPartElementQName(operation.getInput());
+ textRequest = createRequestHavingComplexTypeArgs(operation, parameters,element);
+ } else {
+ textRequest = createRequestHavingNativeOrNoArgs(operation, parameters);
+ }
+
+ EnvelopeWrapper returnedSoapElements = sendSoapRequest(m_targetURL, textRequest, resourceID);
+ BodyWrapper body = returnedSoapElements.getBodyWrapper();
+ return body.getBodyElements();
+ }
+
+ /**
+ * @param operation
+ * @param parameters
+ * @param element
+ * @return
+ * @throws SecurityException
+ * @throws IllegalArgumentException
+ * @throws NoSuchMethodException
+ * @throws IllegalAccessException
+ * @throws InvocationTargetException
+ * @throws ClassNotFoundException
+ */
+ private String createRequestHavingNativeOrNoArgs(Operation operation, Map parameters) throws SecurityException, IllegalArgumentException, ClassNotFoundException, NoSuchMethodException, IllegalAccessException, InvocationTargetException {
+
+ // It is quite likely that this type of request will show no parts
+ // Forced to use MessageImpl to get QName to create XML Bean
+ MessageImpl message = (MessageImpl)operation.getInput().getMessage();
+ QName elementName=message.getQName();
+ XmlObject requestDocument = null;
+ try {
+ requestDocument = getEmptyInstanceOfXMLBean(elementName);
+ } catch (ClassNotFoundException e){
+ // Build a no args request
+ return "<reqns:"+operation.getName()+" xmlns:reqns=\""+elementName.getNamespaceURI()+"\"/>";
+ }
+ if(parameters!=null){
+ // Using only the first and only parameter
+ // This may not be a valid assumtion
+ // Calling set(InsertRequestElementName) with the first passed parameter.
+ Iterator iter1 = parameters.keySet().iterator();
+ Object paramValue = parameters.get(iter1.next());
+ String requestBaseName=elementName.getLocalPart();
+ String nameOfAddNewOperation = "set" + requestBaseName;
+
+ // Debug
+ Method[] methods=requestDocument.getClass().getMethods();
+ Method setterForComplexType=null;
+ try {
+ setterForComplexType = requestDocument.getClass().getMethod(
+ nameOfAddNewOperation, new Class[]{paramValue.getClass()});
+ } catch(NoSuchMethodException e){
+
+ return createRequestHavingComplexTypeArgs(operation, parameters,elementName);
+ }
+ setterForComplexType.invoke(
+ requestDocument, new Object[]{paramValue});
+ }
+
+ XmlOptions opts = new XmlOptions();
+ opts.setSaveOuter();
+ String textRequest = ((XmlObject) requestDocument).xmlText(opts);
+ return textRequest;
+ }
+
+ /**
+ * @param operation
+ * @param parameters
+ * @param element
+ * @return
+ * @throws ClassNotFoundException
+ * @throws NoSuchMethodException
+ * @throws IllegalAccessException
+ * @throws InvocationTargetException
+ * @throws NoClassDefFoundError
+ */
+ private String createRequestHavingComplexTypeArgs(Operation operation, Map parameters,QName element) throws ClassNotFoundException, NoSuchMethodException, IllegalAccessException, InvocationTargetException, NoClassDefFoundError {
+ String textRequestParams;
+ String textRequest;
+
+
+ // Use the element to manufacture an request instance
+
+ XmlObject requestDocument = getEmptyInstanceOfXMLBean(element);
+
+ // extract the baseClassName for the XMLBean
+ String className = getElementXmlBeanClassName(element);
+ String[] classParts = className.split("\\.");
+ String requestBaseName = classParts[classParts.length - 1];
+
+ // Determine then AddNew+BaseClassName operation name the request object
+ String nameOfAddNewOperation = "addNew" + requestBaseName;
+
+ // Determine if addnew+BaseClassName method exists
+ Method[] methodsOfDocument = requestDocument.getClass().getMethods();
+ boolean addNewExists=false;
+ for (int i = 0; i < methodsOfDocument.length; i++) {
+ Method method = methodsOfDocument[i];
+ if(method.getName().equals(nameOfAddNewOperation)){
+ addNewExists=true;
+ break;
+ }
+ }
+
+ // If it does exist then this request has a body
+ // the return value of addnew is the request document
+ Object requestObject;
+ if(addNewExists) {
+ Method methodForAddNewOperation = requestDocument.getClass().getMethod(
+ nameOfAddNewOperation, null);
+ requestObject = methodForAddNewOperation.invoke(
+ requestDocument, null);
+
+
+ // Fill in the complex type with the parameters passed in
+ Iterator iter = parameters.keySet().iterator();
+ for (Iterator iterator = parameters.keySet().iterator(); iterator
+ .hasNext();) {
+ String paramName = (String) iterator.next();
+ String methodName = "set" + capitalize(paramName);
+ Object paramValue = parameters.get(paramName);
+
+ Class requestClass = requestObject.getClass();
+ Method setterMethod = null;
+
+ try{
+ setterMethod = requestClass.getMethod(methodName,
+ new Class[] { paramValue.getClass() });
+ } catch (Throwable e){
+ }
+
+ if(setterMethod==null){
+ Class[] interfaces = paramValue.getClass().getInterfaces();
+ for (int index = 0; index < interfaces.length; index++) {
+ Class interface1 = interfaces[index];
+ try{
+ setterMethod = requestClass.getMethod(methodName,
+ new Class[] { interface1 });
+ break;
+ } catch (Throwable e){
+ }
+
+ }
+ }
+ setterMethod.invoke(requestObject,
+ new Object[] { paramValue });
+ }
+
+ // Save request using forced Requestname to match operation (Sal wants this fixed)
+ XmlOptions opts = new XmlOptions();
+ opts.setSaveOuter();
+ XmlCursor cursor = requestDocument.newCursor();
+ StringBuffer buff= new StringBuffer();
+ cursor.toFirstChild();
+ cursor.toFirstChild();
+ buff.append(cursor.toString());
+ while(cursor.toNextSibling()){
+ buff.append(cursor.toString());
+ }
+ cursor.dispose();
+ textRequestParams=buff.toString();
+
+ // Build the enclosing node containing the operation
+ String opName=operation.getName();
+ String opNamespace=m_definition.getTargetNamespace();
+ textRequest="<oper:"+opName+" xmlns:oper=\""+opNamespace+"\" >"+textRequestParams+"</oper:"+opName+">";
+
+
+ } else {
+ // This will occur when the request is not a complex type
+ // an example of this is when the request is a QName such as GetResourcePropertiesReq
+
+ Iterator iter = parameters.keySet().iterator();
+ Object paramValue = parameters.get(iter.next());
+
+ nameOfAddNewOperation = "set" + requestBaseName;
+
+ Method setterForComplexType = requestDocument.getClass().getMethod(
+ nameOfAddNewOperation, new Class[]{paramValue.getClass()});
+ setterForComplexType.invoke(
+ requestDocument, new Object[]{paramValue});
+ requestObject = requestDocument;
+
+ XmlOptions opts = new XmlOptions();
+ opts.setSaveOuter();
+ //opts.setSaveInner();
+ textRequest = ((XmlObject) requestDocument).xmlText(opts);
+
+ }
+ return textRequest;
+ }
+
+ /**
+ * @param input
+ */
+ private QName getFirstPartElementQName(Input input) {
+ if (input.getMessage() == null) {
+ return null;
+ }
+ Map parts = input.getMessage().getParts();
+ if (parts == null)
+ return null;
+ Iterator iter = parts.keySet().iterator();
+ if (!iter.hasNext())
+ {
+ // Might have native parts
+ return null;
+ }
+ Object partName = iter.next();
+ Part part = (Part) parts.get(partName);
+ return part.getElementName();
+ }
+
+ protected static EnvelopeWrapper sendSoapRequest(URL endpointURL, String xmlText)
+ throws Exception {
+ return sendSoapRequest(endpointURL, xmlText,null);
+ }
+
+ protected static EnvelopeWrapper sendSoapRequest(URL endpointURL, String xmlText,String resourceID)
+ throws Exception {
+ SOAPMessage soapRequestMsg = MessageFactory.newInstance()
+ .createMessage();
+ SOAPEnvelope envelope = soapRequestMsg.getSOAPPart().getEnvelope();
+
+ // Add addressing headers
+ AddressingHeaders addHeader=new AddressingHeaders(envelope);
+ addHeader.setSetMustUnderstand(false);
+ addHeader.setAction(endpointURL.toString()+"/action");
+ // wire TODO Broken to build
+ //addHeader.setTo(new To(endpointURL.toString()));
+ if(!(resourceID==null||resourceID.equals("Singleton"))){
+ ReferencePropertiesType refProperty = new ReferencePropertiesType();
+// refProperty.append(makeResourceIdElement(resourceID),null);
+ refProperty.add(makeResourceIdElement(resourceID));
+ addHeader.setReferenceProperties(refProperty);
+ }
+ addHeader.toEnvelope(envelope,"http://schemas.xmlsoap.org/soap/actor/next");
+ SOAPBody body = envelope.getBody();
+ body.addDocument(JaxpUtils.toDocument(xmlText));
+ SOAPConnection soapConn = SOAPConnectionFactory.newInstance()
+ .createConnection();
+
+ SOAPMessage soapResponseMsg = soapConn.call(soapRequestMsg, endpointURL
+ .toString());
+ soapConn.close();
+ EnvelopeWrapper wrapper = new EnvelopeWrapper(soapResponseMsg);
+ return wrapper;
+
+
+ }
+
+ private static List toList(Iterator iter) {
+ List list = new ArrayList();
+
+ while (iter.hasNext()) {
+ list.add(iter.next());
+ }
+
+ return list;
+ }
+ private static String capitalize(String input){
+ String firstLetter=input.substring(0,1);
+ return firstLetter.toUpperCase()+input.substring(1);
+ }
+
+ private static Element makeResourceIdElement(String resourceId)
+ throws Exception {
+ String xmlText="<muse-wsa:ResourceID xmlns:muse-wsa=\"urn:proposedstandard.org/muse/addressing\">"+resourceId+"</muse-wsa:ResourceID>";
+ //<ns3:ResourceID SOAP-ENV:actor="http://schemas.xmlsoap.org/soap/actor/next" SOAP-ENV:mustUnderstand="0" xmlns:ns3="http://www.apache.org/props">1234</ns3:ResourceID>
+ DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+ dbf.setNamespaceAware(true);
+ DocumentBuilder builder = dbf.newDocumentBuilder();
+ ByteArrayInputStream bais = new ByteArrayInputStream(xmlText.getBytes());
+ Document d = builder.parse(bais);
+ Element xmlRoot = d.getDocumentElement();
+ return xmlRoot;
+}
+
+}
\ No newline at end of file
---------------------------------------------------------------------
To unsubscribe, e-mail: muse-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: muse-dev-help@ws.apache.org