Author: iocanel
Date: Sat Aug 27 13:54:04 2011
New Revision: 1162356

URL: http://svn.apache.org/viewvc?rev=1162356&view=rev
Log:
[KARAF-837] Added samples. Added dosgi-greeter sample. Added hazelcast-app 
sample.

Added:
    karaf/cellar/trunk/samples/
    karaf/cellar/trunk/samples/dosgi-greeter/
    karaf/cellar/trunk/samples/dosgi-greeter/NOTICE
    karaf/cellar/trunk/samples/dosgi-greeter/README
    karaf/cellar/trunk/samples/dosgi-greeter/api/
    karaf/cellar/trunk/samples/dosgi-greeter/api/pom.xml
    karaf/cellar/trunk/samples/dosgi-greeter/api/src/
    karaf/cellar/trunk/samples/dosgi-greeter/api/src/main/
    karaf/cellar/trunk/samples/dosgi-greeter/api/src/main/java/
    karaf/cellar/trunk/samples/dosgi-greeter/api/src/main/java/org/
    karaf/cellar/trunk/samples/dosgi-greeter/api/src/main/java/org/apache/
    karaf/cellar/trunk/samples/dosgi-greeter/api/src/main/java/org/apache/karaf/
    
karaf/cellar/trunk/samples/dosgi-greeter/api/src/main/java/org/apache/karaf/cellar/
    
karaf/cellar/trunk/samples/dosgi-greeter/api/src/main/java/org/apache/karaf/cellar/samples/
    
karaf/cellar/trunk/samples/dosgi-greeter/api/src/main/java/org/apache/karaf/cellar/samples/dosgi/
    
karaf/cellar/trunk/samples/dosgi-greeter/api/src/main/java/org/apache/karaf/cellar/samples/dosgi/greeter/
    
karaf/cellar/trunk/samples/dosgi-greeter/api/src/main/java/org/apache/karaf/cellar/samples/dosgi/greeter/api/
    
karaf/cellar/trunk/samples/dosgi-greeter/api/src/main/java/org/apache/karaf/cellar/samples/dosgi/greeter/api/Greet.java
    
karaf/cellar/trunk/samples/dosgi-greeter/api/src/main/java/org/apache/karaf/cellar/samples/dosgi/greeter/api/GreetResponse.java
    
karaf/cellar/trunk/samples/dosgi-greeter/api/src/main/java/org/apache/karaf/cellar/samples/dosgi/greeter/api/Greeter.java
    karaf/cellar/trunk/samples/dosgi-greeter/api/src/test/
    karaf/cellar/trunk/samples/dosgi-greeter/api/src/test/java/
    karaf/cellar/trunk/samples/dosgi-greeter/client/
    karaf/cellar/trunk/samples/dosgi-greeter/client/pom.xml
    karaf/cellar/trunk/samples/dosgi-greeter/client/src/
    karaf/cellar/trunk/samples/dosgi-greeter/client/src/main/
    karaf/cellar/trunk/samples/dosgi-greeter/client/src/main/java/
    karaf/cellar/trunk/samples/dosgi-greeter/client/src/main/java/org/
    karaf/cellar/trunk/samples/dosgi-greeter/client/src/main/java/org/apache/
    
karaf/cellar/trunk/samples/dosgi-greeter/client/src/main/java/org/apache/karaf/
    
karaf/cellar/trunk/samples/dosgi-greeter/client/src/main/java/org/apache/karaf/cellar/
    
karaf/cellar/trunk/samples/dosgi-greeter/client/src/main/java/org/apache/karaf/cellar/samples/
    
karaf/cellar/trunk/samples/dosgi-greeter/client/src/main/java/org/apache/karaf/cellar/samples/dosgi/
    
karaf/cellar/trunk/samples/dosgi-greeter/client/src/main/java/org/apache/karaf/cellar/samples/dosgi/greeter/
    
karaf/cellar/trunk/samples/dosgi-greeter/client/src/main/java/org/apache/karaf/cellar/samples/dosgi/greeter/client/
    
karaf/cellar/trunk/samples/dosgi-greeter/client/src/main/java/org/apache/karaf/cellar/samples/dosgi/greeter/client/GreetCommand.java
    
karaf/cellar/trunk/samples/dosgi-greeter/client/src/main/java/org/apache/karaf/cellar/samples/dosgi/greeter/client/GreeterClient.java
    karaf/cellar/trunk/samples/dosgi-greeter/client/src/main/resources/
    karaf/cellar/trunk/samples/dosgi-greeter/client/src/main/resources/OSGI-INF/
    
karaf/cellar/trunk/samples/dosgi-greeter/client/src/main/resources/OSGI-INF/blueprint/
    
karaf/cellar/trunk/samples/dosgi-greeter/client/src/main/resources/OSGI-INF/blueprint/blueprint.xml
    
karaf/cellar/trunk/samples/dosgi-greeter/client/src/main/resources/OSGI-INF/blueprint/shell-greeter.xml
    karaf/cellar/trunk/samples/dosgi-greeter/client/src/test/
    karaf/cellar/trunk/samples/dosgi-greeter/client/src/test/java/
    karaf/cellar/trunk/samples/dosgi-greeter/pom.xml
    karaf/cellar/trunk/samples/dosgi-greeter/service/
    karaf/cellar/trunk/samples/dosgi-greeter/service/pom.xml
    karaf/cellar/trunk/samples/dosgi-greeter/service/src/
    karaf/cellar/trunk/samples/dosgi-greeter/service/src/main/
    karaf/cellar/trunk/samples/dosgi-greeter/service/src/main/java/
    karaf/cellar/trunk/samples/dosgi-greeter/service/src/main/java/org/
    karaf/cellar/trunk/samples/dosgi-greeter/service/src/main/java/org/apache/
    
karaf/cellar/trunk/samples/dosgi-greeter/service/src/main/java/org/apache/karaf/
    
karaf/cellar/trunk/samples/dosgi-greeter/service/src/main/java/org/apache/karaf/cellar/
    
karaf/cellar/trunk/samples/dosgi-greeter/service/src/main/java/org/apache/karaf/cellar/samples/
    
karaf/cellar/trunk/samples/dosgi-greeter/service/src/main/java/org/apache/karaf/cellar/samples/dosgi/
    
karaf/cellar/trunk/samples/dosgi-greeter/service/src/main/java/org/apache/karaf/cellar/samples/dosgi/greeter/
    
karaf/cellar/trunk/samples/dosgi-greeter/service/src/main/java/org/apache/karaf/cellar/samples/dosgi/greeter/service/
    
karaf/cellar/trunk/samples/dosgi-greeter/service/src/main/java/org/apache/karaf/cellar/samples/dosgi/greeter/service/GreeterImpl.java
    karaf/cellar/trunk/samples/dosgi-greeter/service/src/main/resources/
    
karaf/cellar/trunk/samples/dosgi-greeter/service/src/main/resources/OSGI-INF/
    
karaf/cellar/trunk/samples/dosgi-greeter/service/src/main/resources/OSGI-INF/blueprint/
    
karaf/cellar/trunk/samples/dosgi-greeter/service/src/main/resources/OSGI-INF/blueprint/blueprint.xml
    karaf/cellar/trunk/samples/dosgi-greeter/service/src/test/
    karaf/cellar/trunk/samples/dosgi-greeter/service/src/test/java/
    karaf/cellar/trunk/samples/dosgi-greeter/src/
    karaf/cellar/trunk/samples/dosgi-greeter/src/main/
    karaf/cellar/trunk/samples/dosgi-greeter/src/main/resources/
    karaf/cellar/trunk/samples/dosgi-greeter/src/main/resources/features.xml
Modified:
    karaf/cellar/trunk/pom.xml

Modified: karaf/cellar/trunk/pom.xml
URL: 
http://svn.apache.org/viewvc/karaf/cellar/trunk/pom.xml?rev=1162356&r1=1162355&r2=1162356&view=diff
==============================================================================
--- karaf/cellar/trunk/pom.xml (original)
+++ karaf/cellar/trunk/pom.xml Sat Aug 27 13:54:04 2011
@@ -63,6 +63,7 @@
         <module>management</module>
         <module>webconsole</module>
         <module>assembly</module>
+        <module>samples</module>
     </modules>
 
     <scm>

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.
+
+
+II. Used Software
+
+This product uses software developed at
+The OSGi Alliance (http://www.osgi.org/).
+Copyright (c) OSGi Alliance (2000, 2010).
+Licensed under the Apache License 2.0.
+
+This product uses software developed at
+OPS4J (http://www.ops4j.org/).
+Licensed under the Apache License 2.0.
+
+This product uses software developed at
+FUSE Source (http://www.fusesource.org/).
+Licensed under the Apache License 2.0.
+
+This product uses software developed at
+JLine (http://jline.sourceforge.net).
+Licensed under the BSD License.
+
+This product uses software developed at
+SLF4J (http://www.slf4j.org/).
+Licensed under the MIT License.
+
+This product includes software from http://www.json.org.
+Copyright (c) 2002 JSON.org
+
+
+III. License Summary
+- Apache License 2.0

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.
+
+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.
+

Added: karaf/cellar/trunk/samples/dosgi-greeter/api/pom.xml
URL: 
http://svn.apache.org/viewvc/karaf/cellar/trunk/samples/dosgi-greeter/api/pom.xml?rev=1162356&view=auto
==============================================================================
--- karaf/cellar/trunk/samples/dosgi-greeter/api/pom.xml (added)
+++ karaf/cellar/trunk/samples/dosgi-greeter/api/pom.xml Sat Aug 27 13:54:04 
2011
@@ -0,0 +1,41 @@
+<?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.api</artifactId>
+    <packaging>bundle</packaging>
+    <name>Apache Karaf :: Cellar :: Samples :: DOSGi Greeter :: API</name>
+
+    <properties>
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+        <osgi.import>
+            !org.apache.karaf.cellar.samples.dosgi.greeter.api*,
+            *
+        </osgi.import>
+        <osgi.export>
+            
org.apache.karaf.cellar.samples.dosgi.greeter.api*;version="${project.version}"
+        </osgi.export>
+    </properties>
+</project>
\ No newline at end of file

Added: 
karaf/cellar/trunk/samples/dosgi-greeter/api/src/main/java/org/apache/karaf/cellar/samples/dosgi/greeter/api/Greet.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/Greet.java?rev=1162356&view=auto
==============================================================================
--- 
karaf/cellar/trunk/samples/dosgi-greeter/api/src/main/java/org/apache/karaf/cellar/samples/dosgi/greeter/api/Greet.java
 (added)
+++ 
karaf/cellar/trunk/samples/dosgi-greeter/api/src/main/java/org/apache/karaf/cellar/samples/dosgi/greeter/api/Greet.java
 Sat Aug 27 13:54:04 2011
@@ -0,0 +1,36 @@
+/*
+ * 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
+ */
+public class Greet implements Serializable {
+    String message;
+
+    public Greet(String message) {
+        this.message = message;
+    }
+
+    public String getMessage() {
+        return message;
+    }
+
+    public void setMessage(String message) {
+        this.message = message;
+    }
+}

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
+ */
+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.
+     * @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)
+    String greetMessage;
+
+    @Argument(index = 1, name = "iterations", description = "The number of 
greet iterations to perform", required = false, multiValued = false)
+    Integer iterations = 10;
+
+     private Greeter greeter;
+
+
+    protected Object doExecute() throws Exception {
+        GreeterClient greeterClient = new GreeterClient(greeter, 
greetMessage,iterations);
+        greeterClient.start();
+        return null;
+    }
+
+    public Greeter getGreeter() {
+        return greeter;
+    }
+
+    public void setGreeter(Greeter greeter) {
+        this.greeter = greeter;
+    }
+}

Added: 
karaf/cellar/trunk/samples/dosgi-greeter/client/src/main/java/org/apache/karaf/cellar/samples/dosgi/greeter/client/GreeterClient.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/GreeterClient.java?rev=1162356&view=auto
==============================================================================
--- 
karaf/cellar/trunk/samples/dosgi-greeter/client/src/main/java/org/apache/karaf/cellar/samples/dosgi/greeter/client/GreeterClient.java
 (added)
+++ 
karaf/cellar/trunk/samples/dosgi-greeter/client/src/main/java/org/apache/karaf/cellar/samples/dosgi/greeter/client/GreeterClient.java
 Sat Aug 27 13:54:04 2011
@@ -0,0 +1,45 @@
+/*
+ * 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.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 GreeterClient {
+
+    private Greeter greeter;
+    private String greetMessage;
+    private int count;
+
+    public GreeterClient(Greeter greeter, String greetMessage, int count) {
+        this.greeter = greeter;
+        this.greetMessage = greetMessage;
+        this.count = count;
+    }
+
+    public void start() {
+        Greet greet  = new Greet(greetMessage);
+        for (int i = 0; i < count; i++) {
+            GreetResponse greetResponse = greeter.greet(greet);
+            if(greetResponse != null) {
+                System.out.println(greetResponse.getResponse());
+            } else System.out.println("Time out!");
+        }
+    }
+}

Added: 
karaf/cellar/trunk/samples/dosgi-greeter/client/src/main/resources/OSGI-INF/blueprint/blueprint.xml
URL: 
http://svn.apache.org/viewvc/karaf/cellar/trunk/samples/dosgi-greeter/client/src/main/resources/OSGI-INF/blueprint/blueprint.xml?rev=1162356&view=auto
==============================================================================
--- 
karaf/cellar/trunk/samples/dosgi-greeter/client/src/main/resources/OSGI-INF/blueprint/blueprint.xml
 (added)
+++ 
karaf/cellar/trunk/samples/dosgi-greeter/client/src/main/resources/OSGI-INF/blueprint/blueprint.xml
 Sat Aug 27 13:54:04 2011
@@ -0,0 +1,20 @@
+<?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.
+  -->
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0";>
+
+    <reference id="greeter" 
interface="org.apache.karaf.cellar.samples.dosgi.greeter.api.Greeter"/>
+
+</blueprint>

Added: 
karaf/cellar/trunk/samples/dosgi-greeter/client/src/main/resources/OSGI-INF/blueprint/shell-greeter.xml
URL: 
http://svn.apache.org/viewvc/karaf/cellar/trunk/samples/dosgi-greeter/client/src/main/resources/OSGI-INF/blueprint/shell-greeter.xml?rev=1162356&view=auto
==============================================================================
--- 
karaf/cellar/trunk/samples/dosgi-greeter/client/src/main/resources/OSGI-INF/blueprint/shell-greeter.xml
 (added)
+++ 
karaf/cellar/trunk/samples/dosgi-greeter/client/src/main/resources/OSGI-INF/blueprint/shell-greeter.xml
 Sat Aug 27 13:54:04 2011
@@ -0,0 +1,27 @@
+<?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.
+-->
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"; 
default-activation="lazy">
+
+    <!-- Command Bundle -->
+    <command-bundle xmlns="http://karaf.apache.org/xmlns/shell/v1.0.0";>
+        <command name="dosgi-greeter/greet">
+            <action 
class="org.apache.karaf.cellar.samples.dosgi.greeter.client.GreetCommand">
+                <property name="greeter" ref="greeter"/>
+            </action>
+        </command>
+    </command-bundle>
+
+</blueprint>

Added: karaf/cellar/trunk/samples/dosgi-greeter/pom.xml
URL: 
http://svn.apache.org/viewvc/karaf/cellar/trunk/samples/dosgi-greeter/pom.xml?rev=1162356&view=auto
==============================================================================
--- karaf/cellar/trunk/samples/dosgi-greeter/pom.xml (added)
+++ karaf/cellar/trunk/samples/dosgi-greeter/pom.xml Sat Aug 27 13:54:04 2011
@@ -0,0 +1,87 @@
+<?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>samples</artifactId>
+        <groupId>org.apache.karaf.cellar</groupId>
+        <version>3.0.0-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <groupId>org.apache.karaf.cellar.samples</groupId>
+    <artifactId>dosgi-greeter</artifactId>
+    <packaging>pom</packaging>
+    <name>Apache Karaf :: Cellar :: Samples :: DOSGi</name>
+
+    <modules>
+        <module>api</module>
+        <module>service</module>
+        <module>client</module>
+    </modules>
+
+    <build>
+        <resources>
+            <resource>
+                <directory>src/main/resources</directory>
+                <filtering>true</filtering>
+                <includes>
+                    <include>**/*</include>
+                </includes>
+            </resource>
+        </resources>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-resources-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>filter</id>
+                        <phase>generate-resources</phase>
+                        <goals>
+                            <goal>resources</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <groupId>org.codehaus.mojo</groupId>
+                <artifactId>build-helper-maven-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>attach-artifact</id>
+                        <phase>package</phase>
+                        <goals>
+                            <goal>attach-artifact</goal>
+                        </goals>
+                        <configuration>
+                            <artifacts>
+                                <artifact>
+                                    <file>target/classes/features.xml</file>
+                                    <type>xml</type>
+                                    <classifier>features</classifier>
+                                </artifact>
+                            </artifacts>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+    </build>
+
+
+</project>
\ No newline at end of file

Added: karaf/cellar/trunk/samples/dosgi-greeter/service/pom.xml
URL: 
http://svn.apache.org/viewvc/karaf/cellar/trunk/samples/dosgi-greeter/service/pom.xml?rev=1162356&view=auto
==============================================================================
--- karaf/cellar/trunk/samples/dosgi-greeter/service/pom.xml (added)
+++ karaf/cellar/trunk/samples/dosgi-greeter/service/pom.xml Sat Aug 27 
13:54:04 2011
@@ -0,0 +1,51 @@
+<?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.service</artifactId>
+    <packaging>bundle</packaging>
+    <name>Apache Karaf :: Cellar :: Samples :: DOSGi Greeter :: Service</name>
+
+    <properties>
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+        <osgi.import>
+            !org.apache.karaf.cellar.samples.dosgi.greeter.service*,
+            org.apache.karaf.cellar.samples.dosgi.greeter.api,
+            *
+        </osgi.import>
+        <osgi.export>
+            
org.apache.karaf.cellar.samples.dosgi.greeter.service*;version="${project.version}"
+        </osgi.export>
+    </properties>
+
+    <dependencies>
+        <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/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++);
+        GreetResponse greetResponse = new GreetResponse(greet,response);
+        return greetResponse;
+    }
+}

Added: 
karaf/cellar/trunk/samples/dosgi-greeter/service/src/main/resources/OSGI-INF/blueprint/blueprint.xml
URL: 
http://svn.apache.org/viewvc/karaf/cellar/trunk/samples/dosgi-greeter/service/src/main/resources/OSGI-INF/blueprint/blueprint.xml?rev=1162356&view=auto
==============================================================================
--- 
karaf/cellar/trunk/samples/dosgi-greeter/service/src/main/resources/OSGI-INF/blueprint/blueprint.xml
 (added)
+++ 
karaf/cellar/trunk/samples/dosgi-greeter/service/src/main/resources/OSGI-INF/blueprint/blueprint.xml
 Sat Aug 27 13:54:04 2011
@@ -0,0 +1,38 @@
+<?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.
+  -->
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0";>
+
+    <!-- Greeter Implementation -->
+    <bean id="greeterImpl" 
class="org.apache.karaf.cellar.samples.dosgi.greeter.service.GreeterImpl">
+        <!-- We want the greeter to display the origin of the greet, so we use 
the nodeId -->
+        <argument ref="nodeId"/>
+    </bean>
+
+    <!-- The current Node -->
+    <bean id="node" factory-ref="clusterManager" factory-method="getNode"/>
+    <!-- The id of the current node -->
+    <bean id="nodeId" factory-ref="node" factory-method="getId"/>
+
+    <!-- OSGi Services  & References -->
+    <service ref="greeterImpl" 
interface="org.apache.karaf.cellar.samples.dosgi.greeter.api.Greeter">
+        <service-properties>
+            <entry key="service.exported.interfaces" value="*"/>
+        </service-properties>
+    </service>
+
+    <reference id="clusterManager" 
interface="org.apache.karaf.cellar.core.ClusterManager"/>
+
+</blueprint>

Added: karaf/cellar/trunk/samples/dosgi-greeter/src/main/resources/features.xml
URL: 
http://svn.apache.org/viewvc/karaf/cellar/trunk/samples/dosgi-greeter/src/main/resources/features.xml?rev=1162356&view=auto
==============================================================================
--- karaf/cellar/trunk/samples/dosgi-greeter/src/main/resources/features.xml 
(added)
+++ karaf/cellar/trunk/samples/dosgi-greeter/src/main/resources/features.xml 
Sat Aug 27 13:54:04 2011
@@ -0,0 +1,29 @@
+<?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.
+-->
+<features name="dosgi-greeter" 
xmlns="http://karaf.apache.org/xmlns/features/v1.0.0";>
+
+    <feature name='greeter-client' description='Greeter Service Client' 
version='${project.version}' resolver='(obr)'>
+        
<bundle>mvn:org.apache.karaf.cellar.samples.dosgi.greeter/org.apache.karaf.cellar.samples.dosgi.greeter.api/${project.version}</bundle>
+        
<bundle>mvn:org.apache.karaf.cellar.samples.dosgi.greeter/org.apache.karaf.cellar.samples.dosgi.greeter.client/${project.version}</bundle>
+    </feature>
+
+    <feature name='greeter-service' description='Greeter Service Service' 
version='${project.version}' resolver='(obr)'>
+        
<bundle>mvn:org.apache.karaf.cellar.samples.dosgi.greeter/org.apache.karaf.cellar.samples.dosgi.greeter.api/${project.version}</bundle>
+        
<bundle>mvn:org.apache.karaf.cellar.samples.dosgi.greeter/org.apache.karaf.cellar.samples.dosgi.greeter.service/${project.version}</bundle>
+    </feature>
+
+</features>
+


Reply via email to