summaryrefslogtreecommitdiffstats
path: root/sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/notification-ejb
diff options
context:
space:
mode:
authornash <nash@13f79535-47bb-0310-9956-ffa450edef68>2010-04-20 22:27:34 +0000
committernash <nash@13f79535-47bb-0310-9956-ffa450edef68>2010-04-20 22:27:34 +0000
commit54e785c9a15bc1286757c147323b697a6c40a640 (patch)
tree1753072ba5b7468376d8ca7cf2d921126daca90c /sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/notification-ejb
parentf094477f3cda79a3918b02e29aa233001c7e4193 (diff)
Copy 1.x travel sample to branches for start of 1.0 travel sample release
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@936092 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/notification-ejb')
-rw-r--r--sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/notification-ejb/build.xml42
-rw-r--r--sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/notification-ejb/pom.xml97
-rw-r--r--sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/notification-ejb/src/main/java/scatours/NotificationEJBLauncher.java59
-rw-r--r--sca-java-1.x/branches/sca-java-travelsample-1.0/launchers/notification-ejb/src/main/java/scatours/notification/Notification.java26
4 files changed, 224 insertions, 0 deletions
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);
+
+}