summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/trunk/tutorials/travelsample/services
diff options
context:
space:
mode:
Diffstat (limited to 'sca-java-2.x/trunk/tutorials/travelsample/services')
-rw-r--r--sca-java-2.x/trunk/tutorials/travelsample/services/build.xml49
-rw-r--r--sca-java-2.x/trunk/tutorials/travelsample/services/creditcard-payment-jaxws/build.xml53
-rw-r--r--sca-java-2.x/trunk/tutorials/travelsample/services/creditcard-payment-jaxws/pom.xml70
-rw-r--r--sca-java-2.x/trunk/tutorials/travelsample/services/creditcard-payment-jaxws/src/main/java/scatours/creditcard/CreditCardService.java34
-rw-r--r--sca-java-2.x/trunk/tutorials/travelsample/services/creditcard-payment-jaxws/src/main/java/scatours/creditcard/CreditCardServiceBootstrap.java31
-rw-r--r--sca-java-2.x/trunk/tutorials/travelsample/services/creditcard-payment-jaxws/src/main/java/scatours/creditcard/CreditCardServiceImpl.java34
-rw-r--r--sca-java-2.x/trunk/tutorials/travelsample/services/pom.xml51
-rw-r--r--sca-java-2.x/trunk/tutorials/travelsample/services/smsgateway-corba/build.xml37
-rw-r--r--sca-java-2.x/trunk/tutorials/travelsample/services/smsgateway-corba/pom.xml85
-rw-r--r--sca-java-2.x/trunk/tutorials/travelsample/services/smsgateway-corba/src/main/java/scatours/smsgateway/SMSGatewayCORBAServiceBootstrap.java105
-rw-r--r--sca-java-2.x/trunk/tutorials/travelsample/services/smsgateway-corba/src/main/java/scatours/smsgateway/SMSGatewayServant.java30
-rw-r--r--sca-java-2.x/trunk/tutorials/travelsample/services/smsgateway-corba/src/main/resources/sms-gateway.idl26
-rw-r--r--sca-java-2.x/trunk/tutorials/travelsample/services/smsgateway-ejb/build.xml35
-rw-r--r--sca-java-2.x/trunk/tutorials/travelsample/services/smsgateway-ejb/pom.xml58
-rw-r--r--sca-java-2.x/trunk/tutorials/travelsample/services/smsgateway-ejb/src/main/java/com/tuscanyscatours/smsgateway/SMSGateway.java30
-rw-r--r--sca-java-2.x/trunk/tutorials/travelsample/services/smsgateway-ejb/src/main/java/com/tuscanyscatours/smsgateway/SMSGatewayEJBServiceBootstrap.java45
-rw-r--r--sca-java-2.x/trunk/tutorials/travelsample/services/smsgateway-ejb/src/main/java/com/tuscanyscatours/smsgateway/SMSGatewayImpl.java33
-rw-r--r--sca-java-2.x/trunk/tutorials/travelsample/services/smsgateway-ejb/src/main/resources/META-INF/ejb-jar.xml2
-rw-r--r--sca-java-2.x/trunk/tutorials/travelsample/services/smsgateway-jaxws/build.xml53
-rw-r--r--sca-java-2.x/trunk/tutorials/travelsample/services/smsgateway-jaxws/pom.xml70
-rw-r--r--sca-java-2.x/trunk/tutorials/travelsample/services/smsgateway-jaxws/src/main/java/com/tuscanyscatours/smsgateway/SMSGatewayService.java32
-rw-r--r--sca-java-2.x/trunk/tutorials/travelsample/services/smsgateway-jaxws/src/main/java/com/tuscanyscatours/smsgateway/SMSGatewayServiceBootstrap.java31
-rw-r--r--sca-java-2.x/trunk/tutorials/travelsample/services/smsgateway-jaxws/src/main/java/com/tuscanyscatours/smsgateway/SMSGatewayServiceImpl.java33
-rw-r--r--sca-java-2.x/trunk/tutorials/travelsample/services/smsgateway-jms/build.xml35
-rw-r--r--sca-java-2.x/trunk/tutorials/travelsample/services/smsgateway-jms/pom.xml104
-rw-r--r--sca-java-2.x/trunk/tutorials/travelsample/services/smsgateway-jms/src/main/java/scatours/smsgateway/SMSGateway.java30
-rw-r--r--sca-java-2.x/trunk/tutorials/travelsample/services/smsgateway-jms/src/main/java/scatours/smsgateway/SMSGatewayImpl.java126
-rw-r--r--sca-java-2.x/trunk/tutorials/travelsample/services/smsgateway-jms/src/main/java/scatours/smsgateway/SMSGatewayJMSServiceBootstrap.java47
-rw-r--r--sca-java-2.x/trunk/tutorials/travelsample/services/smsgateway-rmi/build.xml31
-rw-r--r--sca-java-2.x/trunk/tutorials/travelsample/services/smsgateway-rmi/pom.xml59
-rw-r--r--sca-java-2.x/trunk/tutorials/travelsample/services/smsgateway-rmi/src/main/java/com/tuscanyscatours/smsgateway/SMSGateway.java30
-rw-r--r--sca-java-2.x/trunk/tutorials/travelsample/services/smsgateway-rmi/src/main/java/com/tuscanyscatours/smsgateway/SMSGatewayImpl.java39
-rw-r--r--sca-java-2.x/trunk/tutorials/travelsample/services/smsgateway-rmi/src/main/java/com/tuscanyscatours/smsgateway/SMSGatewayRMIServiceBootstrap.java40
33 files changed, 1568 insertions, 0 deletions
diff --git a/sca-java-2.x/trunk/tutorials/travelsample/services/build.xml b/sca-java-2.x/trunk/tutorials/travelsample/services/build.xml
new file mode 100644
index 0000000000..21b282707c
--- /dev/null
+++ b/sca-java-2.x/trunk/tutorials/travelsample/services/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-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="creditcard-payment-jaxws" target="${target}"/>
+ <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-2.x/trunk/tutorials/travelsample/services/creditcard-payment-jaxws/build.xml b/sca-java-2.x/trunk/tutorials/travelsample/services/creditcard-payment-jaxws/build.xml
new file mode 100644
index 0000000000..266dbec28c
--- /dev/null
+++ b/sca-java-2.x/trunk/tutorials/travelsample/services/creditcard-payment-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-creditcard-payment-jaxws" default="compile">
+ <import file="../../antdefs.xml"/>
+
+ <!-- The "run" target starts a JAX-WS service endpoint for a simple
+ credit card payment service. This endpoint does not appear to be
+ used currently anywhere else in the travel application. -->
+ <target name="run" depends="is-jdk6, jaxws-jdk6, jaxws-jdk5">
+ <java classname="scatours.creditcard.CreditCardServiceBootstrap" 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-2.x/trunk/tutorials/travelsample/services/creditcard-payment-jaxws/pom.xml b/sca-java-2.x/trunk/tutorials/travelsample/services/creditcard-payment-jaxws/pom.xml
new file mode 100644
index 0000000000..958292698e
--- /dev/null
+++ b/sca-java-2.x/trunk/tutorials/travelsample/services/creditcard-payment-jaxws/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-service-creditcard-payment-jaxws</artifactId>
+ <name>Apache Tuscany SCA Tours Credit Card Payment 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>
+
+ <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-jaxws-runtime.jar</Class-Path>
+ <Main-Class>scatours.creditcard.CreditCardServiceBootstrap</Main-Class>
+ </manifestEntries>
+ </archive>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/sca-java-2.x/trunk/tutorials/travelsample/services/creditcard-payment-jaxws/src/main/java/scatours/creditcard/CreditCardService.java b/sca-java-2.x/trunk/tutorials/travelsample/services/creditcard-payment-jaxws/src/main/java/scatours/creditcard/CreditCardService.java
new file mode 100644
index 0000000000..a0f2912f7b
--- /dev/null
+++ b/sca-java-2.x/trunk/tutorials/travelsample/services/creditcard-payment-jaxws/src/main/java/scatours/creditcard/CreditCardService.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 scatours.creditcard;
+
+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 CreditCardService {
+
+ String NOT_AUTHORIZED = "Not_Authorized";
+
+ @WebMethod
+ String makePayment(String cardNumber, String name, double amount);
+}
diff --git a/sca-java-2.x/trunk/tutorials/travelsample/services/creditcard-payment-jaxws/src/main/java/scatours/creditcard/CreditCardServiceBootstrap.java b/sca-java-2.x/trunk/tutorials/travelsample/services/creditcard-payment-jaxws/src/main/java/scatours/creditcard/CreditCardServiceBootstrap.java
new file mode 100644
index 0000000000..2fa12fc187
--- /dev/null
+++ b/sca-java-2.x/trunk/tutorials/travelsample/services/creditcard-payment-jaxws/src/main/java/scatours/creditcard/CreditCardServiceBootstrap.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 scatours.creditcard;
+
+import javax.xml.ws.Endpoint;
+
+public class CreditCardServiceBootstrap {
+
+ public static void main(String[] args) {
+ System.out.println("Publishing Credit Card Service as web service: http://localhost:8081/CreditCardService");
+ System.out.println("Press Ctrl^C to terminate...");
+
+ Endpoint.publish("http://localhost:8081/CreditCardService", new CreditCardServiceImpl());
+ }
+}
diff --git a/sca-java-2.x/trunk/tutorials/travelsample/services/creditcard-payment-jaxws/src/main/java/scatours/creditcard/CreditCardServiceImpl.java b/sca-java-2.x/trunk/tutorials/travelsample/services/creditcard-payment-jaxws/src/main/java/scatours/creditcard/CreditCardServiceImpl.java
new file mode 100644
index 0000000000..7118edbc1f
--- /dev/null
+++ b/sca-java-2.x/trunk/tutorials/travelsample/services/creditcard-payment-jaxws/src/main/java/scatours/creditcard/CreditCardServiceImpl.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 scatours.creditcard;
+
+import javax.jws.WebService;
+
+@WebService(endpointInterface = "scatours.creditcard.CreditCardService")
+public class CreditCardServiceImpl implements CreditCardService {
+
+ public String makePayment(String cardNumber, String name, double amount) {
+ System.out.println("Payment request from " + name);
+
+ if (cardNumber != null && cardNumber.startsWith("1")) {
+ return "AUTH_ID:" + System.currentTimeMillis();
+ }
+ return NOT_AUTHORIZED;
+ }
+}
diff --git a/sca-java-2.x/trunk/tutorials/travelsample/services/pom.xml b/sca-java-2.x/trunk/tutorials/travelsample/services/pom.xml
new file mode 100644
index 0000000000..0c8812cffd
--- /dev/null
+++ b/sca-java-2.x/trunk/tutorials/travelsample/services/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-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>creditcard-payment-jaxws</module>
+ <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-2.x/trunk/tutorials/travelsample/services/smsgateway-corba/build.xml b/sca-java-2.x/trunk/tutorials/travelsample/services/smsgateway-corba/build.xml
new file mode 100644
index 0000000000..0495e2b956
--- /dev/null
+++ b/sca-java-2.x/trunk/tutorials/travelsample/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-2.x/trunk/tutorials/travelsample/services/smsgateway-corba/pom.xml b/sca-java-2.x/trunk/tutorials/travelsample/services/smsgateway-corba/pom.xml
new file mode 100644
index 0000000000..340f043ca5
--- /dev/null
+++ b/sca-java-2.x/trunk/tutorials/travelsample/services/smsgateway-corba/pom.xml
@@ -0,0 +1,85 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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>
+
+ <dependencies>
+ <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.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>
diff --git a/sca-java-2.x/trunk/tutorials/travelsample/services/smsgateway-corba/src/main/java/scatours/smsgateway/SMSGatewayCORBAServiceBootstrap.java b/sca-java-2.x/trunk/tutorials/travelsample/services/smsgateway-corba/src/main/java/scatours/smsgateway/SMSGatewayCORBAServiceBootstrap.java
new file mode 100644
index 0000000000..9a53303e88
--- /dev/null
+++ b/sca-java-2.x/trunk/tutorials/travelsample/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-2.x/trunk/tutorials/travelsample/services/smsgateway-corba/src/main/java/scatours/smsgateway/SMSGatewayServant.java b/sca-java-2.x/trunk/tutorials/travelsample/services/smsgateway-corba/src/main/java/scatours/smsgateway/SMSGatewayServant.java
new file mode 100644
index 0000000000..693a909dca
--- /dev/null
+++ b/sca-java-2.x/trunk/tutorials/travelsample/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-2.x/trunk/tutorials/travelsample/services/smsgateway-corba/src/main/resources/sms-gateway.idl b/sca-java-2.x/trunk/tutorials/travelsample/services/smsgateway-corba/src/main/resources/sms-gateway.idl
new file mode 100644
index 0000000000..30a87f5c7a
--- /dev/null
+++ b/sca-java-2.x/trunk/tutorials/travelsample/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-2.x/trunk/tutorials/travelsample/services/smsgateway-ejb/build.xml b/sca-java-2.x/trunk/tutorials/travelsample/services/smsgateway-ejb/build.xml
new file mode 100644
index 0000000000..cc7456ac52
--- /dev/null
+++ b/sca-java-2.x/trunk/tutorials/travelsample/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-2.x/trunk/tutorials/travelsample/services/smsgateway-ejb/pom.xml b/sca-java-2.x/trunk/tutorials/travelsample/services/smsgateway-ejb/pom.xml
new file mode 100644
index 0000000000..9be6e6647d
--- /dev/null
+++ b/sca-java-2.x/trunk/tutorials/travelsample/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-2.x/trunk/tutorials/travelsample/services/smsgateway-ejb/src/main/java/com/tuscanyscatours/smsgateway/SMSGateway.java b/sca-java-2.x/trunk/tutorials/travelsample/services/smsgateway-ejb/src/main/java/com/tuscanyscatours/smsgateway/SMSGateway.java
new file mode 100644
index 0000000000..b462dd1be8
--- /dev/null
+++ b/sca-java-2.x/trunk/tutorials/travelsample/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-2.x/trunk/tutorials/travelsample/services/smsgateway-ejb/src/main/java/com/tuscanyscatours/smsgateway/SMSGatewayEJBServiceBootstrap.java b/sca-java-2.x/trunk/tutorials/travelsample/services/smsgateway-ejb/src/main/java/com/tuscanyscatours/smsgateway/SMSGatewayEJBServiceBootstrap.java
new file mode 100644
index 0000000000..4da784bc55
--- /dev/null
+++ b/sca-java-2.x/trunk/tutorials/travelsample/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-2.x/trunk/tutorials/travelsample/services/smsgateway-ejb/src/main/java/com/tuscanyscatours/smsgateway/SMSGatewayImpl.java b/sca-java-2.x/trunk/tutorials/travelsample/services/smsgateway-ejb/src/main/java/com/tuscanyscatours/smsgateway/SMSGatewayImpl.java
new file mode 100644
index 0000000000..3bdf48a7ea
--- /dev/null
+++ b/sca-java-2.x/trunk/tutorials/travelsample/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-2.x/trunk/tutorials/travelsample/services/smsgateway-ejb/src/main/resources/META-INF/ejb-jar.xml b/sca-java-2.x/trunk/tutorials/travelsample/services/smsgateway-ejb/src/main/resources/META-INF/ejb-jar.xml
new file mode 100644
index 0000000000..116a25630c
--- /dev/null
+++ b/sca-java-2.x/trunk/tutorials/travelsample/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-2.x/trunk/tutorials/travelsample/services/smsgateway-jaxws/build.xml b/sca-java-2.x/trunk/tutorials/travelsample/services/smsgateway-jaxws/build.xml
new file mode 100644
index 0000000000..6c57e2420b
--- /dev/null
+++ b/sca-java-2.x/trunk/tutorials/travelsample/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-2.x/trunk/tutorials/travelsample/services/smsgateway-jaxws/pom.xml b/sca-java-2.x/trunk/tutorials/travelsample/services/smsgateway-jaxws/pom.xml
new file mode 100644
index 0000000000..a833c03b9e
--- /dev/null
+++ b/sca-java-2.x/trunk/tutorials/travelsample/services/smsgateway-jaxws/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-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>
+
+ <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-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-2.x/trunk/tutorials/travelsample/services/smsgateway-jaxws/src/main/java/com/tuscanyscatours/smsgateway/SMSGatewayService.java b/sca-java-2.x/trunk/tutorials/travelsample/services/smsgateway-jaxws/src/main/java/com/tuscanyscatours/smsgateway/SMSGatewayService.java
new file mode 100644
index 0000000000..696ab12daa
--- /dev/null
+++ b/sca-java-2.x/trunk/tutorials/travelsample/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-2.x/trunk/tutorials/travelsample/services/smsgateway-jaxws/src/main/java/com/tuscanyscatours/smsgateway/SMSGatewayServiceBootstrap.java b/sca-java-2.x/trunk/tutorials/travelsample/services/smsgateway-jaxws/src/main/java/com/tuscanyscatours/smsgateway/SMSGatewayServiceBootstrap.java
new file mode 100644
index 0000000000..6631aee907
--- /dev/null
+++ b/sca-java-2.x/trunk/tutorials/travelsample/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-2.x/trunk/tutorials/travelsample/services/smsgateway-jaxws/src/main/java/com/tuscanyscatours/smsgateway/SMSGatewayServiceImpl.java b/sca-java-2.x/trunk/tutorials/travelsample/services/smsgateway-jaxws/src/main/java/com/tuscanyscatours/smsgateway/SMSGatewayServiceImpl.java
new file mode 100644
index 0000000000..cd4eab052d
--- /dev/null
+++ b/sca-java-2.x/trunk/tutorials/travelsample/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-2.x/trunk/tutorials/travelsample/services/smsgateway-jms/build.xml b/sca-java-2.x/trunk/tutorials/travelsample/services/smsgateway-jms/build.xml
new file mode 100644
index 0000000000..389f6296c3
--- /dev/null
+++ b/sca-java-2.x/trunk/tutorials/travelsample/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-2.x/trunk/tutorials/travelsample/services/smsgateway-jms/pom.xml b/sca-java-2.x/trunk/tutorials/travelsample/services/smsgateway-jms/pom.xml
new file mode 100644
index 0000000000..9f1de49e6d
--- /dev/null
+++ b/sca-java-2.x/trunk/tutorials/travelsample/services/smsgateway-jms/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-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>
+
+ <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.smsgateway.SMSGatewayJMSServiceBootstrap</mainClass>
+ </manifest>
+ </archive>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/sca-java-2.x/trunk/tutorials/travelsample/services/smsgateway-jms/src/main/java/scatours/smsgateway/SMSGateway.java b/sca-java-2.x/trunk/tutorials/travelsample/services/smsgateway-jms/src/main/java/scatours/smsgateway/SMSGateway.java
new file mode 100644
index 0000000000..e6e866fa1d
--- /dev/null
+++ b/sca-java-2.x/trunk/tutorials/travelsample/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-2.x/trunk/tutorials/travelsample/services/smsgateway-jms/src/main/java/scatours/smsgateway/SMSGatewayImpl.java b/sca-java-2.x/trunk/tutorials/travelsample/services/smsgateway-jms/src/main/java/scatours/smsgateway/SMSGatewayImpl.java
new file mode 100644
index 0000000000..c35aa61513
--- /dev/null
+++ b/sca-java-2.x/trunk/tutorials/travelsample/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-2.x/trunk/tutorials/travelsample/services/smsgateway-jms/src/main/java/scatours/smsgateway/SMSGatewayJMSServiceBootstrap.java b/sca-java-2.x/trunk/tutorials/travelsample/services/smsgateway-jms/src/main/java/scatours/smsgateway/SMSGatewayJMSServiceBootstrap.java
new file mode 100644
index 0000000000..d8543266e3
--- /dev/null
+++ b/sca-java-2.x/trunk/tutorials/travelsample/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-2.x/trunk/tutorials/travelsample/services/smsgateway-rmi/build.xml b/sca-java-2.x/trunk/tutorials/travelsample/services/smsgateway-rmi/build.xml
new file mode 100644
index 0000000000..13d4702867
--- /dev/null
+++ b/sca-java-2.x/trunk/tutorials/travelsample/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-2.x/trunk/tutorials/travelsample/services/smsgateway-rmi/pom.xml b/sca-java-2.x/trunk/tutorials/travelsample/services/smsgateway-rmi/pom.xml
new file mode 100644
index 0000000000..3f91e23315
--- /dev/null
+++ b/sca-java-2.x/trunk/tutorials/travelsample/services/smsgateway-rmi/pom.xml
@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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>
+
+ <dependencies>
+ <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>com.tuscanyscatours.smsgateway.SMSGatewayRMIServiceBootstrap</mainClass>
+ </manifest>
+ </archive>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/sca-java-2.x/trunk/tutorials/travelsample/services/smsgateway-rmi/src/main/java/com/tuscanyscatours/smsgateway/SMSGateway.java b/sca-java-2.x/trunk/tutorials/travelsample/services/smsgateway-rmi/src/main/java/com/tuscanyscatours/smsgateway/SMSGateway.java
new file mode 100644
index 0000000000..4ce528fd23
--- /dev/null
+++ b/sca-java-2.x/trunk/tutorials/travelsample/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-2.x/trunk/tutorials/travelsample/services/smsgateway-rmi/src/main/java/com/tuscanyscatours/smsgateway/SMSGatewayImpl.java b/sca-java-2.x/trunk/tutorials/travelsample/services/smsgateway-rmi/src/main/java/com/tuscanyscatours/smsgateway/SMSGatewayImpl.java
new file mode 100644
index 0000000000..c33439af8b
--- /dev/null
+++ b/sca-java-2.x/trunk/tutorials/travelsample/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-2.x/trunk/tutorials/travelsample/services/smsgateway-rmi/src/main/java/com/tuscanyscatours/smsgateway/SMSGatewayRMIServiceBootstrap.java b/sca-java-2.x/trunk/tutorials/travelsample/services/smsgateway-rmi/src/main/java/com/tuscanyscatours/smsgateway/SMSGatewayRMIServiceBootstrap.java
new file mode 100644
index 0000000000..5b223fb40c
--- /dev/null
+++ b/sca-java-2.x/trunk/tutorials/travelsample/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);
+ }
+}