On 08/27/2011 09:54 AM, [email protected] wrote:
Added: karaf/cellar/trunk/samples/dosgi-greeter/NOTICE
URL: 
http://svn.apache.org/viewvc/karaf/cellar/trunk/samples/dosgi-greeter/NOTICE?rev=1162356&view=auto
==============================================================================
--- karaf/cellar/trunk/samples/dosgi-greeter/NOTICE (added)
+++ karaf/cellar/trunk/samples/dosgi-greeter/NOTICE Sat Aug 27 13:54:04 2011
@@ -0,0 +1,44 @@
+Apache Karaf Cellar
+Copyright 2011 The Apache Software Foundation
+
+
+I. Included Software
+
+This product includes software developed at
+The Apache Software Foundation (http://www.apache.org/).
+Licensed under the Apache License 2.0.
+
+This product includes software written by
+Antony Lesuisse.
+Licensed under Public Domain.
+

"Placed in Public Domain" better phrasing? (I'm not sure if something can have a public domain "license" or even be placed in the public domain -- http://www.linuxjournal.com/article/6225, and such statements might scare away potential users.) Getting Antony to put an Apache or MIT license might be a better, safer move.


Added: karaf/cellar/trunk/samples/dosgi-greeter/README
URL: 
http://svn.apache.org/viewvc/karaf/cellar/trunk/samples/dosgi-greeter/README?rev=1162356&view=auto
==============================================================================
--- karaf/cellar/trunk/samples/dosgi-greeter/README (added)
+++ karaf/cellar/trunk/samples/dosgi-greeter/README Sat Aug 27 13:54:04 2011
@@ -0,0 +1,34 @@
+DOSGi Greeter is a sample application that demonstrates the DOSGi feature of 
Cellar.
+
+Requirements / Setup
+--------------------
+It requires a cellar cluster of at least to nodes, say node A and B.

Cellar cluster, *two* nodes

+
+Node B will export the Greeter service and node A will import the service.
+
+192.168.1.101:5701 (Node A)
+192.168.1.101:5702 (Node B)
+
+Installation
+------------
+1. Start the two nodes.
+2. Connect to the shell of node A.
+
+   Node A Shell:
+   -------------
+   karaf@root>  features:addurl 
mvn:org.apache.karaf.cellar.samples/dosgi-greeter/3.0.0-SNAPSHOT/xml/features
+   karaf@root>  cluster:group-set greeter-exporter-group 192.168.1.1:5702
+   Node                 Group
+   * 192.168.1.101:5701   greeter-exporter-group
+     192.168.1.101:5702   greeter-exporter-group
+   karaf@root>  cluster:group-set greeter-importer-group 192.168.1.1:5701
+   Node                 Group
+   * 192.168.1.101:5701   greeter-importer-group
+   karaf@root>  cluster:features-install greeter-exporter-group greeter-service
+   karaf@root>  cluster:features-install greeter-importer-group greeter-client
+
+3. Executing the greet (Pass a greet message and the number of iterations).
+   karaf@root>  dosgi-greeter:greet Halo 2
+   Halo.Halo from node 192.168.1.101:5702 count 0.
+   Halo.Halo from node 192.168.1.101:5702 count 1.
+



Hello.Hello ....


Added: 
karaf/cellar/trunk/samples/dosgi-greeter/api/src/main/java/org/apache/karaf/cellar/samples/dosgi/greeter/api/GreetResponse.java
URL: 
http://svn.apache.org/viewvc/karaf/cellar/trunk/samples/dosgi-greeter/api/src/main/java/org/apache/karaf/cellar/samples/dosgi/greeter/api/GreetResponse.java?rev=1162356&view=auto
==============================================================================
--- 
karaf/cellar/trunk/samples/dosgi-greeter/api/src/main/java/org/apache/karaf/cellar/samples/dosgi/greeter/api/GreetResponse.java
 (added)
+++ 
karaf/cellar/trunk/samples/dosgi-greeter/api/src/main/java/org/apache/karaf/cellar/samples/dosgi/greeter/api/GreetResponse.java
 Sat Aug 27 13:54:04 2011
@@ -0,0 +1,47 @@
+/*
+ * Licensed 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 org.apache.karaf.cellar.samples.dosgi.greeter.api;
+
+import java.io.Serializable;
+
+/**
+ * @author: iocanel
+ */

I think we've already removed the @author tags from Karaf, as they're an Apache no-no.


+public class GreetResponse implements Serializable {
+
+    private Greet greet;
+    private String response;
+
+    public GreetResponse(Greet greet, String response) {
+        this.greet = greet;
+        this.response = response;
+    }
+
+    public Greet getGreet() {
+        return greet;
+    }
+
+    public void setGreet(Greet greet) {
+        this.greet = greet;
+    }
+
+    public String getResponse() {
+        return response;
+    }
+
+    public void setResponse(String response) {
+        this.response = response;
+    }
+}

Added: 
karaf/cellar/trunk/samples/dosgi-greeter/api/src/main/java/org/apache/karaf/cellar/samples/dosgi/greeter/api/Greeter.java
URL: 
http://svn.apache.org/viewvc/karaf/cellar/trunk/samples/dosgi-greeter/api/src/main/java/org/apache/karaf/cellar/samples/dosgi/greeter/api/Greeter.java?rev=1162356&view=auto
==============================================================================
--- 
karaf/cellar/trunk/samples/dosgi-greeter/api/src/main/java/org/apache/karaf/cellar/samples/dosgi/greeter/api/Greeter.java
 (added)
+++ 
karaf/cellar/trunk/samples/dosgi-greeter/api/src/main/java/org/apache/karaf/cellar/samples/dosgi/greeter/api/Greeter.java
 Sat Aug 27 13:54:04 2011
@@ -0,0 +1,26 @@
+/*
+ * Licensed 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 org.apache.karaf.cellar.samples.dosgi.greeter.api;
+
+/**
+ * @author: iocanel
+ */
+public interface Greeter {
+
+    /**
+     * Returns a greet message.

Returns a greeting.   (is more natural, but "greet message" will work.)

+     * @return
+     */
+    public GreetResponse greet(Greet greet);
+}

Added: karaf/cellar/trunk/samples/dosgi-greeter/client/pom.xml
URL: 
http://svn.apache.org/viewvc/karaf/cellar/trunk/samples/dosgi-greeter/client/pom.xml?rev=1162356&view=auto
==============================================================================
--- karaf/cellar/trunk/samples/dosgi-greeter/client/pom.xml (added)
+++ karaf/cellar/trunk/samples/dosgi-greeter/client/pom.xml Sat Aug 27 13:54:04 
2011
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Licensed 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 xmlns="http://maven.apache.org/POM/4.0.0";
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd";>
+<parent>
+<artifactId>dosgi-greeter</artifactId>
+<groupId>org.apache.karaf.cellar.samples</groupId>
+<version>3.0.0-SNAPSHOT</version>
+</parent>
+<modelVersion>4.0.0</modelVersion>
+
+<groupId>org.apache.karaf.cellar.samples.dosgi.greeter</groupId>
+<artifactId>org.apache.karaf.cellar.samples.dosgi.greeter.client</artifactId>
+<packaging>bundle</packaging>
+<name>Apache Karaf :: Cellar :: Samples :: DOSGi Greeter :: Client</name>
+
+<properties>
+<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+<osgi.import>
+            !org.apache.karaf.cellar.samples.dosgi.greeter.client*,
+            org.apache.karaf.cellar.samples.dosgi.greeter.api,
+            *
+</osgi.import>
+<osgi.export>
+            
org.apache.karaf.cellar.samples.dosgi.greeter.client*;version="${project.version}"
+</osgi.export>
+</properties>
+
+<dependencies>
+<dependency>
+<groupId>org.apache.karaf.cellar</groupId>
+<artifactId>org.apache.karaf.cellar.core</artifactId>
+</dependency>
+<dependency>
+<groupId>org.apache.karaf.cellar.samples.dosgi.greeter</groupId>
+<artifactId>org.apache.karaf.cellar.samples.dosgi.greeter.api</artifactId>
+<version>${project.version}</version>
+</dependency>
+</dependencies>
+
+</project>
\ No newline at end of file

Added: 
karaf/cellar/trunk/samples/dosgi-greeter/client/src/main/java/org/apache/karaf/cellar/samples/dosgi/greeter/client/GreetCommand.java
URL: 
http://svn.apache.org/viewvc/karaf/cellar/trunk/samples/dosgi-greeter/client/src/main/java/org/apache/karaf/cellar/samples/dosgi/greeter/client/GreetCommand.java?rev=1162356&view=auto
==============================================================================
--- 
karaf/cellar/trunk/samples/dosgi-greeter/client/src/main/java/org/apache/karaf/cellar/samples/dosgi/greeter/client/GreetCommand.java
 (added)
+++ 
karaf/cellar/trunk/samples/dosgi-greeter/client/src/main/java/org/apache/karaf/cellar/samples/dosgi/greeter/client/GreetCommand.java
 Sat Aug 27 13:54:04 2011
@@ -0,0 +1,50 @@
+/*
+ * Licensed 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 org.apache.karaf.cellar.samples.dosgi.greeter.client;
+
+import org.apache.felix.gogo.commands.Argument;
+import org.apache.felix.gogo.commands.Command;
+import org.apache.karaf.cellar.samples.dosgi.greeter.api.Greeter;
+import org.apache.karaf.shell.console.OsgiCommandSupport;
+
+/**
+ * @author: iocanel
+ */
+@Command(scope = "dosgi-greeter", name = "greet", description = "Starts the greet 
client")
+public class GreetCommand extends OsgiCommandSupport {
+
+    @Argument(index = 0, name = "greetMessage", description = "The message that 
will be sent as greet.", required = true, multiValued = false)

sent as *the greeting*.

Added: 
karaf/cellar/trunk/samples/dosgi-greeter/service/src/main/java/org/apache/karaf/cellar/samples/dosgi/greeter/service/GreeterImpl.java
URL: 
http://svn.apache.org/viewvc/karaf/cellar/trunk/samples/dosgi-greeter/service/src/main/java/org/apache/karaf/cellar/samples/dosgi/greeter/service/GreeterImpl.java?rev=1162356&view=auto
==============================================================================
--- 
karaf/cellar/trunk/samples/dosgi-greeter/service/src/main/java/org/apache/karaf/cellar/samples/dosgi/greeter/service/GreeterImpl.java
 (added)
+++ 
karaf/cellar/trunk/samples/dosgi-greeter/service/src/main/java/org/apache/karaf/cellar/samples/dosgi/greeter/service/GreeterImpl.java
 Sat Aug 27 13:54:04 2011
@@ -0,0 +1,40 @@
+/*
+ * Licensed 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 org.apache.karaf.cellar.samples.dosgi.greeter.service;
+
+import org.apache.karaf.cellar.samples.dosgi.greeter.api.Greet;
+import org.apache.karaf.cellar.samples.dosgi.greeter.api.GreetResponse;
+import org.apache.karaf.cellar.samples.dosgi.greeter.api.Greeter;
+
+/**
+ * @author: iocanel
+ */
+public class GreeterImpl implements Greeter {
+
+    private int counter=0;
+    private String id;
+
+    public GreeterImpl(String id) {
+        this.id = id;
+    }
+
+    @Override
+    public GreetResponse greet(Greet greet) {
+        String message = greet.getMessage();
+        String response = message+"." +String.format("Halo from node %s count 
%s.",id,counter++);

"Hello from..."


--
Glen Mazza
Talend - http://www.talend.com/ai
Blog - http://www.jroller.com/gmazza
Twitter - glenmazza


Reply via email to