Author: fmoga
Date: Sat Jun 18 14:32:14 2011
New Revision: 1137192

URL: http://svn.apache.org/viewvc?rev=1137192&view=rev
Log:
TUSCANY-3522: Apply HBase-API.patch submitted by Eranda

Added:
    tuscany/collaboration/GSoC-2011-Eranda/hbase/
    tuscany/collaboration/GSoC-2011-Eranda/hbase/pom.xml
    tuscany/collaboration/GSoC-2011-Eranda/hbase/src/
    tuscany/collaboration/GSoC-2011-Eranda/hbase/src/main/
    tuscany/collaboration/GSoC-2011-Eranda/hbase/src/main/java/
    tuscany/collaboration/GSoC-2011-Eranda/hbase/src/main/java/org/
    tuscany/collaboration/GSoC-2011-Eranda/hbase/src/main/java/org/apache/
    
tuscany/collaboration/GSoC-2011-Eranda/hbase/src/main/java/org/apache/tuscany/
    
tuscany/collaboration/GSoC-2011-Eranda/hbase/src/main/java/org/apache/tuscany/nosqldatastore/
    
tuscany/collaboration/GSoC-2011-Eranda/hbase/src/main/java/org/apache/tuscany/nosqldatastore/Database.java
    
tuscany/collaboration/GSoC-2011-Eranda/hbase/src/main/java/org/apache/tuscany/nosqldatastore/Group.java
    
tuscany/collaboration/GSoC-2011-Eranda/hbase/src/main/java/org/apache/tuscany/nosqldatastore/Session.java
    
tuscany/collaboration/GSoC-2011-Eranda/hbase/src/main/java/org/apache/tuscany/nosqldatastore/SessionFactory.java
    
tuscany/collaboration/GSoC-2011-Eranda/hbase/src/main/java/org/apache/tuscany/nosqldatastore/hbase/
    
tuscany/collaboration/GSoC-2011-Eranda/hbase/src/main/java/org/apache/tuscany/nosqldatastore/hbase/HBaseDatatabase.java
    
tuscany/collaboration/GSoC-2011-Eranda/hbase/src/main/java/org/apache/tuscany/nosqldatastore/hbase/HBaseGroup.java
    
tuscany/collaboration/GSoC-2011-Eranda/hbase/src/main/java/org/apache/tuscany/nosqldatastore/hbase/HBaseSession.java
    tuscany/collaboration/GSoC-2011-Eranda/hbase/src/test/
    tuscany/collaboration/GSoC-2011-Eranda/hbase/src/test/java/
    tuscany/collaboration/GSoC-2011-Eranda/hbase/src/test/java/org/
    tuscany/collaboration/GSoC-2011-Eranda/hbase/src/test/java/org/apache/
    
tuscany/collaboration/GSoC-2011-Eranda/hbase/src/test/java/org/apache/tuscany/
    
tuscany/collaboration/GSoC-2011-Eranda/hbase/src/test/java/org/apache/tuscany/nosqldatastore/
    
tuscany/collaboration/GSoC-2011-Eranda/hbase/src/test/java/org/apache/tuscany/nosqldatastore/hbase/
    
tuscany/collaboration/GSoC-2011-Eranda/hbase/src/test/java/org/apache/tuscany/nosqldatastore/hbase/HBaseTest.java

Added: tuscany/collaboration/GSoC-2011-Eranda/hbase/pom.xml
URL: 
http://svn.apache.org/viewvc/tuscany/collaboration/GSoC-2011-Eranda/hbase/pom.xml?rev=1137192&view=auto
==============================================================================
--- tuscany/collaboration/GSoC-2011-Eranda/hbase/pom.xml (added)
+++ tuscany/collaboration/GSoC-2011-Eranda/hbase/pom.xml Sat Jun 18 14:32:14 
2011
@@ -0,0 +1,56 @@
+<?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 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";>
+    <modelVersion>4.0.0</modelVersion>
+    <groupId>org.apache.tuscany</groupId>
+    <artifactId>nosql-datastore-hbase</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>
+    </properties>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.hbase</groupId>
+            <artifactId>hbase</artifactId>
+            <version>0.90.3</version>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-compiler-plugin</artifactId>
+                <version>2.0.2</version>
+                <configuration>
+                    <source>1.5</source>
+                    <target>1.5</target>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+</project>

Added: 
tuscany/collaboration/GSoC-2011-Eranda/hbase/src/main/java/org/apache/tuscany/nosqldatastore/Database.java
URL: 
http://svn.apache.org/viewvc/tuscany/collaboration/GSoC-2011-Eranda/hbase/src/main/java/org/apache/tuscany/nosqldatastore/Database.java?rev=1137192&view=auto
==============================================================================
--- 
tuscany/collaboration/GSoC-2011-Eranda/hbase/src/main/java/org/apache/tuscany/nosqldatastore/Database.java
 (added)
+++ 
tuscany/collaboration/GSoC-2011-Eranda/hbase/src/main/java/org/apache/tuscany/nosqldatastore/Database.java
 Sat Jun 18 14:32:14 2011
@@ -0,0 +1,26 @@
+/*
+ * 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;
+
+public interface Database {
+       Group createGroup(String groupId);
+       Group getGroup(String groupId);
+       void deleteGroup(String groupId);
+}

Added: 
tuscany/collaboration/GSoC-2011-Eranda/hbase/src/main/java/org/apache/tuscany/nosqldatastore/Group.java
URL: 
http://svn.apache.org/viewvc/tuscany/collaboration/GSoC-2011-Eranda/hbase/src/main/java/org/apache/tuscany/nosqldatastore/Group.java?rev=1137192&view=auto
==============================================================================
--- 
tuscany/collaboration/GSoC-2011-Eranda/hbase/src/main/java/org/apache/tuscany/nosqldatastore/Group.java
 (added)
+++ 
tuscany/collaboration/GSoC-2011-Eranda/hbase/src/main/java/org/apache/tuscany/nosqldatastore/Group.java
 Sat Jun 18 14:32:14 2011
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.nosqldatastore;
+
+public interface Group {
+       void addEntry(String key, Object value);
+       void updateEntry(String key, Object value);
+       void deleteEntry(String key);
+    Object getValue(String key);
+}

Added: 
tuscany/collaboration/GSoC-2011-Eranda/hbase/src/main/java/org/apache/tuscany/nosqldatastore/Session.java
URL: 
http://svn.apache.org/viewvc/tuscany/collaboration/GSoC-2011-Eranda/hbase/src/main/java/org/apache/tuscany/nosqldatastore/Session.java?rev=1137192&view=auto
==============================================================================
--- 
tuscany/collaboration/GSoC-2011-Eranda/hbase/src/main/java/org/apache/tuscany/nosqldatastore/Session.java
 (added)
+++ 
tuscany/collaboration/GSoC-2011-Eranda/hbase/src/main/java/org/apache/tuscany/nosqldatastore/Session.java
 Sat Jun 18 14:32:14 2011
@@ -0,0 +1,26 @@
+/*
+ * 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;
+
+public interface Session {
+       Database createDatabase(String databaseName);
+       Database getDatabase(String databaseName);
+       void deleteDatabase(String databaseName);
+}

Added: 
tuscany/collaboration/GSoC-2011-Eranda/hbase/src/main/java/org/apache/tuscany/nosqldatastore/SessionFactory.java
URL: 
http://svn.apache.org/viewvc/tuscany/collaboration/GSoC-2011-Eranda/hbase/src/main/java/org/apache/tuscany/nosqldatastore/SessionFactory.java?rev=1137192&view=auto
==============================================================================
--- 
tuscany/collaboration/GSoC-2011-Eranda/hbase/src/main/java/org/apache/tuscany/nosqldatastore/SessionFactory.java
 (added)
+++ 
tuscany/collaboration/GSoC-2011-Eranda/hbase/src/main/java/org/apache/tuscany/nosqldatastore/SessionFactory.java
 Sat Jun 18 14:32:14 2011
@@ -0,0 +1,36 @@
+/*
+ * 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.hbase.HBaseSession;
+
+public class SessionFactory {
+       
+       private static org.apache.tuscany.nosqldatastore.Session session;
+       
+       private SessionFactory(){
+       }
+       
+       public static Session getHBaseSession(){
+               session = new HBaseSession("hbase");
+               return session;
+       }
+       
+}

Added: 
tuscany/collaboration/GSoC-2011-Eranda/hbase/src/main/java/org/apache/tuscany/nosqldatastore/hbase/HBaseDatatabase.java
URL: 
http://svn.apache.org/viewvc/tuscany/collaboration/GSoC-2011-Eranda/hbase/src/main/java/org/apache/tuscany/nosqldatastore/hbase/HBaseDatatabase.java?rev=1137192&view=auto
==============================================================================
--- 
tuscany/collaboration/GSoC-2011-Eranda/hbase/src/main/java/org/apache/tuscany/nosqldatastore/hbase/HBaseDatatabase.java
 (added)
+++ 
tuscany/collaboration/GSoC-2011-Eranda/hbase/src/main/java/org/apache/tuscany/nosqldatastore/hbase/HBaseDatatabase.java
 Sat Jun 18 14:32:14 2011
@@ -0,0 +1,92 @@
+/*
+ * 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.hbase;
+
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.hbase.*;
+import org.apache.hadoop.hbase.client.HBaseAdmin;
+import org.apache.hadoop.hbase.client.HTable;
+import org.apache.tuscany.nosqldatastore.Database;
+import org.apache.tuscany.nosqldatastore.Group;
+
+import java.io.IOException;
+
+public class HBaseDatatabase implements Database{
+    
+    private HTable table;
+    private HBaseAdmin admin;
+
+    HBaseDatatabase(String dbname, HBaseAdmin admin){
+        Configuration conf = HBaseConfiguration.create();
+        try {
+            try{
+                HTableDescriptor descriptor = new HTableDescriptor(dbname);
+                admin.createTable(descriptor);
+            } catch (MasterNotRunningException e) {
+                e.printStackTrace();
+            } catch (ZooKeeperConnectionException e) {
+                e.printStackTrace();
+            } catch (TableExistsException e){
+                System.out.println("connected to existing database....");
+            } finally {
+                table = new HTable(conf,dbname);
+                System.out.println(new String(table.getTableName()));
+                this.admin = admin;
+                table.flushCommits();
+            }
+        }catch (IOException ex) {
+            ex.printStackTrace();
+        }
+
+    }
+
+    public Group createGroup(String groupId) {
+
+        HColumnDescriptor cf= new HColumnDescriptor(groupId.getBytes());
+
+        try {
+            admin.disableTable(table.getTableName());
+            admin.addColumn(table.getTableName(),cf);
+            admin.enableTable(table.getTableName());
+        } catch (IOException e) {
+            System.out.println("Error: Creating the group "+groupId);
+            e.printStackTrace();
+        }
+
+        Group group = new HBaseGroup(table, groupId);
+        return group;
+    }
+
+    public Group getGroup(String groupId) {
+        Group group = new HBaseGroup(table, groupId);
+        return group;
+    }
+
+    public void deleteGroup(String groupId) {
+        try {
+            admin.disableTable(table.getTableName());
+            admin.deleteColumn(table.getTableName(),groupId.getBytes());
+            admin.enableTable(table.getTableName());
+        } catch (IOException e) {
+            System.out.println("Error: Deleting the group "+groupId);
+            e.printStackTrace();  //To change body of catch statement use File 
| Settings | File Templates.
+        }
+    }
+}

Added: 
tuscany/collaboration/GSoC-2011-Eranda/hbase/src/main/java/org/apache/tuscany/nosqldatastore/hbase/HBaseGroup.java
URL: 
http://svn.apache.org/viewvc/tuscany/collaboration/GSoC-2011-Eranda/hbase/src/main/java/org/apache/tuscany/nosqldatastore/hbase/HBaseGroup.java?rev=1137192&view=auto
==============================================================================
--- 
tuscany/collaboration/GSoC-2011-Eranda/hbase/src/main/java/org/apache/tuscany/nosqldatastore/hbase/HBaseGroup.java
 (added)
+++ 
tuscany/collaboration/GSoC-2011-Eranda/hbase/src/main/java/org/apache/tuscany/nosqldatastore/hbase/HBaseGroup.java
 Sat Jun 18 14:32:14 2011
@@ -0,0 +1,81 @@
+/*
+ * 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.hbase;
+
+import org.apache.hadoop.hbase.HColumnDescriptor;
+import org.apache.hadoop.hbase.HTableDescriptor;
+import org.apache.hadoop.hbase.client.*;
+import org.apache.tuscany.nosqldatastore.Group;
+
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+
+public class HBaseGroup implements Group {
+
+    private HTable table;
+    private String cf;
+
+    HBaseGroup(HTable table, String cf){
+        this.table = table;
+        this.cf = cf;
+    }
+
+    public void addEntry(String key, Object value) {
+        Put put = new Put(key.getBytes());
+        put.add(cf.getBytes(),key.getBytes(),((String)value).getBytes());    
+        try {
+            table.put(put);
+            table.flushCommits();
+        } catch (IOException e) {
+            System.out.println("Error: Adding the entry for the Key "+key);
+            e.printStackTrace();
+        }
+
+    }
+
+    public void updateEntry(String key, Object value) {
+        addEntry(key,value);
+    }
+
+    public void deleteEntry(String key) {
+        Delete delete = new Delete(key.getBytes());
+        delete.deleteColumn(cf.getBytes(), key.getBytes());     
+        try {
+            table.delete(delete);
+            table.flushCommits();
+        } catch (IOException e) {
+            System.out.println("Error: Deleting the entry for the Key "+key);
+            e.printStackTrace();
+        }
+    }
+
+    public Object getValue(String key) {
+        Result result = null;
+        Get get = new Get(key.getBytes());
+        try {
+            result = table.get(get);
+        } catch (IOException e) {
+            System.out.println("Error: Retrieving the value or the Key "+key);
+            e.printStackTrace();
+        }
+        return new String(result.getValue(cf.getBytes(),key.getBytes()));
+    }
+}

Added: 
tuscany/collaboration/GSoC-2011-Eranda/hbase/src/main/java/org/apache/tuscany/nosqldatastore/hbase/HBaseSession.java
URL: 
http://svn.apache.org/viewvc/tuscany/collaboration/GSoC-2011-Eranda/hbase/src/main/java/org/apache/tuscany/nosqldatastore/hbase/HBaseSession.java?rev=1137192&view=auto
==============================================================================
--- 
tuscany/collaboration/GSoC-2011-Eranda/hbase/src/main/java/org/apache/tuscany/nosqldatastore/hbase/HBaseSession.java
 (added)
+++ 
tuscany/collaboration/GSoC-2011-Eranda/hbase/src/main/java/org/apache/tuscany/nosqldatastore/hbase/HBaseSession.java
 Sat Jun 18 14:32:14 2011
@@ -0,0 +1,68 @@
+/*
+ * 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.hbase;
+
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.hbase.HBaseConfiguration;
+import org.apache.hadoop.hbase.MasterNotRunningException;
+import org.apache.hadoop.hbase.ZooKeeperConnectionException;
+import org.apache.hadoop.hbase.client.HBaseAdmin;
+import org.apache.tuscany.nosqldatastore.Database;
+import org.apache.tuscany.nosqldatastore.Session;
+
+import java.io.IOException;
+
+public class HBaseSession implements Session{
+
+    private String session;
+    private HBaseAdmin admin;
+
+    public HBaseSession(String session){
+        this.session = session;
+        Configuration conf = HBaseConfiguration.create();
+        try {
+            admin = new HBaseAdmin(conf);
+        } catch (MasterNotRunningException e) {
+            e.printStackTrace();  //To change body of catch statement use File 
| Settings | File Templates.
+        } catch (ZooKeeperConnectionException e) {
+            e.printStackTrace();  //To change body of catch statement use File 
| Settings | File Templates.
+        }
+    }
+
+    public Database createDatabase(String databaseName) {
+        Database database = new HBaseDatatabase(databaseName, admin);
+           return database;
+    }
+
+    public Database getDatabase(String databaseName) {
+           Database database = new HBaseDatatabase(databaseName, admin);
+           return database;
+    }
+
+    public void deleteDatabase(String databaseName) {
+        try {
+            admin.disableTable(databaseName);
+            admin.deleteTable(databaseName);
+        } catch (IOException e) {
+            System.out.println("Error: Creating the database "+databaseName);
+            e.printStackTrace();  //To change body of catch statement use File 
| Settings | File Templates.
+        }
+    }
+}

Added: 
tuscany/collaboration/GSoC-2011-Eranda/hbase/src/test/java/org/apache/tuscany/nosqldatastore/hbase/HBaseTest.java
URL: 
http://svn.apache.org/viewvc/tuscany/collaboration/GSoC-2011-Eranda/hbase/src/test/java/org/apache/tuscany/nosqldatastore/hbase/HBaseTest.java?rev=1137192&view=auto
==============================================================================
--- 
tuscany/collaboration/GSoC-2011-Eranda/hbase/src/test/java/org/apache/tuscany/nosqldatastore/hbase/HBaseTest.java
 (added)
+++ 
tuscany/collaboration/GSoC-2011-Eranda/hbase/src/test/java/org/apache/tuscany/nosqldatastore/hbase/HBaseTest.java
 Sat Jun 18 14:32:14 2011
@@ -0,0 +1,48 @@
+/*
+ * 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.hbase;
+
+import org.apache.tuscany.nosqldatastore.Database;
+import org.apache.tuscany.nosqldatastore.Group;
+import org.apache.tuscany.nosqldatastore.Session;
+import org.apache.tuscany.nosqldatastore.SessionFactory;
+
+public class HBaseTest {
+
+    Session session;
+
+    private HBaseTest(){
+        session = SessionFactory.getHBaseSession();
+    }
+
+    public static void main(String[] args){
+        HBaseTest test = new HBaseTest();
+        test.start();
+    }
+
+    public void start(){
+        Database database = session.createDatabase("SampleDB");
+        Group group = database.createGroup("group1");
+        group.addEntry("eranda", "Eranda Sooriyabandara");
+        System.out.println(group.getValue("eranda"));
+        group.deleteEntry("eranda");
+        database.deleteGroup("group1");
+        session.deleteDatabase("SampleDB");
+    }
+}


Reply via email to