summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/trunk/tutorials/travelsample/launchers/notification-jms
diff options
context:
space:
mode:
Diffstat (limited to 'sca-java-2.x/trunk/tutorials/travelsample/launchers/notification-jms')
-rw-r--r--sca-java-2.x/trunk/tutorials/travelsample/launchers/notification-jms/build.xml41
-rw-r--r--sca-java-2.x/trunk/tutorials/travelsample/launchers/notification-jms/pom.xml148
-rw-r--r--sca-java-2.x/trunk/tutorials/travelsample/launchers/notification-jms/src/main/java/scatours/NotificationJMSLauncher.java56
-rw-r--r--sca-java-2.x/trunk/tutorials/travelsample/launchers/notification-jms/src/main/java/scatours/notification/Notification.java26
4 files changed, 271 insertions, 0 deletions
diff --git a/sca-java-2.x/trunk/tutorials/travelsample/launchers/notification-jms/build.xml b/sca-java-2.x/trunk/tutorials/travelsample/launchers/notification-jms/build.xml
new file mode 100644
index 0000000000..e7129ddc61
--- /dev/null
+++ b/sca-java-2.x/trunk/tutorials/travelsample/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-2.x/trunk/tutorials/travelsample/launchers/notification-jms/pom.xml b/sca-java-2.x/trunk/tutorials/travelsample/launchers/notification-jms/pom.xml
new file mode 100644
index 0000000000..dd0a198622
--- /dev/null
+++ b/sca-java-2.x/trunk/tutorials/travelsample/launchers/notification-jms/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-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>
+ </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>
+ <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>
+ <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-2.x/trunk/tutorials/travelsample/launchers/notification-jms/src/main/java/scatours/NotificationJMSLauncher.java b/sca-java-2.x/trunk/tutorials/travelsample/launchers/notification-jms/src/main/java/scatours/NotificationJMSLauncher.java
new file mode 100644
index 0000000000..c2ffda0725
--- /dev/null
+++ b/sca-java-2.x/trunk/tutorials/travelsample/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-2.x/trunk/tutorials/travelsample/launchers/notification-jms/src/main/java/scatours/notification/Notification.java b/sca-java-2.x/trunk/tutorials/travelsample/launchers/notification-jms/src/main/java/scatours/notification/Notification.java
new file mode 100644
index 0000000000..020e1e40db
--- /dev/null
+++ b/sca-java-2.x/trunk/tutorials/travelsample/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);
+
+}