diff options
Diffstat (limited to 'branches/sca-java-1.4/samples/helloworld-distributed/helloworld-node')
5 files changed, 172 insertions, 0 deletions
diff --git a/branches/sca-java-1.4/samples/helloworld-distributed/helloworld-node/README b/branches/sca-java-1.4/samples/helloworld-distributed/helloworld-node/README new file mode 100644 index 0000000000..9462ae4218 --- /dev/null +++ b/branches/sca-java-1.4/samples/helloworld-distributed/helloworld-node/README @@ -0,0 +1,29 @@ +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 <implementation.web> 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 -jar target\dependency\tuscany-node-dynamic-1.4-SNAPSHOT.jar target\sample-helloworld-node.jar
+
+- 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-1.4/samples/helloworld-distributed/helloworld-node/pom.xml b/branches/sca-java-1.4/samples/helloworld-distributed/helloworld-node/pom.xml new file mode 100644 index 0000000000..94b44edb40 --- /dev/null +++ b/branches/sca-java-1.4/samples/helloworld-distributed/helloworld-node/pom.xml @@ -0,0 +1,57 @@ +<?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>tuscany-sca</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <artifactId>sample-helloworld-node</artifactId>
+ <name>Apache Tuscany SCA Helloworld Node Sample</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca-api</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node-dynamic</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ </build>
+</project>
diff --git a/branches/sca-java-1.4/samples/helloworld-distributed/helloworld-node/src/main/java/sample/Helloworld.java b/branches/sca-java-1.4/samples/helloworld-distributed/helloworld-node/src/main/java/sample/Helloworld.java new file mode 100644 index 0000000000..386426df73 --- /dev/null +++ b/branches/sca-java-1.4/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-1.4/samples/helloworld-distributed/helloworld-node/src/main/java/sample/HelloworldImpl.java b/branches/sca-java-1.4/samples/helloworld-distributed/helloworld-node/src/main/java/sample/HelloworldImpl.java new file mode 100644 index 0000000000..033b4088c8 --- /dev/null +++ b/branches/sca-java-1.4/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-1.4/samples/helloworld-distributed/helloworld-node/src/main/resources/META-INF/sca-deployables/Helloworld.composite b/branches/sca-java-1.4/samples/helloworld-distributed/helloworld-node/src/main/resources/META-INF/sca-deployables/Helloworld.composite new file mode 100644 index 0000000000..0f827390c8 --- /dev/null +++ b/branches/sca-java-1.4/samples/helloworld-distributed/helloworld-node/src/main/resources/META-INF/sca-deployables/Helloworld.composite @@ -0,0 +1,28 @@ +<?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://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://sample"
+ name="Helloworld">
+
+ <component name="HelloworldComponent">
+ <implementation.java class="sample.HelloworldImpl"/>
+ </component>
+
+</composite>
|