airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From scnakand...@apache.org
Subject [09/17] airavata git commit: renaming directory names
Date Wed, 05 Oct 2016 08:21:00 GMT
http://git-wip-us.apache.org/repos/asf/airavata/blob/43f228fc/modules/airavata-sharing-registry/pom.xml
----------------------------------------------------------------------
diff --git a/modules/airavata-sharing-registry/pom.xml b/modules/airavata-sharing-registry/pom.xml
deleted file mode 100644
index 78b65cc..0000000
--- a/modules/airavata-sharing-registry/pom.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<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>
-
-    <parent>
-        <artifactId>airavata</artifactId>
-        <groupId>org.apache.airavata</groupId>
-        <relativePath>../pom.xml</relativePath>
-        <version>0.17-SNAPSHOT</version>
-    </parent>
-
-    <groupId>org.apache.airavata</groupId>
-    <artifactId>airavata-sharing-registry</artifactId>
-    <packaging>pom</packaging>
-    <version>${global.version}</version>
-
-    <properties>
-        <global.version>0.17-SNAPSHOT</global.version>
-    </properties>
-
-    <modules>
-        <module>airavata-sharing-registry-stubs</module>
-        <module>airavata-sharing-registry-core</module>
-        <module>airavata-sharing-data-migrator</module>
-    </modules>
-</project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/43f228fc/modules/airavata-sharing-registry/thrift_models/sharing_cpi.thrift
----------------------------------------------------------------------
diff --git a/modules/airavata-sharing-registry/thrift_models/sharing_cpi.thrift b/modules/airavata-sharing-registry/thrift_models/sharing_cpi.thrift
deleted file mode 100644
index d3cc54f..0000000
--- a/modules/airavata-sharing-registry/thrift_models/sharing_cpi.thrift
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * 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.
- *
- */
-
-namespace java org.apache.airavata.sharing.registry.service.cpi
-
-include "./sharing_models.thrift"
-
-service GovRegistryService {
-
-    /**
-     * Domain Operations
-    **/
-    string createDomain(1: required sharing_models.Domain domain) throws (1: sharing_models.GovRegistryException gre)
-    bool updateDomain(1: required sharing_models.Domain domain) throws (1: sharing_models.GovRegistryException gre)
-    bool deleteDomain(1: required string domainId) throws (1: sharing_models.GovRegistryException gre)
-    sharing_models.Domain getDomain(1: required string domainId) throws (1: sharing_models.GovRegistryException gre)
-    list<sharing_models.Domain> getDomains(1: required i32 offset, 2: required i32 limit) throws (1: sharing_models.GovRegistryException gre);
-
-    /**
-     * User Operations
-    **/
-    string createUser(1: required sharing_models.User user) throws (1: sharing_models.GovRegistryException gre)
-    bool updatedUser(1: required sharing_models.User user) throws (1: sharing_models.GovRegistryException gre)
-    bool deleteUser(1: required string userId) throws (1: sharing_models.GovRegistryException gre)
-    sharing_models.User getUser(1: required string userId) throws (1: sharing_models.GovRegistryException gre)
-    list<sharing_models.User> getUsers(1: required string domain, 2: required i32 offset, 3: required i32 limit) throws (1: sharing_models.GovRegistryException gre);
-
-    /**
-     * Group Operations
-    **/
-    string createGroup(1: required sharing_models.UserGroup group) throws (1: sharing_models.GovRegistryException gre)
-    bool updateGroup(1: required sharing_models.UserGroup group) throws (1: sharing_models.GovRegistryException gre)
-    bool deleteGroup(1: required string groupId) throws (1: sharing_models.GovRegistryException gre)
-    sharing_models.UserGroup getGroup(1: required string groupId) throws (1: sharing_models.GovRegistryException gre)
-    list<sharing_models.UserGroup> getGroups(1: required string domain, 2: required i32 offset, 3: required i32 limit)
-
-    bool addUsersToGroup(1: required list<string> userIds, 2: required string groupId) throws (1: sharing_models.GovRegistryException gre);
-    bool removeUsersFromGroup(1: required list<string> userIds, 2: required string groupId) throws (1: sharing_models.GovRegistryException gre);
-    map<string, sharing_models.GroupChildType> getGroupMembers(1: required string groupId, 2: required i32 offset, 3: required i32 limit) throws (1: sharing_models.GovRegistryException gre);
-    bool addChildGroupToParentGroup(1: required string childId, 2: required string groupId) throws (1: sharing_models.GovRegistryException gre);
-    bool removeChildGroupFromParentGroup(1: required string childId, 2: required string groupId) throws (1: sharing_models.GovRegistryException gre);
-
-    /**
-     * EntityType Operations
-    **/
-    string createEntityType(1: required sharing_models.EntityType entityType) throws (1: sharing_models.GovRegistryException gre)
-    bool updateEntityType(1: required sharing_models.EntityType entityType) throws (1: sharing_models.GovRegistryException gre)
-    bool deleteEntityType(1: required string entityTypeId) throws (1: sharing_models.GovRegistryException gre)
-    sharing_models.EntityType getEntityType(1: required string entityTypeId) throws (1: sharing_models.GovRegistryException gre)
-    list<sharing_models.EntityType> getEntityTypes(1: required string domain, 2: required i32 offset, 3: required i32 limit) throws (1: sharing_models.GovRegistryException gre);
-
-    /**
-     * Entity Operations
-    **/
-    string createEntity(1: required sharing_models.Entity entity) throws (1: sharing_models.GovRegistryException gre)
-    bool updateEntity(1: required sharing_models.Entity entity) throws (1: sharing_models.GovRegistryException gre)
-    bool deleteEntity(1: required string entityId) throws (1: sharing_models.GovRegistryException gre)
-    sharing_models.Entity getEntity(1: required string entityId) throws (1: sharing_models.GovRegistryException gre)
-    list<sharing_models.Entity> searchEntities(1: required string userId, 2: required string entityTypeId, 3: required map<sharing_models.EntitySearchFields,
-     string> filters, 4: required i32 offset, 5: required i32 limit) throws (1: sharing_models.GovRegistryException gre)
-
-    /**
-     * Permission Operations
-    **/
-    string createPermissionType(1: required sharing_models.PermissionType permissionType) throws (1: sharing_models.GovRegistryException gre)
-    bool updatePermissionType(1: required sharing_models.PermissionType permissionType) throws (1: sharing_models.GovRegistryException gre)
-    bool deletePermissionType(1: required string entityTypeId) throws (1: sharing_models.GovRegistryException gre)
-    sharing_models.PermissionType getPermissionType(1: required string permissionTypeId) throws (1: sharing_models.GovRegistryException gre)
-    list<sharing_models.PermissionType> getPermissionTypes(1: required string domain, 2: required i32 offset, 3: required i32 limit) throws (1: sharing_models.GovRegistryException gre)
-
-    /**
-     * Sharing Entity with Users and Groups
-    **/
-    bool shareEntityWithUsers(1: required string entityId, 2: required list<string> userList, 3: required string perssionTypeId) throws (1: sharing_models.GovRegistryException gre)
-    bool revokeEntitySharingFromUsers(1: required string entityId, 2: required list<string> userList, 3: required string perssionTypeId) throws (1: sharing_models.GovRegistryException gre)
-    bool shareEntityWithGroups(1: required string entityId, 2: required list<string> groupList, 3: required string perssionTypeId) throws (1: sharing_models.GovRegistryException gre)
-    bool revokeEntitySharingFromGroups(1: required string entityId, 2: required list<string> groupList, 3: required string perssionTypeId) throws (1: sharing_models.GovRegistryException gre)
-    bool userHasAccess(1: required string domainId, 2: required string userId, 3: required string entityId, 4: required string permissionTypeId) throws (1: sharing_models.GovRegistryException gre)
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/43f228fc/modules/airavata-sharing-registry/thrift_models/sharing_models.thrift
----------------------------------------------------------------------
diff --git a/modules/airavata-sharing-registry/thrift_models/sharing_models.thrift b/modules/airavata-sharing-registry/thrift_models/sharing_models.thrift
deleted file mode 100644
index 5670c5e..0000000
--- a/modules/airavata-sharing-registry/thrift_models/sharing_models.thrift
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- * 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.
- *
- */
-
- namespace java org.apache.airavata.sharing.registry.models
-
-const string DO_NOT_SET_AT_CLIENTS_ID = "DO_NOT_SET_AT_CLIENTS_ID"
-
-struct Domain {
-    1: optional string domainId = DO_NOT_SET_AT_CLIENTS_ID,
-    2: optional string name,
-    3: optional string description,
-    4: optional i64 createdTime,
-    5: optional i64 updatedTime
-}
-
- struct User {
-     1: optional string userId = DO_NOT_SET_AT_CLIENTS_ID,
-     2: optional string domainId,
-     3: optional string userName,
-     4: optional i64 createdTime,
-     5: optional i64 updatedTime
- }
-
-enum GroupType {
-    SINGLE_USER,
-    MULTI_USER
-}
-
- struct UserGroup {
-     1: optional string groupId = DO_NOT_SET_AT_CLIENTS_ID,
-     2: optional string domainId,
-     3: optional string name,
-     6: optional string description,
-     7: optional string ownerId,
-     8: optional i64 createdTime,
-     9: optional i64 updatedTime,
-     10: optional GroupType groupType
- }
-
- enum GroupChildType {
-    USER,
-    GROUP
- }
-
- struct GroupMembership {
-    1: optional string parentId,
-    2: optional string childId,
-    3: optional GroupChildType childType
-    4: optional i64 createdTime,
-    5: optional i64 updatedTime
- }
-
-
-
-struct EntityType {
-    1: optional string entityTypeId = DO_NOT_SET_AT_CLIENTS_ID,
-    2: optional string domainId,
-    3: optional string name,
-    4: optional string description,
-    5: optional i64 createdTime,
-    6: optional i64 updatedTime
-}
-
-enum EntitySearchFields {
-    NAME,
-    DESCRIPTION,
-    FULL_TEXT
-}
-
-
-struct Entity {
-    1: optional string entityId = DO_NOT_SET_AT_CLIENTS_ID,
-    2: optional string domainId,
-    3: optional string entityTypeId,
-    4: optional string ownerId,
-    5: optional string parentEntityId,
-    6: optional string name,
-    7: optional string description,
-    8: optional map<string,string> metadata,
-    9: optional string fullText,
-    10: optional i64 createdTime,
-    11: optional i64 updatedTime
-}
-
-struct PermissionType {
-    1: optional string permissionTypeId = DO_NOT_SET_AT_CLIENTS_ID,
-    2: optional string domainId,
-    3: optional string name,
-    4: optional string description,
-    5: optional i64 createdTime,
-    6: optional i64 updatedTime
-}
-
-enum SharingType {
-    DIRECT,
-    INHERITED
- }
-
-struct Sharing {
-    1: optional string permissionTypeId,
-    2: optional string entityId,
-    3: optional string groupId,
-    4: optional GroupType groupType,
-    5: optional SharingType sharingType,
-    6: optional string inheritedParentId,
-    7: optional i64 createdTime,
-    8: optional i64 updatedTime
-}
-
-exception GovRegistryException {
-  1: required string message
-}

http://git-wip-us.apache.org/repos/asf/airavata/blob/43f228fc/modules/airavata-sharing-registry/thrift_models/thrift-gen.sh
----------------------------------------------------------------------
diff --git a/modules/airavata-sharing-registry/thrift_models/thrift-gen.sh b/modules/airavata-sharing-registry/thrift_models/thrift-gen.sh
deleted file mode 100755
index 295be80..0000000
--- a/modules/airavata-sharing-registry/thrift_models/thrift-gen.sh
+++ /dev/null
@@ -1,16 +0,0 @@
-#!/usr/bin/env bash
-
-thrift --gen java sharing_models.thrift
-cd gen-java
-rm -r ../../airavata-sharing-registry-stubs/src/main/java/org/apache/airavata/sharing/registry/models/*
-cp -r org/apache/airavata/sharing/registry/models/ ../../airavata-sharing-registry-stubs/src/main/java/org/apache/airavata/sharing/registry/models/
-
-cd ..
-thrift --gen java sharing_cpi.thrift
-cd gen-java
-rm -r ../../airavata-sharing-registry-stubs/src/main/java/org/apache/airavata/sharing/registry/service/cpi/*
-cp -r org/apache/airavata/sharing/registry/service/cpi/ ../../airavata-sharing-registry-stubs/src/main/java/org/apache/airavata/sharing/registry/service/cpi/
-
-cd ..
-
-rm -r gen-java
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/43f228fc/modules/sharing-registry/README.md
----------------------------------------------------------------------
diff --git a/modules/sharing-registry/README.md b/modules/sharing-registry/README.md
new file mode 100644
index 0000000..299e7b4
--- /dev/null
+++ b/modules/sharing-registry/README.md
@@ -0,0 +1,3 @@
+## Airavata Governance Registry
+
+* This module implements a generic service for access controlling to resources and to provide group based resource sharing
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/43f228fc/modules/sharing-registry/pom.xml
----------------------------------------------------------------------
diff --git a/modules/sharing-registry/pom.xml b/modules/sharing-registry/pom.xml
new file mode 100644
index 0000000..78b65cc
--- /dev/null
+++ b/modules/sharing-registry/pom.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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>
+
+    <parent>
+        <artifactId>airavata</artifactId>
+        <groupId>org.apache.airavata</groupId>
+        <relativePath>../pom.xml</relativePath>
+        <version>0.17-SNAPSHOT</version>
+    </parent>
+
+    <groupId>org.apache.airavata</groupId>
+    <artifactId>airavata-sharing-registry</artifactId>
+    <packaging>pom</packaging>
+    <version>${global.version}</version>
+
+    <properties>
+        <global.version>0.17-SNAPSHOT</global.version>
+    </properties>
+
+    <modules>
+        <module>airavata-sharing-registry-stubs</module>
+        <module>airavata-sharing-registry-core</module>
+        <module>airavata-sharing-data-migrator</module>
+    </modules>
+</project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/43f228fc/modules/sharing-registry/sharing-data-migrator/pom.xml
----------------------------------------------------------------------
diff --git a/modules/sharing-registry/sharing-data-migrator/pom.xml b/modules/sharing-registry/sharing-data-migrator/pom.xml
new file mode 100644
index 0000000..472b0a2
--- /dev/null
+++ b/modules/sharing-registry/sharing-data-migrator/pom.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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>airavata-sharing-registry</artifactId>
+        <groupId>org.apache.airavata</groupId>
+        <version>${global.version}</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>airavata-sharing-data-migrator</artifactId>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.airavata</groupId>
+            <artifactId>airavata-sharing-registry-core</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+    </dependencies>
+</project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/43f228fc/modules/sharing-registry/sharing-data-migrator/src/main/java/org/apache/airavata/sharing/registry/ConnectionFactory.java
----------------------------------------------------------------------
diff --git a/modules/sharing-registry/sharing-data-migrator/src/main/java/org/apache/airavata/sharing/registry/ConnectionFactory.java b/modules/sharing-registry/sharing-data-migrator/src/main/java/org/apache/airavata/sharing/registry/ConnectionFactory.java
new file mode 100644
index 0000000..d501b96
--- /dev/null
+++ b/modules/sharing-registry/sharing-data-migrator/src/main/java/org/apache/airavata/sharing/registry/ConnectionFactory.java
@@ -0,0 +1,59 @@
+/*
+ *
+ * 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.airavata.sharing.registry;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.SQLException;
+
+public class ConnectionFactory {
+    private final static Logger logger = LoggerFactory.getLogger(ConnectionFactory.class);
+
+    //static reference to itself
+    private static ConnectionFactory instance;
+
+    public static final String EXPCAT_URL = "jdbc:mysql://localhost/airavata_exp_catalog";
+    public static final String EXPCAT_USER = "root";
+    public static final String EXPCAT_PASSWORD = "";
+    public static final String DRIVER_CLASS = "com.mysql.jdbc.Driver";
+
+    private static Connection expCatConnection, sharingCatConnection;
+
+    //private constructor
+    private ConnectionFactory() throws ClassNotFoundException, SQLException {
+        Class.forName(DRIVER_CLASS);
+        expCatConnection = DriverManager.getConnection(EXPCAT_URL, EXPCAT_USER, EXPCAT_PASSWORD);
+    }
+
+    public static ConnectionFactory getInstance() throws SQLException, ClassNotFoundException {
+        if(instance == null)
+            instance = new ConnectionFactory();
+        return instance;
+    }
+
+    public Connection getExpCatConnection() throws SQLException {
+        return expCatConnection;
+    }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/43f228fc/modules/sharing-registry/sharing-data-migrator/src/main/java/org/apache/airavata/sharing/registry/DataMigrator.java
----------------------------------------------------------------------
diff --git a/modules/sharing-registry/sharing-data-migrator/src/main/java/org/apache/airavata/sharing/registry/DataMigrator.java b/modules/sharing-registry/sharing-data-migrator/src/main/java/org/apache/airavata/sharing/registry/DataMigrator.java
new file mode 100644
index 0000000..5e747dc
--- /dev/null
+++ b/modules/sharing-registry/sharing-data-migrator/src/main/java/org/apache/airavata/sharing/registry/DataMigrator.java
@@ -0,0 +1,165 @@
+/*
+ *
+ * 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.airavata.sharing.registry;
+
+import org.apache.airavata.sharing.registry.models.*;
+import org.apache.airavata.sharing.registry.server.SharingRegistryServerHandler;
+import org.apache.thrift.TException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.sql.Connection;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.util.HashMap;
+import java.util.Map;
+
+public class DataMigrator {
+    private final static Logger logger = LoggerFactory.getLogger(DataMigrator.class);
+
+    public static void main(String[] args) throws SQLException, ClassNotFoundException, TException {
+        Connection expCatConnection = ConnectionFactory.getInstance().getExpCatConnection();
+
+        SharingRegistryServerHandler govRegistryServerHandler = new SharingRegistryServerHandler();
+
+        String query = "SELECT * FROM GATEWAY";
+        Statement statement = expCatConnection.createStatement();
+        ResultSet rs = statement.executeQuery(query);
+
+        while (rs.next()) {
+            //Creating domain entries
+            Domain domain = new Domain();
+            domain.setDomainId(rs.getString("GATEWAY_ID"));
+            if(rs.getString("GATEWAY_NAME") != null)
+                domain.setName(rs.getString("GATEWAY_NAME"));
+            else
+                domain.setName(rs.getString("GATEWAY_ID"));
+            domain.setDescription("Domain entry for " + domain.name);
+
+            govRegistryServerHandler.createDomain(domain);
+
+            //Creating Entity Types for each domain
+            EntityType entityType = new EntityType();
+            entityType.setEntityTypeId(domain.domainId+":PROJECT");
+            entityType.setDomainId(domain.domainId);
+            entityType.setName("PROJECT");
+            entityType.setDescription("Project entity type");
+            govRegistryServerHandler.createEntityType(entityType);
+
+            entityType = new EntityType();
+            entityType.setEntityTypeId(domain.domainId+":EXPERIMENT");
+            entityType.setDomainId(domain.domainId);
+            entityType.setName("EXPERIMENT");
+            entityType.setDescription("Experiment entity type");
+            govRegistryServerHandler.createEntityType(entityType);
+
+            entityType = new EntityType();
+            entityType.setEntityTypeId(domain.domainId+":FILE");
+            entityType.setDomainId(domain.domainId);
+            entityType.setName("FILE");
+            entityType.setDescription("File entity type");
+            govRegistryServerHandler.createEntityType(entityType);
+
+            //Creating Permission Types for each domain
+            PermissionType permissionType = new PermissionType();
+            permissionType.setPermissionTypeId(domain.domainId+":READ");
+            permissionType.setDomainId(domain.domainId);
+            permissionType.setName("READ");
+            permissionType.setDescription("Read permission type");
+            govRegistryServerHandler.createPermissionType(permissionType);
+
+            permissionType = new PermissionType();
+            permissionType.setPermissionTypeId(domain.domainId+":WRITE");
+            permissionType.setDomainId(domain.domainId);
+            permissionType.setName("WRITE");
+            permissionType.setDescription("Write permission type");
+            govRegistryServerHandler.createPermissionType(permissionType);
+        }
+
+        //Creating user entries
+        query = "SELECT * FROM USERS";
+        statement = expCatConnection.createStatement();
+        rs = statement.executeQuery(query);
+        while(rs.next()){
+            User user = new User();
+            user.setUserId(rs.getString("AIRAVATA_INTERNAL_USER_ID"));
+            user.setDomainId(rs.getString("GATEWAY_ID"));
+            user.setUserName(rs.getString("USER_NAME"));
+
+            govRegistryServerHandler.createUser(user);
+        }
+
+        //Creating project entries
+        query = "SELECT * FROM PROJECT";
+        statement = expCatConnection.createStatement();
+        rs = statement.executeQuery(query);
+        while(rs.next()){
+            Entity entity = new Entity();
+            entity.setEntityId(rs.getString("PROJECT_ID"));
+            entity.setDomainId(rs.getString("GATEWAY_ID"));
+            entity.setEntityTypeId(rs.getString("GATEWAY_ID") + ":PROJECT");
+            entity.setOwnerId(rs.getString("USER_NAME") + "@" + rs.getString("GATEWAY_ID"));
+            entity.setName(rs.getString("PROJECT_NAME"));
+            entity.setDescription(rs.getString("DESCRIPTION"));
+            if(entity.getDescription() == null)
+                entity.setFullText(entity.getName());
+            else
+                entity.setFullText(entity.getName() + " " + entity.getDescription());
+            Map<String, String> metadata = new HashMap<>();
+            metadata.put("CREATION_TIME", rs.getDate("CREATION_TIME").toString());
+
+            govRegistryServerHandler.createEntity(entity);
+        }
+
+        //Creating experiment entries
+        query = "SELECT * FROM EXPERIMENT";
+        statement = expCatConnection.createStatement();
+        rs = statement.executeQuery(query);
+        while(rs.next()){
+            Entity entity = new Entity();
+            entity.setEntityId(rs.getString("EXPERIMENT_ID"));
+            entity.setDomainId(rs.getString("GATEWAY_ID"));
+            entity.setEntityTypeId(rs.getString("GATEWAY_ID") + ":EXPERIMENT");
+            entity.setOwnerId(rs.getString("USER_NAME") + "@" + rs.getString("GATEWAY_ID"));
+            entity.setParentEntityId(rs.getString("PROJECT_ID"));
+            entity.setName(rs.getString("EXPERIMENT_NAME"));
+            entity.setDescription(rs.getString("DESCRIPTION"));
+            if(entity.getDescription() == null)
+                entity.setFullText(entity.getName());
+            else
+                entity.setFullText(entity.getName() + " " + entity.getDescription());
+            Map<String, String> metadata = new HashMap<>();
+            metadata.put("CREATION_TIME", rs.getDate("CREATION_TIME").toString());
+            metadata.put("EXPERIMENT_TYPE", rs.getString("EXPERIMENT_TYPE"));
+            metadata.put("EXECUTION_ID", rs.getString("EXECUTION_ID"));
+            metadata.put("GATEWAY_EXECUTION_ID", rs.getString("GATEWAY_EXECUTION_ID"));
+            metadata.put("ENABLE_EMAIL_NOTIFICATION", rs.getString("ENABLE_EMAIL_NOTIFICATION"));
+            metadata.put("EMAIL_ADDRESSES", rs.getString("EMAIL_ADDRESSES"));
+            metadata.put("GATEWAY_INSTANCE_ID", rs.getString("GATEWAY_INSTANCE_ID"));
+            metadata.put("ARCHIVE", rs.getString("ARCHIVE"));
+
+            govRegistryServerHandler.createEntity(entity);
+        }
+
+        expCatConnection.close();
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/43f228fc/modules/sharing-registry/sharing-registry-core/pom.xml
----------------------------------------------------------------------
diff --git a/modules/sharing-registry/sharing-registry-core/pom.xml b/modules/sharing-registry/sharing-registry-core/pom.xml
new file mode 100644
index 0000000..f43f77c
--- /dev/null
+++ b/modules/sharing-registry/sharing-registry-core/pom.xml
@@ -0,0 +1,93 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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>airavata-sharing-registry</artifactId>
+        <groupId>org.apache.airavata</groupId>
+        <relativePath>../pom.xml</relativePath>
+        <version>${global.version}</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>airavata-sharing-registry-core</artifactId>
+    <dependencies>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-api</artifactId>
+            <version>1.7.10</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.thrift</groupId>
+            <artifactId>libthrift</artifactId>
+            <version>0.9.3</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.airavata</groupId>
+            <artifactId>airavata-sharing-registry-stubs</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.airavata</groupId>
+            <artifactId>airavata-commons</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>net.sf.dozer</groupId>
+            <artifactId>dozer</artifactId>
+            <version>5.4.0</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.openjpa</groupId>
+            <artifactId>openjpa-all</artifactId>
+            <version>2.2.0</version>
+        </dependency>
+        <dependency>
+            <groupId>mysql</groupId>
+            <artifactId>mysql-connector-java</artifactId>
+            <version>5.1.34</version>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-compiler-plugin</artifactId>
+                <version>3.5.1</version>
+                <configuration>
+                    <source>1.8</source>
+                    <target>1.8</target>
+                </configuration>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.openjpa</groupId>
+                <artifactId>openjpa-maven-plugin</artifactId>
+                <version>2.2.0</version>
+                <configuration>
+                    <includes>**/entities/*.class</includes>
+                    <excludes>**/entities/XML*.class</excludes>
+                    <addDefaultConstructor>true</addDefaultConstructor>
+                    <enforcePropertyRestrictions>true</enforcePropertyRestrictions>
+                </configuration>
+                <executions>
+                    <execution>
+                        <id>enhancer</id>
+                        <phase>process-classes</phase>
+                        <goals>
+                            <goal>enhance</goal>
+                        </goals>
+                    </execution>
+                </executions>
+                <dependencies>
+                    <dependency>
+                        <groupId>org.apache.openjpa</groupId>
+                        <artifactId>openjpa</artifactId>
+                        <version>2.2.0</version>
+                    </dependency>
+                </dependencies>
+            </plugin>
+        </plugins>
+    </build>
+
+</project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/43f228fc/modules/sharing-registry/sharing-registry-core/src/main/java/org/apache/airavata/sharing/registry/db/entities/DomainEntity.java
----------------------------------------------------------------------
diff --git a/modules/sharing-registry/sharing-registry-core/src/main/java/org/apache/airavata/sharing/registry/db/entities/DomainEntity.java b/modules/sharing-registry/sharing-registry-core/src/main/java/org/apache/airavata/sharing/registry/db/entities/DomainEntity.java
new file mode 100644
index 0000000..48b5314
--- /dev/null
+++ b/modules/sharing-registry/sharing-registry-core/src/main/java/org/apache/airavata/sharing/registry/db/entities/DomainEntity.java
@@ -0,0 +1,113 @@
+/*
+ *
+ * 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.airavata.sharing.registry.db.entities;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.persistence.*;
+
+@Entity
+@Table(name = "DOMAIN", schema = "" )
+public class DomainEntity {
+    private final static Logger logger = LoggerFactory.getLogger(DomainEntity.class);
+    private String domainId;
+    private String name;
+    private String description;
+    private Long createdTime;
+    private Long updatedTime;
+
+    @Id
+    @Column(name = "DOMAIN_ID")
+    public String getDomainId() {
+        return domainId;
+    }
+
+    public void setDomainId(String domainId) {
+        this.domainId = domainId;
+    }
+
+    @Basic
+    @Column(name = "NAME")
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    @Basic
+    @Column(name = "DESCRIPTION")
+    public String getDescription() {
+        return description;
+    }
+
+    public void setDescription(String description) {
+        this.description = description;
+    }
+
+    @Basic
+    @Column(name = "CREATED_TIME")
+    public Long getCreatedTime() {
+        return createdTime;
+    }
+
+    public void setCreatedTime(Long createdTime) {
+        this.createdTime = createdTime;
+    }
+
+    @Basic
+    @Column(name = "UPDATED_TIME")
+    public Long getUpdatedTime() {
+        return updatedTime;
+    }
+
+    public void setUpdatedTime(Long updatedTime) {
+        this.updatedTime = updatedTime;
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) return true;
+        if (o == null || getClass() != o.getClass()) return false;
+
+        DomainEntity that = (DomainEntity) o;
+
+        if (domainId != null ? !domainId.equals(that.domainId) : that.domainId != null) return false;
+        if (name != null ? !name.equals(that.name) : that.name != null) return false;
+        if (description != null ? !description.equals(that.description) : that.description != null) return false;
+        if (createdTime != null ? !createdTime.equals(that.createdTime) : that.createdTime != null) return false;
+        if (updatedTime != null ? !updatedTime.equals(that.updatedTime) : that.updatedTime != null) return false;
+
+        return true;
+    }
+
+    @Override
+    public int hashCode() {
+        int result = domainId != null ? domainId.hashCode() : 0;
+        result = 31 * result + (name != null ? name.hashCode() : 0);
+        result = 31 * result + (description != null ? description.hashCode() : 0);
+        result = 31 * result + (createdTime != null ? createdTime.hashCode() : 0);
+        result = 31 * result + (updatedTime != null ? updatedTime.hashCode() : 0);
+        return result;
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/43f228fc/modules/sharing-registry/sharing-registry-core/src/main/java/org/apache/airavata/sharing/registry/db/entities/EntityEntity.java
----------------------------------------------------------------------
diff --git a/modules/sharing-registry/sharing-registry-core/src/main/java/org/apache/airavata/sharing/registry/db/entities/EntityEntity.java b/modules/sharing-registry/sharing-registry-core/src/main/java/org/apache/airavata/sharing/registry/db/entities/EntityEntity.java
new file mode 100644
index 0000000..de8abf4
--- /dev/null
+++ b/modules/sharing-registry/sharing-registry-core/src/main/java/org/apache/airavata/sharing/registry/db/entities/EntityEntity.java
@@ -0,0 +1,192 @@
+/*
+ *
+ * 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.airavata.sharing.registry.db.entities;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.persistence.*;
+import java.util.Map;
+
+@Entity
+@Table(name = "ENTITY", schema = "")
+public class EntityEntity {
+    private final static Logger logger = LoggerFactory.getLogger(EntityEntity.class);
+    private String entityId;
+    private String domainId;
+    private String entityTypeId;
+    private String ownerId;
+    private String parentEntityId;
+    private String name;
+    private String description;
+    private Map<String, String> metadata;
+    private String fullText;
+    private Long createdTime;
+    private Long updatedTime;
+
+    @Id
+    @Column(name = "ENTITY_ID")
+    public String getEntityId() {
+        return entityId;
+    }
+
+    public void setEntityId(String entityId) {
+        this.entityId = entityId;
+    }
+
+    @Basic
+    @Column(name = "DOMAIN_ID")
+    public String getDomainId() {
+        return domainId;
+    }
+
+    public void setDomainId(String domainId) {
+        this.domainId = domainId;
+    }
+
+    @Basic
+    @Column(name = "ENTITY_TYPE_ID")
+    public String getEntityTypeId() {
+        return entityTypeId;
+    }
+
+    public void setEntityTypeId(String entityTypeId) {
+        this.entityTypeId = entityTypeId;
+    }
+
+    @Basic
+    @Column(name = "OWNER_ID")
+    public String getOwnerId() {
+        return ownerId;
+    }
+
+    public void setOwnerId(String ownerId) {
+        this.ownerId = ownerId;
+    }
+
+    @Basic
+    @Column(name = "PARENT_ENTITY_ID")
+    public String getParentEntityId() {
+        return parentEntityId;
+    }
+
+    public void setParentEntityId(String parentEntityId) {
+        this.parentEntityId = parentEntityId;
+    }
+
+    @Basic
+    @Column(name = "NAME")
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    @Basic
+    @Column(name = "DESCRIPTION")
+    public String getDescription() {
+        return description;
+    }
+
+    public void setDescription(String description) {
+        this.description = description;
+    }
+
+    @ElementCollection
+    @CollectionTable(
+            name="ENTITY_METADATA",
+            joinColumns=@JoinColumn(name="ENTITY_ID")
+    )
+    @MapKeyColumn(name="META_KEY")
+    @Column(name="META_VALUE")
+    public Map<String, String> getMetadata() {
+        return metadata;
+    }
+
+    public void setMetadata(Map<String, String> metadata) {
+        this.metadata = metadata;
+    }
+
+    @Lob
+    @Column(name = "FULL_TEXT")
+    public String getFullText() {
+        return fullText;
+    }
+
+    public void setFullText(String fullText) {
+        this.fullText = fullText;
+    }
+
+    @Basic
+    @Column(name = "CREATED_TIME")
+    public Long getCreatedTime() {
+        return createdTime;
+    }
+
+    public void setCreatedTime(Long createdTime) {
+        this.createdTime = createdTime;
+    }
+
+    @Basic
+    @Column(name = "UPDATED_TIME")
+    public Long getUpdatedTime() {
+        return updatedTime;
+    }
+
+    public void setUpdatedTime(Long updatedTime) {
+        this.updatedTime = updatedTime;
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) return true;
+        if (o == null || getClass() != o.getClass()) return false;
+
+        EntityEntity that = (EntityEntity) o;
+
+        if (entityId != null ? !entityId.equals(that.entityId) : that.entityId != null) return false;
+        if (domainId != null ? !domainId.equals(that.domainId) : that.domainId != null) return false;
+        if (parentEntityId != null ? !parentEntityId.equals(that.parentEntityId) : that.parentEntityId != null) return false;
+        if (name != null ? !name.equals(that.name) : that.name != null) return false;
+        if (description != null ? !description.equals(that.description) : that.description != null) return false;
+        if (metadata.equals(that.metadata)) return false;
+        if (fullText != null ? !fullText.equals(that.fullText) : that.fullText != null) return false;
+        if (createdTime != null ? !createdTime.equals(that.createdTime) : that.createdTime != null) return false;
+        if (updatedTime != null ? !updatedTime.equals(that.updatedTime) : that.updatedTime != null) return false;
+        if (ownerId != null ? !ownerId.equals(that.ownerId) : that.ownerId != null) return false;
+
+        return true;
+    }
+
+    @Override
+    public int hashCode() {
+        int result = entityId != null ? entityId.hashCode() : 0;
+        result = 31 * result + (name != null ? name.hashCode() : 0);
+        result = 31 * result + (description != null ? description.hashCode() : 0);
+        result = 31 * result + (metadata != null ? metadata.hashCode() : 0);
+        result = 31 * result + (fullText != null ? fullText.hashCode() : 0);
+        result = 31 * result + (createdTime != null ? createdTime.hashCode() : 0);
+        result = 31 * result + (updatedTime != null ? updatedTime.hashCode() : 0);
+        return result;
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/43f228fc/modules/sharing-registry/sharing-registry-core/src/main/java/org/apache/airavata/sharing/registry/db/entities/EntityTypeEntity.java
----------------------------------------------------------------------
diff --git a/modules/sharing-registry/sharing-registry-core/src/main/java/org/apache/airavata/sharing/registry/db/entities/EntityTypeEntity.java b/modules/sharing-registry/sharing-registry-core/src/main/java/org/apache/airavata/sharing/registry/db/entities/EntityTypeEntity.java
new file mode 100644
index 0000000..0b789ed
--- /dev/null
+++ b/modules/sharing-registry/sharing-registry-core/src/main/java/org/apache/airavata/sharing/registry/db/entities/EntityTypeEntity.java
@@ -0,0 +1,125 @@
+/*
+ *
+ * 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.airavata.sharing.registry.db.entities;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.persistence.*;
+
+@Entity
+@Table(name = "ENTITY_TYPE", schema = "")
+public class EntityTypeEntity {
+    private final static Logger logger = LoggerFactory.getLogger(EntityTypeEntity.class);
+    private String entityTypeId;
+    private String domainId;
+    private String name;
+    private String description;
+    private Long createdTime;
+    private Long updatedTime;
+
+    @Id
+    @Column(name = "ENTITY_TYPE_ID")
+    public String getEntityTypeId() {
+        return entityTypeId;
+    }
+
+    public void setEntityTypeId(String entityTypeId) {
+        this.entityTypeId = entityTypeId;
+    }
+
+    @Basic
+    @Column(name = "DOMAIN_ID")
+    public String getDomainId() {
+        return domainId;
+    }
+
+    public void setDomainId(String domainId) {
+        this.domainId = domainId;
+    }
+
+    @Basic
+    @Column(name = "NAME")
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    @Basic
+    @Column(name = "DESCRIPTION")
+    public String getDescription() {
+        return description;
+    }
+
+    public void setDescription(String description) {
+        this.description = description;
+    }
+
+    @Basic
+    @Column(name = "CREATED_TIME")
+    public Long getCreatedTime() {
+        return createdTime;
+    }
+
+    public void setCreatedTime(Long createdTime) {
+        this.createdTime = createdTime;
+    }
+
+    @Basic
+    @Column(name = "UPDATED_TIME")
+    public Long getUpdatedTime() {
+        return updatedTime;
+    }
+
+    public void setUpdatedTime(Long updatedTime) {
+        this.updatedTime = updatedTime;
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) return true;
+        if (o == null || getClass() != o.getClass()) return false;
+
+        EntityTypeEntity that = (EntityTypeEntity) o;
+
+        if (entityTypeId != null ? !entityTypeId.equals(that.entityTypeId) : that.entityTypeId != null) return false;
+        if (domainId != null ? !domainId.equals(that.domainId) : that.domainId != null) return false;
+        if (name != null ? !name.equals(that.name) : that.name != null) return false;
+        if (description != null ? !description.equals(that.description) : that.description != null) return false;
+        if (createdTime != null ? !createdTime.equals(that.createdTime) : that.createdTime != null) return false;
+        if (updatedTime != null ? !updatedTime.equals(that.updatedTime) : that.updatedTime != null) return false;
+
+        return true;
+    }
+
+    @Override
+    public int hashCode() {
+        int result = entityTypeId != null ? entityTypeId.hashCode() : 0;
+        result = 31 * result + (name != null ? name.hashCode() : 0);
+        result = 31 * result + (description != null ? description.hashCode() : 0);
+        result = 31 * result + (createdTime != null ? createdTime.hashCode() : 0);
+        result = 31 * result + (updatedTime != null ? updatedTime.hashCode() : 0);
+        return result;
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/43f228fc/modules/sharing-registry/sharing-registry-core/src/main/java/org/apache/airavata/sharing/registry/db/entities/GroupMembershipEntity.java
----------------------------------------------------------------------
diff --git a/modules/sharing-registry/sharing-registry-core/src/main/java/org/apache/airavata/sharing/registry/db/entities/GroupMembershipEntity.java b/modules/sharing-registry/sharing-registry-core/src/main/java/org/apache/airavata/sharing/registry/db/entities/GroupMembershipEntity.java
new file mode 100644
index 0000000..c62a52d
--- /dev/null
+++ b/modules/sharing-registry/sharing-registry-core/src/main/java/org/apache/airavata/sharing/registry/db/entities/GroupMembershipEntity.java
@@ -0,0 +1,112 @@
+/*
+ *
+ * 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.airavata.sharing.registry.db.entities;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.persistence.*;
+
+@Entity
+@Table(name = "GROUP_MEMBERSHIP", schema = "")
+@IdClass(GroupMembershipEntityPK.class)
+public class GroupMembershipEntity {
+    private final static Logger logger = LoggerFactory.getLogger(GroupMembershipEntity.class);
+    private String parentId;
+    private String childId;
+    private String childType;
+    private Long createdTime;
+    private Long updatedTime;
+
+    @Id
+    @Column(name = "PARENT_ID")
+    public String getParentId() {
+        return parentId;
+    }
+
+    public void setParentId(String parentId) {
+        this.parentId = parentId;
+    }
+
+    @Id
+    @Column(name = "CHILD_ID")
+    public String getChildId() {
+        return childId;
+    }
+
+    public void setChildId(String childId) {
+        this.childId = childId;
+    }
+
+    @Basic
+    @Column(name = "CHILD_TYPE")
+    public String getChildType() {
+        return childType;
+    }
+
+    public void setChildType(String childType) {
+        this.childType = childType;
+    }
+
+    @Basic
+    @Column(name = "CREATED_TIME")
+    public Long getCreatedTime() {
+        return createdTime;
+    }
+
+    public void setCreatedTime(Long createdTime) {
+        this.createdTime = createdTime;
+    }
+
+    @Basic
+    @Column(name = "UPDATED_TIME")
+    public Long getUpdatedTime() {
+        return updatedTime;
+    }
+
+    public void setUpdatedTime(Long updatedTime) {
+        this.updatedTime = updatedTime;
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) return true;
+        if (o == null || getClass() != o.getClass()) return false;
+
+        GroupMembershipEntity that = (GroupMembershipEntity) o;
+
+        if (parentId != null ? !parentId.equals(that.parentId) : that.parentId != null) return false;
+        if (childId != null ? !childId.equals(that.childId) : that.childId != null) return false;
+        if (childType != null ? !childType.equals(that.childType) : that.childType != null) return false;
+        if (createdTime != null ? !createdTime.equals(that.createdTime) : that.createdTime != null) return false;
+        if (updatedTime != null ? !updatedTime.equals(that.updatedTime) : that.updatedTime != null) return false;
+
+        return true;
+    }
+
+    @Override
+    public int hashCode() {
+        int result = parentId != null ? parentId.hashCode() : 0;
+        result = 31 * result + (childId != null ? childId.hashCode() : 0);
+        result = 31 * result + (childType != null ? childType.hashCode() : 0);
+        return result;
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/43f228fc/modules/sharing-registry/sharing-registry-core/src/main/java/org/apache/airavata/sharing/registry/db/entities/GroupMembershipEntityPK.java
----------------------------------------------------------------------
diff --git a/modules/sharing-registry/sharing-registry-core/src/main/java/org/apache/airavata/sharing/registry/db/entities/GroupMembershipEntityPK.java b/modules/sharing-registry/sharing-registry-core/src/main/java/org/apache/airavata/sharing/registry/db/entities/GroupMembershipEntityPK.java
new file mode 100644
index 0000000..be3b1f9
--- /dev/null
+++ b/modules/sharing-registry/sharing-registry-core/src/main/java/org/apache/airavata/sharing/registry/db/entities/GroupMembershipEntityPK.java
@@ -0,0 +1,74 @@
+/*
+ *
+ * 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.airavata.sharing.registry.db.entities;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.persistence.Column;
+import javax.persistence.Id;
+import java.io.Serializable;
+
+public class GroupMembershipEntityPK implements Serializable {
+    private final static Logger logger = LoggerFactory.getLogger(GroupMembershipEntityPK.class);
+    private String parentId;
+    private String childId;
+
+    @Column(name = "PARENT_ID")
+    @Id
+    public String getParentId() {
+        return parentId;
+    }
+
+    public void setParentId(String parentId) {
+        this.parentId = parentId;
+    }
+
+    @Column(name = "CHILD_ID")
+    @Id
+    public String getChildId() {
+        return childId;
+    }
+
+    public void setChildId(String childId) {
+        this.childId = childId;
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) return true;
+        if (o == null || getClass() != o.getClass()) return false;
+
+        GroupMembershipEntityPK that = (GroupMembershipEntityPK) o;
+
+        if (parentId != null ? !parentId.equals(that.parentId) : that.parentId != null) return false;
+        if (childId != null ? !childId.equals(that.childId) : that.childId != null) return false;
+
+        return true;
+    }
+
+    @Override
+    public int hashCode() {
+        int result = parentId != null ? parentId.hashCode() : 0;
+        result = 31 * result + (childId != null ? childId.hashCode() : 0);
+        return result;
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/43f228fc/modules/sharing-registry/sharing-registry-core/src/main/java/org/apache/airavata/sharing/registry/db/entities/PermissionTypeEntity.java
----------------------------------------------------------------------
diff --git a/modules/sharing-registry/sharing-registry-core/src/main/java/org/apache/airavata/sharing/registry/db/entities/PermissionTypeEntity.java b/modules/sharing-registry/sharing-registry-core/src/main/java/org/apache/airavata/sharing/registry/db/entities/PermissionTypeEntity.java
new file mode 100644
index 0000000..c145cbe
--- /dev/null
+++ b/modules/sharing-registry/sharing-registry-core/src/main/java/org/apache/airavata/sharing/registry/db/entities/PermissionTypeEntity.java
@@ -0,0 +1,125 @@
+/*
+ *
+ * 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.airavata.sharing.registry.db.entities;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.persistence.*;
+
+@Entity
+@Table(name = "PERMISSION_TYPE", schema = "")
+public class PermissionTypeEntity {
+    private final static Logger logger = LoggerFactory.getLogger(PermissionTypeEntity.class);
+    private String permissionTypeId;
+    private String domainId;
+    private String name;
+    private String description;
+    private Long createdTime;
+    private Long updatedTime;
+
+    @Id
+    @Column(name = "PERMISSION_TYPE_ID")
+    public String getPermissionTypeId() {
+        return permissionTypeId;
+    }
+
+    public void setPermissionTypeId(String permissionTypeId) {
+        this.permissionTypeId = permissionTypeId;
+    }
+
+    @Basic
+    @Column(name = "DOMAIN_ID")
+    public String getDomainId() {
+        return domainId;
+    }
+
+    public void setDomainId(String domainId) {
+        this.domainId = domainId;
+    }
+
+    @Basic
+    @Column(name = "NAME")
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+
+    @Basic
+    @Column(name = "DESCRIPTION")
+    public String getDescription() {
+        return description;
+    }
+
+    public void setDescription(String description) {
+        this.description = description;
+    }
+
+    @Basic
+    @Column(name = "CREATED_TIME")
+    public Long getCreatedTime() {
+        return createdTime;
+    }
+
+    public void setCreatedTime(Long createdTime) {
+        this.createdTime = createdTime;
+    }
+
+    @Basic
+    @Column(name = "UPDATED_TIME")
+    public Long getUpdatedTime() {
+        return updatedTime;
+    }
+
+    public void setUpdatedTime(Long updatedTime) {
+        this.updatedTime = updatedTime;
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) return true;
+        if (o == null || getClass() != o.getClass()) return false;
+
+        PermissionTypeEntity that = (PermissionTypeEntity) o;
+
+        if (permissionTypeId != null ? !permissionTypeId.equals(that.permissionTypeId) : that.permissionTypeId != null)
+            return false;
+        if (domainId != null ? !domainId.equals(that.domainId) : that.domainId != null) return false;
+        if (name != null ? !name.equals(that.name) : that.name != null) return false;
+        if (createdTime != null ? !createdTime.equals(that.createdTime) : that.createdTime != null) return false;
+        if (updatedTime != null ? !updatedTime.equals(that.updatedTime) : that.updatedTime != null) return false;
+
+        return true;
+    }
+
+    @Override
+    public int hashCode() {
+        int result = permissionTypeId != null ? permissionTypeId.hashCode() : 0;
+        result = 31 * result + (name != null ? name.hashCode() : 0);
+        result = 31 * result + (createdTime != null ? createdTime.hashCode() : 0);
+        result = 31 * result + (updatedTime != null ? updatedTime.hashCode() : 0);
+        return result;
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/43f228fc/modules/sharing-registry/sharing-registry-core/src/main/java/org/apache/airavata/sharing/registry/db/entities/SharingEntity.java
----------------------------------------------------------------------
diff --git a/modules/sharing-registry/sharing-registry-core/src/main/java/org/apache/airavata/sharing/registry/db/entities/SharingEntity.java b/modules/sharing-registry/sharing-registry-core/src/main/java/org/apache/airavata/sharing/registry/db/entities/SharingEntity.java
new file mode 100644
index 0000000..077d7cf
--- /dev/null
+++ b/modules/sharing-registry/sharing-registry-core/src/main/java/org/apache/airavata/sharing/registry/db/entities/SharingEntity.java
@@ -0,0 +1,146 @@
+/*
+ *
+ * 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.airavata.sharing.registry.db.entities;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.persistence.*;
+
+@Entity
+@Table(name = "SHARING", schema = "")
+@IdClass(SharingEntityPK.class)
+public class SharingEntity {
+    private final static Logger logger = LoggerFactory.getLogger(SharingEntity.class);
+    private String permissionTypeId;
+    private String entityId;
+    private String groupId;
+    private String groupType;
+    private String sharingType;
+    private String inheritedParentId;
+    private Long createdTime;
+    private Long updatedTime;
+
+    @Id
+    @Column(name = "PERMISSION_TYPE_ID")
+    public String getPermissionTypeId() {
+        return permissionTypeId;
+    }
+
+    public void setPermissionTypeId(String permissionTypeId) {
+        this.permissionTypeId = permissionTypeId;
+    }
+
+    @Id
+    @Column(name = "ENTITY_ID")
+    public String getEntityId() {
+        return entityId;
+    }
+
+    public void setEntityId(String entityId) {
+        this.entityId = entityId;
+    }
+
+    @Id
+    @Column(name = "GROUP_ID")
+    public String getGroupId() {
+        return groupId;
+    }
+
+    public void setGroupId(String groupId) {
+        this.groupId = groupId;
+    }
+
+    @Basic
+    @Column(name = "GROUP_TYPE")
+    public String getGroupType() {
+        return groupType;
+    }
+
+    public void setGroupType(String groupType) {
+        this.groupType = groupType;
+    }
+
+    @Basic
+    @Column(name = "SHARING_TYPE")
+    public String getSharingType() {
+        return sharingType;
+    }
+
+    public void setSharingType(String sharingType) {
+        this.sharingType = sharingType;
+    }
+
+    @Basic
+    @Column(name = "INHERITED_PARENT_ID")
+    public String getInheritedParentId() {
+        return inheritedParentId;
+    }
+
+    public void setInheritedParentId(String inheritedParentId) {
+        this.inheritedParentId = inheritedParentId;
+    }
+
+    @Basic
+    @Column(name = "CREATED_TIME")
+    public Long getCreatedTime() {
+        return createdTime;
+    }
+
+    public void setCreatedTime(Long createdTime) {
+        this.createdTime = createdTime;
+    }
+
+    @Basic
+    @Column(name = "UPDATED_TIME")
+    public Long getUpdatedTime() {
+        return updatedTime;
+    }
+
+    public void setUpdatedTime(Long updatedTime) {
+        this.updatedTime = updatedTime;
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) return true;
+        if (o == null || getClass() != o.getClass()) return false;
+
+        SharingEntity that = (SharingEntity) o;
+
+        if (permissionTypeId != null ? !permissionTypeId.equals(that.permissionTypeId) : that.permissionTypeId != null)
+            return false;
+        if (entityId != null ? !entityId.equals(that.entityId) : that.entityId != null) return false;
+        if (groupId != null ? !groupId.equals(that.groupId) : that.groupId != null) return false;
+        if (createdTime != null ? !createdTime.equals(that.createdTime) : that.createdTime != null) return false;
+        if (updatedTime != null ? !updatedTime.equals(that.updatedTime) : that.updatedTime != null) return false;
+
+        return true;
+    }
+
+    @Override
+    public int hashCode() {
+        int result = permissionTypeId != null ? permissionTypeId.hashCode() : 0;
+        result = 31 * result + (entityId != null ? entityId.hashCode() : 0);
+        result = 31 * result + (groupId != null ? groupId.hashCode() : 0);
+        return result;
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/43f228fc/modules/sharing-registry/sharing-registry-core/src/main/java/org/apache/airavata/sharing/registry/db/entities/SharingEntityPK.java
----------------------------------------------------------------------
diff --git a/modules/sharing-registry/sharing-registry-core/src/main/java/org/apache/airavata/sharing/registry/db/entities/SharingEntityPK.java b/modules/sharing-registry/sharing-registry-core/src/main/java/org/apache/airavata/sharing/registry/db/entities/SharingEntityPK.java
new file mode 100644
index 0000000..fe6ebaf
--- /dev/null
+++ b/modules/sharing-registry/sharing-registry-core/src/main/java/org/apache/airavata/sharing/registry/db/entities/SharingEntityPK.java
@@ -0,0 +1,113 @@
+/*
+ *
+ * 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.airavata.sharing.registry.db.entities;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.persistence.Basic;
+import javax.persistence.Column;
+import javax.persistence.Id;
+import java.io.Serializable;
+
+public class SharingEntityPK implements Serializable {
+    private final static Logger logger = LoggerFactory.getLogger(SharingEntityPK.class);
+    private String permissionTypeId;
+    private String entityId;
+    private String groupId;
+    private Long createdTime;
+    private Long updatedTime;
+
+    @Column(name = "PERMISSION_TYPE_ID")
+    @Id
+    public String getPermissionTypeId() {
+        return permissionTypeId;
+    }
+
+    public void setPermissionTypeId(String permissionTypeId) {
+        this.permissionTypeId = permissionTypeId;
+    }
+
+    @Column(name = "ENTITY_ID")
+    @Id
+    public String getEntityId() {
+        return entityId;
+    }
+
+    public void setEntityId(String entityId) {
+        this.entityId = entityId;
+    }
+
+    @Column(name = "GROUP_ID")
+    @Id
+    public String getGroupId() {
+        return groupId;
+    }
+
+    public void setGroupId(String groupId) {
+        this.groupId = groupId;
+    }
+
+    @Basic
+    @Column(name = "CREATED_TIME")
+    public Long getCreatedTime() {
+        return createdTime;
+    }
+
+    public void setCreatedTime(Long createdTime) {
+        this.createdTime = createdTime;
+    }
+
+    @Basic
+    @Column(name = "UPDATED_TIME")
+    public Long getUpdatedTime() {
+        return updatedTime;
+    }
+
+    public void setUpdatedTime(Long updatedTime) {
+        this.updatedTime = updatedTime;
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) return true;
+        if (o == null || getClass() != o.getClass()) return false;
+
+        SharingEntityPK that = (SharingEntityPK) o;
+
+        if (permissionTypeId != null ? !permissionTypeId.equals(that.permissionTypeId) : that.permissionTypeId != null)
+            return false;
+        if (entityId != null ? !entityId.equals(that.entityId) : that.entityId != null) return false;
+        if (groupId != null ? !groupId.equals(that.groupId) : that.groupId != null) return false;
+        if (createdTime != null ? !createdTime.equals(that.createdTime) : that.createdTime != null) return false;
+        if (updatedTime != null ? !updatedTime.equals(that.updatedTime) : that.updatedTime != null) return false;
+
+        return true;
+    }
+
+    @Override
+    public int hashCode() {
+        int result = permissionTypeId != null ? permissionTypeId.hashCode() : 0;
+        result = 31 * result + (entityId != null ? entityId.hashCode() : 0);
+        result = 31 * result + (groupId != null ? groupId.hashCode() : 0);
+        return result;
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/43f228fc/modules/sharing-registry/sharing-registry-core/src/main/java/org/apache/airavata/sharing/registry/db/entities/UserEntity.java
----------------------------------------------------------------------
diff --git a/modules/sharing-registry/sharing-registry-core/src/main/java/org/apache/airavata/sharing/registry/db/entities/UserEntity.java b/modules/sharing-registry/sharing-registry-core/src/main/java/org/apache/airavata/sharing/registry/db/entities/UserEntity.java
new file mode 100644
index 0000000..256d2e7
--- /dev/null
+++ b/modules/sharing-registry/sharing-registry-core/src/main/java/org/apache/airavata/sharing/registry/db/entities/UserEntity.java
@@ -0,0 +1,112 @@
+/*
+ *
+ * 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.airavata.sharing.registry.db.entities;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.persistence.*;
+
+@Entity
+@Table(name = "USER", schema = "")
+public class UserEntity {
+    private final static Logger logger = LoggerFactory.getLogger(UserEntity.class);
+    private String userId;
+    private String domainId;
+    private String userName;
+    private Long createdTime;
+    private Long updatedTime;
+
+    @Id
+    @Column(name = "USER_ID")
+    public String getUserId() {
+        return userId;
+    }
+
+    public void setUserId(String userId) {
+        this.userId = userId;
+    }
+
+    @Basic
+    @Column(name = "DOMAIN_ID")
+    public String getDomainId() {
+        return domainId;
+    }
+
+    public void setDomainId(String domainId) {
+        this.domainId = domainId;
+    }
+
+    @Basic
+    @Column(name = "USER_NAME")
+    public String getUserName() {
+        return userName;
+    }
+
+    public void setUserName(String userName) {
+        this.userName = userName;
+    }
+
+    @Basic
+    @Column(name = "CREATED_TIME")
+    public Long getCreatedTime() {
+        return createdTime;
+    }
+
+    public void setCreatedTime(Long createdTime) {
+        this.createdTime = createdTime;
+    }
+
+    @Basic
+    @Column(name = "UPDATED_TIME")
+    public Long getUpdatedTime() {
+        return updatedTime;
+    }
+
+    public void setUpdatedTime(Long updatedTime) {
+        this.updatedTime = updatedTime;
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) return true;
+        if (o == null || getClass() != o.getClass()) return false;
+
+        UserEntity that = (UserEntity) o;
+
+        if (userId != null ? !userId.equals(that.userId) : that.userId != null) return false;
+        if (domainId != null ? !domainId.equals(that.domainId) : that.domainId != null) return false;
+        if (userName != null ? !userName.equals(that.userName) : that.userName != null) return false;
+        if (createdTime != null ? !createdTime.equals(that.createdTime) : that.createdTime != null) return false;
+        if (updatedTime != null ? !updatedTime.equals(that.updatedTime) : that.updatedTime != null) return false;
+
+        return true;
+    }
+
+    @Override
+    public int hashCode() {
+        int result = userId != null ? userId.hashCode() : 0;
+        result = 31 * result + (userName != null ? userName.hashCode() : 0);
+        result = 31 * result + (createdTime != null ? createdTime.hashCode() : 0);
+        result = 31 * result + (updatedTime != null ? updatedTime.hashCode() : 0);
+        return result;
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/43f228fc/modules/sharing-registry/sharing-registry-core/src/main/java/org/apache/airavata/sharing/registry/db/entities/UserGroupEntity.java
----------------------------------------------------------------------
diff --git a/modules/sharing-registry/sharing-registry-core/src/main/java/org/apache/airavata/sharing/registry/db/entities/UserGroupEntity.java b/modules/sharing-registry/sharing-registry-core/src/main/java/org/apache/airavata/sharing/registry/db/entities/UserGroupEntity.java
new file mode 100644
index 0000000..10d901a
--- /dev/null
+++ b/modules/sharing-registry/sharing-registry-core/src/main/java/org/apache/airavata/sharing/registry/db/entities/UserGroupEntity.java
@@ -0,0 +1,150 @@
+/*
+ *
+ * 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.airavata.sharing.registry.db.entities;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.persistence.*;
+
+@Entity
+@Table(name = "USER_GROUP", schema = "")
+public class UserGroupEntity {
+    private final static Logger logger = LoggerFactory.getLogger(UserGroupEntity.class);
+    private String groupId;
+    private String domainId;
+    private String name;
+    private String description;
+    private String ownerId;
+    private String groupType;
+    private Long createdTime;
+    private Long updatedTime;
+
+    @Id
+    @Column(name = "GROUP_ID")
+    public String getGroupId() {
+        return groupId;
+    }
+
+    public void setGroupId(String groupId) {
+        this.groupId = groupId;
+    }
+
+    @Basic
+    @Column(name = "DOMAIN_ID")
+    public String getDomainId() {
+        return domainId;
+    }
+
+    public void setDomainId(String domainId) {
+        this.domainId = domainId;
+    }
+
+    @Basic
+    @Column(name = "OWNER_ID")
+    public String getOwnerId() {
+        return ownerId;
+    }
+
+    public void setOwnerId(String ownerId) {
+        this.ownerId = ownerId;
+    }
+
+    @Basic
+    @Column(name = "NAME")
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    @Basic
+    @Column(name = "DESCRIPTION")
+    public String getDescription() {
+        return description;
+    }
+
+    public void setDescription(String description) {
+        this.description = description;
+    }
+
+    @Basic
+    @Column(name = "GROUP_TYPE")
+    public String getGroupType() {
+        return groupType;
+    }
+
+    public void setGroupType(String type) {
+        this.groupType = type;
+    }
+
+    @Basic
+    @Column(name = "CREATED_TIME")
+    public Long getCreatedTime() {
+        return createdTime;
+    }
+
+    public void setCreatedTime(Long createdTime) {
+        this.createdTime = createdTime;
+    }
+
+    @Basic
+    @Column(name = "UPDATED_TIME")
+    public Long getUpdatedTime() {
+        return updatedTime;
+    }
+
+    public void setUpdatedTime(Long updatedTime) {
+        this.updatedTime = updatedTime;
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) return true;
+        if (o == null || getClass() != o.getClass()) return false;
+
+        UserGroupEntity that = (UserGroupEntity) o;
+
+        if (groupId != null ? !groupId.equals(that.groupId) : that.groupId != null) return false;
+        if (domainId != null ? !domainId.equals(that.domainId) : that.domainId != null) return false;
+        if (ownerId != null ? !ownerId.equals(that.ownerId) : that.ownerId != null) return false;
+        if (name != null ? !name.equals(that.name) : that.name != null) return false;
+        if (description != null ? !description.equals(that.description) : that.description != null) return false;
+        if (groupType != null ? !groupType.equals(that.groupType) : that.groupType != null) return false;
+        if (createdTime != null ? !createdTime.equals(that.createdTime) : that.createdTime != null) return false;
+        if (updatedTime != null ? !updatedTime.equals(that.updatedTime) : that.updatedTime != null) return false;
+
+        return true;
+    }
+
+    @Override
+    public int hashCode() {
+        int result = groupId != null ? groupId.hashCode() : 0;
+        result = 31 * result + (name != null ? name.hashCode() : 0);
+        result = 31 * result + (description != null ? description.hashCode() : 0);
+        result = 31 * result + (groupType != null ? groupType.hashCode() : 0);
+        result = 31 * result + (createdTime != null ? createdTime.hashCode() : 0);
+        result = 31 * result + (updatedTime != null ? updatedTime.hashCode() : 0);
+        return result;
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/43f228fc/modules/sharing-registry/sharing-registry-core/src/main/java/org/apache/airavata/sharing/registry/db/repositories/AbstractRepository.java
----------------------------------------------------------------------
diff --git a/modules/sharing-registry/sharing-registry-core/src/main/java/org/apache/airavata/sharing/registry/db/repositories/AbstractRepository.java b/modules/sharing-registry/sharing-registry-core/src/main/java/org/apache/airavata/sharing/registry/db/repositories/AbstractRepository.java
new file mode 100644
index 0000000..1a95b97
--- /dev/null
+++ b/modules/sharing-registry/sharing-registry-core/src/main/java/org/apache/airavata/sharing/registry/db/repositories/AbstractRepository.java
@@ -0,0 +1,134 @@
+/*
+ *
+ * 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.airavata.sharing.registry.db.repositories;
+
+import org.apache.airavata.sharing.registry.db.utils.DBConstants;
+import org.apache.airavata.sharing.registry.db.utils.JPAUtils;
+import org.apache.airavata.sharing.registry.db.utils.ObjectMapperSingleton;
+import org.apache.airavata.sharing.registry.models.GovRegistryException;
+import org.dozer.Mapper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+public abstract class AbstractRepository<T, E, Id> {
+    private final static Logger logger = LoggerFactory.getLogger(AbstractRepository.class);
+
+    private Class<T> thriftGenericClass;
+    private Class<E> dbEntityGenericClass;
+
+    public AbstractRepository(Class<T> thriftGenericClass, Class<E> dbEntityGenericClass){
+        this.thriftGenericClass = thriftGenericClass;
+        this.dbEntityGenericClass = dbEntityGenericClass;
+    }
+
+    public T create(T t) throws GovRegistryException {
+        return update(t);
+    }
+
+    public List<T> create(List<T> tList) throws GovRegistryException {
+        return update(tList);
+    }
+
+    public  T update(T t) throws GovRegistryException {
+        Mapper mapper = ObjectMapperSingleton.getInstance();
+        E entity = mapper.map(t, dbEntityGenericClass);
+        E persistedCopy = JPAUtils.execute(entityManager -> entityManager.merge(entity));
+        return mapper.map(persistedCopy, thriftGenericClass);
+    }
+
+    public  List<T> update(List<T> tList) throws GovRegistryException {
+        List<T> returnList = new ArrayList<>();
+        for(T temp : tList)
+            returnList.add(update(temp));
+        return returnList;
+    }
+
+    public boolean delete(Id id) throws GovRegistryException {
+        JPAUtils.execute(entityManager -> {
+            E entity = entityManager.find(dbEntityGenericClass, id);
+            entityManager.remove(entity);
+            return entity;
+        });
+        return true;
+    }
+
+    public boolean delete(List<Id> idList) throws GovRegistryException {
+        for(Id id : idList)
+            delete(id);
+        return true;
+    }
+
+    public T get(Id id) throws GovRegistryException {
+        E entity = JPAUtils.execute(entityManager -> entityManager
+                .find(dbEntityGenericClass, id));
+        Mapper mapper = ObjectMapperSingleton.getInstance();
+        if(entity == null)
+            return null;
+        return mapper.map(entity, thriftGenericClass);
+    }
+
+    public List<T> get(List<Id> idList) throws GovRegistryException {
+        List<T> returnList = new ArrayList<>();
+        for(Id id : idList)
+            returnList.add(get(id));
+        return returnList;
+    }
+
+    public List<T> select(Map<String, String> filters, int offset, int limit) throws GovRegistryException {
+        String queryString = getSelectQuery(filters);
+        int newLimit = limit < 0 ? DBConstants.SELECT_MAX_ROWS: limit;
+        List resultSet = JPAUtils.execute(entityManager -> entityManager.createQuery(queryString).setFirstResult(offset)
+                .setMaxResults(newLimit).getResultList());
+        Mapper mapper = ObjectMapperSingleton.getInstance();
+        List<T> gatewayList = new ArrayList<>();
+        resultSet.stream().forEach(rs -> gatewayList.add(mapper.map(rs, thriftGenericClass)));
+        return gatewayList;
+    }
+
+    public List<T> select(String queryString, int offset, int limit) throws GovRegistryException {
+        int newLimit = limit < 0 ? DBConstants.SELECT_MAX_ROWS: limit;
+        List resultSet = JPAUtils.execute(entityManager -> entityManager.createQuery(queryString).setFirstResult(offset)
+                .setMaxResults(newLimit).getResultList());
+        Mapper mapper = ObjectMapperSingleton.getInstance();
+        List<T> gatewayList = new ArrayList<>();
+        resultSet.stream().forEach(rs -> gatewayList.add(mapper.map(rs, thriftGenericClass)));
+        return gatewayList;
+    }
+
+    private String getSelectQuery(Map<String, String> filters){
+        String query = "SELECT p from " + dbEntityGenericClass.getSimpleName() + " as p";
+        if(filters != null && filters.size() != 0){
+            query += " WHERE ";
+            for(String k : filters.keySet()){
+                query += "p." + k + " = '" + filters.get(k) + "' AND ";
+            }
+            query = query.substring(0, query.length()-5);
+        }
+
+        query += " ORDER BY p.createdTime DESC";
+
+        return query;
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/43f228fc/modules/sharing-registry/sharing-registry-core/src/main/java/org/apache/airavata/sharing/registry/db/repositories/DomainRepository.java
----------------------------------------------------------------------
diff --git a/modules/sharing-registry/sharing-registry-core/src/main/java/org/apache/airavata/sharing/registry/db/repositories/DomainRepository.java b/modules/sharing-registry/sharing-registry-core/src/main/java/org/apache/airavata/sharing/registry/db/repositories/DomainRepository.java
new file mode 100644
index 0000000..8cd44ef
--- /dev/null
+++ b/modules/sharing-registry/sharing-registry-core/src/main/java/org/apache/airavata/sharing/registry/db/repositories/DomainRepository.java
@@ -0,0 +1,34 @@
+/*
+ *
+ * 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.airavata.sharing.registry.db.repositories;
+
+import org.apache.airavata.sharing.registry.db.entities.DomainEntity;
+import org.apache.airavata.sharing.registry.models.Domain;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class DomainRepository extends AbstractRepository<Domain, DomainEntity, String> {
+    private final static Logger logger = LoggerFactory.getLogger(DomainRepository.class);
+
+    public DomainRepository(){
+        super(Domain.class, DomainEntity.class);
+    }
+}
\ No newline at end of file


Mime
View raw message