You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by er...@apache.org on 2011/08/19 21:42:17 UTC

svn commit: r1159757 - in /tuscany/collaboration/GSoC-2011-Eranda: cassandra/ cassandra/src/main/java/org/apache/tuscany/nosqldatastore/ cassandra/src/main/resources/ cassandra/src/main/resources/META-INF/ couchdb/ couchdb/src/main/java/org/apache/tusc...

Author: eranda
Date: Fri Aug 19 19:42:16 2011
New Revision: 1159757

URL: http://svn.apache.org/viewvc?rev=1159757&view=rev
Log:
Making REST services from the datastores(Apache Cassandra, Apacha CouchDB and Apache Hadoop/hbase)

Added:
    tuscany/collaboration/GSoC-2011-Eranda/cassandra/src/main/java/org/apache/tuscany/nosqldatastore/DatastoreService.java
    tuscany/collaboration/GSoC-2011-Eranda/cassandra/src/main/java/org/apache/tuscany/nosqldatastore/DatastoreServiceImpl.java
    tuscany/collaboration/GSoC-2011-Eranda/cassandra/src/main/resources/
    tuscany/collaboration/GSoC-2011-Eranda/cassandra/src/main/resources/META-INF/
    tuscany/collaboration/GSoC-2011-Eranda/cassandra/src/main/resources/META-INF/sca-contribution.xml
    tuscany/collaboration/GSoC-2011-Eranda/cassandra/src/main/resources/datastore.composite
    tuscany/collaboration/GSoC-2011-Eranda/couchdb/src/main/java/org/apache/tuscany/nosqldatastore/DatastoreService.java
    tuscany/collaboration/GSoC-2011-Eranda/couchdb/src/main/java/org/apache/tuscany/nosqldatastore/DatastoreServiceImpl.java
    tuscany/collaboration/GSoC-2011-Eranda/couchdb/src/main/resources/
    tuscany/collaboration/GSoC-2011-Eranda/couchdb/src/main/resources/META-INF/
    tuscany/collaboration/GSoC-2011-Eranda/couchdb/src/main/resources/META-INF/sca-contribution.xml
    tuscany/collaboration/GSoC-2011-Eranda/couchdb/src/main/resources/datastore.composite
    tuscany/collaboration/GSoC-2011-Eranda/hbase/src/main/java/org/apache/tuscany/nosqldatastore/DatastoreService.java
    tuscany/collaboration/GSoC-2011-Eranda/hbase/src/main/java/org/apache/tuscany/nosqldatastore/DatastoreServiceImpl.java
    tuscany/collaboration/GSoC-2011-Eranda/hbase/src/main/resources/
    tuscany/collaboration/GSoC-2011-Eranda/hbase/src/main/resources/META-INF/
    tuscany/collaboration/GSoC-2011-Eranda/hbase/src/main/resources/META-INF/sca-contribution.xml
    tuscany/collaboration/GSoC-2011-Eranda/hbase/src/main/resources/datastore.composite
Modified:
    tuscany/collaboration/GSoC-2011-Eranda/cassandra/pom.xml
    tuscany/collaboration/GSoC-2011-Eranda/couchdb/pom.xml
    tuscany/collaboration/GSoC-2011-Eranda/hbase/pom.xml

Modified: tuscany/collaboration/GSoC-2011-Eranda/cassandra/pom.xml
URL: http://svn.apache.org/viewvc/tuscany/collaboration/GSoC-2011-Eranda/cassandra/pom.xml?rev=1159757&r1=1159756&r2=1159757&view=diff
==============================================================================
--- tuscany/collaboration/GSoC-2011-Eranda/cassandra/pom.xml (original)
+++ tuscany/collaboration/GSoC-2011-Eranda/cassandra/pom.xml Fri Aug 19 19:42:16 2011
@@ -22,39 +22,52 @@ under the License.
          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
     <modelVersion>4.0.0</modelVersion>
     <groupId>org.apache.tuscany</groupId>
-    <artifactId>nosql-datastore</artifactId>
+    <artifactId>nosql-datastore-cassandra</artifactId>
     <version>0.0.1</version>
-
     <packaging>jar</packaging>
     <name>tuscany</name>
     <url>http://maven.apache.org</url>
     <properties>
         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+        <cassandra.version>0.7.1</cassandra.version>
+        <hector.version>0.7.0-29</hector.version>
+        <tuscany.version>2.0-M5</tuscany.version>
     </properties>
-
     <dependencies>
         <dependency>
             <groupId>me.prettyprint</groupId>
             <artifactId>hector-core</artifactId>
-            <version>0.7.0-29</version>
+            <version>${hector.version}</version>
         </dependency>
         <dependency>
             <groupId>org.apache.cassandra</groupId>
             <artifactId>cassandra-javautils</artifactId>
-            <version>0.7.1</version>
+            <version>${cassandra.version}</version>
         </dependency>
         <dependency>
             <groupId>org.apache.cassandra</groupId>
             <artifactId>cassandra-all</artifactId>
-            <version>0.7.4</version>
+            <version>${cassandra.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.tuscany.sca</groupId>
+            <artifactId>tuscany-sca-api</artifactId>
+            <version>${tuscany.version}</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>javax.ws.rs</groupId>
+            <artifactId>jsr311-api</artifactId>
+            <version>1.1.1</version>
+            <scope>provided</scope>
         </dependency>
         <dependency>
             <groupId>junit</groupId>
             <artifactId>junit</artifactId>
-            <version>4.8.2</version>
+            <version>4.8.1</version>
+            <scope>test</scope>
         </dependency>
     </dependencies>
-
     <build>
         <plugins>
             <plugin>

Added: tuscany/collaboration/GSoC-2011-Eranda/cassandra/src/main/java/org/apache/tuscany/nosqldatastore/DatastoreService.java
URL: http://svn.apache.org/viewvc/tuscany/collaboration/GSoC-2011-Eranda/cassandra/src/main/java/org/apache/tuscany/nosqldatastore/DatastoreService.java?rev=1159757&view=auto
==============================================================================
--- tuscany/collaboration/GSoC-2011-Eranda/cassandra/src/main/java/org/apache/tuscany/nosqldatastore/DatastoreService.java (added)
+++ tuscany/collaboration/GSoC-2011-Eranda/cassandra/src/main/java/org/apache/tuscany/nosqldatastore/DatastoreService.java Fri Aug 19 19:42:16 2011
@@ -0,0 +1,67 @@
+/*
+ * 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 org.apache.tuscany.nosqldatastore;
+
+import org.apache.tuscany.nosqldatastore.exception.*;
+import org.oasisopen.sca.annotation.Remotable;
+
+import javax.ws.rs.*;
+
+@Remotable
+public interface DatastoreService {
+
+    @GET
+    @Path("echoTest")
+    String echoTest(@QueryParam("database") String database);
+
+    @POST
+    @Path("addEntry")
+    void addEntry(@QueryParam("database") String database,
+                  @QueryParam("group") String group,
+                  @QueryParam("key") String key,
+                  @QueryParam("value") String value) throws DuplicateEntryException, SessionException;
+
+    @POST
+    @Path("updateEntry")
+    void updateEntry(@QueryParam("database") String database,
+                     @QueryParam("group") String group,
+                     @QueryParam("key") String key,
+                     @QueryParam("value") String value) throws EntryNotFoundException, SessionException;
+
+    @POST
+    @Path("deleteEntry")
+    void deleteEntry(@QueryParam("database") String database,
+                     @QueryParam("group") String group,
+                     @QueryParam("key") String key) throws EntryNotFoundException, SessionException;
+
+    @GET
+    @Path("getEntry")
+    String getEntry(@QueryParam("database") String database,
+                    @QueryParam("group") String group,
+                    @QueryParam("key") String key) throws EntryNotFoundException, SessionException;
+
+    @DELETE
+    @Path("deleteGroup")
+    void deleteGroup(@QueryParam("database") String database,
+                     @QueryParam("group") String group) throws GroupNotFoundException, SessionException;
+
+    @DELETE
+    @Path("deleteDatabase")
+    void deleteDatabase(@QueryParam("database") String database) throws DatabaseNotFoundException, SessionException;
+}

Added: tuscany/collaboration/GSoC-2011-Eranda/cassandra/src/main/java/org/apache/tuscany/nosqldatastore/DatastoreServiceImpl.java
URL: http://svn.apache.org/viewvc/tuscany/collaboration/GSoC-2011-Eranda/cassandra/src/main/java/org/apache/tuscany/nosqldatastore/DatastoreServiceImpl.java?rev=1159757&view=auto
==============================================================================
--- tuscany/collaboration/GSoC-2011-Eranda/cassandra/src/main/java/org/apache/tuscany/nosqldatastore/DatastoreServiceImpl.java (added)
+++ tuscany/collaboration/GSoC-2011-Eranda/cassandra/src/main/java/org/apache/tuscany/nosqldatastore/DatastoreServiceImpl.java Fri Aug 19 19:42:16 2011
@@ -0,0 +1,71 @@
+/*
+ * 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 org.apache.tuscany.nosqldatastore;
+
+import org.apache.tuscany.nosqldatastore.exception.*;
+import org.oasisopen.sca.annotation.Init;
+import org.oasisopen.sca.annotation.Scope;
+
+@Scope("COMPOSITE")
+public class DatastoreServiceImpl implements DatastoreService{
+
+    private Session session;
+
+    @Init
+    public void init(){
+        session = (new SessionFactory()).getCassandraSession();    
+    }
+
+    public String echoTest(String database){
+        return "Database "+database;
+    }
+
+    public void addEntry(String database, String group, String key, String value) throws DuplicateEntryException, SessionException {
+        Database db = session.getDatabase(database);
+        Group grp = db.getGroup(group);
+        grp.addEntry(key, value);
+    }
+
+    public void updateEntry(String database, String group, String key, String value) throws EntryNotFoundException, SessionException {
+        Database db = session.getDatabase(database);
+        Group grp = db.getGroup(group);
+        grp.updateEntry(key, value);
+    }
+
+    public void deleteEntry(String database, String group, String key) throws EntryNotFoundException, SessionException {
+        Database db = session.getDatabase(database);
+        Group grp = db.getGroup(group);
+        grp.deleteEntry(key);
+    }
+
+    public String getEntry(String database, String group, String key) throws EntryNotFoundException, SessionException {
+        Database db = session.getDatabase(database);
+        Group grp = db.getGroup(group);
+        return grp.getEntry(key);
+    }
+
+    public void deleteGroup(String database, String group) throws GroupNotFoundException, SessionException {
+        Database db = session.getDatabase(database);
+        db.deleteGroup(group);
+    }
+
+    public void deleteDatabase(String database) throws DatabaseNotFoundException, SessionException {
+        session.deleteDatabase(database);
+    }
+}

Added: tuscany/collaboration/GSoC-2011-Eranda/cassandra/src/main/resources/META-INF/sca-contribution.xml
URL: http://svn.apache.org/viewvc/tuscany/collaboration/GSoC-2011-Eranda/cassandra/src/main/resources/META-INF/sca-contribution.xml?rev=1159757&view=auto
==============================================================================
--- tuscany/collaboration/GSoC-2011-Eranda/cassandra/src/main/resources/META-INF/sca-contribution.xml (added)
+++ tuscany/collaboration/GSoC-2011-Eranda/cassandra/src/main/resources/META-INF/sca-contribution.xml Fri Aug 19 19:42:16 2011
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<contribution xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200912"
+              xmlns:datastore="http://datastore">
+   
+   <deployable composite="datastore:datastore-contribution" />
+
+</contribution>

Added: tuscany/collaboration/GSoC-2011-Eranda/cassandra/src/main/resources/datastore.composite
URL: http://svn.apache.org/viewvc/tuscany/collaboration/GSoC-2011-Eranda/cassandra/src/main/resources/datastore.composite?rev=1159757&view=auto
==============================================================================
--- tuscany/collaboration/GSoC-2011-Eranda/cassandra/src/main/resources/datastore.composite (added)
+++ tuscany/collaboration/GSoC-2011-Eranda/cassandra/src/main/resources/datastore.composite Fri Aug 19 19:42:16 2011
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<composite xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200912"
+           xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.1"
+           targetNamespace="http://datastore"
+           name="datastore-contribution">
+	<component name="DatastoreComponent">
+	    	<implementation.java class="org.apache.tuscany.nosqldatastore.DatastoreServiceImpl"/>
+		    <service name="DatastoreService">
+		        <interface.java interface="org.apache.tuscany.nosqldatastore.DatastoreService"/>
+                <tuscany:binding.rest uri="http://localhost:8085/DatastoreService">
+                    <tuscany:wireFormat.json/>
+	                <tuscany:operationSelector.jaxrs/>
+                </tuscany:binding.rest>
+        	</service>
+    </component>               
+</composite>

Modified: tuscany/collaboration/GSoC-2011-Eranda/couchdb/pom.xml
URL: http://svn.apache.org/viewvc/tuscany/collaboration/GSoC-2011-Eranda/couchdb/pom.xml?rev=1159757&r1=1159756&r2=1159757&view=diff
==============================================================================
--- tuscany/collaboration/GSoC-2011-Eranda/couchdb/pom.xml (original)
+++ tuscany/collaboration/GSoC-2011-Eranda/couchdb/pom.xml Fri Aug 19 19:42:16 2011
@@ -30,13 +30,27 @@ under the License.
     <url>http://maven.apache.org</url>
     <properties>
         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+        <jcouchdb.version>0.10.0-1</jcouchdb.version>
+        <tuscany.version>2.0-M5</tuscany.version>
     </properties>
 
     <dependencies>
         <dependency>
             <groupId>com.google.code.jcouchdb</groupId>
             <artifactId>jcouchdb</artifactId>
-            <version>0.10.0-1</version>
+            <version>${jcouchdb.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.tuscany.sca</groupId>
+            <artifactId>tuscany-sca-api</artifactId>
+            <version>${tuscany.version}</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>javax.ws.rs</groupId>
+            <artifactId>jsr311-api</artifactId>
+            <version>1.1.1</version>
+            <scope>provided</scope>
         </dependency>
         <dependency>
             <groupId>junit</groupId>

Added: tuscany/collaboration/GSoC-2011-Eranda/couchdb/src/main/java/org/apache/tuscany/nosqldatastore/DatastoreService.java
URL: http://svn.apache.org/viewvc/tuscany/collaboration/GSoC-2011-Eranda/couchdb/src/main/java/org/apache/tuscany/nosqldatastore/DatastoreService.java?rev=1159757&view=auto
==============================================================================
--- tuscany/collaboration/GSoC-2011-Eranda/couchdb/src/main/java/org/apache/tuscany/nosqldatastore/DatastoreService.java (added)
+++ tuscany/collaboration/GSoC-2011-Eranda/couchdb/src/main/java/org/apache/tuscany/nosqldatastore/DatastoreService.java Fri Aug 19 19:42:16 2011
@@ -0,0 +1,67 @@
+/*
+ * 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 org.apache.tuscany.nosqldatastore;
+
+import org.apache.tuscany.nosqldatastore.exception.*;
+import org.oasisopen.sca.annotation.Remotable;
+
+import javax.ws.rs.*;
+
+@Remotable
+public interface DatastoreService {
+
+    @GET
+    @Path("echoTest")
+    String echoTest(@QueryParam("database") String database);
+
+    @POST
+    @Path("addEntry")
+    void addEntry(@QueryParam("database") String database,
+                  @QueryParam("group") String group,
+                  @QueryParam("key") String key,
+                  @QueryParam("value") String value) throws DuplicateEntryException, SessionException;
+
+    @POST
+    @Path("updateEntry")
+    void updateEntry(@QueryParam("database") String database,
+                     @QueryParam("group") String group,
+                     @QueryParam("key") String key,
+                     @QueryParam("value") String value) throws EntryNotFoundException, SessionException;
+
+    @POST
+    @Path("deleteEntry")
+    void deleteEntry(@QueryParam("database") String database,
+                     @QueryParam("group") String group,
+                     @QueryParam("key") String key) throws EntryNotFoundException, SessionException;
+
+    @GET
+    @Path("getEntry")
+    String getEntry(@QueryParam("database") String database,
+                    @QueryParam("group") String group,
+                    @QueryParam("key") String key) throws EntryNotFoundException, SessionException;
+
+    @DELETE
+    @Path("deleteGroup")
+    void deleteGroup(@QueryParam("database") String database,
+                     @QueryParam("group") String group) throws GroupNotFoundException, SessionException;
+
+    @DELETE
+    @Path("deleteDatabase")
+    void deleteDatabase(@QueryParam("database") String database) throws DatabaseNotFoundException, SessionException;
+}

Added: tuscany/collaboration/GSoC-2011-Eranda/couchdb/src/main/java/org/apache/tuscany/nosqldatastore/DatastoreServiceImpl.java
URL: http://svn.apache.org/viewvc/tuscany/collaboration/GSoC-2011-Eranda/couchdb/src/main/java/org/apache/tuscany/nosqldatastore/DatastoreServiceImpl.java?rev=1159757&view=auto
==============================================================================
--- tuscany/collaboration/GSoC-2011-Eranda/couchdb/src/main/java/org/apache/tuscany/nosqldatastore/DatastoreServiceImpl.java (added)
+++ tuscany/collaboration/GSoC-2011-Eranda/couchdb/src/main/java/org/apache/tuscany/nosqldatastore/DatastoreServiceImpl.java Fri Aug 19 19:42:16 2011
@@ -0,0 +1,71 @@
+/*
+ * 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 org.apache.tuscany.nosqldatastore;
+
+import org.apache.tuscany.nosqldatastore.exception.*;
+import org.oasisopen.sca.annotation.Init;
+import org.oasisopen.sca.annotation.Scope;
+
+@Scope("COMPOSITE")
+public class DatastoreServiceImpl implements DatastoreService{
+
+    private Session session;
+
+    @Init
+    public void init(){
+        session = (new SessionFactory()).getCouchDBSession();    
+    }
+
+    public String echoTest(String database){
+        return "Database "+database;
+    }
+
+    public void addEntry(String database, String group, String key, String value) throws DuplicateEntryException, SessionException {
+        Database db = session.getDatabase(database);
+        Group grp = db.getGroup(group);
+        grp.addEntry(key, value);
+    }
+
+    public void updateEntry(String database, String group, String key, String value) throws EntryNotFoundException, SessionException {
+        Database db = session.getDatabase(database);
+        Group grp = db.getGroup(group);
+        grp.updateEntry(key, value);
+    }
+
+    public void deleteEntry(String database, String group, String key) throws EntryNotFoundException, SessionException {
+        Database db = session.getDatabase(database);
+        Group grp = db.getGroup(group);
+        grp.deleteEntry(key);
+    }
+
+    public String getEntry(String database, String group, String key) throws EntryNotFoundException, SessionException {
+        Database db = session.getDatabase(database);
+        Group grp = db.getGroup(group);
+        return grp.getEntry(key);
+    }
+
+    public void deleteGroup(String database, String group) throws GroupNotFoundException, SessionException {
+        Database db = session.getDatabase(database);
+        db.deleteGroup(group);
+    }
+
+    public void deleteDatabase(String database) throws DatabaseNotFoundException, SessionException {
+        session.deleteDatabase(database);
+    }
+}

Added: tuscany/collaboration/GSoC-2011-Eranda/couchdb/src/main/resources/META-INF/sca-contribution.xml
URL: http://svn.apache.org/viewvc/tuscany/collaboration/GSoC-2011-Eranda/couchdb/src/main/resources/META-INF/sca-contribution.xml?rev=1159757&view=auto
==============================================================================
--- tuscany/collaboration/GSoC-2011-Eranda/couchdb/src/main/resources/META-INF/sca-contribution.xml (added)
+++ tuscany/collaboration/GSoC-2011-Eranda/couchdb/src/main/resources/META-INF/sca-contribution.xml Fri Aug 19 19:42:16 2011
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<contribution xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200912"
+              xmlns:datastore="http://datastore">
+   
+   <deployable composite="datastore:datastore-contribution" />
+
+</contribution>

Added: tuscany/collaboration/GSoC-2011-Eranda/couchdb/src/main/resources/datastore.composite
URL: http://svn.apache.org/viewvc/tuscany/collaboration/GSoC-2011-Eranda/couchdb/src/main/resources/datastore.composite?rev=1159757&view=auto
==============================================================================
--- tuscany/collaboration/GSoC-2011-Eranda/couchdb/src/main/resources/datastore.composite (added)
+++ tuscany/collaboration/GSoC-2011-Eranda/couchdb/src/main/resources/datastore.composite Fri Aug 19 19:42:16 2011
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<composite xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200912"
+           xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.1"
+           targetNamespace="http://datastore"
+           name="datastore-contribution">
+	<component name="DatastoreComponent">
+	    	<implementation.java class="org.apache.tuscany.nosqldatastore.DatastoreServiceImpl"/>
+		    <service name="DatastoreService">
+		        <interface.java interface="org.apache.tuscany.nosqldatastore.DatastoreService"/>
+                <tuscany:binding.rest uri="http://localhost:8085/DatastoreService">
+                    <tuscany:wireFormat.json/>
+	                <tuscany:operationSelector.jaxrs/>
+                </tuscany:binding.rest>
+        	</service>
+    </component>               
+</composite>

Modified: tuscany/collaboration/GSoC-2011-Eranda/hbase/pom.xml
URL: http://svn.apache.org/viewvc/tuscany/collaboration/GSoC-2011-Eranda/hbase/pom.xml?rev=1159757&r1=1159756&r2=1159757&view=diff
==============================================================================
--- tuscany/collaboration/GSoC-2011-Eranda/hbase/pom.xml (original)
+++ tuscany/collaboration/GSoC-2011-Eranda/hbase/pom.xml Fri Aug 19 19:42:16 2011
@@ -30,21 +30,33 @@ under the License.
     <url>http://maven.apache.org</url>
     <properties>
         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+        <hbase.version>0.90.3</hbase.version>
+        <tuscany.version>2.0-M5</tuscany.version>
     </properties>
-
     <dependencies>
         <dependency>
             <groupId>org.apache.hbase</groupId>
             <artifactId>hbase</artifactId>
-            <version>0.90.3</version>
+            <version>${hbase.version}</version>
         </dependency>
         <dependency>
             <groupId>junit</groupId>
             <artifactId>junit</artifactId>
             <version>4.8.2</version>
         </dependency>
+        <dependency>
+            <groupId>org.apache.tuscany.sca</groupId>
+            <artifactId>tuscany-sca-api</artifactId>
+            <version>${tuscany.version}</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>javax.ws.rs</groupId>
+            <artifactId>jsr311-api</artifactId>
+            <version>1.1.1</version>
+            <scope>provided</scope>
+        </dependency>
     </dependencies>
-
     <build>
         <plugins>
             <plugin>

Added: tuscany/collaboration/GSoC-2011-Eranda/hbase/src/main/java/org/apache/tuscany/nosqldatastore/DatastoreService.java
URL: http://svn.apache.org/viewvc/tuscany/collaboration/GSoC-2011-Eranda/hbase/src/main/java/org/apache/tuscany/nosqldatastore/DatastoreService.java?rev=1159757&view=auto
==============================================================================
--- tuscany/collaboration/GSoC-2011-Eranda/hbase/src/main/java/org/apache/tuscany/nosqldatastore/DatastoreService.java (added)
+++ tuscany/collaboration/GSoC-2011-Eranda/hbase/src/main/java/org/apache/tuscany/nosqldatastore/DatastoreService.java Fri Aug 19 19:42:16 2011
@@ -0,0 +1,67 @@
+/*
+ * 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 org.apache.tuscany.nosqldatastore;
+
+import org.apache.tuscany.nosqldatastore.exception.*;
+import org.oasisopen.sca.annotation.Remotable;
+
+import javax.ws.rs.*;
+
+@Remotable
+public interface DatastoreService {
+
+    @GET
+    @Path("echoTest")
+    String echoTest(@QueryParam("database") String database);
+
+    @POST
+    @Path("addEntry")
+    void addEntry(@QueryParam("database") String database,
+                  @QueryParam("group") String group,
+                  @QueryParam("key") String key,
+                  @QueryParam("value") String value) throws DuplicateEntryException, SessionException;
+
+    @POST
+    @Path("updateEntry")
+    void updateEntry(@QueryParam("database") String database,
+                     @QueryParam("group") String group,
+                     @QueryParam("key") String key,
+                     @QueryParam("value") String value) throws EntryNotFoundException, SessionException;
+
+    @POST
+    @Path("deleteEntry")
+    void deleteEntry(@QueryParam("database") String database,
+                     @QueryParam("group") String group,
+                     @QueryParam("key") String key) throws EntryNotFoundException, SessionException;
+
+    @GET
+    @Path("getEntry")
+    String getEntry(@QueryParam("database") String database,
+                    @QueryParam("group") String group,
+                    @QueryParam("key") String key) throws EntryNotFoundException, SessionException;
+
+    @DELETE
+    @Path("deleteGroup")
+    void deleteGroup(@QueryParam("database") String database,
+                     @QueryParam("group") String group) throws GroupNotFoundException, SessionException;
+
+    @DELETE
+    @Path("deleteDatabase")
+    void deleteDatabase(@QueryParam("database") String database) throws DatabaseNotFoundException, SessionException;
+}

Added: tuscany/collaboration/GSoC-2011-Eranda/hbase/src/main/java/org/apache/tuscany/nosqldatastore/DatastoreServiceImpl.java
URL: http://svn.apache.org/viewvc/tuscany/collaboration/GSoC-2011-Eranda/hbase/src/main/java/org/apache/tuscany/nosqldatastore/DatastoreServiceImpl.java?rev=1159757&view=auto
==============================================================================
--- tuscany/collaboration/GSoC-2011-Eranda/hbase/src/main/java/org/apache/tuscany/nosqldatastore/DatastoreServiceImpl.java (added)
+++ tuscany/collaboration/GSoC-2011-Eranda/hbase/src/main/java/org/apache/tuscany/nosqldatastore/DatastoreServiceImpl.java Fri Aug 19 19:42:16 2011
@@ -0,0 +1,71 @@
+/*
+ * 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 org.apache.tuscany.nosqldatastore;
+
+import org.apache.tuscany.nosqldatastore.exception.*;
+import org.oasisopen.sca.annotation.Init;
+import org.oasisopen.sca.annotation.Scope;
+
+@Scope("COMPOSITE")
+public class DatastoreServiceImpl implements DatastoreService{
+
+    private Session session;
+
+    @Init
+    public void init(){
+        session = (new SessionFactory()).getHBaseSession();    
+    }
+
+    public String echoTest(String database){
+        return "Database "+database;
+    }
+
+    public void addEntry(String database, String group, String key, String value) throws DuplicateEntryException, SessionException {
+        Database db = session.getDatabase(database);
+        Group grp = db.getGroup(group);
+        grp.addEntry(key, value);
+    }
+
+    public void updateEntry(String database, String group, String key, String value) throws EntryNotFoundException, SessionException {
+        Database db = session.getDatabase(database);
+        Group grp = db.getGroup(group);
+        grp.updateEntry(key, value);
+    }
+
+    public void deleteEntry(String database, String group, String key) throws EntryNotFoundException, SessionException {
+        Database db = session.getDatabase(database);
+        Group grp = db.getGroup(group);
+        grp.deleteEntry(key);
+    }
+
+    public String getEntry(String database, String group, String key) throws EntryNotFoundException, SessionException {
+        Database db = session.getDatabase(database);
+        Group grp = db.getGroup(group);
+        return grp.getEntry(key);
+    }
+
+    public void deleteGroup(String database, String group) throws GroupNotFoundException, SessionException {
+        Database db = session.getDatabase(database);
+        db.deleteGroup(group);
+    }
+
+    public void deleteDatabase(String database) throws DatabaseNotFoundException, SessionException {
+        session.deleteDatabase(database);
+    }
+}

Added: tuscany/collaboration/GSoC-2011-Eranda/hbase/src/main/resources/META-INF/sca-contribution.xml
URL: http://svn.apache.org/viewvc/tuscany/collaboration/GSoC-2011-Eranda/hbase/src/main/resources/META-INF/sca-contribution.xml?rev=1159757&view=auto
==============================================================================
--- tuscany/collaboration/GSoC-2011-Eranda/hbase/src/main/resources/META-INF/sca-contribution.xml (added)
+++ tuscany/collaboration/GSoC-2011-Eranda/hbase/src/main/resources/META-INF/sca-contribution.xml Fri Aug 19 19:42:16 2011
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<contribution xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200912"
+              xmlns:datastore="http://datastore">
+   
+   <deployable composite="datastore:datastore-contribution" />
+
+</contribution>

Added: tuscany/collaboration/GSoC-2011-Eranda/hbase/src/main/resources/datastore.composite
URL: http://svn.apache.org/viewvc/tuscany/collaboration/GSoC-2011-Eranda/hbase/src/main/resources/datastore.composite?rev=1159757&view=auto
==============================================================================
--- tuscany/collaboration/GSoC-2011-Eranda/hbase/src/main/resources/datastore.composite (added)
+++ tuscany/collaboration/GSoC-2011-Eranda/hbase/src/main/resources/datastore.composite Fri Aug 19 19:42:16 2011
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<composite xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200912"
+           xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.1"
+           targetNamespace="http://datastore"
+           name="datastore-contribution">
+	<component name="DatastoreComponent">
+	    	<implementation.java class="org.apache.tuscany.nosqldatastore.DatastoreServiceImpl"/>
+		    <service name="DatastoreService">
+		        <interface.java interface="org.apache.tuscany.nosqldatastore.DatastoreService"/>
+                <tuscany:binding.rest uri="http://localhost:8085/DatastoreService">
+                    <tuscany:wireFormat.json/>
+	                <tuscany:operationSelector.jaxrs/>
+                </tuscany:binding.rest>
+        	</service>
+    </component>               
+</composite>