From a3ce58076d0ce2d2f09c2331ea499554e9b5a9f9 Mon Sep 17 00:00:00 2001 From: lresende Date: Thu, 11 Sep 2008 04:13:16 +0000 Subject: Renaming branch git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@694108 13f79535-47bb-0310-9956-ffa450edef68 --- .../samples/helloworld-distributed/README | 28 +++++ .../helloworld-distributed/helloworld-node/README | 28 +++++ .../helloworld-distributed/helloworld-node/pom.xml | 71 ++++++++++++ .../src/main/java/sample/Helloworld.java | 29 +++++ .../src/main/java/sample/HelloworldImpl.java | 29 +++++ .../src/main/java/sample/HelloworldNode.java | 40 +++++++ .../src/main/resources/Helloworld.composite | 28 +++++ .../helloworld-webapp/README | 28 +++++ .../helloworld-webapp/build.xml | 128 +++++++++++++++++++++ .../helloworld-webapp/pom.xml | 72 ++++++++++++ .../src/main/java/sample/Helloworld.java | 27 +++++ .../src/main/webapp/WEB-INF/web.composite | 29 +++++ .../src/main/webapp/WEB-INF/web.xml | 41 +++++++ .../helloworld-webapp/src/main/webapp/hello.jsp | 36 ++++++ 14 files changed, 614 insertions(+) create mode 100644 branches/sca-java-20080910/samples/helloworld-distributed/README create mode 100644 branches/sca-java-20080910/samples/helloworld-distributed/helloworld-node/README create mode 100644 branches/sca-java-20080910/samples/helloworld-distributed/helloworld-node/pom.xml create mode 100644 branches/sca-java-20080910/samples/helloworld-distributed/helloworld-node/src/main/java/sample/Helloworld.java create mode 100644 branches/sca-java-20080910/samples/helloworld-distributed/helloworld-node/src/main/java/sample/HelloworldImpl.java create mode 100644 branches/sca-java-20080910/samples/helloworld-distributed/helloworld-node/src/main/java/sample/HelloworldNode.java create mode 100644 branches/sca-java-20080910/samples/helloworld-distributed/helloworld-node/src/main/resources/Helloworld.composite create mode 100644 branches/sca-java-20080910/samples/helloworld-distributed/helloworld-webapp/README create mode 100644 branches/sca-java-20080910/samples/helloworld-distributed/helloworld-webapp/build.xml create mode 100644 branches/sca-java-20080910/samples/helloworld-distributed/helloworld-webapp/pom.xml create mode 100644 branches/sca-java-20080910/samples/helloworld-distributed/helloworld-webapp/src/main/java/sample/Helloworld.java create mode 100644 branches/sca-java-20080910/samples/helloworld-distributed/helloworld-webapp/src/main/webapp/WEB-INF/web.composite create mode 100644 branches/sca-java-20080910/samples/helloworld-distributed/helloworld-webapp/src/main/webapp/WEB-INF/web.xml create mode 100644 branches/sca-java-20080910/samples/helloworld-distributed/helloworld-webapp/src/main/webapp/hello.jsp (limited to 'branches/sca-java-20080910/samples/helloworld-distributed') diff --git a/branches/sca-java-20080910/samples/helloworld-distributed/README b/branches/sca-java-20080910/samples/helloworld-distributed/README new file mode 100644 index 0000000000..0ea891b07f --- /dev/null +++ b/branches/sca-java-20080910/samples/helloworld-distributed/README @@ -0,0 +1,28 @@ +Distributed Helloworld Sample +============================= + +This sample demonstrates a distributed SCA domain using the JMS implementation of binding.sca which +automatically discovers available nodes and the services they contain. + +In this sample there are two nodes in the domain, a standalone node containing a Helloworld component, +and a webapp using a JSP with which invokes the Helloworld service in the domain. + +To run the sample: + +- Build the two sample modules with mvn or Ant. +- Deploy the helloworld-webapp war to Tomcat. +- Start the standalone node by: + in the helloworld-node folder do "mvn dependency:copy-dependencies" then: + java -Djava.ext.dirs=target\dependency -cp target\sample-helloworld-node.jar sample.HelloworldNode +- On a web browser go to: + http://localhost:8080/sample-helloworld-webapp + +You should see "Hello world" returned on the web page and the node console should show "HelloworldImpl.sayHello: world" + +How it works: + + + + + + diff --git a/branches/sca-java-20080910/samples/helloworld-distributed/helloworld-node/README b/branches/sca-java-20080910/samples/helloworld-distributed/helloworld-node/README new file mode 100644 index 0000000000..0ea891b07f --- /dev/null +++ b/branches/sca-java-20080910/samples/helloworld-distributed/helloworld-node/README @@ -0,0 +1,28 @@ +Distributed Helloworld Sample +============================= + +This sample demonstrates a distributed SCA domain using the JMS implementation of binding.sca which +automatically discovers available nodes and the services they contain. + +In this sample there are two nodes in the domain, a standalone node containing a Helloworld component, +and a webapp using a JSP with which invokes the Helloworld service in the domain. + +To run the sample: + +- Build the two sample modules with mvn or Ant. +- Deploy the helloworld-webapp war to Tomcat. +- Start the standalone node by: + in the helloworld-node folder do "mvn dependency:copy-dependencies" then: + java -Djava.ext.dirs=target\dependency -cp target\sample-helloworld-node.jar sample.HelloworldNode +- On a web browser go to: + http://localhost:8080/sample-helloworld-webapp + +You should see "Hello world" returned on the web page and the node console should show "HelloworldImpl.sayHello: world" + +How it works: + + + + + + diff --git a/branches/sca-java-20080910/samples/helloworld-distributed/helloworld-node/pom.xml b/branches/sca-java-20080910/samples/helloworld-distributed/helloworld-node/pom.xml new file mode 100644 index 0000000000..941cb2b4ed --- /dev/null +++ b/branches/sca-java-20080910/samples/helloworld-distributed/helloworld-node/pom.xml @@ -0,0 +1,71 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-sca + 1.4-SNAPSHOT + ../../pom.xml + + sample-helloworld-node + Apache Tuscany SCA Helloworld Node Sample + + + + org.apache.tuscany.sca + tuscany-node-api + 1.4-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-node-impl + 1.4-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 1.4-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-binding-sca-jms + 1.4-SNAPSHOT + runtime + + + + junit + junit + 4.2 + test + + + + + + ${artifactId} + + diff --git a/branches/sca-java-20080910/samples/helloworld-distributed/helloworld-node/src/main/java/sample/Helloworld.java b/branches/sca-java-20080910/samples/helloworld-distributed/helloworld-node/src/main/java/sample/Helloworld.java new file mode 100644 index 0000000000..386426df73 --- /dev/null +++ b/branches/sca-java-20080910/samples/helloworld-distributed/helloworld-node/src/main/java/sample/Helloworld.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.osoa.sca.annotations.Remotable; + +@Remotable +public interface Helloworld { + + String sayHello(String name); + +} diff --git a/branches/sca-java-20080910/samples/helloworld-distributed/helloworld-node/src/main/java/sample/HelloworldImpl.java b/branches/sca-java-20080910/samples/helloworld-distributed/helloworld-node/src/main/java/sample/HelloworldImpl.java new file mode 100644 index 0000000000..033b4088c8 --- /dev/null +++ b/branches/sca-java-20080910/samples/helloworld-distributed/helloworld-node/src/main/java/sample/HelloworldImpl.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; + +public class HelloworldImpl implements Helloworld { + + public String sayHello(String name) { + System.out.println("HelloworldImpl.sayHello: " + name); + return "Hello " + name; + } + +} diff --git a/branches/sca-java-20080910/samples/helloworld-distributed/helloworld-node/src/main/java/sample/HelloworldNode.java b/branches/sca-java-20080910/samples/helloworld-distributed/helloworld-node/src/main/java/sample/HelloworldNode.java new file mode 100644 index 0000000000..3cd8fe547a --- /dev/null +++ b/branches/sca-java-20080910/samples/helloworld-distributed/helloworld-node/src/main/java/sample/HelloworldNode.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 sample; + +import org.apache.tuscany.sca.node.SCANode; +import org.apache.tuscany.sca.node.SCANodeFactory; + +/** + */ +public class HelloworldNode { + + public static void main(String[] args) throws Exception { + + SCANode node = SCANodeFactory.newInstance().createSCANodeFromClassLoader("Helloworld.composite", null); + node.start(); + + System.out.println("Hit enter to stop node..."); + System.in.read(); + + node.stop(); + } + +} diff --git a/branches/sca-java-20080910/samples/helloworld-distributed/helloworld-node/src/main/resources/Helloworld.composite b/branches/sca-java-20080910/samples/helloworld-distributed/helloworld-node/src/main/resources/Helloworld.composite new file mode 100644 index 0000000000..0f827390c8 --- /dev/null +++ b/branches/sca-java-20080910/samples/helloworld-distributed/helloworld-node/src/main/resources/Helloworld.composite @@ -0,0 +1,28 @@ + + + + + + + + + diff --git a/branches/sca-java-20080910/samples/helloworld-distributed/helloworld-webapp/README b/branches/sca-java-20080910/samples/helloworld-distributed/helloworld-webapp/README new file mode 100644 index 0000000000..0ea891b07f --- /dev/null +++ b/branches/sca-java-20080910/samples/helloworld-distributed/helloworld-webapp/README @@ -0,0 +1,28 @@ +Distributed Helloworld Sample +============================= + +This sample demonstrates a distributed SCA domain using the JMS implementation of binding.sca which +automatically discovers available nodes and the services they contain. + +In this sample there are two nodes in the domain, a standalone node containing a Helloworld component, +and a webapp using a JSP with which invokes the Helloworld service in the domain. + +To run the sample: + +- Build the two sample modules with mvn or Ant. +- Deploy the helloworld-webapp war to Tomcat. +- Start the standalone node by: + in the helloworld-node folder do "mvn dependency:copy-dependencies" then: + java -Djava.ext.dirs=target\dependency -cp target\sample-helloworld-node.jar sample.HelloworldNode +- On a web browser go to: + http://localhost:8080/sample-helloworld-webapp + +You should see "Hello world" returned on the web page and the node console should show "HelloworldImpl.sayHello: world" + +How it works: + + + + + + diff --git a/branches/sca-java-20080910/samples/helloworld-distributed/helloworld-webapp/build.xml b/branches/sca-java-20080910/samples/helloworld-distributed/helloworld-webapp/build.xml new file mode 100644 index 0000000000..e08dd3027a --- /dev/null +++ b/branches/sca-java-20080910/samples/helloworld-distributed/helloworld-webapp/build.xml @@ -0,0 +1,128 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/branches/sca-java-20080910/samples/helloworld-distributed/helloworld-webapp/pom.xml b/branches/sca-java-20080910/samples/helloworld-distributed/helloworld-webapp/pom.xml new file mode 100644 index 0000000000..1fc96d1623 --- /dev/null +++ b/branches/sca-java-20080910/samples/helloworld-distributed/helloworld-webapp/pom.xml @@ -0,0 +1,72 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-sca + 1.4-SNAPSHOT + ../../pom.xml + + sample-helloworld-webapp + war + Apache Tuscany SCA Distributed Helloworld WebApp Sample + + + + org.apache.tuscany.sca + tuscany-host-webapp + 1.4-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-implementation-web-runtime + 1.4-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-binding-sca-jms + 1.4-SNAPSHOT + runtime + + + + + + ${artifactId} + + + org.apache.tuscany.sca + tuscany-maven-ant-generator + 1.4-SNAPSHOT + + + + generate + + + + + + + diff --git a/branches/sca-java-20080910/samples/helloworld-distributed/helloworld-webapp/src/main/java/sample/Helloworld.java b/branches/sca-java-20080910/samples/helloworld-distributed/helloworld-webapp/src/main/java/sample/Helloworld.java new file mode 100644 index 0000000000..7dd39b82a4 --- /dev/null +++ b/branches/sca-java-20080910/samples/helloworld-distributed/helloworld-webapp/src/main/java/sample/Helloworld.java @@ -0,0 +1,27 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package sample; + +import org.osoa.sca.annotations.Remotable; + +@Remotable +public interface Helloworld { + + String sayHello(String name); +} diff --git a/branches/sca-java-20080910/samples/helloworld-distributed/helloworld-webapp/src/main/webapp/WEB-INF/web.composite b/branches/sca-java-20080910/samples/helloworld-distributed/helloworld-webapp/src/main/webapp/WEB-INF/web.composite new file mode 100644 index 0000000000..0e8de1be42 --- /dev/null +++ b/branches/sca-java-20080910/samples/helloworld-distributed/helloworld-webapp/src/main/webapp/WEB-INF/web.composite @@ -0,0 +1,29 @@ + + + + + + + + + + diff --git a/branches/sca-java-20080910/samples/helloworld-distributed/helloworld-webapp/src/main/webapp/WEB-INF/web.xml b/branches/sca-java-20080910/samples/helloworld-distributed/helloworld-webapp/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000000..1eefec1c48 --- /dev/null +++ b/branches/sca-java-20080910/samples/helloworld-distributed/helloworld-webapp/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,41 @@ + + + + + + + Apache Tuscany Distributed Helloworld Sample + + + tuscany + org.apache.tuscany.sca.host.webapp.TuscanyServletFilter + + + + tuscany + /* + + + + hello.jsp + + + diff --git a/branches/sca-java-20080910/samples/helloworld-distributed/helloworld-webapp/src/main/webapp/hello.jsp b/branches/sca-java-20080910/samples/helloworld-distributed/helloworld-webapp/src/main/webapp/hello.jsp new file mode 100644 index 0000000000..873329cf7c --- /dev/null +++ b/branches/sca-java-20080910/samples/helloworld-distributed/helloworld-webapp/src/main/webapp/hello.jsp @@ -0,0 +1,36 @@ + +<%@ page contentType="text/html;charset=UTF-8" language="java" %> +<%@ taglib uri="http://www.osoa.org/sca/sca_jsp.tld" prefix="sca" %> + + + + + + +

Apache Tuscany Distributed Helloworld Sample

+ + Calling service.sayHello("world") returns: + +

+ + <%= service.sayHello("world") %> + + + -- cgit v1.2.3