summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/branches/sca-java-2.0-M5/samples/webapps/helloworld-jms/src
diff options
context:
space:
mode:
Diffstat (limited to 'sca-java-2.x/branches/sca-java-2.0-M5/samples/webapps/helloworld-jms/src')
-rw-r--r--sca-java-2.x/branches/sca-java-2.0-M5/samples/webapps/helloworld-jms/src/main/java/sample/HelloWorldClient.java37
-rw-r--r--sca-java-2.x/branches/sca-java-2.0-M5/samples/webapps/helloworld-jms/src/main/java/sample/HelloWorldService.java29
-rw-r--r--sca-java-2.x/branches/sca-java-2.0-M5/samples/webapps/helloworld-jms/src/main/java/sample/HelloWorldServiceImpl.java31
-rw-r--r--sca-java-2.x/branches/sca-java-2.0-M5/samples/webapps/helloworld-jms/src/main/webapp/META-INF/context.xml34
-rw-r--r--sca-java-2.x/branches/sca-java-2.0-M5/samples/webapps/helloworld-jms/src/main/webapp/WEB-INF/jetty-env.xml48
-rw-r--r--sca-java-2.x/branches/sca-java-2.0-M5/samples/webapps/helloworld-jms/src/main/webapp/WEB-INF/web.composite44
-rw-r--r--sca-java-2.x/branches/sca-java-2.0-M5/samples/webapps/helloworld-jms/src/main/webapp/WEB-INF/web.xml66
-rw-r--r--sca-java-2.x/branches/sca-java-2.0-M5/samples/webapps/helloworld-jms/src/main/webapp/hello.jsp41
8 files changed, 330 insertions, 0 deletions
diff --git a/sca-java-2.x/branches/sca-java-2.0-M5/samples/webapps/helloworld-jms/src/main/java/sample/HelloWorldClient.java b/sca-java-2.x/branches/sca-java-2.0-M5/samples/webapps/helloworld-jms/src/main/java/sample/HelloWorldClient.java
new file mode 100644
index 0000000000..f209f11605
--- /dev/null
+++ b/sca-java-2.x/branches/sca-java-2.0-M5/samples/webapps/helloworld-jms/src/main/java/sample/HelloWorldClient.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package sample;
+
+/**
+ * The HelloWorld client implementation
+ */
+public class HelloWorldClient implements HelloWorldService {
+
+ HelloWorldService helloWorldRef;
+
+ public String sayHello(String name) {
+ System.out.println("HelloWorldClient.sayHello " + name);
+ return helloWorldRef.sayHello(name);
+ }
+
+ public void setHelloWorldRef(HelloWorldService helloWorldRef) {
+ System.out.println("HelloWorldClient.setHelloWorldService " + helloWorldRef);
+ this.helloWorldRef = helloWorldRef;
+ }
+} \ No newline at end of file
diff --git a/sca-java-2.x/branches/sca-java-2.0-M5/samples/webapps/helloworld-jms/src/main/java/sample/HelloWorldService.java b/sca-java-2.x/branches/sca-java-2.0-M5/samples/webapps/helloworld-jms/src/main/java/sample/HelloWorldService.java
new file mode 100644
index 0000000000..df2a852161
--- /dev/null
+++ b/sca-java-2.x/branches/sca-java-2.0-M5/samples/webapps/helloworld-jms/src/main/java/sample/HelloWorldService.java
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package sample;
+
+import org.oasisopen.sca.annotation.Remotable;
+
+/**
+ * The interface for the helloworld service
+ */
+@Remotable
+public interface HelloWorldService {
+ public String sayHello(String name);
+}
diff --git a/sca-java-2.x/branches/sca-java-2.0-M5/samples/webapps/helloworld-jms/src/main/java/sample/HelloWorldServiceImpl.java b/sca-java-2.x/branches/sca-java-2.0-M5/samples/webapps/helloworld-jms/src/main/java/sample/HelloWorldServiceImpl.java
new file mode 100644
index 0000000000..c09af51e23
--- /dev/null
+++ b/sca-java-2.x/branches/sca-java-2.0-M5/samples/webapps/helloworld-jms/src/main/java/sample/HelloWorldServiceImpl.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 sample;
+
+/**
+ * This class implements the HelloWorld service.
+ */
+public class HelloWorldServiceImpl implements HelloWorldService {
+
+ public String sayHello(String name) {
+ System.out.println("HelloWorldServiceImpl.sayHello " + name);
+ return "Hello " + name;
+ }
+
+}
diff --git a/sca-java-2.x/branches/sca-java-2.0-M5/samples/webapps/helloworld-jms/src/main/webapp/META-INF/context.xml b/sca-java-2.x/branches/sca-java-2.0-M5/samples/webapps/helloworld-jms/src/main/webapp/META-INF/context.xml
new file mode 100644
index 0000000000..7575edfc29
--- /dev/null
+++ b/sca-java-2.x/branches/sca-java-2.0-M5/samples/webapps/helloworld-jms/src/main/webapp/META-INF/context.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<!--
+This file configures the ActiveMQ JMS resources and is only required when
+using Apache ActiveMQ as the JMS broker in Apache Tomcat.
+-->
+
+<Context>
+
+ <Resource name="ConnectionFactory" auth="Container" type="org.apache.activemq.ActiveMQConnectionFactory" description="JMS Connection Factory"
+ factory="org.apache.activemq.jndi.JNDIReferenceFactory" brokerURL="vm://localhost?broker.persistent=false" brokerName="LocalActiveMQBroker"/>
+
+ <Resource name="HelloWorldService" auth="Container" type="org.apache.activemq.command.ActiveMQQueue" description="my Queue"
+ factory="org.apache.activemq.jndi.JNDIReferenceFactory" physicalName="RequestQueue"/>
+
+</Context> \ No newline at end of file
diff --git a/sca-java-2.x/branches/sca-java-2.0-M5/samples/webapps/helloworld-jms/src/main/webapp/WEB-INF/jetty-env.xml b/sca-java-2.x/branches/sca-java-2.0-M5/samples/webapps/helloworld-jms/src/main/webapp/WEB-INF/jetty-env.xml
new file mode 100644
index 0000000000..a8cd27f6c6
--- /dev/null
+++ b/sca-java-2.x/branches/sca-java-2.0-M5/samples/webapps/helloworld-jms/src/main/webapp/WEB-INF/jetty-env.xml
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<!--
+This file configures the ActiveMQ JMS resources and is only required when
+using Apache ActiveMQ as the JMS broker in Jetty.
+-->
+
+<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd">
+
+<Configure class="org.mortbay.jetty.webapp.WebAppContext">
+
+ <New id="cf" class="org.mortbay.jetty.plus.naming.Resource">
+ <Arg>ConnectionFactory</Arg>
+ <Arg>
+ <New class="org.apache.activemq.ActiveMQConnectionFactory">
+ <Arg>vm://localhost?broker.persistent=false</Arg>
+ </New>
+ </Arg>
+ </New>
+
+ <New id="myQueue" class="org.mortbay.jetty.plus.naming.Resource">
+ <Arg>HelloWorldService</Arg>
+ <Arg>
+ <New class="org.apache.activemq.command.ActiveMQQueue">
+ <Arg>DEMO</Arg>
+ </New>
+ </Arg>
+ </New>
+
+</Configure>
diff --git a/sca-java-2.x/branches/sca-java-2.0-M5/samples/webapps/helloworld-jms/src/main/webapp/WEB-INF/web.composite b/sca-java-2.x/branches/sca-java-2.0-M5/samples/webapps/helloworld-jms/src/main/webapp/WEB-INF/web.composite
new file mode 100644
index 0000000000..c51985bc30
--- /dev/null
+++ b/sca-java-2.x/branches/sca-java-2.0-M5/samples/webapps/helloworld-jms/src/main/webapp/WEB-INF/web.composite
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200912"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.1"
+ targetNamespace="http://samples"
+ name="Helloworld">
+
+ <component name="foo">
+ <implementation.web web-uri=""/>
+ <reference name="service" target="HelloWorldClientComponent"/>
+ </component>
+
+ <component name="HelloWorldClientComponent">
+ <implementation.java class="sample.HelloWorldClient"/>
+ <reference name="helloWorldRef">
+ <binding.jms uri="jms:HelloWorldService"/>
+ </reference>
+ </component>
+
+ <component name="HelloWorldServiceComponent">
+ <implementation.java class="sample.HelloWorldServiceImpl" />
+ <service name="HelloWorldService">
+ <binding.jms />
+ </service>
+ </component>
+
+</composite>
diff --git a/sca-java-2.x/branches/sca-java-2.0-M5/samples/webapps/helloworld-jms/src/main/webapp/WEB-INF/web.xml b/sca-java-2.x/branches/sca-java-2.0-M5/samples/webapps/helloworld-jms/src/main/webapp/WEB-INF/web.xml
new file mode 100644
index 0000000000..86710435ae
--- /dev/null
+++ b/sca-java-2.x/branches/sca-java-2.0-M5/samples/webapps/helloworld-jms/src/main/webapp/WEB-INF/web.xml
@@ -0,0 +1,66 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web
+Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
+<web-app>
+
+ <display-name>Apache Tuscany JMS Web Service Sample</display-name>
+
+ <filter>
+ <filter-name>tuscany</filter-name>
+ <filter-class>org.apache.tuscany.sca.host.webapp.TuscanyServletFilter</filter-class>
+ </filter>
+
+ <filter-mapping>
+ <filter-name>tuscany</filter-name>
+ <url-pattern>/*</url-pattern>
+ </filter-mapping>
+
+ <welcome-file-list id="WelcomeFileList">
+ <welcome-file>hello.jsp</welcome-file>
+ </welcome-file-list>
+
+ <!-- Uncomment this to use an appserver thread pool
+ <resource-ref>
+ <res-ref-name>wm/TuscanyWorkManager</res-ref-name>
+ <res-type>commonj.work.WorkManager</res-type>
+ <res-auth>Container</res-auth>
+ <res-sharing-scope>Shareable</res-sharing-scope>
+ </resource-ref>
+ -->
+
+ <!-- Uncomment these to use local jndi name aliases
+ <resource-ref>
+ <res-ref-name>ConnectionFactory</res-ref-name>
+ <res-type>javax.jms.ConnectionFactory</res-type>
+ <res-auth>Container</res-auth>
+ <res-sharing-scope>Shareable</res-sharing-scope>
+ </resource-ref>
+
+ <resource-ref>
+ <res-ref-name>HelloWorldService</res-ref-name>
+ <res-type>javax.jms.Queue</res-type>
+ <res-auth>Container</res-auth>
+ <res-sharing-scope>Shareable</res-sharing-scope>
+ </resource-ref>
+ -->
+
+</web-app>
diff --git a/sca-java-2.x/branches/sca-java-2.0-M5/samples/webapps/helloworld-jms/src/main/webapp/hello.jsp b/sca-java-2.x/branches/sca-java-2.0-M5/samples/webapps/helloworld-jms/src/main/webapp/hello.jsp
new file mode 100644
index 0000000000..9ae037f2c2
--- /dev/null
+++ b/sca-java-2.x/branches/sca-java-2.0-M5/samples/webapps/helloworld-jms/src/main/webapp/hello.jsp
@@ -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.
+--%>
+
+<%@ page contentType="text/html;charset=UTF-8" language="java" %>
+<%@ taglib uri="http://www.osoa.org/sca/sca_jsp.tld" prefix="sca" %>
+
+<sca:reference name="service" type="sample.HelloWorldService" />
+
+<html>
+<head><title>HelloWorld JMS sample</title></head>
+
+<body>
+
+If this sample is working correctly you should see "Hello World" on the next line...
+<p>
+<%= service.sayHello("world") %>
+<p>
+If you do not see "Hello World" on the line above then there has been a problem.
+<p>
+The sample requires JMS resources be manually configured in the server environment, these are:
+a JMS connection factory named "ConnectionFactory", and a destination queues named "HelloWorldService".
+See the sample README file for more information.
+
+</body>
+</html>