diff options
869 files changed, 50688 insertions, 0 deletions
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/antdefs.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/antdefs.xml new file mode 100644 index 0000000000..3a7ad87548 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/antdefs.xml @@ -0,0 +1,590 @@ +<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<!--
+ This file is designed to be imported by build.xml files to provide
+ definitions for a default set of build targets. The build.xml file
+ can include additional definitions to configure the behavior of these
+ default targets. The build.xml file can also define any additional
+ targets that are needed by the project.
+
+ This build file has been tested with JDK 5 update 22 and JDK 6 update 7.
+
+ When invoking a build.xml file that imports this file, the following
+ environment variables must be set:
+ TUSCANY_HOME A directory containing the Tuscany SCA binary distribution.
+ This build file has been tested with Tuscany SCA version 1.6.
+ JUNIT_JAR The location of the JUnit jar file. This build file has
+ been tested with JUnit version 4.5.
+ JAXWS_HOME (only if using JDK 5) A directory containing the JAX-WS
+ reference implementation. This build file has been tested with
+ the JAX-WS RI version 2.1.7.
+
+ This file defines the following targets that can be used on the
+ ant command that invokes the build.xml file:
+ "compile" Compiles any Java source files that don't have an up-to-date
+ class file, and copies any files in or under the resource directory.
+ If the build.xml file contains a <path> element with the id
+ "compile-path", the contents of this path are added to the compiler's
+ classpath. Also invokes the following targets:
+ . "wsdljava" (defined in the build.xml file) if there are any
+ .wsdl files in or under the resource directory
+ . "idljava" (defined in the build.xml file) if there are any
+ .idl files in or under the resource directory
+ . "test" if there are any files in or under the src/test/java
+ directory
+ . "package" if all previous steps completed successfully
+ "test" Compiles any Java unit test files that don't have an
+ up-to-date class file, copies any test resources in or under the
+ src/test/resources directory, and runs the unit tests. If the
+ build.xml file contains a <path> element with the id "test-path",
+ the contents of this path are used for compiling and running the
+ unit tests. In addition, the "compile-path" setting (if specified)
+ is used for running unit tests. If the build.xml file defines the
+ "test-setup" property, the "testsetup" target in the build.xml
+ file is invoked after copying the test resources.
+ "package" Creates a jar file containing the compiled Java class
+ files (excluding unit test code) and any files in or under the
+ resource directory, unless the jar file is already up to date.
+ "clean" Deletes all the files produced by the build.
+
+ This file also defines the following targets for invocation by <antcall>
+ from the build.xml file:
+ "wsimport" Generates Java code from a WSDL file (unless the Java code
+ is already up to date) by running the wsimport command (on JDK 6)
+ or by calling the equivalent class in the JAX-WS RI (on JDK 5).
+ Requires the following parameters:
+ . <package> the Java package to use for generated code
+ . <wsdlfile> the filename of the WSDL file
+ . <javaclass> the filename of any Java class file that will be
+ generated by running this target on the WSDL file
+ "sdojavagen" Generates Java code from a WSDL file (unless the Java
+ code is already up to date) by running the SDO XSD2JavaGenerator.
+ Requires the same parameters as <wsimport>, plus the following:
+ . <prefix> the prefix string for naming the generated factory
+ "idlj" Generates Java code from a CORBA IDL file (unless the Java
+ code is already up to date) by running the JDK idlj command.
+ Requires the following parameters:
+ . <idljopts> the options to be used on this idlj command invocation
+ . <idlfile> the filename of the IDL file
+ . <javaclass> the filename of any Java class file that will be
+ generated by running this target for this IDL file
+ "add-implementation-web" Adds implementation.web support to the
+ installed Tuscany SCA binary distribution if not already there.
+
+ All other targets defined by this file (with names starting with "#")
+ are for internal use within this file and should not be used externally.
+-->
+
+<project name="antdefs">
+ <property environment="env"/>
+ <fail unless="env.TUSCANY_HOME">
+ Error: Please set the TUSCANY_HOME environment variable.
+ </fail>
+ <fail unless="env.JUNIT_JAR">
+ Error: Please set the JUNIT_JAR environment variable.
+ </fail>
+
+ <!-- check whether there are any WSDL files in or under the resource directory -->
+ <target name="#find-wsdlfiles">
+ <fileset id="#allwsdl" dir="src/main/resources">
+ <include name="**/*.wsdl"/>
+ </fileset>
+ <condition property="#wsdlfiles">
+ <and>
+ <available file="src/main/resources" type="dir"/>
+ <resourcecount refid="#allwsdl" when="greater" count="0"/>
+ </and>
+ </condition>
+ </target>
+
+ <!-- call the wsdljava target in the build.xml file if required -->
+ <target name="#call-wsdljava" depends="#find-wsdlfiles" if="#wsdlfiles">
+ <antcall target="wsdljava"/>
+ </target>
+
+ <!-- check whether the WSDL-generated Java code is already up to date -->
+ <target name="#wsdlcheck">
+ <condition property="#wsdl-uptodate">
+ <uptodate srcfile="src/main/resources/${wsdlfile}"
+ targetfile="target/classes/${javaclass}"/>
+ </condition>
+ </target>
+
+ <!-- run the wsimport command if required -->
+ <target name="wsimport" depends="#wsdlcheck" unless="#wsdl-uptodate">
+ <antcall target="#wsimport"/>
+ </target>
+
+ <!-- check whether the wsimport command is available in the JDK -->
+ <target name="#is-jdk-wsimport">
+ <condition property="#jdk-wsimport">
+ <or>
+ <available file="${java.home}/../bin/wsimport" type="file"/>
+ <available file="${java.home}/../bin/wsimport.exe" type="file"/>
+ </or>
+ </condition>
+ </target>
+
+ <!-- run the JDK wsimport command if available -->
+ <target name="#wsimport-jdk" if="#jdk-wsimport">
+ <mkdir dir="target/jaxws-source"/>
+ <exec executable="${java.home}/../bin/wsimport" dir="." failonerror="true">
+ <arg line="-keep -s ./target/jaxws-source -p ${package}
+ -d ./target/classes src/main/resources/${wsdlfile}"/>
+ </exec>
+ </target>
+
+ <!-- run the com.sun.tools.ws.WsImport class in jaxws-tools.jar if available -->
+ <target name="#wsimport-jaxws" unless="#jdk-wsimport">
+ <condition property="#jaxws-tools">
+ <available file="${env.JAXWS_HOME}/lib/jaxws-tools.jar" type="file"/>
+ </condition>
+ <fail unless="#jaxws-tools">
+ Error: Could not find wsimport executable or jaxws-tools.jar.
+ </fail>
+ <mkdir dir="target/jaxws-source"/>
+ <java classname="com.sun.tools.ws.WsImport" fork="true" dir="." failonerror="true">
+ <arg line="-keep -s ./target/jaxws-source -p ${package}
+ -d ./target/classes src/main/resources/${wsdlfile}"/>
+ <classpath location="${env.JAXWS_HOME}/lib/jaxws-tools.jar"/>
+ </java>
+ </target>
+
+ <!-- run the wsimport command in JDK 6 or use jaxws-tools.jar on JDK 5 -->
+ <target name="#wsimport" depends="#is-jdk-wsimport, #wsimport-jdk, #wsimport-jaxws"/>
+
+ <!-- run the SDO XSD2JavaGenerator if required, then compile the generated Java source -->
+ <target name="sdojavagen" depends="#wsdlcheck" unless="#wsdl-uptodate">
+ <mkdir dir="target/sdo-source"/>
+ <java classname="org.apache.tuscany.sdo.generate.XSD2JavaGenerator" fork="true" dir="." failonerror="true">
+ <arg value="-javaPackage"/>
+ <arg value="${package}"/>
+ <arg value="-prefix"/>
+ <arg value="${prefix}"/>
+ <arg value="-noNotification"/>
+ <arg value="-noContainment"/>
+ <arg value="-noUnsettable"/>
+ <arg value="-targetDirectory"/>
+ <arg value="target/sdo-source"/>
+ <arg value="src/main/resources/${wsdlfile}"/>
+ <classpath location="${env.TUSCANY_HOME}/lib/tuscany-sca-manifest.jar"/>
+ </java>
+ <javac destdir="target/classes" debug="true" source="1.5" target="1.5">
+ <src path="target/sdo-source"/>
+ <classpath location="${env.TUSCANY_HOME}/lib/tuscany-sca-manifest.jar"/>
+ </javac>
+ </target>
+
+ <!-- check whether there are any CORBA IDL files in or under the resource directory -->
+ <target name="#find-idlfiles">
+ <fileset id="#allidl" dir="src/main/resources">
+ <include name="**/*.idl"/>
+ </fileset>
+ <condition property="#idlfiles">
+ <and>
+ <available file="src/main/resources" type="dir"/>
+ <resourcecount refid="#allidl" when="greater" count="0"/>
+ </and>
+ </condition>
+ </target>
+
+ <!-- call the idljava target in the build.xml file if required -->
+ <target name="#call-idljava" depends="#find-idlfiles" if="#idlfiles">
+ <antcall target="idljava"/>
+ </target>
+
+ <!-- check whether the IDL-generated Java code is already up to date -->
+ <target name="#idlcheck">
+ <condition property="#idl-uptodate">
+ <uptodate srcfile="src/main/resources/${idlfile}"
+ targetfile="target/classes/${javaclass}"/>
+ </condition>
+ </target>
+
+ <!-- run the JDK idlj command if required, then compile the generated Java source -->
+ <target name="idlj" depends="#idlcheck" unless="#idl-uptodate">
+ <mkdir dir="target/idlj-source"/>
+ <exec executable="${java.home}/../bin/idlj" dir="." failonerror="true">
+ <arg value="${idljopts}"/>
+ <arg value="-td"/>
+ <arg value="target/idlj-source"/>
+ <arg value="src/main/resources/${idlfile}"/>
+ </exec>
+ <javac destdir="target/classes" debug="true" source="1.5" target="1.5">
+ <src path="target/idlj-source"/>
+ </javac>
+ </target>
+
+ <!-- check whether there are any Java source files to compile -->
+ <target name="#find-javafiles">
+ <fileset id="#alljava" dir="src/main/java">
+ <include name="**/*.java"/>
+ </fileset>
+ <condition property="#javafiles">
+ <and>
+ <available file="src/main/java" type="dir"/>
+ <resourcecount refid="#alljava" when="greater" count="0"/>
+ </and>
+ </condition>
+ </target>
+
+ <!-- compile the Java source files -->
+ <target name="#src-compile" depends="#find-javafiles" if="#javafiles">
+ <antcall target="#run-compile"/>
+ </target>
+
+ <!-- check whether a dependency path for the Java compiler was specified -->
+ <target name="#check-compile-path">
+ <condition property="#compile-path">
+ <isreference refid="compile-path"/>
+ </condition>
+ </target>
+
+ <!-- set classpath for Java compiler to include specified additional path -->
+ <target name="#set-compile-path" if="#compile-path">
+ <path id="#javac-classpath">
+ <path refid="compile-path"/>
+ </path>
+ </target>
+
+ <!-- set default classpath for Java compiler if no additional path specified -->
+ <target name="#default-compile-path" unless="#compile-path">
+ <path id="#javac-classpath"/>
+ </target>
+
+ <!-- set the Java compiler classpath -->
+ <target name="#set-javac-classpath" depends="#check-compile-path, #set-compile-path, #default-compile-path"/>
+
+ <!-- compile the Java source files -->
+ <target name="#run-compile" depends="#set-javac-classpath">
+ <javac destdir="target/classes" debug="true" source="1.5" target="1.5">
+ <src path="src/main/java"/>
+ <classpath>
+ <path refid="#javac-classpath"/>
+ <pathelement path="${env.TUSCANY_HOME}/lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </javac>
+ </target>
+
+ <!-- check whether there are any resources to copy -->
+ <target name="#find-resources">
+ <fileset id="#allresources" dir="src/main/resources"/>
+ <condition property="#resources">
+ <and>
+ <available file="src/main/resources" type="dir"/>
+ <resourcecount refid="#allresources" when="greater" count="0"/>
+ </and>
+ </condition>
+ </target>
+
+ <!-- copy the contents of the resource directory -->
+ <target name="#copy-resources" depends="#find-resources" if="#resources">
+ <copy todir="target/classes">
+ <fileset dir="src/main/resources"/>
+ </copy>
+ </target>
+
+ <!-- check whether there are any Java files in or under the test directory -->
+ <target name="#find-testjava">
+ <fileset id="#alltestjava" dir="src/test/java">
+ <include name="**/*.java"/>
+ </fileset>
+ <condition property="#testjava">
+ <and>
+ <available file="src/test/java" type="dir"/>
+ <resourcecount refid="#alltestjava" when="greater" count="0"/>
+ </and>
+ </condition>
+ </target>
+
+ <!-- call the test target if required -->
+ <target name="#call-test" depends="#find-testjava" if="#testjava">
+ <antcall target="test"/>
+ </target>
+
+ <!-- check whether there are any test resources to copy -->
+ <target name="#find-testresources">
+ <fileset id="#alltestresources" dir="src/test/resources"/>
+ <condition property="#testresources">
+ <and>
+ <available file="src/test/resources" type="dir"/>
+ <resourcecount refid="#alltestresources" when="greater" count="0"/>
+ </and>
+ </condition>
+ </target>
+
+ <!-- copy the test resources -->
+ <target name="#copy-testresources" depends="#find-testresources" if="#testresources">
+ <copy todir="target/test-classes">
+ <fileset dir="src/test/resources"/>
+ </copy>
+ </target>
+
+ <!-- perform additional test setup if required -->
+ <target name="#test-setup" if="test-setup">
+ <antcall target="testsetup"/>
+ </target>
+
+ <!-- check whether a dependency path for the unit tests was specified -->
+ <target name="#check-test-path">
+ <condition property="#test-path">
+ <isreference refid="test-path"/>
+ </condition>
+ </target>
+
+ <!-- set classpath for unit tests to include specified additional path -->
+ <target name="#set-test-path" if="#test-path">
+ <path id="#test-classpath">
+ <path refid="test-path"/>
+ </path>
+ </target>
+
+ <!-- set default classpath for unit tests if no additional path specified -->
+ <target name="#default-test-path" unless="#test-path">
+ <path id="#test-classpath"/>
+ </target>
+
+ <!-- set the Java compiler test classpath -->
+ <target name="#set-test-classpath" depends="#check-test-path, #set-test-path, #default-test-path"/>
+
+ <!-- compile the test classes -->
+ <target name="#test-compile" depends="#set-test-classpath">
+ <javac destdir="target/test-classes" debug="true" source="1.5" target="1.5">
+ <src path="src/test/java"/>
+ <classpath>
+ <pathelement location="target/classes"/>
+ <path refid="#test-classpath"/>
+ <pathelement location="${env.TUSCANY_HOME}/lib/tuscany-sca-manifest.jar"/>
+ <pathelement location="${env.JUNIT_JAR}"/>
+ </classpath>
+ </javac>
+ </target>
+
+ <!-- run the junit task -->
+ <target name="#run-junit" depends="#set-test-classpath, #set-javac-classpath">
+ <junit printsummary="no" dir="." fork="true" forkmode="once" haltonfailure="true">
+ <classpath>
+ <pathelement location="target/test-classes"/>
+ <path refid="#test-classpath"/>
+ <pathelement location="target/classes"/>
+ <path refid="#javac-classpath"/>
+ <pathelement location="${env.TUSCANY_HOME}/lib/tuscany-sca-manifest.jar"/>
+ <pathelement location="${env.JUNIT_JAR}"/>
+ </classpath>
+ <formatter type="plain" usefile="false"/>
+ <batchtest>
+ <fileset dir="src/test/java">
+ <include name="**/*TestCase.java"/>
+ </fileset>
+ </batchtest>
+ </junit>
+ </target>
+
+ <!-- check whether the Tuscany SCA version is 1.5.1 -->
+ <target name="#find-tuscany-1.5.1">
+ <fileset id="#tuscany-assembly-1.5.1" dir="${env.TUSCANY_HOME}/modules">
+ <include name="tuscany-assembly-1.5.1.jar"/>
+ </fileset>
+ <condition property="#tuscany-version" value="1.5.1">
+ <resourcecount refid="#tuscany-assembly-1.5.1" when="greater" count="0"/>
+ </condition>
+ <condition property="#tuscany-repo" value="m2-ibiblio-rsync-repository">
+ <resourcecount refid="#tuscany-assembly-1.5.1" when="greater" count="0"/>
+ </condition>
+ </target>
+
+ <!-- check whether the Tuscany SCA version is 1.6-SNAPSHOT -->
+ <target name="#find-tuscany-1.6-SNAPSHOT" unless="#tuscany-version">
+ <fileset id="#tuscany-assembly-1.6-SNAPSHOT" dir="${env.TUSCANY_HOME}/modules">
+ <include name="tuscany-assembly-1.6-SNAPSHOT.jar"/>
+ </fileset>
+ <condition property="#tuscany-version" value="1.6-SNAPSHOT">
+ <resourcecount refid="#tuscany-assembly-1.6-SNAPSHOT" when="greater" count="0"/>
+ </condition>
+ <condition property="#tuscany-baseversion" value="1.6">
+ <resourcecount refid="#tuscany-assembly-1.6-SNAPSHOT" when="greater" count="0"/>
+ </condition>
+ <condition property="#tuscany-repo" value="m2-snapshot-repository">
+ <resourcecount refid="#tuscany-assembly-1.6-SNAPSHOT" when="greater" count="0"/>
+ </condition>
+ </target>
+
+ <!-- check whether the Tuscany SCA version is 1.6 -->
+ <target name="#find-tuscany-1.6" unless="#tuscany-version">
+ <fileset id="#tuscany-assembly-1.6" dir="${env.TUSCANY_HOME}/modules">
+ <include name="tuscany-assembly-1.6.jar"/>
+ </fileset>
+ <condition property="#tuscany-version" value="1.6">
+ <resourcecount refid="#tuscany-assembly-1.6" when="greater" count="0"/>
+ </condition>
+ <condition property="#tuscany-repo" value="m2-ibiblio-rsync-repository">
+ <resourcecount refid="#tuscany-assembly-1.6" when="greater" count="0"/>
+ </condition>
+ </target>
+
+ <!-- check whether the Tuscany SCA version is 1.7-SNAPSHOT -->
+ <target name="#find-tuscany-1.7-SNAPSHOT" unless="#tuscany-version">
+ <fileset id="#tuscany-assembly-1.7-SNAPSHOT" dir="${env.TUSCANY_HOME}/modules">
+ <include name="tuscany-assembly-1.7-SNAPSHOT.jar"/>
+ </fileset>
+ <condition property="#tuscany-version" value="1.7-SNAPSHOT">
+ <resourcecount refid="#tuscany-assembly-1.7-SNAPSHOT" when="greater" count="0"/>
+ </condition>
+ <condition property="#tuscany-baseversion" value="1.7">
+ <resourcecount refid="#tuscany-assembly-1.7-SNAPSHOT" when="greater" count="0"/>
+ </condition>
+ <condition property="#tuscany-repo" value="m2-snapshot-repository">
+ <resourcecount refid="#tuscany-assembly-1.7-SNAPSHOT" when="greater" count="0"/>
+ </condition>
+ </target>
+
+ <!-- find the Tuscany SCA version that matches the JAVA_HOME environment variable -->
+ <target name="#find-tuscany-version" depends="#find-tuscany-1.5.1, #find-tuscany-1.6-SNAPSHOT,
+ #find-tuscany-1.6, #find-tuscany-1.7-SNAPSHOT">
+ <fail unless="#tuscany-version">
+ Error: Unknown Tuscany version for JAVA_HOME environment variable.
+ </fail>
+ </target>
+
+ <!-- check whether the installed Tuscany SCA binary distribution includes implementation.web support -->
+ <target name="#check-implementation-web">
+ <fileset id="#implweb-before-copy" dir="${env.TUSCANY_HOME}/modules">
+ <include name="tuscany-implementation-web-${#tuscany-version}.jar"/>
+ <include name="tuscany-implementation-web-runtime-${#tuscany-version}.jar"/>
+ </fileset>
+ <condition property="#has-implementation-web">
+ <resourcecount refid="#implweb-before-copy" when="equal" count="2"/>
+ </condition>
+ </target>
+
+ <!-- check whether the installed Tuscany SCA binary distribution is a snapshot -->
+ <target name="#check-tuscany-snapshot">
+ <condition property="#tuscany-snapshot">
+ <equals arg1="${#tuscany-repo}" arg2="m2-snapshot-repository"/>
+ </condition>
+ </target>
+
+ <!-- copy implementation.web support to the installed Tuscany SCA snapshot binary distribution -->
+ <target name="#copy-impl-web-snapshot" if="#tuscany-snapshot">
+ <xmlproperty>
+ <url url="http://people.apache.org/repo/${#tuscany-repo}/org/apache/tuscany/sca/tuscany-implementation-web/${#tuscany-version}/maven-metadata.xml"/>
+ </xmlproperty>
+ <copy todir="${env.TUSCANY_HOME}/modules" flatten="true">
+ <url url="http://people.apache.org/repo/${#tuscany-repo}/org/apache/tuscany/sca/tuscany-implementation-web/${#tuscany-version}/tuscany-implementation-web-${#tuscany-baseversion}-${metadata.versioning.snapshot.timestamp}-${metadata.versioning.snapshot.buildNumber}.jar"/>
+ <url url="http://people.apache.org/repo/${#tuscany-repo}/org/apache/tuscany/sca/tuscany-implementation-web-runtime/${#tuscany-version}/tuscany-implementation-web-runtime-${#tuscany-baseversion}-${metadata.versioning.snapshot.timestamp}-${metadata.versioning.snapshot.buildNumber}.jar"/>
+ </copy>
+ <!-- need to copy and move because of ant 1.7.1 bug when copying with tofile and url -->
+ <move file="${env.TUSCANY_HOME}/modules/tuscany-implementation-web-${#tuscany-baseversion}-${metadata.versioning.snapshot.timestamp}-${metadata.versioning.snapshot.buildNumber}.jar" tofile="${env.TUSCANY_HOME}/modules/tuscany-implementation-web-${#tuscany-version}.jar"/>
+ <move file="${env.TUSCANY_HOME}/modules/tuscany-implementation-web-runtime-${#tuscany-baseversion}-${metadata.versioning.snapshot.timestamp}-${metadata.versioning.snapshot.buildNumber}.jar" tofile="${env.TUSCANY_HOME}/modules/tuscany-implementation-web-runtime-${#tuscany-version}.jar"/>
+ </target>
+
+ <!-- copy implementation.web support to the installed Tuscany SCA non-snapshot binary distribution -->
+ <target name="#copy-impl-web-nonsnapshot" unless="#tuscany-snapshot">
+ <copy todir="${env.TUSCANY_HOME}/modules" flatten="true">
+ <url url="http://people.apache.org/repo/${#tuscany-repo}/org/apache/tuscany/sca/tuscany-implementation-web/${#tuscany-version}/tuscany-implementation-web-${#tuscany-version}.jar"/>
+ <url url="http://people.apache.org/repo/${#tuscany-repo}/org/apache/tuscany/sca/tuscany-implementation-web-runtime/${#tuscany-version}/tuscany-implementation-web-runtime-${#tuscany-version}.jar"/>
+ </copy>
+ </target>
+
+ <!-- copy implementation.web support to the installed Tuscany SCA binary distribution -->
+ <target name="#copy-implementation-web" depends="#check-tuscany-snapshot, #copy-impl-web-snapshot, #copy-impl-web-nonsnapshot"/>
+
+ <!-- add implementation.web support to the installed Tuscany SCA binary distribution if not already there -->
+ <target name="add-implementation-web" depends="#find-tuscany-version, #check-implementation-web" unless="#has-implementation-web">
+ <antcall target="#copy-implementation-web"/>
+ <fileset id="#implweb-after-copy" dir="${env.TUSCANY_HOME}/modules">
+ <include name="tuscany-implementation-web-${#tuscany-version}.jar"/>
+ <include name="tuscany-implementation-web-runtime-${#tuscany-version}.jar"/>
+ </fileset>
+ <condition property="#implementation-web-copied">
+ <resourcecount refid="#implweb-after-copy" when="equal" count="2"/>
+ </condition>
+ <fail unless="#implementation-web-copied">
+ Error: Unable to download tuscany-implementation-web and tuscany-implementation-web-runtime jars.
+ </fail>
+ </target>
+
+ <!-- check whether there are any files in the webapp directory -->
+ <target name="#check-webapp">
+ <fileset id="#webappfiles" dir="src/main/webapp"/>
+ <condition property="#webapp">
+ <and>
+ <available file="src/main/webapp" type="dir"/>
+ <resourcecount refid="#webappfiles" when="greater" count="0"/>
+ </and>
+ </condition>
+ </target>
+
+ <!-- build a war file if there are files in the webapp directory -->
+ <target name="#package-war" if="#webapp">
+ <mkdir dir="target/lib"/>
+ <antcall target="copy-lib"/>
+ <war destfile="target/${ant.project.name}.war" webxml="src/main/webapp/WEB-INF/web.xml"
+ excludes="**/*.cbp">
+ <fileset dir="src/main/webapp"/>
+ <lib dir="target/lib"/>
+ <classes dir="target/classes"/>
+ </war>
+ </target>
+
+ <!-- build a jar file if there are no files in the webapp directory -->
+ <target name="#package-jar" unless="#webapp">
+ <jar destfile="target/${ant.project.name}.jar" basedir="target/classes"
+ excludes="**/*.cbp"/>
+ </target>
+
+ <!-- build a packaged jar file or war file -->
+ <target name="#build-package" depends="#check-webapp, #package-war, #package-jar"/>
+
+ <!-- for external use on the ant command line -->
+ <target name="compile">
+ <echo message="Compiling project ${ant.project.name}"/>
+ <mkdir dir="target/classes"/>
+ <antcall target="#call-wsdljava"/>
+ <antcall target="#call-idljava"/>
+ <antcall target="#src-compile"/>
+ <antcall target="#copy-resources"/>
+ <antcall target="#call-test"/>
+ <antcall target="package"/>
+ </target>
+
+ <!-- for external use on the ant command line -->
+ <target name="test" depends="#find-testjava" if="#testjava">
+ <echo message="Testing project ${ant.project.name}"/>
+ <mkdir dir="target/test-classes"/>
+ <antcall target="#test-compile"/>
+ <antcall target="#copy-testresources"/>
+ <antcall target="#test-setup"/>
+ <antcall target="#run-junit"/>
+ </target>
+
+ <!-- for external use on the ant command line -->
+ <target name="package">
+ <echo message="Packaging project ${ant.project.name}"/>
+ <antcall target="#build-package"/>
+ </target>
+
+ <!-- for external use on the ant command line -->
+ <target name="clean">
+ <echo message="Cleaning project ${ant.project.name}"/>
+ <delete dir="target" includeemptydirs="true"/>
+ </target>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/binaries/bundle/pom.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/binaries/bundle/pom.xml new file mode 100644 index 0000000000..7dd0b3fc1a --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/binaries/bundle/pom.xml @@ -0,0 +1,669 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <version>1.0-SNAPSHOT</version>
+
+ <artifactId>scatours-binaries-bundle</artifactId>
+ <name>Apache Tuscany SCA Tours Binaries Bundle</name>
+ <packaging>pom</packaging>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-client-currency-converter-corba</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-client-currency-converter-jms</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-client-currency-converter-rmi</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-client-currency-converter-ws-jaxws</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-contribution-blog-feed</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-contribution-buildingblocks</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-contribution-buildingblocks-client</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-contribution-calendar</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-contribution-car</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-contribution-common</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-contribution-creditcard-payment-jaxb</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-contribution-creditcard-payment-jaxb-policy</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-contribution-creditcard-payment-sdo</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-contribution-creditcard-payment-webapp</artifactId>
+ <type>war</type>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-contribution-currency</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-contribution-currency-corba</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-contribution-currency-jms</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-contribution-currency-jsp</artifactId>
+ <type>war</type>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-contribution-currency-rmi</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-contribution-currency-servlet</artifactId>
+ <type>war</type>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-contribution-currency-ws</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-contribution-databinding-client</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-contribution-emailgateway</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-contribution-feed-logger</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-contribution-flight</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-contribution-fullapp-bespoketrip</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-contribution-fullapp-currency</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-contribution-fullapp-coordination</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-contribution-fullapp-packagedtrip</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-contribution-fullapp-shoppingcart</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-contribution-fullapp-ui</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-contribution-help-pages</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-contribution-hotel</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-contribution-interaction-client</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-contribution-interaction-service-remote</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-contribution-introducing-client</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-contribution-introducing-tours</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-contribution-introducing-trips</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-contribution-notification</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-contribution-notification-corba</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-contribution-notification-ejb</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-contribution-notification-jms</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-contribution-notification-rmi</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-contribution-notification-ws</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-contribution-payment-bpel</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-contribution-payment-bpel-process</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-contribution-payment-groovy</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-contribution-payment-python</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-contribution-payment-java</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-contribution-payment-java-callback</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-contribution-payment-java-policy</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-contribution-payment-java-reference-pass</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-contribution-payment-spring</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-contribution-payment-spring-policy</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-contribution-payment-spring-scatag</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-contribution-policy-client</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-contribution-scatours</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-contribution-shoppingcart</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-contribution-travelcatalog</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-contribution-trip</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-contribution-trip-policy</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-contribution-tripbooking</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-contribution-using</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-launcher-blog-feed</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-launcher-buildingblocks</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-launcher-currency-converter</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-launcher-currency-converter-corba</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-launcher-currency-converter-jms</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-launcher-currency-converter-rmi</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-launcher-currency-converter-ws</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-launcher-databinding</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-launcher-feed-logger</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-launcher-fullapp</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-launcher-fullapp-domain</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-launcher-fullapp-nodes</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-launcher-help-pages</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-launcher-interaction</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-launcher-introducing</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-launcher-introducing-client</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-launcher-introducing-domain</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-launcher-introducing-tours</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-launcher-introducing-trips</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-launcher-notification-corba</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-launcher-notification-ejb</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-launcher-notification-jms</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-launcher-notification-rmi</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-launcher-notification-ws</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-launcher-payment-bpel</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-launcher-payment-groovy</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-launcher-payment-python</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-launcher-payment-java</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-launcher-payment-java-callback</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-launcher-payment-java-policy</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-launcher-payment-java-reference-pass</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-launcher-payment-spring</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-launcher-payment-spring-scatag</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-launcher-policy</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-launcher-using</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-service-smsgateway-corba</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-service-smsgateway-ejb</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-service-smsgateway-jaxws</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-service-smsgateway-jms</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-service-smsgateway-rmi</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-util-launcher-common</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-domainconfig-fullapp</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-domainconfig-introducing</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-jms_1.1_spec</artifactId>
+ <version>1.1</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <executions>
+ <execution>
+ <phase>install</phase>
+ <configuration>
+ <tasks>
+ <delete dir="../target/domainconfig/META-INF" includeemptydirs="true"/>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+ <profiles>
+ <profile>
+ <!-- The default profile produces a subset binaries package which excludes
+ libraries that are present in the Tuscany SCA binary distro. -->
+ <id>default</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>distribution-package</id>
+ <phase>package</phase>
+ <goals>
+ <goal>single</goal>
+ </goals>
+ <configuration>
+ <descriptors>
+ <descriptor>../src/main/assembly/bin.xml</descriptor>
+ </descriptors>
+ <tarLongFileMode>gnu</tarLongFileMode>
+ <archiveBaseDirectory>..</archiveBaseDirectory>
+ <outputDirectory>../target</outputDirectory>
+ <finalName>.</finalName>
+ <appendAssemblyId>true</appendAssemblyId>
+ <ignoreDirFormatExtensions>true</ignoreDirFormatExtensions>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+
+ <profile>
+ <!-- Use mvn -Pselfcontained to produce a self-contained binaries package
+ with all library dependencies included. -->
+ <id>selfcontained</id>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>distribution-package</id>
+ <phase>package</phase>
+ <goals>
+ <goal>single</goal>
+ </goals>
+ <configuration>
+ <descriptors>
+ <descriptor>../src/main/assembly/bin-selfcontained.xml</descriptor>
+ </descriptors>
+ <tarLongFileMode>gnu</tarLongFileMode>
+ <archiveBaseDirectory>..</archiveBaseDirectory>
+ <outputDirectory>../target</outputDirectory>
+ <finalName>.</finalName>
+ <appendAssemblyId>true</appendAssemblyId>
+ <ignoreDirFormatExtensions>true</ignoreDirFormatExtensions>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/binaries/jaxws/pom.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/binaries/jaxws/pom.xml new file mode 100644 index 0000000000..5d426e7c27 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/binaries/jaxws/pom.xml @@ -0,0 +1,71 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <version>1.0-SNAPSHOT</version>
+
+ <!-- This module brings in the JAX-WS runtime dependencies that are needed when running on JDK 5. -->
+ <artifactId>scatours-binaries-jaxws</artifactId>
+ <name>Apache Tuscany SCA Tours Binaries JAX-WS Dependencies for JDK 5</name>
+ <packaging>pom</packaging>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-util-jaxws-runtime</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>distribution-package</id>
+ <phase>package</phase>
+ <goals>
+ <goal>single</goal>
+ </goals>
+ <configuration>
+ <descriptors>
+ <descriptor>../src/main/assembly/bin-jaxws.xml</descriptor>
+ </descriptors>
+ <tarLongFileMode>gnu</tarLongFileMode>
+ <archiveBaseDirectory>..</archiveBaseDirectory>
+ <outputDirectory>../target</outputDirectory>
+ <finalName>.</finalName>
+ <appendAssemblyId>true</appendAssemblyId>
+ <ignoreDirFormatExtensions>true</ignoreDirFormatExtensions>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/binaries/ode/pom.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/binaries/ode/pom.xml new file mode 100644 index 0000000000..b250c553e5 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/binaries/ode/pom.xml @@ -0,0 +1,72 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <version>1.0-SNAPSHOT</version>
+
+ <!-- This module brings in the database needed by the ODE runtime. -->
+ <artifactId>scatours-binaries-ode</artifactId>
+ <name>Apache Tuscany SCA Tours Binaries ODE Database</name>
+ <packaging>pom</packaging>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.ode</groupId>
+ <artifactId>ode-dao-jpa-ojpa-derby</artifactId>
+ <type>zip</type>
+ <version>1.1.1</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>distribution-package</id>
+ <phase>package</phase>
+ <goals>
+ <goal>single</goal>
+ </goals>
+ <configuration>
+ <descriptors>
+ <descriptor>../src/main/assembly/bin-ode.xml</descriptor>
+ </descriptors>
+ <tarLongFileMode>gnu</tarLongFileMode>
+ <archiveBaseDirectory>..</archiveBaseDirectory>
+ <outputDirectory>../target</outputDirectory>
+ <finalName>.</finalName>
+ <appendAssemblyId>true</appendAssemblyId>
+ <ignoreDirFormatExtensions>true</ignoreDirFormatExtensions>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/binaries/openejb/pom.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/binaries/openejb/pom.xml new file mode 100644 index 0000000000..132a1e19bc --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/binaries/openejb/pom.xml @@ -0,0 +1,70 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <version>1.0-SNAPSHOT</version>
+
+ <artifactId>scatours-binaries-openejb</artifactId>
+ <name>Apache Tuscany SCA Tours Binaries OpenEJB Dependencies</name>
+ <packaging>pom</packaging>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-util-openejb-runtime</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>distribution-package</id>
+ <phase>package</phase>
+ <goals>
+ <goal>single</goal>
+ </goals>
+ <configuration>
+ <descriptors>
+ <descriptor>../src/main/assembly/bin-openejb.xml</descriptor>
+ </descriptors>
+ <tarLongFileMode>gnu</tarLongFileMode>
+ <archiveBaseDirectory>..</archiveBaseDirectory>
+ <outputDirectory>../target</outputDirectory>
+ <finalName>.</finalName>
+ <appendAssemblyId>true</appendAssemblyId>
+ <ignoreDirFormatExtensions>true</ignoreDirFormatExtensions>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/binaries/pom.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/binaries/pom.xml new file mode 100644 index 0000000000..ffd9557646 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/binaries/pom.xml @@ -0,0 +1,40 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<project> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>scatours</artifactId> + <version>1.0-SNAPSHOT</version> + <relativePath>../pom.xml</relativePath> + </parent> + <version>1.0-SNAPSHOT</version> + + <artifactId>scatours-binaries</artifactId> + <name>Apache Tuscany SCA Tours Binaries</name> + <packaging>pom</packaging> + + <modules> + <module>bundle</module> + <module>jaxws</module> + <module>ode</module> + <module>openejb</module> + </modules> +</project> diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/binaries/src/main/assembly/bin-jaxws.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/binaries/src/main/assembly/bin-jaxws.xml new file mode 100644 index 0000000000..96ef5cbd30 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/binaries/src/main/assembly/bin-jaxws.xml @@ -0,0 +1,35 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<assembly>
+ <!-- id typically identifies the "type" (src vs bin etc) of the assembly -->
+ <id></id>
+ <includeBaseDirectory>false</includeBaseDirectory>
+ <formats>
+ <format>dir</format>
+<!--
+ <format>tar.gz</format>
+ <format>zip</format>
+-->
+ </formats>
+
+ <componentDescriptors>
+ <componentDescriptor>../src/main/components/bin-jaxws.xml</componentDescriptor>
+ </componentDescriptors>
+</assembly>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/binaries/src/main/assembly/bin-ode.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/binaries/src/main/assembly/bin-ode.xml new file mode 100644 index 0000000000..5e15619a25 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/binaries/src/main/assembly/bin-ode.xml @@ -0,0 +1,35 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<assembly>
+ <!-- id typically identifies the "type" (src vs bin etc) of the assembly -->
+ <id></id>
+ <includeBaseDirectory>false</includeBaseDirectory>
+ <formats>
+ <format>dir</format>
+<!--
+ <format>tar.gz</format>
+ <format>zip</format>
+-->
+ </formats>
+
+ <componentDescriptors>
+ <componentDescriptor>../src/main/components/bin-ode.xml</componentDescriptor>
+ </componentDescriptors>
+</assembly>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/binaries/src/main/assembly/bin-openejb.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/binaries/src/main/assembly/bin-openejb.xml new file mode 100644 index 0000000000..f546400951 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/binaries/src/main/assembly/bin-openejb.xml @@ -0,0 +1,35 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<assembly>
+ <!-- id typically identifies the "type" (src vs bin etc) of the assembly -->
+ <id></id>
+ <includeBaseDirectory>false</includeBaseDirectory>
+ <formats>
+ <format>dir</format>
+<!--
+ <format>tar.gz</format>
+ <format>zip</format>
+-->
+ </formats>
+
+ <componentDescriptors>
+ <componentDescriptor>../src/main/components/bin-openejb.xml</componentDescriptor>
+ </componentDescriptors>
+</assembly>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/binaries/src/main/assembly/bin-selfcontained.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/binaries/src/main/assembly/bin-selfcontained.xml new file mode 100644 index 0000000000..b482fd4b39 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/binaries/src/main/assembly/bin-selfcontained.xml @@ -0,0 +1,36 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<assembly>
+ <!-- id typically identifies the "type" (src vs bin etc) of the assembly -->
+ <id></id>
+ <includeBaseDirectory>false</includeBaseDirectory>
+ <formats>
+ <format>dir</format>
+<!--
+ <format>tar.gz</format>
+ <format>zip</format>
+-->
+ </formats>
+
+ <componentDescriptors>
+ <componentDescriptor>../src/main/components/bin-modules.xml</componentDescriptor>
+ <componentDescriptor>../src/main/components/bin-selfcontained.xml</componentDescriptor>
+ </componentDescriptors>
+</assembly>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/binaries/src/main/assembly/bin.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/binaries/src/main/assembly/bin.xml new file mode 100644 index 0000000000..4dc8bcbebf --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/binaries/src/main/assembly/bin.xml @@ -0,0 +1,36 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<assembly> + <!-- id typically identifies the "type" (src vs bin etc) of the assembly --> + <id></id> + <includeBaseDirectory>false</includeBaseDirectory> + <formats> + <format>dir</format> +<!-- + <format>tar.gz</format> + <format>zip</format> +--> + </formats> + + <componentDescriptors> + <componentDescriptor>../src/main/components/bin-modules.xml</componentDescriptor> + <componentDescriptor>../src/main/components/bin-default.xml</componentDescriptor> + </componentDescriptors> +</assembly> diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/binaries/src/main/components/bin-default.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/binaries/src/main/components/bin-default.xml new file mode 100644 index 0000000000..ed61a17af3 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/binaries/src/main/components/bin-default.xml @@ -0,0 +1,28 @@ +<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<component>
+
+ <files>
+ <file>
+ <source>../src/main/resources/build-defs.xml</source>
+ <outputDirectory>util</outputDirectory>
+ </file>
+ </files>
+
+</component>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/binaries/src/main/components/bin-jaxws.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/binaries/src/main/components/bin-jaxws.xml new file mode 100644 index 0000000000..f139569c23 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/binaries/src/main/components/bin-jaxws.xml @@ -0,0 +1,46 @@ +<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<component>
+
+ <dependencySets>
+ <!-- Add scatours-util-jaxws-runtime.jar to the util directory -->
+ <dependencySet>
+ <useProjectArtifact>false</useProjectArtifact>
+ <outputDirectory>util</outputDirectory>
+ <outputFileNameMapping>${artifact.artifactId}.${artifact.extension}</outputFileNameMapping>
+ <unpack>false</unpack>
+ <includes>
+ <include>org.apache.tuscany.sca:scatours-util-jaxws-runtime</include>
+ </includes>
+ <scope>runtime</scope>
+ </dependencySet>
+
+ <!-- Add the JAX-WS runtime dependencies to the jaxws directory -->
+ <dependencySet>
+ <useProjectArtifact>false</useProjectArtifact>
+ <outputDirectory>jaxws</outputDirectory>
+ <unpack>false</unpack>
+ <excludes>
+ <exclude>org.apache.tuscany.sca:scatours-util-jaxws-runtime</exclude>
+ </excludes>
+ <scope>runtime</scope>
+ </dependencySet>
+ </dependencySets>
+
+</component>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/binaries/src/main/components/bin-modules.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/binaries/src/main/components/bin-modules.xml new file mode 100644 index 0000000000..57eee09c6d --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/binaries/src/main/components/bin-modules.xml @@ -0,0 +1,135 @@ +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<component> + + <files> + <file> + <source>../src/main/resources/build-clients.xml</source> + <outputDirectory>clients</outputDirectory> + <destName>build.xml</destName> + </file> + <file> + <source>../src/main/resources/build-launchers.xml</source> + <outputDirectory>launchers</outputDirectory> + <destName>build.xml</destName> + </file> + <file> + <source>../src/main/resources/build-services.xml</source> + <outputDirectory>services</outputDirectory> + <destName>build.xml</destName> + </file> + </files> + + <dependencySets> + <dependencySet> + <useProjectArtifact>false</useProjectArtifact> + <outputDirectory>util</outputDirectory> + <outputFileNameMapping>${artifact.artifactId}.${artifact.extension}</outputFileNameMapping> + <unpack>false</unpack> + <includes> + <include>org.apache.tuscany.sca:scatours-util-*</include> + </includes> + <scope>runtime</scope> + </dependencySet> + + <dependencySet> + <useProjectArtifact>false</useProjectArtifact> + <outputDirectory>contributions</outputDirectory> + <outputFileNameMapping>${artifact.artifactId}.${artifact.extension}</outputFileNameMapping> + <unpack>false</unpack> + <includes> + <include>org.apache.tuscany.sca:scatours-contribution-*</include> + </includes> + <excludes> + <exclude>org.apache.tuscany.sca:scatours-contribution-creditcard-payment-webapp</exclude> + <exclude>org.apache.tuscany.sca:scatours-contribution-currency-jsp</exclude> + <exclude>org.apache.tuscany.sca:scatours-contribution-currency-servlet</exclude> + <exclude>org.apache.tuscany.sca:scatours-contribution-payment-bpel-process</exclude> + </excludes> + <scope>runtime</scope> + </dependencySet> + + <dependencySet> + <useProjectArtifact>false</useProjectArtifact> + <outputDirectory>contributions/scatours-contribution-payment-bpel-process</outputDirectory> + <unpack>true</unpack> + <includes> + <include>org.apache.tuscany.sca:scatours-contribution-payment-bpel-process</include> + </includes> + <scope>runtime</scope> + </dependencySet> + + <dependencySet> + <useProjectArtifact>false</useProjectArtifact> + <outputDirectory>launchers</outputDirectory> + <outputFileNameMapping>${artifact.artifactId}.${artifact.extension}</outputFileNameMapping> + <unpack>false</unpack> + <includes> + <include>org.apache.tuscany.sca:scatours-launcher-*</include> + </includes> + <scope>runtime</scope> + </dependencySet> + + <dependencySet> + <useProjectArtifact>false</useProjectArtifact> + <outputDirectory>services</outputDirectory> + <outputFileNameMapping>${artifact.artifactId}.${artifact.extension}</outputFileNameMapping> + <unpack>false</unpack> + <includes> + <include>org.apache.tuscany.sca:scatours-service-*</include> + </includes> + <scope>runtime</scope> + </dependencySet> + + <dependencySet> + <useProjectArtifact>false</useProjectArtifact> + <outputDirectory>clients</outputDirectory> + <outputFileNameMapping>${artifact.artifactId}.${artifact.extension}</outputFileNameMapping> + <unpack>false</unpack> + <includes> + <include>org.apache.tuscany.sca:scatours-client-*</include> + </includes> + <scope>runtime</scope> + </dependencySet> + + <dependencySet> + <useProjectArtifact>false</useProjectArtifact> + <outputDirectory>webapps</outputDirectory> + <outputFileNameMapping>${artifact.artifactId}.${artifact.extension}</outputFileNameMapping> + <unpack>false</unpack> + <includes> + <include>org.apache.tuscany.sca:scatours-contribution-creditcard-payment-webapp</include> + <include>org.apache.tuscany.sca:scatours-contribution-currency-jsp</include> + <include>org.apache.tuscany.sca:scatours-contribution-currency-servlet</include> + </includes> + <scope>runtime</scope> + </dependencySet> + + <dependencySet> + <useProjectArtifact>false</useProjectArtifact> + <outputDirectory>domainconfig</outputDirectory> + <unpack>true</unpack> + <includes> + <include>org.apache.tuscany.sca:scatours-domainconfig-*</include> + </includes> + <scope>runtime</scope> + </dependencySet> + </dependencySets> + +</component> diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/binaries/src/main/components/bin-ode.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/binaries/src/main/components/bin-ode.xml new file mode 100644 index 0000000000..884a8fdb84 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/binaries/src/main/components/bin-ode.xml @@ -0,0 +1,36 @@ +<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<component>
+
+ <dependencySets>
+ <!-- Add the ODE database to the ode directory -->
+ <dependencySet>
+ <useProjectArtifact>false</useProjectArtifact>
+ <outputDirectory>ode</outputDirectory>
+ <unpack>true</unpack>
+ <!--
+ <includes>
+ <include>org.apache.ode:ode-dao-jpa-ojpa-derby-*</include>
+ </includes>
+ -->
+ <scope>runtime</scope>
+ </dependencySet>
+ </dependencySets>
+
+</component>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/binaries/src/main/components/bin-openejb.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/binaries/src/main/components/bin-openejb.xml new file mode 100644 index 0000000000..596ee0b55a --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/binaries/src/main/components/bin-openejb.xml @@ -0,0 +1,46 @@ +<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<component>
+
+ <dependencySets>
+ <!-- Add scatours-util-openejb-runtime.jar to the util directory -->
+ <dependencySet>
+ <useProjectArtifact>false</useProjectArtifact>
+ <outputDirectory>util</outputDirectory>
+ <outputFileNameMapping>${artifact.artifactId}.${artifact.extension}</outputFileNameMapping>
+ <unpack>false</unpack>
+ <includes>
+ <include>org.apache.tuscany.sca:scatours-util-openejb-runtime</include>
+ </includes>
+ <scope>runtime</scope>
+ </dependencySet>
+
+ <!-- Add the OpenEJB runtime dependencies to the openejb directory -->
+ <dependencySet>
+ <useProjectArtifact>false</useProjectArtifact>
+ <outputDirectory>openejb</outputDirectory>
+ <unpack>false</unpack>
+ <excludes>
+ <exclude>org.apache.tuscany.sca:scatours-util-openejb-runtime</exclude>
+ </excludes>
+ <scope>runtime</scope>
+ </dependencySet>
+ </dependencySets>
+
+</component>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/binaries/src/main/components/bin-selfcontained.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/binaries/src/main/components/bin-selfcontained.xml new file mode 100644 index 0000000000..90db09cfbe --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/binaries/src/main/components/bin-selfcontained.xml @@ -0,0 +1,42 @@ +<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<component>
+
+ <files>
+ <file>
+ <source>../src/main/resources/build-defs-selfcontained.xml</source>
+ <outputDirectory>util</outputDirectory>
+ <destName>build-defs.xml</destName>
+ </file>
+ </files>
+
+ <dependencySets>
+ <!-- Add all the Tuscany dependencies to the lib directory -->
+ <dependencySet>
+ <useProjectArtifact>false</useProjectArtifact>
+ <outputDirectory>lib</outputDirectory>
+ <unpack>false</unpack>
+ <excludes>
+ <exclude>org.apache.tuscany.sca:scatours*</exclude>
+ </excludes>
+ <scope>runtime</scope>
+ </dependencySet>
+ </dependencySets>
+
+</component>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/binaries/src/main/resources/build-clients.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/binaries/src/main/resources/build-clients.xml new file mode 100644 index 0000000000..98a3b2c345 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/binaries/src/main/resources/build-clients.xml @@ -0,0 +1,54 @@ +<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<project name="scatours-distribution-clients">
+ <import file="../util/build-defs.xml"/>
+
+ <target name="run-currency-converter-corba">
+ <java classname="scatours.CurrencyConverterCORBAClient" fork="true" failonerror="true">
+ <classpath location="scatours-client-currency-converter-corba.jar"/>
+ </java>
+ </target>
+
+ <target name="run-currency-converter-jms">
+ <java classname="scatours.CurrencyConverterJMSClient" fork="true" failonerror="true">
+ <classpath>
+ <pathelement location="scatours-client-currency-converter-jms.jar"/>
+ <!-- The following is used to bring in the ActiveMQ runtime. -->
+ <path refid="scatours.tuscany-manifest"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="run-currency-converter-rmi">
+ <java classname="scatours.CurrencyConverterRMIClient" fork="true" failonerror="true">
+ <classpath location="scatours-client-currency-converter-rmi.jar"/>
+ </java>
+ </target>
+
+ <target name="run-currency-converter-ws-jaxws">
+ <java classname="scatours.CurrencyConverterWSClient" fork="true" failonerror="true">
+ <classpath>
+ <pathelement location="scatours-client-currency-converter-ws-jaxws.jar"/>
+ <!-- The following is used to bring in additional dependencies of the JAX-WS runtime. -->
+ <path refid="scatours.tuscany-manifest"/>
+ </classpath>
+ </java>
+ </target>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/binaries/src/main/resources/build-defs-selfcontained.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/binaries/src/main/resources/build-defs-selfcontained.xml new file mode 100644 index 0000000000..f741f28a7b --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/binaries/src/main/resources/build-defs-selfcontained.xml @@ -0,0 +1,30 @@ +<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<!-- The self-contained build does not need any libraries from the Tuscany SCA
+ binary distro. -->
+<project name="build-defs">
+
+ <path id="scatours.tuscany-manifest"/>
+
+ <path id="scatours.tuscany-node-launcher"/>
+
+ <path id="scatours.tuscany-openejb"/>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/binaries/src/main/resources/build-defs.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/binaries/src/main/resources/build-defs.xml new file mode 100644 index 0000000000..f914208f52 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/binaries/src/main/resources/build-defs.xml @@ -0,0 +1,46 @@ +<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<!-- The default build depends on libraries from the Tuscany SCA binary distro. -->
+<project name="build-defs">
+ <property environment="env"/>
+
+ <path id="scatours.tuscany-manifest">
+ <pathelement location="${env.TUSCANY_HOME}/lib/tuscany-sca-manifest.jar"/>
+ </path>
+
+ <path id="scatours.tuscany-node-launcher">
+ <fileset dir="${env.TUSCANY_HOME}/modules" includes="tuscany-node-launcher-*.jar"/>
+ </path>
+
+ <path id="scatours.tuscany-openejb">
+ <fileset dir="${env.TUSCANY_HOME}/lib">
+ <!-- exclude some jars to prevent them being loaded by OpenEJB -->
+ <exclude name="tuscany-sca-manifest.jar"/>
+ <exclude name="ode-*.jar"/>
+ <exclude name="jaxb-xjc-*.jar"/>
+ <exclude name="jython-*.jar"/>
+ <exclude name="activemq-all-*.jar"/>
+ <exclude name="js-*.jar"/>
+ <exclude name="org.apache.felix.main-*.jar"/>
+ <exclude name="saxon-*.jar"/>
+ </fileset>
+ </path>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/binaries/src/main/resources/build-launchers.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/binaries/src/main/resources/build-launchers.xml new file mode 100644 index 0000000000..ab54f9b7d2 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/binaries/src/main/resources/build-launchers.xml @@ -0,0 +1,328 @@ +<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<project name="scatours-distribution-launchers">
+ <import file="../util/build-defs.xml"/>
+
+ <target name="run-blog-feed">
+ <java classname="scatours.BlogFeedLauncher" fork="true" failonerror="true">
+ <classpath>
+ <pathelement location="scatours-launcher-blog-feed.jar"/>
+ <path refid="scatours.tuscany-manifest"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="run-buildingblocks">
+ <java classname="scatours.BuildingBlocksLauncher" fork="true" failonerror="true">
+ <classpath>
+ <pathelement location="scatours-launcher-buildingblocks.jar"/>
+ <path refid="scatours.tuscany-manifest"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="run-currency-converter">
+ <java classname="scatours.CurrencyConverterLauncher" fork="true" failonerror="true">
+ <classpath>
+ <pathelement location="scatours-launcher-currency-converter.jar"/>
+ <path refid="scatours.tuscany-manifest"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="run-currency-converter-corba">
+ <java classname="scatours.CurrencyConverterCORBALauncher" fork="true" failonerror="true">
+ <classpath>
+ <pathelement location="scatours-launcher-currency-converter-corba.jar"/>
+ <path refid="scatours.tuscany-manifest"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="run-currency-converter-jms">
+ <java classname="scatours.CurrencyConverterJMSLauncher" fork="true" failonerror="true">
+ <classpath>
+ <pathelement location="scatours-launcher-currency-converter-jms.jar"/>
+ <path refid="scatours.tuscany-manifest"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="run-currency-converter-rmi">
+ <java classname="scatours.CurrencyConverterRMILauncher" fork="true" failonerror="true">
+ <classpath>
+ <pathelement location="scatours-launcher-currency-converter-rmi.jar"/>
+ <path refid="scatours.tuscany-manifest"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="run-currency-converter-ws">
+ <java classname="scatours.CurrencyConverterWSLauncher" fork="true" failonerror="true">
+ <classpath>
+ <pathelement location="scatours-launcher-currency-converter-ws.jar"/>
+ <path refid="scatours.tuscany-manifest"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="run-databinding">
+ <java classname="scatours.DatabindingLauncher" fork="true" failonerror="true">
+ <classpath>
+ <pathelement location="scatours-launcher-databinding.jar"/>
+ <path refid="scatours.tuscany-manifest"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="run-feed-logger">
+ <java classname="scatours.FeedLoggerLauncher" fork="true" failonerror="true">
+ <classpath>
+ <pathelement location="scatours-launcher-feed-logger.jar"/>
+ <path refid="scatours.tuscany-manifest"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="run-fullapp">
+ <java classname="scatours.FullAppLauncher" fork="true" failonerror="true">
+ <classpath>
+ <pathelement location="scatours-launcher-fullapp.jar"/>
+ <path refid="scatours.tuscany-manifest"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="run-fullapp-domain">
+ <java classname="scatours.FullAppDomainLauncher" fork="true" failonerror="true">
+ <classpath>
+ <pathelement location="scatours-launcher-fullapp-domain.jar"/>
+ <path refid="scatours.tuscany-manifest"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="run-fullapp-nodes">
+ <java classname="scatours.FullAppNodesLauncher" fork="true" failonerror="true">
+ <classpath>
+ <pathelement location="scatours-launcher-fullapp-nodes.jar"/>
+ <path refid="scatours.tuscany-manifest"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="run-help-pages">
+ <java classname="scatours.HelpPagesLauncher" fork="true" failonerror="true">
+ <classpath>
+ <pathelement location="scatours-launcher-help-pages.jar"/>
+ <path refid="scatours.tuscany-manifest"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="run-interaction">
+ <java classname="scatours.InteractionLauncher" fork="true" failonerror="true">
+ <classpath>
+ <pathelement location="scatours-launcher-interaction.jar"/>
+ <path refid="scatours.tuscany-manifest"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="run-introducing">
+ <java classname="scatours.IntroducingLauncher" fork="true" failonerror="true">
+ <classpath>
+ <pathelement location="scatours-launcher-introducing.jar"/>
+ <path refid="scatours.tuscany-manifest"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="run-introducing-client">
+ <java classname="scatours.IntroducingClientLauncher" fork="true" failonerror="true">
+ <classpath>
+ <pathelement location="scatours-launcher-introducing-client.jar"/>
+ <path refid="scatours.tuscany-manifest"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="run-introducing-domain">
+ <java classname="scatours.IntroducingDomainLauncher" fork="true" failonerror="true">
+ <classpath>
+ <pathelement location="scatours-launcher-introducing-domain.jar"/>
+ <path refid="scatours.tuscany-manifest"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="run-introducing-tours">
+ <java classname="scatours.IntroducingToursLauncher" fork="true" failonerror="true">
+ <classpath>
+ <pathelement location="scatours-launcher-introducing-tours.jar"/>
+ <path refid="scatours.tuscany-manifest"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="run-introducing-trips">
+ <java classname="scatours.IntroducingTripsLauncher" fork="true" failonerror="true">
+ <classpath>
+ <pathelement location="scatours-launcher-introducing-trips.jar"/>
+ <path refid="scatours.tuscany-manifest"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="run-notification-corba">
+ <java classname="scatours.NotificationCORBALauncher" fork="true" failonerror="true">
+ <classpath>
+ <pathelement location="scatours-launcher-notification-corba.jar"/>
+ <path refid="scatours.tuscany-manifest"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="run-notification-ejb">
+ <java classname="scatours.NotificationEJBLauncher" fork="true" failonerror="true">
+ <classpath>
+ <pathelement location="scatours-launcher-notification-ejb.jar"/>
+ <path refid="scatours.tuscany-manifest"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="run-notification-jms">
+ <java classname="scatours.NotificationJMSLauncher" fork="true" failonerror="true">
+ <classpath>
+ <pathelement location="scatours-launcher-notification-jms.jar"/>
+ <path refid="scatours.tuscany-manifest"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="run-notification-rmi">
+ <java classname="scatours.NotificationRMILauncher" fork="true" failonerror="true">
+ <classpath>
+ <pathelement location="scatours-launcher-notification-rmi.jar"/>
+ <path refid="scatours.tuscany-manifest"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="run-notification-ws">
+ <java classname="scatours.NotificationWSLauncher" fork="true" failonerror="true">
+ <classpath>
+ <pathelement location="scatours-launcher-notification-ws.jar"/>
+ <path refid="scatours.tuscany-manifest"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="run-payment-bpel">
+ <java classname="scatours.payment.PaymentLauncher" fork="true" failonerror="true">
+ <classpath>
+ <pathelement location="scatours-launcher-payment-bpel.jar"/>
+ <path refid="scatours.tuscany-manifest"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="run-payment-groovy">
+ <java classname="scatours.payment.PaymentLauncher" fork="true" failonerror="true">
+ <classpath>
+ <pathelement location="scatours-launcher-payment-groovy.jar"/>
+ <path refid="scatours.tuscany-manifest"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="run-payment-python">
+ <java classname="scatours.payment.PaymentLauncher" fork="true" failonerror="true">
+ <classpath>
+ <pathelement location="scatours-launcher-payment-groovy.jar"/>
+ <path refid="scatours.tuscany-manifest"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="run-payment-java">
+ <java classname="scatours.payment.PaymentLauncher" fork="true" failonerror="true">
+ <classpath>
+ <pathelement location="scatours-launcher-payment-java.jar"/>
+ <path refid="scatours.tuscany-manifest"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="run-payment-java-callback">
+ <java classname="scatours.payment.PaymentLauncher" fork="true" failonerror="true">
+ <classpath>
+ <pathelement location="scatours-launcher-payment-java.jar"/>
+ <path refid="scatours.tuscany-manifest"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="run-payment-java-policy">
+ <java classname="scatours.payment.PaymentLauncher" fork="true" failonerror="true">
+ <classpath>
+ <pathelement location="scatours-launcher-java-policy.jar"/>
+ <path refid="scatours.tuscany-manifest"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="run-payment-java-reference-pass">
+ <java classname="scatours.payment.PaymentLauncher" fork="true" failonerror="true">
+ <classpath>
+ <pathelement location="scatours-launcher-payment-java.jar"/>
+ <path refid="scatours.tuscany-manifest"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="run-payment-spring">
+ <java classname="scatours.payment.PaymentLauncher" fork="true" failonerror="true">
+ <classpath>
+ <pathelement location="scatours-launcher-payment-spring.jar"/>
+ <path refid="scatours.tuscany-manifest"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="run-payment-spring-scatag">
+ <java classname="scatours.payment.PaymentLauncher" fork="true" failonerror="true">
+ <classpath>
+ <pathelement location="scatours-launcher-spring-scatag.jar"/>
+ <path refid="scatours.tuscany-manifest"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="run-using">
+ <java classname="scatours.UsingLauncher" fork="true" failonerror="true">
+ <classpath>
+ <pathelement location="scatours-launcher-using.jar"/>
+ <path refid="scatours.tuscany-manifest"/>
+ </classpath>
+ </java>
+ </target>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/binaries/src/main/resources/build-services.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/binaries/src/main/resources/build-services.xml new file mode 100644 index 0000000000..6154f0b451 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/binaries/src/main/resources/build-services.xml @@ -0,0 +1,64 @@ +<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<project name="scatours-distribution-services">
+ <import file="../util/build-defs.xml"/>
+
+ <target name="run-smsgateway-corba">
+ <java classname="scatours.smsgateway.SMSGatewayCORBAServiceBootstrap" fork="true" failonerror="true">
+ <classpath location="scatours-service-smsgateway-corba.jar"/>
+ </java>
+ </target>
+
+ <target name="run-smsgateway-ejb">
+ <java classname="com.tuscanyscatours.smsgateway.SMSGatewayEJBServiceBootstrap" fork="true" failonerror="true">
+ <classpath>
+ <pathelement location="scatours-service-smsgateway-ejb.jar"/>
+ <!-- The following is used to bring in additional dependencies of the OpenEJB runtime. -->
+ <path refid="scatours.tuscany-openejb"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="run-smsgateway-jaxws">
+ <java classname="com.tuscanyscatours.smsgateway.SMSGatewayServiceBootstrap" fork="true">
+ <classpath>
+ <pathelement location="scatours-service-smsgateway-jaxws.jar"/>
+ <!-- The following is used to bring in additional dependencies of the JAX-WS runtime. -->
+ <path refid="scatours.tuscany-manifest"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="run-smsgateway-jms">
+ <java classname="scatours.smsgateway.SMSGatewayJMSServiceBootstrap" fork="true">
+ <classpath>
+ <pathelement location="scatours-service-smsgateway-jms.jar"/>
+ <!-- The following is used to bring in the ActiveMQ runtime. -->
+ <path refid="scatours.tuscany-manifest"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="run-smsgateway-rmi">
+ <java classname="com.tuscanyscatours.smsgateway.SMSGatewayRMIServiceBootstrap" fork="true" failonerror="true">
+ <classpath location="scatours-service-smsgateway-rmi.jar"/>
+ </java>
+ </target>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/build.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/build.xml new file mode 100644 index 0000000000..f74b4cb2a8 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/build.xml @@ -0,0 +1,49 @@ +<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<project name="scatours" default="compile">
+
+ <target name="compile">
+ <antcall target="allsubdirs">
+ <param name="target" value="compile"/>
+ </antcall>
+ </target>
+
+ <target name="test">
+ <antcall target="allsubdirs">
+ <param name="target" value="test"/>
+ </antcall>
+ </target>
+
+ <target name="clean">
+ <antcall target="allsubdirs">
+ <param name="target" value="clean"/>
+ </antcall>
+ </target>
+
+ <target name="allsubdirs">
+ <ant dir="util" target="${target}"/> <!--needed by launchers-->
+ <ant dir="contributions" target="${target}"/> <!--needed by launchers-->
+ <ant dir="domainconfig" target="${target}"/> <!--needed by launchers-->
+ <ant dir="services" target="${target}"/> <!--needed by launchers-->
+ <ant dir="launchers" target="${target}"/> <!--needed by clients-->
+ <ant dir="clients" target="${target}"/>
+ </target>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/clients/build.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/clients/build.xml new file mode 100644 index 0000000000..78e305c3cd --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/clients/build.xml @@ -0,0 +1,47 @@ +<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<project name="scatours-clients" default="compile">
+
+ <target name="compile">
+ <antcall target="allsubdirs">
+ <param name="target" value="compile"/>
+ </antcall>
+ </target>
+
+ <target name="test">
+ <antcall target="allsubdirs">
+ <param name="target" value="test"/>
+ </antcall>
+ </target>
+
+ <target name="clean">
+ <antcall target="allsubdirs">
+ <param name="target" value="clean"/>
+ </antcall>
+ </target>
+
+ <target name="allsubdirs">
+ <ant dir="currency-converter-corba" target="${target}"/>
+ <ant dir="currency-converter-jms" target="${target}"/>
+ <ant dir="currency-converter-rmi" target="${target}"/>
+ <ant dir="currency-converter-ws-jaxws" target="${target}"/>
+ </target>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/clients/currency-converter-corba/build.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/clients/currency-converter-corba/build.xml new file mode 100644 index 0000000000..eebbe90d4d --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/clients/currency-converter-corba/build.xml @@ -0,0 +1,42 @@ +<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<project name="scatours-client-currency-converter-corba" default="compile">
+ <import file="../../antdefs.xml"/>
+
+ <target name="idljava">
+ <antcall target="idlj">
+ <param name="idljopts" value="-fclient"/>
+ <param name="idlfile" value="currency-converter.idl"/>
+ <param name="javaclass" value="com/tuscanyscatours/currencyconverter/CurrencyConverter.class"/>
+ </antcall>
+ </target>
+
+ <!-- Before invoking the "run" target, the CORBA implementation of the
+ currency converter service needs to be started in its own process. -->
+ <target name="run-service">
+ <ant dir="../../launchers/currency-converter-corba" target="run"/>
+ </target>
+
+ <target name="run">
+ <java classname="scatours.CurrencyConverterCORBAClient" fork="true" failonerror="true">
+ <classpath location="target/${ant.project.name}.jar"/>
+ </java>
+ </target>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/clients/currency-converter-corba/pom.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/clients/currency-converter-corba/pom.xml new file mode 100644 index 0000000000..1414ee706b --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/clients/currency-converter-corba/pom.xml @@ -0,0 +1,76 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent><version>1.0-SNAPSHOT</version>
+ <artifactId>scatours-client-currency-converter-corba</artifactId>
+ <name>Apache Tuscany SCA Tours Currency Converter CORBA Client</name>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <version>2.2</version>
+ <configuration>
+ <archive>
+ <manifest>
+ <addClasspath>${scatours.selfContained}</addClasspath>
+ <classpathPrefix>../lib/</classpathPrefix>
+ <mainClass>scatours.CurrencyConverterCORBAClient</mainClass>
+ </manifest>
+ </archive>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>idlj-maven-plugin</artifactId>
+ <version>1.1</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <compiler>idlj</compiler>
+ <sources>
+ <source>
+ <includes>
+ <include>currency-converter.idl</include>
+ </includes>
+ <emitStubs>true</emitStubs>
+ <emitSkeletons>false</emitSkeletons>
+ </source>
+ </sources>
+ <sourceDirectory>${basedir}/src/main/resources</sourceDirectory>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/clients/currency-converter-corba/src/main/java/scatours/CurrencyConverterCORBAClient.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/clients/currency-converter-corba/src/main/java/scatours/CurrencyConverterCORBAClient.java new file mode 100644 index 0000000000..7d799e459b --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/clients/currency-converter-corba/src/main/java/scatours/CurrencyConverterCORBAClient.java @@ -0,0 +1,41 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package scatours; + +import org.omg.CORBA.ORB; +import org.omg.CORBA.Object; + +import com.tuscanyscatours.currencyconverter.CurrencyConverter; +import com.tuscanyscatours.currencyconverter.CurrencyConverterHelper; + +public class CurrencyConverterCORBAClient { + + public static void main(String[] args) throws Exception { + + String[] orbArgs = {"-ORBInitialPort", "5080"}; + ORB orb = ORB.init(orbArgs, null); + + String ior = "corbaname::localhost:5080#CurrencyConverterCORBAService"; + Object obj = orb.string_to_object(ior); + CurrencyConverter converter = CurrencyConverterHelper.narrow(obj); + + System.out.println("USD -> GBP = " + converter.getExchangeRate("USD", "GBP")); + System.out.println("100 USD = " + converter.convert("USD", "GBP", 100.0) + "GBP"); + } +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/clients/currency-converter-corba/src/main/resources/currency-converter.idl b/sca-java-1.x/branches/sca-java-travelsample-1.0/clients/currency-converter-corba/src/main/resources/currency-converter.idl new file mode 100644 index 0000000000..1ff24291f5 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/clients/currency-converter-corba/src/main/resources/currency-converter.idl @@ -0,0 +1,29 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +module com { + module tuscanyscatours { + module currencyconverter { + interface CurrencyConverter { + double getExchangeRate(in string fromCurrencyCode, in string toCurrencyCode); + double convert(in string fromCurrencyCode, in string toCurrencyCode, in double amount); + }; + }; + }; +}; diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/clients/currency-converter-jms/build.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/clients/currency-converter-jms/build.xml new file mode 100644 index 0000000000..1e3e20e4e6 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/clients/currency-converter-jms/build.xml @@ -0,0 +1,38 @@ +<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<project name="scatours-client-currency-converter-jms" default="compile">
+ <import file="../../antdefs.xml"/>
+
+ <!-- Before invoking the "run" target, the JMS implementation of the
+ currency converter service needs to be started in its own process. -->
+ <target name="run-service">
+ <ant dir="../../launchers/currency-converter-jms" target="run"/>
+ </target>
+
+ <target name="run">
+ <java classname="scatours.CurrencyConverterJMSClient" fork="true" failonerror="true">
+ <classpath>
+ <pathelement location="target/${ant.project.name}.jar"/>
+ <!-- The following is used to bring in the ActiveMQ runtime. -->
+ <pathelement location="${env.TUSCANY_HOME}/lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </java>
+ </target>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/clients/currency-converter-jms/pom.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/clients/currency-converter-jms/pom.xml new file mode 100644 index 0000000000..55b499e314 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/clients/currency-converter-jms/pom.xml @@ -0,0 +1,98 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <version>1.0-SNAPSHOT</version>
+ <artifactId>scatours-client-currency-converter-jms</artifactId>
+ <name>Apache Tuscany SCA Tours Currency Converter JMS Client</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>activemq-all</artifactId>
+ <version>5.2.0</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>activemq-web-demo</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.ws.commons.axiom</groupId>
+ <artifactId>axiom-api</artifactId>
+ <version>1.2.7</version>
+ <exclusions>
+ <exclusion>
+ <groupId>xerces</groupId>
+ <artifactId>xercesImpl</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>stax</groupId>
+ <artifactId>stax-api</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>xml-apis</groupId>
+ <artifactId>xml-apis</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.ws.commons.axiom</groupId>
+ <artifactId>axiom-impl</artifactId>
+ <version>1.2.7</version>
+ <scope>runtime</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>stax</groupId>
+ <artifactId>stax-api</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <version>2.2</version>
+ <configuration>
+ <archive>
+ <manifest>
+ <addClasspath>${scatours.selfContained}</addClasspath>
+ <classpathPrefix>../lib/</classpathPrefix>
+ <mainClass>scatours.CurrencyConverterJMSClient</mainClass>
+ </manifest>
+ </archive>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/clients/currency-converter-jms/src/main/java/scatours/CurrencyConverterJMSClient.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/clients/currency-converter-jms/src/main/java/scatours/CurrencyConverterJMSClient.java new file mode 100644 index 0000000000..0bea38e07f --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/clients/currency-converter-jms/src/main/java/scatours/CurrencyConverterJMSClient.java @@ -0,0 +1,103 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package scatours; + +import java.io.ByteArrayInputStream; + +import javax.jms.Connection; +import javax.jms.Destination; +import javax.jms.JMSException; +import javax.jms.MessageConsumer; +import javax.jms.MessageProducer; +import javax.jms.Session; +import javax.jms.TextMessage; +import javax.xml.stream.XMLStreamException; + +import org.apache.activemq.ActiveMQConnectionFactory; +import org.apache.axiom.om.OMAbstractFactory; +import org.apache.axiom.om.OMElement; +import org.apache.axiom.om.OMFactory; +import org.apache.axiom.om.OMText; +import org.apache.axiom.om.impl.builder.StAXOMBuilder; + +public class CurrencyConverterJMSClient { + + private static Connection activeMQConnection; + private static Session activeMQSession; + private static Destination requestDestination; + private static MessageProducer activeMQProducer; + private static Destination responseDestination; + private static MessageConsumer consumer; + private static OMFactory omFactory; + + public static void main(String[] args) throws JMSException, XMLStreamException { + startActiveMQSession(); + + OMElement request = omFactory.createOMElement("convert", "http://goodvaluetrips.com/", "ns2"); + request.addChild(createArg(0, "USD")); + request.addChild(createArg(1, "GBP")); + request.addChild(createArg(2, "100.0")); + + TextMessage message = activeMQSession.createTextMessage("convert"); + message.setStringProperty("scaOperationName", "convert"); + message.setJMSReplyTo(responseDestination); + message.setText(request.toString()); + activeMQProducer.send(message); + + TextMessage response = (TextMessage)consumer.receive(); + StAXOMBuilder builder = new StAXOMBuilder(new ByteArrayInputStream(response.getText().getBytes())); + OMText returnElement = (OMText)builder.getDocumentElement().getFirstOMChild(); + String returnValue = returnElement.getText(); + System.out.println("100 USD = " + returnValue + "GBP"); + + stopActiveMQSession(); + } + + private static void startActiveMQSession() throws JMSException { + ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory("tcp://localhost:61619"); + + activeMQConnection = connectionFactory.createConnection(); + activeMQConnection.start(); + + activeMQSession = activeMQConnection.createSession(false, Session.AUTO_ACKNOWLEDGE); + + requestDestination = activeMQSession.createQueue("RequestQueue"); + activeMQProducer = activeMQSession.createProducer(requestDestination); + + responseDestination = activeMQSession.createQueue("ResponseQueue"); + consumer = activeMQSession.createConsumer(responseDestination); + + omFactory = OMAbstractFactory.getOMFactory(); + } + + private static void stopActiveMQSession() throws JMSException { + consumer.close(); + activeMQProducer.close(); + activeMQSession.close(); + activeMQConnection.close(); + } + + private static OMElement createArg(int argNumber, String value) { + OMFactory omFactory = OMAbstractFactory.getOMFactory(); + OMElement arg = omFactory.createOMElement("arg" + argNumber, null); + OMText senderOM = omFactory.createOMText(value); + arg.addChild(senderOM); + return arg; + } +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/clients/currency-converter-rmi/build.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/clients/currency-converter-rmi/build.xml new file mode 100644 index 0000000000..33a2db7951 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/clients/currency-converter-rmi/build.xml @@ -0,0 +1,36 @@ +<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<project name="scatours-client-currency-converter-rmi" default="compile">
+ <import file="../../antdefs.xml"/>
+
+ <!-- Before invoking the "run" target, the RMI implementation of the
+ currency converter service needs to be started in its own process. -->
+ <target name="run-service">
+ <ant dir="../../launchers/currency-converter-rmi" target="run"/>
+ </target>
+
+ <target name="run">
+ <java classname="scatours.CurrencyConverterRMIClient" fork="true" failonerror="true">
+ <classpath>
+ <pathelement location="target/${ant.project.name}.jar"/>
+ </classpath>
+ </java>
+ </target>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/clients/currency-converter-rmi/pom.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/clients/currency-converter-rmi/pom.xml new file mode 100644 index 0000000000..69a0527d4b --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/clients/currency-converter-rmi/pom.xml @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent><version>1.0-SNAPSHOT</version>
+ <artifactId>scatours-client-currency-converter-rmi</artifactId>
+ <name>Apache Tuscany SCA Tours Currency Converter RMI Client</name>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <version>2.2</version>
+ <configuration>
+ <archive>
+ <manifest>
+ <addClasspath>${scatours.selfContained}</addClasspath>
+ <classpathPrefix>../lib/</classpathPrefix>
+ <mainClass>scatours.CurrencyConverterRMIClient</mainClass>
+ </manifest>
+ </archive>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/clients/currency-converter-rmi/src/main/java/com/tuscanyscatours/currencyconverter/CurrencyConverter.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/clients/currency-converter-rmi/src/main/java/com/tuscanyscatours/currencyconverter/CurrencyConverter.java new file mode 100644 index 0000000000..e12a95c964 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/clients/currency-converter-rmi/src/main/java/com/tuscanyscatours/currencyconverter/CurrencyConverter.java @@ -0,0 +1,30 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package com.tuscanyscatours.currencyconverter;
+
+/**
+ * The CurrencyConverter service interface
+ */
+public interface CurrencyConverter {
+
+ double getExchangeRate(String fromCurrencyCode, String toCurrencyCode);
+
+ double convert(String fromCurrencyCode, String toCurrencyCode, double amount);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/clients/currency-converter-rmi/src/main/java/scatours/CurrencyConverterRMIClient.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/clients/currency-converter-rmi/src/main/java/scatours/CurrencyConverterRMIClient.java new file mode 100644 index 0000000000..32e4fccfce --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/clients/currency-converter-rmi/src/main/java/scatours/CurrencyConverterRMIClient.java @@ -0,0 +1,36 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package scatours; + +import java.rmi.registry.LocateRegistry; +import java.rmi.registry.Registry; + +import com.tuscanyscatours.currencyconverter.CurrencyConverter; + +public class CurrencyConverterRMIClient { + + public static void main(String[] args) throws Exception { + Registry registry = LocateRegistry.getRegistry("localhost", 8099); + String name = "CurrencyConverterRMI"; + CurrencyConverter converter = (CurrencyConverter)registry.lookup(name); + + System.out.println("USD -> GBP = " + converter.getExchangeRate("USD", "GBP")); + System.out.println("100 USD = " + converter.convert("USD", "GBP", 100.0) + "GBP"); + } +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/clients/currency-converter-ws-jaxws/build.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/clients/currency-converter-ws-jaxws/build.xml new file mode 100644 index 0000000000..116f2999ba --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/clients/currency-converter-ws-jaxws/build.xml @@ -0,0 +1,64 @@ +<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<project name="scatours-client-currency-converter-ws-jaxws" default="compile">
+ <import file="../../antdefs.xml"/>
+
+ <target name="wsdljava">
+ <antcall target="wsimport">
+ <param name="wsdlfile" value="wsdl/CurrencyConverter.wsdl"/>
+ <param name="javaclass" value="scatours/currencyconverter/client/CurrencyConverter.class"/>
+ <param name="package" value="scatours.currencyconverter.client"/>
+ </antcall>
+ </target>
+
+ <!-- Before invoking the "run" target, the Web Services implementation of
+ the currency converter service needs to be started in its own process. -->
+ <target name="run-service">
+ <ant dir="../../launchers/currency-converter-ws" target="run"/>
+ </target>
+
+ <target name="run" depends="is-jdk6, jaxws-jdk6, jaxws-jdk5">
+ <java classname="scatours.CurrencyConverterWSClient" fork="true" failonerror="true">
+ <classpath>
+ <pathelement location="target/${ant.project.name}.jar"/>
+ <path refid="jaxws-path"/>
+ </classpath>
+ </java>
+ </target>
+
+ <!-- check to see if we are running on JDK 6 -->
+ <target name="is-jdk6">
+ <condition property="jdk6">
+ <available classname="javax.xml.ws.Service"/>
+ </condition>
+ </target>
+
+ <!-- JDK 6 contains JAX-WS so we don't need it on the classpath -->
+ <target name="jaxws-jdk6" if="jdk6">
+ <path id="jaxws-path"/>
+ </target>
+
+ <!-- on JDK 5 we need to add the JAX-WS runtime to the classpath -->
+ <target name="jaxws-jdk5" unless="jdk6">
+ <path id="jaxws-path">
+ <fileset dir="${env.JAXWS_HOME}/lib"/>
+ </path>
+ </target>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/clients/currency-converter-ws-jaxws/pom.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/clients/currency-converter-ws-jaxws/pom.xml new file mode 100644 index 0000000000..8513023a92 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/clients/currency-converter-ws-jaxws/pom.xml @@ -0,0 +1,93 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <version>1.0-SNAPSHOT</version>
+ <artifactId>scatours-client-currency-converter-ws-jaxws</artifactId>
+ <name>Apache Tuscany SCA Tours Currency Converter Web Service JAX-WS Client</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>javax.xml.ws</groupId>
+ <artifactId>jaxws-api</artifactId>
+ <version>2.1</version>
+ <exclusions>
+ <exclusion>
+ <groupId>javax.xml.soap</groupId>
+ <artifactId>saaj-api</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ </dependencies>
+
+ <pluginRepositories>
+ <pluginRepository>
+ <id>java.net2</id>
+ <name>java.net Maven 2.x Repository</name>
+ <url>http://download.java.net/maven/2</url>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </pluginRepository>
+ </pluginRepositories>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <version>2.2</version>
+ <configuration>
+ <archive>
+ <manifestEntries>
+ <Class-Path>../util/scatours-util-jaxws-runtime.jar</Class-Path>
+ <Main-Class>scatours.CurrencyConverterWSClient</Main-Class>
+ </manifestEntries>
+ </archive>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>jaxws-maven-plugin</artifactId>
+ <version>1.12</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>wsimport</goal>
+ </goals>
+ <configuration>
+ <wsdlDirectory>${basedir}/src/main/resources/wsdl</wsdlDirectory>
+ <packageName>scatours.currencyconverter.client</packageName>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/clients/currency-converter-ws-jaxws/src/main/java/scatours/CurrencyConverterWSClient.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/clients/currency-converter-ws-jaxws/src/main/java/scatours/CurrencyConverterWSClient.java new file mode 100644 index 0000000000..dbaa7c2124 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/clients/currency-converter-ws-jaxws/src/main/java/scatours/CurrencyConverterWSClient.java @@ -0,0 +1,33 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package scatours; + +import scatours.currencyconverter.client.CurrencyConverter; +import scatours.currencyconverter.client.CurrencyConverterService; + +public class CurrencyConverterWSClient { + + public static void main(String[] args) throws Exception { + CurrencyConverterService service = new CurrencyConverterService(); + CurrencyConverter converter = service.getPort(CurrencyConverter.class); + + System.out.println("USD -> GBP = " + converter.getExchangeRate("USD", "GBP")); + System.out.println("100 USD = " + converter.convert("USD", "GBP", 100.0) + "GBP"); + } +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/clients/currency-converter-ws-jaxws/src/main/resources/wsdl/CurrencyConverter.wsdl b/sca-java-1.x/branches/sca-java-travelsample-1.0/clients/currency-converter-ws-jaxws/src/main/resources/wsdl/CurrencyConverter.wsdl new file mode 100644 index 0000000000..055431bbf2 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/clients/currency-converter-ws-jaxws/src/main/resources/wsdl/CurrencyConverter.wsdl @@ -0,0 +1,115 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + --> +<wsdl:definitions name="CurrencyConverterService" targetNamespace="http://currencyconverter.tuscanyscatours.com/" + xmlns:tns="http://currencyconverter.tuscanyscatours.com/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" + xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:SOAP="http://schemas.xmlsoap.org/wsdl/soap/" + xmlns:SOAP11="http://schemas.xmlsoap.org/wsdl/soap/"> + <wsdl:types> + <xs:schema attributeFormDefault="qualified" elementFormDefault="unqualified" targetNamespace="http://currencyconverter.tuscanyscatours.com/" xmlns:xs="http://www.w3.org/2001/XMLSchema"> + <xs:element name="getExchangeRate"> + <xs:complexType> + <xs:sequence> + <xs:element minOccurs="0" name="arg0" nillable="true" type="xs:string"/> + <xs:element minOccurs="0" name="arg1" nillable="true" type="xs:string"/> + </xs:sequence> + </xs:complexType> + </xs:element> + <xs:element name="convertResponse"> + <xs:complexType> + <xs:sequence> + <xs:element minOccurs="0" name="return" type="xs:double"/> + </xs:sequence> + </xs:complexType> + </xs:element> + <xs:element name="getExchangeRateResponse"> + <xs:complexType> + <xs:sequence> + <xs:element minOccurs="0" name="return" type="xs:double"/> + </xs:sequence> + </xs:complexType> + </xs:element> + <xs:element name="convert"> + <xs:complexType> + <xs:sequence> + <xs:element minOccurs="0" name="arg0" nillable="true" type="xs:string"/> + <xs:element minOccurs="0" name="arg1" nillable="true" type="xs:string"/> + <xs:element minOccurs="0" name="arg2" type="xs:double"/> + </xs:sequence> + </xs:complexType> + </xs:element> + </xs:schema> + </wsdl:types> + <wsdl:message name="getExchangeRate"> + <wsdl:part name="getExchangeRate" element="tns:getExchangeRate"> + </wsdl:part> + </wsdl:message> + <wsdl:message name="convertResponse"> + <wsdl:part name="convertResponse" element="tns:convertResponse"> + </wsdl:part> + </wsdl:message> + <wsdl:message name="getExchangeRateResponse"> + <wsdl:part name="getExchangeRateResponse" element="tns:getExchangeRateResponse"> + </wsdl:part> + </wsdl:message> + <wsdl:message name="convert"> + <wsdl:part name="convert" element="tns:convert"> + </wsdl:part> + </wsdl:message> + <wsdl:portType name="CurrencyConverter"> + <wsdl:operation name="getExchangeRate"> + <wsdl:input message="tns:getExchangeRate"> + </wsdl:input> + <wsdl:output message="tns:getExchangeRateResponse"> + </wsdl:output> + </wsdl:operation> + <wsdl:operation name="convert"> + <wsdl:input message="tns:convert"> + </wsdl:input> + <wsdl:output message="tns:convertResponse"> + </wsdl:output> + </wsdl:operation> + </wsdl:portType> + <wsdl:binding name="CurrencyConverterBinding" type="tns:CurrencyConverter"> + <SOAP:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/> + <wsdl:operation name="getExchangeRate"> + <SOAP:operation/> + <wsdl:input> + <SOAP:body use="literal"/> + </wsdl:input> + <wsdl:output> + <SOAP:body use="literal"/> + </wsdl:output> + </wsdl:operation> + <wsdl:operation name="convert"> + <SOAP:operation/> + <wsdl:input> + <SOAP:body use="literal"/> + </wsdl:input> + <wsdl:output> + <SOAP:body use="literal"/> + </wsdl:output> + </wsdl:operation> + </wsdl:binding> + <wsdl:service name="CurrencyConverterService"> + <wsdl:port name="CurrencyConverterPort" binding="tns:CurrencyConverterBinding"> + <SOAP:address location="http://localhost:8080/CurrencyConverter"/> + </wsdl:port> + </wsdl:service> +</wsdl:definitions> diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/clients/pom.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/clients/pom.xml new file mode 100644 index 0000000000..177da15528 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/clients/pom.xml @@ -0,0 +1,49 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <version>1.0-SNAPSHOT</version>
+ <artifactId>scatours-clients</artifactId>
+ <packaging>pom</packaging>
+ <name>Apache Tuscany SCA Tours non-SCA Clients</name>
+
+ <profiles>
+ <profile>
+ <id>default</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ <modules>
+ <module>currency-converter-corba</module>
+ <module>currency-converter-jms</module>
+ <module>currency-converter-rmi</module>
+ <module>currency-converter-ws-jaxws</module>
+ </modules>
+ </profile>
+
+ </profiles>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/blog-feed/build.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/blog-feed/build.xml new file mode 100644 index 0000000000..2f0f6b12a5 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/blog-feed/build.xml @@ -0,0 +1,22 @@ +<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<project name="scatours-contribution-blog-feed" default="compile">
+ <import file="../../antdefs.xml"/>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/blog-feed/pom.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/blog-feed/pom.xml new file mode 100644 index 0000000000..a7381b3c14 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/blog-feed/pom.xml @@ -0,0 +1,68 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent><version>1.0-SNAPSHOT</version>
+ <artifactId>scatours-contribution-blog-feed</artifactId>
+ <name>Apache Tuscany SCA Tours Blog Feed Contribution</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-data-api</artifactId>
+ <version>${tuscany.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-atom-abdera</artifactId>
+ <version>${tuscany.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-rss-rome</artifactId>
+ <version>${tuscany.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.5</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ </build>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/blog-feed/src/main/java/com/tuscanyscatours/blog/BlogPost.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/blog-feed/src/main/java/com/tuscanyscatours/blog/BlogPost.java new file mode 100644 index 0000000000..f93fe59b9d --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/blog-feed/src/main/java/com/tuscanyscatours/blog/BlogPost.java @@ -0,0 +1,68 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package com.tuscanyscatours.blog; + +import java.util.Date; + +/** + * Bean for blog posts. + */ +public class BlogPost { + + private final String author; + private final String title; + private final String content; + private final Date updated; + private final String link; + private final String related; + + public BlogPost(String author, String title, String content, Date updated, String link, String related) { + this.author = author; + this.title = title; + this.content = content; + this.updated = updated; + this.link = link; + this.related = related; + } + + public String getAuthor() { + return author; + } + + public String getTitle() { + return title; + } + + public String getContent() { + return content; + } + + public Date getUpdated() { + return updated; + } + + public String getLink() { + return link; + } + + public String getRelated() { + return related; + } +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/blog-feed/src/main/java/com/tuscanyscatours/blog/feed/impl/AtomBlogFeedImpl.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/blog-feed/src/main/java/com/tuscanyscatours/blog/feed/impl/AtomBlogFeedImpl.java new file mode 100644 index 0000000000..b7a392f927 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/blog-feed/src/main/java/com/tuscanyscatours/blog/feed/impl/AtomBlogFeedImpl.java @@ -0,0 +1,124 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package com.tuscanyscatours.blog.feed.impl; + +import java.util.List; + +import org.apache.abdera.Abdera; +import org.apache.abdera.factory.Factory; +import org.apache.abdera.model.Entry; +import org.apache.abdera.model.Feed; +import org.apache.tuscany.sca.binding.atom.collection.NotFoundException; + +import com.tuscanyscatours.blog.BlogPost; + +/** + * An Atom feed that implements the org.apache.tuscany.sca.binding.atom.collection.Collection + * interface and uses the Atom APIs to construct the Atom feed. + */ +public class AtomBlogFeedImpl extends BaseBlogFeedImpl implements + org.apache.tuscany.sca.binding.atom.collection.Collection { + + /** + * Gets an Atom feed containing all the blog posts. + * + * @return An Atom feed containing all the blog posts. + */ + public Feed getFeed() { + // Create SCA Tours blog Atom feed + final Factory factory = Abdera.getNewFactory(); + final Feed feed = factory.newFeed(); + feed.setTitle(FEED_TITLE); + feed.setSubtitle(FEED_DESCRIPTION); + feed.addAuthor(FEED_AUTHOR); + + // Get all blog posts and convert to Atom entries + final List<BlogPost> blogEntries = getAllBlogPosts(); + for (BlogPost blogEntry : blogEntries) { + final Entry entry = factory.newEntry(); + entry.setId(nextBlogID()); + entry.addAuthor(blogEntry.getAuthor()); + entry.setTitle(blogEntry.getTitle()); + entry.setContentAsHtml(blogEntry.getContent()); + entry.setUpdated(blogEntry.getUpdated()); + entry.addLink(blogEntry.getLink()); + feed.addEntry(entry); + } + + return feed; + } + + /** + * Query the feed. + * + * @param query The query + * @return Always returns null as method not implemented + */ + public Feed query(String query) { + // Not implemented + return null; + } + + /** + * Posts a new entry to the blog. + * + * @param entry The new entry + * @return Always returns null as method not implemented + */ + public Entry post(Entry entry) { + // Not implemented + return null; + } + + /** + * Gets the specified entry from the blog. + * + * @param id ID of the entry to get + * @return Not used + * @throws NotFoundException Always thrown as method not implemented + */ + public Entry get(String id) throws NotFoundException { + // Not implemented + throw new NotFoundException("You are not allowed to update entries"); + } + + /** + * Updates the specified entry on the blog. + * + * @param id ID of the entry to update + * @param entry The new entry + * @throws NotFoundException Always thrown as method not implemented + */ + public void put(String id, Entry entry) throws NotFoundException { + // Not implemented + throw new NotFoundException("You are not allowed to update entries"); + } + + /** + * Deletes the specified entry from the blog. + * + * @param id ID of the entry to delete + * @throws NotFoundException Always thrown as method not implemented + */ + public void delete(String id) throws NotFoundException { + // Not implemented + throw new NotFoundException("You are not allowed to delete entries"); + } +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/blog-feed/src/main/java/com/tuscanyscatours/blog/feed/impl/BaseBlogFeedImpl.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/blog-feed/src/main/java/com/tuscanyscatours/blog/feed/impl/BaseBlogFeedImpl.java new file mode 100644 index 0000000000..f132d340ea --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/blog-feed/src/main/java/com/tuscanyscatours/blog/feed/impl/BaseBlogFeedImpl.java @@ -0,0 +1,88 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package com.tuscanyscatours.blog.feed.impl; + +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import java.util.concurrent.atomic.AtomicInteger; + +import com.tuscanyscatours.blog.BlogPost; + +/** + * Base class for all blog feeds that provides the common methods + * that are shared by all the blog feed implementations. + */ +public abstract class BaseBlogFeedImpl { + + /** + * Title of the blog.feed. + */ + protected static final String FEED_TITLE = "Tuscany SCA Tours Blog Feed"; + + /** + * Description of the blog feed. + */ + protected static final String FEED_DESCRIPTION = "Feed contianing the latest blog posts from Tuscany SCA Tours"; + + /** + * Author of the blog feed. + */ + protected static final String FEED_AUTHOR = "SCA Tours CEO"; + + /** + * Used to generate unique IDs for the blog entries. + */ + protected static final AtomicInteger ID_GEN = new AtomicInteger(); + + /** + * Generates the next blog entry ID. + * + * @return Next blog entry ID + */ + protected String nextBlogID() { + return Integer.toString(ID_GEN.incrementAndGet()); + } + + /** + * Retrieves a list of all blog posts. + * + * @return A list of all blog posts. + */ + public List<BlogPost> getAllBlogPosts() { + // Note: To keep things simple, we will just hard code a sample post. + // A proper implementation would load all blog posts from some resource + // such as files or a database. + List<BlogPost> blogEntries = new ArrayList<BlogPost>(); + + // Create a sample entry + final BlogPost samplePost = + new BlogPost( + FEED_AUTHOR, + "Apache Tuscany in Action book features SCA Tours", + "We are famous as SCA Tours has been featured in the Apache Tuscany in Action book published by Manning", + new Date(), "http://www.manning.com/laws/", null); + + // Add sample post to the list of posts + blogEntries.add(samplePost); + + return blogEntries; + } +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/blog-feed/src/main/java/com/tuscanyscatours/blog/feed/impl/GenericBlogFeedImpl.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/blog-feed/src/main/java/com/tuscanyscatours/blog/feed/impl/GenericBlogFeedImpl.java new file mode 100644 index 0000000000..c427b658a4 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/blog-feed/src/main/java/com/tuscanyscatours/blog/feed/impl/GenericBlogFeedImpl.java @@ -0,0 +1,70 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package com.tuscanyscatours.blog.feed.impl; + +import java.util.List; + +import org.apache.tuscany.sca.data.collection.Entry; +import org.apache.tuscany.sca.data.collection.Item; + +import com.tuscanyscatours.blog.BlogPost; + +/** + * Implementation of the blog feed that uses the Tuscany Data API so + * that it is independent of any Feed APIs such as Atom and RSS. + */ +public class GenericBlogFeedImpl extends BaseBlogFeedImpl { + + /** + * Implementation of the getAll() method from the Tuscany API + * that will return all of the blog posts as generic Tuscany + * feed items. + * + * @return All blog entries + */ + public Entry<Object, Object>[] getAll() { + final List<BlogPost> posts = getAllBlogPosts(); + + final Entry<Object, Object>[] entries = new Entry[posts.size()]; + int i = 0; + for (BlogPost post : posts) { + entries[i++] = convertBlogPostToFeedItem(post); + } + + return entries; + } + + /** + * Converts a blog post to a Tuscany API feed item. + * + * @param post The blog post to convert + * @return The blog post as a Tuscany API feed item + */ + private Entry<Object, Object> convertBlogPostToFeedItem(BlogPost post) { + // Convert Blog entry into an Item + final Item item = + new Item(post.getTitle(), post.getContent(), post.getLink(), post.getRelated(), post.getUpdated()); + + // Add item to entry + final Entry<Object, Object> entry = new Entry<Object, Object>(nextBlogID(), item); + + return entry; + } +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/blog-feed/src/main/java/com/tuscanyscatours/blog/feed/impl/RSSBlogFeedImpl.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/blog-feed/src/main/java/com/tuscanyscatours/blog/feed/impl/RSSBlogFeedImpl.java new file mode 100644 index 0000000000..efccffef67 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/blog-feed/src/main/java/com/tuscanyscatours/blog/feed/impl/RSSBlogFeedImpl.java @@ -0,0 +1,94 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package com.tuscanyscatours.blog.feed.impl; + +import java.util.List; + +import org.apache.tuscany.sca.binding.rss.collection.NotFoundException; + +import com.sun.syndication.feed.synd.SyndContent; +import com.sun.syndication.feed.synd.SyndContentImpl; +import com.sun.syndication.feed.synd.SyndEntry; +import com.sun.syndication.feed.synd.SyndEntryImpl; +import com.sun.syndication.feed.synd.SyndFeed; +import com.sun.syndication.feed.synd.SyndFeedImpl; +import com.tuscanyscatours.blog.BlogPost; + +/** + * An RSS feed that implements the org.apache.tuscany.sca.binding.rss.collection.Collection + * interface and uses the RSS APIs to construct the RSS feed. + */ +public class RSSBlogFeedImpl extends BaseBlogFeedImpl implements + org.apache.tuscany.sca.binding.rss.collection.Collection { + + /** + * Gets an RSS feed containing all the blog posts. + * + * @return An RSS feed containing all the blog posts. + */ + public SyndFeed getFeed() { + // Create SCA Tours blog RSS feed + SyndFeed feed = new SyndFeedImpl(); + feed.setTitle(FEED_TITLE); + feed.setDescription(FEED_DESCRIPTION); + feed.setAuthor(FEED_AUTHOR); + + // Get all blog posts and convert to RSS entries + final List<BlogPost> blogEntries = getAllBlogPosts(); + for (BlogPost blogEntry : blogEntries) { + SyndEntry entry = new SyndEntryImpl(); + entry.setUri(nextBlogID()); + entry.setAuthor(blogEntry.getAuthor()); + entry.setTitle(blogEntry.getTitle()); + + SyndContent content = new SyndContentImpl(); + content.setType("text"); + content.setValue(blogEntry.getContent()); + + entry.setPublishedDate(blogEntry.getUpdated()); + entry.setLink(blogEntry.getLink()); + + feed.getEntries().add(entry); + } + + return feed; + } + + /** + * Query the feed. + * + * @param query The query + * @return Always returns null as method not implemented + */ + public SyndFeed query(String query) { + // Not implemented + return null; + } + + public SyndEntry get(String id) throws NotFoundException { + // Not implemented + return null; + } + + public List<SyndEntry> getAll() throws NotFoundException { + // Not implemented + return null; + } +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/blog-feed/src/main/resources/META-INF/sca-contribution.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/blog-feed/src/main/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..b4152d6e3f --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/blog-feed/src/main/resources/META-INF/sca-contribution.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0">
+</contribution>
\ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/blog-feed/src/main/resources/blog-feed.composite b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/blog-feed/src/main/resources/blog-feed.composite new file mode 100644 index 0000000000..751fd33cd2 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/blog-feed/src/main/resources/blog-feed.composite @@ -0,0 +1,58 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ targetNamespace="http://tuscanyscatours.com/"
+ name="blogFeed">
+
+ <!-- Example that shows using the Tuscany Data APIs to create a feed that -->
+ <!-- is independent of the Feed API -->
+ <service name="BlogAtom" promote="BlogFeed">
+ <tuscany:binding.atom uri="http://localhost:8090/BlogAtom"/>
+ </service>
+
+ <service name="BlogRSS" promote="BlogFeed">
+ <tuscany:binding.rss uri="http://localhost:8090/BlogRSS"/>
+ </service>
+
+ <component name="BlogFeed">
+ <implementation.java class="com.tuscanyscatours.blog.feed.impl.GenericBlogFeedImpl"/>
+ </component>
+
+ <!-- Example that shows using the Atom Collections API to create a feed that -->
+ <!-- uses the Atom APIs -->
+ <service name="BlogAtomAPIs" promote="BlogAtom">
+ <tuscany:binding.atom uri="http://localhost:8090/BlogAtomAPIs"/>
+ </service>
+
+ <component name="BlogAtom">
+ <implementation.java class="com.tuscanyscatours.blog.feed.impl.AtomBlogFeedImpl"/>
+ </component>
+
+ <!-- Example that shows using the RSS Collections API to create a feed that -->
+ <!-- uses the RSS APIs -->
+ <service name="BlogRSSAPIs" promote="BlogRSS">
+ <tuscany:binding.rss uri="http://localhost:8090/BlogRSSAPIs"/>
+ </service>
+
+ <component name="BlogRSS">
+ <implementation.java class="com.tuscanyscatours.blog.feed.impl.RSSBlogFeedImpl"/>
+ </component>
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/build.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/build.xml new file mode 100644 index 0000000000..126fcfe04d --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/build.xml @@ -0,0 +1,102 @@ +<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<project name="scatours-contributions" default="compile">
+
+ <target name="compile">
+ <antcall target="allsubdirs">
+ <param name="target" value="compile"/>
+ </antcall>
+ </target>
+
+ <target name="test">
+ <antcall target="allsubdirs">
+ <param name="target" value="test"/>
+ </antcall>
+ </target>
+
+ <target name="clean">
+ <antcall target="allsubdirs">
+ <param name="target" value="clean"/>
+ </antcall>
+ </target>
+
+ <target name="allsubdirs">
+ <ant dir="blog-feed" target="${target}"/>
+ <ant dir="introducing-trips" target="${target}"/> <!--needed by buildingblocks-->
+ <ant dir="buildingblocks" target="${target}"/>
+ <ant dir="buildingblocks-client" target="${target}"/>
+ <ant dir="calendar" target="${target}"/>
+ <ant dir="common" target="${target}"/> <!--needed by car-->
+ <ant dir="car" target="${target}"/>
+ <ant dir="creditcard-payment-jaxb" target="${target}"/>
+ <ant dir="creditcard-payment-jaxb-policy" target="${target}"/>
+ <ant dir="creditcard-payment-sdo" target="${target}"/>
+ <ant dir="creditcard-payment-webapp" target="${target}"/>
+ <ant dir="currency" target="${target}"/>
+ <ant dir="currency-corba" target="${target}"/>
+ <ant dir="currency-jms" target="${target}"/>
+ <ant dir="currency-jsp" target="${target}"/>
+ <ant dir="currency-rmi" target="${target}"/>
+ <ant dir="currency-servlet" target="${target}"/>
+ <ant dir="currency-ws" target="${target}"/>
+ <ant dir="payment-java" target="${target}"/> <!--needed by databinding-client-->
+ <ant dir="databinding-client" target="${target}"/>
+ <ant dir="emailgateway" target="${target}"/>
+ <ant dir="feed-logger" target="${target}"/>
+ <ant dir="flight" target="${target}"/>
+ <ant dir="fullapp-bespoketrip" target="${target}"/>
+ <ant dir="fullapp-coordination" target="${target}"/>
+ <ant dir="fullapp-currency" target="${target}"/>
+ <ant dir="fullapp-packagedtrip" target="${target}"/>
+ <ant dir="fullapp-shoppingcart" target="${target}"/>
+ <ant dir="fullapp-ui" target="${target}"/>
+ <ant dir="help-pages" target="${target}"/>
+ <ant dir="hotel" target="${target}"/>
+ <ant dir="shoppingcart" target="${target}"/> <!--needed by interaction-client-->
+ <ant dir="interaction-client" target="${target}"/>
+ <ant dir="interaction-service-remote" target="${target}"/>
+ <ant dir="introducing-tours" target="${target}"/> <!--needed by introducing-client-->
+ <ant dir="introducing-client" target="${target}"/>
+ <ant dir="notification" target="${target}"/>
+ <ant dir="notification-corba" target="${target}"/>
+ <ant dir="notification-ejb" target="${target}"/>
+ <ant dir="notification-jms" target="${target}"/>
+ <ant dir="notification-rmi" target="${target}"/>
+ <ant dir="notification-ws" target="${target}"/>
+ <ant dir="payment-java-callback" target="${target}"/>
+ <ant dir="payment-java-policy" target="${target}"/>
+ <ant dir="payment-java-reference-pass" target="${target}"/>
+ <ant dir="payment-bpel-process" target="${target}"/> <!--needed by payment-bpel-->
+ <ant dir="payment-bpel" target="${target}"/>
+ <ant dir="payment-groovy" target="${target}"/>
+ <ant dir="payment-python" target="${target}"/>
+ <ant dir="payment-spring" target="${target}"/>
+ <ant dir="payment-spring-policy" target="${target}"/>
+ <ant dir="payment-spring-scatag" target="${target}"/>
+ <ant dir="policy-client" target="${target}"/>
+ <ant dir="travelcatalog" target="${target}"/> <!--needed by scatours-->
+ <ant dir="tripbooking" target="${target}"/> <!--needed by scatours-->
+ <ant dir="scatours" target="${target}"/>
+ <ant dir="trip" target="${target}"/>
+ <ant dir="trip-policy" target="${target}"/>
+ <ant dir="using" target="${target}"/>
+ </target>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/buildingblocks-client/build.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/buildingblocks-client/build.xml new file mode 100644 index 0000000000..9ea7438516 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/buildingblocks-client/build.xml @@ -0,0 +1,22 @@ +<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<project name="scatours-contribution-buildingblocks-client" default="compile">
+ <import file="../../antdefs.xml"/>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/buildingblocks-client/pom.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/buildingblocks-client/pom.xml new file mode 100644 index 0000000000..20a5d8bce4 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/buildingblocks-client/pom.xml @@ -0,0 +1,125 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent><version>1.0-SNAPSHOT</version>
+ <artifactId>scatours-contribution-buildingblocks-client</artifactId>
+ <name>Apache Tuscany SCA Tours Building Blocks Client Contribution</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca-api</artifactId>
+ <version>${tuscany.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-contribution-buildingblocks</artifactId>
+ <version>${pom.version}</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-contribution-introducing-trips</artifactId>
+ <version>${pom.version}</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-axis2</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-jms-runtime</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node-api</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-node-runtime</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-jetty</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-jms-asf</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>activemq-all</artifactId>
+ <version>5.2.0</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>activemq-web-demo</artifactId>
+ </exclusion>
+ </exclusions>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.5</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ </build>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/buildingblocks-client/src/main/java/scatours/Bookings.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/buildingblocks-client/src/main/java/scatours/Bookings.java new file mode 100644 index 0000000000..e5e994b73c --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/buildingblocks-client/src/main/java/scatours/Bookings.java @@ -0,0 +1,26 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package scatours;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface Bookings {
+ String newBooking(String trip, int people);
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/buildingblocks-client/src/main/java/scatours/Checkout.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/buildingblocks-client/src/main/java/scatours/Checkout.java new file mode 100644 index 0000000000..519b7779fa --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/buildingblocks-client/src/main/java/scatours/Checkout.java @@ -0,0 +1,28 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package scatours;
+
+import java.math.BigDecimal;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface Checkout {
+ void makePayment(BigDecimal amount, String cardInfo);
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/buildingblocks-client/src/main/java/scatours/impl/ApplClientImpl.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/buildingblocks-client/src/main/java/scatours/impl/ApplClientImpl.java new file mode 100644 index 0000000000..278673c67d --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/buildingblocks-client/src/main/java/scatours/impl/ApplClientImpl.java @@ -0,0 +1,52 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package scatours.impl;
+
+import java.math.BigDecimal;
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+import scatours.Bookings;
+import scatours.Checkout;
+
+@Service(Runnable.class)
+public class ApplClientImpl {
+ @Reference
+ protected Bookings bookings1, bookings2;
+
+ @Reference
+ protected Checkout checkout1, checkout2;
+
+ public ApplClientImpl() {
+ }
+
+ public void run() {
+ String bookingCode = bookings1.newBooking("FS1APR4", 1);
+ System.out.println("Booking code is " + bookingCode);
+
+ checkout1.makePayment(new BigDecimal("1995.00"), "1234567843218765 10/10");
+
+ bookingCode = bookings2.newBooking("AC3MAY9", 2);
+ System.out.println("Booking code is " + bookingCode);
+
+ checkout2.makePayment(new BigDecimal("2295.00"), "9876123456784321 11/11");
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/buildingblocks-client/src/main/java/scatours/impl/ToursClientImpl.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/buildingblocks-client/src/main/java/scatours/impl/ToursClientImpl.java new file mode 100644 index 0000000000..16934872b9 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/buildingblocks-client/src/main/java/scatours/impl/ToursClientImpl.java @@ -0,0 +1,47 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package scatours.impl;
+
+import java.math.BigDecimal;
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+import scatours.Bookings;
+import scatours.Checkout;
+
+@Service(Runnable.class)
+public class ToursClientImpl {
+ @Reference
+ protected Bookings bookings;
+
+ @Reference
+ protected Checkout checkout;
+
+ public ToursClientImpl() {
+ }
+
+ public void run() {
+ String bookingCode = bookings.newBooking("FS1APR4", 1);
+ System.out.println("Booking code is " + bookingCode);
+
+ checkout.makePayment(new BigDecimal("1995.00"), "1234567843218765 10/10");
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/buildingblocks-client/src/main/resources/META-INF/sca-contribution.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/buildingblocks-client/src/main/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..e3f6effcee --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/buildingblocks-client/src/main/resources/META-INF/sca-contribution.xml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:tst="http://tuscanyscatours.com/">
+ <import namespace="http://tuscanyscatours.com/" />
+ <deployable composite="tst:ToursApplClient" />
+ <deployable composite="tst:ToursImplClient" />
+ <deployable composite="tst:ToursImplIncludeClient" />
+</contribution>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/buildingblocks-client/src/main/resources/tours-appl-client.composite b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/buildingblocks-client/src/main/resources/tours-appl-client.composite new file mode 100644 index 0000000000..b9f9d59f43 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/buildingblocks-client/src/main/resources/tours-appl-client.composite @@ -0,0 +1,40 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://tuscanyscatours.com/"
+ xmlns:tst="http://tuscanyscatours.com/"
+ name="ToursApplClient">
+
+ <component name="ApplClient">
+ <implementation.java class="scatours.impl.ApplClientImpl" />
+ <reference name="bookings1">
+ <binding.ws uri="http://localhost:8081/BookTrip" />
+ </reference>
+ <reference name="checkout1">
+ <binding.ws uri="http://localhost:8081/Checkout" />
+ </reference>
+ <reference name="bookings2">
+ <binding.jms uri="jms:BookTrip" />
+ </reference>
+ <reference name="checkout2">
+ <binding.jms uri="jms:Checkout" />
+ </reference>
+ </component>
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/buildingblocks-client/src/main/resources/tours-impl-client.composite b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/buildingblocks-client/src/main/resources/tours-impl-client.composite new file mode 100644 index 0000000000..f8f0b3d4d1 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/buildingblocks-client/src/main/resources/tours-impl-client.composite @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://tuscanyscatours.com/"
+ xmlns:tst="http://tuscanyscatours.com/"
+ name="ToursImplClient">
+
+ <component name="ToursClient">
+ <implementation.java class="scatours.impl.ToursClientImpl" />
+ <reference name="bookings" target="MyTours/BookTrip" />
+ <reference name="checkout" target="MyTours/Checkout" />
+ </component>
+
+ <include name="tst:ToursImpl" />
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/buildingblocks-client/src/main/resources/tours-impl-include-client.composite b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/buildingblocks-client/src/main/resources/tours-impl-include-client.composite new file mode 100644 index 0000000000..7310d0540d --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/buildingblocks-client/src/main/resources/tours-impl-include-client.composite @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://tuscanyscatours.com/"
+ xmlns:tst="http://tuscanyscatours.com/"
+ name="ToursImplIncludeClient">
+
+ <component name="ToursClient">
+ <implementation.java class="scatours.impl.ToursClientImpl" />
+ <reference name="bookings" target="MyTours/BookTrip" />
+ <reference name="checkout" target="MyTours/Checkout" />
+ </component>
+
+ <include name="tst:ToursImplInclude" />
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/buildingblocks-client/src/test/java/scatours/BuildingBlocksApplTestCase.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/buildingblocks-client/src/test/java/scatours/BuildingBlocksApplTestCase.java new file mode 100644 index 0000000000..2cf08ec420 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/buildingblocks-client/src/test/java/scatours/BuildingBlocksApplTestCase.java @@ -0,0 +1,77 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package scatours;
+
+import org.apache.activemq.broker.BrokerService;
+
+import org.apache.tuscany.sca.node.SCAClient;
+import org.apache.tuscany.sca.node.SCAContribution;
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.SCANodeFactory;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Tests the Building Blocks Composite Application scenario
+ */
+public class BuildingBlocksApplTestCase {
+
+ private BrokerService jmsBroker;
+ private SCANode node1, node2;
+
+ @Before
+ public void startServer() throws Exception {
+ jmsBroker = new BrokerService();
+ jmsBroker.setPersistent(false);
+ jmsBroker.setUseJmx(false);
+ jmsBroker.addConnector("tcp://localhost:61619");
+
+ node1 = SCANodeFactory.newInstance().createSCANode("tours-appl.composite",
+ new SCAContribution("introducing-trips", "../introducing-trips/target/classes"),
+ new SCAContribution("buildingblocks", "../buildingblocks/target/classes"));
+
+ node2 = SCANodeFactory.newInstance().createSCANode("tours-appl-client.composite",
+ new SCAContribution("buildingblocks-client", "./target/classes"));
+
+ jmsBroker.start();
+ node1.start();
+ node2.start();
+ }
+
+ @Test
+ public void testAppl() {
+ Runnable client = ((SCAClient)node2).getService(Runnable.class, "ApplClient/Runnable");
+ client.run();
+ }
+
+ @After
+ public void stopServer() throws Exception {
+ if (node2 != null) {
+ node2.stop();
+ }
+ if (node1 != null) {
+ node1.stop();
+ }
+ if (jmsBroker != null) {
+ jmsBroker.stop();
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/buildingblocks-client/src/test/java/scatours/BuildingBlocksImplIncludeTestCase.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/buildingblocks-client/src/test/java/scatours/BuildingBlocksImplIncludeTestCase.java new file mode 100644 index 0000000000..ad48db5616 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/buildingblocks-client/src/test/java/scatours/BuildingBlocksImplIncludeTestCase.java @@ -0,0 +1,59 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package scatours;
+
+import org.apache.tuscany.sca.node.SCAClient;
+import org.apache.tuscany.sca.node.SCAContribution;
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.SCANodeFactory;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Tests the Building Blocks Composite Implementation Include scenario
+ */
+public class BuildingBlocksImplIncludeTestCase {
+
+ private SCANode node;
+
+ @Before
+ public void startServer() throws Exception {
+ node = SCANodeFactory.newInstance().createSCANode("tours-impl-include-client.composite",
+ new SCAContribution("introducing-trips", "../introducing-trips/target/classes"),
+ new SCAContribution("buildingblocks", "../buildingblocks/target/classes"),
+ new SCAContribution("buildingblocks-client", "./target/classes"));
+
+ node.start();
+ }
+
+ @Test
+ public void testImplInclude() {
+ Runnable client = ((SCAClient)node).getService(Runnable.class, "ToursClient/Runnable");
+ client.run();
+ }
+
+ @After
+ public void stopServer() throws Exception {
+ if (node != null) {
+ node.stop();
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/buildingblocks-client/src/test/java/scatours/BuildingBlocksImplTestCase.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/buildingblocks-client/src/test/java/scatours/BuildingBlocksImplTestCase.java new file mode 100644 index 0000000000..c4cffa3e02 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/buildingblocks-client/src/test/java/scatours/BuildingBlocksImplTestCase.java @@ -0,0 +1,58 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package scatours;
+
+import org.apache.tuscany.sca.node.SCAClient;
+import org.apache.tuscany.sca.node.SCAContribution;
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.SCANodeFactory;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Tests the Building Blocks Composite Implementation scenario
+ */
+public class BuildingBlocksImplTestCase {
+
+ private SCANode node;
+
+ @Before
+ public void startServer() throws Exception {
+ node = SCANodeFactory.newInstance().createSCANode("tours-impl-client.composite",
+ new SCAContribution("buildingblocks", "../buildingblocks/target/classes"),
+ new SCAContribution("buildingblocks-client", "./target/classes"));
+
+ node.start();
+ }
+
+ @Test
+ public void testImpl() {
+ Runnable client = ((SCAClient)node).getService(Runnable.class, "ToursClient/Runnable");
+ client.run();
+ }
+
+ @After
+ public void stopServer() throws Exception {
+ if (node != null) {
+ node.stop();
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/buildingblocks-client/src/test/resources/jndi.properties b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/buildingblocks-client/src/test/resources/jndi.properties new file mode 100644 index 0000000000..88270fd1e0 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/buildingblocks-client/src/test/resources/jndi.properties @@ -0,0 +1,39 @@ +## ---------------------------------------------------------------------------
+## Licensed to the Apache Software Foundation (ASF) under one or more
+## contributor license agreements. See the NOTICE file distributed with
+## this work for additional information regarding copyright ownership.
+## The ASF licenses this file to You under the Apache License, Version 2.0
+## (the "License"); you may not use this file except in compliance with
+## the License. You may obtain a copy of the License at
+##
+## http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing, software
+## distributed under the License is distributed on an "AS IS" BASIS,
+## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+## See the License for the specific language governing permissions and
+## limitations under the License.
+## ---------------------------------------------------------------------------
+
+# START SNIPPET: jndi
+
+java.naming.factory.initial = org.apache.activemq.jndi.ActiveMQInitialContextFactory
+
+# use the following property to configure the default connector
+java.naming.provider.url = vm://localhost?broker.persistent=false
+
+# use the following property to specify the JNDI name the connection factory
+# should appear as.
+#connectionFactoryNames = connectionFactory, queueConnectionFactory, topicConnectionFactry
+connectionFactoryNames = ConnectionFactory
+
+# register some queues in JNDI using the form
+# queue.[jndiName] = [physicalName]
+queue.BookTrip = BookTripRequestQueue
+queue.Checkout = CheckoutRequestQueue
+
+# register some topics in JNDI using the form
+# topic.[jndiName] = [physicalName]
+#topic.MyTopic = example.MyTopic
+
+# END SNIPPET: jndi
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/buildingblocks/build.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/buildingblocks/build.xml new file mode 100644 index 0000000000..1e23144229 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/buildingblocks/build.xml @@ -0,0 +1,22 @@ +<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<project name="scatours-contribution-buildingblocks" default="compile">
+ <import file="../../antdefs.xml"/>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/buildingblocks/pom.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/buildingblocks/pom.xml new file mode 100644 index 0000000000..32985041a7 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/buildingblocks/pom.xml @@ -0,0 +1,91 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent><version>1.0-SNAPSHOT</version>
+ <artifactId>scatours-contribution-buildingblocks</artifactId>
+ <name>Apache Tuscany SCA Tours Building Blocks Contribution</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca-api</artifactId>
+ <version>${tuscany.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-axis2</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-jms-runtime</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-contribution-introducing-trips</artifactId>
+ <version>${pom.version}</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node-api</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-node-runtime</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.5</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ </build>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/buildingblocks/src/main/java/com/budgettours/Tours.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/buildingblocks/src/main/java/com/budgettours/Tours.java new file mode 100644 index 0000000000..38ddc1f099 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/buildingblocks/src/main/java/com/budgettours/Tours.java @@ -0,0 +1,26 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package com.budgettours;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface Tours {
+ String checkAvailability(String trip, int people);
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/buildingblocks/src/main/java/com/budgettours/impl/TourProviderImpl.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/buildingblocks/src/main/java/com/budgettours/impl/TourProviderImpl.java new file mode 100644 index 0000000000..8e48625f0c --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/buildingblocks/src/main/java/com/budgettours/impl/TourProviderImpl.java @@ -0,0 +1,28 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package com.budgettours.impl;
+
+import com.budgettours.Tours;
+
+public class TourProviderImpl implements Tours {
+ public String checkAvailability(String trip, int people) {
+ // call non-SCA code to reserve trip and return booking code
+ return "5Q87X";
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/buildingblocks/src/main/java/com/goodvaluetrips/Trips.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/buildingblocks/src/main/java/com/goodvaluetrips/Trips.java new file mode 100644 index 0000000000..365a210368 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/buildingblocks/src/main/java/com/goodvaluetrips/Trips.java @@ -0,0 +1,26 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package com.goodvaluetrips;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface Trips {
+ String checkAvailability(String trip, int people);
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/buildingblocks/src/main/java/com/tuscanyscatours/Bookings.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/buildingblocks/src/main/java/com/tuscanyscatours/Bookings.java new file mode 100644 index 0000000000..9d54d46bb6 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/buildingblocks/src/main/java/com/tuscanyscatours/Bookings.java @@ -0,0 +1,26 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package com.tuscanyscatours;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface Bookings {
+ String newBooking(String trip, int people);
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/buildingblocks/src/main/java/com/tuscanyscatours/Checkout.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/buildingblocks/src/main/java/com/tuscanyscatours/Checkout.java new file mode 100644 index 0000000000..29c84d2bc0 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/buildingblocks/src/main/java/com/tuscanyscatours/Checkout.java @@ -0,0 +1,28 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package com.tuscanyscatours;
+
+import java.math.BigDecimal;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface Checkout {
+ void makePayment(BigDecimal amount, String cardInfo);
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/buildingblocks/src/main/java/com/tuscanyscatours/Updates.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/buildingblocks/src/main/java/com/tuscanyscatours/Updates.java new file mode 100644 index 0000000000..e33b0399cb --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/buildingblocks/src/main/java/com/tuscanyscatours/Updates.java @@ -0,0 +1,26 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package com.tuscanyscatours;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface Updates {
+ void addTrip(String resCode);
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/buildingblocks/src/main/java/com/tuscanyscatours/impl/ShoppingCartImpl.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/buildingblocks/src/main/java/com/tuscanyscatours/impl/ShoppingCartImpl.java new file mode 100644 index 0000000000..629ea7b5ec --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/buildingblocks/src/main/java/com/tuscanyscatours/impl/ShoppingCartImpl.java @@ -0,0 +1,49 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package com.tuscanyscatours.impl;
+
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.List;
+
+import com.tuscanyscatours.Checkout;
+import com.tuscanyscatours.Updates;
+
+public class ShoppingCartImpl implements Checkout, Updates {
+ private static List<String> bookedTrips = new ArrayList<String>();
+
+ protected String currency = "USD";
+
+ public void makePayment(BigDecimal amount, String cardInfo) {
+ System.out.print("Charged " + currency + " " + amount
+ + " to card "
+ + cardInfo
+ + " for "
+ + (bookedTrips.size() > 1 ? "trips" : "trip"));
+ for (String trip : bookedTrips) {
+ System.out.print(" " + trip);
+ }
+ System.out.println();
+ bookedTrips.clear();
+ }
+
+ public void addTrip(String resCode) {
+ bookedTrips.add(resCode);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/buildingblocks/src/main/java/com/tuscanyscatours/impl/TripBookingImpl.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/buildingblocks/src/main/java/com/tuscanyscatours/impl/TripBookingImpl.java new file mode 100644 index 0000000000..f2884f87c5 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/buildingblocks/src/main/java/com/tuscanyscatours/impl/TripBookingImpl.java @@ -0,0 +1,39 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package com.tuscanyscatours.impl;
+
+import org.osoa.sca.annotations.Reference;
+
+import com.goodvaluetrips.Trips;
+import com.tuscanyscatours.Bookings;
+import com.tuscanyscatours.Updates;
+
+public class TripBookingImpl implements Bookings {
+ @Reference
+ protected Trips mytrips;
+
+ @Reference
+ protected Updates cart;
+
+ public String newBooking(String trip, int people) {
+ String resCode = mytrips.checkAvailability(trip, people);
+ cart.addTrip(resCode);
+ return "GV" + resCode;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/buildingblocks/src/main/java/scatours/impl/TripProviderImpl.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/buildingblocks/src/main/java/scatours/impl/TripProviderImpl.java new file mode 100644 index 0000000000..a95f01c519 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/buildingblocks/src/main/java/scatours/impl/TripProviderImpl.java @@ -0,0 +1,28 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package scatours.impl;
+
+import com.goodvaluetrips.Trips;
+
+public class TripProviderImpl implements Trips {
+ public String checkAvailability(String trip, int people) {
+ // scaffolded test code to return an arbitrary booking code
+ return "7S09Z";
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/buildingblocks/src/main/resources/META-INF/sca-contribution.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/buildingblocks/src/main/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..028c41e415 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/buildingblocks/src/main/resources/META-INF/sca-contribution.xml @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:tst="http://tuscanyscatours.com/">
+ <import namespace="http://goodvaluetrips.com/" />
+ <export namespace="http://tuscanyscatours.com/" />
+ <deployable composite="tst:ToursAppl" />
+ <deployable composite="tst:ToursImpl" />
+ <deployable composite="tst:ToursImplInclude" />
+</contribution>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/buildingblocks/src/main/resources/tours-appl.composite b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/buildingblocks/src/main/resources/tours-appl.composite new file mode 100644 index 0000000000..8733c79c5d --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/buildingblocks/src/main/resources/tours-appl.composite @@ -0,0 +1,54 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://tuscanyscatours.com/"
+ xmlns:bb="http://bb.tuscanyscatours.com/"
+ xmlns:gvt="http://goodvaluetrips.com/"
+ name="ToursAppl">
+
+ <component name="WSTours">
+ <implementation.composite name="bb:Tours" />
+ <service name="BookTrip">
+ <binding.ws uri="http://localhost:8081/BookTrip" />
+ </service>
+ <service name="Checkout">
+ <binding.ws uri="http://localhost:8081/Checkout" />
+ </service>
+ <reference name="trips" target="TripProvider/Trips" />
+ </component>
+
+ <component name="JMSTours">
+ <implementation.composite name="bb:Tours" />
+ <service name="BookTrip">
+ <binding.jms uri="jms:BookTrip" />
+ </service>
+ <service name="Checkout">
+ <binding.jms uri="jms:Checkout" />
+ </service>
+ <reference name="trips" target="TourProvider/Tours" />
+ </component>
+
+ <include name="gvt:Trips" />
+
+ <component name="TourProvider">
+ <implementation.java class="com.budgettours.impl.TourProviderImpl" />
+ <service name="Tours" />
+ </component>
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/buildingblocks/src/main/resources/tours-impl-include.composite b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/buildingblocks/src/main/resources/tours-impl-include.composite new file mode 100644 index 0000000000..4080523309 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/buildingblocks/src/main/resources/tours-impl-include.composite @@ -0,0 +1,33 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://tuscanyscatours.com/"
+ xmlns:bb="http://bb.tuscanyscatours.com/"
+ xmlns:gvt="http://goodvaluetrips.com/"
+ name="ToursImplInclude">
+
+ <component name="MyTours">
+ <implementation.composite name="bb:Tours" />
+ <reference name="trips" target="TripProvider/Trips" />
+ <property name="currency">GBP</property>
+ </component>
+
+ <include name="gvt:Trips" />
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/buildingblocks/src/main/resources/tours-impl.composite b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/buildingblocks/src/main/resources/tours-impl.composite new file mode 100644 index 0000000000..1d82858f22 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/buildingblocks/src/main/resources/tours-impl.composite @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://tuscanyscatours.com/"
+ xmlns:bb="http://bb.tuscanyscatours.com/"
+ name="ToursImpl">
+
+ <component name="MyTours">
+ <implementation.composite name="bb:Tours" />
+ <reference name="trips" target="TripProvider/Trips" />
+ <property name="currency">GBP</property>
+ </component>
+
+ <component name="TripProvider">
+ <implementation.java class="scatours.impl.TripProviderImpl" />
+ </component>
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/buildingblocks/src/main/resources/tours.composite b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/buildingblocks/src/main/resources/tours.composite new file mode 100644 index 0000000000..b66d2344cd --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/buildingblocks/src/main/resources/tours.composite @@ -0,0 +1,43 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://bb.tuscanyscatours.com/"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ name="Tours">
+
+ <service name="BookTrip" promote="TripBooking/Bookings" />
+ <service name="Checkout" promote="ShoppingCart/Checkout" />
+ <reference name="trips" promote="TripBooking/mytrips" />
+ <property name="currency" type="xs:string">USD</property>
+
+ <component name="TripBooking">
+ <implementation.java class="com.tuscanyscatours.impl.TripBookingImpl" />
+ <service name="Bookings" />
+ <reference name="mytrips" />
+ <reference name="cart" target="ShoppingCart/Updates" />
+ </component>
+
+ <component name="ShoppingCart">
+ <implementation.java class="com.tuscanyscatours.impl.ShoppingCartImpl"/>
+ <service name="Updates" />
+ <service name="Checkout" />
+ <property name="currency" source="$currency"/>
+ </component>
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/buildingblocks/src/test/java/scatours/BuildingBlocksImplIncludeTestCase.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/buildingblocks/src/test/java/scatours/BuildingBlocksImplIncludeTestCase.java new file mode 100644 index 0000000000..ccdd2a73bd --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/buildingblocks/src/test/java/scatours/BuildingBlocksImplIncludeTestCase.java @@ -0,0 +1,66 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package scatours;
+
+import java.math.BigDecimal;
+
+import com.tuscanyscatours.Bookings;
+import com.tuscanyscatours.Checkout;
+
+import org.apache.tuscany.sca.node.SCAClient;
+import org.apache.tuscany.sca.node.SCAContribution;
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.SCANodeFactory;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Tests the Building Blocks Composite Implementation Include scenario
+ */
+public class BuildingBlocksImplIncludeTestCase {
+
+ private SCANode node;
+
+ @Before
+ public void startServer() throws Exception {
+ node = SCANodeFactory.newInstance().createSCANode("tours-impl-include.composite",
+ new SCAContribution("introducing-trips", "../introducing-trips/target/classes"),
+ new SCAContribution("buildingblocks", "./target/classes"));
+ node.start();
+ }
+
+ @Test
+ public void testImplInclude() {
+ Bookings bookings = ((SCAClient)node).getService(Bookings.class, "MyTours/BookTrip");
+ String bookingCode = bookings.newBooking("FS1APR4", 1);
+ System.out.println("Booking code is " + bookingCode);
+
+ Checkout checkout = ((SCAClient)node).getService(Checkout.class, "MyTours/Checkout");
+ checkout.makePayment(new BigDecimal("1995.00"), "1234567801234567 11/10");
+ }
+
+ @After
+ public void stopServer() throws Exception {
+ if (node != null) {
+ node.stop();
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/buildingblocks/src/test/java/scatours/BuildingBlocksImplTestCase.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/buildingblocks/src/test/java/scatours/BuildingBlocksImplTestCase.java new file mode 100644 index 0000000000..35271bc5aa --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/buildingblocks/src/test/java/scatours/BuildingBlocksImplTestCase.java @@ -0,0 +1,65 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package scatours;
+
+import java.math.BigDecimal;
+
+import com.tuscanyscatours.Bookings;
+import com.tuscanyscatours.Checkout;
+
+import org.apache.tuscany.sca.node.SCAClient;
+import org.apache.tuscany.sca.node.SCAContribution;
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.SCANodeFactory;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Tests the Building Blocks Composite Implementation scenario
+ */
+public class BuildingBlocksImplTestCase {
+
+ private SCANode node;
+
+ @Before
+ public void startServer() throws Exception {
+ node = SCANodeFactory.newInstance().createSCANode("tours-impl.composite",
+ new SCAContribution("buildingblocks", "./target/classes"));
+ node.start();
+ }
+
+ @Test
+ public void testImpl() {
+ Bookings bookings = ((SCAClient)node).getService(Bookings.class, "MyTours/BookTrip");
+ String bookingCode = bookings.newBooking("FS1APR4", 1);
+ System.out.println("Booking code is " + bookingCode);
+
+ Checkout checkout = ((SCAClient)node).getService(Checkout.class, "MyTours/Checkout");
+ checkout.makePayment(new BigDecimal("1995.00"), "1234567843218765 10/10");
+ }
+
+ @After
+ public void stopServer() throws Exception {
+ if (node != null) {
+ node.stop();
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/calendar/build.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/calendar/build.xml new file mode 100644 index 0000000000..ae6a47dafb --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/calendar/build.xml @@ -0,0 +1,22 @@ +<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<project name="scatours-contribution-calendar" default="compile">
+ <import file="../../antdefs.xml"/>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/calendar/pom.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/calendar/pom.xml new file mode 100644 index 0000000000..489f26240c --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/calendar/pom.xml @@ -0,0 +1,64 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent><version>1.0-SNAPSHOT</version>
+ <artifactId>scatours-contribution-calendar</artifactId>
+ <name>Apache Tuscany SCA Tours Calendar Contribution</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node-api</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-node-runtime</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.5</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ </build>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/calendar/src/main/java/com/tuscanyscatours/calendar/Calendar.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/calendar/src/main/java/com/tuscanyscatours/calendar/Calendar.java new file mode 100644 index 0000000000..daa5127511 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/calendar/src/main/java/com/tuscanyscatours/calendar/Calendar.java @@ -0,0 +1,25 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package com.tuscanyscatours.calendar;
+
+public interface Calendar {
+
+ String getEndDate(String startDate, int duration);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/calendar/src/main/java/com/tuscanyscatours/calendar/impl/CalendarImpl.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/calendar/src/main/java/com/tuscanyscatours/calendar/impl/CalendarImpl.java new file mode 100644 index 0000000000..4e6e7b161b --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/calendar/src/main/java/com/tuscanyscatours/calendar/impl/CalendarImpl.java @@ -0,0 +1,47 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package com.tuscanyscatours.calendar.impl;
+
+import java.text.DateFormat;
+import java.util.Date;
+
+import com.tuscanyscatours.calendar.Calendar;
+
+/**
+ * An implementation of the Calendar service
+ */
+public class CalendarImpl implements Calendar {
+
+ public String getEndDate(String startDate, int duration) {
+ String returnDate = "Invalid Date";
+
+ try {
+ Date date = DateFormat.getInstance().parse(startDate);
+ java.util.Calendar calendar = java.util.Calendar.getInstance();
+ calendar.setTime(date);
+ calendar.add(java.util.Calendar.DATE, duration);
+ returnDate = DateFormat.getInstance().format(calendar.getTime());
+ } catch (Exception ex) {
+ // do nothing
+ System.out.println(ex.toString());
+ }
+
+ return returnDate;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/calendar/src/main/resources/META-INF/sca-contribution.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/calendar/src/main/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..86f28d7423 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/calendar/src/main/resources/META-INF/sca-contribution.xml @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0">
+ <export.java package="com.tuscanyscatours.calendar" />
+ <export.java package="com.tuscanyscatours.calendar.impl" />
+</contribution>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/calendar/src/test/java/scatours/calendar/CalendarTestCase.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/calendar/src/test/java/scatours/calendar/CalendarTestCase.java new file mode 100644 index 0000000000..8e0f003c4b --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/calendar/src/test/java/scatours/calendar/CalendarTestCase.java @@ -0,0 +1,57 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package scatours.calendar;
+
+import org.apache.tuscany.sca.node.SCAClient;
+import org.apache.tuscany.sca.node.SCAContribution;
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.SCANodeFactory;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import com.tuscanyscatours.calendar.Calendar;
+
+/**
+ * This shows how to test the Calculator service component.
+ */
+public class CalendarTestCase {
+
+ private SCANode node;
+
+ @Before
+ public void startNode() throws Exception {
+ node =
+ SCANodeFactory.newInstance().createSCANode("calendar.composite",
+ new SCAContribution("calendar", "./target/classes"),
+ new SCAContribution("calendar-test", "./target/test-classes"));
+ node.start();
+ }
+
+ @Test
+ public void testCalendar() throws Exception {
+ Calendar calendar = ((SCAClient)node).getService(Calendar.class, "Calendar");
+ System.out.println(calendar.getEndDate("07/10/96 04:05", 3));
+ }
+
+ @After
+ public void stopNode() throws Exception {
+ node.stop();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/calendar/src/test/resources/META-INF/sca-contribution.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/calendar/src/test/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..e57bf783fc --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/calendar/src/test/resources/META-INF/sca-contribution.xml @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0">
+ <import.java package="com.tuscanyscatours.calendar" />
+ <import.java package="com.tuscanyscatours.calendar.impl" />
+</contribution>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/calendar/src/test/resources/calendar.composite b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/calendar/src/test/resources/calendar.composite new file mode 100644 index 0000000000..076eed15b2 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/calendar/src/test/resources/calendar.composite @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://tuscanyscatours.com/"
+ name="calendar">
+
+ <component name="Calendar">
+ <implementation.java class="com.tuscanyscatours.calendar.impl.CalendarImpl"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/car/build.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/car/build.xml new file mode 100644 index 0000000000..46392d4b24 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/car/build.xml @@ -0,0 +1,25 @@ +<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<project name="scatours-contribution-car" default="compile">
+ <import file="../../antdefs.xml"/>
+ <path id="compile-path">
+ <pathelement path="../common/target/scatours-contribution-common.jar"/>
+ </path>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/car/pom.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/car/pom.xml new file mode 100644 index 0000000000..6d39e6d7f0 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/car/pom.xml @@ -0,0 +1,57 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent><version>1.0-SNAPSHOT</version>
+ <artifactId>scatours-contribution-car</artifactId>
+ <name>Apache Tuscany SCA Tours Car Contribution</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca-api</artifactId>
+ <version>${tuscany.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-contribution-common</artifactId>
+ <version>${pom.version}</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.5</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ </build>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/car/src/main/java/com/tuscanyscatours/car/impl/CarImpl.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/car/src/main/java/com/tuscanyscatours/car/impl/CarImpl.java new file mode 100644 index 0000000000..f75c772d48 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/car/src/main/java/com/tuscanyscatours/car/impl/CarImpl.java @@ -0,0 +1,91 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package com.tuscanyscatours.car.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+import com.tuscanyscatours.common.Book;
+import com.tuscanyscatours.common.Search;
+import com.tuscanyscatours.common.SearchCallback;
+import com.tuscanyscatours.common.TripItem;
+import com.tuscanyscatours.common.TripLeg;
+
+/**
+ * An implementation of the Car service
+ */
+@Scope("STATELESS")
+@Service(interfaces = {Search.class, Book.class})
+public class CarImpl implements Search, Book {
+
+ private List<CarInfo> cars = new ArrayList<CarInfo>();
+
+ @Callback
+ protected SearchCallback searchCallback;
+
+ @Init
+ public void init() {
+ cars.add(new CarInfo("Premier Cars", "BMW 5 Series", "FLR", "06/12/09", "5", 100.00, "EUR",
+ "http://localhost:8085/tbd"));
+ cars.add(new CarInfo("Premier Cars", "Ford Focus", "FLR", "06/12/09", "4", 60.00, "EUR",
+ "http://localhost:8085/tbd"));
+ }
+
+ public TripItem[] searchSynch(TripLeg tripLeg) {
+ List<TripItem> items = new ArrayList<TripItem>();
+
+ // find available hotels
+ for (CarInfo car : cars) {
+ if (car.getLocation().equals(tripLeg.getToLocation())) {
+ TripItem item =
+ new TripItem("", "", TripItem.CAR, car.getName(), car.getDescription(), car.getLocation(), tripLeg
+ .getFromDate(), tripLeg.getToDate(), car.getPricePerDay(), car.getCurrency(), car.getLink());
+ items.add(item);
+ }
+ }
+
+ return items.toArray(new TripItem[items.size()]);
+ }
+
+ public void searchAsynch(TripLeg tripLeg) {
+ System.out.println("Starting car search");
+
+ try {
+ Thread.sleep(4000);
+ } catch (Exception ex) {
+ // do nothing
+ }
+
+ // return available hotels
+ searchCallback.searchResults(searchSynch(tripLeg));
+ }
+
+ public int getPercentComplete() {
+ return 100;
+ }
+
+ public String book(TripItem tripItem) {
+ return "car1";
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/car/src/main/java/com/tuscanyscatours/car/impl/CarInfo.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/car/src/main/java/com/tuscanyscatours/car/impl/CarInfo.java new file mode 100644 index 0000000000..c373079ac1 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/car/src/main/java/com/tuscanyscatours/car/impl/CarInfo.java @@ -0,0 +1,118 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package com.tuscanyscatours.car.impl;
+
+public class CarInfo {
+
+ private String name;
+ private String description;
+ private String location;
+ private String date;
+ private String seats;
+ private double pricePerDay;
+ private String currency;
+ private String link;
+
+ public CarInfo() {
+ }
+
+ public CarInfo(String name,
+ String description,
+ String location,
+ String date,
+ String seats,
+ double pricePerDay,
+ String currency,
+ String link) {
+
+ this.name = name;
+ this.description = description;
+ this.location = location;
+ this.date = date;
+ this.seats = seats;
+ this.pricePerDay = pricePerDay;
+ this.currency = currency;
+ this.link = link;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public String getLocation() {
+ return location;
+ }
+
+ public void setLocation(String location) {
+ this.location = location;
+ }
+
+ public String getDate() {
+ return date;
+ }
+
+ public void setDate(String date) {
+ this.date = date;
+ }
+
+ public String getSeats() {
+ return seats;
+ }
+
+ public void setSeats(String seats) {
+ this.seats = seats;
+ }
+
+ public double getPricePerDay() {
+ return pricePerDay;
+ }
+
+ public void setPricePerDay(double pricePerDay) {
+ this.pricePerDay = pricePerDay;
+ }
+
+ public String getCurrency() {
+ return currency;
+ }
+
+ public void setCurrency(String currency) {
+ this.currency = currency;
+ }
+
+ public String getLink() {
+ return link;
+ }
+
+ public void setLink(String link) {
+ this.link = link;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/car/src/main/resources/META-INF/sca-contribution.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/car/src/main/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..eb9ffba20d --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/car/src/main/resources/META-INF/sca-contribution.xml @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0">
+ <import.java package="com.tuscanyscatours.common"/>
+ <export.java package="com.tuscanyscatours.car.impl"/>
+</contribution>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/common/build.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/common/build.xml new file mode 100644 index 0000000000..85cec507ff --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/common/build.xml @@ -0,0 +1,22 @@ +<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<project name="scatours-contribution-common" default="compile">
+ <import file="../../antdefs.xml"/>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/common/pom.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/common/pom.xml new file mode 100644 index 0000000000..8956abcff9 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/common/pom.xml @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent><version>1.0-SNAPSHOT</version>
+ <artifactId>scatours-contribution-common</artifactId>
+ <name>Apache Tuscany SCA Tours Common Artefacts Contribution</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca-api</artifactId>
+ <version>${tuscany.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.5</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ </build>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/common/src/main/java/com/tuscanyscatours/common/Book.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/common/src/main/java/com/tuscanyscatours/common/Book.java new file mode 100644 index 0000000000..47b6f50bec --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/common/src/main/java/com/tuscanyscatours/common/Book.java @@ -0,0 +1,27 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package com.tuscanyscatours.common;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface Book {
+ String book(TripItem tripItem);
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/common/src/main/java/com/tuscanyscatours/common/Search.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/common/src/main/java/com/tuscanyscatours/common/Search.java new file mode 100644 index 0000000000..1611c11792 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/common/src/main/java/com/tuscanyscatours/common/Search.java @@ -0,0 +1,36 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package com.tuscanyscatours.common;
+
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.Conversational;
+import org.osoa.sca.annotations.OneWay;
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+@Callback(SearchCallback.class)
+public interface Search {
+ TripItem[] searchSynch(TripLeg tripLeg);
+
+ @OneWay
+ void searchAsynch(TripLeg tripLeg);
+
+ int getPercentComplete();
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/common/src/main/java/com/tuscanyscatours/common/SearchCallback.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/common/src/main/java/com/tuscanyscatours/common/SearchCallback.java new file mode 100644 index 0000000000..ad13d0d352 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/common/src/main/java/com/tuscanyscatours/common/SearchCallback.java @@ -0,0 +1,28 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package com.tuscanyscatours.common;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface SearchCallback {
+ void searchResults(TripItem[] items);
+ void setPercentComplete(String searchComponent, int percentComplete);
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/common/src/main/java/com/tuscanyscatours/common/TripItem.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/common/src/main/java/com/tuscanyscatours/common/TripItem.java new file mode 100644 index 0000000000..2f2a6299f9 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/common/src/main/java/com/tuscanyscatours/common/TripItem.java @@ -0,0 +1,242 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package com.tuscanyscatours.common;
+
+public class TripItem {
+
+ public static String FLIGHT = "Flight";
+ public static String HOTEL = "Hotel";
+ public static String CAR = "Car";
+ public static String TRIP = "Trip";
+
+ private String id;
+ private String tripId;
+ private String type;
+ private String name;
+ private String description;
+ private String location;
+ private String fromDate;
+ private String toDate;
+ private double price;
+ private String currency;
+ private String link;
+ private TripItem[] tripItems; // used for a trip made up of trip items
+ private String customerDetails;
+ private String agentDetails;
+ private String bookingCode;
+
+ public TripItem() {
+ }
+
+ public TripItem(TripItem item) {
+ this.id = item.getId();
+ this.tripId = item.getTripId();
+ this.type = item.getType();
+ this.name = item.getName();
+ this.description = item.getDescription();
+ this.location = item.getLocation();
+ this.fromDate = item.getFromDate();
+ this.toDate = item.getToDate();
+ this.price = item.getPrice();
+ this.currency = item.getCurrency();
+ this.link = item.getLink();
+ }
+
+ public TripItem(String id,
+ String tripId,
+ String type,
+ String name,
+ String description,
+ String location,
+ String fromDate,
+ String toDate,
+ double price,
+ String currency,
+ String link) {
+ this.id = id;
+ this.tripId = tripId;
+ this.type = type;
+ this.name = name;
+ this.description = description;
+ this.location = location;
+ this.fromDate = fromDate;
+ this.toDate = toDate;
+ this.price = price;
+ this.currency = currency;
+ this.link = link;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getTripId() {
+ return tripId;
+ }
+
+ public void setTripId(String tripId) {
+ this.tripId = tripId;
+ }
+
+ public String getType() {
+ return type;
+ }
+
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public String getLocation() {
+ return location;
+ }
+
+ public void setLocation(String location) {
+ this.location = location;
+ }
+
+ public String getFromDate() {
+ return fromDate;
+ }
+
+ public void setFromDate(String fromDate) {
+ this.fromDate = fromDate;
+ }
+
+ public String getToDate() {
+ return toDate;
+ }
+
+ public void setToDate(String toDate) {
+ this.toDate = toDate;
+ }
+
+ public double getPrice() {
+ return price;
+ }
+
+ public void setPrice(double price) {
+ this.price = price;
+ }
+
+ public String getCurrency() {
+ return currency;
+ }
+
+ public void setCurrency(String currency) {
+ this.currency = currency;
+ }
+
+ public String getLink() {
+ return link;
+ }
+
+ public void setLink(String link) {
+ this.link = link;
+ }
+
+ public TripItem[] getTripItems() {
+ return tripItems;
+ }
+
+ public void setTripItems(TripItem[] tripItems) {
+ this.tripItems = tripItems;
+ }
+
+ public String getCustomerDetails() {
+ return customerDetails;
+ }
+
+ public void setCustomerDetails(String customerDetails) {
+ this.customerDetails = customerDetails;
+ }
+
+ public String getAgentDetails() {
+ return agentDetails;
+ }
+
+ public void setAgentDetails(String agentDetails) {
+ this.agentDetails = agentDetails;
+ }
+
+ public String getBookingCode() {
+ return bookingCode;
+ }
+
+ public void setBookingCode(String bookingCode) {
+ this.bookingCode = bookingCode;
+ }
+
+ @Override
+ public String toString() {
+ String tripString =
+ "Trip: id " + this.tripId
+ + " type "
+ + this.type
+ + " name "
+ + this.name
+ + " description "
+ + this.description
+ + " location "
+ + this.location
+ + " fromDate "
+ + this.fromDate
+ + " toDate "
+ + this.toDate
+ + " price "
+ + this.price
+ + " currency "
+ + this.currency
+ + " link "
+ + this.link;
+ return tripString;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+
+ if (obj instanceof TripItem) {
+ if (((TripItem)obj).getId().equals(getId())) {
+ return true;
+ }
+ }
+
+ return super.equals(obj);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/common/src/main/java/com/tuscanyscatours/common/TripLeg.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/common/src/main/java/com/tuscanyscatours/common/TripLeg.java new file mode 100644 index 0000000000..663634b1e9 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/common/src/main/java/com/tuscanyscatours/common/TripLeg.java @@ -0,0 +1,85 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package com.tuscanyscatours.common;
+
+public class TripLeg {
+
+ private String id;
+ private String fromLocation;
+ private String toLocation;
+ private String fromDate;
+ private String toDate;
+ private String noOfPeople;
+
+ public TripLeg() {
+ }
+
+ public TripLeg(String id, String fromLocation, String toLocation, String fromDate, String toDate, String noOfPeople) {
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getFromLocation() {
+ return fromLocation;
+ }
+
+ public void setFromLocation(String fromLocation) {
+ this.fromLocation = fromLocation;
+ }
+
+ public String getToLocation() {
+ return toLocation;
+ }
+
+ public void setToLocation(String toLocation) {
+ this.toLocation = toLocation;
+ }
+
+ public String getFromDate() {
+ return fromDate;
+ }
+
+ public void setFromDate(String fromDate) {
+ this.fromDate = fromDate;
+ }
+
+ public String getToDate() {
+ return toDate;
+ }
+
+ public void setToDate(String toDate) {
+ this.toDate = toDate;
+ }
+
+ public String getNoOfPeople() {
+ return noOfPeople;
+ }
+
+ public void setNoOfPeople(String noOfPeople) {
+ this.noOfPeople = noOfPeople;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/common/src/main/resources/META-INF/sca-contribution.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/common/src/main/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..d7ada5afe7 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/common/src/main/resources/META-INF/sca-contribution.xml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0">
+ <export.java package="com.tuscanyscatours.common" />
+</contribution>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/creditcard-payment-jaxb-policy/build.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/creditcard-payment-jaxb-policy/build.xml new file mode 100644 index 0000000000..93d1c4ad47 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/creditcard-payment-jaxb-policy/build.xml @@ -0,0 +1,30 @@ +<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<project name="scatours-contribution-creditcard-payment-jaxb-policy" default="compile">
+ <import file="../../antdefs.xml"/>
+
+ <target name="wsdljava">
+ <antcall target="wsimport">
+ <param name="wsdlfile" value="CreditCardPayment.wsdl"/>
+ <param name="javaclass" value="com/tuscanyscatours/payment/creditcard/CreditCardPayment.class"/>
+ <param name="package" value="com.tuscanyscatours.payment.creditcard"/>
+ </antcall>
+ </target>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/creditcard-payment-jaxb-policy/maven-eclipse.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/creditcard-payment-jaxb-policy/maven-eclipse.xml new file mode 100644 index 0000000000..4ceebd71f7 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/creditcard-payment-jaxb-policy/maven-eclipse.xml @@ -0,0 +1,8 @@ +<project default="copy-resources"> + <target name="init"/> + <target name="copy-resources" depends="init"> + <copy todir="target/classes/META-INF" filtering="true"> + <fileset dir="." includes="LICENSE|NOTICE"/> + </copy> + </target> +</project>
\ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/creditcard-payment-jaxb-policy/pom.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/creditcard-payment-jaxb-policy/pom.xml new file mode 100644 index 0000000000..ea0923d8c9 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/creditcard-payment-jaxb-policy/pom.xml @@ -0,0 +1,150 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<project> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>scatours</artifactId> + <version>1.0-SNAPSHOT</version> + <relativePath>../../pom.xml</relativePath> + </parent> + <version>1.0-SNAPSHOT</version> + <artifactId>scatours-contribution-creditcard-payment-jaxb-policy</artifactId> + <name>Apache Tuscany SCA Tours Credit Card Payment Contribution JAXB Policy</name> + + <dependencies> + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-sca-api</artifactId> + <version>${tuscany.version}</version> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-interface-java-jaxws</artifactId> + <version>${tuscany.version}</version> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-implementation-java-runtime</artifactId> + <version>${tuscany.version}</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-binding-ws-axis2</artifactId> + <version>${tuscany.version}</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-node-api</artifactId> + <version>${tuscany.version}</version> + <scope>test</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-node-impl</artifactId> + <version>${tuscany.version}</version> + <scope>test</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-host-jetty</artifactId> + <version>${tuscany.version}</version> + <scope>test</scope> + </dependency> + + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>4.5</version> + <scope>test</scope> + </dependency> + + </dependencies> + + <pluginRepositories> + <pluginRepository> + <id>java.net2</id> + <name>java.net Maven 2.x Repository</name> + <url>http://download.java.net/maven/2</url> + <snapshots> + <enabled>false</enabled> + </snapshots> + </pluginRepository> + </pluginRepositories> + + <build> + <finalName>${artifactId}</finalName> + <plugins> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>build-helper-maven-plugin</artifactId> + <version>1.0</version> + <executions> + <execution> + <id>add-source</id> + <phase>generate-sources</phase> + <goals> + <goal>add-source</goal> + </goals> + <configuration> + <sources> + <source>target/jaxws-source</source> + </sources> + </configuration> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>jaxws-maven-plugin</artifactId> + <version>1.12</version> + <executions> + <execution> + <id>wsimport</id> + <phase>generate-sources</phase> + <goals> + <goal>wsimport</goal> + </goals> + <configuration> + <packageName>com.tuscanyscatours.payment.creditcard</packageName> + <wsdlDirectory>${basedir}/src/main/resources + </wsdlDirectory> + <wsdlFiles> + <wsdlFile>CreditCardPayment.wsdl</wsdlFile> + </wsdlFiles> + <sourceDestDir>${project.build.directory}/jaxws-source + </sourceDestDir> + <verbose>false</verbose> + <xnocompile>true</xnocompile> + </configuration> + </execution> + </executions> + </plugin> + </plugins> + </build> +</project> diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/creditcard-payment-jaxb-policy/src/main/java/com/tuscanyscatours/payment/creditcard/impl/CreditCardPaymentImpl.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/creditcard-payment-jaxb-policy/src/main/java/com/tuscanyscatours/payment/creditcard/impl/CreditCardPaymentImpl.java new file mode 100644 index 0000000000..293f08453f --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/creditcard-payment-jaxb-policy/src/main/java/com/tuscanyscatours/payment/creditcard/impl/CreditCardPaymentImpl.java @@ -0,0 +1,46 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package com.tuscanyscatours.payment.creditcard.impl; + +import org.osoa.sca.annotations.Service; + +import com.tuscanyscatours.payment.creditcard.CreditCardDetailsType; +import com.tuscanyscatours.payment.creditcard.CreditCardPayment; + +/** + * + */ +@Service(CreditCardPayment.class) +public class CreditCardPaymentImpl implements CreditCardPayment { + + public String authorize(CreditCardDetailsType creditCard, float amount) { + if (creditCard != null) { + System.out.println("Checking card: name = " + creditCard.getCardOwner().getName() + + " number = " + + creditCard.getCreditCardNumber() + + " for amount " + + amount); + } else { + System.out.println("Checking card is null"); + } + + return "OK"; + } +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/creditcard-payment-jaxb-policy/src/main/resources/CreditCardPayment.wsdl b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/creditcard-payment-jaxb-policy/src/main/resources/CreditCardPayment.wsdl new file mode 100644 index 0000000000..f313043bf8 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/creditcard-payment-jaxb-policy/src/main/resources/CreditCardPayment.wsdl @@ -0,0 +1,134 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<wsdl:definitions name="CreditCardPayment"
+ targetNamespace="http://www.tuscanyscatours.com/CreditCardPayment/"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:tns="http://www.tuscanyscatours.com/CreditCardPayment/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:bpws="http://schemas.xmlsoap.org/ws/2004/03/business-process/"
+ xmlns:plnk="http://schemas.xmlsoap.org/ws/2004/03/partner-link/">
+ <wsdl:types>
+ <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.tuscanyscatours.com/CreditCardPayment/"
+ xmlns:tns="http://www.tuscanyscatours.com/CreditCardPayment/">
+
+ <!-- https://jaxb.dev.java.net/issues/show_bug.cgi?id=518 -->
+ <!-- I have to change the complex types to be annoymous -->
+ <xsd:element name="authorize">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="CreditCard" type="tns:CreditCardDetailsType"></xsd:element>
+ <xsd:element name="Amount" type="xsd:float"></xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="authorizeResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="Status" type="xsd:string"></xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:complexType name="CreditCardDetailsType">
+ <xsd:sequence>
+ <xsd:element name="CreditCardType" type="tns:CreditCardTypeType" minOccurs="0" />
+ <xsd:element name="CreditCardNumber" type="xsd:string" minOccurs="0" />
+ <xsd:element name="ExpMonth" type="xsd:int" minOccurs="0" />
+ <xsd:element name="ExpYear" type="xsd:int" minOccurs="0" />
+ <xsd:element name="CardOwner" type="tns:PayerType" minOccurs="0" />
+ <xsd:element name="CVV2" type="xsd:string" minOccurs="0" />
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:simpleType name="CreditCardTypeType">
+ <xsd:restriction base="xsd:token">
+ <xsd:enumeration value="Visa" />
+ <xsd:enumeration value="MasterCard" />
+ <xsd:enumeration value="Discover" />
+ <xsd:enumeration value="Amex" />
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:complexType name="PayerType">
+ <xsd:sequence>
+ <xsd:element name="Name" type="xsd:string" />
+ <xsd:element name="Address" type="tns:AddressType" />
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:complexType name="AddressType">
+ <xsd:sequence>
+ <xsd:element name="Street" type="xsd:string" />
+ <xsd:element name="City" type="xsd:string" />
+ <xsd:element name="State" type="xsd:string" />
+ <xsd:element name="ZipCode" type="xsd:string" />
+ <xsd:element name="HomePhone" type="xsd:string" />
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="authorizeFault">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="errorCode" type="xsd:string"></xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:schema>
+ </wsdl:types>
+ <wsdl:message name="AuthorizeRequest">
+ <wsdl:part name="parameters" element="tns:authorize"></wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="AuthorizeResponse">
+ <wsdl:part name="parameters" element="tns:authorizeResponse"></wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="AuthorizeFault">
+ <wsdl:part name="parameters" element="tns:authorizeFault"></wsdl:part>
+ </wsdl:message>
+ <wsdl:portType name="CreditCardPayment">
+ <wsdl:operation name="authorize">
+ <wsdl:input message="tns:AuthorizeRequest"></wsdl:input>
+ <wsdl:output message="tns:AuthorizeResponse"></wsdl:output>
+ <wsdl:fault name="authorizationFailure" message="tns:AuthorizeFault"></wsdl:fault>
+ </wsdl:operation>
+ </wsdl:portType>
+ <wsdl:binding name="CreditCardPaymentBinding" type="tns:CreditCardPayment">
+ <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
+ <wsdl:operation name="authorize">
+ <soap:operation soapAction="http://www.tuscanyscatours.com/CreditCardPayment/authorize" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ <wsdl:fault name="authorizationFailure">
+ <soap:fault name="authorizationFailure" use="literal"/>
+ </wsdl:fault>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:service name="CreditCardPaymentService">
+ <wsdl:port name="CreditCardPaymentPort" binding="tns:CreditCardPaymentBinding">
+ <soap:address location="http://localhost:8080/CreditCardPayment" />
+ </wsdl:port>
+ </wsdl:service>
+
+ <plnk:partnerLinkType name="CreditCardPaymentLinkType">
+ <plnk:role name="forward" portType="tns:CreditCardPayment"/>
+ </plnk:partnerLinkType>
+</wsdl:definitions>
\ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/creditcard-payment-jaxb-policy/src/main/resources/META-INF/sca-contribution.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/creditcard-payment-jaxb-policy/src/main/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..3b889caefd --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/creditcard-payment-jaxb-policy/src/main/resources/META-INF/sca-contribution.xml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0" + xmlns:scatours="http://tuscanyscatours.com/"> + <export.java package="com.tuscanyscatours.payment.creditcard" /> + <deployable composite="scatours:creditcard" /> +</contribution> diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/creditcard-payment-jaxb-policy/src/main/resources/creditcard.composite b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/creditcard-payment-jaxb-policy/src/main/resources/creditcard.composite new file mode 100644 index 0000000000..4a91a96255 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/creditcard-payment-jaxb-policy/src/main/resources/creditcard.composite @@ -0,0 +1,33 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" + targetNamespace="http://tuscanyscatours.com/" + name="creditcard"> + + <component name="CreditCardPayment"> + <implementation.java class="com.tuscanyscatours.payment.creditcard.impl.CreditCardPaymentImpl" /> + <service name="CreditCardPayment"> + <interface.wsdl interface="http://www.tuscanyscatours.com/CreditCardPayment/#wsdl.interface(CreditCardPayment)" /> + <binding.ws uri="http://localhost:8082/CreditCardPayment" requires="authentication"/> + <binding.sca/> + </service> + </component> + +</composite> diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/creditcard-payment-jaxb-policy/src/main/resources/definitions.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/creditcard-payment-jaxb-policy/src/main/resources/definitions.xml new file mode 100644 index 0000000000..5a2c58eaed --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/creditcard-payment-jaxb-policy/src/main/resources/definitions.xml @@ -0,0 +1,36 @@ +<?xml version="1.0" encoding="ASCII"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<definitions xmlns="http://www.osoa.org/xmlns/sca/1.0" + targetNamespace="http://itest/policy" + xmlns:sca="http://www.osoa.org/xmlns/sca/1.0" + xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0" + xmlns:ip="http://itest/policy" > + + + <policySet name="BasicAuthenticationPolicySet" + provides="authentication" + appliesTo="sca:binding.ws"> + <tuscany:basicAuthentication> + <tuscany:userName>myname</tuscany:userName> + <tuscany:password>mypassword</tuscany:password> + </tuscany:basicAuthentication> + </policySet> + +</definitions>
\ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/creditcard-payment-jaxb-policy/src/test/java/scatours/payment/creditcard/CreditCardPaymentTestCase.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/creditcard-payment-jaxb-policy/src/test/java/scatours/payment/creditcard/CreditCardPaymentTestCase.java new file mode 100644 index 0000000000..a33b2b3046 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/creditcard-payment-jaxb-policy/src/test/java/scatours/payment/creditcard/CreditCardPaymentTestCase.java @@ -0,0 +1,100 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package scatours.payment.creditcard; + +import org.apache.tuscany.sca.node.SCAClient; +import org.apache.tuscany.sca.node.SCAContribution; +import org.apache.tuscany.sca.node.SCANode; +import org.apache.tuscany.sca.node.SCANodeFactory; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Ignore; +import org.junit.Test; + +import com.tuscanyscatours.payment.creditcard.AuthorizeFault_Exception; +import com.tuscanyscatours.payment.creditcard.CreditCardDetailsType; +import com.tuscanyscatours.payment.creditcard.CreditCardPayment; +import com.tuscanyscatours.payment.creditcard.CreditCardTypeType; +import com.tuscanyscatours.payment.creditcard.ObjectFactory; +import com.tuscanyscatours.payment.creditcard.PayerType; + +/** + * + */ +public class CreditCardPaymentTestCase { + private static SCANode node; + + /** + * @throws java.lang.Exception + */ + @BeforeClass + public static void setUpBeforeClass() throws Exception { + try { + node = + SCANodeFactory.newInstance().createSCANode("creditcard.composite", new SCAContribution("creditcard", "./target/classes")); + + node.start(); + } catch (Exception ex) { + ex.printStackTrace(); + } + } + + @Test + public void testCreditCardPayment() { + SCAClient client = (SCAClient)node; + CreditCardPayment cc = client.getService(CreditCardPayment.class, "CreditCardPayment"); + + ObjectFactory objectFactory = new ObjectFactory(); + CreditCardDetailsType ccDetails = objectFactory.createCreditCardDetailsType(); + ccDetails.setCreditCardType(CreditCardTypeType.fromValue("Visa")); + PayerType ccOwner = objectFactory.createPayerType(); + ccOwner.setName("Fred"); + ccDetails.setCardOwner(ccOwner); + + try { + System.out.println(cc.authorize(ccDetails, 100.00f)); + } catch (AuthorizeFault_Exception e) { + System.err.println("Fault: " + e.getFaultInfo().getErrorCode()); + } + } + + @Test + @Ignore + public void testWaitForInput() { + System.out.println("Press a key to end"); + try { + System.in.read(); + } catch (Exception ex) { + } + System.out.println("Shutting down"); + } + + /** + * @throws java.lang.Exception + */ + @AfterClass + public static void tearDownAfterClass() throws Exception { + if (node != null) { + node.stop(); + node = null; + } + } + +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/creditcard-payment-jaxb/build.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/creditcard-payment-jaxb/build.xml new file mode 100644 index 0000000000..9e0ac7fff9 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/creditcard-payment-jaxb/build.xml @@ -0,0 +1,30 @@ +<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<project name="scatours-contribution-creditcard-payment-jaxb" default="compile">
+ <import file="../../antdefs.xml"/>
+
+ <target name="wsdljava">
+ <antcall target="wsimport">
+ <param name="wsdlfile" value="CreditCardPayment.wsdl"/>
+ <param name="javaclass" value="com/tuscanyscatours/payment/creditcard/CreditCardPayment.class"/>
+ <param name="package" value="com.tuscanyscatours.payment.creditcard"/>
+ </antcall>
+ </target>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/creditcard-payment-jaxb/pom.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/creditcard-payment-jaxb/pom.xml new file mode 100644 index 0000000000..4f663e0af2 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/creditcard-payment-jaxb/pom.xml @@ -0,0 +1,150 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <version>1.0-SNAPSHOT</version>
+ <artifactId>scatours-contribution-creditcard-payment-jaxb</artifactId>
+ <name>Apache Tuscany SCA Tours Credit Card Payment Contribution JAXB</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca-api</artifactId>
+ <version>${tuscany.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-interface-java-jaxws</artifactId>
+ <version>${tuscany.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-axis2</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node-api</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node-impl</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-jetty</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.5</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+ <pluginRepositories>
+ <pluginRepository>
+ <id>java.net2</id>
+ <name>java.net Maven 2.x Repository</name>
+ <url>http://download.java.net/maven/2</url>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </pluginRepository>
+ </pluginRepositories>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ <version>1.0</version>
+ <executions>
+ <execution>
+ <id>add-source</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>add-source</goal>
+ </goals>
+ <configuration>
+ <sources>
+ <source>target/jaxws-source</source>
+ </sources>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>jaxws-maven-plugin</artifactId>
+ <version>1.12</version>
+ <executions>
+ <execution>
+ <id>wsimport</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>wsimport</goal>
+ </goals>
+ <configuration>
+ <packageName>com.tuscanyscatours.payment.creditcard</packageName>
+ <wsdlDirectory>${basedir}/src/main/resources
+ </wsdlDirectory>
+ <wsdlFiles>
+ <wsdlFile>CreditCardPayment.wsdl</wsdlFile>
+ </wsdlFiles>
+ <sourceDestDir>${project.build.directory}/jaxws-source
+ </sourceDestDir>
+ <verbose>false</verbose>
+ <xnocompile>true</xnocompile>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/creditcard-payment-jaxb/src/main/java/com/tuscanyscatours/payment/creditcard/impl/CreditCardPaymentImpl.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/creditcard-payment-jaxb/src/main/java/com/tuscanyscatours/payment/creditcard/impl/CreditCardPaymentImpl.java new file mode 100644 index 0000000000..ed817a58bb --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/creditcard-payment-jaxb/src/main/java/com/tuscanyscatours/payment/creditcard/impl/CreditCardPaymentImpl.java @@ -0,0 +1,46 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package com.tuscanyscatours.payment.creditcard.impl;
+
+import org.osoa.sca.annotations.Service;
+
+import com.tuscanyscatours.payment.creditcard.CreditCardDetailsType;
+import com.tuscanyscatours.payment.creditcard.CreditCardPayment;
+
+/**
+ *
+ */
+@Service(CreditCardPayment.class)
+public class CreditCardPaymentImpl implements CreditCardPayment {
+
+ public String authorize(CreditCardDetailsType creditCard, float amount) {
+ if (creditCard != null) {
+ System.out.println("Checking card: name = " + creditCard.getCardOwner().getName()
+ + " number = "
+ + creditCard.getCreditCardNumber()
+ + " for amount "
+ + amount);
+ } else {
+ System.out.println("Checking card is null");
+ }
+
+ return "OK";
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/creditcard-payment-jaxb/src/main/resources/CreditCardPayment.wsdl b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/creditcard-payment-jaxb/src/main/resources/CreditCardPayment.wsdl new file mode 100644 index 0000000000..6dcc619c48 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/creditcard-payment-jaxb/src/main/resources/CreditCardPayment.wsdl @@ -0,0 +1,134 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<wsdl:definitions name="CreditCardPayment"
+ targetNamespace="http://www.tuscanyscatours.com/CreditCardPayment/"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:tns="http://www.tuscanyscatours.com/CreditCardPayment/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:bpws="http://schemas.xmlsoap.org/ws/2004/03/business-process/"
+ xmlns:plnk="http://schemas.xmlsoap.org/ws/2004/03/partner-link/">
+ <wsdl:types>
+ <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.tuscanyscatours.com/CreditCardPayment/"
+ xmlns:tns="http://www.tuscanyscatours.com/CreditCardPayment/">
+
+ <!-- https://jaxb.dev.java.net/issues/show_bug.cgi?id=518 -->
+ <!-- I have to change the complex types to be annoymous -->
+ <xsd:element name="authorize">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="CreditCard" type="tns:CreditCardDetailsType"></xsd:element>
+ <xsd:element name="Amount" type="xsd:float"></xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="authorizeResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="Status" type="xsd:string"></xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:complexType name="CreditCardDetailsType">
+ <xsd:sequence>
+ <xsd:element name="CreditCardType" type="tns:CreditCardTypeType" minOccurs="0" />
+ <xsd:element name="CreditCardNumber" type="xsd:string" minOccurs="0" />
+ <xsd:element name="ExpMonth" type="xsd:int" minOccurs="0" />
+ <xsd:element name="ExpYear" type="xsd:int" minOccurs="0" />
+ <xsd:element name="CardOwner" type="tns:PayerType" minOccurs="0" />
+ <xsd:element name="CVV2" type="xsd:string" minOccurs="0" />
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:simpleType name="CreditCardTypeType">
+ <xsd:restriction base="xsd:token">
+ <xsd:enumeration value="Visa" />
+ <xsd:enumeration value="MasterCard" />
+ <xsd:enumeration value="Discover" />
+ <xsd:enumeration value="Amex" />
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:complexType name="PayerType">
+ <xsd:sequence>
+ <xsd:element name="Name" type="xsd:string" />
+ <xsd:element name="Address" type="tns:AddressType" />
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:complexType name="AddressType">
+ <xsd:sequence>
+ <xsd:element name="Street" type="xsd:string" />
+ <xsd:element name="City" type="xsd:string" />
+ <xsd:element name="State" type="xsd:string" />
+ <xsd:element name="ZipCode" type="xsd:string" />
+ <xsd:element name="HomePhone" type="xsd:string" />
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="authorizeFault">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="errorCode" type="xsd:string"></xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:schema>
+ </wsdl:types>
+ <wsdl:message name="AuthorizeRequest">
+ <wsdl:part name="parameters" element="tns:authorize"></wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="AuthorizeResponse">
+ <wsdl:part name="parameters" element="tns:authorizeResponse"></wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="AuthorizeFault">
+ <wsdl:part name="parameters" element="tns:authorizeFault"></wsdl:part>
+ </wsdl:message>
+ <wsdl:portType name="CreditCardPayment">
+ <wsdl:operation name="authorize">
+ <wsdl:input message="tns:AuthorizeRequest"></wsdl:input>
+ <wsdl:output message="tns:AuthorizeResponse"></wsdl:output>
+ <wsdl:fault name="authorizationFailure" message="tns:AuthorizeFault"></wsdl:fault> + </wsdl:operation>
+ </wsdl:portType>
+ <wsdl:binding name="CreditCardPaymentBinding" type="tns:CreditCardPayment">
+ <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
+ <wsdl:operation name="authorize">
+ <soap:operation soapAction="http://www.tuscanyscatours.com/CreditCardPayment/authorize" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ <wsdl:fault name="authorizationFailure">
+ <soap:fault name="authorizationFailure" use="literal"/>
+ </wsdl:fault>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:service name="CreditCardPaymentService">
+ <wsdl:port name="CreditCardPaymentPort" binding="tns:CreditCardPaymentBinding">
+ <soap:address location="http://localhost:8080/CreditCardPayment" />
+ </wsdl:port>
+ </wsdl:service>
+
+ <plnk:partnerLinkType name="CreditCardPaymentLinkType">
+ <plnk:role name="forward" portType="tns:CreditCardPayment"/>
+ </plnk:partnerLinkType>
+</wsdl:definitions>
\ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/creditcard-payment-jaxb/src/main/resources/META-INF/sca-contribution.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/creditcard-payment-jaxb/src/main/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..ea6bed8e09 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/creditcard-payment-jaxb/src/main/resources/META-INF/sca-contribution.xml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:scatours="http://tuscanyscatours.com/">
+ <export.java package="com.tuscanyscatours.payment.creditcard" />
+ <deployable composite="scatours:creditcard" />
+</contribution>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/creditcard-payment-jaxb/src/main/resources/creditcard.composite b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/creditcard-payment-jaxb/src/main/resources/creditcard.composite new file mode 100644 index 0000000000..db6907cf7e --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/creditcard-payment-jaxb/src/main/resources/creditcard.composite @@ -0,0 +1,33 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" + targetNamespace="http://tuscanyscatours.com/" + name="creditcard"> + + <component name="CreditCardPayment"> + <implementation.java class="com.tuscanyscatours.payment.creditcard.impl.CreditCardPaymentImpl" /> + <service name="CreditCardPayment"> + <interface.wsdl interface="http://www.tuscanyscatours.com/CreditCardPayment/#wsdl.interface(CreditCardPayment)" /> + <binding.ws uri="http://localhost:8082/CreditCardPayment" /> + <binding.sca/> + </service> + </component> + +</composite> diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/creditcard-payment-jaxb/src/test/java/scatours/payment/creditcard/CreditCardPaymentTestCase.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/creditcard-payment-jaxb/src/test/java/scatours/payment/creditcard/CreditCardPaymentTestCase.java new file mode 100644 index 0000000000..65c7beb367 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/creditcard-payment-jaxb/src/test/java/scatours/payment/creditcard/CreditCardPaymentTestCase.java @@ -0,0 +1,100 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package scatours.payment.creditcard;
+
+import org.apache.tuscany.sca.node.SCAClient;
+import org.apache.tuscany.sca.node.SCAContribution;
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.SCANodeFactory;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Ignore;
+import org.junit.Test;
+
+import com.tuscanyscatours.payment.creditcard.AuthorizeFault_Exception;
+import com.tuscanyscatours.payment.creditcard.CreditCardDetailsType;
+import com.tuscanyscatours.payment.creditcard.CreditCardPayment;
+import com.tuscanyscatours.payment.creditcard.CreditCardTypeType;
+import com.tuscanyscatours.payment.creditcard.ObjectFactory;
+import com.tuscanyscatours.payment.creditcard.PayerType;
+
+/**
+ *
+ */
+public class CreditCardPaymentTestCase {
+ private static SCANode node;
+
+ /**
+ * @throws java.lang.Exception
+ */
+ @BeforeClass
+ public static void setUpBeforeClass() throws Exception {
+ try {
+ node =
+ SCANodeFactory.newInstance().createSCANode(null, new SCAContribution("creditcard", "./target/classes"));
+
+ node.start();
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
+ }
+
+ @Test
+ public void testCreditCardPayment() {
+ SCAClient client = (SCAClient)node;
+ CreditCardPayment cc = client.getService(CreditCardPayment.class, "CreditCardPayment");
+
+ ObjectFactory objectFactory = new ObjectFactory();
+ CreditCardDetailsType ccDetails = objectFactory.createCreditCardDetailsType();
+ ccDetails.setCreditCardType(CreditCardTypeType.fromValue("Visa"));
+ PayerType ccOwner = objectFactory.createPayerType();
+ ccOwner.setName("Fred");
+ ccDetails.setCardOwner(ccOwner);
+
+ try {
+ System.out.println(cc.authorize(ccDetails, 100.00f));
+ } catch (AuthorizeFault_Exception e) {
+ System.err.println("Fault: " + e.getFaultInfo().getErrorCode());
+ }
+ }
+
+ @Test
+ @Ignore
+ public void testWaitForInput() {
+ System.out.println("Press a key to end");
+ try {
+ System.in.read();
+ } catch (Exception ex) {
+ }
+ System.out.println("Shutting down");
+ }
+
+ /**
+ * @throws java.lang.Exception
+ */
+ @AfterClass
+ public static void tearDownAfterClass() throws Exception {
+ if (node != null) {
+ node.stop();
+ node = null;
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/creditcard-payment-sdo/build.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/creditcard-payment-sdo/build.xml new file mode 100644 index 0000000000..2f9f3d9625 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/creditcard-payment-sdo/build.xml @@ -0,0 +1,31 @@ +<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<project name="scatours-contribution-creditcard-payment-sdo" default="compile">
+ <import file="../../antdefs.xml"/>
+
+ <target name="wsdljava">
+ <antcall target="sdojavagen">
+ <param name="wsdlfile" value="CreditCardPayment.wsdl"/>
+ <param name="javaclass" value="com/tuscanyscatours/payment/creditcard/CreditCardDetailsType.class"/>
+ <param name="package" value="com.tuscanyscatours.payment.creditcard"/>
+ <param name="prefix" value="CreditCardPayment"/>
+ </antcall>
+ </target>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/creditcard-payment-sdo/pom.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/creditcard-payment-sdo/pom.xml new file mode 100644 index 0000000000..ff894aee12 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/creditcard-payment-sdo/pom.xml @@ -0,0 +1,149 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<project> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>scatours</artifactId> + <version>1.0-SNAPSHOT</version> + <relativePath>../../pom.xml</relativePath> + </parent><version>1.0-SNAPSHOT</version> + <artifactId>scatours-contribution-creditcard-payment-sdo</artifactId> + <name>Apache Tuscany SCA Tours Credit Card Payment Contribution SDO</name> + + <dependencies> + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-sca-api</artifactId> + <version>${tuscany.version}</version> + </dependency> + + <dependency> + <groupId>javax.xml.ws</groupId> + <artifactId>jaxws-api</artifactId> + <version>2.1</version> + <exclusions> + <exclusion> + <groupId>javax.xml.soap</groupId> + <artifactId>saaj-api</artifactId> + </exclusion> + </exclusions> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-databinding-sdo</artifactId> + <version>${tuscany.version}</version> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-implementation-java-runtime</artifactId> + <version>${tuscany.version}</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-binding-ws-axis2</artifactId> + <version>${tuscany.version}</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-node-api</artifactId> + <version>${tuscany.version}</version> + <scope>test</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-node-impl</artifactId> + <version>${tuscany.version}</version> + <scope>test</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-host-jetty</artifactId> + <version>${tuscany.version}</version> + <scope>test</scope> + </dependency> + + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>4.5</version> + <scope>test</scope> + </dependency> + + </dependencies> + <build> + <finalName>${artifactId}</finalName> + <plugins> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>build-helper-maven-plugin</artifactId> + <version>1.0</version> + <executions> + <execution> + <id>add-source</id> + <phase>generate-sources</phase> + <goals> + <goal>add-source</goal> + </goals> + <configuration> + <sources> + <source>target/sdo-source</source> + </sources> + </configuration> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.apache.tuscany.sdo</groupId> + <artifactId>tuscany-sdo-plugin</artifactId> + <version>1.1.1</version> + <executions> + <execution> + <id>generate-sdo</id> + <phase>generate-sources</phase> + <configuration> + <schemaFile> + ${basedir}/src/main/resources/CreditCardPayment.wsdl + </schemaFile> + <javaPackage>com.tuscanyscatours.payment.creditcard</javaPackage> + <prefix>CreditCardPayment</prefix> + <noNotification>true</noNotification> + <noContainer>true</noContainer> + <noUnsettable>true</noUnsettable> + </configuration> + <goals> + <goal>generate</goal> + </goals> + </execution> + + </executions> + </plugin> + + </plugins> + </build> +</project> diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/creditcard-payment-sdo/src/main/java/com/tuscanyscatours/payment/creditcard/CreditCardPayment.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/creditcard-payment-sdo/src/main/java/com/tuscanyscatours/payment/creditcard/CreditCardPayment.java new file mode 100644 index 0000000000..9f508ecc59 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/creditcard-payment-sdo/src/main/java/com/tuscanyscatours/payment/creditcard/CreditCardPayment.java @@ -0,0 +1,33 @@ +package com.tuscanyscatours.payment.creditcard;
+
+import javax.jws.WebMethod;
+import javax.jws.WebParam;
+import javax.jws.WebResult;
+import javax.jws.WebService;
+import javax.xml.ws.RequestWrapper;
+import javax.xml.ws.ResponseWrapper;
+
+/**
+ * This class was generated by the JAX-WS RI.
+ * JAX-WS RI 2.1.3-b02-
+ * Generated source version: 2.1
+ *
+ */
+@WebService(name = "CreditCardPayment", targetNamespace = "http://tuscanyscatours.com/CreditCardPayment/")
+public interface CreditCardPayment {
+
+ /**
+ *
+ * @param amount
+ * @param creditCard
+ * @return
+ * returns java.lang.String
+ */
+ @WebMethod(action = "http://tuscanyscatours.com/CreditCardPayment/authorize")
+ @WebResult(name = "Status", targetNamespace = "")
+ @RequestWrapper(localName = "authorize", targetNamespace = "http://tuscanyscatours.com/CreditCardPayment/", className = "com.tuscanyscatours.payment.creditcard.AuthorizeType")
+ @ResponseWrapper(localName = "authorizeResponse", targetNamespace = "http://tuscanyscatours.com/CreditCardPayment/", className = "com.tuscanyscatours.payment.creditcard.AuthorizeResponseType")
+ public String authorize(@WebParam(name = "CreditCard", targetNamespace = "") CreditCardDetailsType creditCard,
+ @WebParam(name = "Amount", targetNamespace = "") float amount);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/creditcard-payment-sdo/src/main/java/com/tuscanyscatours/payment/creditcard/impl/CreditCardPaymentImpl.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/creditcard-payment-sdo/src/main/java/com/tuscanyscatours/payment/creditcard/impl/CreditCardPaymentImpl.java new file mode 100644 index 0000000000..ed817a58bb --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/creditcard-payment-sdo/src/main/java/com/tuscanyscatours/payment/creditcard/impl/CreditCardPaymentImpl.java @@ -0,0 +1,46 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package com.tuscanyscatours.payment.creditcard.impl;
+
+import org.osoa.sca.annotations.Service;
+
+import com.tuscanyscatours.payment.creditcard.CreditCardDetailsType;
+import com.tuscanyscatours.payment.creditcard.CreditCardPayment;
+
+/**
+ *
+ */
+@Service(CreditCardPayment.class)
+public class CreditCardPaymentImpl implements CreditCardPayment {
+
+ public String authorize(CreditCardDetailsType creditCard, float amount) {
+ if (creditCard != null) {
+ System.out.println("Checking card: name = " + creditCard.getCardOwner().getName()
+ + " number = "
+ + creditCard.getCreditCardNumber()
+ + " for amount "
+ + amount);
+ } else {
+ System.out.println("Checking card is null");
+ }
+
+ return "OK";
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/creditcard-payment-sdo/src/main/resources/CreditCardPayment.wsdl b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/creditcard-payment-sdo/src/main/resources/CreditCardPayment.wsdl new file mode 100644 index 0000000000..d7e274aeee --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/creditcard-payment-sdo/src/main/resources/CreditCardPayment.wsdl @@ -0,0 +1,117 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<wsdl:definitions name="CreditCardPayment"
+ targetNamespace="http://www.tuscanyscatours.com/CreditCardPayment/"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:tns="http://www.tuscanyscatours.com/CreditCardPayment/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:bpws="http://schemas.xmlsoap.org/ws/2004/03/business-process/"
+ xmlns:plnk="http://schemas.xmlsoap.org/ws/2004/03/partner-link/">
+ <wsdl:types>
+ <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.tuscanyscatours.com/CreditCardPayment/"
+ xmlns:tns="http://www.tuscanyscatours.com/CreditCardPayment/">
+
+ <xsd:element name="authorize" type="tns:AuthorizeType"/>
+ <xsd:complexType name="AuthorizeType">
+ <xsd:sequence>
+ <xsd:element name="CreditCard" type="tns:CreditCardDetailsType"></xsd:element>
+ <xsd:element name="Amount" type="xsd:float"></xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:element name="authorizeResponse" type="tns:AuthorizeResponseType"/>
+ <xsd:complexType name="AuthorizeResponseType">
+ <xsd:sequence>
+ <xsd:element name="Status" type="xsd:string"></xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:complexType name="CreditCardDetailsType">
+ <xsd:sequence>
+ <xsd:element name="CreditCardType" type="tns:CreditCardTypeType" minOccurs="0" />
+ <xsd:element name="CreditCardNumber" type="xsd:string" minOccurs="0" />
+ <xsd:element name="ExpMonth" type="xsd:int" minOccurs="0" />
+ <xsd:element name="ExpYear" type="xsd:int" minOccurs="0" />
+ <xsd:element name="CardOwner" type="tns:PayerType" minOccurs="0" />
+ <xsd:element name="CVV2" type="xsd:string" minOccurs="0" />
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:simpleType name="CreditCardTypeType">
+ <xsd:restriction base="xsd:token">
+ <xsd:enumeration value="Visa" />
+ <xsd:enumeration value="MasterCard" />
+ <xsd:enumeration value="Discover" />
+ <xsd:enumeration value="Amex" />
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:complexType name="PayerType">
+ <xsd:sequence>
+ <xsd:element name="Name" type="xsd:string" />
+ <xsd:element name="Address" type="tns:AddressType" />
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:complexType name="AddressType">
+ <xsd:sequence>
+ <xsd:element name="Street" type="xsd:string" />
+ <xsd:element name="City" type="xsd:string" />
+ <xsd:element name="State" type="xsd:string" />
+ <xsd:element name="ZipCode" type="xsd:string" />
+ <xsd:element name="HomePhone" type="xsd:string" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:schema>
+ </wsdl:types>
+ <wsdl:message name="AuthorizeRequest">
+ <wsdl:part name="parameters" element="tns:authorize"></wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="AuthorizeResponse">
+ <wsdl:part name="parameters" element="tns:authorizeResponse"></wsdl:part>
+ </wsdl:message>
+ <wsdl:portType name="CreditCardPayment">
+ <wsdl:operation name="authorize">
+ <wsdl:input message="tns:AuthorizeRequest"></wsdl:input>
+ <wsdl:output message="tns:AuthorizeResponse"></wsdl:output>
+ </wsdl:operation>
+ </wsdl:portType>
+ <wsdl:binding name="CreditCardPaymentBinding" type="tns:CreditCardPayment">
+ <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
+ <wsdl:operation name="authorize">
+ <soap:operation soapAction="http://www.example.org/CreditCardPayment/authorize" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:service name="CreditCardPaymentService">
+ <wsdl:port name="CreditCardPaymentPort" binding="tns:CreditCardPaymentBinding">
+ <soap:address location="http://localhost:8080/CreditCardPayment" />
+ </wsdl:port>
+ </wsdl:service>
+
+ <plnk:partnerLinkType name="CreditCardPaymentLinkType">
+ <plnk:role name="forward" portType="tns:CreditCardPayment"/>
+ </plnk:partnerLinkType>
+
+</wsdl:definitions>
\ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/creditcard-payment-sdo/src/main/resources/META-INF/sca-contribution.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/creditcard-payment-sdo/src/main/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..ab31664247 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/creditcard-payment-sdo/src/main/resources/META-INF/sca-contribution.xml @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0" + xmlns:tours="http://tuscanyscatours.com/"> + <deployable composite="tours:creditcard" /> +</contribution> diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/creditcard-payment-sdo/src/main/resources/creditcard.composite b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/creditcard-payment-sdo/src/main/resources/creditcard.composite new file mode 100644 index 0000000000..f5cd7c2506 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/creditcard-payment-sdo/src/main/resources/creditcard.composite @@ -0,0 +1,33 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" + targetNamespace="http://tuscanyscatours.com/" + name="creditcard"> + + <component name="CreditCardPayment"> + <implementation.java class="com.tuscanyscatours.payment.creditcard.impl.CreditCardPaymentImpl" /> + <service name="CreditCardPayment"> + <interface.wsdl interface="http://www.tuscanyscatours.com/CreditCardPayment/#wsdl.interface(CreditCardPayment)"/> + <binding.ws uri="http://localhost:8082/CreditCardPayment" /> + <binding.sca /> + </service> + </component> + +</composite> diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/creditcard-payment-sdo/src/test/java/scatours/payment/creditcard/CreditCardPaymentTestCase.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/creditcard-payment-sdo/src/test/java/scatours/payment/creditcard/CreditCardPaymentTestCase.java new file mode 100644 index 0000000000..b7d76a061f --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/creditcard-payment-sdo/src/test/java/scatours/payment/creditcard/CreditCardPaymentTestCase.java @@ -0,0 +1,80 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package scatours.payment.creditcard;
+
+import org.apache.tuscany.sca.node.SCAClient;
+import org.apache.tuscany.sca.node.SCAContribution;
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.SCANodeFactory;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import com.tuscanyscatours.payment.creditcard.CreditCardDetailsType;
+import com.tuscanyscatours.payment.creditcard.CreditCardPayment;
+import com.tuscanyscatours.payment.creditcard.CreditCardPaymentFactory;
+import com.tuscanyscatours.payment.creditcard.PayerType;
+
+/**
+ *
+ */
+public class CreditCardPaymentTestCase {
+ private static SCANode node;
+
+ /**
+ * @throws java.lang.Exception
+ */
+ @BeforeClass
+ public static void setUpBeforeClass() throws Exception {
+ SCANodeFactory factory = SCANodeFactory.newInstance();
+ node = factory.createSCANode(null, new SCAContribution("creditcard-sdo", "./target/classes"));
+ node.start();
+ }
+
+ @Test
+ public void testCreditCardPayment() {
+ SCAClient client = (SCAClient)node;
+ CreditCardPayment cc = client.getService(CreditCardPayment.class, "CreditCardPayment");
+
+ CreditCardPaymentFactory factory = CreditCardPaymentFactory.INSTANCE;
+ CreditCardDetailsType ccDetails = factory.createCreditCardDetailsType();
+ ccDetails.setCreditCardType("Visa");
+ ccDetails.setCreditCardNumber("1111-2222-3333-4444");
+ ccDetails.setExpMonth(9);
+ ccDetails.setExpYear(2010);
+ PayerType ccOwner = factory.createPayerType();
+ ccOwner.setName("Fred");
+ ccDetails.setCardOwner(ccOwner);
+
+ System.out.println(cc.authorize(ccDetails, 100.00f));
+ }
+
+ /**
+ * @throws java.lang.Exception
+ */
+ @AfterClass
+ public static void tearDownAfterClass() throws Exception {
+ if (node != null) {
+ node.stop();
+ node = null;
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/creditcard-payment-webapp/build.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/creditcard-payment-webapp/build.xml new file mode 100644 index 0000000000..0b3926e913 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/creditcard-payment-webapp/build.xml @@ -0,0 +1,155 @@ +<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<project name="scatours-contribution-creditcard-payment-webapp" default="compile">
+ <import file="../../antdefs.xml"/>
+
+ <target name="wsdljava">
+ <antcall target="wsimport">
+ <param name="wsdlfile" value="CreditCardPayment.wsdl"/>
+ <param name="javaclass" value="com/tuscanyscatours/payment/creditcard/CreditCardPayment.class"/>
+ <param name="package" value="com.tuscanyscatours.payment.creditcard"/>
+ </antcall>
+ </target>
+
+ <target name="copy-lib">
+ <antcall target="add-implementation-web"/>
+ <copy todir="target/lib">
+ <fileset file="../creditcard-payment-jaxb/target/scatours-contribution-creditcard-payment-jaxb.jar"/>
+ <fileset refid="tuscany-modules"/>
+ <fileset refid="tuscany-dependencies"/>
+ </copy>
+ </target>
+
+ <fileset id="tuscany-modules" dir="${env.TUSCANY_HOME}/modules">
+ <include name="tuscany-assembly-1.*.jar"/>
+ <include name="tuscany-assembly-xml-1.*.jar"/>
+ <include name="tuscany-assembly-xsd-1.*.jar"/>
+ <include name="tuscany-binding-sca-1.*.jar"/>
+ <include name="tuscany-binding-sca-xml-1.*.jar"/>
+ <include name="tuscany-binding-ws-1.*.jar"/>
+ <include name="tuscany-binding-ws-axis2-1.*.jar"/>
+ <include name="tuscany-binding-ws-axis2-policy-1.*.jar"/>
+ <include name="tuscany-binding-ws-wsdlgen-1.*.jar"/>
+ <include name="tuscany-binding-ws-xml-1.*.jar"/>
+ <include name="tuscany-contribution-1.*.jar"/>
+ <include name="tuscany-contribution-impl-1.*.jar"/>
+ <include name="tuscany-contribution-java-1.*.jar"/>
+ <include name="tuscany-contribution-jee-1.*.jar"/>
+ <include name="tuscany-contribution-namespace-1.*.jar"/>
+ <include name="tuscany-contribution-xml-1.*.jar"/>
+ <include name="tuscany-core-1.*.jar"/>
+ <include name="tuscany-core-databinding-1.*.jar"/>
+ <include name="tuscany-core-spi-1.*.jar"/>
+ <include name="tuscany-databinding-1.*.jar"/>
+ <include name="tuscany-databinding-axiom-1.*.jar"/>
+ <include name="tuscany-databinding-jaxb-1.*.jar"/>
+ <include name="tuscany-databinding-jaxb-axiom-1.*.jar"/>
+ <include name="tuscany-definitions-1.*.jar"/>
+ <include name="tuscany-definitions-xml-1.*.jar"/>
+ <include name="tuscany-endpoint-1.*.jar"/>
+ <include name="tuscany-extensibility-1.*.jar"/>
+ <include name="tuscany-host-embedded-1.*.jar"/>
+ <include name="tuscany-host-http-1.*.jar"/>
+ <include name="tuscany-host-webapp-1.*.jar"/>
+ <include name="tuscany-implementation-java-1.*.jar"/>
+ <include name="tuscany-implementation-java-runtime-1.*.jar"/>
+ <include name="tuscany-implementation-java-xml-1.*.jar"/>
+ <include name="tuscany-implementation-node-1.*.jar"/>
+ <include name="tuscany-implementation-web-1.*.jar"/>
+ <include name="tuscany-implementation-web-runtime-1.*.jar"/>
+ <include name="tuscany-interface-1.*.jar"/>
+ <include name="tuscany-interface-java-1.*.jar"/>
+ <include name="tuscany-interface-java-jaxws-1.*.jar"/>
+ <include name="tuscany-interface-java-xml-1.*.jar"/>
+ <include name="tuscany-interface-wsdl-1.*.jar"/>
+ <include name="tuscany-interface-wsdl-xml-1.*.jar"/>
+ <include name="tuscany-monitor-1.*.jar"/>
+ <include name="tuscany-node-api-1.*.jar"/>
+ <include name="tuscany-node-impl-1.*.jar"/>
+ <include name="tuscany-policy-1.*.jar"/>
+ <include name="tuscany-policy-security-1.*.jar"/>
+ <include name="tuscany-policy-xml-1.*.jar"/>
+ <include name="tuscany-policy-xml-ws-1.*.jar"/>
+ <include name="tuscany-sca-api-1.*.jar"/>
+ <include name="tuscany-sca-api-extension-1.*.jar"/>
+ <include name="tuscany-xsd-1.*.jar"/>
+ <include name="tuscany-xsd-xml-1.*.jar"/>
+ </fileset>
+
+ <fileset id="tuscany-dependencies" dir="${env.TUSCANY_HOME}/lib">
+ <include name="activation-1.1.jar"/>
+ <include name="annogen-0.1.0.jar"/>
+ <include name="asm-3.1.jar"/>
+ <include name="axiom-api-1.2.7.jar"/>
+ <include name="axiom-dom-1.2.7.jar"/>
+ <include name="axiom-impl-1.2.7.jar"/>
+ <include name="axis-ant-1.4.jar"/>
+ <include name="axis2-adb-1.4.1.jar"/>
+ <include name="axis2-codegen-1.4.1.jar"/>
+ <include name="axis2-java2wsdl-1.4.1.jar"/>
+ <include name="axis2-kernel-1.4.1.jar"/>
+ <include name="axis2-mtompolicy-1.4.1.jar"/>
+ <include name="backport-util-concurrent-3.1.jar"/>
+ <include name="cglib-nodep-2.2.jar"/>
+ <include name="common-2.2.3.jar"/>
+ <include name="commons-codec-1.3.jar"/>
+ <include name="commons-collections-3.1.jar"/>
+ <include name="commons-discovery-0.2.jar"/>
+ <include name="commons-fileupload-1.2.jar"/>
+ <include name="commons-httpclient-3.1.jar"/>
+ <include name="commons-io-1.4.jar"/>
+ <include name="commons-logging-1.1.1.jar"/>
+ <include name="dom4j-1.6.1.jar"/>
+ <include name="geronimo-activation_1.1_spec-1.0.1.jar"/>
+ <include name="geronimo-javamail_1.4_spec-1.2.jar"/>
+ <include name="geronimo-jms_1.1_spec-1.1.jar"/>
+ <include name="geronimo-stax-api_1.0_spec-1.0.1.jar"/>
+ <include name="httpcore-4.0-beta1.jar"/>
+ <include name="httpcore-nio-4.0-beta1.jar"/>
+ <include name="jaxb-api-2.1.jar"/>
+ <include name="jaxb-impl-2.1.7.jar"/>
+ <include name="jaxen-1.1.1.jar"/>
+ <include name="jaxws-api-2.1.jar"/>
+ <include name="jdom-1.0.jar"/>
+ <include name="jsr181-api-1.0-MR1.jar"/>
+ <include name="jsr250-api-1.0.jar"/>
+ <include name="log4j-1.2.15.jar"/>
+ <include name="mail-1.4.jar"/>
+ <include name="mex-1.41-impl.jar"/>
+ <include name="neethi-2.0.4.jar"/>
+ <include name="opensaml-1.1.jar"/>
+ <include name="rampart-core-1.4.jar"/>
+ <include name="rampart-policy-1.4.jar"/>
+ <include name="rampart-trust-1.4.jar"/>
+ <include name="servlet-api-2.5.jar"/>
+ <include name="stax-api-1.0-2.jar"/>
+ <include name="woden-api-1.0M8.jar"/>
+ <include name="woden-impl-dom-1.0M8.jar"/>
+ <include name="wsdl4j-1.6.2.jar"/>
+ <include name="wss4j-1.5.4.jar"/>
+ <include name="wstx-asl-3.2.4.jar"/>
+ <include name="xalan-2.7.0.jar"/>
+ <include name="xercesImpl-2.8.1.jar"/>
+ <include name="xml-apis-1.3.03.jar"/>
+ <include name="xmlParserAPIs-2.6.0.jar"/>
+ <include name="XmlSchema-1.4.2.jar"/>
+ <include name="xmlsec-1.4.2.jar"/>
+ </fileset>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/creditcard-payment-webapp/pom.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/creditcard-payment-webapp/pom.xml new file mode 100644 index 0000000000..88b9cec19c --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/creditcard-payment-webapp/pom.xml @@ -0,0 +1,67 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <version>1.0-SNAPSHOT</version>
+ <artifactId>scatours-contribution-creditcard-payment-webapp</artifactId>
+ <packaging>war</packaging>
+ <name>Apache Tuscany SCA Tours CreditCard Payment WebApp Contribution</name>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca-api</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-web-runtime</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-webapp</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-contribution-creditcard-payment-jaxb</artifactId>
+ <version>${pom.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ </build>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/creditcard-payment-webapp/src/main/resources/CreditCardPayment.wsdl b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/creditcard-payment-webapp/src/main/resources/CreditCardPayment.wsdl new file mode 100644 index 0000000000..6dcc619c48 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/creditcard-payment-webapp/src/main/resources/CreditCardPayment.wsdl @@ -0,0 +1,134 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<wsdl:definitions name="CreditCardPayment"
+ targetNamespace="http://www.tuscanyscatours.com/CreditCardPayment/"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:tns="http://www.tuscanyscatours.com/CreditCardPayment/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:bpws="http://schemas.xmlsoap.org/ws/2004/03/business-process/"
+ xmlns:plnk="http://schemas.xmlsoap.org/ws/2004/03/partner-link/">
+ <wsdl:types>
+ <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.tuscanyscatours.com/CreditCardPayment/"
+ xmlns:tns="http://www.tuscanyscatours.com/CreditCardPayment/">
+
+ <!-- https://jaxb.dev.java.net/issues/show_bug.cgi?id=518 -->
+ <!-- I have to change the complex types to be annoymous -->
+ <xsd:element name="authorize">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="CreditCard" type="tns:CreditCardDetailsType"></xsd:element>
+ <xsd:element name="Amount" type="xsd:float"></xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="authorizeResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="Status" type="xsd:string"></xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:complexType name="CreditCardDetailsType">
+ <xsd:sequence>
+ <xsd:element name="CreditCardType" type="tns:CreditCardTypeType" minOccurs="0" />
+ <xsd:element name="CreditCardNumber" type="xsd:string" minOccurs="0" />
+ <xsd:element name="ExpMonth" type="xsd:int" minOccurs="0" />
+ <xsd:element name="ExpYear" type="xsd:int" minOccurs="0" />
+ <xsd:element name="CardOwner" type="tns:PayerType" minOccurs="0" />
+ <xsd:element name="CVV2" type="xsd:string" minOccurs="0" />
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:simpleType name="CreditCardTypeType">
+ <xsd:restriction base="xsd:token">
+ <xsd:enumeration value="Visa" />
+ <xsd:enumeration value="MasterCard" />
+ <xsd:enumeration value="Discover" />
+ <xsd:enumeration value="Amex" />
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:complexType name="PayerType">
+ <xsd:sequence>
+ <xsd:element name="Name" type="xsd:string" />
+ <xsd:element name="Address" type="tns:AddressType" />
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:complexType name="AddressType">
+ <xsd:sequence>
+ <xsd:element name="Street" type="xsd:string" />
+ <xsd:element name="City" type="xsd:string" />
+ <xsd:element name="State" type="xsd:string" />
+ <xsd:element name="ZipCode" type="xsd:string" />
+ <xsd:element name="HomePhone" type="xsd:string" />
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="authorizeFault">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="errorCode" type="xsd:string"></xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:schema>
+ </wsdl:types>
+ <wsdl:message name="AuthorizeRequest">
+ <wsdl:part name="parameters" element="tns:authorize"></wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="AuthorizeResponse">
+ <wsdl:part name="parameters" element="tns:authorizeResponse"></wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="AuthorizeFault">
+ <wsdl:part name="parameters" element="tns:authorizeFault"></wsdl:part>
+ </wsdl:message>
+ <wsdl:portType name="CreditCardPayment">
+ <wsdl:operation name="authorize">
+ <wsdl:input message="tns:AuthorizeRequest"></wsdl:input>
+ <wsdl:output message="tns:AuthorizeResponse"></wsdl:output>
+ <wsdl:fault name="authorizationFailure" message="tns:AuthorizeFault"></wsdl:fault> + </wsdl:operation>
+ </wsdl:portType>
+ <wsdl:binding name="CreditCardPaymentBinding" type="tns:CreditCardPayment">
+ <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
+ <wsdl:operation name="authorize">
+ <soap:operation soapAction="http://www.tuscanyscatours.com/CreditCardPayment/authorize" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ <wsdl:fault name="authorizationFailure">
+ <soap:fault name="authorizationFailure" use="literal"/>
+ </wsdl:fault>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:service name="CreditCardPaymentService">
+ <wsdl:port name="CreditCardPaymentPort" binding="tns:CreditCardPaymentBinding">
+ <soap:address location="http://localhost:8080/CreditCardPayment" />
+ </wsdl:port>
+ </wsdl:service>
+
+ <plnk:partnerLinkType name="CreditCardPaymentLinkType">
+ <plnk:role name="forward" portType="tns:CreditCardPayment"/>
+ </plnk:partnerLinkType>
+</wsdl:definitions>
\ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/creditcard-payment-webapp/src/main/webapp/META-INF/sca-contribution.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/creditcard-payment-webapp/src/main/webapp/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..898321c510 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/creditcard-payment-webapp/src/main/webapp/META-INF/sca-contribution.xml @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0" + xmlns:scatours="http://tuscanyscatours.com/"> + <deployable composite="scatours:creditcard-webapp" /> +</contribution> diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/creditcard-payment-webapp/src/main/webapp/META-INF/sca-deployables/web.composite b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/creditcard-payment-webapp/src/main/webapp/META-INF/sca-deployables/web.composite new file mode 100644 index 0000000000..ac9128a6d5 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/creditcard-payment-webapp/src/main/webapp/META-INF/sca-deployables/web.composite @@ -0,0 +1,43 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://tuscanyscatours.com/"
+ name="creditcard-webapp">
+
+ <component name="CreditCardPaymentWeb">
+ <implementation.web web-uri="" />
+ <reference name="service" target="CreditCardPayment">
+ <interface.java interface="com.tuscanyscatours.payment.creditcard.CreditCardPayment"/>
+ <!--
+ <binding.ws uri="http://localhost:8082/CreditCardPayment" />
+ -->
+ </reference>
+ </component>
+
+ <component name="CreditCardPayment">
+ <implementation.java class="com.tuscanyscatours.payment.creditcard.impl.CreditCardPaymentImpl" />
+ <service name="CreditCardPayment">
+ <interface.wsdl interface="http://www.tuscanyscatours.com/CreditCardPayment/#wsdl.interface(CreditCardPayment)" />
+ <binding.ws uri="http://localhost:8080/CreditCardPayment" />
+ <binding.sca/>
+ </service>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/creditcard-payment-webapp/src/main/webapp/WEB-INF/web.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/creditcard-payment-webapp/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000000..a6188e25ba --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/creditcard-payment-webapp/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,42 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<web-app version="2.4"
+ xmlns="http://java.sun.com/xml/ns/j2ee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" >
+
+ <display-name>SCA Tours Credit Card Payment WebApp</display-name>
+
+ <filter>
+ <filter-name>tuscany</filter-name>
+ <filter-class>org.apache.tuscany.sca.host.webapp.TuscanyServletFilter</filter-class>
+ </filter>
+
+ <filter-mapping>
+ <filter-name>tuscany</filter-name>
+ <url-pattern>/*</url-pattern>
+ </filter-mapping>
+
+ <welcome-file-list>
+ <welcome-file>creditcard.jsp</welcome-file>
+ </welcome-file-list>
+</web-app>
+
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/creditcard-payment-webapp/src/main/webapp/creditcard.jsp b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/creditcard-payment-webapp/src/main/webapp/creditcard.jsp new file mode 100644 index 0000000000..98b7f41e7b --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/creditcard-payment-webapp/src/main/webapp/creditcard.jsp @@ -0,0 +1,71 @@ +<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<%@ page contentType="text/html;charset=UTF-8" language="java"%>
+<%@ taglib uri="http://www.osoa.org/sca/sca_jsp.tld" prefix="sca"%>
+
+<sca:reference name="service"
+ type="com.tuscanyscatours.payment.creditcard.CreditCardPayment" />
+
+
+<%@page import="com.tuscanyscatours.payment.creditcard.CreditCardPaymentService"%>
+<%@page import="com.tuscanyscatours.payment.creditcard.ObjectFactory"%>
+<%@page import="com.tuscanyscatours.payment.creditcard.CreditCardDetailsType"%>
+<%@page import="com.tuscanyscatours.payment.creditcard.CreditCardTypeType"%>
+<%@page import="com.tuscanyscatours.payment.creditcard.PayerType"%><html>
+<body>
+
+<h2>SCATours Credit Card Payment Web Application</h2>
+
+<p>
+<form action="creditcard.jsp" method="get">Card Type: <select
+ name="type">
+ <option value="Visa" selected="selected">Visa</option>
+ <option value="MasterCard">MasterCard</option>
+ <option value="Amex">Amex</option>
+ <option value="Discover">Discover</option>
+</select> <br />
+Card Number: <input type="text" name="cardNumber" /><br />
+Card Holder: <input type="text" name="cardHolder" /><br />
+Amount (EUR): <input type="text" name="amount" /><br />
+<p>
+<input type="submit" name="charge" value="Submit" /></form>
+
+<%
+ String c = request.getParameter("charge");
+ if (c != null) {
+ ObjectFactory objectFactory = new ObjectFactory();
+ CreditCardDetailsType ccDetails = objectFactory.createCreditCardDetailsType();
+ ccDetails.setCreditCardType(CreditCardTypeType.fromValue(request.getParameter("type")));
+ ccDetails.setCreditCardNumber(request.getParameter("cardNumber"));
+ ccDetails.setCVV2("123");
+ ccDetails.setExpMonth(12);
+ ccDetails.setExpYear(2011);
+ PayerType ccOwner = objectFactory.createPayerType();
+ ccOwner.setName(request.getParameter("cardHolder"));
+ ccDetails.setCardOwner(ccOwner);
+ float amount = Float.parseFloat(request.getParameter("amount"));
+%>
+<%=service.authorize(ccDetails, amount)%>
+<%
+ }
+%>
+
+</body>
+</html>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/currency-corba/build.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/currency-corba/build.xml new file mode 100644 index 0000000000..fa2ac47a64 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/currency-corba/build.xml @@ -0,0 +1,22 @@ +<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<project name="scatours-contribution-currency-corba" default="compile">
+ <import file="../../antdefs.xml"/>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/currency-corba/pom.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/currency-corba/pom.xml new file mode 100644 index 0000000000..8ab8cff332 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/currency-corba/pom.xml @@ -0,0 +1,51 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent><version>1.0-SNAPSHOT</version>
+ <artifactId>scatours-contribution-currency-corba</artifactId>
+ <name>Apache Tuscany SCA Tours Currency Converter Contribution With CORBA Binding</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.5</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ </build>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/currency-corba/src/main/resources/META-INF/sca-contribution.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/currency-corba/src/main/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..f22dd9b55d --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/currency-corba/src/main/resources/META-INF/sca-contribution.xml @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0">
+ <import.java package="com.tuscanyscatours.currencyconverter"/>
+ <import.java package="com.tuscanyscatours.currencyconverter.impl"/>
+</contribution>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/currency-corba/src/main/resources/currency-converter-corba.composite b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/currency-corba/src/main/resources/currency-converter-corba.composite new file mode 100644 index 0000000000..3fde6ea309 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/currency-corba/src/main/resources/currency-converter-corba.composite @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ targetNamespace="http://tuscanyscatours.com/"
+ name="currencyconverter">
+
+ <component name="CurrencyConverter">
+ <implementation.java class="com.tuscanyscatours.currencyconverter.impl.CurrencyConverterImpl" />
+ <service name="CurrencyConverter">
+ <interface.java interface="com.tuscanyscatours.currencyconverter.CurrencyConverter" />
+ <tuscany:binding.corba host="localhost" port="5080" name="CurrencyConverterCORBAService"/>
+ </service>
+ </component>
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/currency-jms/build.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/currency-jms/build.xml new file mode 100644 index 0000000000..1b5cef445b --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/currency-jms/build.xml @@ -0,0 +1,22 @@ +<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<project name="scatours-contribution-currency-jms" default="compile">
+ <import file="../../antdefs.xml"/>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/currency-jms/pom.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/currency-jms/pom.xml new file mode 100644 index 0000000000..d2890508b2 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/currency-jms/pom.xml @@ -0,0 +1,71 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent><version>1.0-SNAPSHOT</version>
+ <artifactId>scatours-contribution-currency-jms</artifactId>
+ <name>Apache Tuscany SCA Tours Currency Converter Contribution With JMS Binding</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-jms-runtime</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.5</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>activemq-all</artifactId>
+ <version>5.2.0</version>
+ <scope>test</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>activemq-web-demo</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ </build>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/currency-jms/src/main/resources/META-INF/sca-contribution.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/currency-jms/src/main/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..89ba1a3578 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/currency-jms/src/main/resources/META-INF/sca-contribution.xml @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0">
+ <import.java package="com.tuscanyscatours.currencyconverter" />
+ <import.java package="com.tuscanyscatours.currencyconverter.impl" />
+</contribution>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/currency-jms/src/main/resources/currency-converter-jms.composite b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/currency-jms/src/main/resources/currency-converter-jms.composite new file mode 100644 index 0000000000..ac34d6f562 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/currency-jms/src/main/resources/currency-converter-jms.composite @@ -0,0 +1,37 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://tuscanyscatours.com/"
+ name="currencyconverter">
+
+ <component name="CurrencyConverter">
+ <implementation.java class="com.tuscanyscatours.currencyconverter.impl.CurrencyConverterImpl"/>
+ <service name="CurrencyConverter">
+ <interface.java interface="com.tuscanyscatours.currencyconverter.CurrencyConverter"/>
+ <binding.jms initialContextFactory="org.apache.activemq.jndi.ActiveMQInitialContextFactory"
+ jndiURL="tcp://localhost:61619">
+ <destination name="RequestQueue" create="ifnotexist"/>
+ <response>
+ <destination name="ResponseQueue" create="ifnotexist"/>
+ </response>
+ </binding.jms>
+ </service>
+ </component>
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/currency-jsp/build.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/currency-jsp/build.xml new file mode 100644 index 0000000000..d1b0d955ac --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/currency-jsp/build.xml @@ -0,0 +1,97 @@ +<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<project name="scatours-contribution-currency-jsp" default="compile">
+ <import file="../../antdefs.xml"/>
+
+ <target name="copy-lib">
+ <antcall target="add-implementation-web"/>
+ <copy todir="target/lib">
+ <fileset file="../currency/target/scatours-contribution-currency.jar"/>
+ <fileset refid="tuscany-modules"/>
+ <fileset refid="tuscany-dependencies"/>
+ </copy>
+ </target>
+
+ <fileset id="tuscany-modules" dir="${env.TUSCANY_HOME}/modules">
+ <include name="tuscany-assembly-1.*.jar"/>
+ <include name="tuscany-assembly-xml-1.*.jar"/>
+ <include name="tuscany-assembly-xsd-1.*.jar"/>
+ <include name="tuscany-binding-sca-1.*.jar"/>
+ <include name="tuscany-binding-sca-xml-1.*.jar"/>
+ <include name="tuscany-contribution-1.*.jar"/>
+ <include name="tuscany-contribution-impl-1.*.jar"/>
+ <include name="tuscany-contribution-java-1.*.jar"/>
+ <include name="tuscany-contribution-jee-1.*.jar"/>
+ <include name="tuscany-contribution-namespace-1.*.jar"/>
+ <include name="tuscany-contribution-xml-1.*.jar"/>
+ <include name="tuscany-core-1.*.jar"/>
+ <include name="tuscany-core-databinding-1.*.jar"/>
+ <include name="tuscany-core-spi-1.*.jar"/>
+ <include name="tuscany-databinding-1.*.jar"/>
+ <include name="tuscany-databinding-jaxb-1.*.jar"/>
+ <include name="tuscany-definitions-1.*.jar"/>
+ <include name="tuscany-definitions-xml-1.*.jar"/>
+ <include name="tuscany-endpoint-1.*.jar"/>
+ <include name="tuscany-extensibility-1.*.jar"/>
+ <include name="tuscany-host-embedded-1.*.jar"/>
+ <include name="tuscany-host-http-1.*.jar"/>
+ <include name="tuscany-host-webapp-1.*.jar"/>
+ <include name="tuscany-implementation-java-1.*.jar"/>
+ <include name="tuscany-implementation-java-runtime-1.*.jar"/>
+ <include name="tuscany-implementation-java-xml-1.*.jar"/>
+ <include name="tuscany-implementation-node-1.*.jar"/>
+ <include name="tuscany-implementation-web-1.*.jar"/>
+ <include name="tuscany-implementation-web-runtime-1.*.jar"/>
+ <include name="tuscany-interface-1.*.jar"/>
+ <include name="tuscany-interface-java-1.*.jar"/>
+ <include name="tuscany-interface-java-jaxws-1.*.jar"/>
+ <include name="tuscany-interface-java-xml-1.*.jar"/>
+ <include name="tuscany-monitor-1.*.jar"/>
+ <include name="tuscany-node-api-1.*.jar"/>
+ <include name="tuscany-node-impl-1.*.jar"/>
+ <include name="tuscany-policy-1.*.jar"/>
+ <include name="tuscany-policy-xml-1.*.jar"/>
+ <include name="tuscany-sca-api-1.*.jar"/>
+ <include name="tuscany-sca-api-extension-1.*.jar"/>
+ <include name="tuscany-xsd-1.*.jar"/>
+ </fileset>
+
+ <fileset id="tuscany-dependencies" dir="${env.TUSCANY_HOME}/lib">
+ <include name="activation-1.1.jar"/>
+ <include name="asm-3.1.jar"/>
+ <include name="axiom-api-1.2.7.jar"/>
+ <include name="axiom-impl-1.2.7.jar"/>
+ <include name="cglib-nodep-2.2.jar"/>
+ <include name="common-2.2.3.jar"/>
+ <include name="commons-logging-1.1.1.jar"/>
+ <include name="geronimo-activation_1.1_spec-1.0.1.jar"/>
+ <include name="geronimo-javamail_1.4_spec-1.2.jar"/>
+ <include name="geronimo-stax-api_1.0_spec-1.0.1.jar"/>
+ <include name="jaxb-api-2.1.jar"/>
+ <include name="jaxb-impl-2.1.7.jar"/>
+ <include name="jaxen-1.1.1.jar"/>
+ <include name="jaxws-api-2.1.jar"/>
+ <include name="jsr181-api-1.0-MR1.jar"/>
+ <include name="jsr250-api-1.0.jar"/>
+ <include name="stax-api-1.0-2.jar"/>
+ <include name="wstx-asl-3.2.4.jar"/>
+ <include name="XmlSchema-1.4.2.jar"/>
+ </fileset>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/currency-jsp/pom.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/currency-jsp/pom.xml new file mode 100644 index 0000000000..91fc29c370 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/currency-jsp/pom.xml @@ -0,0 +1,58 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent><version>1.0-SNAPSHOT</version>
+ <artifactId>scatours-contribution-currency-jsp</artifactId>
+ <packaging>war</packaging>
+ <name>Apache Tuscany SCA Tours Currency Converter JSP Contribution</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-web-runtime</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-webapp</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-contribution-currency</artifactId>
+ <version>${pom.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ </build>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/currency-jsp/src/main/webapp/META-INF/sca-deployables/web.composite b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/currency-jsp/src/main/webapp/META-INF/sca-deployables/web.composite new file mode 100644 index 0000000000..50667b1ac0 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/currency-jsp/src/main/webapp/META-INF/sca-deployables/web.composite @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ targetNamespace="http://tuscanyscatours.com/"
+ name="CurrencyConverterJSP">
+
+ <component name="WebClient">
+ <implementation.web web-uri=""/>
+ <reference name="currencyConverter" target="CurrencyConverter"/>
+ </component>
+
+ <component name="CurrencyConverter">
+ <implementation.java class="com.tuscanyscatours.currencyconverter.impl.CurrencyConverterImpl"/>
+ <service name="CurrencyConverter"/>
+ </component>
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/currency-jsp/src/main/webapp/WEB-INF/web.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/currency-jsp/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000000..3b2c79ca76 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/currency-jsp/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,42 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<web-app version="2.4"
+ xmlns="http://java.sun.com/xml/ns/j2ee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" >
+
+ <display-name>SCA Tours Currency Converter JSP</display-name>
+
+ <filter>
+ <filter-name>tuscany</filter-name>
+ <filter-class>org.apache.tuscany.sca.host.webapp.TuscanyServletFilter</filter-class>
+ </filter>
+
+ <filter-mapping>
+ <filter-name>tuscany</filter-name>
+ <url-pattern>/*</url-pattern>
+ </filter-mapping>
+
+ <welcome-file-list>
+ <welcome-file>currency-converter.jsp</welcome-file>
+ </welcome-file-list>
+</web-app>
+
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/currency-jsp/src/main/webapp/currency-converter.jsp b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/currency-jsp/src/main/webapp/currency-converter.jsp new file mode 100644 index 0000000000..daf8c5cff1 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/currency-jsp/src/main/webapp/currency-converter.jsp @@ -0,0 +1,49 @@ +<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<%@ page contentType="text/html;charset=UTF-8" language="java" %>
+<%@ taglib uri="http://www.osoa.org/sca/sca_jsp.tld" prefix="sca" %>
+
+<sca:reference name="currencyConverter" type="com.tuscanyscatours.currencyconverter.CurrencyConverter"/>
+
+<html>
+<body>
+<h2>SCA Tours Currency Converter JSP</h2>
+Welcome to the SCA Tours Currency Converter:
+<p>
+
+<form method=post action="currency-converter.jsp">
+Enter value in US Dollars
+<input type=text name=dollars size=15>
+<p>
+<input type=submit>
+</form>
+
+<p>
+
+<%
+ String dollarsStr = request.getParameter( "dollars" );
+ if ( dollarsStr != null) {
+ double dollars = Double.parseDouble(dollarsStr);
+ double converted = currencyConverter.convert("USD", "GBP", dollars);
+ out.println(dollars + " US Dollars = " + converted + " GB Pounds");
+ }
+%>
+</body>
+</html>
+
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/currency-rmi/build.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/currency-rmi/build.xml new file mode 100644 index 0000000000..a969f0c819 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/currency-rmi/build.xml @@ -0,0 +1,22 @@ +<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<project name="scatours-contribution-currency-rmi" default="compile">
+ <import file="../../antdefs.xml"/>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/currency-rmi/pom.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/currency-rmi/pom.xml new file mode 100644 index 0000000000..0bd15a7895 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/currency-rmi/pom.xml @@ -0,0 +1,51 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent><version>1.0-SNAPSHOT</version>
+ <artifactId>scatours-contribution-currency-rmi</artifactId>
+ <name>Apache Tuscany SCA Tours Currency Converter Contribution With RMI Binding</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.5</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ </build>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/currency-rmi/src/main/resources/META-INF/sca-contribution.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/currency-rmi/src/main/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..cf7325d247 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/currency-rmi/src/main/resources/META-INF/sca-contribution.xml @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0">
+ <import.java package="com.tuscanyscatours.currencyconverter" />
+ <import.java package="com.tuscanyscatours.currencyconverter.impl" />
+</contribution>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/currency-rmi/src/main/resources/currency-converter-rmi.composite b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/currency-rmi/src/main/resources/currency-converter-rmi.composite new file mode 100644 index 0000000000..52df3a183f --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/currency-rmi/src/main/resources/currency-converter-rmi.composite @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ targetNamespace="http://tuscanyscatours.com/"
+ name="currencyconverter">
+
+ <component name="CurrencyConverter">
+ <implementation.java class="com.tuscanyscatours.currencyconverter.impl.CurrencyConverterImpl" />
+ <service name="CurrencyConverter">
+ <interface.java interface="com.tuscanyscatours.currencyconverter.CurrencyConverter" />
+ <tuscany:binding.rmi host="localhost" port="8099" serviceName="CurrencyConverterRMI"/>
+ </service>
+ </component>
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/currency-servlet/build.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/currency-servlet/build.xml new file mode 100644 index 0000000000..23edaad6a6 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/currency-servlet/build.xml @@ -0,0 +1,100 @@ +<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<project name="scatours-contribution-currency-servlet" default="compile">
+ <import file="../../antdefs.xml"/>
+ <path id="compile-path">
+ <pathelement path="../currency/target/scatours-contribution-currency.jar"/>
+ </path>
+
+ <target name="copy-lib">
+ <antcall target="add-implementation-web"/>
+ <copy todir="target/lib">
+ <fileset file="../currency/target/scatours-contribution-currency.jar"/>
+ <fileset refid="tuscany-modules"/>
+ <fileset refid="tuscany-dependencies"/>
+ </copy>
+ </target>
+
+ <fileset id="tuscany-modules" dir="${env.TUSCANY_HOME}/modules">
+ <include name="tuscany-assembly-1.*.jar"/>
+ <include name="tuscany-assembly-xml-1.*.jar"/>
+ <include name="tuscany-assembly-xsd-1.*.jar"/>
+ <include name="tuscany-binding-sca-1.*.jar"/>
+ <include name="tuscany-binding-sca-xml-1.*.jar"/>
+ <include name="tuscany-contribution-1.*.jar"/>
+ <include name="tuscany-contribution-impl-1.*.jar"/>
+ <include name="tuscany-contribution-java-1.*.jar"/>
+ <include name="tuscany-contribution-jee-1.*.jar"/>
+ <include name="tuscany-contribution-namespace-1.*.jar"/>
+ <include name="tuscany-contribution-xml-1.*.jar"/>
+ <include name="tuscany-core-1.*.jar"/>
+ <include name="tuscany-core-databinding-1.*.jar"/>
+ <include name="tuscany-core-spi-1.*.jar"/>
+ <include name="tuscany-databinding-1.*.jar"/>
+ <include name="tuscany-databinding-jaxb-1.*.jar"/>
+ <include name="tuscany-definitions-1.*.jar"/>
+ <include name="tuscany-definitions-xml-1.*.jar"/>
+ <include name="tuscany-endpoint-1.*.jar"/>
+ <include name="tuscany-extensibility-1.*.jar"/>
+ <include name="tuscany-host-embedded-1.*.jar"/>
+ <include name="tuscany-host-http-1.*.jar"/>
+ <include name="tuscany-host-webapp-1.*.jar"/>
+ <include name="tuscany-implementation-java-1.*.jar"/>
+ <include name="tuscany-implementation-java-runtime-1.*.jar"/>
+ <include name="tuscany-implementation-java-xml-1.*.jar"/>
+ <include name="tuscany-implementation-node-1.*.jar"/>
+ <include name="tuscany-implementation-web-1.*.jar"/>
+ <include name="tuscany-implementation-web-runtime-1.*.jar"/>
+ <include name="tuscany-interface-1.*.jar"/>
+ <include name="tuscany-interface-java-1.*.jar"/>
+ <include name="tuscany-interface-java-jaxws-1.*.jar"/>
+ <include name="tuscany-interface-java-xml-1.*.jar"/>
+ <include name="tuscany-monitor-1.*.jar"/>
+ <include name="tuscany-node-api-1.*.jar"/>
+ <include name="tuscany-node-impl-1.*.jar"/>
+ <include name="tuscany-policy-1.*.jar"/>
+ <include name="tuscany-policy-xml-1.*.jar"/>
+ <include name="tuscany-sca-api-1.*.jar"/>
+ <include name="tuscany-sca-api-extension-1.*.jar"/>
+ <include name="tuscany-xsd-1.*.jar"/>
+ </fileset>
+
+ <fileset id="tuscany-dependencies" dir="${env.TUSCANY_HOME}/lib">
+ <include name="activation-1.1.jar"/>
+ <include name="asm-3.1.jar"/>
+ <include name="axiom-api-1.2.7.jar"/>
+ <include name="axiom-impl-1.2.7.jar"/>
+ <include name="cglib-nodep-2.2.jar"/>
+ <include name="common-2.2.3.jar"/>
+ <include name="commons-logging-1.1.1.jar"/>
+ <include name="geronimo-activation_1.1_spec-1.0.1.jar"/>
+ <include name="geronimo-javamail_1.4_spec-1.2.jar"/>
+ <include name="geronimo-stax-api_1.0_spec-1.0.1.jar"/>
+ <include name="jaxb-api-2.1.jar"/>
+ <include name="jaxb-impl-2.1.7.jar"/>
+ <include name="jaxen-1.1.1.jar"/>
+ <include name="jaxws-api-2.1.jar"/>
+ <include name="jsr181-api-1.0-MR1.jar"/>
+ <include name="jsr250-api-1.0.jar"/>
+ <include name="stax-api-1.0-2.jar"/>
+ <include name="wstx-asl-3.2.4.jar"/>
+ <include name="XmlSchema-1.4.2.jar"/>
+ </fileset>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/currency-servlet/pom.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/currency-servlet/pom.xml new file mode 100644 index 0000000000..cc4ba525a1 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/currency-servlet/pom.xml @@ -0,0 +1,72 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent><version>1.0-SNAPSHOT</version>
+ <artifactId>scatours-contribution-currency-servlet</artifactId>
+ <packaging>war</packaging>
+ <name>Apache Tuscany SCA Tours Currency Converter Servlet Contribution</name>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca-api</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-web-runtime</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-webapp</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>2.3</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-contribution-currency</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ </build>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/currency-servlet/src/main/java/com/tuscanyscatours/currencyconverter/servlet/CurrencyConverterServlet.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/currency-servlet/src/main/java/com/tuscanyscatours/currencyconverter/servlet/CurrencyConverterServlet.java new file mode 100644 index 0000000000..3584ebbb93 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/currency-servlet/src/main/java/com/tuscanyscatours/currencyconverter/servlet/CurrencyConverterServlet.java @@ -0,0 +1,73 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package com.tuscanyscatours.currencyconverter.servlet; + +import java.io.IOException; +import java.io.Writer; + +import javax.servlet.ServletConfig; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.osoa.sca.ComponentContext; +import org.osoa.sca.annotations.Reference; + +import com.tuscanyscatours.currencyconverter.CurrencyConverter; + +public class CurrencyConverterServlet extends HttpServlet { + + @Reference + protected CurrencyConverter currencyConverter; + + @Override + public void init(ServletConfig config) { + if (currencyConverter == null) { + // The Currency Converter reference will only be injected from the @Reference + // annotation in containers supporting SCA "deep" integration. In other + // environments in can be looked up from the ComponentContext. + ComponentContext context = + (ComponentContext)config.getServletContext().getAttribute("org.osoa.sca.ComponentContext"); + currencyConverter = context.getService(CurrencyConverter.class, "currencyConverter"); + } + } + + @Override + protected void service(HttpServletRequest request, HttpServletResponse response) throws IOException { + Writer out = response.getWriter(); + out.write("<html><body><h2>SCA Tours Currency Converter Servlet</h2>"); + out.write("Welcome to the SCA Tours Currency Converter Servlet<p>"); + out.write("<form method=post action=\"CurrencyConverterServlet\">"); + out.write("Enter value in US Dollars"); + out.write("<input type=text name=dollars size=15><p>"); + out.write("<input type=submit>"); + out.write("</form><p>"); + + String dollarsStr = request.getParameter("dollars"); + if (dollarsStr != null) { + double dollars = Double.parseDouble(dollarsStr); + double converted = currencyConverter.convert("USD", "GBP", dollars); + out.write(dollars + " US Dollars = " + converted + " GB Pounds"); + } + + out.write("</body></html>"); + out.flush(); + out.close(); + } +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/currency-servlet/src/main/webapp/META-INF/sca-deployables/web.composite b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/currency-servlet/src/main/webapp/META-INF/sca-deployables/web.composite new file mode 100644 index 0000000000..c9ef16ee1b --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/currency-servlet/src/main/webapp/META-INF/sca-deployables/web.composite @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ targetNamespace="http://scatours.com"
+ name="CurrencyConverterServlet">
+
+ <component name="WebClient">
+ <implementation.web web-uri=""/>
+ <reference name="currencyConverter" target="CurrencyConverter"/>
+ </component>
+
+ <component name="CurrencyConverter">
+ <implementation.java class="com.tuscanyscatours.currencyconverter.impl.CurrencyConverterImpl"/>
+ <service name="CurrencyConverter"/>
+ </component>
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/currency-servlet/src/main/webapp/WEB-INF/web.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/currency-servlet/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000000..2204c67870 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/currency-servlet/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,52 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<web-app version="2.4"
+ xmlns="http://java.sun.com/xml/ns/j2ee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" >
+
+ <display-name>SCA Tours Currency Converter Servlet</display-name>
+
+ <filter>
+ <filter-name>tuscany</filter-name>
+ <filter-class>org.apache.tuscany.sca.host.webapp.TuscanyServletFilter</filter-class>
+ </filter>
+
+ <filter-mapping>
+ <filter-name>tuscany</filter-name>
+ <url-pattern>/*</url-pattern>
+ </filter-mapping>
+
+ <servlet>
+ <servlet-name>CurrencyConverterServlet</servlet-name>
+ <servlet-class>com.tuscanyscatours.currencyconverter.servlet.CurrencyConverterServlet</servlet-class>
+ </servlet>
+
+ <servlet-mapping>
+ <servlet-name>CurrencyConverterServlet</servlet-name>
+ <url-pattern>/CurrencyConverterServlet</url-pattern>
+ </servlet-mapping>
+
+ <welcome-file-list>
+ <welcome-file>CurrencyConverterServlet</welcome-file>
+ </welcome-file-list>
+</web-app>
+
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/currency-ws/build.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/currency-ws/build.xml new file mode 100644 index 0000000000..bf87bbfba6 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/currency-ws/build.xml @@ -0,0 +1,22 @@ +<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<project name="scatours-contribution-currency-ws" default="compile">
+ <import file="../../antdefs.xml"/>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/currency-ws/pom.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/currency-ws/pom.xml new file mode 100644 index 0000000000..4a50cd4f43 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/currency-ws/pom.xml @@ -0,0 +1,51 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent><version>1.0-SNAPSHOT</version>
+ <artifactId>scatours-contribution-currency-ws</artifactId>
+ <name>Apache Tuscany SCA Tours Currency Converter Contribution With Web Service Binding</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.5</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ </build>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/currency-ws/src/main/resources/META-INF/sca-contribution.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/currency-ws/src/main/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..cf7325d247 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/currency-ws/src/main/resources/META-INF/sca-contribution.xml @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0">
+ <import.java package="com.tuscanyscatours.currencyconverter" />
+ <import.java package="com.tuscanyscatours.currencyconverter.impl" />
+</contribution>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/currency-ws/src/main/resources/currency-converter-ws.composite b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/currency-ws/src/main/resources/currency-converter-ws.composite new file mode 100644 index 0000000000..b048a826f1 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/currency-ws/src/main/resources/currency-converter-ws.composite @@ -0,0 +1,31 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://tuscanyscatours.com/"
+ name="currencyconverter">
+
+ <component name="CurrencyConverter">
+ <implementation.java class="com.tuscanyscatours.currencyconverter.impl.CurrencyConverterImpl" />
+ <service name="CurrencyConverter">
+ <interface.java interface="com.tuscanyscatours.currencyconverter.CurrencyConverter" />
+ <binding.ws />
+ </service>
+ </component>
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/currency/build.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/currency/build.xml new file mode 100644 index 0000000000..0f5811e299 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/currency/build.xml @@ -0,0 +1,22 @@ +<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<project name="scatours-contribution-currency" default="compile">
+ <import file="../../antdefs.xml"/>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/currency/pom.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/currency/pom.xml new file mode 100644 index 0000000000..bd99e15850 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/currency/pom.xml @@ -0,0 +1,57 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent><version>1.0-SNAPSHOT</version>
+ <artifactId>scatours-contribution-currency</artifactId>
+ <name>Apache Tuscany SCA Tours Currency Converter Contribution</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca-api</artifactId>
+ <version>${tuscany.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.5</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ </build>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/currency/src/main/java/com/tuscanyscatours/currencyconverter/CurrencyConverter.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/currency/src/main/java/com/tuscanyscatours/currencyconverter/CurrencyConverter.java new file mode 100644 index 0000000000..b1f783bfba --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/currency/src/main/java/com/tuscanyscatours/currencyconverter/CurrencyConverter.java @@ -0,0 +1,33 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package com.tuscanyscatours.currencyconverter;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * The CurrencyConverter service interface
+ */
+@Remotable
+public interface CurrencyConverter {
+
+ double getExchangeRate(String fromCurrencyCode, String toCurrencyCode);
+
+ double convert(String fromCurrencyCode, String toCurrencyCode, double amount);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/currency/src/main/java/com/tuscanyscatours/currencyconverter/impl/CurrencyConverterImpl.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/currency/src/main/java/com/tuscanyscatours/currencyconverter/impl/CurrencyConverterImpl.java new file mode 100644 index 0000000000..6ad9a957c7 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/currency/src/main/java/com/tuscanyscatours/currencyconverter/impl/CurrencyConverterImpl.java @@ -0,0 +1,53 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package com.tuscanyscatours.currencyconverter.impl;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.osoa.sca.annotations.Service;
+
+import com.tuscanyscatours.currencyconverter.CurrencyConverter;
+
+/**
+ * An implementation of the CurrencyConverter service
+ */
+@Service(interfaces = {CurrencyConverter.class})
+public class CurrencyConverterImpl implements CurrencyConverter {
+
+ // currency index
+ private Map<String, Integer> currencyIndex = new HashMap<String, Integer>();
+
+ // exchange rates
+ private final double rates[][] = { {1.00, 0.50, 0.66}, {2.00, 1.00, 1.33}, {1.50, 0.75, 1.00}};
+
+ public CurrencyConverterImpl() {
+ currencyIndex.put("USD", new Integer(0));
+ currencyIndex.put("GBP", new Integer(1));
+ currencyIndex.put("EUR", new Integer(2));
+ }
+
+ public double getExchangeRate(String fromCurrencyCode, String toCurrencyCode) {
+ return rates[currencyIndex.get(fromCurrencyCode).intValue()][currencyIndex.get(toCurrencyCode).intValue()];
+ }
+
+ public double convert(String fromCurrencyCode, String toCurrencyCode, double amount) {
+ return amount * getExchangeRate(fromCurrencyCode, toCurrencyCode);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/currency/src/main/resources/META-INF/sca-contribution.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/currency/src/main/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..b11328f405 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/currency/src/main/resources/META-INF/sca-contribution.xml @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0">
+ <export.java package="com.tuscanyscatours.currencyconverter" />
+ <export.java package="com.tuscanyscatours.currencyconverter.impl" />
+</contribution>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/currency/src/main/resources/currency-converter.composite b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/currency/src/main/resources/currency-converter.composite new file mode 100644 index 0000000000..41d0d325d4 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/currency/src/main/resources/currency-converter.composite @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://tuscanyscatours.com/"
+ name="currencyconverter">
+
+ <component name="CurrencyConverter">
+ <implementation.java class="com.tuscanyscatours.currencyconverter.impl.CurrencyConverterImpl" />
+ <service name="CurrencyConverter"/>
+ </component>
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/databinding-client/build.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/databinding-client/build.xml new file mode 100644 index 0000000000..94f9290854 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/databinding-client/build.xml @@ -0,0 +1,25 @@ +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> + +<project name="scatours-contribution-databinding-client" default="compile"> + <import file="../../antdefs.xml"/> + <path id="compile-path"> + <pathelement path="../payment-java/target/scatours-contribution-payment-java.jar"/> + </path> +</project> diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/databinding-client/pom.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/databinding-client/pom.xml new file mode 100644 index 0000000000..1ceea2b45d --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/databinding-client/pom.xml @@ -0,0 +1,48 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<project> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>scatours</artifactId> + <version>1.0-SNAPSHOT</version> + <relativePath>../../pom.xml</relativePath> + </parent><version>1.0-SNAPSHOT</version> + <artifactId>scatours-contribution-databinding-client</artifactId> + <name>Apache Tuscany SCA Tours Databinding Client Contribution</name> + + <dependencies> + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-sca-api</artifactId> + <version>${tuscany.version}</version> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>scatours-contribution-payment-java</artifactId> + <version>${pom.version}</version> + </dependency> + </dependencies> + + <build> + <finalName>${artifactId}</finalName> + </build> +</project> diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/databinding-client/src/main/java/scatours/client/TestClient.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/databinding-client/src/main/java/scatours/client/TestClient.java new file mode 100644 index 0000000000..f598a6f056 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/databinding-client/src/main/java/scatours/client/TestClient.java @@ -0,0 +1,40 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package scatours.client; + +import org.osoa.sca.annotations.Reference; +import org.osoa.sca.annotations.Service; + +import com.tuscanyscatours.payment.Payment; + +@Service(Runnable.class) +public class TestClient { + @Reference + protected Payment payment; + + public TestClient() { + } + + public void run() { + System.out.println("Call Payment component"); + System.out.println(payment.makePaymentMember("c-0", 100.00f)); + System.out.println(payment.makePaymentMember("c-1", 100.00f)); + } +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/databinding-client/src/main/resources/META-INF/sca-contribution.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/databinding-client/src/main/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..87e8535676 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/databinding-client/src/main/resources/META-INF/sca-contribution.xml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0" + xmlns:client="http://client.scatours/"> + <import.java package="com.tuscanyscatours.payment" /> + <deployable composite="client:Client" /> +</contribution> diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/databinding-client/src/main/resources/client.composite b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/databinding-client/src/main/resources/client.composite new file mode 100644 index 0000000000..e19697290c --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/databinding-client/src/main/resources/client.composite @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" + targetNamespace="http://client.scatours/" + name="Client"> + + <component name="TestClient"> + <implementation.java class="scatours.client.TestClient" /> + <reference name="payment" target="Payment" /> + </component> +</composite> diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/emailgateway/build.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/emailgateway/build.xml new file mode 100644 index 0000000000..ec234bcb4a --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/emailgateway/build.xml @@ -0,0 +1,30 @@ +<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<project name="scatours-contribution-emailgateway" default="compile">
+ <import file="../../antdefs.xml"/>
+
+ <target name="wsdljava">
+ <antcall target="wsimport">
+ <param name="wsdlfile" value="EmailGateway.wsdl"/>
+ <param name="javaclass" value="com/tuscanyscatours/emailgateway/EmailGateway.class"/>
+ <param name="package" value="com.tuscanyscatours.emailgateway"/>
+ </antcall>
+ </target>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/emailgateway/pom.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/emailgateway/pom.xml new file mode 100644 index 0000000000..789edbe475 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/emailgateway/pom.xml @@ -0,0 +1,137 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <version>1.0-SNAPSHOT</version>
+ <artifactId>scatours-contribution-emailgateway</artifactId>
+ <name>Apache Tuscany SCA Tours Email Gateway Contribution</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca-api</artifactId>
+ <version>${tuscany.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-axis2</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-jetty</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node-impl</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.5</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+ <pluginRepositories>
+ <pluginRepository>
+ <id>java.net2</id>
+ <name>java.net Maven 2.x Repository</name>
+ <url>http://download.java.net/maven/2</url>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </pluginRepository>
+ </pluginRepositories>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ <version>1.0</version>
+ <executions>
+ <execution>
+ <id>add-source</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>add-source</goal>
+ </goals>
+ <configuration>
+ <sources>
+ <source>target/jaxws-source</source>
+ </sources>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>jaxws-maven-plugin</artifactId>
+ <version>1.12</version>
+ <executions>
+ <execution>
+ <id>wsimport</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>wsimport</goal>
+ </goals>
+ <configuration>
+ <packageName>com.tuscanyscatours.emailgateway</packageName>
+ <wsdlDirectory>${basedir}/src/main/resources
+ </wsdlDirectory>
+ <wsdlFiles>
+ <wsdlFile>EmailGateway.wsdl</wsdlFile>
+ </wsdlFiles>
+ <sourceDestDir>${project.build.directory}/jaxws-source
+ </sourceDestDir>
+ <verbose>false</verbose>
+ <xnocompile>true</xnocompile>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/emailgateway/src/main/java/com/tuscanyscatours/emailgateway/impl/EmailGatewayImpl.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/emailgateway/src/main/java/com/tuscanyscatours/emailgateway/impl/EmailGatewayImpl.java new file mode 100644 index 0000000000..0ff12b4efa --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/emailgateway/src/main/java/com/tuscanyscatours/emailgateway/impl/EmailGatewayImpl.java @@ -0,0 +1,38 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package com.tuscanyscatours.emailgateway.impl;
+
+import org.osoa.sca.annotations.Service;
+
+import com.tuscanyscatours.emailgateway.EmailGateway;
+import com.tuscanyscatours.emailgateway.EmailType;
+
+/**
+ *
+ */
+@Service(EmailGateway.class)
+public class EmailGatewayImpl implements EmailGateway {
+
+ public String sendEmail(EmailType email) {
+ System.out.println("Sending mail to " + email.getTo());
+ return "SENT";
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/emailgateway/src/main/resources/EmailGateway.wsdl b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/emailgateway/src/main/resources/EmailGateway.wsdl new file mode 100644 index 0000000000..bb9cd27027 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/emailgateway/src/main/resources/EmailGateway.wsdl @@ -0,0 +1,89 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<wsdl:definitions name="EmailGateway"
+ targetNamespace="http://www.tuscanyscatours.com/EmailGateway/"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:tns="http://www.tuscanyscatours.com/EmailGateway/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:bpws="http://schemas.xmlsoap.org/ws/2004/03/business-process/"
+ xmlns:plnk="http://schemas.xmlsoap.org/ws/2004/03/partner-link/">
+ <wsdl:types>
+ <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.tuscanyscatours.com/EmailGateway/"
+ xmlns:tns="http://www.tuscanyscatours.com/EmailGateway/">
+
+ <xsd:element name="sendEmail" type="tns:SendEmailType"/>
+ <xsd:complexType name="SendEmailType">
+ <xsd:sequence>
+ <xsd:element name="Email" type="tns:EmailType"></xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:element name="sendEmailResponse" type="tns:SendEmailResponseType"/>
+ <xsd:complexType name="SendEmailResponseType">
+ <xsd:sequence>
+ <xsd:element name="Status" type="xsd:string"></xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:complexType name="EmailType">
+ <xsd:sequence>
+ <xsd:element name="To" type="xsd:string"/>
+ <xsd:element name="Title" type="xsd:string"/>
+ <xsd:element name="Body" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:schema>
+ </wsdl:types>
+ <wsdl:message name="SendEmailRequest">
+ <wsdl:part name="parameters" element="tns:sendEmail"></wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="SendEmailResponse">
+ <wsdl:part name="parameters" element="tns:sendEmailResponse"></wsdl:part>
+ </wsdl:message>
+ <wsdl:portType name="EmailGateway">
+ <wsdl:operation name="sendEmail">
+ <wsdl:input message="tns:SendEmailRequest"></wsdl:input>
+ <wsdl:output message="tns:SendEmailResponse"></wsdl:output>
+ </wsdl:operation>
+ </wsdl:portType>
+ <wsdl:binding name="EmailGatewayBinding" type="tns:EmailGateway">
+ <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
+ <wsdl:operation name="sendEmail">
+ <soap:operation soapAction="http://www.tuscanyscatours.com/EmailGateway/sendEmail" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:service name="EmailGatewayService">
+ <wsdl:port name="EmailGatewayPort" binding="tns:EmailGatewayBinding">
+ <soap:address location="http://localhost:8088/EmailGateway" />
+ </wsdl:port>
+ </wsdl:service>
+
+ <plnk:partnerLinkType name="EmailGatewayLinkType">
+ <plnk:role name="forward" portType="tns:EmailGateway"/>
+ </plnk:partnerLinkType>
+</wsdl:definitions>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/emailgateway/src/main/resources/META-INF/sca-contribution.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/emailgateway/src/main/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..7d8aa000cc --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/emailgateway/src/main/resources/META-INF/sca-contribution.xml @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:e="http://emailgateway" >
+ <export.java package="com.tuscanyscatours.emailgateway" />
+ <export.java package="com.tuscanyscatours.emailgateway.impl" />
+ <deployable composite="e:emailgateway" />
+</contribution>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/emailgateway/src/main/resources/emailgateway.composite b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/emailgateway/src/main/resources/emailgateway.composite new file mode 100644 index 0000000000..a401b2a96e --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/emailgateway/src/main/resources/emailgateway.composite @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" + xmlns:t="http://tuscany.apache.org/xmlns/sca/1.0" + xmlns:e="http://emailgateway" + targetNamespace="http://emailgateway" + name="emailgateway"> + + <component name="EmailGateway"> + <implementation.java class="com.tuscanyscatours.emailgateway.impl.EmailGatewayImpl" /> + <service name="EmailGateway"> + <binding.ws uri="http://localhost:8088/EmailGateway" /> + </service> + </component> +</composite> diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/emailgateway/src/test/java/scatours/emailgateway/EmailGatewayTestCase.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/emailgateway/src/test/java/scatours/emailgateway/EmailGatewayTestCase.java new file mode 100644 index 0000000000..8b0ecba024 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/emailgateway/src/test/java/scatours/emailgateway/EmailGatewayTestCase.java @@ -0,0 +1,76 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package scatours.emailgateway;
+
+import org.apache.tuscany.sca.node.SCAClient;
+import org.apache.tuscany.sca.node.SCAContribution;
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.SCANodeFactory;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import com.tuscanyscatours.emailgateway.EmailGateway;
+import com.tuscanyscatours.emailgateway.EmailType;
+import com.tuscanyscatours.emailgateway.ObjectFactory;
+
+/**
+ *
+ */
+public class EmailGatewayTestCase {
+ private static SCANode node;
+
+ /**
+ * @throws java.lang.Exception
+ */
+ @BeforeClass
+ public static void setUpBeforeClass() throws Exception {
+ SCANodeFactory factory = SCANodeFactory.newInstance();
+ node =
+ factory.createSCANode(null,
+ new SCAContribution("emailgateway", "./target/classes"),
+ new SCAContribution("emailgateway-test", "./target/test-classes"));
+ node.start();
+ }
+
+ @Test
+ public void testEmailGateway() {
+ SCAClient client = (SCAClient)node;
+ EmailGateway cc = client.getService(EmailGateway.class, "EmailGatewayClient");
+ ObjectFactory objectFactory = new ObjectFactory();
+ EmailType email = objectFactory.createEmailType();
+ email.setTo("Fred");
+ email.setTitle("An email");
+ email.setBody("A message");
+ System.out.println(cc.sendEmail(email));
+ }
+
+ /**
+ * @throws java.lang.Exception
+ */
+ @AfterClass
+ public static void tearDownAfterClass() throws Exception {
+ if (node != null) {
+ node.stop();
+ node = null;
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/emailgateway/src/test/java/scatours/emailgateway/client/impl/EmailGatewayClientImpl.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/emailgateway/src/test/java/scatours/emailgateway/client/impl/EmailGatewayClientImpl.java new file mode 100644 index 0000000000..10d4984665 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/emailgateway/src/test/java/scatours/emailgateway/client/impl/EmailGatewayClientImpl.java @@ -0,0 +1,41 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package scatours.emailgateway.client.impl;
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+import com.tuscanyscatours.emailgateway.EmailGateway;
+import com.tuscanyscatours.emailgateway.EmailType;
+
+/**
+ *
+ */
+@Service(EmailGateway.class)
+public class EmailGatewayClientImpl implements EmailGateway {
+ @Reference
+ protected EmailGateway emailGateway;
+
+ public String sendEmail(EmailType email) {
+ // Delegate the external web service
+ return emailGateway.sendEmail(email);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/emailgateway/src/test/resources/META-INF/sca-contribution.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/emailgateway/src/test/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..cc141d7703 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/emailgateway/src/test/resources/META-INF/sca-contribution.xml @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:e="http://emailgateway-test">
+ <import.java package="com.tuscanyscatours.emailgateway" />
+ <import.java package="com.tuscanyscatours.emailgateway.impl" />
+ <deployable composite="e:emailgateway-test" />
+</contribution>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/emailgateway/src/test/resources/emailgateway-test.composite b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/emailgateway/src/test/resources/emailgateway-test.composite new file mode 100644 index 0000000000..8305356bda --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/emailgateway/src/test/resources/emailgateway-test.composite @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:t="http://tuscany.apache.org/xmlns/sca/1.0"
+ xmlns:e="http://emailgateway-test"
+ targetNamespace="http://emailgateway-test"
+ name="emailgateway-test">
+ <component name="EmailGatewayClient">
+ <implementation.java class="scatours.emailgateway.client.impl.EmailGatewayClientImpl" />
+ <reference name="emailGateway">
+ <binding.ws uri="http://localhost:8088/EmailGateway" />
+ </reference>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/feed-logger/build.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/feed-logger/build.xml new file mode 100644 index 0000000000..c23a99e6ca --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/feed-logger/build.xml @@ -0,0 +1,22 @@ +<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<project name="scatours-contribution-feed-logger" default="compile">
+ <import file="../../antdefs.xml"/>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/feed-logger/pom.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/feed-logger/pom.xml new file mode 100644 index 0000000000..7f7db730bc --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/feed-logger/pom.xml @@ -0,0 +1,68 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent><version>1.0-SNAPSHOT</version>
+ <artifactId>scatours-contribution-feed-logger</artifactId>
+ <name>Apache Tuscany SCA Tours Feed Logger Contribution</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca-api</artifactId>
+ <version>${tuscany.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-atom-abdera</artifactId>
+ <version>${tuscany.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-rss-rome</artifactId>
+ <version>${tuscany.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.5</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ </build>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/feed-logger/src/main/java/com/tuscanyscatours/feedlogger/FeedLogger.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/feed-logger/src/main/java/com/tuscanyscatours/feedlogger/FeedLogger.java new file mode 100644 index 0000000000..0f5d18d53b --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/feed-logger/src/main/java/com/tuscanyscatours/feedlogger/FeedLogger.java @@ -0,0 +1,30 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package com.tuscanyscatours.feedlogger; + +public interface FeedLogger { + + /** + * Captures the configured feeds and logs the feed entries. + * + * @param maxEntriesPerFeed The maximum number of entries to log per feed + */ + public void logFeeds(int maxEntriesPerFeed); +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/feed-logger/src/main/java/com/tuscanyscatours/feedlogger/impl/FeedLoggerImpl.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/feed-logger/src/main/java/com/tuscanyscatours/feedlogger/impl/FeedLoggerImpl.java new file mode 100644 index 0000000000..a949d63383 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/feed-logger/src/main/java/com/tuscanyscatours/feedlogger/impl/FeedLoggerImpl.java @@ -0,0 +1,99 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package com.tuscanyscatours.feedlogger.impl; + +import java.util.List; + +import org.apache.abdera.model.Entry; +import org.apache.abdera.model.Feed; +import org.osoa.sca.annotations.Reference; + +import com.sun.syndication.feed.synd.SyndEntry; +import com.sun.syndication.feed.synd.SyndFeed; +import com.tuscanyscatours.feedlogger.FeedLogger; + +public class FeedLoggerImpl implements FeedLogger { + + /** + * Reference to the SCA Tours Blog Atom feed. + */ + @Reference + public org.apache.tuscany.sca.binding.atom.collection.Collection scaToursBlogAtom; + + /** + * Reference to the SCA Tours Blog RSS feed. + */ + @Reference + public org.apache.tuscany.sca.binding.rss.collection.Collection scaToursBlogRSS; + + /** + * Reference to the BBC News RSS feed. + */ + @Reference + public org.apache.tuscany.sca.binding.rss.collection.Collection bbcNews; + + /** + * {@inheritDoc} + */ + public void logFeeds(int maxEntriesPerFeed) { + System.out.println("Logging SCA Tours Blog Atom feed:"); + logAtomFeed(scaToursBlogAtom, maxEntriesPerFeed); + + System.out.println("Logging SCA Tours Blog RSS feed:"); + logRSSFeed(scaToursBlogRSS, maxEntriesPerFeed); + + System.out.println("Logging BBC News feed:"); + logRSSFeed(bbcNews, maxEntriesPerFeed); + } + + /** + * Logs up to maxEntries entries from the specified feed. + * + * @param maxEntries The maximum number of entries to log per feed + */ + private void logAtomFeed(org.apache.tuscany.sca.binding.atom.collection.Collection atomFeed, int maxEntries) { + final Feed feed = atomFeed.getFeed(); + System.out.println("Feed: " + feed.getTitle()); + final List<Entry> entries = feed.getEntries(); + + for (int i = 0; i < entries.size() && i < maxEntries; i++) { + Entry entry = entries.get(i); + System.out.println("Entry: " + entry.getTitle()); + } + System.out.println(); + } + + /** + * Logs up to maxEntries entries from the specified feed. + * + * @param maxEntries The maximum number of entries to log + */ + private void logRSSFeed(org.apache.tuscany.sca.binding.rss.collection.Collection rssFeed, int maxEntries) { + SyndFeed feed = rssFeed.getFeed(); + System.out.println("Feed: " + feed.getTitle()); + + List<SyndEntry> entries = feed.getEntries(); + for (int i = 0; i < entries.size() && i < maxEntries; i++) { + SyndEntry entry = entries.get(i); + System.out.println("Entry: " + entry.getTitle()); + } + System.out.println(); + } +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/feed-logger/src/main/resources/META-INF/sca-contribution.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/feed-logger/src/main/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..556807a0f0 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/feed-logger/src/main/resources/META-INF/sca-contribution.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0">
+</contribution>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/feed-logger/src/main/resources/feed-logger.composite b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/feed-logger/src/main/resources/feed-logger.composite new file mode 100644 index 0000000000..17c24adefb --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/feed-logger/src/main/resources/feed-logger.composite @@ -0,0 +1,40 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ targetNamespace="http://tuscanyscatours.com/"
+ name="feedLogger">
+
+ <service name="FeedLogger" promote="FeedLogger">
+ </service>
+
+ <component name="FeedLogger">
+ <implementation.java class="com.tuscanyscatours.feedlogger.impl.FeedLoggerImpl"/>
+ <reference name="scaToursBlogAtom">
+ <tuscany:binding.atom uri="http://scatours.wordpress.com/?feed=atom"/>
+ </reference>
+ <reference name="scaToursBlogRSS">
+ <tuscany:binding.rss uri="http://scatours.wordpress.com/?feed=rss"/>
+ </reference>
+ <reference name="bbcNews">
+ <tuscany:binding.rss uri="http://newsrss.bbc.co.uk/rss/newsonline_uk_edition/world/rss.xml"/>
+ </reference>
+ </component>
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/flight/build.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/flight/build.xml new file mode 100644 index 0000000000..0a151c1a20 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/flight/build.xml @@ -0,0 +1,25 @@ +<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<project name="scatours-contribution-flight" default="compile">
+ <import file="../../antdefs.xml"/>
+ <path id="compile-path">
+ <pathelement path="../common/target/scatours-contribution-common.jar"/>
+ </path>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/flight/pom.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/flight/pom.xml new file mode 100644 index 0000000000..53008cd555 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/flight/pom.xml @@ -0,0 +1,57 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent><version>1.0-SNAPSHOT</version>
+ <artifactId>scatours-contribution-flight</artifactId>
+ <name>Apache Tuscany SCA Tours Flight Contribution</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca-api</artifactId>
+ <version>${tuscany.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-contribution-common</artifactId>
+ <version>${pom.version}</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.5</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ </build>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/flight/src/main/java/com/tuscanyscatours/flight/impl/FlightImpl.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/flight/src/main/java/com/tuscanyscatours/flight/impl/FlightImpl.java new file mode 100644 index 0000000000..36407de5b3 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/flight/src/main/java/com/tuscanyscatours/flight/impl/FlightImpl.java @@ -0,0 +1,121 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package com.tuscanyscatours.flight.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.ComponentName;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+import com.tuscanyscatours.common.Book;
+import com.tuscanyscatours.common.Search;
+import com.tuscanyscatours.common.SearchCallback;
+import com.tuscanyscatours.common.TripItem;
+import com.tuscanyscatours.common.TripLeg;
+
+/**
+ * An implementation of the Flight service
+ */
+@Scope("CONVERSATION")
+@Service(interfaces = {Search.class, Book.class})
+public class FlightImpl implements Search, Book {
+
+ private List<FlightInfo> flights = new ArrayList<FlightInfo>();
+
+ @Callback
+ protected SearchCallback searchCallback;
+
+ @ComponentName
+ protected String componentName;
+
+ private int percentComplete = 0;
+
+ @Init
+ public void init() {
+ flights.add(new FlightInfo("EA26", "Europe Airlines Airbus A300", "LGW", "FLR", "06/12/09", "06/12/09", "350",
+ 250, "EUR", "http://localhost:8085/tbd"));
+ flights.add(new FlightInfo("EA27", "Europe Airlines Airbus A300", "FLR", "LGW", "13/12/09", "13/12/09", "350",
+ 250, "EUR", "http://localhost:8085/tbd"));
+
+ }
+
+ public TripItem[] searchSynch(TripLeg tripLeg) {
+ List<TripItem> items = new ArrayList<TripItem>();
+
+ // find outbound leg
+ for (FlightInfo flight : flights) {
+ if ((flight.getFromLocation().equals(tripLeg.getFromLocation())) && (flight.getToLocation().equals(tripLeg
+ .getToLocation()))
+ && (flight.getFromDate().equals(tripLeg.getFromDate()))) {
+ TripItem item =
+ new TripItem("", "", TripItem.FLIGHT, flight.getName(), flight.getDescription(), flight
+ .getFromLocation() + " - "
+ + flight.getToLocation(), flight.getFromDate(), flight.getToDate(), flight.getPricePerSeat(),
+ flight.getCurrency(), flight.getLink());
+ items.add(item);
+ }
+ }
+
+ // find return leg
+ for (FlightInfo flight : flights) {
+ if ((flight.getFromLocation().equals(tripLeg.getToLocation())) && (flight.getToLocation().equals(tripLeg
+ .getFromLocation()))
+ && (flight.getFromDate().equals(tripLeg.getToDate()))) {
+ TripItem item =
+ new TripItem("", "", TripItem.FLIGHT, flight.getName(), flight.getDescription(), flight
+ .getFromLocation() + " - "
+ + flight.getToLocation(), flight.getFromDate(), tripLeg.getToDate(), flight.getPricePerSeat(),
+ flight.getCurrency(), flight.getLink());
+ items.add(item);
+ }
+ }
+
+ return items.toArray(new TripItem[items.size()]);
+ }
+
+ public void searchAsynch(TripLeg tripLeg) {
+ System.out.println("Starting flight search");
+
+ // pretend that this processing takes some time to complete
+ while (percentComplete < 100) {
+ try {
+ Thread.sleep(50);
+ } catch (Exception ex) {
+ // do nothing
+ }
+ percentComplete = percentComplete + 10;
+ searchCallback.setPercentComplete(componentName, percentComplete);
+ }
+
+ // return available flights
+ searchCallback.searchResults(searchSynch(tripLeg));
+ }
+
+ public int getPercentComplete() {
+ return 100;
+ }
+
+ public String book(TripItem tripItem) {
+ return "flight1";
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/flight/src/main/java/com/tuscanyscatours/flight/impl/FlightInfo.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/flight/src/main/java/com/tuscanyscatours/flight/impl/FlightInfo.java new file mode 100644 index 0000000000..5f7de69229 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/flight/src/main/java/com/tuscanyscatours/flight/impl/FlightInfo.java @@ -0,0 +1,140 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package com.tuscanyscatours.flight.impl;
+
+public class FlightInfo {
+
+ private String name;
+ private String description;
+ private String fromLocation;
+ private String toLocation;
+ private String fromDate;
+ private String toDate;
+ private String seats;
+ private double pricePerSeat;
+ private String currency;
+ private String link;
+
+ public FlightInfo() {
+ }
+
+ public FlightInfo(String name,
+ String description,
+ String fromLocation,
+ String toLocation,
+ String fromDate,
+ String toDate,
+ String seats,
+ double pricePerSeat,
+ String currency,
+ String link) {
+
+ this.name = name;
+ this.description = description;
+ this.fromLocation = fromLocation;
+ this.toLocation = toLocation;
+ this.fromDate = fromDate;
+ this.toDate = toDate;
+ this.seats = seats;
+ this.pricePerSeat = pricePerSeat;
+ this.currency = currency;
+ this.link = link;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public String getFromLocation() {
+ return fromLocation;
+ }
+
+ public void setFromLocation(String fromLocation) {
+ this.fromLocation = fromLocation;
+ }
+
+ public String getToLocation() {
+ return toLocation;
+ }
+
+ public void setToLocation(String toLocation) {
+ this.toLocation = toLocation;
+ }
+
+ public String getFromDate() {
+ return fromDate;
+ }
+
+ public void setFromDate(String fromDate) {
+ this.fromDate = fromDate;
+ }
+
+ public String getToDate() {
+ return toDate;
+ }
+
+ public void setToDate(String toDate) {
+ this.toDate = toDate;
+ }
+
+ public String getSeats() {
+ return seats;
+ }
+
+ public void setSeats(String seats) {
+ this.seats = seats;
+ }
+
+ public double getPricePerSeat() {
+ return pricePerSeat;
+ }
+
+ public void setPricePerSeat(double pricePerSeat) {
+ this.pricePerSeat = pricePerSeat;
+ }
+
+ public String getCurrency() {
+ return currency;
+ }
+
+ public void setCurrency(String currency) {
+ this.currency = currency;
+ }
+
+ public String getLink() {
+ return link;
+ }
+
+ public void setLink(String link) {
+ this.link = link;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/flight/src/main/resources/META-INF/sca-contribution.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/flight/src/main/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..1e539bf13b --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/flight/src/main/resources/META-INF/sca-contribution.xml @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0">
+ <import.java package="com.tuscanyscatours.common"/>
+ <export.java package="com.tuscanyscatours.flight.impl"/>
+</contribution>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/fullapp-bespoketrip/build.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/fullapp-bespoketrip/build.xml new file mode 100644 index 0000000000..8428af49f5 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/fullapp-bespoketrip/build.xml @@ -0,0 +1,22 @@ +<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<project name="scatours-contribution-fullapp-bespoketrip" default="compile">
+ <import file="../../antdefs.xml"/>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/fullapp-bespoketrip/pom.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/fullapp-bespoketrip/pom.xml new file mode 100644 index 0000000000..6563d6c782 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/fullapp-bespoketrip/pom.xml @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<project> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>scatours</artifactId> + <version>1.0-SNAPSHOT</version> + <relativePath>../../pom.xml</relativePath> + </parent><version>1.0-SNAPSHOT</version> + <artifactId>scatours-contribution-fullapp-bespoketrip</artifactId> + <name>Apache Tuscany SCA Tours Full Application Bespoke Contribution</name> + + <build> + <finalName>${artifactId}</finalName> + </build> +</project> diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/fullapp-bespoketrip/src/main/resources/META-INF/sca-contribution.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/fullapp-bespoketrip/src/main/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..9ae204d8f7 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/fullapp-bespoketrip/src/main/resources/META-INF/sca-contribution.xml @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0" + xmlns:scatours="http://tuscanyscatours.com/"> + <deployable composite="scatours:fullapp-bespoketrip" /> + <import.java package="com.tuscanyscatours.common" /> + <import.java package="com.tuscanyscatours.hotel" /> + <import.java package="com.tuscanyscatours.hotel.impl" /> + <import.java package="com.tuscanyscatours.flight.impl" /> + <import.java package="com.tuscanyscatours.car.impl" /> +</contribution> diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/fullapp-bespoketrip/src/main/resources/fullapp-bespoketrip.composite b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/fullapp-bespoketrip/src/main/resources/fullapp-bespoketrip.composite new file mode 100644 index 0000000000..76c91b7887 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/fullapp-bespoketrip/src/main/resources/fullapp-bespoketrip.composite @@ -0,0 +1,63 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" + targetNamespace="http://tuscanyscatours.com/" + xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0" + name="fullapp-bespoketrip"> + + <component name="HotelPartner"> + <implementation.java class="com.tuscanyscatours.hotel.impl.HotelImpl"/> + <service name="Search"> + <binding.ws name="searchws" uri="http://localhost:8086/Hotel/Search"/> + <!-- tuscany:binding.jsonrpc name="searchjsonrpc"/--> + <callback> + <binding.ws/> + </callback> + </service> + <service name="Book"/> + </component> + + <component name="FlightPartner"> + <implementation.java class="com.tuscanyscatours.flight.impl.FlightImpl"/> + <service name="Search"> + <interface.java interface="com.tuscanyscatours.common.Search" + callbackInterface="com.tuscanyscatours.common.SearchCallback"/> + <binding.ws name="searchws" uri="http://localhost:8086/Flight/Search"/> + <tuscany:binding.jsonrpc name="searchjsonrpc"/> + <callback> + <binding.ws/> + </callback> + </service> + <service name="Book"/> + </component> + + <component name="CarPartner"> + <implementation.java class="com.tuscanyscatours.car.impl.CarImpl"/> + <service name="Search"> + <binding.ws name="searchws" uri="http://localhost:8086/Car/Search"/> + <tuscany:binding.jsonrpc name="searchjsonrpc"/> + <callback> + <binding.ws/> + </callback> + </service> + <service name="Book"/> + </component> + +</composite> diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/fullapp-coordination/build.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/fullapp-coordination/build.xml new file mode 100644 index 0000000000..0da4e5aebd --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/fullapp-coordination/build.xml @@ -0,0 +1,22 @@ +<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<project name="scatours-contribution-fullapp-coordination" default="compile">
+ <import file="../../antdefs.xml"/>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/fullapp-coordination/pom.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/fullapp-coordination/pom.xml new file mode 100644 index 0000000000..5ddadf2521 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/fullapp-coordination/pom.xml @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<project> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>scatours</artifactId> + <version>1.0-SNAPSHOT</version> + <relativePath>../../pom.xml</relativePath> + </parent><version>1.0-SNAPSHOT</version> + <artifactId>scatours-contribution-fullapp-coordination</artifactId> + <name>Apache Tuscany SCA Tours Full Application Coordination Contribution</name> + + <build> + <finalName>${artifactId}</finalName> + </build> +</project> diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/fullapp-coordination/src/main/resources/META-INF/sca-contribution.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/fullapp-coordination/src/main/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..a6eb8bcce2 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/fullapp-coordination/src/main/resources/META-INF/sca-contribution.xml @@ -0,0 +1,30 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0" + xmlns:scatours="http://tuscanyscatours.com/"> + <deployable composite="scatours:fullapp-coordination" /> + <import.java package="com.tuscanyscatours.common" /> + <import.java package="com.tuscanyscatours.currencyconverter" /> + <import.java package="com.tuscanyscatours.travelcatalog" /> + <import.java package="com.tuscanyscatours.travelcatalog.impl" /> + <import.java package="com.tuscanyscatours.shoppingcart" /> + <import.java package="com.tuscanyscatours.tripbooking" /> + <import.java package="com.tuscanyscatours.tripbooking.impl" /> +</contribution> diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/fullapp-coordination/src/main/resources/fullapp-coordination.composite b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/fullapp-coordination/src/main/resources/fullapp-coordination.composite new file mode 100644 index 0000000000..2d6564ffa3 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/fullapp-coordination/src/main/resources/fullapp-coordination.composite @@ -0,0 +1,72 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" + targetNamespace="http://tuscanyscatours.com/" + name="fullapp-coordination"> + + <component name="TravelCatalog"> + <implementation.java class="com.tuscanyscatours.travelcatalog.impl.TravelCatalogImpl"/> + <service name="TravelCatalogSearch"/> + <reference name="hotelSearch"> + <binding.ws uri="http://localhost:8086/Hotel/Search"/> + <callback> + <binding.ws name="callback" + uri="http://localhost:8084/Hotel/SearchCallback"/> + </callback> + </reference> + <reference name="flightSearch"> + <interface.java interface="com.tuscanyscatours.common.Search" + callbackInterface="com.tuscanyscatours.common.SearchCallback"/> + <binding.ws uri="http://localhost:8086/Flight/Search"/> + <callback> + <binding.ws name="callback" + uri="http://localhost:8084/Flight/SearchCallback"/> + </callback> + </reference> + <reference name="carSearch"> + <binding.ws uri="http://localhost:8086/Car/Search"/> + <callback> + <binding.ws name="callback" + uri="http://localhost:8084/Car/SearchCallback"/> + </callback> + </reference> + <reference name="tripSearch"> + <binding.ws uri="http://localhost:8085/Trip/Search"/> + <callback> + <binding.ws name="callback" + uri="http://localhost:8084/Trip/SearchCallback"/> + </callback> + </reference> + <reference name="currencyConverter" target="CurrencyConverter"> + </reference> + <property name="quoteCurrencyCode">GBP</property> + </component> + + <component name="TripBooking"> + <implementation.java class="com.tuscanyscatours.tripbooking.impl.TripBookingImpl"/> + <service name="TripBooking"/> + <reference name="hotelBook" target="HotelPartner/Book"/> + <reference name="flightBook" target="FlightPartner/Book"/> + <reference name="carBook" target="CarPartner/Book"/> + <reference name="tripBook" target="TripPartner/Book"/> + <reference name="cartUpdates" target="ShoppingCart/CartUpdates"/> + </component> + +</composite> diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/fullapp-currency/build.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/fullapp-currency/build.xml new file mode 100644 index 0000000000..aa6127daf0 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/fullapp-currency/build.xml @@ -0,0 +1,22 @@ +<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<project name="scatours-contribution-fullapp-currency" default="compile">
+ <import file="../../antdefs.xml"/>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/fullapp-currency/pom.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/fullapp-currency/pom.xml new file mode 100644 index 0000000000..076018b274 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/fullapp-currency/pom.xml @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<project> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>scatours</artifactId> + <version>1.0-SNAPSHOT</version> + <relativePath>../../pom.xml</relativePath> + </parent><version>1.0-SNAPSHOT</version> + <artifactId>scatours-contribution-fullapp-currency</artifactId> + <name>Apache Tuscany SCA Tours Full Application Currency Contribution</name> + + <build> + <finalName>${artifactId}</finalName> + </build> +</project> diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/fullapp-currency/src/main/resources/META-INF/sca-contribution.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/fullapp-currency/src/main/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..dc66ed8db6 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/fullapp-currency/src/main/resources/META-INF/sca-contribution.xml @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0" + xmlns:scatours="http://tuscanyscatours.com/"> + <deployable composite="scatours:fullapp-currency" /> + <import.java package="com.tuscanyscatours.currencyconverter" /> + <import.java package="com.tuscanyscatours.currencyconverter.impl" /> +</contribution> diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/fullapp-currency/src/main/resources/fullapp-currency.composite b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/fullapp-currency/src/main/resources/fullapp-currency.composite new file mode 100644 index 0000000000..654ff60c41 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/fullapp-currency/src/main/resources/fullapp-currency.composite @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" + targetNamespace="http://tuscanyscatours.com/" + name="fullapp-currency"> + + <component name="CurrencyConverter"> + <implementation.java class="com.tuscanyscatours.currencyconverter.impl.CurrencyConverterImpl"/> + </component> + +</composite> diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/fullapp-packagedtrip/build.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/fullapp-packagedtrip/build.xml new file mode 100644 index 0000000000..491f9cafd1 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/fullapp-packagedtrip/build.xml @@ -0,0 +1,22 @@ +<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<project name="scatours-contribution-fullapp-packagedtrip" default="compile">
+ <import file="../../antdefs.xml"/>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/fullapp-packagedtrip/pom.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/fullapp-packagedtrip/pom.xml new file mode 100644 index 0000000000..a1aa8e7913 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/fullapp-packagedtrip/pom.xml @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<project> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>scatours</artifactId> + <version>1.0-SNAPSHOT</version> + <relativePath>../../pom.xml</relativePath> + </parent><version>1.0-SNAPSHOT</version> + <artifactId>scatours-contribution-fullapp-packagedtrip</artifactId> + <name>Apache Tuscany SCA Tours Full Application Packaged Trip Contribution</name> + + <build> + <finalName>${artifactId}</finalName> + </build> +</project> diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/fullapp-packagedtrip/src/main/resources/META-INF/sca-contribution.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/fullapp-packagedtrip/src/main/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..3059c49911 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/fullapp-packagedtrip/src/main/resources/META-INF/sca-contribution.xml @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0" + xmlns:scatours="http://tuscanyscatours.com/"> + <deployable composite="scatours:fullapp-packagedtrip" /> + <import.java package="com.tuscanyscatours.common" /> + <import.java package="com.tuscanyscatours.trip.impl" /> +</contribution> diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/fullapp-packagedtrip/src/main/resources/fullapp-packagedtrip.composite b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/fullapp-packagedtrip/src/main/resources/fullapp-packagedtrip.composite new file mode 100644 index 0000000000..0f8dd33060 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/fullapp-packagedtrip/src/main/resources/fullapp-packagedtrip.composite @@ -0,0 +1,37 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" + targetNamespace="http://tuscanyscatours.com/" + xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0" + name="fullapp-packagedtrip"> + + <component name="TripPartner"> + <implementation.java class="com.tuscanyscatours.trip.impl.TripImpl"/> + <service name="Search"> + <binding.ws name="searchws" uri="http://localhost:8085/Trip/Search"/> + <tuscany:binding.jsonrpc name="searchjsonrpc"/> + <callback> + <binding.ws/> + </callback> + </service> + <service name="Book"/> + </component> + +</composite> diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/fullapp-shoppingcart/build.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/fullapp-shoppingcart/build.xml new file mode 100644 index 0000000000..eccff2291f --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/fullapp-shoppingcart/build.xml @@ -0,0 +1,22 @@ +<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<project name="scatours-contribution-fullapp-shoppingcart" default="compile">
+ <import file="../../antdefs.xml"/>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/fullapp-shoppingcart/pom.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/fullapp-shoppingcart/pom.xml new file mode 100644 index 0000000000..f2f02a2143 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/fullapp-shoppingcart/pom.xml @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<project> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>scatours</artifactId> + <version>1.0-SNAPSHOT</version> + <relativePath>../../pom.xml</relativePath> + </parent><version>1.0-SNAPSHOT</version> + <artifactId>scatours-contribution-fullapp-shoppingcart</artifactId> + <name>Apache Tuscany SCA Tours Full Application Shopping Cart Contribution</name> + + <build> + <finalName>${artifactId}</finalName> + </build> +</project> diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/fullapp-shoppingcart/src/main/resources/META-INF/sca-contribution.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/fullapp-shoppingcart/src/main/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..384887f792 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/fullapp-shoppingcart/src/main/resources/META-INF/sca-contribution.xml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0" + xmlns:scatours="http://tuscanyscatours.com/"> + <deployable composite="scatours:fullapp-shoppingcart" /> + <import.java package="com.tuscanyscatours.payment" /> + <import.java package="com.tuscanyscatours.shoppingcart" /> + <import.java package="com.tuscanyscatours.shoppingcart.impl" /> +</contribution> diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/fullapp-shoppingcart/src/main/resources/fullapp-shoppingcart.composite b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/fullapp-shoppingcart/src/main/resources/fullapp-shoppingcart.composite new file mode 100644 index 0000000000..ed4fce84d6 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/fullapp-shoppingcart/src/main/resources/fullapp-shoppingcart.composite @@ -0,0 +1,36 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" + targetNamespace="http://tuscanyscatours.com/" + name="fullapp-shoppingcart"> + + <component name="ShoppingCart"> + <implementation.java class="com.tuscanyscatours.shoppingcart.impl.ShoppingCartImpl"/> + <reference name="cartStore" target="CartStore"/> + <reference name="payment"> + <binding.ws uri="http://localhost:8081/Payment" /> + </reference> + </component> + + <component name="CartStore"> + <implementation.java class="com.tuscanyscatours.shoppingcart.impl.CartStoreImpl"/> + </component> + +</composite> diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/fullapp-ui/build.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/fullapp-ui/build.xml new file mode 100644 index 0000000000..51aef70837 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/fullapp-ui/build.xml @@ -0,0 +1,22 @@ +<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<project name="scatours-contribution-fullapp-ui" default="compile">
+ <import file="../../antdefs.xml"/>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/fullapp-ui/pom.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/fullapp-ui/pom.xml new file mode 100644 index 0000000000..d7acb41d94 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/fullapp-ui/pom.xml @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<project> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>scatours</artifactId> + <version>1.0-SNAPSHOT</version> + <relativePath>../../pom.xml</relativePath> + </parent><version>1.0-SNAPSHOT</version> + <artifactId>scatours-contribution-fullapp-ui</artifactId> + <name>Apache Tuscany SCA Tours Full Application User Interface Contribution</name> + + <build> + <finalName>${artifactId}</finalName> + </build> +</project> diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/fullapp-ui/src/main/resources/META-INF/sca-contribution.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/fullapp-ui/src/main/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..104a78cd92 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/fullapp-ui/src/main/resources/META-INF/sca-contribution.xml @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0" + xmlns:scatours="http://tuscanyscatours.com/"> + <deployable composite="scatours:fullapp-ui" /> + <import.java package="com.tuscanyscatours" /> + <import.java package="com.tuscanyscatours.impl" /> + <import.java package="com.tuscanyscatours.shoppingcart" /> + <import.java package="com.tuscanyscatours.travelcatalog" /> + <import.java package="com.tuscanyscatours.tripbooking" /> +</contribution> diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/fullapp-ui/src/main/resources/fullapp-ui.composite b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/fullapp-ui/src/main/resources/fullapp-ui.composite new file mode 100644 index 0000000000..bcfa894ca6 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/fullapp-ui/src/main/resources/fullapp-ui.composite @@ -0,0 +1,58 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" + targetNamespace="http://tuscanyscatours.com/" + xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0" + name="fullapp-ui"> + + <component name="SCAToursUserInterface"> + <tuscany:implementation.widget location="scatours.html"/> + <service name="Widget"> + <tuscany:binding.http uri="/scatours"/> + </service> + <reference name="scaToursCatalog" target="SCATours/SCAToursSearch"> + <tuscany:binding.jsonrpc/> + </reference> + <reference name="scaToursBooking" target="SCATours/SCAToursBooking"> + <tuscany:binding.jsonrpc/> + </reference> + <reference name="scaToursCart" target="SCATours/SCAToursCart"> + <tuscany:binding.jsonrpc/> + </reference> + </component> + + <component name="SCATours"> + <implementation.java class="com.tuscanyscatours.impl.SCAToursImpl"/> + <service name="SCAToursSearch"> + <tuscany:binding.jsonrpc/> + </service> + <service name="SCAToursBooking"> + <tuscany:binding.jsonrpc/> + </service> + <service name="SCAToursCart"> + <tuscany:binding.jsonrpc/> + </service> + <reference name="travelCatalogSearch" target="TravelCatalog/TravelCatalogSearch"/> + <reference name="tripBooking" target="TripBooking"/> + <reference name="cartInitialize" target="ShoppingCart/CartInitialize"/> + <reference name="cartCheckout" target="ShoppingCart/CartCheckout"/> + </component> + +</composite> diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/fullapp-ui/src/main/resources/scatours.html b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/fullapp-ui/src/main/resources/scatours.html new file mode 100644 index 0000000000..52479c1cde --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/fullapp-ui/src/main/resources/scatours.html @@ -0,0 +1,399 @@ +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<html> +<head> +<title>SCA Tours</title> + +<link rel="stylesheet" type="text/css" href="style.css" /> + +<script type="text/javascript" src="scatours.js"></script> + +<script language="JavaScript"> + + //@Reference + var scaToursCatalog = new tuscany.sca.Reference("scaToursCatalog"); + + //@Reference + var scaToursBooking = new tuscany.sca.Reference("scaToursBooking"); + + //@Reference + var scaToursCart = new tuscany.sca.Reference("scaToursCart"); + + //local state + var packagedItems; + var bespokeItems; + var cartId; + + //the constructor for trip leg beans + function TripLegType(id, + fromLocation, + toLocation, + fromDate, + toDate, + noOfPeople) { + this.id = id; + this.fromLocation = fromLocation; + this.toLocation = toLocation; + this.fromDate = fromDate; + this.toDate = toDate; + this.noOfPeople = noOfPeople; + } + + function getTripLeg(){ + return new TripLegType(cartId, + document.searchForm.fromLocation.value, + document.searchForm.toLocation.value, + document.searchForm.fromDate.value, + document.searchForm.toDate.value, + document.searchForm.noOfPeople.value); + } + + //the constructor for bespoke trip beans + function TripType() { + this.id = cartId; + this.type = "Bespoke"; + this.tripItems = new Array(); + // json databinding can't tolerate having a class hint set as the + // databinding transformer is not in the right classloader to load + // the class pointed to by the hint + //this.javaClass = "scatours.common.TripItem"; + } + + function getTrip(){ + return new TripType(); + } + + // remove class hint from the trip object + // can also be used to limit the amount of + // data returned to the server + function copyTrip(trip){ + var tripCopy = new TripType(); + + tripCopy.id = trip.id; + tripCopy.tripId = trip.tripId; + tripCopy.type = trip.type; + tripCopy.name = trip.name; + tripCopy.description = trip.description; + tripCopy.location = trip.location; + tripCopy.fromDate = trip.fromDate; + tripCopy.toDate = trip.toDate; + tripCopy.price = trip.price; + tripCopy.currency = trip.currency; + tripCopy.link = trip.link; + + return tripCopy; + } + + function init() { + try { + newCart(); + } + catch(e) { + alert(e); + } + } + + function reset() { + document.getElementById('packagedTripItems').innerHTML = ""; + document.getElementById('bespokeTripItems').innerHTML = ""; + document.getElementById('cartItems').innerHTML = ""; + document.getElementById('cartPrice').innerHTML = ""; + packagedItems = new Array(); + bespokeItems = new Array(); + } + + function newCart() { + scaToursCart.newCart(newCart_response); + reset(); + } + + function newCart_response(newCartId, exception) { + if(exception){ + alert(exception.javaStack); + return; + } + cartId = newCartId + } + + function searchTravelCatalog() { + scaToursCatalog.search(getTripLeg(), search_response); + } + + function search_response(items, exception) { + if(exception){ + alert(exception.javaStack); + return; + } + + var packagedHTML = '<h3>Packaged Trip Items</h3>'; + packagedHTML += '<table border="0">'; + packagedHTML += '<tr>'; + packagedHTML += '<td>Select</td><td>Name</td><td>Description</td><td>Location</td><td>From - To</td><td>Price</td>'; + packagedHTML += '</tr>'; + + var bespokeHTML = '<h3>Bespoke Trip Items</h3>'; + bespokeHTML += '<table border="0">'; + bespokeHTML += '<tr>'; + bespokeHTML += '<td>Select</td><td>Name</td><td>Description</td><td>Location</td><td>From - To</td><td>Price</td>'; + bespokeHTML += '</tr>'; + + for (var i=0; i<items.length; i++) { + if (items[i].type == "Trip") { + packagedHTML += '<tr>'; + packagedHTML += '<td><input onClick="processPackagedSelection()" name="packagedTripItemSelection" type="checkbox" value="' + items[i].id + '"></td>' + packagedHTML += '<td>' + items[i].name + '</td>'; + packagedHTML += '<td>' + items[i].description + '</td>'; + packagedHTML += '<td>' + items[i].location + '</td>'; + packagedHTML += '<td>' + items[i].fromDate + ' - ' + items[i].toDate +'</td>'; + packagedHTML += '<td>' + items[i].price + ' ' + items[i].currency + '</td>'; + packagedHTML += '</tr>'; + packagedItems.push(items[i]); + } else { + bespokeHTML += '<tr>'; + bespokeHTML += '<td><input onClick="processBespokeSelection()" name="bespokeTripItemSelection" type="checkbox" value="' + items[i].id + '"></td>' + bespokeHTML += '<td>' + items[i].name + '</td>'; + bespokeHTML += '<td>' + items[i].description + '</td>'; + bespokeHTML += '<td>' + items[i].location + '</td>'; + bespokeHTML += '<td>' + items[i].fromDate + ' - ' + items[i].toDate +'</td>'; + bespokeHTML += '<td>' + items[i].price + ' ' + items[i].currency + '</td>'; + bespokeHTML += '</tr>'; + bespokeItems.push(items[i]); + } + } + + packagedHTML += '</table>'; + packagedHTML += '<input type="button" onClick="bookPackagedTrip()" value="Book Packaged Trip">'; + + bespokeHTML += '<tr><td/><td/><td>Total Price</td><td/><td/><td><div id="bespokeTripPrice"></div> </td></tr>'; + bespokeHTML += '</table>'; + bespokeHTML += '<input type="button" onClick="bookBespokeTrip()" value="Book Bespoke Trip">'; + + if (packagedItems.length > 0){ + document.getElementById('packagedTripItems').innerHTML = packagedHTML; + } + + if (bespokeItems.length > 0){ + document.getElementById('bespokeTripItems').innerHTML = bespokeHTML; + } + } + + function processPackagedSelection() { + // do nothing at the moment + } + + function processBespokeSelection() { + // calculate total price + var items = document.getElementsByName("bespokeTripItemSelection"); + var totalPrice = 0.0; + for (var i=0; i<items.length; i++) { + + // find the items that are checked + if (items[i].checked == true) { + totalPrice = totalPrice + bespokeItems[i].price; + } + } + document.getElementById('bespokeTripPrice').innerHTML = totalPrice + ' ' + bespokeItems[0]. currency; + } + + function bookPackagedTrip() { + // find first selected trip item + var trip = null; + var items = document.getElementsByName("packagedTripItemSelection"); + for (var i=0; i<items.length; i++) { + + // find the items that are checked + if (items[i].checked == true) { + trip = copyTrip(packagedItems[i]); + break; + } + } + + if (trip != null) { + // book trip + scaToursBooking.bookTrip(cartId, trip); + + // reset the display + reset(); + + // re-populate the cart with all entries + getCartTrips(); + } else { + alert ("Please select a trip") + } + } + + function bookBespokeTrip() { + // create a trip object + var trip = getTrip(); + + // add selected trip items to trip + var items = document.getElementsByName("bespokeTripItemSelection"); + for (var i=0; i<items.length; i++) { + + // find the items that are checked + if (items[i].checked == true) { + trip.tripItems.push(copyTrip(bespokeItems[i])); + } + } + + if (trip.tripItems.length > 0) { + // book trip + scaToursBooking.bookTrip(cartId, trip); + + // reset the display + reset(); + + // re-populate the cart with all entries + getCartTrips(); + } else { + alert ("Please select some trip items!") + } + } + + function getCartTrips() { + scaToursCart.getTrips(cartId, getCartTrips_response); + } + + function getCartTrips_response(trips, exception) { + if(exception){ + alert(exception.javaStack); + return; + } + var itemsHTML = ''; + var totalPrice = 0.0; + var currency = '?'; + + for (var x=0; x<trips.length; x++){ + itemsHTML += '<h3>Trip - ' + trips[x].id + '</h3>'; + itemsHTML += '<table border="0">'; + itemsHTML += '<tr>'; + itemsHTML += '<td>Booking Ref</td><td>Name</td><td>Description</td><td>Location</td><td>From - To</td><td>Price</td>'; + itemsHTML += '</tr>'; + + if (trips[x].type == "Trip") { + itemsHTML += '<tr>'; + itemsHTML += '<td>' + trips[x].bookingCode + '</td>'; + itemsHTML += '<td>' + trips[x].name + '</td>'; + itemsHTML += '<td>' + trips[x].description + '</td>'; + itemsHTML += '<td>' + trips[x].location + '</td>'; + itemsHTML += '<td>' + trips[x].fromDate + ' - ' + trips[x].toDate +'</td>'; + itemsHTML += '<td>' + trips[x].price + ' ' + trips[x].currency + '</td>'; + itemsHTML += '</tr>'; + if (totalPrice == 0.0) { + currency = trips[x].currency; + } + totalPrice = totalPrice + trips[x].price; + + } else { + var tripItems = trips[x].tripItems; + + for (var i=0; i<tripItems.length; i++) { + itemsHTML += '<tr>'; + itemsHTML += '<td>' + tripItems[i].bookingCode + '</td>'; + itemsHTML += '<td>' + tripItems[i].name + '</td>'; + itemsHTML += '<td>' + tripItems[i].description + '</td>'; + itemsHTML += '<td>' + tripItems[i].location + '</td>'; + itemsHTML += '<td>' + tripItems[i].fromDate + ' - ' + tripItems[i].toDate +'</td>'; + itemsHTML += '<td>' + tripItems[i].price + ' ' + tripItems[i].currency + '</td>'; + itemsHTML += '</tr>'; + if (totalPrice == 0.0) { + currency = tripItems[i].currency; + } + totalPrice = totalPrice + tripItems[i].price; + } + } + + itemsHTML += '</table>'; + } + + document.getElementById('cartItems').innerHTML = itemsHTML; + document.getElementById('cartPrice').innerHTML = totalPrice + ' ' + currency; + } + + function checkout() { + scaToursCart.checkout(cartId); + + document.getElementById('packagedTripItems').innerHTML = ""; + document.getElementById('bespokeTripItems').innerHTML = ""; + document.getElementById('cartItems').innerHTML = "Thank you for shopping with SCA Tours"; + document.getElementById('cartPrice').innerHTML = ""; + searchResponseItems = null; + tripItems = null; + init(); + } + + function purchase() { + } + +</script> + +</head> + +<body onload="init()" background=""> + <img src="scatours.png" border="0" /> + <div id="scatours"> + <form name="searchForm"> + <h3>Search for trips, hotels, flights and cars</h3> + <br/> + <table border="0"> + <tr> + <td>From Location:</td> + <td><input type="text" name="fromLocation" value="LGW"></td> + <td>To Location:</td> + <td><input type="text" name="toLocation" value="FLR"></td> + </tr> + <tr> + <td>Start Date:</td> + <td><input type="text" name="fromDate" value="06/12/09"></td> + <td>End Date:</td> + <td><input type="text" name="toDate" value="13/12/09"></td> + </tr> + <tr> + <td>Number of people:</td> + <td><select name="noOfPeople"> + <option>1 + <option selected>2 + <option>3 + <option>4 + </select></td> + <td/> + <td/> + </tr> + </table> + <br/> + <input type="button" onClick="searchTravelCatalog()" value="Search"> + </form> + <form name="packagedTripForm"> + <div id="packagedTripItems"></div> + </form> + <form name="bespokeTripForm"> + <div id="bespokeTripItems"></div> + </form> + <form name="cartForm"> + <h3>Shopping Cart</h3> + <div id="cartItems"></div> + <br/> + Total Price: <div id="cartPrice"></div> + <br/> + <input type="button" onClick="checkout()" value="Checkout"> + </form> + </div> + +</body> +</html> diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/fullapp-ui/src/main/resources/scatours.odg b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/fullapp-ui/src/main/resources/scatours.odg Binary files differnew file mode 100644 index 0000000000..8466377374 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/fullapp-ui/src/main/resources/scatours.odg diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/fullapp-ui/src/main/resources/scatours.png b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/fullapp-ui/src/main/resources/scatours.png Binary files differnew file mode 100644 index 0000000000..563bf4ea91 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/fullapp-ui/src/main/resources/scatours.png diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/fullapp-ui/src/main/resources/style.css b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/fullapp-ui/src/main/resources/style.css new file mode 100644 index 0000000000..6e17c2747b --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/fullapp-ui/src/main/resources/style.css @@ -0,0 +1,135 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + + + +/*******************************************/ + +p,table,li,h1,h2,h3 +{ +font-family: verdana, arial, 'sans serif'; +} + +p, h1, h2, h3, table, li, hr +{ +margin-left: 10pt; +} + +table +{ +border-color: black; +border-collapse: separate; +border-spacing: 0px 1px; + +margin-right: 10pt; +margin-left: 10pt; +width: 800px; +} + +.sourceDetailsTable +{ +width: 600px; +} + +tr, td +{ +margin-left: 0pt; +margin-right: 0pt; +padding-left: 10pt; +font-size: 90%; +} + +p,li,th +{ +font-size: 90%; +margin-left: 10pt; +} + +pre +{ +margin-left: 10pt; +} + +body +{ +#ffffff; +} + +h1,h2,h3,hr +{ +color: firebrick; +} + +a:link {COLOR: firebrick;} +a:visited {COLOR: firebrick;} +a:active {COLOR: navy;} + +.link +{ +COLOR: firebrick; +text-decoration: underline; +} + +.clickable +{ +cursor: pointer +} + +.unread_title +{ +font-weight: bold; +} + +.read_title +{ +font-weight: normal; +} + +.summary +{ +color: DimGrey; +} + +.hidden +{ +display: none; +} + +.source_name +{ +width: 600px; +} + +.alert_text +{ +width: 600px; +} + +.alert_data +{ +margin-left: 10px; +width: 800px; +height: 800px; +} + +.source_0 +{ +background-color: LightGreen; +} + diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/help-pages/build.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/help-pages/build.xml new file mode 100644 index 0000000000..7f77b9270d --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/help-pages/build.xml @@ -0,0 +1,22 @@ +<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<project name="scatours-contribution-help-pages" default="compile">
+ <import file="../../antdefs.xml"/>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/help-pages/pom.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/help-pages/pom.xml new file mode 100644 index 0000000000..91360b9594 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/help-pages/pom.xml @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent><version>1.0-SNAPSHOT</version>
+ <artifactId>scatours-contribution-help-pages</artifactId>
+ <name>Apache Tuscany SCA Tours Help Pages Contribution</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-resource-runtime</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-http-runtime</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ </build>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/help-pages/src/main/resources/META-INF/sca-contribution.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/help-pages/src/main/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..038f9260b4 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/help-pages/src/main/resources/META-INF/sca-contribution.xml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0">
+ <export.resource uri="help_pages"/>
+</contribution>
\ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/help-pages/src/main/resources/help-pages.composite b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/help-pages/src/main/resources/help-pages.composite new file mode 100644 index 0000000000..1ef8c0a6b1 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/help-pages/src/main/resources/help-pages.composite @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" + xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0" + targetNamespace="http://www.tuscanyscatours.com/" + name="helpPages"> + + <component name="Help"> + <tuscany:implementation.resource location="help_pages"/> + <service name="Resource"> + <tuscany:binding.http uri="http://localhost:8085/help/"/> + </service> + </component> + +</composite> diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/help-pages/src/main/resources/help_pages/BookingAHoliday.html b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/help-pages/src/main/resources/help_pages/BookingAHoliday.html new file mode 100644 index 0000000000..194ecd1183 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/help-pages/src/main/resources/help_pages/BookingAHoliday.html @@ -0,0 +1,34 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + --> + +<head> +<title>Tuscany SCA Tours Help - Booking a holiday</title> +</head> + +<body> +<h1>Tuscany SCA Tours Help Pages - Booking a holiday</h1> + +<p>This page contains instructions on how to book a holiday with SCA Tours</p> + +<p>More help text would go here.....</p> + +</body> +</html>
\ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/help-pages/src/main/resources/help_pages/BookingAHotel.html b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/help-pages/src/main/resources/help_pages/BookingAHotel.html new file mode 100644 index 0000000000..bde4d25226 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/help-pages/src/main/resources/help_pages/BookingAHotel.html @@ -0,0 +1,34 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + --> + +<head> +<title>Tuscany SCA Tours Help - Booking a hotel</title> +</head> + +<body> +<h1>Tuscany SCA Tours Help Pages - Booking a hotel</h1> + +<p>This page contains instructions on how to book a hotel with SCA Tours</p> + +<p>More help text would go here.....</p> + +</body> +</html>
\ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/help-pages/src/main/resources/help_pages/MakingPayments.html b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/help-pages/src/main/resources/help_pages/MakingPayments.html new file mode 100644 index 0000000000..a1b24f4d23 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/help-pages/src/main/resources/help_pages/MakingPayments.html @@ -0,0 +1,34 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + --> + +<head> +<title>Tuscany SCA Tours Help - Making Payments</title> +</head> + +<body> +<h1>Tuscany SCA Tours Help Pages - Making Payments</h1> + +<p>This page contains instructions on how to make payments to SCA Tours</p> + +<p>More help text would go here.....</p> + +</body> +</html>
\ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/help-pages/src/main/resources/help_pages/index.html b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/help-pages/src/main/resources/help_pages/index.html new file mode 100644 index 0000000000..4972752ea1 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/help-pages/src/main/resources/help_pages/index.html @@ -0,0 +1,59 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + --> + +<head> +<title>Tuscany SCA Tours Help</title> +</head> + +<body> +<h1>Tuscany SCA Tours Help Pages</h1> + +<p>Welcome to the Tuscany SCA Tours help pages.</p> +<p>How can we help you?</p> + +<h3>Making a booking</h3> +<ul> +<li><a href="BookingAHoliday.html">Booking a holiday</a></li> +<li><a href="BookingAHotel.html">Booking a hotel</a></li> +<li>Booking a car</li> +</ul> + +<h3>Making payments</h3> +<ul> +<li><a href="MakingPayments.html">Paying for my bookings</a></li> +<li>Checking the status of my payment</li> +</ul> + +<h3>Preparing to travel</h3> +<ul> +<li>Passports and Visas</li> +<li>Pre-travel health checks</li> +<li>Things to pack checklist</li> +</ul> + +<h3>Contact customer support</h3> +<ul> +<li>By Email</li> +<li>By Phone</li> +<li>By Post</li> +</ul> +</body> +</html>
\ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/hotel/build.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/hotel/build.xml new file mode 100644 index 0000000000..f624c43a01 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/hotel/build.xml @@ -0,0 +1,25 @@ +<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<project name="scatours-contribution-hotel" default="compile">
+ <import file="../../antdefs.xml"/>
+ <path id="compile-path">
+ <pathelement path="../common/target/scatours-contribution-common.jar"/>
+ </path>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/hotel/pom.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/hotel/pom.xml new file mode 100644 index 0000000000..55b3bc193d --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/hotel/pom.xml @@ -0,0 +1,49 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent><version>1.0-SNAPSHOT</version>
+ <artifactId>scatours-contribution-hotel</artifactId>
+ <name>Apache Tuscany SCA Tours Hotel Contribution</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca-api</artifactId>
+ <version>${tuscany.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-contribution-common</artifactId>
+ <version>${pom.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ </build>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/hotel/src/main/java/com/tuscanyscatours/hotel/HotelInfo.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/hotel/src/main/java/com/tuscanyscatours/hotel/HotelInfo.java new file mode 100644 index 0000000000..e2912c50fc --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/hotel/src/main/java/com/tuscanyscatours/hotel/HotelInfo.java @@ -0,0 +1,118 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package com.tuscanyscatours.hotel;
+
+public class HotelInfo {
+
+ private String name;
+ private String description;
+ private String location;
+ private String date;
+ private String beds;
+ private double pricePerBed;
+ private String currency;
+ private String link;
+
+ public HotelInfo() {
+ }
+
+ public HotelInfo(String name,
+ String description,
+ String location,
+ String date,
+ String beds,
+ double pricePerBed,
+ String currency,
+ String link) {
+
+ this.name = name;
+ this.description = description;
+ this.location = location;
+ this.date = date;
+ this.beds = beds;
+ this.pricePerBed = pricePerBed;
+ this.currency = currency;
+ this.link = link;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public String getLocation() {
+ return location;
+ }
+
+ public void setLocation(String location) {
+ this.location = location;
+ }
+
+ public String getDate() {
+ return date;
+ }
+
+ public void setDate(String date) {
+ this.date = date;
+ }
+
+ public String getBeds() {
+ return beds;
+ }
+
+ public void setBeds(String beds) {
+ this.beds = beds;
+ }
+
+ public double getPricePerBed() {
+ return pricePerBed;
+ }
+
+ public void setPricePerBed(double pricePerBed) {
+ this.pricePerBed = pricePerBed;
+ }
+
+ public String getCurrency() {
+ return currency;
+ }
+
+ public void setCurrency(String currency) {
+ this.currency = currency;
+ }
+
+ public String getLink() {
+ return link;
+ }
+
+ public void setLink(String link) {
+ this.link = link;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/hotel/src/main/java/com/tuscanyscatours/hotel/HotelManagement.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/hotel/src/main/java/com/tuscanyscatours/hotel/HotelManagement.java new file mode 100644 index 0000000000..476da9a544 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/hotel/src/main/java/com/tuscanyscatours/hotel/HotelManagement.java @@ -0,0 +1,24 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package com.tuscanyscatours.hotel; + +public interface HotelManagement { + void addHotelInfo(HotelInfo hotelInfo); +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/hotel/src/main/java/com/tuscanyscatours/hotel/impl/HotelImpl.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/hotel/src/main/java/com/tuscanyscatours/hotel/impl/HotelImpl.java new file mode 100644 index 0000000000..fe8953ea0e --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/hotel/src/main/java/com/tuscanyscatours/hotel/impl/HotelImpl.java @@ -0,0 +1,105 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package com.tuscanyscatours.hotel.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+import com.tuscanyscatours.common.Book;
+import com.tuscanyscatours.common.Search;
+import com.tuscanyscatours.common.SearchCallback;
+import com.tuscanyscatours.common.TripItem;
+import com.tuscanyscatours.common.TripLeg;
+import com.tuscanyscatours.hotel.HotelInfo;
+import com.tuscanyscatours.hotel.HotelManagement;
+
+/**
+ * An implementation of the Hotel service
+ */
+@Scope("STATELESS")
+@Service(interfaces = {Search.class, Book.class, HotelManagement.class})
+public class HotelImpl implements Search, Book, HotelManagement {
+
+ private List<HotelInfo> hotels = new ArrayList<HotelInfo>();
+
+ @Callback
+ protected SearchCallback searchCallback;
+
+ @Init
+ public void init() {
+ hotels.add(new HotelInfo("Deep Bay Hotel", "Wonderful sea views and a relaxed atmosphere", "FLR", "06/12/09",
+ "200", 100, "EUR", "http://localhost:8085/tbd"));
+ hotels.add(new HotelInfo("Long Bay Hotel", "Friendly staff and an ocean breeze", "FLR", "06/12/09", "200", 100,
+ "EUR", "http://localhost:8085/tbd"));
+ hotels.add(new HotelInfo("City Hotel", "Smart rooms and early breakfasts", "FLR", "06/12/09", "200", 100,
+ "EUR", "http://localhost:8085/tbd"));
+ hotels.add(new HotelInfo("County Hotel", "The smell of the open country", "FLR", "06/12/09", "200", 100, "EUR",
+ "http://localhost:8085/tbd"));
+ }
+
+ public TripItem[] searchSynch(TripLeg tripLeg) {
+ List<TripItem> items = new ArrayList<TripItem>();
+
+ // find available hotels
+ for (HotelInfo hotel : hotels) {
+ if (hotel.getLocation().equals(tripLeg.getToLocation())) {
+ TripItem item =
+ new TripItem("", "", TripItem.HOTEL, hotel.getName(), hotel.getDescription(), hotel.getLocation(),
+ tripLeg.getFromDate(), tripLeg.getToDate(), hotel.getPricePerBed(), hotel
+ .getCurrency(), hotel.getLink());
+ items.add(item);
+ }
+ }
+
+ return items.toArray(new TripItem[items.size()]);
+ }
+
+ public void searchAsynch(TripLeg tripLeg) {
+ System.out.println("Starting hotel search");
+
+ // pretend that this processing takes some time to complete
+ try {
+ Thread.sleep(3000);
+ } catch (Exception ex) {
+ // do nothing
+ }
+
+ // return available hotels
+ TripItem[] items = searchSynch(tripLeg);
+ searchCallback.searchResults(items);
+ }
+
+ public int getPercentComplete() {
+ return 100;
+ }
+
+ public String book(TripItem tripItem) {
+ return "hotel1";
+ }
+
+ public void addHotelInfo(HotelInfo hotelInfo) {
+ hotels.add(hotelInfo);
+ System.out.println("Added hotel info - " + hotelInfo.getName());
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/hotel/src/main/resources/META-INF/sca-contribution.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/hotel/src/main/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..40382221a5 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/hotel/src/main/resources/META-INF/sca-contribution.xml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0">
+ <import.java package="com.tuscanyscatours.common"/>
+ <export.java package="com.tuscanyscatours.hotel"/>
+ <export.java package="com.tuscanyscatours.hotel.impl"/>
+</contribution>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/interaction-client/build.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/interaction-client/build.xml new file mode 100644 index 0000000000..0d03b5401d --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/interaction-client/build.xml @@ -0,0 +1,28 @@ +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> + +<project name="scatours-contribution-interaction-client" default="compile"> + <import file="../../antdefs.xml"/> + <path id="compile-path"> + <pathelement path="../calendar/target/scatours-contribution-calendar.jar"/> + <pathelement path="../common/target/scatours-contribution-common.jar"/> + <pathelement path="../currency/target/scatours-contribution-currency.jar"/> + <pathelement path="../shoppingcart/target/scatours-contribution-shoppingcart.jar"/> + </path> +</project> diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/interaction-client/pom.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/interaction-client/pom.xml new file mode 100644 index 0000000000..59025a3a54 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/interaction-client/pom.xml @@ -0,0 +1,77 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<project> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>scatours</artifactId> + <version>1.0-SNAPSHOT</version> + <relativePath>../../pom.xml</relativePath> + </parent><version>1.0-SNAPSHOT</version> + <artifactId>scatours-contribution-interaction-client</artifactId> + <name>Apache Tuscany SCA Tours Interaction Client Contribution</name> + + <dependencies> + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-sca-api</artifactId> + <version>${tuscany.version}</version> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>scatours-contribution-common</artifactId> + <version>${pom.version}</version> + <scope>provided</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>scatours-contribution-calendar</artifactId> + <version>${pom.version}</version> + <scope>provided</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>scatours-contribution-hotel</artifactId> + <version>${pom.version}</version> + <scope>provided</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>scatours-contribution-currency</artifactId> + <version>${pom.version}</version> + <scope>provided</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>scatours-contribution-shoppingcart</artifactId> + <version>${pom.version}</version> + <scope>provided</scope> + </dependency> + </dependencies> + + <build> + <finalName>${artifactId}</finalName> + </build> +</project> diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/interaction-client/src/main/java/scatours/client/impl/InteractionConversationClientImpl.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/interaction-client/src/main/java/scatours/client/impl/InteractionConversationClientImpl.java new file mode 100644 index 0000000000..290e6e6aee --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/interaction-client/src/main/java/scatours/client/impl/InteractionConversationClientImpl.java @@ -0,0 +1,73 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package scatours.client.impl; + +import org.osoa.sca.annotations.Reference; +import org.osoa.sca.annotations.Scope; +import org.osoa.sca.annotations.Service; + +import com.tuscanyscatours.common.TripItem; +import com.tuscanyscatours.shoppingcart.CartStore; + +@Scope("COMPOSITE") +@Service(Runnable.class) +public class InteractionConversationClientImpl implements Runnable { + + @Reference + protected CartStore cartStoreConversation; + + public void run() { + System.out.println("\nCalling cart store using the conversational interaction pattern"); + + // add some trip items to the cart store + TripItem tripItem = getTestTripItem(); + cartStoreConversation.addTrip(tripItem); + + tripItem.setDescription("2nd trip item"); + cartStoreConversation.addTrip(tripItem); + + tripItem.setDescription("3rd trip item"); + cartStoreConversation.addTrip(tripItem); + + System.out.println("Trip items now in cart"); + TripItem[] tripItems = cartStoreConversation.getTrips(); + for (TripItem item : tripItems) { + System.out.println("Item - " + item.getDescription()); + } + + System.out.println("Reset the cart"); + cartStoreConversation.reset(); + + System.out.println("Trip items now in cart"); + tripItems = cartStoreConversation.getTrips(); + for (TripItem item : tripItems) { + System.out.println("Item - " + item.getDescription()); + } + } + + private TripItem getTestTripItem() { + TripItem tripItem = new TripItem(); + tripItem.setLocation("FLR"); + tripItem.setFromDate("06/12/09 00:00"); + tripItem.setToDate("13/12/09 00:00"); + tripItem.setDescription("1st trip item"); + return tripItem; + } +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/interaction-client/src/main/java/scatours/client/impl/InteractionLocalClientImpl.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/interaction-client/src/main/java/scatours/client/impl/InteractionLocalClientImpl.java new file mode 100644 index 0000000000..ca3cb2874a --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/interaction-client/src/main/java/scatours/client/impl/InteractionLocalClientImpl.java @@ -0,0 +1,53 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package scatours.client.impl; + +import org.osoa.sca.annotations.Reference; +import org.osoa.sca.annotations.Service; + +import com.tuscanyscatours.calendar.Calendar; +import com.tuscanyscatours.common.TripLeg; + +@Service(Runnable.class) +public class InteractionLocalClientImpl implements Runnable { + + @Reference + protected Calendar calendarLocal; + + public void run() { + System.out.println("\nCalling calendar component over a local binding"); + TripLeg tripLeg = getTestTripLeg(); + String toDate = calendarLocal.getEndDate(tripLeg.getFromDate(), 10); + tripLeg.setToDate(toDate); + System.out.println("Calculated trip end date - " + toDate); + ; + } + + private TripLeg getTestTripLeg() { + TripLeg tripLeg = new TripLeg(); + tripLeg.setFromLocation("LGW"); + tripLeg.setToLocation("FLR"); + tripLeg.setFromDate("06/12/09 00:00"); + tripLeg.setToDate("13/12/09 00:00"); + tripLeg.setNoOfPeople("1"); + tripLeg.setId("TRIP27"); + return tripLeg; + } +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/interaction-client/src/main/java/scatours/client/impl/InteractionOneWayCallbackClientImpl.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/interaction-client/src/main/java/scatours/client/impl/InteractionOneWayCallbackClientImpl.java new file mode 100644 index 0000000000..9689ce8e0c --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/interaction-client/src/main/java/scatours/client/impl/InteractionOneWayCallbackClientImpl.java @@ -0,0 +1,78 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package scatours.client.impl; + +import java.util.concurrent.CountDownLatch; + +import org.osoa.sca.annotations.Reference; +import org.osoa.sca.annotations.Scope; +import org.osoa.sca.annotations.Service; + +import com.tuscanyscatours.common.Search; +import com.tuscanyscatours.common.SearchCallback; +import com.tuscanyscatours.common.TripItem; +import com.tuscanyscatours.common.TripLeg; + +@Scope("COMPOSITE") +@Service(Runnable.class) +public class InteractionOneWayCallbackClientImpl implements Runnable, SearchCallback { + + @Reference + protected Search hotelSearchOneWayCallback; + + CountDownLatch resultsReceivedCountdown; + + public void run() { + System.out.println("\nCalling hotel component using both one way and callback interation patterns"); + resultsReceivedCountdown = new CountDownLatch(1); + TripLeg tripLeg = getTestTripLeg(); + hotelSearchOneWayCallback.searchAsynch(tripLeg); + + // start other searched here while the hotel search progresses + + // wait for responses to come back + try { + resultsReceivedCountdown.await(); + } catch (InterruptedException ex) { + } + } + + public void searchResults(TripItem[] items) { + for (TripItem tripItem : items) { + System.out.println("Found hotel - " + tripItem.getName()); + } + resultsReceivedCountdown.countDown(); + } + + public void setPercentComplete(String searchComponent, int percentComplete) { + // Not used in this sample + } + + private TripLeg getTestTripLeg() { + TripLeg tripLeg = new TripLeg(); + tripLeg.setFromLocation("LGW"); + tripLeg.setToLocation("FLR"); + tripLeg.setFromDate("06/12/09 00:00"); + tripLeg.setToDate("13/12/09 00:00"); + tripLeg.setNoOfPeople("1"); + tripLeg.setId("TRIP27"); + return tripLeg; + } +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/interaction-client/src/main/java/scatours/client/impl/InteractionRemoteClientImpl.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/interaction-client/src/main/java/scatours/client/impl/InteractionRemoteClientImpl.java new file mode 100644 index 0000000000..1fd9d9cbe8 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/interaction-client/src/main/java/scatours/client/impl/InteractionRemoteClientImpl.java @@ -0,0 +1,64 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package scatours.client.impl; + +import org.osoa.sca.annotations.Reference; +import org.osoa.sca.annotations.Service; + +import com.tuscanyscatours.common.Search; +import com.tuscanyscatours.common.SearchCallback; +import com.tuscanyscatours.common.TripItem; +import com.tuscanyscatours.common.TripLeg; + +@Service(Runnable.class) +public class InteractionRemoteClientImpl implements Runnable, SearchCallback { + + @Reference + protected Search hotelSearchRemote; + + public void run() { + System.out.println("\nCalling hotel component over a remote binding"); + TripLeg tripLeg = getTestTripLeg(); + TripItem[] tripItems = hotelSearchRemote.searchSynch(tripLeg); + for (TripItem tripItem : tripItems) { + System.out.println("Found hotel - " + tripItem.getName()); + } + } + + public void searchResults(TripItem[] items) { + // we are calling the hotel component synchronously here + // so the callback interface is not used + } + + public void setPercentComplete(String searchComponent, int percentComplete) { + // Not used in this sample + } + + private TripLeg getTestTripLeg() { + TripLeg tripLeg = new TripLeg(); + tripLeg.setFromLocation("LGW"); + tripLeg.setToLocation("FLR"); + tripLeg.setFromDate("06/12/09 00:00"); + tripLeg.setToDate("13/12/09 00:00"); + tripLeg.setNoOfPeople("1"); + tripLeg.setId("TRIP27"); + return tripLeg; + } +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/interaction-client/src/main/java/scatours/client/impl/InteractionRequestResponseClientImpl.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/interaction-client/src/main/java/scatours/client/impl/InteractionRequestResponseClientImpl.java new file mode 100644 index 0000000000..d1438434ae --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/interaction-client/src/main/java/scatours/client/impl/InteractionRequestResponseClientImpl.java @@ -0,0 +1,39 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package scatours.client.impl; + +import org.osoa.sca.annotations.Reference; +import org.osoa.sca.annotations.Service; + +import com.tuscanyscatours.currencyconverter.CurrencyConverter; + +@Service(Runnable.class) +public class InteractionRequestResponseClientImpl implements Runnable { + + @Reference + protected CurrencyConverter currencyConverterRequestResponse; + + public void run() { + System.out.println("\nCalling currency converter component using request response interation pattern"); + double exchangeRate = currencyConverterRequestResponse.getExchangeRate("GBP", "USD"); + System.out.println("GBP to USD exchange rate is " + exchangeRate); + } + +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/interaction-client/src/main/resources/META-INF/sca-contribution.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/interaction-client/src/main/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..283a1588df --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/interaction-client/src/main/resources/META-INF/sca-contribution.xml @@ -0,0 +1,30 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0" + xmlns:tours="http://tucsanyscatours.com/"> + <import.java package="com.tuscanyscatours.calendar" /> + <import.java package="com.tuscanyscatours.calendar.impl" /> + <import.java package="com.tuscanyscatours.common" /> + <import.java package="com.tuscanyscatours.currencyconverter" /> + <import.java package="com.tuscanyscatours.currencyconverter.impl" /> + <import.java package="com.tuscanyscatours.shoppingcart" /> + <import.java package="com.tuscanyscatours.shoppingcart.impl" /> + <deployable composite="tours:client" /> +</contribution> diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/interaction-client/src/main/resources/client.composite b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/interaction-client/src/main/resources/client.composite new file mode 100644 index 0000000000..1c8552974b --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/interaction-client/src/main/resources/client.composite @@ -0,0 +1,77 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" + targetNamespace="http://tuscanyscatours.com/" + name="Client"> + + <!-- Local interaction --> + <component name="InteractionLocalClient"> + <implementation.java class="scatours.client.impl.InteractionLocalClientImpl" /> + <reference name="calendarLocal" + target="Calendar"/> + </component> + + <component name="Calendar"> + <implementation.java class="com.tuscanyscatours.calendar.impl.CalendarImpl"/> + </component> + + <!-- Remote interaction --> + <component name="InteractionRemoteClient"> + <implementation.java class="scatours.client.impl.InteractionRemoteClientImpl" /> + <reference name="hotelSearchRemote"> + <binding.ws uri="http://localhost:8081/Hotel/Search"/> + </reference> + </component> + + <!-- Request response interaction --> + <component name="InteractionRequestResponseClient"> + <implementation.java class="scatours.client.impl.InteractionRequestResponseClientImpl" /> + <reference name="currencyConverterRequestResponse" target="CurrencyConverter"/> + </component> + + <component name="CurrencyConverter"> + <implementation.java class="com.tuscanyscatours.currencyconverter.impl.CurrencyConverterImpl"/> + </component> + + <!-- One way and callback interaction --> + <component name="InteractionOneWayCallbackClient"> + <implementation.java class="scatours.client.impl.InteractionOneWayCallbackClientImpl" /> + <reference name="hotelSearchOneWayCallback"> + <interface.java interface="com.tuscanyscatours.common.Search" + callbackInterface="com.tuscanyscatours.common.SearchCallback"/> + <binding.ws uri="http://localhost:8081/Hotel/Search"/> + <callback> + <binding.ws name="callback" uri="http://localhost:8080/Client/SearchCallback"/> + </callback> + </reference> + </component> + + <!-- Conversational interaction --> + <component name="InteractionConversationClient"> + <implementation.java class="scatours.client.impl.InteractionConversationClientImpl" /> + <reference name="cartStoreConversation" target="CartStore"/> + </component> + + <component name="CartStore"> + <implementation.java class="com.tuscanyscatours.shoppingcart.impl.CartStoreImpl"/> + <service name="CartStore"/> + </component> + +</composite> diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/interaction-service-remote/build.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/interaction-service-remote/build.xml new file mode 100644 index 0000000000..10451b6248 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/interaction-service-remote/build.xml @@ -0,0 +1,22 @@ +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> + +<project name="scatours-contribution-interaction-service-remote" default="compile"> + <import file="../../antdefs.xml"/> +</project> diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/interaction-service-remote/pom.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/interaction-service-remote/pom.xml new file mode 100644 index 0000000000..417557f0ae --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/interaction-service-remote/pom.xml @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<project> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>scatours</artifactId> + <version>1.0-SNAPSHOT</version> + <relativePath>../../pom.xml</relativePath> + </parent><version>1.0-SNAPSHOT</version> + <artifactId>scatours-contribution-interaction-service-remote</artifactId> + <name>Apache Tuscany SCA Tours Interaction Service Remote Contribution</name> + + <build> + <finalName>${artifactId}</finalName> + </build> +</project> diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/interaction-service-remote/src/main/resources/META-INF/sca-contribution.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/interaction-service-remote/src/main/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..c26d63563b --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/interaction-service-remote/src/main/resources/META-INF/sca-contribution.xml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0" + xmlns:tours="http://com.tuscanyscatours/"> + <import.java package="com.tuscanyscatours.common" /> + <import.java package="com.tuscanyscatours.flight.impl" /> + <import.java package="com.tuscanyscatours.hotel.impl" /> + <deployable composite="tours:service" /> +</contribution> diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/interaction-service-remote/src/main/resources/service.composite b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/interaction-service-remote/src/main/resources/service.composite new file mode 100644 index 0000000000..0f368da1ed --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/interaction-service-remote/src/main/resources/service.composite @@ -0,0 +1,48 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" + targetNamespace="http://tuscanyscatours.com/" + name="Service"> + + <component name="Hotel"> + <implementation.java class="com.tuscanyscatours.hotel.impl.HotelImpl"/> + <service name="Search"> + <interface.java interface="com.tuscanyscatours.common.Search" + callbackInterface="com.tuscanyscatours.common.SearchCallback"/> + <binding.ws uri="http://localhost:8081/Hotel/Search"/> + <callback> + <binding.ws name="callback"/> + </callback> + </service> + </component> + + <component name="Flight"> + <implementation.java class="com.tuscanyscatours.flight.impl.FlightImpl"/> + <service name="Search"> + <interface.java interface="com.tuscanyscatours.common.Search" + callbackInterface="com.tuscanyscatours.common.SearchCallback"/> + <binding.ws uri="http://localhost:8081/Hotel/SearchConversational"/> + <callback> + <binding.ws name="callback"/> + </callback> + </service> + </component> + +</composite> diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/introducing-client/build.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/introducing-client/build.xml new file mode 100644 index 0000000000..6a85f2066e --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/introducing-client/build.xml @@ -0,0 +1,25 @@ +<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<project name="scatours-contribution-introducing-client" default="compile">
+ <import file="../../antdefs.xml"/>
+ <path id="compile-path">
+ <pathelement path="../introducing-tours/target/scatours-contribution-introducing-tours.jar"/>
+ </path>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/introducing-client/pom.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/introducing-client/pom.xml new file mode 100644 index 0000000000..efbfec8179 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/introducing-client/pom.xml @@ -0,0 +1,49 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent><version>1.0-SNAPSHOT</version>
+ <artifactId>scatours-contribution-introducing-client</artifactId>
+ <name>Apache Tuscany SCA Tours Introducing Client Contribution</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca-api</artifactId>
+ <version>${tuscany.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-contribution-introducing-tours</artifactId>
+ <version>${pom.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ </build>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/introducing-client/src/main/java/scatours/client/impl/TestClientImpl.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/introducing-client/src/main/java/scatours/client/impl/TestClientImpl.java new file mode 100644 index 0000000000..f81a2c7304 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/introducing-client/src/main/java/scatours/client/impl/TestClientImpl.java @@ -0,0 +1,47 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package scatours.client.impl;
+
+import java.math.BigDecimal;
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+import com.tuscanyscatours.Bookings;
+import com.tuscanyscatours.Checkout;
+
+@Service(Runnable.class)
+public class TestClientImpl {
+ @Reference
+ protected Bookings bookings;
+
+ @Reference
+ protected Checkout checkout;
+
+ public TestClientImpl() {
+ }
+
+ public void run() {
+ String bookingCode = bookings.newBooking("FS1APR4", 1);
+ System.out.println("Booking code is " + bookingCode);
+
+ checkout.makePayment(new BigDecimal("1995.00"), "1234567843218765 10/10");
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/introducing-client/src/main/resources/META-INF/sca-contribution.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/introducing-client/src/main/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..9ce11f16ef --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/introducing-client/src/main/resources/META-INF/sca-contribution.xml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:client="http://client.scatours/">
+ <import.java package="com.tuscanyscatours" />
+ <deployable composite="client:Client" />
+</contribution>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/introducing-client/src/main/resources/client.composite b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/introducing-client/src/main/resources/client.composite new file mode 100644 index 0000000000..3a404eb10d --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/introducing-client/src/main/resources/client.composite @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://client.scatours/"
+ name="Client">
+
+ <component name="TestClient">
+ <implementation.java class="scatours.client.impl.TestClientImpl" />
+ <reference name="bookings" target="TripBooking/Bookings" />
+ <reference name="checkout" target="ShoppingCart/Checkout" />
+ </component>
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/introducing-tours/build.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/introducing-tours/build.xml new file mode 100644 index 0000000000..f269f6577b --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/introducing-tours/build.xml @@ -0,0 +1,22 @@ +<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<project name="scatours-contribution-introducing-tours" default="compile">
+ <import file="../../antdefs.xml"/>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/introducing-tours/pom.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/introducing-tours/pom.xml new file mode 100644 index 0000000000..90839f94d4 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/introducing-tours/pom.xml @@ -0,0 +1,42 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent><version>1.0-SNAPSHOT</version>
+ <artifactId>scatours-contribution-introducing-tours</artifactId>
+ <name>Apache Tuscany SCA Tours Introducing Tours Contribution</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca-api</artifactId>
+ <version>${tuscany.version}</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ </build>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/introducing-tours/src/main/java/com/goodvaluetrips/Trips.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/introducing-tours/src/main/java/com/goodvaluetrips/Trips.java new file mode 100644 index 0000000000..365a210368 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/introducing-tours/src/main/java/com/goodvaluetrips/Trips.java @@ -0,0 +1,26 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package com.goodvaluetrips;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface Trips {
+ String checkAvailability(String trip, int people);
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/introducing-tours/src/main/java/com/tuscanyscatours/Bookings.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/introducing-tours/src/main/java/com/tuscanyscatours/Bookings.java new file mode 100644 index 0000000000..9d54d46bb6 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/introducing-tours/src/main/java/com/tuscanyscatours/Bookings.java @@ -0,0 +1,26 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package com.tuscanyscatours;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface Bookings {
+ String newBooking(String trip, int people);
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/introducing-tours/src/main/java/com/tuscanyscatours/Checkout.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/introducing-tours/src/main/java/com/tuscanyscatours/Checkout.java new file mode 100644 index 0000000000..29c84d2bc0 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/introducing-tours/src/main/java/com/tuscanyscatours/Checkout.java @@ -0,0 +1,28 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package com.tuscanyscatours;
+
+import java.math.BigDecimal;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface Checkout {
+ void makePayment(BigDecimal amount, String cardInfo);
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/introducing-tours/src/main/java/com/tuscanyscatours/Updates.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/introducing-tours/src/main/java/com/tuscanyscatours/Updates.java new file mode 100644 index 0000000000..e33b0399cb --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/introducing-tours/src/main/java/com/tuscanyscatours/Updates.java @@ -0,0 +1,26 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package com.tuscanyscatours;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface Updates {
+ void addTrip(String resCode);
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/introducing-tours/src/main/java/com/tuscanyscatours/impl/ShoppingCartImpl.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/introducing-tours/src/main/java/com/tuscanyscatours/impl/ShoppingCartImpl.java new file mode 100644 index 0000000000..629ea7b5ec --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/introducing-tours/src/main/java/com/tuscanyscatours/impl/ShoppingCartImpl.java @@ -0,0 +1,49 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package com.tuscanyscatours.impl;
+
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.List;
+
+import com.tuscanyscatours.Checkout;
+import com.tuscanyscatours.Updates;
+
+public class ShoppingCartImpl implements Checkout, Updates {
+ private static List<String> bookedTrips = new ArrayList<String>();
+
+ protected String currency = "USD";
+
+ public void makePayment(BigDecimal amount, String cardInfo) {
+ System.out.print("Charged " + currency + " " + amount
+ + " to card "
+ + cardInfo
+ + " for "
+ + (bookedTrips.size() > 1 ? "trips" : "trip"));
+ for (String trip : bookedTrips) {
+ System.out.print(" " + trip);
+ }
+ System.out.println();
+ bookedTrips.clear();
+ }
+
+ public void addTrip(String resCode) {
+ bookedTrips.add(resCode);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/introducing-tours/src/main/java/com/tuscanyscatours/impl/TripBookingImpl.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/introducing-tours/src/main/java/com/tuscanyscatours/impl/TripBookingImpl.java new file mode 100644 index 0000000000..f2884f87c5 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/introducing-tours/src/main/java/com/tuscanyscatours/impl/TripBookingImpl.java @@ -0,0 +1,39 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package com.tuscanyscatours.impl;
+
+import org.osoa.sca.annotations.Reference;
+
+import com.goodvaluetrips.Trips;
+import com.tuscanyscatours.Bookings;
+import com.tuscanyscatours.Updates;
+
+public class TripBookingImpl implements Bookings {
+ @Reference
+ protected Trips mytrips;
+
+ @Reference
+ protected Updates cart;
+
+ public String newBooking(String trip, int people) {
+ String resCode = mytrips.checkAvailability(trip, people);
+ cart.addTrip(resCode);
+ return "GV" + resCode;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/introducing-tours/src/main/resources/META-INF/sca-contribution.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/introducing-tours/src/main/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..5f76588dad --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/introducing-tours/src/main/resources/META-INF/sca-contribution.xml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:tst="http://tuscanyscatours.com/">
+ <export.java package="com.tuscanyscatours" />
+ <deployable composite="tst:Tours" />
+</contribution>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/introducing-tours/src/main/resources/tours.composite b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/introducing-tours/src/main/resources/tours.composite new file mode 100644 index 0000000000..6d47793aa4 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/introducing-tours/src/main/resources/tours.composite @@ -0,0 +1,46 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://tuscanyscatours.com/"
+ name="Tours">
+
+ <component name="TripBooking">
+ <implementation.java class="com.tuscanyscatours.impl.TripBookingImpl" />
+ <service name="Bookings">
+ <interface.java interface="com.tuscanyscatours.Bookings" />
+ </service>
+ <reference name="mytrips" target="TripProvider/Trips">
+ <interface.java interface="com.goodvaluetrips.Trips" />
+ </reference>
+ <reference name="cart" target="ShoppingCart/Updates">
+ <interface.java interface="com.tuscanyscatours.Updates" />
+ </reference>
+ </component>
+
+ <component name="ShoppingCart">
+ <implementation.java class="com.tuscanyscatours.impl.ShoppingCartImpl"/>
+ <service name="Checkout">
+ <interface.java interface="com.tuscanyscatours.Checkout" />
+ </service>
+ <service name="Updates">
+ <interface.java interface="com.tuscanyscatours.Updates" />
+ </service>
+ </component>
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/introducing-trips/build.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/introducing-trips/build.xml new file mode 100644 index 0000000000..9d65c703b7 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/introducing-trips/build.xml @@ -0,0 +1,22 @@ +<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<project name="scatours-contribution-introducing-trips" default="compile">
+ <import file="../../antdefs.xml"/>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/introducing-trips/pom.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/introducing-trips/pom.xml new file mode 100644 index 0000000000..d586861b6b --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/introducing-trips/pom.xml @@ -0,0 +1,42 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent><version>1.0-SNAPSHOT</version>
+ <artifactId>scatours-contribution-introducing-trips</artifactId>
+ <name>Apache Tuscany SCA Tours Introducing Trips Contribution</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca-api</artifactId>
+ <version>${tuscany.version}</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ </build>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/introducing-trips/src/main/java/com/goodvaluetrips/Trips.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/introducing-trips/src/main/java/com/goodvaluetrips/Trips.java new file mode 100644 index 0000000000..365a210368 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/introducing-trips/src/main/java/com/goodvaluetrips/Trips.java @@ -0,0 +1,26 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package com.goodvaluetrips;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface Trips {
+ String checkAvailability(String trip, int people);
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/introducing-trips/src/main/java/com/goodvaluetrips/impl/TripProviderImpl.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/introducing-trips/src/main/java/com/goodvaluetrips/impl/TripProviderImpl.java new file mode 100644 index 0000000000..06f93f2637 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/introducing-trips/src/main/java/com/goodvaluetrips/impl/TripProviderImpl.java @@ -0,0 +1,28 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package com.goodvaluetrips.impl;
+
+import com.goodvaluetrips.Trips;
+
+public class TripProviderImpl implements Trips {
+ public String checkAvailability(String trip, int people) {
+ // call non-SCA code to reserve trip and return booking code
+ return "6R98Y";
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/introducing-trips/src/main/resources/META-INF/sca-contribution.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/introducing-trips/src/main/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..85e064b1a2 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/introducing-trips/src/main/resources/META-INF/sca-contribution.xml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:gvt="http://goodvaluetrips.com/">
+ <export namespace="http://goodvaluetrips.com/" />
+ <deployable composite="gvt:Trips" />
+</contribution>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/introducing-trips/src/main/resources/trips.composite b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/introducing-trips/src/main/resources/trips.composite new file mode 100644 index 0000000000..8d1db35b1f --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/introducing-trips/src/main/resources/trips.composite @@ -0,0 +1,30 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://goodvaluetrips.com/"
+ name="Trips">
+
+ <component name="TripProvider">
+ <implementation.java class="com.goodvaluetrips.impl.TripProviderImpl" />
+ <service name="Trips">
+ <interface.java interface="com.goodvaluetrips.Trips" />
+ </service>
+ </component>
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/notification-corba/build.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/notification-corba/build.xml new file mode 100644 index 0000000000..1baf6ab153 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/notification-corba/build.xml @@ -0,0 +1,22 @@ +<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<project name="scatours-contribution-notification-corba" default="compile">
+ <import file="../../antdefs.xml"/>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/notification-corba/pom.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/notification-corba/pom.xml new file mode 100644 index 0000000000..2cc112c887 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/notification-corba/pom.xml @@ -0,0 +1,43 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent><version>1.0-SNAPSHOT</version>
+ <artifactId>scatours-contribution-notification-corba</artifactId>
+ <name>Apache Tuscany SCA Tours Notification Contribution Which Uses SMSGateway CORBA Service</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-corba-runtime</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ </build>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/notification-corba/src/main/resources/META-INF/sca-contribution.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/notification-corba/src/main/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..373d1494f6 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/notification-corba/src/main/resources/META-INF/sca-contribution.xml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0">
+ <import.java package="com.tuscanyscatours.notification" />
+ <import.java package="com.tuscanyscatours.notification.impl" />
+ <import.java package="com.tuscanyscatours.smsgateway" />
+</contribution>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/notification-corba/src/main/resources/notification-corba.composite b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/notification-corba/src/main/resources/notification-corba.composite new file mode 100644 index 0000000000..8baca02509 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/notification-corba/src/main/resources/notification-corba.composite @@ -0,0 +1,36 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" + xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0" + targetNamespace="http://tuscanyscatours.com/" + name="notification"> + + <component name="Notification"> + <implementation.java class="com.tuscanyscatours.notification.impl.NotificationImpl" /> + <service name="Notification"> + <interface.java interface="com.tuscanyscatours.notification.Notification"/> + </service> + + <reference name="smsGateway"> + <interface.java interface="com.tuscanyscatours.smsgateway.SMSGateway"/> + <tuscany:binding.corba host="localhost" port="5080" name="SMSGatewayCORBAService"/> + </reference> + </component> +</composite> diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/notification-ejb/build.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/notification-ejb/build.xml new file mode 100644 index 0000000000..3b7e660a5d --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/notification-ejb/build.xml @@ -0,0 +1,22 @@ +<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<project name="scatours-contribution-notification-ejb" default="compile">
+ <import file="../../antdefs.xml"/>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/notification-ejb/pom.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/notification-ejb/pom.xml new file mode 100644 index 0000000000..4a51f1d27f --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/notification-ejb/pom.xml @@ -0,0 +1,43 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent><version>1.0-SNAPSHOT</version>
+ <artifactId>scatours-contribution-notification-ejb</artifactId>
+ <name>Apache Tuscany SCA Tours Notification Contribution Which Uses SMSGateway EJB Service</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ejb-runtime</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ </build>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/notification-ejb/src/main/resources/META-INF/sca-contribution.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/notification-ejb/src/main/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..373d1494f6 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/notification-ejb/src/main/resources/META-INF/sca-contribution.xml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0">
+ <import.java package="com.tuscanyscatours.notification" />
+ <import.java package="com.tuscanyscatours.notification.impl" />
+ <import.java package="com.tuscanyscatours.smsgateway" />
+</contribution>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/notification-ejb/src/main/resources/notification-ejb.composite b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/notification-ejb/src/main/resources/notification-ejb.composite new file mode 100644 index 0000000000..11b632fd79 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/notification-ejb/src/main/resources/notification-ejb.composite @@ -0,0 +1,35 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" + targetNamespace="http://tuscanyscatours.com/" + name="notification"> + + <component name="Notification"> + <implementation.java class="com.tuscanyscatours.notification.impl.NotificationImpl" /> + <service name="Notification"> + <interface.java interface="com.tuscanyscatours.notification.Notification"/> + </service> + + <reference name="smsGateway"> + <interface.java interface="com.tuscanyscatours.smsgateway.SMSGateway"/> + <binding.ejb uri="SMSGatewayImplRemote"/> + </reference> + </component> +</composite> diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/notification-jms/build.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/notification-jms/build.xml new file mode 100644 index 0000000000..0b1b80c44f --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/notification-jms/build.xml @@ -0,0 +1,22 @@ +<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<project name="scatours-contribution-notification-jms" default="compile">
+ <import file="../../antdefs.xml"/>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/notification-jms/pom.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/notification-jms/pom.xml new file mode 100644 index 0000000000..bd4740eec7 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/notification-jms/pom.xml @@ -0,0 +1,43 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent><version>1.0-SNAPSHOT</version>
+ <artifactId>scatours-contribution-notification-jms</artifactId>
+ <name>Apache Tuscany SCA Tours Notification Contribution Which Uses SMSGateway JMS Service</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-jms-runtime</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ </build>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/notification-jms/src/main/resources/META-INF/sca-contribution.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/notification-jms/src/main/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..373d1494f6 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/notification-jms/src/main/resources/META-INF/sca-contribution.xml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0">
+ <import.java package="com.tuscanyscatours.notification" />
+ <import.java package="com.tuscanyscatours.notification.impl" />
+ <import.java package="com.tuscanyscatours.smsgateway" />
+</contribution>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/notification-jms/src/main/resources/notification-jms.composite b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/notification-jms/src/main/resources/notification-jms.composite new file mode 100644 index 0000000000..dfd96ae918 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/notification-jms/src/main/resources/notification-jms.composite @@ -0,0 +1,41 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" + targetNamespace="http://tuscanyscatours.com/" + name="notification"> + + <component name="Notification"> + <implementation.java class="com.tuscanyscatours.notification.impl.NotificationImpl" /> + <service name="Notification"> + <interface.java interface="com.tuscanyscatours.notification.Notification"/> + </service> + + <reference name="smsGateway"> + <interface.java interface="com.tuscanyscatours.smsgateway.SMSGateway"/> + <binding.jms initialContextFactory="org.apache.activemq.jndi.ActiveMQInitialContextFactory" + jndiURL="tcp://localhost:61619"> + <destination name="SMSRequestQueue" create="ifnotexist"/> + <response> + <destination name="SMSResponseQueue" create="ifnotexist"/> + </response> + </binding.jms> + </reference> + </component> +</composite> diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/notification-rmi/build.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/notification-rmi/build.xml new file mode 100644 index 0000000000..de8d5bbb06 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/notification-rmi/build.xml @@ -0,0 +1,22 @@ +<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<project name="scatours-contribution-notification-rmi" default="compile">
+ <import file="../../antdefs.xml"/>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/notification-rmi/pom.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/notification-rmi/pom.xml new file mode 100644 index 0000000000..ba86efbecf --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/notification-rmi/pom.xml @@ -0,0 +1,43 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent><version>1.0-SNAPSHOT</version>
+ <artifactId>scatours-contribution-notification-rmi</artifactId>
+ <name>Apache Tuscany SCA Tours Notification Contribution Which Uses SMSGateway RMI Service</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-rmi-runtime</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ </build>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/notification-rmi/src/main/resources/META-INF/sca-contribution.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/notification-rmi/src/main/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..373d1494f6 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/notification-rmi/src/main/resources/META-INF/sca-contribution.xml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0">
+ <import.java package="com.tuscanyscatours.notification" />
+ <import.java package="com.tuscanyscatours.notification.impl" />
+ <import.java package="com.tuscanyscatours.smsgateway" />
+</contribution>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/notification-rmi/src/main/resources/notification-rmi.composite b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/notification-rmi/src/main/resources/notification-rmi.composite new file mode 100644 index 0000000000..e80c381b55 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/notification-rmi/src/main/resources/notification-rmi.composite @@ -0,0 +1,36 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" + xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0" + targetNamespace="http://tuscanyscatours.com/" + name="notification"> + + <component name="Notification"> + <implementation.java class="com.tuscanyscatours.notification.impl.NotificationImpl" /> + <service name="Notification"> + <interface.java interface="com.tuscanyscatours.notification.Notification"/> + </service> + + <reference name="smsGateway"> + <interface.java interface="com.tuscanyscatours.smsgateway.SMSGateway"/> + <tuscany:binding.rmi host="localhost" port="8099" serviceName="SMSGatewayRMI"/> + </reference> + </component> +</composite> diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/notification-ws/build.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/notification-ws/build.xml new file mode 100644 index 0000000000..bac935bc5a --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/notification-ws/build.xml @@ -0,0 +1,22 @@ +<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<project name="scatours-contribution-notification-ws" default="compile">
+ <import file="../../antdefs.xml"/>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/notification-ws/pom.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/notification-ws/pom.xml new file mode 100644 index 0000000000..95dc266d38 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/notification-ws/pom.xml @@ -0,0 +1,43 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent><version>1.0-SNAPSHOT</version>
+ <artifactId>scatours-contribution-notification-ws</artifactId>
+ <name>Apache Tuscany SCA Tours Notification Contribution Which Uses SMSGateway Web Service</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-axis2</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ </build>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/notification-ws/src/main/resources/META-INF/sca-contribution.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/notification-ws/src/main/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..373d1494f6 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/notification-ws/src/main/resources/META-INF/sca-contribution.xml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0">
+ <import.java package="com.tuscanyscatours.notification" />
+ <import.java package="com.tuscanyscatours.notification.impl" />
+ <import.java package="com.tuscanyscatours.smsgateway" />
+</contribution>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/notification-ws/src/main/resources/notification-ws.composite b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/notification-ws/src/main/resources/notification-ws.composite new file mode 100644 index 0000000000..e2051ad612 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/notification-ws/src/main/resources/notification-ws.composite @@ -0,0 +1,35 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" + targetNamespace="http://tuscanyscatours.com/" + name="notification"> + + <component name="Notification"> + <implementation.java class="com.tuscanyscatours.notification.impl.NotificationImpl" /> + <service name="Notification"> + <interface.java interface="com.tuscanyscatours.notification.Notification" /> + </service> + + <reference name="smsGateway"> + <interface.java interface="com.tuscanyscatours.smsgateway.SMSGateway" /> + <binding.ws uri="http://localhost:8081/SMSGatewayService" /> + </reference> + </component> +</composite> diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/notification/build.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/notification/build.xml new file mode 100644 index 0000000000..ff7e56c8b7 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/notification/build.xml @@ -0,0 +1,22 @@ +<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<project name="scatours-contribution-notification" default="compile">
+ <import file="../../antdefs.xml"/>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/notification/pom.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/notification/pom.xml new file mode 100644 index 0000000000..0f4e682e24 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/notification/pom.xml @@ -0,0 +1,49 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent><version>1.0-SNAPSHOT</version>
+ <artifactId>scatours-contribution-notification</artifactId>
+ <name>Apache Tuscany SCA Tours Notification Contribution</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca-api</artifactId>
+ <version>${tuscany.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ </build>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/notification/src/main/java/com/tuscanyscatours/notification/Notification.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/notification/src/main/java/com/tuscanyscatours/notification/Notification.java new file mode 100644 index 0000000000..7ae26b93e4 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/notification/src/main/java/com/tuscanyscatours/notification/Notification.java @@ -0,0 +1,26 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package com.tuscanyscatours.notification; + +public interface Notification { + + boolean notify(String accountID, String subject, String message); + +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/notification/src/main/java/com/tuscanyscatours/notification/impl/NotificationImpl.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/notification/src/main/java/com/tuscanyscatours/notification/impl/NotificationImpl.java new file mode 100644 index 0000000000..58d590242d --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/notification/src/main/java/com/tuscanyscatours/notification/impl/NotificationImpl.java @@ -0,0 +1,58 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package com.tuscanyscatours.notification.impl; + +import org.osoa.sca.annotations.Reference; +import org.osoa.sca.annotations.Service; + +import com.tuscanyscatours.notification.Notification; +import com.tuscanyscatours.smsgateway.SMSGateway; + +@Service(Notification.class) +public class NotificationImpl implements Notification { + + /** + * Use "Fake" phone number that has been reserved by Ofcom. + * See: http://www.ofcom.org.uk/telecoms/ioi/numbers/num_drama?a=87101 + */ + private static final String SCA_TOURS_SMS = "+44(0)2079460723"; + + @Reference + protected SMSGateway smsGateway; + + public boolean notify(String accountID, String subject, String message) { + + boolean result = true; + + String sms = getSMSAddress(accountID); + if (sms != null) { + System.out.println("Sending SMS to " + sms + " for accountID " + accountID); + result &= smsGateway.sendSMS(SCA_TOURS_SMS, sms, subject + ". " + message); + } + + return result; + } + + private String getSMSAddress(String accountID) { + // Use "Fake" phone number that has been reserved by Ofcom. + // See: http://www.ofcom.org.uk/telecoms/ioi/numbers/num_drama?a=87101 + return "+44(0)7700900812"; + } +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/notification/src/main/java/com/tuscanyscatours/smsgateway/SMSGateway.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/notification/src/main/java/com/tuscanyscatours/smsgateway/SMSGateway.java new file mode 100644 index 0000000000..fdf5872565 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/notification/src/main/java/com/tuscanyscatours/smsgateway/SMSGateway.java @@ -0,0 +1,30 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package com.tuscanyscatours.smsgateway; + +import org.osoa.sca.annotations.Remotable; + +/** + * A gateway to send SMS messages. + */ +@Remotable +public interface SMSGateway { + boolean sendSMS(String fromNumber, String toNumber, String text); +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/notification/src/main/resources/META-INF/sca-contribution.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/notification/src/main/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..518c7e363b --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/notification/src/main/resources/META-INF/sca-contribution.xml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0">
+ <export.java package="com.tuscanyscatours.notification" />
+ <export.java package="com.tuscanyscatours.notification.impl" />
+ <export.java package="com.tuscanyscatours.smsgateway" />
+</contribution>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-bpel-process/build.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-bpel-process/build.xml new file mode 100644 index 0000000000..5e2921995c --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-bpel-process/build.xml @@ -0,0 +1,23 @@ +<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<project name="scatours-contribution-payment-bpel-process" default="compile">
+ <import file="../../antdefs.xml"/>
+ <target name="wsdljava"/>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-bpel-process/pom.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-bpel-process/pom.xml new file mode 100644 index 0000000000..4bd900239c --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-bpel-process/pom.xml @@ -0,0 +1,47 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <version>1.0-SNAPSHOT</version>
+ <artifactId>scatours-contribution-payment-bpel-process</artifactId>
+ <name>Apache Tuscany SCA Tours Payment BPEL Process Contribution</name>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <version>2.2</version>
+ <configuration>
+ <excludes>
+ <exclude>**/*.cbp</exclude>
+ </excludes>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-bpel-process/src/main/resources/CreditCardPayment.wsdl b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-bpel-process/src/main/resources/CreditCardPayment.wsdl new file mode 100644 index 0000000000..22ef6de317 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-bpel-process/src/main/resources/CreditCardPayment.wsdl @@ -0,0 +1,117 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<wsdl:definitions name="CreditCardPayment" + targetNamespace="http://www.tuscanyscatours.com/CreditCardPayment/" + xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" + xmlns:tns="http://www.tuscanyscatours.com/CreditCardPayment/" + xmlns:xsd="http://www.w3.org/2001/XMLSchema" + xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" + xmlns:bpws="http://schemas.xmlsoap.org/ws/2004/03/business-process/" + xmlns:plnk="http://schemas.xmlsoap.org/ws/2004/03/partner-link/"> + <wsdl:types> + <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" + targetNamespace="http://www.tuscanyscatours.com/CreditCardPayment/" + xmlns:tns="http://www.tuscanyscatours.com/CreditCardPayment/" + elementFormDefault="unqualified"> + + <xsd:element name="authorize" type="tns:AuthorizeType"/> + <xsd:complexType name="AuthorizeType"> + <xsd:sequence> + <xsd:element name="CreditCard" type="tns:CreditCardDetailsType"></xsd:element> + <xsd:element name="Amount" type="xsd:float"></xsd:element> + </xsd:sequence> + </xsd:complexType> + + <xsd:element name="authorizeResponse" type="tns:AuthorizeResponseType"/> + <xsd:complexType name="AuthorizeResponseType"> + <xsd:sequence> + <xsd:element name="Status" type="xsd:string"></xsd:element> + </xsd:sequence> + </xsd:complexType> + + <xsd:complexType name="CreditCardDetailsType"> + <xsd:sequence> + <xsd:element name="CreditCardType" type="tns:CreditCardTypeType" minOccurs="0" /> + <xsd:element name="CreditCardNumber" type="xsd:string" minOccurs="0" /> + <xsd:element name="ExpMonth" type="xsd:int" minOccurs="0" /> + <xsd:element name="ExpYear" type="xsd:int" minOccurs="0" /> + <xsd:element name="CardOwner" type="tns:PayerType" minOccurs="0" /> + <xsd:element name="CVV2" type="xsd:string" minOccurs="0" /> + </xsd:sequence> + </xsd:complexType> + <xsd:simpleType name="CreditCardTypeType"> + <xsd:restriction base="xsd:token"> + <xsd:enumeration value="Visa" /> + <xsd:enumeration value="MasterCard" /> + <xsd:enumeration value="Discover" /> + <xsd:enumeration value="Amex" /> + </xsd:restriction> + </xsd:simpleType> + <xsd:complexType name="PayerType"> + <xsd:sequence> + <xsd:element name="Name" type="xsd:string" /> + <xsd:element name="Address" type="tns:AddressType" /> + </xsd:sequence> + </xsd:complexType> + <xsd:complexType name="AddressType"> + <xsd:sequence> + <xsd:element name="Street" type="xsd:string" /> + <xsd:element name="City" type="xsd:string" /> + <xsd:element name="State" type="xsd:string" /> + <xsd:element name="ZipCode" type="xsd:string" /> + <xsd:element name="HomePhone" type="xsd:string" /> + </xsd:sequence> + </xsd:complexType> + </xsd:schema> + </wsdl:types> + <wsdl:message name="AuthorizeRequest"> + <wsdl:part name="parameters" element="tns:authorize"></wsdl:part> + </wsdl:message> + <wsdl:message name="AuthorizeResponse"> + <wsdl:part name="parameters" element="tns:authorizeResponse"></wsdl:part> + </wsdl:message> + <wsdl:portType name="CreditCardPayment"> + <wsdl:operation name="authorize"> + <wsdl:input message="tns:AuthorizeRequest"></wsdl:input> + <wsdl:output message="tns:AuthorizeResponse"></wsdl:output> + </wsdl:operation> + </wsdl:portType> + <wsdl:binding name="CreditCardPaymentBinding" type="tns:CreditCardPayment"> + <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" /> + <wsdl:operation name="authorize"> + <soap:operation soapAction="http://www.tuscanyscatours.com/CreditCardPayment/authorize" /> + <wsdl:input> + <soap:body use="literal" /> + </wsdl:input> + <wsdl:output> + <soap:body use="literal" /> + </wsdl:output> + </wsdl:operation> + </wsdl:binding> + <wsdl:service name="CreditCardPaymentService"> + <wsdl:port name="CreditCardPaymentPort" binding="tns:CreditCardPaymentBinding"> + <soap:address location="http://localhost:8081/CreditCardPayment" /> + </wsdl:port> + </wsdl:service> + + <plnk:partnerLinkType name="CreditCardPaymentLinkType"> + <plnk:role name="forward" portType="tns:CreditCardPayment"/> + </plnk:partnerLinkType> +</wsdl:definitions>
\ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-bpel-process/src/main/resources/EmailGateway.wsdl b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-bpel-process/src/main/resources/EmailGateway.wsdl new file mode 100644 index 0000000000..a097d9b7e4 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-bpel-process/src/main/resources/EmailGateway.wsdl @@ -0,0 +1,89 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<wsdl:definitions name="EmailGateway" + targetNamespace="http://www.tuscanyscatours.com/EmailGateway/" + xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" + xmlns:tns="http://www.tuscanyscatours.com/EmailGateway/" + xmlns:xsd="http://www.w3.org/2001/XMLSchema" + xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" + xmlns:bpws="http://schemas.xmlsoap.org/ws/2004/03/business-process/" + xmlns:plnk="http://schemas.xmlsoap.org/ws/2004/03/partner-link/"> + <wsdl:types> + <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" + targetNamespace="http://www.tuscanyscatours.com/EmailGateway/" + xmlns:tns="http://www.tuscanyscatours.com/EmailGateway/"> + + <xsd:element name="sendEmail" type="tns:SendEmailType"/> + <xsd:complexType name="SendEmailType"> + <xsd:sequence> + <xsd:element name="Email" type="tns:EmailType"></xsd:element> + </xsd:sequence> + </xsd:complexType> + + <xsd:element name="sendEmailResponse" type="tns:SendEmailResponseType"/> + <xsd:complexType name="SendEmailResponseType"> + <xsd:sequence> + <xsd:element name="Status" type="xsd:string"></xsd:element> + </xsd:sequence> + </xsd:complexType> + + <xsd:complexType name="EmailType"> + <xsd:sequence> + <xsd:element name="To" type="xsd:string"/> + <xsd:element name="Title" type="xsd:string"/> + <xsd:element name="Body" type="xsd:string"/> + </xsd:sequence> + </xsd:complexType> + </xsd:schema> + </wsdl:types> + <wsdl:message name="SendEmailRequest"> + <wsdl:part name="parameters" element="tns:sendEmail"></wsdl:part> + </wsdl:message> + <wsdl:message name="SendEmailResponse"> + <wsdl:part name="parameters" element="tns:sendEmailResponse"></wsdl:part> + </wsdl:message> + <wsdl:portType name="EmailGateway"> + <wsdl:operation name="sendEmail"> + <wsdl:input message="tns:SendEmailRequest"></wsdl:input> + <wsdl:output message="tns:SendEmailResponse"></wsdl:output> + </wsdl:operation> + </wsdl:portType> + <wsdl:binding name="EmailGatwayBinding" type="tns:EmailGateway"> + <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" /> + <wsdl:operation name="sendEmail"> + <soap:operation soapAction="http://www.tuscanyscatours.com/EmailGateway/sendEmail" /> + <wsdl:input> + <soap:body use="literal" /> + </wsdl:input> + <wsdl:output> + <soap:body use="literal" /> + </wsdl:output> + </wsdl:operation> + </wsdl:binding> + <wsdl:service name="EmailGatewayService"> + <wsdl:port name="EmailGatewayPort" binding="tns:EmailGatwayBinding"> + <soap:address location="http://localhost:8082/EmailGateway" /> + </wsdl:port> + </wsdl:service> + + <plnk:partnerLinkType name="EmailGatewayLinkType"> + <plnk:role name="forward" portType="tns:EmailGateway"/> + </plnk:partnerLinkType> +</wsdl:definitions>
\ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-bpel-process/src/main/resources/META-INF/sca-contribution.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-bpel-process/src/main/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..f32584eee1 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-bpel-process/src/main/resources/META-INF/sca-contribution.xml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0">
+ <export namespace="http://www.tuscanyscatours.com/Payment"/>
+</contribution>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-bpel-process/src/main/resources/Payment.wsdl b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-bpel-process/src/main/resources/Payment.wsdl new file mode 100644 index 0000000000..e2c4062f2e --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-bpel-process/src/main/resources/Payment.wsdl @@ -0,0 +1,83 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<wsdl:definitions name="Payment" + targetNamespace="http://www.tuscanyscatours.com/Payment/" + xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" + xmlns:tns="http://www.tuscanyscatours.com/Payment/" + xmlns:xsd="http://www.w3.org/2001/XMLSchema" + xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" + xmlns:bpws="http://schemas.xmlsoap.org/ws/2004/03/business-process/" + xmlns:plnk="http://schemas.xmlsoap.org/ws/2004/03/partner-link/"> + <wsdl:types> + <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" + targetNamespace="http://www.tuscanyscatours.com/Payment/" + xmlns:tns="http://www.tuscanyscatours.com/Payment/"> + + <xsd:complexType name="MakePaymentMemberType"> + <xsd:sequence> + <xsd:element name="CustomerId" type="xsd:string"></xsd:element> + <xsd:element name="Amount" type="xsd:float"></xsd:element> + </xsd:sequence> + </xsd:complexType> + <xsd:element name="makePaymentMember" type="tns:MakePaymentMemberType"/> + + <xsd:complexType name="MakePaymentMemberResponseType"> + <xsd:sequence> + <xsd:element name="Status" type="xsd:string"></xsd:element> + </xsd:sequence> + </xsd:complexType> + <xsd:element name="makePaymentMemberResponse" type="tns:MakePaymentMemberResponseType"/> + + </xsd:schema> + </wsdl:types> + <wsdl:message name="MakePaymentMemberRequest"> + <wsdl:part name="parameters" element="tns:makePaymentMember"></wsdl:part> + </wsdl:message> + <wsdl:message name="MakePaymentMemberResponse"> + <wsdl:part name="parameters" element="tns:makePaymentMemberResponse"></wsdl:part> + </wsdl:message> + <wsdl:portType name="Payment"> + <wsdl:operation name="makePaymentMember"> + <wsdl:input message="tns:MakePaymentMemberRequest"></wsdl:input> + <wsdl:output message="tns:MakePaymentMemberResponse"></wsdl:output> + </wsdl:operation> + </wsdl:portType> + <wsdl:binding name="PaymentBinding" type="tns:Payment"> + <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" /> + <wsdl:operation name="makePaymentMember"> + <soap:operation soapAction="http://www.tuscanyscatours.com/Payment/makePayment" /> + <wsdl:input> + <soap:body use="literal" /> + </wsdl:input> + <wsdl:output> + <soap:body use="literal" /> + </wsdl:output> + </wsdl:operation> + </wsdl:binding> + <wsdl:service name="PaymentService"> + <wsdl:port name="PaymentPort" binding="tns:PaymentBinding"> + <soap:address location="http://localhost:8080/Payment" /> + </wsdl:port> + </wsdl:service> + + <plnk:partnerLinkType name="PaymentLinkType"> + <plnk:role name="forward" portType="tns:Payment"/> + </plnk:partnerLinkType> +</wsdl:definitions>
\ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-bpel-process/src/main/resources/payment.bpel b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-bpel-process/src/main/resources/payment.bpel new file mode 100644 index 0000000000..e304d3a349 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-bpel-process/src/main/resources/payment.bpel @@ -0,0 +1,161 @@ +<!-- + ~ Licensed to the Apache Software Foundation (ASF) under one + ~ or more contributor license agreements. See the NOTICE file + ~ distributed with this work for additional information + ~ regarding copyright ownership. The ASF licenses this file + ~ to you under the Apache License, Version 2.0 (the + ~ "License"); you may not use this file except in compliance + ~ with the License. You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, + ~ software distributed under the License is distributed on an + ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + ~ KIND, either express or implied. See the License for the + ~ specific language governing permissions and limitations + ~ under the License. + --> +<process name="Payment" + targetNamespace="http://www.tuscanyscatours.com/Payment" + xmlns="http://schemas.xmlsoap.org/ws/2004/03/business-process/"
+ xmlns:bpws="http://schemas.xmlsoap.org/ws/2004/03/business-process/" + xmlns:xsd="http://www.w3.org/2001/XMLSchema" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:pp="http://www.tuscanyscatours.com/Payment/" + xmlns:ccp="http://www.tuscanyscatours.com/CreditCardPayment/" + xmlns:eg="http://www.tuscanyscatours.com/EmailGateway/" + queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0" + expressionLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0"> + + <import location="Payment.wsdl" + importType="http://schemas.xmlsoap.org/wsdl/" + namespace="http://www.tuscanyscatours.com/Payment/"/> + + <import location="CreditCardPayment.wsdl" + importType="http://schemas.xmlsoap.org/wsdl/" + namespace="http://www.tuscanyscatours.com/CreditCardPayment/"/> + + <import location="EmailGateway.wsdl" + importType="http://schemas.xmlsoap.org/wsdl/" + namespace="http://www.tuscanyscatours.com/EmailGateway/"/> + + <partnerLinks> + <partnerLink name="paymentPartnerLink" partnerLinkType="pp:PaymentLinkType" myRole="forward" /> + <partnerLink name="creditCardPaymentPartnerLink" partnerLinkType="ccp:CreditCardPaymentLinkType" partnerRole="forward" initializePartnerRole="yes" /> + <partnerLink name="emailGatewayPartnerLink" partnerLinkType="eg:EmailGatewayLinkType" partnerRole="forward" initializePartnerRole="yes" /> + </partnerLinks> + + <variables> + <variable name="makePaymentMemberRequestMessage" messageType="pp:MakePaymentMemberRequest"/> + <variable name="makePaymentMemberResponseMessage" messageType="pp:MakePaymentMemberResponse"/> + <variable name="authorizeRequestMessage" messageType="ccp:AuthorizeRequest"/> + <variable name="authorizeResponseMessage" messageType="ccp:AuthorizeResponse"/> + <variable name="sendEmailRequestMessage" messageType="eg:SendEmailRequest"/> + <variable name="sendEmailResponseMessage" messageType="eg:SendEmailResponse"/> + </variables> + + <sequence> + <receive name="start" + partnerLink="paymentPartnerLink" + portType="pp:Payment" + operation="makePaymentMember" + variable="makePaymentMemberRequestMessage" + createInstance="yes"/> + + <!-- set up call to payments service --> + <assign name="assign1"> + <copy> + <from> + <literal> + <authorize xmlns="http://www.tuscanyscatours.com/CreditCardPayment/"> + <CreditCard xmlns=""> + <CreditCardType>Visa</CreditCardType> + <CreditCardNumber>12345678</CreditCardNumber> + <ExpMonth>2</ExpMonth> + <ExpYear>2010</ExpYear> + <CardOwner> + <Name>Empty</Name> + <Address> + <Street>1 The Road</Street> + <City>Winchester</City> + <State>Hampshire</State> + <ZipCode>AB1 2CD</ZipCode> + <HomePhone>12345678</HomePhone> + </Address> + </CardOwner> + </CreditCard> + <Amount xmlns="">0.0</Amount> + </authorize> + </literal> + </from> + <to>$authorizeRequestMessage.parameters</to> + </copy> + <copy> + <from>$makePaymentMemberRequestMessage.parameters/CustomerId/text()</from> + <to>$authorizeRequestMessage.parameters/CreditCard/CardOwner/Name</to> + </copy> + <copy> + <from>$makePaymentMemberRequestMessage.parameters/Amount/text()</from> + <to>$authorizeRequestMessage.parameters/Amount</to> + </copy> + </assign> + + <invoke name="invokeCreditCardPayment" + operation="authorize" + inputVariable="authorizeRequestMessage" + outputVariable="authorizeResponseMessage" + partnerLink="creditCardPaymentPartnerLink" + portType="ccp:CreditCardPayment" /> + + <!-- set up call to email gateway service --> + <assign name="assign2"> + <copy> + <from> + <literal> + <sendEmail xmlns="http://www.tuscanyscatours.com/EmailGateway/"> + <Email xmlns=""> + <To>Default</To> + <Title>Payment Confirmation</Title> + <Body>Your payment has been confirmed</Body> + </Email> + </sendEmail> + </literal> + </from> + <to>$sendEmailRequestMessage.parameters</to> + </copy> + <copy> + <from>$makePaymentMemberRequestMessage.parameters/CustomerId/text()</from> + <to>$sendEmailRequestMessage.parameters/Email/To</to> + </copy> + </assign> + + <!-- call the email gateway to send a confirmation --> + <invoke name="invokeEmailGateway" + operation="sendEmail" + inputVariable="sendEmailRequestMessage" + outputVariable="sendEmailResponseMessage" + partnerLink="emailGatewayPartnerLink" + portType="eg:EmailGateway" /> + + <!-- set up the response --> + <assign name="assign3"> + <copy keepSrcElementName="yes"> + <from> + <literal> + <Status xmlns="">OK</Status> + </literal> + </from> + <to>$makePaymentMemberResponseMessage.parameters</to> + </copy> + </assign> + + + <reply name="end" + partnerLink="paymentPartnerLink" + portType="pp:Payment" + operation="makePaymentMember" + variable="makePaymentMemberResponseMessage"> + </reply> + </sequence> +</process> diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-bpel/build.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-bpel/build.xml new file mode 100644 index 0000000000..29e317cf4d --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-bpel/build.xml @@ -0,0 +1,49 @@ +<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<project name="scatours-contribution-payment-bpel" default="compile">
+ <import file="../../antdefs.xml"/>
+
+ <target name="wsdljava">
+ <antcall target="wsimport">
+ <param name="wsdlfile" value="CreditCardPayment.wsdl"/>
+ <param name="javaclass" value="com/tuscanyscatours/payment/creditcard/CreditCardPayment.class"/>
+ <param name="package" value="com.tuscanyscatours.payment.creditcard"/>
+ </antcall>
+ <antcall target="wsimport">
+ <param name="wsdlfile" value="EmailGateway.wsdl"/>
+ <param name="javaclass" value="com/tuscanyscatours/emailgateway/EmailGateway.class"/>
+ <param name="package" value="com.tuscanyscatours.emailgateway"/>
+ </antcall>
+ <antcall target="wsimport">
+ <param name="wsdlfile" value="Payment.wsdl"/>
+ <param name="javaclass" value="com/tuscanyscatours/payment/Payment.class"/>
+ <param name="package" value="com.tuscanyscatours.payment"/>
+ </antcall>
+ </target>
+
+ <property name="test-setup" value="yes"/>
+ <target name="testsetup">
+ <unzip dest="target/test-classes">
+ <fileset dir="${env.TUSCANY_HOME}/lib">
+ <include name="ode-dao-jpa-ojpa-derby-*.zip"/>
+ </fileset>
+ </unzip>
+ </target>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-bpel/log4j.properties b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-bpel/log4j.properties new file mode 100644 index 0000000000..7ed0bcaf77 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-bpel/log4j.properties @@ -0,0 +1,36 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# Set root logger level to WARN and its only appender to CONSOLE +log4j.rootLogger=OFF, CONSOLE + +# log4j properties to work with commandline tools. +log4j.category.org.mortbay=OFF +log4j.category.org.hibernate.type=OFF +log4j.category.org.objectweb=OFF +log4j.category.org.apache.ode.axis2=OFF +log4j.category.org.apache.ode.bpel.engine=DEBUG +log4j.category.org.apache.ode.daohib.bpel.CorrelatorDaoImpl=OFF +log4j.category.org.apache.ode.bpel.epr=OFF +log4j.category.org.apache.tuscany.sca.implementation.bpel=DEBUG +log4j.category.org.apache.tuscany.sca.implementation.bpel.ode=DEBUG +log4j.category.org.apache.tuscany.sca.implementation.bpel.provider=DEBUG + +# Console appender +log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender +log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout +log4j.appender.CONSOLE.layout.ConversionPattern=[%p] - %C{1}.%M(%L) | %m%n diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-bpel/pom.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-bpel/pom.xml new file mode 100644 index 0000000000..5ac4da779c --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-bpel/pom.xml @@ -0,0 +1,215 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<project> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>scatours</artifactId> + <version>1.0-SNAPSHOT</version> + <relativePath>../../pom.xml</relativePath> + </parent> + <version>1.0-SNAPSHOT</version> + <artifactId>scatours-contribution-payment-bpel</artifactId> + <name>Apache Tuscany SCA Tours Payment BPEL Contribution</name> + + <dependencies> + <dependency> + <groupId>javax.xml.bind</groupId> + <artifactId>jaxb-api</artifactId> + <version>2.1</version> + </dependency> + + <dependency> + <groupId>javax.xml.ws</groupId> + <artifactId>jaxws-api</artifactId> + <version>2.1</version> + <exclusions> + <exclusion> + <groupId>javax.xml.soap</groupId> + <artifactId>saaj-api</artifactId> + </exclusion> + </exclusions> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-implementation-java-runtime</artifactId> + <version>${tuscany.version}</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-implementation-bpel-ode</artifactId> + <version>${tuscany.version}</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-binding-ws-axis2</artifactId> + <version>${tuscany.version}</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-host-jetty</artifactId> + <version>${tuscany.version}</version> + <scope>test</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-node-impl</artifactId> + <version>${tuscany.version}</version> + <scope>test</scope> + </dependency> + + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>4.5</version> + <scope>test</scope> + </dependency> + + </dependencies> + <build> + <finalName>${artifactId}</finalName> + <plugins> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>build-helper-maven-plugin</artifactId> + <version>1.0</version> + <executions> + <execution> + <id>add-source</id> + <phase>generate-sources</phase> + <goals> + <goal>add-source</goal> + </goals> + <configuration> + <sources> + <source>target/jaxws-source</source> + </sources> + </configuration> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>jaxws-maven-plugin</artifactId> + <version>1.12</version> + <executions> + <execution> + <id>wsimport</id> + <phase>generate-sources</phase> + <goals> + <goal>wsimport</goal> + </goals> + <configuration> + <packageName>com.tuscanyscatours.payment</packageName> + <wsdlDirectory>${basedir}/src/main/resources</wsdlDirectory> + <wsdlFiles> + <wsdlFile>Payment.wsdl</wsdlFile> + </wsdlFiles> + <sourceDestDir>${project.build.directory}/jaxws-source</sourceDestDir> + <staleFile>${project.build.directory}/jaxws-source/stale/payment.stale</staleFile> + <verbose>false</verbose> + <xnocompile>true</xnocompile> + </configuration> + </execution> + <execution> + <id>payment.creditcard</id> + <phase>process-sources</phase> + <goals> + <goal>wsimport</goal> + </goals> + <configuration> + <packageName>com.tuscanyscatours.payment.creditcard</packageName> + <wsdlDirectory>${basedir}/src/main/resources</wsdlDirectory> + <wsdlFiles> + <wsdlFile>CreditCardPayment.wsdl</wsdlFile> + </wsdlFiles> + <sourceDestDir>${project.build.directory}/jaxws-source</sourceDestDir> + <staleFile>${project.build.directory}/jaxws-source/stale/creditcard.stale</staleFile> + <verbose>false</verbose> + <xnocompile>true</xnocompile> + </configuration> + </execution> + <execution> + <id>emailgateway</id> + <phase>process-sources</phase> + <goals> + <goal>wsimport</goal> + </goals> + <configuration> + <packageName>com.tuscanyscatours.emailgateway</packageName> + <wsdlDirectory>${basedir}/src/main/resources</wsdlDirectory> + <wsdlFiles> + <wsdlFile>EmailGateway.wsdl</wsdlFile> + </wsdlFiles> + <sourceDestDir>${project.build.directory}/jaxws-source</sourceDestDir> + <staleFile>${project.build.directory}/jaxws-source/stale/emailgateway.stale</staleFile> + <verbose>false</verbose> + <xnocompile>true</xnocompile> + </configuration> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-surefire-plugin</artifactId> + <!-- http://jira.codehaus.org/browse/SUREFIRE-322 --> + <version>2.3.1</version> + <configuration> + <useFile>false</useFile> + <trimStackTrace>false</trimStackTrace> + <useSystemClassLoader>true</useSystemClassLoader> + </configuration> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-dependency-plugin</artifactId> + <executions> + <execution> + <id>unpack</id> + <phase>test-compile</phase> + <goals> + <goal>unpack</goal> + </goals> + <configuration> + <artifactItems> + <artifactItem> + <groupId>org.apache.ode</groupId> + <artifactId>ode-dao-jpa-ojpa-derby</artifactId> + <version>1.1.1</version> + <type>zip</type> + <overWrite>true</overWrite> + <outputDirectory>${project.build.directory}/test-classes/</outputDirectory> + </artifactItem> + </artifactItems> + </configuration> + </execution> + </executions> + </plugin> + </plugins> + </build> +</project> diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-bpel/src/main/resources/CreditCardPayment.wsdl b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-bpel/src/main/resources/CreditCardPayment.wsdl new file mode 100644 index 0000000000..22ef6de317 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-bpel/src/main/resources/CreditCardPayment.wsdl @@ -0,0 +1,117 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<wsdl:definitions name="CreditCardPayment" + targetNamespace="http://www.tuscanyscatours.com/CreditCardPayment/" + xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" + xmlns:tns="http://www.tuscanyscatours.com/CreditCardPayment/" + xmlns:xsd="http://www.w3.org/2001/XMLSchema" + xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" + xmlns:bpws="http://schemas.xmlsoap.org/ws/2004/03/business-process/" + xmlns:plnk="http://schemas.xmlsoap.org/ws/2004/03/partner-link/"> + <wsdl:types> + <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" + targetNamespace="http://www.tuscanyscatours.com/CreditCardPayment/" + xmlns:tns="http://www.tuscanyscatours.com/CreditCardPayment/" + elementFormDefault="unqualified"> + + <xsd:element name="authorize" type="tns:AuthorizeType"/> + <xsd:complexType name="AuthorizeType"> + <xsd:sequence> + <xsd:element name="CreditCard" type="tns:CreditCardDetailsType"></xsd:element> + <xsd:element name="Amount" type="xsd:float"></xsd:element> + </xsd:sequence> + </xsd:complexType> + + <xsd:element name="authorizeResponse" type="tns:AuthorizeResponseType"/> + <xsd:complexType name="AuthorizeResponseType"> + <xsd:sequence> + <xsd:element name="Status" type="xsd:string"></xsd:element> + </xsd:sequence> + </xsd:complexType> + + <xsd:complexType name="CreditCardDetailsType"> + <xsd:sequence> + <xsd:element name="CreditCardType" type="tns:CreditCardTypeType" minOccurs="0" /> + <xsd:element name="CreditCardNumber" type="xsd:string" minOccurs="0" /> + <xsd:element name="ExpMonth" type="xsd:int" minOccurs="0" /> + <xsd:element name="ExpYear" type="xsd:int" minOccurs="0" /> + <xsd:element name="CardOwner" type="tns:PayerType" minOccurs="0" /> + <xsd:element name="CVV2" type="xsd:string" minOccurs="0" /> + </xsd:sequence> + </xsd:complexType> + <xsd:simpleType name="CreditCardTypeType"> + <xsd:restriction base="xsd:token"> + <xsd:enumeration value="Visa" /> + <xsd:enumeration value="MasterCard" /> + <xsd:enumeration value="Discover" /> + <xsd:enumeration value="Amex" /> + </xsd:restriction> + </xsd:simpleType> + <xsd:complexType name="PayerType"> + <xsd:sequence> + <xsd:element name="Name" type="xsd:string" /> + <xsd:element name="Address" type="tns:AddressType" /> + </xsd:sequence> + </xsd:complexType> + <xsd:complexType name="AddressType"> + <xsd:sequence> + <xsd:element name="Street" type="xsd:string" /> + <xsd:element name="City" type="xsd:string" /> + <xsd:element name="State" type="xsd:string" /> + <xsd:element name="ZipCode" type="xsd:string" /> + <xsd:element name="HomePhone" type="xsd:string" /> + </xsd:sequence> + </xsd:complexType> + </xsd:schema> + </wsdl:types> + <wsdl:message name="AuthorizeRequest"> + <wsdl:part name="parameters" element="tns:authorize"></wsdl:part> + </wsdl:message> + <wsdl:message name="AuthorizeResponse"> + <wsdl:part name="parameters" element="tns:authorizeResponse"></wsdl:part> + </wsdl:message> + <wsdl:portType name="CreditCardPayment"> + <wsdl:operation name="authorize"> + <wsdl:input message="tns:AuthorizeRequest"></wsdl:input> + <wsdl:output message="tns:AuthorizeResponse"></wsdl:output> + </wsdl:operation> + </wsdl:portType> + <wsdl:binding name="CreditCardPaymentBinding" type="tns:CreditCardPayment"> + <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" /> + <wsdl:operation name="authorize"> + <soap:operation soapAction="http://www.tuscanyscatours.com/CreditCardPayment/authorize" /> + <wsdl:input> + <soap:body use="literal" /> + </wsdl:input> + <wsdl:output> + <soap:body use="literal" /> + </wsdl:output> + </wsdl:operation> + </wsdl:binding> + <wsdl:service name="CreditCardPaymentService"> + <wsdl:port name="CreditCardPaymentPort" binding="tns:CreditCardPaymentBinding"> + <soap:address location="http://localhost:8081/CreditCardPayment" /> + </wsdl:port> + </wsdl:service> + + <plnk:partnerLinkType name="CreditCardPaymentLinkType"> + <plnk:role name="forward" portType="tns:CreditCardPayment"/> + </plnk:partnerLinkType> +</wsdl:definitions>
\ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-bpel/src/main/resources/EmailGateway.wsdl b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-bpel/src/main/resources/EmailGateway.wsdl new file mode 100644 index 0000000000..a097d9b7e4 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-bpel/src/main/resources/EmailGateway.wsdl @@ -0,0 +1,89 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<wsdl:definitions name="EmailGateway" + targetNamespace="http://www.tuscanyscatours.com/EmailGateway/" + xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" + xmlns:tns="http://www.tuscanyscatours.com/EmailGateway/" + xmlns:xsd="http://www.w3.org/2001/XMLSchema" + xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" + xmlns:bpws="http://schemas.xmlsoap.org/ws/2004/03/business-process/" + xmlns:plnk="http://schemas.xmlsoap.org/ws/2004/03/partner-link/"> + <wsdl:types> + <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" + targetNamespace="http://www.tuscanyscatours.com/EmailGateway/" + xmlns:tns="http://www.tuscanyscatours.com/EmailGateway/"> + + <xsd:element name="sendEmail" type="tns:SendEmailType"/> + <xsd:complexType name="SendEmailType"> + <xsd:sequence> + <xsd:element name="Email" type="tns:EmailType"></xsd:element> + </xsd:sequence> + </xsd:complexType> + + <xsd:element name="sendEmailResponse" type="tns:SendEmailResponseType"/> + <xsd:complexType name="SendEmailResponseType"> + <xsd:sequence> + <xsd:element name="Status" type="xsd:string"></xsd:element> + </xsd:sequence> + </xsd:complexType> + + <xsd:complexType name="EmailType"> + <xsd:sequence> + <xsd:element name="To" type="xsd:string"/> + <xsd:element name="Title" type="xsd:string"/> + <xsd:element name="Body" type="xsd:string"/> + </xsd:sequence> + </xsd:complexType> + </xsd:schema> + </wsdl:types> + <wsdl:message name="SendEmailRequest"> + <wsdl:part name="parameters" element="tns:sendEmail"></wsdl:part> + </wsdl:message> + <wsdl:message name="SendEmailResponse"> + <wsdl:part name="parameters" element="tns:sendEmailResponse"></wsdl:part> + </wsdl:message> + <wsdl:portType name="EmailGateway"> + <wsdl:operation name="sendEmail"> + <wsdl:input message="tns:SendEmailRequest"></wsdl:input> + <wsdl:output message="tns:SendEmailResponse"></wsdl:output> + </wsdl:operation> + </wsdl:portType> + <wsdl:binding name="EmailGatwayBinding" type="tns:EmailGateway"> + <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" /> + <wsdl:operation name="sendEmail"> + <soap:operation soapAction="http://www.tuscanyscatours.com/EmailGateway/sendEmail" /> + <wsdl:input> + <soap:body use="literal" /> + </wsdl:input> + <wsdl:output> + <soap:body use="literal" /> + </wsdl:output> + </wsdl:operation> + </wsdl:binding> + <wsdl:service name="EmailGatewayService"> + <wsdl:port name="EmailGatewayPort" binding="tns:EmailGatwayBinding"> + <soap:address location="http://localhost:8082/EmailGateway" /> + </wsdl:port> + </wsdl:service> + + <plnk:partnerLinkType name="EmailGatewayLinkType"> + <plnk:role name="forward" portType="tns:EmailGateway"/> + </plnk:partnerLinkType> +</wsdl:definitions>
\ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-bpel/src/main/resources/META-INF/sca-contribution.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-bpel/src/main/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..e95a8bf0a3 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-bpel/src/main/resources/META-INF/sca-contribution.xml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0" + xmlns:pp="http://www.tuscanyscatours.com/Payment"> + <import namespace="http://www.tuscanyscatours.com/Payment"/> + <deployable composite="pp:payment"/> +</contribution> diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-bpel/src/main/resources/Payment.wsdl b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-bpel/src/main/resources/Payment.wsdl new file mode 100644 index 0000000000..e2c4062f2e --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-bpel/src/main/resources/Payment.wsdl @@ -0,0 +1,83 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<wsdl:definitions name="Payment" + targetNamespace="http://www.tuscanyscatours.com/Payment/" + xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" + xmlns:tns="http://www.tuscanyscatours.com/Payment/" + xmlns:xsd="http://www.w3.org/2001/XMLSchema" + xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" + xmlns:bpws="http://schemas.xmlsoap.org/ws/2004/03/business-process/" + xmlns:plnk="http://schemas.xmlsoap.org/ws/2004/03/partner-link/"> + <wsdl:types> + <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" + targetNamespace="http://www.tuscanyscatours.com/Payment/" + xmlns:tns="http://www.tuscanyscatours.com/Payment/"> + + <xsd:complexType name="MakePaymentMemberType"> + <xsd:sequence> + <xsd:element name="CustomerId" type="xsd:string"></xsd:element> + <xsd:element name="Amount" type="xsd:float"></xsd:element> + </xsd:sequence> + </xsd:complexType> + <xsd:element name="makePaymentMember" type="tns:MakePaymentMemberType"/> + + <xsd:complexType name="MakePaymentMemberResponseType"> + <xsd:sequence> + <xsd:element name="Status" type="xsd:string"></xsd:element> + </xsd:sequence> + </xsd:complexType> + <xsd:element name="makePaymentMemberResponse" type="tns:MakePaymentMemberResponseType"/> + + </xsd:schema> + </wsdl:types> + <wsdl:message name="MakePaymentMemberRequest"> + <wsdl:part name="parameters" element="tns:makePaymentMember"></wsdl:part> + </wsdl:message> + <wsdl:message name="MakePaymentMemberResponse"> + <wsdl:part name="parameters" element="tns:makePaymentMemberResponse"></wsdl:part> + </wsdl:message> + <wsdl:portType name="Payment"> + <wsdl:operation name="makePaymentMember"> + <wsdl:input message="tns:MakePaymentMemberRequest"></wsdl:input> + <wsdl:output message="tns:MakePaymentMemberResponse"></wsdl:output> + </wsdl:operation> + </wsdl:portType> + <wsdl:binding name="PaymentBinding" type="tns:Payment"> + <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" /> + <wsdl:operation name="makePaymentMember"> + <soap:operation soapAction="http://www.tuscanyscatours.com/Payment/makePayment" /> + <wsdl:input> + <soap:body use="literal" /> + </wsdl:input> + <wsdl:output> + <soap:body use="literal" /> + </wsdl:output> + </wsdl:operation> + </wsdl:binding> + <wsdl:service name="PaymentService"> + <wsdl:port name="PaymentPort" binding="tns:PaymentBinding"> + <soap:address location="http://localhost:8080/Payment" /> + </wsdl:port> + </wsdl:service> + + <plnk:partnerLinkType name="PaymentLinkType"> + <plnk:role name="forward" portType="tns:Payment"/> + </plnk:partnerLinkType> +</wsdl:definitions>
\ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-bpel/src/main/resources/payment.composite b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-bpel/src/main/resources/payment.composite new file mode 100644 index 0000000000..5c337799a7 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-bpel/src/main/resources/payment.composite @@ -0,0 +1,40 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" + xmlns:t="http://tuscany.apache.org/xmlns/sca/1.0" + xmlns:pp="http://www.tuscanyscatours.com/Payment" + targetNamespace="http://www.tuscanyscatours.com/Payment" + name="payment"> + + <component name="Payment"> + <implementation.bpel process="pp:Payment"/> + <service name="paymentPartnerLink"> + <interface.wsdl interface="http://www.tuscanyscatours.com/Payment/#wsdl.interface(Payment)" /> + <binding.ws uri="http://localhost:8080/Payment" wsdlElement="http://www.tuscanyscatours.com/Payment/#wsdl.service(PaymentService)"/> + </service> + <reference name="creditCardPaymentPartnerLink"> + <binding.ws uri="http://localhost:8082/CreditCardPayment"/> + </reference> + <reference name="emailGatewayPartnerLink"> + <binding.ws uri="http://localhost:8088/EmailGateway"/> + </reference> + </component> + +</composite>
\ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-bpel/src/test/java/scatours/payment/PaymentTestCase.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-bpel/src/test/java/scatours/payment/PaymentTestCase.java new file mode 100644 index 0000000000..6db4934edf --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-bpel/src/test/java/scatours/payment/PaymentTestCase.java @@ -0,0 +1,87 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package scatours.payment; + +import org.apache.tuscany.sca.node.SCAClient; +import org.apache.tuscany.sca.node.SCAContribution; +import org.apache.tuscany.sca.node.SCANode; +import org.apache.tuscany.sca.node.SCANodeFactory; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +import com.tuscanyscatours.payment.Payment; + +/** + * + */ +public class PaymentTestCase { + private static SCANode paymentNode; + private static SCANode creditCardNode; + private static SCANode emailGatewayNode; + + @BeforeClass + public static void setUpBeforeClass() throws Exception { + creditCardNode = + SCANodeFactory.newInstance() + .createSCANode("creditcard.composite", + new SCAContribution("creditcard", "../creditcard-payment-jaxb/target/classes")); + + creditCardNode.start(); + + emailGatewayNode = + SCANodeFactory.newInstance().createSCANode("emailgateway.composite", + new SCAContribution("emailgateway", + "../emailgateway/target/classes"), + new SCAContribution("emailgateway-test", + "../emailgateway/target/test-classes")); + + emailGatewayNode.start(); + + paymentNode = + SCANodeFactory.newInstance() + .createSCANode(null, + new SCAContribution("payment-bpel-process", + "../payment-bpel-process/target/classes"), + new SCAContribution("payment-bpel", "./target/classes"), + new SCAContribution("payment-bpel-test", "./target/test-classes")); + + paymentNode.start(); + } + + @Test + public void testPayment() { + SCAClient client = (SCAClient)paymentNode; + Payment payment = client.getService(Payment.class, "PaymentClient"); + String result = payment.makePaymentMember("Fred", 100.00f); + System.out.println("Result = " + result); + if (!"OK".equals(result)) { + throw new RuntimeException(result); + } + } + + @AfterClass + public static void tearDownAfterClass() throws Exception { + paymentNode.stop(); + creditCardNode.stop(); + emailGatewayNode.stop(); + } + +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-bpel/src/test/java/scatours/payment/client/impl/PaymentClientImpl.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-bpel/src/test/java/scatours/payment/client/impl/PaymentClientImpl.java new file mode 100644 index 0000000000..a38ba51ac5 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-bpel/src/test/java/scatours/payment/client/impl/PaymentClientImpl.java @@ -0,0 +1,37 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package scatours.payment.client.impl;
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+import com.tuscanyscatours.payment.Payment;
+
+@Service(Payment.class)
+public class PaymentClientImpl implements Payment {
+ @Reference
+ protected Payment payment;
+
+ public String makePaymentMember(String customerId, float amount) {
+ // Delegate the external web service
+ return payment.makePaymentMember(customerId, amount);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-bpel/src/test/resources/META-INF/sca-contribution.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-bpel/src/test/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..fcfc2d7c61 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-bpel/src/test/resources/META-INF/sca-contribution.xml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0" + xmlns:pp="http://www.tuscanyscatours.com/Payment"> + <import.java package="com.tuscanyscatours.payment" /> + <deployable composite="pp:paymentClient" /> +</contribution> diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-bpel/src/test/resources/payment-client.composite b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-bpel/src/test/resources/payment-client.composite new file mode 100644 index 0000000000..a5110aacff --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-bpel/src/test/resources/payment-client.composite @@ -0,0 +1,33 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" + xmlns:t="http://tuscany.apache.org/xmlns/sca/1.0" + xmlns:pp="http://www.tuscanyscatours.com/Payment" + targetNamespace="http://www.tuscanyscatours.com/Payment" + name="paymentClient"> + + <component name="PaymentClient"> + <implementation.java class="scatours.payment.client.impl.PaymentClientImpl" /> + <reference name="payment"> + <binding.ws uri="http://localhost:8080/Payment" /> + </reference> + </component> + +</composite>
\ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-groovy/build.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-groovy/build.xml new file mode 100644 index 0000000000..3a86952fc1 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-groovy/build.xml @@ -0,0 +1,40 @@ +<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<project name="scatours-contribution-payment-groovy" default="compile">
+ <import file="../../antdefs.xml"/>
+
+ <target name="wsdljava">
+ <antcall target="wsimport">
+ <param name="wsdlfile" value="CreditCardPayment.wsdl"/>
+ <param name="javaclass" value="com/tuscanyscatours/payment/creditcard/CreditCardPayment.class"/>
+ <param name="package" value="com.tuscanyscatours.payment.creditcard"/>
+ </antcall>
+ <antcall target="wsimport">
+ <param name="wsdlfile" value="EmailGateway.wsdl"/>
+ <param name="javaclass" value="com/tuscanyscatours/emailgateway/EmailGateway.class"/>
+ <param name="package" value="com.tuscanyscatours.emailgateway"/>
+ </antcall>
+ <antcall target="wsimport">
+ <param name="wsdlfile" value="Payment.wsdl"/>
+ <param name="javaclass" value="com/tuscanyscatours/payment/Payment.class"/>
+ <param name="package" value="com.tuscanyscatours.payment"/>
+ </antcall>
+ </target>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-groovy/pom.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-groovy/pom.xml new file mode 100644 index 0000000000..523e1a8c24 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-groovy/pom.xml @@ -0,0 +1,162 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<project> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>scatours</artifactId> + <version>1.0-SNAPSHOT</version> + <relativePath>../../pom.xml</relativePath> + </parent> + <version>1.0-SNAPSHOT</version> + <artifactId>scatours-contribution-payment-groovy</artifactId> + <name>Apache Tuscany SCA Tours Payment Groovy Contribution</name> + + <dependencies> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-implementation-script</artifactId> + <version>${tuscany.version}</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-binding-ws-axis2</artifactId> + <version>${tuscany.version}</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-implementation-java-runtime</artifactId> + <version>${tuscany.version}</version> + <scope>test</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-host-jetty</artifactId> + <version>${tuscany.version}</version> + <scope>test</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-node-impl</artifactId> + <version>${tuscany.version}</version> + <scope>test</scope> + </dependency> + + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>4.5</version> + <scope>test</scope> + </dependency> + + </dependencies> + <build> + <finalName>${artifactId}</finalName> + <plugins> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>build-helper-maven-plugin</artifactId> + <version>1.0</version> + <executions> + <execution> + <id>add-source</id> + <phase>generate-sources</phase> + <goals> + <goal>add-source</goal> + </goals> + <configuration> + <sources> + <source>target/jaxws-source</source> + </sources> + </configuration> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>jaxws-maven-plugin</artifactId> + <version>1.12</version> + <executions> + <execution> + <id>payment</id> + <phase>generate-sources</phase> + <goals> + <goal>wsimport</goal> + </goals> + <configuration> + <packageName>com.tuscanyscatours.payment</packageName> + <wsdlDirectory>${basedir}/src/main/resources</wsdlDirectory> + <wsdlFiles> + <wsdlFile>Payment.wsdl</wsdlFile> + </wsdlFiles> + <sourceDestDir>${project.build.directory}/jaxws-source</sourceDestDir> + <staleFile>${project.build.directory}/jaxws-source/stale/payment.stale</staleFile> + <verbose>false</verbose> + <xnocompile>true</xnocompile> + </configuration> + </execution> + <execution> + <id>payment.creditcard</id> + <phase>process-sources</phase> + <goals> + <goal>wsimport</goal> + </goals> + <configuration> + <packageName>com.tuscanyscatours.payment.creditcard</packageName> + <wsdlDirectory>${basedir}/src/main/resources</wsdlDirectory> + <wsdlFiles> + <wsdlFile>CreditCardPayment.wsdl</wsdlFile> + </wsdlFiles> + <sourceDestDir>${project.build.directory}/jaxws-source</sourceDestDir> + <staleFile>${project.build.directory}/jaxws-source/stale/creditcard.stale</staleFile> + <verbose>false</verbose> + <xnocompile>true</xnocompile> + </configuration> + </execution> + <execution> + <id>emailgateway</id> + <phase>process-sources</phase> + <goals> + <goal>wsimport</goal> + </goals> + <configuration> + <packageName>com.tuscanyscatours.emailgateway</packageName> + <wsdlDirectory>${basedir}/src/main/resources</wsdlDirectory> + <wsdlFiles> + <wsdlFile>EmailGateway.wsdl</wsdlFile> + </wsdlFiles> + <sourceDestDir>${project.build.directory}/jaxws-source</sourceDestDir> + <staleFile>${project.build.directory}/jaxws-source/stale/emailgateway.stale</staleFile> + <verbose>false</verbose> + <xnocompile>true</xnocompile> + </configuration> + </execution> + </executions> + </plugin> + </plugins> + </build> +</project> diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-groovy/src/main/resources/CreditCardPayment.wsdl b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-groovy/src/main/resources/CreditCardPayment.wsdl new file mode 100644 index 0000000000..1813c77436 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-groovy/src/main/resources/CreditCardPayment.wsdl @@ -0,0 +1,116 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<wsdl:definitions name="CreditCardPayment" + targetNamespace="http://www.tuscanyscatours.com/CreditCardPayment/" + xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" + xmlns:tns="http://www.tuscanyscatours.com/CreditCardPayment/" + xmlns:xsd="http://www.w3.org/2001/XMLSchema" + xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" + xmlns:bpws="http://schemas.xmlsoap.org/ws/2004/03/business-process/" + xmlns:plnk="http://schemas.xmlsoap.org/ws/2004/03/partner-link/"> + <wsdl:types> + <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" + targetNamespace="http://www.tuscanyscatours.com/CreditCardPayment/" + xmlns:tns="http://www.tuscanyscatours.com/CreditCardPayment/"> + + <xsd:element name="authorize" type="tns:AuthorizeType"/> + <xsd:complexType name="AuthorizeType"> + <xsd:sequence> + <xsd:element name="CreditCard" type="tns:CreditCardDetailsType"></xsd:element> + <xsd:element name="Amount" type="xsd:float"></xsd:element> + </xsd:sequence> + </xsd:complexType> + + <xsd:element name="authorizeResponse" type="tns:AuthorizeResponseType"/> + <xsd:complexType name="AuthorizeResponseType"> + <xsd:sequence> + <xsd:element name="Status" type="xsd:string"></xsd:element> + </xsd:sequence> + </xsd:complexType> + + <xsd:complexType name="CreditCardDetailsType"> + <xsd:sequence> + <xsd:element name="CreditCardType" type="tns:CreditCardTypeType" minOccurs="0" /> + <xsd:element name="CreditCardNumber" type="xsd:string" minOccurs="0" /> + <xsd:element name="ExpMonth" type="xsd:int" minOccurs="0" /> + <xsd:element name="ExpYear" type="xsd:int" minOccurs="0" /> + <xsd:element name="CardOwner" type="tns:PayerType" minOccurs="0" /> + <xsd:element name="CVV2" type="xsd:string" minOccurs="0" /> + </xsd:sequence> + </xsd:complexType> + <xsd:simpleType name="CreditCardTypeType"> + <xsd:restriction base="xsd:token"> + <xsd:enumeration value="Visa" /> + <xsd:enumeration value="MasterCard" /> + <xsd:enumeration value="Discover" /> + <xsd:enumeration value="Amex" /> + </xsd:restriction> + </xsd:simpleType> + <xsd:complexType name="PayerType"> + <xsd:sequence> + <xsd:element name="Name" type="xsd:string" /> + <xsd:element name="Address" type="tns:AddressType" /> + </xsd:sequence> + </xsd:complexType> + <xsd:complexType name="AddressType"> + <xsd:sequence> + <xsd:element name="Street" type="xsd:string" /> + <xsd:element name="City" type="xsd:string" /> + <xsd:element name="State" type="xsd:string" /> + <xsd:element name="ZipCode" type="xsd:string" /> + <xsd:element name="HomePhone" type="xsd:string" /> + </xsd:sequence> + </xsd:complexType> + </xsd:schema> + </wsdl:types> + <wsdl:message name="AuthorizeRequest"> + <wsdl:part name="parameters" element="tns:authorize"></wsdl:part> + </wsdl:message> + <wsdl:message name="AuthorizeResponse"> + <wsdl:part name="parameters" element="tns:authorizeResponse"></wsdl:part> + </wsdl:message> + <wsdl:portType name="CreditCardPayment"> + <wsdl:operation name="authorize"> + <wsdl:input message="tns:AuthorizeRequest"></wsdl:input> + <wsdl:output message="tns:AuthorizeResponse"></wsdl:output> + </wsdl:operation> + </wsdl:portType> + <wsdl:binding name="CreditCardPaymentBinding" type="tns:CreditCardPayment"> + <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" /> + <wsdl:operation name="authorize"> + <soap:operation soapAction="http://www.tuscanyscatours.com/CreditCardPayment/authorize" /> + <wsdl:input> + <soap:body use="literal" /> + </wsdl:input> + <wsdl:output> + <soap:body use="literal" /> + </wsdl:output> + </wsdl:operation> + </wsdl:binding> + <wsdl:service name="CreditCardPaymentService"> + <wsdl:port name="CreditCardPaymentPort" binding="tns:CreditCardPaymentBinding"> + <soap:address location="http://localhost:8080/CreditCardPayment" /> + </wsdl:port> + </wsdl:service> + + <plnk:partnerLinkType name="CreditCardPaymentLinkType"> + <plnk:role name="forward" portType="tns:CreditCardPayment"/> + </plnk:partnerLinkType> +</wsdl:definitions>
\ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-groovy/src/main/resources/EmailGateway.wsdl b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-groovy/src/main/resources/EmailGateway.wsdl new file mode 100644 index 0000000000..a097d9b7e4 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-groovy/src/main/resources/EmailGateway.wsdl @@ -0,0 +1,89 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<wsdl:definitions name="EmailGateway" + targetNamespace="http://www.tuscanyscatours.com/EmailGateway/" + xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" + xmlns:tns="http://www.tuscanyscatours.com/EmailGateway/" + xmlns:xsd="http://www.w3.org/2001/XMLSchema" + xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" + xmlns:bpws="http://schemas.xmlsoap.org/ws/2004/03/business-process/" + xmlns:plnk="http://schemas.xmlsoap.org/ws/2004/03/partner-link/"> + <wsdl:types> + <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" + targetNamespace="http://www.tuscanyscatours.com/EmailGateway/" + xmlns:tns="http://www.tuscanyscatours.com/EmailGateway/"> + + <xsd:element name="sendEmail" type="tns:SendEmailType"/> + <xsd:complexType name="SendEmailType"> + <xsd:sequence> + <xsd:element name="Email" type="tns:EmailType"></xsd:element> + </xsd:sequence> + </xsd:complexType> + + <xsd:element name="sendEmailResponse" type="tns:SendEmailResponseType"/> + <xsd:complexType name="SendEmailResponseType"> + <xsd:sequence> + <xsd:element name="Status" type="xsd:string"></xsd:element> + </xsd:sequence> + </xsd:complexType> + + <xsd:complexType name="EmailType"> + <xsd:sequence> + <xsd:element name="To" type="xsd:string"/> + <xsd:element name="Title" type="xsd:string"/> + <xsd:element name="Body" type="xsd:string"/> + </xsd:sequence> + </xsd:complexType> + </xsd:schema> + </wsdl:types> + <wsdl:message name="SendEmailRequest"> + <wsdl:part name="parameters" element="tns:sendEmail"></wsdl:part> + </wsdl:message> + <wsdl:message name="SendEmailResponse"> + <wsdl:part name="parameters" element="tns:sendEmailResponse"></wsdl:part> + </wsdl:message> + <wsdl:portType name="EmailGateway"> + <wsdl:operation name="sendEmail"> + <wsdl:input message="tns:SendEmailRequest"></wsdl:input> + <wsdl:output message="tns:SendEmailResponse"></wsdl:output> + </wsdl:operation> + </wsdl:portType> + <wsdl:binding name="EmailGatwayBinding" type="tns:EmailGateway"> + <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" /> + <wsdl:operation name="sendEmail"> + <soap:operation soapAction="http://www.tuscanyscatours.com/EmailGateway/sendEmail" /> + <wsdl:input> + <soap:body use="literal" /> + </wsdl:input> + <wsdl:output> + <soap:body use="literal" /> + </wsdl:output> + </wsdl:operation> + </wsdl:binding> + <wsdl:service name="EmailGatewayService"> + <wsdl:port name="EmailGatewayPort" binding="tns:EmailGatwayBinding"> + <soap:address location="http://localhost:8082/EmailGateway" /> + </wsdl:port> + </wsdl:service> + + <plnk:partnerLinkType name="EmailGatewayLinkType"> + <plnk:role name="forward" portType="tns:EmailGateway"/> + </plnk:partnerLinkType> +</wsdl:definitions>
\ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-groovy/src/main/resources/META-INF/sca-contribution.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-groovy/src/main/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..36e2990be1 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-groovy/src/main/resources/META-INF/sca-contribution.xml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0" + xmlns:tours="http://tuscanyscatours.com/"> + <export.java package="com.tuscanyscatours.payment" /> + <deployable composite="tours:payment" /> +</contribution> diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-groovy/src/main/resources/Payment.wsdl b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-groovy/src/main/resources/Payment.wsdl new file mode 100644 index 0000000000..2519d7642e --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-groovy/src/main/resources/Payment.wsdl @@ -0,0 +1,83 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<wsdl:definitions name="Payment" + targetNamespace="http://www.tuscanyscatours.com/Payment/" + xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" + xmlns:tns="http://www.tuscanyscatours.com/Payment/" + xmlns:xsd="http://www.w3.org/2001/XMLSchema" + xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" + xmlns:bpws="http://schemas.xmlsoap.org/ws/2004/03/business-process/" + xmlns:plnk="http://schemas.xmlsoap.org/ws/2004/03/partner-link/"> + <wsdl:types> + <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" + targetNamespace="http://www.tuscanyscatours.com/Payment/" + xmlns:tns="http://www.tuscanyscatours.com/Payment/"> + + <xsd:complexType name="MakePaymentMemberType"> + <xsd:sequence> + <xsd:element name="CustomerId" type="xsd:string"></xsd:element> + <xsd:element name="Amount" type="xsd:float"></xsd:element> + </xsd:sequence> + </xsd:complexType> + <xsd:element name="makePaymentMember" type="tns:MakePaymentMemberType"/> + + <xsd:complexType name="MakePaymentMemberResponseType"> + <xsd:sequence> + <xsd:element name="Status" type="xsd:string"></xsd:element> + </xsd:sequence> + </xsd:complexType> + <xsd:element name="makePaymentMemberResponse" type="tns:MakePaymentMemberResponseType"/> + + </xsd:schema> + </wsdl:types> + <wsdl:message name="MakePaymentMemberRequest"> + <wsdl:part name="parameters" element="tns:makePaymentMember"></wsdl:part> + </wsdl:message> + <wsdl:message name="MakePaymentMemberResponse"> + <wsdl:part name="parameters" element="tns:makePaymentMemberResponse"></wsdl:part> + </wsdl:message> + <wsdl:portType name="Payment"> + <wsdl:operation name="makePaymentMember"> + <wsdl:input message="tns:MakePaymentMemberRequest"></wsdl:input> + <wsdl:output message="tns:MakePaymentMemberResponse"></wsdl:output> + </wsdl:operation> + </wsdl:portType> + <wsdl:binding name="PaymentBinding" type="tns:Payment"> + <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" /> + <wsdl:operation name="makePaymentMember"> + <soap:operation soapAction="http://www.tuscanyscatours.com/Payment/makePayment" /> + <wsdl:input> + <soap:body use="literal" /> + </wsdl:input> + <wsdl:output> + <soap:body use="literal" /> + </wsdl:output> + </wsdl:operation> + </wsdl:binding> + <wsdl:service name="PaymentService"> + <wsdl:port name="PaymentPort" binding="tns:PaymentBinding"> + <soap:address location="http://localhost:8083/Payment" /> + </wsdl:port> + </wsdl:service> + + <plnk:partnerLinkType name="PaymentLinkType"> + <plnk:role name="forward" portType="tns:Payment"/> + </plnk:partnerLinkType> +</wsdl:definitions>
\ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-groovy/src/main/resources/payment.composite b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-groovy/src/main/resources/payment.composite new file mode 100644 index 0000000000..071c6786d1 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-groovy/src/main/resources/payment.composite @@ -0,0 +1,38 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" + targetNamespace="http://tuscanyscatours.com/" + xmlns:t="http://tuscany.apache.org/xmlns/sca/1.0" + xmlns:xsd="http://www.w3.org/2001/XMLSchema" + name="payment"> + + <component name="Payment"> + <t:implementation.script script="payment/PaymentImpl.groovy"/> + <service name="Payment"> + <interface.java interface="com.tuscanyscatours.payment.Payment" /> + <binding.ws uri="http://localhost:8081/Payment"/> + </service> + <reference name="emailGateway"> + <interface.java interface="com.tuscanyscatours.emailgateway.EmailGateway" /> + <binding.ws uri="http://localhost:8088/EmailGateway"/> + </reference> + <property name="transactionFee" type="xsd:float">0.02</property> + </component> +</composite> diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-groovy/src/main/resources/payment/PaymentImpl.groovy b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-groovy/src/main/resources/payment/PaymentImpl.groovy new file mode 100644 index 0000000000..854fbd2f4a --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-groovy/src/main/resources/payment/PaymentImpl.groovy @@ -0,0 +1,31 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+def makePaymentMember(customerId, amount) {
+
+ def finalAmount = amount + transactionFee;
+
+ com.tuscanyscatours.emailgateway.EmailType email = new com.tuscanyscatours.emailgateway.EmailType();
+ email.setTo(customerId);
+ email.setTitle("Payment " + finalAmount + " Received");
+
+ emailGateway.sendEmail(email);
+
+ return "Success";
+}
\ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-groovy/src/test/java/scatours/payment/PaymentTestCase.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-groovy/src/test/java/scatours/payment/PaymentTestCase.java new file mode 100644 index 0000000000..1eb611e5b3 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-groovy/src/test/java/scatours/payment/PaymentTestCase.java @@ -0,0 +1,86 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package scatours.payment;
+
+import org.apache.tuscany.sca.node.SCAClient;
+import org.apache.tuscany.sca.node.SCAContribution;
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.SCANodeFactory;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import com.tuscanyscatours.payment.Payment;
+
+/**
+ *
+ */
+public class PaymentTestCase {
+
+ private static SCANode paymentNode;
+ private static SCANode creditCardNode;
+ private static SCANode emailGatewayNode;
+
+ @BeforeClass
+ public static void setUpBeforeClass() throws Exception {
+ creditCardNode =
+ SCANodeFactory.newInstance()
+ .createSCANode("creditcard.composite",
+ new SCAContribution("creditcard", "../creditcard-payment-jaxb/target/classes"));
+
+ creditCardNode.start();
+
+ emailGatewayNode =
+ SCANodeFactory.newInstance().createSCANode("emailgateway.composite",
+ new SCAContribution("emailgateway",
+ "../emailgateway/target/classes"),
+ new SCAContribution("emailgateway-test",
+ "../emailgateway/target/test-classes"));
+
+ emailGatewayNode.start();
+
+ paymentNode =
+ SCANodeFactory.newInstance().createSCANode(null,
+ new SCAContribution("payment-groovy", "./target/classes"),
+ new SCAContribution("payment-groovy-test",
+ "./target/test-classes"));
+
+ paymentNode.start();
+ }
+
+ @Test
+ public void testPayment() {
+ SCAClient client = (SCAClient)paymentNode;
+ Payment payment = client.getService(Payment.class, "PaymentClient");
+ String result = payment.makePaymentMember("Fred", 100.00f);
+ System.out.println("Result = " + result);
+ if (!"Success".equals(result)) {
+ throw new RuntimeException(result);
+ }
+ }
+
+ @AfterClass
+ public static void tearDownAfterClass() throws Exception {
+ paymentNode.stop();
+ creditCardNode.stop();
+ emailGatewayNode.stop();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-groovy/src/test/java/scatours/payment/client/impl/PaymentClientImpl.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-groovy/src/test/java/scatours/payment/client/impl/PaymentClientImpl.java new file mode 100644 index 0000000000..a38ba51ac5 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-groovy/src/test/java/scatours/payment/client/impl/PaymentClientImpl.java @@ -0,0 +1,37 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package scatours.payment.client.impl;
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+import com.tuscanyscatours.payment.Payment;
+
+@Service(Payment.class)
+public class PaymentClientImpl implements Payment {
+ @Reference
+ protected Payment payment;
+
+ public String makePaymentMember(String customerId, float amount) {
+ // Delegate the external web service
+ return payment.makePaymentMember(customerId, amount);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-groovy/src/test/resources/META-INF/sca-contribution.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-groovy/src/test/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..378e09009b --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-groovy/src/test/resources/META-INF/sca-contribution.xml @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0" + xmlns:tours="http://tuscanyscatours.com/" > + <deployable composite="tours:paymentClient" /> +</contribution> diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-groovy/src/test/resources/payment-client.composite b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-groovy/src/test/resources/payment-client.composite new file mode 100644 index 0000000000..353c1cea04 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-groovy/src/test/resources/payment-client.composite @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" + targetNamespace="http://tuscanyscatours.com/" + name="paymentClient"> + + <component name="PaymentClient"> + <implementation.java class="scatours.payment.client.impl.PaymentClientImpl" /> + <reference name="payment"> + <interface.java interface="com.tuscanyscatours.payment.Payment" /> + <binding.ws uri="http://localhost:8081/Payment" /> + </reference> + </component> + +</composite> diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-callback/build.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-callback/build.xml new file mode 100644 index 0000000000..c20d49800e --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-callback/build.xml @@ -0,0 +1,30 @@ +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> + +<project name="scatours-contribution-payment-java-callback" default="compile"> + <import file="../../antdefs.xml"/> + + <target name="wsdljava"> + <antcall target="wsimport"> + <param name="wsdlfile" value="Payment.wsdl"/> + <param name="javaclass" value="com/tuscanyscatours/payment/Payment.class"/> + <param name="package" value="com.tuscanyscatours.payment"/> + </antcall> + </target> +</project> diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-callback/pom.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-callback/pom.xml new file mode 100644 index 0000000000..2dc84e2b39 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-callback/pom.xml @@ -0,0 +1,136 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<project> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>scatours</artifactId> + <version>1.0-SNAPSHOT</version> + <relativePath>../../pom.xml</relativePath> + </parent> + <version>1.0-SNAPSHOT</version> + <artifactId>scatours-contribution-payment-java-callback</artifactId> + <name>Apache Tuscany SCA Tours Payment Java Callback</name> + + <dependencies> + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-sca-api</artifactId> + <version>${tuscany.version}</version> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-implementation-java-runtime</artifactId> + <version>${tuscany.version}</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-binding-ws-axis2</artifactId> + <version>${tuscany.version}</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-node-impl</artifactId> + <version>${tuscany.version}</version> + <scope>test</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-host-jetty</artifactId> + <version>${tuscany.version}</version> + <scope>test</scope> + </dependency> + + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>4.5</version> + <scope>test</scope> + </dependency> + + </dependencies> + + <pluginRepositories> + <pluginRepository> + <id>java.net2</id> + <name>java.net Maven 2.x Repository</name> + <url>http://download.java.net/maven/2</url> + <snapshots> + <enabled>false</enabled> + </snapshots> + </pluginRepository> + </pluginRepositories> + + <build> + <finalName>${artifactId}</finalName> + <plugins> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>build-helper-maven-plugin</artifactId> + <version>1.0</version> + <executions> + <execution> + <id>add-source</id> + <phase>generate-sources</phase> + <goals> + <goal>add-source</goal> + </goals> + <configuration> + <sources> + <source>target/jaxws-source</source> + </sources> + </configuration> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>jaxws-maven-plugin</artifactId> + <version>1.12</version> + <executions> + <execution> + <id>payment</id> + <phase>generate-sources</phase> + <goals> + <goal>wsimport</goal> + </goals> + <configuration> + <packageName>com.tuscanyscatours.payment</packageName> + <wsdlDirectory>${basedir}/src/main/resources</wsdlDirectory> + <wsdlFiles> + <wsdlFile>Payment.wsdl</wsdlFile> + </wsdlFiles> + <sourceDestDir>${project.build.directory}/jaxws-source</sourceDestDir> + <staleFile>${project.build.directory}/jaxws-source/stale/payment.stale</staleFile> + <verbose>false</verbose> + <xnocompile>true</xnocompile> + </configuration> + </execution> + </executions> + </plugin> + </plugins> + </build> +</project> diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-callback/src/main/java/com/tuscanyscatours/customer/Customer.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-callback/src/main/java/com/tuscanyscatours/customer/Customer.java new file mode 100644 index 0000000000..3b72f81b33 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-callback/src/main/java/com/tuscanyscatours/customer/Customer.java @@ -0,0 +1,70 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package com.tuscanyscatours.customer; + +import com.tuscanyscatours.payment.creditcard.CreditCardDetailsType; + +/** + * Customer data + */ +public class Customer { + private String id; + private String email; + private String name; + + private CreditCardDetailsType creditCard; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public CreditCardDetailsType getCreditCard() { + return creditCard; + } + + public void setCreditCard(CreditCardDetailsType creditCard) { + this.creditCard = creditCard; + } + + public String toString() { + return "id: " + id + " name: " + name + " e-mail: " + email; + } + +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-callback/src/main/java/com/tuscanyscatours/customer/CustomerNotFoundException.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-callback/src/main/java/com/tuscanyscatours/customer/CustomerNotFoundException.java new file mode 100644 index 0000000000..b08f76e0fa --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-callback/src/main/java/com/tuscanyscatours/customer/CustomerNotFoundException.java @@ -0,0 +1,57 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package com.tuscanyscatours.customer; + +public class CustomerNotFoundException extends Exception { + private static final long serialVersionUID = -129752837478357452L; + + /** + * + */ + public CustomerNotFoundException() { + + } + + /** + * @param message + */ + public CustomerNotFoundException(String message) { + super(message); + + } + + /** + * @param cause + */ + public CustomerNotFoundException(Throwable cause) { + super(cause); + + } + + /** + * @param message + * @param cause + */ + public CustomerNotFoundException(String message, Throwable cause) { + super(message, cause); + + } + +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-callback/src/main/java/com/tuscanyscatours/customer/CustomerRegistry.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-callback/src/main/java/com/tuscanyscatours/customer/CustomerRegistry.java new file mode 100644 index 0000000000..706167d567 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-callback/src/main/java/com/tuscanyscatours/customer/CustomerRegistry.java @@ -0,0 +1,39 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package com.tuscanyscatours.customer; + +import java.util.Collection; + +import com.tuscanyscatours.payment.creditcard.CreditCardDetailsType; + +/** + * Customer registry interface + */ +public interface CustomerRegistry { + Customer createCustomer(String name, String email, CreditCardDetailsType creditCard); + + boolean updateCustomer(Customer customer); + + Customer getCustomer(String id) throws CustomerNotFoundException; + + Collection<Customer> getAllCustomers(); + + boolean deleteCustomer(String id); +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-callback/src/main/java/com/tuscanyscatours/customer/impl/CustomerRegistryImpl.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-callback/src/main/java/com/tuscanyscatours/customer/impl/CustomerRegistryImpl.java new file mode 100644 index 0000000000..bdf99dec72 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-callback/src/main/java/com/tuscanyscatours/customer/impl/CustomerRegistryImpl.java @@ -0,0 +1,114 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package com.tuscanyscatours.customer.impl; + +import java.util.Collection; +import java.util.HashMap; +import java.util.Map; + +import org.osoa.sca.annotations.Destroy; +import org.osoa.sca.annotations.EagerInit; +import org.osoa.sca.annotations.Init; +import org.osoa.sca.annotations.Requires; +import org.osoa.sca.annotations.Scope; +import org.osoa.sca.annotations.Service; + +import com.tuscanyscatours.customer.Customer; +import com.tuscanyscatours.customer.CustomerNotFoundException; +import com.tuscanyscatours.customer.CustomerRegistry; +import com.tuscanyscatours.payment.creditcard.CreditCardDetailsType; +import com.tuscanyscatours.payment.creditcard.CreditCardTypeType; +import com.tuscanyscatours.payment.creditcard.PayerType; + +/** + * An in-memory customer registry implementation + */ +@Service(CustomerRegistry.class) +@Scope("COMPOSITE") +@EagerInit +@Requires("{http://www.osoa.org/xmlns/sca/1.0}managedTransaction.global") +public class CustomerRegistryImpl implements CustomerRegistry { + private volatile static int idGenerator = 0; + private Map<String, Customer> customers = new HashMap<String, Customer>(); + + @Init + public void init() { + // Load the customers + + CreditCardDetailsType cc = new CreditCardDetailsType(); + PayerType john = new PayerType(); + john.setName("John Smith"); + cc.setCardOwner(john); + cc.setCreditCardNumber("1111-2222-3333-4444"); + cc.setCreditCardType(CreditCardTypeType.VISA); + cc.setCVV2("1234"); + cc.setExpMonth(1); + cc.setExpYear(2012); + createCustomer("John Smith", "john@xyz.com", cc); + } + + @Destroy + public void destroy() { + // Save the customers + } + + public Customer createCustomer(String name, String email, CreditCardDetailsType creditCard) { + Customer customer = new Customer(); + customer.setId("c-" + idGenerator++); + customer.setName(name); + customer.setEmail(email); + customer.setCreditCard(creditCard); + customers.put(customer.getId(), customer); + return customer; + } + + public boolean deleteCustomer(String id) { + return customers.remove(id) != null; + } + + public Collection<Customer> getAllCustomers() { + return customers.values(); + } + + public Customer getCustomer(String id) throws CustomerNotFoundException { + Customer customer = customers.get(id); + + if (customer == null) { + throw new CustomerNotFoundException("Customer " + id + " not found"); + } + + return customer; + } + + public boolean updateCustomer(Customer customer) { + Customer current = null; + try { + current = getCustomer(customer.getId()); + } catch (Exception ex) { + return false; + } + + current.setEmail(customer.getEmail()); + current.setName(customer.getName()); + current.setCreditCard(customer.getCreditCard()); + return true; + } + +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-callback/src/main/java/com/tuscanyscatours/emailgateway/EmailGateway.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-callback/src/main/java/com/tuscanyscatours/emailgateway/EmailGateway.java new file mode 100644 index 0000000000..0fbf63d6bc --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-callback/src/main/java/com/tuscanyscatours/emailgateway/EmailGateway.java @@ -0,0 +1,30 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package com.tuscanyscatours.emailgateway; + +import org.osoa.sca.annotations.Remotable; + +/** + * A gateway to send e-mail + */ +@Remotable +public interface EmailGateway { + public boolean sendEmail(String sender, String recipient, String subject, String body); +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-callback/src/main/java/com/tuscanyscatours/emailgateway/impl/EmailGatewayImpl.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-callback/src/main/java/com/tuscanyscatours/emailgateway/impl/EmailGatewayImpl.java new file mode 100644 index 0000000000..d9798e436a --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-callback/src/main/java/com/tuscanyscatours/emailgateway/impl/EmailGatewayImpl.java @@ -0,0 +1,37 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package com.tuscanyscatours.emailgateway.impl; + +import org.osoa.sca.annotations.Service; + +import com.tuscanyscatours.emailgateway.EmailGateway; + +@Service(EmailGateway.class) +public class EmailGatewayImpl implements EmailGateway { + + public boolean sendEmail(String sender, String recipient, String subject, String body) { + System.out.println("From: " + sender); + System.out.println("To: " + recipient); + System.out.println("Subject: " + subject); + System.out.println(body); + return true; + } + +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-callback/src/main/java/com/tuscanyscatours/payment/creditcard/AddressType.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-callback/src/main/java/com/tuscanyscatours/payment/creditcard/AddressType.java new file mode 100644 index 0000000000..ca3724a4f5 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-callback/src/main/java/com/tuscanyscatours/payment/creditcard/AddressType.java @@ -0,0 +1,191 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package com.tuscanyscatours.payment.creditcard; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + + +/** + * <p>Java class for AddressType complex type. + * + * <p>The following schema fragment specifies the expected content contained within this class. + * + * <pre> + * <complexType name="AddressType"> + * <complexContent> + * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> + * <sequence> + * <element name="Street" type="{http://www.w3.org/2001/XMLSchema}string"/> + * <element name="City" type="{http://www.w3.org/2001/XMLSchema}string"/> + * <element name="State" type="{http://www.w3.org/2001/XMLSchema}string"/> + * <element name="ZipCode" type="{http://www.w3.org/2001/XMLSchema}string"/> + * <element name="HomePhone" type="{http://www.w3.org/2001/XMLSchema}string"/> + * </sequence> + * </restriction> + * </complexContent> + * </complexType> + * </pre> + * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "AddressType", propOrder = { + "street", + "city", + "state", + "zipCode", + "homePhone" +}) +public class AddressType { + + @XmlElement(name = "Street", required = true) + protected String street; + @XmlElement(name = "City", required = true) + protected String city; + @XmlElement(name = "State", required = true) + protected String state; + @XmlElement(name = "ZipCode", required = true) + protected String zipCode; + @XmlElement(name = "HomePhone", required = true) + protected String homePhone; + + /** + * Gets the value of the street property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getStreet() { + return street; + } + + /** + * Sets the value of the street property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setStreet(String value) { + this.street = value; + } + + /** + * Gets the value of the city property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCity() { + return city; + } + + /** + * Sets the value of the city property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCity(String value) { + this.city = value; + } + + /** + * Gets the value of the state property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getState() { + return state; + } + + /** + * Sets the value of the state property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setState(String value) { + this.state = value; + } + + /** + * Gets the value of the zipCode property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getZipCode() { + return zipCode; + } + + /** + * Sets the value of the zipCode property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setZipCode(String value) { + this.zipCode = value; + } + + /** + * Gets the value of the homePhone property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getHomePhone() { + return homePhone; + } + + /** + * Sets the value of the homePhone property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setHomePhone(String value) { + this.homePhone = value; + } + +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-callback/src/main/java/com/tuscanyscatours/payment/creditcard/Authorize.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-callback/src/main/java/com/tuscanyscatours/payment/creditcard/Authorize.java new file mode 100644 index 0000000000..7c0b38198e --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-callback/src/main/java/com/tuscanyscatours/payment/creditcard/Authorize.java @@ -0,0 +1,101 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package com.tuscanyscatours.payment.creditcard; + +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; + + +/** + * <p>Java class for anonymous complex type. + * + * <p>The following schema fragment specifies the expected content contained within this class. + * + * <pre> + * <complexType> + * <complexContent> + * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> + * <sequence> + * <element name="CreditCard" type="{http://www.tuscanyscatours.com/CreditCardPayment/}CreditCardDetailsType"/> + * <element name="Amount" type="{http://www.w3.org/2001/XMLSchema}float"/> + * </sequence> + * </restriction> + * </complexContent> + * </complexType> + * </pre> + * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "creditCard", + "amount" +}) +@XmlRootElement(name = "authorize") +public class Authorize { + + @XmlElement(name = "CreditCard", required = true) + protected CreditCardDetailsType creditCard; + @XmlElement(name = "Amount") + protected float amount; + + /** + * Gets the value of the creditCard property. + * + * @return + * possible object is + * {@link CreditCardDetailsType } + * + */ + public CreditCardDetailsType getCreditCard() { + return creditCard; + } + + /** + * Sets the value of the creditCard property. + * + * @param value + * allowed object is + * {@link CreditCardDetailsType } + * + */ + public void setCreditCard(CreditCardDetailsType value) { + this.creditCard = value; + } + + /** + * Gets the value of the amount property. + * + */ + public float getAmount() { + return amount; + } + + /** + * Sets the value of the amount property. + * + */ + public void setAmount(float value) { + this.amount = value; + } + +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-callback/src/main/java/com/tuscanyscatours/payment/creditcard/AuthorizeFault.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-callback/src/main/java/com/tuscanyscatours/payment/creditcard/AuthorizeFault.java new file mode 100644 index 0000000000..84278aa508 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-callback/src/main/java/com/tuscanyscatours/payment/creditcard/AuthorizeFault.java @@ -0,0 +1,81 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package com.tuscanyscatours.payment.creditcard; + +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; + + +/** + * <p>Java class for anonymous complex type. + * + * <p>The following schema fragment specifies the expected content contained within this class. + * + * <pre> + * <complexType> + * <complexContent> + * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> + * <sequence> + * <element name="errorCode" type="{http://www.w3.org/2001/XMLSchema}string"/> + * </sequence> + * </restriction> + * </complexContent> + * </complexType> + * </pre> + * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "errorCode" +}) +@XmlRootElement(name = "authorizeFault") +public class AuthorizeFault { + + @XmlElement(required = true) + protected String errorCode; + + /** + * Gets the value of the errorCode property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getErrorCode() { + return errorCode; + } + + /** + * Sets the value of the errorCode property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setErrorCode(String value) { + this.errorCode = value; + } + +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-callback/src/main/java/com/tuscanyscatours/payment/creditcard/AuthorizeFault_Exception.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-callback/src/main/java/com/tuscanyscatours/payment/creditcard/AuthorizeFault_Exception.java new file mode 100644 index 0000000000..ec0f8768da --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-callback/src/main/java/com/tuscanyscatours/payment/creditcard/AuthorizeFault_Exception.java @@ -0,0 +1,71 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package com.tuscanyscatours.payment.creditcard; + +import javax.xml.ws.WebFault; + + +/** + * This class was generated by the JAX-WS RI. + * JAX-WS RI 2.1.7-b01- + * Generated source version: 2.1 + * + */ +@WebFault(name = "authorizeFault", targetNamespace = "http://www.tuscanyscatours.com/CreditCardPayment/") +public class AuthorizeFault_Exception + extends Exception +{ + + /** + * Java type that goes as soapenv:Fault detail element. + * + */ + private AuthorizeFault faultInfo; + + /** + * + * @param message + * @param faultInfo + */ + public AuthorizeFault_Exception(String message, AuthorizeFault faultInfo) { + super(message); + this.faultInfo = faultInfo; + } + + /** + * + * @param message + * @param faultInfo + * @param cause + */ + public AuthorizeFault_Exception(String message, AuthorizeFault faultInfo, Throwable cause) { + super(message, cause); + this.faultInfo = faultInfo; + } + + /** + * + * @return + * returns fault bean: com.tuscanyscatours.payment.creditcard.AuthorizeFault + */ + public AuthorizeFault getFaultInfo() { + return faultInfo; + } + +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-callback/src/main/java/com/tuscanyscatours/payment/creditcard/AuthorizeResponse.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-callback/src/main/java/com/tuscanyscatours/payment/creditcard/AuthorizeResponse.java new file mode 100644 index 0000000000..05f3479804 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-callback/src/main/java/com/tuscanyscatours/payment/creditcard/AuthorizeResponse.java @@ -0,0 +1,81 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package com.tuscanyscatours.payment.creditcard; + +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; + + +/** + * <p>Java class for anonymous complex type. + * + * <p>The following schema fragment specifies the expected content contained within this class. + * + * <pre> + * <complexType> + * <complexContent> + * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> + * <sequence> + * <element name="Status" type="{http://www.w3.org/2001/XMLSchema}string"/> + * </sequence> + * </restriction> + * </complexContent> + * </complexType> + * </pre> + * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "status" +}) +@XmlRootElement(name = "authorizeResponse") +public class AuthorizeResponse { + + @XmlElement(name = "Status", required = true) + protected String status; + + /** + * Gets the value of the status property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getStatus() { + return status; + } + + /** + * Sets the value of the status property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setStatus(String value) { + this.status = value; + } + +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-callback/src/main/java/com/tuscanyscatours/payment/creditcard/CardCompany.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-callback/src/main/java/com/tuscanyscatours/payment/creditcard/CardCompany.java new file mode 100644 index 0000000000..dbffbe2c19 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-callback/src/main/java/com/tuscanyscatours/payment/creditcard/CardCompany.java @@ -0,0 +1,31 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package com.tuscanyscatours.payment.creditcard; + +import org.osoa.sca.CallableReference; +import org.osoa.sca.annotations.Remotable; + +@Remotable +public interface CardCompany { + + public String makePayment(CreditCardDetailsType ccDetails, + float amount, + CallableReference<CreditCardConfirm> callbackRef); +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-callback/src/main/java/com/tuscanyscatours/payment/creditcard/CreditCardConfirm.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-callback/src/main/java/com/tuscanyscatours/payment/creditcard/CreditCardConfirm.java new file mode 100644 index 0000000000..ff3b2d74b4 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-callback/src/main/java/com/tuscanyscatours/payment/creditcard/CreditCardConfirm.java @@ -0,0 +1,27 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package com.tuscanyscatours.payment.creditcard; + +import org.osoa.sca.annotations.Remotable; + +@Remotable +public interface CreditCardConfirm { + void confirmPayment(String paymentRef); +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-callback/src/main/java/com/tuscanyscatours/payment/creditcard/CreditCardDetailsType.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-callback/src/main/java/com/tuscanyscatours/payment/creditcard/CreditCardDetailsType.java new file mode 100644 index 0000000000..8bac29f6bd --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-callback/src/main/java/com/tuscanyscatours/payment/creditcard/CreditCardDetailsType.java @@ -0,0 +1,219 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package com.tuscanyscatours.payment.creditcard; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + + +/** + * <p>Java class for CreditCardDetailsType complex type. + * + * <p>The following schema fragment specifies the expected content contained within this class. + * + * <pre> + * <complexType name="CreditCardDetailsType"> + * <complexContent> + * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> + * <sequence> + * <element name="CreditCardType" type="{http://www.tuscanyscatours.com/CreditCardPayment/}CreditCardTypeType" minOccurs="0"/> + * <element name="CreditCardNumber" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> + * <element name="ExpMonth" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/> + * <element name="ExpYear" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/> + * <element name="CardOwner" type="{http://www.tuscanyscatours.com/CreditCardPayment/}PayerType" minOccurs="0"/> + * <element name="CVV2" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> + * </sequence> + * </restriction> + * </complexContent> + * </complexType> + * </pre> + * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "CreditCardDetailsType", propOrder = { + "creditCardType", + "creditCardNumber", + "expMonth", + "expYear", + "cardOwner", + "cvv2" +}) +public class CreditCardDetailsType { + + @XmlElement(name = "CreditCardType") + protected CreditCardTypeType creditCardType; + @XmlElement(name = "CreditCardNumber") + protected String creditCardNumber; + @XmlElement(name = "ExpMonth") + protected Integer expMonth; + @XmlElement(name = "ExpYear") + protected Integer expYear; + @XmlElement(name = "CardOwner") + protected PayerType cardOwner; + @XmlElement(name = "CVV2") + protected String cvv2; + + /** + * Gets the value of the creditCardType property. + * + * @return + * possible object is + * {@link CreditCardTypeType } + * + */ + public CreditCardTypeType getCreditCardType() { + return creditCardType; + } + + /** + * Sets the value of the creditCardType property. + * + * @param value + * allowed object is + * {@link CreditCardTypeType } + * + */ + public void setCreditCardType(CreditCardTypeType value) { + this.creditCardType = value; + } + + /** + * Gets the value of the creditCardNumber property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCreditCardNumber() { + return creditCardNumber; + } + + /** + * Sets the value of the creditCardNumber property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCreditCardNumber(String value) { + this.creditCardNumber = value; + } + + /** + * Gets the value of the expMonth property. + * + * @return + * possible object is + * {@link Integer } + * + */ + public Integer getExpMonth() { + return expMonth; + } + + /** + * Sets the value of the expMonth property. + * + * @param value + * allowed object is + * {@link Integer } + * + */ + public void setExpMonth(Integer value) { + this.expMonth = value; + } + + /** + * Gets the value of the expYear property. + * + * @return + * possible object is + * {@link Integer } + * + */ + public Integer getExpYear() { + return expYear; + } + + /** + * Sets the value of the expYear property. + * + * @param value + * allowed object is + * {@link Integer } + * + */ + public void setExpYear(Integer value) { + this.expYear = value; + } + + /** + * Gets the value of the cardOwner property. + * + * @return + * possible object is + * {@link PayerType } + * + */ + public PayerType getCardOwner() { + return cardOwner; + } + + /** + * Sets the value of the cardOwner property. + * + * @param value + * allowed object is + * {@link PayerType } + * + */ + public void setCardOwner(PayerType value) { + this.cardOwner = value; + } + + /** + * Gets the value of the cvv2 property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCVV2() { + return cvv2; + } + + /** + * Sets the value of the cvv2 property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCVV2(String value) { + this.cvv2 = value; + } + +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-callback/src/main/java/com/tuscanyscatours/payment/creditcard/CreditCardPayment.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-callback/src/main/java/com/tuscanyscatours/payment/creditcard/CreditCardPayment.java new file mode 100644 index 0000000000..da3d32fc0b --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-callback/src/main/java/com/tuscanyscatours/payment/creditcard/CreditCardPayment.java @@ -0,0 +1,31 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package com.tuscanyscatours.payment.creditcard; + +import org.osoa.sca.annotations.Callback; +import org.osoa.sca.annotations.Remotable; + +@Remotable +@Callback(CreditCardSecurity.class) +public interface CreditCardPayment { + + public String authorize(CreditCardDetailsType ccDetails, float amount) + throws AuthorizeFault_Exception; +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-callback/src/main/java/com/tuscanyscatours/payment/creditcard/CreditCardPaymentConfirm.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-callback/src/main/java/com/tuscanyscatours/payment/creditcard/CreditCardPaymentConfirm.java new file mode 100644 index 0000000000..0c775f3621 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-callback/src/main/java/com/tuscanyscatours/payment/creditcard/CreditCardPaymentConfirm.java @@ -0,0 +1,31 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package com.tuscanyscatours.payment.creditcard; + +import org.osoa.sca.annotations.Callback; +import org.osoa.sca.annotations.Remotable; + +@Remotable +@Callback(CreditCardConfirm.class) +public interface CreditCardPaymentConfirm { + + public String authorize(CreditCardDetailsType ccDetails, float amount) + throws AuthorizeFault_Exception; +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-callback/src/main/java/com/tuscanyscatours/payment/creditcard/CreditCardSecurity.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-callback/src/main/java/com/tuscanyscatours/payment/creditcard/CreditCardSecurity.java new file mode 100644 index 0000000000..ae367c9f1e --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-callback/src/main/java/com/tuscanyscatours/payment/creditcard/CreditCardSecurity.java @@ -0,0 +1,27 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package com.tuscanyscatours.payment.creditcard; + +import org.osoa.sca.annotations.Remotable; + +@Remotable +public interface CreditCardSecurity { + String checkSecurity(String securityPrompt); +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-callback/src/main/java/com/tuscanyscatours/payment/creditcard/CreditCardTypeType.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-callback/src/main/java/com/tuscanyscatours/payment/creditcard/CreditCardTypeType.java new file mode 100644 index 0000000000..0467078279 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-callback/src/main/java/com/tuscanyscatours/payment/creditcard/CreditCardTypeType.java @@ -0,0 +1,74 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package com.tuscanyscatours.payment.creditcard; + +import javax.xml.bind.annotation.XmlEnum; +import javax.xml.bind.annotation.XmlEnumValue; +import javax.xml.bind.annotation.XmlType; + + +/** + * <p>Java class for CreditCardTypeType. + * + * <p>The following schema fragment specifies the expected content contained within this class. + * <p> + * <pre> + * <simpleType name="CreditCardTypeType"> + * <restriction base="{http://www.w3.org/2001/XMLSchema}token"> + * <enumeration value="Visa"/> + * <enumeration value="MasterCard"/> + * <enumeration value="Discover"/> + * <enumeration value="Amex"/> + * </restriction> + * </simpleType> + * </pre> + * + */ +@XmlType(name = "CreditCardTypeType") +@XmlEnum +public enum CreditCardTypeType { + + @XmlEnumValue("Visa") + VISA("Visa"), + @XmlEnumValue("MasterCard") + MASTER_CARD("MasterCard"), + @XmlEnumValue("Discover") + DISCOVER("Discover"), + @XmlEnumValue("Amex") + AMEX("Amex"); + private final String value; + + CreditCardTypeType(String v) { + value = v; + } + + public String value() { + return value; + } + + public static CreditCardTypeType fromValue(String v) { + for (CreditCardTypeType c: CreditCardTypeType.values()) { + if (c.value.equals(v)) { + return c; + } + } + throw new IllegalArgumentException(v); + } + +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-callback/src/main/java/com/tuscanyscatours/payment/creditcard/PayerType.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-callback/src/main/java/com/tuscanyscatours/payment/creditcard/PayerType.java new file mode 100644 index 0000000000..f36fe35bdf --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-callback/src/main/java/com/tuscanyscatours/payment/creditcard/PayerType.java @@ -0,0 +1,107 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package com.tuscanyscatours.payment.creditcard; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + + +/** + * <p>Java class for PayerType complex type. + * + * <p>The following schema fragment specifies the expected content contained within this class. + * + * <pre> + * <complexType name="PayerType"> + * <complexContent> + * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> + * <sequence> + * <element name="Name" type="{http://www.w3.org/2001/XMLSchema}string"/> + * <element name="Address" type="{http://www.tuscanyscatours.com/CreditCardPayment/}AddressType"/> + * </sequence> + * </restriction> + * </complexContent> + * </complexType> + * </pre> + * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "PayerType", propOrder = { + "name", + "address" +}) +public class PayerType { + + @XmlElement(name = "Name", required = true) + protected String name; + @XmlElement(name = "Address", required = true) + protected AddressType address; + + /** + * Gets the value of the name property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getName() { + return name; + } + + /** + * Sets the value of the name property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setName(String value) { + this.name = value; + } + + /** + * Gets the value of the address property. + * + * @return + * possible object is + * {@link AddressType } + * + */ + public AddressType getAddress() { + return address; + } + + /** + * Sets the value of the address property. + * + * @param value + * allowed object is + * {@link AddressType } + * + */ + public void setAddress(AddressType value) { + this.address = value; + } + +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-callback/src/main/java/com/tuscanyscatours/payment/creditcard/impl/CardCompanyImpl.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-callback/src/main/java/com/tuscanyscatours/payment/creditcard/impl/CardCompanyImpl.java new file mode 100644 index 0000000000..55759e7b20 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-callback/src/main/java/com/tuscanyscatours/payment/creditcard/impl/CardCompanyImpl.java @@ -0,0 +1,60 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package com.tuscanyscatours.payment.creditcard.impl; + +import org.osoa.sca.CallableReference; +import org.osoa.sca.annotations.Service; + +import com.tuscanyscatours.payment.creditcard.CardCompany; +import com.tuscanyscatours.payment.creditcard.CreditCardConfirm; +import com.tuscanyscatours.payment.creditcard.CreditCardDetailsType; + + +@Service(CardCompany.class) +public class CardCompanyImpl implements CardCompany { + + public String makePayment(CreditCardDetailsType ccDetails, + float amount, + CallableReference<CreditCardConfirm> callbackRef){ + // payment processing happens asynchronously + Thread app = new Thread(new AsycnhPaymentProcessing(callbackRef)); + app.start(); + return "OK"; + } + + class AsycnhPaymentProcessing implements Runnable { + CallableReference<CreditCardConfirm> callbackRef; + + AsycnhPaymentProcessing(CallableReference<CreditCardConfirm> callbackRef){ + this.callbackRef = callbackRef; + } + public void run() { + String paymentRef = "123456"; + + try { + Thread.sleep(1000); + } catch (Exception ex) { + // do nothing + } + + callbackRef.getService().confirmPayment(paymentRef); + } + } +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-callback/src/main/java/com/tuscanyscatours/payment/creditcard/impl/CreditCardPaymentCallbackImpl.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-callback/src/main/java/com/tuscanyscatours/payment/creditcard/impl/CreditCardPaymentCallbackImpl.java new file mode 100644 index 0000000000..bd578bc810 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-callback/src/main/java/com/tuscanyscatours/payment/creditcard/impl/CreditCardPaymentCallbackImpl.java @@ -0,0 +1,78 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package com.tuscanyscatours.payment.creditcard.impl; + +import org.osoa.sca.RequestContext; +import org.osoa.sca.annotations.Callback; +import org.osoa.sca.annotations.Context; +import org.osoa.sca.annotations.Service; + +import com.tuscanyscatours.payment.creditcard.CreditCardDetailsType; +import com.tuscanyscatours.payment.creditcard.CreditCardPayment; +import com.tuscanyscatours.payment.creditcard.CreditCardSecurity; + +@Service(CreditCardPayment.class) +public class CreditCardPaymentCallbackImpl implements CreditCardPayment { + + @Callback + protected CreditCardSecurity ccSecurity; + + @Context + protected RequestContext rqContext; + + + public String authorize(CreditCardDetailsType card, float amount) { + if (amount > 1000) { + for (int i = 0; i < 3; i++) { + String pwd = null; + if (amount < 10000) { + // using injected callback proxy + pwd = ccSecurity.checkSecurity("Enter password"); + } else { + // using request context to get callback proxy + CreditCardSecurity ccSecurity = rqContext.getCallback(); + pwd = ccSecurity.checkSecurity("Enter password"); + } + + if (verifyPassword(card, pwd)) { + break; + } + if (i == 2) { + return "BadPassword"; + } + } + } + makePayment(card, amount); + return "OK"; + } + + private boolean verifyPassword(CreditCardDetailsType card, String pw) { + if (pw.equals("abcxyz")){ + return true; + } else { + return false; + } + } + + private void makePayment(CreditCardDetailsType card, float amount) { + // payment processing + } + +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-callback/src/main/java/com/tuscanyscatours/payment/creditcard/impl/CreditCardPaymentConfirmImpl.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-callback/src/main/java/com/tuscanyscatours/payment/creditcard/impl/CreditCardPaymentConfirmImpl.java new file mode 100644 index 0000000000..02f1f46f82 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-callback/src/main/java/com/tuscanyscatours/payment/creditcard/impl/CreditCardPaymentConfirmImpl.java @@ -0,0 +1,48 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package com.tuscanyscatours.payment.creditcard.impl; + +import org.osoa.sca.CallableReference; +import org.osoa.sca.annotations.Callback; +import org.osoa.sca.annotations.Reference; +import org.osoa.sca.annotations.Service; + +import com.tuscanyscatours.payment.creditcard.CardCompany; +import com.tuscanyscatours.payment.creditcard.CreditCardConfirm; +import com.tuscanyscatours.payment.creditcard.CreditCardDetailsType; +import com.tuscanyscatours.payment.creditcard.CreditCardPaymentConfirm; + +@Service(CreditCardPaymentConfirm.class) +public class CreditCardPaymentConfirmImpl implements CreditCardPaymentConfirm { + + @Callback + protected CallableReference<CreditCardConfirm> callbackRef; + + @Reference + protected CardCompany cardCompany; + + public String authorize(CreditCardDetailsType card, + float amount) { + cardCompany.makePayment(card, amount, callbackRef); + return "InProgress"; + } + + +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-callback/src/main/java/com/tuscanyscatours/payment/impl/CreditCardSecurityImpl.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-callback/src/main/java/com/tuscanyscatours/payment/impl/CreditCardSecurityImpl.java new file mode 100644 index 0000000000..94ffead262 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-callback/src/main/java/com/tuscanyscatours/payment/impl/CreditCardSecurityImpl.java @@ -0,0 +1,38 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package com.tuscanyscatours.payment.impl; + +import org.osoa.sca.annotations.Service; + +import com.tuscanyscatours.payment.creditcard.CreditCardSecurity; + +/** + * The payment implementation + */ +@Service(CreditCardSecurity.class) +public class CreditCardSecurityImpl implements CreditCardSecurity { + + public String checkSecurity(String securityPrompt) { + System.out.println("Extra securiy - " + securityPrompt); + System.out.println("password = abcxyz"); + return "abcxyz"; + } + +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-callback/src/main/java/com/tuscanyscatours/payment/impl/PaymentCallbackIDImpl.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-callback/src/main/java/com/tuscanyscatours/payment/impl/PaymentCallbackIDImpl.java new file mode 100644 index 0000000000..887d54c4e7 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-callback/src/main/java/com/tuscanyscatours/payment/impl/PaymentCallbackIDImpl.java @@ -0,0 +1,90 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package com.tuscanyscatours.payment.impl; + +import org.osoa.sca.RequestContext; +import org.osoa.sca.ServiceReference; +import org.osoa.sca.annotations.Context; +import org.osoa.sca.annotations.Property; +import org.osoa.sca.annotations.Reference; +import org.osoa.sca.annotations.Service; + +import com.tuscanyscatours.customer.Customer; +import com.tuscanyscatours.customer.CustomerNotFoundException; +import com.tuscanyscatours.customer.CustomerRegistry; +import com.tuscanyscatours.emailgateway.EmailGateway; +import com.tuscanyscatours.payment.Payment; +import com.tuscanyscatours.payment.creditcard.AuthorizeFault_Exception; +import com.tuscanyscatours.payment.creditcard.CreditCardPayment; +import com.tuscanyscatours.payment.creditcard.CreditCardSecurity; + +/** + * The payment implementation + */ +@Service(Payment.class) +public class PaymentCallbackIDImpl implements Payment, + CreditCardSecurity { + + @Reference + protected CustomerRegistry customerRegistry; + + @Reference(name="creditCardPayment") + protected ServiceReference<CreditCardPayment> cpRef; +; + + @Reference + protected EmailGateway emailGateway; + + @Property + protected float transactionFee = 0.01f; + + @Context + protected RequestContext rqContext; + + public String makePaymentMember(String customerId, float amount) { + try { + Customer customer = customerRegistry.getCustomer(customerId); + String auditID = "987654321"; + cpRef.setCallbackID(auditID); + String status = cpRef.getService().authorize(customer.getCreditCard(), amount + transactionFee); + emailGateway.sendEmail("order@tuscanyscatours.com", + customer.getEmail(), + "Status for your payment", + customer + " >>> Status = " + status); + return status; + } catch (CustomerNotFoundException ex) { + return "Payment failed due to " + ex.getMessage(); + } catch (AuthorizeFault_Exception e) { + return e.getFaultInfo().getErrorCode(); + } catch (Throwable t) { + return "Payment failed due to system error " + t.getMessage(); + } + } + + public String checkSecurity(String securityPrompt) { + System.out.println("Extra securiy - " + securityPrompt); + System.out.println("password = abcxyz"); + Object cbID = rqContext.getServiceReference().getCallbackID(); + System.out.println("callback ID = " + cbID); + + return "abcxyz"; + } + +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-callback/src/main/java/com/tuscanyscatours/payment/impl/PaymentCallbackImpl.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-callback/src/main/java/com/tuscanyscatours/payment/impl/PaymentCallbackImpl.java new file mode 100644 index 0000000000..63b61d685d --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-callback/src/main/java/com/tuscanyscatours/payment/impl/PaymentCallbackImpl.java @@ -0,0 +1,78 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package com.tuscanyscatours.payment.impl; + +import org.osoa.sca.annotations.Property; +import org.osoa.sca.annotations.Reference; +import org.osoa.sca.annotations.Service; + +import com.tuscanyscatours.customer.Customer; +import com.tuscanyscatours.customer.CustomerNotFoundException; +import com.tuscanyscatours.customer.CustomerRegistry; +import com.tuscanyscatours.emailgateway.EmailGateway; +import com.tuscanyscatours.payment.Payment; +import com.tuscanyscatours.payment.creditcard.AuthorizeFault_Exception; +import com.tuscanyscatours.payment.creditcard.CreditCardPayment; +import com.tuscanyscatours.payment.creditcard.CreditCardSecurity; + +/** + * The payment implementation + */ +@Service(Payment.class) +public class PaymentCallbackImpl implements Payment, + CreditCardSecurity { + + @Reference + protected CustomerRegistry customerRegistry; + + @Reference + protected CreditCardPayment creditCardPayment; + + @Reference + protected EmailGateway emailGateway; + + @Property + protected float transactionFee = 0.01f; + + public String makePaymentMember(String customerId, float amount) { + try { + Customer customer = customerRegistry.getCustomer(customerId); + String status = creditCardPayment.authorize(customer.getCreditCard(), amount + transactionFee); + emailGateway.sendEmail("order@tuscanyscatours.com", + customer.getEmail(), + "Status for your payment", + customer + " >>> Status = " + status); + return status; + } catch (CustomerNotFoundException ex) { + return "Payment failed due to " + ex.getMessage(); + } catch (AuthorizeFault_Exception e) { + return e.getFaultInfo().getErrorCode(); + } catch (Throwable t) { + return "Payment failed due to system error " + t.getMessage(); + } + } + + public String checkSecurity(String securityPrompt) { + System.out.println("Extra securiy - " + securityPrompt); + System.out.println("password = abcxyz"); + return "abcxyz"; + } + +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-callback/src/main/java/com/tuscanyscatours/payment/impl/PaymentCallbackRedirectImpl.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-callback/src/main/java/com/tuscanyscatours/payment/impl/PaymentCallbackRedirectImpl.java new file mode 100644 index 0000000000..bf554dbad5 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-callback/src/main/java/com/tuscanyscatours/payment/impl/PaymentCallbackRedirectImpl.java @@ -0,0 +1,83 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package com.tuscanyscatours.payment.impl; + +import org.osoa.sca.ServiceReference; +import org.osoa.sca.annotations.Property; +import org.osoa.sca.annotations.Reference; +import org.osoa.sca.annotations.Service; + +import com.tuscanyscatours.customer.Customer; +import com.tuscanyscatours.customer.CustomerNotFoundException; +import com.tuscanyscatours.customer.CustomerRegistry; +import com.tuscanyscatours.emailgateway.EmailGateway; +import com.tuscanyscatours.payment.Payment; +import com.tuscanyscatours.payment.creditcard.AuthorizeFault_Exception; +import com.tuscanyscatours.payment.creditcard.CreditCardPayment; +import com.tuscanyscatours.payment.creditcard.CreditCardSecurity; + +/** + * The payment implementation + */ +@Service(Payment.class) +public class PaymentCallbackRedirectImpl implements Payment, + CreditCardSecurity { + + @Reference + protected CustomerRegistry customerRegistry; + + @Reference(name="creditCardPayment") + protected ServiceReference<CreditCardPayment> cpRef; + + @Reference(name="creditCardSecurity") + protected ServiceReference<CreditCardSecurity> csRef; + + @Reference + protected EmailGateway emailGateway; + + @Property + protected float transactionFee = 0.01f; + + public String makePaymentMember(String customerId, float amount) { + try { + Customer customer = customerRegistry.getCustomer(customerId); + cpRef.setCallback(csRef); + String status = cpRef.getService().authorize(customer.getCreditCard(), amount + transactionFee); + emailGateway.sendEmail("order@tuscanyscatours.com", + customer.getEmail(), + "Status for your payment", + customer + " >>> Status = " + status); + return status; + } catch (CustomerNotFoundException ex) { + return "Payment failed due to " + ex.getMessage(); + } catch (AuthorizeFault_Exception e) { + return e.getFaultInfo().getErrorCode(); + } catch (Throwable t) { + return "Payment failed due to system error " + t.getMessage(); + } + } + + public String checkSecurity(String securityPrompt) { + System.out.println("Extra securiy - " + securityPrompt); + System.out.println("password = abcxyz"); + return "abcxyz"; + } + +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-callback/src/main/java/com/tuscanyscatours/payment/impl/PaymentConfirmImpl.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-callback/src/main/java/com/tuscanyscatours/payment/impl/PaymentConfirmImpl.java new file mode 100644 index 0000000000..1a9c35c65d --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-callback/src/main/java/com/tuscanyscatours/payment/impl/PaymentConfirmImpl.java @@ -0,0 +1,77 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package com.tuscanyscatours.payment.impl; + +import org.osoa.sca.annotations.Property; +import org.osoa.sca.annotations.Reference; +import org.osoa.sca.annotations.Service; + +import com.tuscanyscatours.customer.Customer; +import com.tuscanyscatours.customer.CustomerNotFoundException; +import com.tuscanyscatours.customer.CustomerRegistry; +import com.tuscanyscatours.emailgateway.EmailGateway; +import com.tuscanyscatours.payment.Payment; +import com.tuscanyscatours.payment.creditcard.AuthorizeFault_Exception; +import com.tuscanyscatours.payment.creditcard.CreditCardConfirm; +import com.tuscanyscatours.payment.creditcard.CreditCardPayment; +import com.tuscanyscatours.payment.creditcard.CreditCardPaymentConfirm; + +/** + * The payment implementation + */ +@Service(Payment.class) +public class PaymentConfirmImpl implements Payment, + CreditCardConfirm { + + @Reference + protected CustomerRegistry customerRegistry; + + @Reference + protected CreditCardPaymentConfirm creditCardPayment; + + @Reference + protected EmailGateway emailGateway; + + @Property + protected float transactionFee = 0.01f; + + public String makePaymentMember(String customerId, float amount) { + try { + Customer customer = customerRegistry.getCustomer(customerId); + String status = creditCardPayment.authorize(customer.getCreditCard(), amount + transactionFee); + emailGateway.sendEmail("order@tuscanyscatours.com", + customer.getEmail(), + "Status for your payment", + customer + " >>> Status = " + status); + return status; + } catch (CustomerNotFoundException ex) { + return "Payment failed due to " + ex.getMessage(); + } catch (AuthorizeFault_Exception e) { + return e.getFaultInfo().getErrorCode(); + } catch (Throwable t) { + return "Payment failed due to system error " + t.getMessage(); + } + } + + public void confirmPayment(String paymentRef) { + System.out.println("Pament ref is - " + paymentRef); + } + +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-callback/src/main/resources/CreditCardPayment.wsdl b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-callback/src/main/resources/CreditCardPayment.wsdl new file mode 100644 index 0000000000..08be3dc2e2 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-callback/src/main/resources/CreditCardPayment.wsdl @@ -0,0 +1,132 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<wsdl:definitions name="CreditCardPayment" + targetNamespace="http://www.tuscanyscatours.com/CreditCardPayment/" + xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" + xmlns:tns="http://www.tuscanyscatours.com/CreditCardPayment/" + xmlns:xsd="http://www.w3.org/2001/XMLSchema" + xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" + xmlns:bpws="http://schemas.xmlsoap.org/ws/2004/03/business-process/" + xmlns:plnk="http://schemas.xmlsoap.org/ws/2004/03/partner-link/"> + <wsdl:types> + <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" + targetNamespace="http://www.tuscanyscatours.com/CreditCardPayment/" + xmlns:tns="http://www.tuscanyscatours.com/CreditCardPayment/"> + + <xsd:element name="authorize"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="CreditCard" type="tns:CreditCardDetailsType"></xsd:element> + <xsd:element name="Amount" type="xsd:float"></xsd:element> + </xsd:sequence> + </xsd:complexType> + </xsd:element> + + <xsd:element name="authorizeResponse"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="Status" type="xsd:string"></xsd:element> + </xsd:sequence> + </xsd:complexType> + </xsd:element> + + <xsd:complexType name="CreditCardDetailsType"> + <xsd:sequence> + <xsd:element name="CreditCardType" type="tns:CreditCardTypeType" minOccurs="0" /> + <xsd:element name="CreditCardNumber" type="xsd:string" minOccurs="0" /> + <xsd:element name="ExpMonth" type="xsd:int" minOccurs="0" /> + <xsd:element name="ExpYear" type="xsd:int" minOccurs="0" /> + <xsd:element name="CardOwner" type="tns:PayerType" minOccurs="0" /> + <xsd:element name="CVV2" type="xsd:string" minOccurs="0" /> + </xsd:sequence> + </xsd:complexType> + <xsd:simpleType name="CreditCardTypeType"> + <xsd:restriction base="xsd:token"> + <xsd:enumeration value="Visa" /> + <xsd:enumeration value="MasterCard" /> + <xsd:enumeration value="Discover" /> + <xsd:enumeration value="Amex" /> + </xsd:restriction> + </xsd:simpleType> + <xsd:complexType name="PayerType"> + <xsd:sequence> + <xsd:element name="Name" type="xsd:string" /> + <xsd:element name="Address" type="tns:AddressType" /> + </xsd:sequence> + </xsd:complexType> + <xsd:complexType name="AddressType"> + <xsd:sequence> + <xsd:element name="Street" type="xsd:string" /> + <xsd:element name="City" type="xsd:string" /> + <xsd:element name="State" type="xsd:string" /> + <xsd:element name="ZipCode" type="xsd:string" /> + <xsd:element name="HomePhone" type="xsd:string" /> + </xsd:sequence> + </xsd:complexType> + <xsd:element name="authorizeFault"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="errorCode" type="xsd:string"></xsd:element> + </xsd:sequence> + </xsd:complexType> + </xsd:element> + </xsd:schema> + </wsdl:types> + <wsdl:message name="AuthorizeRequest"> + <wsdl:part name="parameters" element="tns:authorize"></wsdl:part> + </wsdl:message> + <wsdl:message name="AuthorizeResponse"> + <wsdl:part name="parameters" element="tns:authorizeResponse"></wsdl:part> + </wsdl:message> + <wsdl:message name="AuthorizeFault"> + <wsdl:part name="parameters" element="tns:authorizeFault"></wsdl:part> + </wsdl:message> + <wsdl:portType name="CreditCardPayment"> + <wsdl:operation name="authorize"> + <wsdl:input message="tns:AuthorizeRequest"></wsdl:input> + <wsdl:output message="tns:AuthorizeResponse"></wsdl:output> + <wsdl:fault name="authorizationFailure" message="tns:AuthorizeFault"></wsdl:fault> + </wsdl:operation> + </wsdl:portType> + <wsdl:binding name="CreditCardPaymentBinding" type="tns:CreditCardPayment"> + <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" /> + <wsdl:operation name="authorize"> + <soap:operation soapAction="http://www.tuscanyscatours.com/CreditCardPayment/authorize" /> + <wsdl:input> + <soap:body use="literal" /> + </wsdl:input> + <wsdl:output> + <soap:body use="literal" /> + </wsdl:output> + <wsdl:fault name="authorizationFailure"> + <soap:fault name="authorizationFailure" use="literal"/> + </wsdl:fault> + </wsdl:operation> + </wsdl:binding> + <wsdl:service name="CreditCardPaymentService"> + <wsdl:port name="CreditCardPaymentPort" binding="tns:CreditCardPaymentBinding"> + <soap:address location="http://localhost:8080/CreditCardPayment" /> + </wsdl:port> + </wsdl:service> + + <plnk:partnerLinkType name="CreditCardPaymentLinkType"> + <plnk:role name="forward" portType="tns:CreditCardPayment"/> + </plnk:partnerLinkType> +</wsdl:definitions>
\ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-callback/src/main/resources/META-INF/sca-contribution.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-callback/src/main/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..0fd7cb9910 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-callback/src/main/resources/META-INF/sca-contribution.xml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0" + xmlns:scatours="http://tuscanyscatours.com/"> + <export.java package="com.tuscanyscatours.payment" /> + <deployable composite="scatours:payment" /> +</contribution> diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-callback/src/main/resources/Payment.wsdl b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-callback/src/main/resources/Payment.wsdl new file mode 100644 index 0000000000..2519d7642e --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-callback/src/main/resources/Payment.wsdl @@ -0,0 +1,83 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<wsdl:definitions name="Payment" + targetNamespace="http://www.tuscanyscatours.com/Payment/" + xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" + xmlns:tns="http://www.tuscanyscatours.com/Payment/" + xmlns:xsd="http://www.w3.org/2001/XMLSchema" + xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" + xmlns:bpws="http://schemas.xmlsoap.org/ws/2004/03/business-process/" + xmlns:plnk="http://schemas.xmlsoap.org/ws/2004/03/partner-link/"> + <wsdl:types> + <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" + targetNamespace="http://www.tuscanyscatours.com/Payment/" + xmlns:tns="http://www.tuscanyscatours.com/Payment/"> + + <xsd:complexType name="MakePaymentMemberType"> + <xsd:sequence> + <xsd:element name="CustomerId" type="xsd:string"></xsd:element> + <xsd:element name="Amount" type="xsd:float"></xsd:element> + </xsd:sequence> + </xsd:complexType> + <xsd:element name="makePaymentMember" type="tns:MakePaymentMemberType"/> + + <xsd:complexType name="MakePaymentMemberResponseType"> + <xsd:sequence> + <xsd:element name="Status" type="xsd:string"></xsd:element> + </xsd:sequence> + </xsd:complexType> + <xsd:element name="makePaymentMemberResponse" type="tns:MakePaymentMemberResponseType"/> + + </xsd:schema> + </wsdl:types> + <wsdl:message name="MakePaymentMemberRequest"> + <wsdl:part name="parameters" element="tns:makePaymentMember"></wsdl:part> + </wsdl:message> + <wsdl:message name="MakePaymentMemberResponse"> + <wsdl:part name="parameters" element="tns:makePaymentMemberResponse"></wsdl:part> + </wsdl:message> + <wsdl:portType name="Payment"> + <wsdl:operation name="makePaymentMember"> + <wsdl:input message="tns:MakePaymentMemberRequest"></wsdl:input> + <wsdl:output message="tns:MakePaymentMemberResponse"></wsdl:output> + </wsdl:operation> + </wsdl:portType> + <wsdl:binding name="PaymentBinding" type="tns:Payment"> + <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" /> + <wsdl:operation name="makePaymentMember"> + <soap:operation soapAction="http://www.tuscanyscatours.com/Payment/makePayment" /> + <wsdl:input> + <soap:body use="literal" /> + </wsdl:input> + <wsdl:output> + <soap:body use="literal" /> + </wsdl:output> + </wsdl:operation> + </wsdl:binding> + <wsdl:service name="PaymentService"> + <wsdl:port name="PaymentPort" binding="tns:PaymentBinding"> + <soap:address location="http://localhost:8083/Payment" /> + </wsdl:port> + </wsdl:service> + + <plnk:partnerLinkType name="PaymentLinkType"> + <plnk:role name="forward" portType="tns:Payment"/> + </plnk:partnerLinkType> +</wsdl:definitions>
\ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-callback/src/main/resources/definitions.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-callback/src/main/resources/definitions.xml new file mode 100644 index 0000000000..b304bbfc2b --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-callback/src/main/resources/definitions.xml @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="ASCII"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<definitions xmlns="http://www.osoa.org/xmlns/sca/1.0" + targetNamespace="http://www.osoa.org/xmlns/sca/1.0" + xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"> + + <!-- Policy Intents Defined by the SCA Runtime --> + <intent name="authorization" constrains="sca:implementation"/> + <intent name="managedTransaction" constrains="sca:implementation"/> + <intent name="managedTransaction.global"/> + + <!-- Policy intents --> + <policySet name="ps1" provides="sca:authorization" appliesTo="sca:implementation.java"/> + + <policySet name="ps2" provides="sca:managedTransaction.global" appliesTo="sca:implementation.java"/> + +</definitions> diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-callback/src/main/resources/payment.composite b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-callback/src/main/resources/payment.composite new file mode 100644 index 0000000000..6707b8a6cc --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-callback/src/main/resources/payment.composite @@ -0,0 +1,118 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" + targetNamespace="http://tuscanyscatours.com/" + name="payment"> + + <!-- standard callbacks --> + <component name="Payment1"> + <implementation.java class="com.tuscanyscatours.payment.impl.PaymentCallbackImpl" /> + <service name="Payment"> + <binding.ws uri="http://localhost:8081/Payment" /> + <binding.sca /> + </service> + <reference name="customerRegistry" target="CustomerRegistry" /> + <reference name="creditCardPayment" target="CreditCardPayment"/> + <reference name="emailGateway" target="EmailGateway" /> + <property name="transactionFee">0.02</property> + </component> + + <component name="Payment2"> + <implementation.java class="com.tuscanyscatours.payment.impl.PaymentCallbackImpl" /> + <service name="Payment"> + <binding.ws uri="http://localhost:8081/Payment" /> + <binding.sca /> + </service> + <reference name="customerRegistry" target="CustomerRegistry" /> + <reference name="creditCardPayment" target="CreditCardPayment"/> + <reference name="emailGateway" target="EmailGateway" /> + <property name="transactionFee">0.02</property> + </component> + + <!-- callbacks passed as callable references --> + <component name="PaymentConfirm"> + <implementation.java class="com.tuscanyscatours.payment.impl.PaymentConfirmImpl" /> + <service name="Payment"> + <binding.ws uri="http://localhost:8081/Payment" /> + <binding.sca /> + </service> + <reference name="customerRegistry" target="CustomerRegistry" /> + <reference name="creditCardPayment" target="CreditCardPaymentConfirm"/> + <reference name="emailGateway" target="EmailGateway" /> + <property name="transactionFee">0.02</property> + </component> + + <component name="CreditCardPaymentConfirm"> + <implementation.java class="com.tuscanyscatours.payment.creditcard.impl.CreditCardPaymentConfirmImpl" /> + <reference name="cardCompany" target="CardCompany" /> + </component> + + <component name="CardCompany"> + <implementation.java class="com.tuscanyscatours.payment.creditcard.impl.CardCompanyImpl" /> + </component> + + <!-- callback ID --> + + <component name="PaymentCallbackID"> + <implementation.java class="com.tuscanyscatours.payment.impl.PaymentCallbackIDImpl" /> + <service name="Payment"> + <binding.ws uri="http://localhost:8081/Payment" /> + <binding.sca /> + </service> + <reference name="customerRegistry" target="CustomerRegistry" /> + <reference name="creditCardPayment" target="CreditCardPayment"/> + <reference name="emailGateway" target="EmailGateway" /> + <property name="transactionFee">0.02</property> + </component> + + <!-- callback Redirection --> + + <component name="PaymentCallbackRedirect"> + <implementation.java class="com.tuscanyscatours.payment.impl.PaymentCallbackRedirectImpl" /> + <service name="Payment"> + <binding.ws uri="http://localhost:8081/Payment" /> + <binding.sca /> + </service> + <reference name="customerRegistry" target="CustomerRegistry" /> + <reference name="creditCardPayment" target="CreditCardPayment"/> + <reference name="creditCardSecurity" target="CreditCardSecurity"/> + <reference name="emailGateway" target="EmailGateway" /> + <property name="transactionFee">0.02</property> + </component> + + <component name="CreditCardSecurity"> + <implementation.java class="com.tuscanyscatours.payment.impl.CreditCardSecurityImpl" /> + </component> + + <!-- component common to multiple scenarios --> + + <component name="CustomerRegistry"> + <implementation.java class="com.tuscanyscatours.customer.impl.CustomerRegistryImpl" /> + </component> + + <component name="CreditCardPayment"> + <implementation.java class="com.tuscanyscatours.payment.creditcard.impl.CreditCardPaymentCallbackImpl" /> + </component> + + <component name="EmailGateway"> + <implementation.java class="com.tuscanyscatours.emailgateway.impl.EmailGatewayImpl" /> + </component> + +</composite>
\ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-callback/src/test/java/scatours/payment/PaymentTestCase.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-callback/src/test/java/scatours/payment/PaymentTestCase.java new file mode 100644 index 0000000000..330dc15385 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-callback/src/test/java/scatours/payment/PaymentTestCase.java @@ -0,0 +1,111 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package scatours.payment; + +import org.apache.tuscany.sca.node.SCAClient; +import org.apache.tuscany.sca.node.SCAContribution; +import org.apache.tuscany.sca.node.SCANode; +import org.apache.tuscany.sca.node.SCANodeFactory; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Ignore; +import org.junit.Test; + +import com.tuscanyscatours.payment.Payment; + +public class PaymentTestCase { + private static SCANode node; + + @BeforeClass + public static void setUpBeforeClass() throws Exception { + node = + SCANodeFactory.newInstance() + .createSCANode(null, + new SCAContribution("payment", "./target/classes")); + node.start(); + } + + @Test + public void testPayment() { + SCAClient client = (SCAClient)node; + Payment payment1 = client.getService(Payment.class, "Payment1"); + Payment payment2 = client.getService(Payment.class, "Payment2"); + Payment paymentConfirm = client.getService(Payment.class, "PaymentConfirm"); + Payment paymentCallbackID = client.getService(Payment.class, "PaymentCallbackID"); + Payment paymentCallbackRedirect = client.getService(Payment.class, "PaymentCallbackRedirect"); + + System.out.println("==================================================="); + System.out.println("\n\nPayment1 under limit - Status = \n\n" + payment1.makePaymentMember("c-0", 100.00f)); + System.out.println("==================================================="); + System.out.println("\n\nPayment2 under limit - Status = \n\n" + payment2.makePaymentMember("c-0", 100.00f)); + System.out.println("==================================================="); + System.out.println("\n\nPayment1 over limit - Status = \n\n" + payment1.makePaymentMember("c-0", 1500.00f)); + System.out.println("==================================================="); + System.out.println("\n\nPayment2 over limit - Status = \n\n" + payment2.makePaymentMember("c-0", 1500.00f)); + System.out.println("==================================================="); + System.out.println("\n\nPayment2 using request context - Status = \n\n" + payment2.makePaymentMember("c-0", 20000.00f)); + System.out.println("==================================================="); + System.out.println("\n\nPaymentConfirm - Status = \n\n" + paymentConfirm.makePaymentMember("c-0", 20000.00f)); + System.out.println("==================================================="); + + // wait for longer that the asynch payment processing waits. + try { + Thread.sleep(2000); + } catch (Exception ex) { + // do nothing + } + + System.out.println("==================================================="); + String result = paymentCallbackID.makePaymentMember("c-0", 20000.00f); + System.out.println("\n\nPaymentCallbackID - Status = \n\n" + result); + if (!"OK".equals(result)) { + throw new RuntimeException(result); + } + System.out.println("==================================================="); + result = paymentCallbackRedirect.makePaymentMember("c-0", 20000.00f); + System.out.println("\n\nPaymentCallbackRedirect - Status = \n\n" + result); + if (!"OK".equals(result)) { + throw new RuntimeException(result); + } + System.out.println("==================================================="); + + + } + + @Test + @Ignore + public void testWaitForInput() { + System.out.println("Press a key to end"); + try { + System.in.read(); + } catch (Exception ex) { + } + System.out.println("Shutting down"); + } + + @AfterClass + public static void tearDownAfterClass() throws Exception { + if (node != null) { + node.stop(); + node = null; + } + } + +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-policy/build.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-policy/build.xml new file mode 100644 index 0000000000..4c943a7370 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-policy/build.xml @@ -0,0 +1,35 @@ +<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<project name="scatours-contribution-payment-java-policy" default="compile">
+ <import file="../../antdefs.xml"/>
+
+ <target name="wsdljava">
+ <antcall target="wsimport">
+ <param name="wsdlfile" value="CreditCardPayment.wsdl"/>
+ <param name="javaclass" value="com/tuscanyscatours/payment/creditcard/CreditCardPayment.class"/>
+ <param name="package" value="com.tuscanyscatours.payment.creditcard"/>
+ </antcall>
+ <antcall target="wsimport">
+ <param name="wsdlfile" value="Payment.wsdl"/>
+ <param name="javaclass" value="com/tuscanyscatours/payment/Payment.class"/>
+ <param name="package" value="com.tuscanyscatours.payment"/>
+ </antcall>
+ </target>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-policy/maven-eclipse.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-policy/maven-eclipse.xml new file mode 100644 index 0000000000..4ceebd71f7 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-policy/maven-eclipse.xml @@ -0,0 +1,8 @@ +<project default="copy-resources"> + <target name="init"/> + <target name="copy-resources" depends="init"> + <copy todir="target/classes/META-INF" filtering="true"> + <fileset dir="." includes="LICENSE|NOTICE"/> + </copy> + </target> +</project>
\ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-policy/pom.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-policy/pom.xml new file mode 100644 index 0000000000..69bf9229db --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-policy/pom.xml @@ -0,0 +1,178 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<project> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>scatours</artifactId> + <version>1.0-SNAPSHOT</version> + <relativePath>../../pom.xml</relativePath> + </parent> + <version>1.0-SNAPSHOT</version> + <artifactId>scatours-contribution-payment-java-policy</artifactId> + <name>Apache Tuscany SCA Tours Payment Java Policy Contribution</name> + + <dependencies> + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-sca-api</artifactId> + <version>${tuscany.version}</version> + </dependency> + +<!-- + <dependency> + <groupId>javax.annotation</groupId> + <artifactId>jsr250-api</artifactId> + <version>1.0</version> + </dependency> +--> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-implementation-java-runtime</artifactId> + <version>${tuscany.version}</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-binding-ws-axis2</artifactId> + <version>${tuscany.version}</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-policy-security</artifactId> + <version>${tuscany.version}</version> + <scope>runtime</scope> + </dependency> + +<!-- + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-policy-transaction</artifactId> + <version>${tuscany.version}</version> + <scope>runtime</scope> + </dependency> +--> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-host-jetty</artifactId> + <version>${tuscany.version}</version> + <scope>test</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-node-impl</artifactId> + <version>${tuscany.version}</version> + <scope>test</scope> + </dependency> + + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>4.5</version> + <scope>test</scope> + </dependency> + + </dependencies> + + <pluginRepositories> + <pluginRepository> + <id>java.net2</id> + <name>java.net Maven 2.x Repository</name> + <url>http://download.java.net/maven/2</url> + <snapshots> + <enabled>false</enabled> + </snapshots> + </pluginRepository> + </pluginRepositories> + + <build> + <finalName>${artifactId}</finalName> + <plugins> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>build-helper-maven-plugin</artifactId> + <version>1.0</version> + <executions> + <execution> + <id>add-source</id> + <phase>generate-sources</phase> + <goals> + <goal>add-source</goal> + </goals> + <configuration> + <sources> + <source>target/jaxws-source</source> + </sources> + </configuration> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>jaxws-maven-plugin</artifactId> + <version>1.12</version> + <executions> + <execution> + <id>payment</id> + <phase>generate-sources</phase> + <goals> + <goal>wsimport</goal> + </goals> + <configuration> + <packageName>com.tuscanyscatours.payment</packageName> + <wsdlDirectory>${basedir}/src/main/resources</wsdlDirectory> + <wsdlFiles> + <wsdlFile>Payment.wsdl</wsdlFile> + </wsdlFiles> + <sourceDestDir>${project.build.directory}/jaxws-source</sourceDestDir> + <staleFile>${project.build.directory}/jaxws-source/stale/payment.stale</staleFile> + <verbose>false</verbose> + <xnocompile>true</xnocompile> + </configuration> + </execution> + <execution> + <id>payment.creditcard</id> + <phase>process-sources</phase> + <goals> + <goal>wsimport</goal> + </goals> + <configuration> + <packageName>com.tuscanyscatours.payment.creditcard</packageName> + <wsdlDirectory>${basedir}/src/main/resources</wsdlDirectory> + <wsdlFiles> + <wsdlFile>CreditCardPayment.wsdl</wsdlFile> + </wsdlFiles> + <sourceDestDir>${project.build.directory}/jaxws-source</sourceDestDir> + <staleFile>${project.build.directory}/jaxws-source/stale/creditcard.stale</staleFile> + <verbose>false</verbose> + <xnocompile>true</xnocompile> + </configuration> + </execution> + </executions> + </plugin> + </plugins> + </build> +</project> diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-policy/src/main/java/com/tuscanyscatours/customer/Customer.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-policy/src/main/java/com/tuscanyscatours/customer/Customer.java new file mode 100644 index 0000000000..3b72f81b33 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-policy/src/main/java/com/tuscanyscatours/customer/Customer.java @@ -0,0 +1,70 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package com.tuscanyscatours.customer; + +import com.tuscanyscatours.payment.creditcard.CreditCardDetailsType; + +/** + * Customer data + */ +public class Customer { + private String id; + private String email; + private String name; + + private CreditCardDetailsType creditCard; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public CreditCardDetailsType getCreditCard() { + return creditCard; + } + + public void setCreditCard(CreditCardDetailsType creditCard) { + this.creditCard = creditCard; + } + + public String toString() { + return "id: " + id + " name: " + name + " e-mail: " + email; + } + +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-policy/src/main/java/com/tuscanyscatours/customer/CustomerNotFoundException.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-policy/src/main/java/com/tuscanyscatours/customer/CustomerNotFoundException.java new file mode 100644 index 0000000000..b08f76e0fa --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-policy/src/main/java/com/tuscanyscatours/customer/CustomerNotFoundException.java @@ -0,0 +1,57 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package com.tuscanyscatours.customer; + +public class CustomerNotFoundException extends Exception { + private static final long serialVersionUID = -129752837478357452L; + + /** + * + */ + public CustomerNotFoundException() { + + } + + /** + * @param message + */ + public CustomerNotFoundException(String message) { + super(message); + + } + + /** + * @param cause + */ + public CustomerNotFoundException(Throwable cause) { + super(cause); + + } + + /** + * @param message + * @param cause + */ + public CustomerNotFoundException(String message, Throwable cause) { + super(message, cause); + + } + +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-policy/src/main/java/com/tuscanyscatours/customer/CustomerRegistry.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-policy/src/main/java/com/tuscanyscatours/customer/CustomerRegistry.java new file mode 100644 index 0000000000..706167d567 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-policy/src/main/java/com/tuscanyscatours/customer/CustomerRegistry.java @@ -0,0 +1,39 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package com.tuscanyscatours.customer; + +import java.util.Collection; + +import com.tuscanyscatours.payment.creditcard.CreditCardDetailsType; + +/** + * Customer registry interface + */ +public interface CustomerRegistry { + Customer createCustomer(String name, String email, CreditCardDetailsType creditCard); + + boolean updateCustomer(Customer customer); + + Customer getCustomer(String id) throws CustomerNotFoundException; + + Collection<Customer> getAllCustomers(); + + boolean deleteCustomer(String id); +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-policy/src/main/java/com/tuscanyscatours/customer/impl/CustomerRegistryImpl.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-policy/src/main/java/com/tuscanyscatours/customer/impl/CustomerRegistryImpl.java new file mode 100644 index 0000000000..26926c7764 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-policy/src/main/java/com/tuscanyscatours/customer/impl/CustomerRegistryImpl.java @@ -0,0 +1,115 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package com.tuscanyscatours.customer.impl; + +import java.util.Collection; +import java.util.HashMap; +import java.util.Map; + +import org.osoa.sca.annotations.Destroy; +import org.osoa.sca.annotations.EagerInit; +import org.osoa.sca.annotations.Init; +import org.osoa.sca.annotations.Requires; +import org.osoa.sca.annotations.Scope; +import org.osoa.sca.annotations.Service; + +import com.tuscanyscatours.customer.Customer; +import com.tuscanyscatours.customer.CustomerNotFoundException; +import com.tuscanyscatours.customer.CustomerRegistry; +import com.tuscanyscatours.payment.creditcard.CreditCardDetailsType; +import com.tuscanyscatours.payment.creditcard.CreditCardTypeType; +import com.tuscanyscatours.payment.creditcard.ObjectFactory; +import com.tuscanyscatours.payment.creditcard.PayerType; + +/** + * An in-memory customer registry implementation + */ +@Service(CustomerRegistry.class) +@Scope("COMPOSITE") +@EagerInit +@Requires("{http://www.osoa.org/xmlns/sca/1.0}managedTransaction.global") +public class CustomerRegistryImpl implements CustomerRegistry { + private volatile static int idGenerator = 0; + private Map<String, Customer> customers = new HashMap<String, Customer>(); + + @Init + public void init() { + // Load the customers + ObjectFactory factory = new ObjectFactory(); + CreditCardDetailsType cc = factory.createCreditCardDetailsType(); + PayerType john = factory.createPayerType(); + john.setName("John Smith"); + cc.setCardOwner(john); + cc.setCreditCardNumber("1111-2222-3333-4444"); + cc.setCreditCardType(CreditCardTypeType.VISA); + cc.setCVV2("1234"); + cc.setExpMonth(1); + cc.setExpYear(2012); + createCustomer("John Smith", "john@xyz.com", cc); + } + + @Destroy + public void destroy() { + // Save the customers + } + + public Customer createCustomer(String name, String email, CreditCardDetailsType creditCard) { + Customer customer = new Customer(); + customer.setId("c-" + idGenerator++); + customer.setName(name); + customer.setEmail(email); + customer.setCreditCard(creditCard); + customers.put(customer.getId(), customer); + return customer; + } + + public boolean deleteCustomer(String id) { + return customers.remove(id) != null; + } + + public Collection<Customer> getAllCustomers() { + return customers.values(); + } + + public Customer getCustomer(String id) throws CustomerNotFoundException { + Customer customer = customers.get(id); + + if (customer == null) { + throw new CustomerNotFoundException("Customer " + id + " not found"); + } + + return customer; + } + + public boolean updateCustomer(Customer customer) { + Customer current = null; + try { + current = getCustomer(customer.getId()); + } catch (Exception ex) { + return false; + } + + current.setEmail(customer.getEmail()); + current.setName(customer.getName()); + current.setCreditCard(customer.getCreditCard()); + return true; + } + +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-policy/src/main/java/com/tuscanyscatours/emailgateway/EmailGateway.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-policy/src/main/java/com/tuscanyscatours/emailgateway/EmailGateway.java new file mode 100644 index 0000000000..0fbf63d6bc --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-policy/src/main/java/com/tuscanyscatours/emailgateway/EmailGateway.java @@ -0,0 +1,30 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package com.tuscanyscatours.emailgateway; + +import org.osoa.sca.annotations.Remotable; + +/** + * A gateway to send e-mail + */ +@Remotable +public interface EmailGateway { + public boolean sendEmail(String sender, String recipient, String subject, String body); +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-policy/src/main/java/com/tuscanyscatours/emailgateway/impl/EmailGatewayImpl.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-policy/src/main/java/com/tuscanyscatours/emailgateway/impl/EmailGatewayImpl.java new file mode 100644 index 0000000000..d9798e436a --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-policy/src/main/java/com/tuscanyscatours/emailgateway/impl/EmailGatewayImpl.java @@ -0,0 +1,37 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package com.tuscanyscatours.emailgateway.impl; + +import org.osoa.sca.annotations.Service; + +import com.tuscanyscatours.emailgateway.EmailGateway; + +@Service(EmailGateway.class) +public class EmailGatewayImpl implements EmailGateway { + + public boolean sendEmail(String sender, String recipient, String subject, String body) { + System.out.println("From: " + sender); + System.out.println("To: " + recipient); + System.out.println("Subject: " + subject); + System.out.println(body); + return true; + } + +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-policy/src/main/java/com/tuscanyscatours/payment/impl/PaymentImpl.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-policy/src/main/java/com/tuscanyscatours/payment/impl/PaymentImpl.java new file mode 100644 index 0000000000..b3eb95b44b --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-policy/src/main/java/com/tuscanyscatours/payment/impl/PaymentImpl.java @@ -0,0 +1,74 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package com.tuscanyscatours.payment.impl; + +import org.osoa.sca.annotations.Property; +import org.osoa.sca.annotations.Reference; +import org.osoa.sca.annotations.Requires; +import org.osoa.sca.annotations.Service; + +import com.tuscanyscatours.customer.Customer; +import com.tuscanyscatours.customer.CustomerNotFoundException; +import com.tuscanyscatours.customer.CustomerRegistry; +import com.tuscanyscatours.emailgateway.EmailGateway; +import com.tuscanyscatours.payment.Payment; +import com.tuscanyscatours.payment.creditcard.AuthorizeFault_Exception; +import com.tuscanyscatours.payment.creditcard.CreditCardPayment; + +/** + * The payment implementation + */ +@Service(Payment.class) +//@RolesAllowed({"Admin", "Billing"}) +//@RunAs("Billing") +public class PaymentImpl implements Payment { + + @Reference + protected CustomerRegistry customerRegistry; + + @Reference + //@Authentication - not supported + @Requires("{http://www.osoa.org/xmlns/sca/1.0}authentication") + protected CreditCardPayment creditCardPayment; + + @Reference + protected EmailGateway emailGateway; + + @Property + protected float transactionFee = 0.01f; + + public String makePaymentMember(String customerId, float amount) { + try { + Customer customer = customerRegistry.getCustomer(customerId); + String status = creditCardPayment.authorize(customer.getCreditCard(), amount + transactionFee); + emailGateway.sendEmail("order@tuscanyscatours.com", + customer.getEmail(), + "Status for your payment", + customer + " >>> Status = " + status); + return status; + } catch (CustomerNotFoundException ex) { + return "Payment failed due to " + ex.getMessage(); + } catch (AuthorizeFault_Exception e) { + return e.getFaultInfo().getErrorCode(); + } catch (Throwable t) { + return "Payment failed due to system error " + t.getMessage(); + } + } +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-policy/src/main/resources/CreditCardPayment.wsdl b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-policy/src/main/resources/CreditCardPayment.wsdl new file mode 100644 index 0000000000..9a87f1d2ae --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-policy/src/main/resources/CreditCardPayment.wsdl @@ -0,0 +1,132 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<wsdl:definitions name="CreditCardPayment"
+ targetNamespace="http://www.tuscanyscatours.com/CreditCardPayment/"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:tns="http://www.tuscanyscatours.com/CreditCardPayment/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:bpws="http://schemas.xmlsoap.org/ws/2004/03/business-process/"
+ xmlns:plnk="http://schemas.xmlsoap.org/ws/2004/03/partner-link/">
+ <wsdl:types>
+ <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.tuscanyscatours.com/CreditCardPayment/"
+ xmlns:tns="http://www.tuscanyscatours.com/CreditCardPayment/">
+
+ <xsd:element name="authorize">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="CreditCard" type="tns:CreditCardDetailsType"></xsd:element>
+ <xsd:element name="Amount" type="xsd:float"></xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="authorizeResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="Status" type="xsd:string"></xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:complexType name="CreditCardDetailsType">
+ <xsd:sequence>
+ <xsd:element name="CreditCardType" type="tns:CreditCardTypeType" minOccurs="0" />
+ <xsd:element name="CreditCardNumber" type="xsd:string" minOccurs="0" />
+ <xsd:element name="ExpMonth" type="xsd:int" minOccurs="0" />
+ <xsd:element name="ExpYear" type="xsd:int" minOccurs="0" />
+ <xsd:element name="CardOwner" type="tns:PayerType" minOccurs="0" />
+ <xsd:element name="CVV2" type="xsd:string" minOccurs="0" />
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:simpleType name="CreditCardTypeType">
+ <xsd:restriction base="xsd:token">
+ <xsd:enumeration value="Visa" />
+ <xsd:enumeration value="MasterCard" />
+ <xsd:enumeration value="Discover" />
+ <xsd:enumeration value="Amex" />
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:complexType name="PayerType">
+ <xsd:sequence>
+ <xsd:element name="Name" type="xsd:string" />
+ <xsd:element name="Address" type="tns:AddressType" />
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:complexType name="AddressType">
+ <xsd:sequence>
+ <xsd:element name="Street" type="xsd:string" />
+ <xsd:element name="City" type="xsd:string" />
+ <xsd:element name="State" type="xsd:string" />
+ <xsd:element name="ZipCode" type="xsd:string" />
+ <xsd:element name="HomePhone" type="xsd:string" />
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="authorizeFault">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="errorCode" type="xsd:string"></xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:schema>
+ </wsdl:types>
+ <wsdl:message name="AuthorizeRequest">
+ <wsdl:part name="parameters" element="tns:authorize"></wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="AuthorizeResponse">
+ <wsdl:part name="parameters" element="tns:authorizeResponse"></wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="AuthorizeFault">
+ <wsdl:part name="parameters" element="tns:authorizeFault"></wsdl:part>
+ </wsdl:message>
+ <wsdl:portType name="CreditCardPayment">
+ <wsdl:operation name="authorize">
+ <wsdl:input message="tns:AuthorizeRequest"></wsdl:input>
+ <wsdl:output message="tns:AuthorizeResponse"></wsdl:output>
+ <wsdl:fault name="authorizationFailure" message="tns:AuthorizeFault"></wsdl:fault>
+ </wsdl:operation>
+ </wsdl:portType>
+ <wsdl:binding name="CreditCardPaymentBinding" type="tns:CreditCardPayment">
+ <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
+ <wsdl:operation name="authorize">
+ <soap:operation soapAction="http://www.tuscanyscatours.com/CreditCardPayment/authorize" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ <wsdl:fault name="authorizationFailure">
+ <soap:fault name="authorizationFailure" use="literal"/>
+ </wsdl:fault>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:service name="CreditCardPaymentService">
+ <wsdl:port name="CreditCardPaymentPort" binding="tns:CreditCardPaymentBinding">
+ <soap:address location="http://localhost:8080/CreditCardPayment" />
+ </wsdl:port>
+ </wsdl:service>
+
+ <plnk:partnerLinkType name="CreditCardPaymentLinkType">
+ <plnk:role name="forward" portType="tns:CreditCardPayment"/>
+ </plnk:partnerLinkType>
+</wsdl:definitions>
\ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-policy/src/main/resources/META-INF/sca-contribution.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-policy/src/main/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..0fd7cb9910 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-policy/src/main/resources/META-INF/sca-contribution.xml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0" + xmlns:scatours="http://tuscanyscatours.com/"> + <export.java package="com.tuscanyscatours.payment" /> + <deployable composite="scatours:payment" /> +</contribution> diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-policy/src/main/resources/Payment.wsdl b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-policy/src/main/resources/Payment.wsdl new file mode 100644 index 0000000000..2519d7642e --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-policy/src/main/resources/Payment.wsdl @@ -0,0 +1,83 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<wsdl:definitions name="Payment" + targetNamespace="http://www.tuscanyscatours.com/Payment/" + xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" + xmlns:tns="http://www.tuscanyscatours.com/Payment/" + xmlns:xsd="http://www.w3.org/2001/XMLSchema" + xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" + xmlns:bpws="http://schemas.xmlsoap.org/ws/2004/03/business-process/" + xmlns:plnk="http://schemas.xmlsoap.org/ws/2004/03/partner-link/"> + <wsdl:types> + <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" + targetNamespace="http://www.tuscanyscatours.com/Payment/" + xmlns:tns="http://www.tuscanyscatours.com/Payment/"> + + <xsd:complexType name="MakePaymentMemberType"> + <xsd:sequence> + <xsd:element name="CustomerId" type="xsd:string"></xsd:element> + <xsd:element name="Amount" type="xsd:float"></xsd:element> + </xsd:sequence> + </xsd:complexType> + <xsd:element name="makePaymentMember" type="tns:MakePaymentMemberType"/> + + <xsd:complexType name="MakePaymentMemberResponseType"> + <xsd:sequence> + <xsd:element name="Status" type="xsd:string"></xsd:element> + </xsd:sequence> + </xsd:complexType> + <xsd:element name="makePaymentMemberResponse" type="tns:MakePaymentMemberResponseType"/> + + </xsd:schema> + </wsdl:types> + <wsdl:message name="MakePaymentMemberRequest"> + <wsdl:part name="parameters" element="tns:makePaymentMember"></wsdl:part> + </wsdl:message> + <wsdl:message name="MakePaymentMemberResponse"> + <wsdl:part name="parameters" element="tns:makePaymentMemberResponse"></wsdl:part> + </wsdl:message> + <wsdl:portType name="Payment"> + <wsdl:operation name="makePaymentMember"> + <wsdl:input message="tns:MakePaymentMemberRequest"></wsdl:input> + <wsdl:output message="tns:MakePaymentMemberResponse"></wsdl:output> + </wsdl:operation> + </wsdl:portType> + <wsdl:binding name="PaymentBinding" type="tns:Payment"> + <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" /> + <wsdl:operation name="makePaymentMember"> + <soap:operation soapAction="http://www.tuscanyscatours.com/Payment/makePayment" /> + <wsdl:input> + <soap:body use="literal" /> + </wsdl:input> + <wsdl:output> + <soap:body use="literal" /> + </wsdl:output> + </wsdl:operation> + </wsdl:binding> + <wsdl:service name="PaymentService"> + <wsdl:port name="PaymentPort" binding="tns:PaymentBinding"> + <soap:address location="http://localhost:8083/Payment" /> + </wsdl:port> + </wsdl:service> + + <plnk:partnerLinkType name="PaymentLinkType"> + <plnk:role name="forward" portType="tns:Payment"/> + </plnk:partnerLinkType> +</wsdl:definitions>
\ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-policy/src/main/resources/definitions.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-policy/src/main/resources/definitions.xml new file mode 100644 index 0000000000..edaa250b10 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-policy/src/main/resources/definitions.xml @@ -0,0 +1,48 @@ +<?xml version="1.0" encoding="ASCII"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<definitions xmlns="http://www.osoa.org/xmlns/sca/1.0" + targetNamespace="http://www.osoa.org/xmlns/sca/1.0" + xmlns:sca="http://www.osoa.org/xmlns/sca/1.0" + xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"> + + <!-- Policy Intents Defined by the SCA Runtime --> + <intent name="authorization" constrains="sca:implementation"/> + <intent name="managedTransaction" constrains="sca:implementation"/> + <intent name="managedTransaction.global"/> + + <!-- Policy Sets --> + <policySet name="ps1" + provides="sca:authorization" + appliesTo="sca:implementation.java"/> + + <policySet name="ps2" + provides="sca:managedTransaction.global" + appliesTo="sca:implementation.java"/> + + <policySet name="BasicAuthenticationPolicySet" + provides="authentication" + appliesTo="sca:binding.ws"> + <tuscany:basicAuthentication> + <tuscany:userName>myname</tuscany:userName> + <tuscany:password>mypassword</tuscany:password> + </tuscany:basicAuthentication> + </policySet> + +</definitions> diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-policy/src/main/resources/payment.composite b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-policy/src/main/resources/payment.composite new file mode 100644 index 0000000000..710583ae5d --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-policy/src/main/resources/payment.composite @@ -0,0 +1,48 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" + targetNamespace="http://tuscanyscatours.com/" + name="payment"> + + <component name="Payment"> + <implementation.java class="com.tuscanyscatours.payment.impl.PaymentImpl" /> + <service name="Payment"> + <binding.sca/> + <binding.ws uri="http://localhost:8081/Payment"/> + </service> + <reference name="customerRegistry" target="CustomerRegistry"/> + <!-- reference name="creditCardPayment" policySets="BasicAuthenticationPolicySet"--> + <!-- reference name="creditCardPayment" requires="authentication"--> + <reference name="creditCardPayment"> + <binding.ws uri="http://localhost:8082/CreditCardPayment"/> + </reference> + <reference name="emailGateway" target="EmailGateway"/> + <property name="transactionFee">0.02</property> + </component> + + <component name="CustomerRegistry"> + <implementation.java class="com.tuscanyscatours.customer.impl.CustomerRegistryImpl" /> + </component> + + <component name="EmailGateway"> + <implementation.java class="com.tuscanyscatours.emailgateway.impl.EmailGatewayImpl" /> + </component> + +</composite>
\ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-policy/src/test/java/scatours/payment/PaymentTestCase.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-policy/src/test/java/scatours/payment/PaymentTestCase.java new file mode 100644 index 0000000000..5539d6b1fe --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-policy/src/test/java/scatours/payment/PaymentTestCase.java @@ -0,0 +1,89 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package scatours.payment; + +import org.apache.tuscany.sca.node.SCAClient; +import org.apache.tuscany.sca.node.SCAContribution; +import org.apache.tuscany.sca.node.SCANode; +import org.apache.tuscany.sca.node.SCANodeFactory; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Ignore; +import org.junit.Test; + +import com.tuscanyscatours.payment.Payment; + +public class PaymentTestCase { + private static SCANode node1; + private static SCANode node2; + + @BeforeClass + public static void setUpBeforeClass() throws Exception { + node1 = + SCANodeFactory.newInstance() + .createSCANode("payment.composite", + new SCAContribution("payment", "./target/classes")); + node2 = + SCANodeFactory.newInstance() + .createSCANode("creditcard.composite", + new SCAContribution("creditcard", + "../../contributions/creditcard-payment-jaxb/target/classes")); + node1.start(); + node2.start(); + } + + @Test + public void testPayment() { + SCAClient client = (SCAClient)node1; + Payment payment = client.getService(Payment.class, "Payment"); + + String result = payment.makePaymentMember("c-0", 100.00f); + System.out.println("\n\nSuccessful Payment - Status = \n\n" + result); + if (!"OK".equals(result)) { + throw new RuntimeException(result); + } + System.out.println("\n\nFailed Payment - Status = \n\n" + payment.makePaymentMember("c-1", 100.00f)); + } + + @Test + @Ignore + public void testWaitForInput() { + System.out.println("Press a key to end"); + try { + System.in.read(); + } catch (Exception ex) { + } + System.out.println("Shutting down"); + } + + @AfterClass + public static void tearDownAfterClass() throws Exception { + if (node1 != null) { + node1.stop(); + node1 = null; + } + + if (node2 != null) { + node2.stop(); + node2 = null; + } + } + +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-reference-pass/build.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-reference-pass/build.xml new file mode 100644 index 0000000000..2873b6790a --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-reference-pass/build.xml @@ -0,0 +1,30 @@ +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> + +<project name="scatours-contribution-payment-java-reference-pass" default="compile"> + <import file="../../antdefs.xml"/> + + <target name="wsdljava"> + <antcall target="wsimport"> + <param name="wsdlfile" value="Payment.wsdl"/> + <param name="javaclass" value="com/tuscanyscatours/payment/Payment.class"/> + <param name="package" value="com.tuscanyscatours.payment"/> + </antcall> + </target> +</project> diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-reference-pass/pom.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-reference-pass/pom.xml new file mode 100644 index 0000000000..a90061ffe9 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-reference-pass/pom.xml @@ -0,0 +1,136 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<project> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>scatours</artifactId> + <version>1.0-SNAPSHOT</version> + <relativePath>../../pom.xml</relativePath> + </parent> + <version>1.0-SNAPSHOT</version> + <artifactId>scatours-contribution-payment-java-reference-pass</artifactId> + <name>Apache Tuscany SCA Tours Payment Java Reference Pass</name> + + <dependencies> + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-sca-api</artifactId> + <version>${tuscany.version}</version> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-implementation-java-runtime</artifactId> + <version>${tuscany.version}</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-binding-ws-axis2</artifactId> + <version>${tuscany.version}</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-node-impl</artifactId> + <version>${tuscany.version}</version> + <scope>test</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-host-jetty</artifactId> + <version>${tuscany.version}</version> + <scope>test</scope> + </dependency> + + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>4.5</version> + <scope>test</scope> + </dependency> + + </dependencies> + + <pluginRepositories> + <pluginRepository> + <id>java.net2</id> + <name>java.net Maven 2.x Repository</name> + <url>http://download.java.net/maven/2</url> + <snapshots> + <enabled>false</enabled> + </snapshots> + </pluginRepository> + </pluginRepositories> + + <build> + <finalName>${artifactId}</finalName> + <plugins> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>build-helper-maven-plugin</artifactId> + <version>1.0</version> + <executions> + <execution> + <id>add-source</id> + <phase>generate-sources</phase> + <goals> + <goal>add-source</goal> + </goals> + <configuration> + <sources> + <source>target/jaxws-source</source> + </sources> + </configuration> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>jaxws-maven-plugin</artifactId> + <version>1.12</version> + <executions> + <execution> + <id>payment</id> + <phase>generate-sources</phase> + <goals> + <goal>wsimport</goal> + </goals> + <configuration> + <packageName>com.tuscanyscatours.payment</packageName> + <wsdlDirectory>${basedir}/src/main/resources</wsdlDirectory> + <wsdlFiles> + <wsdlFile>Payment.wsdl</wsdlFile> + </wsdlFiles> + <sourceDestDir>${project.build.directory}/jaxws-source</sourceDestDir> + <staleFile>${project.build.directory}/jaxws-source/stale/payment.stale</staleFile> + <verbose>false</verbose> + <xnocompile>true</xnocompile> + </configuration> + </execution> + </executions> + </plugin> + </plugins> + </build> +</project> diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-reference-pass/src/main/java/com/tuscanyscatours/customer/Customer.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-reference-pass/src/main/java/com/tuscanyscatours/customer/Customer.java new file mode 100644 index 0000000000..3b72f81b33 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-reference-pass/src/main/java/com/tuscanyscatours/customer/Customer.java @@ -0,0 +1,70 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package com.tuscanyscatours.customer; + +import com.tuscanyscatours.payment.creditcard.CreditCardDetailsType; + +/** + * Customer data + */ +public class Customer { + private String id; + private String email; + private String name; + + private CreditCardDetailsType creditCard; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public CreditCardDetailsType getCreditCard() { + return creditCard; + } + + public void setCreditCard(CreditCardDetailsType creditCard) { + this.creditCard = creditCard; + } + + public String toString() { + return "id: " + id + " name: " + name + " e-mail: " + email; + } + +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-reference-pass/src/main/java/com/tuscanyscatours/customer/CustomerNotFoundException.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-reference-pass/src/main/java/com/tuscanyscatours/customer/CustomerNotFoundException.java new file mode 100644 index 0000000000..b08f76e0fa --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-reference-pass/src/main/java/com/tuscanyscatours/customer/CustomerNotFoundException.java @@ -0,0 +1,57 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package com.tuscanyscatours.customer; + +public class CustomerNotFoundException extends Exception { + private static final long serialVersionUID = -129752837478357452L; + + /** + * + */ + public CustomerNotFoundException() { + + } + + /** + * @param message + */ + public CustomerNotFoundException(String message) { + super(message); + + } + + /** + * @param cause + */ + public CustomerNotFoundException(Throwable cause) { + super(cause); + + } + + /** + * @param message + * @param cause + */ + public CustomerNotFoundException(String message, Throwable cause) { + super(message, cause); + + } + +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-reference-pass/src/main/java/com/tuscanyscatours/customer/CustomerRegistry.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-reference-pass/src/main/java/com/tuscanyscatours/customer/CustomerRegistry.java new file mode 100644 index 0000000000..706167d567 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-reference-pass/src/main/java/com/tuscanyscatours/customer/CustomerRegistry.java @@ -0,0 +1,39 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package com.tuscanyscatours.customer; + +import java.util.Collection; + +import com.tuscanyscatours.payment.creditcard.CreditCardDetailsType; + +/** + * Customer registry interface + */ +public interface CustomerRegistry { + Customer createCustomer(String name, String email, CreditCardDetailsType creditCard); + + boolean updateCustomer(Customer customer); + + Customer getCustomer(String id) throws CustomerNotFoundException; + + Collection<Customer> getAllCustomers(); + + boolean deleteCustomer(String id); +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-reference-pass/src/main/java/com/tuscanyscatours/customer/impl/CustomerRegistryImpl.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-reference-pass/src/main/java/com/tuscanyscatours/customer/impl/CustomerRegistryImpl.java new file mode 100644 index 0000000000..bdf99dec72 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-reference-pass/src/main/java/com/tuscanyscatours/customer/impl/CustomerRegistryImpl.java @@ -0,0 +1,114 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package com.tuscanyscatours.customer.impl; + +import java.util.Collection; +import java.util.HashMap; +import java.util.Map; + +import org.osoa.sca.annotations.Destroy; +import org.osoa.sca.annotations.EagerInit; +import org.osoa.sca.annotations.Init; +import org.osoa.sca.annotations.Requires; +import org.osoa.sca.annotations.Scope; +import org.osoa.sca.annotations.Service; + +import com.tuscanyscatours.customer.Customer; +import com.tuscanyscatours.customer.CustomerNotFoundException; +import com.tuscanyscatours.customer.CustomerRegistry; +import com.tuscanyscatours.payment.creditcard.CreditCardDetailsType; +import com.tuscanyscatours.payment.creditcard.CreditCardTypeType; +import com.tuscanyscatours.payment.creditcard.PayerType; + +/** + * An in-memory customer registry implementation + */ +@Service(CustomerRegistry.class) +@Scope("COMPOSITE") +@EagerInit +@Requires("{http://www.osoa.org/xmlns/sca/1.0}managedTransaction.global") +public class CustomerRegistryImpl implements CustomerRegistry { + private volatile static int idGenerator = 0; + private Map<String, Customer> customers = new HashMap<String, Customer>(); + + @Init + public void init() { + // Load the customers + + CreditCardDetailsType cc = new CreditCardDetailsType(); + PayerType john = new PayerType(); + john.setName("John Smith"); + cc.setCardOwner(john); + cc.setCreditCardNumber("1111-2222-3333-4444"); + cc.setCreditCardType(CreditCardTypeType.VISA); + cc.setCVV2("1234"); + cc.setExpMonth(1); + cc.setExpYear(2012); + createCustomer("John Smith", "john@xyz.com", cc); + } + + @Destroy + public void destroy() { + // Save the customers + } + + public Customer createCustomer(String name, String email, CreditCardDetailsType creditCard) { + Customer customer = new Customer(); + customer.setId("c-" + idGenerator++); + customer.setName(name); + customer.setEmail(email); + customer.setCreditCard(creditCard); + customers.put(customer.getId(), customer); + return customer; + } + + public boolean deleteCustomer(String id) { + return customers.remove(id) != null; + } + + public Collection<Customer> getAllCustomers() { + return customers.values(); + } + + public Customer getCustomer(String id) throws CustomerNotFoundException { + Customer customer = customers.get(id); + + if (customer == null) { + throw new CustomerNotFoundException("Customer " + id + " not found"); + } + + return customer; + } + + public boolean updateCustomer(Customer customer) { + Customer current = null; + try { + current = getCustomer(customer.getId()); + } catch (Exception ex) { + return false; + } + + current.setEmail(customer.getEmail()); + current.setName(customer.getName()); + current.setCreditCard(customer.getCreditCard()); + return true; + } + +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-reference-pass/src/main/java/com/tuscanyscatours/emailgateway/EmailGateway.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-reference-pass/src/main/java/com/tuscanyscatours/emailgateway/EmailGateway.java new file mode 100644 index 0000000000..0fbf63d6bc --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-reference-pass/src/main/java/com/tuscanyscatours/emailgateway/EmailGateway.java @@ -0,0 +1,30 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package com.tuscanyscatours.emailgateway; + +import org.osoa.sca.annotations.Remotable; + +/** + * A gateway to send e-mail + */ +@Remotable +public interface EmailGateway { + public boolean sendEmail(String sender, String recipient, String subject, String body); +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-reference-pass/src/main/java/com/tuscanyscatours/emailgateway/impl/EmailGatewayImpl.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-reference-pass/src/main/java/com/tuscanyscatours/emailgateway/impl/EmailGatewayImpl.java new file mode 100644 index 0000000000..d9798e436a --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-reference-pass/src/main/java/com/tuscanyscatours/emailgateway/impl/EmailGatewayImpl.java @@ -0,0 +1,37 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package com.tuscanyscatours.emailgateway.impl; + +import org.osoa.sca.annotations.Service; + +import com.tuscanyscatours.emailgateway.EmailGateway; + +@Service(EmailGateway.class) +public class EmailGatewayImpl implements EmailGateway { + + public boolean sendEmail(String sender, String recipient, String subject, String body) { + System.out.println("From: " + sender); + System.out.println("To: " + recipient); + System.out.println("Subject: " + subject); + System.out.println(body); + return true; + } + +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-reference-pass/src/main/java/com/tuscanyscatours/payment/creditcard/AddressType.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-reference-pass/src/main/java/com/tuscanyscatours/payment/creditcard/AddressType.java new file mode 100644 index 0000000000..ca3724a4f5 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-reference-pass/src/main/java/com/tuscanyscatours/payment/creditcard/AddressType.java @@ -0,0 +1,191 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package com.tuscanyscatours.payment.creditcard; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + + +/** + * <p>Java class for AddressType complex type. + * + * <p>The following schema fragment specifies the expected content contained within this class. + * + * <pre> + * <complexType name="AddressType"> + * <complexContent> + * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> + * <sequence> + * <element name="Street" type="{http://www.w3.org/2001/XMLSchema}string"/> + * <element name="City" type="{http://www.w3.org/2001/XMLSchema}string"/> + * <element name="State" type="{http://www.w3.org/2001/XMLSchema}string"/> + * <element name="ZipCode" type="{http://www.w3.org/2001/XMLSchema}string"/> + * <element name="HomePhone" type="{http://www.w3.org/2001/XMLSchema}string"/> + * </sequence> + * </restriction> + * </complexContent> + * </complexType> + * </pre> + * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "AddressType", propOrder = { + "street", + "city", + "state", + "zipCode", + "homePhone" +}) +public class AddressType { + + @XmlElement(name = "Street", required = true) + protected String street; + @XmlElement(name = "City", required = true) + protected String city; + @XmlElement(name = "State", required = true) + protected String state; + @XmlElement(name = "ZipCode", required = true) + protected String zipCode; + @XmlElement(name = "HomePhone", required = true) + protected String homePhone; + + /** + * Gets the value of the street property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getStreet() { + return street; + } + + /** + * Sets the value of the street property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setStreet(String value) { + this.street = value; + } + + /** + * Gets the value of the city property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCity() { + return city; + } + + /** + * Sets the value of the city property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCity(String value) { + this.city = value; + } + + /** + * Gets the value of the state property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getState() { + return state; + } + + /** + * Sets the value of the state property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setState(String value) { + this.state = value; + } + + /** + * Gets the value of the zipCode property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getZipCode() { + return zipCode; + } + + /** + * Sets the value of the zipCode property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setZipCode(String value) { + this.zipCode = value; + } + + /** + * Gets the value of the homePhone property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getHomePhone() { + return homePhone; + } + + /** + * Sets the value of the homePhone property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setHomePhone(String value) { + this.homePhone = value; + } + +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-reference-pass/src/main/java/com/tuscanyscatours/payment/creditcard/Authorize.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-reference-pass/src/main/java/com/tuscanyscatours/payment/creditcard/Authorize.java new file mode 100644 index 0000000000..7c0b38198e --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-reference-pass/src/main/java/com/tuscanyscatours/payment/creditcard/Authorize.java @@ -0,0 +1,101 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package com.tuscanyscatours.payment.creditcard; + +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; + + +/** + * <p>Java class for anonymous complex type. + * + * <p>The following schema fragment specifies the expected content contained within this class. + * + * <pre> + * <complexType> + * <complexContent> + * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> + * <sequence> + * <element name="CreditCard" type="{http://www.tuscanyscatours.com/CreditCardPayment/}CreditCardDetailsType"/> + * <element name="Amount" type="{http://www.w3.org/2001/XMLSchema}float"/> + * </sequence> + * </restriction> + * </complexContent> + * </complexType> + * </pre> + * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "creditCard", + "amount" +}) +@XmlRootElement(name = "authorize") +public class Authorize { + + @XmlElement(name = "CreditCard", required = true) + protected CreditCardDetailsType creditCard; + @XmlElement(name = "Amount") + protected float amount; + + /** + * Gets the value of the creditCard property. + * + * @return + * possible object is + * {@link CreditCardDetailsType } + * + */ + public CreditCardDetailsType getCreditCard() { + return creditCard; + } + + /** + * Sets the value of the creditCard property. + * + * @param value + * allowed object is + * {@link CreditCardDetailsType } + * + */ + public void setCreditCard(CreditCardDetailsType value) { + this.creditCard = value; + } + + /** + * Gets the value of the amount property. + * + */ + public float getAmount() { + return amount; + } + + /** + * Sets the value of the amount property. + * + */ + public void setAmount(float value) { + this.amount = value; + } + +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-reference-pass/src/main/java/com/tuscanyscatours/payment/creditcard/AuthorizeFault.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-reference-pass/src/main/java/com/tuscanyscatours/payment/creditcard/AuthorizeFault.java new file mode 100644 index 0000000000..84278aa508 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-reference-pass/src/main/java/com/tuscanyscatours/payment/creditcard/AuthorizeFault.java @@ -0,0 +1,81 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package com.tuscanyscatours.payment.creditcard; + +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; + + +/** + * <p>Java class for anonymous complex type. + * + * <p>The following schema fragment specifies the expected content contained within this class. + * + * <pre> + * <complexType> + * <complexContent> + * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> + * <sequence> + * <element name="errorCode" type="{http://www.w3.org/2001/XMLSchema}string"/> + * </sequence> + * </restriction> + * </complexContent> + * </complexType> + * </pre> + * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "errorCode" +}) +@XmlRootElement(name = "authorizeFault") +public class AuthorizeFault { + + @XmlElement(required = true) + protected String errorCode; + + /** + * Gets the value of the errorCode property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getErrorCode() { + return errorCode; + } + + /** + * Sets the value of the errorCode property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setErrorCode(String value) { + this.errorCode = value; + } + +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-reference-pass/src/main/java/com/tuscanyscatours/payment/creditcard/AuthorizeFault_Exception.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-reference-pass/src/main/java/com/tuscanyscatours/payment/creditcard/AuthorizeFault_Exception.java new file mode 100644 index 0000000000..ec0f8768da --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-reference-pass/src/main/java/com/tuscanyscatours/payment/creditcard/AuthorizeFault_Exception.java @@ -0,0 +1,71 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package com.tuscanyscatours.payment.creditcard; + +import javax.xml.ws.WebFault; + + +/** + * This class was generated by the JAX-WS RI. + * JAX-WS RI 2.1.7-b01- + * Generated source version: 2.1 + * + */ +@WebFault(name = "authorizeFault", targetNamespace = "http://www.tuscanyscatours.com/CreditCardPayment/") +public class AuthorizeFault_Exception + extends Exception +{ + + /** + * Java type that goes as soapenv:Fault detail element. + * + */ + private AuthorizeFault faultInfo; + + /** + * + * @param message + * @param faultInfo + */ + public AuthorizeFault_Exception(String message, AuthorizeFault faultInfo) { + super(message); + this.faultInfo = faultInfo; + } + + /** + * + * @param message + * @param faultInfo + * @param cause + */ + public AuthorizeFault_Exception(String message, AuthorizeFault faultInfo, Throwable cause) { + super(message, cause); + this.faultInfo = faultInfo; + } + + /** + * + * @return + * returns fault bean: com.tuscanyscatours.payment.creditcard.AuthorizeFault + */ + public AuthorizeFault getFaultInfo() { + return faultInfo; + } + +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-reference-pass/src/main/java/com/tuscanyscatours/payment/creditcard/AuthorizeResponse.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-reference-pass/src/main/java/com/tuscanyscatours/payment/creditcard/AuthorizeResponse.java new file mode 100644 index 0000000000..05f3479804 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-reference-pass/src/main/java/com/tuscanyscatours/payment/creditcard/AuthorizeResponse.java @@ -0,0 +1,81 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package com.tuscanyscatours.payment.creditcard; + +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; + + +/** + * <p>Java class for anonymous complex type. + * + * <p>The following schema fragment specifies the expected content contained within this class. + * + * <pre> + * <complexType> + * <complexContent> + * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> + * <sequence> + * <element name="Status" type="{http://www.w3.org/2001/XMLSchema}string"/> + * </sequence> + * </restriction> + * </complexContent> + * </complexType> + * </pre> + * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "status" +}) +@XmlRootElement(name = "authorizeResponse") +public class AuthorizeResponse { + + @XmlElement(name = "Status", required = true) + protected String status; + + /** + * Gets the value of the status property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getStatus() { + return status; + } + + /** + * Sets the value of the status property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setStatus(String value) { + this.status = value; + } + +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-reference-pass/src/main/java/com/tuscanyscatours/payment/creditcard/CreditCardDetailsType.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-reference-pass/src/main/java/com/tuscanyscatours/payment/creditcard/CreditCardDetailsType.java new file mode 100644 index 0000000000..8bac29f6bd --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-reference-pass/src/main/java/com/tuscanyscatours/payment/creditcard/CreditCardDetailsType.java @@ -0,0 +1,219 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package com.tuscanyscatours.payment.creditcard; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + + +/** + * <p>Java class for CreditCardDetailsType complex type. + * + * <p>The following schema fragment specifies the expected content contained within this class. + * + * <pre> + * <complexType name="CreditCardDetailsType"> + * <complexContent> + * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> + * <sequence> + * <element name="CreditCardType" type="{http://www.tuscanyscatours.com/CreditCardPayment/}CreditCardTypeType" minOccurs="0"/> + * <element name="CreditCardNumber" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> + * <element name="ExpMonth" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/> + * <element name="ExpYear" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/> + * <element name="CardOwner" type="{http://www.tuscanyscatours.com/CreditCardPayment/}PayerType" minOccurs="0"/> + * <element name="CVV2" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> + * </sequence> + * </restriction> + * </complexContent> + * </complexType> + * </pre> + * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "CreditCardDetailsType", propOrder = { + "creditCardType", + "creditCardNumber", + "expMonth", + "expYear", + "cardOwner", + "cvv2" +}) +public class CreditCardDetailsType { + + @XmlElement(name = "CreditCardType") + protected CreditCardTypeType creditCardType; + @XmlElement(name = "CreditCardNumber") + protected String creditCardNumber; + @XmlElement(name = "ExpMonth") + protected Integer expMonth; + @XmlElement(name = "ExpYear") + protected Integer expYear; + @XmlElement(name = "CardOwner") + protected PayerType cardOwner; + @XmlElement(name = "CVV2") + protected String cvv2; + + /** + * Gets the value of the creditCardType property. + * + * @return + * possible object is + * {@link CreditCardTypeType } + * + */ + public CreditCardTypeType getCreditCardType() { + return creditCardType; + } + + /** + * Sets the value of the creditCardType property. + * + * @param value + * allowed object is + * {@link CreditCardTypeType } + * + */ + public void setCreditCardType(CreditCardTypeType value) { + this.creditCardType = value; + } + + /** + * Gets the value of the creditCardNumber property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCreditCardNumber() { + return creditCardNumber; + } + + /** + * Sets the value of the creditCardNumber property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCreditCardNumber(String value) { + this.creditCardNumber = value; + } + + /** + * Gets the value of the expMonth property. + * + * @return + * possible object is + * {@link Integer } + * + */ + public Integer getExpMonth() { + return expMonth; + } + + /** + * Sets the value of the expMonth property. + * + * @param value + * allowed object is + * {@link Integer } + * + */ + public void setExpMonth(Integer value) { + this.expMonth = value; + } + + /** + * Gets the value of the expYear property. + * + * @return + * possible object is + * {@link Integer } + * + */ + public Integer getExpYear() { + return expYear; + } + + /** + * Sets the value of the expYear property. + * + * @param value + * allowed object is + * {@link Integer } + * + */ + public void setExpYear(Integer value) { + this.expYear = value; + } + + /** + * Gets the value of the cardOwner property. + * + * @return + * possible object is + * {@link PayerType } + * + */ + public PayerType getCardOwner() { + return cardOwner; + } + + /** + * Sets the value of the cardOwner property. + * + * @param value + * allowed object is + * {@link PayerType } + * + */ + public void setCardOwner(PayerType value) { + this.cardOwner = value; + } + + /** + * Gets the value of the cvv2 property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCVV2() { + return cvv2; + } + + /** + * Sets the value of the cvv2 property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCVV2(String value) { + this.cvv2 = value; + } + +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-reference-pass/src/main/java/com/tuscanyscatours/payment/creditcard/CreditCardPayment.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-reference-pass/src/main/java/com/tuscanyscatours/payment/creditcard/CreditCardPayment.java new file mode 100644 index 0000000000..8150b3ccfd --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-reference-pass/src/main/java/com/tuscanyscatours/payment/creditcard/CreditCardPayment.java @@ -0,0 +1,36 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package com.tuscanyscatours.payment.creditcard; + +import org.osoa.sca.ServiceReference; +import org.osoa.sca.annotations.Remotable; + +import com.tuscanyscatours.emailgateway.EmailGateway; + +@Remotable +public interface CreditCardPayment { + + public String authorize(CreditCardDetailsType ccDetails, + float amount, + ServiceReference<EmailGateway> emailGateway, + String emailAddress) + throws AuthorizeFault_Exception; + +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-reference-pass/src/main/java/com/tuscanyscatours/payment/creditcard/CreditCardTypeType.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-reference-pass/src/main/java/com/tuscanyscatours/payment/creditcard/CreditCardTypeType.java new file mode 100644 index 0000000000..0467078279 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-reference-pass/src/main/java/com/tuscanyscatours/payment/creditcard/CreditCardTypeType.java @@ -0,0 +1,74 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package com.tuscanyscatours.payment.creditcard; + +import javax.xml.bind.annotation.XmlEnum; +import javax.xml.bind.annotation.XmlEnumValue; +import javax.xml.bind.annotation.XmlType; + + +/** + * <p>Java class for CreditCardTypeType. + * + * <p>The following schema fragment specifies the expected content contained within this class. + * <p> + * <pre> + * <simpleType name="CreditCardTypeType"> + * <restriction base="{http://www.w3.org/2001/XMLSchema}token"> + * <enumeration value="Visa"/> + * <enumeration value="MasterCard"/> + * <enumeration value="Discover"/> + * <enumeration value="Amex"/> + * </restriction> + * </simpleType> + * </pre> + * + */ +@XmlType(name = "CreditCardTypeType") +@XmlEnum +public enum CreditCardTypeType { + + @XmlEnumValue("Visa") + VISA("Visa"), + @XmlEnumValue("MasterCard") + MASTER_CARD("MasterCard"), + @XmlEnumValue("Discover") + DISCOVER("Discover"), + @XmlEnumValue("Amex") + AMEX("Amex"); + private final String value; + + CreditCardTypeType(String v) { + value = v; + } + + public String value() { + return value; + } + + public static CreditCardTypeType fromValue(String v) { + for (CreditCardTypeType c: CreditCardTypeType.values()) { + if (c.value.equals(v)) { + return c; + } + } + throw new IllegalArgumentException(v); + } + +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-reference-pass/src/main/java/com/tuscanyscatours/payment/creditcard/PayerType.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-reference-pass/src/main/java/com/tuscanyscatours/payment/creditcard/PayerType.java new file mode 100644 index 0000000000..f36fe35bdf --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-reference-pass/src/main/java/com/tuscanyscatours/payment/creditcard/PayerType.java @@ -0,0 +1,107 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package com.tuscanyscatours.payment.creditcard; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + + +/** + * <p>Java class for PayerType complex type. + * + * <p>The following schema fragment specifies the expected content contained within this class. + * + * <pre> + * <complexType name="PayerType"> + * <complexContent> + * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> + * <sequence> + * <element name="Name" type="{http://www.w3.org/2001/XMLSchema}string"/> + * <element name="Address" type="{http://www.tuscanyscatours.com/CreditCardPayment/}AddressType"/> + * </sequence> + * </restriction> + * </complexContent> + * </complexType> + * </pre> + * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "PayerType", propOrder = { + "name", + "address" +}) +public class PayerType { + + @XmlElement(name = "Name", required = true) + protected String name; + @XmlElement(name = "Address", required = true) + protected AddressType address; + + /** + * Gets the value of the name property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getName() { + return name; + } + + /** + * Sets the value of the name property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setName(String value) { + this.name = value; + } + + /** + * Gets the value of the address property. + * + * @return + * possible object is + * {@link AddressType } + * + */ + public AddressType getAddress() { + return address; + } + + /** + * Sets the value of the address property. + * + * @param value + * allowed object is + * {@link AddressType } + * + */ + public void setAddress(AddressType value) { + this.address = value; + } + +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-reference-pass/src/main/java/com/tuscanyscatours/payment/creditcard/impl/CreditCardPaymentImpl.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-reference-pass/src/main/java/com/tuscanyscatours/payment/creditcard/impl/CreditCardPaymentImpl.java new file mode 100644 index 0000000000..46b51f40c8 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-reference-pass/src/main/java/com/tuscanyscatours/payment/creditcard/impl/CreditCardPaymentImpl.java @@ -0,0 +1,47 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package com.tuscanyscatours.payment.creditcard.impl; + +import org.osoa.sca.ServiceReference; +import org.osoa.sca.annotations.Service; + +import com.tuscanyscatours.emailgateway.EmailGateway; +import com.tuscanyscatours.payment.creditcard.CreditCardDetailsType; +import com.tuscanyscatours.payment.creditcard.CreditCardPayment; + +@Service(CreditCardPayment.class) +public class CreditCardPaymentImpl implements CreditCardPayment { + + public String authorize(CreditCardDetailsType card, + float amount, + ServiceReference<EmailGateway> emailGateway, + String emailAddress) { + + // payment processing + + emailGateway.getService().sendEmail("order@tuscanyscatours.com", + emailAddress, + "Status for your payment", + "Authorized"); + + return "OK"; + } + +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-reference-pass/src/main/java/com/tuscanyscatours/payment/impl/PaymentImpl.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-reference-pass/src/main/java/com/tuscanyscatours/payment/impl/PaymentImpl.java new file mode 100644 index 0000000000..089ea4a183 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-reference-pass/src/main/java/com/tuscanyscatours/payment/impl/PaymentImpl.java @@ -0,0 +1,76 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package com.tuscanyscatours.payment.impl; + +import org.osoa.sca.ServiceReference; +import org.osoa.sca.annotations.Property; +import org.osoa.sca.annotations.Reference; +import org.osoa.sca.annotations.Service; + +import com.tuscanyscatours.customer.Customer; +import com.tuscanyscatours.customer.CustomerNotFoundException; +import com.tuscanyscatours.customer.CustomerRegistry; +import com.tuscanyscatours.emailgateway.EmailGateway; +import com.tuscanyscatours.payment.Payment; +import com.tuscanyscatours.payment.creditcard.AuthorizeFault_Exception; +import com.tuscanyscatours.payment.creditcard.CreditCardPayment; + +/** + * The payment implementation + */ +@Service(Payment.class) +public class PaymentImpl implements Payment { + + @Reference + protected CustomerRegistry customerRegistry; + + @Reference + protected CreditCardPayment creditCardPayment; + + @Reference + protected ServiceReference<EmailGateway> emailGateway; + + @Property + protected float transactionFee = 0.01f; + + public String makePaymentMember(String customerId, float amount) { + try { + Customer customer = customerRegistry.getCustomer(customerId); + String status = creditCardPayment.authorize(customer.getCreditCard(), + amount + transactionFee, + emailGateway, + customer.getEmail()); + return status; + } catch (CustomerNotFoundException ex) { + return "Payment failed due to " + ex.getMessage(); + } catch (AuthorizeFault_Exception e) { + return e.getFaultInfo().getErrorCode(); + } catch (Throwable t) { + return "Payment failed due to system error " + t.getMessage(); + } + } + + public String checkSecurity(String securityPrompt) { + System.out.println("Extra securiy - " + securityPrompt); + System.out.println("password = abcxyz"); + return "abcxyz"; + } + +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-reference-pass/src/main/resources/CreditCardPayment.wsdl b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-reference-pass/src/main/resources/CreditCardPayment.wsdl new file mode 100644 index 0000000000..08be3dc2e2 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-reference-pass/src/main/resources/CreditCardPayment.wsdl @@ -0,0 +1,132 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<wsdl:definitions name="CreditCardPayment" + targetNamespace="http://www.tuscanyscatours.com/CreditCardPayment/" + xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" + xmlns:tns="http://www.tuscanyscatours.com/CreditCardPayment/" + xmlns:xsd="http://www.w3.org/2001/XMLSchema" + xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" + xmlns:bpws="http://schemas.xmlsoap.org/ws/2004/03/business-process/" + xmlns:plnk="http://schemas.xmlsoap.org/ws/2004/03/partner-link/"> + <wsdl:types> + <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" + targetNamespace="http://www.tuscanyscatours.com/CreditCardPayment/" + xmlns:tns="http://www.tuscanyscatours.com/CreditCardPayment/"> + + <xsd:element name="authorize"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="CreditCard" type="tns:CreditCardDetailsType"></xsd:element> + <xsd:element name="Amount" type="xsd:float"></xsd:element> + </xsd:sequence> + </xsd:complexType> + </xsd:element> + + <xsd:element name="authorizeResponse"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="Status" type="xsd:string"></xsd:element> + </xsd:sequence> + </xsd:complexType> + </xsd:element> + + <xsd:complexType name="CreditCardDetailsType"> + <xsd:sequence> + <xsd:element name="CreditCardType" type="tns:CreditCardTypeType" minOccurs="0" /> + <xsd:element name="CreditCardNumber" type="xsd:string" minOccurs="0" /> + <xsd:element name="ExpMonth" type="xsd:int" minOccurs="0" /> + <xsd:element name="ExpYear" type="xsd:int" minOccurs="0" /> + <xsd:element name="CardOwner" type="tns:PayerType" minOccurs="0" /> + <xsd:element name="CVV2" type="xsd:string" minOccurs="0" /> + </xsd:sequence> + </xsd:complexType> + <xsd:simpleType name="CreditCardTypeType"> + <xsd:restriction base="xsd:token"> + <xsd:enumeration value="Visa" /> + <xsd:enumeration value="MasterCard" /> + <xsd:enumeration value="Discover" /> + <xsd:enumeration value="Amex" /> + </xsd:restriction> + </xsd:simpleType> + <xsd:complexType name="PayerType"> + <xsd:sequence> + <xsd:element name="Name" type="xsd:string" /> + <xsd:element name="Address" type="tns:AddressType" /> + </xsd:sequence> + </xsd:complexType> + <xsd:complexType name="AddressType"> + <xsd:sequence> + <xsd:element name="Street" type="xsd:string" /> + <xsd:element name="City" type="xsd:string" /> + <xsd:element name="State" type="xsd:string" /> + <xsd:element name="ZipCode" type="xsd:string" /> + <xsd:element name="HomePhone" type="xsd:string" /> + </xsd:sequence> + </xsd:complexType> + <xsd:element name="authorizeFault"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="errorCode" type="xsd:string"></xsd:element> + </xsd:sequence> + </xsd:complexType> + </xsd:element> + </xsd:schema> + </wsdl:types> + <wsdl:message name="AuthorizeRequest"> + <wsdl:part name="parameters" element="tns:authorize"></wsdl:part> + </wsdl:message> + <wsdl:message name="AuthorizeResponse"> + <wsdl:part name="parameters" element="tns:authorizeResponse"></wsdl:part> + </wsdl:message> + <wsdl:message name="AuthorizeFault"> + <wsdl:part name="parameters" element="tns:authorizeFault"></wsdl:part> + </wsdl:message> + <wsdl:portType name="CreditCardPayment"> + <wsdl:operation name="authorize"> + <wsdl:input message="tns:AuthorizeRequest"></wsdl:input> + <wsdl:output message="tns:AuthorizeResponse"></wsdl:output> + <wsdl:fault name="authorizationFailure" message="tns:AuthorizeFault"></wsdl:fault> + </wsdl:operation> + </wsdl:portType> + <wsdl:binding name="CreditCardPaymentBinding" type="tns:CreditCardPayment"> + <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" /> + <wsdl:operation name="authorize"> + <soap:operation soapAction="http://www.tuscanyscatours.com/CreditCardPayment/authorize" /> + <wsdl:input> + <soap:body use="literal" /> + </wsdl:input> + <wsdl:output> + <soap:body use="literal" /> + </wsdl:output> + <wsdl:fault name="authorizationFailure"> + <soap:fault name="authorizationFailure" use="literal"/> + </wsdl:fault> + </wsdl:operation> + </wsdl:binding> + <wsdl:service name="CreditCardPaymentService"> + <wsdl:port name="CreditCardPaymentPort" binding="tns:CreditCardPaymentBinding"> + <soap:address location="http://localhost:8080/CreditCardPayment" /> + </wsdl:port> + </wsdl:service> + + <plnk:partnerLinkType name="CreditCardPaymentLinkType"> + <plnk:role name="forward" portType="tns:CreditCardPayment"/> + </plnk:partnerLinkType> +</wsdl:definitions>
\ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-reference-pass/src/main/resources/META-INF/sca-contribution.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-reference-pass/src/main/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..0fd7cb9910 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-reference-pass/src/main/resources/META-INF/sca-contribution.xml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0" + xmlns:scatours="http://tuscanyscatours.com/"> + <export.java package="com.tuscanyscatours.payment" /> + <deployable composite="scatours:payment" /> +</contribution> diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-reference-pass/src/main/resources/Payment.wsdl b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-reference-pass/src/main/resources/Payment.wsdl new file mode 100644 index 0000000000..2519d7642e --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-reference-pass/src/main/resources/Payment.wsdl @@ -0,0 +1,83 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<wsdl:definitions name="Payment" + targetNamespace="http://www.tuscanyscatours.com/Payment/" + xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" + xmlns:tns="http://www.tuscanyscatours.com/Payment/" + xmlns:xsd="http://www.w3.org/2001/XMLSchema" + xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" + xmlns:bpws="http://schemas.xmlsoap.org/ws/2004/03/business-process/" + xmlns:plnk="http://schemas.xmlsoap.org/ws/2004/03/partner-link/"> + <wsdl:types> + <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" + targetNamespace="http://www.tuscanyscatours.com/Payment/" + xmlns:tns="http://www.tuscanyscatours.com/Payment/"> + + <xsd:complexType name="MakePaymentMemberType"> + <xsd:sequence> + <xsd:element name="CustomerId" type="xsd:string"></xsd:element> + <xsd:element name="Amount" type="xsd:float"></xsd:element> + </xsd:sequence> + </xsd:complexType> + <xsd:element name="makePaymentMember" type="tns:MakePaymentMemberType"/> + + <xsd:complexType name="MakePaymentMemberResponseType"> + <xsd:sequence> + <xsd:element name="Status" type="xsd:string"></xsd:element> + </xsd:sequence> + </xsd:complexType> + <xsd:element name="makePaymentMemberResponse" type="tns:MakePaymentMemberResponseType"/> + + </xsd:schema> + </wsdl:types> + <wsdl:message name="MakePaymentMemberRequest"> + <wsdl:part name="parameters" element="tns:makePaymentMember"></wsdl:part> + </wsdl:message> + <wsdl:message name="MakePaymentMemberResponse"> + <wsdl:part name="parameters" element="tns:makePaymentMemberResponse"></wsdl:part> + </wsdl:message> + <wsdl:portType name="Payment"> + <wsdl:operation name="makePaymentMember"> + <wsdl:input message="tns:MakePaymentMemberRequest"></wsdl:input> + <wsdl:output message="tns:MakePaymentMemberResponse"></wsdl:output> + </wsdl:operation> + </wsdl:portType> + <wsdl:binding name="PaymentBinding" type="tns:Payment"> + <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" /> + <wsdl:operation name="makePaymentMember"> + <soap:operation soapAction="http://www.tuscanyscatours.com/Payment/makePayment" /> + <wsdl:input> + <soap:body use="literal" /> + </wsdl:input> + <wsdl:output> + <soap:body use="literal" /> + </wsdl:output> + </wsdl:operation> + </wsdl:binding> + <wsdl:service name="PaymentService"> + <wsdl:port name="PaymentPort" binding="tns:PaymentBinding"> + <soap:address location="http://localhost:8083/Payment" /> + </wsdl:port> + </wsdl:service> + + <plnk:partnerLinkType name="PaymentLinkType"> + <plnk:role name="forward" portType="tns:Payment"/> + </plnk:partnerLinkType> +</wsdl:definitions>
\ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-reference-pass/src/main/resources/definitions.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-reference-pass/src/main/resources/definitions.xml new file mode 100644 index 0000000000..b304bbfc2b --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-reference-pass/src/main/resources/definitions.xml @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="ASCII"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<definitions xmlns="http://www.osoa.org/xmlns/sca/1.0" + targetNamespace="http://www.osoa.org/xmlns/sca/1.0" + xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"> + + <!-- Policy Intents Defined by the SCA Runtime --> + <intent name="authorization" constrains="sca:implementation"/> + <intent name="managedTransaction" constrains="sca:implementation"/> + <intent name="managedTransaction.global"/> + + <!-- Policy intents --> + <policySet name="ps1" provides="sca:authorization" appliesTo="sca:implementation.java"/> + + <policySet name="ps2" provides="sca:managedTransaction.global" appliesTo="sca:implementation.java"/> + +</definitions> diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-reference-pass/src/main/resources/payment.composite b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-reference-pass/src/main/resources/payment.composite new file mode 100644 index 0000000000..92f316804d --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-reference-pass/src/main/resources/payment.composite @@ -0,0 +1,49 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" + targetNamespace="http://tuscanyscatours.com/" + name="payment"> + + + <component name="Payment"> + <implementation.java class="com.tuscanyscatours.payment.impl.PaymentImpl" /> + <service name="Payment"> + <binding.ws uri="http://localhost:8081/Payment" /> + <binding.sca /> + </service> + <reference name="customerRegistry" target="CustomerRegistry" /> + <reference name="creditCardPayment" target="CreditCardPayment"/> + <reference name="emailGateway" target="EmailGateway" /> + <property name="transactionFee">0.02</property> + </component> + + <component name="CustomerRegistry"> + <implementation.java class="com.tuscanyscatours.customer.impl.CustomerRegistryImpl" /> + </component> + + <component name="CreditCardPayment"> + <implementation.java class="com.tuscanyscatours.payment.creditcard.impl.CreditCardPaymentImpl" /> + </component> + + <component name="EmailGateway"> + <implementation.java class="com.tuscanyscatours.emailgateway.impl.EmailGatewayImpl" /> + </component> + +</composite>
\ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-reference-pass/src/test/java/scatours/payment/PaymentTestCase.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-reference-pass/src/test/java/scatours/payment/PaymentTestCase.java new file mode 100644 index 0000000000..52a1469da7 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java-reference-pass/src/test/java/scatours/payment/PaymentTestCase.java @@ -0,0 +1,79 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package scatours.payment; + +import org.apache.tuscany.sca.node.SCAClient; +import org.apache.tuscany.sca.node.SCAContribution; +import org.apache.tuscany.sca.node.SCANode; +import org.apache.tuscany.sca.node.SCANodeFactory; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Ignore; +import org.junit.Test; + +import com.tuscanyscatours.payment.Payment; + +public class PaymentTestCase { + private static SCANode node; + + @BeforeClass + public static void setUpBeforeClass() throws Exception { + node = + SCANodeFactory.newInstance() + .createSCANode(null, + new SCAContribution("payment", "./target/classes")); + node.start(); + } + + @Test + public void testPayment() { + SCAClient client = (SCAClient)node; + Payment payment = client.getService(Payment.class, "Payment"); + + System.out.println("==================================================="); + String result = payment.makePaymentMember("c-0", 100.00f); + System.out.println("\n\nPayment - Status = \n\n" + result); + if (!"OK".equals(result)) { + throw new RuntimeException(result); + } + System.out.println("==================================================="); + + } + + @Test + @Ignore + public void testWaitForInput() { + System.out.println("Press a key to end"); + try { + System.in.read(); + } catch (Exception ex) { + } + System.out.println("Shutting down"); + } + + @AfterClass + public static void tearDownAfterClass() throws Exception { + if (node != null) { + node.stop(); + node = null; + } + } + +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java/build.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java/build.xml new file mode 100644 index 0000000000..4ddd9fbba0 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java/build.xml @@ -0,0 +1,35 @@ +<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<project name="scatours-contribution-payment-java" default="compile">
+ <import file="../../antdefs.xml"/>
+
+ <target name="wsdljava">
+ <antcall target="wsimport">
+ <param name="wsdlfile" value="CreditCardPayment.wsdl"/>
+ <param name="javaclass" value="com/tuscanyscatours/payment/creditcard/CreditCardPayment.class"/>
+ <param name="package" value="com.tuscanyscatours.payment.creditcard"/>
+ </antcall>
+ <antcall target="wsimport">
+ <param name="wsdlfile" value="Payment.wsdl"/>
+ <param name="javaclass" value="com/tuscanyscatours/payment/Payment.class"/>
+ <param name="package" value="com.tuscanyscatours.payment"/>
+ </antcall>
+ </target>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java/pom.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java/pom.xml new file mode 100644 index 0000000000..5e81879131 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java/pom.xml @@ -0,0 +1,154 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<project> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>scatours</artifactId> + <version>1.0-SNAPSHOT</version> + <relativePath>../../pom.xml</relativePath> + </parent> + <version>1.0-SNAPSHOT</version> + <artifactId>scatours-contribution-payment-java</artifactId> + <name>Apache Tuscany SCA Tours Payment Java Contribution</name> + + <dependencies> + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-sca-api</artifactId> + <version>${tuscany.version}</version> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-implementation-java-runtime</artifactId> + <version>${tuscany.version}</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-binding-ws-axis2</artifactId> + <version>${tuscany.version}</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-node-impl</artifactId> + <version>${tuscany.version}</version> + <scope>test</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-host-jetty</artifactId> + <version>${tuscany.version}</version> + <scope>test</scope> + </dependency> + + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>4.5</version> + <scope>test</scope> + </dependency> + + </dependencies> + + <pluginRepositories> + <pluginRepository> + <id>java.net2</id> + <name>java.net Maven 2.x Repository</name> + <url>http://download.java.net/maven/2</url> + <snapshots> + <enabled>false</enabled> + </snapshots> + </pluginRepository> + </pluginRepositories> + + <build> + <finalName>${artifactId}</finalName> + <plugins> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>build-helper-maven-plugin</artifactId> + <version>1.0</version> + <executions> + <execution> + <id>add-source</id> + <phase>generate-sources</phase> + <goals> + <goal>add-source</goal> + </goals> + <configuration> + <sources> + <source>target/jaxws-source</source> + </sources> + </configuration> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>jaxws-maven-plugin</artifactId> + <version>1.12</version> + <executions> + <execution> + <id>payment</id> + <phase>generate-sources</phase> + <goals> + <goal>wsimport</goal> + </goals> + <configuration> + <packageName>com.tuscanyscatours.payment</packageName> + <wsdlDirectory>${basedir}/src/main/resources</wsdlDirectory> + <wsdlFiles> + <wsdlFile>Payment.wsdl</wsdlFile> + </wsdlFiles> + <sourceDestDir>${project.build.directory}/jaxws-source</sourceDestDir> + <staleFile>${project.build.directory}/jaxws-source/stale/payment.stale</staleFile> + <verbose>false</verbose> + <xnocompile>true</xnocompile> + </configuration> + </execution> + <execution> + <id>payment.creditcard</id> + <phase>process-sources</phase> + <goals> + <goal>wsimport</goal> + </goals> + <configuration> + <packageName>com.tuscanyscatours.payment.creditcard</packageName> + <wsdlDirectory>${basedir}/src/main/resources</wsdlDirectory> + <wsdlFiles> + <wsdlFile>CreditCardPayment.wsdl</wsdlFile> + </wsdlFiles> + <sourceDestDir>${project.build.directory}/jaxws-source</sourceDestDir> + <staleFile>${project.build.directory}/jaxws-source/stale/creditcard.stale</staleFile> + <verbose>false</verbose> + <xnocompile>true</xnocompile> + </configuration> + </execution> + </executions> + </plugin> + </plugins> + </build> +</project> diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java/src/main/java/com/tuscanyscatours/customer/Customer.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java/src/main/java/com/tuscanyscatours/customer/Customer.java new file mode 100644 index 0000000000..c97ba8fb9f --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java/src/main/java/com/tuscanyscatours/customer/Customer.java @@ -0,0 +1,70 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package com.tuscanyscatours.customer;
+
+import com.tuscanyscatours.payment.creditcard.CreditCardDetailsType;
+
+/**
+ * Customer data
+ */
+public class Customer {
+ private String id;
+ private String email;
+ private String name;
+
+ private CreditCardDetailsType creditCard;
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getEmail() {
+ return email;
+ }
+
+ public void setEmail(String email) {
+ this.email = email;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public CreditCardDetailsType getCreditCard() {
+ return creditCard;
+ }
+
+ public void setCreditCard(CreditCardDetailsType creditCard) {
+ this.creditCard = creditCard;
+ }
+
+ public String toString() {
+ return "id: " + id + " name: " + name + " e-mail: " + email;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java/src/main/java/com/tuscanyscatours/customer/CustomerNotFoundException.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java/src/main/java/com/tuscanyscatours/customer/CustomerNotFoundException.java new file mode 100644 index 0000000000..7f028c301e --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java/src/main/java/com/tuscanyscatours/customer/CustomerNotFoundException.java @@ -0,0 +1,57 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package com.tuscanyscatours.customer;
+
+public class CustomerNotFoundException extends Exception {
+ private static final long serialVersionUID = -129752837478357452L;
+
+ /**
+ *
+ */
+ public CustomerNotFoundException() {
+
+ }
+
+ /**
+ * @param message
+ */
+ public CustomerNotFoundException(String message) {
+ super(message);
+
+ }
+
+ /**
+ * @param cause
+ */
+ public CustomerNotFoundException(Throwable cause) {
+ super(cause);
+
+ }
+
+ /**
+ * @param message
+ * @param cause
+ */
+ public CustomerNotFoundException(String message, Throwable cause) {
+ super(message, cause);
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java/src/main/java/com/tuscanyscatours/customer/CustomerRegistry.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java/src/main/java/com/tuscanyscatours/customer/CustomerRegistry.java new file mode 100644 index 0000000000..38a2759660 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java/src/main/java/com/tuscanyscatours/customer/CustomerRegistry.java @@ -0,0 +1,39 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package com.tuscanyscatours.customer;
+
+import java.util.Collection;
+
+import com.tuscanyscatours.payment.creditcard.CreditCardDetailsType;
+
+/**
+ * Customer registry interface
+ */
+public interface CustomerRegistry {
+ Customer createCustomer(String name, String email, CreditCardDetailsType creditCard);
+
+ boolean updateCustomer(Customer customer);
+
+ Customer getCustomer(String id) throws CustomerNotFoundException;
+
+ Collection<Customer> getAllCustomers();
+
+ boolean deleteCustomer(String id);
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java/src/main/java/com/tuscanyscatours/customer/impl/CustomerRegistryImpl.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java/src/main/java/com/tuscanyscatours/customer/impl/CustomerRegistryImpl.java new file mode 100644 index 0000000000..bc76f411f3 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java/src/main/java/com/tuscanyscatours/customer/impl/CustomerRegistryImpl.java @@ -0,0 +1,115 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package com.tuscanyscatours.customer.impl;
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.osoa.sca.annotations.Destroy;
+import org.osoa.sca.annotations.EagerInit;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Requires;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+import com.tuscanyscatours.customer.Customer;
+import com.tuscanyscatours.customer.CustomerNotFoundException;
+import com.tuscanyscatours.customer.CustomerRegistry;
+import com.tuscanyscatours.payment.creditcard.CreditCardDetailsType;
+import com.tuscanyscatours.payment.creditcard.CreditCardTypeType;
+import com.tuscanyscatours.payment.creditcard.ObjectFactory;
+import com.tuscanyscatours.payment.creditcard.PayerType;
+
+/**
+ * An in-memory customer registry implementation
+ */
+@Service(CustomerRegistry.class)
+@Scope("COMPOSITE")
+@EagerInit
+@Requires("{http://www.osoa.org/xmlns/sca/1.0}managedTransaction.global")
+public class CustomerRegistryImpl implements CustomerRegistry {
+ private volatile static int idGenerator = 0;
+ private Map<String, Customer> customers = new HashMap<String, Customer>();
+
+ @Init
+ public void init() {
+ // Load the customers
+ ObjectFactory factory = new ObjectFactory();
+ CreditCardDetailsType cc = factory.createCreditCardDetailsType();
+ PayerType john = factory.createPayerType();
+ john.setName("John Smith");
+ cc.setCardOwner(john);
+ cc.setCreditCardNumber("1111-2222-3333-4444");
+ cc.setCreditCardType(CreditCardTypeType.VISA);
+ cc.setCVV2("1234");
+ cc.setExpMonth(1);
+ cc.setExpYear(2012);
+ createCustomer("John Smith", "john@xyz.com", cc);
+ }
+
+ @Destroy
+ public void destroy() {
+ // Save the customers
+ }
+
+ public Customer createCustomer(String name, String email, CreditCardDetailsType creditCard) {
+ Customer customer = new Customer();
+ customer.setId("c-" + idGenerator++);
+ customer.setName(name);
+ customer.setEmail(email);
+ customer.setCreditCard(creditCard);
+ customers.put(customer.getId(), customer);
+ return customer;
+ }
+
+ public boolean deleteCustomer(String id) {
+ return customers.remove(id) != null;
+ }
+
+ public Collection<Customer> getAllCustomers() {
+ return customers.values();
+ }
+
+ public Customer getCustomer(String id) throws CustomerNotFoundException {
+ Customer customer = customers.get(id);
+
+ if (customer == null) {
+ throw new CustomerNotFoundException("Customer " + id + " not found");
+ }
+
+ return customer;
+ }
+
+ public boolean updateCustomer(Customer customer) {
+ Customer current = null;
+ try {
+ current = getCustomer(customer.getId());
+ } catch (Exception ex) {
+ return false;
+ }
+
+ current.setEmail(customer.getEmail());
+ current.setName(customer.getName());
+ current.setCreditCard(customer.getCreditCard());
+ return true;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java/src/main/java/com/tuscanyscatours/emailgateway/EmailGateway.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java/src/main/java/com/tuscanyscatours/emailgateway/EmailGateway.java new file mode 100644 index 0000000000..8c6ca806d2 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java/src/main/java/com/tuscanyscatours/emailgateway/EmailGateway.java @@ -0,0 +1,30 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package com.tuscanyscatours.emailgateway;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * A gateway to send e-mail
+ */
+@Remotable
+public interface EmailGateway {
+ public boolean sendEmail(String sender, String recipient, String subject, String body);
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java/src/main/java/com/tuscanyscatours/emailgateway/impl/EmailGatewayImpl.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java/src/main/java/com/tuscanyscatours/emailgateway/impl/EmailGatewayImpl.java new file mode 100644 index 0000000000..a6a162d5c3 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java/src/main/java/com/tuscanyscatours/emailgateway/impl/EmailGatewayImpl.java @@ -0,0 +1,37 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package com.tuscanyscatours.emailgateway.impl;
+
+import org.osoa.sca.annotations.Service;
+
+import com.tuscanyscatours.emailgateway.EmailGateway;
+
+@Service(EmailGateway.class)
+public class EmailGatewayImpl implements EmailGateway {
+
+ public boolean sendEmail(String sender, String recipient, String subject, String body) {
+ System.out.println("From: " + sender);
+ System.out.println("To: " + recipient);
+ System.out.println("Subject: " + subject);
+ System.out.println(body);
+ return true;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java/src/main/java/com/tuscanyscatours/payment/impl/PaymentImpl.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java/src/main/java/com/tuscanyscatours/payment/impl/PaymentImpl.java new file mode 100644 index 0000000000..988605f7cd --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java/src/main/java/com/tuscanyscatours/payment/impl/PaymentImpl.java @@ -0,0 +1,69 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package com.tuscanyscatours.payment.impl;
+
+import org.osoa.sca.annotations.Property;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+import com.tuscanyscatours.customer.Customer;
+import com.tuscanyscatours.customer.CustomerNotFoundException;
+import com.tuscanyscatours.customer.CustomerRegistry;
+import com.tuscanyscatours.emailgateway.EmailGateway;
+import com.tuscanyscatours.payment.Payment;
+import com.tuscanyscatours.payment.creditcard.AuthorizeFault_Exception;
+import com.tuscanyscatours.payment.creditcard.CreditCardPayment;
+
+/**
+ * The payment implementation
+ */
+@Service(Payment.class)
+public class PaymentImpl implements Payment {
+
+ @Reference
+ protected CustomerRegistry customerRegistry;
+
+ @Reference
+ protected CreditCardPayment creditCardPayment;
+
+ @Reference
+ protected EmailGateway emailGateway;
+
+ @Property
+ protected float transactionFee = 0.01f;
+
+ public String makePaymentMember(String customerId, float amount) {
+ try {
+ Customer customer = customerRegistry.getCustomer(customerId);
+ String status = creditCardPayment.authorize(customer.getCreditCard(), amount + transactionFee);
+ emailGateway.sendEmail("order@tuscanyscatours.com",
+ customer.getEmail(),
+ "Status for your payment",
+ customer + " >>> Status = " + status);
+ return status;
+ } catch (CustomerNotFoundException ex) {
+ return "Payment failed due to " + ex.getMessage();
+ } catch (AuthorizeFault_Exception e) {
+ return e.getFaultInfo().getErrorCode();
+ } catch (Throwable t) {
+ return "Payment failed due to system error " + t.getMessage();
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java/src/main/resources/CreditCardPayment.wsdl b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java/src/main/resources/CreditCardPayment.wsdl new file mode 100644 index 0000000000..d17497d1f6 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java/src/main/resources/CreditCardPayment.wsdl @@ -0,0 +1,132 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<wsdl:definitions name="CreditCardPayment"
+ targetNamespace="http://www.tuscanyscatours.com/CreditCardPayment/"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:tns="http://www.tuscanyscatours.com/CreditCardPayment/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:bpws="http://schemas.xmlsoap.org/ws/2004/03/business-process/"
+ xmlns:plnk="http://schemas.xmlsoap.org/ws/2004/03/partner-link/">
+ <wsdl:types>
+ <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.tuscanyscatours.com/CreditCardPayment/"
+ xmlns:tns="http://www.tuscanyscatours.com/CreditCardPayment/">
+
+ <xsd:element name="authorize">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="CreditCard" type="tns:CreditCardDetailsType"></xsd:element>
+ <xsd:element name="Amount" type="xsd:float"></xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="authorizeResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="Status" type="xsd:string"></xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:complexType name="CreditCardDetailsType">
+ <xsd:sequence>
+ <xsd:element name="CreditCardType" type="tns:CreditCardTypeType" minOccurs="0" />
+ <xsd:element name="CreditCardNumber" type="xsd:string" minOccurs="0" />
+ <xsd:element name="ExpMonth" type="xsd:int" minOccurs="0" />
+ <xsd:element name="ExpYear" type="xsd:int" minOccurs="0" />
+ <xsd:element name="CardOwner" type="tns:PayerType" minOccurs="0" />
+ <xsd:element name="CVV2" type="xsd:string" minOccurs="0" />
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:simpleType name="CreditCardTypeType">
+ <xsd:restriction base="xsd:token">
+ <xsd:enumeration value="Visa" />
+ <xsd:enumeration value="MasterCard" />
+ <xsd:enumeration value="Discover" />
+ <xsd:enumeration value="Amex" />
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:complexType name="PayerType">
+ <xsd:sequence>
+ <xsd:element name="Name" type="xsd:string" />
+ <xsd:element name="Address" type="tns:AddressType" />
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:complexType name="AddressType">
+ <xsd:sequence>
+ <xsd:element name="Street" type="xsd:string" />
+ <xsd:element name="City" type="xsd:string" />
+ <xsd:element name="State" type="xsd:string" />
+ <xsd:element name="ZipCode" type="xsd:string" />
+ <xsd:element name="HomePhone" type="xsd:string" />
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="authorizeFault">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="errorCode" type="xsd:string"></xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:schema>
+ </wsdl:types>
+ <wsdl:message name="AuthorizeRequest">
+ <wsdl:part name="parameters" element="tns:authorize"></wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="AuthorizeResponse">
+ <wsdl:part name="parameters" element="tns:authorizeResponse"></wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="AuthorizeFault">
+ <wsdl:part name="parameters" element="tns:authorizeFault"></wsdl:part>
+ </wsdl:message>
+ <wsdl:portType name="CreditCardPayment">
+ <wsdl:operation name="authorize">
+ <wsdl:input message="tns:AuthorizeRequest"></wsdl:input>
+ <wsdl:output message="tns:AuthorizeResponse"></wsdl:output>
+ <wsdl:fault name="authorizationFailure" message="tns:AuthorizeFault"></wsdl:fault> + </wsdl:operation>
+ </wsdl:portType>
+ <wsdl:binding name="CreditCardPaymentBinding" type="tns:CreditCardPayment">
+ <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
+ <wsdl:operation name="authorize">
+ <soap:operation soapAction="http://www.tuscanyscatours.com/CreditCardPayment/authorize" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ <wsdl:fault name="authorizationFailure">
+ <soap:fault name="authorizationFailure" use="literal"/>
+ </wsdl:fault>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:service name="CreditCardPaymentService">
+ <wsdl:port name="CreditCardPaymentPort" binding="tns:CreditCardPaymentBinding">
+ <soap:address location="http://localhost:8080/CreditCardPayment" />
+ </wsdl:port>
+ </wsdl:service>
+
+ <plnk:partnerLinkType name="CreditCardPaymentLinkType">
+ <plnk:role name="forward" portType="tns:CreditCardPayment"/>
+ </plnk:partnerLinkType>
+</wsdl:definitions>
\ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java/src/main/resources/META-INF/sca-contribution.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java/src/main/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..f8ff7b4623 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java/src/main/resources/META-INF/sca-contribution.xml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:scatours="http://tuscanyscatours.com/">
+ <export.java package="com.tuscanyscatours.payment" />
+ <deployable composite="scatours:payment" />
+</contribution>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java/src/main/resources/Payment.wsdl b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java/src/main/resources/Payment.wsdl new file mode 100644 index 0000000000..3885764899 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java/src/main/resources/Payment.wsdl @@ -0,0 +1,83 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<wsdl:definitions name="Payment"
+ targetNamespace="http://www.tuscanyscatours.com/Payment/"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:tns="http://www.tuscanyscatours.com/Payment/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:bpws="http://schemas.xmlsoap.org/ws/2004/03/business-process/"
+ xmlns:plnk="http://schemas.xmlsoap.org/ws/2004/03/partner-link/">
+ <wsdl:types>
+ <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.tuscanyscatours.com/Payment/"
+ xmlns:tns="http://www.tuscanyscatours.com/Payment/">
+
+ <xsd:complexType name="MakePaymentMemberType">
+ <xsd:sequence>
+ <xsd:element name="CustomerId" type="xsd:string"></xsd:element>
+ <xsd:element name="Amount" type="xsd:float"></xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="makePaymentMember" type="tns:MakePaymentMemberType"/>
+
+ <xsd:complexType name="MakePaymentMemberResponseType">
+ <xsd:sequence>
+ <xsd:element name="Status" type="xsd:string"></xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="makePaymentMemberResponse" type="tns:MakePaymentMemberResponseType"/>
+
+ </xsd:schema>
+ </wsdl:types>
+ <wsdl:message name="MakePaymentMemberRequest">
+ <wsdl:part name="parameters" element="tns:makePaymentMember"></wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="MakePaymentMemberResponse">
+ <wsdl:part name="parameters" element="tns:makePaymentMemberResponse"></wsdl:part>
+ </wsdl:message>
+ <wsdl:portType name="Payment">
+ <wsdl:operation name="makePaymentMember">
+ <wsdl:input message="tns:MakePaymentMemberRequest"></wsdl:input>
+ <wsdl:output message="tns:MakePaymentMemberResponse"></wsdl:output>
+ </wsdl:operation>
+ </wsdl:portType>
+ <wsdl:binding name="PaymentBinding" type="tns:Payment">
+ <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
+ <wsdl:operation name="makePaymentMember">
+ <soap:operation soapAction="http://www.tuscanyscatours.com/Payment/makePayment" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:service name="PaymentService">
+ <wsdl:port name="PaymentPort" binding="tns:PaymentBinding">
+ <soap:address location="http://localhost:8083/Payment" />
+ </wsdl:port>
+ </wsdl:service>
+
+ <plnk:partnerLinkType name="PaymentLinkType">
+ <plnk:role name="forward" portType="tns:Payment"/>
+ </plnk:partnerLinkType>
+</wsdl:definitions>
\ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java/src/main/resources/definitions.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java/src/main/resources/definitions.xml new file mode 100644 index 0000000000..dc47395e9b --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java/src/main/resources/definitions.xml @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="ASCII"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<definitions xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0">
+
+ <!-- Policy Intents Defined by the SCA Runtime -->
+ <intent name="authorization" constrains="sca:implementation"/>
+ <intent name="managedTransaction" constrains="sca:implementation"/>
+ <intent name="managedTransaction.global"/>
+
+ <!-- Policy intents -->
+ <policySet name="ps1" provides="sca:authorization" appliesTo="sca:implementation.java"/>
+
+ <policySet name="ps2" provides="sca:managedTransaction.global" appliesTo="sca:implementation.java"/>
+
+</definitions>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java/src/main/resources/payment.composite b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java/src/main/resources/payment.composite new file mode 100644 index 0000000000..b4dcd328b1 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java/src/main/resources/payment.composite @@ -0,0 +1,46 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://tuscanyscatours.com/"
+ name="payment">
+
+ <component name="Payment">
+ <implementation.java class="com.tuscanyscatours.payment.impl.PaymentImpl" />
+ <service name="Payment">
+ <binding.ws uri="http://localhost:8081/Payment" />
+ <binding.sca />
+ </service>
+ <reference name="customerRegistry" target="CustomerRegistry" />
+ <reference name="creditCardPayment">
+ <binding.ws uri="http://localhost:8082/CreditCardPayment" />
+ </reference>
+ <reference name="emailGateway" target="EmailGateway" />
+ <property name="transactionFee">0.02</property>
+ </component>
+
+ <component name="CustomerRegistry">
+ <implementation.java class="com.tuscanyscatours.customer.impl.CustomerRegistryImpl" />
+ </component>
+
+ <component name="EmailGateway">
+ <implementation.java class="com.tuscanyscatours.emailgateway.impl.EmailGatewayImpl" />
+ </component>
+
+</composite>
\ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java/src/test/java/scatours/payment/PaymentTestCase.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java/src/test/java/scatours/payment/PaymentTestCase.java new file mode 100644 index 0000000000..ee4e3a5e96 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-java/src/test/java/scatours/payment/PaymentTestCase.java @@ -0,0 +1,79 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package scatours.payment;
+
+import org.apache.tuscany.sca.node.SCAClient;
+import org.apache.tuscany.sca.node.SCAContribution;
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.SCANodeFactory;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Ignore;
+import org.junit.Test;
+
+import com.tuscanyscatours.payment.Payment;
+
+public class PaymentTestCase {
+ private static SCANode node;
+
+ @BeforeClass
+ public static void setUpBeforeClass() throws Exception {
+ node =
+ SCANodeFactory.newInstance()
+ .createSCANode(null,
+ new SCAContribution("payment", "./target/classes"),
+ new SCAContribution("creditcard",
+ "../../contributions/creditcard-payment-jaxb/target/classes"));
+ node.start();
+ }
+
+ @Test
+ public void testPayment() {
+ SCAClient client = (SCAClient)node;
+ Payment payment = client.getService(Payment.class, "Payment");
+
+ String result = payment.makePaymentMember("c-0", 100.00f);
+ System.out.println("\n\nSuccessful Payment - Status = \n\n" + result);
+ if (!"OK".equals(result)) {
+ throw new RuntimeException(result);
+ }
+ System.out.println("\n\nFailed Payment - Status = \n\n" + payment.makePaymentMember("c-1", 100.00f));
+ }
+
+ @Test
+ @Ignore
+ public void testWaitForInput() {
+ System.out.println("Press a key to end");
+ try {
+ System.in.read();
+ } catch (Exception ex) {
+ }
+ System.out.println("Shutting down");
+ }
+
+ @AfterClass
+ public static void tearDownAfterClass() throws Exception {
+ if (node != null) {
+ node.stop();
+ node = null;
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-python/build.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-python/build.xml new file mode 100644 index 0000000000..1c29162343 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-python/build.xml @@ -0,0 +1,40 @@ +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> + +<project name="scatours-contribution-payment-pythin" default="compile"> + <import file="../../antdefs.xml"/> + + <target name="wsdljava"> + <antcall target="wsimport"> + <param name="wsdlfile" value="CreditCardPayment.wsdl"/> + <param name="javaclass" value="com/tuscanyscatours/payment/creditcard/CreditCardPayment.class"/> + <param name="package" value="com.tuscanyscatours.payment.creditcard"/> + </antcall> + <antcall target="wsimport"> + <param name="wsdlfile" value="EmailGateway.wsdl"/> + <param name="javaclass" value="com/tuscanyscatours/emailgateway/EmailGateway.class"/> + <param name="package" value="com.tuscanyscatours.emailgateway"/> + </antcall> + <antcall target="wsimport"> + <param name="wsdlfile" value="Payment.wsdl"/> + <param name="javaclass" value="com/tuscanyscatours/payment/Payment.class"/> + <param name="package" value="com.tuscanyscatours.payment"/> + </antcall> + </target> +</project> diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-python/pom.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-python/pom.xml new file mode 100644 index 0000000000..93c63ed973 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-python/pom.xml @@ -0,0 +1,162 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<project> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>scatours</artifactId> + <version>1.0-SNAPSHOT</version> + <relativePath>../../pom.xml</relativePath> + </parent> + <version>1.0-SNAPSHOT</version> + <artifactId>scatours-contribution-payment-python</artifactId> + <name>Apache Tuscany SCA Tours Payment Python Contribution</name> + + <dependencies> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-implementation-script</artifactId> + <version>${tuscany.version}</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-binding-ws-axis2</artifactId> + <version>${tuscany.version}</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-implementation-java-runtime</artifactId> + <version>${tuscany.version}</version> + <scope>test</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-host-jetty</artifactId> + <version>${tuscany.version}</version> + <scope>test</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-node-impl</artifactId> + <version>${tuscany.version}</version> + <scope>test</scope> + </dependency> + + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>4.5</version> + <scope>test</scope> + </dependency> + + </dependencies> + <build> + <finalName>${artifactId}</finalName> + <plugins> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>build-helper-maven-plugin</artifactId> + <version>1.0</version> + <executions> + <execution> + <id>add-source</id> + <phase>generate-sources</phase> + <goals> + <goal>add-source</goal> + </goals> + <configuration> + <sources> + <source>target/jaxws-source</source> + </sources> + </configuration> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>jaxws-maven-plugin</artifactId> + <version>1.12</version> + <executions> + <execution> + <id>payment</id> + <phase>generate-sources</phase> + <goals> + <goal>wsimport</goal> + </goals> + <configuration> + <packageName>com.tuscanyscatours.payment</packageName> + <wsdlDirectory>${basedir}/src/main/resources</wsdlDirectory> + <wsdlFiles> + <wsdlFile>Payment.wsdl</wsdlFile> + </wsdlFiles> + <sourceDestDir>${project.build.directory}/jaxws-source</sourceDestDir> + <staleFile>${project.build.directory}/jaxws-source/stale/payment.stale</staleFile> + <verbose>false</verbose> + <xnocompile>true</xnocompile> + </configuration> + </execution> + <execution> + <id>payment.creditcard</id> + <phase>process-sources</phase> + <goals> + <goal>wsimport</goal> + </goals> + <configuration> + <packageName>com.tuscanyscatours.payment.creditcard</packageName> + <wsdlDirectory>${basedir}/src/main/resources</wsdlDirectory> + <wsdlFiles> + <wsdlFile>CreditCardPayment.wsdl</wsdlFile> + </wsdlFiles> + <sourceDestDir>${project.build.directory}/jaxws-source</sourceDestDir> + <staleFile>${project.build.directory}/jaxws-source/stale/creditcard.stale</staleFile> + <verbose>false</verbose> + <xnocompile>true</xnocompile> + </configuration> + </execution> + <execution> + <id>emailgateway</id> + <phase>process-sources</phase> + <goals> + <goal>wsimport</goal> + </goals> + <configuration> + <packageName>com.tuscanyscatours.emailgateway</packageName> + <wsdlDirectory>${basedir}/src/main/resources</wsdlDirectory> + <wsdlFiles> + <wsdlFile>EmailGateway.wsdl</wsdlFile> + </wsdlFiles> + <sourceDestDir>${project.build.directory}/jaxws-source</sourceDestDir> + <staleFile>${project.build.directory}/jaxws-source/stale/emailgateway.stale</staleFile> + <verbose>false</verbose> + <xnocompile>true</xnocompile> + </configuration> + </execution> + </executions> + </plugin> + </plugins> + </build> +</project> diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-python/src/main/resources/CreditCardPayment.wsdl b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-python/src/main/resources/CreditCardPayment.wsdl new file mode 100644 index 0000000000..1813c77436 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-python/src/main/resources/CreditCardPayment.wsdl @@ -0,0 +1,116 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<wsdl:definitions name="CreditCardPayment" + targetNamespace="http://www.tuscanyscatours.com/CreditCardPayment/" + xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" + xmlns:tns="http://www.tuscanyscatours.com/CreditCardPayment/" + xmlns:xsd="http://www.w3.org/2001/XMLSchema" + xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" + xmlns:bpws="http://schemas.xmlsoap.org/ws/2004/03/business-process/" + xmlns:plnk="http://schemas.xmlsoap.org/ws/2004/03/partner-link/"> + <wsdl:types> + <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" + targetNamespace="http://www.tuscanyscatours.com/CreditCardPayment/" + xmlns:tns="http://www.tuscanyscatours.com/CreditCardPayment/"> + + <xsd:element name="authorize" type="tns:AuthorizeType"/> + <xsd:complexType name="AuthorizeType"> + <xsd:sequence> + <xsd:element name="CreditCard" type="tns:CreditCardDetailsType"></xsd:element> + <xsd:element name="Amount" type="xsd:float"></xsd:element> + </xsd:sequence> + </xsd:complexType> + + <xsd:element name="authorizeResponse" type="tns:AuthorizeResponseType"/> + <xsd:complexType name="AuthorizeResponseType"> + <xsd:sequence> + <xsd:element name="Status" type="xsd:string"></xsd:element> + </xsd:sequence> + </xsd:complexType> + + <xsd:complexType name="CreditCardDetailsType"> + <xsd:sequence> + <xsd:element name="CreditCardType" type="tns:CreditCardTypeType" minOccurs="0" /> + <xsd:element name="CreditCardNumber" type="xsd:string" minOccurs="0" /> + <xsd:element name="ExpMonth" type="xsd:int" minOccurs="0" /> + <xsd:element name="ExpYear" type="xsd:int" minOccurs="0" /> + <xsd:element name="CardOwner" type="tns:PayerType" minOccurs="0" /> + <xsd:element name="CVV2" type="xsd:string" minOccurs="0" /> + </xsd:sequence> + </xsd:complexType> + <xsd:simpleType name="CreditCardTypeType"> + <xsd:restriction base="xsd:token"> + <xsd:enumeration value="Visa" /> + <xsd:enumeration value="MasterCard" /> + <xsd:enumeration value="Discover" /> + <xsd:enumeration value="Amex" /> + </xsd:restriction> + </xsd:simpleType> + <xsd:complexType name="PayerType"> + <xsd:sequence> + <xsd:element name="Name" type="xsd:string" /> + <xsd:element name="Address" type="tns:AddressType" /> + </xsd:sequence> + </xsd:complexType> + <xsd:complexType name="AddressType"> + <xsd:sequence> + <xsd:element name="Street" type="xsd:string" /> + <xsd:element name="City" type="xsd:string" /> + <xsd:element name="State" type="xsd:string" /> + <xsd:element name="ZipCode" type="xsd:string" /> + <xsd:element name="HomePhone" type="xsd:string" /> + </xsd:sequence> + </xsd:complexType> + </xsd:schema> + </wsdl:types> + <wsdl:message name="AuthorizeRequest"> + <wsdl:part name="parameters" element="tns:authorize"></wsdl:part> + </wsdl:message> + <wsdl:message name="AuthorizeResponse"> + <wsdl:part name="parameters" element="tns:authorizeResponse"></wsdl:part> + </wsdl:message> + <wsdl:portType name="CreditCardPayment"> + <wsdl:operation name="authorize"> + <wsdl:input message="tns:AuthorizeRequest"></wsdl:input> + <wsdl:output message="tns:AuthorizeResponse"></wsdl:output> + </wsdl:operation> + </wsdl:portType> + <wsdl:binding name="CreditCardPaymentBinding" type="tns:CreditCardPayment"> + <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" /> + <wsdl:operation name="authorize"> + <soap:operation soapAction="http://www.tuscanyscatours.com/CreditCardPayment/authorize" /> + <wsdl:input> + <soap:body use="literal" /> + </wsdl:input> + <wsdl:output> + <soap:body use="literal" /> + </wsdl:output> + </wsdl:operation> + </wsdl:binding> + <wsdl:service name="CreditCardPaymentService"> + <wsdl:port name="CreditCardPaymentPort" binding="tns:CreditCardPaymentBinding"> + <soap:address location="http://localhost:8080/CreditCardPayment" /> + </wsdl:port> + </wsdl:service> + + <plnk:partnerLinkType name="CreditCardPaymentLinkType"> + <plnk:role name="forward" portType="tns:CreditCardPayment"/> + </plnk:partnerLinkType> +</wsdl:definitions>
\ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-python/src/main/resources/EmailGateway.wsdl b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-python/src/main/resources/EmailGateway.wsdl new file mode 100644 index 0000000000..a097d9b7e4 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-python/src/main/resources/EmailGateway.wsdl @@ -0,0 +1,89 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<wsdl:definitions name="EmailGateway" + targetNamespace="http://www.tuscanyscatours.com/EmailGateway/" + xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" + xmlns:tns="http://www.tuscanyscatours.com/EmailGateway/" + xmlns:xsd="http://www.w3.org/2001/XMLSchema" + xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" + xmlns:bpws="http://schemas.xmlsoap.org/ws/2004/03/business-process/" + xmlns:plnk="http://schemas.xmlsoap.org/ws/2004/03/partner-link/"> + <wsdl:types> + <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" + targetNamespace="http://www.tuscanyscatours.com/EmailGateway/" + xmlns:tns="http://www.tuscanyscatours.com/EmailGateway/"> + + <xsd:element name="sendEmail" type="tns:SendEmailType"/> + <xsd:complexType name="SendEmailType"> + <xsd:sequence> + <xsd:element name="Email" type="tns:EmailType"></xsd:element> + </xsd:sequence> + </xsd:complexType> + + <xsd:element name="sendEmailResponse" type="tns:SendEmailResponseType"/> + <xsd:complexType name="SendEmailResponseType"> + <xsd:sequence> + <xsd:element name="Status" type="xsd:string"></xsd:element> + </xsd:sequence> + </xsd:complexType> + + <xsd:complexType name="EmailType"> + <xsd:sequence> + <xsd:element name="To" type="xsd:string"/> + <xsd:element name="Title" type="xsd:string"/> + <xsd:element name="Body" type="xsd:string"/> + </xsd:sequence> + </xsd:complexType> + </xsd:schema> + </wsdl:types> + <wsdl:message name="SendEmailRequest"> + <wsdl:part name="parameters" element="tns:sendEmail"></wsdl:part> + </wsdl:message> + <wsdl:message name="SendEmailResponse"> + <wsdl:part name="parameters" element="tns:sendEmailResponse"></wsdl:part> + </wsdl:message> + <wsdl:portType name="EmailGateway"> + <wsdl:operation name="sendEmail"> + <wsdl:input message="tns:SendEmailRequest"></wsdl:input> + <wsdl:output message="tns:SendEmailResponse"></wsdl:output> + </wsdl:operation> + </wsdl:portType> + <wsdl:binding name="EmailGatwayBinding" type="tns:EmailGateway"> + <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" /> + <wsdl:operation name="sendEmail"> + <soap:operation soapAction="http://www.tuscanyscatours.com/EmailGateway/sendEmail" /> + <wsdl:input> + <soap:body use="literal" /> + </wsdl:input> + <wsdl:output> + <soap:body use="literal" /> + </wsdl:output> + </wsdl:operation> + </wsdl:binding> + <wsdl:service name="EmailGatewayService"> + <wsdl:port name="EmailGatewayPort" binding="tns:EmailGatwayBinding"> + <soap:address location="http://localhost:8082/EmailGateway" /> + </wsdl:port> + </wsdl:service> + + <plnk:partnerLinkType name="EmailGatewayLinkType"> + <plnk:role name="forward" portType="tns:EmailGateway"/> + </plnk:partnerLinkType> +</wsdl:definitions>
\ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-python/src/main/resources/META-INF/sca-contribution.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-python/src/main/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..36e2990be1 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-python/src/main/resources/META-INF/sca-contribution.xml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0" + xmlns:tours="http://tuscanyscatours.com/"> + <export.java package="com.tuscanyscatours.payment" /> + <deployable composite="tours:payment" /> +</contribution> diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-python/src/main/resources/Payment.wsdl b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-python/src/main/resources/Payment.wsdl new file mode 100644 index 0000000000..2519d7642e --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-python/src/main/resources/Payment.wsdl @@ -0,0 +1,83 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<wsdl:definitions name="Payment" + targetNamespace="http://www.tuscanyscatours.com/Payment/" + xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" + xmlns:tns="http://www.tuscanyscatours.com/Payment/" + xmlns:xsd="http://www.w3.org/2001/XMLSchema" + xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" + xmlns:bpws="http://schemas.xmlsoap.org/ws/2004/03/business-process/" + xmlns:plnk="http://schemas.xmlsoap.org/ws/2004/03/partner-link/"> + <wsdl:types> + <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" + targetNamespace="http://www.tuscanyscatours.com/Payment/" + xmlns:tns="http://www.tuscanyscatours.com/Payment/"> + + <xsd:complexType name="MakePaymentMemberType"> + <xsd:sequence> + <xsd:element name="CustomerId" type="xsd:string"></xsd:element> + <xsd:element name="Amount" type="xsd:float"></xsd:element> + </xsd:sequence> + </xsd:complexType> + <xsd:element name="makePaymentMember" type="tns:MakePaymentMemberType"/> + + <xsd:complexType name="MakePaymentMemberResponseType"> + <xsd:sequence> + <xsd:element name="Status" type="xsd:string"></xsd:element> + </xsd:sequence> + </xsd:complexType> + <xsd:element name="makePaymentMemberResponse" type="tns:MakePaymentMemberResponseType"/> + + </xsd:schema> + </wsdl:types> + <wsdl:message name="MakePaymentMemberRequest"> + <wsdl:part name="parameters" element="tns:makePaymentMember"></wsdl:part> + </wsdl:message> + <wsdl:message name="MakePaymentMemberResponse"> + <wsdl:part name="parameters" element="tns:makePaymentMemberResponse"></wsdl:part> + </wsdl:message> + <wsdl:portType name="Payment"> + <wsdl:operation name="makePaymentMember"> + <wsdl:input message="tns:MakePaymentMemberRequest"></wsdl:input> + <wsdl:output message="tns:MakePaymentMemberResponse"></wsdl:output> + </wsdl:operation> + </wsdl:portType> + <wsdl:binding name="PaymentBinding" type="tns:Payment"> + <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" /> + <wsdl:operation name="makePaymentMember"> + <soap:operation soapAction="http://www.tuscanyscatours.com/Payment/makePayment" /> + <wsdl:input> + <soap:body use="literal" /> + </wsdl:input> + <wsdl:output> + <soap:body use="literal" /> + </wsdl:output> + </wsdl:operation> + </wsdl:binding> + <wsdl:service name="PaymentService"> + <wsdl:port name="PaymentPort" binding="tns:PaymentBinding"> + <soap:address location="http://localhost:8083/Payment" /> + </wsdl:port> + </wsdl:service> + + <plnk:partnerLinkType name="PaymentLinkType"> + <plnk:role name="forward" portType="tns:Payment"/> + </plnk:partnerLinkType> +</wsdl:definitions>
\ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-python/src/main/resources/payment.composite b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-python/src/main/resources/payment.composite new file mode 100644 index 0000000000..a0de3e9d67 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-python/src/main/resources/payment.composite @@ -0,0 +1,38 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" + targetNamespace="http://tuscanyscatours.com/" + xmlns:t="http://tuscany.apache.org/xmlns/sca/1.0" + xmlns:xsd="http://www.w3.org/2001/XMLSchema" + name="payment"> + + <component name="Payment"> + <t:implementation.script script="payment/PaymentImpl.py"/> + <service name="Payment"> + <interface.java interface="com.tuscanyscatours.payment.Payment" /> + <binding.ws uri="http://localhost:8081/Payment"/> + </service> + <reference name="emailGateway"> + <interface.java interface="com.tuscanyscatours.emailgateway.EmailGateway" /> + <binding.ws uri="http://localhost:8088/EmailGateway"/> + </reference> + <property name="transactionFee" type="xsd:float">0.02</property> + </component> +</composite> diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-python/src/main/resources/payment/PaymentImpl.py b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-python/src/main/resources/payment/PaymentImpl.py new file mode 100644 index 0000000000..095c549789 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-python/src/main/resources/payment/PaymentImpl.py @@ -0,0 +1,26 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +from com.tuscanyscatours.emailgateway import EmailType + +def makePaymentMember(customerId, amount): + finalAmount = amount + transactionFee; + print "Total amount = ", finalAmount + email = EmailType() + email.setTo(customerId) + emailGateway.sendEmail(email) + return "Success" diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-python/src/test/java/scatours/payment/PaymentTestCase.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-python/src/test/java/scatours/payment/PaymentTestCase.java new file mode 100644 index 0000000000..f55f8c7c75 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-python/src/test/java/scatours/payment/PaymentTestCase.java @@ -0,0 +1,86 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package scatours.payment; + +import org.apache.tuscany.sca.node.SCAClient; +import org.apache.tuscany.sca.node.SCAContribution; +import org.apache.tuscany.sca.node.SCANode; +import org.apache.tuscany.sca.node.SCANodeFactory; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +import com.tuscanyscatours.payment.Payment; + +/** + * + */ +public class PaymentTestCase { + + private static SCANode paymentNode; + private static SCANode creditCardNode; + private static SCANode emailGatewayNode; + + @BeforeClass + public static void setUpBeforeClass() throws Exception { + creditCardNode = + SCANodeFactory.newInstance() + .createSCANode("creditcard.composite", + new SCAContribution("creditcard", "../creditcard-payment-jaxb/target/classes")); + + creditCardNode.start(); + + emailGatewayNode = + SCANodeFactory.newInstance().createSCANode("emailgateway.composite", + new SCAContribution("emailgateway", + "../emailgateway/target/classes"), + new SCAContribution("emailgateway-test", + "../emailgateway/target/test-classes")); + + emailGatewayNode.start(); + + paymentNode = + SCANodeFactory.newInstance().createSCANode(null, + new SCAContribution("payment-python", "./target/classes"), + new SCAContribution("payment-python-test", + "./target/test-classes")); + + paymentNode.start(); + } + + @Test + public void testPayment() { + SCAClient client = (SCAClient)paymentNode; + Payment payment = client.getService(Payment.class, "PaymentClient"); + String result = payment.makePaymentMember("Fred", 100.00f); + System.out.println("Result = " + result); + if (!"Success".equals(result)) { + throw new RuntimeException(result); + } + } + + @AfterClass + public static void tearDownAfterClass() throws Exception { + paymentNode.stop(); + creditCardNode.stop(); + emailGatewayNode.stop(); + } + +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-python/src/test/java/scatours/payment/client/impl/PaymentClientImpl.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-python/src/test/java/scatours/payment/client/impl/PaymentClientImpl.java new file mode 100644 index 0000000000..4f64b20c4e --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-python/src/test/java/scatours/payment/client/impl/PaymentClientImpl.java @@ -0,0 +1,37 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package scatours.payment.client.impl; + +import org.osoa.sca.annotations.Reference; +import org.osoa.sca.annotations.Service; + +import com.tuscanyscatours.payment.Payment; + +@Service(Payment.class) +public class PaymentClientImpl implements Payment { + @Reference + protected Payment payment; + + public String makePaymentMember(String customerId, float amount) { + // Delegate the external web service + return payment.makePaymentMember(customerId, amount); + } + +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-python/src/test/resources/META-INF/sca-contribution.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-python/src/test/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..378e09009b --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-python/src/test/resources/META-INF/sca-contribution.xml @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0" + xmlns:tours="http://tuscanyscatours.com/" > + <deployable composite="tours:paymentClient" /> +</contribution> diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-python/src/test/resources/payment-client.composite b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-python/src/test/resources/payment-client.composite new file mode 100644 index 0000000000..353c1cea04 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-python/src/test/resources/payment-client.composite @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" + targetNamespace="http://tuscanyscatours.com/" + name="paymentClient"> + + <component name="PaymentClient"> + <implementation.java class="scatours.payment.client.impl.PaymentClientImpl" /> + <reference name="payment"> + <interface.java interface="com.tuscanyscatours.payment.Payment" /> + <binding.ws uri="http://localhost:8081/Payment" /> + </reference> + </component> + +</composite> diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-spring-policy/build.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-spring-policy/build.xml new file mode 100644 index 0000000000..db0e41b22f --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-spring-policy/build.xml @@ -0,0 +1,40 @@ +<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<project name="scatours-contribution-payment-spring-policy" default="compile">
+ <import file="../../antdefs.xml"/>
+
+ <target name="wsdljava">
+ <antcall target="wsimport">
+ <param name="wsdlfile" value="CreditCardPayment.wsdl"/>
+ <param name="javaclass" value="com/tuscanyscatours/payment/creditcard/CreditCardPayment.class"/>
+ <param name="package" value="com.tuscanyscatours.payment.creditcard"/>
+ </antcall>
+ <antcall target="wsimport">
+ <param name="wsdlfile" value="EmailGateway.wsdl"/>
+ <param name="javaclass" value="com/tuscanyscatours/emailgateway/EmailGateway.class"/>
+ <param name="package" value="com.tuscanyscatours.emailgateway"/>
+ </antcall>
+ <antcall target="wsimport">
+ <param name="wsdlfile" value="Payment.wsdl"/>
+ <param name="javaclass" value="com/tuscanyscatours/payment/Payment.class"/>
+ <param name="package" value="com.tuscanyscatours.payment"/>
+ </antcall>
+ </target>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-spring-policy/pom.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-spring-policy/pom.xml new file mode 100644 index 0000000000..92c169b68a --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-spring-policy/pom.xml @@ -0,0 +1,189 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<project> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>scatours</artifactId> + <version>1.0-SNAPSHOT</version> + <relativePath>../../pom.xml</relativePath> + </parent> + <version>1.0-SNAPSHOT</version> + <artifactId>scatours-contribution-payment-spring-policy</artifactId> + <name>Apache Tuscany SCA Tours Payment Spring Policy Contribution</name> + + <dependencies> + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-sca-api</artifactId> + <version>${tuscany.version}</version> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-implementation-java-runtime</artifactId> + <version>${tuscany.version}</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-binding-ws-axis2</artifactId> + <version>${tuscany.version}</version> + <scope>runtime</scope> + </dependency> + + <!-- + https://issues.apache.org/jira/browse/TUSCANY-3069 + --> + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-implementation-spring</artifactId> + <version>${tuscany.version}</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-implementation-spring-runtime</artifactId> + <version>${tuscany.version}</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-host-jetty</artifactId> + <version>${tuscany.version}</version> + <scope>test</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-node-impl</artifactId> + <version>${tuscany.version}</version> + <scope>test</scope> + </dependency> + + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>4.5</version> + <scope>test</scope> + </dependency> + + </dependencies> + + <pluginRepositories> + <pluginRepository> + <id>java.net2</id> + <name>java.net Maven 2.x Repository</name> + <url>http://download.java.net/maven/2</url> + <snapshots> + <enabled>false</enabled> + </snapshots> + </pluginRepository> + </pluginRepositories> + + <build> + <finalName>${artifactId}</finalName> + <plugins> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>build-helper-maven-plugin</artifactId> + <version>1.0</version> + <executions> + <execution> + <id>add-source</id> + <phase>generate-sources</phase> + <goals> + <goal>add-source</goal> + </goals> + <configuration> + <sources> + <source>target/jaxws-source</source> + </sources> + </configuration> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>jaxws-maven-plugin</artifactId> + <version>1.12</version> + <executions> + <execution> + <id>payment</id> + <phase>generate-sources</phase> + <goals> + <goal>wsimport</goal> + </goals> + <configuration> + <packageName>com.tuscanyscatours.payment</packageName> + <wsdlDirectory>${basedir}/src/main/resources</wsdlDirectory> + <wsdlFiles> + <wsdlFile>Payment.wsdl</wsdlFile> + </wsdlFiles> + <sourceDestDir>${project.build.directory}/jaxws-source</sourceDestDir> + <staleFile>${project.build.directory}/jaxws-source/stale/payment.stale</staleFile> + <verbose>false</verbose> + <xnocompile>true</xnocompile> + </configuration> + </execution> + <execution> + <id>payment.creditcard</id> + <phase>process-sources</phase> + <goals> + <goal>wsimport</goal> + </goals> + <configuration> + <packageName>com.tuscanyscatours.payment.creditcard</packageName> + <wsdlDirectory>${basedir}/src/main/resources</wsdlDirectory> + <wsdlFiles> + <wsdlFile>CreditCardPayment.wsdl</wsdlFile> + </wsdlFiles> + <sourceDestDir>${project.build.directory}/jaxws-source</sourceDestDir> + <staleFile>${project.build.directory}/jaxws-source/stale/creditcard.stale</staleFile> + <verbose>false</verbose> + <xnocompile>true</xnocompile> + </configuration> + </execution> + <execution> + <id>scatours.emailgateway</id> + <phase>process-sources</phase> + <goals> + <goal>wsimport</goal> + </goals> + <configuration> + <packageName>com.tuscanyscatours.emailgateway</packageName> + <wsdlDirectory>${basedir}/src/main/resources</wsdlDirectory> + <wsdlFiles> + <wsdlFile>EmailGateway.wsdl</wsdlFile> + </wsdlFiles> + <sourceDestDir>${project.build.directory}/jaxws-source</sourceDestDir> + <staleFile>${project.build.directory}/jaxws-source/stale/emailgateway.stale</staleFile> + <verbose>false</verbose> + <xnocompile>true</xnocompile> + </configuration> + </execution> + </executions> + </plugin> + </plugins> + </build> +</project> diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-spring-policy/src/main/java/com/tuscanyscatours/customer/Customer.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-spring-policy/src/main/java/com/tuscanyscatours/customer/Customer.java new file mode 100644 index 0000000000..3b72f81b33 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-spring-policy/src/main/java/com/tuscanyscatours/customer/Customer.java @@ -0,0 +1,70 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package com.tuscanyscatours.customer; + +import com.tuscanyscatours.payment.creditcard.CreditCardDetailsType; + +/** + * Customer data + */ +public class Customer { + private String id; + private String email; + private String name; + + private CreditCardDetailsType creditCard; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public CreditCardDetailsType getCreditCard() { + return creditCard; + } + + public void setCreditCard(CreditCardDetailsType creditCard) { + this.creditCard = creditCard; + } + + public String toString() { + return "id: " + id + " name: " + name + " e-mail: " + email; + } + +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-spring-policy/src/main/java/com/tuscanyscatours/customer/CustomerNotFoundException.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-spring-policy/src/main/java/com/tuscanyscatours/customer/CustomerNotFoundException.java new file mode 100644 index 0000000000..b08f76e0fa --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-spring-policy/src/main/java/com/tuscanyscatours/customer/CustomerNotFoundException.java @@ -0,0 +1,57 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package com.tuscanyscatours.customer; + +public class CustomerNotFoundException extends Exception { + private static final long serialVersionUID = -129752837478357452L; + + /** + * + */ + public CustomerNotFoundException() { + + } + + /** + * @param message + */ + public CustomerNotFoundException(String message) { + super(message); + + } + + /** + * @param cause + */ + public CustomerNotFoundException(Throwable cause) { + super(cause); + + } + + /** + * @param message + * @param cause + */ + public CustomerNotFoundException(String message, Throwable cause) { + super(message, cause); + + } + +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-spring-policy/src/main/java/com/tuscanyscatours/customer/CustomerRegistry.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-spring-policy/src/main/java/com/tuscanyscatours/customer/CustomerRegistry.java new file mode 100644 index 0000000000..706167d567 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-spring-policy/src/main/java/com/tuscanyscatours/customer/CustomerRegistry.java @@ -0,0 +1,39 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package com.tuscanyscatours.customer; + +import java.util.Collection; + +import com.tuscanyscatours.payment.creditcard.CreditCardDetailsType; + +/** + * Customer registry interface + */ +public interface CustomerRegistry { + Customer createCustomer(String name, String email, CreditCardDetailsType creditCard); + + boolean updateCustomer(Customer customer); + + Customer getCustomer(String id) throws CustomerNotFoundException; + + Collection<Customer> getAllCustomers(); + + boolean deleteCustomer(String id); +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-spring-policy/src/main/java/com/tuscanyscatours/customer/impl/CustomerRegistryImpl.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-spring-policy/src/main/java/com/tuscanyscatours/customer/impl/CustomerRegistryImpl.java new file mode 100644 index 0000000000..4381029543 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-spring-policy/src/main/java/com/tuscanyscatours/customer/impl/CustomerRegistryImpl.java @@ -0,0 +1,113 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package com.tuscanyscatours.customer.impl; + +import java.util.Collection; +import java.util.HashMap; +import java.util.Map; + +import org.osoa.sca.annotations.Destroy; +import org.osoa.sca.annotations.EagerInit; +import org.osoa.sca.annotations.Init; +import org.osoa.sca.annotations.Scope; +import org.osoa.sca.annotations.Service; + +import com.tuscanyscatours.customer.Customer; +import com.tuscanyscatours.customer.CustomerNotFoundException; +import com.tuscanyscatours.customer.CustomerRegistry; +import com.tuscanyscatours.payment.creditcard.CreditCardDetailsType; +import com.tuscanyscatours.payment.creditcard.CreditCardTypeType; +import com.tuscanyscatours.payment.creditcard.ObjectFactory; +import com.tuscanyscatours.payment.creditcard.PayerType; + +/** + * An in-memory customer registry implementation + */ +@Service(CustomerRegistry.class) +@Scope("COMPOSITE") +@EagerInit +public class CustomerRegistryImpl implements CustomerRegistry { + private volatile static int idGenerator = 0; + private Map<String, Customer> customers = new HashMap<String, Customer>(); + + @Init + public void init() { + // Load the customers + ObjectFactory factory = new ObjectFactory(); + CreditCardDetailsType cc = factory.createCreditCardDetailsType(); + PayerType john = factory.createPayerType(); + john.setName("John Smith"); + cc.setCardOwner(john); + cc.setCreditCardNumber("1111-2222-3333-4444"); + cc.setCreditCardType(CreditCardTypeType.VISA); + cc.setCVV2("1234"); + cc.setExpMonth(1); + cc.setExpYear(2012); + createCustomer("John Smith", "john@xyz.com", cc); + } + + @Destroy + public void destroy() { + // Save the customers + } + + public Customer createCustomer(String name, String email, CreditCardDetailsType creditCard) { + Customer customer = new Customer(); + customer.setId("c-" + idGenerator++); + customer.setName(name); + customer.setEmail(email); + customer.setCreditCard(creditCard); + customers.put(customer.getId(), customer); + return customer; + } + + public boolean deleteCustomer(String id) { + return customers.remove(id) != null; + } + + public Collection<Customer> getAllCustomers() { + return customers.values(); + } + + public Customer getCustomer(String id) throws CustomerNotFoundException { + Customer customer = customers.get(id); + + if (customer == null) { + throw new CustomerNotFoundException("Customer " + id + " not found"); + } + + return customer; + } + + public boolean updateCustomer(Customer customer) { + Customer current = null; + try { + current = getCustomer(customer.getId()); + } catch (Exception ex) { + return false; + } + + current.setEmail(customer.getEmail()); + current.setName(customer.getName()); + current.setCreditCard(customer.getCreditCard()); + return true; + } + +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-spring-policy/src/main/java/com/tuscanyscatours/emailgateway/impl/EmailGatewayImpl.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-spring-policy/src/main/java/com/tuscanyscatours/emailgateway/impl/EmailGatewayImpl.java new file mode 100644 index 0000000000..5eb825cb85 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-spring-policy/src/main/java/com/tuscanyscatours/emailgateway/impl/EmailGatewayImpl.java @@ -0,0 +1,32 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package com.tuscanyscatours.emailgateway.impl; + +import com.tuscanyscatours.emailgateway.EmailGateway; +import com.tuscanyscatours.emailgateway.EmailType; + +public class EmailGatewayImpl implements EmailGateway { + + public String sendEmail(EmailType email) { + System.out.println("Sending mail to " + email.getTo()); + return "SENT"; + } + +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-spring-policy/src/main/java/com/tuscanyscatours/payment/impl/PaymentImpl.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-spring-policy/src/main/java/com/tuscanyscatours/payment/impl/PaymentImpl.java new file mode 100644 index 0000000000..a35f761dc7 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-spring-policy/src/main/java/com/tuscanyscatours/payment/impl/PaymentImpl.java @@ -0,0 +1,77 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package com.tuscanyscatours.payment.impl; + +import com.tuscanyscatours.customer.Customer; +import com.tuscanyscatours.customer.CustomerNotFoundException; +import com.tuscanyscatours.customer.CustomerRegistry; +import com.tuscanyscatours.emailgateway.EmailGateway; +import com.tuscanyscatours.emailgateway.EmailType; +import com.tuscanyscatours.payment.Payment; +import com.tuscanyscatours.payment.creditcard.CreditCardPayment; + +public class PaymentImpl implements Payment { + + private CreditCardPayment creditCardPayment; + private CustomerRegistry customerRegistry; + private EmailGateway emailGateway; + private float transactionFee; + + public void setCreditCardPayment(CreditCardPayment creditCardPayment) { + this.creditCardPayment = creditCardPayment; + } + + public void setCustomerRegistry(CustomerRegistry customerRegistry) { + this.customerRegistry = customerRegistry; + } + + public void setEmailGateway(EmailGateway emailGateway) { + this.emailGateway = emailGateway; + } + + public void setTransactionFee(Float transactionFee) { + this.transactionFee = transactionFee; + } + + public String makePaymentMember(String customerId, float amount) { + try { + Customer customer = customerRegistry.getCustomer(customerId); + + amount += transactionFee; + + String status = creditCardPayment.authorize(customer.getCreditCard(), amount); + + com.tuscanyscatours.emailgateway.ObjectFactory emailFactory = + new com.tuscanyscatours.emailgateway.ObjectFactory(); + EmailType email = emailFactory.createEmailType(); + email.setTitle("Payment Received"); + email.setTo(customerId); + + emailGateway.sendEmail(email); + + return status; + } catch (CustomerNotFoundException ex) { + return "Payment failed due to " + ex.getMessage(); + } catch (Throwable t) { + return "Payment failed due to system error " + t.getMessage(); + } + } + +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-spring-policy/src/main/resources/CreditCardPayment.wsdl b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-spring-policy/src/main/resources/CreditCardPayment.wsdl new file mode 100644 index 0000000000..8224cd126f --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-spring-policy/src/main/resources/CreditCardPayment.wsdl @@ -0,0 +1,118 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<wsdl:definitions name="CreditCardPayment" + targetNamespace="http://www.tuscanyscatours.com/CreditCardPayment/" + xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" + xmlns:tns="http://www.tuscanyscatours.com/CreditCardPayment/" + xmlns:xsd="http://www.w3.org/2001/XMLSchema" + xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" + xmlns:bpws="http://schemas.xmlsoap.org/ws/2004/03/business-process/" + xmlns:plnk="http://schemas.xmlsoap.org/ws/2004/03/partner-link/"> + <wsdl:types> + <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" + targetNamespace="http://www.tuscanyscatours.com/CreditCardPayment/" + xmlns:tns="http://www.tuscanyscatours.com/CreditCardPayment/"> + + <xsd:element name="authorize"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="CreditCard" type="tns:CreditCardDetailsType"></xsd:element> + <xsd:element name="Amount" type="xsd:float"></xsd:element> + </xsd:sequence> + </xsd:complexType> + </xsd:element> + + <xsd:element name="authorizeResponse"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="Status" type="xsd:string"></xsd:element> + </xsd:sequence> + </xsd:complexType> + </xsd:element> + + <xsd:complexType name="CreditCardDetailsType"> + <xsd:sequence> + <xsd:element name="CreditCardType" type="tns:CreditCardTypeType" minOccurs="0" /> + <xsd:element name="CreditCardNumber" type="xsd:string" minOccurs="0" /> + <xsd:element name="ExpMonth" type="xsd:int" minOccurs="0" /> + <xsd:element name="ExpYear" type="xsd:int" minOccurs="0" /> + <xsd:element name="CardOwner" type="tns:PayerType" minOccurs="0" /> + <xsd:element name="CVV2" type="xsd:string" minOccurs="0" /> + </xsd:sequence> + </xsd:complexType> + <xsd:simpleType name="CreditCardTypeType"> + <xsd:restriction base="xsd:token"> + <xsd:enumeration value="Visa" /> + <xsd:enumeration value="MasterCard" /> + <xsd:enumeration value="Discover" /> + <xsd:enumeration value="Amex" /> + </xsd:restriction> + </xsd:simpleType> + <xsd:complexType name="PayerType"> + <xsd:sequence> + <xsd:element name="Name" type="xsd:string" /> + <xsd:element name="Address" type="tns:AddressType" /> + </xsd:sequence> + </xsd:complexType> + <xsd:complexType name="AddressType"> + <xsd:sequence> + <xsd:element name="Street" type="xsd:string" /> + <xsd:element name="City" type="xsd:string" /> + <xsd:element name="State" type="xsd:string" /> + <xsd:element name="ZipCode" type="xsd:string" /> + <xsd:element name="HomePhone" type="xsd:string" /> + </xsd:sequence> + </xsd:complexType> + </xsd:schema> + </wsdl:types> + <wsdl:message name="AuthorizeRequest"> + <wsdl:part name="parameters" element="tns:authorize"></wsdl:part> + </wsdl:message> + <wsdl:message name="AuthorizeResponse"> + <wsdl:part name="parameters" element="tns:authorizeResponse"></wsdl:part> + </wsdl:message> + <wsdl:portType name="CreditCardPayment"> + <wsdl:operation name="authorize"> + <wsdl:input message="tns:AuthorizeRequest"></wsdl:input> + <wsdl:output message="tns:AuthorizeResponse"></wsdl:output> + </wsdl:operation> + </wsdl:portType> + <wsdl:binding name="CreditCardPaymentBinding" type="tns:CreditCardPayment"> + <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" /> + <wsdl:operation name="authorize"> + <soap:operation soapAction="http://www.tuscanyscatours.com/CreditCardPayment/authorize" /> + <wsdl:input> + <soap:body use="literal" /> + </wsdl:input> + <wsdl:output> + <soap:body use="literal" /> + </wsdl:output> + </wsdl:operation> + </wsdl:binding> + <wsdl:service name="CreditCardPaymentService"> + <wsdl:port name="CreditCardPaymentPort" binding="tns:CreditCardPaymentBinding"> + <soap:address location="http://localhost:8080/CreditCardPayment" /> + </wsdl:port> + </wsdl:service> + + <plnk:partnerLinkType name="CreditCardPaymentLinkType"> + <plnk:role name="forward" portType="tns:CreditCardPayment"/> + </plnk:partnerLinkType> +</wsdl:definitions>
\ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-spring-policy/src/main/resources/EmailGateway.wsdl b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-spring-policy/src/main/resources/EmailGateway.wsdl new file mode 100644 index 0000000000..9e9a6ea685 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-spring-policy/src/main/resources/EmailGateway.wsdl @@ -0,0 +1,89 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<wsdl:definitions name="EmailGateway" + targetNamespace="http://www.tuscanyscatours.com/EmailGateway/" + xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" + xmlns:tns="http://www.tuscanyscatours.com/EmailGateway/" + xmlns:xsd="http://www.w3.org/2001/XMLSchema" + xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" + xmlns:bpws="http://schemas.xmlsoap.org/ws/2004/03/business-process/" + xmlns:plnk="http://schemas.xmlsoap.org/ws/2004/03/partner-link/"> + <wsdl:types> + <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" + targetNamespace="http://www.tuscanyscatours.com/EmailGateway/" + xmlns:tns="http://www.tuscanyscatours.com/EmailGateway/"> + + <xsd:element name="sendEmail" type="tns:SendEmailType"/> + <xsd:complexType name="SendEmailType"> + <xsd:sequence> + <xsd:element name="Email" type="tns:EmailType"></xsd:element> + </xsd:sequence> + </xsd:complexType> + + <xsd:element name="sendEmailResponse" type="tns:SendEmailResponseType"/> + <xsd:complexType name="SendEmailResponseType"> + <xsd:sequence> + <xsd:element name="Status" type="xsd:string"></xsd:element> + </xsd:sequence> + </xsd:complexType> + + <xsd:complexType name="EmailType"> + <xsd:sequence> + <xsd:element name="To" type="xsd:string"/> + <xsd:element name="Title" type="xsd:string"/> + <xsd:element name="Body" type="xsd:string"/> + </xsd:sequence> + </xsd:complexType> + </xsd:schema> + </wsdl:types> + <wsdl:message name="SendEmailRequest"> + <wsdl:part name="parameters" element="tns:sendEmail"></wsdl:part> + </wsdl:message> + <wsdl:message name="SendEmailResponse"> + <wsdl:part name="parameters" element="tns:sendEmailResponse"></wsdl:part> + </wsdl:message> + <wsdl:portType name="EmailGateway"> + <wsdl:operation name="sendEmail"> + <wsdl:input message="tns:SendEmailRequest"></wsdl:input> + <wsdl:output message="tns:SendEmailResponse"></wsdl:output> + </wsdl:operation> + </wsdl:portType> + <wsdl:binding name="EmailGatwayBinding" type="tns:EmailGateway"> + <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" /> + <wsdl:operation name="sendEmail"> + <soap:operation soapAction="http://www.tuscanyscatours.com/EmailGateway/sendEmail" /> + <wsdl:input> + <soap:body use="literal" /> + </wsdl:input> + <wsdl:output> + <soap:body use="literal" /> + </wsdl:output> + </wsdl:operation> + </wsdl:binding> + <wsdl:service name="EmailGatewayService"> + <wsdl:port name="EmailGatewayPort" binding="tns:EmailGatwayBinding"> + <soap:address location="http://localhost:8088/EmailGateway" /> + </wsdl:port> + </wsdl:service> + + <plnk:partnerLinkType name="EmailGatewayLinkType"> + <plnk:role name="forward" portType="tns:EmailGateway"/> + </plnk:partnerLinkType> +</wsdl:definitions> diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-spring-policy/src/main/resources/META-INF/sca-contribution.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-spring-policy/src/main/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..696bf293f3 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-spring-policy/src/main/resources/META-INF/sca-contribution.xml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0" + xmlns:scatours="http://tuscanyscatours.com/"> + <export.java package="com.tuscanyscatours.payment"/> + <deployable composite="scatours:payment" /> +</contribution> diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-spring-policy/src/main/resources/Payment-context.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-spring-policy/src/main/resources/Payment-context.xml new file mode 100644 index 0000000000..bcb965924b --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-spring-policy/src/main/resources/Payment-context.xml @@ -0,0 +1,33 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<beans xmlns="http://www.springframework.org/schema/beans" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:sca="http://www.springframework.org/schema/sca" + xsi:schemaLocation="http://www.springframework.org/schema/beans + http://www.springframework.org/schema/beans/spring-beans.xsd"> + + <bean id="Payment" class="com.tuscanyscatours.payment.impl.PaymentImpl"> + <property name="creditCardPayment" ref="creditCardPaymentReference"/> + <property name="emailGateway" ref="emailGateway"/> + <property name="customerRegistry" ref="customerRegistry"/> + <property name="transactionFee" value="0.5f"/> + </bean> + +</beans> diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-spring-policy/src/main/resources/Payment.wsdl b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-spring-policy/src/main/resources/Payment.wsdl new file mode 100644 index 0000000000..e2c4062f2e --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-spring-policy/src/main/resources/Payment.wsdl @@ -0,0 +1,83 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<wsdl:definitions name="Payment" + targetNamespace="http://www.tuscanyscatours.com/Payment/" + xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" + xmlns:tns="http://www.tuscanyscatours.com/Payment/" + xmlns:xsd="http://www.w3.org/2001/XMLSchema" + xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" + xmlns:bpws="http://schemas.xmlsoap.org/ws/2004/03/business-process/" + xmlns:plnk="http://schemas.xmlsoap.org/ws/2004/03/partner-link/"> + <wsdl:types> + <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" + targetNamespace="http://www.tuscanyscatours.com/Payment/" + xmlns:tns="http://www.tuscanyscatours.com/Payment/"> + + <xsd:complexType name="MakePaymentMemberType"> + <xsd:sequence> + <xsd:element name="CustomerId" type="xsd:string"></xsd:element> + <xsd:element name="Amount" type="xsd:float"></xsd:element> + </xsd:sequence> + </xsd:complexType> + <xsd:element name="makePaymentMember" type="tns:MakePaymentMemberType"/> + + <xsd:complexType name="MakePaymentMemberResponseType"> + <xsd:sequence> + <xsd:element name="Status" type="xsd:string"></xsd:element> + </xsd:sequence> + </xsd:complexType> + <xsd:element name="makePaymentMemberResponse" type="tns:MakePaymentMemberResponseType"/> + + </xsd:schema> + </wsdl:types> + <wsdl:message name="MakePaymentMemberRequest"> + <wsdl:part name="parameters" element="tns:makePaymentMember"></wsdl:part> + </wsdl:message> + <wsdl:message name="MakePaymentMemberResponse"> + <wsdl:part name="parameters" element="tns:makePaymentMemberResponse"></wsdl:part> + </wsdl:message> + <wsdl:portType name="Payment"> + <wsdl:operation name="makePaymentMember"> + <wsdl:input message="tns:MakePaymentMemberRequest"></wsdl:input> + <wsdl:output message="tns:MakePaymentMemberResponse"></wsdl:output> + </wsdl:operation> + </wsdl:portType> + <wsdl:binding name="PaymentBinding" type="tns:Payment"> + <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" /> + <wsdl:operation name="makePaymentMember"> + <soap:operation soapAction="http://www.tuscanyscatours.com/Payment/makePayment" /> + <wsdl:input> + <soap:body use="literal" /> + </wsdl:input> + <wsdl:output> + <soap:body use="literal" /> + </wsdl:output> + </wsdl:operation> + </wsdl:binding> + <wsdl:service name="PaymentService"> + <wsdl:port name="PaymentPort" binding="tns:PaymentBinding"> + <soap:address location="http://localhost:8080/Payment" /> + </wsdl:port> + </wsdl:service> + + <plnk:partnerLinkType name="PaymentLinkType"> + <plnk:role name="forward" portType="tns:Payment"/> + </plnk:partnerLinkType> +</wsdl:definitions>
\ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-spring-policy/src/main/resources/definitions.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-spring-policy/src/main/resources/definitions.xml new file mode 100644 index 0000000000..0e421d3b83 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-spring-policy/src/main/resources/definitions.xml @@ -0,0 +1,35 @@ +<?xml version="1.0" encoding="ASCII"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<definitions xmlns="http://www.osoa.org/xmlns/sca/1.0" + targetNamespace="http://www.osoa.org/xmlns/sca/1.0" + xmlns:sca="http://www.osoa.org/xmlns/sca/1.0" + xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"> + + <!-- Policy Sets --> + <policySet name="BasicAuthenticationPolicySet" + provides="authentication" + appliesTo="sca:binding.ws"> + <tuscany:basicAuthentication> + <tuscany:userName>myname</tuscany:userName> + <tuscany:password>mypassword</tuscany:password> + </tuscany:basicAuthentication> + </policySet> + +</definitions> diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-spring-policy/src/main/resources/payment.composite b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-spring-policy/src/main/resources/payment.composite new file mode 100644 index 0000000000..3f5bcfe48d --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-spring-policy/src/main/resources/payment.composite @@ -0,0 +1,45 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" + targetNamespace="http://tuscanyscatours.com/" + name="payment"> + + <component name="Payment"> + <implementation.spring location="Payment-context.xml"/> + <service name="Payment"> + <binding.ws uri="http://localhost:8081/Payment"/> + </service> + <reference name="creditCardPaymentReference" > + <binding.ws uri="http://localhost:8082/CreditCardPayment" requires="authentication"/> + </reference> + <reference name="emailGateway" target="EmailGateway"/> + <reference name="customerRegistry" target="CustomerRegistry"/> + <property name="transactionFee">1.23</property> + </component> + + <component name="CustomerRegistry"> + <implementation.java class="com.tuscanyscatours.customer.impl.CustomerRegistryImpl" /> + </component> + + <component name="EmailGateway"> + <implementation.java class="com.tuscanyscatours.emailgateway.impl.EmailGatewayImpl" /> + </component> + +</composite> diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-spring-policy/src/test/java/scatours/payment/PaymentTestCase.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-spring-policy/src/test/java/scatours/payment/PaymentTestCase.java new file mode 100644 index 0000000000..9e59b05d80 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-spring-policy/src/test/java/scatours/payment/PaymentTestCase.java @@ -0,0 +1,74 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package scatours.payment; + +import org.apache.tuscany.sca.node.SCAClient; +import org.apache.tuscany.sca.node.SCAContribution; +import org.apache.tuscany.sca.node.SCANode; +import org.apache.tuscany.sca.node.SCANodeFactory; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +import com.tuscanyscatours.payment.Payment; + +/** + * + */ +public class PaymentTestCase { + private static SCANode paymentNode; + private static SCANode creditCardNode; + + @BeforeClass + public static void setUpBeforeClass() throws Exception { + creditCardNode = + SCANodeFactory.newInstance() + .createSCANode("creditcard.composite", + new SCAContribution("creditcard", "../creditcard-payment-jaxb-policy/target/classes")); + + creditCardNode.start(); + + paymentNode = + SCANodeFactory.newInstance() + .createSCANode(null, + new SCAContribution("payment-spring-policy", "./target/classes"), + new SCAContribution("payment-spring-policy-test", "./target/test-classes")); + + paymentNode.start(); + } + + @Test + public void testPayment() { + SCAClient client = (SCAClient)paymentNode; + Payment payment = client.getService(Payment.class, "PaymentClient"); + String result = payment.makePaymentMember("c-0", 100.00f); + System.out.println("Result = " + result); + if (!"OK".equals(result)) { + throw new RuntimeException(result); + } + } + + @AfterClass + public static void tearDownAfterClass() throws Exception { + paymentNode.stop(); + creditCardNode.stop(); + } + +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-spring-policy/src/test/java/scatours/payment/client/impl/PaymentClientImpl.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-spring-policy/src/test/java/scatours/payment/client/impl/PaymentClientImpl.java new file mode 100644 index 0000000000..4f64b20c4e --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-spring-policy/src/test/java/scatours/payment/client/impl/PaymentClientImpl.java @@ -0,0 +1,37 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package scatours.payment.client.impl; + +import org.osoa.sca.annotations.Reference; +import org.osoa.sca.annotations.Service; + +import com.tuscanyscatours.payment.Payment; + +@Service(Payment.class) +public class PaymentClientImpl implements Payment { + @Reference + protected Payment payment; + + public String makePaymentMember(String customerId, float amount) { + // Delegate the external web service + return payment.makePaymentMember(customerId, amount); + } + +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-spring-policy/src/test/resources/META-INF/sca-contribution.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-spring-policy/src/test/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..c97b6862f4 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-spring-policy/src/test/resources/META-INF/sca-contribution.xml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0" + xmlns:scatours="http://tuscanyscatours.com/"> + <import.java package="com.tuscanyscatours.payment"/> + <deployable composite="scatours:paymentClient" /> +</contribution> diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-spring-policy/src/test/resources/payment-client.composite b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-spring-policy/src/test/resources/payment-client.composite new file mode 100644 index 0000000000..642cebfd1c --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-spring-policy/src/test/resources/payment-client.composite @@ -0,0 +1,31 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" + targetNamespace="http://tuscanyscatours.com/" + name="paymentClient"> + + <component name="PaymentClient"> + <implementation.java class="scatours.payment.client.impl.PaymentClientImpl" /> + <reference name="payment"> + <binding.ws uri="http://localhost:8081/Payment" /> + </reference> + </component> + +</composite> diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-spring-scatag/build.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-spring-scatag/build.xml new file mode 100644 index 0000000000..6ad2ea55ad --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-spring-scatag/build.xml @@ -0,0 +1,40 @@ +<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<project name="scatours-contribution-payment-spring-scatag" default="compile">
+ <import file="../../antdefs.xml"/>
+
+ <target name="wsdljava">
+ <antcall target="wsimport">
+ <param name="wsdlfile" value="CreditCardPayment.wsdl"/>
+ <param name="javaclass" value="com/tuscanyscatours/payment/creditcard/CreditCardPayment.class"/>
+ <param name="package" value="com.tuscanyscatours.payment.creditcard"/>
+ </antcall>
+ <antcall target="wsimport">
+ <param name="wsdlfile" value="EmailGateway.wsdl"/>
+ <param name="javaclass" value="com/tuscanyscatours/emailgateway/EmailGateway.class"/>
+ <param name="package" value="com.tuscanyscatours.emailgateway"/>
+ </antcall>
+ <antcall target="wsimport">
+ <param name="wsdlfile" value="Payment.wsdl"/>
+ <param name="javaclass" value="com/tuscanyscatours/payment/Payment.class"/>
+ <param name="package" value="com.tuscanyscatours.payment"/>
+ </antcall>
+ </target>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-spring-scatag/pom.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-spring-scatag/pom.xml new file mode 100644 index 0000000000..f1ab200d64 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-spring-scatag/pom.xml @@ -0,0 +1,189 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<project> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>scatours</artifactId> + <version>1.0-SNAPSHOT</version> + <relativePath>../../pom.xml</relativePath> + </parent> + <version>1.0-SNAPSHOT</version> + <artifactId>scatours-contribution-payment-spring-scatag</artifactId> + <name>Apache Tuscany SCA Tours Payment Spring SCA Tag Contribution</name> + + <dependencies> + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-sca-api</artifactId> + <version>${tuscany.version}</version> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-implementation-java-runtime</artifactId> + <version>${tuscany.version}</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-binding-ws-axis2</artifactId> + <version>${tuscany.version}</version> + <scope>runtime</scope> + </dependency> + + <!-- + https://issues.apache.org/jira/browse/TUSCANY-3069 + --> + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-implementation-spring</artifactId> + <version>${tuscany.version}</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-implementation-spring-runtime</artifactId> + <version>${tuscany.version}</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-host-jetty</artifactId> + <version>${tuscany.version}</version> + <scope>test</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-node-impl</artifactId> + <version>${tuscany.version}</version> + <scope>test</scope> + </dependency> + + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>4.5</version> + <scope>test</scope> + </dependency> + + </dependencies> + + <pluginRepositories> + <pluginRepository> + <id>java.net2</id> + <name>java.net Maven 2.x Repository</name> + <url>http://download.java.net/maven/2</url> + <snapshots> + <enabled>false</enabled> + </snapshots> + </pluginRepository> + </pluginRepositories> + + <build> + <finalName>${artifactId}</finalName> + <plugins> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>build-helper-maven-plugin</artifactId> + <version>1.0</version> + <executions> + <execution> + <id>add-source</id> + <phase>generate-sources</phase> + <goals> + <goal>add-source</goal> + </goals> + <configuration> + <sources> + <source>target/jaxws-source</source> + </sources> + </configuration> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>jaxws-maven-plugin</artifactId> + <version>1.12</version> + <executions> + <execution> + <id>payment</id> + <phase>generate-sources</phase> + <goals> + <goal>wsimport</goal> + </goals> + <configuration> + <packageName>com.tuscanyscatours.payment</packageName> + <wsdlDirectory>${basedir}/src/main/resources</wsdlDirectory> + <wsdlFiles> + <wsdlFile>Payment.wsdl</wsdlFile> + </wsdlFiles> + <sourceDestDir>${project.build.directory}/jaxws-source</sourceDestDir> + <staleFile>${project.build.directory}/jaxws-source/stale/payment.stale</staleFile> + <verbose>false</verbose> + <xnocompile>true</xnocompile> + </configuration> + </execution> + <execution> + <id>payment.creditcard</id> + <phase>process-sources</phase> + <goals> + <goal>wsimport</goal> + </goals> + <configuration> + <packageName>com.tuscanyscatours.payment.creditcard</packageName> + <wsdlDirectory>${basedir}/src/main/resources</wsdlDirectory> + <wsdlFiles> + <wsdlFile>CreditCardPayment.wsdl</wsdlFile> + </wsdlFiles> + <sourceDestDir>${project.build.directory}/jaxws-source</sourceDestDir> + <staleFile>${project.build.directory}/jaxws-source/stale/creditcard.stale</staleFile> + <verbose>false</verbose> + <xnocompile>true</xnocompile> + </configuration> + </execution> + <execution> + <id>scatours.emailgateway</id> + <phase>process-sources</phase> + <goals> + <goal>wsimport</goal> + </goals> + <configuration> + <packageName>com.tuscanyscatours.emailgateway</packageName> + <wsdlDirectory>${basedir}/src/main/resources</wsdlDirectory> + <wsdlFiles> + <wsdlFile>EmailGateway.wsdl</wsdlFile> + </wsdlFiles> + <sourceDestDir>${project.build.directory}/jaxws-source</sourceDestDir> + <staleFile>${project.build.directory}/jaxws-source/stale/emailgateway.stale</staleFile> + <verbose>false</verbose> + <xnocompile>true</xnocompile> + </configuration> + </execution> + </executions> + </plugin> + </plugins> + </build> +</project> diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-spring-scatag/src/main/java/com/tuscanyscatours/emailgateway/impl/EmailGatewayImpl.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-spring-scatag/src/main/java/com/tuscanyscatours/emailgateway/impl/EmailGatewayImpl.java new file mode 100644 index 0000000000..5eb825cb85 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-spring-scatag/src/main/java/com/tuscanyscatours/emailgateway/impl/EmailGatewayImpl.java @@ -0,0 +1,32 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package com.tuscanyscatours.emailgateway.impl; + +import com.tuscanyscatours.emailgateway.EmailGateway; +import com.tuscanyscatours.emailgateway.EmailType; + +public class EmailGatewayImpl implements EmailGateway { + + public String sendEmail(EmailType email) { + System.out.println("Sending mail to " + email.getTo()); + return "SENT"; + } + +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-spring-scatag/src/main/java/com/tuscanyscatours/payment/impl/PaymentImpl.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-spring-scatag/src/main/java/com/tuscanyscatours/payment/impl/PaymentImpl.java new file mode 100644 index 0000000000..42d995aa88 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-spring-scatag/src/main/java/com/tuscanyscatours/payment/impl/PaymentImpl.java @@ -0,0 +1,76 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package com.tuscanyscatours.payment.impl; + +import com.tuscanyscatours.emailgateway.EmailGateway; +import com.tuscanyscatours.emailgateway.EmailType; +import com.tuscanyscatours.payment.Payment; +import com.tuscanyscatours.payment.creditcard.CreditCardDetailsType; +import com.tuscanyscatours.payment.creditcard.CreditCardPayment; +import com.tuscanyscatours.payment.creditcard.CreditCardTypeType; +import com.tuscanyscatours.payment.creditcard.ObjectFactory; +import com.tuscanyscatours.payment.creditcard.PayerType; + +//@Service(Payment.class) +public class PaymentImpl implements Payment { + + protected CreditCardPayment creditCardPayment; + protected EmailGateway emailGateway; + protected float transactionFee = 0; + + //@Reference + public void setCreditCardPayment(CreditCardPayment creditCardPayment) { + this.creditCardPayment = creditCardPayment; + } + + public void setEmailGateway(EmailGateway emailGateway) { + this.emailGateway = emailGateway; + } + + //@Property + public void setTransactionFee(Float transactionFee) { + this.transactionFee = transactionFee; + } + + public String makePaymentMember(String customerId, float amount) { + + ObjectFactory objectFactory = new ObjectFactory(); + CreditCardDetailsType ccDetails = objectFactory.createCreditCardDetailsType(); + ccDetails.setCreditCardType(CreditCardTypeType.fromValue("Visa")); + PayerType ccOwner = objectFactory.createPayerType(); + ccOwner.setName(customerId); + ccDetails.setCardOwner(ccOwner); + + amount += transactionFee; + + String status = creditCardPayment.authorize(ccDetails, amount); + + com.tuscanyscatours.emailgateway.ObjectFactory emailFactory = + new com.tuscanyscatours.emailgateway.ObjectFactory(); + EmailType email = emailFactory.createEmailType(); + email.setTitle("Payment Received"); + email.setTo(customerId); + + emailGateway.sendEmail(email); + + return status; + } + +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-spring-scatag/src/main/resources/CreditCardPayment.wsdl b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-spring-scatag/src/main/resources/CreditCardPayment.wsdl new file mode 100644 index 0000000000..8224cd126f --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-spring-scatag/src/main/resources/CreditCardPayment.wsdl @@ -0,0 +1,118 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<wsdl:definitions name="CreditCardPayment" + targetNamespace="http://www.tuscanyscatours.com/CreditCardPayment/" + xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" + xmlns:tns="http://www.tuscanyscatours.com/CreditCardPayment/" + xmlns:xsd="http://www.w3.org/2001/XMLSchema" + xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" + xmlns:bpws="http://schemas.xmlsoap.org/ws/2004/03/business-process/" + xmlns:plnk="http://schemas.xmlsoap.org/ws/2004/03/partner-link/"> + <wsdl:types> + <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" + targetNamespace="http://www.tuscanyscatours.com/CreditCardPayment/" + xmlns:tns="http://www.tuscanyscatours.com/CreditCardPayment/"> + + <xsd:element name="authorize"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="CreditCard" type="tns:CreditCardDetailsType"></xsd:element> + <xsd:element name="Amount" type="xsd:float"></xsd:element> + </xsd:sequence> + </xsd:complexType> + </xsd:element> + + <xsd:element name="authorizeResponse"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="Status" type="xsd:string"></xsd:element> + </xsd:sequence> + </xsd:complexType> + </xsd:element> + + <xsd:complexType name="CreditCardDetailsType"> + <xsd:sequence> + <xsd:element name="CreditCardType" type="tns:CreditCardTypeType" minOccurs="0" /> + <xsd:element name="CreditCardNumber" type="xsd:string" minOccurs="0" /> + <xsd:element name="ExpMonth" type="xsd:int" minOccurs="0" /> + <xsd:element name="ExpYear" type="xsd:int" minOccurs="0" /> + <xsd:element name="CardOwner" type="tns:PayerType" minOccurs="0" /> + <xsd:element name="CVV2" type="xsd:string" minOccurs="0" /> + </xsd:sequence> + </xsd:complexType> + <xsd:simpleType name="CreditCardTypeType"> + <xsd:restriction base="xsd:token"> + <xsd:enumeration value="Visa" /> + <xsd:enumeration value="MasterCard" /> + <xsd:enumeration value="Discover" /> + <xsd:enumeration value="Amex" /> + </xsd:restriction> + </xsd:simpleType> + <xsd:complexType name="PayerType"> + <xsd:sequence> + <xsd:element name="Name" type="xsd:string" /> + <xsd:element name="Address" type="tns:AddressType" /> + </xsd:sequence> + </xsd:complexType> + <xsd:complexType name="AddressType"> + <xsd:sequence> + <xsd:element name="Street" type="xsd:string" /> + <xsd:element name="City" type="xsd:string" /> + <xsd:element name="State" type="xsd:string" /> + <xsd:element name="ZipCode" type="xsd:string" /> + <xsd:element name="HomePhone" type="xsd:string" /> + </xsd:sequence> + </xsd:complexType> + </xsd:schema> + </wsdl:types> + <wsdl:message name="AuthorizeRequest"> + <wsdl:part name="parameters" element="tns:authorize"></wsdl:part> + </wsdl:message> + <wsdl:message name="AuthorizeResponse"> + <wsdl:part name="parameters" element="tns:authorizeResponse"></wsdl:part> + </wsdl:message> + <wsdl:portType name="CreditCardPayment"> + <wsdl:operation name="authorize"> + <wsdl:input message="tns:AuthorizeRequest"></wsdl:input> + <wsdl:output message="tns:AuthorizeResponse"></wsdl:output> + </wsdl:operation> + </wsdl:portType> + <wsdl:binding name="CreditCardPaymentBinding" type="tns:CreditCardPayment"> + <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" /> + <wsdl:operation name="authorize"> + <soap:operation soapAction="http://www.tuscanyscatours.com/CreditCardPayment/authorize" /> + <wsdl:input> + <soap:body use="literal" /> + </wsdl:input> + <wsdl:output> + <soap:body use="literal" /> + </wsdl:output> + </wsdl:operation> + </wsdl:binding> + <wsdl:service name="CreditCardPaymentService"> + <wsdl:port name="CreditCardPaymentPort" binding="tns:CreditCardPaymentBinding"> + <soap:address location="http://localhost:8080/CreditCardPayment" /> + </wsdl:port> + </wsdl:service> + + <plnk:partnerLinkType name="CreditCardPaymentLinkType"> + <plnk:role name="forward" portType="tns:CreditCardPayment"/> + </plnk:partnerLinkType> +</wsdl:definitions>
\ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-spring-scatag/src/main/resources/EmailGateway.wsdl b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-spring-scatag/src/main/resources/EmailGateway.wsdl new file mode 100644 index 0000000000..44867f794c --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-spring-scatag/src/main/resources/EmailGateway.wsdl @@ -0,0 +1,89 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<wsdl:definitions name="EmailGateway"
+ targetNamespace="http://www.tuscanyscatours.com/EmailGateway/"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:tns="http://www.tuscanyscatours.com/EmailGateway/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:bpws="http://schemas.xmlsoap.org/ws/2004/03/business-process/"
+ xmlns:plnk="http://schemas.xmlsoap.org/ws/2004/03/partner-link/">
+ <wsdl:types>
+ <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.tuscanyscatours.com/EmailGateway/"
+ xmlns:tns="http://www.tuscanyscatours.com/EmailGateway/">
+
+ <xsd:element name="sendEmail" type="tns:SendEmailType"/>
+ <xsd:complexType name="SendEmailType">
+ <xsd:sequence>
+ <xsd:element name="Email" type="tns:EmailType"></xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:element name="sendEmailResponse" type="tns:SendEmailResponseType"/>
+ <xsd:complexType name="SendEmailResponseType">
+ <xsd:sequence>
+ <xsd:element name="Status" type="xsd:string"></xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:complexType name="EmailType">
+ <xsd:sequence>
+ <xsd:element name="To" type="xsd:string"/>
+ <xsd:element name="Title" type="xsd:string"/>
+ <xsd:element name="Body" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:schema>
+ </wsdl:types>
+ <wsdl:message name="SendEmailRequest">
+ <wsdl:part name="parameters" element="tns:sendEmail"></wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="SendEmailResponse">
+ <wsdl:part name="parameters" element="tns:sendEmailResponse"></wsdl:part>
+ </wsdl:message>
+ <wsdl:portType name="EmailGateway">
+ <wsdl:operation name="sendEmail">
+ <wsdl:input message="tns:SendEmailRequest"></wsdl:input>
+ <wsdl:output message="tns:SendEmailResponse"></wsdl:output>
+ </wsdl:operation>
+ </wsdl:portType>
+ <wsdl:binding name="EmailGatwayBinding" type="tns:EmailGateway">
+ <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
+ <wsdl:operation name="sendEmail">
+ <soap:operation soapAction="http://www.tuscanyscatours.com/EmailGateway/sendEmail" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:service name="EmailGatewayService">
+ <wsdl:port name="EmailGatewayPort" binding="tns:EmailGatwayBinding">
+ <soap:address location="http://localhost:8088/EmailGateway" />
+ </wsdl:port>
+ </wsdl:service>
+
+ <plnk:partnerLinkType name="EmailGatewayLinkType">
+ <plnk:role name="forward" portType="tns:EmailGateway"/>
+ </plnk:partnerLinkType>
+</wsdl:definitions>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-spring-scatag/src/main/resources/META-INF/sca-contribution.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-spring-scatag/src/main/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..b480cc4aa1 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-spring-scatag/src/main/resources/META-INF/sca-contribution.xml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:scatours="http://tuscanyscatours.com/">
+ <export.java package="com.tuscanyscatours.payment"/>
+ <deployable composite="scatours:payment" />
+</contribution>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-spring-scatag/src/main/resources/Payment-context.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-spring-scatag/src/main/resources/Payment-context.xml new file mode 100644 index 0000000000..83776cde1b --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-spring-scatag/src/main/resources/Payment-context.xml @@ -0,0 +1,44 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<beans xmlns="http://www.springframework.org/schema/beans" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:sca="http://www.springframework.org/schema/sca" + xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd + http://www.springframework.org/schema/sca http://www.osoa.org/xmlns/sca/1.0/spring-sca.xsd"> + + <sca:service name="Payment" + type="com.tuscanyscatours.payment.Payment" + target="Payment"/> + + <bean id="Payment" class="com.tuscanyscatours.payment.impl.PaymentImpl"> + <property name="creditCardPayment" ref="creditCardPayment"/> + <property name="emailGateway" ref="EmailGateway"/> + <property name="transactionFee" ref="transactionFee"/> + </bean> + + <bean id="EmailGateway" class="com.tuscanyscatours.emailgateway.impl.EmailGatewayImpl"> + </bean> + + <sca:reference name="creditCardPayment" + type="com.tuscanyscatours.payment.creditcard.CreditCardPayment"/> + + <sca:property name="transactionFee" + type="java.lang.Float"/> +</beans> diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-spring-scatag/src/main/resources/Payment.wsdl b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-spring-scatag/src/main/resources/Payment.wsdl new file mode 100644 index 0000000000..e2c4062f2e --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-spring-scatag/src/main/resources/Payment.wsdl @@ -0,0 +1,83 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<wsdl:definitions name="Payment" + targetNamespace="http://www.tuscanyscatours.com/Payment/" + xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" + xmlns:tns="http://www.tuscanyscatours.com/Payment/" + xmlns:xsd="http://www.w3.org/2001/XMLSchema" + xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" + xmlns:bpws="http://schemas.xmlsoap.org/ws/2004/03/business-process/" + xmlns:plnk="http://schemas.xmlsoap.org/ws/2004/03/partner-link/"> + <wsdl:types> + <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" + targetNamespace="http://www.tuscanyscatours.com/Payment/" + xmlns:tns="http://www.tuscanyscatours.com/Payment/"> + + <xsd:complexType name="MakePaymentMemberType"> + <xsd:sequence> + <xsd:element name="CustomerId" type="xsd:string"></xsd:element> + <xsd:element name="Amount" type="xsd:float"></xsd:element> + </xsd:sequence> + </xsd:complexType> + <xsd:element name="makePaymentMember" type="tns:MakePaymentMemberType"/> + + <xsd:complexType name="MakePaymentMemberResponseType"> + <xsd:sequence> + <xsd:element name="Status" type="xsd:string"></xsd:element> + </xsd:sequence> + </xsd:complexType> + <xsd:element name="makePaymentMemberResponse" type="tns:MakePaymentMemberResponseType"/> + + </xsd:schema> + </wsdl:types> + <wsdl:message name="MakePaymentMemberRequest"> + <wsdl:part name="parameters" element="tns:makePaymentMember"></wsdl:part> + </wsdl:message> + <wsdl:message name="MakePaymentMemberResponse"> + <wsdl:part name="parameters" element="tns:makePaymentMemberResponse"></wsdl:part> + </wsdl:message> + <wsdl:portType name="Payment"> + <wsdl:operation name="makePaymentMember"> + <wsdl:input message="tns:MakePaymentMemberRequest"></wsdl:input> + <wsdl:output message="tns:MakePaymentMemberResponse"></wsdl:output> + </wsdl:operation> + </wsdl:portType> + <wsdl:binding name="PaymentBinding" type="tns:Payment"> + <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" /> + <wsdl:operation name="makePaymentMember"> + <soap:operation soapAction="http://www.tuscanyscatours.com/Payment/makePayment" /> + <wsdl:input> + <soap:body use="literal" /> + </wsdl:input> + <wsdl:output> + <soap:body use="literal" /> + </wsdl:output> + </wsdl:operation> + </wsdl:binding> + <wsdl:service name="PaymentService"> + <wsdl:port name="PaymentPort" binding="tns:PaymentBinding"> + <soap:address location="http://localhost:8080/Payment" /> + </wsdl:port> + </wsdl:service> + + <plnk:partnerLinkType name="PaymentLinkType"> + <plnk:role name="forward" portType="tns:Payment"/> + </plnk:partnerLinkType> +</wsdl:definitions>
\ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-spring-scatag/src/main/resources/payment.composite b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-spring-scatag/src/main/resources/payment.composite new file mode 100644 index 0000000000..639f1e5662 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-spring-scatag/src/main/resources/payment.composite @@ -0,0 +1,35 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" + targetNamespace="http://tuscanyscatours.com/" + name="payment"> + + <component name="Payment"> + <implementation.spring location="Payment-context.xml"/> + <service name="Payment"> + <binding.ws uri="http://localhost:8081/Payment"/> + </service> + <reference name="creditCardPayment"> + <binding.ws uri="http://localhost:8082/CreditCardPayment"/> + </reference> + <property name="transactionFee">1.23</property> + </component> + +</composite> diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-spring-scatag/src/test/java/scatours/payment/PaymentTestCase.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-spring-scatag/src/test/java/scatours/payment/PaymentTestCase.java new file mode 100644 index 0000000000..23ca9643c2 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-spring-scatag/src/test/java/scatours/payment/PaymentTestCase.java @@ -0,0 +1,75 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package scatours.payment; + +import org.apache.tuscany.sca.node.SCAClient; +import org.apache.tuscany.sca.node.SCAContribution; +import org.apache.tuscany.sca.node.SCANode; +import org.apache.tuscany.sca.node.SCANodeFactory; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +import com.tuscanyscatours.payment.Payment; + +/** + * + */ +public class PaymentTestCase { + private static SCANode paymentNode; + private static SCANode creditCardNode; + + @BeforeClass + public static void setUpBeforeClass() throws Exception { + creditCardNode = + SCANodeFactory.newInstance() + .createSCANode("creditcard.composite", + new SCAContribution("creditcard", "../creditcard-payment-jaxb/target/classes")); + + creditCardNode.start(); + + paymentNode = + SCANodeFactory.newInstance().createSCANode(null, + new SCAContribution("payment-spring-annotation", + "./target/classes"), + new SCAContribution("payment-spring-annotation-test", + "./target/test-classes")); + + paymentNode.start(); + } + + @Test + public void testPayment() { + SCAClient client = (SCAClient)paymentNode; + Payment payment = client.getService(Payment.class, "PaymentClient"); + String result = payment.makePaymentMember("Fred", 100.00f); + System.out.println("Result = " + result); + if (!"OK".equals(result)) { + throw new RuntimeException(result); + } + } + + @AfterClass + public static void tearDownAfterClass() throws Exception { + paymentNode.stop(); + creditCardNode.stop(); + } + +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-spring-scatag/src/test/java/scatours/payment/client/impl/PaymentClientImpl.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-spring-scatag/src/test/java/scatours/payment/client/impl/PaymentClientImpl.java new file mode 100644 index 0000000000..4f64b20c4e --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-spring-scatag/src/test/java/scatours/payment/client/impl/PaymentClientImpl.java @@ -0,0 +1,37 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package scatours.payment.client.impl; + +import org.osoa.sca.annotations.Reference; +import org.osoa.sca.annotations.Service; + +import com.tuscanyscatours.payment.Payment; + +@Service(Payment.class) +public class PaymentClientImpl implements Payment { + @Reference + protected Payment payment; + + public String makePaymentMember(String customerId, float amount) { + // Delegate the external web service + return payment.makePaymentMember(customerId, amount); + } + +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-spring-scatag/src/test/resources/META-INF/sca-contribution.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-spring-scatag/src/test/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..b5639eb1f9 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-spring-scatag/src/test/resources/META-INF/sca-contribution.xml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:scatours="http://tuscanyscatours.com/">
+ <import.java package="com.tuscanyscatours.payment"/>
+ <deployable composite="scatours:paymentClient" />
+</contribution>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-spring-scatag/src/test/resources/payment-client.composite b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-spring-scatag/src/test/resources/payment-client.composite new file mode 100644 index 0000000000..642cebfd1c --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-spring-scatag/src/test/resources/payment-client.composite @@ -0,0 +1,31 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" + targetNamespace="http://tuscanyscatours.com/" + name="paymentClient"> + + <component name="PaymentClient"> + <implementation.java class="scatours.payment.client.impl.PaymentClientImpl" /> + <reference name="payment"> + <binding.ws uri="http://localhost:8081/Payment" /> + </reference> + </component> + +</composite> diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-spring/build.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-spring/build.xml new file mode 100644 index 0000000000..93c9dfc660 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-spring/build.xml @@ -0,0 +1,40 @@ +<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<project name="scatours-contribution-payment-spring" default="compile">
+ <import file="../../antdefs.xml"/>
+
+ <target name="wsdljava">
+ <antcall target="wsimport">
+ <param name="wsdlfile" value="CreditCardPayment.wsdl"/>
+ <param name="javaclass" value="com/tuscanyscatours/payment/creditcard/CreditCardPayment.class"/>
+ <param name="package" value="com.tuscanyscatours.payment.creditcard"/>
+ </antcall>
+ <antcall target="wsimport">
+ <param name="wsdlfile" value="EmailGateway.wsdl"/>
+ <param name="javaclass" value="com/tuscanyscatours/emailgateway/EmailGateway.class"/>
+ <param name="package" value="com.tuscanyscatours.emailgateway"/>
+ </antcall>
+ <antcall target="wsimport">
+ <param name="wsdlfile" value="Payment.wsdl"/>
+ <param name="javaclass" value="com/tuscanyscatours/payment/Payment.class"/>
+ <param name="package" value="com.tuscanyscatours.payment"/>
+ </antcall>
+ </target>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-spring/pom.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-spring/pom.xml new file mode 100644 index 0000000000..4c963f4b99 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-spring/pom.xml @@ -0,0 +1,189 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<project> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>scatours</artifactId> + <version>1.0-SNAPSHOT</version> + <relativePath>../../pom.xml</relativePath> + </parent> + <version>1.0-SNAPSHOT</version> + <artifactId>scatours-contribution-payment-spring</artifactId> + <name>Apache Tuscany SCA Tours Payment Spring Contribution</name> + + <dependencies> + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-sca-api</artifactId> + <version>${tuscany.version}</version> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-implementation-java-runtime</artifactId> + <version>${tuscany.version}</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-binding-ws-axis2</artifactId> + <version>${tuscany.version}</version> + <scope>runtime</scope> + </dependency> + + <!-- + https://issues.apache.org/jira/browse/TUSCANY-3069 + --> + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-implementation-spring</artifactId> + <version>${tuscany.version}</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-implementation-spring-runtime</artifactId> + <version>${tuscany.version}</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-host-jetty</artifactId> + <version>${tuscany.version}</version> + <scope>test</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-node-impl</artifactId> + <version>${tuscany.version}</version> + <scope>test</scope> + </dependency> + + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>4.5</version> + <scope>test</scope> + </dependency> + + </dependencies> + + <pluginRepositories> + <pluginRepository> + <id>java.net2</id> + <name>java.net Maven 2.x Repository</name> + <url>http://download.java.net/maven/2</url> + <snapshots> + <enabled>false</enabled> + </snapshots> + </pluginRepository> + </pluginRepositories> + + <build> + <finalName>${artifactId}</finalName> + <plugins> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>build-helper-maven-plugin</artifactId> + <version>1.0</version> + <executions> + <execution> + <id>add-source</id> + <phase>generate-sources</phase> + <goals> + <goal>add-source</goal> + </goals> + <configuration> + <sources> + <source>target/jaxws-source</source> + </sources> + </configuration> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>jaxws-maven-plugin</artifactId> + <version>1.12</version> + <executions> + <execution> + <id>payment</id> + <phase>generate-sources</phase> + <goals> + <goal>wsimport</goal> + </goals> + <configuration> + <packageName>com.tuscanyscatours.payment</packageName> + <wsdlDirectory>${basedir}/src/main/resources</wsdlDirectory> + <wsdlFiles> + <wsdlFile>Payment.wsdl</wsdlFile> + </wsdlFiles> + <sourceDestDir>${project.build.directory}/jaxws-source</sourceDestDir> + <staleFile>${project.build.directory}/jaxws-source/stale/payment.stale</staleFile> + <verbose>false</verbose> + <xnocompile>true</xnocompile> + </configuration> + </execution> + <execution> + <id>payment.creditcard</id> + <phase>process-sources</phase> + <goals> + <goal>wsimport</goal> + </goals> + <configuration> + <packageName>com.tuscanyscatours.payment.creditcard</packageName> + <wsdlDirectory>${basedir}/src/main/resources</wsdlDirectory> + <wsdlFiles> + <wsdlFile>CreditCardPayment.wsdl</wsdlFile> + </wsdlFiles> + <sourceDestDir>${project.build.directory}/jaxws-source</sourceDestDir> + <staleFile>${project.build.directory}/jaxws-source/stale/creditcard.stale</staleFile> + <verbose>false</verbose> + <xnocompile>true</xnocompile> + </configuration> + </execution> + <execution> + <id>scatours.emailgateway</id> + <phase>process-sources</phase> + <goals> + <goal>wsimport</goal> + </goals> + <configuration> + <packageName>com.tuscanyscatours.emailgateway</packageName> + <wsdlDirectory>${basedir}/src/main/resources</wsdlDirectory> + <wsdlFiles> + <wsdlFile>EmailGateway.wsdl</wsdlFile> + </wsdlFiles> + <sourceDestDir>${project.build.directory}/jaxws-source</sourceDestDir> + <staleFile>${project.build.directory}/jaxws-source/stale/emailgateway.stale</staleFile> + <verbose>false</verbose> + <xnocompile>true</xnocompile> + </configuration> + </execution> + </executions> + </plugin> + </plugins> + </build> +</project> diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-spring/src/main/java/com/tuscanyscatours/customer/Customer.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-spring/src/main/java/com/tuscanyscatours/customer/Customer.java new file mode 100644 index 0000000000..3b72f81b33 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-spring/src/main/java/com/tuscanyscatours/customer/Customer.java @@ -0,0 +1,70 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package com.tuscanyscatours.customer; + +import com.tuscanyscatours.payment.creditcard.CreditCardDetailsType; + +/** + * Customer data + */ +public class Customer { + private String id; + private String email; + private String name; + + private CreditCardDetailsType creditCard; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public CreditCardDetailsType getCreditCard() { + return creditCard; + } + + public void setCreditCard(CreditCardDetailsType creditCard) { + this.creditCard = creditCard; + } + + public String toString() { + return "id: " + id + " name: " + name + " e-mail: " + email; + } + +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-spring/src/main/java/com/tuscanyscatours/customer/CustomerNotFoundException.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-spring/src/main/java/com/tuscanyscatours/customer/CustomerNotFoundException.java new file mode 100644 index 0000000000..b08f76e0fa --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-spring/src/main/java/com/tuscanyscatours/customer/CustomerNotFoundException.java @@ -0,0 +1,57 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package com.tuscanyscatours.customer; + +public class CustomerNotFoundException extends Exception { + private static final long serialVersionUID = -129752837478357452L; + + /** + * + */ + public CustomerNotFoundException() { + + } + + /** + * @param message + */ + public CustomerNotFoundException(String message) { + super(message); + + } + + /** + * @param cause + */ + public CustomerNotFoundException(Throwable cause) { + super(cause); + + } + + /** + * @param message + * @param cause + */ + public CustomerNotFoundException(String message, Throwable cause) { + super(message, cause); + + } + +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-spring/src/main/java/com/tuscanyscatours/customer/CustomerRegistry.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-spring/src/main/java/com/tuscanyscatours/customer/CustomerRegistry.java new file mode 100644 index 0000000000..706167d567 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-spring/src/main/java/com/tuscanyscatours/customer/CustomerRegistry.java @@ -0,0 +1,39 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package com.tuscanyscatours.customer; + +import java.util.Collection; + +import com.tuscanyscatours.payment.creditcard.CreditCardDetailsType; + +/** + * Customer registry interface + */ +public interface CustomerRegistry { + Customer createCustomer(String name, String email, CreditCardDetailsType creditCard); + + boolean updateCustomer(Customer customer); + + Customer getCustomer(String id) throws CustomerNotFoundException; + + Collection<Customer> getAllCustomers(); + + boolean deleteCustomer(String id); +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-spring/src/main/java/com/tuscanyscatours/customer/impl/CustomerRegistryImpl.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-spring/src/main/java/com/tuscanyscatours/customer/impl/CustomerRegistryImpl.java new file mode 100644 index 0000000000..26926c7764 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-spring/src/main/java/com/tuscanyscatours/customer/impl/CustomerRegistryImpl.java @@ -0,0 +1,115 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package com.tuscanyscatours.customer.impl; + +import java.util.Collection; +import java.util.HashMap; +import java.util.Map; + +import org.osoa.sca.annotations.Destroy; +import org.osoa.sca.annotations.EagerInit; +import org.osoa.sca.annotations.Init; +import org.osoa.sca.annotations.Requires; +import org.osoa.sca.annotations.Scope; +import org.osoa.sca.annotations.Service; + +import com.tuscanyscatours.customer.Customer; +import com.tuscanyscatours.customer.CustomerNotFoundException; +import com.tuscanyscatours.customer.CustomerRegistry; +import com.tuscanyscatours.payment.creditcard.CreditCardDetailsType; +import com.tuscanyscatours.payment.creditcard.CreditCardTypeType; +import com.tuscanyscatours.payment.creditcard.ObjectFactory; +import com.tuscanyscatours.payment.creditcard.PayerType; + +/** + * An in-memory customer registry implementation + */ +@Service(CustomerRegistry.class) +@Scope("COMPOSITE") +@EagerInit +@Requires("{http://www.osoa.org/xmlns/sca/1.0}managedTransaction.global") +public class CustomerRegistryImpl implements CustomerRegistry { + private volatile static int idGenerator = 0; + private Map<String, Customer> customers = new HashMap<String, Customer>(); + + @Init + public void init() { + // Load the customers + ObjectFactory factory = new ObjectFactory(); + CreditCardDetailsType cc = factory.createCreditCardDetailsType(); + PayerType john = factory.createPayerType(); + john.setName("John Smith"); + cc.setCardOwner(john); + cc.setCreditCardNumber("1111-2222-3333-4444"); + cc.setCreditCardType(CreditCardTypeType.VISA); + cc.setCVV2("1234"); + cc.setExpMonth(1); + cc.setExpYear(2012); + createCustomer("John Smith", "john@xyz.com", cc); + } + + @Destroy + public void destroy() { + // Save the customers + } + + public Customer createCustomer(String name, String email, CreditCardDetailsType creditCard) { + Customer customer = new Customer(); + customer.setId("c-" + idGenerator++); + customer.setName(name); + customer.setEmail(email); + customer.setCreditCard(creditCard); + customers.put(customer.getId(), customer); + return customer; + } + + public boolean deleteCustomer(String id) { + return customers.remove(id) != null; + } + + public Collection<Customer> getAllCustomers() { + return customers.values(); + } + + public Customer getCustomer(String id) throws CustomerNotFoundException { + Customer customer = customers.get(id); + + if (customer == null) { + throw new CustomerNotFoundException("Customer " + id + " not found"); + } + + return customer; + } + + public boolean updateCustomer(Customer customer) { + Customer current = null; + try { + current = getCustomer(customer.getId()); + } catch (Exception ex) { + return false; + } + + current.setEmail(customer.getEmail()); + current.setName(customer.getName()); + current.setCreditCard(customer.getCreditCard()); + return true; + } + +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-spring/src/main/java/com/tuscanyscatours/emailgateway/impl/EmailGatewayImpl.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-spring/src/main/java/com/tuscanyscatours/emailgateway/impl/EmailGatewayImpl.java new file mode 100644 index 0000000000..5eb825cb85 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-spring/src/main/java/com/tuscanyscatours/emailgateway/impl/EmailGatewayImpl.java @@ -0,0 +1,32 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package com.tuscanyscatours.emailgateway.impl; + +import com.tuscanyscatours.emailgateway.EmailGateway; +import com.tuscanyscatours.emailgateway.EmailType; + +public class EmailGatewayImpl implements EmailGateway { + + public String sendEmail(EmailType email) { + System.out.println("Sending mail to " + email.getTo()); + return "SENT"; + } + +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-spring/src/main/java/com/tuscanyscatours/payment/impl/PaymentImpl.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-spring/src/main/java/com/tuscanyscatours/payment/impl/PaymentImpl.java new file mode 100644 index 0000000000..a35f761dc7 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-spring/src/main/java/com/tuscanyscatours/payment/impl/PaymentImpl.java @@ -0,0 +1,77 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package com.tuscanyscatours.payment.impl; + +import com.tuscanyscatours.customer.Customer; +import com.tuscanyscatours.customer.CustomerNotFoundException; +import com.tuscanyscatours.customer.CustomerRegistry; +import com.tuscanyscatours.emailgateway.EmailGateway; +import com.tuscanyscatours.emailgateway.EmailType; +import com.tuscanyscatours.payment.Payment; +import com.tuscanyscatours.payment.creditcard.CreditCardPayment; + +public class PaymentImpl implements Payment { + + private CreditCardPayment creditCardPayment; + private CustomerRegistry customerRegistry; + private EmailGateway emailGateway; + private float transactionFee; + + public void setCreditCardPayment(CreditCardPayment creditCardPayment) { + this.creditCardPayment = creditCardPayment; + } + + public void setCustomerRegistry(CustomerRegistry customerRegistry) { + this.customerRegistry = customerRegistry; + } + + public void setEmailGateway(EmailGateway emailGateway) { + this.emailGateway = emailGateway; + } + + public void setTransactionFee(Float transactionFee) { + this.transactionFee = transactionFee; + } + + public String makePaymentMember(String customerId, float amount) { + try { + Customer customer = customerRegistry.getCustomer(customerId); + + amount += transactionFee; + + String status = creditCardPayment.authorize(customer.getCreditCard(), amount); + + com.tuscanyscatours.emailgateway.ObjectFactory emailFactory = + new com.tuscanyscatours.emailgateway.ObjectFactory(); + EmailType email = emailFactory.createEmailType(); + email.setTitle("Payment Received"); + email.setTo(customerId); + + emailGateway.sendEmail(email); + + return status; + } catch (CustomerNotFoundException ex) { + return "Payment failed due to " + ex.getMessage(); + } catch (Throwable t) { + return "Payment failed due to system error " + t.getMessage(); + } + } + +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-spring/src/main/resources/CreditCardPayment.wsdl b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-spring/src/main/resources/CreditCardPayment.wsdl new file mode 100644 index 0000000000..8224cd126f --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-spring/src/main/resources/CreditCardPayment.wsdl @@ -0,0 +1,118 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<wsdl:definitions name="CreditCardPayment" + targetNamespace="http://www.tuscanyscatours.com/CreditCardPayment/" + xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" + xmlns:tns="http://www.tuscanyscatours.com/CreditCardPayment/" + xmlns:xsd="http://www.w3.org/2001/XMLSchema" + xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" + xmlns:bpws="http://schemas.xmlsoap.org/ws/2004/03/business-process/" + xmlns:plnk="http://schemas.xmlsoap.org/ws/2004/03/partner-link/"> + <wsdl:types> + <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" + targetNamespace="http://www.tuscanyscatours.com/CreditCardPayment/" + xmlns:tns="http://www.tuscanyscatours.com/CreditCardPayment/"> + + <xsd:element name="authorize"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="CreditCard" type="tns:CreditCardDetailsType"></xsd:element> + <xsd:element name="Amount" type="xsd:float"></xsd:element> + </xsd:sequence> + </xsd:complexType> + </xsd:element> + + <xsd:element name="authorizeResponse"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="Status" type="xsd:string"></xsd:element> + </xsd:sequence> + </xsd:complexType> + </xsd:element> + + <xsd:complexType name="CreditCardDetailsType"> + <xsd:sequence> + <xsd:element name="CreditCardType" type="tns:CreditCardTypeType" minOccurs="0" /> + <xsd:element name="CreditCardNumber" type="xsd:string" minOccurs="0" /> + <xsd:element name="ExpMonth" type="xsd:int" minOccurs="0" /> + <xsd:element name="ExpYear" type="xsd:int" minOccurs="0" /> + <xsd:element name="CardOwner" type="tns:PayerType" minOccurs="0" /> + <xsd:element name="CVV2" type="xsd:string" minOccurs="0" /> + </xsd:sequence> + </xsd:complexType> + <xsd:simpleType name="CreditCardTypeType"> + <xsd:restriction base="xsd:token"> + <xsd:enumeration value="Visa" /> + <xsd:enumeration value="MasterCard" /> + <xsd:enumeration value="Discover" /> + <xsd:enumeration value="Amex" /> + </xsd:restriction> + </xsd:simpleType> + <xsd:complexType name="PayerType"> + <xsd:sequence> + <xsd:element name="Name" type="xsd:string" /> + <xsd:element name="Address" type="tns:AddressType" /> + </xsd:sequence> + </xsd:complexType> + <xsd:complexType name="AddressType"> + <xsd:sequence> + <xsd:element name="Street" type="xsd:string" /> + <xsd:element name="City" type="xsd:string" /> + <xsd:element name="State" type="xsd:string" /> + <xsd:element name="ZipCode" type="xsd:string" /> + <xsd:element name="HomePhone" type="xsd:string" /> + </xsd:sequence> + </xsd:complexType> + </xsd:schema> + </wsdl:types> + <wsdl:message name="AuthorizeRequest"> + <wsdl:part name="parameters" element="tns:authorize"></wsdl:part> + </wsdl:message> + <wsdl:message name="AuthorizeResponse"> + <wsdl:part name="parameters" element="tns:authorizeResponse"></wsdl:part> + </wsdl:message> + <wsdl:portType name="CreditCardPayment"> + <wsdl:operation name="authorize"> + <wsdl:input message="tns:AuthorizeRequest"></wsdl:input> + <wsdl:output message="tns:AuthorizeResponse"></wsdl:output> + </wsdl:operation> + </wsdl:portType> + <wsdl:binding name="CreditCardPaymentBinding" type="tns:CreditCardPayment"> + <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" /> + <wsdl:operation name="authorize"> + <soap:operation soapAction="http://www.tuscanyscatours.com/CreditCardPayment/authorize" /> + <wsdl:input> + <soap:body use="literal" /> + </wsdl:input> + <wsdl:output> + <soap:body use="literal" /> + </wsdl:output> + </wsdl:operation> + </wsdl:binding> + <wsdl:service name="CreditCardPaymentService"> + <wsdl:port name="CreditCardPaymentPort" binding="tns:CreditCardPaymentBinding"> + <soap:address location="http://localhost:8080/CreditCardPayment" /> + </wsdl:port> + </wsdl:service> + + <plnk:partnerLinkType name="CreditCardPaymentLinkType"> + <plnk:role name="forward" portType="tns:CreditCardPayment"/> + </plnk:partnerLinkType> +</wsdl:definitions>
\ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-spring/src/main/resources/EmailGateway.wsdl b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-spring/src/main/resources/EmailGateway.wsdl new file mode 100644 index 0000000000..44867f794c --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-spring/src/main/resources/EmailGateway.wsdl @@ -0,0 +1,89 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<wsdl:definitions name="EmailGateway"
+ targetNamespace="http://www.tuscanyscatours.com/EmailGateway/"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:tns="http://www.tuscanyscatours.com/EmailGateway/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:bpws="http://schemas.xmlsoap.org/ws/2004/03/business-process/"
+ xmlns:plnk="http://schemas.xmlsoap.org/ws/2004/03/partner-link/">
+ <wsdl:types>
+ <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.tuscanyscatours.com/EmailGateway/"
+ xmlns:tns="http://www.tuscanyscatours.com/EmailGateway/">
+
+ <xsd:element name="sendEmail" type="tns:SendEmailType"/>
+ <xsd:complexType name="SendEmailType">
+ <xsd:sequence>
+ <xsd:element name="Email" type="tns:EmailType"></xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:element name="sendEmailResponse" type="tns:SendEmailResponseType"/>
+ <xsd:complexType name="SendEmailResponseType">
+ <xsd:sequence>
+ <xsd:element name="Status" type="xsd:string"></xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:complexType name="EmailType">
+ <xsd:sequence>
+ <xsd:element name="To" type="xsd:string"/>
+ <xsd:element name="Title" type="xsd:string"/>
+ <xsd:element name="Body" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:schema>
+ </wsdl:types>
+ <wsdl:message name="SendEmailRequest">
+ <wsdl:part name="parameters" element="tns:sendEmail"></wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="SendEmailResponse">
+ <wsdl:part name="parameters" element="tns:sendEmailResponse"></wsdl:part>
+ </wsdl:message>
+ <wsdl:portType name="EmailGateway">
+ <wsdl:operation name="sendEmail">
+ <wsdl:input message="tns:SendEmailRequest"></wsdl:input>
+ <wsdl:output message="tns:SendEmailResponse"></wsdl:output>
+ </wsdl:operation>
+ </wsdl:portType>
+ <wsdl:binding name="EmailGatwayBinding" type="tns:EmailGateway">
+ <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
+ <wsdl:operation name="sendEmail">
+ <soap:operation soapAction="http://www.tuscanyscatours.com/EmailGateway/sendEmail" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:service name="EmailGatewayService">
+ <wsdl:port name="EmailGatewayPort" binding="tns:EmailGatwayBinding">
+ <soap:address location="http://localhost:8088/EmailGateway" />
+ </wsdl:port>
+ </wsdl:service>
+
+ <plnk:partnerLinkType name="EmailGatewayLinkType">
+ <plnk:role name="forward" portType="tns:EmailGateway"/>
+ </plnk:partnerLinkType>
+</wsdl:definitions>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-spring/src/main/resources/META-INF/sca-contribution.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-spring/src/main/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..b480cc4aa1 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-spring/src/main/resources/META-INF/sca-contribution.xml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:scatours="http://tuscanyscatours.com/">
+ <export.java package="com.tuscanyscatours.payment"/>
+ <deployable composite="scatours:payment" />
+</contribution>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-spring/src/main/resources/Payment-context.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-spring/src/main/resources/Payment-context.xml new file mode 100644 index 0000000000..f27280bf2f --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-spring/src/main/resources/Payment-context.xml @@ -0,0 +1,39 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<beans xmlns="http://www.springframework.org/schema/beans" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:sca="http://www.springframework.org/schema/sca" + xsi:schemaLocation="http://www.springframework.org/schema/beans + http://www.springframework.org/schema/beans/spring-beans.xsd"> + + <bean id="Payment" class="com.tuscanyscatours.payment.impl.PaymentImpl"> + <property name="creditCardPayment" ref="creditCardPaymentReference"/> + <property name="emailGateway" ref="EmailGateway"/> + <property name="customerRegistry" ref="CustomerRegistry"/> + <property name="transactionFee" value="0.5f"/> + </bean> + + <bean id="CustomerRegistry" class="com.tuscanyscatours.customer.impl.CustomerRegistryImpl"> + </bean> + + <bean id="EmailGateway" class="com.tuscanyscatours.emailgateway.impl.EmailGatewayImpl"> + </bean> + +</beans> diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-spring/src/main/resources/Payment.wsdl b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-spring/src/main/resources/Payment.wsdl new file mode 100644 index 0000000000..e2c4062f2e --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-spring/src/main/resources/Payment.wsdl @@ -0,0 +1,83 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<wsdl:definitions name="Payment" + targetNamespace="http://www.tuscanyscatours.com/Payment/" + xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" + xmlns:tns="http://www.tuscanyscatours.com/Payment/" + xmlns:xsd="http://www.w3.org/2001/XMLSchema" + xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" + xmlns:bpws="http://schemas.xmlsoap.org/ws/2004/03/business-process/" + xmlns:plnk="http://schemas.xmlsoap.org/ws/2004/03/partner-link/"> + <wsdl:types> + <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" + targetNamespace="http://www.tuscanyscatours.com/Payment/" + xmlns:tns="http://www.tuscanyscatours.com/Payment/"> + + <xsd:complexType name="MakePaymentMemberType"> + <xsd:sequence> + <xsd:element name="CustomerId" type="xsd:string"></xsd:element> + <xsd:element name="Amount" type="xsd:float"></xsd:element> + </xsd:sequence> + </xsd:complexType> + <xsd:element name="makePaymentMember" type="tns:MakePaymentMemberType"/> + + <xsd:complexType name="MakePaymentMemberResponseType"> + <xsd:sequence> + <xsd:element name="Status" type="xsd:string"></xsd:element> + </xsd:sequence> + </xsd:complexType> + <xsd:element name="makePaymentMemberResponse" type="tns:MakePaymentMemberResponseType"/> + + </xsd:schema> + </wsdl:types> + <wsdl:message name="MakePaymentMemberRequest"> + <wsdl:part name="parameters" element="tns:makePaymentMember"></wsdl:part> + </wsdl:message> + <wsdl:message name="MakePaymentMemberResponse"> + <wsdl:part name="parameters" element="tns:makePaymentMemberResponse"></wsdl:part> + </wsdl:message> + <wsdl:portType name="Payment"> + <wsdl:operation name="makePaymentMember"> + <wsdl:input message="tns:MakePaymentMemberRequest"></wsdl:input> + <wsdl:output message="tns:MakePaymentMemberResponse"></wsdl:output> + </wsdl:operation> + </wsdl:portType> + <wsdl:binding name="PaymentBinding" type="tns:Payment"> + <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" /> + <wsdl:operation name="makePaymentMember"> + <soap:operation soapAction="http://www.tuscanyscatours.com/Payment/makePayment" /> + <wsdl:input> + <soap:body use="literal" /> + </wsdl:input> + <wsdl:output> + <soap:body use="literal" /> + </wsdl:output> + </wsdl:operation> + </wsdl:binding> + <wsdl:service name="PaymentService"> + <wsdl:port name="PaymentPort" binding="tns:PaymentBinding"> + <soap:address location="http://localhost:8080/Payment" /> + </wsdl:port> + </wsdl:service> + + <plnk:partnerLinkType name="PaymentLinkType"> + <plnk:role name="forward" portType="tns:Payment"/> + </plnk:partnerLinkType> +</wsdl:definitions>
\ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-spring/src/main/resources/payment.composite b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-spring/src/main/resources/payment.composite new file mode 100644 index 0000000000..1e5bae2a2b --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-spring/src/main/resources/payment.composite @@ -0,0 +1,35 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" + targetNamespace="http://tuscanyscatours.com/" + name="payment"> + + <component name="Payment"> + <implementation.spring location="Payment-context.xml"/> + <service name="Payment"> + <binding.ws uri="http://localhost:8081/Payment"/> + </service> + <reference name="creditCardPaymentReference"> + <binding.ws uri="http://localhost:8082/CreditCardPayment"/> + </reference> + <property name="transactionFee">1.23</property> + </component> + +</composite> diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-spring/src/test/java/scatours/payment/PaymentTestCase.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-spring/src/test/java/scatours/payment/PaymentTestCase.java new file mode 100644 index 0000000000..e1634c95f9 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-spring/src/test/java/scatours/payment/PaymentTestCase.java @@ -0,0 +1,74 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package scatours.payment; + +import org.apache.tuscany.sca.node.SCAClient; +import org.apache.tuscany.sca.node.SCAContribution; +import org.apache.tuscany.sca.node.SCANode; +import org.apache.tuscany.sca.node.SCANodeFactory; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +import com.tuscanyscatours.payment.Payment; + +/** + * + */ +public class PaymentTestCase { + private static SCANode paymentNode; + private static SCANode creditCardNode; + + @BeforeClass + public static void setUpBeforeClass() throws Exception { + creditCardNode = + SCANodeFactory.newInstance() + .createSCANode("creditcard.composite", + new SCAContribution("creditcard", "../creditcard-payment-jaxb/target/classes")); + + creditCardNode.start(); + + paymentNode = + SCANodeFactory.newInstance().createSCANode(null, + new SCAContribution("payment-spring", "./target/classes"), + new SCAContribution("payment-spring-test", + "./target/test-classes")); + + paymentNode.start(); + } + + @Test + public void testPayment() { + SCAClient client = (SCAClient)paymentNode; + Payment payment = client.getService(Payment.class, "PaymentClient"); + String result = payment.makePaymentMember("c-0", 100.00f); + System.out.println("Result = " + result); + if (!"OK".equals(result)) { + throw new RuntimeException(result); + } + } + + @AfterClass + public static void tearDownAfterClass() throws Exception { + paymentNode.stop(); + creditCardNode.stop(); + } + +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-spring/src/test/java/scatours/payment/client/impl/PaymentClientImpl.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-spring/src/test/java/scatours/payment/client/impl/PaymentClientImpl.java new file mode 100644 index 0000000000..4f64b20c4e --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-spring/src/test/java/scatours/payment/client/impl/PaymentClientImpl.java @@ -0,0 +1,37 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package scatours.payment.client.impl; + +import org.osoa.sca.annotations.Reference; +import org.osoa.sca.annotations.Service; + +import com.tuscanyscatours.payment.Payment; + +@Service(Payment.class) +public class PaymentClientImpl implements Payment { + @Reference + protected Payment payment; + + public String makePaymentMember(String customerId, float amount) { + // Delegate the external web service + return payment.makePaymentMember(customerId, amount); + } + +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-spring/src/test/resources/META-INF/sca-contribution.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-spring/src/test/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..b5639eb1f9 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-spring/src/test/resources/META-INF/sca-contribution.xml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:scatours="http://tuscanyscatours.com/">
+ <import.java package="com.tuscanyscatours.payment"/>
+ <deployable composite="scatours:paymentClient" />
+</contribution>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-spring/src/test/resources/payment-client.composite b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-spring/src/test/resources/payment-client.composite new file mode 100644 index 0000000000..642cebfd1c --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-spring/src/test/resources/payment-client.composite @@ -0,0 +1,31 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" + targetNamespace="http://tuscanyscatours.com/" + name="paymentClient"> + + <component name="PaymentClient"> + <implementation.java class="scatours.payment.client.impl.PaymentClientImpl" /> + <reference name="payment"> + <binding.ws uri="http://localhost:8081/Payment" /> + </reference> + </component> + +</composite> diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/policy-client/build.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/policy-client/build.xml new file mode 100644 index 0000000000..2a85f58a3f --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/policy-client/build.xml @@ -0,0 +1,33 @@ +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> + +<project name="scatours-contribution-policy-client" default="compile"> + <import file="../../antdefs.xml"/> + <path id="compile-path"> + <pathelement path="../common/target/scatours-contribution-common.jar"/> + </path> + + <target name="wsdljava"> + <antcall target="wsimport"> + <param name="wsdlfile" value="Payment.wsdl"/> + <param name="javaclass" value="com/tuscanyscatours/payment/Payment.class"/> + <param name="package" value="com.tuscanyscatours.payment"/> + </antcall> + </target> +</project> diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/policy-client/maven-eclipse.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/policy-client/maven-eclipse.xml new file mode 100644 index 0000000000..4ceebd71f7 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/policy-client/maven-eclipse.xml @@ -0,0 +1,8 @@ +<project default="copy-resources"> + <target name="init"/> + <target name="copy-resources" depends="init"> + <copy todir="target/classes/META-INF" filtering="true"> + <fileset dir="." includes="LICENSE|NOTICE"/> + </copy> + </target> +</project>
\ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/policy-client/pom.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/policy-client/pom.xml new file mode 100644 index 0000000000..b304838d47 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/policy-client/pom.xml @@ -0,0 +1,107 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<project> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>scatours</artifactId> + <version>1.0-SNAPSHOT</version> + <relativePath>../../pom.xml</relativePath> + </parent><version>1.0-SNAPSHOT</version> + <artifactId>scatours-contribution-policy-client</artifactId> + <name>Apache Tuscany SCA Tours Policy Client Contribution</name> + + <dependencies> + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-sca-api</artifactId> + <version>${tuscany.version}</version> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>scatours-contribution-common</artifactId> + <version>${pom.version}</version> + <scope>provided</scope> + </dependency> + + <dependency> + <groupId>javax.xml.ws</groupId> + <artifactId>jaxws-api</artifactId> + <version>2.1</version> + <exclusions> + <exclusion> + <groupId>javax.xml.soap</groupId> + <artifactId>saaj-api</artifactId> + </exclusion> + </exclusions> + </dependency> + + </dependencies> + + <build> + <finalName>${artifactId}</finalName> + <plugins> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>build-helper-maven-plugin</artifactId> + <version>1.0</version> + <executions> + <execution> + <id>add-source</id> + <phase>generate-sources</phase> + <goals> + <goal>add-source</goal> + </goals> + <configuration> + <sources> + <source>target/jaxws-source</source> + </sources> + </configuration> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>jaxws-maven-plugin</artifactId> + <version>1.12</version> + <executions> + <execution> + <id>payment</id> + <phase>generate-sources</phase> + <goals> + <goal>wsimport</goal> + </goals> + <configuration> + <packageName>com.tuscanyscatours.payment</packageName> + <wsdlDirectory>${basedir}/src/main/resources</wsdlDirectory> + <wsdlFiles> + <wsdlFile>Payment.wsdl</wsdlFile> + </wsdlFiles> + <sourceDestDir>${project.build.directory}/jaxws-source</sourceDestDir> + <verbose>false</verbose> + <xnocompile>true</xnocompile> + </configuration> + </execution> + </executions> + </plugin> + </plugins> + </build> +</project> diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/policy-client/src/main/java/scatours/client/TestClient.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/policy-client/src/main/java/scatours/client/TestClient.java new file mode 100644 index 0000000000..6f1243b103 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/policy-client/src/main/java/scatours/client/TestClient.java @@ -0,0 +1,60 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package scatours.client; + + +import org.osoa.sca.annotations.Reference; +import org.osoa.sca.annotations.Service; + +import com.tuscanyscatours.payment.Payment; + +import com.tuscanyscatours.common.Book; +import com.tuscanyscatours.common.TripItem; + +/** + * A client for calling payment and trip components directly. The components in this + * case are expected to have policy configuration associated with the in the + * composite files that define them + * + */ +@Service(Runnable.class) +public class TestClient { + @Reference + protected Payment payment; + + @Reference + protected Book tripBooking; + + public TestClient() { + } + + public void run() { + System.out.println("==============================================="); + System.out.println("Test the loggin policy by calling the trip component"); + TripItem tripItem = + new TripItem("1234", "5678", TripItem.TRIP, "FS1DEC06", "Florence and Siena pre-packaged tour", "FLR", + "06/12/09", "13/12/09", 450, "EUR", "http://localhost:8085/tbd"); + System.out.println("Result = " + tripBooking.book(tripItem)); + System.out.println("==============================================="); + System.out.println("Test the basic authentication policy by calling the payment component"); + System.out.println("TestClient - Successful Payment - Status = " + payment.makePaymentMember("c-0", 100.00f)); + System.out.println("==============================================="); + } +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/policy-client/src/main/resources/META-INF/sca-contribution.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/policy-client/src/main/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..4300ce0dc0 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/policy-client/src/main/resources/META-INF/sca-contribution.xml @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0" + xmlns:client="http://client.scatours/"> + <import.java package="payment" /> + <import.java package="com.tuscanyscatours.common"/> + <deployable composite="client:Client" /> +</contribution> diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/policy-client/src/main/resources/Payment.wsdl b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/policy-client/src/main/resources/Payment.wsdl new file mode 100644 index 0000000000..2519d7642e --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/policy-client/src/main/resources/Payment.wsdl @@ -0,0 +1,83 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<wsdl:definitions name="Payment" + targetNamespace="http://www.tuscanyscatours.com/Payment/" + xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" + xmlns:tns="http://www.tuscanyscatours.com/Payment/" + xmlns:xsd="http://www.w3.org/2001/XMLSchema" + xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" + xmlns:bpws="http://schemas.xmlsoap.org/ws/2004/03/business-process/" + xmlns:plnk="http://schemas.xmlsoap.org/ws/2004/03/partner-link/"> + <wsdl:types> + <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" + targetNamespace="http://www.tuscanyscatours.com/Payment/" + xmlns:tns="http://www.tuscanyscatours.com/Payment/"> + + <xsd:complexType name="MakePaymentMemberType"> + <xsd:sequence> + <xsd:element name="CustomerId" type="xsd:string"></xsd:element> + <xsd:element name="Amount" type="xsd:float"></xsd:element> + </xsd:sequence> + </xsd:complexType> + <xsd:element name="makePaymentMember" type="tns:MakePaymentMemberType"/> + + <xsd:complexType name="MakePaymentMemberResponseType"> + <xsd:sequence> + <xsd:element name="Status" type="xsd:string"></xsd:element> + </xsd:sequence> + </xsd:complexType> + <xsd:element name="makePaymentMemberResponse" type="tns:MakePaymentMemberResponseType"/> + + </xsd:schema> + </wsdl:types> + <wsdl:message name="MakePaymentMemberRequest"> + <wsdl:part name="parameters" element="tns:makePaymentMember"></wsdl:part> + </wsdl:message> + <wsdl:message name="MakePaymentMemberResponse"> + <wsdl:part name="parameters" element="tns:makePaymentMemberResponse"></wsdl:part> + </wsdl:message> + <wsdl:portType name="Payment"> + <wsdl:operation name="makePaymentMember"> + <wsdl:input message="tns:MakePaymentMemberRequest"></wsdl:input> + <wsdl:output message="tns:MakePaymentMemberResponse"></wsdl:output> + </wsdl:operation> + </wsdl:portType> + <wsdl:binding name="PaymentBinding" type="tns:Payment"> + <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" /> + <wsdl:operation name="makePaymentMember"> + <soap:operation soapAction="http://www.tuscanyscatours.com/Payment/makePayment" /> + <wsdl:input> + <soap:body use="literal" /> + </wsdl:input> + <wsdl:output> + <soap:body use="literal" /> + </wsdl:output> + </wsdl:operation> + </wsdl:binding> + <wsdl:service name="PaymentService"> + <wsdl:port name="PaymentPort" binding="tns:PaymentBinding"> + <soap:address location="http://localhost:8083/Payment" /> + </wsdl:port> + </wsdl:service> + + <plnk:partnerLinkType name="PaymentLinkType"> + <plnk:role name="forward" portType="tns:Payment"/> + </plnk:partnerLinkType> +</wsdl:definitions>
\ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/policy-client/src/main/resources/client.composite b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/policy-client/src/main/resources/client.composite new file mode 100644 index 0000000000..5b632b4be2 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/policy-client/src/main/resources/client.composite @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" + targetNamespace="http://client.scatours/" + name="Client"> + + <component name="TestClient"> + <implementation.java class="scatours.client.TestClient" /> + <reference name="payment" target="Payment/Payment" /> + <reference name="tripBooking" target="Trip/Book" /> + </component> +</composite> diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/pom.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/pom.xml new file mode 100644 index 0000000000..f6475d0db8 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/pom.xml @@ -0,0 +1,104 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <version>1.0-SNAPSHOT</version>
+ <artifactId>scatours-contributions</artifactId>
+ <packaging>pom</packaging>
+ <name>Apache Tuscany SCA Tours Contributions</name>
+
+ <profiles>
+ <profile>
+ <id>default</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ <modules>
+ <module>blog-feed</module>
+ <module>buildingblocks</module>
+ <module>buildingblocks-client</module>
+ <module>calendar</module>
+ <module>car</module>
+ <module>common</module>
+ <module>creditcard-payment-jaxb</module>
+ <module>creditcard-payment-jaxb-policy</module>
+ <module>creditcard-payment-sdo</module>
+ <module>creditcard-payment-webapp</module>
+ <module>currency</module>
+ <module>currency-corba</module>
+ <module>currency-jms</module>
+ <module>currency-jsp</module>
+ <module>currency-rmi</module>
+ <module>currency-servlet</module>
+ <module>currency-ws</module>
+ <module>databinding-client</module>
+ <module>emailgateway</module>
+ <module>feed-logger</module>
+ <module>flight</module>
+ <module>fullapp-ui</module>
+ <module>fullapp-coordination</module>
+ <module>fullapp-currency</module>
+ <module>fullapp-packagedtrip</module>
+ <module>fullapp-bespoketrip</module>
+ <module>fullapp-shoppingcart</module>
+ <module>help-pages</module>
+ <module>hotel</module>
+ <module>interaction-client</module>
+ <module>interaction-service-remote</module>
+ <module>introducing-client</module>
+ <module>introducing-tours</module>
+ <module>introducing-trips</module>
+ <module>notification</module>
+ <module>notification-ws</module>
+ <module>notification-corba</module>
+ <module>notification-ejb</module>
+ <module>notification-jms</module>
+ <module>notification-rmi</module>
+ <module>shoppingcart</module>
+ <module>travelcatalog</module>
+ <module>tripbooking</module>
+ <module>trip</module>
+ <module>scatours</module>
+ <module>payment-java</module>
+ <module>payment-java-callback</module>
+ <module>payment-java-policy</module>
+ <module>payment-java-reference-pass</module>
+ <module>payment-spring</module>
+ <module>payment-spring-policy</module>
+ <module>payment-spring-scatag</module>
+ <module>payment-bpel-process</module>
+ <module>payment-bpel</module>
+ <module>payment-groovy</module>
+ <module>payment-python</module>
+ <module>policy-client</module>
+ <module>trip-policy</module>
+ <module>using</module>
+ </modules>
+ </profile>
+
+ </profiles>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/scatours/build.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/scatours/build.xml new file mode 100644 index 0000000000..bdb8f8ecc4 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/scatours/build.xml @@ -0,0 +1,28 @@ +<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<project name="scatours-contribution-scatours" default="compile">
+ <import file="../../antdefs.xml"/>
+ <path id="compile-path">
+ <pathelement path="../common/target/scatours-contribution-common.jar"/>
+ <pathelement path="../shoppingcart/target/scatours-contribution-shoppingcart.jar"/>
+ <pathelement path="../travelcatalog/target/scatours-contribution-travelcatalog.jar"/>
+ <pathelement path="../tripbooking/target/scatours-contribution-tripbooking.jar"/>
+ </path>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/scatours/pom.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/scatours/pom.xml new file mode 100644 index 0000000000..8f291690df --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/scatours/pom.xml @@ -0,0 +1,78 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent><version>1.0-SNAPSHOT</version>
+ <artifactId>scatours-contribution-scatours</artifactId>
+ <name>Apache Tuscany SCA Tours SCATours Contribution</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca-api</artifactId>
+ <version>${tuscany.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-contribution-common</artifactId>
+ <version>${pom.version}</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-contribution-travelcatalog</artifactId>
+ <version>${pom.version}</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-contribution-tripbooking</artifactId>
+ <version>${pom.version}</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-contribution-shoppingcart</artifactId>
+ <version>${pom.version}</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.5</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ </build>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/scatours/src/main/java/com/tuscanyscatours/SCAToursBooking.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/scatours/src/main/java/com/tuscanyscatours/SCAToursBooking.java new file mode 100644 index 0000000000..a1e0d6c91f --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/scatours/src/main/java/com/tuscanyscatours/SCAToursBooking.java @@ -0,0 +1,31 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package com.tuscanyscatours;
+
+import org.osoa.sca.annotations.Remotable;
+
+import com.tuscanyscatours.common.TripItem;
+
+/**
+ * The SCA Tours trip booking service interface
+ */
+@Remotable
+public interface SCAToursBooking {
+ String bookTrip(String cartId, TripItem tripId);
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/scatours/src/main/java/com/tuscanyscatours/SCAToursCart.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/scatours/src/main/java/com/tuscanyscatours/SCAToursCart.java new file mode 100644 index 0000000000..f9554342e9 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/scatours/src/main/java/com/tuscanyscatours/SCAToursCart.java @@ -0,0 +1,35 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package com.tuscanyscatours;
+
+import org.osoa.sca.annotations.Remotable;
+
+import com.tuscanyscatours.common.TripItem;
+
+/**
+ * The ShoppingCart service interface
+ */
+@Remotable
+public interface SCAToursCart {
+ String newCart();
+
+ TripItem[] getTrips(String cartId);
+
+ void checkout(String cartId);
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/scatours/src/main/java/com/tuscanyscatours/SCAToursSearch.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/scatours/src/main/java/com/tuscanyscatours/SCAToursSearch.java new file mode 100644 index 0000000000..6ce03fbb86 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/scatours/src/main/java/com/tuscanyscatours/SCAToursSearch.java @@ -0,0 +1,32 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package com.tuscanyscatours;
+
+import org.osoa.sca.annotations.Remotable;
+
+import com.tuscanyscatours.common.TripItem;
+import com.tuscanyscatours.common.TripLeg;
+
+/**
+ * The Search service interface
+ */
+@Remotable
+public interface SCAToursSearch {
+ TripItem[] search(TripLeg tripLeg);
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/scatours/src/main/java/com/tuscanyscatours/impl/SCAToursImpl.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/scatours/src/main/java/com/tuscanyscatours/impl/SCAToursImpl.java new file mode 100644 index 0000000000..7a7f6b460d --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/scatours/src/main/java/com/tuscanyscatours/impl/SCAToursImpl.java @@ -0,0 +1,84 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package com.tuscanyscatours.impl;
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+import com.tuscanyscatours.SCAToursBooking;
+import com.tuscanyscatours.SCAToursCart;
+import com.tuscanyscatours.SCAToursSearch;
+import com.tuscanyscatours.common.TripItem;
+import com.tuscanyscatours.common.TripLeg;
+import com.tuscanyscatours.shoppingcart.CartCheckout;
+import com.tuscanyscatours.shoppingcart.CartInitialize;
+import com.tuscanyscatours.travelcatalog.TravelCatalogSearch;
+import com.tuscanyscatours.tripbooking.TripBooking;
+
+/**
+ * An implementation of the SCA tours component. it's just a pass through and allows
+ * the outward facing bindings to be changed without changing the individual contributions
+ */
+@Scope("COMPOSITE")
+@Service(interfaces = {SCAToursSearch.class, SCAToursBooking.class, SCAToursCart.class})
+public class SCAToursImpl implements SCAToursSearch, SCAToursBooking, SCAToursCart {
+
+ @Reference
+ protected TravelCatalogSearch travelCatalogSearch;
+
+ @Reference
+ protected TripBooking tripBooking;
+
+ @Reference
+ protected CartInitialize cartInitialize;
+
+ @Reference
+ protected CartCheckout cartCheckout;
+
+ // SCAToursSearch methods
+
+ public TripItem[] search(TripLeg tripLeg) {
+ return travelCatalogSearch.search(tripLeg);
+ }
+
+ // SCAToursBooking methods
+
+ public String bookTrip(String cartId, TripItem trip) {
+ TripItem bookedTrip = tripBooking.bookTrip(cartId, trip);
+ return bookedTrip.getBookingCode();
+ }
+
+ // SCAToursCart methods
+
+ public String newCart() {
+ String cartId = cartInitialize.newCart();
+ return cartId;
+ }
+
+ public TripItem[] getTrips(String cartId) {
+ return cartInitialize.getTrips(cartId);
+ }
+
+ public void checkout(String cartId) {
+ // need to get the user id from the context here but
+ // just make one up for the time being
+ cartCheckout.checkout(cartId, "c-0");
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/scatours/src/main/resources/META-INF/sca-contribution.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/scatours/src/main/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..2728a88840 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/scatours/src/main/resources/META-INF/sca-contribution.xml @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0">
+ <import.java package="com.tuscanyscatours.common" />
+ <import.java package="com.tuscanyscatours.travelcatalog" />
+ <import.java package="com.tuscanyscatours.tripbooking" />
+ <import.java package="com.tuscanyscatours.shoppingcart" />
+ <export.java package="com.tuscanyscatours" />
+ <export.java package="com.tuscanyscatours.impl" />
+</contribution>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/shoppingcart/build.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/shoppingcart/build.xml new file mode 100644 index 0000000000..1976d2b5ed --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/shoppingcart/build.xml @@ -0,0 +1,33 @@ +<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<project name="scatours-contribution-shoppingcart" default="compile">
+ <import file="../../antdefs.xml"/>
+ <path id="compile-path">
+ <pathelement path="../common/target/scatours-contribution-common.jar"/>
+ </path>
+
+ <target name="wsdljava">
+ <antcall target="wsimport">
+ <param name="wsdlfile" value="Payment.wsdl"/>
+ <param name="javaclass" value="com/tuscanyscatours/payment/Payment.class"/>
+ <param name="package" value="com.tuscanyscatours.payment"/>
+ </antcall>
+ </target>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/shoppingcart/pom.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/shoppingcart/pom.xml new file mode 100644 index 0000000000..30d317a90c --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/shoppingcart/pom.xml @@ -0,0 +1,126 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <version>1.0-SNAPSHOT</version>
+ <artifactId>scatours-contribution-shoppingcart</artifactId>
+ <name>Apache Tuscany SCA Tours Shopping Cart Contribution</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca-api</artifactId>
+ <version>${tuscany.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-contribution-common</artifactId>
+ <version>${pom.version}</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.xml.ws</groupId>
+ <artifactId>jaxws-api</artifactId>
+ <version>2.1</version>
+ <exclusions>
+ <exclusion>
+ <groupId>javax.xml.soap</groupId>
+ <artifactId>saaj-api</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.5</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+ <pluginRepositories>
+ <pluginRepository>
+ <id>java.net2</id>
+ <name>java.net Maven 2.x Repository</name>
+ <url>http://download.java.net/maven/2</url>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </pluginRepository>
+ </pluginRepositories>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ <version>1.0</version>
+ <executions>
+ <execution>
+ <id>add-source</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>add-source</goal>
+ </goals>
+ <configuration>
+ <sources>
+ <source>target/jaxws-source</source>
+ </sources>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>jaxws-maven-plugin</artifactId>
+ <version>1.12</version>
+ <executions>
+ <execution>
+ <id>payment</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>wsimport</goal>
+ </goals>
+ <configuration>
+ <packageName>com.tuscanyscatours.payment</packageName>
+ <wsdlDirectory>${basedir}/src/main/resources</wsdlDirectory>
+ <wsdlFiles>
+ <wsdlFile>Payment.wsdl</wsdlFile>
+ </wsdlFiles>
+ <sourceDestDir>${project.build.directory}/jaxws-source</sourceDestDir>
+ <verbose>false</verbose>
+ <xnocompile>true</xnocompile>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/shoppingcart/src/main/java/com/tuscanyscatours/shoppingcart/CartCheckout.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/shoppingcart/src/main/java/com/tuscanyscatours/shoppingcart/CartCheckout.java new file mode 100644 index 0000000000..929f9895c6 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/shoppingcart/src/main/java/com/tuscanyscatours/shoppingcart/CartCheckout.java @@ -0,0 +1,26 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package com.tuscanyscatours.shoppingcart; + +import org.osoa.sca.annotations.Remotable; + +@Remotable +public interface CartCheckout { + void checkout(String cartId, String name); +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/shoppingcart/src/main/java/com/tuscanyscatours/shoppingcart/CartInitialize.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/shoppingcart/src/main/java/com/tuscanyscatours/shoppingcart/CartInitialize.java new file mode 100644 index 0000000000..24affc4b23 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/shoppingcart/src/main/java/com/tuscanyscatours/shoppingcart/CartInitialize.java @@ -0,0 +1,30 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package com.tuscanyscatours.shoppingcart; + +import org.osoa.sca.annotations.Remotable; + +import com.tuscanyscatours.common.TripItem; + +@Remotable +public interface CartInitialize { + String newCart(); + + TripItem[] getTrips(String cartId); +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/shoppingcart/src/main/java/com/tuscanyscatours/shoppingcart/CartStore.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/shoppingcart/src/main/java/com/tuscanyscatours/shoppingcart/CartStore.java new file mode 100644 index 0000000000..c7d03d765b --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/shoppingcart/src/main/java/com/tuscanyscatours/shoppingcart/CartStore.java @@ -0,0 +1,41 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package com.tuscanyscatours.shoppingcart; + +import org.osoa.sca.annotations.Conversational; +import org.osoa.sca.annotations.EndsConversation; +import org.osoa.sca.annotations.Remotable; + +import com.tuscanyscatours.common.TripItem; + +/** + * The CartStore service interface + */ +@Remotable +@Conversational +public interface CartStore { + void addTrip(TripItem trip); + + void removeTrip(TripItem trip); + + TripItem[] getTrips(); + + @EndsConversation + void reset(); +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/shoppingcart/src/main/java/com/tuscanyscatours/shoppingcart/CartUpdates.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/shoppingcart/src/main/java/com/tuscanyscatours/shoppingcart/CartUpdates.java new file mode 100644 index 0000000000..f9a1272695 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/shoppingcart/src/main/java/com/tuscanyscatours/shoppingcart/CartUpdates.java @@ -0,0 +1,30 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package com.tuscanyscatours.shoppingcart; + +import org.osoa.sca.annotations.Remotable; + +import com.tuscanyscatours.common.TripItem; + +@Remotable +public interface CartUpdates { + void addTrip(String cartId, TripItem trip); + + void removeTrip(String cartId, TripItem trip); +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/shoppingcart/src/main/java/com/tuscanyscatours/shoppingcart/impl/CartStoreImpl.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/shoppingcart/src/main/java/com/tuscanyscatours/shoppingcart/impl/CartStoreImpl.java new file mode 100644 index 0000000000..460b962526 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/shoppingcart/src/main/java/com/tuscanyscatours/shoppingcart/impl/CartStoreImpl.java @@ -0,0 +1,70 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package com.tuscanyscatours.shoppingcart.impl; + +import java.util.ArrayList; +import java.util.List; + +import org.osoa.sca.annotations.ConversationID; +import org.osoa.sca.annotations.Destroy; +import org.osoa.sca.annotations.Init; +import org.osoa.sca.annotations.Scope; +import org.osoa.sca.annotations.Service; + +import com.tuscanyscatours.common.TripItem; +import com.tuscanyscatours.shoppingcart.CartStore; + +/** + * An implementation of the CartStore service + */ +@Scope("CONVERSATION") +@Service(interfaces = {CartStore.class}) +public class CartStoreImpl implements CartStore { + + @ConversationID + protected String cartId; + + private List<TripItem> trips = new ArrayList<TripItem>(); + + @Init + public void initCart() { + System.out.println("CartStore init for id: " + cartId); + } + + @Destroy + public void destroyCart() { + System.out.println("CartStore destroy for id: " + cartId); + } + + public void addTrip(TripItem trip) { + trips.add(trip); + } + + public void removeTrip(TripItem trip) { + trips.remove(trip); + } + + public TripItem[] getTrips() { + return trips.toArray(new TripItem[trips.size()]); + } + + public void reset() { + trips.clear(); + } +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/shoppingcart/src/main/java/com/tuscanyscatours/shoppingcart/impl/ShoppingCartImpl.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/shoppingcart/src/main/java/com/tuscanyscatours/shoppingcart/impl/ShoppingCartImpl.java new file mode 100644 index 0000000000..41c58e5266 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/shoppingcart/src/main/java/com/tuscanyscatours/shoppingcart/impl/ShoppingCartImpl.java @@ -0,0 +1,104 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package com.tuscanyscatours.shoppingcart.impl;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.UUID;
+
+import org.osoa.sca.ComponentContext;
+import org.osoa.sca.ServiceReference;
+import org.osoa.sca.annotations.Context;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+import com.tuscanyscatours.common.TripItem;
+import com.tuscanyscatours.payment.Payment;
+import com.tuscanyscatours.shoppingcart.CartCheckout;
+import com.tuscanyscatours.shoppingcart.CartInitialize;
+import com.tuscanyscatours.shoppingcart.CartStore;
+import com.tuscanyscatours.shoppingcart.CartUpdates;
+
+/**
+ * An implementation of the ShoppingCart service
+ */
+@Service(interfaces = {CartInitialize.class, CartUpdates.class, CartCheckout.class})
+public class ShoppingCartImpl implements CartInitialize, CartUpdates, CartCheckout {
+
+ @Reference
+ protected Payment payment;
+
+ @Reference
+ protected CartStore cartStore;
+
+ @Context
+ protected ComponentContext componentContext;
+
+ private static Map<String, CartStore> cartStores = new HashMap<String, CartStore>();
+
+ public String newCart() {
+ String cartId = UUID.randomUUID().toString();
+ ServiceReference<CartStore> cartStore = componentContext.getServiceReference(CartStore.class, "cartStore");
+ cartStore.setConversationID(cartId);
+ cartStores.put(cartId, cartStore.getService());
+
+ return cartId;
+ }
+
+ public void addTrip(String cartId, TripItem trip) {
+ cartStores.get(cartId).addTrip(trip);
+ }
+
+ public void removeTrip(String cartId, TripItem trip) {
+ cartStores.get(cartId).addTrip(trip);
+ }
+
+ public TripItem[] getTrips(String cartId) {
+ return cartStores.get(cartId).getTrips();
+ }
+
+ public void checkout(String cartId, String customerName) {
+ // get users credentials. Hard coded for now but should
+ // come from the security context
+ String customerId = customerName;
+
+ // get the total for all the trips
+ float amount = (float)0.0;
+
+ TripItem[] trips = getTrips(cartId);
+
+ for (TripItem trip : trips) {
+ if (trip.getType().equals(TripItem.TRIP)) {
+ amount += trip.getPrice();
+ } else {
+ for (TripItem tripItem : trip.getTripItems()) {
+ amount += tripItem.getPrice();
+ }
+ }
+ }
+
+ // Take the payment from the customer
+ payment.makePaymentMember(customerId, amount);
+
+ // reset the cart store
+ cartStores.get(cartId).reset();
+ cartStores.remove(cartId);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/shoppingcart/src/main/resources/META-INF/sca-contribution.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/shoppingcart/src/main/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..176c031c4c --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/shoppingcart/src/main/resources/META-INF/sca-contribution.xml @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0">
+ <import.java package="com.tuscanyscatours.common" />
+ <export.java package="com.tuscanyscatours.payment" />
+ <export.java package="com.tuscanyscatours.shoppingcart" />
+ <export.java package="com.tuscanyscatours.shoppingcart.impl" />
+</contribution>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/shoppingcart/src/main/resources/Payment.wsdl b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/shoppingcart/src/main/resources/Payment.wsdl new file mode 100644 index 0000000000..3885764899 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/shoppingcart/src/main/resources/Payment.wsdl @@ -0,0 +1,83 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<wsdl:definitions name="Payment"
+ targetNamespace="http://www.tuscanyscatours.com/Payment/"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:tns="http://www.tuscanyscatours.com/Payment/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:bpws="http://schemas.xmlsoap.org/ws/2004/03/business-process/"
+ xmlns:plnk="http://schemas.xmlsoap.org/ws/2004/03/partner-link/">
+ <wsdl:types>
+ <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.tuscanyscatours.com/Payment/"
+ xmlns:tns="http://www.tuscanyscatours.com/Payment/">
+
+ <xsd:complexType name="MakePaymentMemberType">
+ <xsd:sequence>
+ <xsd:element name="CustomerId" type="xsd:string"></xsd:element>
+ <xsd:element name="Amount" type="xsd:float"></xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="makePaymentMember" type="tns:MakePaymentMemberType"/>
+
+ <xsd:complexType name="MakePaymentMemberResponseType">
+ <xsd:sequence>
+ <xsd:element name="Status" type="xsd:string"></xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="makePaymentMemberResponse" type="tns:MakePaymentMemberResponseType"/>
+
+ </xsd:schema>
+ </wsdl:types>
+ <wsdl:message name="MakePaymentMemberRequest">
+ <wsdl:part name="parameters" element="tns:makePaymentMember"></wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="MakePaymentMemberResponse">
+ <wsdl:part name="parameters" element="tns:makePaymentMemberResponse"></wsdl:part>
+ </wsdl:message>
+ <wsdl:portType name="Payment">
+ <wsdl:operation name="makePaymentMember">
+ <wsdl:input message="tns:MakePaymentMemberRequest"></wsdl:input>
+ <wsdl:output message="tns:MakePaymentMemberResponse"></wsdl:output>
+ </wsdl:operation>
+ </wsdl:portType>
+ <wsdl:binding name="PaymentBinding" type="tns:Payment">
+ <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
+ <wsdl:operation name="makePaymentMember">
+ <soap:operation soapAction="http://www.tuscanyscatours.com/Payment/makePayment" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:service name="PaymentService">
+ <wsdl:port name="PaymentPort" binding="tns:PaymentBinding">
+ <soap:address location="http://localhost:8083/Payment" />
+ </wsdl:port>
+ </wsdl:service>
+
+ <plnk:partnerLinkType name="PaymentLinkType">
+ <plnk:role name="forward" portType="tns:Payment"/>
+ </plnk:partnerLinkType>
+</wsdl:definitions>
\ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/travelcatalog/build.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/travelcatalog/build.xml new file mode 100644 index 0000000000..45373a4910 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/travelcatalog/build.xml @@ -0,0 +1,26 @@ +<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<project name="scatours-contribution-travelcatalog" default="compile">
+ <import file="../../antdefs.xml"/>
+ <path id="compile-path">
+ <pathelement path="../common/target/scatours-contribution-common.jar"/>
+ <pathelement path="../currency/target/scatours-contribution-currency.jar"/>
+ </path>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/travelcatalog/pom.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/travelcatalog/pom.xml new file mode 100644 index 0000000000..d2f8f1278c --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/travelcatalog/pom.xml @@ -0,0 +1,64 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent><version>1.0-SNAPSHOT</version>
+ <artifactId>scatours-contribution-travelcatalog</artifactId>
+ <name>Apache Tuscany SCA Tours Travel Catalog Contribution</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca-api</artifactId>
+ <version>${tuscany.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-contribution-common</artifactId>
+ <version>${pom.version}</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-contribution-currency</artifactId>
+ <version>${pom.version}</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.5</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ </build>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/travelcatalog/src/main/java/com/tuscanyscatours/travelcatalog/TravelCatalogSearch.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/travelcatalog/src/main/java/com/tuscanyscatours/travelcatalog/TravelCatalogSearch.java new file mode 100644 index 0000000000..e558439f82 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/travelcatalog/src/main/java/com/tuscanyscatours/travelcatalog/TravelCatalogSearch.java @@ -0,0 +1,32 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package com.tuscanyscatours.travelcatalog;
+
+import org.osoa.sca.annotations.Remotable;
+
+import com.tuscanyscatours.common.TripItem;
+import com.tuscanyscatours.common.TripLeg;
+
+/**
+ * The TravelCatalogSearch service interface
+ */
+@Remotable
+public interface TravelCatalogSearch {
+ TripItem[] search(TripLeg tripLeg);
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/travelcatalog/src/main/java/com/tuscanyscatours/travelcatalog/impl/TravelCatalogImpl.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/travelcatalog/src/main/java/com/tuscanyscatours/travelcatalog/impl/TravelCatalogImpl.java new file mode 100644 index 0000000000..90351720bb --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/travelcatalog/src/main/java/com/tuscanyscatours/travelcatalog/impl/TravelCatalogImpl.java @@ -0,0 +1,127 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package com.tuscanyscatours.travelcatalog.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.UUID;
+import java.util.concurrent.CountDownLatch;
+
+import org.osoa.sca.ComponentContext;
+import org.osoa.sca.RequestContext;
+import org.osoa.sca.ServiceReference;
+import org.osoa.sca.annotations.Context;
+import org.osoa.sca.annotations.Property;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+import com.tuscanyscatours.common.Search;
+import com.tuscanyscatours.common.SearchCallback;
+import com.tuscanyscatours.common.TripItem;
+import com.tuscanyscatours.common.TripLeg;
+import com.tuscanyscatours.currencyconverter.CurrencyConverter;
+import com.tuscanyscatours.travelcatalog.TravelCatalogSearch;
+
+/**
+ * An implementation of the travel catalog service
+ */
+@Scope("COMPOSITE")
+@Service(interfaces = {TravelCatalogSearch.class})
+public class TravelCatalogImpl implements TravelCatalogSearch, SearchCallback {
+
+ @Reference
+ protected Search hotelSearch;
+
+ @Reference
+ protected Search flightSearch;
+
+ @Reference
+ protected Search carSearch;
+
+ @Reference
+ protected Search tripSearch;
+
+ @Property
+ public String quoteCurrencyCode = "USD";
+
+ @Reference
+ protected CurrencyConverter currencyConverter;
+
+ @Context
+ protected ComponentContext componentContext;
+
+ private List<TripItem> searchResults = new ArrayList<TripItem>();
+
+ CountDownLatch resultsReceivedCountdown;
+
+ // TravelSearch methods
+
+ public TripItem[] search(TripLeg tripLeg) {
+
+ resultsReceivedCountdown = new CountDownLatch(4);
+ searchResults.clear();
+
+ ServiceReference<Search> dynamicHotelSearch = componentContext.getServiceReference(Search.class, "hotelSearch");
+
+ dynamicHotelSearch.setCallbackID("HotelSearchCallbackID-" + tripLeg.getId());
+ dynamicHotelSearch.getService().searchAsynch(tripLeg);
+
+ flightSearch.searchAsynch(tripLeg);
+ carSearch.searchAsynch(tripLeg);
+ tripSearch.searchAsynch(tripLeg);
+
+ System.out.println("going into wait");
+
+ try {
+ resultsReceivedCountdown.await();
+ } catch (InterruptedException ex) {
+ }
+
+ for (TripItem tripItem : searchResults) {
+ tripItem.setId(UUID.randomUUID().toString());
+ tripItem.setTripId(tripLeg.getId());
+ tripItem
+ .setPrice(currencyConverter.convert(tripItem.getCurrency(), quoteCurrencyCode, tripItem.getPrice()));
+ tripItem.setCurrency(quoteCurrencyCode);
+ }
+
+ return searchResults.toArray(new TripItem[searchResults.size()]);
+ }
+
+ // SearchCallback methods
+
+ public synchronized void searchResults(TripItem[] items) {
+ RequestContext requestContext = componentContext.getRequestContext();
+ Object callbackID = requestContext.getServiceReference().getCallbackID();
+ System.out.println("Asynch response - " + callbackID);
+
+ if (items != null) {
+ for (int i = 0; i < items.length; i++) {
+ searchResults.add(items[i]);
+ }
+ }
+
+ resultsReceivedCountdown.countDown();
+ }
+
+ public void setPercentComplete(String searchComponent, int percentComplete) {
+ // Not used at the moment
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/travelcatalog/src/main/resources/META-INF/sca-contribution.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/travelcatalog/src/main/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..b18ae45a09 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/travelcatalog/src/main/resources/META-INF/sca-contribution.xml @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0">
+ <import.java package="com.tuscanyscatours.common" />
+ <import.java package="com.tuscanyscatours.currencyconverter" />
+ <export.java package="com.tuscanyscatours.travelcatalog" />
+ <export.java package="com.tuscanyscatours.travelcatalog.impl" />
+</contribution>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/trip-policy/build.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/trip-policy/build.xml new file mode 100644 index 0000000000..a6c7e4e058 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/trip-policy/build.xml @@ -0,0 +1,26 @@ +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> + +<project name="scatours-contribution-trip-policy" default="compile"> + <import file="../../antdefs.xml"/> + <path id="compile-path"> + <pathelement path="../common/target/scatours-contribution-common.jar"/> + </path> + <path id="test-path" refid="compile-path"/> +</project> diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/trip-policy/pom.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/trip-policy/pom.xml new file mode 100644 index 0000000000..2a235f887e --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/trip-policy/pom.xml @@ -0,0 +1,78 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<project> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>scatours</artifactId> + <version>1.0-SNAPSHOT</version> + <relativePath>../../pom.xml</relativePath> + </parent><version>1.0-SNAPSHOT</version> + <artifactId>scatours-contribution-trip-policy</artifactId> + <name>Apache Tuscany SCA Tours Prepackaged Trip Policy Contribution</name> + + <dependencies> + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-sca-api</artifactId> + <version>${tuscany.version}</version> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>scatours-contribution-common</artifactId> + <version>${pom.version}</version> + <scope>provided</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-implementation-java-runtime</artifactId> + <version>${tuscany.version}</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-policy-logging</artifactId> + <version>${tuscany.version}</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-node-impl</artifactId> + <version>${tuscany.version}</version> + <scope>test</scope> + </dependency> + + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>4.5</version> + <scope>test</scope> + </dependency> + + </dependencies> + + <build> + <finalName>${artifactId}</finalName> + </build> +</project> diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/trip-policy/src/main/java/com/tuscanyscatours/trip/impl/TripImpl.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/trip-policy/src/main/java/com/tuscanyscatours/trip/impl/TripImpl.java new file mode 100644 index 0000000000..2b7047ac07 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/trip-policy/src/main/java/com/tuscanyscatours/trip/impl/TripImpl.java @@ -0,0 +1,94 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package com.tuscanyscatours.trip.impl; + +import java.util.ArrayList; +import java.util.List; + +import org.osoa.sca.annotations.Callback; +import org.osoa.sca.annotations.Init; +import org.osoa.sca.annotations.Scope; +import org.osoa.sca.annotations.Service; + +import com.tuscanyscatours.common.Book; +import com.tuscanyscatours.common.Search; +import com.tuscanyscatours.common.SearchCallback; +import com.tuscanyscatours.common.TripItem; +import com.tuscanyscatours.common.TripLeg; + +/** + * An implementation of the Trip service + */ +@Scope("STATELESS") +@Service(interfaces = {Search.class, Book.class}) +public class TripImpl implements Search, Book { + + private List<TripInfo> trips = new ArrayList<TripInfo>(); + + @Callback + protected SearchCallback searchCallback; + + @Init + public void init() { + trips.add(new TripInfo("FS1DEC06", "Florence and Siena pre-packaged tour", "LGW", "FLR", "06/12/09", + "13/12/09", "27", 450, "EUR", "http://localhost:8085/tbd")); + trips.add(new TripInfo("FS1DEC13", "Florence and Siena pre-packaged tour 2", "LGW", "FLR", "13/12/09", + "20/12/09", "27", 550, "EUR", "http://localhost:8085/tbd")); + } + + public TripItem[] searchSynch(TripLeg tripLeg) { + List<TripItem> items = new ArrayList<TripItem>(); + + // find the pre-package trip + for (TripInfo trip : trips) { + if ((trip.getFromLocation().equals(tripLeg.getFromLocation())) && (trip.getToLocation().equals(tripLeg + .getToLocation())) + && (trip.getFromDate().equals(tripLeg.getFromDate()))) { + TripItem item = + new TripItem("", "", TripItem.TRIP, trip.getName(), trip.getDescription(), + trip.getFromLocation() + " - " + trip.getToLocation(), trip.getFromDate(), trip + .getToDate(), trip.getPricePerPerson(), trip.getCurrency(), trip.getLink()); + items.add(item); + } + } + + return items.toArray(new TripItem[items.size()]); + } + + public void searchAsynch(TripLeg tripLeg) { + System.out.println("Starting trip search"); + + try { + Thread.sleep(2000); + } catch (Exception ex) { + // do nothing + } + + // return available hotels + searchCallback.searchResults(searchSynch(tripLeg)); + } + + public int getPercentComplete() { + return 100; + } + + public String book(TripItem tripItem) { + return "trip1"; + } +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/trip-policy/src/main/java/com/tuscanyscatours/trip/impl/TripInfo.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/trip-policy/src/main/java/com/tuscanyscatours/trip/impl/TripInfo.java new file mode 100644 index 0000000000..5edbc92ccd --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/trip-policy/src/main/java/com/tuscanyscatours/trip/impl/TripInfo.java @@ -0,0 +1,140 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package com.tuscanyscatours.trip.impl; + +public class TripInfo { + + private String name; + private String description; + private String fromLocation; + private String toLocation; + private String fromDate; + private String toDate; + private String spaces; + private double pricePerPerson; + private String currency; + private String link; + + public TripInfo() { + } + + public TripInfo(String name, + String description, + String fromLocation, + String toLocation, + String fromDate, + String toDate, + String spaces, + double pricePerPerson, + String currency, + String link) { + + this.name = name; + this.description = description; + this.fromLocation = fromLocation; + this.toLocation = toLocation; + this.fromDate = fromDate; + this.toDate = toDate; + this.spaces = spaces; + this.pricePerPerson = pricePerPerson; + this.currency = currency; + this.link = link; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getFromLocation() { + return fromLocation; + } + + public void setFromLocation(String fromLocation) { + this.fromLocation = fromLocation; + } + + public String getToLocation() { + return toLocation; + } + + public void setToLocation(String toLocation) { + this.toLocation = toLocation; + } + + public String getFromDate() { + return fromDate; + } + + public void setFromDate(String fromDate) { + this.fromDate = fromDate; + } + + public String getToDate() { + return toDate; + } + + public void setToDate(String toDate) { + this.toDate = toDate; + } + + public String getSpaces() { + return spaces; + } + + public void setSpaces(String spaces) { + this.spaces = spaces; + } + + public double getPricePerPerson() { + return pricePerPerson; + } + + public void setPricePerPerson(double pricePerPerson) { + this.pricePerPerson = pricePerPerson; + } + + public String getCurrency() { + return currency; + } + + public void setCurrency(String currency) { + this.currency = currency; + } + + public String getLink() { + return link; + } + + public void setLink(String link) { + this.link = link; + } +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/trip-policy/src/main/resources/META-INF/sca-contribution.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/trip-policy/src/main/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..21555e4514 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/trip-policy/src/main/resources/META-INF/sca-contribution.xml @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0" + xmlns:scatours="http://scatours"> + <import.java package="com.tuscanyscatours.common"/> + <export.java package="com.tuscanyscatours.trip.impl"/> + <deployable composite="scatours:packagedtrip" /> +</contribution> diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/trip-policy/src/main/resources/definitions.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/trip-policy/src/main/resources/definitions.xml new file mode 100644 index 0000000000..8d7ff59b0c --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/trip-policy/src/main/resources/definitions.xml @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="ASCII"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<definitions xmlns="http://www.osoa.org/xmlns/sca/1.0" + targetNamespace="http://tuscany.apache.org/xmlns/sca/1.0" + xmlns:sca="http://www.osoa.org/xmlns/sca/1.0" + xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"> + + <!-- PolicySets --> + <policySet name="JDKLoggingPolicy" provides="tuscany:logging" appliesTo="sca:implementation.java" + xmlns="http://www.osoa.org/xmlns/sca/1.0"> + <tuscany:jdkLogger name="myLogger"> + <logLevel>FINER</logLevel> + </tuscany:jdkLogger> + </policySet> +</definitions> diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/trip-policy/src/main/resources/trip.composite b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/trip-policy/src/main/resources/trip.composite new file mode 100644 index 0000000000..06c449633c --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/trip-policy/src/main/resources/trip.composite @@ -0,0 +1,31 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" + targetNamespace="http://scatours" + xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0" + name="packagedtrip"> + + <component name="Trip"> + <implementation.java class="com.tuscanyscatours.trip.impl.TripImpl" requires="tuscany:logging"/> + <service name="Search"/> + <service name="Book"/> + </component> + +</composite> diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/trip-policy/src/test/java/scatours/trip/TripTestCase.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/trip-policy/src/test/java/scatours/trip/TripTestCase.java new file mode 100644 index 0000000000..fd2cc073ec --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/trip-policy/src/test/java/scatours/trip/TripTestCase.java @@ -0,0 +1,68 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package scatours.trip; + +import org.apache.tuscany.sca.node.SCAClient; +import org.apache.tuscany.sca.node.SCAContribution; +import org.apache.tuscany.sca.node.SCANode; +import org.apache.tuscany.sca.node.SCANodeFactory; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +import com.tuscanyscatours.common.Book; +import com.tuscanyscatours.common.TripItem; + +/** + * + */ +public class TripTestCase { + private static SCANode tripNode; + + @BeforeClass + public static void setUpBeforeClass() throws Exception { + try { + tripNode = + SCANodeFactory.newInstance().createSCANode("trip.composite", + new SCAContribution("trip", "./target/classes"), + new SCAContribution("trip-test", "./target/test-classes")); + + tripNode.start(); + } catch (Exception ex) { + ex.printStackTrace(); + } + } + + @Test + public void testPayment() { + SCAClient client = (SCAClient)tripNode; + Book booking = client.getService(Book.class, "Trip/Book"); + TripItem tripItem = + new TripItem("1234", "5678", TripItem.TRIP, "FS1DEC06", "Florence and Siena pre-packaged tour", "FLR", + "06/12/09", "13/12/09", 450, "EUR", "http://localhost:8085/tbd"); + System.out.println("Result = " + booking.book(tripItem) + "\n"); + } + + @AfterClass + public static void tearDownAfterClass() throws Exception { + tripNode.stop(); + } + +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/trip/build.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/trip/build.xml new file mode 100644 index 0000000000..6e48af3cf8 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/trip/build.xml @@ -0,0 +1,26 @@ +<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<project name="scatours-contribution-trip" default="compile">
+ <import file="../../antdefs.xml"/>
+ <path id="compile-path">
+ <pathelement path="../common/target/scatours-contribution-common.jar"/>
+ </path>
+ <path id="test-path" refid="compile-path"/>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/trip/pom.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/trip/pom.xml new file mode 100644 index 0000000000..2cadc55c4e --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/trip/pom.xml @@ -0,0 +1,78 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent><version>1.0-SNAPSHOT</version>
+ <artifactId>scatours-contribution-trip</artifactId>
+ <name>Apache Tuscany SCA Tours Prepackaged Trip Contribution</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca-api</artifactId>
+ <version>${tuscany.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-contribution-common</artifactId>
+ <version>${pom.version}</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-policy-logging</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node-impl</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.5</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ </build>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/trip/src/main/java/com/tuscanyscatours/trip/impl/TripImpl.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/trip/src/main/java/com/tuscanyscatours/trip/impl/TripImpl.java new file mode 100644 index 0000000000..ec90524518 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/trip/src/main/java/com/tuscanyscatours/trip/impl/TripImpl.java @@ -0,0 +1,94 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package com.tuscanyscatours.trip.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+import com.tuscanyscatours.common.Book;
+import com.tuscanyscatours.common.Search;
+import com.tuscanyscatours.common.SearchCallback;
+import com.tuscanyscatours.common.TripItem;
+import com.tuscanyscatours.common.TripLeg;
+
+/**
+ * An implementation of the Trip service
+ */
+@Scope("STATELESS")
+@Service(interfaces = {Search.class, Book.class})
+public class TripImpl implements Search, Book {
+
+ private List<TripInfo> trips = new ArrayList<TripInfo>();
+
+ @Callback
+ protected SearchCallback searchCallback;
+
+ @Init
+ public void init() {
+ trips.add(new TripInfo("FS1DEC06", "Florence and Siena pre-packaged tour", "LGW", "FLR", "06/12/09",
+ "13/12/09", "27", 450, "EUR", "http://localhost:8085/tbd"));
+ trips.add(new TripInfo("FS1DEC13", "Florence and Siena pre-packaged tour 2", "LGW", "FLR", "13/12/09",
+ "20/12/09", "27", 550, "EUR", "http://localhost:8085/tbd"));
+ }
+
+ public TripItem[] searchSynch(TripLeg tripLeg) {
+ List<TripItem> items = new ArrayList<TripItem>();
+
+ // find the pre-package trip
+ for (TripInfo trip : trips) {
+ if ((trip.getFromLocation().equals(tripLeg.getFromLocation())) && (trip.getToLocation().equals(tripLeg
+ .getToLocation()))
+ && (trip.getFromDate().equals(tripLeg.getFromDate()))) {
+ TripItem item =
+ new TripItem("", "", TripItem.TRIP, trip.getName(), trip.getDescription(),
+ trip.getFromLocation() + " - " + trip.getToLocation(), trip.getFromDate(), trip
+ .getToDate(), trip.getPricePerPerson(), trip.getCurrency(), trip.getLink());
+ items.add(item);
+ }
+ }
+
+ return items.toArray(new TripItem[items.size()]);
+ }
+
+ public void searchAsynch(TripLeg tripLeg) {
+ System.out.println("Starting trip search");
+
+ try {
+ Thread.sleep(2000);
+ } catch (Exception ex) {
+ // do nothing
+ }
+
+ // return available hotels
+ searchCallback.searchResults(searchSynch(tripLeg));
+ }
+
+ public int getPercentComplete() {
+ return 100;
+ }
+
+ public String book(TripItem tripItem) {
+ return "trip1";
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/trip/src/main/java/com/tuscanyscatours/trip/impl/TripInfo.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/trip/src/main/java/com/tuscanyscatours/trip/impl/TripInfo.java new file mode 100644 index 0000000000..d8809e1325 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/trip/src/main/java/com/tuscanyscatours/trip/impl/TripInfo.java @@ -0,0 +1,140 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package com.tuscanyscatours.trip.impl;
+
+public class TripInfo {
+
+ private String name;
+ private String description;
+ private String fromLocation;
+ private String toLocation;
+ private String fromDate;
+ private String toDate;
+ private String spaces;
+ private double pricePerPerson;
+ private String currency;
+ private String link;
+
+ public TripInfo() {
+ }
+
+ public TripInfo(String name,
+ String description,
+ String fromLocation,
+ String toLocation,
+ String fromDate,
+ String toDate,
+ String spaces,
+ double pricePerPerson,
+ String currency,
+ String link) {
+
+ this.name = name;
+ this.description = description;
+ this.fromLocation = fromLocation;
+ this.toLocation = toLocation;
+ this.fromDate = fromDate;
+ this.toDate = toDate;
+ this.spaces = spaces;
+ this.pricePerPerson = pricePerPerson;
+ this.currency = currency;
+ this.link = link;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public String getFromLocation() {
+ return fromLocation;
+ }
+
+ public void setFromLocation(String fromLocation) {
+ this.fromLocation = fromLocation;
+ }
+
+ public String getToLocation() {
+ return toLocation;
+ }
+
+ public void setToLocation(String toLocation) {
+ this.toLocation = toLocation;
+ }
+
+ public String getFromDate() {
+ return fromDate;
+ }
+
+ public void setFromDate(String fromDate) {
+ this.fromDate = fromDate;
+ }
+
+ public String getToDate() {
+ return toDate;
+ }
+
+ public void setToDate(String toDate) {
+ this.toDate = toDate;
+ }
+
+ public String getSpaces() {
+ return spaces;
+ }
+
+ public void setSpaces(String spaces) {
+ this.spaces = spaces;
+ }
+
+ public double getPricePerPerson() {
+ return pricePerPerson;
+ }
+
+ public void setPricePerPerson(double pricePerPerson) {
+ this.pricePerPerson = pricePerPerson;
+ }
+
+ public String getCurrency() {
+ return currency;
+ }
+
+ public void setCurrency(String currency) {
+ this.currency = currency;
+ }
+
+ public String getLink() {
+ return link;
+ }
+
+ public void setLink(String link) {
+ this.link = link;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/trip/src/main/resources/META-INF/sca-contribution.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/trip/src/main/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..7f2efe2de7 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/trip/src/main/resources/META-INF/sca-contribution.xml @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0">
+ <import.java package="com.tuscanyscatours.common"/>
+ <export.java package="com.tuscanyscatours.trip.impl"/>
+</contribution>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/trip/src/test/java/scatours/trip/TripTestCase.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/trip/src/test/java/scatours/trip/TripTestCase.java new file mode 100644 index 0000000000..fd2cc073ec --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/trip/src/test/java/scatours/trip/TripTestCase.java @@ -0,0 +1,68 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package scatours.trip; + +import org.apache.tuscany.sca.node.SCAClient; +import org.apache.tuscany.sca.node.SCAContribution; +import org.apache.tuscany.sca.node.SCANode; +import org.apache.tuscany.sca.node.SCANodeFactory; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +import com.tuscanyscatours.common.Book; +import com.tuscanyscatours.common.TripItem; + +/** + * + */ +public class TripTestCase { + private static SCANode tripNode; + + @BeforeClass + public static void setUpBeforeClass() throws Exception { + try { + tripNode = + SCANodeFactory.newInstance().createSCANode("trip.composite", + new SCAContribution("trip", "./target/classes"), + new SCAContribution("trip-test", "./target/test-classes")); + + tripNode.start(); + } catch (Exception ex) { + ex.printStackTrace(); + } + } + + @Test + public void testPayment() { + SCAClient client = (SCAClient)tripNode; + Book booking = client.getService(Book.class, "Trip/Book"); + TripItem tripItem = + new TripItem("1234", "5678", TripItem.TRIP, "FS1DEC06", "Florence and Siena pre-packaged tour", "FLR", + "06/12/09", "13/12/09", 450, "EUR", "http://localhost:8085/tbd"); + System.out.println("Result = " + booking.book(tripItem) + "\n"); + } + + @AfterClass + public static void tearDownAfterClass() throws Exception { + tripNode.stop(); + } + +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/trip/src/test/resources/definitions.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/trip/src/test/resources/definitions.xml new file mode 100644 index 0000000000..8d7ff59b0c --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/trip/src/test/resources/definitions.xml @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="ASCII"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<definitions xmlns="http://www.osoa.org/xmlns/sca/1.0" + targetNamespace="http://tuscany.apache.org/xmlns/sca/1.0" + xmlns:sca="http://www.osoa.org/xmlns/sca/1.0" + xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"> + + <!-- PolicySets --> + <policySet name="JDKLoggingPolicy" provides="tuscany:logging" appliesTo="sca:implementation.java" + xmlns="http://www.osoa.org/xmlns/sca/1.0"> + <tuscany:jdkLogger name="myLogger"> + <logLevel>FINER</logLevel> + </tuscany:jdkLogger> + </policySet> +</definitions> diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/trip/src/test/resources/trip.composite b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/trip/src/test/resources/trip.composite new file mode 100644 index 0000000000..06c449633c --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/trip/src/test/resources/trip.composite @@ -0,0 +1,31 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" + targetNamespace="http://scatours" + xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0" + name="packagedtrip"> + + <component name="Trip"> + <implementation.java class="com.tuscanyscatours.trip.impl.TripImpl" requires="tuscany:logging"/> + <service name="Search"/> + <service name="Book"/> + </component> + +</composite> diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/tripbooking/build.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/tripbooking/build.xml new file mode 100644 index 0000000000..e8e7eb7f10 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/tripbooking/build.xml @@ -0,0 +1,26 @@ +<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<project name="scatours-contribution-tripbooking" default="compile">
+ <import file="../../antdefs.xml"/>
+ <path id="compile-path">
+ <pathelement path="../common/target/scatours-contribution-common.jar"/>
+ <pathelement path="../shoppingcart/target/scatours-contribution-shoppingcart.jar"/>
+ </path>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/tripbooking/pom.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/tripbooking/pom.xml new file mode 100644 index 0000000000..8527a8c7c3 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/tripbooking/pom.xml @@ -0,0 +1,63 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent><version>1.0-SNAPSHOT</version>
+ <artifactId>scatours-contribution-tripbooking</artifactId>
+ <name>Apache Tuscany SCA Tours Trip Booking Contribution</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca-api</artifactId>
+ <version>${tuscany.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-contribution-common</artifactId>
+ <version>${pom.version}</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-contribution-currency</artifactId>
+ <version>${pom.version}</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-contribution-shoppingcart</artifactId>
+ <version>${pom.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ </build>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/tripbooking/src/main/java/com/tuscanyscatours/tripbooking/TripBooking.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/tripbooking/src/main/java/com/tuscanyscatours/tripbooking/TripBooking.java new file mode 100644 index 0000000000..0693d40465 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/tripbooking/src/main/java/com/tuscanyscatours/tripbooking/TripBooking.java @@ -0,0 +1,32 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package com.tuscanyscatours.tripbooking;
+
+import org.osoa.sca.annotations.Remotable;
+
+import com.tuscanyscatours.common.TripItem;
+
+/**
+ * The TripBooking service interface
+ */
+@Remotable
+public interface TripBooking {
+
+ TripItem bookTrip(String cartId, TripItem trip);
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/tripbooking/src/main/java/com/tuscanyscatours/tripbooking/impl/TripBookingImpl.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/tripbooking/src/main/java/com/tuscanyscatours/tripbooking/impl/TripBookingImpl.java new file mode 100644 index 0000000000..5d1e1f2db5 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/tripbooking/src/main/java/com/tuscanyscatours/tripbooking/impl/TripBookingImpl.java @@ -0,0 +1,91 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package com.tuscanyscatours.tripbooking.impl;
+
+import org.osoa.sca.ComponentContext;
+import org.osoa.sca.ServiceReference;
+import org.osoa.sca.annotations.Context;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+import com.tuscanyscatours.common.Book;
+import com.tuscanyscatours.common.TripItem;
+import com.tuscanyscatours.shoppingcart.CartUpdates;
+import com.tuscanyscatours.tripbooking.TripBooking;
+
+/**
+ * An implementation of the TripBooking service
+ */
+@Service(interfaces = {TripBooking.class})
+public class TripBookingImpl implements TripBooking {
+
+ @Reference
+ protected Book hotelBook;
+
+ @Reference
+ protected Book flightBook;
+
+ @Reference
+ protected Book carBook;
+
+ @Reference
+ protected Book tripBook;
+
+ @Reference
+ protected CartUpdates cartUpdates;
+
+ @Context
+ protected ComponentContext componentContext;
+
+ public TripItem bookTrip(String cartId, TripItem trip) {
+
+ String bookingCode = "";
+
+ // book any nested items
+ TripItem[] nestedItems = trip.getTripItems();
+ if (nestedItems != null) {
+ for (int i = 0; i < nestedItems.length; i++) {
+ TripItem tripItem = nestedItems[i];
+ if (tripItem.getType().equals(TripItem.CAR)) {
+ tripItem.setBookingCode(carBook.book(tripItem));
+ } else if (tripItem.getType().equals(TripItem.FLIGHT)) {
+ tripItem.setBookingCode(flightBook.book(tripItem));
+ } else if (tripItem.getType().equals(TripItem.HOTEL)) {
+ tripItem.setBookingCode(hotelBook.book(tripItem));
+ } else {
+ tripItem.setBookingCode(tripItem.getType() + " is invalid");
+ }
+ }
+ }
+
+ // book the top level item if it's a packaged trip
+ if (trip.getType().equals(TripItem.TRIP)) {
+ bookingCode = tripBook.book(trip);
+ trip.setBookingCode(bookingCode);
+ }
+
+ // add trip to the shopping cart
+ ServiceReference<CartUpdates> cart = componentContext.getServiceReference(CartUpdates.class, "cartUpdates");
+ cart.setConversationID(cartId);
+ cart.getService().addTrip(cartId, trip);
+
+ return trip;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/tripbooking/src/main/resources/META-INF/sca-contribution.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/tripbooking/src/main/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..906f892d1f --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/tripbooking/src/main/resources/META-INF/sca-contribution.xml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0">
+ <import.java package="com.tuscanyscatours.common" />
+ <import.java package="com.tuscanyscatours.currencyconverter" />
+ <import.java package="com.tuscanyscatours.shoppingcart" />
+ <export.java package="com.tuscanyscatours.tripbooking" />
+ <export.java package="com.tuscanyscatours.tripbooking.impl" />
+</contribution>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/build.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/build.xml new file mode 100644 index 0000000000..51983cf967 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/build.xml @@ -0,0 +1,22 @@ +<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<project name="scatours-contribution-using" default="compile">
+ <import file="../../antdefs.xml"/>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/pom.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/pom.xml new file mode 100644 index 0000000000..42aea70182 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/pom.xml @@ -0,0 +1,118 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent><version>1.0-SNAPSHOT</version>
+ <artifactId>scatours-contribution-using</artifactId>
+ <name>Apache Tuscany SCA Tours Using Components Contribution</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca-api</artifactId>
+ <version>${tuscany.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-axis2</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-jms-runtime</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ejb-runtime</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node-api</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node-impl</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-jms-asf</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>activemq-all</artifactId>
+ <version>5.2.0</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>activemq-web-demo</artifactId>
+ </exclusion>
+ </exclusions>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-jetty</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.5</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ </build>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/java/com/tuscanyscahotels/HotelOffers.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/java/com/tuscanyscahotels/HotelOffers.java new file mode 100644 index 0000000000..8abc5af687 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/java/com/tuscanyscahotels/HotelOffers.java @@ -0,0 +1,26 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package com.tuscanyscahotels;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface HotelOffers {
+ String bookTodaysSpecial();
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/java/com/tuscanyscahotels/impl/HotelOffersImpl.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/java/com/tuscanyscahotels/impl/HotelOffersImpl.java new file mode 100644 index 0000000000..fccef2beed --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/java/com/tuscanyscahotels/impl/HotelOffersImpl.java @@ -0,0 +1,35 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package com.tuscanyscahotels.impl;
+
+import java.util.Date;
+import org.osoa.sca.annotations.Reference;
+
+import com.tuscanyscahotels.HotelOffers;
+import com.tuscanyscatours.Hotels;
+
+public class HotelOffersImpl implements HotelOffers {
+
+ @Reference
+ protected Hotels hotels;
+
+ public String bookTodaysSpecial() {
+ return hotels.bookHotel("LBH", new Date(), 3, "STD");
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/java/com/tuscanyscatours/Address.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/java/com/tuscanyscatours/Address.java new file mode 100644 index 0000000000..614da1e2ad --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/java/com/tuscanyscatours/Address.java @@ -0,0 +1,172 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.3 in JDK 1.6
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
+// Any modifications to this file will be lost upon recompilation of the source schema.
+// Generated on: 2010.03.27 at 05:55:25 AM GMT
+//
+
+
+package com.tuscanyscatours;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for Address complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * <complexType name="Address">
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <element name="street" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * <element name="city" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * <element name="state" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * <element name="zip" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * </sequence>
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </pre>
+ *
+ *
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "Address", propOrder = {
+ "street",
+ "city",
+ "state",
+ "zip"
+})
+public class Address {
+
+ @XmlElement(required = true)
+ protected String street;
+ @XmlElement(required = true)
+ protected String city;
+ @XmlElement(required = true)
+ protected String state;
+ @XmlElement(required = true)
+ protected String zip;
+
+ /**
+ * Gets the value of the street property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getStreet() {
+ return street;
+ }
+
+ /**
+ * Sets the value of the street property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setStreet(String value) {
+ this.street = value;
+ }
+
+ /**
+ * Gets the value of the city property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getCity() {
+ return city;
+ }
+
+ /**
+ * Sets the value of the city property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setCity(String value) {
+ this.city = value;
+ }
+
+ /**
+ * Gets the value of the state property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getState() {
+ return state;
+ }
+
+ /**
+ * Sets the value of the state property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setState(String value) {
+ this.state = value;
+ }
+
+ /**
+ * Gets the value of the zip property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getZip() {
+ return zip;
+ }
+
+ /**
+ * Sets the value of the zip property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setZip(String value) {
+ this.zip = value;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/java/com/tuscanyscatours/AirportCodes.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/java/com/tuscanyscatours/AirportCodes.java new file mode 100644 index 0000000000..577f22250a --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/java/com/tuscanyscatours/AirportCodes.java @@ -0,0 +1,28 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package com.tuscanyscatours;
+
+public class AirportCodes {
+ public String getAirport(String code) {
+ if ("AAA".equals(code)) return "Anaa";
+ else if ("AAB".equals(code)) return "Arrabury";
+ // other airport codes and cities would follow here
+ else return null;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/java/com/tuscanyscatours/BillingAddress.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/java/com/tuscanyscatours/BillingAddress.java new file mode 100644 index 0000000000..4687cf1116 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/java/com/tuscanyscatours/BillingAddress.java @@ -0,0 +1,174 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.3 in JDK 1.6
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
+// Any modifications to this file will be lost upon recompilation of the source schema.
+// Generated on: 2010.03.27 at 05:55:25 AM GMT
+//
+
+
+package com.tuscanyscatours;
+
+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;
+
+
+/**
+ * <p>Java class for anonymous complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * <complexType>
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <element name="street" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * <element name="city" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * <element name="state" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * <element name="zip" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * </sequence>
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </pre>
+ *
+ *
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "", propOrder = {
+ "street",
+ "city",
+ "state",
+ "zip"
+})
+@XmlRootElement(name = "billingAddress")
+public class BillingAddress {
+
+ @XmlElement(required = true)
+ protected String street;
+ @XmlElement(required = true)
+ protected String city;
+ @XmlElement(required = true)
+ protected String state;
+ @XmlElement(required = true)
+ protected String zip;
+
+ /**
+ * Gets the value of the street property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getStreet() {
+ return street;
+ }
+
+ /**
+ * Sets the value of the street property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setStreet(String value) {
+ this.street = value;
+ }
+
+ /**
+ * Gets the value of the city property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getCity() {
+ return city;
+ }
+
+ /**
+ * Sets the value of the city property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setCity(String value) {
+ this.city = value;
+ }
+
+ /**
+ * Gets the value of the state property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getState() {
+ return state;
+ }
+
+ /**
+ * Sets the value of the state property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setState(String value) {
+ this.state = value;
+ }
+
+ /**
+ * Gets the value of the zip property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getZip() {
+ return zip;
+ }
+
+ /**
+ * Sets the value of the zip property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setZip(String value) {
+ this.zip = value;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/java/com/tuscanyscatours/Bookings.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/java/com/tuscanyscatours/Bookings.java new file mode 100644 index 0000000000..9d54d46bb6 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/java/com/tuscanyscatours/Bookings.java @@ -0,0 +1,26 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package com.tuscanyscatours;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface Bookings {
+ String newBooking(String trip, int people);
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/java/com/tuscanyscatours/Cars.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/java/com/tuscanyscatours/Cars.java new file mode 100644 index 0000000000..f58fa33c8d --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/java/com/tuscanyscatours/Cars.java @@ -0,0 +1,27 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package com.tuscanyscatours;
+
+import java.util.Date;
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface Cars {
+ String bookCar(Date pickup, int days, String carClass);
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/java/com/tuscanyscatours/CurrencyConverter.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/java/com/tuscanyscatours/CurrencyConverter.java new file mode 100644 index 0000000000..9c201813e1 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/java/com/tuscanyscatours/CurrencyConverter.java @@ -0,0 +1,27 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package com.tuscanyscatours;
+
+import java.math.BigDecimal;
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface CurrencyConverter {
+ BigDecimal convert(BigDecimal amount);
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/java/com/tuscanyscatours/CustomerInfo.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/java/com/tuscanyscatours/CustomerInfo.java new file mode 100644 index 0000000000..958ca6cf8c --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/java/com/tuscanyscatours/CustomerInfo.java @@ -0,0 +1,27 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package com.tuscanyscatours;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface CustomerInfo {
+ String getBillingAddress();
+ String getDeliveryAddress();
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/java/com/tuscanyscatours/Flights.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/java/com/tuscanyscatours/Flights.java new file mode 100644 index 0000000000..873b0afc0c --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/java/com/tuscanyscatours/Flights.java @@ -0,0 +1,27 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package com.tuscanyscatours;
+
+import java.util.Date;
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface Flights {
+ String bookFlight(String flightNumber, Date date, int seats, String flightClass);
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/java/com/tuscanyscatours/Hotels.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/java/com/tuscanyscatours/Hotels.java new file mode 100644 index 0000000000..85944ad1b6 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/java/com/tuscanyscatours/Hotels.java @@ -0,0 +1,27 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package com.tuscanyscatours;
+
+import java.util.Date;
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface Hotels {
+ String bookHotel(String hotelCode, Date date, int days, String roomType);
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/java/com/tuscanyscatours/using/impl/CarPartnerImpl.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/java/com/tuscanyscatours/using/impl/CarPartnerImpl.java new file mode 100644 index 0000000000..687fc49230 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/java/com/tuscanyscatours/using/impl/CarPartnerImpl.java @@ -0,0 +1,36 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package com.tuscanyscatours.using.impl;
+
+import java.util.Date;
+import org.osoa.sca.annotations.Reference;
+import com.tuscanyscatours.Cars;
+
+public class CarPartnerImpl implements Cars {
+
+ @Reference
+ protected Cars[] cars;
+
+ @Reference(required=false)
+ protected Cars[] luxuryCars;
+
+ public String bookCar(Date pickup, int days, String carClass) {
+ return cars[0].bookCar(pickup, days, carClass);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/java/com/tuscanyscatours/using/impl/CarVendorImpl.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/java/com/tuscanyscatours/using/impl/CarVendorImpl.java new file mode 100644 index 0000000000..f8644bab2c --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/java/com/tuscanyscatours/using/impl/CarVendorImpl.java @@ -0,0 +1,34 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package com.tuscanyscatours.using.impl;
+
+import java.util.Date;
+import com.tuscanyscatours.Cars;
+
+public class CarVendorImpl implements Cars {
+
+ protected int minAge; // implicitly defines an SCA property
+
+ public String bookCar(Date pickup, int days, String carClass) {
+ System.out.println("Booking confirmed for pickup date " + pickup +
+ " duration " + days + " days in a " + carClass +
+ " class car");
+ return "CV234";
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/java/com/tuscanyscatours/using/impl/CurrencyConverterImpl.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/java/com/tuscanyscatours/using/impl/CurrencyConverterImpl.java new file mode 100644 index 0000000000..3749221aa9 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/java/com/tuscanyscatours/using/impl/CurrencyConverterImpl.java @@ -0,0 +1,45 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package com.tuscanyscatours.using.impl;
+
+import java.math.BigDecimal;
+import org.osoa.sca.annotations.Property;
+import com.tuscanyscatours.CurrencyConverter;
+
+public class CurrencyConverterImpl implements CurrencyConverter {
+
+ @Property
+ protected String fromCurrency;
+
+ @Property
+ protected String toCurrency;
+
+ public BigDecimal convert(BigDecimal amount) {
+ return amount.multiply(getRate(toCurrency))
+ .divide(getRate(fromCurrency), 2, 0);
+ }
+
+ private BigDecimal getRate(String currency) {
+ int rate = 0;
+ for (int i = 0; i < currency.length(); i++) {
+ rate += currency.codePointAt(i);
+ }
+ return new BigDecimal(rate).divide(new BigDecimal(100));
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/java/com/tuscanyscatours/using/impl/CustomerImpl.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/java/com/tuscanyscatours/using/impl/CustomerImpl.java new file mode 100644 index 0000000000..84ca6c7593 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/java/com/tuscanyscatours/using/impl/CustomerImpl.java @@ -0,0 +1,47 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package com.tuscanyscatours.using.impl;
+
+import org.osoa.sca.annotations.Property;
+import com.tuscanyscatours.Address;
+import com.tuscanyscatours.BillingAddress;
+import com.tuscanyscatours.CustomerInfo;
+
+public class CustomerImpl implements CustomerInfo {
+
+ @Property
+ protected BillingAddress billingAddress;
+
+ @Property
+ protected Address deliveryAddress;
+
+ public String getBillingAddress() {
+ return billingAddress.getStreet() + ", " +
+ billingAddress.getCity() + ", " +
+ billingAddress.getState() + " " +
+ billingAddress.getZip();
+ }
+
+ public String getDeliveryAddress() {
+ return deliveryAddress.getStreet() + ", " +
+ deliveryAddress.getCity() + ", " +
+ deliveryAddress.getState() + " " +
+ deliveryAddress.getZip();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/java/com/tuscanyscatours/using/impl/FlightPartnerImpl.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/java/com/tuscanyscatours/using/impl/FlightPartnerImpl.java new file mode 100644 index 0000000000..c5d6747a6b --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/java/com/tuscanyscatours/using/impl/FlightPartnerImpl.java @@ -0,0 +1,31 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package com.tuscanyscatours.using.impl;
+
+import java.util.Date;
+import com.tuscanyscatours.Flights;
+
+public class FlightPartnerImpl implements Flights {
+
+ public String bookFlight(String flightNumber, Date date, int seats, String flightClass) {
+ System.out.println("Booking confirmed for flight " + flightNumber + " on date " +
+ date + " with " + seats + " seats in " + flightClass + " class");
+ return "FP345";
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/java/com/tuscanyscatours/using/impl/HotelPartnerImpl.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/java/com/tuscanyscatours/using/impl/HotelPartnerImpl.java new file mode 100644 index 0000000000..6cca73b0d0 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/java/com/tuscanyscatours/using/impl/HotelPartnerImpl.java @@ -0,0 +1,31 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package com.tuscanyscatours.using.impl;
+
+import java.util.Date;
+import com.tuscanyscatours.Hotels;
+
+public class HotelPartnerImpl implements Hotels {
+
+ public String bookHotel(String hotelCode, Date date, int days, String roomType) {
+ System.out.println("Booking confirmed for hotel " + hotelCode + " arriving on " +
+ date + " for " + days + " days in a " + roomType + " room");
+ return "HP456";
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/java/com/tuscanyscatours/using/impl/TripBookingImpl.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/java/com/tuscanyscatours/using/impl/TripBookingImpl.java new file mode 100644 index 0000000000..9d81a0d4ed --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/java/com/tuscanyscatours/using/impl/TripBookingImpl.java @@ -0,0 +1,73 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package com.tuscanyscatours.using.impl;
+
+import java.text.DateFormat;
+import java.util.Date;
+import org.osoa.sca.annotations.Reference;
+
+import com.tuscanyscatours.Bookings;
+import com.tuscanyscatours.Cars;
+import com.tuscanyscatours.Flights;
+import com.tuscanyscatours.Hotels;
+
+public class TripBookingImpl implements Bookings {
+
+ public TripBookingImpl(@Reference(name="cars") Cars cars) {
+ this.cars = cars;
+ }
+
+ protected Cars cars;
+
+ @Reference
+ protected Flights flights;
+
+ private Hotels hotels;
+
+ @Reference
+ public void setHotels(Hotels hotels) {
+ this.hotels = hotels;
+ }
+
+ public String newBooking(String trip, int people) {
+ /* In a real implementation this method would look up the trip code
+ in the travel catalog to get details of the car, flight and hotel
+ bookings needed. Instead these details are hard-wired here for
+ test purposes. */
+ Date startDate = new Date(); //TEMP - need to fix
+ /*
+ try {
+ startDate = DateFormat.getInstance().parse("7 Jul, 2012");
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ */
+
+ if (people > 0) {
+ cars.bookCar(startDate, 7, "B");
+ flights.bookFlight("AA123", startDate, people, "Y");
+ hotels.bookHotel("DBH", startDate, 7, "SUP");
+
+ return "HW3546";
+
+ } else {
+ return "NONE";
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/java/scatours/client/impl/AirportCodesClientImpl.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/java/scatours/client/impl/AirportCodesClientImpl.java new file mode 100644 index 0000000000..4857b25fb6 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/java/scatours/client/impl/AirportCodesClientImpl.java @@ -0,0 +1,36 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package scatours.client.impl;
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+import com.tuscanyscatours.AirportCodes;
+
+@Service(Runnable.class)
+public class AirportCodesClientImpl {
+
+ @Reference
+ protected AirportCodes airportcodes;
+
+ public void run() {
+ String airport = airportcodes.getAirport("AAB");
+ System.out.println("AAB is the airport code for " + airport);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/java/scatours/client/impl/BookingsClientImpl.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/java/scatours/client/impl/BookingsClientImpl.java new file mode 100644 index 0000000000..aa842c80f7 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/java/scatours/client/impl/BookingsClientImpl.java @@ -0,0 +1,36 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package scatours.client.impl;
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+import com.tuscanyscatours.Bookings;
+
+@Service(Runnable.class)
+public class BookingsClientImpl {
+
+ @Reference
+ protected Bookings bookings;
+
+ public void run() {
+ String bookingCode = bookings.newBooking("VR3MAY9", 2);
+ System.out.println("Booking code is " + bookingCode);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/java/scatours/client/impl/BookingsZeroClientImpl.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/java/scatours/client/impl/BookingsZeroClientImpl.java new file mode 100644 index 0000000000..1fd519d5e9 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/java/scatours/client/impl/BookingsZeroClientImpl.java @@ -0,0 +1,36 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package scatours.client.impl;
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+import com.tuscanyscatours.Bookings;
+
+@Service(Runnable.class)
+public class BookingsZeroClientImpl {
+
+ @Reference
+ protected Bookings bookings;
+
+ public void run() {
+ String bookingCode = bookings.newBooking("DUMMY", 0);
+ System.out.println("Booking code is " + bookingCode);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/java/scatours/client/impl/CarBookingsClientImpl.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/java/scatours/client/impl/CarBookingsClientImpl.java new file mode 100644 index 0000000000..0c78a77825 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/java/scatours/client/impl/CarBookingsClientImpl.java @@ -0,0 +1,38 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package scatours.client.impl;
+
+import java.util.Date;
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+import com.tuscanyscatours.Cars;
+
+@Service(Runnable.class)
+public class CarBookingsClientImpl {
+
+ @Reference
+ protected Cars cars;
+
+ public void run() {
+ String bookingCode = cars.bookCar(new Date(), 3, "K"); // need to FIX
+ System.out.println("Booking code is " + bookingCode);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/java/scatours/client/impl/ConverterClientImpl.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/java/scatours/client/impl/ConverterClientImpl.java new file mode 100644 index 0000000000..5eab8f8a16 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/java/scatours/client/impl/ConverterClientImpl.java @@ -0,0 +1,43 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package scatours.client.impl;
+
+import java.math.BigDecimal;
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+import com.tuscanyscatours.CurrencyConverter;
+
+@Service(Runnable.class)
+public class ConverterClientImpl {
+
+ @Reference
+ protected CurrencyConverter eur2jpy;
+
+ @Reference
+ protected CurrencyConverter usd2gbp;
+
+ public void run() {
+ BigDecimal jpy = eur2jpy.convert(new BigDecimal("1000.00"));
+ System.out.println("Converted EUR 1000.00 to JPY " + jpy);
+ BigDecimal gbp = usd2gbp.convert(new BigDecimal("1000.00"));
+ System.out.println("Converted USD 1000.00 to GBP " + gbp);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/java/scatours/client/impl/HotelOffersClientImpl.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/java/scatours/client/impl/HotelOffersClientImpl.java new file mode 100644 index 0000000000..e581273113 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/java/scatours/client/impl/HotelOffersClientImpl.java @@ -0,0 +1,36 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package scatours.client.impl;
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+import com.tuscanyscahotels.HotelOffers;
+
+@Service(Runnable.class)
+public class HotelOffersClientImpl {
+
+ @Reference
+ protected HotelOffers offers;
+
+ public void run() {
+ String bookingCode = offers.bookTodaysSpecial();
+ System.out.println("Hotel offers booking code is " + bookingCode);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/java/scatours/client/impl/Orders1ClientImpl.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/java/scatours/client/impl/Orders1ClientImpl.java new file mode 100644 index 0000000000..af21ad3683 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/java/scatours/client/impl/Orders1ClientImpl.java @@ -0,0 +1,36 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package scatours.client.impl;
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+import com.tuscanyscatours.CustomerInfo;
+
+@Service(Runnable.class)
+public class Orders1ClientImpl {
+
+ @Reference
+ protected CustomerInfo customer;
+
+ public void run() {
+ String address = customer.getBillingAddress();
+ System.out.println("Customer billing address: " + address);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/java/scatours/client/impl/Orders2ClientImpl.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/java/scatours/client/impl/Orders2ClientImpl.java new file mode 100644 index 0000000000..41727ac621 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/java/scatours/client/impl/Orders2ClientImpl.java @@ -0,0 +1,38 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package scatours.client.impl;
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+import com.tuscanyscatours.CustomerInfo;
+
+@Service(Runnable.class)
+public class Orders2ClientImpl {
+
+ @Reference
+ protected CustomerInfo customer;
+
+ public void run() {
+ String address = customer.getBillingAddress();
+ System.out.println("Customer billing address: " + address);
+ address = customer.getDeliveryAddress();
+ System.out.println("Customer delivery address: " + address);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/resources/address.xsd b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/resources/address.xsd new file mode 100644 index 0000000000..116110f1f3 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/resources/address.xsd @@ -0,0 +1,41 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ xmlns:t="http://tuscanyscatours.com/"
+ targetNamespace="http://tuscanyscatours.com/">
+ <xs:element name="billingAddress">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="street" type="xs:string" />
+ <xs:element name="city" type="xs:string" />
+ <xs:element name="state" type="xs:string" />
+ <xs:element name="zip" type="xs:string" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:complexType name="Address">
+ <xs:sequence>
+ <xs:element name="street" type="xs:string" />
+ <xs:element name="city" type="xs:string" />
+ <xs:element name="state" type="xs:string" />
+ <xs:element name="zip" type="xs:string" />
+ </xs:sequence>
+ </xs:complexType>
+</xs:schema>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/resources/airportcodes.composite b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/resources/airportcodes.composite new file mode 100644 index 0000000000..e68fc732b1 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/resources/airportcodes.composite @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://tuscanyscatours.com/"
+ name="airportcodes">
+ <component name="AirportCodes">
+ <implementation.java class="com.tuscanyscatours.AirportCodes" />
+ </component>
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/resources/bookings1.composite b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/resources/bookings1.composite new file mode 100644 index 0000000000..783bc3c6c7 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/resources/bookings1.composite @@ -0,0 +1,42 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://tuscanyscatours.com/"
+ name="bookings1">
+ <component name="TripBooking">
+ <implementation.java
+ class="com.tuscanyscatours.using.impl.TripBookingImpl" />
+ <reference name="cars" target="CarPartner/Cars" />
+ <reference name="flights" target="FlightPartner/Flights" />
+ <reference name="hotels" target="HotelPartner" />
+ </component>
+ <component name="CarPartner">
+ <implementation.java
+ class="com.tuscanyscatours.using.impl.CarVendorImpl" />
+ </component>
+ <component name="FlightPartner">
+ <implementation.java
+ class="com.tuscanyscatours.using.impl.FlightPartnerImpl" />
+ </component>
+ <component name="HotelPartner">
+ <implementation.java
+ class="com.tuscanyscatours.using.impl.HotelPartnerImpl" />
+ </component>
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/resources/bookings2.composite b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/resources/bookings2.composite new file mode 100644 index 0000000000..35b5eff4a1 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/resources/bookings2.composite @@ -0,0 +1,43 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://tuscanyscatours.com/"
+ name="bookings2">
+ <component name="TripBooking">
+ <implementation.java
+ class="com.tuscanyscatours.using.impl.TripBookingImpl" />
+ <reference name="cars" target="CarPartner/Cars" />
+ <reference name="flights" target="FlightPartner/Flights" />
+ <reference name="hotels" />
+ </component>
+ <wire source="TripBooking/hotels" target="HotelPartner" />
+ <component name="CarPartner">
+ <implementation.java
+ class="com.tuscanyscatours.using.impl.CarVendorImpl" />
+ </component>
+ <component name="FlightPartner">
+ <implementation.java
+ class="com.tuscanyscatours.using.impl.FlightPartnerImpl" />
+ </component>
+ <component name="HotelPartner">
+ <implementation.java
+ class="com.tuscanyscatours.using.impl.HotelPartnerImpl" />
+ </component>
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/resources/bookings3.composite b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/resources/bookings3.composite new file mode 100644 index 0000000000..8cb7b94010 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/resources/bookings3.composite @@ -0,0 +1,42 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://tuscanyscatours.com/"
+ name="bookings3">
+ <component name="TripBooking" autowire="true">
+ <implementation.java
+ class="com.tuscanyscatours.using.impl.TripBookingImpl" />
+ <reference name="cars" />
+ <reference name="flights" />
+ <reference name="hotels" />
+ </component>
+ <component name="CarPartner">
+ <implementation.java
+ class="com.tuscanyscatours.using.impl.CarVendorImpl" />
+ </component>
+ <component name="FlightPartner">
+ <implementation.java
+ class="com.tuscanyscatours.using.impl.FlightPartnerImpl" />
+ </component>
+ <component name="HotelPartner">
+ <implementation.java
+ class="com.tuscanyscatours.using.impl.HotelPartnerImpl" />
+ </component>
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/resources/bookings4.composite b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/resources/bookings4.composite new file mode 100644 index 0000000000..acb6e269a4 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/resources/bookings4.composite @@ -0,0 +1,42 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://tuscanyscatours.com/"
+ name="bookings4">
+ <component name="TripBooking">
+ <implementation.java
+ class="com.tuscanyscatours.using.impl.TripBookingImpl" />
+ <service name="Bookings">
+ <binding.ws uri="http://tuscanyscatours.com:8085/Bookings" />
+ <binding.jms uri="jms:Bookings" />
+ </service>
+ <reference name="cars">
+ <binding.ws uri="http://tuscanycars.com:8081/Cars" />
+ </reference>
+ <reference name="flights">
+ <binding.ejb uri="corbaname:rir:#flight/FlightPartnerHome" />
+ </reference>
+ <reference name="hotels" target="HotelPartner" />
+ </component>
+ <component name="HotelPartner">
+ <implementation.java
+ class="com.tuscanyscatours.using.impl.HotelPartnerImpl" />
+ </component>
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/resources/carbookings1.composite b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/resources/carbookings1.composite new file mode 100644 index 0000000000..16c8b24684 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/resources/carbookings1.composite @@ -0,0 +1,37 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://tuscanyscatours.com/"
+ name="carbookings1">
+ <component name="CarPartner">
+ <implementation.java
+ class="com.tuscanyscatours.using.impl.CarPartnerImpl" />
+ <reference name="cars" target="JoesCars KensCars" />
+ <reference name="luxuryCars" />
+ </component>
+ <component name="JoesCars">
+ <implementation.java
+ class="com.tuscanyscatours.using.impl.CarVendorImpl" />
+ </component>
+ <component name="KensCars">
+ <implementation.java
+ class="com.tuscanyscatours.using.impl.CarVendorImpl" />
+ </component>
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/resources/carbookings2.composite b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/resources/carbookings2.composite new file mode 100644 index 0000000000..af01006b6f --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/resources/carbookings2.composite @@ -0,0 +1,37 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://tuscanyscatours.com/"
+ name="carbookings2">
+ <component name="CarPartner">
+ <implementation.java
+ class="com.tuscanyscatours.using.impl.CarPartnerImpl" />
+ </component>
+ <wire source="CarPartner/cars" target="JoesCars" />
+ <wire source="CarPartner/cars" target="KensCars" />
+ <component name="JoesCars">
+ <implementation.java
+ class="com.tuscanyscatours.using.impl.CarVendorImpl" />
+ </component>
+ <component name="KensCars">
+ <implementation.java
+ class="com.tuscanyscatours.using.impl.CarVendorImpl" />
+ </component>
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/resources/carbookings3.composite b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/resources/carbookings3.composite new file mode 100644 index 0000000000..f1d3a81d42 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/resources/carbookings3.composite @@ -0,0 +1,36 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://tuscanyscatours.com/"
+ name="carbookings3">
+ <component name="CarPartner" autowire="true">
+ <implementation.java
+ class="com.tuscanyscatours.using.impl.CarPartnerImpl" />
+ <reference name="luxuryCars" autowire="false" />
+ </component>
+ <component name="JoesCars">
+ <implementation.java
+ class="com.tuscanyscatours.using.impl.CarVendorImpl" />
+ </component>
+ <component name="KensCars">
+ <implementation.java
+ class="com.tuscanyscatours.using.impl.CarVendorImpl" />
+ </component>
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/resources/converter.composite b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/resources/converter.composite new file mode 100644 index 0000000000..c0a1d32e11 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/resources/converter.composite @@ -0,0 +1,35 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://tuscanyscatours.com/"
+ name="converter">
+ <component name="EURJPYConverter">
+ <implementation.java
+ class="com.tuscanyscatours.using.impl.CurrencyConverterImpl" />
+ <property name="fromCurrency">EUR</property>
+ <property name="toCurrency">JPY</property>
+ </component>
+ <component name="USDGBPConverter">
+ <implementation.java
+ class="com.tuscanyscatours.using.impl.CurrencyConverterImpl" />
+ <property name="fromCurrency">USD</property>
+ <property name="toCurrency">GBP</property>
+ </component>
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/resources/hotelsdomain.composite b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/resources/hotelsdomain.composite new file mode 100644 index 0000000000..1db3586513 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/resources/hotelsdomain.composite @@ -0,0 +1,38 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://tuscanyscahotels.com/"
+ name="hotelsdomain">
+ <component name="HotelPartner">
+ <implementation.java class=
+ "com.tuscanyscatours.using.impl.HotelPartnerImpl" />
+ <service name="Hotels">
+ <binding.ws uri=
+ "http://tuscanyscahotels.com:8083/Hotels" />
+ <binding.sca />
+ </service>
+ </component>
+ <component name="HotelOffers">
+ <implementation.java class=
+ "com.tuscanyscahotels.impl.HotelOffersImpl" />
+ <reference name="hotels"
+ target="HotelPartner/Hotels" />
+ </component>
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/resources/orders1.composite b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/resources/orders1.composite new file mode 100644 index 0000000000..ac2647b387 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/resources/orders1.composite @@ -0,0 +1,37 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://tuscanyscatours.com/"
+ xmlns:t="http://tuscanyscatours.com/"
+ name="orders1">
+
+ <component name="Customer">
+ <implementation.java
+ class="com.tuscanyscatours.using.impl.CustomerImpl" />
+ <property name="billingAddress" element="t:billingAddress">
+ <t:billingAddress xmlns="">
+ <street>123 Main Street</street>
+ <city>New York</city>
+ <state>NY</state>
+ <zip>01234</zip>
+ </t:billingAddress>
+ </property>
+ </component>
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/resources/orders2.composite b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/resources/orders2.composite new file mode 100644 index 0000000000..d0489bbd21 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/resources/orders2.composite @@ -0,0 +1,46 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://tuscanyscatours.com/"
+ xmlns:t="http://tuscanyscatours.com/"
+ xmlns:o="http://tuscanyscatours.com/orders"
+ name="orders2">
+
+ <component name="Customer">
+ <implementation.java
+ class="com.tuscanyscatours.using.impl.CustomerImpl" />
+ <property name="billingAddress" type="t:Address">
+ <o:address xmlns="">
+ <street>123 Main Street</street>
+ <city>New York</city>
+ <state>NY</state>
+ <zip>01234</zip>
+ </o:address>
+ </property>
+ <property name="deliveryAddress" type="t:Address">
+ <o:address xmlns="">
+ <street>456 Market Street</street>
+ <city>San Francisco</city>
+ <state>CA</state>
+ <zip>98765</zip>
+ </o:address>
+ </property>
+ </component>
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/resources/orders2.xsd b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/resources/orders2.xsd new file mode 100644 index 0000000000..db6ee8766e --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/resources/orders2.xsd @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://tuscanyscatours.com/orders"
+ xmlns:t="http://tuscanyscatours.com/">
+ <xs:element name="address" type="t:Address" />
+</xs:schema>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/resources/test-clients/airportcodes-client.composite b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/resources/test-clients/airportcodes-client.composite new file mode 100644 index 0000000000..faf2aced82 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/resources/test-clients/airportcodes-client.composite @@ -0,0 +1,33 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://tuscanyscatours.com/"
+ xmlns:t="http://tuscanyscatours.com/"
+ name="airportcodes-client">
+
+ <!-- a test client for airportcodes.composite -->
+ <component name="AirportCodesClient">
+ <implementation.java class="scatours.client.impl.AirportCodesClientImpl" />
+ <reference name="airportcodes" target="AirportCodes" />
+ </component>
+
+ <!-- run airportcodes.composite in the same SCA node -->
+ <include name="t:airportcodes" />
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/resources/test-clients/bookings1-client.composite b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/resources/test-clients/bookings1-client.composite new file mode 100644 index 0000000000..c1c4ecfe12 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/resources/test-clients/bookings1-client.composite @@ -0,0 +1,33 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://tuscanyscatours.com/"
+ xmlns:t="http://tuscanyscatours.com/"
+ name="bookings1-client">
+
+ <!-- a test client for bookings1.composite -->
+ <component name="Bookings1Client">
+ <implementation.java class="scatours.client.impl.BookingsClientImpl" />
+ <reference name="bookings" target="TripBooking" />
+ </component>
+
+ <!-- run bookings1.composite in the same SCA node -->
+ <include name="t:bookings1" />
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/resources/test-clients/bookings2-client.composite b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/resources/test-clients/bookings2-client.composite new file mode 100644 index 0000000000..e84c7fec06 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/resources/test-clients/bookings2-client.composite @@ -0,0 +1,33 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://tuscanyscatours.com/"
+ xmlns:t="http://tuscanyscatours.com/"
+ name="bookings2-client">
+
+ <!-- a test client for bookings2.composite -->
+ <component name="Bookings2Client">
+ <implementation.java class="scatours.client.impl.BookingsClientImpl" />
+ <reference name="bookings" target="TripBooking" />
+ </component>
+
+ <!-- run bookings2.composite in the same SCA node -->
+ <include name="t:bookings2" />
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/resources/test-clients/bookings3-client.composite b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/resources/test-clients/bookings3-client.composite new file mode 100644 index 0000000000..21248976a6 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/resources/test-clients/bookings3-client.composite @@ -0,0 +1,33 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://tuscanyscatours.com/"
+ xmlns:t="http://tuscanyscatours.com/"
+ name="bookings3-client">
+
+ <!-- a test client for bookings3.composite -->
+ <component name="Bookings3Client">
+ <implementation.java class="scatours.client.impl.BookingsClientImpl" />
+ <reference name="bookings" target="TripBooking" />
+ </component>
+
+ <!-- run bookings3.composite in the same SCA node -->
+ <include name="t:bookings3" />
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/resources/test-clients/bookings4-client.composite b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/resources/test-clients/bookings4-client.composite new file mode 100644 index 0000000000..bc3af6ae4a --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/resources/test-clients/bookings4-client.composite @@ -0,0 +1,35 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://tuscanyscatours.com/"
+ xmlns:t="http://tuscanyscatours.com/"
+ name="bookings4-client">
+
+ <!-- a test client for bookings4.composite -->
+ <component name="Bookings4Client">
+ <implementation.java class="scatours.client.impl.BookingsZeroClientImpl" />
+ <reference name="bookings">
+ <binding.jms uri="jms:Bookings" />
+ </reference>
+ </component>
+
+ <!-- run bookings4.composite in the same SCA node -->
+ <include name="t:bookings4" />
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/resources/test-clients/carbookings1-client.composite b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/resources/test-clients/carbookings1-client.composite new file mode 100644 index 0000000000..363f498997 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/resources/test-clients/carbookings1-client.composite @@ -0,0 +1,33 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://tuscanyscatours.com/"
+ xmlns:t="http://tuscanyscatours.com/"
+ name="carbookings1-client">
+
+ <!-- a test client for carbookings1.composite -->
+ <component name="CarBookings1Client">
+ <implementation.java class="scatours.client.impl.CarBookingsClientImpl" />
+ <reference name="cars" target="CarPartner" />
+ </component>
+
+ <!-- run carbookings1.composite in the same SCA node -->
+ <include name="t:carbookings1" />
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/resources/test-clients/carbookings2-client.composite b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/resources/test-clients/carbookings2-client.composite new file mode 100644 index 0000000000..f80eaf4eca --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/resources/test-clients/carbookings2-client.composite @@ -0,0 +1,33 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://tuscanyscatours.com/"
+ xmlns:t="http://tuscanyscatours.com/"
+ name="carbookings2-client">
+
+ <!-- a test client for carbookings2.composite -->
+ <component name="CarBookings2Client">
+ <implementation.java class="scatours.client.impl.CarBookingsClientImpl" />
+ <reference name="cars" target="CarPartner" />
+ </component>
+
+ <!-- run carbookings2.composite in the same SCA node -->
+ <include name="t:carbookings2" />
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/resources/test-clients/carbookings3-client.composite b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/resources/test-clients/carbookings3-client.composite new file mode 100644 index 0000000000..e3cf379de3 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/resources/test-clients/carbookings3-client.composite @@ -0,0 +1,33 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://tuscanyscatours.com/"
+ xmlns:t="http://tuscanyscatours.com/"
+ name="carbookings3-client">
+
+ <!-- a test client for carbookings3.composite -->
+ <component name="CarBookings3Client">
+ <implementation.java class="scatours.client.impl.CarBookingsClientImpl" />
+ <reference name="cars" target="CarPartner" />
+ </component>
+
+ <!-- run carbookings3.composite in the same SCA node -->
+ <include name="t:carbookings3" />
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/resources/test-clients/converter-client.composite b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/resources/test-clients/converter-client.composite new file mode 100644 index 0000000000..c488a454b4 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/resources/test-clients/converter-client.composite @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://tuscanyscatours.com/"
+ xmlns:t="http://tuscanyscatours.com/"
+ name="converter-client">
+
+ <!-- a test client for converter.composite -->
+ <component name="ConverterClient">
+ <implementation.java class="scatours.client.impl.ConverterClientImpl" />
+ <reference name="eur2jpy" target="EURJPYConverter" />
+ <reference name="usd2gbp" target="USDGBPConverter" />
+ </component>
+
+ <!-- run converter.composite in the same SCA node -->
+ <include name="t:converter" />
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/resources/test-clients/hotelsdomain-client.composite b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/resources/test-clients/hotelsdomain-client.composite new file mode 100644 index 0000000000..597a5f0a4f --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/resources/test-clients/hotelsdomain-client.composite @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://tuscanyscatours.com/"
+ xmlns:t="http://tuscanyscatours.com/"
+ xmlns:h="http://tuscanyscahotels.com/"
+ name="hotelsdomain-client">
+
+ <!-- a test client for hotelsdomain.composite -->
+ <component name="HotelsDomainClient">
+ <implementation.java class="scatours.client.impl.HotelOffersClientImpl" />
+ <reference name="offers" target="HotelOffers" />
+ </component>
+
+ <!-- run hotelsdomain.composite in the same SCA node -->
+ <include name="h:hotelsdomain" />
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/resources/test-clients/orders1-client.composite b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/resources/test-clients/orders1-client.composite new file mode 100644 index 0000000000..9015e14cb8 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/resources/test-clients/orders1-client.composite @@ -0,0 +1,33 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://tuscanyscatours.com/"
+ xmlns:t="http://tuscanyscatours.com/"
+ name="orders1-client">
+
+ <!-- a test client for orders1.composite -->
+ <component name="Orders1Client">
+ <implementation.java class="scatours.client.impl.Orders1ClientImpl" />
+ <reference name="customer" target="Customer" />
+ </component>
+
+ <!-- run orders1.composite in the same SCA node -->
+ <include name="t:orders1" />
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/resources/test-clients/orders2-client.composite b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/resources/test-clients/orders2-client.composite new file mode 100644 index 0000000000..f9ae67332b --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/resources/test-clients/orders2-client.composite @@ -0,0 +1,33 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://tuscanyscatours.com/"
+ xmlns:t="http://tuscanyscatours.com/"
+ name="orders2-client">
+
+ <!-- a test client for orders2.composite -->
+ <component name="Orders2Client">
+ <implementation.java class="scatours.client.impl.Orders2ClientImpl" />
+ <reference name="customer" target="Customer" />
+ </component>
+
+ <!-- run orders2.composite in the same SCA node -->
+ <include name="t:orders2" />
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/resources/test-clients/toursdomain-client.composite b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/resources/test-clients/toursdomain-client.composite new file mode 100644 index 0000000000..b84dbe8f72 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/resources/test-clients/toursdomain-client.composite @@ -0,0 +1,33 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://tuscanyscatours.com/"
+ xmlns:t="http://tuscanyscatours.com/"
+ name="toursdomain-client">
+
+ <!-- a test client for toursdomain.composite -->
+ <component name="ToursDomainClient">
+ <implementation.java class="scatours.client.impl.BookingsZeroClientImpl" />
+ <reference name="bookings" target="TripBooking" />
+ </component>
+
+ <!-- run toursdomain.composite in the same SCA node -->
+ <include name="t:toursdomain" />
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/resources/toursdomain.composite b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/resources/toursdomain.composite new file mode 100644 index 0000000000..c04fb897d7 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/main/resources/toursdomain.composite @@ -0,0 +1,39 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://tuscanyscatours.com/"
+ name="toursdomain">
+ <component name="TripBooking">
+ <implementation.java
+ class="com.tuscanyscatours.using.impl.TripBookingImpl" />
+ <reference name="flights">
+ <binding.ws
+ uri="http://flightbookingservice.com:8084/Flights" />
+ </reference>
+ <reference name="hotels">
+ <binding.ws uri="http://tuscanyscahotels.com:8083/Hotels" />
+ </reference>
+ <reference name="cars" target="CarPartner/Cars" />
+ </component>
+ <component name="CarPartner">
+ <implementation.java
+ class="com.tuscanyscatours.using.impl.CarVendorImpl" />
+ </component>
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/test/java/scatours/AirportCodesTestCase.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/test/java/scatours/AirportCodesTestCase.java new file mode 100644 index 0000000000..53d9029e7f --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/test/java/scatours/AirportCodesTestCase.java @@ -0,0 +1,56 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package scatours;
+
+import org.apache.tuscany.sca.node.SCAClient;
+import org.apache.tuscany.sca.node.SCAContribution;
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.SCANodeFactory;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Tests the AirportCodes component implementation class
+ */
+public class AirportCodesTestCase {
+
+ private SCANode node;
+
+ @Before
+ public void startServer() throws Exception {
+ node = SCANodeFactory.newInstance().createSCANode("test-clients/airportcodes-client.composite",
+ new SCAContribution("using", "./target/classes"));
+ node.start();
+ }
+
+ @Test
+ public void testImpl() {
+ Runnable client = ((SCAClient)node).getService(Runnable.class, "AirportCodesClient");
+ client.run();
+ }
+
+ @After
+ public void stopServer() throws Exception {
+ if (node != null) {
+ node.stop();
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/test/java/scatours/BindingsTestCase.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/test/java/scatours/BindingsTestCase.java new file mode 100644 index 0000000000..2daa59245e --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/test/java/scatours/BindingsTestCase.java @@ -0,0 +1,56 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package scatours;
+
+import org.apache.tuscany.sca.node.SCAClient;
+import org.apache.tuscany.sca.node.SCAContribution;
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.SCANodeFactory;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Tests services and references with configured bindings
+ */
+public class BindingsTestCase {
+
+ private SCANode node;
+
+ @Before
+ public void startServer() throws Exception {
+ node = SCANodeFactory.newInstance().createSCANode("test-clients/bookings4-client.composite",
+ new SCAContribution("using", "./target/classes"));
+ node.start();
+ }
+
+ @Test
+ public void testImpl() {
+ Runnable client = ((SCAClient)node).getService(Runnable.class, "Bookings4Client");
+ client.run();
+ }
+
+ @After
+ public void stopServer() throws Exception {
+ if (node != null) {
+ node.stop();
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/test/java/scatours/CarAutowireTestCase.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/test/java/scatours/CarAutowireTestCase.java new file mode 100644 index 0000000000..bf20e7cae1 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/test/java/scatours/CarAutowireTestCase.java @@ -0,0 +1,56 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package scatours;
+
+import org.apache.tuscany.sca.node.SCAClient;
+import org.apache.tuscany.sca.node.SCAContribution;
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.SCANodeFactory;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Tests autowiring of references with different multiplicities
+ */
+public class CarAutowireTestCase {
+
+ private SCANode node;
+
+ @Before
+ public void startServer() throws Exception {
+ node = SCANodeFactory.newInstance().createSCANode("test-clients/carbookings3-client.composite",
+ new SCAContribution("using", "./target/classes"));
+ node.start();
+ }
+
+ @Test
+ public void testImpl() {
+ Runnable client = ((SCAClient)node).getService(Runnable.class, "CarBookings3Client");
+ client.run();
+ }
+
+ @After
+ public void stopServer() throws Exception {
+ if (node != null) {
+ node.stop();
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/test/java/scatours/CarPartnerTestCase.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/test/java/scatours/CarPartnerTestCase.java new file mode 100644 index 0000000000..18e43e7a8b --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/test/java/scatours/CarPartnerTestCase.java @@ -0,0 +1,56 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package scatours;
+
+import org.apache.tuscany.sca.node.SCAClient;
+import org.apache.tuscany.sca.node.SCAContribution;
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.SCANodeFactory;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Tests wiring of references with different multiplicities
+ */
+public class CarPartnerTestCase {
+
+ private SCANode node;
+
+ @Before
+ public void startServer() throws Exception {
+ node = SCANodeFactory.newInstance().createSCANode("test-clients/carbookings1-client.composite",
+ new SCAContribution("using", "./target/classes"));
+ node.start();
+ }
+
+ @Test
+ public void testImpl() {
+ Runnable client = ((SCAClient)node).getService(Runnable.class, "CarBookings1Client");
+ client.run();
+ }
+
+ @After
+ public void stopServer() throws Exception {
+ if (node != null) {
+ node.stop();
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/test/java/scatours/CarWireElementTestCase.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/test/java/scatours/CarWireElementTestCase.java new file mode 100644 index 0000000000..997460e0ea --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/test/java/scatours/CarWireElementTestCase.java @@ -0,0 +1,56 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package scatours;
+
+import org.apache.tuscany.sca.node.SCAClient;
+import org.apache.tuscany.sca.node.SCAContribution;
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.SCANodeFactory;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Tests wire elements for references with different multiplicities
+ */
+public class CarWireElementTestCase {
+
+ private SCANode node;
+
+ @Before
+ public void startServer() throws Exception {
+ node = SCANodeFactory.newInstance().createSCANode("test-clients/carbookings2-client.composite",
+ new SCAContribution("using", "./target/classes"));
+ node.start();
+ }
+
+ @Test
+ public void testImpl() {
+ Runnable client = ((SCAClient)node).getService(Runnable.class, "CarBookings2Client");
+ client.run();
+ }
+
+ @After
+ public void stopServer() throws Exception {
+ if (node != null) {
+ node.stop();
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/test/java/scatours/ComplexPropertyElementTestCase.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/test/java/scatours/ComplexPropertyElementTestCase.java new file mode 100644 index 0000000000..177b4b2355 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/test/java/scatours/ComplexPropertyElementTestCase.java @@ -0,0 +1,56 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package scatours;
+
+import org.apache.tuscany.sca.node.SCAClient;
+import org.apache.tuscany.sca.node.SCAContribution;
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.SCANodeFactory;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Tests complex properties defined as XML Schema global elements
+ */
+public class ComplexPropertyElementTestCase {
+
+ private SCANode node;
+
+ @Before
+ public void startServer() throws Exception {
+ node = SCANodeFactory.newInstance().createSCANode("test-clients/orders1-client.composite",
+ new SCAContribution("using", "./target/classes"));
+ node.start();
+ }
+
+ @Test
+ public void testImpl() {
+ Runnable client = ((SCAClient)node).getService(Runnable.class, "Orders1Client");
+ client.run();
+ }
+
+ @After
+ public void stopServer() throws Exception {
+ if (node != null) {
+ node.stop();
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/test/java/scatours/ComplexPropertyTypeTestCase.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/test/java/scatours/ComplexPropertyTypeTestCase.java new file mode 100644 index 0000000000..168d8f3273 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/test/java/scatours/ComplexPropertyTypeTestCase.java @@ -0,0 +1,56 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package scatours;
+
+import org.apache.tuscany.sca.node.SCAClient;
+import org.apache.tuscany.sca.node.SCAContribution;
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.SCANodeFactory;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Tests complex properties defined as XML Schema types
+ */
+public class ComplexPropertyTypeTestCase {
+
+ private SCANode node;
+
+ @Before
+ public void startServer() throws Exception {
+ node = SCANodeFactory.newInstance().createSCANode("test-clients/orders2-client.composite",
+ new SCAContribution("using", "./target/classes"));
+ node.start();
+ }
+
+ @Test
+ public void testImpl() {
+ Runnable client = ((SCAClient)node).getService(Runnable.class, "Orders2Client");
+ client.run();
+ }
+
+ @After
+ public void stopServer() throws Exception {
+ if (node != null) {
+ node.stop();
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/test/java/scatours/CurrencyConverterTestCase.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/test/java/scatours/CurrencyConverterTestCase.java new file mode 100644 index 0000000000..dec2ae9976 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/test/java/scatours/CurrencyConverterTestCase.java @@ -0,0 +1,56 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package scatours;
+
+import org.apache.tuscany.sca.node.SCAClient;
+import org.apache.tuscany.sca.node.SCAContribution;
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.SCANodeFactory;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Tests the CurrencyConverterImpl component implementation class
+ */
+public class CurrencyConverterTestCase {
+
+ private SCANode node;
+
+ @Before
+ public void startServer() throws Exception {
+ node = SCANodeFactory.newInstance().createSCANode("test-clients/converter-client.composite",
+ new SCAContribution("using", "./target/classes"));
+ node.start();
+ }
+
+ @Test
+ public void testImpl() {
+ Runnable client = ((SCAClient)node).getService(Runnable.class, "ConverterClient");
+ client.run();
+ }
+
+ @After
+ public void stopServer() throws Exception {
+ if (node != null) {
+ node.stop();
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/test/java/scatours/MultiDomainTestCase.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/test/java/scatours/MultiDomainTestCase.java new file mode 100644 index 0000000000..a7028f6d8c --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/test/java/scatours/MultiDomainTestCase.java @@ -0,0 +1,65 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package scatours;
+
+import org.apache.tuscany.sca.node.SCAClient;
+import org.apache.tuscany.sca.node.SCAContribution;
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.SCANodeFactory;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Tests the multiple domains with bindings scenario
+ */
+public class MultiDomainTestCase {
+
+ private SCANode hotelsNode;
+ private SCANode toursNode;
+
+ @Before
+ public void startServer() throws Exception {
+ hotelsNode = SCANodeFactory.newInstance().createSCANode("test-clients/hotelsdomain-client.composite",
+ new SCAContribution("using", "./target/classes"));
+ hotelsNode.start();
+ toursNode = SCANodeFactory.newInstance().createSCANode("test-clients/toursdomain-client.composite",
+ new SCAContribution("using", "./target/classes"));
+ toursNode.start();
+ }
+
+ @Test
+ public void testImpl() {
+ Runnable hotelsClient = ((SCAClient)hotelsNode).getService(Runnable.class, "HotelsDomainClient");
+ hotelsClient.run();
+ Runnable toursClient = ((SCAClient)toursNode).getService(Runnable.class, "ToursDomainClient");
+ toursClient.run();
+ }
+
+ @After
+ public void stopServer() throws Exception {
+ if (toursNode != null) {
+ toursNode.stop();
+ }
+ if (hotelsNode != null) {
+ hotelsNode.stop();
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/test/java/scatours/TripAutowireTestCase.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/test/java/scatours/TripAutowireTestCase.java new file mode 100644 index 0000000000..a6f1df98ef --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/test/java/scatours/TripAutowireTestCase.java @@ -0,0 +1,56 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package scatours;
+
+import org.apache.tuscany.sca.node.SCAClient;
+import org.apache.tuscany.sca.node.SCAContribution;
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.SCANodeFactory;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Tests the use of autowire in the Trip Booking implementation scenario
+ */
+public class TripAutowireTestCase {
+
+ private SCANode node;
+
+ @Before
+ public void startServer() throws Exception {
+ node = SCANodeFactory.newInstance().createSCANode("test-clients/bookings3-client.composite",
+ new SCAContribution("using", "./target/classes"));
+ node.start();
+ }
+
+ @Test
+ public void testImpl() {
+ Runnable client = ((SCAClient)node).getService(Runnable.class, "Bookings3Client");
+ client.run();
+ }
+
+ @After
+ public void stopServer() throws Exception {
+ if (node != null) {
+ node.stop();
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/test/java/scatours/TripBookingTestCase.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/test/java/scatours/TripBookingTestCase.java new file mode 100644 index 0000000000..d08d176464 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/test/java/scatours/TripBookingTestCase.java @@ -0,0 +1,56 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package scatours;
+
+import org.apache.tuscany.sca.node.SCAClient;
+import org.apache.tuscany.sca.node.SCAContribution;
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.SCANodeFactory;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Tests the Trip Booking implementation scenario
+ */
+public class TripBookingTestCase {
+
+ private SCANode node;
+
+ @Before
+ public void startServer() throws Exception {
+ node = SCANodeFactory.newInstance().createSCANode("test-clients/bookings1-client.composite",
+ new SCAContribution("using", "./target/classes"));
+ node.start();
+ }
+
+ @Test
+ public void testImpl() {
+ Runnable client = ((SCAClient)node).getService(Runnable.class, "Bookings1Client");
+ client.run();
+ }
+
+ @After
+ public void stopServer() throws Exception {
+ if (node != null) {
+ node.stop();
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/test/java/scatours/TripWireElementTestCase.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/test/java/scatours/TripWireElementTestCase.java new file mode 100644 index 0000000000..36811a98d8 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/test/java/scatours/TripWireElementTestCase.java @@ -0,0 +1,56 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package scatours;
+
+import org.apache.tuscany.sca.node.SCAClient;
+import org.apache.tuscany.sca.node.SCAContribution;
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.SCANodeFactory;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Tests the use of wire elements in the Trip Booking implementation scenario
+ */
+public class TripWireElementTestCase {
+
+ private SCANode node;
+
+ @Before
+ public void startServer() throws Exception {
+ node = SCANodeFactory.newInstance().createSCANode("test-clients/bookings2-client.composite",
+ new SCAContribution("using", "./target/classes"));
+ node.start();
+ }
+
+ @Test
+ public void testImpl() {
+ Runnable client = ((SCAClient)node).getService(Runnable.class, "Bookings2Client");
+ client.run();
+ }
+
+ @After
+ public void stopServer() throws Exception {
+ if (node != null) {
+ node.stop();
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/test/resources/jndi.properties b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/test/resources/jndi.properties new file mode 100644 index 0000000000..80236a8e6c --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/using/src/test/resources/jndi.properties @@ -0,0 +1,38 @@ +## ---------------------------------------------------------------------------
+## Licensed to the Apache Software Foundation (ASF) under one or more
+## contributor license agreements. See the NOTICE file distributed with
+## this work for additional information regarding copyright ownership.
+## The ASF licenses this file to You under the Apache License, Version 2.0
+## (the "License"); you may not use this file except in compliance with
+## the License. You may obtain a copy of the License at
+##
+## http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing, software
+## distributed under the License is distributed on an "AS IS" BASIS,
+## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+## See the License for the specific language governing permissions and
+## limitations under the License.
+## ---------------------------------------------------------------------------
+
+# START SNIPPET: jndi
+
+java.naming.factory.initial = org.apache.activemq.jndi.ActiveMQInitialContextFactory
+
+# use the following property to configure the default connector
+java.naming.provider.url = vm://localhost?broker.persistent=false
+
+# use the following property to specify the JNDI name the connection factory
+# should appear as.
+#connectionFactoryNames = connectionFactory, queueConnectionFactory, topicConnectionFactry
+connectionFactoryNames = ConnectionFactory
+
+# register some queues in JNDI using the form
+# queue.[jndiName] = [physicalName]
+queue.Bookings = BookingsRequestQueue
+
+# register some topics in JNDI using the form
+# topic.[jndiName] = [physicalName]
+#topic.MyTopic = example.MyTopic
+
+# END SNIPPET: jndi
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/distribution/pom.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/distribution/pom.xml new file mode 100644 index 0000000000..0f8f681c64 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/distribution/pom.xml @@ -0,0 +1,62 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<project> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>scatours</artifactId> + <version>1.0-SNAPSHOT</version> + <relativePath>../pom.xml</relativePath> + </parent> + <version>1.0-SNAPSHOT</version> + + <artifactId>scatours-distribution</artifactId> + <name>Apache Tuscany SCA Tours Distribution</name> + <packaging>pom</packaging> + + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-assembly-plugin</artifactId> + <executions> + <execution> + <id>distribution-package</id> + <phase>package</phase> + <goals> + <goal>single</goal> + </goals> + <configuration> + <descriptors> + <descriptor>src/main/assembly/src.xml</descriptor> + </descriptors> + <tarLongFileMode>gnu</tarLongFileMode> + <archiveBaseDirectory>.</archiveBaseDirectory> + <outputDirectory>target</outputDirectory> + <finalName>apache-tuscany-scatours-${version}</finalName> + <appendAssemblyId>true</appendAssemblyId> + <ignoreDirFormatExtensions>true</ignoreDirFormatExtensions> + </configuration> + </execution> + </executions> + </plugin> + </plugins> + </build> +</project> diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/distribution/src/main/assembly/src.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/distribution/src/main/assembly/src.xml new file mode 100644 index 0000000000..0133880dcd --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/distribution/src/main/assembly/src.xml @@ -0,0 +1,62 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<assembly> + <!-- id typically identifies the "type" (src vs bin etc) of the assembly --> + <id></id> + <includeBaseDirectory>true</includeBaseDirectory> + <baseDirectory>tuscany-scatours-${version}</baseDirectory> + <formats> +<!-- + <format>dir</format> +--> + <format>tar.gz</format> + <format>zip</format> + </formats> + + <fileSets> + <fileSet> + <directory>..</directory> + <outputDirectory>travelsample</outputDirectory> + <excludes> + <exclude>**/.*</exclude> + <exclude>**/.*/**</exclude> + <exclude>**/*.log</exclude> + <exclude>**/target</exclude> + <exclude>**/target/**/*</exclude> + <exclude>**/maven-eclipse.xml</exclude> + </excludes> + </fileSet> + + <!-- Add the text files to the top-level directroy --> + <fileSet> + <directory>src/main/release</directory> + <outputDirectory>travelsample</outputDirectory> + <includes> + <include>BUILDING</include> + <include>CHANGES</include> + <include>LICENSE</include> + <include>NOTICE</include> + <include>README</include> + <include>RELEASE_NOTES</include> + </includes> + </fileSet> + </fileSets> + +</assembly> diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/distribution/src/main/release/BUILDING b/sca-java-1.x/branches/sca-java-travelsample-1.0/distribution/src/main/release/BUILDING new file mode 100644 index 0000000000..8600064227 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/distribution/src/main/release/BUILDING @@ -0,0 +1,111 @@ +Building the Apache Tuscany SCA Travel Sample 1.0 April 2010 release distribution
+=================================================================================
+
+Initial Setup
+-------------
+
+1) Install Java SE JDK 5 or JDK 6, which can be downloaded from
+ http://java.sun.com/javase/downloads/index.jsp. For JDK 5 use update 22
+ and for JDK 6 use update 7 (or later).
+
+2) Make sure that your JAVA_HOME environment variable is set to the newly installed
+ JDK location, and that your PATH includes %JAVA_HOME%\bin (windows) or
+ $JAVA_HOME/bin (unix).
+
+3) Install Apache Maven 2.0.7 or later, which can be downloaded from
+ http://maven.apache.org/download.html. Make sure that your M2_HOME
+ environment variable is set to the installation base directory, and that
+ your PATH includes %M2_HOME%\bin (windows) or $M2_HOME/bin (unix).
+
+4) Install Apache Ant 1.7.1 or later, which can be downloaded from
+ http://ant.apache.org/bindownload.cgi. Make sure that your ANT_HOME
+ environment variable is set to the installation base directory, and that
+ your PATH includes %ANT_HOME%\bin (windows) or $ANT_HOME/bin (unix).
+
+5) Download the Apache Tuscany SCA Java 1.6 (or later) binary distribution
+ from http://tuscany.apache.org/sca-java-1x-releases.html and unpack it
+ into a local directory. Set your TUSCANY_HOME environment variable to
+ the base directory containing the unpacked binary distribution.
+
+6) Download the Apache Tuscany SCA Java Travel Sample 1.0 (or later) distribution
+ from http://tuscany.apache.org/sca-java-travel-sample-1x-releases.html and
+ unpack it into a local directory.
+
+The following steps are only needed if you will be using Maven to build the
+travel sample:
+
+ 7) Check the setting of the <tuscany.version> property in the
+ travelsample/pom.xml file. If you want to build the travel sample using
+ a different Tuscany version, change this property as necessary. The
+ travel sample has been tested and runs correctly with Tuscany SCA Java 1.6.
+
+The following steps are only needed if you will be using Ant to build the
+travel sample:
+
+ 8) Download the Apache OpenEJB 3.1.2 (or later) binary distribution from
+ http://openejb.apache.org/download.html and unpack it into a local
+ directory. Set your OPENEJB_HOME environment variable to the base directory
+ containing the unpacked binary distribution.
+
+ 9) If you are using JDK 5, download the JAX-WS reference implementation
+ version 2.1.7 from https://jax-ws.dev.java.net/2.1.7/ and unpack it into
+ a local directory. Set your JAXWS_HOME environment variable to the base
+ directory containing the unpacked download.
+
+10) Download the JUnit 4.5 (or later) binary distribution from
+ http://github.com/KentBeck/junit/downloads and unpack it into a local
+ directory. Set your the JUNIT_JAR environment variable to the full path
+ to the junit-x.y.z.jar in the unpacked binary distribution taking care
+ to replace x.y.z with the JUnit version number.
+
+
+Building using Ant
+------------------
+
+1) Change to the "travelsample" directory of the Apache Tuscany SCA Travel Sample
+ distribution which you unpacked in step 6) above.
+
+2) Run the command "ant". This will compile the complete travel sample and
+ run all of the travel sample unit tests.
+
+
+Building using Maven
+--------------------
+
+1) Change to the "travelsample" directory of the Apache Tuscany SCA Travel Sample
+ distribution which you unpacked in step 6) above.
+
+2) Run the command "mvn". You will need a live internet connection so that
+ Maven can download any required files to your local repository. This will
+ compile the complete travel sample and run all of the travel sample unit tests.
+
+ Depending on the load of remote Maven 2.0 repositories, you may have
+ to run "mvn" several times until the required dependencies are
+ all located in your local maven repository. It usually takes some time for
+ maven to download required dependencies in the first build. Once all the
+ dependencies have been downloaded you may use the -o option to run maven
+ in offline mode, for example, 'mvn clean install -o'.
+
+ When building with Maven, an executable binary package for the travel
+ sample is created in the travelsample/binaries/target directory. By default
+ this binary package is an add-on delta to the Tuscany SCA Java 1.6 binary
+ distribution. If you want to produce a fully self-contained binary package
+ in the travelsample/binaries/target directory (with no external dependencies),
+ you can use the command "mvn -Pselfcontained" instead of "mvn" when
+ building from the "travelsample" directory.
+
+
+Building the Distribution
+-------------------------
+
+1) Change to the travelsample/distribution directory.
+
+2) Run the command "mvn". This will build the distribution package
+ with .zip and .tar.gz formats in the distribution/target directory.
+
+
+Running the Travel Sample
+-------------------------
+
+Full details of how to run the travel sample can be found in the README
+file in the "travelsample" directory of the unpacked distribution.
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/distribution/src/main/release/CHANGES b/sca-java-1.x/branches/sca-java-travelsample-1.0/distribution/src/main/release/CHANGES new file mode 100644 index 0000000000..8175ae30fc --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/distribution/src/main/release/CHANGES @@ -0,0 +1,4 @@ +Changes in Apache Tuscany SCA Travel Sample 1.0 April 2010
+==========================================================
+
+First release of the travel sample.
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/distribution/src/main/release/LICENSE b/sca-java-1.x/branches/sca-java-travelsample-1.0/distribution/src/main/release/LICENSE new file mode 100644 index 0000000000..75b52484ea --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/distribution/src/main/release/LICENSE @@ -0,0 +1,202 @@ +
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/distribution/src/main/release/NOTICE b/sca-java-1.x/branches/sca-java-travelsample-1.0/distribution/src/main/release/NOTICE new file mode 100644 index 0000000000..fe2afdae7c --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/distribution/src/main/release/NOTICE @@ -0,0 +1,83 @@ +Apache Tuscany
+Copyright (c) 2005 - 2010 The Apache Software Foundation
+
+This product includes/uses software developed at
+The Apache Software Foundation (http://www.apache.org/).
+ +This product includes/uses JSON-RPC-Java (http://oss.metaparadigm.com/jsonrpc/) + +This product includes/uses JSON-RPC JavaScript client (jsonrpc.js) + Copyright (c) 2003-2004 Jan-Klaas Kollhof + Copyright (c) 2005 Michael Clark, Metaparadigm Pte Ltd +This product includes/uses Axion : the Open Source Java Database (http://axion.tigris.org/)
+ Copyright (c) 2002-2003 Axion Development Team. All rights reserved.
+
+This product includes/uses XmlSchema developed at
+The Apache Software Foundation (http://ws.apache.org/commons/XmlSchema)
+ Portions Copyright 2006 International Business Machines Corp.
+
+This product includes/uses the Jetty Servlet Engine (http://jetty.mortbay.org),
+developed by Mort Bay Consulting (http://www.mortbay.com)
+
+This product includes/uses DOM4J : the flexible XML framework for java (http://www.dom4j.org/)
+ Copyright 2001-2005 (C) MetaStuff, Ltd. All Rights Reserved.
+
+This product includes/uses software, AOP alliance (http://aopalliance.sourceforge.net)
+License: Public Domain
+
+This product includes/uses javacc (https://javacc.dev.java.net/)
+ Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
+
+This product includes/uses software from the GlassFish project (https://glassfish.dev.java.net/)
+ Copyright (c) 2006, Sun Microsystems, Inc.
+
+This product includes/uses the Sourceforge wsdl4j project (http://sourceforge.net/projects/wsdl4j/)
+
+This product includes/uses JDOM (http://www.jdom.org/)
+ Copyright (C) 2000-2004 Jason Hunter & Brett McLaughlin. All rights reserved.
+
+This product includes/uses javacc (https://javacc.dev.java.net/)
+ Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
+
+This product includes/uses ASM (http://asm.objectweb.org)
+ Copyright (c) 2000-2005 INRIA, France Telecom. All rights reserved.
+
+This product includes/uses Jaxen (http://jaxen.codehaus.org/)
+ Copyright 2003-2006 The Werken Company. All Rights Reserved.
+
+This product includes/uses Serp (http://serp.sourceforge.net/) under the BSD license:
+ Copyright (c) 2002, A. Abram White. All rights reserved.
+
+This product also includes/uses software under the BSD license
+with the following copyright:
+ Copyright (c) 2006, Sun Microsystems, Inc. All rights reserved.
+
+The Program includes/uses all or portions of the following software: "The
+Saxon XSLT and XQuery Processor from Saxonica Limited" distributed under
+an MPL v1.0 license. Please refer to the homepage URL at
+http://www.saxonica.com/.
+
+This product includes/uses Serp (http://serp.sourceforge.net/) under the BSD license:
+ Copyright (c) 2002, A. Abram White. All rights reserved.
+
+This product also includes/uses "OSGi Materials."
+ Copyright (c) 2000, 2006
+ OSGi Alliance Bishop Ranch 6
+ 2400 Camino Ramon, Suite 375
+ San Ramon, CA 94583 USA
+ All Rights Reserved.
+
+This product includes/uses software under the Service Component Architecture JavaDoc,
+Interface Definition files and XSD files license.
+ (c) Copyright SCA Collaboration 2006, 2007
+
+This product includes/uses software under the Service Data Objects JavaDoc and
+Interface Definition file license
+
+(c) Copyright BEA Systems, Inc., International Business Machines Corporation,
+Oracle Corporation, Primeton Technologies Ltd., Rogue Wave Software, SAP AG.,
+Software AG., Sun Microsystems, Sybase Inc., Xcalia, Zend Technologies,
+2005, 2006. All rights reserved.
+
+This product includes/uses software under the OASIS license
+Copyright (C) OASIS(R) 2005, 2010. All Rights Reserved.
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/distribution/src/main/release/README b/sca-java-1.x/branches/sca-java-travelsample-1.0/distribution/src/main/release/README new file mode 100644 index 0000000000..27b21c09a1 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/distribution/src/main/release/README @@ -0,0 +1,488 @@ +
+Running the travel sample from the source directories
+-----------------------------------------------------
+
+The travel sample consists of a number of related scenarios. These scenarios
+are listed below, together with instructions for running them. The instructions
+in this section will work irrespective of whether the travel sample was built
+using ant or maven.
+
+Most of the scenarios are run by opening a single command prompt window
+and entering the command "ant run" into that window. If a scenario is
+listed with multiple commands, this means that it needs multiple command
+prompt windows. In this case, each of the listed commands must be entered
+into its own separate command prompt window in the order shown.
+
+Before running these scenarios, you need to perform the setup described above
+in "Building the travel sample using ant" if you have not already done this.
+
+Some of the scenarios are packaged as web applications (.war files). Instead
+of being run from the command line, these are deployed to a suitable web
+application server (such as Apache Tomcat) and run from a browser.
+
+For each scenario, the following are listed below:
+ Command(s): the command or commands for running the scenario, if any
+ Directory: the current directory for the command prompt window or windows
+ Webapp: .war file to be deployed for this scenario, if any
+ URL(s): browser URL or URLs used to run this scenario, if any
+ Contributions: SCA contributions used in this scenario
+ Launchers: other launcher directories used in this scenario, if any
+ Services: non-SCA services used in this scenario, if any
+ Clients: non-SCA clients used in this scenario, if any
+
+1) Jumpstart - First simple example of using Tuscany
+
+Command: ant run
+Directory: launchers/jumpstart
+Contributions: introducing-trips
+
+2) Introducing - Simplified introduction to the travel application
+
+Command: ant run
+Directory: launchers/introducing
+Contributions: introducing-client, introducing-tours, introducing-trips
+
+3) Introducing (distributed) - Distributed services with a domain manager
+
+Commands: ant run-domain, ant run-trips, ant run-tours, ant run
+Directory: launchers/introducing-client
+Contributions: introducing-client, introducing-tours, introducing-trips
+Launchers: introducing-domain, introducing-tours, introducing-trips
+
+4) Interaction - Different SCA interaction styles
+
+Command: ant run
+Directory: launchers/interaction
+Contributions: calendar, common, currency, flight, hotel, interaction-client,
+ interaction-service-remote, shoppingcart
+
+5) Full application - The full interactive travel application
+
+Command: ant run
+Directory: launchers/fullapp
+URL: http://localhost:8080/scatours
+Contributions: car, common, creditcard-payment-jaxb-policy, currency, flight,
+ fullapp-bespoketrip, fullapp-coordination, fullapp-currency, fullapp-packagedtrip,
+ fullapp-shoppingcart, fullapp-ui, hotel, payment-spring-policy, scatours,
+ shoppingcart, travelcatalog, trip, tripbooking
+
+6) Full application (distributed) - Distributed services with a domain manager
+
+Commands: ant run-domain, ant run
+Directory: launchers/fullapp-nodes
+URL: http://localhost:8080/scatours
+Contributions: car, common, creditcard-payment-jaxb-policy, currency, flight,
+ fullapp-bespoketrip, fullapp-coordination, fullapp-currency, fullapp-packagedtrip,
+ fullapp-shoppingcart, fullapp-ui, hotel, payment-spring-policy, scatours,
+ shoppingcart, travelcatalog, trip, tripbooking
+Launchers: fullapp-domain
+
+7) Building blocks - Using SCA composites as application building blocks
+
+Commands: ant run
+Directory: launchers/buildingblocks
+Contributions: buildingblocks, buildingblocks-client, introducing-trips
+
+8) Blog feed
+
+Command: ant run
+Directory: launchers/blog-feed
+URLs: http://localhost:8090/BlogAtom, http://localhost:8090/BlogRSS,
+ http://localhost:8090/BlogAtomAPIs, http://localhost:8090/BlogRSSAPIs
+Contributions: blog-feed
+
+9) Data binding
+
+Command: ant run
+Directory: launchers/databinding
+Contributions: creditcard-payment-sdo, databinding-client, payment-java
+
+10) Feed logger
+
+Command: ant run
+Directory: launchers/feed-logger
+Contributions: feed-logger
+
+11) Help pages
+
+Command: ant run
+Directory: launchers/help-pages
+URL: http://localhost:8085/help/index.html
+Contributions: help-pages
+
+12) Policy
+
+Command: ant run
+Directory: launchers/policy
+Contributions: creditcard-payment-jaxb-policy, payment-java-policy, policy-client
+
+13) Payment service with different implementation types
+
+13a) implementation.bpel
+
+Command: ant run
+Directory: launchers/payment-bpel
+Contributions: creditcard-payment-jaxb, emailgateway, payment-bpel, payment-bpel-process
+
+13b) implementation.script written in Groovy
+
+Command: ant run
+Directory: launchers/payment-groovy
+Contributions: creditcard-payment-jaxb, emailgateway, payment-groovy
+
+13c) implementation.java
+
+Command: ant run
+Directory: launchers/payment-java
+Contributions: creditcard-payment-jaxb, payment-java
+
+13d) implementation.java with policy
+
+Command: ant run
+Directory: launchers/payment-java-policy
+Contributions: creditcard-payment-jaxb-policy, payment-java-policy
+
+13e) implementation.spring
+
+Command: ant run
+Directory: launchers/payment-spring
+Contributions: creditcard-payment-jaxb, payment-spring
+
+13f) implementation.spring with SCA tags
+
+Command: ant run
+Directory: launchers/payment-spring-scatag
+Contributions: creditcard-payment-jaxb, payment-spring-scatag
+
+14) SCA service packaged in a web application
+
+Webapp: scatours-contribution-creditcard-payment-webapp.war
+Contributions: creditcard-payment-jaxb, creditcard-payment-webapp
+URL: http://localhost:8080/scatours-contribution-creditcard-payment-webapp
+
+Note: The host name and port number may differ depending on the configuration
+of the web application server.
+
+15) SCA currency converter service interoperating with SCA or non-SCA client
+
+15a) SCA client
+
+Command: ant run
+Directory: launchers/currency-converter
+Contributions: currency
+
+15b) CORBA client
+
+Commands: ant run, ant run-client
+Directory: launchers/currency-converter-corba
+Contributions: currency, currency-corba
+Clients: currency-converter-corba
+
+15c) JMS client
+
+Commands: ant run, ant run-client
+Directory: launchers/currency-converter-jms
+Contributions: currency, currency-jms
+Clients: currency-converter-jms
+
+15d) RMI client
+
+Commands: ant run, ant run-client
+Directory: launchers/currency-converter-rmi
+Contributions: currency, currency-rmi
+Clients: currency-converter-rmi
+
+15e) JAX-WS client
+
+Commands: ant run, ant run-client
+Directory: launchers/currency-converter-ws
+Contributions: currency, currency-ws
+Clients: currency-converter-ws-jaxws
+
+15f) Web application JSP client
+
+Webapp: scatours-contribution-currency-jsp.war
+Contributions: currency, currency-jsp
+URL: http://localhost:8080/scatours-contribution-currency-jsp
+
+Note: The URL host name and port number may differ depending on the
+configuration of the web application server.
+
+15g) Web application servlet client
+
+Webapp: scatours-contribution-currency-servlet.war
+Contributions: currency, currency-servlet
+URL: http://localhost:8080/scatours-contribution-currency-servlet
+
+Note: The URL host name and port number may differ depending on the
+configuration of the web application server.
+
+16) SCA notification service interoperating with non-SCA SMS gateway service
+
+16a) SMS gateway CORBA service
+
+Commands: ant run-smsgateway, ant run
+Directory: launchers/notification-corba
+Contributions: notification, notification-corba
+Services: smsgateway-corba
+
+16b) SMS gateway EJB service
+
+Commands: ant run-smsgateway, ant run
+Directory: launchers/notification-ejb
+Contributions: notification, notification-ejb
+Services: smsgateway-ejb
+
+16c) SMS gateway JMS service
+
+Commands: ant run-smsgateway, ant run
+Directory: launchers/notification-jms
+Contributions: notification, notification-jms
+Services: smsgateway-jms
+
+16d) SMS gateway RMI service
+
+Commands: ant run-smsgateway, ant run
+Directory: launchers/notification-rmi
+Contributions: notification, notification-rmi
+Services: smsgateway-rmi
+
+16e) SMS gateway JAX-WS service
+
+Commands: ant run-smsgateway, ant run
+Directory: launchers/notification-ws
+Contributions: notification, notification-ws
+Services: smsgateway-jaxws
+
+
+Running the travel sample from the "binaries" directory
+-------------------------------------------------------
+
+If the travel sample was built using maven, a binaries/target directory
+will be created with subdirectories containing all the built jar and war
+files and runtime dependencies for the jar files.
+
+The following subdirectories of binaries/target contain jar and war files
+for the travel sample:
+ clients - non-SCA clients using various communication technologies
+ contributions - SCA contributions for the travel sample
+ launchers - executable launchers for the travel sample
+ services - non-SCA services using various communication technologies
+ util - jar files needed by other jars in the travel sample
+ webapps - war files for the travel sample
+
+The following subdirectories of binaries/target contain runtime dependencies
+for the above jar files:
+ domainconfig - domain configuration files
+ jaxws - JAX-WS runtime jars neeed when running the travel sample on JDK 5
+ lib - Tuscany runtime jars and their dependencies needed by the travel sample
+ (only present if the travel sample was built using "mvn -Pselfcontained")
+ ode - JPA Derby database needed by the ODE runtime
+ openejb - OpenEJB 3.1.2 runtime jars needed by the travel sample
+
+You can run each of the scenarios from the appropriate subdirectory of the
+binaries/target directory using ant scripts that are included in these
+subdirectories.
+
+The ant commands that you need to use for running each scenario are listed below.
+If multiple ant commands are listed for a scenario, they must be run in
+separate processes in the order listed. The current directory when invoking
+the ant command must be set to the appropriate subdirectory of binaries/target
+as follows:
+ launchers/scatours-launcher-*.jar are run from the launchers directory
+ clients/scatours-client-*.jar are run from the clients directory
+ services/scatours-service-*.jar are run from the services directory
+
+To run a jar, you need to use the command "ant run-jarsuffix" where
+"jarsuffix" is the last part of the jar file name omitting the standard prefix
+"scatours-client", "scatours-launcher" or "scatours-service". For example,
+to run the "jumpstart" scenario, you would set your current directory to the
+binaries/target/launchers directory and run the command
+ ant run-jumpstart
+This runs the travel sample jar file scatours-launcher-jumpstart.jar using a
+classpath with the required runtime dependencies from the Tuscany SCA binary
+distribution. The location of the Tuscany SCA binary distribution is specified
+by the TUSCANY_HOME environment variable).
+
+If the travel sample was built using the "mvn -Pselfcontained" command, you can
+use the "java -jar" command to run the travel sample executable jars directly as
+n alternative to using ant scripts. For example, instead of using the command
+ ant run-jumpstart
+you can use the command
+ java -jar scatours-launcher-jumpstart.jar
+
+Here is a complete list of the ant commands to run the scenarios described above
+from the binaries/target subdirectories. These are run from the "launchers"
+subdirectory unlesss otherwise indicated.
+
+ 1) Jumpstart - First simple example of using Tuscany
+ ant run-jumpstart
+
+ 2) Introducing - Simplified introduction to the travel application
+ ant run-introducing
+
+ 3) Introducing (distributed) - Distributed services with a domain manager
+ ant run-introducing-domain
+ ant run-introducing-trips
+ ant run-introducing-tours
+ ant run-introducing-client
+
+ 4) Interaction - Different SCA interaction styles
+ ant run-interaction
+
+ 5) Full application - The full interactive travel application
+ jant run-fullapp
+
+ 6) Full application (distributed) - Distributed services with a domain manager
+ ant run-fullapp-domain
+ ant run-fullapp-nodes
+
+ 7) Building blocks - Using SCA composites as application building blocks
+ ant run-buildingblocks
+
+ 8) Blog feed
+ ant run-blog-feed
+
+ 9) Data binding
+ ant run-databinding
+
+10) Feed logger
+ ant run-feed-logger
+
+11) Help pages
+ ant run-help-pages
+
+12) Policy
+ ant run-policy
+
+13) Payment service with different implementation types
+
+13a) implementation.bpel
+ ant run-payment-bpel
+
+13b) implementation.script written in Groovy
+ ant run-payment-groovy
+
+13c) implementation.java
+ ant run-payment-java
+
+13d) implementation.java with policy
+ ant run-payment-java-policy
+
+13e) implementation.spring
+ ant run-payment-spring
+
+13f) implementation.spring with SCA tags
+ ant run-payment-spring-scatag
+
+14) SCA service packaged in a web application
+ deploy webapps/scatours-contribution-creditcard-payment-webapp.war to Tomcat
+
+15) SCA currency converter service interoperating with SCA or non-SCA client
+
+15a) SCA client
+ ant run-currency-converter
+
+15b) CORBA client
+ ant run-currency-converter-corba
+ ant run-currency-converter-corba (from "clients" directory)
+
+15c) JMS client
+ ant run-currency-converter-jms
+ ant run-currency-converter-jms (from "clients" directory)
+
+15d) RMI client
+ ant run-currency-converter-rmi
+ ant run-currency-converter-rmi (from "clients" directory)
+
+15e) JAX-WS client
+ ant run-currency-converter-ws
+ ant run-currency-converter-ws-jaxws (from "clients" directory)
+
+15f) Web application JSP client
+ deploy webapps/scatours-contribution-currency-jsp.war to Tomcat
+
+15g) Web application servlet client
+ deploy webapps/scatours-contribution-currency-servlet.war to Tomcat
+
+16) SCA notification service interoperating with non-SCA SMS gateway service
+
+16a) SMS gateway CORBA service
+ ant run-smsgateway-corba (from "services" directory)
+ ant run-notification-corba
+
+16b) SMS gateway EJB service
+ ant run-smsgateway-ejb (from "services" directory)
+ ant run-notification-ejb
+
+16c) SMS gateway JMS service
+ ant run-smsgateway-jms (from "services" directory)
+ ant run-notification-jms
+
+16d) SMS gateway RMI service
+ ant run-smsgateway-rmi (from "services" directory)
+ ant run-notification-rmi
+
+16e) SMS gateway JAX-WS service
+ ant run-smsgateway-jaxws (from "services" directory)
+ ant run-notification-ws
+
+
+Cross-reference of contributions to scenarios
+---------------------------------------------
+
+The following table shows which contributions are used in which scenarios.
+
+contributions/blog-feed 8
+contributions/buildingblocks 7
+contributions/buildingblocks-client 7
+contributions/calendar 4
+contributions/car 5, 6
+contributions/common 4, 5, 6
+contributions/creditcard-payment-jaxb 13a, 13b, 13c, 13e, 13f, 14
+contributions/creditcard-payment-jaxb-policy 5, 6, 12, 13d
+contributions/creditcard-payment-sdo 9
+contributions/creditcard-payment-webapp 14
+contributions/currency 4, 5, 6, 15a, 15b, 15c, 15d, 15e, 15f, 15g
+contributions/currency-corba 15b
+contributions/currency-jms 15c
+contributions/currency-jsp 15f
+contributions/currency-rmi 15d
+contributions/currency-servlet 15g
+contributions/currency-ws 15e
+contributions/databinding-client 9
+contributions/emailgateway 13a, 13b
+contributions/feed-logger 10
+contributions/flight 4, 5, 6
+contributions/fullapp-bespoketrip 5, 6
+contributions/fullapp-coordination 5, 6
+contributions/fullapp-currency 5, 6
+contributions/fullapp-packagedtrip 5, 6
+contributions/fullapp-shoppingcart 5, 6
+contributions/fullapp-ui 5, 6
+contributions/help-pages 11
+contributions/hotel 5, 6
+contributions/interaction-client 4
+contributions/interaction-service-remote 4
+contributions/introducing-client 2, 3
+contributions/introducing-tours 2, 3
+contributions/introducing-trips 1, 2, 3, 7
+contributions/notification 16a, 16b, 16c, 16d
+contributions/notification-corba 16a
+contributions/notification-ejb 16b
+contributions/notification-jms 16c
+contributions/notification-rmi 16d
+contributions/payment-bpel 13a
+contributions/payment-bpel-process 13a
+contributions/payment-groovy 13b
+contributions/payment-java 9, 13c
+contributions/payment-java-policy 12, 13d
+contributions/payment-spring 13e
+contributions/payment-spring-policy 5, 6
+contributions/payment-spring-scatag 13f
+contributions/policy-client 12
+contributions/scatours 5, 6
+contributions/shoppingcart 4, 5, 6
+contributions/travelcatalog 5, 6
+contributions/trip 5, 6
+contributions/tripbooking 5, 6
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/distribution/src/main/release/RELEASE_NOTES b/sca-java-1.x/branches/sca-java-travelsample-1.0/distribution/src/main/release/RELEASE_NOTES new file mode 100644 index 0000000000..ff0375f7d3 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/distribution/src/main/release/RELEASE_NOTES @@ -0,0 +1,63 @@ +Apache Tuscany SCA Travel Sample 1.0 April 2010 Release Notes
+=============================================================
+
+The Apache Tuscany SCA Travel Sample shows how Apache Tuscany SCA
+can be used in a business application.
+
+Overview
+--------
+
+The travel sample consists of a number of scenarios which demonstrate
+various aspects of SCA and Apache Tuscany in the context of a travel
+booking application. Details of these scenarios can be found in the
+travel sample README file.
+
+Unlike other Apache Tuscany SCA samples that are included in the
+Apache Tuscany SCA distribution, the travel sample is released as a
+separate package. This matches how user applications are developed
+and makes it easier for Apache Tuscany users to use the travel sample
+as a template for developing and packaging their own applications.
+
+The travel sample distribution contains source code and build files.
+It doesn't contain binaries because one of the major purposes of this
+sample is to show users how to build and run an Apache Tuscany
+application from source code. The travel sample BUILDING file gives
+details of the steps needed to do this.
+
+See the travel sample CHANGES file for a detailed list of new features
+and bug fixes in this release.
+
+Support
+-------
+
+For more information on Apache Tuscany visit the website at:
+
+ http://tuscany.apache.org/
+
+Any issues with this release can be reported to Apache Tuscany
+using the mailing lists or in the JIRA issue tracker.
+
+ Mailing list archives:
+
+ http://mail-archives.apache.org/mod_mbox/tuscany-user
+ http://mail-archives.apache.org/mod_mbox/tuscany-dev/
+
+ JIRA:
+
+ http://issues.apache.org/jira/browse/TUSCANY
+
+To join the project's mailing lists follow the instructions at:
+
+ http://tuscany.apache.org/mailing-lists.html
+
+To find out more about OASIS Open CSA go to:
+
+ http://www.oasis-opencsa.org.
+
+Apache Tuscany welcomes your help. Any contribution, including code,
+testing, improving the documentation, or bug reporting is always
+appreciated.
+
+Thank you for using Apache Tuscany!
+
+- The Tuscany Team.
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/domainconfig/build.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/domainconfig/build.xml new file mode 100644 index 0000000000..04219dd032 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/domainconfig/build.xml @@ -0,0 +1,45 @@ +<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<project name="scatours-domainconfig" default="compile">
+
+ <target name="compile">
+ <antcall target="allsubdirs">
+ <param name="target" value="compile"/>
+ </antcall>
+ </target>
+
+ <target name="test">
+ <antcall target="allsubdirs">
+ <param name="target" value="test"/>
+ </antcall>
+ </target>
+
+ <target name="clean">
+ <antcall target="allsubdirs">
+ <param name="target" value="clean"/>
+ </antcall>
+ </target>
+
+ <target name="allsubdirs">
+ <ant dir="fullapp" target="${target}"/>
+ <ant dir="introducing" target="${target}"/>
+ </target>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/domainconfig/fullapp/build.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/domainconfig/fullapp/build.xml new file mode 100644 index 0000000000..3fd52446fc --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/domainconfig/fullapp/build.xml @@ -0,0 +1,22 @@ +<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<project name="scatours-domainconfig-fullapp" default="compile">
+ <import file="../../antdefs.xml"/>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/domainconfig/fullapp/pom.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/domainconfig/fullapp/pom.xml new file mode 100644 index 0000000000..94802269bb --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/domainconfig/fullapp/pom.xml @@ -0,0 +1,79 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent><version>1.0-SNAPSHOT</version>
+ <artifactId>scatours-domainconfig-fullapp</artifactId>
+ <name>Apache Tuscany SCA Tours Full App Domain Configuration</name>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ <resources>
+ <resource>
+ <directory>src/main/resources</directory>
+ <excludes>
+ <exclude>workspace-distribution.xml</exclude>
+ </excludes>
+ </resource>
+ </resources>
+ <plugins>
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <executions>
+ <execution>
+ <phase>process-resources</phase>
+ <configuration>
+ <tasks>
+ <mkdir dir="target/jar-classes/fullapp"/>
+ <copy todir="target/jar-classes/fullapp">
+ <fileset dir="src/main/resources">
+ <exclude name="workspace*.xml"/>
+ </fileset>
+ </copy>
+ <copy todir="target/jar-classes/fullapp">
+ <fileset dir="src/main/resources">
+ <include name="workspace-distribution.xml"/>
+ </fileset>
+ <globmapper from="workspace-distribution.xml" to="workspace.xml"/>
+ </copy>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <configuration>
+ <classesDirectory>target/jar-classes</classesDirectory>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/domainconfig/fullapp/src/main/resources/cloud.composite b/sca-java-1.x/branches/sca-java-travelsample-1.0/domainconfig/fullapp/src/main/resources/cloud.composite new file mode 100644 index 0000000000..284376538a --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/domainconfig/fullapp/src/main/resources/cloud.composite @@ -0,0 +1,35 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite name="cloud.composite"
+ targetNamespace="http://tuscany.apache.org/xmlns/sca/1.0"
+ xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:ns1="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:ns2="http://tuscany.apache.org/cloud">
+
+ <include name="ns2:ui" uri="http://tuscany.apache.org/cloud" />
+ <include name="ns2:coordination" uri="http://tuscany.apache.org/cloud" />
+ <include name="ns2:packagedtrip" uri="http://tuscany.apache.org/cloud" />
+ <include name="ns2:bespoketrip" uri="http://tuscany.apache.org/cloud" />
+ <include name="ns2:currency" uri="http://tuscany.apache.org/cloud" />
+ <include name="ns2:shoppingcart" uri="http://tuscany.apache.org/cloud" />
+ <include name="ns2:payment" uri="http://tuscany.apache.org/cloud" />
+ <include name="ns2:creditcard" uri="http://tuscany.apache.org/cloud" />
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/domainconfig/fullapp/src/main/resources/cloud/fullapp-bespoketrip.composite b/sca-java-1.x/branches/sca-java-travelsample-1.0/domainconfig/fullapp/src/main/resources/cloud/fullapp-bespoketrip.composite new file mode 100644 index 0000000000..b6d9d51cbc --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/domainconfig/fullapp/src/main/resources/cloud/fullapp-bespoketrip.composite @@ -0,0 +1,36 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:t="http://tuscany.apache.org/xmlns/sca/1.0"
+ targetNamespace="http://tuscany.apache.org/cloud"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ xmlns:s="http://tuscanyscatours.com/"
+ name="bespoketrip">
+
+ <component name="bespoketrip">
+ <t:implementation.node uri="fullapp-bespoketrip" composite="s:fullapp-bespoketrip"/>
+ <service name="Node">
+ <binding.sca uri="http://localhost:8086"/>
+ <binding.ws uri="http://localhost:8086"/>
+ <tuscany:binding.jsonrpc uri="http://localhost:8086"/>
+ </service>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/domainconfig/fullapp/src/main/resources/cloud/fullapp-coordination.composite b/sca-java-1.x/branches/sca-java-travelsample-1.0/domainconfig/fullapp/src/main/resources/cloud/fullapp-coordination.composite new file mode 100644 index 0000000000..b42457154f --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/domainconfig/fullapp/src/main/resources/cloud/fullapp-coordination.composite @@ -0,0 +1,36 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:t="http://tuscany.apache.org/xmlns/sca/1.0"
+ targetNamespace="http://tuscany.apache.org/cloud"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ xmlns:s="http://tuscanyscatours.com/"
+ name="coordination">
+
+ <component name="coordination">
+ <t:implementation.node uri="fullapp-coordination" composite="s:fullapp-coordination"/>
+ <service name="Node">
+ <binding.sca uri="http://localhost:8084"/>
+ <binding.ws uri="http://localhost:8084"/>
+ <tuscany:binding.jsonrpc uri="http://localhost:8084"/>
+ </service>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/domainconfig/fullapp/src/main/resources/cloud/fullapp-creditcard.composite b/sca-java-1.x/branches/sca-java-travelsample-1.0/domainconfig/fullapp/src/main/resources/cloud/fullapp-creditcard.composite new file mode 100644 index 0000000000..5c66ff2796 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/domainconfig/fullapp/src/main/resources/cloud/fullapp-creditcard.composite @@ -0,0 +1,36 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:t="http://tuscany.apache.org/xmlns/sca/1.0"
+ targetNamespace="http://tuscany.apache.org/cloud"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ xmlns:s="http://tuscanyscatours.com/"
+ name="creditcard">
+
+ <component name="creditcard">
+ <t:implementation.node uri="fullapp-creditcard" composite="s:creditcard"/>
+ <service name="Node">
+ <binding.sca uri="http://localhost:8082"/>
+ <binding.ws uri="http://localhost:8082"/>
+ <tuscany:binding.jsonrpc uri="http://localhost:8082"/>
+ </service>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/domainconfig/fullapp/src/main/resources/cloud/fullapp-currency.composite b/sca-java-1.x/branches/sca-java-travelsample-1.0/domainconfig/fullapp/src/main/resources/cloud/fullapp-currency.composite new file mode 100644 index 0000000000..185112122c --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/domainconfig/fullapp/src/main/resources/cloud/fullapp-currency.composite @@ -0,0 +1,36 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:t="http://tuscany.apache.org/xmlns/sca/1.0"
+ targetNamespace="http://tuscany.apache.org/cloud"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ xmlns:s="http://tuscanyscatours.com/"
+ name="currency">
+
+ <component name="currency">
+ <t:implementation.node uri="fullapp-currency" composite="s:fullapp-currency"/>
+ <service name="Node">
+ <binding.sca uri="http://localhost:8083"/>
+ <binding.ws uri="http://localhost:8083"/>
+ <tuscany:binding.jsonrpc uri="http://localhost:8083"/>
+ </service>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/domainconfig/fullapp/src/main/resources/cloud/fullapp-packagedtrip.composite b/sca-java-1.x/branches/sca-java-travelsample-1.0/domainconfig/fullapp/src/main/resources/cloud/fullapp-packagedtrip.composite new file mode 100644 index 0000000000..323700b4a0 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/domainconfig/fullapp/src/main/resources/cloud/fullapp-packagedtrip.composite @@ -0,0 +1,35 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:t="http://tuscany.apache.org/xmlns/sca/1.0"
+ targetNamespace="http://tuscany.apache.org/cloud"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ xmlns:s="http://tuscanyscatours.com/"
+ name="packagedtrip">
+
+ <component name="packagedtrip">
+ <t:implementation.node uri="fullapp-packagedtrip" composite="s:fullapp-packagedtrip"/>
+ <service name="Node">
+ <binding.sca uri="http://localhost:8085"/>
+ <tuscany:binding.jsonrpc uri="http://localhost:8085"/>
+ </service>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/domainconfig/fullapp/src/main/resources/cloud/fullapp-payment.composite b/sca-java-1.x/branches/sca-java-travelsample-1.0/domainconfig/fullapp/src/main/resources/cloud/fullapp-payment.composite new file mode 100644 index 0000000000..b27b57fad5 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/domainconfig/fullapp/src/main/resources/cloud/fullapp-payment.composite @@ -0,0 +1,36 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:t="http://tuscany.apache.org/xmlns/sca/1.0"
+ targetNamespace="http://tuscany.apache.org/cloud"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ xmlns:s="http://tuscanyscatours.com/"
+ name="payment">
+
+ <component name="payment">
+ <t:implementation.node uri="fullapp-payment" composite="s:payment"/>
+ <service name="Node">
+ <binding.sca uri="http://localhost:8081"/>
+ <binding.ws uri="http://localhost:8081"/>
+ <tuscany:binding.jsonrpc uri="http://localhost:8081"/>
+ </service>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/domainconfig/fullapp/src/main/resources/cloud/fullapp-shoppingcart.composite b/sca-java-1.x/branches/sca-java-travelsample-1.0/domainconfig/fullapp/src/main/resources/cloud/fullapp-shoppingcart.composite new file mode 100644 index 0000000000..7bec251965 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/domainconfig/fullapp/src/main/resources/cloud/fullapp-shoppingcart.composite @@ -0,0 +1,36 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:t="http://tuscany.apache.org/xmlns/sca/1.0"
+ targetNamespace="http://tuscany.apache.org/cloud"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ xmlns:s="http://tuscanyscatours.com/"
+ name="shoppingcart">
+
+ <component name="shoppingcart">
+ <t:implementation.node uri="fullapp-shoppingcart" composite="s:fullapp-shoppingcart"/>
+ <service name="Node">
+ <binding.sca uri="http://localhost:8087"/>
+ <binding.ws uri="http://localhost:8087"/>
+ <tuscany:binding.jsonrpc uri="http://localhost:8087"/>
+ </service>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/domainconfig/fullapp/src/main/resources/cloud/fullapp-ui.composite b/sca-java-1.x/branches/sca-java-travelsample-1.0/domainconfig/fullapp/src/main/resources/cloud/fullapp-ui.composite new file mode 100644 index 0000000000..e86bef1c56 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/domainconfig/fullapp/src/main/resources/cloud/fullapp-ui.composite @@ -0,0 +1,33 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:t="http://tuscany.apache.org/xmlns/sca/1.0"
+ targetNamespace="http://tuscany.apache.org/cloud"
+ xmlns:s="http://tuscanyscatours.com/"
+ name="ui">
+
+ <component name="ui">
+ <t:implementation.node uri="fullapp-ui" composite="s:fullapp-ui"/>
+ <service name="Node">
+ <binding.sca uri="http://localhost:8080"/>
+ </service>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/domainconfig/fullapp/src/main/resources/domain.composite b/sca-java-1.x/branches/sca-java-travelsample-1.0/domainconfig/fullapp/src/main/resources/domain.composite new file mode 100644 index 0000000000..b26f71aa94 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/domainconfig/fullapp/src/main/resources/domain.composite @@ -0,0 +1,35 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite name="domain.composite"
+ targetNamespace="http://tuscany.apache.org/xmlns/sca/1.0"
+ xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:ns1="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:ns2="http://tuscanyscatours.com/">
+
+ <include name="ns2:creditcard" uri="fullapp-creditcard" />
+ <include name="ns2:payment" uri="fullapp-payment" />
+ <include name="ns2:fullapp-shoppingcart" uri="fullapp-shoppingcart" />
+ <include name="ns2:fullapp-currency" uri="fullapp-currency" />
+ <include name="ns2:fullapp-packagedtrip" uri="fullapp-packagedtrip" />
+ <include name="ns2:fullapp-bespoketrip" uri="fullapp-bespoketrip" />
+ <include name="ns2:fullapp-coordination" uri="fullapp-coordination" />
+ <include name="ns2:fullapp-ui" uri="fullapp-ui" />
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/domainconfig/fullapp/src/main/resources/workspace-distribution.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/domainconfig/fullapp/src/main/resources/workspace-distribution.xml new file mode 100644 index 0000000000..a7a3b01895 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/domainconfig/fullapp/src/main/resources/workspace-distribution.xml @@ -0,0 +1,42 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<workspace xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ xmlns:ns1="http://tuscany.apache.org/xmlns/sca/1.0">
+ <contribution location="file:../contributions/scatours-contribution-common.jar" uri="common"/>
+ <contribution location="file:../contributions/scatours-contribution-currency.jar" uri="currency"/>
+ <contribution location="file:../contributions/scatours-contribution-hotel.jar" uri="hotel"/>
+ <contribution location="file:../contributions/scatours-contribution-flight.jar" uri="flight"/>
+ <contribution location="file:../contributions/scatours-contribution-car.jar" uri="car"/>
+ <contribution location="file:../contributions/scatours-contribution-trip.jar" uri="trip"/>
+ <contribution location="file:../contributions/scatours-contribution-tripbooking.jar" uri="tripbooking"/>
+ <contribution location="file:../contributions/scatours-contribution-travelcatalog.jar" uri="travelcatalog"/>
+ <!-- the following line should be payment-spring-policy but this doesn't work when using the domain manager (TUSCANY-3476) -->
+ <contribution location="file:../contributions/scatours-contribution-payment-java-policy.jar" uri="fullapp-payment"/>
+ <contribution location="file:../contributions/scatours-contribution-creditcard-payment-jaxb-policy.jar" uri="fullapp-creditcard"/>
+ <contribution location="file:../contributions/scatours-contribution-shoppingcart.jar" uri="shoppingcart"/>
+ <contribution location="file:../contributions/scatours-contribution-scatours.jar" uri="scatours"/>
+ <contribution location="file:../contributions/scatours-contribution-fullapp-ui.jar" uri="fullapp-ui"/>
+ <contribution location="file:../contributions/scatours-contribution-fullapp-coordination.jar" uri="fullapp-coordination"/>
+ <contribution location="file:../contributions/scatours-contribution-fullapp-currency.jar" uri="fullapp-currency"/>
+ <contribution location="file:../contributions/scatours-contribution-fullapp-packagedtrip.jar" uri="fullapp-packagedtrip"/>
+ <contribution location="file:../contributions/scatours-contribution-fullapp-bespoketrip.jar" uri="fullapp-bespoketrip"/>
+ <contribution location="file:../contributions/scatours-contribution-fullapp-shoppingcart.jar" uri="fullapp-shoppingcart"/>
+ <contribution location="file:../domainconfig/fullapp/cloud" uri="http://tuscany.apache.org/cloud"/>
+</workspace>
\ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/domainconfig/fullapp/src/main/resources/workspace.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/domainconfig/fullapp/src/main/resources/workspace.xml new file mode 100644 index 0000000000..8f1efcd1fd --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/domainconfig/fullapp/src/main/resources/workspace.xml @@ -0,0 +1,42 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<workspace xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ xmlns:ns1="http://tuscany.apache.org/xmlns/sca/1.0">
+ <contribution location="file:../../contributions/common/target/scatours-contribution-common.jar" uri="common"/>
+ <contribution location="file:../../contributions/currency/target/scatours-contribution-currency.jar" uri="currency"/>
+ <contribution location="file:../../contributions/hotel/target/scatours-contribution-hotel.jar" uri="hotel"/>
+ <contribution location="file:../../contributions/flight/target/scatours-contribution-flight.jar" uri="flight"/>
+ <contribution location="file:../../contributions/car/target/scatours-contribution-car.jar" uri="car"/>
+ <contribution location="file:../../contributions/trip/target/scatours-contribution-trip.jar" uri="trip"/>
+ <contribution location="file:../../contributions/tripbooking/target/scatours-contribution-tripbooking.jar" uri="tripbooking"/>
+ <contribution location="file:../../contributions/travelcatalog/target/scatours-contribution-travelcatalog.jar" uri="travelcatalog"/>
+ <!-- the following line should be payment-spring-policy but this doesn't work when using the domain manager (TUSCANY-3476) -->
+ <contribution location="file:../../contributions/payment-java-policy/target/scatours-contribution-payment-java-policy.jar" uri="fullapp-payment"/>
+ <contribution location="file:../../contributions/creditcard-payment-jaxb-policy/target/scatours-contribution-creditcard-payment-jaxb-policy.jar" uri="fullapp-creditcard"/>
+ <contribution location="file:../../contributions/shoppingcart/target/scatours-contribution-shoppingcart.jar" uri="shoppingcart"/>
+ <contribution location="file:../../contributions/scatours/target/scatours-contribution-scatours.jar" uri="scatours"/>
+ <contribution location="file:../../contributions/fullapp-ui/target/scatours-contribution-fullapp-ui.jar" uri="fullapp-ui"/>
+ <contribution location="file:../../contributions/fullapp-coordination/target/scatours-contribution-fullapp-coordination.jar" uri="fullapp-coordination"/>
+ <contribution location="file:../../contributions/fullapp-currency/target/scatours-contribution-fullapp-currency.jar" uri="fullapp-currency"/>
+ <contribution location="file:../../contributions/fullapp-packagedtrip/target/scatours-contribution-fullapp-packagedtrip.jar" uri="fullapp-packagedtrip"/>
+ <contribution location="file:../../contributions/fullapp-bespoketrip/target/scatours-contribution-fullapp-bespoketrip.jar" uri="fullapp-bespoketrip"/>
+ <contribution location="file:../../contributions/fullapp-shoppingcart/target/scatours-contribution-fullapp-shoppingcart.jar" uri="fullapp-shoppingcart"/>
+ <contribution location="file:../../domainconfig/fullapp/target/classes/cloud" uri="http://tuscany.apache.org/cloud"/>
+</workspace>
\ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/domainconfig/introducing/build.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/domainconfig/introducing/build.xml new file mode 100644 index 0000000000..5ce51edcce --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/domainconfig/introducing/build.xml @@ -0,0 +1,22 @@ +<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<project name="scatours-domainconfig-introducing" default="compile">
+ <import file="../../antdefs.xml"/>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/domainconfig/introducing/pom.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/domainconfig/introducing/pom.xml new file mode 100644 index 0000000000..9cc529cd90 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/domainconfig/introducing/pom.xml @@ -0,0 +1,79 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent><version>1.0-SNAPSHOT</version>
+ <artifactId>scatours-domainconfig-introducing</artifactId>
+ <name>Apache Tuscany SCA Tours Introducing Domain Configuration</name>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ <resources>
+ <resource>
+ <directory>src/main/resources</directory>
+ <excludes>
+ <exclude>workspace-distribution.xml</exclude>
+ </excludes>
+ </resource>
+ </resources>
+ <plugins>
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <executions>
+ <execution>
+ <phase>process-resources</phase>
+ <configuration>
+ <tasks>
+ <mkdir dir="target/jar-classes/introducing"/>
+ <copy todir="target/jar-classes/introducing">
+ <fileset dir="src/main/resources">
+ <exclude name="workspace*.xml"/>
+ </fileset>
+ </copy>
+ <copy todir="target/jar-classes/introducing">
+ <fileset dir="src/main/resources">
+ <include name="workspace-distribution.xml"/>
+ </fileset>
+ <globmapper from="workspace-distribution.xml" to="workspace.xml"/>
+ </copy>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <configuration>
+ <classesDirectory>target/jar-classes</classesDirectory>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/domainconfig/introducing/src/main/resources/cloud.composite b/sca-java-1.x/branches/sca-java-travelsample-1.0/domainconfig/introducing/src/main/resources/cloud.composite new file mode 100644 index 0000000000..5d400e1be8 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/domainconfig/introducing/src/main/resources/cloud.composite @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<composite local="true" name="cloud" + targetNamespace="http://tuscany.apache.org/xmlns/sca/1.0" + xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:ns1="http://www.osoa.org/xmlns/sca/1.0"> + <include name="ns2:ToursNode" uri="http://tuscany.apache.org/cloud" xmlns:ns2="http://tuscany.apache.org/cloud"/> + <include name="ns2:TripsNode" uri="http://tuscany.apache.org/cloud" xmlns:ns2="http://tuscany.apache.org/cloud"/> + <include name="ns2:ClientNode" uri="http://tuscany.apache.org/cloud" xmlns:ns2="http://tuscany.apache.org/cloud"/> +</composite> diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/domainconfig/introducing/src/main/resources/cloud/ClientNode.composite b/sca-java-1.x/branches/sca-java-travelsample-1.0/domainconfig/introducing/src/main/resources/cloud/ClientNode.composite new file mode 100644 index 0000000000..adf8f0e9cb --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/domainconfig/introducing/src/main/resources/cloud/ClientNode.composite @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:t="http://tuscany.apache.org/xmlns/sca/1.0" xmlns:c="http://client.scatours/" targetNamespace="http://tuscany.apache.org/cloud" name="ClientNode"> + + <component name="ClientNode"> + <t:implementation.node uri="introducing-client" composite="c:Client" /> + <service name="Node"> + <binding.sca uri="http://localhost:8083" /> + <binding.ws uri="http://localhost:8083" /> + <t:binding.http uri="http://localhost:8083" /> + <t:binding.jsonrpc uri="http://localhost:8083" /> + <t:binding.atom uri="http://localhost:8083" /> + </service> + </component> +</composite>
\ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/domainconfig/introducing/src/main/resources/cloud/ToursNode.composite b/sca-java-1.x/branches/sca-java-travelsample-1.0/domainconfig/introducing/src/main/resources/cloud/ToursNode.composite new file mode 100644 index 0000000000..6e8f7fadb6 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/domainconfig/introducing/src/main/resources/cloud/ToursNode.composite @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:t="http://tuscany.apache.org/xmlns/sca/1.0" xmlns:c="http://tuscanyscatours.com/" targetNamespace="http://tuscany.apache.org/cloud" name="ToursNode"> + + <component name="ToursNode"> + <t:implementation.node uri="introducing-tours" composite="c:Tours" /> + <service name="Node"> + <binding.sca uri="http://localhost:8081" /> + <binding.ws uri="http://localhost:8081" /> + <t:binding.http uri="http://localhost:8081" /> + <t:binding.jsonrpc uri="http://localhost:8081" /> + <t:binding.atom uri="http://localhost:8081" /> + </service> + </component> +</composite>
\ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/domainconfig/introducing/src/main/resources/cloud/TripsNode.composite b/sca-java-1.x/branches/sca-java-travelsample-1.0/domainconfig/introducing/src/main/resources/cloud/TripsNode.composite new file mode 100644 index 0000000000..9e4b454941 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/domainconfig/introducing/src/main/resources/cloud/TripsNode.composite @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:t="http://tuscany.apache.org/xmlns/sca/1.0" xmlns:c="http://goodvaluetrips.com/" targetNamespace="http://tuscany.apache.org/cloud" name="TripsNode"> + + <component name="TripsNode"> + <t:implementation.node uri="introducing-trips" composite="c:Trips" /> + <service name="Node"> + <binding.sca uri="http://localhost:8082" /> + <binding.ws uri="http://localhost:8082" /> + <t:binding.http uri="http://localhost:8082" /> + <t:binding.jsonrpc uri="http://localhost:8082" /> + <t:binding.atom uri="http://localhost:8082" /> + </service> + </component> +</composite>
\ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/domainconfig/introducing/src/main/resources/domain.composite b/sca-java-1.x/branches/sca-java-travelsample-1.0/domainconfig/introducing/src/main/resources/domain.composite new file mode 100644 index 0000000000..ec0f71484b --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/domainconfig/introducing/src/main/resources/domain.composite @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<composite local="true" name="domain" + targetNamespace="http://tuscany.apache.org/xmlns/sca/1.0" + xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:ns1="http://www.osoa.org/xmlns/sca/1.0"> + <include name="ns2:Tours" uri="introducing-tours" xmlns:ns2="http://tuscanyscatours.com/"/> + <include name="ns2:Trips" uri="introducing-trips" xmlns:ns2="http://goodvaluetrips.com/"/> + <include name="ns2:Client" uri="introducing-client" xmlns:ns2="http://client.scatours/"/> +</composite> diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/domainconfig/introducing/src/main/resources/workspace-distribution.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/domainconfig/introducing/src/main/resources/workspace-distribution.xml new file mode 100644 index 0000000000..5c058ee325 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/domainconfig/introducing/src/main/resources/workspace-distribution.xml @@ -0,0 +1,30 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<workspace xmlns="http://tuscany.apache.org/xmlns/sca/1.0" + xmlns:ns1="http://tuscany.apache.org/xmlns/sca/1.0"> + <contribution location="file:../domainconfig/introducing/cloud" + uri="http://tuscany.apache.org/cloud"/> + <contribution location="file:../contributions/scatours-contribution-introducing-tours.jar" + uri="introducing-tours"/> + <contribution location="file:../contributions/scatours-contribution-introducing-trips.jar" + uri="introducing-trips"/> + <contribution location="file:../contributions/scatours-contribution-introducing-client.jar" + uri="introducing-client"/> +</workspace> diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/domainconfig/introducing/src/main/resources/workspace.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/domainconfig/introducing/src/main/resources/workspace.xml new file mode 100644 index 0000000000..59468135c1 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/domainconfig/introducing/src/main/resources/workspace.xml @@ -0,0 +1,30 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<workspace xmlns="http://tuscany.apache.org/xmlns/sca/1.0" + xmlns:ns1="http://tuscany.apache.org/xmlns/sca/1.0"> + <contribution location="file:../../domainconfig/introducing/target/classes/cloud" + uri="http://tuscany.apache.org/cloud"/> + <contribution location="file:../../contributions/introducing-tours/target/scatours-contribution-introducing-tours.jar" + uri="introducing-tours"/> + <contribution location="file:../../contributions/introducing-trips/target/scatours-contribution-introducing-trips.jar" + uri="introducing-trips"/> + <contribution location="file:../../contributions/introducing-client/target/scatours-contribution-introducing-client.jar" + uri="introducing-client"/> +</workspace> diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/domainconfig/pom.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/domainconfig/pom.xml new file mode 100644 index 0000000000..41f75d3068 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/domainconfig/pom.xml @@ -0,0 +1,47 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <version>1.0-SNAPSHOT</version>
+ <artifactId>scatours-domainconfig</artifactId>
+ <packaging>pom</packaging>
+ <name>Apache Tuscany SCA Tours Domain Configurations</name>
+
+ <profiles>
+ <profile>
+ <id>default</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ <modules>
+ <module>fullapp</module>
+ <module>introducing</module>
+ </modules>
+ </profile>
+
+ </profiles>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/blog-feed/build.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/blog-feed/build.xml new file mode 100644 index 0000000000..f7c4bee524 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/blog-feed/build.xml @@ -0,0 +1,35 @@ +<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<project name="scatours-launcher-blog-feed" default="compile">
+ <import file="../../antdefs.xml"/>
+ <path id="compile-path">
+ <pathelement path="../../util/launcher-common/target/scatours-util-launcher-common.jar"/>
+ </path>
+
+ <target name="run">
+ <java classname="scatours.BlogFeedLauncher" fork="true" failonerror="true">
+ <classpath>
+ <pathelement location="target/${ant.project.name}.jar"/>
+ <path refid="compile-path"/>
+ <pathelement location="${env.TUSCANY_HOME}/lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </java>
+ </target>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/blog-feed/pom.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/blog-feed/pom.xml new file mode 100644 index 0000000000..5f36065a5b --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/blog-feed/pom.xml @@ -0,0 +1,104 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent><version>1.0-SNAPSHOT</version>
+ <artifactId>scatours-launcher-blog-feed</artifactId>
+ <name>Apache Tuscany SCA Tours Blog Feed Launcher</name>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-util-launcher-common</artifactId>
+ <version>${pom.version}</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node-api</artifactId>
+ <version>${tuscany.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node-impl</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-tomcat</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-atom-abdera</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-rss-rome</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <version>2.2</version>
+ <configuration>
+ <archive>
+ <manifestEntries>
+ <Class-Path>../util/scatours-util-launcher-common.jar</Class-Path>
+ </manifestEntries>
+ <manifest>
+ <addClasspath>${scatours.selfContained}</addClasspath>
+ <classpathPrefix>../lib/</classpathPrefix>
+ <mainClass>scatours.BlogFeedLauncher</mainClass>
+ </manifest>
+ </archive>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/blog-feed/src/main/java/scatours/BlogFeedLauncher.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/blog-feed/src/main/java/scatours/BlogFeedLauncher.java new file mode 100644 index 0000000000..8dc6956986 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/blog-feed/src/main/java/scatours/BlogFeedLauncher.java @@ -0,0 +1,50 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package scatours;
+
+import static scatours.launcher.LauncherUtil.locate;
+
+import org.apache.tuscany.sca.node.SCAContribution;
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.SCANodeFactory;
+
+public class BlogFeedLauncher {
+
+ public static void main(String[] args) throws Exception {
+ SCAContribution feedContribution = locate("blog-feed");
+
+ SCANode node = SCANodeFactory.newInstance().createSCANode("blog-feed.composite", feedContribution);
+ node.start();
+
+ System.out.println("Node started - Press enter to shutdown.");
+ System.out.println();
+ System.out.println("To view the blog feed, use your Web browser to view:");
+ System.out.println(" Feeds using Tuscany Data APIs");
+ System.out.println(" http://localhost:8090/BlogAtom");
+ System.out.println(" http://localhost:8090/BlogRSS");
+ System.out.println(" Feeds using Atom APIs");
+ System.out.println(" http://localhost:8090/BlogAtomAPIs");
+ System.out.println(" Feeds using RSS APIs");
+ System.out.println(" http://localhost:8090/BlogRSSAPIs");
+ System.out.println();
+ System.in.read();
+ node.stop();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/build.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/build.xml new file mode 100644 index 0000000000..2f934ad32e --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/build.xml @@ -0,0 +1,79 @@ +<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<project name="scatours-launchers" default="compile">
+
+ <target name="compile">
+ <antcall target="allsubdirs">
+ <param name="target" value="compile"/>
+ </antcall>
+ </target>
+
+ <target name="test">
+ <antcall target="allsubdirs">
+ <param name="target" value="test"/>
+ </antcall>
+ </target>
+
+ <target name="clean">
+ <antcall target="allsubdirs">
+ <param name="target" value="clean"/>
+ </antcall>
+ </target>
+
+ <target name="allsubdirs">
+ <ant dir="blog-feed" target="${target}"/>
+ <ant dir="buildingblocks" target="${target}"/>
+ <ant dir="currency-converter" target="${target}"/>
+ <ant dir="currency-converter-corba" target="${target}"/>
+ <ant dir="currency-converter-jms" target="${target}"/>
+ <ant dir="currency-converter-rmi" target="${target}"/>
+ <ant dir="currency-converter-ws" target="${target}"/>
+ <ant dir="databinding" target="${target}"/>
+ <ant dir="feed-logger" target="${target}"/>
+ <ant dir="fullapp" target="${target}"/>
+ <ant dir="fullapp-domain" target="${target}"/>
+ <ant dir="fullapp-nodes" target="${target}"/>
+ <ant dir="help-pages" target="${target}"/>
+ <ant dir="interaction" target="${target}"/>
+ <ant dir="introducing" target="${target}"/>
+ <ant dir="introducing-client" target="${target}"/>
+ <ant dir="introducing-domain" target="${target}"/>
+ <ant dir="introducing-tours" target="${target}"/>
+ <ant dir="introducing-trips" target="${target}"/>
+ <ant dir="jumpstart" target="${target}"/>
+ <ant dir="notification-corba" target="${target}"/>
+ <ant dir="notification-ejb" target="${target}"/>
+ <ant dir="notification-jms" target="${target}"/>
+ <ant dir="notification-rmi" target="${target}"/>
+ <ant dir="notification-ws" target="${target}"/>
+ <ant dir="payment-java" target="${target}"/>
+ <ant dir="payment-java-callback" target="${target}"/>
+ <ant dir="payment-java-policy" target="${target}"/>
+ <ant dir="payment-java-reference-pass" target="${target}"/>
+ <ant dir="payment-spring" target="${target}"/>
+ <ant dir="payment-spring-scatag" target="${target}"/>
+ <ant dir="payment-bpel" target="${target}"/>
+ <ant dir="payment-groovy" target="${target}"/>
+ <ant dir="payment-python" target="${target}"/>
+ <ant dir="policy" target="${target}"/>
+ <ant dir="using" target="${target}"/>
+ </target>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/buildingblocks/build.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/buildingblocks/build.xml new file mode 100644 index 0000000000..b61282f368 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/buildingblocks/build.xml @@ -0,0 +1,35 @@ +<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<project name="scatours-launcher-buildingblocks" default="compile">
+ <import file="../../antdefs.xml"/>
+ <path id="compile-path">
+ <pathelement path="../../util/launcher-common/target/scatours-util-launcher-common.jar"/>
+ </path>
+
+ <target name="run">
+ <java classname="scatours.BuildingBlocksLauncher" fork="true" failonerror="true">
+ <classpath>
+ <pathelement location="target/${ant.project.name}.jar"/>
+ <path refid="compile-path"/>
+ <pathelement location="${env.TUSCANY_HOME}/lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </java>
+ </target>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/buildingblocks/pom.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/buildingblocks/pom.xml new file mode 100644 index 0000000000..b43706c55e --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/buildingblocks/pom.xml @@ -0,0 +1,131 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent><version>1.0-SNAPSHOT</version>
+ <artifactId>scatours-launcher-buildingblocks</artifactId>
+ <name>Apache Tuscany SCA Tours Building Blocks Launcher</name>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-util-launcher-common</artifactId>
+ <version>${pom.version}</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node-api</artifactId>
+ <version>${tuscany.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>activemq-all</artifactId>
+ <version>5.2.0</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>activemq-web-demo</artifactId>
+ </exclusion>
+ </exclusions>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node-impl</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-axis2</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-jetty</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-jms-runtime</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-jms-asf</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.5</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <version>2.2</version>
+ <configuration>
+ <archive>
+ <manifestEntries>
+ <Class-Path>../util/scatours-util-launcher-common.jar</Class-Path>
+ </manifestEntries>
+ <manifest>
+ <addClasspath>${scatours.selfContained}</addClasspath>
+ <classpathPrefix>../lib/</classpathPrefix>
+ <mainClass>scatours.BuildingBlocksLauncher</mainClass>
+ </manifest>
+ </archive>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/buildingblocks/src/main/java/scatours/BuildingBlocksLauncher.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/buildingblocks/src/main/java/scatours/BuildingBlocksLauncher.java new file mode 100644 index 0000000000..741b502cf3 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/buildingblocks/src/main/java/scatours/BuildingBlocksLauncher.java @@ -0,0 +1,84 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package scatours;
+
+import org.apache.tuscany.sca.node.SCAClient;
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.SCANodeFactory;
+
+import static scatours.launcher.LauncherUtil.locate;
+
+public class BuildingBlocksLauncher {
+
+ public static void main(String[] args) throws Exception {
+ runImpl();
+ runImplInclude();
+ runAppl();
+ }
+
+ private static void runImpl() throws Exception {
+ SCANode node =
+ SCANodeFactory.newInstance().createSCANode("tours-impl-client.composite",
+ locate("buildingblocks"),
+ locate("buildingblocks-client"));
+
+ node.start();
+
+ Runnable client = ((SCAClient)node).getService(Runnable.class, "ToursClient/Runnable");
+ client.run();
+
+ node.stop();
+ }
+
+ private static void runImplInclude() throws Exception {
+ SCANode node =
+ SCANodeFactory.newInstance().createSCANode("tours-impl-include-client.composite",
+ locate("introducing-trips"),
+ locate("buildingblocks"),
+ locate("buildingblocks-client"));
+
+ node.start();
+
+ Runnable client = ((SCAClient)node).getService(Runnable.class, "ToursClient/Runnable");
+ client.run();
+
+ node.stop();
+ }
+
+ private static void runAppl() throws Exception {
+ SCANode node1 =
+ SCANodeFactory.newInstance().createSCANode("tours-appl.composite",
+ locate("introducing-trips"),
+ locate("buildingblocks"));
+
+ SCANode node2 =
+ SCANodeFactory.newInstance().createSCANode("tours-appl-client.composite",
+ locate("buildingblocks-client"));
+
+ node1.start();
+ node2.start();
+
+ Runnable client = ((SCAClient)node2).getService(Runnable.class, "ApplClient/Runnable");
+ client.run();
+
+ node2.stop();
+ node1.stop();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/buildingblocks/src/main/resources/jndi.properties b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/buildingblocks/src/main/resources/jndi.properties new file mode 100644 index 0000000000..88270fd1e0 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/buildingblocks/src/main/resources/jndi.properties @@ -0,0 +1,39 @@ +## ---------------------------------------------------------------------------
+## Licensed to the Apache Software Foundation (ASF) under one or more
+## contributor license agreements. See the NOTICE file distributed with
+## this work for additional information regarding copyright ownership.
+## The ASF licenses this file to You under the Apache License, Version 2.0
+## (the "License"); you may not use this file except in compliance with
+## the License. You may obtain a copy of the License at
+##
+## http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing, software
+## distributed under the License is distributed on an "AS IS" BASIS,
+## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+## See the License for the specific language governing permissions and
+## limitations under the License.
+## ---------------------------------------------------------------------------
+
+# START SNIPPET: jndi
+
+java.naming.factory.initial = org.apache.activemq.jndi.ActiveMQInitialContextFactory
+
+# use the following property to configure the default connector
+java.naming.provider.url = vm://localhost?broker.persistent=false
+
+# use the following property to specify the JNDI name the connection factory
+# should appear as.
+#connectionFactoryNames = connectionFactory, queueConnectionFactory, topicConnectionFactry
+connectionFactoryNames = ConnectionFactory
+
+# register some queues in JNDI using the form
+# queue.[jndiName] = [physicalName]
+queue.BookTrip = BookTripRequestQueue
+queue.Checkout = CheckoutRequestQueue
+
+# register some topics in JNDI using the form
+# topic.[jndiName] = [physicalName]
+#topic.MyTopic = example.MyTopic
+
+# END SNIPPET: jndi
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/buildingblocks/src/test/java/scatours/BuildingBlocksTestCase.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/buildingblocks/src/test/java/scatours/BuildingBlocksTestCase.java new file mode 100644 index 0000000000..55943e2f45 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/buildingblocks/src/test/java/scatours/BuildingBlocksTestCase.java @@ -0,0 +1,42 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package scatours;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Tests the launcher
+ */
+public class BuildingBlocksTestCase {
+
+ @Before
+ public void startServer() throws Exception {
+ }
+
+ @Test
+ public void testLauncher() throws Exception {
+ BuildingBlocksLauncher.main(null);
+ }
+
+ @After
+ public void stopServer() throws Exception {
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/currency-converter-corba/build.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/currency-converter-corba/build.xml new file mode 100644 index 0000000000..c5f32d4588 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/currency-converter-corba/build.xml @@ -0,0 +1,42 @@ +<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<project name="scatours-launcher-currency-converter-corba" default="compile">
+ <import file="../../antdefs.xml"/>
+ <path id="compile-path">
+ <pathelement path="../../util/launcher-common/target/scatours-util-launcher-common.jar"/>
+ </path>
+
+ <!-- After starting the SCA CORBA service by invoking the "run" target below,
+ the CORBA Java implementation of the currency converter client should be
+ run in another process using the "run-client" target. -->
+ <target name="run-client">
+ <ant dir="../../clients/currency-converter-corba" target="run"/>
+ </target>
+
+ <target name="run">
+ <java classname="scatours.CurrencyConverterCORBALauncher" fork="true" failonerror="true">
+ <classpath>
+ <pathelement location="target/${ant.project.name}.jar"/>
+ <path refid="compile-path"/>
+ <pathelement location="${env.TUSCANY_HOME}/lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </java>
+ </target>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/currency-converter-corba/pom.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/currency-converter-corba/pom.xml new file mode 100644 index 0000000000..3f48c97f2a --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/currency-converter-corba/pom.xml @@ -0,0 +1,97 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent><version>1.0-SNAPSHOT</version>
+ <artifactId>scatours-launcher-currency-converter-corba</artifactId>
+ <name>Apache Tuscany SCA Tours Currency Converter CORBA Launcher</name>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-util-launcher-common</artifactId>
+ <version>${pom.version}</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node-api</artifactId>
+ <version>${tuscany.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node-impl</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-corba-runtime</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-corba-jse-tns</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <version>2.2</version>
+ <configuration>
+ <archive>
+ <manifestEntries>
+ <Class-Path>../util/scatours-util-launcher-common.jar</Class-Path>
+ </manifestEntries>
+ <manifest>
+ <addClasspath>${scatours.selfContained}</addClasspath>
+ <classpathPrefix>../lib/</classpathPrefix>
+ <mainClass>scatours.CurrencyConverterCORBALauncher</mainClass>
+ </manifest>
+ </archive>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/currency-converter-corba/src/main/java/scatours/CurrencyConverterCORBALauncher.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/currency-converter-corba/src/main/java/scatours/CurrencyConverterCORBALauncher.java new file mode 100644 index 0000000000..0f9d0eca80 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/currency-converter-corba/src/main/java/scatours/CurrencyConverterCORBALauncher.java @@ -0,0 +1,52 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package scatours;
+
+import static scatours.launcher.LauncherUtil.locate;
+
+import org.apache.tuscany.sca.node.SCAClient;
+import org.apache.tuscany.sca.node.SCAContribution;
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.SCANodeFactory;
+
+import scatours.currencyconverter.CurrencyConverter;
+
+public class CurrencyConverterCORBALauncher {
+
+ public static void main(String[] args) throws Exception {
+ SCAContribution currencyCORBAContribution = locate("currency-corba");
+ SCAContribution currencyContribution = locate("currency");
+
+ SCANode node =
+ SCANodeFactory.newInstance().createSCANode("currency-converter-corba.composite",
+ currencyContribution,
+ currencyCORBAContribution);
+ node.start();
+
+ System.out.println("Quick currency converter test");
+ CurrencyConverter converter = ((SCAClient)node).getService(CurrencyConverter.class, "CurrencyConverter");
+ System.out.println("USD -> GBP = " + converter.getExchangeRate("USD", "GBP"));
+ System.out.println("100 USD = " + converter.convert("USD", "GBP", 100) + "GBP");
+
+ System.out.println("Node started - Press enter to shutdown.");
+ System.in.read();
+ node.stop();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/currency-converter-corba/src/main/java/scatours/currencyconverter/CurrencyConverter.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/currency-converter-corba/src/main/java/scatours/currencyconverter/CurrencyConverter.java new file mode 100644 index 0000000000..fe5c98bf02 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/currency-converter-corba/src/main/java/scatours/currencyconverter/CurrencyConverter.java @@ -0,0 +1,33 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package scatours.currencyconverter;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * The CurrencyConverter service interface
+ */
+@Remotable
+public interface CurrencyConverter {
+
+ double getExchangeRate(String fromCurrencyCode, String toCurrencyCode);
+
+ double convert(String fromCurrencyCode, String toCurrencyCode, double amount);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/currency-converter-jms/build.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/currency-converter-jms/build.xml new file mode 100644 index 0000000000..3ccf56b2c8 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/currency-converter-jms/build.xml @@ -0,0 +1,42 @@ +<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<project name="scatours-launcher-currency-converter-jms" default="compile">
+ <import file="../../antdefs.xml"/>
+ <path id="compile-path">
+ <pathelement path="../../util/launcher-common/target/scatours-util-launcher-common.jar"/>
+ </path>
+
+ <!-- After starting the SCA JMS service by invoking the "run" target below,
+ the ActiveMQ JMS implementation of the currency converter client should be
+ run in another process using the "run-client" target. -->
+ <target name="run-client">
+ <ant dir="../../clients/currency-converter-jms" target="run"/>
+ </target>
+
+ <target name="run">
+ <java classname="scatours.CurrencyConverterJMSLauncher" fork="true" failonerror="true">
+ <classpath>
+ <pathelement location="target/${ant.project.name}.jar"/>
+ <path refid="compile-path"/>
+ <pathelement location="${env.TUSCANY_HOME}/lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </java>
+ </target>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/currency-converter-jms/pom.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/currency-converter-jms/pom.xml new file mode 100644 index 0000000000..db54525784 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/currency-converter-jms/pom.xml @@ -0,0 +1,109 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent><version>1.0-SNAPSHOT</version>
+ <artifactId>scatours-launcher-currency-converter-jms</artifactId>
+ <name>Apache Tuscany SCA Tours Currency Converter JMS Launcher</name>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-util-launcher-common</artifactId>
+ <version>${pom.version}</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node-api</artifactId>
+ <version>${tuscany.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node-impl</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-jms-runtime</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-jms-asf</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>activemq-all</artifactId>
+ <version>5.2.0</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>activemq-web-demo</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <version>2.2</version>
+ <configuration>
+ <archive>
+ <manifestEntries>
+ <Class-Path>../util/scatours-util-launcher-common.jar</Class-Path>
+ </manifestEntries>
+ <manifest>
+ <addClasspath>${scatours.selfContained}</addClasspath>
+ <classpathPrefix>../lib/</classpathPrefix>
+ <mainClass>scatours.CurrencyConverterJMSLauncher</mainClass>
+ </manifest>
+ </archive>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/currency-converter-jms/src/main/java/scatours/CurrencyConverterJMSLauncher.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/currency-converter-jms/src/main/java/scatours/CurrencyConverterJMSLauncher.java new file mode 100644 index 0000000000..6da4e7e162 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/currency-converter-jms/src/main/java/scatours/CurrencyConverterJMSLauncher.java @@ -0,0 +1,53 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package scatours;
+
+import static scatours.launcher.LauncherUtil.locate;
+
+import org.apache.activemq.broker.BrokerService;
+import org.apache.tuscany.sca.node.SCAContribution;
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.SCANodeFactory;
+
+public class CurrencyConverterJMSLauncher {
+
+ public static void main(String[] args) throws Exception {
+ final BrokerService jmsBroker = new BrokerService();
+ jmsBroker.setPersistent(false);
+ jmsBroker.setUseJmx(false);
+ jmsBroker.addConnector("tcp://localhost:61619");
+ jmsBroker.start();
+
+ SCAContribution currencyJMSContribution = locate("currency-jms");
+ SCAContribution currencyContribution = locate("currency");
+
+ SCANode node =
+ SCANodeFactory.newInstance().createSCANode("currency-converter-jms.composite",
+ currencyContribution,
+ currencyJMSContribution);
+ node.start();
+
+ System.out.println("Node started - Press enter to shutdown.");
+ System.in.read();
+
+ node.stop();
+ jmsBroker.stop();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/currency-converter-rmi/build.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/currency-converter-rmi/build.xml new file mode 100644 index 0000000000..8990723c63 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/currency-converter-rmi/build.xml @@ -0,0 +1,42 @@ +<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<project name="scatours-launcher-currency-converter-rmi" default="compile">
+ <import file="../../antdefs.xml"/>
+ <path id="compile-path">
+ <pathelement path="../../util/launcher-common/target/scatours-util-launcher-common.jar"/>
+ </path>
+
+ <!-- After starting the SCA RMI service by invoking the "run" target below,
+ the RMI Java implementation of the currency converter client should be
+ run in another process using the "run-client" target. -->
+ <target name="run-client">
+ <ant dir="../../clients/currency-converter-rmi" target="run"/>
+ </target>
+
+ <target name="run">
+ <java classname="scatours.CurrencyConverterRMILauncher" fork="true" failonerror="true">
+ <classpath>
+ <pathelement location="target/${ant.project.name}.jar"/>
+ <path refid="compile-path"/>
+ <pathelement location="${env.TUSCANY_HOME}/lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </java>
+ </target>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/currency-converter-rmi/pom.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/currency-converter-rmi/pom.xml new file mode 100644 index 0000000000..14e4a77e3d --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/currency-converter-rmi/pom.xml @@ -0,0 +1,104 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent><version>1.0-SNAPSHOT</version>
+ <artifactId>scatours-launcher-currency-converter-rmi</artifactId>
+ <name>Apache Tuscany SCA Tours Currency Converter RMI Launcher</name>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-util-launcher-common</artifactId>
+ <version>${pom.version}</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node-api</artifactId>
+ <version>${tuscany.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node-impl</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-rmi</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-rmi-runtime</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-rmi</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <version>2.2</version>
+ <configuration>
+ <archive>
+ <manifestEntries>
+ <Class-Path>../util/scatours-util-launcher-common.jar</Class-Path>
+ </manifestEntries>
+ <manifest>
+ <addClasspath>${scatours.selfContained}</addClasspath>
+ <classpathPrefix>../lib/</classpathPrefix>
+ <mainClass>scatours.CurrencyConverterRMILauncher</mainClass>
+ </manifest>
+ </archive>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/currency-converter-rmi/src/main/java/com/tuscanyscatours/currencyconverter/CurrencyConverter.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/currency-converter-rmi/src/main/java/com/tuscanyscatours/currencyconverter/CurrencyConverter.java new file mode 100644 index 0000000000..b1f783bfba --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/currency-converter-rmi/src/main/java/com/tuscanyscatours/currencyconverter/CurrencyConverter.java @@ -0,0 +1,33 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package com.tuscanyscatours.currencyconverter;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * The CurrencyConverter service interface
+ */
+@Remotable
+public interface CurrencyConverter {
+
+ double getExchangeRate(String fromCurrencyCode, String toCurrencyCode);
+
+ double convert(String fromCurrencyCode, String toCurrencyCode, double amount);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/currency-converter-rmi/src/main/java/scatours/CurrencyConverterRMILauncher.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/currency-converter-rmi/src/main/java/scatours/CurrencyConverterRMILauncher.java new file mode 100644 index 0000000000..81d9e19c60 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/currency-converter-rmi/src/main/java/scatours/CurrencyConverterRMILauncher.java @@ -0,0 +1,56 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package scatours;
+
+import static scatours.launcher.LauncherUtil.locate;
+
+import org.apache.tuscany.sca.node.SCAClient;
+import org.apache.tuscany.sca.node.SCAContribution;
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.SCANodeFactory;
+
+import com.tuscanyscatours.currencyconverter.CurrencyConverter;
+
+public class CurrencyConverterRMILauncher {
+
+ public static void main(String[] args) throws Exception {
+ SCAContribution currencyRMIContribution = locate("currency-rmi");
+ SCAContribution currencyContribution = locate("currency");
+
+ SCANode node =
+ SCANodeFactory.newInstance().createSCANode("currency-converter-rmi.composite",
+ currencyContribution,
+ currencyRMIContribution);
+ node.start();
+
+ System.out.println("Quick currency converter test");
+ CurrencyConverter converter = ((SCAClient)node).getService(CurrencyConverter.class, "CurrencyConverter");
+ System.out.println("USD -> GBP = " + converter.getExchangeRate("USD", "GBP"));
+ System.out.println("100 USD = " + converter.convert("USD", "GBP", 100) + "GBP");
+
+ System.out.println("Node started - Press enter to shutdown.");
+ System.in.read();
+ node.stop();
+
+ // The following line is a workaround for TUSCANY-3277 when running
+ // on Tuscany SCA 1.6 (the JVM hangs when exiting).
+ System.exit(0);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/currency-converter-ws/build.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/currency-converter-ws/build.xml new file mode 100644 index 0000000000..2fd3663bab --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/currency-converter-ws/build.xml @@ -0,0 +1,42 @@ +<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<project name="scatours-launcher-currency-converter-ws" default="compile">
+ <import file="../../antdefs.xml"/>
+ <path id="compile-path">
+ <pathelement path="../../util/launcher-common/target/scatours-util-launcher-common.jar"/>
+ </path>
+
+ <!-- After starting the SCA Web service by invoking the "run" target below,
+ the JAX-WS implementation of the currency converter client should be
+ run in another process using the "run-client" target. -->
+ <target name="run-client">
+ <ant dir="../../clients/currency-converter-ws-jaxws" target="run"/>
+ </target>
+
+ <target name="run">
+ <java classname="scatours.CurrencyConverterWSLauncher" fork="true" failonerror="true">
+ <classpath>
+ <pathelement location="target/${ant.project.name}.jar"/>
+ <path refid="compile-path"/>
+ <pathelement location="${env.TUSCANY_HOME}/lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </java>
+ </target>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/currency-converter-ws/pom.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/currency-converter-ws/pom.xml new file mode 100644 index 0000000000..bddb75987a --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/currency-converter-ws/pom.xml @@ -0,0 +1,98 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <version>1.0-SNAPSHOT</version>
+ <artifactId>scatours-launcher-currency-converter-ws</artifactId>
+ <name>Apache Tuscany SCA Tours Currency Converter Web Service Launcher</name>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-util-launcher-common</artifactId>
+ <version>${pom.version}</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node-api</artifactId>
+ <version>${tuscany.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node-impl</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-axis2</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-tomcat</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <version>2.2</version>
+ <configuration>
+ <archive>
+ <manifestEntries>
+ <Class-Path>../util/scatours-util-launcher-common.jar</Class-Path>
+ </manifestEntries>
+ <manifest>
+ <addClasspath>${scatours.selfContained}</addClasspath>
+ <classpathPrefix>../lib/</classpathPrefix>
+ <mainClass>scatours.CurrencyConverterWSLauncher</mainClass>
+ </manifest>
+ </archive>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/currency-converter-ws/src/main/java/scatours/CurrencyConverterWSLauncher.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/currency-converter-ws/src/main/java/scatours/CurrencyConverterWSLauncher.java new file mode 100644 index 0000000000..2425d3f483 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/currency-converter-ws/src/main/java/scatours/CurrencyConverterWSLauncher.java @@ -0,0 +1,53 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package scatours;
+
+import static scatours.launcher.LauncherUtil.locate;
+
+import org.apache.tuscany.sca.node.SCAClient;
+import org.apache.tuscany.sca.node.SCAContribution;
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.SCANodeFactory;
+
+import scatours.currencyconverter.CurrencyConverter;
+
+public class CurrencyConverterWSLauncher {
+
+ public static void main(String[] args) throws Exception {
+ SCAContribution currencyWSContribution = locate("currency-ws");
+ SCAContribution currencyContribution = locate("currency");
+
+ SCANode node =
+ SCANodeFactory.newInstance().createSCANode("currency-converter-ws.composite",
+ currencyContribution,
+ currencyWSContribution);
+ node.start();
+
+ System.out.println("Quick currency converter test");
+ CurrencyConverter converter = ((SCAClient)node).getService(CurrencyConverter.class, "CurrencyConverter");
+ System.out.println("USD -> GBP = " + converter.getExchangeRate("USD", "GBP"));
+ System.out.println("100 USD = " + converter.convert("USD", "GBP", 100) + "GBP");
+
+ System.out.println("Node started - Press enter to shutdown.");
+ System.in.read();
+
+ node.stop();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/currency-converter-ws/src/main/java/scatours/currencyconverter/CurrencyConverter.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/currency-converter-ws/src/main/java/scatours/currencyconverter/CurrencyConverter.java new file mode 100644 index 0000000000..fe5c98bf02 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/currency-converter-ws/src/main/java/scatours/currencyconverter/CurrencyConverter.java @@ -0,0 +1,33 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package scatours.currencyconverter;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * The CurrencyConverter service interface
+ */
+@Remotable
+public interface CurrencyConverter {
+
+ double getExchangeRate(String fromCurrencyCode, String toCurrencyCode);
+
+ double convert(String fromCurrencyCode, String toCurrencyCode, double amount);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/currency-converter/build.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/currency-converter/build.xml new file mode 100644 index 0000000000..2cd41af723 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/currency-converter/build.xml @@ -0,0 +1,35 @@ +<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<project name="scatours-launcher-currency-converter" default="compile">
+ <import file="../../antdefs.xml"/>
+ <path id="compile-path">
+ <pathelement path="../../util/launcher-common/target/scatours-util-launcher-common.jar"/>
+ </path>
+
+ <target name="run">
+ <java classname="scatours.CurrencyConverterLauncher" fork="true" failonerror="true">
+ <classpath>
+ <pathelement location="target/${ant.project.name}.jar"/>
+ <path refid="compile-path"/>
+ <pathelement location="${env.TUSCANY_HOME}/lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </java>
+ </target>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/currency-converter/pom.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/currency-converter/pom.xml new file mode 100644 index 0000000000..20cbc7dbff --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/currency-converter/pom.xml @@ -0,0 +1,83 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent><version>1.0-SNAPSHOT</version>
+ <artifactId>scatours-launcher-currency-converter</artifactId>
+ <name>Apache Tuscany SCA Tours Currency Converter Launcher</name>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-util-launcher-common</artifactId>
+ <version>${pom.version}</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node-api</artifactId>
+ <version>${tuscany.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node-impl</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <version>2.2</version>
+ <configuration>
+ <archive>
+ <manifestEntries>
+ <Class-Path>../util/scatours-util-launcher-common.jar</Class-Path>
+ </manifestEntries>
+ <manifest>
+ <addClasspath>${scatours.selfContained}</addClasspath>
+ <classpathPrefix>../lib/</classpathPrefix>
+ <mainClass>scatours.CurrencyConverterLauncher</mainClass>
+ </manifest>
+ </archive>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/currency-converter/src/main/java/scatours/CurrencyConverterLauncher.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/currency-converter/src/main/java/scatours/CurrencyConverterLauncher.java new file mode 100644 index 0000000000..cacd579b3b --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/currency-converter/src/main/java/scatours/CurrencyConverterLauncher.java @@ -0,0 +1,48 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package scatours;
+
+import static scatours.launcher.LauncherUtil.locate;
+
+import org.apache.tuscany.sca.node.SCAClient;
+import org.apache.tuscany.sca.node.SCAContribution;
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.SCANodeFactory;
+
+import scatours.currencyconverter.CurrencyConverter;
+
+public class CurrencyConverterLauncher {
+
+ public static void main(String[] args) throws Exception {
+ SCAContribution currencyContribution = locate("currency");
+
+ SCANode node = SCANodeFactory.newInstance().createSCANode("currency-converter.composite", currencyContribution);
+ node.start();
+
+ System.out.println("Quick currency converter test");
+ CurrencyConverter converter = ((SCAClient)node).getService(CurrencyConverter.class, "CurrencyConverter");
+ System.out.println("USD -> GBP = " + converter.getExchangeRate("USD", "GBP"));
+ System.out.println("100 USD = " + converter.convert("USD", "GBP", 100) + "GBP");
+
+ System.out.println("Node started - Press enter to shutdown.");
+ System.in.read();
+ node.stop();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/currency-converter/src/main/java/scatours/currencyconverter/CurrencyConverter.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/currency-converter/src/main/java/scatours/currencyconverter/CurrencyConverter.java new file mode 100644 index 0000000000..fe5c98bf02 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/currency-converter/src/main/java/scatours/currencyconverter/CurrencyConverter.java @@ -0,0 +1,33 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package scatours.currencyconverter;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * The CurrencyConverter service interface
+ */
+@Remotable
+public interface CurrencyConverter {
+
+ double getExchangeRate(String fromCurrencyCode, String toCurrencyCode);
+
+ double convert(String fromCurrencyCode, String toCurrencyCode, double amount);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/databinding/build.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/databinding/build.xml new file mode 100644 index 0000000000..dc099ea479 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/databinding/build.xml @@ -0,0 +1,35 @@ +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> + +<project name="scatours-launcher-databinding" default="compile"> + <import file="../../antdefs.xml"/> + <path id="compile-path"> + <pathelement path="../../util/launcher-common/target/scatours-util-launcher-common.jar"/> + </path> + + <target name="run"> + <java classname="scatours.DatabindingLauncher" fork="true" failonerror="true"> + <classpath> + <pathelement location="target/${ant.project.name}.jar"/> + <path refid="compile-path"/> + <pathelement location="${env.TUSCANY_HOME}/lib/tuscany-sca-manifest.jar"/> + </classpath> + </java> + </target> +</project> diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/databinding/pom.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/databinding/pom.xml new file mode 100644 index 0000000000..7fef1796f7 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/databinding/pom.xml @@ -0,0 +1,169 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<project> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>scatours</artifactId> + <version>1.0-SNAPSHOT</version> + <relativePath>../../pom.xml</relativePath> + </parent> + <version>1.0-SNAPSHOT</version> + <artifactId>scatours-launcher-databinding</artifactId> + <name>Apache Tuscany SCA Tours Databinding Launcher</name> + + <dependencies> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>scatours-util-launcher-common</artifactId> + <version>${pom.version}</version> + <scope>provided</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-node-api</artifactId> + <version>${tuscany.version}</version> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-node-impl</artifactId> + <version>${tuscany.version}</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-implementation-java-runtime</artifactId> + <version>${tuscany.version}</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-implementation-widget-runtime</artifactId> + <version>${tuscany.version}</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-implementation-resource-runtime</artifactId> + <version>${tuscany.version}</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-binding-atom-abdera</artifactId> + <version>${tuscany.version}</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-binding-jsonrpc-runtime</artifactId> + <version>${tuscany.version}</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-binding-http-runtime</artifactId> + <version>${tuscany.version}</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-binding-ws-axis2</artifactId> + <version>${tuscany.version}</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-binding-sca-axis2</artifactId> + <version>${tuscany.version}</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-binding-ejb-runtime</artifactId> + <version>${tuscany.version}</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-implementation-ejb</artifactId> + <version>${tuscany.version}</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-implementation-bpel-ode</artifactId> + <version>${tuscany.version}</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-host-jetty</artifactId> + <version>${tuscany.version}</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.derby</groupId> + <artifactId>derby</artifactId> + <version>10.3.1.4</version> + <scope>runtime</scope> + </dependency> + + </dependencies> + + <build> + <finalName>${artifactId}</finalName> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-jar-plugin</artifactId> + <version>2.2</version> + <configuration> + <archive> + <manifestEntries> + <Class-Path>../util/scatours-util-launcher-common.jar</Class-Path> + </manifestEntries> + <manifest> + <addClasspath>${scatours.selfContained}</addClasspath> + <classpathPrefix>../lib/</classpathPrefix> + <mainClass>scatours.DatabindingLauncher</mainClass> + </manifest> + </archive> + </configuration> + </plugin> + </plugins> + </build> +</project> diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/databinding/src/main/java/scatours/DatabindingLauncher.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/databinding/src/main/java/scatours/DatabindingLauncher.java new file mode 100644 index 0000000000..6271c60d53 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/databinding/src/main/java/scatours/DatabindingLauncher.java @@ -0,0 +1,45 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package scatours; + +import static scatours.launcher.LauncherUtil.locate; + +import org.apache.tuscany.sca.node.SCAClient; +import org.apache.tuscany.sca.node.SCANode; +import org.apache.tuscany.sca.node.SCANodeFactory; + +public class DatabindingLauncher { + public static void main(String[] args) throws Exception { + SCANode node1 = SCANodeFactory.newInstance().createSCANode(null, + locate("payment-java"), + locate("databinding-client")); + + SCANode node2 = SCANodeFactory.newInstance().createSCANode(null, locate("creditcard-payment-sdo")); + + node1.start(); + node2.start(); + + Runnable runner = ((SCAClient)node1).getService(Runnable.class, "TestClient/Runnable"); + runner.run(); + + node1.stop(); + node2.stop(); + } +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/feed-logger/build.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/feed-logger/build.xml new file mode 100644 index 0000000000..826c542cdb --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/feed-logger/build.xml @@ -0,0 +1,35 @@ +<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<project name="scatours-launcher-feed-logger" default="compile">
+ <import file="../../antdefs.xml"/>
+ <path id="compile-path">
+ <pathelement path="../../util/launcher-common/target/scatours-util-launcher-common.jar"/>
+ </path>
+
+ <target name="run">
+ <java classname="scatours.FeedLoggerLauncher" fork="true" failonerror="true">
+ <classpath>
+ <pathelement location="target/${ant.project.name}.jar"/>
+ <path refid="compile-path"/>
+ <pathelement location="${env.TUSCANY_HOME}/lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </java>
+ </target>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/feed-logger/pom.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/feed-logger/pom.xml new file mode 100644 index 0000000000..fb5a788652 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/feed-logger/pom.xml @@ -0,0 +1,105 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <version>1.0-SNAPSHOT</version>
+ <artifactId>scatours-launcher-feed-logger</artifactId>
+ <name>Apache Tuscany SCA Tours Feed Logger Launcher</name>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-util-launcher-common</artifactId>
+ <version>${pom.version}</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node-api</artifactId>
+ <version>${tuscany.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node-impl</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-tomcat</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-atom-abdera</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-rss-rome</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <version>2.2</version>
+ <configuration>
+ <archive>
+ <manifestEntries>
+ <Class-Path>../util/scatours-util-launcher-common.jar</Class-Path>
+ </manifestEntries>
+ <manifest>
+ <addClasspath>${scatours.selfContained}</addClasspath>
+ <classpathPrefix>../lib/</classpathPrefix>
+ <mainClass>scatours.FeedLoggerLauncher</mainClass>
+ </manifest>
+ </archive>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/feed-logger/src/main/java/scatours/FeedLoggerLauncher.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/feed-logger/src/main/java/scatours/FeedLoggerLauncher.java new file mode 100644 index 0000000000..4aea24dbfe --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/feed-logger/src/main/java/scatours/FeedLoggerLauncher.java @@ -0,0 +1,44 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package scatours;
+
+import static scatours.launcher.LauncherUtil.locate;
+
+import org.apache.tuscany.sca.node.SCAClient;
+import org.apache.tuscany.sca.node.SCAContribution;
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.SCANodeFactory;
+
+import scatours.feedlogger.FeedLogger;
+
+public class FeedLoggerLauncher {
+
+ public static void main(String[] args) throws Exception {
+ SCAContribution feedContribution = locate("feed-logger");
+
+ SCANode node = SCANodeFactory.newInstance().createSCANode("feed-logger.composite", feedContribution);
+ node.start();
+
+ FeedLogger logger = ((SCAClient)node).getService(FeedLogger.class, "FeedLogger");
+ logger.logFeeds(5);
+
+ node.stop();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/feed-logger/src/main/java/scatours/feedlogger/FeedLogger.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/feed-logger/src/main/java/scatours/feedlogger/FeedLogger.java new file mode 100644 index 0000000000..8187e34d2c --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/feed-logger/src/main/java/scatours/feedlogger/FeedLogger.java @@ -0,0 +1,30 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package scatours.feedlogger; + +public interface FeedLogger { + + /** + * Captures the configured feeds and logs the feed entries. + * + * @param maxEntriesPerFeed The maximum number of entries to log per feed + */ + public void logFeeds(int maxEntriesPerFeed); +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/fullapp-domain/build.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/fullapp-domain/build.xml new file mode 100644 index 0000000000..36de2a93e4 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/fullapp-domain/build.xml @@ -0,0 +1,38 @@ +<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<project name="scatours-launcher-fullapp-domain" default="run">
+ <import file="../../antdefs.xml"/>
+
+ <!-- The "run" target runs the DomainManagerLauncher class directly
+ (as if it had been invoked from a command line) and passes in the
+ domain configuration directory as a command-line argument. This
+ only works with Tuscany SCA Java version 1.6 and above. -->
+ <target name="run">
+ <java classname="org.apache.tuscany.sca.node.launcher.DomainManagerLauncher"
+ dir="." fork="true" failonerror="true">
+ <classpath>
+ <fileset dir="${env.TUSCANY_HOME}/modules">
+ <include name="tuscany-node-launcher-*.jar"/>
+ </fileset>
+ </classpath>
+ <arg value="../../domainconfig/fullapp/target/classes"/>
+ </java>
+ </target>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/fullapp-domain/pom.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/fullapp-domain/pom.xml new file mode 100644 index 0000000000..eb7604506d --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/fullapp-domain/pom.xml @@ -0,0 +1,86 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent><version>1.0-SNAPSHOT</version>
+ <artifactId>scatours-launcher-fullapp-domain</artifactId>
+ <name>Apache Tuscany SCA Tours Full App Domain Launcher</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node-api</artifactId>
+ <version>${tuscany.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-domain-manager</artifactId>
+ <version>${tuscany.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node-impl</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-jsonrpc</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-xml</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <version>2.2</version>
+ <configuration>
+ <archive>
+ <manifest>
+ <addClasspath>${scatours.selfContained}</addClasspath>
+ <classpathPrefix>../lib/</classpathPrefix>
+ <mainClass>scatours.FullAppDomainLauncher</mainClass>
+ </manifest>
+ </archive>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/fullapp-domain/src/main/java/scatours/FullAppDomainLauncher.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/fullapp-domain/src/main/java/scatours/FullAppDomainLauncher.java new file mode 100644 index 0000000000..324b68ab57 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/fullapp-domain/src/main/java/scatours/FullAppDomainLauncher.java @@ -0,0 +1,53 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package scatours; + +import java.io.IOException; + +import org.apache.tuscany.sca.domain.manager.launcher.DomainManagerLauncherBootstrap; +import org.apache.tuscany.sca.node.SCANode; + +/** + * This launcher is only used when running from the binaries directory. + * If the binaries directory was built using the mvn -Pselfcontained command, + * it's important to ensure that no dependencies other than those explicitly + * specified by the launcher jar manifest and its transitive dependencies + * are used. This launcher class must therefore avoid using the Tuscany + * DomainManagerLauncher class, because DomainManagerLauncher builds a + * runtime classpath from (among other things) the TUSCANY_HOME environment + * variable. + */ +public class FullAppDomainLauncher { + + public static void main(String[] args) throws Exception { + String rootDir = "../domainconfig/fullapp"; + DomainManagerLauncherBootstrap bootstrap = new DomainManagerLauncherBootstrap(rootDir); + SCANode node = bootstrap.getNode(); + node.start(); + + System.out.println("Domain manager started - Press enter to shutdown."); + try { + System.in.read(); + } catch (IOException e) { + } + + node.stop(); + } +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/fullapp-nodes/build.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/fullapp-nodes/build.xml new file mode 100644 index 0000000000..b147a2087a --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/fullapp-nodes/build.xml @@ -0,0 +1,37 @@ +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> + +<project name="scatours-launcher-fullapp-nodes" default="compile"> + <import file="../../antdefs.xml"/> + + <!-- Before invoking the "run" target, the domain manager needs + to be started and running in a different process. --> + <target name="run-domain"> + <ant dir="../fullapp-domain" target="run"/> + </target> + + <target name="run"> + <java classname="scatours.FullAppNodesLauncher" fork="true" failonerror="true"> + <classpath> + <pathelement location="target/${ant.project.name}.jar"/> + <pathelement location="${env.TUSCANY_HOME}/lib/tuscany-sca-manifest.jar"/> + </classpath> + </java> + </target> +</project> diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/fullapp-nodes/pom.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/fullapp-nodes/pom.xml new file mode 100644 index 0000000000..28f5e93074 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/fullapp-nodes/pom.xml @@ -0,0 +1,172 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<project> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>scatours</artifactId> + <version>1.0-SNAPSHOT</version> + <relativePath>../../pom.xml</relativePath> + </parent><version>1.0-SNAPSHOT</version> + <artifactId>scatours-launcher-fullapp-nodes</artifactId> + <name>Apache Tuscany SCA Tours Full Application Nodes Launcher</name> + + <dependencies> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-node-api</artifactId> + <version>${tuscany.version}</version> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-node-impl</artifactId> + <version>${tuscany.version}</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-implementation-java-runtime</artifactId> + <version>${tuscany.version}</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-implementation-widget-runtime-tuscany</artifactId> + <version>${tuscany.version}</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-binding-atom-abdera</artifactId> + <version>${tuscany.version}</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-binding-jsonrpc-js</artifactId> + <version>${tuscany.version}</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-binding-jsonrpc-runtime</artifactId> + <version>${tuscany.version}</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-binding-http-runtime</artifactId> + <version>${tuscany.version}</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-host-jetty</artifactId> + <version>${tuscany.version}</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-binding-ws-axis2</artifactId> + <version>${tuscany.version}</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-binding-sca-axis2</artifactId> + <version>${tuscany.version}</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-binding-ejb-runtime</artifactId> + <version>${tuscany.version}</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-implementation-ejb</artifactId> + <version>${tuscany.version}</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-implementation-bpel-ode</artifactId> + <version>${tuscany.version}</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-implementation-spring</artifactId> + <version>${tuscany.version}</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-implementation-spring-runtime</artifactId> + <version>${tuscany.version}</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.derby</groupId> + <artifactId>derby</artifactId> + <version>10.3.1.4</version> + <scope>runtime</scope> + </dependency> + + </dependencies> + + <build> + <finalName>${artifactId}</finalName> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-jar-plugin</artifactId> + <version>2.2</version> + <configuration> + <archive> + <manifest> + <addClasspath>${scatours.selfContained}</addClasspath> + <classpathPrefix>../lib/</classpathPrefix> + <mainClass>scatours.FullAppNodesLauncher</mainClass> + </manifest> + </archive> + </configuration> + </plugin> + </plugins> + </build> +</project> diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/fullapp-nodes/src/main/java/scatours/FullAppNodesLauncher.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/fullapp-nodes/src/main/java/scatours/FullAppNodesLauncher.java new file mode 100644 index 0000000000..4d6459b749 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/fullapp-nodes/src/main/java/scatours/FullAppNodesLauncher.java @@ -0,0 +1,78 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package scatours; + +import java.io.IOException; + +import org.apache.tuscany.sca.node.SCANode; +import org.apache.tuscany.sca.node.SCANodeFactory; + +public class FullAppNodesLauncher { + + public static void main(String[] args) throws Exception { + SCANode nodeCreditcard = + SCANodeFactory.newInstance().createSCANodeFromURL("http://localhost:9990/node-config/creditcard"); + nodeCreditcard.start(); + + SCANode nodePayment = + SCANodeFactory.newInstance().createSCANodeFromURL("http://localhost:9990/node-config/payment"); + nodePayment.start(); + + SCANode nodeShoppingcart = + SCANodeFactory.newInstance().createSCANodeFromURL("http://localhost:9990/node-config/shoppingcart"); + nodeShoppingcart.start(); + + SCANode nodeCurrency = + SCANodeFactory.newInstance().createSCANodeFromURL("http://localhost:9990/node-config/currency"); + nodeCurrency.start(); + + SCANode nodePackagedtrip = + SCANodeFactory.newInstance().createSCANodeFromURL("http://localhost:9990/node-config/packagedtrip"); + nodePackagedtrip.start(); + + SCANode nodeBespoketrip = + SCANodeFactory.newInstance().createSCANodeFromURL("http://localhost:9990/node-config/bespoketrip"); + nodeBespoketrip.start(); + + SCANode nodeFrontend = + SCANodeFactory.newInstance().createSCANodeFromURL("http://localhost:9990/node-config/coordination"); + nodeFrontend.start(); + + SCANode nodeUI = SCANodeFactory.newInstance().createSCANodeFromURL("http://localhost:9990/node-config/ui"); + nodeUI.start(); + + System.out.println("Point your browser at - http://localhost:8080/scatours/ "); + System.out.println("Nodes started - Press enter to shutdown."); + + try { + System.in.read(); + } catch (IOException e) { + } + + nodeCreditcard.stop(); + nodePayment.stop(); + nodeShoppingcart.stop(); + nodeCurrency.stop(); + nodePackagedtrip.stop(); + nodeBespoketrip.stop(); + nodeFrontend.stop(); + nodeUI.stop(); + } +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/fullapp/build.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/fullapp/build.xml new file mode 100644 index 0000000000..ab2f62460c --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/fullapp/build.xml @@ -0,0 +1,35 @@ +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> + +<project name="scatours-launcher-fullapp" default="compile"> + <import file="../../antdefs.xml"/> + <path id="compile-path"> + <pathelement path="../../util/launcher-common/target/scatours-util-launcher-common.jar"/> + </path> + + <target name="run"> + <java classname="scatours.FullAppLauncher" fork="true" failonerror="true"> + <classpath> + <pathelement location="target/${ant.project.name}.jar"/> + <path refid="compile-path"/> + <pathelement location="${env.TUSCANY_HOME}/lib/tuscany-sca-manifest.jar"/> + </classpath> + </java> + </target> +</project> diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/fullapp/pom.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/fullapp/pom.xml new file mode 100644 index 0000000000..70bef29299 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/fullapp/pom.xml @@ -0,0 +1,183 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<project> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>scatours</artifactId> + <version>1.0-SNAPSHOT</version> + <relativePath>../../pom.xml</relativePath> + </parent> + <version>1.0-SNAPSHOT</version> + <artifactId>scatours-launcher-fullapp</artifactId> + <name>Apache Tuscany SCA Tours Full Application Launcher</name> + + <dependencies> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>scatours-util-launcher-common</artifactId> + <version>${pom.version}</version> + <scope>provided</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-node-api</artifactId> + <version>${tuscany.version}</version> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-node-impl</artifactId> + <version>${tuscany.version}</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-implementation-java-runtime</artifactId> + <version>${tuscany.version}</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-implementation-widget-runtime-tuscany</artifactId> + <version>${tuscany.version}</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-binding-atom-abdera</artifactId> + <version>${tuscany.version}</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-binding-jsonrpc-js</artifactId> + <version>${tuscany.version}</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-binding-jsonrpc-runtime</artifactId> + <version>${tuscany.version}</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-binding-http-runtime</artifactId> + <version>${tuscany.version}</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-host-jetty</artifactId> + <version>${tuscany.version}</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-binding-ws-axis2</artifactId> + <version>${tuscany.version}</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-binding-sca-axis2</artifactId> + <version>${tuscany.version}</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-binding-ejb-runtime</artifactId> + <version>${tuscany.version}</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-implementation-ejb</artifactId> + <version>${tuscany.version}</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-implementation-bpel-ode</artifactId> + <version>${tuscany.version}</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-implementation-spring</artifactId> + <version>${tuscany.version}</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-implementation-spring-runtime</artifactId> + <version>${tuscany.version}</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.derby</groupId> + <artifactId>derby</artifactId> + <version>10.3.1.4</version> + <scope>runtime</scope> + </dependency> + + </dependencies> + + <build> + <finalName>${artifactId}</finalName> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-jar-plugin</artifactId> + <version>2.2</version> + <configuration> + <archive> + <manifestEntries> + <Class-Path>../util/scatours-util-launcher-common.jar</Class-Path> + </manifestEntries> + <manifest> + <addClasspath>${scatours.selfContained}</addClasspath> + <classpathPrefix>../lib/</classpathPrefix> + <mainClass>scatours.FullAppLauncher</mainClass> + </manifest> + </archive> + </configuration> + </plugin> + </plugins> + </build> +</project> diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/fullapp/src/main/java/scatours/FullAppLauncher.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/fullapp/src/main/java/scatours/FullAppLauncher.java new file mode 100644 index 0000000000..ab1b7d031b --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/fullapp/src/main/java/scatours/FullAppLauncher.java @@ -0,0 +1,66 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package scatours; + +import static scatours.launcher.LauncherUtil.locate; + +import java.io.IOException; + +import org.apache.tuscany.sca.node.SCANode; +import org.apache.tuscany.sca.node.SCANodeFactory; + +public class FullAppLauncher { + + public static void main(String[] args) throws Exception { + SCANode node = + SCANodeFactory.newInstance().createSCANode(null, + locate("common"), + locate("currency"), + locate("hotel"), + locate("flight"), + locate("car"), + locate("trip"), + locate("tripbooking"), + locate("travelcatalog"), + //locate("payment-java-policy"), + locate("payment-spring-policy"), + locate("creditcard-payment-jaxb-policy"), + locate("shoppingcart"), + locate("scatours"), + locate("fullapp-ui"), + locate("fullapp-coordination"), + locate("fullapp-currency"), + locate("fullapp-packagedtrip"), + locate("fullapp-bespoketrip"), + locate("fullapp-shoppingcart")); + + node.start(); + + System.out.println("Point your browser at - http://localhost:8080/scatours/ "); + System.out.println("Node started - Press enter to shutdown."); + + try { + System.in.read(); + } catch (IOException e) { + } + + node.stop(); + } +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/help-pages/build.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/help-pages/build.xml new file mode 100644 index 0000000000..a763c082e0 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/help-pages/build.xml @@ -0,0 +1,35 @@ +<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<project name="scatours-launcher-help-pages" default="compile">
+ <import file="../../antdefs.xml"/>
+ <path id="compile-path">
+ <pathelement path="../../util/launcher-common/target/scatours-util-launcher-common.jar"/>
+ </path>
+
+ <target name="run">
+ <java classname="scatours.HelpPagesLauncher" fork="true" failonerror="true">
+ <classpath>
+ <pathelement location="target/${ant.project.name}.jar"/>
+ <path refid="compile-path"/>
+ <pathelement location="${env.TUSCANY_HOME}/lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </java>
+ </target>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/help-pages/pom.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/help-pages/pom.xml new file mode 100644 index 0000000000..b26030fb77 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/help-pages/pom.xml @@ -0,0 +1,97 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent><version>1.0-SNAPSHOT</version>
+ <artifactId>scatours-launcher-help-pages</artifactId>
+ <name>Apache Tuscany SCA Tours Help Pages Launcher</name>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-util-launcher-common</artifactId>
+ <version>${pom.version}</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node-api</artifactId>
+ <version>${tuscany.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node-impl</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-resource-runtime</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-http-runtime</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-tomcat</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <version>2.2</version>
+ <configuration>
+ <archive>
+ <manifestEntries>
+ <Class-Path>../util/scatours-util-launcher-common.jar</Class-Path>
+ </manifestEntries>
+ <manifest>
+ <addClasspath>${scatours.selfContained}</addClasspath>
+ <classpathPrefix>../lib/</classpathPrefix>
+ <mainClass>scatours.HelpPagesLauncher</mainClass>
+ </manifest>
+ </archive>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/help-pages/src/main/java/scatours/HelpPagesLauncher.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/help-pages/src/main/java/scatours/HelpPagesLauncher.java new file mode 100644 index 0000000000..a72f5c4c54 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/help-pages/src/main/java/scatours/HelpPagesLauncher.java @@ -0,0 +1,44 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package scatours;
+
+import static scatours.launcher.LauncherUtil.locate;
+
+import org.apache.tuscany.sca.node.SCAContribution;
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.SCANodeFactory;
+
+public class HelpPagesLauncher {
+
+ public static void main(String[] args) throws Exception {
+ SCAContribution helpContribution = locate("help-pages");
+
+ SCANode node = SCANodeFactory.newInstance().createSCANode("help-pages.composite", helpContribution);
+ node.start();
+
+ System.out.println("Node started - Press enter to shutdown.");
+ System.out.println();
+ System.out.println("To view the help pages, use your Web browser to view:");
+ System.out.println(" http://localhost:8085/help/index.html");
+ System.out.println();
+ System.in.read();
+ node.stop();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/interaction/build.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/interaction/build.xml new file mode 100644 index 0000000000..8db09fe972 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/interaction/build.xml @@ -0,0 +1,35 @@ +<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<project name="scatours-launcher-interaction" default="compile">
+ <import file="../../antdefs.xml"/>
+ <path id="compile-path">
+ <pathelement path="../../util/launcher-common/target/scatours-util-launcher-common.jar"/>
+ </path>
+
+ <target name="run">
+ <java classname="scatours.InteractionLauncher" fork="true" failonerror="true">
+ <classpath>
+ <pathelement location="target/${ant.project.name}.jar"/>
+ <path refid="compile-path"/>
+ <pathelement location="${env.TUSCANY_HOME}/lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </java>
+ </target>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/interaction/pom.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/interaction/pom.xml new file mode 100644 index 0000000000..7e15913e53 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/interaction/pom.xml @@ -0,0 +1,104 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent><version>1.0-SNAPSHOT</version>
+ <artifactId>scatours-launcher-interaction</artifactId>
+ <name>Apache Tuscany SCA Tours Interaction Launcher</name>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-util-launcher-common</artifactId>
+ <version>${pom.version}</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node-api</artifactId>
+ <version>${tuscany.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node-impl</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-axis2</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-jetty</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.5</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <version>2.2</version>
+ <configuration>
+ <archive>
+ <manifestEntries>
+ <Class-Path>../util/scatours-util-launcher-common.jar</Class-Path>
+ </manifestEntries>
+ <manifest>
+ <addClasspath>${scatours.selfContained}</addClasspath>
+ <classpathPrefix>../lib/</classpathPrefix>
+ <mainClass>scatours.InteractionLauncher</mainClass>
+ </manifest>
+ </archive>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/interaction/src/main/java/scatours/InteractionLauncher.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/interaction/src/main/java/scatours/InteractionLauncher.java new file mode 100644 index 0000000000..b3e0e52f2e --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/interaction/src/main/java/scatours/InteractionLauncher.java @@ -0,0 +1,70 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package scatours;
+
+import static scatours.launcher.LauncherUtil.locate;
+
+import org.apache.tuscany.sca.node.SCAClient;
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.SCANodeFactory;
+
+public class InteractionLauncher {
+
+ public static void main(String[] args) throws Exception {
+ SCANode node1 =
+ SCANodeFactory.newInstance().createSCANode("client.composite",
+ locate("common"),
+ locate("currency"),
+ locate("calendar"),
+ locate("shoppingcart"),
+ locate("interaction-client"));
+
+ SCANode node2 =
+ SCANodeFactory.newInstance().createSCANode("service.composite",
+ locate("common"),
+ locate("hotel"),
+ locate("flight"),
+ locate("interaction-service-remote"));
+
+ node2.start();
+ node1.start();
+
+ Runnable localInteraction = ((SCAClient)node1).getService(Runnable.class, "InteractionLocalClient/Runnable");
+ localInteraction.run();
+
+ Runnable remoteInteraction = ((SCAClient)node1).getService(Runnable.class, "InteractionRemoteClient/Runnable");
+ remoteInteraction.run();
+
+ Runnable requestResponseInteraction =
+ ((SCAClient)node1).getService(Runnable.class, "InteractionRequestResponseClient/Runnable");
+ requestResponseInteraction.run();
+
+ Runnable onewayCallbackInteraction =
+ ((SCAClient)node1).getService(Runnable.class, "InteractionOneWayCallbackClient/Runnable");
+ onewayCallbackInteraction.run();
+
+ Runnable conversationalInteraction =
+ ((SCAClient)node1).getService(Runnable.class, "InteractionConversationClient/Runnable");
+ conversationalInteraction.run();
+
+ node1.stop();
+ node2.stop();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/interaction/src/test/java/scatours/InteractionTestCase.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/interaction/src/test/java/scatours/InteractionTestCase.java new file mode 100644 index 0000000000..c64e5d1e5b --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/interaction/src/test/java/scatours/InteractionTestCase.java @@ -0,0 +1,42 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package scatours;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Tests the launcher
+ */
+public class InteractionTestCase {
+
+ @Before
+ public void startServer() throws Exception {
+ }
+
+ @Test
+ public void testLauncher() throws Exception {
+ InteractionLauncher.main(null);
+ }
+
+ @After
+ public void stopServer() throws Exception {
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/introducing-client/build.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/introducing-client/build.xml new file mode 100644 index 0000000000..84b3ade200 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/introducing-client/build.xml @@ -0,0 +1,44 @@ +<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<project name="scatours-launcher-introducing-client" default="compile">
+ <import file="../../antdefs.xml"/>
+
+ <!-- Before invoking the "run" target, the domain manager and the
+ introducing-trips and introducing-tours nodes need to be started
+ and running in different processes. -->
+ <target name="run-domain">
+ <ant dir="../introducing-domain" target="run"/>
+ </target>
+ <target name="run-trips">
+ <ant dir="../introducing-trips" target="run"/>
+ </target>
+ <target name="run-tours">
+ <ant dir="../introducing-tours" target="run"/>
+ </target>
+
+ <target name="run">
+ <java classname="scatours.IntroducingClientLauncher" fork="true" failonerror="true">
+ <classpath>
+ <pathelement location="target/${ant.project.name}.jar"/>
+ <pathelement location="${env.TUSCANY_HOME}/lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </java>
+ </target>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/introducing-client/pom.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/introducing-client/pom.xml new file mode 100644 index 0000000000..7385505063 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/introducing-client/pom.xml @@ -0,0 +1,90 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent><version>1.0-SNAPSHOT</version>
+ <artifactId>scatours-launcher-introducing-client</artifactId>
+ <name>Apache Tuscany SCA Tours Introducing Client Launcher</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node-api</artifactId>
+ <version>${tuscany.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node-impl</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-sca-axis2</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <!-- The folowing dependency has been added as a workaround for issue
+ TUSCANY-3540 so that the travel sample can run on Tuscany SCA 1.6.
+ When a Tuscany SCA release with a fix for TUSCANY-3540 is available,
+ this unnecessary dependency can be removed. -->
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-jetty</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <version>2.2</version>
+ <configuration>
+ <archive>
+ <manifest>
+ <addClasspath>${scatours.selfContained}</addClasspath>
+ <classpathPrefix>../lib/</classpathPrefix>
+ <mainClass>scatours.IntroducingClientLauncher</mainClass>
+ </manifest>
+ </archive>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/introducing-client/src/main/java/scatours/IntroducingClientLauncher.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/introducing-client/src/main/java/scatours/IntroducingClientLauncher.java new file mode 100644 index 0000000000..f261ef6e27 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/introducing-client/src/main/java/scatours/IntroducingClientLauncher.java @@ -0,0 +1,38 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package scatours;
+
+import org.apache.tuscany.sca.node.SCAClient;
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.SCANodeFactory;
+
+public class IntroducingClientLauncher {
+
+ public static void main(String[] args) throws Exception {
+ SCANode node =
+ SCANodeFactory.newInstance().createSCANodeFromURL("http://localhost:9990/node-config/ClientNode");
+ node.start();
+
+ Runnable client = ((SCAClient)node).getService(Runnable.class, "TestClient/Runnable");
+ client.run();
+
+ node.stop();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/introducing-domain/build.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/introducing-domain/build.xml new file mode 100644 index 0000000000..9d8c28b8e1 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/introducing-domain/build.xml @@ -0,0 +1,38 @@ +<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<project name="scatours-launcher-introducing-domain" default="run">
+ <import file="../../antdefs.xml"/>
+
+ <!-- The "run" target runs the DomainManagerLauncher class directly
+ (as if it had been invoked from a command line) and passes in the
+ domain configuration directory as a command-line argument. This
+ only works with Tuscany SCA Java version 1.6 and above. -->
+ <target name="run">
+ <java classname="org.apache.tuscany.sca.node.launcher.DomainManagerLauncher"
+ dir="." fork="true" failonerror="true">
+ <classpath>
+ <fileset dir="${env.TUSCANY_HOME}/modules">
+ <include name="tuscany-node-launcher-*.jar"/>
+ </fileset>
+ </classpath>
+ <arg value="../../domainconfig/introducing/target/classes"/>
+ </java>
+ </target>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/introducing-domain/pom.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/introducing-domain/pom.xml new file mode 100644 index 0000000000..43d256e212 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/introducing-domain/pom.xml @@ -0,0 +1,86 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent><version>1.0-SNAPSHOT</version>
+ <artifactId>scatours-launcher-introducing-domain</artifactId>
+ <name>Apache Tuscany SCA Tours Introducing Domain Launcher</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node-api</artifactId>
+ <version>${tuscany.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-domain-manager</artifactId>
+ <version>${tuscany.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node-impl</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-jsonrpc</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-xml</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <version>2.2</version>
+ <configuration>
+ <archive>
+ <manifest>
+ <addClasspath>${scatours.selfContained}</addClasspath>
+ <classpathPrefix>../lib/</classpathPrefix>
+ <mainClass>scatours.IntroducingDomainLauncher</mainClass>
+ </manifest>
+ </archive>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/introducing-domain/src/main/java/scatours/IntroducingDomainLauncher.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/introducing-domain/src/main/java/scatours/IntroducingDomainLauncher.java new file mode 100644 index 0000000000..1b47ef92bd --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/introducing-domain/src/main/java/scatours/IntroducingDomainLauncher.java @@ -0,0 +1,53 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package scatours;
+
+import java.io.IOException;
+
+import org.apache.tuscany.sca.domain.manager.launcher.DomainManagerLauncherBootstrap;
+import org.apache.tuscany.sca.node.SCANode;
+
+/**
+ * This launcher is only used when running from the binaries directory.
+ * If the binaries directory was built using the mvn -Pselfcontained command,
+ * it's important to ensure that no dependencies other than those explicitly
+ * specified by the launcher jar manifest and its transitive dependencies
+ * are used. This launcher class must therefore avoid using the Tuscany
+ * DomainManagerLauncher class, because DomainManagerLauncher builds a
+ * runtime classpath from (among other things) the TUSCANY_HOME environment
+ * variable.
+ */
+public class IntroducingDomainLauncher {
+
+ public static void main(String[] args) throws Exception {
+ String rootDir = "../domainconfig/introducing";
+ DomainManagerLauncherBootstrap bootstrap = new DomainManagerLauncherBootstrap(rootDir);
+ SCANode node = bootstrap.getNode();
+ node.start();
+
+ System.out.println("Domain manager started - Press enter to shutdown.");
+ try {
+ System.in.read();
+ } catch (IOException e) {
+ }
+
+ node.stop();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/introducing-tours/build.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/introducing-tours/build.xml new file mode 100644 index 0000000000..1713b85e03 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/introducing-tours/build.xml @@ -0,0 +1,34 @@ +<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<project name="scatours-launcher-introducing-tours" default="run">
+ <import file="../../antdefs.xml"/>
+
+ <target name="run">
+ <java classname="org.apache.tuscany.sca.node.launcher.NodeLauncher"
+ fork="true" failonerror="true">
+ <arg value="http://localhost:9990/node-config/ToursNode"/>
+ <classpath>
+ <fileset dir="${env.TUSCANY_HOME}/modules">
+ <include name="tuscany-node-launcher-*.jar"/>
+ </fileset>
+ </classpath>
+ </java>
+ </target>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/introducing-tours/pom.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/introducing-tours/pom.xml new file mode 100644 index 0000000000..5970149bc9 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/introducing-tours/pom.xml @@ -0,0 +1,86 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent><version>1.0-SNAPSHOT</version>
+ <artifactId>scatours-launcher-introducing-tours</artifactId>
+ <name>Apache Tuscany SCA Tours Introducing Tours Launcher</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node-api</artifactId>
+ <version>${tuscany.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node-impl</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-sca-axis2</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-jetty</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <version>2.2</version>
+ <configuration>
+ <archive>
+ <manifest>
+ <addClasspath>${scatours.selfContained}</addClasspath>
+ <classpathPrefix>../lib/</classpathPrefix>
+ <mainClass>scatours.IntroducingToursLauncher</mainClass>
+ </manifest>
+ </archive>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/introducing-tours/src/main/java/scatours/IntroducingToursLauncher.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/introducing-tours/src/main/java/scatours/IntroducingToursLauncher.java new file mode 100644 index 0000000000..c99bf58e07 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/introducing-tours/src/main/java/scatours/IntroducingToursLauncher.java @@ -0,0 +1,51 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package scatours;
+
+import java.io.IOException;
+
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.SCANodeFactory;
+
+/**
+ * This launcher is only used when running from the binaries directory.
+ * If the binaries directory was built using the mvn -Pselfcontained command,
+ * it's important to ensure that no dependencies other than those explicitly
+ * specified by the launcher jar manifest and its transitive dependencies
+ * are used. This launcher class must therefore avoid using the Tuscany
+ * NodeLauncher class, because NodeLauncher builds a runtime classpath from
+ * (among other things) the TUSCANY_HOME environment variable.
+ */
+public class IntroducingToursLauncher {
+
+ public static void main(String[] args) throws Exception {
+ SCANode node =
+ SCANodeFactory.newInstance().createSCANodeFromURL("http://localhost:9990/node-config/ToursNode");
+ node.start();
+
+ System.out.println("Node started - Press enter to shutdown.");
+ try {
+ System.in.read();
+ } catch (IOException e) {
+ }
+
+ node.stop();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/introducing-trips/build.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/introducing-trips/build.xml new file mode 100644 index 0000000000..4059606a08 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/introducing-trips/build.xml @@ -0,0 +1,34 @@ +<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<project name="scatours-launcher-introducing-trips" default="run">
+ <import file="../../antdefs.xml"/>
+
+ <target name="run">
+ <java classname="org.apache.tuscany.sca.node.launcher.NodeLauncher"
+ fork="true" failonerror="true">
+ <arg value="http://localhost:9990/node-config/TripsNode"/>
+ <classpath>
+ <fileset dir="${env.TUSCANY_HOME}/modules">
+ <include name="tuscany-node-launcher-*.jar"/>
+ </fileset>
+ </classpath>
+ </java>
+ </target>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/introducing-trips/pom.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/introducing-trips/pom.xml new file mode 100644 index 0000000000..ec5da820e7 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/introducing-trips/pom.xml @@ -0,0 +1,86 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent><version>1.0-SNAPSHOT</version>
+ <artifactId>scatours-launcher-introducing-trips</artifactId>
+ <name>Apache Tuscany SCA Tours Introducing Trips Launcher</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node-api</artifactId>
+ <version>${tuscany.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node-impl</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-sca-axis2</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-jetty</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <version>2.2</version>
+ <configuration>
+ <archive>
+ <manifest>
+ <addClasspath>${scatours.selfContained}</addClasspath>
+ <classpathPrefix>../lib/</classpathPrefix>
+ <mainClass>scatours.IntroducingTripsLauncher</mainClass>
+ </manifest>
+ </archive>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/introducing-trips/src/main/java/scatours/IntroducingTripsLauncher.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/introducing-trips/src/main/java/scatours/IntroducingTripsLauncher.java new file mode 100644 index 0000000000..10dfc242e1 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/introducing-trips/src/main/java/scatours/IntroducingTripsLauncher.java @@ -0,0 +1,51 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package scatours;
+
+import java.io.IOException;
+
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.SCANodeFactory;
+
+/**
+ * This launcher is only used when running from the binaries directory.
+ * If the binaries directory was built using the mvn -Pselfcontained command,
+ * it's important to ensure that no dependencies other than those explicitly
+ * specified by the launcher jar manifest and its transitive dependencies
+ * are used. This launcher class must therefore avoid using the Tuscany
+ * NodeLauncher class, because NodeLauncher builds a runtime classpath from
+ * (among other things) the TUSCANY_HOME environment variable.
+ */
+public class IntroducingTripsLauncher {
+
+ public static void main(String[] args) throws Exception {
+ SCANode node =
+ SCANodeFactory.newInstance().createSCANodeFromURL("http://localhost:9990/node-config/TripsNode");
+ node.start();
+
+ System.out.println("Node started - Press enter to shutdown.");
+ try {
+ System.in.read();
+ } catch (IOException e) {
+ }
+
+ node.stop();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/introducing/build.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/introducing/build.xml new file mode 100644 index 0000000000..217679604d --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/introducing/build.xml @@ -0,0 +1,35 @@ +<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<project name="scatours-launcher-introducing" default="compile">
+ <import file="../../antdefs.xml"/>
+ <path id="compile-path">
+ <pathelement path="../../util/launcher-common/target/scatours-util-launcher-common.jar"/>
+ </path>
+
+ <target name="run">
+ <java classname="scatours.IntroducingLauncher" fork="true" failonerror="true">
+ <classpath>
+ <pathelement location="target/${ant.project.name}.jar"/>
+ <path refid="compile-path"/>
+ <pathelement location="${env.TUSCANY_HOME}/lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </java>
+ </target>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/introducing/pom.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/introducing/pom.xml new file mode 100644 index 0000000000..98c8627d6c --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/introducing/pom.xml @@ -0,0 +1,90 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent><version>1.0-SNAPSHOT</version>
+ <artifactId>scatours-launcher-introducing</artifactId>
+ <name>Apache Tuscany SCA Tours Introducing Launcher</name>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-util-launcher-common</artifactId>
+ <version>${pom.version}</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node-api</artifactId>
+ <version>${tuscany.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node-impl</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.5</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <version>2.2</version>
+ <configuration>
+ <archive>
+ <manifestEntries>
+ <Class-Path>../util/scatours-util-launcher-common.jar</Class-Path>
+ </manifestEntries>
+ <manifest>
+ <addClasspath>${scatours.selfContained}</addClasspath>
+ <classpathPrefix>../lib/</classpathPrefix>
+ <mainClass>scatours.IntroducingLauncher</mainClass>
+ </manifest>
+ </archive>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/introducing/src/main/java/scatours/IntroducingLauncher.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/introducing/src/main/java/scatours/IntroducingLauncher.java new file mode 100644 index 0000000000..4ad19762d9 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/introducing/src/main/java/scatours/IntroducingLauncher.java @@ -0,0 +1,44 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package scatours; + +import static scatours.launcher.LauncherUtil.locate; + +import org.apache.tuscany.sca.node.SCAClient; +import org.apache.tuscany.sca.node.SCANode; +import org.apache.tuscany.sca.node.SCANodeFactory; + +public class IntroducingLauncher { + + public static void main(String[] args) throws Exception { + SCANode node = + SCANodeFactory.newInstance().createSCANode(null, + locate("introducing-tours"), + locate("introducing-trips"), + locate("introducing-client")); + + node.start(); + + Runnable proxy = ((SCAClient)node).getService(Runnable.class, "TestClient/Runnable"); + proxy.run(); + + node.stop(); + } +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/introducing/src/test/java/scatours/IntroducingTestCase.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/introducing/src/test/java/scatours/IntroducingTestCase.java new file mode 100644 index 0000000000..573d2e76bd --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/introducing/src/test/java/scatours/IntroducingTestCase.java @@ -0,0 +1,62 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package scatours;
+
+import org.apache.tuscany.sca.node.SCAClient;
+import org.apache.tuscany.sca.node.SCAContribution;
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.SCANodeFactory;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Test case to run the test code in the introducing-client contribution
+ * that tests components and services in the introducing-tours contribution
+ * and the introducing-trips contribution.
+ */
+public class IntroducingTestCase {
+
+ private SCANode node;
+
+ @Before
+ public void startServer() throws Exception {
+ node =
+ SCANodeFactory.newInstance()
+ .createSCANode(null,
+ new SCAContribution("introducing-tours",
+ "../../contributions/introducing-tours/target/classes"),
+ new SCAContribution("introducing-trips",
+ "../../contributions/introducing-trips/target/classes"),
+ new SCAContribution("introducing-client",
+ "../../contributions/introducing-client/target/classes"));
+ node.start();
+ }
+
+ @Test
+ public void testClient() throws Exception {
+ Runnable proxy = ((SCAClient)node).getService(Runnable.class, "TestClient/Runnable");
+ proxy.run();
+ }
+
+ @After
+ public void stopServer() throws Exception {
+ node.stop();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/jumpstart/build.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/jumpstart/build.xml new file mode 100644 index 0000000000..b7aead4d1c --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/jumpstart/build.xml @@ -0,0 +1,31 @@ +<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<project name="scatours-launcher-jumpstart" default="compile">
+ <import file="../../antdefs.xml"/>
+
+ <target name="run">
+ <java classname="scatours.JumpstartLauncher" fork="true" failonerror="true">
+ <classpath>
+ <pathelement location="target/${ant.project.name}.jar"/>
+ <pathelement location="${env.TUSCANY_HOME}/lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </java>
+ </target>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/jumpstart/pom.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/jumpstart/pom.xml new file mode 100644 index 0000000000..c5f50cb8df --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/jumpstart/pom.xml @@ -0,0 +1,79 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent><version>1.0-SNAPSHOT</version>
+ <artifactId>scatours-launcher-jumpstart</artifactId>
+ <name>Apache Tuscany SCA Tours Jump Start Launcher</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node-api</artifactId>
+ <version>${tuscany.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node-impl</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.5</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <version>2.2</version>
+ <configuration>
+ <archive>
+ <manifest>
+ <addClasspath>${scatours.selfContained}</addClasspath>
+ <classpathPrefix>../lib/</classpathPrefix>
+ <mainClass>scatours.JumpstartLauncher</mainClass>
+ </manifest>
+ </archive>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/jumpstart/src/main/java/scatours/JumpstartLauncher.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/jumpstart/src/main/java/scatours/JumpstartLauncher.java new file mode 100644 index 0000000000..e2f0f9da4b --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/jumpstart/src/main/java/scatours/JumpstartLauncher.java @@ -0,0 +1,43 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package scatours;
+
+import org.apache.tuscany.sca.node.SCAClient;
+import org.apache.tuscany.sca.node.SCAContribution;
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.SCANodeFactory;
+
+public class JumpstartLauncher {
+
+ public static void main(String[] args) throws Exception {
+ SCAContribution gvtContribution = new SCAContribution("introducing-trips",
+ "../../contributions/introducing-trips/target/classes");
+
+ SCANode node = SCANodeFactory.newInstance().createSCANode("trips.composite", gvtContribution);
+
+ node.start();
+
+ Trips tripProvider = ((SCAClient)node).getService(Trips.class, "TripProvider/Trips");
+
+ System.out.println("Trip boooking code = " + tripProvider.checkAvailability("FS1APR4", 1));
+
+ node.stop();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/jumpstart/src/main/java/scatours/Trips.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/jumpstart/src/main/java/scatours/Trips.java new file mode 100644 index 0000000000..a7abf8e08d --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/jumpstart/src/main/java/scatours/Trips.java @@ -0,0 +1,26 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package scatours;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface Trips {
+ String checkAvailability(String trip, int people);
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/jumpstart/src/test/java/scatours/JumpstartTestCase.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/jumpstart/src/test/java/scatours/JumpstartTestCase.java new file mode 100644 index 0000000000..4da7c54917 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/jumpstart/src/test/java/scatours/JumpstartTestCase.java @@ -0,0 +1,56 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package scatours;
+
+import org.apache.tuscany.sca.node.SCAClient;
+import org.apache.tuscany.sca.node.SCAContribution;
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.SCANodeFactory;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Tests the Jump Start scenario
+ */
+public class JumpstartTestCase {
+
+ private SCANode node;
+
+ @Before
+ public void startServer() throws Exception {
+ node =
+ SCANodeFactory.newInstance()
+ .createSCANode("trips.composite",
+ new SCAContribution("introducing-trips",
+ "../../contributions/introducing-trips/target/classes"));
+ node.start();
+ }
+
+ @Test
+ public void testClient() throws Exception {
+ Trips tripProvider = ((SCAClient)node).getService(Trips.class, "TripProvider/Trips");
+ System.out.println("Trip boooking code = " + tripProvider.checkAvailability("FS1APR4", 2));
+ }
+
+ @After
+ public void stopServer() throws Exception {
+ node.stop();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/notification-corba/build.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/notification-corba/build.xml new file mode 100644 index 0000000000..4c2524fdd0 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/notification-corba/build.xml @@ -0,0 +1,41 @@ +<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<project name="scatours-launcher-notification-corba" default="compile">
+ <import file="../../antdefs.xml"/>
+ <path id="compile-path">
+ <pathelement path="../../util/launcher-common/target/scatours-util-launcher-common.jar"/>
+ </path>
+
+ <!-- Before invoking the "run" target, the CORBA SMS Gateway service
+ needs to be started and running in a different process. -->
+ <target name="run-smsgateway">
+ <ant dir="../../services/smsgateway-corba" target="run"/>
+ </target>
+
+ <target name="run">
+ <java classname="scatours.NotificationCORBALauncher" fork="true" failonerror="true">
+ <classpath>
+ <pathelement location="target/${ant.project.name}.jar"/>
+ <path refid="compile-path"/>
+ <pathelement location="${env.TUSCANY_HOME}/lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </java>
+ </target>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/notification-corba/pom.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/notification-corba/pom.xml new file mode 100644 index 0000000000..077e5e724f --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/notification-corba/pom.xml @@ -0,0 +1,97 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent><version>1.0-SNAPSHOT</version>
+ <artifactId>scatours-launcher-notification-corba</artifactId>
+ <name>Apache Tuscany SCA Tours Notification CORBA Service Launcher</name>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-util-launcher-common</artifactId>
+ <version>${pom.version}</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node-api</artifactId>
+ <version>${tuscany.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node-impl</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-corba-runtime</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-corba-jse-tns</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <version>2.2</version>
+ <configuration>
+ <archive>
+ <manifestEntries>
+ <Class-Path>../util/scatours-util-launcher-common.jar</Class-Path>
+ </manifestEntries>
+ <manifest>
+ <addClasspath>${scatours.selfContained}</addClasspath>
+ <classpathPrefix>../lib/</classpathPrefix>
+ <mainClass>scatours.NotificationCORBALauncher</mainClass>
+ </manifest>
+ </archive>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/notification-corba/src/main/java/scatours/NotificationCORBALauncher.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/notification-corba/src/main/java/scatours/NotificationCORBALauncher.java new file mode 100644 index 0000000000..44b94b3a59 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/notification-corba/src/main/java/scatours/NotificationCORBALauncher.java @@ -0,0 +1,54 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package scatours;
+
+import static scatours.launcher.LauncherUtil.locate;
+
+import org.apache.tuscany.sca.node.SCAClient;
+import org.apache.tuscany.sca.node.SCAContribution;
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.SCANodeFactory;
+
+import scatours.notification.Notification;
+
+public class NotificationCORBALauncher {
+
+ public static void main(String[] args) throws Exception {
+ SCAContribution notificationContribution = locate("notification");
+ SCAContribution notificationCORBAContribution = locate("notification-corba");
+
+ SCANode node =
+ SCANodeFactory.newInstance().createSCANode("notification-corba.composite",
+ notificationContribution,
+ notificationCORBAContribution);
+ node.start();
+
+ System.out.println("Quick notification test");
+ Notification notification = ((SCAClient)node).getService(Notification.class, "Notification");
+ String accountID = "1234";
+ String subject = "Holiday payment taken";
+ String message = "Payment of £102.37 accepted...";
+ notification.notify(accountID, subject, message);
+
+ System.out.println("Node started - Press enter to shutdown.");
+ System.in.read();
+ node.stop();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/notification-corba/src/main/java/scatours/notification/Notification.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/notification-corba/src/main/java/scatours/notification/Notification.java new file mode 100644 index 0000000000..020e1e40db --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/notification-corba/src/main/java/scatours/notification/Notification.java @@ -0,0 +1,26 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package scatours.notification; + +public interface Notification { + + boolean notify(String accountID, String subject, String message); + +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/notification-ejb/build.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/notification-ejb/build.xml new file mode 100644 index 0000000000..ec1416635c --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/notification-ejb/build.xml @@ -0,0 +1,42 @@ +<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<project name="scatours-launcher-notification-ejb" default="compile">
+ <import file="../../antdefs.xml"/>
+ <path id="compile-path">
+ <pathelement path="../../util/launcher-common/target/scatours-util-launcher-common.jar"/>
+ </path>
+
+ <!-- Before invoking the "run" target, the EJB server for the SMS Gateway EJB
+ needs to be started and running in a different process. -->
+ <target name="run-smsgateway">
+ <ant dir="../../services/smsgateway-ejb" target="run"/>
+ </target>
+
+ <target name="run">
+ <java classname="scatours.NotificationEJBLauncher" fork="true" failonerror="true">
+ <classpath>
+ <pathelement location="target/${ant.project.name}.jar"/>
+ <path refid="compile-path"/>
+ <pathelement location="${env.TUSCANY_HOME}/lib/tuscany-sca-manifest.jar"/>
+ <fileset dir="${env.OPENEJB_HOME}/lib"/>
+ </classpath>
+ </java>
+ </target>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/notification-ejb/pom.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/notification-ejb/pom.xml new file mode 100644 index 0000000000..1dd95cf3e5 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/notification-ejb/pom.xml @@ -0,0 +1,97 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent><version>1.0-SNAPSHOT</version>
+ <artifactId>scatours-launcher-notification-ejb</artifactId>
+ <name>Apache Tuscany SCA Tours Notification EJB Launcher</name>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-util-launcher-common</artifactId>
+ <version>${pom.version}</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node-api</artifactId>
+ <version>${tuscany.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node-impl</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ejb</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ejb-runtime</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <version>2.2</version>
+ <configuration>
+ <archive>
+ <manifestEntries>
+ <Class-Path>../util/scatours-util-launcher-common.jar ../util/scatours-util-openejb-runtime.jar</Class-Path>
+ </manifestEntries>
+ <manifest>
+ <addClasspath>${scatours.selfContained}</addClasspath>
+ <classpathPrefix>../lib/</classpathPrefix>
+ <mainClass>scatours.NotificationEJBLauncher</mainClass>
+ </manifest>
+ </archive>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/notification-ejb/src/main/java/scatours/NotificationEJBLauncher.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/notification-ejb/src/main/java/scatours/NotificationEJBLauncher.java new file mode 100644 index 0000000000..2d843e9ff9 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/notification-ejb/src/main/java/scatours/NotificationEJBLauncher.java @@ -0,0 +1,59 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package scatours;
+
+import static scatours.launcher.LauncherUtil.locate;
+
+import javax.naming.Context;
+
+import org.apache.tuscany.sca.node.SCAClient;
+import org.apache.tuscany.sca.node.SCAContribution;
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.SCANodeFactory;
+
+import scatours.notification.Notification;
+
+public class NotificationEJBLauncher {
+
+ public static void main(String[] args) throws Exception {
+ System.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.apache.openejb.client.RemoteInitialContextFactory");
+ System.setProperty(Context.PROVIDER_URL, "ejbd://localhost:4201");
+
+ SCAContribution notificationContribution = locate("notification");
+ SCAContribution notificationEJBContribution = locate("notification-ejb");
+
+ SCANode node =
+ SCANodeFactory.newInstance().createSCANode("notification-ejb.composite",
+ notificationContribution,
+ notificationEJBContribution);
+ node.start();
+
+ System.out.println("Quick notification test");
+ Notification notification = ((SCAClient)node).getService(Notification.class, "Notification");
+ String accountID = "1234";
+ String subject = "Holiday payment taken";
+ String message = "Payment of £102.37 accepted...";
+ notification.notify(accountID, subject, message);
+
+ System.out.println("Node started - Press enter to shutdown.");
+ System.in.read();
+ node.stop();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/notification-ejb/src/main/java/scatours/notification/Notification.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/notification-ejb/src/main/java/scatours/notification/Notification.java new file mode 100644 index 0000000000..020e1e40db --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/notification-ejb/src/main/java/scatours/notification/Notification.java @@ -0,0 +1,26 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package scatours.notification; + +public interface Notification { + + boolean notify(String accountID, String subject, String message); + +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/notification-jms/build.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/notification-jms/build.xml new file mode 100644 index 0000000000..e7129ddc61 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/notification-jms/build.xml @@ -0,0 +1,41 @@ +<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<project name="scatours-launcher-notification-jms" default="compile">
+ <import file="../../antdefs.xml"/>
+ <path id="compile-path">
+ <pathelement path="../../util/launcher-common/target/scatours-util-launcher-common.jar"/>
+ </path>
+
+ <!-- Before invoking the "run" target, the JMS implementation of the
+ SMS gateway needs to be started and running in a different process. -->
+ <target name="run-smsgateway">
+ <ant dir="../../services/smsgateway-jms" target="run"/>
+ </target>
+
+ <target name="run">
+ <java classname="scatours.NotificationJMSLauncher" fork="true" failonerror="true">
+ <classpath>
+ <pathelement location="target/${ant.project.name}.jar"/>
+ <path refid="compile-path"/>
+ <pathelement location="${env.TUSCANY_HOME}/lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </java>
+ </target>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/notification-jms/pom.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/notification-jms/pom.xml new file mode 100644 index 0000000000..3b20798e40 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/notification-jms/pom.xml @@ -0,0 +1,103 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent><version>1.0-SNAPSHOT</version>
+ <artifactId>scatours-launcher-notification-jms</artifactId>
+ <name>Apache Tuscany SCA Tours Notification JMS Launcher</name>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-util-launcher-common</artifactId>
+ <version>${pom.version}</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node-api</artifactId>
+ <version>${tuscany.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node-impl</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-jms-asf</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>activemq-all</artifactId>
+ <version>5.2.0</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>activemq-web-demo</artifactId>
+ </exclusion>
+ </exclusions>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <version>2.2</version>
+ <configuration>
+ <archive>
+ <manifestEntries>
+ <Class-Path>../util/scatours-util-launcher-common.jar</Class-Path>
+ </manifestEntries>
+ <manifest>
+ <addClasspath>${scatours.selfContained}</addClasspath>
+ <classpathPrefix>../lib/</classpathPrefix>
+ <mainClass>scatours.NotificationJMSLauncher</mainClass>
+ </manifest>
+ </archive>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/notification-jms/src/main/java/scatours/NotificationJMSLauncher.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/notification-jms/src/main/java/scatours/NotificationJMSLauncher.java new file mode 100644 index 0000000000..c2ffda0725 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/notification-jms/src/main/java/scatours/NotificationJMSLauncher.java @@ -0,0 +1,56 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package scatours;
+
+import static scatours.launcher.LauncherUtil.locate;
+
+import org.apache.tuscany.sca.node.SCAClient;
+import org.apache.tuscany.sca.node.SCAContribution;
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.SCANodeFactory;
+
+import scatours.notification.Notification;
+
+public class NotificationJMSLauncher {
+
+ public static void main(String[] args) throws Exception {
+ SCAContribution notificationContribution = locate("notification");
+ SCAContribution notificationJMSContribution = locate("notification-jms");
+
+ SCANode node =
+ SCANodeFactory.newInstance().createSCANode("notification-jms.composite",
+ notificationContribution,
+ notificationJMSContribution);
+
+ try {
+ node.start();
+
+ System.out.println("Quick notification test");
+ Notification notification = ((SCAClient)node).getService(Notification.class, "Notification");
+ String accountID = "1234";
+ String subject = "Holiday payment taken";
+ String message = "Payment of £102.37 accepted...";
+ notification.notify(accountID, subject, message);
+ System.out.println("Notification sent");
+ } finally {
+ node.stop();
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/notification-jms/src/main/java/scatours/notification/Notification.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/notification-jms/src/main/java/scatours/notification/Notification.java new file mode 100644 index 0000000000..020e1e40db --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/notification-jms/src/main/java/scatours/notification/Notification.java @@ -0,0 +1,26 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package scatours.notification; + +public interface Notification { + + boolean notify(String accountID, String subject, String message); + +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/notification-rmi/build.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/notification-rmi/build.xml new file mode 100644 index 0000000000..a4f7b17d01 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/notification-rmi/build.xml @@ -0,0 +1,41 @@ +<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<project name="scatours-launcher-notification-rmi" default="compile">
+ <import file="../../antdefs.xml"/>
+ <path id="compile-path">
+ <pathelement path="../../util/launcher-common/target/scatours-util-launcher-common.jar"/>
+ </path>
+
+ <!-- Before invoking the "run" target, the RMI server for the SMS Gateway
+ remote object needs to be started and running in a different process. -->
+ <target name="run-smsgateway">
+ <ant dir="../../services/smsgateway-rmi" target="run"/>
+ </target>
+
+ <target name="run">
+ <java classname="scatours.NotificationRMILauncher" fork="true" failonerror="true">
+ <classpath>
+ <pathelement location="target/${ant.project.name}.jar"/>
+ <path refid="compile-path"/>
+ <pathelement location="${env.TUSCANY_HOME}/lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </java>
+ </target>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/notification-rmi/pom.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/notification-rmi/pom.xml new file mode 100644 index 0000000000..69590fa45e --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/notification-rmi/pom.xml @@ -0,0 +1,97 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent><version>1.0-SNAPSHOT</version>
+ <artifactId>scatours-launcher-notification-rmi</artifactId>
+ <name>Apache Tuscany SCA Tours Notification RMI Launcher</name>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-util-launcher-common</artifactId>
+ <version>${pom.version}</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node-api</artifactId>
+ <version>${tuscany.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node-impl</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-rmi</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-rmi-runtime</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <version>2.2</version>
+ <configuration>
+ <archive>
+ <manifestEntries>
+ <Class-Path>../util/scatours-util-launcher-common.jar</Class-Path>
+ </manifestEntries>
+ <manifest>
+ <addClasspath>${scatours.selfContained}</addClasspath>
+ <classpathPrefix>../lib/</classpathPrefix>
+ <mainClass>scatours.NotificationRMILauncher</mainClass>
+ </manifest>
+ </archive>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/notification-rmi/src/main/java/com/tuscanyscatours/smsgateway/SMSGateway.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/notification-rmi/src/main/java/com/tuscanyscatours/smsgateway/SMSGateway.java new file mode 100644 index 0000000000..4ce528fd23 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/notification-rmi/src/main/java/com/tuscanyscatours/smsgateway/SMSGateway.java @@ -0,0 +1,30 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package com.tuscanyscatours.smsgateway; + +import java.rmi.Remote; +import java.rmi.RemoteException; + +/** + * A gateway to send SMS messages. + */ +public interface SMSGateway extends Remote { + boolean sendSMS(String fromNumber, String toNumber, String text) throws RemoteException; +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/notification-rmi/src/main/java/scatours/NotificationRMILauncher.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/notification-rmi/src/main/java/scatours/NotificationRMILauncher.java new file mode 100644 index 0000000000..2904349a49 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/notification-rmi/src/main/java/scatours/NotificationRMILauncher.java @@ -0,0 +1,54 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package scatours;
+
+import static scatours.launcher.LauncherUtil.locate;
+
+import org.apache.tuscany.sca.node.SCAClient;
+import org.apache.tuscany.sca.node.SCAContribution;
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.SCANodeFactory;
+
+import scatours.notification.Notification;
+
+public class NotificationRMILauncher {
+
+ public static void main(String[] args) throws Exception {
+ SCAContribution notificationContribution = locate("notification");
+ SCAContribution notificationRMIContribution = locate("notification-rmi");
+
+ SCANode node =
+ SCANodeFactory.newInstance().createSCANode("notification-rmi.composite",
+ notificationContribution,
+ notificationRMIContribution);
+ node.start();
+
+ System.out.println("Quick notification test");
+ Notification notification = ((SCAClient)node).getService(Notification.class, "Notification");
+ String accountID = "1234";
+ String subject = "Holiday payment taken";
+ String message = "Payment of £102.37 accepted...";
+ notification.notify(accountID, subject, message);
+
+ System.out.println("Node started - Press enter to shutdown.");
+ System.in.read();
+ node.stop();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/notification-rmi/src/main/java/scatours/notification/Notification.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/notification-rmi/src/main/java/scatours/notification/Notification.java new file mode 100644 index 0000000000..020e1e40db --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/notification-rmi/src/main/java/scatours/notification/Notification.java @@ -0,0 +1,26 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package scatours.notification; + +public interface Notification { + + boolean notify(String accountID, String subject, String message); + +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/notification-ws/build.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/notification-ws/build.xml new file mode 100644 index 0000000000..a6a3ac5ef0 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/notification-ws/build.xml @@ -0,0 +1,41 @@ +<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<project name="scatours-launcher-notification-ws" default="compile">
+ <import file="../../antdefs.xml"/>
+ <path id="compile-path">
+ <pathelement path="../../util/launcher-common/target/scatours-util-launcher-common.jar"/>
+ </path>
+
+ <!-- Before invoking the "run" target, the JAX-WS server for the SMS Gateway
+ remote object needs to be started and running in a different process. -->
+ <target name="run-smsgateway">
+ <ant dir="../../services/smsgateway-jaxws" target="run"/>
+ </target>
+
+ <target name="run">
+ <java classname="scatours.NotificationWSLauncher" fork="true" failonerror="true">
+ <classpath>
+ <pathelement location="target/${ant.project.name}.jar"/>
+ <path refid="compile-path"/>
+ <pathelement location="${env.TUSCANY_HOME}/lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </java>
+ </target>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/notification-ws/pom.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/notification-ws/pom.xml new file mode 100644 index 0000000000..c5dd336d6b --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/notification-ws/pom.xml @@ -0,0 +1,97 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent><version>1.0-SNAPSHOT</version>
+ <artifactId>scatours-launcher-notification-ws</artifactId>
+ <name>Apache Tuscany SCA Tours Notification Web Service Launcher</name>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-util-launcher-common</artifactId>
+ <version>${pom.version}</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node-api</artifactId>
+ <version>${tuscany.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node-impl</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-axis2</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-tomcat</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <version>2.2</version>
+ <configuration>
+ <archive>
+ <manifestEntries>
+ <Class-Path>../util/scatours-util-launcher-common.jar</Class-Path>
+ </manifestEntries>
+ <manifest>
+ <addClasspath>${scatours.selfContained}</addClasspath>
+ <classpathPrefix>../lib/</classpathPrefix>
+ <mainClass>scatours.NotificationWSLauncher</mainClass>
+ </manifest>
+ </archive>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/notification-ws/src/main/java/scatours/NotificationWSLauncher.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/notification-ws/src/main/java/scatours/NotificationWSLauncher.java new file mode 100644 index 0000000000..fbdb1500f5 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/notification-ws/src/main/java/scatours/NotificationWSLauncher.java @@ -0,0 +1,54 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package scatours;
+
+import static scatours.launcher.LauncherUtil.locate;
+
+import org.apache.tuscany.sca.node.SCAClient;
+import org.apache.tuscany.sca.node.SCAContribution;
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.SCANodeFactory;
+
+import scatours.notification.Notification;
+
+public class NotificationWSLauncher {
+
+ public static void main(String[] args) throws Exception {
+ SCAContribution notificationContribution = locate("notification");
+ SCAContribution notificationWSContribution = locate("notification-ws");
+
+ SCANode node =
+ SCANodeFactory.newInstance().createSCANode("notification-ws.composite",
+ notificationContribution,
+ notificationWSContribution);
+ node.start();
+
+ System.out.println("Quick notification test");
+ Notification notification = ((SCAClient)node).getService(Notification.class, "Notification");
+ String accountID = "1234";
+ String subject = "Holiday payment taken";
+ String message = "Payment of £102.37 accepted...";
+ notification.notify(accountID, subject, message);
+
+ System.out.println("Node started - Press enter to shutdown.");
+ System.in.read();
+ node.stop();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/notification-ws/src/main/java/scatours/notification/Notification.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/notification-ws/src/main/java/scatours/notification/Notification.java new file mode 100644 index 0000000000..020e1e40db --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/notification-ws/src/main/java/scatours/notification/Notification.java @@ -0,0 +1,26 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package scatours.notification; + +public interface Notification { + + boolean notify(String accountID, String subject, String message); + +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-bpel/build.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-bpel/build.xml new file mode 100644 index 0000000000..f9d839c17e --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-bpel/build.xml @@ -0,0 +1,41 @@ +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> + +<project name="scatours-launcher-payment-bpel" default="compile"> + <import file="../../antdefs.xml"/> + <path id="compile-path"> + <pathelement path="../../util/launcher-common/target/scatours-util-launcher-common.jar"/> + </path> + + <target name="run"> + <unzip dest="target/ode"> + <fileset dir="${env.TUSCANY_HOME}/lib"> + <include name="ode-dao-jpa-ojpa-derby-*.zip"/> + </fileset> + </unzip> + <java classname="scatours.payment.PaymentLauncher" fork="true" failonerror="true"> + <classpath> + <pathelement location="target/${ant.project.name}.jar"/> + <pathelement location="target/ode"/> + <path refid="compile-path"/> + <pathelement location="${env.TUSCANY_HOME}/lib/tuscany-sca-manifest.jar"/> + </classpath> + </java> + </target> +</project> diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-bpel/pom.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-bpel/pom.xml new file mode 100644 index 0000000000..811bb6a9ed --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-bpel/pom.xml @@ -0,0 +1,140 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<project> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>scatours</artifactId> + <version>1.0-SNAPSHOT</version> + <relativePath>../../pom.xml</relativePath> + </parent><version>1.0-SNAPSHOT</version> + <artifactId>scatours-launcher-payment-bpel</artifactId> + <name>Apache Tuscany SCA Tours Payment BPEL Launcher</name> + + <dependencies> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>scatours-util-launcher-common</artifactId> + <version>${pom.version}</version> + <scope>provided</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-node-api</artifactId> + <version>${tuscany.version}</version> + </dependency> + + <dependency> + <groupId>javax.xml.bind</groupId> + <artifactId>jaxb-api</artifactId> + <version>2.1</version> + </dependency> + + <dependency> + <groupId>javax.xml.ws</groupId> + <artifactId>jaxws-api</artifactId> + <version>2.1</version> + <exclusions> + <exclusion> + <groupId>javax.xml.soap</groupId> + <artifactId>saaj-api</artifactId> + </exclusion> + </exclusions> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-node-impl</artifactId> + <version>${tuscany.version}</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-implementation-java-runtime</artifactId> + <version>${tuscany.version}</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-implementation-bpel-ode</artifactId> + <version>${tuscany.version}</version> + <scope>runtime</scope> + </dependency> + + <!-- Replace commons-logging-1.0.4 brought in by tuscany-implementation-bpel-ode --> + <dependency> + <groupId>commons-logging</groupId> + <artifactId>commons-logging</artifactId> + <version>1.1.1</version> + <exclusions> + <exclusion> + <groupId>javax.servlet</groupId> + <artifactId>servlet-api</artifactId> + </exclusion> + <exclusion> + <groupId>avalon-framework</groupId> + <artifactId>avalon-framework</artifactId> + </exclusion> + </exclusions> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-binding-ws-axis2</artifactId> + <version>${tuscany.version}</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-host-jetty</artifactId> + <version>${tuscany.version}</version> + <scope>runtime</scope> + </dependency> + </dependencies> + + <build> + <finalName>${artifactId}</finalName> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-jar-plugin</artifactId> + <version>2.2</version> + <configuration> + <archive> + <manifestEntries> + <Class-Path>../util/scatours-util-launcher-common.jar ../ode/</Class-Path> + </manifestEntries> + <manifest> + <addClasspath>${scatours.selfContained}</addClasspath> + <classpathPrefix>../lib/</classpathPrefix> + <mainClass>scatours.payment.PaymentLauncher</mainClass> + </manifest> + </archive> + </configuration> + </plugin> + </plugins> + </build> +</project> diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-bpel/src/main/java/com/tuscanyscatours/payment/MakePaymentMemberResponseType.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-bpel/src/main/java/com/tuscanyscatours/payment/MakePaymentMemberResponseType.java new file mode 100644 index 0000000000..e5f3ef3cad --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-bpel/src/main/java/com/tuscanyscatours/payment/MakePaymentMemberResponseType.java @@ -0,0 +1,62 @@ + +package com.tuscanyscatours.payment; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + + +/** + * <p>Java class for MakePaymentMemberResponseType complex type. + * + * <p>The following schema fragment specifies the expected content contained within this class. + * + * <pre> + * <complexType name="MakePaymentMemberResponseType"> + * <complexContent> + * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> + * <sequence> + * <element name="Status" type="{http://www.w3.org/2001/XMLSchema}string"/> + * </sequence> + * </restriction> + * </complexContent> + * </complexType> + * </pre> + * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "MakePaymentMemberResponseType", propOrder = { + "status" +}) +public class MakePaymentMemberResponseType { + + @XmlElement(name = "Status", required = true) + protected String status; + + /** + * Gets the value of the status property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getStatus() { + return status; + } + + /** + * Sets the value of the status property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setStatus(String value) { + this.status = value; + } + +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-bpel/src/main/java/com/tuscanyscatours/payment/MakePaymentMemberType.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-bpel/src/main/java/com/tuscanyscatours/payment/MakePaymentMemberType.java new file mode 100644 index 0000000000..ca94d86628 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-bpel/src/main/java/com/tuscanyscatours/payment/MakePaymentMemberType.java @@ -0,0 +1,82 @@ + +package com.tuscanyscatours.payment; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + + +/** + * <p>Java class for MakePaymentMemberType complex type. + * + * <p>The following schema fragment specifies the expected content contained within this class. + * + * <pre> + * <complexType name="MakePaymentMemberType"> + * <complexContent> + * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> + * <sequence> + * <element name="CustomerId" type="{http://www.w3.org/2001/XMLSchema}string"/> + * <element name="Amount" type="{http://www.w3.org/2001/XMLSchema}float"/> + * </sequence> + * </restriction> + * </complexContent> + * </complexType> + * </pre> + * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "MakePaymentMemberType", propOrder = { + "customerId", + "amount" +}) +public class MakePaymentMemberType { + + @XmlElement(name = "CustomerId", required = true) + protected String customerId; + @XmlElement(name = "Amount") + protected float amount; + + /** + * Gets the value of the customerId property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCustomerId() { + return customerId; + } + + /** + * Sets the value of the customerId property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCustomerId(String value) { + this.customerId = value; + } + + /** + * Gets the value of the amount property. + * + */ + public float getAmount() { + return amount; + } + + /** + * Sets the value of the amount property. + * + */ + public void setAmount(float value) { + this.amount = value; + } + +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-bpel/src/main/java/com/tuscanyscatours/payment/ObjectFactory.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-bpel/src/main/java/com/tuscanyscatours/payment/ObjectFactory.java new file mode 100644 index 0000000000..b069b2ba94 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-bpel/src/main/java/com/tuscanyscatours/payment/ObjectFactory.java @@ -0,0 +1,71 @@ + +package com.tuscanyscatours.payment; + +import javax.xml.bind.JAXBElement; +import javax.xml.bind.annotation.XmlElementDecl; +import javax.xml.bind.annotation.XmlRegistry; +import javax.xml.namespace.QName; + + +/** + * This object contains factory methods for each + * Java content interface and Java element interface + * generated in the com.tuscanyscatours.payment package. + * <p>An ObjectFactory allows you to programatically + * construct new instances of the Java representation + * for XML content. The Java representation of XML + * content can consist of schema derived interfaces + * and classes representing the binding of schema + * type definitions, element declarations and model + * groups. Factory methods for each of these are + * provided in this class. + * + */ +@XmlRegistry +public class ObjectFactory { + + private final static QName _MakePaymentMember_QNAME = new QName("http://www.tuscanyscatours.com/Payment/", "makePaymentMember"); + private final static QName _MakePaymentMemberResponse_QNAME = new QName("http://www.tuscanyscatours.com/Payment/", "makePaymentMemberResponse"); + + /** + * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: com.tuscanyscatours.payment + * + */ + public ObjectFactory() { + } + + /** + * Create an instance of {@link MakePaymentMemberResponseType } + * + */ + public MakePaymentMemberResponseType createMakePaymentMemberResponseType() { + return new MakePaymentMemberResponseType(); + } + + /** + * Create an instance of {@link MakePaymentMemberType } + * + */ + public MakePaymentMemberType createMakePaymentMemberType() { + return new MakePaymentMemberType(); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link MakePaymentMemberType }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://www.tuscanyscatours.com/Payment/", name = "makePaymentMember") + public JAXBElement<MakePaymentMemberType> createMakePaymentMember(MakePaymentMemberType value) { + return new JAXBElement<MakePaymentMemberType>(_MakePaymentMember_QNAME, MakePaymentMemberType.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link MakePaymentMemberResponseType }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://www.tuscanyscatours.com/Payment/", name = "makePaymentMemberResponse") + public JAXBElement<MakePaymentMemberResponseType> createMakePaymentMemberResponse(MakePaymentMemberResponseType value) { + return new JAXBElement<MakePaymentMemberResponseType>(_MakePaymentMemberResponse_QNAME, MakePaymentMemberResponseType.class, null, value); + } + +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-bpel/src/main/java/com/tuscanyscatours/payment/Payment.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-bpel/src/main/java/com/tuscanyscatours/payment/Payment.java new file mode 100644 index 0000000000..bbbd03d89a --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-bpel/src/main/java/com/tuscanyscatours/payment/Payment.java @@ -0,0 +1,43 @@ + +package com.tuscanyscatours.payment; + +import javax.jws.WebMethod; +import javax.jws.WebParam; +import javax.jws.WebResult; +import javax.jws.WebService; +import javax.xml.bind.annotation.XmlSeeAlso; +import javax.xml.ws.RequestWrapper; +import javax.xml.ws.ResponseWrapper; + + +/** + * This class was generated by the JAX-WS RI. + * JAX-WS RI 2.1.7-b01- + * Generated source version: 2.1 + * + */ +@WebService(name = "Payment", targetNamespace = "http://www.tuscanyscatours.com/Payment/") +@XmlSeeAlso({ + ObjectFactory.class +}) +public interface Payment { + + + /** + * + * @param amount + * @param customerId + * @return + * returns java.lang.String + */ + @WebMethod(action = "http://www.tuscanyscatours.com/Payment/makePayment") + @WebResult(name = "Status", targetNamespace = "") + @RequestWrapper(localName = "makePaymentMember", targetNamespace = "http://www.tuscanyscatours.com/Payment/", className = "com.tuscanyscatours.payment.MakePaymentMemberType") + @ResponseWrapper(localName = "makePaymentMemberResponse", targetNamespace = "http://www.tuscanyscatours.com/Payment/", className = "com.tuscanyscatours.payment.MakePaymentMemberResponseType") + public String makePaymentMember( + @WebParam(name = "CustomerId", targetNamespace = "") + String customerId, + @WebParam(name = "Amount", targetNamespace = "") + float amount); + +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-bpel/src/main/java/com/tuscanyscatours/payment/PaymentService.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-bpel/src/main/java/com/tuscanyscatours/payment/PaymentService.java new file mode 100644 index 0000000000..a430175976 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-bpel/src/main/java/com/tuscanyscatours/payment/PaymentService.java @@ -0,0 +1,71 @@ + +package com.tuscanyscatours.payment; + +import java.net.MalformedURLException; +import java.net.URL; +import java.util.logging.Logger; +import javax.xml.namespace.QName; +import javax.xml.ws.Service; +import javax.xml.ws.WebEndpoint; +import javax.xml.ws.WebServiceClient; +import javax.xml.ws.WebServiceFeature; + + +/** + * This class was generated by the JAX-WS RI. + * JAX-WS RI 2.1.7-b01- + * Generated source version: 2.1 + * + */ +@WebServiceClient(name = "PaymentService", targetNamespace = "http://www.tuscanyscatours.com/Payment/", wsdlLocation = "file:/C:/simon/tuscany/travelsample/contributions/payment-java/src/main/resources/Payment.wsdl") +public class PaymentService + extends Service +{ + + private final static URL PAYMENTSERVICE_WSDL_LOCATION; + private final static Logger logger = Logger.getLogger(com.tuscanyscatours.payment.PaymentService.class.getName()); + + static { + URL url = null; + try { + URL baseUrl; + baseUrl = com.tuscanyscatours.payment.PaymentService.class.getResource("."); + url = new URL(baseUrl, "file:/C:/simon/tuscany/travelsample/contributions/payment-java/src/main/resources/Payment.wsdl"); + } catch (MalformedURLException e) { + logger.warning("Failed to create URL for the wsdl Location: 'file:/C:/simon/tuscany/travelsample/contributions/payment-java/src/main/resources/Payment.wsdl', retrying as a local file"); + logger.warning(e.getMessage()); + } + PAYMENTSERVICE_WSDL_LOCATION = url; + } + + public PaymentService(URL wsdlLocation, QName serviceName) { + super(wsdlLocation, serviceName); + } + + public PaymentService() { + super(PAYMENTSERVICE_WSDL_LOCATION, new QName("http://www.tuscanyscatours.com/Payment/", "PaymentService")); + } + + /** + * + * @return + * returns Payment + */ + @WebEndpoint(name = "PaymentPort") + public Payment getPaymentPort() { + return super.getPort(new QName("http://www.tuscanyscatours.com/Payment/", "PaymentPort"), Payment.class); + } + + /** + * + * @param features + * A list of {@link javax.xml.ws.WebServiceFeature} to configure on the proxy. Supported features not in the <code>features</code> parameter will have their default values. + * @return + * returns Payment + */ + @WebEndpoint(name = "PaymentPort") + public Payment getPaymentPort(WebServiceFeature... features) { + return super.getPort(new QName("http://www.tuscanyscatours.com/Payment/", "PaymentPort"), Payment.class, features); + } + +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-bpel/src/main/java/com/tuscanyscatours/payment/package-info.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-bpel/src/main/java/com/tuscanyscatours/payment/package-info.java new file mode 100644 index 0000000000..acd208f5c9 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-bpel/src/main/java/com/tuscanyscatours/payment/package-info.java @@ -0,0 +1,2 @@ +@javax.xml.bind.annotation.XmlSchema(namespace = "http://www.tuscanyscatours.com/Payment/") +package com.tuscanyscatours.payment; diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-bpel/src/main/java/scatours/payment/PaymentLauncher.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-bpel/src/main/java/scatours/payment/PaymentLauncher.java new file mode 100644 index 0000000000..45df91a5e9 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-bpel/src/main/java/scatours/payment/PaymentLauncher.java @@ -0,0 +1,53 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package scatours.payment; + +import static scatours.launcher.LauncherUtil.locate; + +import org.apache.tuscany.sca.node.SCAClient; +import org.apache.tuscany.sca.node.SCANode; +import org.apache.tuscany.sca.node.SCANodeFactory; + +import com.tuscanyscatours.payment.Payment; + +public class PaymentLauncher { + + public static void main(String[] args) throws Exception { + SCANode node = SCANodeFactory.newInstance().createSCANode(null, + locate("payment-bpel-process"), + locate("payment-bpel"), + locate("creditcard-payment-jaxb"), + locate("emailgateway")); + node.start(); + + SCAClient client = (SCAClient)node; + Payment payment = client.getService(Payment.class, "Payment/paymentPartnerLink"); + + System.out.println("Payment BPEL test"); + System.out.println("\nSuccessful Payment - Status = \n\n" + payment.makePaymentMember("c-0", 100.00f)); + System.out.println("\n\nFailed Payment - Status = \n\n" + payment.makePaymentMember("c-1", 100.00f)); + + node.stop(); + + // The following line is a workaround for TUSCANY-3475 when running + // on Tuscany SCA 1.6 (the JVM waits for 60 seconds before exiting). + System.exit(0); + } +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-groovy/build.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-groovy/build.xml new file mode 100644 index 0000000000..17bd0943a0 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-groovy/build.xml @@ -0,0 +1,35 @@ +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> + +<project name="scatours-launcher-payment-groovy" default="compile"> + <import file="../../antdefs.xml"/> + <path id="compile-path"> + <pathelement path="../../util/launcher-common/target/scatours-util-launcher-common.jar"/> + </path> + + <target name="run"> + <java classname="scatours.payment.PaymentLauncher" fork="true" failonerror="true"> + <classpath> + <pathelement location="target/${ant.project.name}.jar"/> + <path refid="compile-path"/> + <pathelement location="${env.TUSCANY_HOME}/lib/tuscany-sca-manifest.jar"/> + </classpath> + </java> + </target> +</project> diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-groovy/pom.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-groovy/pom.xml new file mode 100644 index 0000000000..b46c58001c --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-groovy/pom.xml @@ -0,0 +1,122 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<project> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>scatours</artifactId> + <version>1.0-SNAPSHOT</version> + <relativePath>../../pom.xml</relativePath> + </parent><version>1.0-SNAPSHOT</version> + <artifactId>scatours-launcher-payment-groovy</artifactId> + <name>Apache Tuscany SCA Tours Payment Groovy Launcher</name> + + <dependencies> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>scatours-util-launcher-common</artifactId> + <version>${pom.version}</version> + <scope>provided</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-node-api</artifactId> + <version>${tuscany.version}</version> + </dependency> + + <dependency> + <groupId>javax.xml.bind</groupId> + <artifactId>jaxb-api</artifactId> + <version>2.1</version> + </dependency> + + <dependency> + <groupId>javax.xml.ws</groupId> + <artifactId>jaxws-api</artifactId> + <version>2.1</version> + <exclusions> + <exclusion> + <groupId>javax.xml.soap</groupId> + <artifactId>saaj-api</artifactId> + </exclusion> + </exclusions> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-node-impl</artifactId> + <version>${tuscany.version}</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-implementation-java-runtime</artifactId> + <version>${tuscany.version}</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-implementation-script</artifactId> + <version>${tuscany.version}</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-binding-ws-axis2</artifactId> + <version>${tuscany.version}</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-host-jetty</artifactId> + <version>${tuscany.version}</version> + <scope>runtime</scope> + </dependency> + </dependencies> + + <build> + <finalName>${artifactId}</finalName> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-jar-plugin</artifactId> + <version>2.2</version> + <configuration> + <archive> + <manifestEntries> + <Class-Path>../util/scatours-util-launcher-common.jar</Class-Path> + </manifestEntries> + <manifest> + <addClasspath>${scatours.selfContained}</addClasspath> + <classpathPrefix>../lib/</classpathPrefix> + <mainClass>scatours.payment.PaymentLauncher</mainClass> + </manifest> + </archive> + </configuration> + </plugin> + </plugins> + </build> +</project> diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-groovy/src/main/java/com/tuscanyscatours/emailgateway/EmailGateway.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-groovy/src/main/java/com/tuscanyscatours/emailgateway/EmailGateway.java new file mode 100644 index 0000000000..0e4e9726de --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-groovy/src/main/java/com/tuscanyscatours/emailgateway/EmailGateway.java @@ -0,0 +1,40 @@ + +package com.tuscanyscatours.emailgateway; + +import javax.jws.WebMethod; +import javax.jws.WebParam; +import javax.jws.WebResult; +import javax.jws.WebService; +import javax.xml.bind.annotation.XmlSeeAlso; +import javax.xml.ws.RequestWrapper; +import javax.xml.ws.ResponseWrapper; + + +/** + * This class was generated by the JAX-WS RI. + * JAX-WS RI 2.1.7-b01- + * Generated source version: 2.1 + * + */ +@WebService(name = "EmailGateway", targetNamespace = "http://www.tuscanyscatours.com/EmailGateway/") +@XmlSeeAlso({ + ObjectFactory.class +}) +public interface EmailGateway { + + + /** + * + * @param email + * @return + * returns java.lang.String + */ + @WebMethod(action = "http://www.tuscanyscatours.com/EmailGateway/sendEmail") + @WebResult(name = "Status", targetNamespace = "") + @RequestWrapper(localName = "sendEmail", targetNamespace = "http://www.tuscanyscatours.com/EmailGateway/", className = "com.tuscanyscatours.emailgateway.SendEmailType") + @ResponseWrapper(localName = "sendEmailResponse", targetNamespace = "http://www.tuscanyscatours.com/EmailGateway/", className = "com.tuscanyscatours.emailgateway.SendEmailResponseType") + public String sendEmail( + @WebParam(name = "Email", targetNamespace = "") + EmailType email); + +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-groovy/src/main/java/com/tuscanyscatours/emailgateway/EmailGatewayService.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-groovy/src/main/java/com/tuscanyscatours/emailgateway/EmailGatewayService.java new file mode 100644 index 0000000000..8f87855dd9 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-groovy/src/main/java/com/tuscanyscatours/emailgateway/EmailGatewayService.java @@ -0,0 +1,71 @@ + +package com.tuscanyscatours.emailgateway; + +import java.net.MalformedURLException; +import java.net.URL; +import java.util.logging.Logger; +import javax.xml.namespace.QName; +import javax.xml.ws.Service; +import javax.xml.ws.WebEndpoint; +import javax.xml.ws.WebServiceClient; +import javax.xml.ws.WebServiceFeature; + + +/** + * This class was generated by the JAX-WS RI. + * JAX-WS RI 2.1.7-b01- + * Generated source version: 2.1 + * + */ +@WebServiceClient(name = "EmailGatewayService", targetNamespace = "http://www.tuscanyscatours.com/EmailGateway/", wsdlLocation = "file:/C:/simon/tuscany/travelsample/contributions/payment-groovy/src/main/resources/EmailGateway.wsdl") +public class EmailGatewayService + extends Service +{ + + private final static URL EMAILGATEWAYSERVICE_WSDL_LOCATION; + private final static Logger logger = Logger.getLogger(com.tuscanyscatours.emailgateway.EmailGatewayService.class.getName()); + + static { + URL url = null; + try { + URL baseUrl; + baseUrl = com.tuscanyscatours.emailgateway.EmailGatewayService.class.getResource("."); + url = new URL(baseUrl, "file:/C:/simon/tuscany/travelsample/contributions/payment-groovy/src/main/resources/EmailGateway.wsdl"); + } catch (MalformedURLException e) { + logger.warning("Failed to create URL for the wsdl Location: 'file:/C:/simon/tuscany/travelsample/contributions/payment-groovy/src/main/resources/EmailGateway.wsdl', retrying as a local file"); + logger.warning(e.getMessage()); + } + EMAILGATEWAYSERVICE_WSDL_LOCATION = url; + } + + public EmailGatewayService(URL wsdlLocation, QName serviceName) { + super(wsdlLocation, serviceName); + } + + public EmailGatewayService() { + super(EMAILGATEWAYSERVICE_WSDL_LOCATION, new QName("http://www.tuscanyscatours.com/EmailGateway/", "EmailGatewayService")); + } + + /** + * + * @return + * returns EmailGateway + */ + @WebEndpoint(name = "EmailGatewayPort") + public EmailGateway getEmailGatewayPort() { + return super.getPort(new QName("http://www.tuscanyscatours.com/EmailGateway/", "EmailGatewayPort"), EmailGateway.class); + } + + /** + * + * @param features + * A list of {@link javax.xml.ws.WebServiceFeature} to configure on the proxy. Supported features not in the <code>features</code> parameter will have their default values. + * @return + * returns EmailGateway + */ + @WebEndpoint(name = "EmailGatewayPort") + public EmailGateway getEmailGatewayPort(WebServiceFeature... features) { + return super.getPort(new QName("http://www.tuscanyscatours.com/EmailGateway/", "EmailGatewayPort"), EmailGateway.class, features); + } + +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-groovy/src/main/java/com/tuscanyscatours/emailgateway/EmailType.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-groovy/src/main/java/com/tuscanyscatours/emailgateway/EmailType.java new file mode 100644 index 0000000000..25935d2303 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-groovy/src/main/java/com/tuscanyscatours/emailgateway/EmailType.java @@ -0,0 +1,118 @@ + +package com.tuscanyscatours.emailgateway; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + + +/** + * <p>Java class for EmailType complex type. + * + * <p>The following schema fragment specifies the expected content contained within this class. + * + * <pre> + * <complexType name="EmailType"> + * <complexContent> + * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> + * <sequence> + * <element name="To" type="{http://www.w3.org/2001/XMLSchema}string"/> + * <element name="Title" type="{http://www.w3.org/2001/XMLSchema}string"/> + * <element name="Body" type="{http://www.w3.org/2001/XMLSchema}string"/> + * </sequence> + * </restriction> + * </complexContent> + * </complexType> + * </pre> + * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "EmailType", propOrder = { + "to", + "title", + "body" +}) +public class EmailType { + + @XmlElement(name = "To", required = true) + protected String to; + @XmlElement(name = "Title", required = true) + protected String title; + @XmlElement(name = "Body", required = true) + protected String body; + + /** + * Gets the value of the to property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getTo() { + return to; + } + + /** + * Sets the value of the to property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setTo(String value) { + this.to = value; + } + + /** + * Gets the value of the title property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getTitle() { + return title; + } + + /** + * Sets the value of the title property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setTitle(String value) { + this.title = value; + } + + /** + * Gets the value of the body property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getBody() { + return body; + } + + /** + * Sets the value of the body property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setBody(String value) { + this.body = value; + } + +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-groovy/src/main/java/com/tuscanyscatours/emailgateway/ObjectFactory.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-groovy/src/main/java/com/tuscanyscatours/emailgateway/ObjectFactory.java new file mode 100644 index 0000000000..f414bb3eb3 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-groovy/src/main/java/com/tuscanyscatours/emailgateway/ObjectFactory.java @@ -0,0 +1,79 @@ + +package com.tuscanyscatours.emailgateway; + +import javax.xml.bind.JAXBElement; +import javax.xml.bind.annotation.XmlElementDecl; +import javax.xml.bind.annotation.XmlRegistry; +import javax.xml.namespace.QName; + + +/** + * This object contains factory methods for each + * Java content interface and Java element interface + * generated in the com.tuscanyscatours.emailgateway package. + * <p>An ObjectFactory allows you to programatically + * construct new instances of the Java representation + * for XML content. The Java representation of XML + * content can consist of schema derived interfaces + * and classes representing the binding of schema + * type definitions, element declarations and model + * groups. Factory methods for each of these are + * provided in this class. + * + */ +@XmlRegistry +public class ObjectFactory { + + private final static QName _SendEmailResponse_QNAME = new QName("http://www.tuscanyscatours.com/EmailGateway/", "sendEmailResponse"); + private final static QName _SendEmail_QNAME = new QName("http://www.tuscanyscatours.com/EmailGateway/", "sendEmail"); + + /** + * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: com.tuscanyscatours.emailgateway + * + */ + public ObjectFactory() { + } + + /** + * Create an instance of {@link SendEmailType } + * + */ + public SendEmailType createSendEmailType() { + return new SendEmailType(); + } + + /** + * Create an instance of {@link EmailType } + * + */ + public EmailType createEmailType() { + return new EmailType(); + } + + /** + * Create an instance of {@link SendEmailResponseType } + * + */ + public SendEmailResponseType createSendEmailResponseType() { + return new SendEmailResponseType(); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link SendEmailResponseType }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://www.tuscanyscatours.com/EmailGateway/", name = "sendEmailResponse") + public JAXBElement<SendEmailResponseType> createSendEmailResponse(SendEmailResponseType value) { + return new JAXBElement<SendEmailResponseType>(_SendEmailResponse_QNAME, SendEmailResponseType.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link SendEmailType }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://www.tuscanyscatours.com/EmailGateway/", name = "sendEmail") + public JAXBElement<SendEmailType> createSendEmail(SendEmailType value) { + return new JAXBElement<SendEmailType>(_SendEmail_QNAME, SendEmailType.class, null, value); + } + +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-groovy/src/main/java/com/tuscanyscatours/emailgateway/SendEmailResponseType.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-groovy/src/main/java/com/tuscanyscatours/emailgateway/SendEmailResponseType.java new file mode 100644 index 0000000000..6d366b7554 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-groovy/src/main/java/com/tuscanyscatours/emailgateway/SendEmailResponseType.java @@ -0,0 +1,62 @@ + +package com.tuscanyscatours.emailgateway; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + + +/** + * <p>Java class for SendEmailResponseType complex type. + * + * <p>The following schema fragment specifies the expected content contained within this class. + * + * <pre> + * <complexType name="SendEmailResponseType"> + * <complexContent> + * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> + * <sequence> + * <element name="Status" type="{http://www.w3.org/2001/XMLSchema}string"/> + * </sequence> + * </restriction> + * </complexContent> + * </complexType> + * </pre> + * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "SendEmailResponseType", propOrder = { + "status" +}) +public class SendEmailResponseType { + + @XmlElement(name = "Status", required = true) + protected String status; + + /** + * Gets the value of the status property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getStatus() { + return status; + } + + /** + * Sets the value of the status property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setStatus(String value) { + this.status = value; + } + +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-groovy/src/main/java/com/tuscanyscatours/emailgateway/SendEmailType.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-groovy/src/main/java/com/tuscanyscatours/emailgateway/SendEmailType.java new file mode 100644 index 0000000000..cc8e15366c --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-groovy/src/main/java/com/tuscanyscatours/emailgateway/SendEmailType.java @@ -0,0 +1,62 @@ + +package com.tuscanyscatours.emailgateway; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + + +/** + * <p>Java class for SendEmailType complex type. + * + * <p>The following schema fragment specifies the expected content contained within this class. + * + * <pre> + * <complexType name="SendEmailType"> + * <complexContent> + * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> + * <sequence> + * <element name="Email" type="{http://www.tuscanyscatours.com/EmailGateway/}EmailType"/> + * </sequence> + * </restriction> + * </complexContent> + * </complexType> + * </pre> + * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "SendEmailType", propOrder = { + "email" +}) +public class SendEmailType { + + @XmlElement(name = "Email", required = true) + protected EmailType email; + + /** + * Gets the value of the email property. + * + * @return + * possible object is + * {@link EmailType } + * + */ + public EmailType getEmail() { + return email; + } + + /** + * Sets the value of the email property. + * + * @param value + * allowed object is + * {@link EmailType } + * + */ + public void setEmail(EmailType value) { + this.email = value; + } + +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-groovy/src/main/java/com/tuscanyscatours/emailgateway/package-info.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-groovy/src/main/java/com/tuscanyscatours/emailgateway/package-info.java new file mode 100644 index 0000000000..2c2d603ada --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-groovy/src/main/java/com/tuscanyscatours/emailgateway/package-info.java @@ -0,0 +1,2 @@ +@javax.xml.bind.annotation.XmlSchema(namespace = "http://www.tuscanyscatours.com/EmailGateway/") +package com.tuscanyscatours.emailgateway; diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-groovy/src/main/java/com/tuscanyscatours/payment/MakePaymentMemberResponseType.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-groovy/src/main/java/com/tuscanyscatours/payment/MakePaymentMemberResponseType.java new file mode 100644 index 0000000000..e5f3ef3cad --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-groovy/src/main/java/com/tuscanyscatours/payment/MakePaymentMemberResponseType.java @@ -0,0 +1,62 @@ + +package com.tuscanyscatours.payment; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + + +/** + * <p>Java class for MakePaymentMemberResponseType complex type. + * + * <p>The following schema fragment specifies the expected content contained within this class. + * + * <pre> + * <complexType name="MakePaymentMemberResponseType"> + * <complexContent> + * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> + * <sequence> + * <element name="Status" type="{http://www.w3.org/2001/XMLSchema}string"/> + * </sequence> + * </restriction> + * </complexContent> + * </complexType> + * </pre> + * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "MakePaymentMemberResponseType", propOrder = { + "status" +}) +public class MakePaymentMemberResponseType { + + @XmlElement(name = "Status", required = true) + protected String status; + + /** + * Gets the value of the status property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getStatus() { + return status; + } + + /** + * Sets the value of the status property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setStatus(String value) { + this.status = value; + } + +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-groovy/src/main/java/com/tuscanyscatours/payment/MakePaymentMemberType.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-groovy/src/main/java/com/tuscanyscatours/payment/MakePaymentMemberType.java new file mode 100644 index 0000000000..ca94d86628 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-groovy/src/main/java/com/tuscanyscatours/payment/MakePaymentMemberType.java @@ -0,0 +1,82 @@ + +package com.tuscanyscatours.payment; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + + +/** + * <p>Java class for MakePaymentMemberType complex type. + * + * <p>The following schema fragment specifies the expected content contained within this class. + * + * <pre> + * <complexType name="MakePaymentMemberType"> + * <complexContent> + * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> + * <sequence> + * <element name="CustomerId" type="{http://www.w3.org/2001/XMLSchema}string"/> + * <element name="Amount" type="{http://www.w3.org/2001/XMLSchema}float"/> + * </sequence> + * </restriction> + * </complexContent> + * </complexType> + * </pre> + * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "MakePaymentMemberType", propOrder = { + "customerId", + "amount" +}) +public class MakePaymentMemberType { + + @XmlElement(name = "CustomerId", required = true) + protected String customerId; + @XmlElement(name = "Amount") + protected float amount; + + /** + * Gets the value of the customerId property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCustomerId() { + return customerId; + } + + /** + * Sets the value of the customerId property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCustomerId(String value) { + this.customerId = value; + } + + /** + * Gets the value of the amount property. + * + */ + public float getAmount() { + return amount; + } + + /** + * Sets the value of the amount property. + * + */ + public void setAmount(float value) { + this.amount = value; + } + +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-groovy/src/main/java/com/tuscanyscatours/payment/ObjectFactory.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-groovy/src/main/java/com/tuscanyscatours/payment/ObjectFactory.java new file mode 100644 index 0000000000..b069b2ba94 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-groovy/src/main/java/com/tuscanyscatours/payment/ObjectFactory.java @@ -0,0 +1,71 @@ + +package com.tuscanyscatours.payment; + +import javax.xml.bind.JAXBElement; +import javax.xml.bind.annotation.XmlElementDecl; +import javax.xml.bind.annotation.XmlRegistry; +import javax.xml.namespace.QName; + + +/** + * This object contains factory methods for each + * Java content interface and Java element interface + * generated in the com.tuscanyscatours.payment package. + * <p>An ObjectFactory allows you to programatically + * construct new instances of the Java representation + * for XML content. The Java representation of XML + * content can consist of schema derived interfaces + * and classes representing the binding of schema + * type definitions, element declarations and model + * groups. Factory methods for each of these are + * provided in this class. + * + */ +@XmlRegistry +public class ObjectFactory { + + private final static QName _MakePaymentMember_QNAME = new QName("http://www.tuscanyscatours.com/Payment/", "makePaymentMember"); + private final static QName _MakePaymentMemberResponse_QNAME = new QName("http://www.tuscanyscatours.com/Payment/", "makePaymentMemberResponse"); + + /** + * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: com.tuscanyscatours.payment + * + */ + public ObjectFactory() { + } + + /** + * Create an instance of {@link MakePaymentMemberResponseType } + * + */ + public MakePaymentMemberResponseType createMakePaymentMemberResponseType() { + return new MakePaymentMemberResponseType(); + } + + /** + * Create an instance of {@link MakePaymentMemberType } + * + */ + public MakePaymentMemberType createMakePaymentMemberType() { + return new MakePaymentMemberType(); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link MakePaymentMemberType }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://www.tuscanyscatours.com/Payment/", name = "makePaymentMember") + public JAXBElement<MakePaymentMemberType> createMakePaymentMember(MakePaymentMemberType value) { + return new JAXBElement<MakePaymentMemberType>(_MakePaymentMember_QNAME, MakePaymentMemberType.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link MakePaymentMemberResponseType }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://www.tuscanyscatours.com/Payment/", name = "makePaymentMemberResponse") + public JAXBElement<MakePaymentMemberResponseType> createMakePaymentMemberResponse(MakePaymentMemberResponseType value) { + return new JAXBElement<MakePaymentMemberResponseType>(_MakePaymentMemberResponse_QNAME, MakePaymentMemberResponseType.class, null, value); + } + +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-groovy/src/main/java/com/tuscanyscatours/payment/Payment.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-groovy/src/main/java/com/tuscanyscatours/payment/Payment.java new file mode 100644 index 0000000000..bbbd03d89a --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-groovy/src/main/java/com/tuscanyscatours/payment/Payment.java @@ -0,0 +1,43 @@ + +package com.tuscanyscatours.payment; + +import javax.jws.WebMethod; +import javax.jws.WebParam; +import javax.jws.WebResult; +import javax.jws.WebService; +import javax.xml.bind.annotation.XmlSeeAlso; +import javax.xml.ws.RequestWrapper; +import javax.xml.ws.ResponseWrapper; + + +/** + * This class was generated by the JAX-WS RI. + * JAX-WS RI 2.1.7-b01- + * Generated source version: 2.1 + * + */ +@WebService(name = "Payment", targetNamespace = "http://www.tuscanyscatours.com/Payment/") +@XmlSeeAlso({ + ObjectFactory.class +}) +public interface Payment { + + + /** + * + * @param amount + * @param customerId + * @return + * returns java.lang.String + */ + @WebMethod(action = "http://www.tuscanyscatours.com/Payment/makePayment") + @WebResult(name = "Status", targetNamespace = "") + @RequestWrapper(localName = "makePaymentMember", targetNamespace = "http://www.tuscanyscatours.com/Payment/", className = "com.tuscanyscatours.payment.MakePaymentMemberType") + @ResponseWrapper(localName = "makePaymentMemberResponse", targetNamespace = "http://www.tuscanyscatours.com/Payment/", className = "com.tuscanyscatours.payment.MakePaymentMemberResponseType") + public String makePaymentMember( + @WebParam(name = "CustomerId", targetNamespace = "") + String customerId, + @WebParam(name = "Amount", targetNamespace = "") + float amount); + +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-groovy/src/main/java/com/tuscanyscatours/payment/PaymentService.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-groovy/src/main/java/com/tuscanyscatours/payment/PaymentService.java new file mode 100644 index 0000000000..a430175976 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-groovy/src/main/java/com/tuscanyscatours/payment/PaymentService.java @@ -0,0 +1,71 @@ + +package com.tuscanyscatours.payment; + +import java.net.MalformedURLException; +import java.net.URL; +import java.util.logging.Logger; +import javax.xml.namespace.QName; +import javax.xml.ws.Service; +import javax.xml.ws.WebEndpoint; +import javax.xml.ws.WebServiceClient; +import javax.xml.ws.WebServiceFeature; + + +/** + * This class was generated by the JAX-WS RI. + * JAX-WS RI 2.1.7-b01- + * Generated source version: 2.1 + * + */ +@WebServiceClient(name = "PaymentService", targetNamespace = "http://www.tuscanyscatours.com/Payment/", wsdlLocation = "file:/C:/simon/tuscany/travelsample/contributions/payment-java/src/main/resources/Payment.wsdl") +public class PaymentService + extends Service +{ + + private final static URL PAYMENTSERVICE_WSDL_LOCATION; + private final static Logger logger = Logger.getLogger(com.tuscanyscatours.payment.PaymentService.class.getName()); + + static { + URL url = null; + try { + URL baseUrl; + baseUrl = com.tuscanyscatours.payment.PaymentService.class.getResource("."); + url = new URL(baseUrl, "file:/C:/simon/tuscany/travelsample/contributions/payment-java/src/main/resources/Payment.wsdl"); + } catch (MalformedURLException e) { + logger.warning("Failed to create URL for the wsdl Location: 'file:/C:/simon/tuscany/travelsample/contributions/payment-java/src/main/resources/Payment.wsdl', retrying as a local file"); + logger.warning(e.getMessage()); + } + PAYMENTSERVICE_WSDL_LOCATION = url; + } + + public PaymentService(URL wsdlLocation, QName serviceName) { + super(wsdlLocation, serviceName); + } + + public PaymentService() { + super(PAYMENTSERVICE_WSDL_LOCATION, new QName("http://www.tuscanyscatours.com/Payment/", "PaymentService")); + } + + /** + * + * @return + * returns Payment + */ + @WebEndpoint(name = "PaymentPort") + public Payment getPaymentPort() { + return super.getPort(new QName("http://www.tuscanyscatours.com/Payment/", "PaymentPort"), Payment.class); + } + + /** + * + * @param features + * A list of {@link javax.xml.ws.WebServiceFeature} to configure on the proxy. Supported features not in the <code>features</code> parameter will have their default values. + * @return + * returns Payment + */ + @WebEndpoint(name = "PaymentPort") + public Payment getPaymentPort(WebServiceFeature... features) { + return super.getPort(new QName("http://www.tuscanyscatours.com/Payment/", "PaymentPort"), Payment.class, features); + } + +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-groovy/src/main/java/com/tuscanyscatours/payment/package-info.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-groovy/src/main/java/com/tuscanyscatours/payment/package-info.java new file mode 100644 index 0000000000..acd208f5c9 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-groovy/src/main/java/com/tuscanyscatours/payment/package-info.java @@ -0,0 +1,2 @@ +@javax.xml.bind.annotation.XmlSchema(namespace = "http://www.tuscanyscatours.com/Payment/") +package com.tuscanyscatours.payment; diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-groovy/src/main/java/scatours/payment/PaymentLauncher.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-groovy/src/main/java/scatours/payment/PaymentLauncher.java new file mode 100644 index 0000000000..8dbf39b514 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-groovy/src/main/java/scatours/payment/PaymentLauncher.java @@ -0,0 +1,47 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package scatours.payment; + +import static scatours.launcher.LauncherUtil.locate; + +import org.apache.tuscany.sca.node.SCAClient; +import org.apache.tuscany.sca.node.SCANode; +import org.apache.tuscany.sca.node.SCANodeFactory; + +import com.tuscanyscatours.payment.Payment; + +public class PaymentLauncher { + + public static void main(String[] args) throws Exception { + SCANode node = SCANodeFactory.newInstance().createSCANode(null, + locate("payment-groovy"), + locate("creditcard-payment-jaxb"), + locate("emailgateway")); + node.start(); + + SCAClient client = (SCAClient)node; + Payment payment = client.getService(Payment.class, "Payment"); + + System.out.println("Payment Groovy test"); + System.out.println("\nSuccessful Payment - Status = \n\n" + payment.makePaymentMember("c-0", 100.00f)); + + node.stop(); + } +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-java-callback/build.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-java-callback/build.xml new file mode 100644 index 0000000000..725a92e516 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-java-callback/build.xml @@ -0,0 +1,35 @@ +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> + +<project name="scatours-launcher-payment-java-callback" default="compile"> + <import file="../../antdefs.xml"/> + <path id="compile-path"> + <pathelement path="../../util/launcher-common/target/scatours-util-launcher-common.jar"/> + </path> + + <target name="run"> + <java classname="scatours.payment.PaymentLauncher" fork="true" failonerror="true"> + <classpath> + <pathelement location="target/${ant.project.name}.jar"/> + <path refid="compile-path"/> + <pathelement location="${env.TUSCANY_HOME}/lib/tuscany-sca-manifest.jar"/> + </classpath> + </java> + </target> +</project> diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-java-callback/pom.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-java-callback/pom.xml new file mode 100644 index 0000000000..d4ea82f62c --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-java-callback/pom.xml @@ -0,0 +1,115 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<project> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>scatours</artifactId> + <version>1.0-SNAPSHOT</version> + <relativePath>../../pom.xml</relativePath> + </parent><version>1.0-SNAPSHOT</version> + <artifactId>scatours-launcher-payment-java-callback</artifactId> + <name>Apache Tuscany SCA Tours Payment Java Callback Launcher</name> + + <dependencies> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>scatours-util-launcher-common</artifactId> + <version>${pom.version}</version> + <scope>provided</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-node-api</artifactId> + <version>${tuscany.version}</version> + </dependency> + + <dependency> + <groupId>javax.xml.bind</groupId> + <artifactId>jaxb-api</artifactId> + <version>2.1</version> + </dependency> + + <dependency> + <groupId>javax.xml.ws</groupId> + <artifactId>jaxws-api</artifactId> + <version>2.1</version> + <exclusions> + <exclusion> + <groupId>javax.xml.soap</groupId> + <artifactId>saaj-api</artifactId> + </exclusion> + </exclusions> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-node-impl</artifactId> + <version>${tuscany.version}</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-implementation-java-runtime</artifactId> + <version>${tuscany.version}</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-binding-ws-axis2</artifactId> + <version>${tuscany.version}</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-host-jetty</artifactId> + <version>${tuscany.version}</version> + <scope>runtime</scope> + </dependency> + </dependencies> + + <build> + <finalName>${artifactId}</finalName> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-jar-plugin</artifactId> + <version>2.2</version> + <configuration> + <archive> + <manifestEntries> + <Class-Path>../util/scatours-util-launcher-common.jar</Class-Path> + </manifestEntries> + <manifest> + <addClasspath>${scatours.selfContained}</addClasspath> + <classpathPrefix>../lib/</classpathPrefix> + <mainClass>scatours.payment.PaymentLauncher</mainClass> + </manifest> + </archive> + </configuration> + </plugin> + </plugins> + </build> +</project> diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-java-callback/src/main/java/com/tuscanyscatours/payment/MakePaymentMemberResponseType.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-java-callback/src/main/java/com/tuscanyscatours/payment/MakePaymentMemberResponseType.java new file mode 100644 index 0000000000..e5f3ef3cad --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-java-callback/src/main/java/com/tuscanyscatours/payment/MakePaymentMemberResponseType.java @@ -0,0 +1,62 @@ + +package com.tuscanyscatours.payment; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + + +/** + * <p>Java class for MakePaymentMemberResponseType complex type. + * + * <p>The following schema fragment specifies the expected content contained within this class. + * + * <pre> + * <complexType name="MakePaymentMemberResponseType"> + * <complexContent> + * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> + * <sequence> + * <element name="Status" type="{http://www.w3.org/2001/XMLSchema}string"/> + * </sequence> + * </restriction> + * </complexContent> + * </complexType> + * </pre> + * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "MakePaymentMemberResponseType", propOrder = { + "status" +}) +public class MakePaymentMemberResponseType { + + @XmlElement(name = "Status", required = true) + protected String status; + + /** + * Gets the value of the status property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getStatus() { + return status; + } + + /** + * Sets the value of the status property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setStatus(String value) { + this.status = value; + } + +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-java-callback/src/main/java/com/tuscanyscatours/payment/MakePaymentMemberType.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-java-callback/src/main/java/com/tuscanyscatours/payment/MakePaymentMemberType.java new file mode 100644 index 0000000000..ca94d86628 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-java-callback/src/main/java/com/tuscanyscatours/payment/MakePaymentMemberType.java @@ -0,0 +1,82 @@ + +package com.tuscanyscatours.payment; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + + +/** + * <p>Java class for MakePaymentMemberType complex type. + * + * <p>The following schema fragment specifies the expected content contained within this class. + * + * <pre> + * <complexType name="MakePaymentMemberType"> + * <complexContent> + * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> + * <sequence> + * <element name="CustomerId" type="{http://www.w3.org/2001/XMLSchema}string"/> + * <element name="Amount" type="{http://www.w3.org/2001/XMLSchema}float"/> + * </sequence> + * </restriction> + * </complexContent> + * </complexType> + * </pre> + * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "MakePaymentMemberType", propOrder = { + "customerId", + "amount" +}) +public class MakePaymentMemberType { + + @XmlElement(name = "CustomerId", required = true) + protected String customerId; + @XmlElement(name = "Amount") + protected float amount; + + /** + * Gets the value of the customerId property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCustomerId() { + return customerId; + } + + /** + * Sets the value of the customerId property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCustomerId(String value) { + this.customerId = value; + } + + /** + * Gets the value of the amount property. + * + */ + public float getAmount() { + return amount; + } + + /** + * Sets the value of the amount property. + * + */ + public void setAmount(float value) { + this.amount = value; + } + +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-java-callback/src/main/java/com/tuscanyscatours/payment/ObjectFactory.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-java-callback/src/main/java/com/tuscanyscatours/payment/ObjectFactory.java new file mode 100644 index 0000000000..b069b2ba94 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-java-callback/src/main/java/com/tuscanyscatours/payment/ObjectFactory.java @@ -0,0 +1,71 @@ + +package com.tuscanyscatours.payment; + +import javax.xml.bind.JAXBElement; +import javax.xml.bind.annotation.XmlElementDecl; +import javax.xml.bind.annotation.XmlRegistry; +import javax.xml.namespace.QName; + + +/** + * This object contains factory methods for each + * Java content interface and Java element interface + * generated in the com.tuscanyscatours.payment package. + * <p>An ObjectFactory allows you to programatically + * construct new instances of the Java representation + * for XML content. The Java representation of XML + * content can consist of schema derived interfaces + * and classes representing the binding of schema + * type definitions, element declarations and model + * groups. Factory methods for each of these are + * provided in this class. + * + */ +@XmlRegistry +public class ObjectFactory { + + private final static QName _MakePaymentMember_QNAME = new QName("http://www.tuscanyscatours.com/Payment/", "makePaymentMember"); + private final static QName _MakePaymentMemberResponse_QNAME = new QName("http://www.tuscanyscatours.com/Payment/", "makePaymentMemberResponse"); + + /** + * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: com.tuscanyscatours.payment + * + */ + public ObjectFactory() { + } + + /** + * Create an instance of {@link MakePaymentMemberResponseType } + * + */ + public MakePaymentMemberResponseType createMakePaymentMemberResponseType() { + return new MakePaymentMemberResponseType(); + } + + /** + * Create an instance of {@link MakePaymentMemberType } + * + */ + public MakePaymentMemberType createMakePaymentMemberType() { + return new MakePaymentMemberType(); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link MakePaymentMemberType }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://www.tuscanyscatours.com/Payment/", name = "makePaymentMember") + public JAXBElement<MakePaymentMemberType> createMakePaymentMember(MakePaymentMemberType value) { + return new JAXBElement<MakePaymentMemberType>(_MakePaymentMember_QNAME, MakePaymentMemberType.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link MakePaymentMemberResponseType }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://www.tuscanyscatours.com/Payment/", name = "makePaymentMemberResponse") + public JAXBElement<MakePaymentMemberResponseType> createMakePaymentMemberResponse(MakePaymentMemberResponseType value) { + return new JAXBElement<MakePaymentMemberResponseType>(_MakePaymentMemberResponse_QNAME, MakePaymentMemberResponseType.class, null, value); + } + +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-java-callback/src/main/java/com/tuscanyscatours/payment/Payment.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-java-callback/src/main/java/com/tuscanyscatours/payment/Payment.java new file mode 100644 index 0000000000..bbbd03d89a --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-java-callback/src/main/java/com/tuscanyscatours/payment/Payment.java @@ -0,0 +1,43 @@ + +package com.tuscanyscatours.payment; + +import javax.jws.WebMethod; +import javax.jws.WebParam; +import javax.jws.WebResult; +import javax.jws.WebService; +import javax.xml.bind.annotation.XmlSeeAlso; +import javax.xml.ws.RequestWrapper; +import javax.xml.ws.ResponseWrapper; + + +/** + * This class was generated by the JAX-WS RI. + * JAX-WS RI 2.1.7-b01- + * Generated source version: 2.1 + * + */ +@WebService(name = "Payment", targetNamespace = "http://www.tuscanyscatours.com/Payment/") +@XmlSeeAlso({ + ObjectFactory.class +}) +public interface Payment { + + + /** + * + * @param amount + * @param customerId + * @return + * returns java.lang.String + */ + @WebMethod(action = "http://www.tuscanyscatours.com/Payment/makePayment") + @WebResult(name = "Status", targetNamespace = "") + @RequestWrapper(localName = "makePaymentMember", targetNamespace = "http://www.tuscanyscatours.com/Payment/", className = "com.tuscanyscatours.payment.MakePaymentMemberType") + @ResponseWrapper(localName = "makePaymentMemberResponse", targetNamespace = "http://www.tuscanyscatours.com/Payment/", className = "com.tuscanyscatours.payment.MakePaymentMemberResponseType") + public String makePaymentMember( + @WebParam(name = "CustomerId", targetNamespace = "") + String customerId, + @WebParam(name = "Amount", targetNamespace = "") + float amount); + +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-java-callback/src/main/java/com/tuscanyscatours/payment/PaymentService.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-java-callback/src/main/java/com/tuscanyscatours/payment/PaymentService.java new file mode 100644 index 0000000000..a430175976 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-java-callback/src/main/java/com/tuscanyscatours/payment/PaymentService.java @@ -0,0 +1,71 @@ + +package com.tuscanyscatours.payment; + +import java.net.MalformedURLException; +import java.net.URL; +import java.util.logging.Logger; +import javax.xml.namespace.QName; +import javax.xml.ws.Service; +import javax.xml.ws.WebEndpoint; +import javax.xml.ws.WebServiceClient; +import javax.xml.ws.WebServiceFeature; + + +/** + * This class was generated by the JAX-WS RI. + * JAX-WS RI 2.1.7-b01- + * Generated source version: 2.1 + * + */ +@WebServiceClient(name = "PaymentService", targetNamespace = "http://www.tuscanyscatours.com/Payment/", wsdlLocation = "file:/C:/simon/tuscany/travelsample/contributions/payment-java/src/main/resources/Payment.wsdl") +public class PaymentService + extends Service +{ + + private final static URL PAYMENTSERVICE_WSDL_LOCATION; + private final static Logger logger = Logger.getLogger(com.tuscanyscatours.payment.PaymentService.class.getName()); + + static { + URL url = null; + try { + URL baseUrl; + baseUrl = com.tuscanyscatours.payment.PaymentService.class.getResource("."); + url = new URL(baseUrl, "file:/C:/simon/tuscany/travelsample/contributions/payment-java/src/main/resources/Payment.wsdl"); + } catch (MalformedURLException e) { + logger.warning("Failed to create URL for the wsdl Location: 'file:/C:/simon/tuscany/travelsample/contributions/payment-java/src/main/resources/Payment.wsdl', retrying as a local file"); + logger.warning(e.getMessage()); + } + PAYMENTSERVICE_WSDL_LOCATION = url; + } + + public PaymentService(URL wsdlLocation, QName serviceName) { + super(wsdlLocation, serviceName); + } + + public PaymentService() { + super(PAYMENTSERVICE_WSDL_LOCATION, new QName("http://www.tuscanyscatours.com/Payment/", "PaymentService")); + } + + /** + * + * @return + * returns Payment + */ + @WebEndpoint(name = "PaymentPort") + public Payment getPaymentPort() { + return super.getPort(new QName("http://www.tuscanyscatours.com/Payment/", "PaymentPort"), Payment.class); + } + + /** + * + * @param features + * A list of {@link javax.xml.ws.WebServiceFeature} to configure on the proxy. Supported features not in the <code>features</code> parameter will have their default values. + * @return + * returns Payment + */ + @WebEndpoint(name = "PaymentPort") + public Payment getPaymentPort(WebServiceFeature... features) { + return super.getPort(new QName("http://www.tuscanyscatours.com/Payment/", "PaymentPort"), Payment.class, features); + } + +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-java-callback/src/main/java/com/tuscanyscatours/payment/package-info.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-java-callback/src/main/java/com/tuscanyscatours/payment/package-info.java new file mode 100644 index 0000000000..acd208f5c9 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-java-callback/src/main/java/com/tuscanyscatours/payment/package-info.java @@ -0,0 +1,2 @@ +@javax.xml.bind.annotation.XmlSchema(namespace = "http://www.tuscanyscatours.com/Payment/") +package com.tuscanyscatours.payment; diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-java-callback/src/main/java/scatours/payment/PaymentLauncher.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-java-callback/src/main/java/scatours/payment/PaymentLauncher.java new file mode 100644 index 0000000000..41f78e4109 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-java-callback/src/main/java/scatours/payment/PaymentLauncher.java @@ -0,0 +1,73 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package scatours.payment; + +import static scatours.launcher.LauncherUtil.locate; + +import org.apache.tuscany.sca.node.SCAClient; +import org.apache.tuscany.sca.node.SCANode; +import org.apache.tuscany.sca.node.SCANodeFactory; + +import com.tuscanyscatours.payment.Payment; + +public class PaymentLauncher { + + public static void main(String[] args) throws Exception { + SCANode node = SCANodeFactory.newInstance().createSCANode(null, + locate("payment-java-callback")); + node.start(); + + SCAClient client = (SCAClient)node; + Payment payment1 = client.getService(Payment.class, "Payment1"); + Payment payment2 = client.getService(Payment.class, "Payment2"); + Payment paymentConfirm = client.getService(Payment.class, "PaymentConfirm"); + Payment paymentCallbackID = client.getService(Payment.class, "PaymentCallbackID"); + Payment paymentCallbackRedirect = client.getService(Payment.class, "PaymentCallbackRedirect"); + + System.out.println("==================================================="); + System.out.println("\n\nPayment1 under limit - Status = \n\n" + payment1.makePaymentMember("c-0", 100.00f)); + System.out.println("==================================================="); + System.out.println("\n\nPayment2 under limit - Status = \n\n" + payment2.makePaymentMember("c-0", 100.00f)); + System.out.println("==================================================="); + System.out.println("\n\nPayment1 over limit - Status = \n\n" + payment1.makePaymentMember("c-0", 1500.00f)); + System.out.println("==================================================="); + System.out.println("\n\nPayment2 over limit - Status = \n\n" + payment2.makePaymentMember("c-0", 1500.00f)); + System.out.println("==================================================="); + System.out.println("\n\nPayment2 using request context - Status = \n\n" + payment2.makePaymentMember("c-0", 20000.00f)); + System.out.println("==================================================="); + System.out.println("\n\nPaymentConfirm - Status = \n\n" + paymentConfirm.makePaymentMember("c-0", 20000.00f)); + System.out.println("==================================================="); + + // wait for longer that the asynch payment processing waits. + try { + Thread.sleep(2000); + } catch (Exception ex) { + // do nothing + } + + System.out.println("==================================================="); + System.out.println("\n\nPaymentCallbackID - Status = \n\n" + paymentCallbackID.makePaymentMember("c-0", 20000.00f)); + System.out.println("==================================================="); + System.out.println("\n\nPaymentCallbackRedirect - Status = \n\n" + paymentCallbackRedirect.makePaymentMember("c-0", 20000.00f)); + System.out.println("==================================================="); + + node.stop(); + } +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-java-policy/build.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-java-policy/build.xml new file mode 100644 index 0000000000..9579c408ff --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-java-policy/build.xml @@ -0,0 +1,35 @@ +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> + +<project name="scatours-launcher-payment-java-policy" default="compile"> + <import file="../../antdefs.xml"/> + <path id="compile-path"> + <pathelement path="../../util/launcher-common/target/scatours-util-launcher-common.jar"/> + </path> + + <target name="run"> + <java classname="scatours.payment.PaymentLauncher" fork="true" failonerror="true"> + <classpath> + <pathelement location="target/${ant.project.name}.jar"/> + <path refid="compile-path"/> + <pathelement location="${env.TUSCANY_HOME}/lib/tuscany-sca-manifest.jar"/> + </classpath> + </java> + </target> +</project> diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-java-policy/pom.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-java-policy/pom.xml new file mode 100644 index 0000000000..4d6823400c --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-java-policy/pom.xml @@ -0,0 +1,115 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<project> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>scatours</artifactId> + <version>1.0-SNAPSHOT</version> + <relativePath>../../pom.xml</relativePath> + </parent><version>1.0-SNAPSHOT</version> + <artifactId>scatours-launcher-payment-java-policy</artifactId> + <name>Apache Tuscany SCA Tours Payment Java Policy Launcher</name> + + <dependencies> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>scatours-util-launcher-common</artifactId> + <version>${pom.version}</version> + <scope>provided</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-node-api</artifactId> + <version>${tuscany.version}</version> + </dependency> + + <dependency> + <groupId>javax.xml.bind</groupId> + <artifactId>jaxb-api</artifactId> + <version>2.1</version> + </dependency> + + <dependency> + <groupId>javax.xml.ws</groupId> + <artifactId>jaxws-api</artifactId> + <version>2.1</version> + <exclusions> + <exclusion> + <groupId>javax.xml.soap</groupId> + <artifactId>saaj-api</artifactId> + </exclusion> + </exclusions> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-node-impl</artifactId> + <version>${tuscany.version}</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-implementation-java-runtime</artifactId> + <version>${tuscany.version}</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-binding-ws-axis2</artifactId> + <version>${tuscany.version}</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-host-jetty</artifactId> + <version>${tuscany.version}</version> + <scope>runtime</scope> + </dependency> + </dependencies> + + <build> + <finalName>${artifactId}</finalName> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-jar-plugin</artifactId> + <version>2.2</version> + <configuration> + <archive> + <manifestEntries> + <Class-Path>../util/scatours-util-launcher-common.jar</Class-Path> + </manifestEntries> + <manifest> + <addClasspath>${scatours.selfContained}</addClasspath> + <classpathPrefix>../lib/</classpathPrefix> + <mainClass>scatours.payment.PaymentLauncher</mainClass> + </manifest> + </archive> + </configuration> + </plugin> + </plugins> + </build> +</project> diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-java-policy/src/main/java/com/tuscanyscatours/payment/MakePaymentMemberResponseType.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-java-policy/src/main/java/com/tuscanyscatours/payment/MakePaymentMemberResponseType.java new file mode 100644 index 0000000000..e5f3ef3cad --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-java-policy/src/main/java/com/tuscanyscatours/payment/MakePaymentMemberResponseType.java @@ -0,0 +1,62 @@ + +package com.tuscanyscatours.payment; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + + +/** + * <p>Java class for MakePaymentMemberResponseType complex type. + * + * <p>The following schema fragment specifies the expected content contained within this class. + * + * <pre> + * <complexType name="MakePaymentMemberResponseType"> + * <complexContent> + * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> + * <sequence> + * <element name="Status" type="{http://www.w3.org/2001/XMLSchema}string"/> + * </sequence> + * </restriction> + * </complexContent> + * </complexType> + * </pre> + * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "MakePaymentMemberResponseType", propOrder = { + "status" +}) +public class MakePaymentMemberResponseType { + + @XmlElement(name = "Status", required = true) + protected String status; + + /** + * Gets the value of the status property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getStatus() { + return status; + } + + /** + * Sets the value of the status property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setStatus(String value) { + this.status = value; + } + +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-java-policy/src/main/java/com/tuscanyscatours/payment/MakePaymentMemberType.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-java-policy/src/main/java/com/tuscanyscatours/payment/MakePaymentMemberType.java new file mode 100644 index 0000000000..ca94d86628 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-java-policy/src/main/java/com/tuscanyscatours/payment/MakePaymentMemberType.java @@ -0,0 +1,82 @@ + +package com.tuscanyscatours.payment; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + + +/** + * <p>Java class for MakePaymentMemberType complex type. + * + * <p>The following schema fragment specifies the expected content contained within this class. + * + * <pre> + * <complexType name="MakePaymentMemberType"> + * <complexContent> + * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> + * <sequence> + * <element name="CustomerId" type="{http://www.w3.org/2001/XMLSchema}string"/> + * <element name="Amount" type="{http://www.w3.org/2001/XMLSchema}float"/> + * </sequence> + * </restriction> + * </complexContent> + * </complexType> + * </pre> + * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "MakePaymentMemberType", propOrder = { + "customerId", + "amount" +}) +public class MakePaymentMemberType { + + @XmlElement(name = "CustomerId", required = true) + protected String customerId; + @XmlElement(name = "Amount") + protected float amount; + + /** + * Gets the value of the customerId property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCustomerId() { + return customerId; + } + + /** + * Sets the value of the customerId property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCustomerId(String value) { + this.customerId = value; + } + + /** + * Gets the value of the amount property. + * + */ + public float getAmount() { + return amount; + } + + /** + * Sets the value of the amount property. + * + */ + public void setAmount(float value) { + this.amount = value; + } + +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-java-policy/src/main/java/com/tuscanyscatours/payment/ObjectFactory.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-java-policy/src/main/java/com/tuscanyscatours/payment/ObjectFactory.java new file mode 100644 index 0000000000..b069b2ba94 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-java-policy/src/main/java/com/tuscanyscatours/payment/ObjectFactory.java @@ -0,0 +1,71 @@ + +package com.tuscanyscatours.payment; + +import javax.xml.bind.JAXBElement; +import javax.xml.bind.annotation.XmlElementDecl; +import javax.xml.bind.annotation.XmlRegistry; +import javax.xml.namespace.QName; + + +/** + * This object contains factory methods for each + * Java content interface and Java element interface + * generated in the com.tuscanyscatours.payment package. + * <p>An ObjectFactory allows you to programatically + * construct new instances of the Java representation + * for XML content. The Java representation of XML + * content can consist of schema derived interfaces + * and classes representing the binding of schema + * type definitions, element declarations and model + * groups. Factory methods for each of these are + * provided in this class. + * + */ +@XmlRegistry +public class ObjectFactory { + + private final static QName _MakePaymentMember_QNAME = new QName("http://www.tuscanyscatours.com/Payment/", "makePaymentMember"); + private final static QName _MakePaymentMemberResponse_QNAME = new QName("http://www.tuscanyscatours.com/Payment/", "makePaymentMemberResponse"); + + /** + * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: com.tuscanyscatours.payment + * + */ + public ObjectFactory() { + } + + /** + * Create an instance of {@link MakePaymentMemberResponseType } + * + */ + public MakePaymentMemberResponseType createMakePaymentMemberResponseType() { + return new MakePaymentMemberResponseType(); + } + + /** + * Create an instance of {@link MakePaymentMemberType } + * + */ + public MakePaymentMemberType createMakePaymentMemberType() { + return new MakePaymentMemberType(); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link MakePaymentMemberType }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://www.tuscanyscatours.com/Payment/", name = "makePaymentMember") + public JAXBElement<MakePaymentMemberType> createMakePaymentMember(MakePaymentMemberType value) { + return new JAXBElement<MakePaymentMemberType>(_MakePaymentMember_QNAME, MakePaymentMemberType.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link MakePaymentMemberResponseType }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://www.tuscanyscatours.com/Payment/", name = "makePaymentMemberResponse") + public JAXBElement<MakePaymentMemberResponseType> createMakePaymentMemberResponse(MakePaymentMemberResponseType value) { + return new JAXBElement<MakePaymentMemberResponseType>(_MakePaymentMemberResponse_QNAME, MakePaymentMemberResponseType.class, null, value); + } + +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-java-policy/src/main/java/com/tuscanyscatours/payment/Payment.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-java-policy/src/main/java/com/tuscanyscatours/payment/Payment.java new file mode 100644 index 0000000000..bbbd03d89a --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-java-policy/src/main/java/com/tuscanyscatours/payment/Payment.java @@ -0,0 +1,43 @@ + +package com.tuscanyscatours.payment; + +import javax.jws.WebMethod; +import javax.jws.WebParam; +import javax.jws.WebResult; +import javax.jws.WebService; +import javax.xml.bind.annotation.XmlSeeAlso; +import javax.xml.ws.RequestWrapper; +import javax.xml.ws.ResponseWrapper; + + +/** + * This class was generated by the JAX-WS RI. + * JAX-WS RI 2.1.7-b01- + * Generated source version: 2.1 + * + */ +@WebService(name = "Payment", targetNamespace = "http://www.tuscanyscatours.com/Payment/") +@XmlSeeAlso({ + ObjectFactory.class +}) +public interface Payment { + + + /** + * + * @param amount + * @param customerId + * @return + * returns java.lang.String + */ + @WebMethod(action = "http://www.tuscanyscatours.com/Payment/makePayment") + @WebResult(name = "Status", targetNamespace = "") + @RequestWrapper(localName = "makePaymentMember", targetNamespace = "http://www.tuscanyscatours.com/Payment/", className = "com.tuscanyscatours.payment.MakePaymentMemberType") + @ResponseWrapper(localName = "makePaymentMemberResponse", targetNamespace = "http://www.tuscanyscatours.com/Payment/", className = "com.tuscanyscatours.payment.MakePaymentMemberResponseType") + public String makePaymentMember( + @WebParam(name = "CustomerId", targetNamespace = "") + String customerId, + @WebParam(name = "Amount", targetNamespace = "") + float amount); + +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-java-policy/src/main/java/com/tuscanyscatours/payment/PaymentService.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-java-policy/src/main/java/com/tuscanyscatours/payment/PaymentService.java new file mode 100644 index 0000000000..a430175976 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-java-policy/src/main/java/com/tuscanyscatours/payment/PaymentService.java @@ -0,0 +1,71 @@ + +package com.tuscanyscatours.payment; + +import java.net.MalformedURLException; +import java.net.URL; +import java.util.logging.Logger; +import javax.xml.namespace.QName; +import javax.xml.ws.Service; +import javax.xml.ws.WebEndpoint; +import javax.xml.ws.WebServiceClient; +import javax.xml.ws.WebServiceFeature; + + +/** + * This class was generated by the JAX-WS RI. + * JAX-WS RI 2.1.7-b01- + * Generated source version: 2.1 + * + */ +@WebServiceClient(name = "PaymentService", targetNamespace = "http://www.tuscanyscatours.com/Payment/", wsdlLocation = "file:/C:/simon/tuscany/travelsample/contributions/payment-java/src/main/resources/Payment.wsdl") +public class PaymentService + extends Service +{ + + private final static URL PAYMENTSERVICE_WSDL_LOCATION; + private final static Logger logger = Logger.getLogger(com.tuscanyscatours.payment.PaymentService.class.getName()); + + static { + URL url = null; + try { + URL baseUrl; + baseUrl = com.tuscanyscatours.payment.PaymentService.class.getResource("."); + url = new URL(baseUrl, "file:/C:/simon/tuscany/travelsample/contributions/payment-java/src/main/resources/Payment.wsdl"); + } catch (MalformedURLException e) { + logger.warning("Failed to create URL for the wsdl Location: 'file:/C:/simon/tuscany/travelsample/contributions/payment-java/src/main/resources/Payment.wsdl', retrying as a local file"); + logger.warning(e.getMessage()); + } + PAYMENTSERVICE_WSDL_LOCATION = url; + } + + public PaymentService(URL wsdlLocation, QName serviceName) { + super(wsdlLocation, serviceName); + } + + public PaymentService() { + super(PAYMENTSERVICE_WSDL_LOCATION, new QName("http://www.tuscanyscatours.com/Payment/", "PaymentService")); + } + + /** + * + * @return + * returns Payment + */ + @WebEndpoint(name = "PaymentPort") + public Payment getPaymentPort() { + return super.getPort(new QName("http://www.tuscanyscatours.com/Payment/", "PaymentPort"), Payment.class); + } + + /** + * + * @param features + * A list of {@link javax.xml.ws.WebServiceFeature} to configure on the proxy. Supported features not in the <code>features</code> parameter will have their default values. + * @return + * returns Payment + */ + @WebEndpoint(name = "PaymentPort") + public Payment getPaymentPort(WebServiceFeature... features) { + return super.getPort(new QName("http://www.tuscanyscatours.com/Payment/", "PaymentPort"), Payment.class, features); + } + +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-java-policy/src/main/java/com/tuscanyscatours/payment/package-info.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-java-policy/src/main/java/com/tuscanyscatours/payment/package-info.java new file mode 100644 index 0000000000..acd208f5c9 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-java-policy/src/main/java/com/tuscanyscatours/payment/package-info.java @@ -0,0 +1,2 @@ +@javax.xml.bind.annotation.XmlSchema(namespace = "http://www.tuscanyscatours.com/Payment/") +package com.tuscanyscatours.payment; diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-java-policy/src/main/java/scatours/payment/PaymentLauncher.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-java-policy/src/main/java/scatours/payment/PaymentLauncher.java new file mode 100644 index 0000000000..e5bd98ff2b --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-java-policy/src/main/java/scatours/payment/PaymentLauncher.java @@ -0,0 +1,47 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package scatours.payment; + +import static scatours.launcher.LauncherUtil.locate; + +import org.apache.tuscany.sca.node.SCAClient; +import org.apache.tuscany.sca.node.SCANode; +import org.apache.tuscany.sca.node.SCANodeFactory; + +import com.tuscanyscatours.payment.Payment; + +public class PaymentLauncher { + + public static void main(String[] args) throws Exception { + SCANode node = SCANodeFactory.newInstance().createSCANode(null, + locate("payment-java-policy"), + locate("creditcard-payment-jaxb-policy")); + node.start(); + + SCAClient client = (SCAClient)node; + Payment payment = client.getService(Payment.class, "Payment"); + + System.out.println("Payment Java Policy test"); + System.out.println("\nSuccessful Payment - Status = \n\n" + payment.makePaymentMember("c-0", 100.00f)); + System.out.println("\n\nFailed Payment - Status = \n\n" + payment.makePaymentMember("c-1", 100.00f)); + + node.stop(); + } +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-java-reference-pass/build.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-java-reference-pass/build.xml new file mode 100644 index 0000000000..c61fe810a4 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-java-reference-pass/build.xml @@ -0,0 +1,35 @@ +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> + +<project name="scatours-launcher-payment-java-reference-pass" default="compile"> + <import file="../../antdefs.xml"/> + <path id="compile-path"> + <pathelement path="../../util/launcher-common/target/scatours-util-launcher-common.jar"/> + </path> + + <target name="run"> + <java classname="scatours.payment.PaymentLauncher" fork="true" failonerror="true"> + <classpath> + <pathelement location="target/${ant.project.name}.jar"/> + <path refid="compile-path"/> + <pathelement location="${env.TUSCANY_HOME}/lib/tuscany-sca-manifest.jar"/> + </classpath> + </java> + </target> +</project> diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-java-reference-pass/pom.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-java-reference-pass/pom.xml new file mode 100644 index 0000000000..6046fcab91 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-java-reference-pass/pom.xml @@ -0,0 +1,115 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<project> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>scatours</artifactId> + <version>1.0-SNAPSHOT</version> + <relativePath>../../pom.xml</relativePath> + </parent><version>1.0-SNAPSHOT</version> + <artifactId>scatours-launcher-payment-java-reference-pass</artifactId> + <name>Apache Tuscany SCA Tours Payment Java Callback Reference Pass</name> + + <dependencies> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>scatours-util-launcher-common</artifactId> + <version>${pom.version}</version> + <scope>provided</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-node-api</artifactId> + <version>${tuscany.version}</version> + </dependency> + + <dependency> + <groupId>javax.xml.bind</groupId> + <artifactId>jaxb-api</artifactId> + <version>2.1</version> + </dependency> + + <dependency> + <groupId>javax.xml.ws</groupId> + <artifactId>jaxws-api</artifactId> + <version>2.1</version> + <exclusions> + <exclusion> + <groupId>javax.xml.soap</groupId> + <artifactId>saaj-api</artifactId> + </exclusion> + </exclusions> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-node-impl</artifactId> + <version>${tuscany.version}</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-implementation-java-runtime</artifactId> + <version>${tuscany.version}</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-binding-ws-axis2</artifactId> + <version>${tuscany.version}</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-host-jetty</artifactId> + <version>${tuscany.version}</version> + <scope>runtime</scope> + </dependency> + </dependencies> + + <build> + <finalName>${artifactId}</finalName> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-jar-plugin</artifactId> + <version>2.2</version> + <configuration> + <archive> + <manifestEntries> + <Class-Path>../util/scatours-util-launcher-common.jar</Class-Path> + </manifestEntries> + <manifest> + <addClasspath>${scatours.selfContained}</addClasspath> + <classpathPrefix>../lib/</classpathPrefix> + <mainClass>scatours.payment.PaymentLauncher</mainClass> + </manifest> + </archive> + </configuration> + </plugin> + </plugins> + </build> +</project> diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-java-reference-pass/src/main/java/com/tuscanyscatours/payment/MakePaymentMemberResponseType.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-java-reference-pass/src/main/java/com/tuscanyscatours/payment/MakePaymentMemberResponseType.java new file mode 100644 index 0000000000..e5f3ef3cad --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-java-reference-pass/src/main/java/com/tuscanyscatours/payment/MakePaymentMemberResponseType.java @@ -0,0 +1,62 @@ + +package com.tuscanyscatours.payment; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + + +/** + * <p>Java class for MakePaymentMemberResponseType complex type. + * + * <p>The following schema fragment specifies the expected content contained within this class. + * + * <pre> + * <complexType name="MakePaymentMemberResponseType"> + * <complexContent> + * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> + * <sequence> + * <element name="Status" type="{http://www.w3.org/2001/XMLSchema}string"/> + * </sequence> + * </restriction> + * </complexContent> + * </complexType> + * </pre> + * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "MakePaymentMemberResponseType", propOrder = { + "status" +}) +public class MakePaymentMemberResponseType { + + @XmlElement(name = "Status", required = true) + protected String status; + + /** + * Gets the value of the status property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getStatus() { + return status; + } + + /** + * Sets the value of the status property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setStatus(String value) { + this.status = value; + } + +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-java-reference-pass/src/main/java/com/tuscanyscatours/payment/MakePaymentMemberType.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-java-reference-pass/src/main/java/com/tuscanyscatours/payment/MakePaymentMemberType.java new file mode 100644 index 0000000000..ca94d86628 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-java-reference-pass/src/main/java/com/tuscanyscatours/payment/MakePaymentMemberType.java @@ -0,0 +1,82 @@ + +package com.tuscanyscatours.payment; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + + +/** + * <p>Java class for MakePaymentMemberType complex type. + * + * <p>The following schema fragment specifies the expected content contained within this class. + * + * <pre> + * <complexType name="MakePaymentMemberType"> + * <complexContent> + * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> + * <sequence> + * <element name="CustomerId" type="{http://www.w3.org/2001/XMLSchema}string"/> + * <element name="Amount" type="{http://www.w3.org/2001/XMLSchema}float"/> + * </sequence> + * </restriction> + * </complexContent> + * </complexType> + * </pre> + * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "MakePaymentMemberType", propOrder = { + "customerId", + "amount" +}) +public class MakePaymentMemberType { + + @XmlElement(name = "CustomerId", required = true) + protected String customerId; + @XmlElement(name = "Amount") + protected float amount; + + /** + * Gets the value of the customerId property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCustomerId() { + return customerId; + } + + /** + * Sets the value of the customerId property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCustomerId(String value) { + this.customerId = value; + } + + /** + * Gets the value of the amount property. + * + */ + public float getAmount() { + return amount; + } + + /** + * Sets the value of the amount property. + * + */ + public void setAmount(float value) { + this.amount = value; + } + +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-java-reference-pass/src/main/java/com/tuscanyscatours/payment/ObjectFactory.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-java-reference-pass/src/main/java/com/tuscanyscatours/payment/ObjectFactory.java new file mode 100644 index 0000000000..b069b2ba94 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-java-reference-pass/src/main/java/com/tuscanyscatours/payment/ObjectFactory.java @@ -0,0 +1,71 @@ + +package com.tuscanyscatours.payment; + +import javax.xml.bind.JAXBElement; +import javax.xml.bind.annotation.XmlElementDecl; +import javax.xml.bind.annotation.XmlRegistry; +import javax.xml.namespace.QName; + + +/** + * This object contains factory methods for each + * Java content interface and Java element interface + * generated in the com.tuscanyscatours.payment package. + * <p>An ObjectFactory allows you to programatically + * construct new instances of the Java representation + * for XML content. The Java representation of XML + * content can consist of schema derived interfaces + * and classes representing the binding of schema + * type definitions, element declarations and model + * groups. Factory methods for each of these are + * provided in this class. + * + */ +@XmlRegistry +public class ObjectFactory { + + private final static QName _MakePaymentMember_QNAME = new QName("http://www.tuscanyscatours.com/Payment/", "makePaymentMember"); + private final static QName _MakePaymentMemberResponse_QNAME = new QName("http://www.tuscanyscatours.com/Payment/", "makePaymentMemberResponse"); + + /** + * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: com.tuscanyscatours.payment + * + */ + public ObjectFactory() { + } + + /** + * Create an instance of {@link MakePaymentMemberResponseType } + * + */ + public MakePaymentMemberResponseType createMakePaymentMemberResponseType() { + return new MakePaymentMemberResponseType(); + } + + /** + * Create an instance of {@link MakePaymentMemberType } + * + */ + public MakePaymentMemberType createMakePaymentMemberType() { + return new MakePaymentMemberType(); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link MakePaymentMemberType }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://www.tuscanyscatours.com/Payment/", name = "makePaymentMember") + public JAXBElement<MakePaymentMemberType> createMakePaymentMember(MakePaymentMemberType value) { + return new JAXBElement<MakePaymentMemberType>(_MakePaymentMember_QNAME, MakePaymentMemberType.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link MakePaymentMemberResponseType }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://www.tuscanyscatours.com/Payment/", name = "makePaymentMemberResponse") + public JAXBElement<MakePaymentMemberResponseType> createMakePaymentMemberResponse(MakePaymentMemberResponseType value) { + return new JAXBElement<MakePaymentMemberResponseType>(_MakePaymentMemberResponse_QNAME, MakePaymentMemberResponseType.class, null, value); + } + +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-java-reference-pass/src/main/java/com/tuscanyscatours/payment/Payment.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-java-reference-pass/src/main/java/com/tuscanyscatours/payment/Payment.java new file mode 100644 index 0000000000..bbbd03d89a --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-java-reference-pass/src/main/java/com/tuscanyscatours/payment/Payment.java @@ -0,0 +1,43 @@ + +package com.tuscanyscatours.payment; + +import javax.jws.WebMethod; +import javax.jws.WebParam; +import javax.jws.WebResult; +import javax.jws.WebService; +import javax.xml.bind.annotation.XmlSeeAlso; +import javax.xml.ws.RequestWrapper; +import javax.xml.ws.ResponseWrapper; + + +/** + * This class was generated by the JAX-WS RI. + * JAX-WS RI 2.1.7-b01- + * Generated source version: 2.1 + * + */ +@WebService(name = "Payment", targetNamespace = "http://www.tuscanyscatours.com/Payment/") +@XmlSeeAlso({ + ObjectFactory.class +}) +public interface Payment { + + + /** + * + * @param amount + * @param customerId + * @return + * returns java.lang.String + */ + @WebMethod(action = "http://www.tuscanyscatours.com/Payment/makePayment") + @WebResult(name = "Status", targetNamespace = "") + @RequestWrapper(localName = "makePaymentMember", targetNamespace = "http://www.tuscanyscatours.com/Payment/", className = "com.tuscanyscatours.payment.MakePaymentMemberType") + @ResponseWrapper(localName = "makePaymentMemberResponse", targetNamespace = "http://www.tuscanyscatours.com/Payment/", className = "com.tuscanyscatours.payment.MakePaymentMemberResponseType") + public String makePaymentMember( + @WebParam(name = "CustomerId", targetNamespace = "") + String customerId, + @WebParam(name = "Amount", targetNamespace = "") + float amount); + +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-java-reference-pass/src/main/java/com/tuscanyscatours/payment/PaymentService.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-java-reference-pass/src/main/java/com/tuscanyscatours/payment/PaymentService.java new file mode 100644 index 0000000000..a430175976 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-java-reference-pass/src/main/java/com/tuscanyscatours/payment/PaymentService.java @@ -0,0 +1,71 @@ + +package com.tuscanyscatours.payment; + +import java.net.MalformedURLException; +import java.net.URL; +import java.util.logging.Logger; +import javax.xml.namespace.QName; +import javax.xml.ws.Service; +import javax.xml.ws.WebEndpoint; +import javax.xml.ws.WebServiceClient; +import javax.xml.ws.WebServiceFeature; + + +/** + * This class was generated by the JAX-WS RI. + * JAX-WS RI 2.1.7-b01- + * Generated source version: 2.1 + * + */ +@WebServiceClient(name = "PaymentService", targetNamespace = "http://www.tuscanyscatours.com/Payment/", wsdlLocation = "file:/C:/simon/tuscany/travelsample/contributions/payment-java/src/main/resources/Payment.wsdl") +public class PaymentService + extends Service +{ + + private final static URL PAYMENTSERVICE_WSDL_LOCATION; + private final static Logger logger = Logger.getLogger(com.tuscanyscatours.payment.PaymentService.class.getName()); + + static { + URL url = null; + try { + URL baseUrl; + baseUrl = com.tuscanyscatours.payment.PaymentService.class.getResource("."); + url = new URL(baseUrl, "file:/C:/simon/tuscany/travelsample/contributions/payment-java/src/main/resources/Payment.wsdl"); + } catch (MalformedURLException e) { + logger.warning("Failed to create URL for the wsdl Location: 'file:/C:/simon/tuscany/travelsample/contributions/payment-java/src/main/resources/Payment.wsdl', retrying as a local file"); + logger.warning(e.getMessage()); + } + PAYMENTSERVICE_WSDL_LOCATION = url; + } + + public PaymentService(URL wsdlLocation, QName serviceName) { + super(wsdlLocation, serviceName); + } + + public PaymentService() { + super(PAYMENTSERVICE_WSDL_LOCATION, new QName("http://www.tuscanyscatours.com/Payment/", "PaymentService")); + } + + /** + * + * @return + * returns Payment + */ + @WebEndpoint(name = "PaymentPort") + public Payment getPaymentPort() { + return super.getPort(new QName("http://www.tuscanyscatours.com/Payment/", "PaymentPort"), Payment.class); + } + + /** + * + * @param features + * A list of {@link javax.xml.ws.WebServiceFeature} to configure on the proxy. Supported features not in the <code>features</code> parameter will have their default values. + * @return + * returns Payment + */ + @WebEndpoint(name = "PaymentPort") + public Payment getPaymentPort(WebServiceFeature... features) { + return super.getPort(new QName("http://www.tuscanyscatours.com/Payment/", "PaymentPort"), Payment.class, features); + } + +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-java-reference-pass/src/main/java/com/tuscanyscatours/payment/package-info.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-java-reference-pass/src/main/java/com/tuscanyscatours/payment/package-info.java new file mode 100644 index 0000000000..acd208f5c9 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-java-reference-pass/src/main/java/com/tuscanyscatours/payment/package-info.java @@ -0,0 +1,2 @@ +@javax.xml.bind.annotation.XmlSchema(namespace = "http://www.tuscanyscatours.com/Payment/") +package com.tuscanyscatours.payment; diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-java-reference-pass/src/main/java/scatours/payment/PaymentLauncher.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-java-reference-pass/src/main/java/scatours/payment/PaymentLauncher.java new file mode 100644 index 0000000000..5385eb342e --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-java-reference-pass/src/main/java/scatours/payment/PaymentLauncher.java @@ -0,0 +1,46 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package scatours.payment; + +import static scatours.launcher.LauncherUtil.locate; + +import org.apache.tuscany.sca.node.SCAClient; +import org.apache.tuscany.sca.node.SCANode; +import org.apache.tuscany.sca.node.SCANodeFactory; + +import com.tuscanyscatours.payment.Payment; + +public class PaymentLauncher { + + public static void main(String[] args) throws Exception { + SCANode node = SCANodeFactory.newInstance().createSCANode(null, + locate("payment-java-reference-pass")); + node.start(); + + SCAClient client = (SCAClient)node; + Payment payment = client.getService(Payment.class, "Payment"); + + System.out.println("==================================================="); + System.out.println("\n\nPayment - Status = \n\n" + payment.makePaymentMember("c-0", 100.00f)); + System.out.println("==================================================="); + + node.stop(); + } +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-java/build.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-java/build.xml new file mode 100644 index 0000000000..1e3c69119f --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-java/build.xml @@ -0,0 +1,35 @@ +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> + +<project name="scatours-launcher-payment-java" default="compile"> + <import file="../../antdefs.xml"/> + <path id="compile-path"> + <pathelement path="../../util/launcher-common/target/scatours-util-launcher-common.jar"/> + </path> + + <target name="run"> + <java classname="scatours.payment.PaymentLauncher" fork="true" failonerror="true"> + <classpath> + <pathelement location="target/${ant.project.name}.jar"/> + <path refid="compile-path"/> + <pathelement location="${env.TUSCANY_HOME}/lib/tuscany-sca-manifest.jar"/> + </classpath> + </java> + </target> +</project> diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-java/pom.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-java/pom.xml new file mode 100644 index 0000000000..2a2bb63532 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-java/pom.xml @@ -0,0 +1,115 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<project> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>scatours</artifactId> + <version>1.0-SNAPSHOT</version> + <relativePath>../../pom.xml</relativePath> + </parent><version>1.0-SNAPSHOT</version> + <artifactId>scatours-launcher-payment-java</artifactId> + <name>Apache Tuscany SCA Tours Payment Java Launcher</name> + + <dependencies> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>scatours-util-launcher-common</artifactId> + <version>${pom.version}</version> + <scope>provided</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-node-api</artifactId> + <version>${tuscany.version}</version> + </dependency> + + <dependency> + <groupId>javax.xml.bind</groupId> + <artifactId>jaxb-api</artifactId> + <version>2.1</version> + </dependency> + + <dependency> + <groupId>javax.xml.ws</groupId> + <artifactId>jaxws-api</artifactId> + <version>2.1</version> + <exclusions> + <exclusion> + <groupId>javax.xml.soap</groupId> + <artifactId>saaj-api</artifactId> + </exclusion> + </exclusions> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-node-impl</artifactId> + <version>${tuscany.version}</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-implementation-java-runtime</artifactId> + <version>${tuscany.version}</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-binding-ws-axis2</artifactId> + <version>${tuscany.version}</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-host-jetty</artifactId> + <version>${tuscany.version}</version> + <scope>runtime</scope> + </dependency> + </dependencies> + + <build> + <finalName>${artifactId}</finalName> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-jar-plugin</artifactId> + <version>2.2</version> + <configuration> + <archive> + <manifestEntries> + <Class-Path>../util/scatours-util-launcher-common.jar</Class-Path> + </manifestEntries> + <manifest> + <addClasspath>${scatours.selfContained}</addClasspath> + <classpathPrefix>../lib/</classpathPrefix> + <mainClass>scatours.payment.PaymentLauncher</mainClass> + </manifest> + </archive> + </configuration> + </plugin> + </plugins> + </build> +</project> diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-java/src/main/java/com/tuscanyscatours/payment/MakePaymentMemberResponseType.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-java/src/main/java/com/tuscanyscatours/payment/MakePaymentMemberResponseType.java new file mode 100644 index 0000000000..e5f3ef3cad --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-java/src/main/java/com/tuscanyscatours/payment/MakePaymentMemberResponseType.java @@ -0,0 +1,62 @@ + +package com.tuscanyscatours.payment; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + + +/** + * <p>Java class for MakePaymentMemberResponseType complex type. + * + * <p>The following schema fragment specifies the expected content contained within this class. + * + * <pre> + * <complexType name="MakePaymentMemberResponseType"> + * <complexContent> + * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> + * <sequence> + * <element name="Status" type="{http://www.w3.org/2001/XMLSchema}string"/> + * </sequence> + * </restriction> + * </complexContent> + * </complexType> + * </pre> + * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "MakePaymentMemberResponseType", propOrder = { + "status" +}) +public class MakePaymentMemberResponseType { + + @XmlElement(name = "Status", required = true) + protected String status; + + /** + * Gets the value of the status property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getStatus() { + return status; + } + + /** + * Sets the value of the status property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setStatus(String value) { + this.status = value; + } + +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-java/src/main/java/com/tuscanyscatours/payment/MakePaymentMemberType.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-java/src/main/java/com/tuscanyscatours/payment/MakePaymentMemberType.java new file mode 100644 index 0000000000..ca94d86628 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-java/src/main/java/com/tuscanyscatours/payment/MakePaymentMemberType.java @@ -0,0 +1,82 @@ + +package com.tuscanyscatours.payment; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + + +/** + * <p>Java class for MakePaymentMemberType complex type. + * + * <p>The following schema fragment specifies the expected content contained within this class. + * + * <pre> + * <complexType name="MakePaymentMemberType"> + * <complexContent> + * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> + * <sequence> + * <element name="CustomerId" type="{http://www.w3.org/2001/XMLSchema}string"/> + * <element name="Amount" type="{http://www.w3.org/2001/XMLSchema}float"/> + * </sequence> + * </restriction> + * </complexContent> + * </complexType> + * </pre> + * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "MakePaymentMemberType", propOrder = { + "customerId", + "amount" +}) +public class MakePaymentMemberType { + + @XmlElement(name = "CustomerId", required = true) + protected String customerId; + @XmlElement(name = "Amount") + protected float amount; + + /** + * Gets the value of the customerId property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCustomerId() { + return customerId; + } + + /** + * Sets the value of the customerId property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCustomerId(String value) { + this.customerId = value; + } + + /** + * Gets the value of the amount property. + * + */ + public float getAmount() { + return amount; + } + + /** + * Sets the value of the amount property. + * + */ + public void setAmount(float value) { + this.amount = value; + } + +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-java/src/main/java/com/tuscanyscatours/payment/ObjectFactory.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-java/src/main/java/com/tuscanyscatours/payment/ObjectFactory.java new file mode 100644 index 0000000000..b069b2ba94 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-java/src/main/java/com/tuscanyscatours/payment/ObjectFactory.java @@ -0,0 +1,71 @@ + +package com.tuscanyscatours.payment; + +import javax.xml.bind.JAXBElement; +import javax.xml.bind.annotation.XmlElementDecl; +import javax.xml.bind.annotation.XmlRegistry; +import javax.xml.namespace.QName; + + +/** + * This object contains factory methods for each + * Java content interface and Java element interface + * generated in the com.tuscanyscatours.payment package. + * <p>An ObjectFactory allows you to programatically + * construct new instances of the Java representation + * for XML content. The Java representation of XML + * content can consist of schema derived interfaces + * and classes representing the binding of schema + * type definitions, element declarations and model + * groups. Factory methods for each of these are + * provided in this class. + * + */ +@XmlRegistry +public class ObjectFactory { + + private final static QName _MakePaymentMember_QNAME = new QName("http://www.tuscanyscatours.com/Payment/", "makePaymentMember"); + private final static QName _MakePaymentMemberResponse_QNAME = new QName("http://www.tuscanyscatours.com/Payment/", "makePaymentMemberResponse"); + + /** + * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: com.tuscanyscatours.payment + * + */ + public ObjectFactory() { + } + + /** + * Create an instance of {@link MakePaymentMemberResponseType } + * + */ + public MakePaymentMemberResponseType createMakePaymentMemberResponseType() { + return new MakePaymentMemberResponseType(); + } + + /** + * Create an instance of {@link MakePaymentMemberType } + * + */ + public MakePaymentMemberType createMakePaymentMemberType() { + return new MakePaymentMemberType(); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link MakePaymentMemberType }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://www.tuscanyscatours.com/Payment/", name = "makePaymentMember") + public JAXBElement<MakePaymentMemberType> createMakePaymentMember(MakePaymentMemberType value) { + return new JAXBElement<MakePaymentMemberType>(_MakePaymentMember_QNAME, MakePaymentMemberType.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link MakePaymentMemberResponseType }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://www.tuscanyscatours.com/Payment/", name = "makePaymentMemberResponse") + public JAXBElement<MakePaymentMemberResponseType> createMakePaymentMemberResponse(MakePaymentMemberResponseType value) { + return new JAXBElement<MakePaymentMemberResponseType>(_MakePaymentMemberResponse_QNAME, MakePaymentMemberResponseType.class, null, value); + } + +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-java/src/main/java/com/tuscanyscatours/payment/Payment.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-java/src/main/java/com/tuscanyscatours/payment/Payment.java new file mode 100644 index 0000000000..bbbd03d89a --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-java/src/main/java/com/tuscanyscatours/payment/Payment.java @@ -0,0 +1,43 @@ + +package com.tuscanyscatours.payment; + +import javax.jws.WebMethod; +import javax.jws.WebParam; +import javax.jws.WebResult; +import javax.jws.WebService; +import javax.xml.bind.annotation.XmlSeeAlso; +import javax.xml.ws.RequestWrapper; +import javax.xml.ws.ResponseWrapper; + + +/** + * This class was generated by the JAX-WS RI. + * JAX-WS RI 2.1.7-b01- + * Generated source version: 2.1 + * + */ +@WebService(name = "Payment", targetNamespace = "http://www.tuscanyscatours.com/Payment/") +@XmlSeeAlso({ + ObjectFactory.class +}) +public interface Payment { + + + /** + * + * @param amount + * @param customerId + * @return + * returns java.lang.String + */ + @WebMethod(action = "http://www.tuscanyscatours.com/Payment/makePayment") + @WebResult(name = "Status", targetNamespace = "") + @RequestWrapper(localName = "makePaymentMember", targetNamespace = "http://www.tuscanyscatours.com/Payment/", className = "com.tuscanyscatours.payment.MakePaymentMemberType") + @ResponseWrapper(localName = "makePaymentMemberResponse", targetNamespace = "http://www.tuscanyscatours.com/Payment/", className = "com.tuscanyscatours.payment.MakePaymentMemberResponseType") + public String makePaymentMember( + @WebParam(name = "CustomerId", targetNamespace = "") + String customerId, + @WebParam(name = "Amount", targetNamespace = "") + float amount); + +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-java/src/main/java/com/tuscanyscatours/payment/PaymentService.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-java/src/main/java/com/tuscanyscatours/payment/PaymentService.java new file mode 100644 index 0000000000..a430175976 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-java/src/main/java/com/tuscanyscatours/payment/PaymentService.java @@ -0,0 +1,71 @@ + +package com.tuscanyscatours.payment; + +import java.net.MalformedURLException; +import java.net.URL; +import java.util.logging.Logger; +import javax.xml.namespace.QName; +import javax.xml.ws.Service; +import javax.xml.ws.WebEndpoint; +import javax.xml.ws.WebServiceClient; +import javax.xml.ws.WebServiceFeature; + + +/** + * This class was generated by the JAX-WS RI. + * JAX-WS RI 2.1.7-b01- + * Generated source version: 2.1 + * + */ +@WebServiceClient(name = "PaymentService", targetNamespace = "http://www.tuscanyscatours.com/Payment/", wsdlLocation = "file:/C:/simon/tuscany/travelsample/contributions/payment-java/src/main/resources/Payment.wsdl") +public class PaymentService + extends Service +{ + + private final static URL PAYMENTSERVICE_WSDL_LOCATION; + private final static Logger logger = Logger.getLogger(com.tuscanyscatours.payment.PaymentService.class.getName()); + + static { + URL url = null; + try { + URL baseUrl; + baseUrl = com.tuscanyscatours.payment.PaymentService.class.getResource("."); + url = new URL(baseUrl, "file:/C:/simon/tuscany/travelsample/contributions/payment-java/src/main/resources/Payment.wsdl"); + } catch (MalformedURLException e) { + logger.warning("Failed to create URL for the wsdl Location: 'file:/C:/simon/tuscany/travelsample/contributions/payment-java/src/main/resources/Payment.wsdl', retrying as a local file"); + logger.warning(e.getMessage()); + } + PAYMENTSERVICE_WSDL_LOCATION = url; + } + + public PaymentService(URL wsdlLocation, QName serviceName) { + super(wsdlLocation, serviceName); + } + + public PaymentService() { + super(PAYMENTSERVICE_WSDL_LOCATION, new QName("http://www.tuscanyscatours.com/Payment/", "PaymentService")); + } + + /** + * + * @return + * returns Payment + */ + @WebEndpoint(name = "PaymentPort") + public Payment getPaymentPort() { + return super.getPort(new QName("http://www.tuscanyscatours.com/Payment/", "PaymentPort"), Payment.class); + } + + /** + * + * @param features + * A list of {@link javax.xml.ws.WebServiceFeature} to configure on the proxy. Supported features not in the <code>features</code> parameter will have their default values. + * @return + * returns Payment + */ + @WebEndpoint(name = "PaymentPort") + public Payment getPaymentPort(WebServiceFeature... features) { + return super.getPort(new QName("http://www.tuscanyscatours.com/Payment/", "PaymentPort"), Payment.class, features); + } + +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-java/src/main/java/com/tuscanyscatours/payment/package-info.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-java/src/main/java/com/tuscanyscatours/payment/package-info.java new file mode 100644 index 0000000000..acd208f5c9 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-java/src/main/java/com/tuscanyscatours/payment/package-info.java @@ -0,0 +1,2 @@ +@javax.xml.bind.annotation.XmlSchema(namespace = "http://www.tuscanyscatours.com/Payment/") +package com.tuscanyscatours.payment; diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-java/src/main/java/scatours/payment/PaymentLauncher.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-java/src/main/java/scatours/payment/PaymentLauncher.java new file mode 100644 index 0000000000..8d5cc8765d --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-java/src/main/java/scatours/payment/PaymentLauncher.java @@ -0,0 +1,47 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package scatours.payment; + +import static scatours.launcher.LauncherUtil.locate; + +import org.apache.tuscany.sca.node.SCAClient; +import org.apache.tuscany.sca.node.SCANode; +import org.apache.tuscany.sca.node.SCANodeFactory; + +import com.tuscanyscatours.payment.Payment; + +public class PaymentLauncher { + + public static void main(String[] args) throws Exception { + SCANode node = SCANodeFactory.newInstance().createSCANode(null, + locate("payment-java"), + locate("creditcard-payment-jaxb")); + node.start(); + + SCAClient client = (SCAClient)node; + Payment payment = client.getService(Payment.class, "Payment"); + + System.out.println("Payment Java test"); + System.out.println("\nSuccessful Payment - Status = \n\n" + payment.makePaymentMember("c-0", 100.00f)); + System.out.println("\n\nFailed Payment - Status = \n\n" + payment.makePaymentMember("c-1", 100.00f)); + + node.stop(); + } +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-python/build.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-python/build.xml new file mode 100644 index 0000000000..b6e3f72127 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-python/build.xml @@ -0,0 +1,35 @@ +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> + +<project name="scatours-launcher-payment-python" default="compile"> + <import file="../../antdefs.xml"/> + <path id="compile-path"> + <pathelement path="../../util/launcher-common/target/scatours-util-launcher-common.jar"/> + </path> + + <target name="run"> + <java classname="scatours.payment.PaymentLauncher" fork="true" failonerror="true"> + <classpath> + <pathelement location="target/${ant.project.name}.jar"/> + <path refid="compile-path"/> + <pathelement location="${env.TUSCANY_HOME}/lib/tuscany-sca-manifest.jar"/> + </classpath> + </java> + </target> +</project> diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-python/pom.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-python/pom.xml new file mode 100644 index 0000000000..97ba34d3ab --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-python/pom.xml @@ -0,0 +1,122 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<project> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>scatours</artifactId> + <version>1.0-SNAPSHOT</version> + <relativePath>../../pom.xml</relativePath> + </parent><version>1.0-SNAPSHOT</version> + <artifactId>scatours-launcher-payment-python</artifactId> + <name>Apache Tuscany SCA Tours Payment Python Launcher</name> + + <dependencies> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>scatours-util-launcher-common</artifactId> + <version>${pom.version}</version> + <scope>provided</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-node-api</artifactId> + <version>${tuscany.version}</version> + </dependency> + + <dependency> + <groupId>javax.xml.bind</groupId> + <artifactId>jaxb-api</artifactId> + <version>2.1</version> + </dependency> + + <dependency> + <groupId>javax.xml.ws</groupId> + <artifactId>jaxws-api</artifactId> + <version>2.1</version> + <exclusions> + <exclusion> + <groupId>javax.xml.soap</groupId> + <artifactId>saaj-api</artifactId> + </exclusion> + </exclusions> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-node-impl</artifactId> + <version>${tuscany.version}</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-implementation-java-runtime</artifactId> + <version>${tuscany.version}</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-implementation-script</artifactId> + <version>${tuscany.version}</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-binding-ws-axis2</artifactId> + <version>${tuscany.version}</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-host-jetty</artifactId> + <version>${tuscany.version}</version> + <scope>runtime</scope> + </dependency> + </dependencies> + + <build> + <finalName>${artifactId}</finalName> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-jar-plugin</artifactId> + <version>2.2</version> + <configuration> + <archive> + <manifestEntries> + <Class-Path>../util/scatours-util-launcher-common.jar</Class-Path> + </manifestEntries> + <manifest> + <addClasspath>${scatours.selfContained}</addClasspath> + <classpathPrefix>../lib/</classpathPrefix> + <mainClass>scatours.payment.PaymentLauncher</mainClass> + </manifest> + </archive> + </configuration> + </plugin> + </plugins> + </build> +</project> diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-python/src/main/java/com/tuscanyscatours/emailgateway/EmailGateway.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-python/src/main/java/com/tuscanyscatours/emailgateway/EmailGateway.java new file mode 100644 index 0000000000..0e4e9726de --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-python/src/main/java/com/tuscanyscatours/emailgateway/EmailGateway.java @@ -0,0 +1,40 @@ + +package com.tuscanyscatours.emailgateway; + +import javax.jws.WebMethod; +import javax.jws.WebParam; +import javax.jws.WebResult; +import javax.jws.WebService; +import javax.xml.bind.annotation.XmlSeeAlso; +import javax.xml.ws.RequestWrapper; +import javax.xml.ws.ResponseWrapper; + + +/** + * This class was generated by the JAX-WS RI. + * JAX-WS RI 2.1.7-b01- + * Generated source version: 2.1 + * + */ +@WebService(name = "EmailGateway", targetNamespace = "http://www.tuscanyscatours.com/EmailGateway/") +@XmlSeeAlso({ + ObjectFactory.class +}) +public interface EmailGateway { + + + /** + * + * @param email + * @return + * returns java.lang.String + */ + @WebMethod(action = "http://www.tuscanyscatours.com/EmailGateway/sendEmail") + @WebResult(name = "Status", targetNamespace = "") + @RequestWrapper(localName = "sendEmail", targetNamespace = "http://www.tuscanyscatours.com/EmailGateway/", className = "com.tuscanyscatours.emailgateway.SendEmailType") + @ResponseWrapper(localName = "sendEmailResponse", targetNamespace = "http://www.tuscanyscatours.com/EmailGateway/", className = "com.tuscanyscatours.emailgateway.SendEmailResponseType") + public String sendEmail( + @WebParam(name = "Email", targetNamespace = "") + EmailType email); + +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-python/src/main/java/com/tuscanyscatours/emailgateway/EmailGatewayService.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-python/src/main/java/com/tuscanyscatours/emailgateway/EmailGatewayService.java new file mode 100644 index 0000000000..8f87855dd9 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-python/src/main/java/com/tuscanyscatours/emailgateway/EmailGatewayService.java @@ -0,0 +1,71 @@ + +package com.tuscanyscatours.emailgateway; + +import java.net.MalformedURLException; +import java.net.URL; +import java.util.logging.Logger; +import javax.xml.namespace.QName; +import javax.xml.ws.Service; +import javax.xml.ws.WebEndpoint; +import javax.xml.ws.WebServiceClient; +import javax.xml.ws.WebServiceFeature; + + +/** + * This class was generated by the JAX-WS RI. + * JAX-WS RI 2.1.7-b01- + * Generated source version: 2.1 + * + */ +@WebServiceClient(name = "EmailGatewayService", targetNamespace = "http://www.tuscanyscatours.com/EmailGateway/", wsdlLocation = "file:/C:/simon/tuscany/travelsample/contributions/payment-groovy/src/main/resources/EmailGateway.wsdl") +public class EmailGatewayService + extends Service +{ + + private final static URL EMAILGATEWAYSERVICE_WSDL_LOCATION; + private final static Logger logger = Logger.getLogger(com.tuscanyscatours.emailgateway.EmailGatewayService.class.getName()); + + static { + URL url = null; + try { + URL baseUrl; + baseUrl = com.tuscanyscatours.emailgateway.EmailGatewayService.class.getResource("."); + url = new URL(baseUrl, "file:/C:/simon/tuscany/travelsample/contributions/payment-groovy/src/main/resources/EmailGateway.wsdl"); + } catch (MalformedURLException e) { + logger.warning("Failed to create URL for the wsdl Location: 'file:/C:/simon/tuscany/travelsample/contributions/payment-groovy/src/main/resources/EmailGateway.wsdl', retrying as a local file"); + logger.warning(e.getMessage()); + } + EMAILGATEWAYSERVICE_WSDL_LOCATION = url; + } + + public EmailGatewayService(URL wsdlLocation, QName serviceName) { + super(wsdlLocation, serviceName); + } + + public EmailGatewayService() { + super(EMAILGATEWAYSERVICE_WSDL_LOCATION, new QName("http://www.tuscanyscatours.com/EmailGateway/", "EmailGatewayService")); + } + + /** + * + * @return + * returns EmailGateway + */ + @WebEndpoint(name = "EmailGatewayPort") + public EmailGateway getEmailGatewayPort() { + return super.getPort(new QName("http://www.tuscanyscatours.com/EmailGateway/", "EmailGatewayPort"), EmailGateway.class); + } + + /** + * + * @param features + * A list of {@link javax.xml.ws.WebServiceFeature} to configure on the proxy. Supported features not in the <code>features</code> parameter will have their default values. + * @return + * returns EmailGateway + */ + @WebEndpoint(name = "EmailGatewayPort") + public EmailGateway getEmailGatewayPort(WebServiceFeature... features) { + return super.getPort(new QName("http://www.tuscanyscatours.com/EmailGateway/", "EmailGatewayPort"), EmailGateway.class, features); + } + +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-python/src/main/java/com/tuscanyscatours/emailgateway/EmailType.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-python/src/main/java/com/tuscanyscatours/emailgateway/EmailType.java new file mode 100644 index 0000000000..25935d2303 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-python/src/main/java/com/tuscanyscatours/emailgateway/EmailType.java @@ -0,0 +1,118 @@ + +package com.tuscanyscatours.emailgateway; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + + +/** + * <p>Java class for EmailType complex type. + * + * <p>The following schema fragment specifies the expected content contained within this class. + * + * <pre> + * <complexType name="EmailType"> + * <complexContent> + * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> + * <sequence> + * <element name="To" type="{http://www.w3.org/2001/XMLSchema}string"/> + * <element name="Title" type="{http://www.w3.org/2001/XMLSchema}string"/> + * <element name="Body" type="{http://www.w3.org/2001/XMLSchema}string"/> + * </sequence> + * </restriction> + * </complexContent> + * </complexType> + * </pre> + * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "EmailType", propOrder = { + "to", + "title", + "body" +}) +public class EmailType { + + @XmlElement(name = "To", required = true) + protected String to; + @XmlElement(name = "Title", required = true) + protected String title; + @XmlElement(name = "Body", required = true) + protected String body; + + /** + * Gets the value of the to property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getTo() { + return to; + } + + /** + * Sets the value of the to property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setTo(String value) { + this.to = value; + } + + /** + * Gets the value of the title property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getTitle() { + return title; + } + + /** + * Sets the value of the title property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setTitle(String value) { + this.title = value; + } + + /** + * Gets the value of the body property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getBody() { + return body; + } + + /** + * Sets the value of the body property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setBody(String value) { + this.body = value; + } + +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-python/src/main/java/com/tuscanyscatours/emailgateway/ObjectFactory.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-python/src/main/java/com/tuscanyscatours/emailgateway/ObjectFactory.java new file mode 100644 index 0000000000..f414bb3eb3 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-python/src/main/java/com/tuscanyscatours/emailgateway/ObjectFactory.java @@ -0,0 +1,79 @@ + +package com.tuscanyscatours.emailgateway; + +import javax.xml.bind.JAXBElement; +import javax.xml.bind.annotation.XmlElementDecl; +import javax.xml.bind.annotation.XmlRegistry; +import javax.xml.namespace.QName; + + +/** + * This object contains factory methods for each + * Java content interface and Java element interface + * generated in the com.tuscanyscatours.emailgateway package. + * <p>An ObjectFactory allows you to programatically + * construct new instances of the Java representation + * for XML content. The Java representation of XML + * content can consist of schema derived interfaces + * and classes representing the binding of schema + * type definitions, element declarations and model + * groups. Factory methods for each of these are + * provided in this class. + * + */ +@XmlRegistry +public class ObjectFactory { + + private final static QName _SendEmailResponse_QNAME = new QName("http://www.tuscanyscatours.com/EmailGateway/", "sendEmailResponse"); + private final static QName _SendEmail_QNAME = new QName("http://www.tuscanyscatours.com/EmailGateway/", "sendEmail"); + + /** + * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: com.tuscanyscatours.emailgateway + * + */ + public ObjectFactory() { + } + + /** + * Create an instance of {@link SendEmailType } + * + */ + public SendEmailType createSendEmailType() { + return new SendEmailType(); + } + + /** + * Create an instance of {@link EmailType } + * + */ + public EmailType createEmailType() { + return new EmailType(); + } + + /** + * Create an instance of {@link SendEmailResponseType } + * + */ + public SendEmailResponseType createSendEmailResponseType() { + return new SendEmailResponseType(); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link SendEmailResponseType }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://www.tuscanyscatours.com/EmailGateway/", name = "sendEmailResponse") + public JAXBElement<SendEmailResponseType> createSendEmailResponse(SendEmailResponseType value) { + return new JAXBElement<SendEmailResponseType>(_SendEmailResponse_QNAME, SendEmailResponseType.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link SendEmailType }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://www.tuscanyscatours.com/EmailGateway/", name = "sendEmail") + public JAXBElement<SendEmailType> createSendEmail(SendEmailType value) { + return new JAXBElement<SendEmailType>(_SendEmail_QNAME, SendEmailType.class, null, value); + } + +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-python/src/main/java/com/tuscanyscatours/emailgateway/SendEmailResponseType.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-python/src/main/java/com/tuscanyscatours/emailgateway/SendEmailResponseType.java new file mode 100644 index 0000000000..6d366b7554 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-python/src/main/java/com/tuscanyscatours/emailgateway/SendEmailResponseType.java @@ -0,0 +1,62 @@ + +package com.tuscanyscatours.emailgateway; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + + +/** + * <p>Java class for SendEmailResponseType complex type. + * + * <p>The following schema fragment specifies the expected content contained within this class. + * + * <pre> + * <complexType name="SendEmailResponseType"> + * <complexContent> + * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> + * <sequence> + * <element name="Status" type="{http://www.w3.org/2001/XMLSchema}string"/> + * </sequence> + * </restriction> + * </complexContent> + * </complexType> + * </pre> + * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "SendEmailResponseType", propOrder = { + "status" +}) +public class SendEmailResponseType { + + @XmlElement(name = "Status", required = true) + protected String status; + + /** + * Gets the value of the status property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getStatus() { + return status; + } + + /** + * Sets the value of the status property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setStatus(String value) { + this.status = value; + } + +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-python/src/main/java/com/tuscanyscatours/emailgateway/SendEmailType.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-python/src/main/java/com/tuscanyscatours/emailgateway/SendEmailType.java new file mode 100644 index 0000000000..cc8e15366c --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-python/src/main/java/com/tuscanyscatours/emailgateway/SendEmailType.java @@ -0,0 +1,62 @@ + +package com.tuscanyscatours.emailgateway; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + + +/** + * <p>Java class for SendEmailType complex type. + * + * <p>The following schema fragment specifies the expected content contained within this class. + * + * <pre> + * <complexType name="SendEmailType"> + * <complexContent> + * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> + * <sequence> + * <element name="Email" type="{http://www.tuscanyscatours.com/EmailGateway/}EmailType"/> + * </sequence> + * </restriction> + * </complexContent> + * </complexType> + * </pre> + * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "SendEmailType", propOrder = { + "email" +}) +public class SendEmailType { + + @XmlElement(name = "Email", required = true) + protected EmailType email; + + /** + * Gets the value of the email property. + * + * @return + * possible object is + * {@link EmailType } + * + */ + public EmailType getEmail() { + return email; + } + + /** + * Sets the value of the email property. + * + * @param value + * allowed object is + * {@link EmailType } + * + */ + public void setEmail(EmailType value) { + this.email = value; + } + +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-python/src/main/java/com/tuscanyscatours/emailgateway/package-info.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-python/src/main/java/com/tuscanyscatours/emailgateway/package-info.java new file mode 100644 index 0000000000..2c2d603ada --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-python/src/main/java/com/tuscanyscatours/emailgateway/package-info.java @@ -0,0 +1,2 @@ +@javax.xml.bind.annotation.XmlSchema(namespace = "http://www.tuscanyscatours.com/EmailGateway/") +package com.tuscanyscatours.emailgateway; diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-python/src/main/java/com/tuscanyscatours/payment/MakePaymentMemberResponseType.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-python/src/main/java/com/tuscanyscatours/payment/MakePaymentMemberResponseType.java new file mode 100644 index 0000000000..e5f3ef3cad --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-python/src/main/java/com/tuscanyscatours/payment/MakePaymentMemberResponseType.java @@ -0,0 +1,62 @@ + +package com.tuscanyscatours.payment; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + + +/** + * <p>Java class for MakePaymentMemberResponseType complex type. + * + * <p>The following schema fragment specifies the expected content contained within this class. + * + * <pre> + * <complexType name="MakePaymentMemberResponseType"> + * <complexContent> + * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> + * <sequence> + * <element name="Status" type="{http://www.w3.org/2001/XMLSchema}string"/> + * </sequence> + * </restriction> + * </complexContent> + * </complexType> + * </pre> + * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "MakePaymentMemberResponseType", propOrder = { + "status" +}) +public class MakePaymentMemberResponseType { + + @XmlElement(name = "Status", required = true) + protected String status; + + /** + * Gets the value of the status property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getStatus() { + return status; + } + + /** + * Sets the value of the status property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setStatus(String value) { + this.status = value; + } + +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-python/src/main/java/com/tuscanyscatours/payment/MakePaymentMemberType.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-python/src/main/java/com/tuscanyscatours/payment/MakePaymentMemberType.java new file mode 100644 index 0000000000..ca94d86628 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-python/src/main/java/com/tuscanyscatours/payment/MakePaymentMemberType.java @@ -0,0 +1,82 @@ + +package com.tuscanyscatours.payment; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + + +/** + * <p>Java class for MakePaymentMemberType complex type. + * + * <p>The following schema fragment specifies the expected content contained within this class. + * + * <pre> + * <complexType name="MakePaymentMemberType"> + * <complexContent> + * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> + * <sequence> + * <element name="CustomerId" type="{http://www.w3.org/2001/XMLSchema}string"/> + * <element name="Amount" type="{http://www.w3.org/2001/XMLSchema}float"/> + * </sequence> + * </restriction> + * </complexContent> + * </complexType> + * </pre> + * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "MakePaymentMemberType", propOrder = { + "customerId", + "amount" +}) +public class MakePaymentMemberType { + + @XmlElement(name = "CustomerId", required = true) + protected String customerId; + @XmlElement(name = "Amount") + protected float amount; + + /** + * Gets the value of the customerId property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCustomerId() { + return customerId; + } + + /** + * Sets the value of the customerId property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCustomerId(String value) { + this.customerId = value; + } + + /** + * Gets the value of the amount property. + * + */ + public float getAmount() { + return amount; + } + + /** + * Sets the value of the amount property. + * + */ + public void setAmount(float value) { + this.amount = value; + } + +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-python/src/main/java/com/tuscanyscatours/payment/ObjectFactory.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-python/src/main/java/com/tuscanyscatours/payment/ObjectFactory.java new file mode 100644 index 0000000000..b069b2ba94 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-python/src/main/java/com/tuscanyscatours/payment/ObjectFactory.java @@ -0,0 +1,71 @@ + +package com.tuscanyscatours.payment; + +import javax.xml.bind.JAXBElement; +import javax.xml.bind.annotation.XmlElementDecl; +import javax.xml.bind.annotation.XmlRegistry; +import javax.xml.namespace.QName; + + +/** + * This object contains factory methods for each + * Java content interface and Java element interface + * generated in the com.tuscanyscatours.payment package. + * <p>An ObjectFactory allows you to programatically + * construct new instances of the Java representation + * for XML content. The Java representation of XML + * content can consist of schema derived interfaces + * and classes representing the binding of schema + * type definitions, element declarations and model + * groups. Factory methods for each of these are + * provided in this class. + * + */ +@XmlRegistry +public class ObjectFactory { + + private final static QName _MakePaymentMember_QNAME = new QName("http://www.tuscanyscatours.com/Payment/", "makePaymentMember"); + private final static QName _MakePaymentMemberResponse_QNAME = new QName("http://www.tuscanyscatours.com/Payment/", "makePaymentMemberResponse"); + + /** + * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: com.tuscanyscatours.payment + * + */ + public ObjectFactory() { + } + + /** + * Create an instance of {@link MakePaymentMemberResponseType } + * + */ + public MakePaymentMemberResponseType createMakePaymentMemberResponseType() { + return new MakePaymentMemberResponseType(); + } + + /** + * Create an instance of {@link MakePaymentMemberType } + * + */ + public MakePaymentMemberType createMakePaymentMemberType() { + return new MakePaymentMemberType(); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link MakePaymentMemberType }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://www.tuscanyscatours.com/Payment/", name = "makePaymentMember") + public JAXBElement<MakePaymentMemberType> createMakePaymentMember(MakePaymentMemberType value) { + return new JAXBElement<MakePaymentMemberType>(_MakePaymentMember_QNAME, MakePaymentMemberType.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link MakePaymentMemberResponseType }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://www.tuscanyscatours.com/Payment/", name = "makePaymentMemberResponse") + public JAXBElement<MakePaymentMemberResponseType> createMakePaymentMemberResponse(MakePaymentMemberResponseType value) { + return new JAXBElement<MakePaymentMemberResponseType>(_MakePaymentMemberResponse_QNAME, MakePaymentMemberResponseType.class, null, value); + } + +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-python/src/main/java/com/tuscanyscatours/payment/Payment.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-python/src/main/java/com/tuscanyscatours/payment/Payment.java new file mode 100644 index 0000000000..bbbd03d89a --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-python/src/main/java/com/tuscanyscatours/payment/Payment.java @@ -0,0 +1,43 @@ + +package com.tuscanyscatours.payment; + +import javax.jws.WebMethod; +import javax.jws.WebParam; +import javax.jws.WebResult; +import javax.jws.WebService; +import javax.xml.bind.annotation.XmlSeeAlso; +import javax.xml.ws.RequestWrapper; +import javax.xml.ws.ResponseWrapper; + + +/** + * This class was generated by the JAX-WS RI. + * JAX-WS RI 2.1.7-b01- + * Generated source version: 2.1 + * + */ +@WebService(name = "Payment", targetNamespace = "http://www.tuscanyscatours.com/Payment/") +@XmlSeeAlso({ + ObjectFactory.class +}) +public interface Payment { + + + /** + * + * @param amount + * @param customerId + * @return + * returns java.lang.String + */ + @WebMethod(action = "http://www.tuscanyscatours.com/Payment/makePayment") + @WebResult(name = "Status", targetNamespace = "") + @RequestWrapper(localName = "makePaymentMember", targetNamespace = "http://www.tuscanyscatours.com/Payment/", className = "com.tuscanyscatours.payment.MakePaymentMemberType") + @ResponseWrapper(localName = "makePaymentMemberResponse", targetNamespace = "http://www.tuscanyscatours.com/Payment/", className = "com.tuscanyscatours.payment.MakePaymentMemberResponseType") + public String makePaymentMember( + @WebParam(name = "CustomerId", targetNamespace = "") + String customerId, + @WebParam(name = "Amount", targetNamespace = "") + float amount); + +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-python/src/main/java/com/tuscanyscatours/payment/PaymentService.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-python/src/main/java/com/tuscanyscatours/payment/PaymentService.java new file mode 100644 index 0000000000..a430175976 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-python/src/main/java/com/tuscanyscatours/payment/PaymentService.java @@ -0,0 +1,71 @@ + +package com.tuscanyscatours.payment; + +import java.net.MalformedURLException; +import java.net.URL; +import java.util.logging.Logger; +import javax.xml.namespace.QName; +import javax.xml.ws.Service; +import javax.xml.ws.WebEndpoint; +import javax.xml.ws.WebServiceClient; +import javax.xml.ws.WebServiceFeature; + + +/** + * This class was generated by the JAX-WS RI. + * JAX-WS RI 2.1.7-b01- + * Generated source version: 2.1 + * + */ +@WebServiceClient(name = "PaymentService", targetNamespace = "http://www.tuscanyscatours.com/Payment/", wsdlLocation = "file:/C:/simon/tuscany/travelsample/contributions/payment-java/src/main/resources/Payment.wsdl") +public class PaymentService + extends Service +{ + + private final static URL PAYMENTSERVICE_WSDL_LOCATION; + private final static Logger logger = Logger.getLogger(com.tuscanyscatours.payment.PaymentService.class.getName()); + + static { + URL url = null; + try { + URL baseUrl; + baseUrl = com.tuscanyscatours.payment.PaymentService.class.getResource("."); + url = new URL(baseUrl, "file:/C:/simon/tuscany/travelsample/contributions/payment-java/src/main/resources/Payment.wsdl"); + } catch (MalformedURLException e) { + logger.warning("Failed to create URL for the wsdl Location: 'file:/C:/simon/tuscany/travelsample/contributions/payment-java/src/main/resources/Payment.wsdl', retrying as a local file"); + logger.warning(e.getMessage()); + } + PAYMENTSERVICE_WSDL_LOCATION = url; + } + + public PaymentService(URL wsdlLocation, QName serviceName) { + super(wsdlLocation, serviceName); + } + + public PaymentService() { + super(PAYMENTSERVICE_WSDL_LOCATION, new QName("http://www.tuscanyscatours.com/Payment/", "PaymentService")); + } + + /** + * + * @return + * returns Payment + */ + @WebEndpoint(name = "PaymentPort") + public Payment getPaymentPort() { + return super.getPort(new QName("http://www.tuscanyscatours.com/Payment/", "PaymentPort"), Payment.class); + } + + /** + * + * @param features + * A list of {@link javax.xml.ws.WebServiceFeature} to configure on the proxy. Supported features not in the <code>features</code> parameter will have their default values. + * @return + * returns Payment + */ + @WebEndpoint(name = "PaymentPort") + public Payment getPaymentPort(WebServiceFeature... features) { + return super.getPort(new QName("http://www.tuscanyscatours.com/Payment/", "PaymentPort"), Payment.class, features); + } + +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-python/src/main/java/com/tuscanyscatours/payment/package-info.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-python/src/main/java/com/tuscanyscatours/payment/package-info.java new file mode 100644 index 0000000000..acd208f5c9 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-python/src/main/java/com/tuscanyscatours/payment/package-info.java @@ -0,0 +1,2 @@ +@javax.xml.bind.annotation.XmlSchema(namespace = "http://www.tuscanyscatours.com/Payment/") +package com.tuscanyscatours.payment; diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-python/src/main/java/scatours/payment/PaymentLauncher.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-python/src/main/java/scatours/payment/PaymentLauncher.java new file mode 100644 index 0000000000..bb94cf8642 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-python/src/main/java/scatours/payment/PaymentLauncher.java @@ -0,0 +1,47 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package scatours.payment; + +import static scatours.launcher.LauncherUtil.locate; + +import org.apache.tuscany.sca.node.SCAClient; +import org.apache.tuscany.sca.node.SCANode; +import org.apache.tuscany.sca.node.SCANodeFactory; + +import com.tuscanyscatours.payment.Payment; + +public class PaymentLauncher { + + public static void main(String[] args) throws Exception { + SCANode node = SCANodeFactory.newInstance().createSCANode(null, + locate("payment-python"), + locate("creditcard-payment-jaxb"), + locate("emailgateway")); + node.start(); + + SCAClient client = (SCAClient)node; + Payment payment = client.getService(Payment.class, "Payment"); + + System.out.println("Payment Python test"); + System.out.println("\nSuccessful Payment - Status = \n\n" + payment.makePaymentMember("c-0", 100.00f)); + + node.stop(); + } +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-spring-scatag/build.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-spring-scatag/build.xml new file mode 100644 index 0000000000..6ccd55f641 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-spring-scatag/build.xml @@ -0,0 +1,35 @@ +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> + +<project name="scatours-launcher-payment-spring-scatag" default="compile"> + <import file="../../antdefs.xml"/> + <path id="compile-path"> + <pathelement path="../../util/launcher-common/target/scatours-util-launcher-common.jar"/> + </path> + + <target name="run"> + <java classname="scatours.payment.PaymentLauncher" fork="true" failonerror="true"> + <classpath> + <pathelement location="target/${ant.project.name}.jar"/> + <path refid="compile-path"/> + <pathelement location="${env.TUSCANY_HOME}/lib/tuscany-sca-manifest.jar"/> + </classpath> + </java> + </target> +</project> diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-spring-scatag/pom.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-spring-scatag/pom.xml new file mode 100644 index 0000000000..c44f53ad1a --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-spring-scatag/pom.xml @@ -0,0 +1,129 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<project> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>scatours</artifactId> + <version>1.0-SNAPSHOT</version> + <relativePath>../../pom.xml</relativePath> + </parent><version>1.0-SNAPSHOT</version> + <artifactId>scatours-launcher-payment-spring-scatag</artifactId> + <name>Apache Tuscany SCA Tours Payment Spring SCATag Launcher</name> + + <dependencies> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>scatours-util-launcher-common</artifactId> + <version>${pom.version}</version> + <scope>provided</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-node-api</artifactId> + <version>${tuscany.version}</version> + </dependency> + + <dependency> + <groupId>javax.xml.bind</groupId> + <artifactId>jaxb-api</artifactId> + <version>2.1</version> + </dependency> + + <dependency> + <groupId>javax.xml.ws</groupId> + <artifactId>jaxws-api</artifactId> + <version>2.1</version> + <exclusions> + <exclusion> + <groupId>javax.xml.soap</groupId> + <artifactId>saaj-api</artifactId> + </exclusion> + </exclusions> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-node-impl</artifactId> + <version>${tuscany.version}</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-implementation-java-runtime</artifactId> + <version>${tuscany.version}</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-implementation-spring</artifactId> + <version>${tuscany.version}</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-implementation-spring-runtime</artifactId> + <version>${tuscany.version}</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-binding-ws-axis2</artifactId> + <version>${tuscany.version}</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-host-jetty</artifactId> + <version>${tuscany.version}</version> + <scope>runtime</scope> + </dependency> + </dependencies> + + <build> + <finalName>${artifactId}</finalName> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-jar-plugin</artifactId> + <version>2.2</version> + <configuration> + <archive> + <manifestEntries> + <Class-Path>../util/scatours-util-launcher-common.jar</Class-Path> + </manifestEntries> + <manifest> + <addClasspath>${scatours.selfContained}</addClasspath> + <classpathPrefix>../lib/</classpathPrefix> + <mainClass>scatours.payment.PaymentLauncher</mainClass> + </manifest> + </archive> + </configuration> + </plugin> + </plugins> + </build> +</project> diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-spring-scatag/src/main/java/com/tuscanyscatours/payment/MakePaymentMemberResponseType.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-spring-scatag/src/main/java/com/tuscanyscatours/payment/MakePaymentMemberResponseType.java new file mode 100644 index 0000000000..e5f3ef3cad --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-spring-scatag/src/main/java/com/tuscanyscatours/payment/MakePaymentMemberResponseType.java @@ -0,0 +1,62 @@ + +package com.tuscanyscatours.payment; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + + +/** + * <p>Java class for MakePaymentMemberResponseType complex type. + * + * <p>The following schema fragment specifies the expected content contained within this class. + * + * <pre> + * <complexType name="MakePaymentMemberResponseType"> + * <complexContent> + * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> + * <sequence> + * <element name="Status" type="{http://www.w3.org/2001/XMLSchema}string"/> + * </sequence> + * </restriction> + * </complexContent> + * </complexType> + * </pre> + * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "MakePaymentMemberResponseType", propOrder = { + "status" +}) +public class MakePaymentMemberResponseType { + + @XmlElement(name = "Status", required = true) + protected String status; + + /** + * Gets the value of the status property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getStatus() { + return status; + } + + /** + * Sets the value of the status property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setStatus(String value) { + this.status = value; + } + +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-spring-scatag/src/main/java/com/tuscanyscatours/payment/MakePaymentMemberType.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-spring-scatag/src/main/java/com/tuscanyscatours/payment/MakePaymentMemberType.java new file mode 100644 index 0000000000..ca94d86628 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-spring-scatag/src/main/java/com/tuscanyscatours/payment/MakePaymentMemberType.java @@ -0,0 +1,82 @@ + +package com.tuscanyscatours.payment; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + + +/** + * <p>Java class for MakePaymentMemberType complex type. + * + * <p>The following schema fragment specifies the expected content contained within this class. + * + * <pre> + * <complexType name="MakePaymentMemberType"> + * <complexContent> + * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> + * <sequence> + * <element name="CustomerId" type="{http://www.w3.org/2001/XMLSchema}string"/> + * <element name="Amount" type="{http://www.w3.org/2001/XMLSchema}float"/> + * </sequence> + * </restriction> + * </complexContent> + * </complexType> + * </pre> + * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "MakePaymentMemberType", propOrder = { + "customerId", + "amount" +}) +public class MakePaymentMemberType { + + @XmlElement(name = "CustomerId", required = true) + protected String customerId; + @XmlElement(name = "Amount") + protected float amount; + + /** + * Gets the value of the customerId property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCustomerId() { + return customerId; + } + + /** + * Sets the value of the customerId property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCustomerId(String value) { + this.customerId = value; + } + + /** + * Gets the value of the amount property. + * + */ + public float getAmount() { + return amount; + } + + /** + * Sets the value of the amount property. + * + */ + public void setAmount(float value) { + this.amount = value; + } + +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-spring-scatag/src/main/java/com/tuscanyscatours/payment/ObjectFactory.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-spring-scatag/src/main/java/com/tuscanyscatours/payment/ObjectFactory.java new file mode 100644 index 0000000000..b069b2ba94 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-spring-scatag/src/main/java/com/tuscanyscatours/payment/ObjectFactory.java @@ -0,0 +1,71 @@ + +package com.tuscanyscatours.payment; + +import javax.xml.bind.JAXBElement; +import javax.xml.bind.annotation.XmlElementDecl; +import javax.xml.bind.annotation.XmlRegistry; +import javax.xml.namespace.QName; + + +/** + * This object contains factory methods for each + * Java content interface and Java element interface + * generated in the com.tuscanyscatours.payment package. + * <p>An ObjectFactory allows you to programatically + * construct new instances of the Java representation + * for XML content. The Java representation of XML + * content can consist of schema derived interfaces + * and classes representing the binding of schema + * type definitions, element declarations and model + * groups. Factory methods for each of these are + * provided in this class. + * + */ +@XmlRegistry +public class ObjectFactory { + + private final static QName _MakePaymentMember_QNAME = new QName("http://www.tuscanyscatours.com/Payment/", "makePaymentMember"); + private final static QName _MakePaymentMemberResponse_QNAME = new QName("http://www.tuscanyscatours.com/Payment/", "makePaymentMemberResponse"); + + /** + * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: com.tuscanyscatours.payment + * + */ + public ObjectFactory() { + } + + /** + * Create an instance of {@link MakePaymentMemberResponseType } + * + */ + public MakePaymentMemberResponseType createMakePaymentMemberResponseType() { + return new MakePaymentMemberResponseType(); + } + + /** + * Create an instance of {@link MakePaymentMemberType } + * + */ + public MakePaymentMemberType createMakePaymentMemberType() { + return new MakePaymentMemberType(); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link MakePaymentMemberType }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://www.tuscanyscatours.com/Payment/", name = "makePaymentMember") + public JAXBElement<MakePaymentMemberType> createMakePaymentMember(MakePaymentMemberType value) { + return new JAXBElement<MakePaymentMemberType>(_MakePaymentMember_QNAME, MakePaymentMemberType.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link MakePaymentMemberResponseType }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://www.tuscanyscatours.com/Payment/", name = "makePaymentMemberResponse") + public JAXBElement<MakePaymentMemberResponseType> createMakePaymentMemberResponse(MakePaymentMemberResponseType value) { + return new JAXBElement<MakePaymentMemberResponseType>(_MakePaymentMemberResponse_QNAME, MakePaymentMemberResponseType.class, null, value); + } + +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-spring-scatag/src/main/java/com/tuscanyscatours/payment/Payment.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-spring-scatag/src/main/java/com/tuscanyscatours/payment/Payment.java new file mode 100644 index 0000000000..bbbd03d89a --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-spring-scatag/src/main/java/com/tuscanyscatours/payment/Payment.java @@ -0,0 +1,43 @@ + +package com.tuscanyscatours.payment; + +import javax.jws.WebMethod; +import javax.jws.WebParam; +import javax.jws.WebResult; +import javax.jws.WebService; +import javax.xml.bind.annotation.XmlSeeAlso; +import javax.xml.ws.RequestWrapper; +import javax.xml.ws.ResponseWrapper; + + +/** + * This class was generated by the JAX-WS RI. + * JAX-WS RI 2.1.7-b01- + * Generated source version: 2.1 + * + */ +@WebService(name = "Payment", targetNamespace = "http://www.tuscanyscatours.com/Payment/") +@XmlSeeAlso({ + ObjectFactory.class +}) +public interface Payment { + + + /** + * + * @param amount + * @param customerId + * @return + * returns java.lang.String + */ + @WebMethod(action = "http://www.tuscanyscatours.com/Payment/makePayment") + @WebResult(name = "Status", targetNamespace = "") + @RequestWrapper(localName = "makePaymentMember", targetNamespace = "http://www.tuscanyscatours.com/Payment/", className = "com.tuscanyscatours.payment.MakePaymentMemberType") + @ResponseWrapper(localName = "makePaymentMemberResponse", targetNamespace = "http://www.tuscanyscatours.com/Payment/", className = "com.tuscanyscatours.payment.MakePaymentMemberResponseType") + public String makePaymentMember( + @WebParam(name = "CustomerId", targetNamespace = "") + String customerId, + @WebParam(name = "Amount", targetNamespace = "") + float amount); + +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-spring-scatag/src/main/java/com/tuscanyscatours/payment/PaymentService.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-spring-scatag/src/main/java/com/tuscanyscatours/payment/PaymentService.java new file mode 100644 index 0000000000..a430175976 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-spring-scatag/src/main/java/com/tuscanyscatours/payment/PaymentService.java @@ -0,0 +1,71 @@ + +package com.tuscanyscatours.payment; + +import java.net.MalformedURLException; +import java.net.URL; +import java.util.logging.Logger; +import javax.xml.namespace.QName; +import javax.xml.ws.Service; +import javax.xml.ws.WebEndpoint; +import javax.xml.ws.WebServiceClient; +import javax.xml.ws.WebServiceFeature; + + +/** + * This class was generated by the JAX-WS RI. + * JAX-WS RI 2.1.7-b01- + * Generated source version: 2.1 + * + */ +@WebServiceClient(name = "PaymentService", targetNamespace = "http://www.tuscanyscatours.com/Payment/", wsdlLocation = "file:/C:/simon/tuscany/travelsample/contributions/payment-java/src/main/resources/Payment.wsdl") +public class PaymentService + extends Service +{ + + private final static URL PAYMENTSERVICE_WSDL_LOCATION; + private final static Logger logger = Logger.getLogger(com.tuscanyscatours.payment.PaymentService.class.getName()); + + static { + URL url = null; + try { + URL baseUrl; + baseUrl = com.tuscanyscatours.payment.PaymentService.class.getResource("."); + url = new URL(baseUrl, "file:/C:/simon/tuscany/travelsample/contributions/payment-java/src/main/resources/Payment.wsdl"); + } catch (MalformedURLException e) { + logger.warning("Failed to create URL for the wsdl Location: 'file:/C:/simon/tuscany/travelsample/contributions/payment-java/src/main/resources/Payment.wsdl', retrying as a local file"); + logger.warning(e.getMessage()); + } + PAYMENTSERVICE_WSDL_LOCATION = url; + } + + public PaymentService(URL wsdlLocation, QName serviceName) { + super(wsdlLocation, serviceName); + } + + public PaymentService() { + super(PAYMENTSERVICE_WSDL_LOCATION, new QName("http://www.tuscanyscatours.com/Payment/", "PaymentService")); + } + + /** + * + * @return + * returns Payment + */ + @WebEndpoint(name = "PaymentPort") + public Payment getPaymentPort() { + return super.getPort(new QName("http://www.tuscanyscatours.com/Payment/", "PaymentPort"), Payment.class); + } + + /** + * + * @param features + * A list of {@link javax.xml.ws.WebServiceFeature} to configure on the proxy. Supported features not in the <code>features</code> parameter will have their default values. + * @return + * returns Payment + */ + @WebEndpoint(name = "PaymentPort") + public Payment getPaymentPort(WebServiceFeature... features) { + return super.getPort(new QName("http://www.tuscanyscatours.com/Payment/", "PaymentPort"), Payment.class, features); + } + +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-spring-scatag/src/main/java/com/tuscanyscatours/payment/package-info.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-spring-scatag/src/main/java/com/tuscanyscatours/payment/package-info.java new file mode 100644 index 0000000000..acd208f5c9 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-spring-scatag/src/main/java/com/tuscanyscatours/payment/package-info.java @@ -0,0 +1,2 @@ +@javax.xml.bind.annotation.XmlSchema(namespace = "http://www.tuscanyscatours.com/Payment/") +package com.tuscanyscatours.payment; diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-spring-scatag/src/main/java/scatours/payment/PaymentLauncher.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-spring-scatag/src/main/java/scatours/payment/PaymentLauncher.java new file mode 100644 index 0000000000..5760fe0d72 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-spring-scatag/src/main/java/scatours/payment/PaymentLauncher.java @@ -0,0 +1,47 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package scatours.payment; + +import static scatours.launcher.LauncherUtil.locate; + +import org.apache.tuscany.sca.node.SCAClient; +import org.apache.tuscany.sca.node.SCANode; +import org.apache.tuscany.sca.node.SCANodeFactory; + +import com.tuscanyscatours.payment.Payment; + +public class PaymentLauncher { + + public static void main(String[] args) throws Exception { + SCANode node = SCANodeFactory.newInstance().createSCANode(null, + locate("payment-spring-scatag"), + locate("creditcard-payment-jaxb")); + node.start(); + + SCAClient client = (SCAClient)node; + Payment payment = client.getService(Payment.class, "Payment/Payment"); + + System.out.println("Payment Spring SCATag test"); + System.out.println("\nSuccessful Payment - Status = \n\n" + payment.makePaymentMember("c-0", 100.00f)); + System.out.println("\n\nFailed Payment - Status = \n\n" + payment.makePaymentMember("c-1", 100.00f)); + + node.stop(); + } +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-spring/build.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-spring/build.xml new file mode 100644 index 0000000000..73cdf2da6a --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-spring/build.xml @@ -0,0 +1,35 @@ +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> + +<project name="scatours-launcher-payment-spring" default="compile"> + <import file="../../antdefs.xml"/> + <path id="compile-path"> + <pathelement path="../../util/launcher-common/target/scatours-util-launcher-common.jar"/> + </path> + + <target name="run"> + <java classname="scatours.payment.PaymentLauncher" fork="true" failonerror="true"> + <classpath> + <pathelement location="target/${ant.project.name}.jar"/> + <path refid="compile-path"/> + <pathelement location="${env.TUSCANY_HOME}/lib/tuscany-sca-manifest.jar"/> + </classpath> + </java> + </target> +</project> diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-spring/pom.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-spring/pom.xml new file mode 100644 index 0000000000..013c7e1482 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-spring/pom.xml @@ -0,0 +1,129 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<project> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>scatours</artifactId> + <version>1.0-SNAPSHOT</version> + <relativePath>../../pom.xml</relativePath> + </parent><version>1.0-SNAPSHOT</version> + <artifactId>scatours-launcher-payment-spring</artifactId> + <name>Apache Tuscany SCA Tours Payment Spring Launcher</name> + + <dependencies> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>scatours-util-launcher-common</artifactId> + <version>${pom.version}</version> + <scope>provided</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-node-api</artifactId> + <version>${tuscany.version}</version> + </dependency> + + <dependency> + <groupId>javax.xml.bind</groupId> + <artifactId>jaxb-api</artifactId> + <version>2.1</version> + </dependency> + + <dependency> + <groupId>javax.xml.ws</groupId> + <artifactId>jaxws-api</artifactId> + <version>2.1</version> + <exclusions> + <exclusion> + <groupId>javax.xml.soap</groupId> + <artifactId>saaj-api</artifactId> + </exclusion> + </exclusions> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-node-impl</artifactId> + <version>${tuscany.version}</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-implementation-java-runtime</artifactId> + <version>${tuscany.version}</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-implementation-spring</artifactId> + <version>${tuscany.version}</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-implementation-spring-runtime</artifactId> + <version>${tuscany.version}</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-binding-ws-axis2</artifactId> + <version>${tuscany.version}</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-host-jetty</artifactId> + <version>${tuscany.version}</version> + <scope>runtime</scope> + </dependency> + </dependencies> + + <build> + <finalName>${artifactId}</finalName> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-jar-plugin</artifactId> + <version>2.2</version> + <configuration> + <archive> + <manifestEntries> + <Class-Path>../util/scatours-util-launcher-common.jar</Class-Path> + </manifestEntries> + <manifest> + <addClasspath>${scatours.selfContained}</addClasspath> + <classpathPrefix>../lib/</classpathPrefix> + <mainClass>scatours.payment.PaymentLauncher</mainClass> + </manifest> + </archive> + </configuration> + </plugin> + </plugins> + </build> +</project> diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-spring/src/main/java/com/tuscanyscatours/payment/MakePaymentMemberResponseType.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-spring/src/main/java/com/tuscanyscatours/payment/MakePaymentMemberResponseType.java new file mode 100644 index 0000000000..e5f3ef3cad --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-spring/src/main/java/com/tuscanyscatours/payment/MakePaymentMemberResponseType.java @@ -0,0 +1,62 @@ + +package com.tuscanyscatours.payment; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + + +/** + * <p>Java class for MakePaymentMemberResponseType complex type. + * + * <p>The following schema fragment specifies the expected content contained within this class. + * + * <pre> + * <complexType name="MakePaymentMemberResponseType"> + * <complexContent> + * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> + * <sequence> + * <element name="Status" type="{http://www.w3.org/2001/XMLSchema}string"/> + * </sequence> + * </restriction> + * </complexContent> + * </complexType> + * </pre> + * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "MakePaymentMemberResponseType", propOrder = { + "status" +}) +public class MakePaymentMemberResponseType { + + @XmlElement(name = "Status", required = true) + protected String status; + + /** + * Gets the value of the status property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getStatus() { + return status; + } + + /** + * Sets the value of the status property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setStatus(String value) { + this.status = value; + } + +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-spring/src/main/java/com/tuscanyscatours/payment/MakePaymentMemberType.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-spring/src/main/java/com/tuscanyscatours/payment/MakePaymentMemberType.java new file mode 100644 index 0000000000..ca94d86628 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-spring/src/main/java/com/tuscanyscatours/payment/MakePaymentMemberType.java @@ -0,0 +1,82 @@ + +package com.tuscanyscatours.payment; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + + +/** + * <p>Java class for MakePaymentMemberType complex type. + * + * <p>The following schema fragment specifies the expected content contained within this class. + * + * <pre> + * <complexType name="MakePaymentMemberType"> + * <complexContent> + * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> + * <sequence> + * <element name="CustomerId" type="{http://www.w3.org/2001/XMLSchema}string"/> + * <element name="Amount" type="{http://www.w3.org/2001/XMLSchema}float"/> + * </sequence> + * </restriction> + * </complexContent> + * </complexType> + * </pre> + * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "MakePaymentMemberType", propOrder = { + "customerId", + "amount" +}) +public class MakePaymentMemberType { + + @XmlElement(name = "CustomerId", required = true) + protected String customerId; + @XmlElement(name = "Amount") + protected float amount; + + /** + * Gets the value of the customerId property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCustomerId() { + return customerId; + } + + /** + * Sets the value of the customerId property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCustomerId(String value) { + this.customerId = value; + } + + /** + * Gets the value of the amount property. + * + */ + public float getAmount() { + return amount; + } + + /** + * Sets the value of the amount property. + * + */ + public void setAmount(float value) { + this.amount = value; + } + +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-spring/src/main/java/com/tuscanyscatours/payment/ObjectFactory.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-spring/src/main/java/com/tuscanyscatours/payment/ObjectFactory.java new file mode 100644 index 0000000000..b069b2ba94 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-spring/src/main/java/com/tuscanyscatours/payment/ObjectFactory.java @@ -0,0 +1,71 @@ + +package com.tuscanyscatours.payment; + +import javax.xml.bind.JAXBElement; +import javax.xml.bind.annotation.XmlElementDecl; +import javax.xml.bind.annotation.XmlRegistry; +import javax.xml.namespace.QName; + + +/** + * This object contains factory methods for each + * Java content interface and Java element interface + * generated in the com.tuscanyscatours.payment package. + * <p>An ObjectFactory allows you to programatically + * construct new instances of the Java representation + * for XML content. The Java representation of XML + * content can consist of schema derived interfaces + * and classes representing the binding of schema + * type definitions, element declarations and model + * groups. Factory methods for each of these are + * provided in this class. + * + */ +@XmlRegistry +public class ObjectFactory { + + private final static QName _MakePaymentMember_QNAME = new QName("http://www.tuscanyscatours.com/Payment/", "makePaymentMember"); + private final static QName _MakePaymentMemberResponse_QNAME = new QName("http://www.tuscanyscatours.com/Payment/", "makePaymentMemberResponse"); + + /** + * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: com.tuscanyscatours.payment + * + */ + public ObjectFactory() { + } + + /** + * Create an instance of {@link MakePaymentMemberResponseType } + * + */ + public MakePaymentMemberResponseType createMakePaymentMemberResponseType() { + return new MakePaymentMemberResponseType(); + } + + /** + * Create an instance of {@link MakePaymentMemberType } + * + */ + public MakePaymentMemberType createMakePaymentMemberType() { + return new MakePaymentMemberType(); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link MakePaymentMemberType }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://www.tuscanyscatours.com/Payment/", name = "makePaymentMember") + public JAXBElement<MakePaymentMemberType> createMakePaymentMember(MakePaymentMemberType value) { + return new JAXBElement<MakePaymentMemberType>(_MakePaymentMember_QNAME, MakePaymentMemberType.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link MakePaymentMemberResponseType }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://www.tuscanyscatours.com/Payment/", name = "makePaymentMemberResponse") + public JAXBElement<MakePaymentMemberResponseType> createMakePaymentMemberResponse(MakePaymentMemberResponseType value) { + return new JAXBElement<MakePaymentMemberResponseType>(_MakePaymentMemberResponse_QNAME, MakePaymentMemberResponseType.class, null, value); + } + +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-spring/src/main/java/com/tuscanyscatours/payment/Payment.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-spring/src/main/java/com/tuscanyscatours/payment/Payment.java new file mode 100644 index 0000000000..bbbd03d89a --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-spring/src/main/java/com/tuscanyscatours/payment/Payment.java @@ -0,0 +1,43 @@ + +package com.tuscanyscatours.payment; + +import javax.jws.WebMethod; +import javax.jws.WebParam; +import javax.jws.WebResult; +import javax.jws.WebService; +import javax.xml.bind.annotation.XmlSeeAlso; +import javax.xml.ws.RequestWrapper; +import javax.xml.ws.ResponseWrapper; + + +/** + * This class was generated by the JAX-WS RI. + * JAX-WS RI 2.1.7-b01- + * Generated source version: 2.1 + * + */ +@WebService(name = "Payment", targetNamespace = "http://www.tuscanyscatours.com/Payment/") +@XmlSeeAlso({ + ObjectFactory.class +}) +public interface Payment { + + + /** + * + * @param amount + * @param customerId + * @return + * returns java.lang.String + */ + @WebMethod(action = "http://www.tuscanyscatours.com/Payment/makePayment") + @WebResult(name = "Status", targetNamespace = "") + @RequestWrapper(localName = "makePaymentMember", targetNamespace = "http://www.tuscanyscatours.com/Payment/", className = "com.tuscanyscatours.payment.MakePaymentMemberType") + @ResponseWrapper(localName = "makePaymentMemberResponse", targetNamespace = "http://www.tuscanyscatours.com/Payment/", className = "com.tuscanyscatours.payment.MakePaymentMemberResponseType") + public String makePaymentMember( + @WebParam(name = "CustomerId", targetNamespace = "") + String customerId, + @WebParam(name = "Amount", targetNamespace = "") + float amount); + +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-spring/src/main/java/com/tuscanyscatours/payment/PaymentService.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-spring/src/main/java/com/tuscanyscatours/payment/PaymentService.java new file mode 100644 index 0000000000..a430175976 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-spring/src/main/java/com/tuscanyscatours/payment/PaymentService.java @@ -0,0 +1,71 @@ + +package com.tuscanyscatours.payment; + +import java.net.MalformedURLException; +import java.net.URL; +import java.util.logging.Logger; +import javax.xml.namespace.QName; +import javax.xml.ws.Service; +import javax.xml.ws.WebEndpoint; +import javax.xml.ws.WebServiceClient; +import javax.xml.ws.WebServiceFeature; + + +/** + * This class was generated by the JAX-WS RI. + * JAX-WS RI 2.1.7-b01- + * Generated source version: 2.1 + * + */ +@WebServiceClient(name = "PaymentService", targetNamespace = "http://www.tuscanyscatours.com/Payment/", wsdlLocation = "file:/C:/simon/tuscany/travelsample/contributions/payment-java/src/main/resources/Payment.wsdl") +public class PaymentService + extends Service +{ + + private final static URL PAYMENTSERVICE_WSDL_LOCATION; + private final static Logger logger = Logger.getLogger(com.tuscanyscatours.payment.PaymentService.class.getName()); + + static { + URL url = null; + try { + URL baseUrl; + baseUrl = com.tuscanyscatours.payment.PaymentService.class.getResource("."); + url = new URL(baseUrl, "file:/C:/simon/tuscany/travelsample/contributions/payment-java/src/main/resources/Payment.wsdl"); + } catch (MalformedURLException e) { + logger.warning("Failed to create URL for the wsdl Location: 'file:/C:/simon/tuscany/travelsample/contributions/payment-java/src/main/resources/Payment.wsdl', retrying as a local file"); + logger.warning(e.getMessage()); + } + PAYMENTSERVICE_WSDL_LOCATION = url; + } + + public PaymentService(URL wsdlLocation, QName serviceName) { + super(wsdlLocation, serviceName); + } + + public PaymentService() { + super(PAYMENTSERVICE_WSDL_LOCATION, new QName("http://www.tuscanyscatours.com/Payment/", "PaymentService")); + } + + /** + * + * @return + * returns Payment + */ + @WebEndpoint(name = "PaymentPort") + public Payment getPaymentPort() { + return super.getPort(new QName("http://www.tuscanyscatours.com/Payment/", "PaymentPort"), Payment.class); + } + + /** + * + * @param features + * A list of {@link javax.xml.ws.WebServiceFeature} to configure on the proxy. Supported features not in the <code>features</code> parameter will have their default values. + * @return + * returns Payment + */ + @WebEndpoint(name = "PaymentPort") + public Payment getPaymentPort(WebServiceFeature... features) { + return super.getPort(new QName("http://www.tuscanyscatours.com/Payment/", "PaymentPort"), Payment.class, features); + } + +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-spring/src/main/java/com/tuscanyscatours/payment/package-info.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-spring/src/main/java/com/tuscanyscatours/payment/package-info.java new file mode 100644 index 0000000000..acd208f5c9 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-spring/src/main/java/com/tuscanyscatours/payment/package-info.java @@ -0,0 +1,2 @@ +@javax.xml.bind.annotation.XmlSchema(namespace = "http://www.tuscanyscatours.com/Payment/") +package com.tuscanyscatours.payment; diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-spring/src/main/java/scatours/payment/PaymentLauncher.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-spring/src/main/java/scatours/payment/PaymentLauncher.java new file mode 100644 index 0000000000..6917b9c57b --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/payment-spring/src/main/java/scatours/payment/PaymentLauncher.java @@ -0,0 +1,47 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package scatours.payment; + +import static scatours.launcher.LauncherUtil.locate; + +import org.apache.tuscany.sca.node.SCAClient; +import org.apache.tuscany.sca.node.SCANode; +import org.apache.tuscany.sca.node.SCANodeFactory; + +import com.tuscanyscatours.payment.Payment; + +public class PaymentLauncher { + + public static void main(String[] args) throws Exception { + SCANode node = SCANodeFactory.newInstance().createSCANode(null, + locate("payment-spring"), + locate("creditcard-payment-jaxb")); + node.start(); + + SCAClient client = (SCAClient)node; + Payment payment = client.getService(Payment.class, "Payment/Payment"); + + System.out.println("Payment Spring test"); + System.out.println("\nSuccessful Payment - Status = \n\n" + payment.makePaymentMember("c-0", 100.00f)); + System.out.println("\n\nFailed Payment - Status = \n\n" + payment.makePaymentMember("c-1", 100.00f)); + + node.stop(); + } +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/policy/build.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/policy/build.xml new file mode 100644 index 0000000000..57001f70e3 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/policy/build.xml @@ -0,0 +1,35 @@ +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> + +<project name="scatours-launcher-policy" default="compile"> + <import file="../../antdefs.xml"/> + <path id="compile-path"> + <pathelement path="../../util/launcher-common/target/scatours-util-launcher-common.jar"/> + </path> + + <target name="run"> + <java classname="scatours.PolicyLauncher" fork="true"> + <classpath> + <pathelement location="target/${ant.project.name}.jar"/> + <path refid="compile-path"/> + <pathelement location="${env.TUSCANY_HOME}/lib/tuscany-sca-manifest.jar"/> + </classpath> + </java> + </target> +</project> diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/policy/maven-eclipse.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/policy/maven-eclipse.xml new file mode 100644 index 0000000000..4ceebd71f7 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/policy/maven-eclipse.xml @@ -0,0 +1,8 @@ +<project default="copy-resources"> + <target name="init"/> + <target name="copy-resources" depends="init"> + <copy todir="target/classes/META-INF" filtering="true"> + <fileset dir="." includes="LICENSE|NOTICE"/> + </copy> + </target> +</project>
\ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/policy/pom.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/policy/pom.xml new file mode 100644 index 0000000000..dc72d0c3c0 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/policy/pom.xml @@ -0,0 +1,111 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<project> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>scatours</artifactId> + <version>1.0-SNAPSHOT</version> + <relativePath>../../pom.xml</relativePath> + </parent><version>1.0-SNAPSHOT</version> + <artifactId>scatours-launcher-policy</artifactId> + <name>Apache Tuscany SCA Tours Policy Launcher</name> + + <dependencies> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>scatours-util-launcher-common</artifactId> + <version>${pom.version}</version> + <scope>provided</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-node-api</artifactId> + <version>${tuscany.version}</version> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-implementation-java-runtime</artifactId> + <version>${tuscany.version}</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-binding-ws-axis2</artifactId> + <version>${tuscany.version}</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-host-jetty</artifactId> + <version>${tuscany.version}</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-node-impl</artifactId> + <version>${tuscany.version}</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-policy-security</artifactId> + <version>${tuscany.version}</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-policy-logging</artifactId> + <version>${tuscany.version}</version> + <scope>runtime</scope> + </dependency> + </dependencies> + + <build> + <finalName>${artifactId}</finalName> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-jar-plugin</artifactId> + <version>2.2</version> + <configuration> + <archive> + <manifestEntries> + <Class-Path>../util/scatours-util-launcher-common.jar</Class-Path> + </manifestEntries> + <manifest> + <addClasspath>${scatours.selfContained}</addClasspath> + <classpathPrefix>../lib/</classpathPrefix> + <mainClass>scatours.PolicyLauncher</mainClass> + </manifest> + </archive> + </configuration> + </plugin> + </plugins> + </build> +</project> diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/policy/src/main/java/scatours/PolicyLauncher.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/policy/src/main/java/scatours/PolicyLauncher.java new file mode 100644 index 0000000000..115d747ede --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/policy/src/main/java/scatours/PolicyLauncher.java @@ -0,0 +1,51 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package scatours; + +import static scatours.launcher.LauncherUtil.locate; + +import org.apache.tuscany.sca.node.SCAClient; +import org.apache.tuscany.sca.node.SCANode; +import org.apache.tuscany.sca.node.SCANodeFactory; + +public class PolicyLauncher { + + public static void main(String[] args) throws Exception { + SCANode node1 = + SCANodeFactory.newInstance().createSCANode(null, + locate("common"), + locate("policy-client"), + locate("payment-java-policy"), + locate("trip-policy")); + + node1.start(); + + SCANode node2 = SCANodeFactory.newInstance().createSCANode(null, + locate("creditcard-payment-jaxb-policy")); + + node2.start(); + + Runnable client = ((SCAClient)node1).getService(Runnable.class, "TestClient/Runnable"); + client.run(); + + node1.stop(); + node2.stop(); + } +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/pom.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/pom.xml new file mode 100644 index 0000000000..caf076997c --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/pom.xml @@ -0,0 +1,81 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <version>1.0-SNAPSHOT</version>
+ <artifactId>scatours-launchers</artifactId>
+ <packaging>pom</packaging>
+ <name>Apache Tuscany SCA Tours Launchers</name>
+
+ <profiles>
+ <profile>
+ <id>default</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ <modules>
+ <module>blog-feed</module>
+ <module>buildingblocks</module>
+ <module>currency-converter</module>
+ <module>currency-converter-corba</module>
+ <module>currency-converter-jms</module>
+ <module>currency-converter-rmi</module>
+ <module>currency-converter-ws</module>
+ <module>databinding</module>
+ <module>feed-logger</module>
+ <module>interaction</module>
+ <module>introducing</module>
+ <module>introducing-client</module>
+ <module>introducing-domain</module>
+ <module>introducing-tours</module>
+ <module>introducing-trips</module>
+ <module>jumpstart</module>
+ <module>fullapp</module>
+ <module>fullapp-domain</module>
+ <module>fullapp-nodes</module>
+ <module>help-pages</module>
+ <module>notification-ws</module>
+ <module>notification-corba</module>
+ <module>notification-ejb</module>
+ <module>notification-jms</module>
+ <module>notification-rmi</module>
+ <module>payment-java</module>
+ <module>payment-java-callback</module>
+ <module>payment-java-policy</module>
+ <module>payment-java-reference-pass</module>
+ <module>payment-spring</module>
+ <module>payment-spring-scatag</module>
+ <module>payment-bpel</module>
+ <module>payment-groovy</module>
+ <module>payment-python</module>
+ <module>policy</module>
+ <module>using</module>
+ </modules>
+ </profile>
+
+ </profiles>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/using/build.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/using/build.xml new file mode 100644 index 0000000000..8fb4c92ef2 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/using/build.xml @@ -0,0 +1,35 @@ +<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<project name="scatours-launcher-using" default="compile">
+ <import file="../../antdefs.xml"/>
+ <path id="compile-path">
+ <pathelement path="../../util/launcher-common/target/scatours-util-launcher-common.jar"/>
+ </path>
+
+ <target name="run">
+ <java classname="scatours.UsingLauncher" fork="true" failonerror="true">
+ <classpath>
+ <pathelement location="target/${ant.project.name}.jar"/>
+ <path refid="compile-path"/>
+ <pathelement location="${env.TUSCANY_HOME}/lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </java>
+ </target>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/using/pom.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/using/pom.xml new file mode 100644 index 0000000000..09e7647fc0 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/using/pom.xml @@ -0,0 +1,138 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent><version>1.0-SNAPSHOT</version>
+ <artifactId>scatours-launcher-using</artifactId>
+ <name>Apache Tuscany SCA Tours Using Launcher</name>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-util-launcher-common</artifactId>
+ <version>${pom.version}</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node-api</artifactId>
+ <version>${tuscany.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>activemq-all</artifactId>
+ <version>5.2.0</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>activemq-web-demo</artifactId>
+ </exclusion>
+ </exclusions>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node-impl</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-axis2</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-jetty</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-jms-runtime</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-jms-asf</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ejb-runtime</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.5</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <version>2.2</version>
+ <configuration>
+ <archive>
+ <manifestEntries>
+ <Class-Path>../util/scatours-util-launcher-common.jar</Class-Path>
+ </manifestEntries>
+ <manifest>
+ <addClasspath>${scatours.selfContained}</addClasspath>
+ <classpathPrefix>../lib/</classpathPrefix>
+ <mainClass>scatours.BuildingBlocksLauncher</mainClass>
+ </manifest>
+ </archive>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/using/src/main/java/scatours/UsingLauncher.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/using/src/main/java/scatours/UsingLauncher.java new file mode 100644 index 0000000000..59a2ea427f --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/using/src/main/java/scatours/UsingLauncher.java @@ -0,0 +1,208 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package scatours;
+
+//import org.apache.activemq.broker.BrokerService;
+import org.apache.tuscany.sca.node.SCAClient;
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.SCANodeFactory;
+
+import static scatours.launcher.LauncherUtil.locate;
+
+public class UsingLauncher {
+
+ public static void main(String[] args) throws Exception {
+ runAirportCodes();
+ runBindings();
+ runCarAutowire();
+ runCarPartner();
+ runCarWireElement();
+ runComplexPropertyElement();
+ runComplexPropertyType();
+ runCurrencyConverter();
+ runMultiDomain();
+ runTripAutowire();
+ runTripBooking();
+ runTripWireElement();
+ }
+
+ private static void runAirportCodes() throws Exception {
+ SCANode node =
+ SCANodeFactory.newInstance().createSCANode("test-clients/airportcodes-client.composite",
+ locate("using"));
+
+ node.start();
+
+ Runnable client = ((SCAClient)node).getService(Runnable.class, "AirportCodesClient");
+ client.run();
+
+ node.stop();
+ }
+
+ private static void runBindings() throws Exception {
+ SCANode node =
+ SCANodeFactory.newInstance().createSCANode("test-clients/bookings4-client.composite",
+ locate("using"));
+
+ node.start();
+
+ Runnable client = ((SCAClient)node).getService(Runnable.class, "Bookings4Client");
+ client.run();
+
+ node.stop();
+ }
+
+ private static void runCarAutowire() throws Exception {
+ SCANode node =
+ SCANodeFactory.newInstance().createSCANode("test-clients/carbookings3-client.composite",
+ locate("using"));
+
+ node.start();
+
+ Runnable client = ((SCAClient)node).getService(Runnable.class, "CarBookings3Client");
+ client.run();
+
+ node.stop();
+ }
+
+ private static void runCarPartner() throws Exception {
+ SCANode node =
+ SCANodeFactory.newInstance().createSCANode("test-clients/carbookings1-client.composite",
+ locate("using"));
+
+ node.start();
+
+ Runnable client = ((SCAClient)node).getService(Runnable.class, "CarBookings1Client");
+ client.run();
+
+ node.stop();
+ }
+
+ private static void runCarWireElement() throws Exception {
+ SCANode node =
+ SCANodeFactory.newInstance().createSCANode("test-clients/carbookings2-client.composite",
+ locate("using"));
+
+ node.start();
+
+ Runnable client = ((SCAClient)node).getService(Runnable.class, "CarBookings2Client");
+ client.run();
+
+ node.stop();
+ }
+
+ private static void runComplexPropertyElement() throws Exception {
+ SCANode node =
+ SCANodeFactory.newInstance().createSCANode("test-clients/orders1-client.composite",
+ locate("using"));
+
+ node.start();
+
+ Runnable client = ((SCAClient)node).getService(Runnable.class, "Orders1Client");
+ client.run();
+
+ node.stop();
+ }
+
+ private static void runComplexPropertyType() throws Exception {
+ SCANode node =
+ SCANodeFactory.newInstance().createSCANode("test-clients/orders2-client.composite",
+ locate("using"));
+
+ node.start();
+
+ Runnable client = ((SCAClient)node).getService(Runnable.class, "Orders2Client");
+ client.run();
+
+ node.stop();
+ }
+
+ private static void runCurrencyConverter() throws Exception {
+ SCANode node =
+ SCANodeFactory.newInstance().createSCANode("test-clients/converter-client.composite",
+ locate("using"));
+
+ node.start();
+
+ Runnable client = ((SCAClient)node).getService(Runnable.class, "ConverterClient");
+ client.run();
+
+ node.stop();
+ }
+
+ private static void runMultiDomain() throws Exception {
+ SCANode hotelsNode =
+ SCANodeFactory.newInstance().createSCANode("test-clients/hotelsdomain-client.composite",
+ locate("using"));
+ SCANode toursNode =
+ SCANodeFactory.newInstance().createSCANode("test-clients/toursdomain-client.composite",
+ locate("using"));
+
+ hotelsNode.start();
+ toursNode.start();
+
+ Runnable hotelsClient = ((SCAClient)hotelsNode).getService(Runnable.class, "HotelsDomainClient");
+ hotelsClient.run();
+ Runnable toursClient = ((SCAClient)toursNode).getService(Runnable.class, "ToursDomainClient");
+ toursClient.run();
+
+ toursNode.stop();
+ hotelsNode.stop();
+ }
+
+ private static void runTripAutowire() throws Exception {
+ SCANode node =
+ SCANodeFactory.newInstance().createSCANode("test-clients/bookings3-client.composite",
+ locate("using"));
+
+ node.start();
+
+ Runnable client = ((SCAClient)node).getService(Runnable.class, "Bookings3Client");
+ client.run();
+
+ node.stop();
+ }
+
+ private static void runTripBooking() throws Exception {
+ SCANode node =
+ SCANodeFactory.newInstance().createSCANode("test-clients/bookings1-client.composite",
+ locate("using"));
+
+ node.start();
+
+ Runnable client = ((SCAClient)node).getService(Runnable.class, "Bookings1Client");
+ client.run();
+
+ node.stop();
+ }
+
+ private static void runTripWireElement() throws Exception {
+ SCANode node =
+ SCANodeFactory.newInstance().createSCANode("test-clients/bookings2-client.composite",
+ locate("using"));
+
+ node.start();
+
+ Runnable client = ((SCAClient)node).getService(Runnable.class, "Bookings2Client");
+ client.run();
+
+ node.stop();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/using/src/main/resources/jndi.properties b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/using/src/main/resources/jndi.properties new file mode 100644 index 0000000000..80236a8e6c --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/using/src/main/resources/jndi.properties @@ -0,0 +1,38 @@ +## ---------------------------------------------------------------------------
+## Licensed to the Apache Software Foundation (ASF) under one or more
+## contributor license agreements. See the NOTICE file distributed with
+## this work for additional information regarding copyright ownership.
+## The ASF licenses this file to You under the Apache License, Version 2.0
+## (the "License"); you may not use this file except in compliance with
+## the License. You may obtain a copy of the License at
+##
+## http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing, software
+## distributed under the License is distributed on an "AS IS" BASIS,
+## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+## See the License for the specific language governing permissions and
+## limitations under the License.
+## ---------------------------------------------------------------------------
+
+# START SNIPPET: jndi
+
+java.naming.factory.initial = org.apache.activemq.jndi.ActiveMQInitialContextFactory
+
+# use the following property to configure the default connector
+java.naming.provider.url = vm://localhost?broker.persistent=false
+
+# use the following property to specify the JNDI name the connection factory
+# should appear as.
+#connectionFactoryNames = connectionFactory, queueConnectionFactory, topicConnectionFactry
+connectionFactoryNames = ConnectionFactory
+
+# register some queues in JNDI using the form
+# queue.[jndiName] = [physicalName]
+queue.Bookings = BookingsRequestQueue
+
+# register some topics in JNDI using the form
+# topic.[jndiName] = [physicalName]
+#topic.MyTopic = example.MyTopic
+
+# END SNIPPET: jndi
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/using/src/test/java/scatours/UsingTestCase.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/using/src/test/java/scatours/UsingTestCase.java new file mode 100644 index 0000000000..cd643b6649 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/using/src/test/java/scatours/UsingTestCase.java @@ -0,0 +1,42 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package scatours;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Tests the launcher
+ */
+public class UsingTestCase {
+
+ @Before
+ public void startServer() throws Exception {
+ }
+
+ @Test
+ public void testLauncher() throws Exception {
+ UsingLauncher.main(null);
+ }
+
+ @After
+ public void stopServer() throws Exception {
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/pom.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/pom.xml new file mode 100644 index 0000000000..417f6ad73f --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/pom.xml @@ -0,0 +1,111 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<project> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-sca</artifactId> + <version>1.6</version> + </parent> + <artifactId>scatours</artifactId> + <packaging>pom</packaging> + <version>1.0-SNAPSHOT</version> + <name>Apache Tuscany SCA Tours Travel Sample</name> + + <repositories> + <repository> + <id>maven.central</id> + <url>http://repo2.maven.org/maven2</url> + <releases> + <enabled>true</enabled> + </releases> + <snapshots> + <enabled>false</enabled> + </snapshots> + </repository> + <repository> + <id>java.net</id> + <name>java.net Maven 1.x Repository</name> + <url>http://download.java.net/maven/1</url> + <layout>legacy</layout> + <snapshots> + <enabled>false</enabled> + </snapshots> + </repository> + <repository> + <id>java.net2</id> + <name>java.net Maven 2.x Repository</name> + <url>http://download.java.net/maven/2</url> + <snapshots> + <enabled>false</enabled> + </snapshots> + </repository> + </repositories> + + <pluginRepositories> + <pluginRepository> + <id>java.net2</id> + <name>java.net Maven 2.x Repository</name> + <url>http://download.java.net/maven/2</url> + <snapshots> + <enabled>false</enabled> + </snapshots> + </pluginRepository> + </pluginRepositories> + + <profiles> + <profile> + <!-- The default profile produces a subset distribution which excludes + libraries that are present in the Tuscany SCA binary distro. --> + <id>default</id> + <activation> + <activeByDefault>true</activeByDefault> + </activation> + <properties> + <scatours.selfContained>false</scatours.selfContained> + </properties> + </profile> + + <profile> + <!-- Use mvn -Pselfcontained to produce a self-contained distribution + with all library dependencies included. --> + <id>selfcontained</id> + <properties> + <scatours.selfContained>true</scatours.selfContained> + </properties> + </profile> + </profiles> + + <properties> + <scatours.version>1.0-SNAPSHOT</scatours.version> + <tuscany.version>1.6</tuscany.version> + </properties> + + <modules> + <module>util</module> + <module>contributions</module> + <module>domainconfig</module> + <module>launchers</module> + <module>services</module> + <module>clients</module> + <module>binaries</module> + </modules> + +</project> diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/services/build.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/services/build.xml new file mode 100644 index 0000000000..326563e763 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/services/build.xml @@ -0,0 +1,48 @@ +<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<project name="scatours-services" default="compile">
+
+ <target name="compile">
+ <antcall target="allsubdirs">
+ <param name="target" value="compile"/>
+ </antcall>
+ </target>
+
+ <target name="test">
+ <antcall target="allsubdirs">
+ <param name="target" value="test"/>
+ </antcall>
+ </target>
+
+ <target name="clean">
+ <antcall target="allsubdirs">
+ <param name="target" value="clean"/>
+ </antcall>
+ </target>
+
+ <target name="allsubdirs">
+ <ant dir="smsgateway-corba" target="${target}"/>
+ <ant dir="smsgateway-ejb" target="${target}"/>
+ <ant dir="smsgateway-jaxws" target="${target}"/>
+ <ant dir="smsgateway-jms" target="${target}"/>
+ <ant dir="smsgateway-rmi" target="${target}"/>
+ </target>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/services/pom.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/services/pom.xml new file mode 100644 index 0000000000..8428d9a791 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/services/pom.xml @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <version>1.0-SNAPSHOT</version>
+ <artifactId>scatours-services</artifactId>
+ <packaging>pom</packaging>
+ <name>Apache Tuscany SCA Tours non-SCA Services</name>
+
+ <profiles>
+ <profile>
+ <id>default</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ <modules>
+ <module>smsgateway-jaxws</module>
+ <module>smsgateway-corba</module>
+ <module>smsgateway-ejb</module>
+ <module>smsgateway-jms</module>
+ <module>smsgateway-rmi</module>
+ </modules>
+ </profile>
+
+ </profiles>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/services/smsgateway-corba/build.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/services/smsgateway-corba/build.xml new file mode 100644 index 0000000000..0495e2b956 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/services/smsgateway-corba/build.xml @@ -0,0 +1,37 @@ +<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<project name="scatours-service-smsgateway-corba" default="compile">
+ <import file="../../antdefs.xml"/>
+
+ <target name="idljava">
+ <antcall target="idlj">
+ <param name="idljopts" value="-fall"/>
+ <param name="idlfile" value="sms-gateway.idl"/>
+ <param name="javaclass" value="scatours/smsgateway/SMSGatewayPOA.class"/>
+ </antcall>
+ </target>
+
+ <target name="run">
+ <java classname="scatours.smsgateway.SMSGatewayCORBAServiceBootstrap"
+ fork="true" failonerror="true">
+ <classpath location="target/${ant.project.name}.jar"/>
+ </java>
+ </target>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/services/smsgateway-corba/pom.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/services/smsgateway-corba/pom.xml new file mode 100644 index 0000000000..261c22d5e1 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/services/smsgateway-corba/pom.xml @@ -0,0 +1,76 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent><version>1.0-SNAPSHOT</version>
+ <artifactId>scatours-service-smsgateway-corba</artifactId>
+ <name>Apache Tuscany SCA Tours SMS Gateway CORBA Service</name>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <version>2.2</version>
+ <configuration>
+ <archive>
+ <manifest>
+ <addClasspath>${scatours.selfContained}</addClasspath>
+ <classpathPrefix>../lib/</classpathPrefix>
+ <mainClass>scatours.smsgateway.SMSGatewayCORBAServiceBootstrap</mainClass>
+ </manifest>
+ </archive>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>idlj-maven-plugin</artifactId>
+ <version>1.1</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <compiler>idlj</compiler>
+ <sources>
+ <source>
+ <includes>
+ <include>sms-gateway.idl</include>
+ </includes>
+ <emitStubs>true</emitStubs>
+ <emitSkeletons>true</emitSkeletons>
+ <compatible>false</compatible> + </source>
+ </sources>
+ <sourceDirectory>${basedir}/src/main/resources</sourceDirectory>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
\ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/services/smsgateway-corba/src/main/java/scatours/smsgateway/SMSGatewayCORBAServiceBootstrap.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/services/smsgateway-corba/src/main/java/scatours/smsgateway/SMSGatewayCORBAServiceBootstrap.java new file mode 100644 index 0000000000..9a53303e88 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/services/smsgateway-corba/src/main/java/scatours/smsgateway/SMSGatewayCORBAServiceBootstrap.java @@ -0,0 +1,105 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package scatours.smsgateway;
+
+import java.io.BufferedReader;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+
+import org.omg.CORBA.ORB;
+import org.omg.CORBA.Object;
+import org.omg.CosNaming.NameComponent;
+import org.omg.CosNaming.NamingContextExt;
+import org.omg.CosNaming.NamingContextExtHelper;
+import org.omg.PortableServer.POA;
+import org.omg.PortableServer.POAHelper;
+
+public class SMSGatewayCORBAServiceBootstrap {
+
+ public static void main(String[] args) throws Exception {
+ String home = System.getProperty("java.home");
+ String[] tnsCommand = {"" + home + "/bin/tnameserv", "-ORBInitialPort", "5080"};
+ Process tns = null;
+
+ try {
+ System.out.println("Starting transient name server process (port=5080)");
+
+ // Start tnameserv in a separate process
+ tns = Runtime.getRuntime().exec(tnsCommand);
+
+ // Wait for the tnameserv process to complete its startup, and
+ // display the output from the tnameserv process on the console
+ InputStream tnsOut = tns.getInputStream();
+ BufferedReader tnsOutReader = new BufferedReader(new InputStreamReader(tnsOut));
+ while (true) {
+ String line = tnsOutReader.readLine();
+ System.out.println("tnameserv: " + line);
+ if ("Ready.".equals(line)) {
+ break;
+ }
+ }
+
+ System.out.println("Publishing SMS Gateway Service as a CORBA service: SMSGatewayCORBAService (port=5080)");
+
+ String[] orbArgs = {"-ORBInitialPort", "5080"};
+ ORB orb = ORB.init(orbArgs, null);
+
+ NamingContextExt namingCtx;
+ try {
+ Object objRef = orb.resolve_initial_references("NameService");
+ namingCtx = NamingContextExtHelper.narrow(objRef);
+ } catch (Exception ex) {
+ System.err.println("ERROR: Failed to resolve Name Service.");
+ //System.err.println("Don't forget to run it with:");
+ //System.err.println(" tnameserv -ORBInitialPort 5080");
+ return;
+ }
+
+ Object rootPoaRef = orb.resolve_initial_references("RootPOA");
+ POA rootPoa = POAHelper.narrow(rootPoaRef);
+ rootPoa.the_POAManager().activate();
+
+ SMSGatewayServant smsGateway = new SMSGatewayServant();
+ Object smsGatewayRef = rootPoa.servant_to_reference(smsGateway);
+
+ String corbaServerName = "SMSGatewayCORBAService";
+ NameComponent[] name = {new NameComponent(corbaServerName, "")};
+ namingCtx.rebind(name, smsGatewayRef);
+
+ System.out.println("CORBA server running - press Enter to shutdown");
+ System.in.read();
+
+ orb.shutdown(true);
+ orb.destroy();
+
+ } finally {
+ // Make sure that the tnameserv process gets destroyed and its
+ // listener port is released
+ if (tns != null) {
+ System.out.println("Destroying transient name server process");
+ try {
+ tns.destroy();
+ System.out.println("Transient name server process destroyed");
+ } catch (Exception e) {
+ // ignore
+ }
+ }
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/services/smsgateway-corba/src/main/java/scatours/smsgateway/SMSGatewayServant.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/services/smsgateway-corba/src/main/java/scatours/smsgateway/SMSGatewayServant.java new file mode 100644 index 0000000000..693a909dca --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/services/smsgateway-corba/src/main/java/scatours/smsgateway/SMSGatewayServant.java @@ -0,0 +1,30 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package scatours.smsgateway;
+
+public class SMSGatewayServant extends SMSGatewayPOA {
+
+ public boolean sendSMS(String fromNumber, String toNumber, String text) {
+ System.out.println("Sending SMS message");
+ System.out.println("From: " + fromNumber);
+ System.out.println("To: " + toNumber);
+ System.out.println("Message: " + text);
+ return true;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/services/smsgateway-corba/src/main/resources/sms-gateway.idl b/sca-java-1.x/branches/sca-java-travelsample-1.0/services/smsgateway-corba/src/main/resources/sms-gateway.idl new file mode 100644 index 0000000000..30a87f5c7a --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/services/smsgateway-corba/src/main/resources/sms-gateway.idl @@ -0,0 +1,26 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + + module scatours { + module smsgateway { + interface SMSGateway { + boolean sendSMS(in string fromNumber, in string toNumber, in string text); + }; + }; +}; diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/services/smsgateway-ejb/build.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/services/smsgateway-ejb/build.xml new file mode 100644 index 0000000000..cc7456ac52 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/services/smsgateway-ejb/build.xml @@ -0,0 +1,35 @@ +<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<project name="scatours-service-smsgateway-ejb" default="compile">
+ <import file="../../antdefs.xml"/>
+
+ <!-- The "run" target starts an OpenEJB service endpoint for the
+ SMS gateway service. This endpoint is used by the "run" target
+ of the notification-ejb launcher. -->
+ <target name="run">
+ <java classname="com.tuscanyscatours.smsgateway.SMSGatewayEJBServiceBootstrap"
+ fork="true" failonerror="true">
+ <classpath>
+ <pathelement location="target/${ant.project.name}.jar"/>
+ <fileset dir="${env.OPENEJB_HOME}/lib"/>
+ </classpath>
+ </java>
+ </target>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/services/smsgateway-ejb/pom.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/services/smsgateway-ejb/pom.xml new file mode 100644 index 0000000000..9be6e6647d --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/services/smsgateway-ejb/pom.xml @@ -0,0 +1,58 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent><version>1.0-SNAPSHOT</version>
+ <artifactId>scatours-service-smsgateway-ejb</artifactId>
+ <name>Apache Tuscany SCA Tours SMS Gateway EJB Service</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.openejb</groupId>
+ <artifactId>javaee-api</artifactId>
+ <version>5.0-2</version>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <version>2.2</version>
+ <configuration>
+ <archive>
+ <manifestEntries>
+ <Class-Path>../util/scatours-util-openejb-runtime.jar</Class-Path>
+ <Main-Class>com.tuscanyscatours.smsgateway.SMSGatewayEJBServiceBootstrap</Main-Class>
+ </manifestEntries>
+ </archive>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/services/smsgateway-ejb/src/main/java/com/tuscanyscatours/smsgateway/SMSGateway.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/services/smsgateway-ejb/src/main/java/com/tuscanyscatours/smsgateway/SMSGateway.java new file mode 100644 index 0000000000..b462dd1be8 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/services/smsgateway-ejb/src/main/java/com/tuscanyscatours/smsgateway/SMSGateway.java @@ -0,0 +1,30 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package com.tuscanyscatours.smsgateway; + +import javax.ejb.Remote; + +/** + * A gateway to send SMS messages. + */ +@Remote +public interface SMSGateway { + boolean sendSMS(String fromNumber, String toNumber, String text); +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/services/smsgateway-ejb/src/main/java/com/tuscanyscatours/smsgateway/SMSGatewayEJBServiceBootstrap.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/services/smsgateway-ejb/src/main/java/com/tuscanyscatours/smsgateway/SMSGatewayEJBServiceBootstrap.java new file mode 100644 index 0000000000..4da784bc55 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/services/smsgateway-ejb/src/main/java/com/tuscanyscatours/smsgateway/SMSGatewayEJBServiceBootstrap.java @@ -0,0 +1,45 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package com.tuscanyscatours.smsgateway;
+
+import java.util.Properties;
+
+import javax.naming.Context;
+import javax.naming.InitialContext;
+
+public class SMSGatewayEJBServiceBootstrap {
+
+ public static void main(String[] args) throws Exception {
+ System.out.println("Publishing SMS Gateway Service as an EJB service");
+
+ Properties properties = new Properties();
+ properties.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.apache.openejb.client.LocalInitialContextFactory");
+ properties.setProperty("openejb.embedded.remotable", "true");
+
+ InitialContext initialContext = new InitialContext(properties);
+
+ // Object object = initialContext.lookup("SMSGatewayImplRemote");
+ // SMSGateway smsGateway = (SMSGateway) object;
+ // smsGateway.sendSMS("From", "to", "Message");
+
+ System.out.println("EJB server running - waiting for requests");
+ System.out.println("Press enter to shutdown.");
+ System.in.read();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/services/smsgateway-ejb/src/main/java/com/tuscanyscatours/smsgateway/SMSGatewayImpl.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/services/smsgateway-ejb/src/main/java/com/tuscanyscatours/smsgateway/SMSGatewayImpl.java new file mode 100644 index 0000000000..3bdf48a7ea --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/services/smsgateway-ejb/src/main/java/com/tuscanyscatours/smsgateway/SMSGatewayImpl.java @@ -0,0 +1,33 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package com.tuscanyscatours.smsgateway;
+
+import javax.ejb.Stateless;
+
+@Stateless
+public class SMSGatewayImpl implements SMSGateway {
+
+ public boolean sendSMS(String fromNumber, String toNumber, String text) {
+ System.out.println("Sending SMS message");
+ System.out.println("From: " + fromNumber);
+ System.out.println("To: " + toNumber);
+ System.out.println("Message: " + text);
+ return true;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/services/smsgateway-ejb/src/main/resources/META-INF/ejb-jar.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/services/smsgateway-ejb/src/main/resources/META-INF/ejb-jar.xml new file mode 100644 index 0000000000..116a25630c --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/services/smsgateway-ejb/src/main/resources/META-INF/ejb-jar.xml @@ -0,0 +1,2 @@ +<?xml version="1.0"?> + <ejb-jar/>
\ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/services/smsgateway-jaxws/build.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/services/smsgateway-jaxws/build.xml new file mode 100644 index 0000000000..6c57e2420b --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/services/smsgateway-jaxws/build.xml @@ -0,0 +1,53 @@ +<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<project name="scatours-service-smsgateway-jaxws" default="compile">
+ <import file="../../antdefs.xml"/>
+
+ <!-- The "run" target starts a JAX-WS service endpoint for the
+ SMS gateway service. This endpoint is used by the "run" target
+ of the notification-ws launcher. -->
+ <target name="run" depends="is-jdk6, jaxws-jdk6, jaxws-jdk5">
+ <java classname="com.tuscanyscatours.smsgateway.SMSGatewayServiceBootstrap" fork="true">
+ <classpath>
+ <pathelement location="target/${ant.project.name}.jar"/>
+ <path refid="jaxws-path"/>
+ </classpath>
+ </java>
+ </target>
+
+ <!-- check to see if we are running on JDK 6 -->
+ <target name="is-jdk6">
+ <condition property="jdk6">
+ <available classname="javax.xml.ws.Endpoint"/>
+ </condition>
+ </target>
+
+ <!-- JDK 6 contains JAX-WS so we don't need it on the classpath -->
+ <target name="jaxws-jdk6" if="jdk6">
+ <path id="jaxws-path"/>
+ </target>
+
+ <!-- on JDK 5 we need to add the JAX-WS runtime to the classpath -->
+ <target name="jaxws-jdk5" unless="jdk6">
+ <path id="jaxws-path">
+ <fileset dir="${env.JAXWS_HOME}/lib"/>
+ </path>
+ </target>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/services/smsgateway-jaxws/pom.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/services/smsgateway-jaxws/pom.xml new file mode 100644 index 0000000000..06c497db00 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/services/smsgateway-jaxws/pom.xml @@ -0,0 +1,63 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent><version>1.0-SNAPSHOT</version>
+ <artifactId>scatours-service-smsgateway-jaxws</artifactId>
+ <name>Apache Tuscany SCA Tours SMS Gateway JAX-WS Service</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>javax.xml.ws</groupId>
+ <artifactId>jaxws-api</artifactId>
+ <version>2.1</version>
+ <exclusions>
+ <exclusion>
+ <groupId>javax.xml.soap</groupId>
+ <artifactId>saaj-api</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <version>2.2</version>
+ <configuration>
+ <archive>
+ <manifestEntries>
+ <Class-Path>../util/scatours-util-jaxws-runtime.jar</Class-Path>
+ <Main-Class>com.tuscanyscatours.smsgateway.SMSGatewayServiceBootstrap</Main-Class>
+ </manifestEntries>
+ </archive>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/services/smsgateway-jaxws/src/main/java/com/tuscanyscatours/smsgateway/SMSGatewayService.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/services/smsgateway-jaxws/src/main/java/com/tuscanyscatours/smsgateway/SMSGatewayService.java new file mode 100644 index 0000000000..696ab12daa --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/services/smsgateway-jaxws/src/main/java/com/tuscanyscatours/smsgateway/SMSGatewayService.java @@ -0,0 +1,32 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package com.tuscanyscatours.smsgateway;
+
+import javax.jws.WebMethod;
+import javax.jws.WebService;
+import javax.jws.soap.SOAPBinding;
+import javax.jws.soap.SOAPBinding.Style;
+
+@WebService
+@SOAPBinding(style = Style.RPC)
+public interface SMSGatewayService {
+
+ @WebMethod
+ boolean sendSMS(String fromNumber, String toNumber, String text);
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/services/smsgateway-jaxws/src/main/java/com/tuscanyscatours/smsgateway/SMSGatewayServiceBootstrap.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/services/smsgateway-jaxws/src/main/java/com/tuscanyscatours/smsgateway/SMSGatewayServiceBootstrap.java new file mode 100644 index 0000000000..6631aee907 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/services/smsgateway-jaxws/src/main/java/com/tuscanyscatours/smsgateway/SMSGatewayServiceBootstrap.java @@ -0,0 +1,31 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package com.tuscanyscatours.smsgateway;
+
+import javax.xml.ws.Endpoint;
+
+public class SMSGatewayServiceBootstrap {
+
+ public static void main(String[] args) {
+ System.out.println("Publishing SMS Gateway Service as web service: http://localhost:8081/SMSGatewayService");
+ System.out.println("Press Ctrl^C to terminate...");
+
+ Endpoint.publish("http://localhost:8081/SMSGatewayService", new SMSGatewayServiceImpl());
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/services/smsgateway-jaxws/src/main/java/com/tuscanyscatours/smsgateway/SMSGatewayServiceImpl.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/services/smsgateway-jaxws/src/main/java/com/tuscanyscatours/smsgateway/SMSGatewayServiceImpl.java new file mode 100644 index 0000000000..cd4eab052d --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/services/smsgateway-jaxws/src/main/java/com/tuscanyscatours/smsgateway/SMSGatewayServiceImpl.java @@ -0,0 +1,33 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package com.tuscanyscatours.smsgateway;
+
+import javax.jws.WebService;
+
+@WebService(endpointInterface = "com.tuscanyscatours.smsgateway.SMSGatewayService")
+public class SMSGatewayServiceImpl implements SMSGatewayService {
+
+ public boolean sendSMS(String fromNumber, String toNumber, String text) {
+ System.out.println("Sending SMS message");
+ System.out.println("From: " + fromNumber);
+ System.out.println("To: " + toNumber);
+ System.out.println("Message: " + text);
+ return true;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/services/smsgateway-jms/build.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/services/smsgateway-jms/build.xml new file mode 100644 index 0000000000..389f6296c3 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/services/smsgateway-jms/build.xml @@ -0,0 +1,35 @@ +<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<project name="scatours-service-smsgateway-jms" default="compile">
+ <import file="../../antdefs.xml"/>
+
+ <!-- The "run" target creates JMS request and response queues for the
+ SMS gateway service. These queues are used by the "run" target of
+ the notification-jms launcher. -->
+ <target name="run">
+ <java classname="scatours.smsgateway.SMSGatewayJMSServiceBootstrap" fork="true">
+ <classpath>
+ <pathelement location="target/${ant.project.name}.jar"/>
+ <!-- The following is used to bring in the ActiveMQ runtime. -->
+ <pathelement location="${env.TUSCANY_HOME}/lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </java>
+ </target>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/services/smsgateway-jms/pom.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/services/smsgateway-jms/pom.xml new file mode 100644 index 0000000000..9b0bee5a6f --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/services/smsgateway-jms/pom.xml @@ -0,0 +1,97 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent><version>1.0-SNAPSHOT</version>
+ <artifactId>scatours-service-smsgateway-jms</artifactId>
+ <name>Apache Tuscany SCA Tours SMS Gateway JMS Service</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>activemq-all</artifactId>
+ <version>5.2.0</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>activemq-web-demo</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.ws.commons.axiom</groupId>
+ <artifactId>axiom-api</artifactId>
+ <version>1.2.7</version>
+ <exclusions>
+ <exclusion>
+ <groupId>xerces</groupId>
+ <artifactId>xercesImpl</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>stax</groupId>
+ <artifactId>stax-api</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>xml-apis</groupId>
+ <artifactId>xml-apis</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.ws.commons.axiom</groupId>
+ <artifactId>axiom-impl</artifactId>
+ <version>1.2.7</version>
+ <scope>runtime</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>stax</groupId>
+ <artifactId>stax-api</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <version>2.2</version>
+ <configuration>
+ <archive>
+ <manifest>
+ <addClasspath>${scatours.selfContained}</addClasspath>
+ <classpathPrefix>../lib/</classpathPrefix>
+ <mainClass>scatours.smsgateway.SMSGatewayJMSServiceBootstrap</mainClass>
+ </manifest>
+ </archive>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/services/smsgateway-jms/src/main/java/scatours/smsgateway/SMSGateway.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/services/smsgateway-jms/src/main/java/scatours/smsgateway/SMSGateway.java new file mode 100644 index 0000000000..e6e866fa1d --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/services/smsgateway-jms/src/main/java/scatours/smsgateway/SMSGateway.java @@ -0,0 +1,30 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package scatours.smsgateway; + +import java.rmi.Remote; +import java.rmi.RemoteException; + +/** + * A gateway to send SMS messages. + */ +public interface SMSGateway extends Remote { + boolean sendSMS(String fromNumber, String toNumber, String text) throws RemoteException; +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/services/smsgateway-jms/src/main/java/scatours/smsgateway/SMSGatewayImpl.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/services/smsgateway-jms/src/main/java/scatours/smsgateway/SMSGatewayImpl.java new file mode 100644 index 0000000000..c35aa61513 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/services/smsgateway-jms/src/main/java/scatours/smsgateway/SMSGatewayImpl.java @@ -0,0 +1,126 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package scatours.smsgateway;
+
+import java.io.ByteArrayInputStream;
+
+import javax.jms.BytesMessage;
+import javax.jms.Destination;
+import javax.jms.JMSException;
+import javax.jms.Message;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageProducer;
+import javax.jms.Session;
+import javax.jms.TextMessage;
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+
+import org.apache.axiom.om.OMAbstractFactory;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMFactory;
+import org.apache.axiom.om.OMText;
+import org.apache.axiom.om.impl.builder.StAXOMBuilder;
+
+public class SMSGatewayImpl implements SMSGateway {
+
+ private final Session session;
+ private final MessageConsumer consumer;
+ private final MessageProducer producer;
+
+ public SMSGatewayImpl(Session session) throws JMSException {
+ this.session = session;
+ Destination requestDest = session.createQueue("SMSRequestQueue");
+ consumer = session.createConsumer(requestDest);
+
+ Destination responseDest = session.createQueue("SMSResponseQueue");
+ producer = session.createProducer(responseDest);
+ }
+
+ public void start() throws JMSException, XMLStreamException {
+ while (true) {
+ Message message = consumer.receive();
+ handleRequest(message);
+ }
+ }
+
+ private void handleRequest(Message inMessage) throws XMLStreamException, JMSException {
+ OMElement xml = parseXMLPayload(inMessage);
+
+ String fromNumber = getStringArg(xml, 0);
+ String toNumber = getStringArg(xml, 1);
+ String text = getStringArg(xml, 2);
+
+ boolean result = sendSMS(fromNumber, toNumber, text);
+
+ String responseXML = createXMLResponse(result);
+
+ TextMessage outMessage = createResponseMessage(inMessage.getJMSMessageID(), responseXML);
+ producer.send(outMessage);
+ }
+
+ private OMElement parseXMLPayload(Message inMessage) throws JMSException, XMLStreamException {
+ final byte[] msgData;
+ if (inMessage instanceof TextMessage) {
+ msgData = ((TextMessage)inMessage).getText().getBytes();
+ } else if (inMessage instanceof BytesMessage) {
+ BytesMessage bytesMessage = (BytesMessage)inMessage;
+ msgData = new byte[(int)bytesMessage.getBodyLength()];
+ bytesMessage.readBytes(msgData);
+ } else {
+ throw new JMSException("Unsupported JMS message type of " + inMessage.getClass().getName());
+ }
+ ByteArrayInputStream in = new ByteArrayInputStream(msgData);
+ StAXOMBuilder builder = new StAXOMBuilder(in);
+ OMElement doc = builder.getDocumentElement();
+ return doc;
+ }
+
+ private String getStringArg(OMElement doc, int i) {
+ QName argQName = new QName("arg" + i);
+ OMElement arg = doc.getFirstChildWithName(argQName);
+ if (arg == null) {
+ return null;
+ }
+ return arg.getText();
+ }
+
+ public boolean sendSMS(String fromNumber, String toNumber, String text) {
+ System.out.println("From: " + fromNumber);
+ System.out.println("To: " + toNumber);
+ System.out.println(text);
+ return true;
+ }
+
+ private String createXMLResponse(boolean result) {
+ OMFactory omFactory = OMAbstractFactory.getOMFactory();
+ OMElement response = omFactory.createOMElement("sendSMS", "http://smsgateway.scatours/", "ns2");
+ OMElement returnValue = omFactory.createOMElement("return", null);
+ OMText returnV = omFactory.createOMText(Boolean.toString(result));
+ returnValue.addChild(returnV);
+ response.addChild(returnValue);
+ return response.toString();
+ }
+
+ private TextMessage createResponseMessage(String correlationID, String responseXML) throws JMSException {
+ TextMessage outMessage = session.createTextMessage("sendSMS");
+ outMessage.setText(responseXML);
+ outMessage.setJMSCorrelationID(correlationID);
+ return outMessage;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/services/smsgateway-jms/src/main/java/scatours/smsgateway/SMSGatewayJMSServiceBootstrap.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/services/smsgateway-jms/src/main/java/scatours/smsgateway/SMSGatewayJMSServiceBootstrap.java new file mode 100644 index 0000000000..d8543266e3 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/services/smsgateway-jms/src/main/java/scatours/smsgateway/SMSGatewayJMSServiceBootstrap.java @@ -0,0 +1,47 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package scatours.smsgateway;
+
+import javax.jms.Connection;
+import javax.jms.Session;
+
+import org.apache.activemq.ActiveMQConnectionFactory;
+import org.apache.activemq.broker.BrokerService;
+
+public class SMSGatewayJMSServiceBootstrap {
+
+ public static void main(String[] args) throws Exception {
+ final BrokerService jmsBroker = new BrokerService();
+ jmsBroker.setPersistent(false);
+ jmsBroker.setUseJmx(false);
+ jmsBroker.addConnector("tcp://localhost:61619");
+ jmsBroker.start();
+
+ System.out.println("Publishing SMS Gateway Service as a JMS service: tcp://localhost:61619");
+ System.out.println("Press Ctrl^C to terminate...");
+
+ ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory("tcp://localhost:61619");
+ Connection connection = connectionFactory.createConnection();
+ connection.start();
+ Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+ SMSGatewayImpl impl = new SMSGatewayImpl(session);
+ impl.start();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/services/smsgateway-rmi/build.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/services/smsgateway-rmi/build.xml new file mode 100644 index 0000000000..13d4702867 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/services/smsgateway-rmi/build.xml @@ -0,0 +1,31 @@ +<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<project name="scatours-service-smsgateway-rmi" default="compile">
+ <import file="../../antdefs.xml"/>
+
+ <!-- The "run" target starts an RMI server for the SMS gateway service.
+ This server is used by the "run" target of the notification-rmi launcher. -->
+ <target name="run">
+ <java classname="com.tuscanyscatours.smsgateway.SMSGatewayRMIServiceBootstrap"
+ fork="true" failonerror="true">
+ <classpath location="target/${ant.project.name}.jar"/>
+ </java>
+ </target>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/services/smsgateway-rmi/pom.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/services/smsgateway-rmi/pom.xml new file mode 100644 index 0000000000..1922ec271b --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/services/smsgateway-rmi/pom.xml @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent><version>1.0-SNAPSHOT</version>
+ <artifactId>scatours-service-smsgateway-rmi</artifactId>
+ <name>Apache Tuscany SCA Tours SMS Gateway RMI Service</name>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <version>2.2</version>
+ <configuration>
+ <archive>
+ <manifest>
+ <addClasspath>${scatours.selfContained}</addClasspath>
+ <classpathPrefix>../lib/</classpathPrefix>
+ <mainClass>com.tuscanyscatours.smsgateway.SMSGatewayRMIServiceBootstrap</mainClass>
+ </manifest>
+ </archive>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/services/smsgateway-rmi/src/main/java/com/tuscanyscatours/smsgateway/SMSGateway.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/services/smsgateway-rmi/src/main/java/com/tuscanyscatours/smsgateway/SMSGateway.java new file mode 100644 index 0000000000..4ce528fd23 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/services/smsgateway-rmi/src/main/java/com/tuscanyscatours/smsgateway/SMSGateway.java @@ -0,0 +1,30 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package com.tuscanyscatours.smsgateway; + +import java.rmi.Remote; +import java.rmi.RemoteException; + +/** + * A gateway to send SMS messages. + */ +public interface SMSGateway extends Remote { + boolean sendSMS(String fromNumber, String toNumber, String text) throws RemoteException; +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/services/smsgateway-rmi/src/main/java/com/tuscanyscatours/smsgateway/SMSGatewayImpl.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/services/smsgateway-rmi/src/main/java/com/tuscanyscatours/smsgateway/SMSGatewayImpl.java new file mode 100644 index 0000000000..c33439af8b --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/services/smsgateway-rmi/src/main/java/com/tuscanyscatours/smsgateway/SMSGatewayImpl.java @@ -0,0 +1,39 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package com.tuscanyscatours.smsgateway;
+
+import java.rmi.RemoteException;
+import java.rmi.server.UnicastRemoteObject;
+
+public class SMSGatewayImpl extends UnicastRemoteObject implements SMSGateway {
+
+ private static final long serialVersionUID = -2739486025442222295L;
+
+ protected SMSGatewayImpl() throws RemoteException {
+ super();
+ }
+
+ public boolean sendSMS(String fromNumber, String toNumber, String text) {
+ System.out.println("Sending SMS message");
+ System.out.println("From: " + fromNumber);
+ System.out.println("To: " + toNumber);
+ System.out.println("Message: " + text);
+ return true;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/services/smsgateway-rmi/src/main/java/com/tuscanyscatours/smsgateway/SMSGatewayRMIServiceBootstrap.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/services/smsgateway-rmi/src/main/java/com/tuscanyscatours/smsgateway/SMSGatewayRMIServiceBootstrap.java new file mode 100644 index 0000000000..5b223fb40c --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/services/smsgateway-rmi/src/main/java/com/tuscanyscatours/smsgateway/SMSGatewayRMIServiceBootstrap.java @@ -0,0 +1,40 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package com.tuscanyscatours.smsgateway;
+
+import java.rmi.registry.LocateRegistry;
+import java.rmi.registry.Registry;
+
+public class SMSGatewayRMIServiceBootstrap {
+
+ public static void main(String[] args) throws Exception {
+ System.out.println("Publishing SMS Gateway Service as a RMI service");
+
+ String serviceName = "SMSGatewayRMI";
+ SMSGatewayImpl smsGatewayImpl = new SMSGatewayImpl();
+ Registry rmiRegistry = LocateRegistry.createRegistry(8099);
+ rmiRegistry.bind(serviceName, smsGatewayImpl);
+
+ System.out.println("RMI server running - waiting for requests");
+ System.out.println("Press enter to shutdown.");
+ System.in.read();
+ rmiRegistry.unbind(serviceName);
+ System.exit(-1);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/testdomain/build.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/testdomain/build.xml new file mode 100644 index 0000000000..1f8d60a8e3 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/testdomain/build.xml @@ -0,0 +1,42 @@ +<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<project name="scatours-test-domain" default="run">
+ <property environment="env"/>
+
+ <target name="run">
+ <java classname="org.apache.tuscany.sca.node.launcher.DomainManagerLauncher" fork="true">
+ <classpath>
+ <fileset dir="${env.TUSCANY_HOME}/modules">
+ <include name="tuscany-node-launcher-*.jar"/>
+ </fileset>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="clean">
+ <delete dir="./.felix"/>
+ <delete dir="./cloud"/>
+ <delete dir="./target"/>
+ <delete file="./cloud.composite"/>
+ <delete file="./domain.composite"/>
+ <delete file="./workspace.xml"/>
+ </target>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/testdomain/pom.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/testdomain/pom.xml new file mode 100644 index 0000000000..b30add6b13 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/testdomain/pom.xml @@ -0,0 +1,58 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent><version>1.0-SNAPSHOT</version>
+ <artifactId>scatours-test-domain</artifactId>
+ <name>Apache Tuscany SCA Tours Test Domain</name>
+
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-clean-plugin</artifactId>
+ <version>2.2</version>
+ <configuration>
+ <filesets>
+ <fileset>
+ <directory>./.felix</directory>
+ </fileset>
+ <fileset>
+ <directory>./cloud</directory>
+ </fileset>
+ <fileset>
+ <directory>.</directory>
+ <includes>
+ <include>**/cloud.composite</include>
+ <include>**/domain.composite</include>
+ <include>**/workspace.xml</include>
+ </includes>
+ </fileset>
+ </filesets>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/travel-scenario.odg b/sca-java-1.x/branches/sca-java-travelsample-1.0/travel-scenario.odg Binary files differnew file mode 100644 index 0000000000..06298e5221 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/travel-scenario.odg diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/util/build.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/util/build.xml new file mode 100644 index 0000000000..3ab8df5da3 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/util/build.xml @@ -0,0 +1,44 @@ +<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<project name="scatours-util" default="compile">
+
+ <target name="compile">
+ <antcall target="allsubdirs">
+ <param name="target" value="compile"/>
+ </antcall>
+ </target>
+
+ <target name="test">
+ <antcall target="allsubdirs">
+ <param name="target" value="test"/>
+ </antcall>
+ </target>
+
+ <target name="clean">
+ <antcall target="allsubdirs">
+ <param name="target" value="clean"/>
+ </antcall>
+ </target>
+
+ <target name="allsubdirs">
+ <ant dir="launcher-common" target="${target}"/>
+ </target>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/util/jaxws-runtime/pom.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/util/jaxws-runtime/pom.xml new file mode 100644 index 0000000000..7f02dc408e --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/util/jaxws-runtime/pom.xml @@ -0,0 +1,148 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <version>1.0-SNAPSHOT</version>
+ <artifactId>scatours-util-jaxws-runtime</artifactId>
+ <name>Apache Tuscany SCA Tours JAX-WS Runtime Dependencies for JDK 5</name>
+
+ <profiles>
+ <profile>
+ <!-- The default profile produces a subset distribution which excludes
+ libraries that are present in the Tuscany SCA binary distro. -->
+ <id>default</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ <dependencies>
+ <dependency>
+ <groupId>com.sun.xml.ws</groupId>
+ <artifactId>jaxws-rt</artifactId>
+ <version>2.1.7</version>
+ <scope>runtime</scope>
+ <exclusions>
+ <!-- exclude the following because they are part of the Tuscany SCA binary distro -->
+ <exclusion>
+ <groupId>com.sun.xml.bind</groupId>
+ <artifactId>jaxb-impl</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>javax.activation</groupId>
+ <artifactId>activation</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>javax.xml.stream</groupId>
+ <artifactId>stax-api</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>javax.xml.ws</groupId>
+ <artifactId>jaxws-api</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.codehaus.woodstox</groupId>
+ <artifactId>wstx-asl</artifactId>
+ </exclusion>
+ <!-- exclude the following because they aren't needed by the travel sample -->
+ <exclusion>
+ <groupId>com.sun.org.apache.xml.internal</groupId>
+ <artifactId>resolver</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.jvnet</groupId>
+ <artifactId>mimepull</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
+ <groupId>com.sun.net.httpserver</groupId>
+ <artifactId>http</artifactId>
+ <version>20070405</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.xml.soap</groupId>
+ <artifactId>saaj-api</artifactId>
+ <version>1.3</version>
+ <scope>runtime</scope>
+ <exclusions>
+ <!-- exclude the following because it is part of the Tuscany SCA binary distro -->
+ <exclusion>
+ <groupId>javax.activation</groupId>
+ <artifactId>activation</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ </dependencies>
+ </profile>
+
+ <profile>
+ <!-- Use mvn -Pselfcontained to produce a self-contained distribution
+ with all library dependencies included. -->
+ <id>selfcontained</id>
+ <dependencies>
+ <dependency>
+ <groupId>com.sun.xml.ws</groupId>
+ <artifactId>jaxws-rt</artifactId>
+ <version>2.1.7</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>com.sun.net.httpserver</groupId>
+ <artifactId>http</artifactId>
+ <version>20070405</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+ </profile>
+ </profiles>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <version>2.2</version>
+ <configuration>
+ <archive>
+ <manifest>
+ <addClasspath>true</addClasspath>
+ <classpathPrefix>../jaxws/</classpathPrefix>
+ </manifest>
+ </archive>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/util/launcher-common/build.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/util/launcher-common/build.xml new file mode 100644 index 0000000000..a8fe5faff0 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/util/launcher-common/build.xml @@ -0,0 +1,22 @@ +<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<project name="scatours-util-launcher-common" default="compile">
+ <import file="../../antdefs.xml"/>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/util/launcher-common/pom.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/util/launcher-common/pom.xml new file mode 100644 index 0000000000..a499139eff --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/util/launcher-common/pom.xml @@ -0,0 +1,58 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<project> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>scatours</artifactId> + <version>1.0-SNAPSHOT</version> + <relativePath>../../pom.xml</relativePath> + </parent><version>1.0-SNAPSHOT</version> + <artifactId>scatours-util-launcher-common</artifactId> + <name>Apache Tuscany SCA Tours Common Utility for Launchers</name> + + <dependencies> + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-node-api</artifactId> + <version>${tuscany.version}</version> + </dependency> + </dependencies> + + <build> + <finalName>${artifactId}</finalName> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-jar-plugin</artifactId> + <version>2.2</version> + <configuration> + <archive> + <manifest> + <addClasspath>${scatours.selfContained}</addClasspath> + <classpathPrefix>../lib/</classpathPrefix> + </manifest> + </archive> + </configuration> + </plugin> + </plugins> + </build> + +</project> diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/util/launcher-common/src/main/java/scatours/launcher/LauncherUtil.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/util/launcher-common/src/main/java/scatours/launcher/LauncherUtil.java new file mode 100644 index 0000000000..0cae436c82 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/util/launcher-common/src/main/java/scatours/launcher/LauncherUtil.java @@ -0,0 +1,86 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package scatours.launcher; + +import java.io.File; + +import org.apache.tuscany.sca.node.SCAContribution; +import org.apache.tuscany.sca.node.SCANode; +import org.apache.tuscany.sca.node.SCANodeFactory; + +/** + * This utility locates SCA contributions by name so that the launcher can work with various environments where + * contributions are stored differently. + */ +public class LauncherUtil { + + /** + * Locate an SCA contribution by name + * @param name The name of the SCA contribution archive + * @return The SCAContribution + */ + public static SCAContribution locate(String name) { + // Try to use the target/classes directory inside Eclipse/Maven + File file = new File("../../contributions/" + name + "/target/classes"); + if (!file.exists()) { + // Try to use the target/<contribution>.jar that is generated by maven build + file = new File("../../contributions/" + name + "/target/scatours-contribution-" + name + ".jar"); + if (!file.exists()) { + // Try to use the contribution jar under the contributions folder of the distribution + file = new File("../contributions/scatours-contribution-" + name + ".jar"); + if (!file.exists()) { + // Try to use the contribution subfolder under the contributions folder of the distribution + file = new File("../contributions/scatours-contribution-" + name); + if (!file.exists()) { + throw new IllegalArgumentException("Contribution " + name + " cannot be located."); + } + } + } + } + return new SCAContribution(name, file.toURI().toString()); + } + + /** + * Locate an SCA contribution by replacing the ${name} in the pattern + * @param urlPattern The url pattern that contains ${name} + * @param name The name of the contribution archive + * @return The SCAContribution + */ + public static SCAContribution locate(String urlPattern, String name) { + String url = urlPattern.replace("${name}", name); + return new SCAContribution(name, url); + } + + /** + * Create an SCA node from a list of contribution names + * @param composite + * @param contributionNames + * @return + */ + public static SCANode createNode(String composite, String... contributionNames) { + SCAContribution[] contributions = new SCAContribution[contributionNames.length]; + int index = 0; + for (String name : contributionNames) { + contributions[index++] = locate(name); + } + SCANode node = SCANodeFactory.newInstance().createSCANode(composite, contributions); + return node; + } +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/util/openejb-runtime/pom.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/util/openejb-runtime/pom.xml new file mode 100644 index 0000000000..b78fd646d6 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/util/openejb-runtime/pom.xml @@ -0,0 +1,179 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <version>1.0-SNAPSHOT</version>
+ <artifactId>scatours-util-openejb-runtime</artifactId>
+ <name>Apache Tuscany SCA Tours OpenEJB Runtime Dependencies</name>
+
+ <profiles>
+ <profile>
+ <!-- The default profile produces a subset distribution which excludes
+ libraries that are present in the Tuscany SCA binary distro. -->
+ <id>default</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.openejb</groupId>
+ <artifactId>openejb-ejbd</artifactId>
+ <version>3.1.2</version>
+ <scope>runtime</scope>
+ <!-- exclude the following because they are part of the Tuscany SCA binary distro -->
+ <exclusions>
+ <exclusion>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>activeio-core</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>activemq-core</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>activemq-ra</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>backport-util-concurrent</groupId>
+ <artifactId>backport-util-concurrent</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>commons-collections</groupId>
+ <artifactId>commons-collections</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>commons-lang</groupId>
+ <artifactId>commons-lang</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>commons-pool</groupId>
+ <artifactId>commons-pool</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.geronimo.components</groupId>
+ <artifactId>geronimo-connector</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.geronimo.javamail</groupId>
+ <artifactId>geronimo-javamail_1.4_mail</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.objectweb.howl</groupId>
+ <artifactId>howl</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>hsqldb</groupId>
+ <artifactId>hsqldb</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>com.sun.xml.bind</groupId>
+ <artifactId>jaxb-impl</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.openjpa</groupId>
+ <artifactId>openjpa</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>quartz</groupId>
+ <artifactId>quartz</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>serp</groupId>
+ <artifactId>serp</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>stax</groupId>
+ <artifactId>stax-api</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.codehaus.swizzle</groupId>
+ <artifactId>swizzle-stream</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>wsdl4j</groupId>
+ <artifactId>wsdl4j</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.codehaus.woodstox</groupId>
+ <artifactId>wstx-asl</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.xbean</groupId>
+ <artifactId>xbean-naming</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ </dependencies>
+ </profile>
+
+ <profile>
+ <!-- Use mvn -Pselfcontained to produce a self-contained distribution
+ with all library dependencies included. -->
+ <id>selfcontained</id>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.openejb</groupId>
+ <artifactId>openejb-ejbd</artifactId>
+ <version>3.1.2</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+ </profile>
+ </profiles>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <version>2.2</version>
+ <configuration>
+ <archive>
+ <manifest>
+ <addClasspath>true</addClasspath>
+ <classpathPrefix>../openejb/</classpathPrefix>
+ </manifest>
+ </archive>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/util/pom.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/util/pom.xml new file mode 100644 index 0000000000..7f987f9afd --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/util/pom.xml @@ -0,0 +1,47 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <version>1.0-SNAPSHOT</version>
+ <artifactId>scatours-util</artifactId>
+ <packaging>pom</packaging>
+ <name>Apache Tuscany SCA Tours Utilities</name>
+
+ <profiles>
+ <profile>
+ <id>default</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ <modules>
+ <module>jaxws-runtime</module>
+ <module>launcher-common</module>
+ <module>openejb-runtime</module>
+ </modules>
+ </profile>
+ </profiles>
+
+</project>
|