You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by sh...@apache.org on 2016/12/13 15:54:42 UTC

[1/5] airavata git commit: migrating user-profile service and new registry components to develop branch

Repository: airavata
Updated Branches:
  refs/heads/develop 4d5b61ce9 -> 49afd997f


http://git-wip-us.apache.org/repos/asf/airavata/blob/d9a69ae5/modules/user-profile/user-profile-stubs/src/main/java/org/apache/airavata/userprofile/crude/cpi/client/UserProfileServiceClientFactory.java
----------------------------------------------------------------------
diff --git a/modules/user-profile/user-profile-stubs/src/main/java/org/apache/airavata/userprofile/crude/cpi/client/UserProfileServiceClientFactory.java b/modules/user-profile/user-profile-stubs/src/main/java/org/apache/airavata/userprofile/crude/cpi/client/UserProfileServiceClientFactory.java
new file mode 100644
index 0000000..536d43c
--- /dev/null
+++ b/modules/user-profile/user-profile-stubs/src/main/java/org/apache/airavata/userprofile/crude/cpi/client/UserProfileServiceClientFactory.java
@@ -0,0 +1,43 @@
+/*
+ *
+ * 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.userprofile.crude.cpi.client;
+
+import org.apache.airavata.registry.api.exception.RegistryServiceException;
+import org.apache.airavata.userprofile.crude.cpi.UserProfileCrudeService;
+import org.apache.thrift.protocol.TBinaryProtocol;
+import org.apache.thrift.protocol.TProtocol;
+import org.apache.thrift.transport.TSocket;
+import org.apache.thrift.transport.TTransport;
+import org.apache.thrift.transport.TTransportException;
+
+
+public class UserProfileServiceClientFactory {
+    public static UserProfileCrudeService.Client createRegistryClient(String serverHost, int serverPort)  throws RegistryServiceException {
+        try {
+            TTransport transport = new TSocket(serverHost, serverPort);
+            transport.open();
+            TProtocol protocol = new TBinaryProtocol(transport);
+            return new UserProfileCrudeService.Client(protocol);
+        } catch (TTransportException e) {
+            throw new RegistryServiceException();
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/d9a69ae5/modules/user-profile/user-profile-stubs/src/main/java/org/apache/airavata/userprofile/crude/cpi/user_profile_crud_cpiConstants.java
----------------------------------------------------------------------
diff --git a/modules/user-profile/user-profile-stubs/src/main/java/org/apache/airavata/userprofile/crude/cpi/user_profile_crud_cpiConstants.java b/modules/user-profile/user-profile-stubs/src/main/java/org/apache/airavata/userprofile/crude/cpi/user_profile_crud_cpiConstants.java
new file mode 100644
index 0000000..2dcfd0e
--- /dev/null
+++ b/modules/user-profile/user-profile-stubs/src/main/java/org/apache/airavata/userprofile/crude/cpi/user_profile_crud_cpiConstants.java
@@ -0,0 +1,41 @@
+/**
+ * Autogenerated by Thrift Compiler (0.9.3)
+ *
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ *  @generated
+ */
+package org.apache.airavata.userprofile.crude.cpi;
+
+import org.apache.thrift.scheme.IScheme;
+import org.apache.thrift.scheme.SchemeFactory;
+import org.apache.thrift.scheme.StandardScheme;
+
+import org.apache.thrift.scheme.TupleScheme;
+import org.apache.thrift.protocol.TTupleProtocol;
+import org.apache.thrift.protocol.TProtocolException;
+import org.apache.thrift.EncodingUtils;
+import org.apache.thrift.TException;
+import org.apache.thrift.async.AsyncMethodCallback;
+import org.apache.thrift.server.AbstractNonblockingServer.*;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.EnumMap;
+import java.util.Set;
+import java.util.HashSet;
+import java.util.EnumSet;
+import java.util.Collections;
+import java.util.BitSet;
+import java.nio.ByteBuffer;
+import java.util.Arrays;
+import javax.annotation.Generated;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"})
+public class user_profile_crud_cpiConstants {
+
+  public static final String USER_PROFILE_CPI_VERSION = "0.16.0";
+
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/d9a69ae5/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index b6f9969..f00aa4b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -635,6 +635,7 @@
                 <module>modules/test-suite</module>
                 <module>modules/sharing-registry</module>
                 <module>modules/cluster-monitoring</module>
+                <module>modules/registry-refactoring</module>
                 <!-- Deprecated Modules-->
                 <!--<module>modules/integration-tests</module>-->
                 <!--<module>modules/workflow-model</module>-->


[5/5] airavata git commit: adding the user-profile migration module to develop branch

Posted by sh...@apache.org.
adding the user-profile migration module to develop branch


Project: http://git-wip-us.apache.org/repos/asf/airavata/repo
Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/49afd997
Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/49afd997
Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/49afd997

Branch: refs/heads/develop
Commit: 49afd997f2f30ccabb83a30059f0e4483553a640
Parents: d9a69ae
Author: Anuj Bhandar <bh...@gmail.com>
Authored: Mon Dec 12 15:51:57 2016 -0500
Committer: Anuj Bhandar <bh...@gmail.com>
Committed: Mon Dec 12 15:51:57 2016 -0500

----------------------------------------------------------------------
 modules/user-profile-migration/pom.xml          | 102 ++++++++++++++
 .../apache/airavata/ISLoginCredentialsDAO.java  |  59 ++++++++
 .../apache/airavata/IdentityServerClient.java   | 118 ++++++++++++++++
 .../org/apache/airavata/MigrationManager.java   | 141 +++++++++++++++++++
 .../UserProfileAiravataThriftClient.java        |  45 ++++++
 .../org/apache/airavata/UserProfileDAO.java     | 120 ++++++++++++++++
 pom.xml                                         |   1 +
 7 files changed, 586 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/49afd997/modules/user-profile-migration/pom.xml
----------------------------------------------------------------------
diff --git a/modules/user-profile-migration/pom.xml b/modules/user-profile-migration/pom.xml
new file mode 100644
index 0000000..faf0121
--- /dev/null
+++ b/modules/user-profile-migration/pom.xml
@@ -0,0 +1,102 @@
+<?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">
+    <parent>
+        <artifactId>airavata</artifactId>
+        <groupId>org.apache.airavata</groupId>
+        <version>0.17-SNAPSHOT</version>
+        <relativePath>../../pom.xml</relativePath>
+    </parent>
+
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>user-profile-migration</artifactId>
+
+    <repositories>
+        <repository>
+            <id>wso2-maven2-repository</id>
+            <url>http://dist.wso2.org/maven2</url>
+        </repository>
+        <repository>
+            <id>apache-maven2-repo</id>
+            <name>Apache Maven2 Repository</name>
+            <url>http://repo1.maven.org/maven2/</url>
+        </repository>
+    </repositories>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.axis2.wso2</groupId>
+            <artifactId>axis2</artifactId>
+            <version>1.6.1.wso2v1</version>
+        </dependency>
+        <dependency>
+            <groupId>org.wso2.securevault</groupId>
+            <artifactId>org.wso2.securevault</artifactId>
+            <version>1.0.0</version>
+        </dependency>
+        <dependency>
+            <groupId>commons-httpclient</groupId>
+            <artifactId>commons-httpclient</artifactId>
+            <version>3.1</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.httpcomponents</groupId>
+            <artifactId>httpclient</artifactId>
+            <version>4.0.1</version>
+        </dependency>
+        <dependency>
+            <groupId>org.wso2.carbon</groupId>
+            <artifactId>org.wso2.carbon.um.ws.api.stub</artifactId>
+            <version>4.0.2</version>
+        </dependency>
+        <!-- https://mvnrepository.com/artifact/mysql/mysql-connector-java -->
+        <dependency>
+            <groupId>mysql</groupId>
+            <artifactId>mysql-connector-java</artifactId>
+            <version>5.1.6</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.airavata</groupId>
+            <artifactId>user-profile-stubs</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.airavata</groupId>
+            <artifactId>airavata-commons</artifactId>
+            <version>0.17-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.airavata</groupId>
+            <artifactId>airavata-data-models</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <sourceDirectory>src/main/java</sourceDirectory>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-compiler-plugin</artifactId>
+                <inherited>true</inherited>
+                <version>2.0</version>
+                <configuration>
+                    <source>1.6</source>
+                    <target>1.6</target>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+
+
+</project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/49afd997/modules/user-profile-migration/src/main/java/org/apache/airavata/ISLoginCredentialsDAO.java
----------------------------------------------------------------------
diff --git a/modules/user-profile-migration/src/main/java/org/apache/airavata/ISLoginCredentialsDAO.java b/modules/user-profile-migration/src/main/java/org/apache/airavata/ISLoginCredentialsDAO.java
new file mode 100644
index 0000000..871f823
--- /dev/null
+++ b/modules/user-profile-migration/src/main/java/org/apache/airavata/ISLoginCredentialsDAO.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;
+
+public class ISLoginCredentialsDAO {
+    public String getGateway() {
+        return Gateway;
+    }
+
+    public void setGateway(String gateway) {
+        Gateway = gateway;
+    }
+
+    public String getLoginUserName() {
+        return loginUserName;
+    }
+
+    public void setLoginUserName(String loginUserName) {
+        this.loginUserName = loginUserName;
+    }
+
+    public String getLoginPassword() {
+        return loginPassword;
+    }
+
+    public void setLoginPassword(String loginPassword) {
+        this.loginPassword = loginPassword;
+    }
+
+    private String Gateway;
+    private String loginUserName;
+    private String loginPassword;
+
+    public ISLoginCredentialsDAO(String gateway, String loginUserName, String loginPassword) {
+        Gateway = gateway;
+        this.loginUserName = loginUserName;
+        this.loginPassword = loginPassword;
+    }
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/49afd997/modules/user-profile-migration/src/main/java/org/apache/airavata/IdentityServerClient.java
----------------------------------------------------------------------
diff --git a/modules/user-profile-migration/src/main/java/org/apache/airavata/IdentityServerClient.java b/modules/user-profile-migration/src/main/java/org/apache/airavata/IdentityServerClient.java
new file mode 100644
index 0000000..c8cd0a0
--- /dev/null
+++ b/modules/user-profile-migration/src/main/java/org/apache/airavata/IdentityServerClient.java
@@ -0,0 +1,118 @@
+package org.apache.airavata;
+
+import org.apache.axis2.client.Options;
+import org.apache.axis2.client.ServiceClient;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.context.ConfigurationContextFactory;
+import org.apache.axis2.transport.http.HTTPConstants;
+import org.apache.axis2.transport.http.HttpTransportProperties;
+import org.wso2.carbon.um.ws.api.stub.RemoteUserStoreManagerServiceStub;
+
+import java.io.File;
+
+/*
+ *
+ * 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.
+ *
+ */
+
+
+public class IdentityServerClient {
+    /**
+     * Server url of the WSO2 Carbon Server
+     */
+    private static String SEVER_URL = "URL for Identity server";
+
+
+    public static RemoteUserStoreManagerServiceStub getAdminServiceClient(String adminUserName, String adminPassword, String adminService){
+
+        /**
+         * trust store path.  this must contains server's  certificate or Server's CA chain
+         */
+
+        /* The below code snippet is intentionally commented for the build to pass,
+         * because the private key and certificate file are not committed to GitHub,
+         * which are needed to run the client */
+
+//        String trustStore = System.getProperty("user.dir") + File.separator +
+//                "modules" + File.separator + "user-profile-migration" + File.separator +
+//                "src" + File.separator + "main" + File.separator +
+//                "resources" + File.separator + "wso2carbon.jks";
+//        System.out.println("file path : " + trustStore);
+//
+//        /**
+//         * Call to https://localhost:9443/services/   uses HTTPS protocol.
+//         * Therefore we to validate the server certificate or CA chain. The server certificate is looked up in the
+//         * trust store.
+//         * Following code sets what trust-store to look for and its JKs password.
+//         */
+//
+//        System.setProperty("javax.net.ssl.trustStore",  trustStore );
+//
+//        System.setProperty("javax.net.ssl.trustStorePassword", "wso2carbon");
+
+        /**
+         * Axis2 configuration context
+         */
+        ConfigurationContext configContext;
+        RemoteUserStoreManagerServiceStub adminStub;
+
+        try {
+
+            /**
+             * Create a configuration context. A configuration context contains information for
+             * axis2 environment. This is needed to create an axis2 service client
+             */
+            configContext = ConfigurationContextFactory.createConfigurationContextFromFileSystem(null, null);
+
+            /**
+             * end point url with service name
+             */
+//            String serviceEndPoint = SEVER_URL + "RemoteUserStoreManagerService";
+            String serviceEndPoint = SEVER_URL + adminService;
+
+            /**
+             * create stub and service client
+             */
+            adminStub = new RemoteUserStoreManagerServiceStub(configContext, serviceEndPoint);
+            ServiceClient client = adminStub._getServiceClient();
+            Options option = client.getOptions();
+
+            /**
+             * Setting a authenticated cookie that is received from Carbon server.
+             * If you have authenticated with Carbon server earlier, you can use that cookie, if
+             * it has not been expired
+             */
+            option.setProperty(HTTPConstants.COOKIE_STRING, null);
+
+            /**
+             * Setting basic auth headers for authentication for carbon server
+             */
+            HttpTransportProperties.Authenticator auth = new HttpTransportProperties.Authenticator();
+            auth.setUsername(adminUserName);
+            auth.setPassword(adminPassword);
+            auth.setPreemptiveAuthentication(true);
+            option.setProperty(HTTPConstants.AUTHENTICATE, auth);
+            option.setManageSession(true);
+            return adminStub;
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return null;
+    }
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/49afd997/modules/user-profile-migration/src/main/java/org/apache/airavata/MigrationManager.java
----------------------------------------------------------------------
diff --git a/modules/user-profile-migration/src/main/java/org/apache/airavata/MigrationManager.java b/modules/user-profile-migration/src/main/java/org/apache/airavata/MigrationManager.java
new file mode 100644
index 0000000..a5161cd
--- /dev/null
+++ b/modules/user-profile-migration/src/main/java/org/apache/airavata/MigrationManager.java
@@ -0,0 +1,141 @@
+/*
+ *
+ * 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;
+
+import org.apache.airavata.common.exception.ApplicationSettingsException;
+import org.apache.airavata.model.user.UserProfile;
+import org.apache.airavata.userprofile.crude.cpi.UserProfileCrudeService;
+import org.apache.thrift.TException;
+import org.wso2.carbon.um.ws.api.stub.ClaimValue;
+import org.wso2.carbon.um.ws.api.stub.RemoteUserStoreManagerServiceStub;
+import org.wso2.carbon.um.ws.api.stub.RemoteUserStoreManagerServiceUserStoreExceptionException;
+
+import java.rmi.RemoteException;
+import java.util.ArrayList;
+import java.util.List;
+
+public class MigrationManager {
+
+    private ArrayList<ISLoginCredentialsDAO> adminCredentials = new ArrayList<ISLoginCredentialsDAO>();
+
+    /*Add the credentials for all the tenants from which the profile should be migrated to Airavata DB*/
+
+    public void setISLoginCredentials(){
+        adminCredentials.add(new ISLoginCredentialsDAO("prod.seagrid","UserName","Password"));
+        // new credential records here...
+    }
+
+    /* Method used to fetch all the user profiles from the registered tenants */
+
+    public List<UserProfileDAO> getUserProfilesFromIS(){
+        ArrayList<UserProfileDAO> userProfileList = new ArrayList<UserProfileDAO>();
+        for(ISLoginCredentialsDAO creds:adminCredentials){
+            RemoteUserStoreManagerServiceStub isClient = IdentityServerClient.getAdminServiceClient(creds.getLoginUserName(),creds.getLoginPassword(),"RemoteUserStoreManagerService");
+            String[] userList;
+            System.out.println("Fetching User Profiles for " + creds.getGateway() + " tenant ...");
+            try {
+                userList = isClient.getUserList("http://wso2.org/claims/givenname", "*", "default");
+                System.out.println("FirstName\tLastName\tEmail\t\t\tuserName\tCountry\tOrganization\tphone");
+                String[] claims = {"http://wso2.org/claims/givenname",
+                                    "http://wso2.org/claims/lastname",
+                                    "http://wso2.org/claims/emailaddress",
+                                    "http://wso2.org/claims/country",
+                                    "http://wso2.org/claims/organization",
+                                    "http://wso2.org/claims/mobile",
+                                    "http://wso2.org/claims/telephone",
+                                    "http://wso2.org/claims/streetaddress"};
+                for (String user : userList) {
+                    UserProfileDAO userProfile = new UserProfileDAO();
+                    ClaimValue[] retrievedClaimValues = isClient.getUserClaimValuesForClaims(user, claims, null);
+                    List<String> phones = new ArrayList<String>();
+                    for(ClaimValue claim:retrievedClaimValues){
+                        if(claim.getClaimURI().equals(claims[0])){
+                            userProfile.setFirstName(claim.getValue());
+                        }else if(claim.getClaimURI().equals(claims[1])){
+                            userProfile.setLastName(claim.getValue());
+                        }else if(claim.getClaimURI().equals(claims[2])){
+                            userProfile.setEmail(claim.getValue());
+                        }else if(claim.getClaimURI().equals(claims[3])){
+                            userProfile.setCountry(claim.getValue());
+                        }else if(claim.getClaimURI().equals(claims[4])){
+                            userProfile.setOrganization(claim.getValue());
+                        }else if(claim.getClaimURI().equals(claims[5]) || claim.getClaimURI().equals(claims[6])){
+                            phones.add(claim.getValue());
+                        } else if(claim.getClaimURI().equals(claims[7])){
+                            userProfile.setAddress(claim.getValue());
+                        }
+                    }
+                    userProfile.setUserName(user);
+                    userProfile.setGatewayID(creds.getGateway());
+                    userProfile.setPhones(phones);
+                    System.out.println(userProfile.getFirstName()+"\t"+userProfile.getLastName()+"\t"+userProfile.getUserName()+"\t"+userProfile.getEmail()+"\t"+userProfile.getCountry()+"\t"+userProfile.getOrganization() + userProfile.getAddress());
+                    userProfileList.add(userProfile);
+                }
+            } catch (RemoteException e) {
+                System.out.println(e.getMessage());
+                System.out.println(e.getCause());
+                e.printStackTrace();
+            } catch (RemoteUserStoreManagerServiceUserStoreExceptionException e) {
+                System.out.println(e.getMessage());
+                System.out.println(e.getCause());
+                e.printStackTrace();
+            }
+        }
+        System.out.println("User profiles from all the tenant are retrieved ...");
+        return userProfileList;
+    }
+
+    /* Method used to migrate User profiles to Airavata DB by making a call to User profile thrift Service */
+    private boolean migrateUserProfilesToAiravata(List<UserProfileDAO> ISProfileList) throws TException, ApplicationSettingsException {
+        System.out.println("Initiating migration to Airavata internal DB ...");
+        UserProfileAiravataThriftClient objFactory = new UserProfileAiravataThriftClient();
+        UserProfileCrudeService.Client client = objFactory.getRegistryServiceClient();
+        UserProfile airavataUserProfile = new UserProfile();
+        // Here are the data associations...
+        for(UserProfileDAO ISProfile : ISProfileList){
+            airavataUserProfile.setUserName(ISProfile.getFirstName()+" "+ISProfile.getLastName());
+            airavataUserProfile.setUserId(ISProfile.getUserName());
+            airavataUserProfile.setGatewayId(ISProfile.getGatewayID());
+            List<String> emails = new ArrayList<String>();
+            emails.add(ISProfile.getEmail());
+            airavataUserProfile.setEmails(emails);
+            airavataUserProfile.setHomeOrganization(ISProfile.getOrganization());
+            airavataUserProfile.setPhones(ISProfile.getPhones());
+            airavataUserProfile.setCountry(ISProfile.getCountry());
+            client.addUserProfile(airavataUserProfile);
+        }
+        return false;
+    }
+
+    public static void main(String[] args) {
+        MigrationManager migrationManager = new MigrationManager();
+        migrationManager.setISLoginCredentials();
+        List<UserProfileDAO> userProfileList = migrationManager.getUserProfilesFromIS();
+        try {
+            migrationManager.migrateUserProfilesToAiravata(userProfileList);
+        } catch (TException e) {
+            e.printStackTrace();
+        } catch (ApplicationSettingsException e) {
+            e.printStackTrace();
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/49afd997/modules/user-profile-migration/src/main/java/org/apache/airavata/UserProfileAiravataThriftClient.java
----------------------------------------------------------------------
diff --git a/modules/user-profile-migration/src/main/java/org/apache/airavata/UserProfileAiravataThriftClient.java b/modules/user-profile-migration/src/main/java/org/apache/airavata/UserProfileAiravataThriftClient.java
new file mode 100644
index 0000000..9e5568f
--- /dev/null
+++ b/modules/user-profile-migration/src/main/java/org/apache/airavata/UserProfileAiravataThriftClient.java
@@ -0,0 +1,45 @@
+/*
+ *
+ * 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;
+
+import org.apache.airavata.common.exception.ApplicationSettingsException;
+import org.apache.airavata.common.utils.ServerSettings;
+import org.apache.airavata.registry.api.exception.RegistryServiceException;
+import org.apache.airavata.userprofile.crude.cpi.UserProfileCrudeService;
+import org.apache.airavata.userprofile.crude.cpi.client.UserProfileServiceClientFactory;
+import org.apache.thrift.TException;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class UserProfileAiravataThriftClient {
+
+    public UserProfileCrudeService.Client getRegistryServiceClient() throws TException, ApplicationSettingsException {
+        final int serverPort = Integer.parseInt(ServerSettings.getRegistryServerPort());
+        final String serverHost = ServerSettings.getRegistryServerHost();
+        try {
+            return UserProfileServiceClientFactory.createRegistryClient(serverHost, serverPort);
+        } catch (RegistryServiceException e) {
+            throw new TException("Unable to create registry client...", e);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/49afd997/modules/user-profile-migration/src/main/java/org/apache/airavata/UserProfileDAO.java
----------------------------------------------------------------------
diff --git a/modules/user-profile-migration/src/main/java/org/apache/airavata/UserProfileDAO.java b/modules/user-profile-migration/src/main/java/org/apache/airavata/UserProfileDAO.java
new file mode 100644
index 0000000..1edb7cf
--- /dev/null
+++ b/modules/user-profile-migration/src/main/java/org/apache/airavata/UserProfileDAO.java
@@ -0,0 +1,120 @@
+/*
+ *
+ * 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;
+
+import java.util.List;
+
+public class UserProfileDAO {
+    private String firstName;
+    private String lastName;
+    private String middleInitials;
+    private String userName;
+    private String email;
+    private String country;
+    private String organization;
+    private List<String> Phones;
+    private String gatewayID;
+    private String address;
+
+    public String getAddress() {
+        return address;
+    }
+
+    public void setAddress(String address) {
+        this.address = address;
+    }
+
+
+    public List<String> getPhones() {
+        return Phones;
+    }
+
+    public void setPhones(List<String> phones) {
+        Phones = phones;
+    }
+
+    public String getGatewayID() {
+        return gatewayID;
+    }
+
+    public void setGatewayID(String gatewayID) {
+        this.gatewayID = gatewayID;
+    }
+
+    public String getCountry() {
+        return country;
+    }
+
+    public void setCountry(String country) {
+        this.country = country;
+    }
+
+    public String getOrganization() {
+        return organization;
+    }
+
+    public void setOrganization(String organization) {
+        this.organization = organization;
+    }
+
+
+
+    public String getFirstName() {
+        return firstName;
+    }
+
+    public void setFirstName(String firstName) {
+        this.firstName = firstName;
+    }
+
+    public String getLastName() {
+        return lastName;
+    }
+
+    public void setLastName(String lastName) {
+        this.lastName = lastName;
+    }
+
+    public String getMiddleInitials() {
+        return middleInitials;
+    }
+
+    public void setMiddleInitials(String middleInitials) {
+        this.middleInitials = middleInitials;
+    }
+
+    public String getUserName() {
+        return userName;
+    }
+
+    public void setUserName(String userName) {
+        this.userName = userName;
+    }
+
+    public String getEmail() {
+        return email;
+    }
+
+    public void setEmail(String email) {
+        this.email = email;
+    }
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/49afd997/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index f00aa4b..c019dce 100644
--- a/pom.xml
+++ b/pom.xml
@@ -636,6 +636,7 @@
                 <module>modules/sharing-registry</module>
                 <module>modules/cluster-monitoring</module>
                 <module>modules/registry-refactoring</module>
+                <module>modules/user-profile-migration</module>
                 <!-- Deprecated Modules-->
                 <!--<module>modules/integration-tests</module>-->
                 <!--<module>modules/workflow-model</module>-->


[3/5] airavata git commit: migrating user-profile service and new registry components to develop branch

Posted by sh...@apache.org.
http://git-wip-us.apache.org/repos/asf/airavata/blob/d9a69ae5/modules/user-profile/user-profile-core/src/main/java/org/apache/airavata/userprofile/core/AbstractThriftDeserializer.java
----------------------------------------------------------------------
diff --git a/modules/user-profile/user-profile-core/src/main/java/org/apache/airavata/userprofile/core/AbstractThriftDeserializer.java b/modules/user-profile/user-profile-core/src/main/java/org/apache/airavata/userprofile/core/AbstractThriftDeserializer.java
deleted file mode 100644
index 256b0e6..0000000
--- a/modules/user-profile/user-profile-core/src/main/java/org/apache/airavata/userprofile/core/AbstractThriftDeserializer.java
+++ /dev/null
@@ -1,151 +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.
- *
-*/
-package org.apache.airavata.userprofile.core;
-
-import com.fasterxml.jackson.core.JsonParser;
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.databind.*;
-import com.fasterxml.jackson.databind.node.JsonNodeType;
-import com.fasterxml.jackson.databind.node.ObjectNode;
-import com.fasterxml.jackson.databind.type.TypeFactory;
-import com.google.common.base.CaseFormat;
-import org.apache.thrift.TBase;
-import org.apache.thrift.TException;
-import org.apache.thrift.TFieldIdEnum;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.IOException;
-import java.lang.reflect.Field;
-import java.lang.reflect.ParameterizedType;
-import java.util.Iterator;
-import java.util.Map;
-
-/**
- * This abstract class represents a generic de-serializer for converting JSON to Thrift-based entities.
- *
- * @param <E> An implementation of the {@link org.apache.thrift.TFieldIdEnum} interface.
- * @param <T> An implementation of the {@link org.apache.thrift.TBase} interface.
- */
-public abstract class AbstractThriftDeserializer<E extends TFieldIdEnum, T extends TBase<T, E>> extends JsonDeserializer<T> {
-
-    private static Logger log = LoggerFactory.getLogger(AbstractThriftDeserializer.class);
-
-    @Override
-    public T deserialize(final JsonParser jp, final DeserializationContext ctxt) throws IOException, JsonProcessingException {
-        final T instance = newInstance();
-        final ObjectMapper mapper = (ObjectMapper)jp.getCodec();
-        final ObjectNode rootNode = (ObjectNode)mapper.readTree(jp);
-        final Iterator<Map.Entry<String, JsonNode>> iterator = rootNode.fields();
-
-        while(iterator.hasNext()) {
-            final Map.Entry<String, JsonNode> currentField = iterator.next();
-            try {
-                /*
-                 * If the current node is not a null value, process it.  Otherwise,
-                 * skip it.  Jackson will treat the null as a 0 for primitive
-                 * number types, which in turn will make Thrift think the field
-                 * has been set. Also we ignore the MongoDB specific _id field
-                 */
-                if(!currentField.getKey().equalsIgnoreCase("_id")
-                        && currentField.getValue().getNodeType() != JsonNodeType.NULL) {
-                    final E field = getField(CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.UPPER_UNDERSCORE, currentField.getKey()));
-                    final JsonParser parser = currentField.getValue().traverse();
-                    parser.setCodec(mapper);
-                    final Object value = mapper.readValue(parser, generateValueType(instance, field));
-                    if(value != null) {
-                        log.debug(String.format("Field %s produced value %s of type %s.",
-                                currentField.getKey(), value, value.getClass().getName()));
-                        instance.setFieldValue(field, value);
-                    } else {
-                        log.debug("Field {} contains a null value.  Skipping...", currentField.getKey());
-                    }
-                } else {
-                    log.debug("Field {} contains a null value.  Skipping...", currentField.getKey());
-                }
-            } catch (final NoSuchFieldException | IllegalArgumentException e) {
-                log.error("Unable to de-serialize field '{}'.", currentField.getKey(), e);
-                ctxt.mappingException(e.getMessage());
-            }
-        }
-
-        try {
-            // Validate that the instance contains all required fields.
-            validate(instance);
-        } catch (final TException e) {
-            log.error("Unable to deserialize JSON {} to type {} : error: {}", jp.getValueAsString(), instance.getClass().getName(), e.getMessage());
-            ctxt.mappingException(e.getMessage());
-        }
-
-        return instance;
-    }
-
-    /**
-     * Returns the {@code <E>} enumerated value that represents the target
-     * field in the Thrift entity referenced in the JSON document.
-     * @param fieldName The name of the Thrift entity target field.
-     * @return The {@code <E>} enumerated value that represents the target
-     *   field in the Thrift entity referenced in the JSON document.
-     */
-    protected abstract E getField(String fieldName);
-
-    /**
-     * Creates a new instance of the Thrift entity class represented by this deserializer.
-     * @return A new instance of the Thrift entity class represented by this deserializer.
-     */
-    protected abstract T newInstance();
-
-    /**
-     * Validates that the Thrift entity instance contains all required fields after deserialization.
-     * @param instance A Thrift entity instance.
-     * @throws org.apache.thrift.TException if unable to validate the instance.
-     */
-    protected abstract void validate(T instance) throws TException;
-
-    /**
-     * Generates a {@link JavaType} that matches the target Thrift field represented by the provided
-     * {@code <E>} enumerated value.  If the field's type includes generics, the generics will
-     * be added to the generated {@link JavaType} to support proper conversion.
-     * @param thriftInstance The Thrift-generated class instance that will be converted to/from JSON.
-     * @param field A {@code <E>} enumerated value that represents a field in a Thrift-based entity.
-     * @return The {@link JavaType} representation of the type associated with the field.
-     * @throws NoSuchFieldException if unable to determine the field's type.
-     * @throws SecurityException if unable to determine the field's type.
-     */
-    protected JavaType generateValueType(final T thriftInstance, final E field) throws NoSuchFieldException, SecurityException {
-        final TypeFactory typeFactory = TypeFactory.defaultInstance();
-
-        final Field declaredField = thriftInstance.getClass().getDeclaredField(field.getFieldName());
-        if(declaredField.getType().equals(declaredField.getGenericType())) {
-            log.debug("Generating JavaType for type '{}'.", declaredField.getType());
-            return typeFactory.constructType(declaredField.getType());
-        } else {
-            final ParameterizedType type = (ParameterizedType)declaredField.getGenericType();
-            final Class<?>[] parameterizedTypes = new Class<?>[type.getActualTypeArguments().length];
-            for(int i=0; i<type.getActualTypeArguments().length; i++) {
-                parameterizedTypes[i] = (Class<?>)type.getActualTypeArguments()[i];
-            }
-            log.debug("Generating JavaType for type '{}' with generics '{}'", declaredField.getType(), parameterizedTypes);
-            return typeFactory.constructParametricType(declaredField.getType(), parameterizedTypes);
-        }
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/airavata/blob/d9a69ae5/modules/user-profile/user-profile-core/src/main/java/org/apache/airavata/userprofile/core/AbstractThriftSerializer.java
----------------------------------------------------------------------
diff --git a/modules/user-profile/user-profile-core/src/main/java/org/apache/airavata/userprofile/core/AbstractThriftSerializer.java b/modules/user-profile/user-profile-core/src/main/java/org/apache/airavata/userprofile/core/AbstractThriftSerializer.java
deleted file mode 100644
index d9e19ab..0000000
--- a/modules/user-profile/user-profile-core/src/main/java/org/apache/airavata/userprofile/core/AbstractThriftSerializer.java
+++ /dev/null
@@ -1,122 +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.
- *
-*/
-package org.apache.airavata.userprofile.core;
-
-import com.fasterxml.jackson.core.JsonGenerator;
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.databind.JsonSerializer;
-import com.fasterxml.jackson.databind.SerializerProvider;
-import com.google.common.base.CaseFormat;
-import org.apache.thrift.TBase;
-import org.apache.thrift.TFieldIdEnum;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.IOException;
-import java.util.Collection;
-
-/**
- * This abstract class represents a generic serializer for converting Thrift-based entities
- * to JSON.
- *
- * @param <E> An implementation of the {@link org.apache.thrift.TFieldIdEnum} interface.
- * @param <T> An implementation of the {@link org.apache.thrift.TBase} interface.
- */
-public abstract class AbstractThriftSerializer<E extends TFieldIdEnum, T extends TBase<T, E>>
-        extends JsonSerializer<T> {
-
-    private static final Logger log = LoggerFactory.getLogger(AbstractThriftSerializer.class);
-
-    @Override
-    public Class<T> handledType() {
-        return getThriftClass();
-    }
-
-    @Override
-    public void serialize(final T value, final JsonGenerator jgen, final SerializerProvider provider)
-            throws IOException, JsonProcessingException {
-        jgen.writeStartObject();
-        for(final E field : getFieldValues()) {
-            if(value.isSet(field)) {
-                final Object fieldValue = value.getFieldValue(field);
-                if(fieldValue != null) {
-                    log.debug("Adding field {} to the JSON string...",
-                            CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE,field.getFieldName())
-                    );
-
-                    jgen.writeFieldName(CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE,field.getFieldName()));
-                    if(fieldValue instanceof Short) {
-                        jgen.writeNumber((Short)fieldValue);
-                    } else if(fieldValue instanceof Integer) {
-                        jgen.writeNumber((Integer)fieldValue);
-                    } else if(fieldValue instanceof Long) {
-                        jgen.writeNumber((Long)fieldValue);
-                    } else if(fieldValue instanceof Double) {
-                        jgen.writeNumber((Double)fieldValue);
-                    } else if(fieldValue instanceof Float) {
-                        jgen.writeNumber((Float)fieldValue);
-                    } else if(fieldValue instanceof Boolean) {
-                        jgen.writeBoolean((Boolean)fieldValue);
-                    } else if(fieldValue instanceof String) {
-                        jgen.writeString(fieldValue.toString());
-                    } else if(fieldValue instanceof Collection) {
-                        log.debug("Array opened for field {}.",
-                                CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE,field.getFieldName())
-                        );
-                        jgen.writeStartArray();
-                        for(final Object arrayObject : (Collection<?>)fieldValue) {
-                            jgen.writeObject(arrayObject);
-                        }
-                        jgen.writeEndArray();
-                        log.debug("Array closed for field {}.",
-                                CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE,field.getFieldName())
-                        );
-                    } else {
-                        jgen.writeObject(fieldValue);
-                    }
-                } else {
-                    log.debug("Skipping converting field {} to JSON:  value is null!",
-                            CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE,field.getFieldName())
-                    );
-                }
-            } else {
-                log.debug("Skipping converting field {} to JSON:  field has not been set!",
-                        CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE,field.getFieldName())
-                );
-            }
-        }
-        jgen.writeEndObject();
-    }
-
-    /**
-     * Returns an array of {@code <E>} enumerated values that represent the fields present in the
-     * Thrift class associated with this serializer.
-     * @return The array of {@code <E>} enumerated values that represent the fields present in the
-     *   Thrift class.
-     */
-    protected abstract E[] getFieldValues();
-
-    /**
-     * Returns the {@code <T>} implementation class associated with this serializer.
-     * @return The {@code <T>} implementation class
-     */
-    protected abstract Class<T> getThriftClass();
-}

http://git-wip-us.apache.org/repos/asf/airavata/blob/d9a69ae5/modules/user-profile/user-profile-core/src/main/java/org/apache/airavata/userprofile/core/ModelConversionHelper.java
----------------------------------------------------------------------
diff --git a/modules/user-profile/user-profile-core/src/main/java/org/apache/airavata/userprofile/core/ModelConversionHelper.java b/modules/user-profile/user-profile-core/src/main/java/org/apache/airavata/userprofile/core/ModelConversionHelper.java
deleted file mode 100644
index cae69a1..0000000
--- a/modules/user-profile/user-profile-core/src/main/java/org/apache/airavata/userprofile/core/ModelConversionHelper.java
+++ /dev/null
@@ -1,77 +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.
- *
-*/
-package org.apache.airavata.userprofile.core;
-
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.core.Version;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.module.SimpleModule;
-import org.apache.airavata.model.user.UserProfile;
-import org.apache.thrift.TBase;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.IOException;
-
-public class ModelConversionHelper {
-    private final static Logger logger = LoggerFactory.getLogger(ModelConversionHelper.class);
-    private ObjectMapper objectMapper;
-
-    public ModelConversionHelper(){
-        init();
-    }
-
-    /**
-     * Private method to register the custom serializers and deserializers
-     */
-    private void init() {
-        this.objectMapper = new ObjectMapper();
-        SimpleModule module = new SimpleModule("UserProfileModule",
-                new Version(1, 0, 0, null, null, null));
-
-        module.addSerializer(UserProfile.class, new UserProfileSerializer());
-        module.addDeserializer(UserProfile.class, new UserProfileDeserializer());
-
-        objectMapper.registerModule(module);
-    }
-
-    /**
-     * Method to serialize a thrift object to json
-     * @param object
-     * @return
-     * @throws JsonProcessingException
-     */
-    public String serializeObject(TBase object) throws JsonProcessingException {
-        String json = this.objectMapper.writeValueAsString(object);
-        return json;
-    }
-
-    /**
-     * Method to deserialize a json to the thrift object
-     * @param clz
-     * @param json
-     * @return
-     * @throws IOException
-     */
-    public TBase deserializeObject(Class<?> clz, String json) throws IOException {
-        return (TBase)this.objectMapper.readValue(json, clz);
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/d9a69ae5/modules/user-profile/user-profile-core/src/main/java/org/apache/airavata/userprofile/core/MongoUtil.java
----------------------------------------------------------------------
diff --git a/modules/user-profile/user-profile-core/src/main/java/org/apache/airavata/userprofile/core/MongoUtil.java b/modules/user-profile/user-profile-core/src/main/java/org/apache/airavata/userprofile/core/MongoUtil.java
deleted file mode 100644
index 3cd3598..0000000
--- a/modules/user-profile/user-profile-core/src/main/java/org/apache/airavata/userprofile/core/MongoUtil.java
+++ /dev/null
@@ -1,59 +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.
- *
-*/
-package org.apache.airavata.userprofile.core;
-
-import com.mongodb.DB;
-import com.mongodb.MongoClient;
-import org.apache.airavata.common.exception.ApplicationSettingsException;
-import org.apache.airavata.common.utils.ServerSettings;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class MongoUtil {
-    private final static Logger logger = LoggerFactory.getLogger(MongoUtil.class);
-
-    private static MongoClient mongoClient = null;
-    private static DB userProfileRegistry;
-    public static String USER_PROFILE_REGISTRY_NAME = "user-profile-registry";
-
-    public static MongoClient getMongoClient() throws ApplicationSettingsException {
-        if (mongoClient == null) {
-            String host = ServerSettings.getUserProfileMongodbHost();
-            int port = ServerSettings.getUserProfileMongodbPort();
-            mongoClient = new MongoClient(host, port);
-            logger.debug("New Mongo Client created with [" + host + "] and ["
-                    + port + "]");
-        }
-        return mongoClient;
-    }
-
-    public static DB getUserProfileRegistry() throws ApplicationSettingsException {
-        if (userProfileRegistry == null) {
-            userProfileRegistry = getMongoClient().getDB(USER_PROFILE_REGISTRY_NAME);
-        }
-        return userProfileRegistry;
-    }
-
-    public static void dropUserProfileRegistry() throws ApplicationSettingsException {
-        getMongoClient().dropDatabase(USER_PROFILE_REGISTRY_NAME);
-        logger.debug("Dropped User Profile Registry");
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/d9a69ae5/modules/user-profile/user-profile-core/src/main/java/org/apache/airavata/userprofile/core/UserProfileCPIImpl.java
----------------------------------------------------------------------
diff --git a/modules/user-profile/user-profile-core/src/main/java/org/apache/airavata/userprofile/core/UserProfileCPIImpl.java b/modules/user-profile/user-profile-core/src/main/java/org/apache/airavata/userprofile/core/UserProfileCPIImpl.java
deleted file mode 100644
index 991f193..0000000
--- a/modules/user-profile/user-profile-core/src/main/java/org/apache/airavata/userprofile/core/UserProfileCPIImpl.java
+++ /dev/null
@@ -1,79 +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.
- *
-*/
-package org.apache.airavata.userprofile.core;
-
-import org.apache.airavata.model.user.UserProfile;
-import org.apache.airavata.userprofile.cpi.UserProfileCPI;
-import org.apache.airavata.userprofile.cpi.UserProfileException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.List;
-import java.util.UUID;
-
-public class UserProfileCPIImpl implements UserProfileCPI {
-    private final static Logger logger = LoggerFactory.getLogger(UserProfileCPIImpl.class);
-
-    private UserProfileDao userProfileDao;
-
-    public UserProfileCPIImpl() throws UserProfileException {
-        userProfileDao = new UserProfileDao();
-    }
-
-    @Override
-    public List<UserProfile> getAllUserProfilesInGateway(String gatewayId) throws UserProfileException {
-        return userProfileDao.getAllUserProfilesInGateway(gatewayId);
-    }
-
-    @Override
-    public String createUserProfile(UserProfile userProfile) throws UserProfileException {
-        userProfile.setUserId(UUID.randomUUID().toString());
-        // Setting user id to airavataInternalUserId. We don't distinguish these two at the moment.
-        userProfile.setAiravataInternalUserId(userProfile.getUserId());
-        userProfileDao.createUserProfile(userProfile);
-        return userProfile.getUserId();
-    }
-
-    @Override
-    public boolean updateUserProfile(UserProfile userProfile) throws UserProfileException {
-        return userProfileDao.updateUserProfile(userProfile);
-    }
-
-    @Override
-    public boolean deleteUserProfile(String userId) throws UserProfileException {
-        return userProfileDao.deleteUserProfile(userId);
-    }
-
-    @Override
-    public UserProfile getUserProfileFromUserId(String userId) throws UserProfileException {
-        return userProfileDao.getUserProfileFromUserId(userId);
-    }
-
-    @Override
-    public UserProfile getUserProfileFromUserName(String userName, String gatewayId) throws UserProfileException {
-        return userProfileDao.getUserProfileFromUserName(userName, gatewayId);
-    }
-
-    @Override
-    public boolean userProfileExists(String userName, String gatewayId) throws UserProfileException {
-        return userProfileDao.userProfileExists(userName, gatewayId);
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/d9a69ae5/modules/user-profile/user-profile-core/src/main/java/org/apache/airavata/userprofile/core/UserProfileCPIImplFactory.java
----------------------------------------------------------------------
diff --git a/modules/user-profile/user-profile-core/src/main/java/org/apache/airavata/userprofile/core/UserProfileCPIImplFactory.java b/modules/user-profile/user-profile-core/src/main/java/org/apache/airavata/userprofile/core/UserProfileCPIImplFactory.java
deleted file mode 100644
index 532d382..0000000
--- a/modules/user-profile/user-profile-core/src/main/java/org/apache/airavata/userprofile/core/UserProfileCPIImplFactory.java
+++ /dev/null
@@ -1,43 +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.
- *
-*/
-package org.apache.airavata.userprofile.core;
-
-import org.apache.airavata.userprofile.cpi.UserProfileException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class UserProfileCPIImplFactory {
-    private final static Logger logger = LoggerFactory.getLogger(UserProfileCPIImplFactory.class);
-
-    private static UserProfileCPIImpl userProfileCPIImpl;
-
-    public static UserProfileCPIImpl getRegistry() throws UserProfileException {
-        try {
-            if (userProfileCPIImpl == null) {
-                userProfileCPIImpl = new UserProfileCPIImpl();
-            }
-        } catch (Exception e) {
-            logger.error("Unable to create UserProfileCPIImpl instance", e);
-            throw new UserProfileException(e);
-        }
-        return userProfileCPIImpl;
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/d9a69ae5/modules/user-profile/user-profile-core/src/main/java/org/apache/airavata/userprofile/core/UserProfileDao.java
----------------------------------------------------------------------
diff --git a/modules/user-profile/user-profile-core/src/main/java/org/apache/airavata/userprofile/core/UserProfileDao.java b/modules/user-profile/user-profile-core/src/main/java/org/apache/airavata/userprofile/core/UserProfileDao.java
deleted file mode 100644
index be3a78b..0000000
--- a/modules/user-profile/user-profile-core/src/main/java/org/apache/airavata/userprofile/core/UserProfileDao.java
+++ /dev/null
@@ -1,164 +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.
- *
-*/
-package org.apache.airavata.userprofile.core;
-
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.mongodb.*;
-import com.mongodb.util.JSON;
-import org.apache.airavata.common.exception.ApplicationSettingsException;
-import org.apache.airavata.model.user.UserProfile;
-import org.apache.airavata.userprofile.cpi.UserProfileException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-
-public class UserProfileDao {
-    private final static Logger logger = LoggerFactory.getLogger(UserProfileDao.class);
-
-    private static final String USER_PROFILE_COLLECTION_NAME = "user-profiles";
-    private DBCollection collection;
-    private ModelConversionHelper modelConversionHelper;
-
-    private static final String USER_ID = "user_id";
-    private static final String USER_NAME = "user_name";
-    private static final String GATEWAY_ID = "gateway_id";
-
-    public UserProfileDao() throws UserProfileException {
-        try {
-            collection = MongoUtil.getUserProfileRegistry().getCollection(USER_PROFILE_COLLECTION_NAME);
-        } catch (ApplicationSettingsException e) {
-            throw new UserProfileException(e);
-        }
-        modelConversionHelper = new ModelConversionHelper();
-        //collection.dropIndexes();
-        initIndexes();
-    }
-
-    /**
-     * If indexes are already defined this will simply ignore them
-     */
-    private void initIndexes(){
-        // UserID is the primary key
-        collection.createIndex(new BasicDBObject(USER_ID, 1), new BasicDBObject("unique", true));
-        // UserName and GatewayID combination is also makes a unique key
-        collection.createIndex(new BasicDBObject(USER_NAME, 1).append(GATEWAY_ID, 1), new BasicDBObject("unique", true));
-    }
-
-    public List<UserProfile> getAllUserProfilesInGateway(String gatewayId) throws UserProfileException {
-        List<UserProfile> userList = new ArrayList();
-        DBCursor cursor = collection.find();
-        for(DBObject document: cursor){
-            try {
-                userList.add((UserProfile) modelConversionHelper.deserializeObject(
-                        UserProfile.class, document.toString()));
-            } catch (IOException e) {
-                throw new UserProfileException(e);
-            }
-        }
-        return userList;
-    }
-
-    public boolean createUserProfile(UserProfile userProfile) throws UserProfileException{
-        try {
-            WriteResult result = collection.insert((DBObject) JSON.parse(
-                    modelConversionHelper.serializeObject(userProfile)));
-            logger.debug("No of inserted results "+ result.getN());
-            return true;
-        } catch (JsonProcessingException e) {
-            throw new UserProfileException(e);
-        }
-    }
-
-    /**
-     * The following operation replaces the document with item equal to
-     * the given user id. The newly replaced document will only
-     * contain the the _id field and the fields in the replacement document.
-     * @param userProfile
-     * @throws org.apache.airavata.registry.cpi.UserProfileException
-     */
-    public boolean updateUserProfile(UserProfile userProfile) throws UserProfileException{
-        try {
-            DBObject query = BasicDBObjectBuilder.start().add(
-                    USER_ID, userProfile.getUserId()).get();
-            WriteResult result = collection.update(query, (DBObject) JSON.parse(
-                    modelConversionHelper.serializeObject(userProfile)));
-            logger.debug("No of updated results "+ result.getN());
-            return true;
-        } catch (JsonProcessingException e) {
-            throw new UserProfileException(e);
-        }
-    }
-
-    public boolean deleteUserProfile(String userId) throws UserProfileException{
-        DBObject query = BasicDBObjectBuilder.start().add(
-                USER_ID, userId).get();
-        WriteResult result = collection.remove(query);
-        logger.debug("No of removed user profiles " + result.getN());
-        return true;
-    }
-
-    public UserProfile getUserProfileFromUserId(String userId) throws UserProfileException{
-        try {
-            DBObject criteria = new BasicDBObject(USER_ID, userId);
-            DBObject doc = collection.findOne(criteria);
-            if(doc != null){
-                String json = doc.toString();
-                return (UserProfile)modelConversionHelper.deserializeObject(
-                        UserProfile.class, json);
-            }
-        } catch (IOException e) {
-            throw new UserProfileException(e);
-        }
-        return null;
-    }
-
-    public UserProfile getUserProfileFromUserName(String userName, String gatewayId) throws UserProfileException{
-        try {
-            DBObject criteria = new BasicDBObject(USER_NAME, userName).append(GATEWAY_ID, gatewayId);
-            DBObject doc = collection.findOne(criteria);
-            if(doc != null){
-                String json = doc.toString();
-                return (UserProfile)modelConversionHelper.deserializeObject(
-                        UserProfile.class, json);
-            }
-        } catch (IOException e) {
-            throw new UserProfileException(e);
-        }
-        return null;
-    }
-
-    public boolean userProfileExists(String userName, String gatewayId) throws UserProfileException{
-        try {
-            DBObject criteria = new BasicDBObject(USER_NAME, userName).append(GATEWAY_ID, gatewayId);
-            DBObject doc = collection.findOne(criteria);
-            if(doc != null){
-                String json = doc.toString();
-                return modelConversionHelper.deserializeObject(UserProfile.class, json) !=  null;
-            }
-            return false;
-        } catch (IOException e) {
-            throw new UserProfileException(e);
-        }
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/d9a69ae5/modules/user-profile/user-profile-core/src/main/java/org/apache/airavata/userprofile/core/UserProfileDeserializer.java
----------------------------------------------------------------------
diff --git a/modules/user-profile/user-profile-core/src/main/java/org/apache/airavata/userprofile/core/UserProfileDeserializer.java b/modules/user-profile/user-profile-core/src/main/java/org/apache/airavata/userprofile/core/UserProfileDeserializer.java
deleted file mode 100644
index 4af0fc8..0000000
--- a/modules/user-profile/user-profile-core/src/main/java/org/apache/airavata/userprofile/core/UserProfileDeserializer.java
+++ /dev/null
@@ -1,64 +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.
- *
-*/
-package org.apache.airavata.userprofile.core;
-
-import org.apache.airavata.model.user.UserProfile;
-import org.apache.thrift.TException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class UserProfileDeserializer extends AbstractThriftDeserializer<UserProfile._Fields, UserProfile>{
-    private final static Logger logger = LoggerFactory.getLogger(UserProfileDeserializer.class);
-
-    /**
-     * Returns the {@code <E>} enumerated value that represents the target
-     * field in the Thrift entity referenced in the JSON document.
-     *
-     * @param fieldName The name of the Thrift entity target field.
-     * @return The {@code <E>} enumerated value that represents the target
-     * field in the Thrift entity referenced in the JSON document.
-     */
-    @Override
-    protected UserProfile._Fields getField(String fieldName) {
-        return UserProfile._Fields.valueOf(fieldName);
-    }
-
-    /**
-     * Creates a new instance of the Thrift entity class represented by this deserializer.
-     *
-     * @return A new instance of the Thrift entity class represented by this deserializer.
-     */
-    @Override
-    protected UserProfile newInstance() {
-        return new UserProfile();
-    }
-
-    /**
-     * Validates that the Thrift entity instance contains all required fields after deserialization.
-     *
-     * @param instance A Thrift entity instance.
-     * @throws TException if unable to validate the instance.
-     */
-    @Override
-    protected void validate(UserProfile instance) throws TException {
-        instance.validate();
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/d9a69ae5/modules/user-profile/user-profile-core/src/main/java/org/apache/airavata/userprofile/core/UserProfileSerializer.java
----------------------------------------------------------------------
diff --git a/modules/user-profile/user-profile-core/src/main/java/org/apache/airavata/userprofile/core/UserProfileSerializer.java b/modules/user-profile/user-profile-core/src/main/java/org/apache/airavata/userprofile/core/UserProfileSerializer.java
deleted file mode 100644
index 0f20906..0000000
--- a/modules/user-profile/user-profile-core/src/main/java/org/apache/airavata/userprofile/core/UserProfileSerializer.java
+++ /dev/null
@@ -1,51 +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.
- *
-*/
-package org.apache.airavata.userprofile.core;
-
-import org.apache.airavata.model.user.UserProfile;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class UserProfileSerializer extends AbstractThriftSerializer<UserProfile._Fields, UserProfile>  {
-    private final static Logger logger = LoggerFactory.getLogger(UserProfileSerializer.class);
-
-    /**
-     * Returns an array of {@code <E>} enumerated values that represent the fields present in the
-     * Thrift class associated with this serializer.
-     *
-     * @return The array of {@code <E>} enumerated values that represent the fields present in the
-     * Thrift class.
-     */
-    @Override
-    protected UserProfile._Fields[] getFieldValues() {
-        return UserProfile._Fields.values();
-    }
-
-    /**
-     * Returns the {@code <T>} implementation class associated with this serializer.
-     *
-     * @return The {@code <T>} implementation class
-     */
-    @Override
-    protected Class<UserProfile> getThriftClass() {
-        return null;
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/d9a69ae5/modules/user-profile/user-profile-core/src/test/java/org/apache/airavata/userprofile/core/UserProfileCPIImplTest.java
----------------------------------------------------------------------
diff --git a/modules/user-profile/user-profile-core/src/test/java/org/apache/airavata/userprofile/core/UserProfileCPIImplTest.java b/modules/user-profile/user-profile-core/src/test/java/org/apache/airavata/userprofile/core/UserProfileCPIImplTest.java
deleted file mode 100644
index 737aa6b..0000000
--- a/modules/user-profile/user-profile-core/src/test/java/org/apache/airavata/userprofile/core/UserProfileCPIImplTest.java
+++ /dev/null
@@ -1,68 +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.
- *
-*/
-package org.apache.airavata.userprofile.core;
-
-import junit.framework.Assert;
-import org.apache.airavata.model.user.Status;
-import org.apache.airavata.model.user.UserProfile;
-import org.apache.airavata.userprofile.cpi.UserProfileException;
-import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.List;
-
-public class UserProfileCPIImplTest {
-    private final static Logger logger = LoggerFactory.getLogger(UserProfileCPIImplTest.class);
-
-  /*  @Test
-    public void testUserProfileCPIImplementation(){
-        UserProfile userProfile  = new UserProfile();
-        userProfile.setUserName("jsfsjdfsdg" + System.currentTimeMillis());
-        userProfile.setGatewayId("seagrid");
-        userProfile.setComments("vidfkj dfgndfkg dfkgndkjfng");
-        userProfile.setCountry("USA");
-        userProfile.setState(Status.ACTIVE);
-
-        try {
-            UserProfileCPIImpl userProfileCPIImpl = new UserProfileCPIImpl();
-            String userId = userProfileCPIImpl.createUserProfile(userProfile);
-            Assert.assertNotNull(userId);
-            userProfile = userProfileCPIImpl.getUserProfileFromUserId(userId);
-            Assert.assertNotNull(userProfile);
-            Assert.assertTrue(userProfile.getCountry().equals("USA"));
-            userProfile.setCountry("Sri Lanka");
-            userProfileCPIImpl.updateUserProfile(userProfile);
-            userProfile = userProfileCPIImpl.getUserProfileFromUserId(userId);
-            Assert.assertTrue(userProfile.getCountry().equals("Sri Lanka"));
-            userProfile = userProfileCPIImpl.getUserProfileFromUserName(userProfile.getUserName(),
-                    userProfile.getGatewayId());
-            Assert.assertNotNull(userProfile);
-            List<UserProfile> userProfileList = userProfileCPIImpl.getAllUserProfilesInGateway("seagrid");
-            Assert.assertNotNull(userProfileList);
-            userProfileCPIImpl.deleteUserProfile(userProfile.getUserId());
-            Assert.assertNull(userProfileCPIImpl.getUserProfileFromUserId(userProfile.getUserId()));
-        } catch (UserProfileException e) {
-            e.printStackTrace();
-            Assert.fail();
-        }
-    }*/
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/d9a69ae5/modules/user-profile/user-profile-cpi/pom.xml
----------------------------------------------------------------------
diff --git a/modules/user-profile/user-profile-cpi/pom.xml b/modules/user-profile/user-profile-cpi/pom.xml
deleted file mode 100644
index 440726a..0000000
--- a/modules/user-profile/user-profile-cpi/pom.xml
+++ /dev/null
@@ -1,30 +0,0 @@
-<?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">
-    <parent>
-        <artifactId>user-profile</artifactId>
-        <groupId>org.apache.airavata</groupId>
-        <version>0.17-SNAPSHOT</version>
-    </parent>
-    <modelVersion>4.0.0</modelVersion>
-
-    <artifactId>user-profile-cpi</artifactId>
-
-
-    <dependencies>
-        <dependency>
-            <groupId>org.apache.airavata</groupId>
-            <artifactId>airavata-data-models</artifactId>
-            <version>${project.version}</version>
-        </dependency>
-    </dependencies>
-</project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/d9a69ae5/modules/user-profile/user-profile-cpi/src/main/java/org/apache/airavata/userprofile/cpi/UserProfileCPI.java
----------------------------------------------------------------------
diff --git a/modules/user-profile/user-profile-cpi/src/main/java/org/apache/airavata/userprofile/cpi/UserProfileCPI.java b/modules/user-profile/user-profile-cpi/src/main/java/org/apache/airavata/userprofile/cpi/UserProfileCPI.java
deleted file mode 100644
index 76b5e39..0000000
--- a/modules/user-profile/user-profile-cpi/src/main/java/org/apache/airavata/userprofile/cpi/UserProfileCPI.java
+++ /dev/null
@@ -1,42 +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.
- *
- */
-package org.apache.airavata.userprofile.cpi;
-
-import org.apache.airavata.model.user.UserProfile;
-
-import java.util.List;
-
-public interface UserProfileCPI {
-
-    public List<UserProfile> getAllUserProfilesInGateway(String gatewayId) throws UserProfileException;
-
-    public String createUserProfile(UserProfile userProfile) throws UserProfileException;
-
-    public boolean updateUserProfile(UserProfile userProfile) throws UserProfileException;
-
-    public boolean deleteUserProfile(String userId) throws UserProfileException;
-
-    public UserProfile getUserProfileFromUserId(String userId) throws UserProfileException;
-
-    public UserProfile getUserProfileFromUserName(String userName, String gatewayId) throws UserProfileException;
-
-    public boolean userProfileExists(String userName, String gatewayId) throws UserProfileException;
-}

http://git-wip-us.apache.org/repos/asf/airavata/blob/d9a69ae5/modules/user-profile/user-profile-cpi/src/main/java/org/apache/airavata/userprofile/cpi/UserProfileException.java
----------------------------------------------------------------------
diff --git a/modules/user-profile/user-profile-cpi/src/main/java/org/apache/airavata/userprofile/cpi/UserProfileException.java b/modules/user-profile/user-profile-cpi/src/main/java/org/apache/airavata/userprofile/cpi/UserProfileException.java
deleted file mode 100644
index 645210b..0000000
--- a/modules/user-profile/user-profile-cpi/src/main/java/org/apache/airavata/userprofile/cpi/UserProfileException.java
+++ /dev/null
@@ -1,32 +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.
- *
-*/
-package org.apache.airavata.userprofile.cpi;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class UserProfileException extends Exception {
-    private final static Logger logger = LoggerFactory.getLogger(UserProfileException.class);
-
-    public UserProfileException(Exception e) {
-        super(e);
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/d9a69ae5/modules/user-profile/user-profile-service/.classpath
----------------------------------------------------------------------
diff --git a/modules/user-profile/user-profile-service/.classpath b/modules/user-profile/user-profile-service/.classpath
new file mode 100644
index 0000000..af1430b
--- /dev/null
+++ b/modules/user-profile/user-profile-service/.classpath
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="src" output="target/classes" path="src/main/java">
+		<attributes>
+			<attribute name="optional" value="true"/>
+			<attribute name="maven.pomderived" value="true"/>
+		</attributes>
+	</classpathentry>
+	<classpathentry kind="src" output="target/test-classes" path="src/test/java">
+		<attributes>
+			<attribute name="optional" value="true"/>
+			<attribute name="maven.pomderived" value="true"/>
+		</attributes>
+	</classpathentry>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
+		<attributes>
+			<attribute name="maven.pomderived" value="true"/>
+		</attributes>
+	</classpathentry>
+	<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
+		<attributes>
+			<attribute name="maven.pomderived" value="true"/>
+		</attributes>
+	</classpathentry>
+	<classpathentry kind="output" path="target/classes"/>
+</classpath>

http://git-wip-us.apache.org/repos/asf/airavata/blob/d9a69ae5/modules/user-profile/user-profile-service/pom.xml
----------------------------------------------------------------------
diff --git a/modules/user-profile/user-profile-service/pom.xml b/modules/user-profile/user-profile-service/pom.xml
new file mode 100644
index 0000000..3e35699
--- /dev/null
+++ b/modules/user-profile/user-profile-service/pom.xml
@@ -0,0 +1,27 @@
+<?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>
+
+    <groupId>org.apache.airavata</groupId>
+    <artifactId>user-profile-service</artifactId>
+    <version>0.17-SNAPSHOT</version>
+
+    <dependencies>
+
+        <dependency>
+            <groupId>org.apache.airavata</groupId>
+            <artifactId>airavata-commons</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.airavata</groupId>
+            <artifactId>user-profile-stubs</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+
+    </dependencies>
+    
+</project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/d9a69ae5/modules/user-profile/user-profile-service/src/main/java/com.apache.airavata.user.profile/server/UserProfileHandler.java
----------------------------------------------------------------------
diff --git a/modules/user-profile/user-profile-service/src/main/java/com.apache.airavata.user.profile/server/UserProfileHandler.java b/modules/user-profile/user-profile-service/src/main/java/com.apache.airavata.user.profile/server/UserProfileHandler.java
new file mode 100644
index 0000000..f07426c
--- /dev/null
+++ b/modules/user-profile/user-profile-service/src/main/java/com.apache.airavata.user.profile/server/UserProfileHandler.java
@@ -0,0 +1,85 @@
+package com.apache.airavata.user.profile.server;
+
+import org.apache.airavata.model.user.UserProfile;
+import org.apache.airavata.registry.api.exception.RegistryServiceException;
+import org.apache.airavata.registry.core.entities.workspacecatalog.UserProfileEntity;
+import org.apache.airavata.registry.core.repositories.workspacecatalog.UserProfileRepository;
+import org.apache.airavata.userprofile.crude.cpi.UserProfileCrudeService;
+import org.apache.thrift.TException;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Created by Airavata on 11/11/2016.
+ */
+public class UserProfileHandler implements UserProfileCrudeService.Iface {
+
+    private UserProfileRepository userProfileRepository;
+
+    public UserProfileHandler() {
+
+        userProfileRepository = new UserProfileRepository(UserProfile.class, UserProfileEntity.class);
+    }
+
+    public String addUserProfile(UserProfile userProfile) throws RegistryServiceException, TException {
+
+        userProfileRepository.create(userProfile);
+
+        if (null != userProfile)
+            return userProfile.getUserId();
+
+        return null;
+    }
+
+    public boolean updateUserProfile(UserProfile userProfile) throws RegistryServiceException, TException {
+
+        try {
+            userProfileRepository.update(userProfile);
+        } catch (Exception e) {
+
+            return false;
+        }
+
+        return true;
+    }
+
+    public UserProfile getUserProfileById(String userId, String gatewayId) throws RegistryServiceException, TException {
+
+
+        UserProfile userProfile = userProfileRepository.getUserProfileByIdAndGateWay(userId, gatewayId);
+
+        return userProfile;
+    }
+
+    public boolean deleteUserProfile(String userId) throws RegistryServiceException, TException {
+
+        boolean deleteResult = userProfileRepository.delete(userId);
+
+        return deleteResult;
+    }
+
+
+
+    public List<UserProfile> getAllUserProfilesInGateway(String gatewayId, int offset, int limit) throws RegistryServiceException, TException {
+        List<UserProfile> usersInGateway = userProfileRepository.getAllUserProfilesInGateway(gatewayId, offset, limit);
+        return usersInGateway;
+    }
+
+
+    public UserProfile getUserProfileByName(String userName, String gatewayId) throws RegistryServiceException, TException {
+
+        UserProfile userProfile = userProfileRepository.getUserProfileByNameAndGateWay(userName, gatewayId);
+        return userProfile;
+    }
+
+    public boolean doesUserExist(String userName, String gatewayId) throws RegistryServiceException, TException {
+
+        UserProfile userProfile = userProfileRepository.getUserProfileByNameAndGateWay(userName, gatewayId);
+
+        if (null != userProfile)
+            return true;
+        return false;
+    }
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/d9a69ae5/modules/user-profile/user-profile-service/src/main/java/com.apache.airavata.user.profile/server/UserProfileServer.java
----------------------------------------------------------------------
diff --git a/modules/user-profile/user-profile-service/src/main/java/com.apache.airavata.user.profile/server/UserProfileServer.java b/modules/user-profile/user-profile-service/src/main/java/com.apache.airavata.user.profile/server/UserProfileServer.java
new file mode 100644
index 0000000..53fd539
--- /dev/null
+++ b/modules/user-profile/user-profile-service/src/main/java/com.apache.airavata.user.profile/server/UserProfileServer.java
@@ -0,0 +1,141 @@
+package com.apache.airavata.user.profile.server;
+
+import org.apache.airavata.common.utils.IServer;
+import org.apache.airavata.common.utils.ServerSettings;
+import org.apache.airavata.userprofile.crude.cpi.UserProfileCrudeService;
+import org.apache.thrift.server.TServer;
+import org.apache.thrift.server.TThreadPoolServer;
+import org.apache.thrift.transport.TServerSocket;
+import org.apache.thrift.transport.TServerTransport;
+import org.apache.thrift.transport.TTransportException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.net.InetSocketAddress;
+import java.util.Date;
+
+/**
+ * Created by abhij on 11/11/2016.
+ */
+public class UserProfileServer implements IServer {
+
+    private final static Logger logger = LoggerFactory.getLogger(UserProfileServer.class);
+
+    private static final String SERVER_NAME = "User Profile Server";
+    private static final String SERVER_VERSION = "1.0";
+
+    private IServer.ServerStatus status;
+    private TServer server;
+
+    public UserProfileServer() {
+        setStatus(IServer.ServerStatus.STOPPED);
+    }
+
+    public void updateTime() {
+
+    }
+
+    public Date getTime() {
+        return null;
+    }
+
+    public String getName() {
+        return SERVER_NAME;
+    }
+
+    public String getVersion() {
+        return SERVER_VERSION;
+    }
+
+    public void start() throws Exception {
+
+
+        try {
+            setStatus(ServerStatus.STARTING);
+            final int serverPort = Integer.parseInt(ServerSettings.getUserProfileServerPort());
+            final String serverHost = ServerSettings.getUserProfileServerHost();
+            UserProfileCrudeService.Processor processor = new UserProfileCrudeService.Processor(new UserProfileHandler());
+
+            TServerTransport serverTransport;
+
+            if (serverHost == null) {
+                serverTransport = new TServerSocket(serverPort);
+            } else {
+                InetSocketAddress inetSocketAddress = new InetSocketAddress(serverHost, serverPort);
+                serverTransport = new TServerSocket(inetSocketAddress);
+            }
+            TThreadPoolServer.Args options = new TThreadPoolServer.Args(serverTransport);
+            options.minWorkerThreads = 30;
+            server = new TThreadPoolServer(options.processor(processor));
+
+            new Thread() {
+                public void run() {
+                    server.serve();
+                    setStatus(ServerStatus.STOPPED);
+                    logger.info("User Profile Server Stopped.");
+                }
+            }.start();
+            new Thread() {
+                public void run() {
+                    while (!server.isServing()) {
+                        try {
+                            Thread.sleep(500);
+                        } catch (InterruptedException e) {
+                            break;
+                        }
+                    }
+                    if (server.isServing()) {
+                        setStatus(ServerStatus.STARTED);
+                        logger.info("Starting User Profile Server on Port " + serverPort);
+                        logger.info("Listening to User Profile server clients ....");
+                    }
+                }
+            }.start();
+        } catch (TTransportException e) {
+            setStatus(ServerStatus.FAILED);
+            throw new Exception("Error while starting the User Profile service", e);
+        }
+    }
+
+    public void stop() throws Exception {
+
+        if (server!=null && server.isServing()){
+            setStatus(ServerStatus.STOPING);
+            server.stop();
+        }
+    }
+
+    public void restart() throws Exception {
+
+        stop();
+        start();
+    }
+
+    public void configure() throws Exception {
+
+    }
+
+    public ServerStatus getStatus() throws Exception {
+        return status;    }
+
+    private void setStatus(IServer.ServerStatus stat){
+        status=stat;
+        status.updateTime();
+    }
+
+    public TServer getServer() {
+        return server;
+    }
+
+    public void setServer(TServer server) {
+        this.server = server;
+    }
+
+    public static void main(String[] args) {
+        try {
+            new UserProfileServer().start();
+        } catch (Exception e) {
+            logger.error(e.getMessage(), e);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/d9a69ae5/modules/user-profile/user-profile-stubs/pom.xml
----------------------------------------------------------------------
diff --git a/modules/user-profile/user-profile-stubs/pom.xml b/modules/user-profile/user-profile-stubs/pom.xml
new file mode 100644
index 0000000..3f9bce8
--- /dev/null
+++ b/modules/user-profile/user-profile-stubs/pom.xml
@@ -0,0 +1,35 @@
+<?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">
+    <parent>
+        <artifactId>user-profile</artifactId>
+        <groupId>org.apache.airavata</groupId>
+        <version>0.17-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>user-profile-stubs</artifactId>
+
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.airavata</groupId>
+            <artifactId>airavata-data-models</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.airavata</groupId>
+            <artifactId>registry-refactoring</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+    </dependencies>
+</project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/d9a69ae5/modules/user-profile/user-profile-stubs/src/main/java/org/apache/airavata/registry/api/exception/RegistryServiceException.java
----------------------------------------------------------------------
diff --git a/modules/user-profile/user-profile-stubs/src/main/java/org/apache/airavata/registry/api/exception/RegistryServiceException.java b/modules/user-profile/user-profile-stubs/src/main/java/org/apache/airavata/registry/api/exception/RegistryServiceException.java
new file mode 100644
index 0000000..154ea74
--- /dev/null
+++ b/modules/user-profile/user-profile-stubs/src/main/java/org/apache/airavata/registry/api/exception/RegistryServiceException.java
@@ -0,0 +1,407 @@
+    /*
+     * 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.
+     */
+/**
+ * Autogenerated by Thrift Compiler (0.9.3)
+ *
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ *  @generated
+ */
+package org.apache.airavata.registry.api.exception;
+
+import org.apache.thrift.scheme.IScheme;
+import org.apache.thrift.scheme.SchemeFactory;
+import org.apache.thrift.scheme.StandardScheme;
+
+import org.apache.thrift.scheme.TupleScheme;
+import org.apache.thrift.protocol.TTupleProtocol;
+import org.apache.thrift.protocol.TProtocolException;
+import org.apache.thrift.EncodingUtils;
+import org.apache.thrift.TException;
+import org.apache.thrift.async.AsyncMethodCallback;
+import org.apache.thrift.server.AbstractNonblockingServer.*;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.EnumMap;
+import java.util.Set;
+import java.util.HashSet;
+import java.util.EnumSet;
+import java.util.Collections;
+import java.util.BitSet;
+import java.nio.ByteBuffer;
+import java.util.Arrays;
+import javax.annotation.Generated;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"})
+@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2016-11-18")
+public class RegistryServiceException extends TException implements org.apache.thrift.TBase<RegistryServiceException, RegistryServiceException._Fields>, java.io.Serializable, Cloneable, Comparable<RegistryServiceException> {
+  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("RegistryServiceException");
+
+  private static final org.apache.thrift.protocol.TField MESSAGE_FIELD_DESC = new org.apache.thrift.protocol.TField("message", org.apache.thrift.protocol.TType.STRING, (short)1);
+
+  private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+  static {
+    schemes.put(StandardScheme.class, new RegistryServiceExceptionStandardSchemeFactory());
+    schemes.put(TupleScheme.class, new RegistryServiceExceptionTupleSchemeFactory());
+  }
+
+  public String message; // required
+
+  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
+  public enum _Fields implements org.apache.thrift.TFieldIdEnum {
+    MESSAGE((short)1, "message");
+
+    private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
+
+    static {
+      for (_Fields field : EnumSet.allOf(_Fields.class)) {
+        byName.put(field.getFieldName(), field);
+      }
+    }
+
+    /**
+     * Find the _Fields constant that matches fieldId, or null if its not found.
+     */
+    public static _Fields findByThriftId(int fieldId) {
+      switch(fieldId) {
+        case 1: // MESSAGE
+          return MESSAGE;
+        default:
+          return null;
+      }
+    }
+
+    /**
+     * Find the _Fields constant that matches fieldId, throwing an exception
+     * if it is not found.
+     */
+    public static _Fields findByThriftIdOrThrow(int fieldId) {
+      _Fields fields = findByThriftId(fieldId);
+      if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
+      return fields;
+    }
+
+    /**
+     * Find the _Fields constant that matches name, or null if its not found.
+     */
+    public static _Fields findByName(String name) {
+      return byName.get(name);
+    }
+
+    private final short _thriftId;
+    private final String _fieldName;
+
+    _Fields(short thriftId, String fieldName) {
+      _thriftId = thriftId;
+      _fieldName = fieldName;
+    }
+
+    public short getThriftFieldId() {
+      return _thriftId;
+    }
+
+    public String getFieldName() {
+      return _fieldName;
+    }
+  }
+
+  // isset id assignments
+  public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
+  static {
+    Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
+    tmpMap.put(_Fields.MESSAGE, new org.apache.thrift.meta_data.FieldMetaData("message", org.apache.thrift.TFieldRequirementType.REQUIRED, 
+        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+    metaDataMap = Collections.unmodifiableMap(tmpMap);
+    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(RegistryServiceException.class, metaDataMap);
+  }
+
+  public RegistryServiceException() {
+  }
+
+  public RegistryServiceException(
+    String message)
+  {
+    this();
+    this.message = message;
+  }
+
+  /**
+   * Performs a deep copy on <i>other</i>.
+   */
+  public RegistryServiceException(RegistryServiceException other) {
+    if (other.isSetMessage()) {
+      this.message = other.message;
+    }
+  }
+
+  public RegistryServiceException deepCopy() {
+    return new RegistryServiceException(this);
+  }
+
+  @Override
+  public void clear() {
+    this.message = null;
+  }
+
+  public String getMessage() {
+    return this.message;
+  }
+
+  public RegistryServiceException setMessage(String message) {
+    this.message = message;
+    return this;
+  }
+
+  public void unsetMessage() {
+    this.message = null;
+  }
+
+  /** Returns true if field message is set (has been assigned a value) and false otherwise */
+  public boolean isSetMessage() {
+    return this.message != null;
+  }
+
+  public void setMessageIsSet(boolean value) {
+    if (!value) {
+      this.message = null;
+    }
+  }
+
+  public void setFieldValue(_Fields field, Object value) {
+    switch (field) {
+    case MESSAGE:
+      if (value == null) {
+        unsetMessage();
+      } else {
+        setMessage((String)value);
+      }
+      break;
+
+    }
+  }
+
+  public Object getFieldValue(_Fields field) {
+    switch (field) {
+    case MESSAGE:
+      return getMessage();
+
+    }
+    throw new IllegalStateException();
+  }
+
+  /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
+  public boolean isSet(_Fields field) {
+    if (field == null) {
+      throw new IllegalArgumentException();
+    }
+
+    switch (field) {
+    case MESSAGE:
+      return isSetMessage();
+    }
+    throw new IllegalStateException();
+  }
+
+  @Override
+  public boolean equals(Object that) {
+    if (that == null)
+      return false;
+    if (that instanceof RegistryServiceException)
+      return this.equals((RegistryServiceException)that);
+    return false;
+  }
+
+  public boolean equals(RegistryServiceException that) {
+    if (that == null)
+      return false;
+
+    boolean this_present_message = true && this.isSetMessage();
+    boolean that_present_message = true && that.isSetMessage();
+    if (this_present_message || that_present_message) {
+      if (!(this_present_message && that_present_message))
+        return false;
+      if (!this.message.equals(that.message))
+        return false;
+    }
+
+    return true;
+  }
+
+  @Override
+  public int hashCode() {
+    List<Object> list = new ArrayList<Object>();
+
+    boolean present_message = true && (isSetMessage());
+    list.add(present_message);
+    if (present_message)
+      list.add(message);
+
+    return list.hashCode();
+  }
+
+  @Override
+  public int compareTo(RegistryServiceException other) {
+    if (!getClass().equals(other.getClass())) {
+      return getClass().getName().compareTo(other.getClass().getName());
+    }
+
+    int lastComparison = 0;
+
+    lastComparison = Boolean.valueOf(isSetMessage()).compareTo(other.isSetMessage());
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    if (isSetMessage()) {
+      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.message, other.message);
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+    }
+    return 0;
+  }
+
+  public _Fields fieldForId(int fieldId) {
+    return _Fields.findByThriftId(fieldId);
+  }
+
+  public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
+    schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
+  }
+
+  public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
+    schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
+  }
+
+  @Override
+  public String toString() {
+    StringBuilder sb = new StringBuilder("RegistryServiceException(");
+    boolean first = true;
+
+    sb.append("message:");
+    if (this.message == null) {
+      sb.append("null");
+    } else {
+      sb.append(this.message);
+    }
+    first = false;
+    sb.append(")");
+    return sb.toString();
+  }
+
+  public void validate() throws org.apache.thrift.TException {
+    // check for required fields
+    if (message == null) {
+      throw new org.apache.thrift.protocol.TProtocolException("Required field 'message' was not present! Struct: " + toString());
+    }
+    // check for sub-struct validity
+  }
+
+  private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
+    try {
+      write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
+    } catch (org.apache.thrift.TException te) {
+      throw new java.io.IOException(te);
+    }
+  }
+
+  private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
+    try {
+      read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
+    } catch (org.apache.thrift.TException te) {
+      throw new java.io.IOException(te);
+    }
+  }
+
+  private static class RegistryServiceExceptionStandardSchemeFactory implements SchemeFactory {
+    public RegistryServiceExceptionStandardScheme getScheme() {
+      return new RegistryServiceExceptionStandardScheme();
+    }
+  }
+
+  private static class RegistryServiceExceptionStandardScheme extends StandardScheme<RegistryServiceException> {
+
+    public void read(org.apache.thrift.protocol.TProtocol iprot, RegistryServiceException struct) throws org.apache.thrift.TException {
+      org.apache.thrift.protocol.TField schemeField;
+      iprot.readStructBegin();
+      while (true)
+      {
+        schemeField = iprot.readFieldBegin();
+        if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { 
+          break;
+        }
+        switch (schemeField.id) {
+          case 1: // MESSAGE
+            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+              struct.message = iprot.readString();
+              struct.setMessageIsSet(true);
+            } else { 
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+            }
+            break;
+          default:
+            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+        }
+        iprot.readFieldEnd();
+      }
+      iprot.readStructEnd();
+
+      // check for required fields of primitive type, which can't be checked in the validate method
+      struct.validate();
+    }
+
+    public void write(org.apache.thrift.protocol.TProtocol oprot, RegistryServiceException struct) throws org.apache.thrift.TException {
+      struct.validate();
+
+      oprot.writeStructBegin(STRUCT_DESC);
+      if (struct.message != null) {
+        oprot.writeFieldBegin(MESSAGE_FIELD_DESC);
+        oprot.writeString(struct.message);
+        oprot.writeFieldEnd();
+      }
+      oprot.writeFieldStop();
+      oprot.writeStructEnd();
+    }
+
+  }
+
+  private static class RegistryServiceExceptionTupleSchemeFactory implements SchemeFactory {
+    public RegistryServiceExceptionTupleScheme getScheme() {
+      return new RegistryServiceExceptionTupleScheme();
+    }
+  }
+
+  private static class RegistryServiceExceptionTupleScheme extends TupleScheme<RegistryServiceException> {
+
+    @Override
+    public void write(org.apache.thrift.protocol.TProtocol prot, RegistryServiceException struct) throws org.apache.thrift.TException {
+      TTupleProtocol oprot = (TTupleProtocol) prot;
+      oprot.writeString(struct.message);
+    }
+
+    @Override
+    public void read(org.apache.thrift.protocol.TProtocol prot, RegistryServiceException struct) throws org.apache.thrift.TException {
+      TTupleProtocol iprot = (TTupleProtocol) prot;
+      struct.message = iprot.readString();
+      struct.setMessageIsSet(true);
+    }
+  }
+
+}
+

http://git-wip-us.apache.org/repos/asf/airavata/blob/d9a69ae5/modules/user-profile/user-profile-stubs/src/main/java/org/apache/airavata/userprofile/crude/cpi/Test.java
----------------------------------------------------------------------
diff --git a/modules/user-profile/user-profile-stubs/src/main/java/org/apache/airavata/userprofile/crude/cpi/Test.java b/modules/user-profile/user-profile-stubs/src/main/java/org/apache/airavata/userprofile/crude/cpi/Test.java
new file mode 100644
index 0000000..9914906
--- /dev/null
+++ b/modules/user-profile/user-profile-stubs/src/main/java/org/apache/airavata/userprofile/crude/cpi/Test.java
@@ -0,0 +1,14 @@
+package org.apache.airavata.userprofile.crude.cpi;
+
+import org.apache.airavata.model.user.UserProfile;
+
+/**
+ * Created by abhij on 11/17/2016.
+ */
+public class Test {
+
+    public static void main(String args[])  {
+
+        System.out.println();
+    }
+}


[2/5] airavata git commit: migrating user-profile service and new registry components to develop branch

Posted by sh...@apache.org.
http://git-wip-us.apache.org/repos/asf/airavata/blob/d9a69ae5/modules/user-profile/user-profile-stubs/src/main/java/org/apache/airavata/userprofile/crude/cpi/UserProfileCrudeService.java
----------------------------------------------------------------------
diff --git a/modules/user-profile/user-profile-stubs/src/main/java/org/apache/airavata/userprofile/crude/cpi/UserProfileCrudeService.java b/modules/user-profile/user-profile-stubs/src/main/java/org/apache/airavata/userprofile/crude/cpi/UserProfileCrudeService.java
new file mode 100644
index 0000000..7692d99
--- /dev/null
+++ b/modules/user-profile/user-profile-stubs/src/main/java/org/apache/airavata/userprofile/crude/cpi/UserProfileCrudeService.java
@@ -0,0 +1,7488 @@
+/**
+ * Autogenerated by Thrift Compiler (0.9.3)
+ *
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ *  @generated
+ */
+package org.apache.airavata.userprofile.crude.cpi;
+
+import org.apache.thrift.scheme.IScheme;
+import org.apache.thrift.scheme.SchemeFactory;
+import org.apache.thrift.scheme.StandardScheme;
+
+import org.apache.thrift.scheme.TupleScheme;
+import org.apache.thrift.protocol.TTupleProtocol;
+import org.apache.thrift.protocol.TProtocolException;
+import org.apache.thrift.EncodingUtils;
+import org.apache.thrift.TException;
+import org.apache.thrift.async.AsyncMethodCallback;
+import org.apache.thrift.server.AbstractNonblockingServer.*;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.EnumMap;
+import java.util.Set;
+import java.util.HashSet;
+import java.util.EnumSet;
+import java.util.Collections;
+import java.util.BitSet;
+import java.nio.ByteBuffer;
+import java.util.Arrays;
+import javax.annotation.Generated;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"})
+@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2016-11-29")
+public class UserProfileCrudeService {
+
+  public interface Iface {
+
+    public String addUserProfile(org.apache.airavata.model.user.UserProfile userProfile) throws org.apache.airavata.registry.api.exception.RegistryServiceException, TException;
+
+    public boolean updateUserProfile(org.apache.airavata.model.user.UserProfile userProfile) throws org.apache.airavata.registry.api.exception.RegistryServiceException, TException;
+
+    public org.apache.airavata.model.user.UserProfile getUserProfileById(String userId, String gatewayId) throws org.apache.airavata.registry.api.exception.RegistryServiceException, TException;
+
+    public boolean deleteUserProfile(String userId) throws org.apache.airavata.registry.api.exception.RegistryServiceException, TException;
+
+    public List<org.apache.airavata.model.user.UserProfile> getAllUserProfilesInGateway(String gatewayId, int offset, int limit) throws org.apache.airavata.registry.api.exception.RegistryServiceException, TException;
+
+    public org.apache.airavata.model.user.UserProfile getUserProfileByName(String userName, String gatewayId) throws org.apache.airavata.registry.api.exception.RegistryServiceException, TException;
+
+    public boolean doesUserExist(String userName, String gatewayId) throws org.apache.airavata.registry.api.exception.RegistryServiceException, TException;
+
+  }
+
+  public interface AsyncIface {
+
+    public void addUserProfile(org.apache.airavata.model.user.UserProfile userProfile, AsyncMethodCallback resultHandler) throws TException;
+
+    public void updateUserProfile(org.apache.airavata.model.user.UserProfile userProfile, AsyncMethodCallback resultHandler) throws TException;
+
+    public void getUserProfileById(String userId, String gatewayId, AsyncMethodCallback resultHandler) throws TException;
+
+    public void deleteUserProfile(String userId, AsyncMethodCallback resultHandler) throws TException;
+
+    public void getAllUserProfilesInGateway(String gatewayId, int offset, int limit, AsyncMethodCallback resultHandler) throws TException;
+
+    public void getUserProfileByName(String userName, String gatewayId, AsyncMethodCallback resultHandler) throws TException;
+
+    public void doesUserExist(String userName, String gatewayId, AsyncMethodCallback resultHandler) throws TException;
+
+  }
+
+  public static class Client extends org.apache.thrift.TServiceClient implements Iface {
+    public static class Factory implements org.apache.thrift.TServiceClientFactory<Client> {
+      public Factory() {}
+      public Client getClient(org.apache.thrift.protocol.TProtocol prot) {
+        return new Client(prot);
+      }
+      public Client getClient(org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) {
+        return new Client(iprot, oprot);
+      }
+    }
+
+    public Client(org.apache.thrift.protocol.TProtocol prot)
+    {
+      super(prot, prot);
+    }
+
+    public Client(org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) {
+      super(iprot, oprot);
+    }
+
+    public String addUserProfile(org.apache.airavata.model.user.UserProfile userProfile) throws org.apache.airavata.registry.api.exception.RegistryServiceException, TException
+    {
+      send_addUserProfile(userProfile);
+      return recv_addUserProfile();
+    }
+
+    public void send_addUserProfile(org.apache.airavata.model.user.UserProfile userProfile) throws TException
+    {
+      addUserProfile_args args = new addUserProfile_args();
+      args.setUserProfile(userProfile);
+      sendBase("addUserProfile", args);
+    }
+
+    public String recv_addUserProfile() throws org.apache.airavata.registry.api.exception.RegistryServiceException, TException
+    {
+      addUserProfile_result result = new addUserProfile_result();
+      receiveBase(result, "addUserProfile");
+      if (result.isSetSuccess()) {
+        return result.success;
+      }
+      if (result.registryException != null) {
+        throw result.registryException;
+      }
+      throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "addUserProfile failed: unknown result");
+    }
+
+    public boolean updateUserProfile(org.apache.airavata.model.user.UserProfile userProfile) throws org.apache.airavata.registry.api.exception.RegistryServiceException, TException
+    {
+      send_updateUserProfile(userProfile);
+      return recv_updateUserProfile();
+    }
+
+    public void send_updateUserProfile(org.apache.airavata.model.user.UserProfile userProfile) throws TException
+    {
+      updateUserProfile_args args = new updateUserProfile_args();
+      args.setUserProfile(userProfile);
+      sendBase("updateUserProfile", args);
+    }
+
+    public boolean recv_updateUserProfile() throws org.apache.airavata.registry.api.exception.RegistryServiceException, TException
+    {
+      updateUserProfile_result result = new updateUserProfile_result();
+      receiveBase(result, "updateUserProfile");
+      if (result.isSetSuccess()) {
+        return result.success;
+      }
+      if (result.registryException != null) {
+        throw result.registryException;
+      }
+      throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "updateUserProfile failed: unknown result");
+    }
+
+    public org.apache.airavata.model.user.UserProfile getUserProfileById(String userId, String gatewayId) throws org.apache.airavata.registry.api.exception.RegistryServiceException, TException
+    {
+      send_getUserProfileById(userId, gatewayId);
+      return recv_getUserProfileById();
+    }
+
+    public void send_getUserProfileById(String userId, String gatewayId) throws TException
+    {
+      getUserProfileById_args args = new getUserProfileById_args();
+      args.setUserId(userId);
+      args.setGatewayId(gatewayId);
+      sendBase("getUserProfileById", args);
+    }
+
+    public org.apache.airavata.model.user.UserProfile recv_getUserProfileById() throws org.apache.airavata.registry.api.exception.RegistryServiceException, TException
+    {
+      getUserProfileById_result result = new getUserProfileById_result();
+      receiveBase(result, "getUserProfileById");
+      if (result.isSetSuccess()) {
+        return result.success;
+      }
+      if (result.registryException != null) {
+        throw result.registryException;
+      }
+      throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "getUserProfileById failed: unknown result");
+    }
+
+    public boolean deleteUserProfile(String userId) throws org.apache.airavata.registry.api.exception.RegistryServiceException, TException
+    {
+      send_deleteUserProfile(userId);
+      return recv_deleteUserProfile();
+    }
+
+    public void send_deleteUserProfile(String userId) throws TException
+    {
+      deleteUserProfile_args args = new deleteUserProfile_args();
+      args.setUserId(userId);
+      sendBase("deleteUserProfile", args);
+    }
+
+    public boolean recv_deleteUserProfile() throws org.apache.airavata.registry.api.exception.RegistryServiceException, TException
+    {
+      deleteUserProfile_result result = new deleteUserProfile_result();
+      receiveBase(result, "deleteUserProfile");
+      if (result.isSetSuccess()) {
+        return result.success;
+      }
+      if (result.registryException != null) {
+        throw result.registryException;
+      }
+      throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "deleteUserProfile failed: unknown result");
+    }
+
+    public List<org.apache.airavata.model.user.UserProfile> getAllUserProfilesInGateway(String gatewayId, int offset, int limit) throws org.apache.airavata.registry.api.exception.RegistryServiceException, TException
+    {
+      send_getAllUserProfilesInGateway(gatewayId, offset, limit);
+      return recv_getAllUserProfilesInGateway();
+    }
+
+    public void send_getAllUserProfilesInGateway(String gatewayId, int offset, int limit) throws TException
+    {
+      getAllUserProfilesInGateway_args args = new getAllUserProfilesInGateway_args();
+      args.setGatewayId(gatewayId);
+      args.setOffset(offset);
+      args.setLimit(limit);
+      sendBase("getAllUserProfilesInGateway", args);
+    }
+
+    public List<org.apache.airavata.model.user.UserProfile> recv_getAllUserProfilesInGateway() throws org.apache.airavata.registry.api.exception.RegistryServiceException, TException
+    {
+      getAllUserProfilesInGateway_result result = new getAllUserProfilesInGateway_result();
+      receiveBase(result, "getAllUserProfilesInGateway");
+      if (result.isSetSuccess()) {
+        return result.success;
+      }
+      if (result.registryException != null) {
+        throw result.registryException;
+      }
+      throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "getAllUserProfilesInGateway failed: unknown result");
+    }
+
+    public org.apache.airavata.model.user.UserProfile getUserProfileByName(String userName, String gatewayId) throws org.apache.airavata.registry.api.exception.RegistryServiceException, TException
+    {
+      send_getUserProfileByName(userName, gatewayId);
+      return recv_getUserProfileByName();
+    }
+
+    public void send_getUserProfileByName(String userName, String gatewayId) throws TException
+    {
+      getUserProfileByName_args args = new getUserProfileByName_args();
+      args.setUserName(userName);
+      args.setGatewayId(gatewayId);
+      sendBase("getUserProfileByName", args);
+    }
+
+    public org.apache.airavata.model.user.UserProfile recv_getUserProfileByName() throws org.apache.airavata.registry.api.exception.RegistryServiceException, TException
+    {
+      getUserProfileByName_result result = new getUserProfileByName_result();
+      receiveBase(result, "getUserProfileByName");
+      if (result.isSetSuccess()) {
+        return result.success;
+      }
+      if (result.registryException != null) {
+        throw result.registryException;
+      }
+      throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "getUserProfileByName failed: unknown result");
+    }
+
+    public boolean doesUserExist(String userName, String gatewayId) throws org.apache.airavata.registry.api.exception.RegistryServiceException, TException
+    {
+      send_doesUserExist(userName, gatewayId);
+      return recv_doesUserExist();
+    }
+
+    public void send_doesUserExist(String userName, String gatewayId) throws TException
+    {
+      doesUserExist_args args = new doesUserExist_args();
+      args.setUserName(userName);
+      args.setGatewayId(gatewayId);
+      sendBase("doesUserExist", args);
+    }
+
+    public boolean recv_doesUserExist() throws org.apache.airavata.registry.api.exception.RegistryServiceException, TException
+    {
+      doesUserExist_result result = new doesUserExist_result();
+      receiveBase(result, "doesUserExist");
+      if (result.isSetSuccess()) {
+        return result.success;
+      }
+      if (result.registryException != null) {
+        throw result.registryException;
+      }
+      throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "doesUserExist failed: unknown result");
+    }
+
+  }
+  public static class AsyncClient extends org.apache.thrift.async.TAsyncClient implements AsyncIface {
+    public static class Factory implements org.apache.thrift.async.TAsyncClientFactory<AsyncClient> {
+      private org.apache.thrift.async.TAsyncClientManager clientManager;
+      private org.apache.thrift.protocol.TProtocolFactory protocolFactory;
+      public Factory(org.apache.thrift.async.TAsyncClientManager clientManager, org.apache.thrift.protocol.TProtocolFactory protocolFactory) {
+        this.clientManager = clientManager;
+        this.protocolFactory = protocolFactory;
+      }
+      public AsyncClient getAsyncClient(org.apache.thrift.transport.TNonblockingTransport transport) {
+        return new AsyncClient(protocolFactory, clientManager, transport);
+      }
+    }
+
+    public AsyncClient(org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.async.TAsyncClientManager clientManager, org.apache.thrift.transport.TNonblockingTransport transport) {
+      super(protocolFactory, clientManager, transport);
+    }
+
+    public void addUserProfile(org.apache.airavata.model.user.UserProfile userProfile, AsyncMethodCallback resultHandler) throws TException {
+      checkReady();
+      addUserProfile_call method_call = new addUserProfile_call(userProfile, resultHandler, this, ___protocolFactory, ___transport);
+      this.___currentMethod = method_call;
+      ___manager.call(method_call);
+    }
+
+    public static class addUserProfile_call extends org.apache.thrift.async.TAsyncMethodCall {
+      private org.apache.airavata.model.user.UserProfile userProfile;
+      public addUserProfile_call(org.apache.airavata.model.user.UserProfile userProfile, AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws TException {
+        super(client, protocolFactory, transport, resultHandler, false);
+        this.userProfile = userProfile;
+      }
+
+      public void write_args(org.apache.thrift.protocol.TProtocol prot) throws TException {
+        prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("addUserProfile", org.apache.thrift.protocol.TMessageType.CALL, 0));
+        addUserProfile_args args = new addUserProfile_args();
+        args.setUserProfile(userProfile);
+        args.write(prot);
+        prot.writeMessageEnd();
+      }
+
+      public String getResult() throws org.apache.airavata.registry.api.exception.RegistryServiceException, TException {
+        if (getState() != State.RESPONSE_READ) {
+          throw new IllegalStateException("Method call not finished!");
+        }
+        org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
+        org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
+        return (new Client(prot)).recv_addUserProfile();
+      }
+    }
+
+    public void updateUserProfile(org.apache.airavata.model.user.UserProfile userProfile, AsyncMethodCallback resultHandler) throws TException {
+      checkReady();
+      updateUserProfile_call method_call = new updateUserProfile_call(userProfile, resultHandler, this, ___protocolFactory, ___transport);
+      this.___currentMethod = method_call;
+      ___manager.call(method_call);
+    }
+
+    public static class updateUserProfile_call extends org.apache.thrift.async.TAsyncMethodCall {
+      private org.apache.airavata.model.user.UserProfile userProfile;
+      public updateUserProfile_call(org.apache.airavata.model.user.UserProfile userProfile, AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws TException {
+        super(client, protocolFactory, transport, resultHandler, false);
+        this.userProfile = userProfile;
+      }
+
+      public void write_args(org.apache.thrift.protocol.TProtocol prot) throws TException {
+        prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("updateUserProfile", org.apache.thrift.protocol.TMessageType.CALL, 0));
+        updateUserProfile_args args = new updateUserProfile_args();
+        args.setUserProfile(userProfile);
+        args.write(prot);
+        prot.writeMessageEnd();
+      }
+
+      public boolean getResult() throws org.apache.airavata.registry.api.exception.RegistryServiceException, TException {
+        if (getState() != State.RESPONSE_READ) {
+          throw new IllegalStateException("Method call not finished!");
+        }
+        org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
+        org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
+        return (new Client(prot)).recv_updateUserProfile();
+      }
+    }
+
+    public void getUserProfileById(String userId, String gatewayId, AsyncMethodCallback resultHandler) throws TException {
+      checkReady();
+      getUserProfileById_call method_call = new getUserProfileById_call(userId, gatewayId, resultHandler, this, ___protocolFactory, ___transport);
+      this.___currentMethod = method_call;
+      ___manager.call(method_call);
+    }
+
+    public static class getUserProfileById_call extends org.apache.thrift.async.TAsyncMethodCall {
+      private String userId;
+      private String gatewayId;
+      public getUserProfileById_call(String userId, String gatewayId, AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws TException {
+        super(client, protocolFactory, transport, resultHandler, false);
+        this.userId = userId;
+        this.gatewayId = gatewayId;
+      }
+
+      public void write_args(org.apache.thrift.protocol.TProtocol prot) throws TException {
+        prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("getUserProfileById", org.apache.thrift.protocol.TMessageType.CALL, 0));
+        getUserProfileById_args args = new getUserProfileById_args();
+        args.setUserId(userId);
+        args.setGatewayId(gatewayId);
+        args.write(prot);
+        prot.writeMessageEnd();
+      }
+
+      public org.apache.airavata.model.user.UserProfile getResult() throws org.apache.airavata.registry.api.exception.RegistryServiceException, TException {
+        if (getState() != State.RESPONSE_READ) {
+          throw new IllegalStateException("Method call not finished!");
+        }
+        org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
+        org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
+        return (new Client(prot)).recv_getUserProfileById();
+      }
+    }
+
+    public void deleteUserProfile(String userId, AsyncMethodCallback resultHandler) throws TException {
+      checkReady();
+      deleteUserProfile_call method_call = new deleteUserProfile_call(userId, resultHandler, this, ___protocolFactory, ___transport);
+      this.___currentMethod = method_call;
+      ___manager.call(method_call);
+    }
+
+    public static class deleteUserProfile_call extends org.apache.thrift.async.TAsyncMethodCall {
+      private String userId;
+      public deleteUserProfile_call(String userId, AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws TException {
+        super(client, protocolFactory, transport, resultHandler, false);
+        this.userId = userId;
+      }
+
+      public void write_args(org.apache.thrift.protocol.TProtocol prot) throws TException {
+        prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("deleteUserProfile", org.apache.thrift.protocol.TMessageType.CALL, 0));
+        deleteUserProfile_args args = new deleteUserProfile_args();
+        args.setUserId(userId);
+        args.write(prot);
+        prot.writeMessageEnd();
+      }
+
+      public boolean getResult() throws org.apache.airavata.registry.api.exception.RegistryServiceException, TException {
+        if (getState() != State.RESPONSE_READ) {
+          throw new IllegalStateException("Method call not finished!");
+        }
+        org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
+        org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
+        return (new Client(prot)).recv_deleteUserProfile();
+      }
+    }
+
+    public void getAllUserProfilesInGateway(String gatewayId, int offset, int limit, AsyncMethodCallback resultHandler) throws TException {
+      checkReady();
+      getAllUserProfilesInGateway_call method_call = new getAllUserProfilesInGateway_call(gatewayId, offset, limit, resultHandler, this, ___protocolFactory, ___transport);
+      this.___currentMethod = method_call;
+      ___manager.call(method_call);
+    }
+
+    public static class getAllUserProfilesInGateway_call extends org.apache.thrift.async.TAsyncMethodCall {
+      private String gatewayId;
+      private int offset;
+      private int limit;
+      public getAllUserProfilesInGateway_call(String gatewayId, int offset, int limit, AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws TException {
+        super(client, protocolFactory, transport, resultHandler, false);
+        this.gatewayId = gatewayId;
+        this.offset = offset;
+        this.limit = limit;
+      }
+
+      public void write_args(org.apache.thrift.protocol.TProtocol prot) throws TException {
+        prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("getAllUserProfilesInGateway", org.apache.thrift.protocol.TMessageType.CALL, 0));
+        getAllUserProfilesInGateway_args args = new getAllUserProfilesInGateway_args();
+        args.setGatewayId(gatewayId);
+        args.setOffset(offset);
+        args.setLimit(limit);
+        args.write(prot);
+        prot.writeMessageEnd();
+      }
+
+      public List<org.apache.airavata.model.user.UserProfile> getResult() throws org.apache.airavata.registry.api.exception.RegistryServiceException, TException {
+        if (getState() != State.RESPONSE_READ) {
+          throw new IllegalStateException("Method call not finished!");
+        }
+        org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
+        org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
+        return (new Client(prot)).recv_getAllUserProfilesInGateway();
+      }
+    }
+
+    public void getUserProfileByName(String userName, String gatewayId, AsyncMethodCallback resultHandler) throws TException {
+      checkReady();
+      getUserProfileByName_call method_call = new getUserProfileByName_call(userName, gatewayId, resultHandler, this, ___protocolFactory, ___transport);
+      this.___currentMethod = method_call;
+      ___manager.call(method_call);
+    }
+
+    public static class getUserProfileByName_call extends org.apache.thrift.async.TAsyncMethodCall {
+      private String userName;
+      private String gatewayId;
+      public getUserProfileByName_call(String userName, String gatewayId, AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws TException {
+        super(client, protocolFactory, transport, resultHandler, false);
+        this.userName = userName;
+        this.gatewayId = gatewayId;
+      }
+
+      public void write_args(org.apache.thrift.protocol.TProtocol prot) throws TException {
+        prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("getUserProfileByName", org.apache.thrift.protocol.TMessageType.CALL, 0));
+        getUserProfileByName_args args = new getUserProfileByName_args();
+        args.setUserName(userName);
+        args.setGatewayId(gatewayId);
+        args.write(prot);
+        prot.writeMessageEnd();
+      }
+
+      public org.apache.airavata.model.user.UserProfile getResult() throws org.apache.airavata.registry.api.exception.RegistryServiceException, TException {
+        if (getState() != State.RESPONSE_READ) {
+          throw new IllegalStateException("Method call not finished!");
+        }
+        org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
+        org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
+        return (new Client(prot)).recv_getUserProfileByName();
+      }
+    }
+
+    public void doesUserExist(String userName, String gatewayId, AsyncMethodCallback resultHandler) throws TException {
+      checkReady();
+      doesUserExist_call method_call = new doesUserExist_call(userName, gatewayId, resultHandler, this, ___protocolFactory, ___transport);
+      this.___currentMethod = method_call;
+      ___manager.call(method_call);
+    }
+
+    public static class doesUserExist_call extends org.apache.thrift.async.TAsyncMethodCall {
+      private String userName;
+      private String gatewayId;
+      public doesUserExist_call(String userName, String gatewayId, AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws TException {
+        super(client, protocolFactory, transport, resultHandler, false);
+        this.userName = userName;
+        this.gatewayId = gatewayId;
+      }
+
+      public void write_args(org.apache.thrift.protocol.TProtocol prot) throws TException {
+        prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("doesUserExist", org.apache.thrift.protocol.TMessageType.CALL, 0));
+        doesUserExist_args args = new doesUserExist_args();
+        args.setUserName(userName);
+        args.setGatewayId(gatewayId);
+        args.write(prot);
+        prot.writeMessageEnd();
+      }
+
+      public boolean getResult() throws org.apache.airavata.registry.api.exception.RegistryServiceException, TException {
+        if (getState() != State.RESPONSE_READ) {
+          throw new IllegalStateException("Method call not finished!");
+        }
+        org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
+        org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
+        return (new Client(prot)).recv_doesUserExist();
+      }
+    }
+
+  }
+
+  public static class Processor<I extends Iface> extends org.apache.thrift.TBaseProcessor<I> implements org.apache.thrift.TProcessor {
+    private static final Logger LOGGER = LoggerFactory.getLogger(Processor.class.getName());
+    public Processor(I iface) {
+      super(iface, getProcessMap(new HashMap<String, org.apache.thrift.ProcessFunction<I, ? extends org.apache.thrift.TBase>>()));
+    }
+
+    protected Processor(I iface, Map<String,  org.apache.thrift.ProcessFunction<I, ? extends  org.apache.thrift.TBase>> processMap) {
+      super(iface, getProcessMap(processMap));
+    }
+
+    private static <I extends Iface> Map<String,  org.apache.thrift.ProcessFunction<I, ? extends  org.apache.thrift.TBase>> getProcessMap(Map<String,  org.apache.thrift.ProcessFunction<I, ? extends  org.apache.thrift.TBase>> processMap) {
+      processMap.put("addUserProfile", new addUserProfile());
+      processMap.put("updateUserProfile", new updateUserProfile());
+      processMap.put("getUserProfileById", new getUserProfileById());
+      processMap.put("deleteUserProfile", new deleteUserProfile());
+      processMap.put("getAllUserProfilesInGateway", new getAllUserProfilesInGateway());
+      processMap.put("getUserProfileByName", new getUserProfileByName());
+      processMap.put("doesUserExist", new doesUserExist());
+      return processMap;
+    }
+
+    public static class addUserProfile<I extends Iface> extends org.apache.thrift.ProcessFunction<I, addUserProfile_args> {
+      public addUserProfile() {
+        super("addUserProfile");
+      }
+
+      public addUserProfile_args getEmptyArgsInstance() {
+        return new addUserProfile_args();
+      }
+
+      protected boolean isOneway() {
+        return false;
+      }
+
+      public addUserProfile_result getResult(I iface, addUserProfile_args args) throws TException {
+        addUserProfile_result result = new addUserProfile_result();
+        try {
+          result.success = iface.addUserProfile(args.userProfile);
+        } catch (org.apache.airavata.registry.api.exception.RegistryServiceException registryException) {
+          result.registryException = registryException;
+        }
+        return result;
+      }
+    }
+
+    public static class updateUserProfile<I extends Iface> extends org.apache.thrift.ProcessFunction<I, updateUserProfile_args> {
+      public updateUserProfile() {
+        super("updateUserProfile");
+      }
+
+      public updateUserProfile_args getEmptyArgsInstance() {
+        return new updateUserProfile_args();
+      }
+
+      protected boolean isOneway() {
+        return false;
+      }
+
+      public updateUserProfile_result getResult(I iface, updateUserProfile_args args) throws TException {
+        updateUserProfile_result result = new updateUserProfile_result();
+        try {
+          result.success = iface.updateUserProfile(args.userProfile);
+          result.setSuccessIsSet(true);
+        } catch (org.apache.airavata.registry.api.exception.RegistryServiceException registryException) {
+          result.registryException = registryException;
+        }
+        return result;
+      }
+    }
+
+    public static class getUserProfileById<I extends Iface> extends org.apache.thrift.ProcessFunction<I, getUserProfileById_args> {
+      public getUserProfileById() {
+        super("getUserProfileById");
+      }
+
+      public getUserProfileById_args getEmptyArgsInstance() {
+        return new getUserProfileById_args();
+      }
+
+      protected boolean isOneway() {
+        return false;
+      }
+
+      public getUserProfileById_result getResult(I iface, getUserProfileById_args args) throws TException {
+        getUserProfileById_result result = new getUserProfileById_result();
+        try {
+          result.success = iface.getUserProfileById(args.userId, args.gatewayId);
+        } catch (org.apache.airavata.registry.api.exception.RegistryServiceException registryException) {
+          result.registryException = registryException;
+        }
+        return result;
+      }
+    }
+
+    public static class deleteUserProfile<I extends Iface> extends org.apache.thrift.ProcessFunction<I, deleteUserProfile_args> {
+      public deleteUserProfile() {
+        super("deleteUserProfile");
+      }
+
+      public deleteUserProfile_args getEmptyArgsInstance() {
+        return new deleteUserProfile_args();
+      }
+
+      protected boolean isOneway() {
+        return false;
+      }
+
+      public deleteUserProfile_result getResult(I iface, deleteUserProfile_args args) throws TException {
+        deleteUserProfile_result result = new deleteUserProfile_result();
+        try {
+          result.success = iface.deleteUserProfile(args.userId);
+          result.setSuccessIsSet(true);
+        } catch (org.apache.airavata.registry.api.exception.RegistryServiceException registryException) {
+          result.registryException = registryException;
+        }
+        return result;
+      }
+    }
+
+    public static class getAllUserProfilesInGateway<I extends Iface> extends org.apache.thrift.ProcessFunction<I, getAllUserProfilesInGateway_args> {
+      public getAllUserProfilesInGateway() {
+        super("getAllUserProfilesInGateway");
+      }
+
+      public getAllUserProfilesInGateway_args getEmptyArgsInstance() {
+        return new getAllUserProfilesInGateway_args();
+      }
+
+      protected boolean isOneway() {
+        return false;
+      }
+
+      public getAllUserProfilesInGateway_result getResult(I iface, getAllUserProfilesInGateway_args args) throws TException {
+        getAllUserProfilesInGateway_result result = new getAllUserProfilesInGateway_result();
+        try {
+          result.success = iface.getAllUserProfilesInGateway(args.gatewayId, args.offset, args.limit);
+        } catch (org.apache.airavata.registry.api.exception.RegistryServiceException registryException) {
+          result.registryException = registryException;
+        }
+        return result;
+      }
+    }
+
+    public static class getUserProfileByName<I extends Iface> extends org.apache.thrift.ProcessFunction<I, getUserProfileByName_args> {
+      public getUserProfileByName() {
+        super("getUserProfileByName");
+      }
+
+      public getUserProfileByName_args getEmptyArgsInstance() {
+        return new getUserProfileByName_args();
+      }
+
+      protected boolean isOneway() {
+        return false;
+      }
+
+      public getUserProfileByName_result getResult(I iface, getUserProfileByName_args args) throws TException {
+        getUserProfileByName_result result = new getUserProfileByName_result();
+        try {
+          result.success = iface.getUserProfileByName(args.userName, args.gatewayId);
+        } catch (org.apache.airavata.registry.api.exception.RegistryServiceException registryException) {
+          result.registryException = registryException;
+        }
+        return result;
+      }
+    }
+
+    public static class doesUserExist<I extends Iface> extends org.apache.thrift.ProcessFunction<I, doesUserExist_args> {
+      public doesUserExist() {
+        super("doesUserExist");
+      }
+
+      public doesUserExist_args getEmptyArgsInstance() {
+        return new doesUserExist_args();
+      }
+
+      protected boolean isOneway() {
+        return false;
+      }
+
+      public doesUserExist_result getResult(I iface, doesUserExist_args args) throws TException {
+        doesUserExist_result result = new doesUserExist_result();
+        try {
+          result.success = iface.doesUserExist(args.userName, args.gatewayId);
+          result.setSuccessIsSet(true);
+        } catch (org.apache.airavata.registry.api.exception.RegistryServiceException registryException) {
+          result.registryException = registryException;
+        }
+        return result;
+      }
+    }
+
+  }
+
+  public static class AsyncProcessor<I extends AsyncIface> extends org.apache.thrift.TBaseAsyncProcessor<I> {
+    private static final Logger LOGGER = LoggerFactory.getLogger(AsyncProcessor.class.getName());
+    public AsyncProcessor(I iface) {
+      super(iface, getProcessMap(new HashMap<String, org.apache.thrift.AsyncProcessFunction<I, ? extends org.apache.thrift.TBase, ?>>()));
+    }
+
+    protected AsyncProcessor(I iface, Map<String,  org.apache.thrift.AsyncProcessFunction<I, ? extends  org.apache.thrift.TBase, ?>> processMap) {
+      super(iface, getProcessMap(processMap));
+    }
+
+    private static <I extends AsyncIface> Map<String,  org.apache.thrift.AsyncProcessFunction<I, ? extends  org.apache.thrift.TBase,?>> getProcessMap(Map<String,  org.apache.thrift.AsyncProcessFunction<I, ? extends  org.apache.thrift.TBase, ?>> processMap) {
+      processMap.put("addUserProfile", new addUserProfile());
+      processMap.put("updateUserProfile", new updateUserProfile());
+      processMap.put("getUserProfileById", new getUserProfileById());
+      processMap.put("deleteUserProfile", new deleteUserProfile());
+      processMap.put("getAllUserProfilesInGateway", new getAllUserProfilesInGateway());
+      processMap.put("getUserProfileByName", new getUserProfileByName());
+      processMap.put("doesUserExist", new doesUserExist());
+      return processMap;
+    }
+
+    public static class addUserProfile<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, addUserProfile_args, String> {
+      public addUserProfile() {
+        super("addUserProfile");
+      }
+
+      public addUserProfile_args getEmptyArgsInstance() {
+        return new addUserProfile_args();
+      }
+
+      public AsyncMethodCallback<String> getResultHandler(final AsyncFrameBuffer fb, final int seqid) {
+        final org.apache.thrift.AsyncProcessFunction fcall = this;
+        return new AsyncMethodCallback<String>() { 
+          public void onComplete(String o) {
+            addUserProfile_result result = new addUserProfile_result();
+            result.success = o;
+            try {
+              fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid);
+              return;
+            } catch (Exception e) {
+              LOGGER.error("Exception writing to internal frame buffer", e);
+            }
+            fb.close();
+          }
+          public void onError(Exception e) {
+            byte msgType = org.apache.thrift.protocol.TMessageType.REPLY;
+            org.apache.thrift.TBase msg;
+            addUserProfile_result result = new addUserProfile_result();
+            if (e instanceof org.apache.airavata.registry.api.exception.RegistryServiceException) {
+                        result.registryException = (org.apache.airavata.registry.api.exception.RegistryServiceException) e;
+                        result.setRegistryExceptionIsSet(true);
+                        msg = result;
+            }
+             else 
+            {
+              msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
+              msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage());
+            }
+            try {
+              fcall.sendResponse(fb,msg,msgType,seqid);
+              return;
+            } catch (Exception ex) {
+              LOGGER.error("Exception writing to internal frame buffer", ex);
+            }
+            fb.close();
+          }
+        };
+      }
+
+      protected boolean isOneway() {
+        return false;
+      }
+
+      public void start(I iface, addUserProfile_args args, AsyncMethodCallback<String> resultHandler) throws TException {
+        iface.addUserProfile(args.userProfile,resultHandler);
+      }
+    }
+
+    public static class updateUserProfile<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, updateUserProfile_args, Boolean> {
+      public updateUserProfile() {
+        super("updateUserProfile");
+      }
+
+      public updateUserProfile_args getEmptyArgsInstance() {
+        return new updateUserProfile_args();
+      }
+
+      public AsyncMethodCallback<Boolean> getResultHandler(final AsyncFrameBuffer fb, final int seqid) {
+        final org.apache.thrift.AsyncProcessFunction fcall = this;
+        return new AsyncMethodCallback<Boolean>() { 
+          public void onComplete(Boolean o) {
+            updateUserProfile_result result = new updateUserProfile_result();
+            result.success = o;
+            result.setSuccessIsSet(true);
+            try {
+              fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid);
+              return;
+            } catch (Exception e) {
+              LOGGER.error("Exception writing to internal frame buffer", e);
+            }
+            fb.close();
+          }
+          public void onError(Exception e) {
+            byte msgType = org.apache.thrift.protocol.TMessageType.REPLY;
+            org.apache.thrift.TBase msg;
+            updateUserProfile_result result = new updateUserProfile_result();
+            if (e instanceof org.apache.airavata.registry.api.exception.RegistryServiceException) {
+                        result.registryException = (org.apache.airavata.registry.api.exception.RegistryServiceException) e;
+                        result.setRegistryExceptionIsSet(true);
+                        msg = result;
+            }
+             else 
+            {
+              msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
+              msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage());
+            }
+            try {
+              fcall.sendResponse(fb,msg,msgType,seqid);
+              return;
+            } catch (Exception ex) {
+              LOGGER.error("Exception writing to internal frame buffer", ex);
+            }
+            fb.close();
+          }
+        };
+      }
+
+      protected boolean isOneway() {
+        return false;
+      }
+
+      public void start(I iface, updateUserProfile_args args, AsyncMethodCallback<Boolean> resultHandler) throws TException {
+        iface.updateUserProfile(args.userProfile,resultHandler);
+      }
+    }
+
+    public static class getUserProfileById<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, getUserProfileById_args, org.apache.airavata.model.user.UserProfile> {
+      public getUserProfileById() {
+        super("getUserProfileById");
+      }
+
+      public getUserProfileById_args getEmptyArgsInstance() {
+        return new getUserProfileById_args();
+      }
+
+      public AsyncMethodCallback<org.apache.airavata.model.user.UserProfile> getResultHandler(final AsyncFrameBuffer fb, final int seqid) {
+        final org.apache.thrift.AsyncProcessFunction fcall = this;
+        return new AsyncMethodCallback<org.apache.airavata.model.user.UserProfile>() { 
+          public void onComplete(org.apache.airavata.model.user.UserProfile o) {
+            getUserProfileById_result result = new getUserProfileById_result();
+            result.success = o;
+            try {
+              fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid);
+              return;
+            } catch (Exception e) {
+              LOGGER.error("Exception writing to internal frame buffer", e);
+            }
+            fb.close();
+          }
+          public void onError(Exception e) {
+            byte msgType = org.apache.thrift.protocol.TMessageType.REPLY;
+            org.apache.thrift.TBase msg;
+            getUserProfileById_result result = new getUserProfileById_result();
+            if (e instanceof org.apache.airavata.registry.api.exception.RegistryServiceException) {
+                        result.registryException = (org.apache.airavata.registry.api.exception.RegistryServiceException) e;
+                        result.setRegistryExceptionIsSet(true);
+                        msg = result;
+            }
+             else 
+            {
+              msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
+              msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage());
+            }
+            try {
+              fcall.sendResponse(fb,msg,msgType,seqid);
+              return;
+            } catch (Exception ex) {
+              LOGGER.error("Exception writing to internal frame buffer", ex);
+            }
+            fb.close();
+          }
+        };
+      }
+
+      protected boolean isOneway() {
+        return false;
+      }
+
+      public void start(I iface, getUserProfileById_args args, AsyncMethodCallback<org.apache.airavata.model.user.UserProfile> resultHandler) throws TException {
+        iface.getUserProfileById(args.userId, args.gatewayId,resultHandler);
+      }
+    }
+
+    public static class deleteUserProfile<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, deleteUserProfile_args, Boolean> {
+      public deleteUserProfile() {
+        super("deleteUserProfile");
+      }
+
+      public deleteUserProfile_args getEmptyArgsInstance() {
+        return new deleteUserProfile_args();
+      }
+
+      public AsyncMethodCallback<Boolean> getResultHandler(final AsyncFrameBuffer fb, final int seqid) {
+        final org.apache.thrift.AsyncProcessFunction fcall = this;
+        return new AsyncMethodCallback<Boolean>() { 
+          public void onComplete(Boolean o) {
+            deleteUserProfile_result result = new deleteUserProfile_result();
+            result.success = o;
+            result.setSuccessIsSet(true);
+            try {
+              fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid);
+              return;
+            } catch (Exception e) {
+              LOGGER.error("Exception writing to internal frame buffer", e);
+            }
+            fb.close();
+          }
+          public void onError(Exception e) {
+            byte msgType = org.apache.thrift.protocol.TMessageType.REPLY;
+            org.apache.thrift.TBase msg;
+            deleteUserProfile_result result = new deleteUserProfile_result();
+            if (e instanceof org.apache.airavata.registry.api.exception.RegistryServiceException) {
+                        result.registryException = (org.apache.airavata.registry.api.exception.RegistryServiceException) e;
+                        result.setRegistryExceptionIsSet(true);
+                        msg = result;
+            }
+             else 
+            {
+              msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
+              msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage());
+            }
+            try {
+              fcall.sendResponse(fb,msg,msgType,seqid);
+              return;
+            } catch (Exception ex) {
+              LOGGER.error("Exception writing to internal frame buffer", ex);
+            }
+            fb.close();
+          }
+        };
+      }
+
+      protected boolean isOneway() {
+        return false;
+      }
+
+      public void start(I iface, deleteUserProfile_args args, AsyncMethodCallback<Boolean> resultHandler) throws TException {
+        iface.deleteUserProfile(args.userId,resultHandler);
+      }
+    }
+
+    public static class getAllUserProfilesInGateway<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, getAllUserProfilesInGateway_args, List<org.apache.airavata.model.user.UserProfile>> {
+      public getAllUserProfilesInGateway() {
+        super("getAllUserProfilesInGateway");
+      }
+
+      public getAllUserProfilesInGateway_args getEmptyArgsInstance() {
+        return new getAllUserProfilesInGateway_args();
+      }
+
+      public AsyncMethodCallback<List<org.apache.airavata.model.user.UserProfile>> getResultHandler(final AsyncFrameBuffer fb, final int seqid) {
+        final org.apache.thrift.AsyncProcessFunction fcall = this;
+        return new AsyncMethodCallback<List<org.apache.airavata.model.user.UserProfile>>() { 
+          public void onComplete(List<org.apache.airavata.model.user.UserProfile> o) {
+            getAllUserProfilesInGateway_result result = new getAllUserProfilesInGateway_result();
+            result.success = o;
+            try {
+              fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid);
+              return;
+            } catch (Exception e) {
+              LOGGER.error("Exception writing to internal frame buffer", e);
+            }
+            fb.close();
+          }
+          public void onError(Exception e) {
+            byte msgType = org.apache.thrift.protocol.TMessageType.REPLY;
+            org.apache.thrift.TBase msg;
+            getAllUserProfilesInGateway_result result = new getAllUserProfilesInGateway_result();
+            if (e instanceof org.apache.airavata.registry.api.exception.RegistryServiceException) {
+                        result.registryException = (org.apache.airavata.registry.api.exception.RegistryServiceException) e;
+                        result.setRegistryExceptionIsSet(true);
+                        msg = result;
+            }
+             else 
+            {
+              msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
+              msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage());
+            }
+            try {
+              fcall.sendResponse(fb,msg,msgType,seqid);
+              return;
+            } catch (Exception ex) {
+              LOGGER.error("Exception writing to internal frame buffer", ex);
+            }
+            fb.close();
+          }
+        };
+      }
+
+      protected boolean isOneway() {
+        return false;
+      }
+
+      public void start(I iface, getAllUserProfilesInGateway_args args, AsyncMethodCallback<List<org.apache.airavata.model.user.UserProfile>> resultHandler) throws TException {
+        iface.getAllUserProfilesInGateway(args.gatewayId, args.offset, args.limit,resultHandler);
+      }
+    }
+
+    public static class getUserProfileByName<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, getUserProfileByName_args, org.apache.airavata.model.user.UserProfile> {
+      public getUserProfileByName() {
+        super("getUserProfileByName");
+      }
+
+      public getUserProfileByName_args getEmptyArgsInstance() {
+        return new getUserProfileByName_args();
+      }
+
+      public AsyncMethodCallback<org.apache.airavata.model.user.UserProfile> getResultHandler(final AsyncFrameBuffer fb, final int seqid) {
+        final org.apache.thrift.AsyncProcessFunction fcall = this;
+        return new AsyncMethodCallback<org.apache.airavata.model.user.UserProfile>() { 
+          public void onComplete(org.apache.airavata.model.user.UserProfile o) {
+            getUserProfileByName_result result = new getUserProfileByName_result();
+            result.success = o;
+            try {
+              fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid);
+              return;
+            } catch (Exception e) {
+              LOGGER.error("Exception writing to internal frame buffer", e);
+            }
+            fb.close();
+          }
+          public void onError(Exception e) {
+            byte msgType = org.apache.thrift.protocol.TMessageType.REPLY;
+            org.apache.thrift.TBase msg;
+            getUserProfileByName_result result = new getUserProfileByName_result();
+            if (e instanceof org.apache.airavata.registry.api.exception.RegistryServiceException) {
+                        result.registryException = (org.apache.airavata.registry.api.exception.RegistryServiceException) e;
+                        result.setRegistryExceptionIsSet(true);
+                        msg = result;
+            }
+             else 
+            {
+              msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
+              msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage());
+            }
+            try {
+              fcall.sendResponse(fb,msg,msgType,seqid);
+              return;
+            } catch (Exception ex) {
+              LOGGER.error("Exception writing to internal frame buffer", ex);
+            }
+            fb.close();
+          }
+        };
+      }
+
+      protected boolean isOneway() {
+        return false;
+      }
+
+      public void start(I iface, getUserProfileByName_args args, AsyncMethodCallback<org.apache.airavata.model.user.UserProfile> resultHandler) throws TException {
+        iface.getUserProfileByName(args.userName, args.gatewayId,resultHandler);
+      }
+    }
+
+    public static class doesUserExist<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, doesUserExist_args, Boolean> {
+      public doesUserExist() {
+        super("doesUserExist");
+      }
+
+      public doesUserExist_args getEmptyArgsInstance() {
+        return new doesUserExist_args();
+      }
+
+      public AsyncMethodCallback<Boolean> getResultHandler(final AsyncFrameBuffer fb, final int seqid) {
+        final org.apache.thrift.AsyncProcessFunction fcall = this;
+        return new AsyncMethodCallback<Boolean>() { 
+          public void onComplete(Boolean o) {
+            doesUserExist_result result = new doesUserExist_result();
+            result.success = o;
+            result.setSuccessIsSet(true);
+            try {
+              fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid);
+              return;
+            } catch (Exception e) {
+              LOGGER.error("Exception writing to internal frame buffer", e);
+            }
+            fb.close();
+          }
+          public void onError(Exception e) {
+            byte msgType = org.apache.thrift.protocol.TMessageType.REPLY;
+            org.apache.thrift.TBase msg;
+            doesUserExist_result result = new doesUserExist_result();
+            if (e instanceof org.apache.airavata.registry.api.exception.RegistryServiceException) {
+                        result.registryException = (org.apache.airavata.registry.api.exception.RegistryServiceException) e;
+                        result.setRegistryExceptionIsSet(true);
+                        msg = result;
+            }
+             else 
+            {
+              msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
+              msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage());
+            }
+            try {
+              fcall.sendResponse(fb,msg,msgType,seqid);
+              return;
+            } catch (Exception ex) {
+              LOGGER.error("Exception writing to internal frame buffer", ex);
+            }
+            fb.close();
+          }
+        };
+      }
+
+      protected boolean isOneway() {
+        return false;
+      }
+
+      public void start(I iface, doesUserExist_args args, AsyncMethodCallback<Boolean> resultHandler) throws TException {
+        iface.doesUserExist(args.userName, args.gatewayId,resultHandler);
+      }
+    }
+
+  }
+
+  public static class addUserProfile_args implements org.apache.thrift.TBase<addUserProfile_args, addUserProfile_args._Fields>, java.io.Serializable, Cloneable, Comparable<addUserProfile_args>   {
+    private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("addUserProfile_args");
+
+    private static final org.apache.thrift.protocol.TField USER_PROFILE_FIELD_DESC = new org.apache.thrift.protocol.TField("userProfile", org.apache.thrift.protocol.TType.STRUCT, (short)1);
+
+    private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+    static {
+      schemes.put(StandardScheme.class, new addUserProfile_argsStandardSchemeFactory());
+      schemes.put(TupleScheme.class, new addUserProfile_argsTupleSchemeFactory());
+    }
+
+    public org.apache.airavata.model.user.UserProfile userProfile; // required
+
+    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
+    public enum _Fields implements org.apache.thrift.TFieldIdEnum {
+      USER_PROFILE((short)1, "userProfile");
+
+      private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
+
+      static {
+        for (_Fields field : EnumSet.allOf(_Fields.class)) {
+          byName.put(field.getFieldName(), field);
+        }
+      }
+
+      /**
+       * Find the _Fields constant that matches fieldId, or null if its not found.
+       */
+      public static _Fields findByThriftId(int fieldId) {
+        switch(fieldId) {
+          case 1: // USER_PROFILE
+            return USER_PROFILE;
+          default:
+            return null;
+        }
+      }
+
+      /**
+       * Find the _Fields constant that matches fieldId, throwing an exception
+       * if it is not found.
+       */
+      public static _Fields findByThriftIdOrThrow(int fieldId) {
+        _Fields fields = findByThriftId(fieldId);
+        if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
+        return fields;
+      }
+
+      /**
+       * Find the _Fields constant that matches name, or null if its not found.
+       */
+      public static _Fields findByName(String name) {
+        return byName.get(name);
+      }
+
+      private final short _thriftId;
+      private final String _fieldName;
+
+      _Fields(short thriftId, String fieldName) {
+        _thriftId = thriftId;
+        _fieldName = fieldName;
+      }
+
+      public short getThriftFieldId() {
+        return _thriftId;
+      }
+
+      public String getFieldName() {
+        return _fieldName;
+      }
+    }
+
+    // isset id assignments
+    public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
+    static {
+      Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
+      tmpMap.put(_Fields.USER_PROFILE, new org.apache.thrift.meta_data.FieldMetaData("userProfile", org.apache.thrift.TFieldRequirementType.REQUIRED, 
+          new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, org.apache.airavata.model.user.UserProfile.class)));
+      metaDataMap = Collections.unmodifiableMap(tmpMap);
+      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(addUserProfile_args.class, metaDataMap);
+    }
+
+    public addUserProfile_args() {
+    }
+
+    public addUserProfile_args(
+      org.apache.airavata.model.user.UserProfile userProfile)
+    {
+      this();
+      this.userProfile = userProfile;
+    }
+
+    /**
+     * Performs a deep copy on <i>other</i>.
+     */
+    public addUserProfile_args(addUserProfile_args other) {
+      if (other.isSetUserProfile()) {
+        this.userProfile = new org.apache.airavata.model.user.UserProfile(other.userProfile);
+      }
+    }
+
+    public addUserProfile_args deepCopy() {
+      return new addUserProfile_args(this);
+    }
+
+    @Override
+    public void clear() {
+      this.userProfile = null;
+    }
+
+    public org.apache.airavata.model.user.UserProfile getUserProfile() {
+      return this.userProfile;
+    }
+
+    public addUserProfile_args setUserProfile(org.apache.airavata.model.user.UserProfile userProfile) {
+      this.userProfile = userProfile;
+      return this;
+    }
+
+    public void unsetUserProfile() {
+      this.userProfile = null;
+    }
+
+    /** Returns true if field userProfile is set (has been assigned a value) and false otherwise */
+    public boolean isSetUserProfile() {
+      return this.userProfile != null;
+    }
+
+    public void setUserProfileIsSet(boolean value) {
+      if (!value) {
+        this.userProfile = null;
+      }
+    }
+
+    public void setFieldValue(_Fields field, Object value) {
+      switch (field) {
+      case USER_PROFILE:
+        if (value == null) {
+          unsetUserProfile();
+        } else {
+          setUserProfile((org.apache.airavata.model.user.UserProfile)value);
+        }
+        break;
+
+      }
+    }
+
+    public Object getFieldValue(_Fields field) {
+      switch (field) {
+      case USER_PROFILE:
+        return getUserProfile();
+
+      }
+      throw new IllegalStateException();
+    }
+
+    /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
+    public boolean isSet(_Fields field) {
+      if (field == null) {
+        throw new IllegalArgumentException();
+      }
+
+      switch (field) {
+      case USER_PROFILE:
+        return isSetUserProfile();
+      }
+      throw new IllegalStateException();
+    }
+
+    @Override
+    public boolean equals(Object that) {
+      if (that == null)
+        return false;
+      if (that instanceof addUserProfile_args)
+        return this.equals((addUserProfile_args)that);
+      return false;
+    }
+
+    public boolean equals(addUserProfile_args that) {
+      if (that == null)
+        return false;
+
+      boolean this_present_userProfile = true && this.isSetUserProfile();
+      boolean that_present_userProfile = true && that.isSetUserProfile();
+      if (this_present_userProfile || that_present_userProfile) {
+        if (!(this_present_userProfile && that_present_userProfile))
+          return false;
+        if (!this.userProfile.equals(that.userProfile))
+          return false;
+      }
+
+      return true;
+    }
+
+    @Override
+    public int hashCode() {
+      List<Object> list = new ArrayList<Object>();
+
+      boolean present_userProfile = true && (isSetUserProfile());
+      list.add(present_userProfile);
+      if (present_userProfile)
+        list.add(userProfile);
+
+      return list.hashCode();
+    }
+
+    @Override
+    public int compareTo(addUserProfile_args other) {
+      if (!getClass().equals(other.getClass())) {
+        return getClass().getName().compareTo(other.getClass().getName());
+      }
+
+      int lastComparison = 0;
+
+      lastComparison = Boolean.valueOf(isSetUserProfile()).compareTo(other.isSetUserProfile());
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+      if (isSetUserProfile()) {
+        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.userProfile, other.userProfile);
+        if (lastComparison != 0) {
+          return lastComparison;
+        }
+      }
+      return 0;
+    }
+
+    public _Fields fieldForId(int fieldId) {
+      return _Fields.findByThriftId(fieldId);
+    }
+
+    public void read(org.apache.thrift.protocol.TProtocol iprot) throws TException {
+      schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
+    }
+
+    public void write(org.apache.thrift.protocol.TProtocol oprot) throws TException {
+      schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
+    }
+
+    @Override
+    public String toString() {
+      StringBuilder sb = new StringBuilder("addUserProfile_args(");
+      boolean first = true;
+
+      sb.append("userProfile:");
+      if (this.userProfile == null) {
+        sb.append("null");
+      } else {
+        sb.append(this.userProfile);
+      }
+      first = false;
+      sb.append(")");
+      return sb.toString();
+    }
+
+    public void validate() throws TException {
+      // check for required fields
+      if (userProfile == null) {
+        throw new TProtocolException("Required field 'userProfile' was not present! Struct: " + toString());
+      }
+      // check for sub-struct validity
+      if (userProfile != null) {
+        userProfile.validate();
+      }
+    }
+
+    private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
+      try {
+        write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
+      } catch (TException te) {
+        throw new java.io.IOException(te);
+      }
+    }
+
+    private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
+      try {
+        read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
+      } catch (TException te) {
+        throw new java.io.IOException(te);
+      }
+    }
+
+    private static class addUserProfile_argsStandardSchemeFactory implements SchemeFactory {
+      public addUserProfile_argsStandardScheme getScheme() {
+        return new addUserProfile_argsStandardScheme();
+      }
+    }
+
+    private static class addUserProfile_argsStandardScheme extends StandardScheme<addUserProfile_args> {
+
+      public void read(org.apache.thrift.protocol.TProtocol iprot, addUserProfile_args struct) throws TException {
+        org.apache.thrift.protocol.TField schemeField;
+        iprot.readStructBegin();
+        while (true)
+        {
+          schemeField = iprot.readFieldBegin();
+          if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { 
+            break;
+          }
+          switch (schemeField.id) {
+            case 1: // USER_PROFILE
+              if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
+                struct.userProfile = new org.apache.airavata.model.user.UserProfile();
+                struct.userProfile.read(iprot);
+                struct.setUserProfileIsSet(true);
+              } else { 
+                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+              }
+              break;
+            default:
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+          }
+          iprot.readFieldEnd();
+        }
+        iprot.readStructEnd();
+
+        // check for required fields of primitive type, which can't be checked in the validate method
+        struct.validate();
+      }
+
+      public void write(org.apache.thrift.protocol.TProtocol oprot, addUserProfile_args struct) throws TException {
+        struct.validate();
+
+        oprot.writeStructBegin(STRUCT_DESC);
+        if (struct.userProfile != null) {
+          oprot.writeFieldBegin(USER_PROFILE_FIELD_DESC);
+          struct.userProfile.write(oprot);
+          oprot.writeFieldEnd();
+        }
+        oprot.writeFieldStop();
+        oprot.writeStructEnd();
+      }
+
+    }
+
+    private static class addUserProfile_argsTupleSchemeFactory implements SchemeFactory {
+      public addUserProfile_argsTupleScheme getScheme() {
+        return new addUserProfile_argsTupleScheme();
+      }
+    }
+
+    private static class addUserProfile_argsTupleScheme extends TupleScheme<addUserProfile_args> {
+
+      @Override
+      public void write(org.apache.thrift.protocol.TProtocol prot, addUserProfile_args struct) throws TException {
+        TTupleProtocol oprot = (TTupleProtocol) prot;
+        struct.userProfile.write(oprot);
+      }
+
+      @Override
+      public void read(org.apache.thrift.protocol.TProtocol prot, addUserProfile_args struct) throws TException {
+        TTupleProtocol iprot = (TTupleProtocol) prot;
+        struct.userProfile = new org.apache.airavata.model.user.UserProfile();
+        struct.userProfile.read(iprot);
+        struct.setUserProfileIsSet(true);
+      }
+    }
+
+  }
+
+  public static class addUserProfile_result implements org.apache.thrift.TBase<addUserProfile_result, addUserProfile_result._Fields>, java.io.Serializable, Cloneable, Comparable<addUserProfile_result>   {
+    private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("addUserProfile_result");
+
+    private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.STRING, (short)0);
+    private static final org.apache.thrift.protocol.TField REGISTRY_EXCEPTION_FIELD_DESC = new org.apache.thrift.protocol.TField("registryException", org.apache.thrift.protocol.TType.STRUCT, (short)1);
+
+    private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+    static {
+      schemes.put(StandardScheme.class, new addUserProfile_resultStandardSchemeFactory());
+      schemes.put(TupleScheme.class, new addUserProfile_resultTupleSchemeFactory());
+    }
+
+    public String success; // required
+    public org.apache.airavata.registry.api.exception.RegistryServiceException registryException; // required
+
+    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
+    public enum _Fields implements org.apache.thrift.TFieldIdEnum {
+      SUCCESS((short)0, "success"),
+      REGISTRY_EXCEPTION((short)1, "registryException");
+
+      private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
+
+      static {
+        for (_Fields field : EnumSet.allOf(_Fields.class)) {
+          byName.put(field.getFieldName(), field);
+        }
+      }
+
+      /**
+       * Find the _Fields constant that matches fieldId, or null if its not found.
+       */
+      public static _Fields findByThriftId(int fieldId) {
+        switch(fieldId) {
+          case 0: // SUCCESS
+            return SUCCESS;
+          case 1: // REGISTRY_EXCEPTION
+            return REGISTRY_EXCEPTION;
+          default:
+            return null;
+        }
+      }
+
+      /**
+       * Find the _Fields constant that matches fieldId, throwing an exception
+       * if it is not found.
+       */
+      public static _Fields findByThriftIdOrThrow(int fieldId) {
+        _Fields fields = findByThriftId(fieldId);
+        if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
+        return fields;
+      }
+
+      /**
+       * Find the _Fields constant that matches name, or null if its not found.
+       */
+      public static _Fields findByName(String name) {
+        return byName.get(name);
+      }
+
+      private final short _thriftId;
+      private final String _fieldName;
+
+      _Fields(short thriftId, String fieldName) {
+        _thriftId = thriftId;
+        _fieldName = fieldName;
+      }
+
+      public short getThriftFieldId() {
+        return _thriftId;
+      }
+
+      public String getFieldName() {
+        return _fieldName;
+      }
+    }
+
+    // isset id assignments
+    public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
+    static {
+      Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
+      tmpMap.put(_Fields.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT, 
+          new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+      tmpMap.put(_Fields.REGISTRY_EXCEPTION, new org.apache.thrift.meta_data.FieldMetaData("registryException", org.apache.thrift.TFieldRequirementType.DEFAULT, 
+          new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRUCT)));
+      metaDataMap = Collections.unmodifiableMap(tmpMap);
+      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(addUserProfile_result.class, metaDataMap);
+    }
+
+    public addUserProfile_result() {
+    }
+
+    public addUserProfile_result(
+      String success,
+      org.apache.airavata.registry.api.exception.RegistryServiceException registryException)
+    {
+      this();
+      this.success = success;
+      this.registryException = registryException;
+    }
+
+    /**
+     * Performs a deep copy on <i>other</i>.
+     */
+    public addUserProfile_result(addUserProfile_result other) {
+      if (other.isSetSuccess()) {
+        this.success = other.success;
+      }
+      if (other.isSetRegistryException()) {
+        this.registryException = new org.apache.airavata.registry.api.exception.RegistryServiceException(other.registryException);
+      }
+    }
+
+    public addUserProfile_result deepCopy() {
+      return new addUserProfile_result(this);
+    }
+
+    @Override
+    public void clear() {
+      this.success = null;
+      this.registryException = null;
+    }
+
+    public String getSuccess() {
+      return this.success;
+    }
+
+    public addUserProfile_result setSuccess(String success) {
+      this.success = success;
+      return this;
+    }
+
+    public void unsetSuccess() {
+      this.success = null;
+    }
+
+    /** Returns true if field success is set (has been assigned a value) and false otherwise */
+    public boolean isSetSuccess() {
+      return this.success != null;
+    }
+
+    public void setSuccessIsSet(boolean value) {
+      if (!value) {
+        this.success = null;
+      }
+    }
+
+    public org.apache.airavata.registry.api.exception.RegistryServiceException getRegistryException() {
+      return this.registryException;
+    }
+
+    public addUserProfile_result setRegistryException(org.apache.airavata.registry.api.exception.RegistryServiceException registryException) {
+      this.registryException = registryException;
+      return this;
+    }
+
+    public void unsetRegistryException() {
+      this.registryException = null;
+    }
+
+    /** Returns true if field registryException is set (has been assigned a value) and false otherwise */
+    public boolean isSetRegistryException() {
+      return this.registryException != null;
+    }
+
+    public void setRegistryExceptionIsSet(boolean value) {
+      if (!value) {
+        this.registryException = null;
+      }
+    }
+
+    public void setFieldValue(_Fields field, Object value) {
+      switch (field) {
+      case SUCCESS:
+        if (value == null) {
+          unsetSuccess();
+        } else {
+          setSuccess((String)value);
+        }
+        break;
+
+      case REGISTRY_EXCEPTION:
+        if (value == null) {
+          unsetRegistryException();
+        } else {
+          setRegistryException((org.apache.airavata.registry.api.exception.RegistryServiceException)value);
+        }
+        break;
+
+      }
+    }
+
+    public Object getFieldValue(_Fields field) {
+      switch (field) {
+      case SUCCESS:
+        return getSuccess();
+
+      case REGISTRY_EXCEPTION:
+        return getRegistryException();
+
+      }
+      throw new IllegalStateException();
+    }
+
+    /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
+    public boolean isSet(_Fields field) {
+      if (field == null) {
+        throw new IllegalArgumentException();
+      }
+
+      switch (field) {
+      case SUCCESS:
+        return isSetSuccess();
+      case REGISTRY_EXCEPTION:
+        return isSetRegistryException();
+      }
+      throw new IllegalStateException();
+    }
+
+    @Override
+    public boolean equals(Object that) {
+      if (that == null)
+        return false;
+      if (that instanceof addUserProfile_result)
+        return this.equals((addUserProfile_result)that);
+      return false;
+    }
+
+    public boolean equals(addUserProfile_result that) {
+      if (that == null)
+        return false;
+
+      boolean this_present_success = true && this.isSetSuccess();
+      boolean that_present_success = true && that.isSetSuccess();
+      if (this_present_success || that_present_success) {
+        if (!(this_present_success && that_present_success))
+          return false;
+        if (!this.success.equals(that.success))
+          return false;
+      }
+
+      boolean this_present_registryException = true && this.isSetRegistryException();
+      boolean that_present_registryException = true && that.isSetRegistryException();
+      if (this_present_registryException || that_present_registryException) {
+        if (!(this_present_registryException && that_present_registryException))
+          return false;
+        if (!this.registryException.equals(that.registryException))
+          return false;
+      }
+
+      return true;
+    }
+
+    @Override
+    public int hashCode() {
+      List<Object> list = new ArrayList<Object>();
+
+      boolean present_success = true && (isSetSuccess());
+      list.add(present_success);
+      if (present_success)
+        list.add(success);
+
+      boolean present_registryException = true && (isSetRegistryException());
+      list.add(present_registryException);
+      if (present_registryException)
+        list.add(registryException);
+
+      return list.hashCode();
+    }
+
+    @Override
+    public int compareTo(addUserProfile_result other) {
+      if (!getClass().equals(other.getClass())) {
+        return getClass().getName().compareTo(other.getClass().getName());
+      }
+
+      int lastComparison = 0;
+
+      lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess());
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+      if (isSetSuccess()) {
+        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success);
+        if (lastComparison != 0) {
+          return lastComparison;
+        }
+      }
+      lastComparison = Boolean.valueOf(isSetRegistryException()).compareTo(other.isSetRegistryException());
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+      if (isSetRegistryException()) {
+        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.registryException, other.registryException);
+        if (lastComparison != 0) {
+          return lastComparison;
+        }
+      }
+      return 0;
+    }
+
+    public _Fields fieldForId(int fieldId) {
+      return _Fields.findByThriftId(fieldId);
+    }
+
+    public void read(org.apache.thrift.protocol.TProtocol iprot) throws TException {
+      schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
+    }
+
+    public void write(org.apache.thrift.protocol.TProtocol oprot) throws TException {
+      schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
+      }
+
+    @Override
+    public String toString() {
+      StringBuilder sb = new StringBuilder("addUserProfile_result(");
+      boolean first = true;
+
+      sb.append("success:");
+      if (this.success == null) {
+        sb.append("null");
+      } else {
+        sb.append(this.success);
+      }
+      first = false;
+      if (!first) sb.append(", ");
+      sb.append("registryException:");
+      if (this.registryException == null) {
+        sb.append("null");
+      } else {
+        sb.append(this.registryException);
+      }
+      first = false;
+      sb.append(")");
+      return sb.toString();
+    }
+
+    public void validate() throws TException {
+      // check for required fields
+      // check for sub-struct validity
+    }
+
+    private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
+      try {
+        write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
+      } catch (TException te) {
+        throw new java.io.IOException(te);
+      }
+    }
+
+    private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
+      try {
+        read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
+      } catch (TException te) {
+        throw new java.io.IOException(te);
+      }
+    }
+
+    private static class addUserProfile_resultStandardSchemeFactory implements SchemeFactory {
+      public addUserProfile_resultStandardScheme getScheme() {
+        return new addUserProfile_resultStandardScheme();
+      }
+    }
+
+    private static class addUserProfile_resultStandardScheme extends StandardScheme<addUserProfile_result> {
+
+      public void read(org.apache.thrift.protocol.TProtocol iprot, addUserProfile_result struct) throws TException {
+        org.apache.thrift.protocol.TField schemeField;
+        iprot.readStructBegin();
+        while (true)
+        {
+          schemeField = iprot.readFieldBegin();
+          if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { 
+            break;
+          }
+          switch (schemeField.id) {
+            case 0: // SUCCESS
+              if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+                struct.success = iprot.readString();
+                struct.setSuccessIsSet(true);
+              } else { 
+                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+              }
+              break;
+            case 1: // REGISTRY_EXCEPTION
+              if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
+                struct.registryException = new org.apache.airavata.registry.api.exception.RegistryServiceException();
+                struct.registryException.read(iprot);
+                struct.setRegistryExceptionIsSet(true);
+              } else { 
+                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+              }
+              break;
+            default:
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+          }
+          iprot.readFieldEnd();
+        }
+        iprot.readStructEnd();
+
+        // check for required fields of primitive type, which can't be checked in the validate method
+        struct.validate();
+      }
+
+      public void write(org.apache.thrift.protocol.TProtocol oprot, addUserProfile_result struct) throws TException {
+        struct.validate();
+
+        oprot.writeStructBegin(STRUCT_DESC);
+        if (struct.success != null) {
+          oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
+          oprot.writeString(struct.success);
+          oprot.writeFieldEnd();
+        }
+        if (struct.registryException != null) {
+          oprot.writeFieldBegin(REGISTRY_EXCEPTION_FIELD_DESC);
+          struct.registryException.write(oprot);
+          oprot.writeFieldEnd();
+        }
+        oprot.writeFieldStop();
+        oprot.writeStructEnd();
+      }
+
+    }
+
+    private static class addUserProfile_resultTupleSchemeFactory implements SchemeFactory {
+      public addUserProfile_resultTupleScheme getScheme() {
+        return new addUserProfile_resultTupleScheme();
+      }
+    }
+
+    private static class addUserProfile_resultTupleScheme extends TupleScheme<addUserProfile_result> {
+
+      @Override
+      public void write(org.apache.thrift.protocol.TProtocol prot, addUserProfile_result struct) throws TException {
+        TTupleProtocol oprot = (TTupleProtocol) prot;
+        BitSet optionals = new BitSet();
+        if (struct.isSetSuccess()) {
+          optionals.set(0);
+        }
+        if (struct.isSetRegistryException()) {
+          optionals.set(1);
+        }
+        oprot.writeBitSet(optionals, 2);
+        if (struct.isSetSuccess()) {
+          oprot.writeString(struct.success);
+        }
+        if (struct.isSetRegistryException()) {
+          struct.registryException.write(oprot);
+        }
+      }
+
+      @Override
+      public void read(org.apache.thrift.protocol.TProtocol prot, addUserProfile_result struct) throws TException {
+        TTupleProtocol iprot = (TTupleProtocol) prot;
+        BitSet incoming = iprot.readBitSet(2);
+        if (incoming.get(0)) {
+          struct.success = iprot.readString();
+          struct.setSuccessIsSet(true);
+        }
+        if (incoming.get(1)) {
+          struct.registryException = new org.apache.airavata.registry.api.exception.RegistryServiceException();
+          struct.registryException.read(iprot);
+          struct.setRegistryExceptionIsSet(true);
+        }
+      }
+    }
+
+  }
+
+  public static class updateUserProfile_args implements org.apache.thrift.TBase<updateUserProfile_args, updateUserProfile_args._Fields>, java.io.Serializable, Cloneable, Comparable<updateUserProfile_args>   {
+    private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("updateUserProfile_args");
+
+    private static final org.apache.thrift.protocol.TField USER_PROFILE_FIELD_DESC = new org.apache.thrift.protocol.TField("userProfile", org.apache.thrift.protocol.TType.STRUCT, (short)1);
+
+    private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+    static {
+      schemes.put(StandardScheme.class, new updateUserProfile_argsStandardSchemeFactory());
+      schemes.put(TupleScheme.class, new updateUserProfile_argsTupleSchemeFactory());
+    }
+
+    public org.apache.airavata.model.user.UserProfile userProfile; // required
+
+    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
+    public enum _Fields implements org.apache.thrift.TFieldIdEnum {
+      USER_PROFILE((short)1, "userProfile");
+
+      private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
+
+      static {
+        for (_Fields field : EnumSet.allOf(_Fields.class)) {
+          byName.put(field.getFieldName(), field);
+        }
+      }
+
+      /**
+       * Find the _Fields constant that matches fieldId, or null if its not found.
+       */
+      public static _Fields findByThriftId(int fieldId) {
+        switch(fieldId) {
+          case 1: // USER_PROFILE
+            return USER_PROFILE;
+          default:
+            return null;
+        }
+      }
+
+      /**
+       * Find the _Fields constant that matches fieldId, throwing an exception
+       * if it is not found.
+       */
+      public static _Fields findByThriftIdOrThrow(int fieldId) {
+        _Fields fields = findByThriftId(fieldId);
+        if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
+        return fields;
+      }
+
+      /**
+       * Find the _Fields constant that matches name, or null if its not found.
+       */
+      public static _Fields findByName(String name) {
+        return byName.get(name);
+      }
+
+      private final short _thriftId;
+      private final String _fieldName;
+
+      _Fields(short thriftId, String fieldName) {
+        _thriftId = thriftId;
+        _fieldName = fieldName;
+      }
+
+      public short getThriftFieldId() {
+        return _thriftId;
+      }
+
+      public String getFieldName() {
+        return _fieldName;
+      }
+    }
+
+    // isset id assignments
+    public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
+    static {
+      Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
+      tmpMap.put(_Fields.USER_PROFILE, new org.apache.thrift.meta_data.FieldMetaData("userProfile", org.apache.thrift.TFieldRequirementType.REQUIRED, 
+          new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, org.apache.airavata.model.user.UserProfile.class)));
+      metaDataMap = Collections.unmodifiableMap(tmpMap);
+      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(updateUserProfile_args.class, metaDataMap);
+    }
+
+    public updateUserProfile_args() {
+    }
+
+    public updateUserProfile_args(
+      org.apache.airavata.model.user.UserProfile userProfile)
+    {
+      this();
+      this.userProfile = userProfile;
+    }
+
+    /**
+     * Performs a deep copy on <i>other</i>.
+     */
+    public updateUserProfile_args(updateUserProfile_args other) {
+      if (other.isSetUserProfile()) {
+        this.userProfile = new org.apache.airavata.model.user.UserProfile(other.userProfile);
+      }
+    }
+
+

<TRUNCATED>

[4/5] airavata git commit: migrating user-profile service and new registry components to develop branch

Posted by sh...@apache.org.
migrating user-profile service and new registry components to develop branch


Project: http://git-wip-us.apache.org/repos/asf/airavata/repo
Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/d9a69ae5
Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/d9a69ae5
Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/d9a69ae5

Branch: refs/heads/develop
Commit: d9a69ae546736ce3265b6b5cedeeb6a2361293d8
Parents: 4d5b61c
Author: Anuj Bhandar <bh...@gmail.com>
Authored: Mon Dec 12 15:00:27 2016 -0500
Committer: Anuj Bhandar <bh...@gmail.com>
Committed: Mon Dec 12 15:00:27 2016 -0500

----------------------------------------------------------------------
 .../common/utils/ApplicationSettings.java       |    8 +
 .../airavata/common/utils/ServerSettings.java   |    5 +
 .../main/resources/airavata-server.properties   |    7 +
 modules/registry-refactoring/pom.xml            |  127 +
 .../registry/core/RegistryException.java        |   28 +
 .../workspacecatalog/GatewayEntity.java         |  221 +
 .../workspacecatalog/NSFDemographicsEntity.java |   94 +
 .../workspacecatalog/NotificationEntity.java    |  110 +
 .../workspacecatalog/ProjectEntity.java         |   92 +
 .../workspacecatalog/UserProfileEntity.java     |  247 +
 .../core/repositories/AbstractRepository.java   |   98 +
 .../workspacecatalog/GatewayRepository.java     |   36 +
 .../NotificationRepository.java                 |   35 +
 .../workspacecatalog/ProjectRepository.java     |   35 +
 .../workspacecatalog/UserProfileRepository.java |   88 +
 .../airavata/registry/core/utils/Committer.java |   27 +
 .../airavata/registry/core/utils/JPAUtils.java  |   82 +
 .../core/utils/ObjectMapperSingleton.java       |   39 +
 .../registry/core/utils/QueryConstants.java     |   22 +
 .../src/main/resources/META-INF/persistence.xml |   32 +
 .../src/main/resources/workspace_catalog.sql    |  125 +
 .../repositories/WorkspaceRepositoryTest.java   |  197 +
 .../org/apache/airavata/server/ServerMain.java  |    2 +
 modules/user-profile/pom.xml                    |    4 +-
 modules/user-profile/user-profile-core/pom.xml  |   88 -
 .../core/AbstractThriftDeserializer.java        |  151 -
 .../core/AbstractThriftSerializer.java          |  122 -
 .../userprofile/core/ModelConversionHelper.java |   77 -
 .../airavata/userprofile/core/MongoUtil.java    |   59 -
 .../userprofile/core/UserProfileCPIImpl.java    |   79 -
 .../core/UserProfileCPIImplFactory.java         |   43 -
 .../userprofile/core/UserProfileDao.java        |  164 -
 .../core/UserProfileDeserializer.java           |   64 -
 .../userprofile/core/UserProfileSerializer.java |   51 -
 .../core/UserProfileCPIImplTest.java            |   68 -
 modules/user-profile/user-profile-cpi/pom.xml   |   30 -
 .../userprofile/cpi/UserProfileCPI.java         |   42 -
 .../userprofile/cpi/UserProfileException.java   |   32 -
 .../user-profile-service/.classpath             |   26 +
 .../user-profile/user-profile-service/pom.xml   |   27 +
 .../server/UserProfileHandler.java              |   85 +
 .../server/UserProfileServer.java               |  141 +
 modules/user-profile/user-profile-stubs/pom.xml |   35 +
 .../api/exception/RegistryServiceException.java |  407 +
 .../airavata/userprofile/crude/cpi/Test.java    |   14 +
 .../crude/cpi/UserProfileCrudeService.java      | 7488 ++++++++++++++++++
 .../client/UserProfileServiceClientFactory.java |   43 +
 .../cpi/user_profile_crud_cpiConstants.java     |   41 +
 pom.xml                                         |    1 +
 49 files changed, 10067 insertions(+), 1072 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/d9a69ae5/modules/commons/src/main/java/org/apache/airavata/common/utils/ApplicationSettings.java
----------------------------------------------------------------------
diff --git a/modules/commons/src/main/java/org/apache/airavata/common/utils/ApplicationSettings.java b/modules/commons/src/main/java/org/apache/airavata/common/utils/ApplicationSettings.java
index 3c3eed7..e44c4ab 100644
--- a/modules/commons/src/main/java/org/apache/airavata/common/utils/ApplicationSettings.java
+++ b/modules/commons/src/main/java/org/apache/airavata/common/utils/ApplicationSettings.java
@@ -413,6 +413,14 @@ public class ApplicationSettings {
         return getSetting("cluster.status.monitoring.repeat.time");
     }
 
+    public static String getUserProfileServerHost() throws ApplicationSettingsException {
+        return getSetting(ServerSettings.USER_PROFILE_SERVER_HOST);
+    }
+
+    public static String getUserProfileServerPort() throws ApplicationSettingsException {
+        return getSetting(ServerSettings.USER_PROFILE_SERVER_PORT);
+    }
+
     /**
      * @deprecated use {{@link #getSetting(String)}}
      * @return

http://git-wip-us.apache.org/repos/asf/airavata/blob/d9a69ae5/modules/commons/src/main/java/org/apache/airavata/common/utils/ServerSettings.java
----------------------------------------------------------------------
diff --git a/modules/commons/src/main/java/org/apache/airavata/common/utils/ServerSettings.java b/modules/commons/src/main/java/org/apache/airavata/common/utils/ServerSettings.java
index 46b1ebb..cdf49e0 100644
--- a/modules/commons/src/main/java/org/apache/airavata/common/utils/ServerSettings.java
+++ b/modules/commons/src/main/java/org/apache/airavata/common/utils/ServerSettings.java
@@ -122,6 +122,11 @@ public class ServerSettings extends ApplicationSettings {
     private static final String KAFKA_TOPIC_PREFIX = "kafka.topic.prefix";
     private static final String SERVER_ROLES = "server.roles";
 
+    //User Profile onstants
+
+    public static final String USER_PROFILE_SERVER_HOST = "user.profile.server.host";
+    public static final String USER_PROFILE_SERVER_PORT = "user.profile.server.port";
+
     // todo until AIRAVATA-2066 is finished, keep server side list configurations here.
     private static Map<String, String[]> listConfigurations = new HashMap<>();
 

http://git-wip-us.apache.org/repos/asf/airavata/blob/d9a69ae5/modules/configuration/server/src/main/resources/airavata-server.properties
----------------------------------------------------------------------
diff --git a/modules/configuration/server/src/main/resources/airavata-server.properties b/modules/configuration/server/src/main/resources/airavata-server.properties
index ab19a12..ffc9ea8 100644
--- a/modules/configuration/server/src/main/resources/airavata-server.properties
+++ b/modules/configuration/server/src/main/resources/airavata-server.properties
@@ -325,3 +325,10 @@ isRunningOnAws=false
 kafka.broker.list=localhost:9092
 kafka.topic.prefix=local
 enable.kafka.logging=false
+
+###########################################################################
+# User Profile module Configuration
+###########################################################################
+user.profile.server.host=localhost
+user.profile.server.port=8961
+user_profile=com.apache.airavata.user.profile.server.UserProfileServer
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/d9a69ae5/modules/registry-refactoring/pom.xml
----------------------------------------------------------------------
diff --git a/modules/registry-refactoring/pom.xml b/modules/registry-refactoring/pom.xml
new file mode 100644
index 0000000..b794349
--- /dev/null
+++ b/modules/registry-refactoring/pom.xml
@@ -0,0 +1,127 @@
+<?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>
+        <groupId>org.apache.airavata</groupId>
+        <artifactId>airavata</artifactId>
+        <version>0.17-SNAPSHOT</version>
+        <relativePath>../../pom.xml</relativePath>
+    </parent>
+
+    <groupId>org.apache.airavata</groupId>
+    <artifactId>registry-refactoring</artifactId>
+
+    <properties>
+        <derby.version>10.11.1.1</derby.version>
+        <surefire.version>2.18.1</surefire.version>
+        <skipTests>false</skipTests>
+        <mysql.connector.version>5.1.34</mysql.connector.version>
+    </properties>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.airavata</groupId>
+            <artifactId>airavata-data-models</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.3.0</version>
+        </dependency>
+
+        <dependency>
+            <groupId>mysql</groupId>
+            <artifactId>mysql-connector-java</artifactId>
+            <version>${mysql.connector.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.derby</groupId>
+            <artifactId>derby</artifactId>
+            <version>${derby.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.derby</groupId>
+            <artifactId>derbyclient</artifactId>
+            <version>${derby.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.derby</groupId>
+            <artifactId>derbynet</artifactId>
+            <version>${derby.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.derby</groupId>
+            <artifactId>derbytools</artifactId>
+            <version>${derby.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <version>4.12</version>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-compiler-plugin</artifactId>
+                <version>3.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>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-surefire-plugin</artifactId>
+                <version>${surefire.version}</version>
+                <inherited>true</inherited>
+                <configuration>
+                    <failIfNoTests>false</failIfNoTests>
+                    <!--<skipTests>${skipTests}</skipTests>-->
+                    <skipTests>true</skipTests>
+                    <workingDirectory>${project.build.testOutputDirectory}</workingDirectory>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+
+</project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/d9a69ae5/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/RegistryException.java
----------------------------------------------------------------------
diff --git a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/RegistryException.java b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/RegistryException.java
new file mode 100644
index 0000000..8893b34
--- /dev/null
+++ b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/RegistryException.java
@@ -0,0 +1,28 @@
+/*
+ *
+ * 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.registry.core;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class RegistryException extends Exception {
+    private final static Logger logger = LoggerFactory.getLogger(RegistryException.class);
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/d9a69ae5/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/workspacecatalog/GatewayEntity.java
----------------------------------------------------------------------
diff --git a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/workspacecatalog/GatewayEntity.java b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/workspacecatalog/GatewayEntity.java
new file mode 100644
index 0000000..c4f1f59
--- /dev/null
+++ b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/workspacecatalog/GatewayEntity.java
@@ -0,0 +1,221 @@
+/*
+ *
+ * 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.registry.core.entities.workspacecatalog;
+
+import javax.persistence.*;
+
+@Entity
+@Table(name="WORKSPACE_GATEWAY")
+public class GatewayEntity {
+    private String gatewayId;
+    private String gatewayName;
+    private String domain;
+    private String emailAddress;
+    private String gatewayApprovalStatus;
+    private String gatewayAcronym;
+    private String gatewayUrl;
+    private String gatewayPublicAbstract;
+    private String reviewProposalDescription;
+    private String gatewayAdminFirstName;
+    private String getGatewayAdminLastName;
+    private String gatewayAdminEmail;
+    private String identityServerUserName;
+    private String identityServerPasswordToken;
+    private String declinedReason;
+    private String oauthClientId;
+    private String getOauthClientSecret;
+    private long requestCreationTime;
+    private String requesterUsername;
+
+    @Id
+    @Column(name = "GATEWAY_ID")
+    public String getGatewayId() {
+        return gatewayId;
+    }
+
+    public void setGatewayId(String id) {
+        this.gatewayId = id;
+    }
+
+    @Column(name = "GATEWAY_NAME")
+    public String getGatewayName() {
+        return gatewayName;
+    }
+
+    public void setGatewayName(String gatewayName) {
+        this.gatewayName = gatewayName;
+    }
+
+    @Column(name = "GATEWAY_DOMAIN")
+    public String getDomain() {
+        return domain;
+    }
+
+    public void setDomain(String domain) {
+        this.domain = domain;
+    }
+
+    @Column(name = "EMAIL_ADDRESS")
+    public String getEmailAddress() {
+        return emailAddress;
+    }
+
+    public void setEmailAddress(String emailAddress) {
+        this.emailAddress = emailAddress;
+    }
+
+    @Column(name = "GATEWAY_APPROVAL_STATUS")
+    public String getGatewayApprovalStatus() {
+        return gatewayApprovalStatus;
+    }
+
+    public void setGatewayApprovalStatus(String gatewayApprovalStatus) {
+        this.gatewayApprovalStatus = gatewayApprovalStatus;
+    }
+
+    @Column(name = "GATEWAY_ACRONYM")
+    public String getGatewayAcronym() {
+        return gatewayAcronym;
+    }
+
+    public void setGatewayAcronym(String gatewayAcronym) {
+        this.gatewayAcronym = gatewayAcronym;
+    }
+
+    @Column(name = "GATEWAY_URL")
+    public String getGatewayUrl() {
+        return gatewayUrl;
+    }
+
+    public void setGatewayUrl(String gatewayUrl) {
+        this.gatewayUrl = gatewayUrl;
+    }
+
+    @Lob
+    @Column(name = "GATEWAY_PUBLIC_ABSTRACT")
+    public String getGatewayPublicAbstract() {
+        return gatewayPublicAbstract;
+    }
+
+    public void setGatewayPublicAbstract(String gatewayPublicAbstract) {
+        this.gatewayPublicAbstract = gatewayPublicAbstract;
+    }
+
+    @Lob
+    @Column(name = "REVIEW_PROPOSAL_DESCRIPTION")
+    public String getReviewProposalDescription() {
+        return reviewProposalDescription;
+    }
+
+    public void setReviewProposalDescription(String reviewProposalDescription) {
+        this.reviewProposalDescription = reviewProposalDescription;
+    }
+
+    @Column(name = "GATEWAY_ADMIN_FIRST_NAME")
+    public String getGatewayAdminFirstName() {
+        return gatewayAdminFirstName;
+    }
+
+    public void setGatewayAdminFirstName(String gatewayAdminFirstName) {
+        this.gatewayAdminFirstName = gatewayAdminFirstName;
+    }
+
+    @Column(name = "GATEWAY_ADMIN_LAST_NAME")
+    public String getGetGatewayAdminLastName() {
+        return getGatewayAdminLastName;
+    }
+
+    public void setGetGatewayAdminLastName(String getGatewayAdminLastName) {
+        this.getGatewayAdminLastName = getGatewayAdminLastName;
+    }
+
+    @Column(name = "GATEWAY_ADMIN_EMAIL")
+    public String getGatewayAdminEmail() {
+        return gatewayAdminEmail;
+    }
+
+    public void setGatewayAdminEmail(String gatewayAdminEmail) {
+        this.gatewayAdminEmail = gatewayAdminEmail;
+    }
+
+    @Column(name = "IDENTITY_SERVER_USERNAME")
+    public String getIdentityServerUserName() {
+        return identityServerUserName;
+    }
+
+    public void setIdentityServerUserName(String identityServerUserName) {
+        this.identityServerUserName = identityServerUserName;
+    }
+
+    @Column(name = "IDENTITY_SERVER_PASSWORD_TOKEN")
+    public String getIdentityServerPasswordToken() {
+        return identityServerPasswordToken;
+    }
+
+    public void setIdentityServerPasswordToken(String identityServerPasswordToken) {
+        this.identityServerPasswordToken = identityServerPasswordToken;
+    }
+
+    @Column(name = "REQUESTER_USERNAME")
+    public String getRequesterUsername() {
+        return requesterUsername;
+    }
+
+    public void setRequesterUsername(String requesterUsername) {
+        this.requesterUsername = requesterUsername;
+    }
+
+    @Column(name = "DECLINED_REASON")
+    public String getDeclinedReason() {
+        return declinedReason;
+    }
+
+    public void setDeclinedReason(String declinedReason) {
+        this.declinedReason = declinedReason;
+    }
+
+    @Column(name = "OAUTH_CLIENT_ID")
+    public String getOauthClientId() {
+        return oauthClientId;
+    }
+
+    public void setOauthClientId(String oauthClientId) {
+        this.oauthClientId = oauthClientId;
+    }
+
+    @Column(name = "REQUEST_CREATION_TIME")
+    public long getRequestCreationTime() {
+        return requestCreationTime;
+    }
+
+    public void setRequestCreationTime(long requestCreationTime) {
+        this.requestCreationTime = requestCreationTime;
+    }
+
+    @Column(name = "OAUTH_CLIENT_SECRET")
+    public String getGetOauthClientSecret() {
+        return getOauthClientSecret;
+    }
+
+    public void setGetOauthClientSecret(String oauthClientSecret) {
+        this.getOauthClientSecret = oauthClientSecret;
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/d9a69ae5/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/workspacecatalog/NSFDemographicsEntity.java
----------------------------------------------------------------------
diff --git a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/workspacecatalog/NSFDemographicsEntity.java b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/workspacecatalog/NSFDemographicsEntity.java
new file mode 100644
index 0000000..0bcbafa
--- /dev/null
+++ b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/workspacecatalog/NSFDemographicsEntity.java
@@ -0,0 +1,94 @@
+/*
+ *
+ * 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.registry.core.entities.workspacecatalog;
+
+import javax.persistence.*;
+import java.util.List;
+
+@Entity
+@Table(name = "WORKSPACE_NSF_DEMOGRAPHIC")
+public class NSFDemographicsEntity {
+    private String airavataInternalUserId;
+    private String gender;
+    private List<String> ethnicities;
+    private List<String> races;
+    private List<String> disabilities;
+    private UserProfileEntity userProfile;
+
+    @Id
+    @Column(name = "AIRAVATA_INTERNAL_USER_ID")
+    public String getAiravataInternalUserId() {
+        return airavataInternalUserId;
+    }
+
+    public void setAiravataInternalUserId(String userId) {
+        this.airavataInternalUserId = userId;
+    }
+
+    @Column(name = "GENDER")
+    public String getGender() {
+        return gender;
+    }
+
+    public void setGender(String gender) {
+        this.gender = gender;
+    }
+
+    @ElementCollection
+    @CollectionTable(name="NSF_DEMOGRAPHIC_ETHNICITY", joinColumns = @JoinColumn(name="AIRAVATA_INTERNAL_USER_ID"))
+    public List<String> getEthnicities() {
+        return ethnicities;
+    }
+
+    public void setEthnicities(List<String> ethnicities) {
+        this.ethnicities = ethnicities;
+    }
+
+    @ElementCollection
+    @CollectionTable(name="NSF_DEMOGRAPHIC_RACE", joinColumns = @JoinColumn(name="AIRAVATA_INTERNAL_USER_ID"))
+    public List<String> getRaces() {
+        return races;
+    }
+
+    public void setRaces(List<String> races) {
+        this.races = races;
+    }
+
+    @ElementCollection
+    @CollectionTable(name="NSF_DEMOGRAPHIC_DISABILITY", joinColumns = @JoinColumn(name="AIRAVATA_INTERNAL_USER_ID"))
+    public List<String> getDisabilities() {
+        return disabilities;
+    }
+
+    public void setDisabilities(List<String> disabilities) {
+        this.disabilities = disabilities;
+    }
+
+    @OneToOne(targetEntity = UserProfileEntity.class, cascade = CascadeType.ALL)
+    @PrimaryKeyJoinColumn(name = "AIRAVATA_INTERNAL_USER_ID", referencedColumnName = "AIRAVATA_INTERNAL_USER_ID")
+    public UserProfileEntity getUserProfile() {
+        return userProfile;
+    }
+
+    public void setUserProfile(UserProfileEntity userProfile) {
+        this.userProfile = userProfile;
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/d9a69ae5/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/workspacecatalog/NotificationEntity.java
----------------------------------------------------------------------
diff --git a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/workspacecatalog/NotificationEntity.java b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/workspacecatalog/NotificationEntity.java
new file mode 100644
index 0000000..67f8af2
--- /dev/null
+++ b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/workspacecatalog/NotificationEntity.java
@@ -0,0 +1,110 @@
+/*
+ *
+ * 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.registry.core.entities.workspacecatalog;
+
+import javax.persistence.*;
+
+@Entity
+@Table(name = "WORKSPACE_NOTIFICATION")
+public class NotificationEntity {
+    private String notificationId;
+    private String gatewayId;
+    private String title;
+    private String notificationMessage;
+    private long creationTime;
+    private long publishedTime;
+    private long expirationTime;
+    private String priority;
+
+    @Id
+    @Column(name = "NOTIFICATION_ID")
+    public String getNotificationId() {
+        return notificationId;
+    }
+
+    public void setNotificationId(String notificationId) {
+        this.notificationId = notificationId;
+    }
+
+    @Column(name = "GATEWAY_ID")
+    public String getGatewayId() {
+        return gatewayId;
+    }
+
+    public void setGatewayId(String gatewayId) {
+        this.gatewayId = gatewayId;
+    }
+
+    @Column(name = "TITLE")
+    public String getTitle() {
+        return title;
+    }
+
+    public void setTitle(String title) {
+        this.title = title;
+    }
+
+    @Lob
+    @Column(name = "NOTIFICATION_MESSAGE")
+    public String getNotificationMessage() {
+        return notificationMessage;
+    }
+
+    public void setNotificationMessage(String notificationMessage) {
+        this.notificationMessage = notificationMessage;
+    }
+
+    @Column(name = "CREATION_TIME")
+    public long getCreationTime() {
+        return creationTime;
+    }
+
+    public void setCreationTime(long creationTime) {
+        this.creationTime = creationTime;
+    }
+
+    @Column(name = "PUBLISHED_TIME")
+    public long getPublishedTime() {
+        return publishedTime;
+    }
+
+    public void setPublishedTime(long publishedTime) {
+        this.publishedTime = publishedTime;
+    }
+
+    @Column(name = "EXPIRATION_TIME")
+    public long getExpirationTime() {
+        return expirationTime;
+    }
+
+    public void setExpirationTime(long expirationTime) {
+        this.expirationTime = expirationTime;
+    }
+
+    @Column(name = "PRIORITY")
+    public String getPriority() {
+        return priority;
+    }
+
+    public void setPriority(String priority) {
+        this.priority = priority;
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/d9a69ae5/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/workspacecatalog/ProjectEntity.java
----------------------------------------------------------------------
diff --git a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/workspacecatalog/ProjectEntity.java b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/workspacecatalog/ProjectEntity.java
new file mode 100644
index 0000000..31e0868
--- /dev/null
+++ b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/workspacecatalog/ProjectEntity.java
@@ -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.airavata.registry.core.entities.workspacecatalog;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+@Entity
+@Table(name = "WORKSPACE_PROJECT")
+public class ProjectEntity {
+    private String projectID;
+    private String owner;
+    private String gatewayId;
+    private String name;
+    private String description;
+    private long creationTime;
+
+    @Id
+    @Column(name = "PROJECT_ID")
+    public String getProjectID() {
+        return projectID;
+    }
+
+    public void setProjectID(String projectID) {
+        this.projectID = projectID;
+    }
+
+    @Column(name = "OWNER")
+    public String getOwner() {
+        return owner;
+    }
+
+    public void setOwner(String owner) {
+        this.owner = owner;
+    }
+
+    @Column(name = "GATEWAY_ID")
+    public String getGatewayId() {
+        return gatewayId;
+    }
+
+    public void setGatewayId(String gatewayId) {
+        this.gatewayId = gatewayId;
+    }
+
+    @Column(name = "PROJECT_NAME")
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    @Column(name = "DESCRIPTION")
+    public String getDescription() {
+        return description;
+    }
+
+    public void setDescription(String description) {
+        this.description = description;
+    }
+
+    @Column(name = "CREATION_TIME")
+    public long getCreationTime() {
+        return creationTime;
+    }
+
+    public void setCreationTime(long creationTime) {
+        this.creationTime = creationTime;
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/d9a69ae5/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/workspacecatalog/UserProfileEntity.java
----------------------------------------------------------------------
diff --git a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/workspacecatalog/UserProfileEntity.java b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/workspacecatalog/UserProfileEntity.java
new file mode 100644
index 0000000..7dd51ed
--- /dev/null
+++ b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/workspacecatalog/UserProfileEntity.java
@@ -0,0 +1,247 @@
+/*
+ *
+ * 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.registry.core.entities.workspacecatalog;
+
+import javax.persistence.*;
+import java.util.List;
+
+@Entity
+@Table(name="WORKSPACE_USER_PROFILE")
+public class UserProfileEntity {
+    private String airavataInternalUserId;
+    private String userId;
+    private String gatewayId;
+    private String userModelVersion;
+    private String userName;
+    private String orcidId;
+    private String country;
+    private String homeOrganization;
+    private String orginationAffiliation;
+    private long creationTime;
+    private long lastAccessTime;
+    private long validUntil;
+    private String state;
+    private String comments;
+    private List<String> labeledURI;
+    private String gpgKey;
+    private String timeZone;
+
+    private List<String> nationality;
+    private List<String> emails;
+    private List<String> phones;
+    private NSFDemographicsEntity nsfDemographics;
+
+    @Id
+    @Column(name = "AIRAVATA_INTERNAL_USER_ID")
+    public String getAiravataInternalUserId() {
+        return airavataInternalUserId;
+    }
+
+    public void setAiravataInternalUserId(String id) {
+        this.airavataInternalUserId = id;
+    }
+
+    @Column(name = "USER_ID")
+    public String getUserId() {
+        return userId;
+    }
+
+    public void setUserId(String userId) {
+        this.userId = userId;
+    }
+
+    @Column(name = "GATEWAY_ID")
+    public String getGatewayId() {
+        return gatewayId;
+    }
+
+    public void setGatewayId(String gatewayId) {
+        this.gatewayId = gatewayId;
+    }
+
+    @Column(name = "USER_MODEL_VERSION")
+    public String getUserModelVersion() {
+        return userModelVersion;
+    }
+
+    public void setUserModelVersion(String userModelVersion) {
+        this.userModelVersion = userModelVersion;
+    }
+
+    @ElementCollection
+    @CollectionTable(name="USER_PROFILE_EMAIL", joinColumns = @JoinColumn(name="AIRAVATA_INTERNAL_USER_ID"))
+    public List<String> getEmails() {
+        return emails;
+    }
+
+    public void setEmails(List<String> emails) {
+        this.emails = emails;
+    }
+
+    @Column(name = "USER_NAME")
+    public String getUserName() {
+        return userName;
+    }
+
+    public void setUserName(String userName) {
+        this.userName = userName;
+    }
+
+    @Column(name = "ORCID_ID")
+    public String getOrcidId() {
+        return orcidId;
+    }
+
+    public void setOrcidId(String orcidId) {
+        this.orcidId = orcidId;
+    }
+
+    @ElementCollection
+    @CollectionTable(name="USER_PROFILE_PHONE", joinColumns = @JoinColumn(name="AIRAVATA_INTERNAL_USER_ID"))
+    public List<String> getPhones() {
+        return phones;
+    }
+
+    public void setPhones(List<String> phones) {
+        this.phones = phones;
+    }
+
+    @Column(name = "COUNTRY")
+    public String getCountry() {
+        return country;
+    }
+
+    public void setCountry(String country) {
+        this.country = country;
+    }
+
+    @ElementCollection
+    @CollectionTable(name="USER_PROFILE_NATIONALITY", joinColumns = @JoinColumn(name="AIRAVATA_INTERNAL_USER_ID"))
+    public List<String> getNationality() {
+        return nationality;
+    }
+
+    public void setNationality(List<String> nationality) {
+        this.nationality = nationality;
+    }
+
+    @Column(name = "HOME_ORGANIZATION")
+    public String getHomeOrganization() {
+        return homeOrganization;
+    }
+
+    public void setHomeOrganization(String homeOrganization) {
+        this.homeOrganization = homeOrganization;
+    }
+
+    @Column(name = "ORIGINATION_AFFILIATION")
+    public String getOrginationAffiliation() {
+        return orginationAffiliation;
+    }
+
+    public void setOrginationAffiliation(String orginationAffiliation) {
+        this.orginationAffiliation = orginationAffiliation;
+    }
+
+    @Column(name="CREATION_TIME")
+    public long getCreationTime() {
+        return creationTime;
+    }
+
+    public void setCreationTime(long creationTime) {
+        this.creationTime = creationTime;
+    }
+
+    @Column(name = "LAST_ACCESS_TIME")
+    public long getLastAccessTime() {
+        return lastAccessTime;
+    }
+
+    public void setLastAccessTime(long lastAccessTime) {
+        this.lastAccessTime = lastAccessTime;
+    }
+
+    @Column(name = "VALID_UNTIL")
+    public long getValidUntil() {
+        return validUntil;
+    }
+
+    public void setValidUntil(long validUntil) {
+        this.validUntil = validUntil;
+    }
+
+    @Column(name = "STATE")
+    public String getState() {
+        return state;
+    }
+
+    public void setState(String state) {
+        this.state = state;
+    }
+
+    @Lob
+    @Column(name = "COMMENTS")
+    public String getComments() {
+        return comments;
+    }
+
+    public void setComments(String comments) {
+        this.comments = comments;
+    }
+
+    @ElementCollection
+    @CollectionTable(name="USER_PROFILE_LABELED_URI", joinColumns = @JoinColumn(name="AIRAVATA_INTERNAL_USER_ID"))
+    public List<String> getLabeledURI() {
+        return labeledURI;
+    }
+
+    public void setLabeledURI(List<String> labeledURI) {
+        this.labeledURI = labeledURI;
+    }
+
+    @Lob
+    @Column(name = "GPG_KEY")
+    public String getGpgKey() {
+        return gpgKey;
+    }
+
+    public void setGpgKey(String gpgKey) {
+        this.gpgKey = gpgKey;
+    }
+
+    @Column(name = "TIME_ZONE")
+    public String getTimeZone() {
+        return timeZone;
+    }
+
+    public void setTimeZone(String timeZone) {
+        this.timeZone = timeZone;
+    }
+
+    @OneToOne(targetEntity = NSFDemographicsEntity.class, cascade = CascadeType.ALL, mappedBy = "userProfile")
+    public NSFDemographicsEntity getNsfDemographics() {
+        return nsfDemographics;
+    }
+
+    public void setNsfDemographics(NSFDemographicsEntity nsfDemographics) {
+        this.nsfDemographics = nsfDemographics;
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/d9a69ae5/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/repositories/AbstractRepository.java
----------------------------------------------------------------------
diff --git a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/repositories/AbstractRepository.java b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/repositories/AbstractRepository.java
new file mode 100644
index 0000000..a83928d
--- /dev/null
+++ b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/repositories/AbstractRepository.java
@@ -0,0 +1,98 @@
+/*
+ *
+ * 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.registry.core.repositories;
+
+import org.apache.airavata.registry.core.utils.JPAUtils;
+import org.apache.airavata.registry.core.utils.ObjectMapperSingleton;
+import org.dozer.Mapper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.persistence.Query;
+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) {
+        return update(t);
+    }
+
+    public T update(T t) {
+        Mapper mapper = ObjectMapperSingleton.getInstance();
+        E entity = mapper.map(t, dbEntityGenericClass);
+        E persistedCopy = JPAUtils.execute(entityManager -> entityManager.merge(entity));
+        return mapper.map(persistedCopy, thriftGenericClass);
+    }
+
+    public boolean delete(Id id) {
+        JPAUtils.execute(entityManager -> {
+            E entity = entityManager.find(dbEntityGenericClass, id);
+            entityManager.remove(entity);
+            return entity;
+        });
+        return true;
+    }
+
+    public T get(Id id) {
+        E entity = JPAUtils.execute(entityManager -> entityManager
+                .find(dbEntityGenericClass, id));
+        Mapper mapper = ObjectMapperSingleton.getInstance();
+        return mapper.map(entity, thriftGenericClass);
+    }
+
+    public List<T> select(String query, int limit, int offset) {
+        List resultSet = (List) JPAUtils.execute(entityManager -> entityManager.createQuery(query).setFirstResult(offset)
+                .setMaxResults(offset).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 query, int limit, int offset, Map<String, Object> queryParams) {
+        List resultSet = (List) JPAUtils.execute(entityManager -> {
+            Query jpaQuery = entityManager.createQuery(query);
+
+            for (Map.Entry<String, Object> entry : queryParams.entrySet()) {
+
+                jpaQuery.setParameter(entry.getKey(), entry.getValue());
+            }
+
+            return jpaQuery.setFirstResult(offset).setMaxResults(limit).getResultList();
+
+        });
+        Mapper mapper = ObjectMapperSingleton.getInstance();
+        List<T> gatewayList = new ArrayList<>();
+        resultSet.stream().forEach(rs -> gatewayList.add(mapper.map(rs, thriftGenericClass)));
+        return gatewayList;
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/d9a69ae5/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/repositories/workspacecatalog/GatewayRepository.java
----------------------------------------------------------------------
diff --git a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/repositories/workspacecatalog/GatewayRepository.java b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/repositories/workspacecatalog/GatewayRepository.java
new file mode 100644
index 0000000..9a1c6d6
--- /dev/null
+++ b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/repositories/workspacecatalog/GatewayRepository.java
@@ -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.airavata.registry.core.repositories.workspacecatalog;
+
+import org.apache.airavata.model.workspace.Gateway;
+import org.apache.airavata.registry.core.entities.workspacecatalog.GatewayEntity;
+import org.apache.airavata.registry.core.repositories.AbstractRepository;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class GatewayRepository extends AbstractRepository<Gateway, GatewayEntity, String> {
+    private final static Logger logger = LoggerFactory.getLogger(GatewayRepository.class);
+
+    public GatewayRepository(Class<Gateway> thriftGenericClass, Class<GatewayEntity> dbEntityGenericClass) {
+        super(thriftGenericClass, dbEntityGenericClass);
+
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/d9a69ae5/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/repositories/workspacecatalog/NotificationRepository.java
----------------------------------------------------------------------
diff --git a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/repositories/workspacecatalog/NotificationRepository.java b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/repositories/workspacecatalog/NotificationRepository.java
new file mode 100644
index 0000000..8332024
--- /dev/null
+++ b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/repositories/workspacecatalog/NotificationRepository.java
@@ -0,0 +1,35 @@
+/*
+ *
+ * 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.registry.core.repositories.workspacecatalog;
+
+import org.apache.airavata.model.workspace.Notification;
+import org.apache.airavata.registry.core.entities.workspacecatalog.NotificationEntity;
+import org.apache.airavata.registry.core.repositories.AbstractRepository;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class NotificationRepository extends AbstractRepository<Notification, NotificationEntity, String> {
+    private final static Logger logger = LoggerFactory.getLogger(NotificationRepository.class);
+
+    public NotificationRepository(Class thriftGenericClass, Class dbEntityGenericClass) {
+        super(thriftGenericClass, dbEntityGenericClass);
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/d9a69ae5/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/repositories/workspacecatalog/ProjectRepository.java
----------------------------------------------------------------------
diff --git a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/repositories/workspacecatalog/ProjectRepository.java b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/repositories/workspacecatalog/ProjectRepository.java
new file mode 100644
index 0000000..eebf5fb
--- /dev/null
+++ b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/repositories/workspacecatalog/ProjectRepository.java
@@ -0,0 +1,35 @@
+/*
+ *
+ * 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.registry.core.repositories.workspacecatalog;
+
+import org.apache.airavata.model.workspace.Project;
+import org.apache.airavata.registry.core.entities.workspacecatalog.ProjectEntity;
+import org.apache.airavata.registry.core.repositories.AbstractRepository;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class ProjectRepository extends AbstractRepository<Project, ProjectEntity, String> {
+    private final static Logger logger = LoggerFactory.getLogger(ProjectRepository.class);
+
+    public ProjectRepository(Class<Project> thriftGenericClass, Class<ProjectEntity> dbEntityGenericClass) {
+        super(thriftGenericClass, dbEntityGenericClass);
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/d9a69ae5/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/repositories/workspacecatalog/UserProfileRepository.java
----------------------------------------------------------------------
diff --git a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/repositories/workspacecatalog/UserProfileRepository.java b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/repositories/workspacecatalog/UserProfileRepository.java
new file mode 100644
index 0000000..de0f99e
--- /dev/null
+++ b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/repositories/workspacecatalog/UserProfileRepository.java
@@ -0,0 +1,88 @@
+/*
+ *
+ * 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.registry.core.repositories.workspacecatalog;
+
+import org.apache.airavata.model.user.UserProfile;
+import org.apache.airavata.registry.core.entities.workspacecatalog.UserProfileEntity;
+import org.apache.airavata.registry.core.repositories.AbstractRepository;
+import org.apache.airavata.registry.core.utils.QueryConstants;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+public class UserProfileRepository extends AbstractRepository<UserProfile, UserProfileEntity, String> {
+    private final static Logger logger = LoggerFactory.getLogger(UserProfileRepository.class);
+
+    public UserProfileRepository(Class<UserProfile> thriftGenericClass, Class<UserProfileEntity> dbEntityGenericClass) {
+        super(thriftGenericClass, dbEntityGenericClass);
+    }
+
+    @Override
+    public List<UserProfile> select(String query, int offset, int limit) {
+        throw new UnsupportedOperationException("Due to performance overheads this method is not supported. Instead use" +
+                " UserProfileSummaryRepository");
+    }
+
+    public UserProfile getUserProfileByIdAndGateWay(String userId, String gatewayId)   {
+
+        UserProfile userProfile = null;
+
+        Map<String, Object> queryParam = new HashMap<String, Object>();
+        queryParam.put(UserProfile._Fields.USER_ID.getFieldName(), userId);
+        queryParam.put(UserProfile._Fields.GATEWAY_ID.getFieldName(), gatewayId);
+        List<UserProfile> resultList = select(QueryConstants.FIND_USER_PROFILE_BY_USER_ID, 0, 1, queryParam);
+
+        if (resultList != null && resultList.size() > 0)
+            userProfile =  resultList.get(0);
+
+
+        return userProfile;
+    }
+
+    public List<UserProfile> getAllUserProfilesInGateway(String gatewayId, int offset, int limit)  {
+
+        Map<String, Object> queryParam = new HashMap<String, Object>();
+        queryParam.put(UserProfile._Fields.GATEWAY_ID.getFieldName(), gatewayId);
+
+        List<UserProfile> resultList = select(QueryConstants.FIND_ALL_USER_PROFILES_BY_GATEWAY_ID, limit, offset, queryParam);
+
+        return  resultList;
+    }
+
+    public UserProfile getUserProfileByNameAndGateWay(String name, String gatewayId)   {
+
+        UserProfile userProfile = null;
+
+        Map<String, Object> queryParam = new HashMap<String, Object>();
+        queryParam.put(UserProfile._Fields.USER_NAME.getFieldName(), name);
+        queryParam.put(UserProfile._Fields.GATEWAY_ID.getFieldName(), gatewayId);
+        List<UserProfile> resultList = select(QueryConstants.FIND_USER_PROFILE_BY_USER_NAME, 0, 1, queryParam);
+
+        if (resultList != null && resultList.size() > 0)
+            userProfile =  resultList.get(0);
+
+
+        return userProfile;
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/d9a69ae5/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/utils/Committer.java
----------------------------------------------------------------------
diff --git a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/utils/Committer.java b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/utils/Committer.java
new file mode 100644
index 0000000..07f8244
--- /dev/null
+++ b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/utils/Committer.java
@@ -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.airavata.registry.core.utils;
+
+@FunctionalInterface
+public interface Committer<T, R>  {
+
+    R commit(T t);
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/d9a69ae5/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/utils/JPAUtils.java
----------------------------------------------------------------------
diff --git a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/utils/JPAUtils.java b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/utils/JPAUtils.java
new file mode 100644
index 0000000..05098c4
--- /dev/null
+++ b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/utils/JPAUtils.java
@@ -0,0 +1,82 @@
+/*
+ *
+ * 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.registry.core.utils;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.persistence.*;
+import java.util.HashMap;
+import java.util.Map;
+
+public class JPAUtils {
+    private final static Logger logger = LoggerFactory.getLogger(JPAUtils.class);
+    private static final String PERSISTENCE_UNIT_NAME = "airavata_catalog";
+    @PersistenceUnit(unitName = "airavata_catalog")
+    protected static EntityManagerFactory factory;
+    @PersistenceContext(unitName = "airavata_catalog")
+    private static EntityManager entityManager;
+
+    public static EntityManager getEntityManager(){
+        if (factory == null) {
+            //FIXME
+            String connectionProperties = "DriverClassName=com.mysql.jdbc.Driver," +
+                    "Url=jdbc:mysql://localhost:3306/airavata_catalog," +
+                    "Username=root," +
+                    "Password=root";
+            logger.info(connectionProperties);
+            Map<String, String> properties = new HashMap<String, String>();
+            properties.put("openjpa.ConnectionDriverName", "org.apache.commons.dbcp.BasicDataSource");
+            properties.put("openjpa.ConnectionProperties", connectionProperties);
+            properties.put("openjpa.DynamicEnhancementAgent", "true");
+            properties.put("openjpa.RuntimeUnenhancedClasses", "warn");
+            properties.put("openjpa.RemoteCommitProvider", "sjvm");
+            properties.put("openjpa.Log", "DefaultLevel=INFO, Runtime=INFO, Tool=INFO, SQL=INFO");
+            properties.put("openjpa.jdbc.SynchronizeMappings", "buildSchema(ForeignKeys=true)");
+            properties.put("openjpa.jdbc.QuerySQLCache", "false");
+            properties.put("openjpa.ConnectionFactoryProperties", "PrettyPrint=true, PrettyPrintLineLength=72," +
+                    " PrintParameters=true, MaxActive=10, MaxIdle=5, MinIdle=2, MaxWait=31536000,  autoReconnect=true");
+            factory = Persistence.createEntityManagerFactory(PERSISTENCE_UNIT_NAME, properties);
+        }
+
+        entityManager = factory.createEntityManager();
+        return entityManager;
+    }
+
+    public static <R> R execute(Committer<EntityManager, R> committer){
+        EntityManager entityManager = JPAUtils.getEntityManager();
+        try {
+            entityManager.getTransaction().begin();
+            R r = committer.commit(entityManager);
+            entityManager.getTransaction().commit();
+            return  r;
+        }finally {
+            if (entityManager != null && entityManager.isOpen()) {
+                if (entityManager.getTransaction().isActive()) {
+                    entityManager.getTransaction().rollback();
+                }
+                entityManager.close();
+            }
+        }
+    }
+
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/d9a69ae5/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/utils/ObjectMapperSingleton.java
----------------------------------------------------------------------
diff --git a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/utils/ObjectMapperSingleton.java b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/utils/ObjectMapperSingleton.java
new file mode 100644
index 0000000..9189460
--- /dev/null
+++ b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/utils/ObjectMapperSingleton.java
@@ -0,0 +1,39 @@
+/*
+ *
+ * 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.registry.core.utils;
+
+import org.dozer.DozerBeanMapper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class ObjectMapperSingleton extends DozerBeanMapper{
+    private final static Logger logger = LoggerFactory.getLogger(ObjectMapperSingleton.class);
+
+    private static ObjectMapperSingleton instance;
+
+    private ObjectMapperSingleton(){}
+
+    public static ObjectMapperSingleton getInstance(){
+        if(instance == null)
+            instance = new ObjectMapperSingleton();
+        return instance;
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/d9a69ae5/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/utils/QueryConstants.java
----------------------------------------------------------------------
diff --git a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/utils/QueryConstants.java b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/utils/QueryConstants.java
new file mode 100644
index 0000000..171317e
--- /dev/null
+++ b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/utils/QueryConstants.java
@@ -0,0 +1,22 @@
+package org.apache.airavata.registry.core.utils;
+
+import org.apache.airavata.model.user.UserProfile;
+
+/**
+ * Created by abhij on 11/11/2016.
+ */
+public interface QueryConstants {
+
+
+
+    String FIND_USER_PROFILE_BY_USER_ID = "SELECT u FROM UserProfileEntity u " +
+            "where u.userId LIKE :" + UserProfile._Fields.USER_ID.getFieldName() + " " +
+            "AND u.gatewayId LIKE :"+ UserProfile._Fields.GATEWAY_ID.getFieldName() + "";
+
+    String FIND_ALL_USER_PROFILES_BY_GATEWAY_ID = "SELECT u FROM UserProfileEntity u " +
+            "where u.gatewayId LIKE :"+ UserProfile._Fields.GATEWAY_ID.getFieldName() + "";
+
+    String FIND_USER_PROFILE_BY_USER_NAME = "SELECT u FROM UserProfileEntity u " +
+            "where u.userId LIKE :" + UserProfile._Fields.USER_NAME.getFieldName() + " " +
+            "AND u.gatewayId LIKE :"+ UserProfile._Fields.GATEWAY_ID.getFieldName() + "";
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/d9a69ae5/modules/registry-refactoring/src/main/resources/META-INF/persistence.xml
----------------------------------------------------------------------
diff --git a/modules/registry-refactoring/src/main/resources/META-INF/persistence.xml b/modules/registry-refactoring/src/main/resources/META-INF/persistence.xml
new file mode 100644
index 0000000..76c965a
--- /dev/null
+++ b/modules/registry-refactoring/src/main/resources/META-INF/persistence.xml
@@ -0,0 +1,32 @@
+<?xml version="1.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.
+ *
+* -->
+<persistence xmlns="http://java.sun.com/xml/ns/persistence" version="2.0">
+    <persistence-unit name="airavata_catalog">
+        <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
+        <class>org.apache.airavata.registry.core.entities.workspacecatalog.GatewayEntity</class>
+        <class>org.apache.airavata.registry.core.entities.workspacecatalog.UserProfileEntity</class>
+        <class>org.apache.airavata.registry.core.entities.workspacecatalog.NSFDemographicsEntity</class>
+        <class>org.apache.airavata.registry.core.entities.workspacecatalog.NotificationEntity</class>
+        <class>org.apache.airavata.registry.core.entities.workspacecatalog.ProjectEntity</class>
+        <exclude-unlisted-classes>true</exclude-unlisted-classes>
+    </persistence-unit>
+</persistence>

http://git-wip-us.apache.org/repos/asf/airavata/blob/d9a69ae5/modules/registry-refactoring/src/main/resources/workspace_catalog.sql
----------------------------------------------------------------------
diff --git a/modules/registry-refactoring/src/main/resources/workspace_catalog.sql b/modules/registry-refactoring/src/main/resources/workspace_catalog.sql
new file mode 100644
index 0000000..debdba4
--- /dev/null
+++ b/modules/registry-refactoring/src/main/resources/workspace_catalog.sql
@@ -0,0 +1,125 @@
+
+CREATE TABLE IF NOT  EXISTS WORKSPACE_GATEWAY(
+    GATEWAY_ID VARCHAR (255),
+    GATEWAY_NAME VARCHAR (255),
+    GATEWAY_DOMAIN VARCHAR (255),
+    EMAIL_ADDRESS VARCHAR (255),
+    GATEWAY_APPROVAL_STATUS VARCHAR (255),
+    GATEWAY_ACRONYM VARCHAR (255),
+    GATEWAY_URL VARCHAR (255),
+    GATEWAY_PUBLIC_ABSTRACT TEXT,
+    REVIEW_PROPOSAL_DESCRIPTION TEXT,
+    GATEWAY_ADMIN_FIRST_NAME VARCHAR(255),
+    GATEWAY_ADMIN_LAST_NAME VARCHAR(255),
+    GATEWAY_ADMIN_EMAIL VARCHAR(255),
+    IDENTITY_SERVER_USERNAME VARCHAR(255),
+    IDENTITY_SERVER_PASSWORD_TOKEN VARCHAR(255),
+    DECLINED_REASON VARCHAR(255),
+    OAUTH_CLIENT_ID VARCHAR(255),
+    OAUTH_CLIENT_SECRET VARCHAR(255),
+    REQUEST_CREATION_TIME BIGINT,
+    REQUESTER_USERNAME VARCHAR(255),
+    PRIMARY KEY (GATEWAY_ID)
+);
+
+CREATE TABLE IF NOT EXISTS WORKSPACE_NOTIFICATION (
+    NOTIFICATION_ID VARCHAR (255),
+    GATEWAY_ID VARCHAR (255),
+    TITLE VARCHAR (255),
+    NOTIFICATION_MESSAGE TEXT,
+    CREATION_TIME BIGINT,
+    PUBLISHED_TIME BIGINT,
+    EXPIRATION_TIME BIGINT,
+    PRIORITY VARCHAR (255),
+    PRIMARY KEY (NOTIFICATION_ID),
+    FOREIGN KEY (GATEWAY_ID) REFERENCES WORKSPACE_GATEWAY(GATEWAY_ID) ON DELETE CASCADE
+);
+
+CREATE TABLE IF NOT EXISTS WORKSPACE_USER_PROFILE (
+    AIRAVATA_INTERNAL_USER_ID VARCHAR (255),
+    USER_ID VARCHAR (255),
+    GATEWAY_ID VARCHAR (255),
+    USER_MODEL_VERSION VARCHAR (255),
+    USER_NAME VARCHAR (255),
+    ORCID_ID VARCHAR (255),
+    COUNTRY VARCHAR (255),
+    HOME_ORGANIZATION VARCHAR (255),
+    ORIGINATION_AFFILIATION VARCHAR (255),
+    CREATION_TIME BIGINT,
+    LAST_ACCESS_TIME BIGINT,
+    VALID_UNTIL BIGINT,
+    STATE VARCHAR (255),
+    COMMENTS TEXT,
+    GPG_KEY VARCHAR (8192),
+    TIME_ZONE VARCHAR (255),
+    PRIMARY KEY (AIRAVATA_INTERNAL_USER_ID),
+    FOREIGN KEY (GATEWAY_ID) REFERENCES WORKSPACE_GATEWAY(GATEWAY_ID) ON DELETE CASCADE
+);
+
+CREATE TABLE IF NOT EXISTS WORKSPACE_USER_PROFILE_EMAIL (
+    AIRAVATA_INTERNAL_USER_ID VARCHAR (255),
+    EMAIL VARCHAR (255),
+    PRIMARY KEY (AIRAVATA_INTERNAL_USER_ID, EMAIL),
+    FOREIGN KEY (AIRAVATA_INTERNAL_USER_ID) REFERENCES WORKSPACE_USER_PROFILE(AIRAVATA_INTERNAL_USER_ID) ON DELETE CASCADE
+);
+
+CREATE TABLE IF NOT EXISTS WORKSPACE_USER_PROFILE_PHONE (
+    AIRAVATA_INTERNAL_USER_ID VARCHAR (255),
+    PHONE VARCHAR (255),
+    PRIMARY KEY (AIRAVATA_INTERNAL_USER_ID, PHONE ),
+    FOREIGN KEY (AIRAVATA_INTERNAL_USER_ID) REFERENCES WORKSPACE_USER_PROFILE(AIRAVATA_INTERNAL_USER_ID) ON DELETE CASCADE
+);
+
+CREATE TABLE IF NOT EXISTS WORKSPACE_USER_PROFILE_NATIONALITY (
+    AIRAVATA_INTERNAL_USER_ID VARCHAR (255),
+    NATIONALITY VARCHAR (255),
+    PRIMARY KEY (AIRAVATA_INTERNAL_USER_ID, NATIONALITY ),
+    FOREIGN KEY (AIRAVATA_INTERNAL_USER_ID) REFERENCES WORKSPACE_USER_PROFILE(AIRAVATA_INTERNAL_USER_ID) ON DELETE CASCADE
+);
+
+CREATE TABLE IF NOT EXISTS WORKSPACE_USER_PROFILE_LABELED_URI (
+    AIRAVATA_INTERNAL_USER_ID VARCHAR (255),
+    LABELED_URI VARCHAR (255),
+    PRIMARY KEY (AIRAVATA_INTERNAL_USER_ID, LABELED_URI ),
+    FOREIGN KEY (AIRAVATA_INTERNAL_USER_ID) REFERENCES WORKSPACE_USER_PROFILE(AIRAVATA_INTERNAL_USER_ID) ON DELETE CASCADE
+);
+
+CREATE TABLE IF NOT EXISTS WORKSPACE_NSF_DEMOGRAPHIC (
+    AIRAVATA_INTERNAL_USER_ID VARCHAR (255),
+    GENDER VARCHAR (255),
+    PRIMARY KEY (AIRAVATA_INTERNAL_USER_ID),
+    FOREIGN KEY (AIRAVATA_INTERNAL_USER_ID) REFERENCES WORKSPACE_USER_PROFILE(AIRAVATA_INTERNAL_USER_ID) ON DELETE CASCADE
+);
+
+CREATE TABLE IF NOT EXISTS WORKSPACE_NSF_DEMOGRAPHIC_ETHNICITY (
+    AIRAVATA_INTERNAL_USER_ID VARCHAR (255),
+    ETHNICITY VARCHAR (255),
+    PRIMARY KEY (AIRAVATA_INTERNAL_USER_ID, ETHNICITY ),
+    FOREIGN KEY (AIRAVATA_INTERNAL_USER_ID) REFERENCES WORKSPACE_NSF_DEMOGRAPHIC(AIRAVATA_INTERNAL_USER_ID) ON DELETE CASCADE
+);
+
+CREATE TABLE IF NOT EXISTS WORKSPACE_NSF_DEMOGRAPHIC_RACE (
+    AIRAVATA_INTERNAL_USER_ID VARCHAR (255),
+    RACE VARCHAR (255),
+    PRIMARY KEY (AIRAVATA_INTERNAL_USER_ID, RACE ),
+    FOREIGN KEY (AIRAVATA_INTERNAL_USER_ID) REFERENCES WORKSPACE_NSF_DEMOGRAPHIC(AIRAVATA_INTERNAL_USER_ID) ON DELETE CASCADE
+);
+
+CREATE TABLE IF NOT EXISTS WORKSPACE_NSF_DEMOGRAPHIC_DISABILITY (
+    AIRAVATA_INTERNAL_USER_ID VARCHAR (255),
+    DISABILITY VARCHAR (255),
+    PRIMARY KEY (AIRAVATA_INTERNAL_USER_ID, DISABILITY ),
+    FOREIGN KEY (AIRAVATA_INTERNAL_USER_ID) REFERENCES WORKSPACE_NSF_DEMOGRAPHIC(AIRAVATA_INTERNAL_USER_ID) ON DELETE CASCADE
+);
+
+CREATE TABLE IF NOT EXISTS WORKSPACE_PROJECT(
+    PROJECT_ID VARCHAR (255),
+    OWNER VARCHAR (255),
+    GATEWAY_ID VARCHAR (255),
+    PROJECT_NAME VARCHAR (255),
+    DESCRIPTION VARCHAR (255),
+    CREATION_TIME BIGINT,
+    PRIMARY KEY (PROJECT_ID),
+    FOREIGN KEY(OWNER) REFERENCES WORKSPACE_USER_PROFILE(AIRAVATA_INTERNAL_USER_ID),
+    FOREIGN KEY(GATEWAY_ID) REFERENCES WORKSPACE_GATEWAY(GATEWAY_ID) ON DELETE CASCADE
+);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/d9a69ae5/modules/registry-refactoring/src/test/java/org/apache/airavata/registry/core/repositories/WorkspaceRepositoryTest.java
----------------------------------------------------------------------
diff --git a/modules/registry-refactoring/src/test/java/org/apache/airavata/registry/core/repositories/WorkspaceRepositoryTest.java b/modules/registry-refactoring/src/test/java/org/apache/airavata/registry/core/repositories/WorkspaceRepositoryTest.java
new file mode 100644
index 0000000..a168f0d
--- /dev/null
+++ b/modules/registry-refactoring/src/test/java/org/apache/airavata/registry/core/repositories/WorkspaceRepositoryTest.java
@@ -0,0 +1,197 @@
+/*
+ *
+ * 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.registry.core.repositories;
+
+import org.apache.airavata.model.user.UserProfile;
+import org.apache.airavata.model.workspace.Gateway;
+import org.apache.airavata.model.workspace.GatewayApprovalStatus;
+import org.apache.airavata.model.workspace.Notification;
+import org.apache.airavata.model.workspace.Project;
+import org.apache.airavata.registry.core.entities.workspacecatalog.GatewayEntity;
+import org.apache.airavata.registry.core.entities.workspacecatalog.NotificationEntity;
+import org.apache.airavata.registry.core.entities.workspacecatalog.ProjectEntity;
+import org.apache.airavata.registry.core.entities.workspacecatalog.UserProfileEntity;
+import org.apache.airavata.registry.core.repositories.workspacecatalog.GatewayRepository;
+import org.apache.airavata.registry.core.repositories.workspacecatalog.NotificationRepository;
+import org.apache.airavata.registry.core.repositories.workspacecatalog.ProjectRepository;
+import org.apache.airavata.registry.core.repositories.workspacecatalog.UserProfileRepository;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.UUID;
+
+public class WorkspaceRepositoryTest {
+    private final static Logger logger = LoggerFactory.getLogger(WorkspaceRepositoryTest.class);
+
+    private GatewayRepository gatewayRepository;
+    private NotificationRepository notificationRepository;
+    private UserProfileRepository userProfileRepository;
+    private ProjectRepository projectRepository;
+    private String gatewayId;
+    private String notificationId;
+    private String userId;
+    private String projectId;
+
+    private final String GATEWAY_DOMAIN = "test1.com";
+    private final String NOTIFY_MESSAGE = "NotifyMe";
+    private final String USER_COMMENT = "TestComment";
+    private final String PROJECT_DESCRIPTION = "Test Description";
+
+
+    @Before
+    public void setupRepository() {
+
+        gatewayRepository = new GatewayRepository(Gateway.class, GatewayEntity.class);
+        notificationRepository = new NotificationRepository(Notification.class,
+                NotificationEntity.class);
+        userProfileRepository = new UserProfileRepository(UserProfile.class, UserProfileEntity.class);
+        projectRepository = new ProjectRepository(Project.class, ProjectEntity.class);
+
+        gatewayId = "test.com" + System.currentTimeMillis();
+        notificationId = UUID.randomUUID().toString();
+        userId = "testuser" + System.currentTimeMillis();
+        projectId = "project" + System.currentTimeMillis();
+    }
+
+    @Test
+    public void userProfileRepositoryTest() {
+
+		/*
+         * Creating Gateway required for UserProfile creation
+		 */
+        Gateway gateway = new Gateway();
+        gateway.setGatewayApprovalStatus(GatewayApprovalStatus.ACTIVE);
+        gateway.setGatewayId(gatewayId);
+        gateway.setDomain(GATEWAY_DOMAIN);
+        gateway = gatewayRepository.create(gateway);
+        Assert.assertTrue(!gateway.getGatewayId().isEmpty());
+
+
+
+		/*
+         * UserProfile Instance creation
+		 */
+        UserProfile userProfile = new UserProfile();
+        userProfile.setAiravataInternalUserId(userId);
+        userProfile.setGatewayId(gateway.getGatewayId());
+
+        /*
+         * Workspace UserProfile Repository Insert Operation Test
+		 */
+        userProfile = userProfileRepository.create(userProfile);
+        Assert.assertTrue(!userProfile.getAiravataInternalUserId().isEmpty());
+
+        /*
+         * Workspace UserProfile Repository Update Operation Test
+		 */
+        userProfile.setComments(USER_COMMENT);
+        userProfileRepository.update(userProfile);
+        userProfile = userProfileRepository.get(userId);
+        System.out.println(userProfile.getComments());
+        Assert.assertEquals(userProfile.getComments(), USER_COMMENT);
+
+		/*
+         * Workspace UserProfile Repository Select Operation Test
+		 */
+        userProfile = userProfileRepository.get(userId);
+        Assert.assertNotNull(userProfile);
+
+		/*
+         * Workspace UserProfile Repository Delete Operation
+		 */
+        boolean deleteResult = userProfileRepository.delete(userId);
+        Assert.assertTrue(deleteResult);
+        deleteResult = gatewayRepository.delete(gatewayId);
+        Assert.assertTrue(deleteResult);
+
+
+    }
+
+    @Test
+    public void projectRepositoryTest() {
+
+		/*
+         * Creating Gateway required for UserProfile & Project creation
+		 */
+        Gateway gateway = new Gateway();
+        gateway.setGatewayApprovalStatus(GatewayApprovalStatus.ACTIVE);
+        gateway.setGatewayId(gatewayId);
+        gateway.setDomain(GATEWAY_DOMAIN);
+        gateway = gatewayRepository.create(gateway);
+        Assert.assertTrue(!gateway.getGatewayId().isEmpty());
+
+		/*
+         * UserProfile Instance creation required for Project Creation
+		 */
+        UserProfile userProfile = new UserProfile();
+        userProfile.setAiravataInternalUserId(userId);
+        userProfile.setGatewayId(gateway.getGatewayId());
+        userProfile = userProfileRepository.create(userProfile);
+        Assert.assertTrue(!userProfile.getAiravataInternalUserId().isEmpty());
+
+        /*
+         * Project Instance creation
+         */
+        Project project = new Project();
+        project.setGatewayId(gatewayId);
+        project.setOwner(userId);
+        project.setProjectID(projectId);
+        project.setGatewayIdIsSet(true);
+
+
+        /*
+         * Workspace Project Repository Insert Operation Test
+		 */
+        project = projectRepository.create(project);
+        Assert.assertTrue(!project.getProjectID().isEmpty());
+
+        /*
+         * Workspace Project Repository Update Operation Test
+		 */
+        project.setDescription(PROJECT_DESCRIPTION);
+        projectRepository.update(project);
+        project = projectRepository.get(projectId);
+        Assert.assertEquals(project.getDescription(), PROJECT_DESCRIPTION);
+
+		/*
+         * Workspace Project Repository Select Operation Test
+		 */
+        project = projectRepository.get(projectId);
+        Assert.assertNotNull(project);
+
+		/*
+         * Workspace Project Repository Delete Operation
+		 */
+        boolean deleteResult = projectRepository.delete(projectId);
+        Assert.assertTrue(deleteResult);
+
+        deleteResult = userProfileRepository.delete(userId);
+        Assert.assertTrue(deleteResult);
+
+        deleteResult = gatewayRepository.delete(gatewayId);
+        Assert.assertTrue(deleteResult);
+
+
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/d9a69ae5/modules/server/src/main/java/org/apache/airavata/server/ServerMain.java
----------------------------------------------------------------------
diff --git a/modules/server/src/main/java/org/apache/airavata/server/ServerMain.java b/modules/server/src/main/java/org/apache/airavata/server/ServerMain.java
index b348ec0..0ff5744 100644
--- a/modules/server/src/main/java/org/apache/airavata/server/ServerMain.java
+++ b/modules/server/src/main/java/org/apache/airavata/server/ServerMain.java
@@ -63,6 +63,7 @@ public class ServerMain {
 	private static final String REGISTRY_SERVER = "regserver";
 	private static final String GFAC_SERVER = "gfac";
 	private static final String ORCHESTRATOR = "orchestrator";
+	private static final String USER_PROFILE = "user_profile";
 
     private static ServerCnxnFactory cnxnFactory;
 //	private static boolean shutdownHookCalledBefore=false;
@@ -117,6 +118,7 @@ public class ServerMain {
 			serverList.add(API_SERVER);
 			serverList.add(ORCHESTRATOR);
 			serverList.add(GFAC_SERVER);
+			serverList.add(USER_PROFILE);
 		} else if (serverList.indexOf(API_ORCH) > -1) {
 			serverList.clear();
 			serverList.add(CREDENTIAL_STORE);

http://git-wip-us.apache.org/repos/asf/airavata/blob/d9a69ae5/modules/user-profile/pom.xml
----------------------------------------------------------------------
diff --git a/modules/user-profile/pom.xml b/modules/user-profile/pom.xml
index 00d9afe..f6349d3 100644
--- a/modules/user-profile/pom.xml
+++ b/modules/user-profile/pom.xml
@@ -21,8 +21,8 @@
     <artifactId>user-profile</artifactId>
     <packaging>pom</packaging>
     <modules>
-        <module>user-profile-core</module>
-        <module>user-profile-cpi</module>
+        <module>user-profile-stubs</module>
+        <module>user-profile-service</module>
     </modules>
 
 

http://git-wip-us.apache.org/repos/asf/airavata/blob/d9a69ae5/modules/user-profile/user-profile-core/pom.xml
----------------------------------------------------------------------
diff --git a/modules/user-profile/user-profile-core/pom.xml b/modules/user-profile/user-profile-core/pom.xml
deleted file mode 100644
index 0c4fb24..0000000
--- a/modules/user-profile/user-profile-core/pom.xml
+++ /dev/null
@@ -1,88 +0,0 @@
-<?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">
-    <parent>
-        <artifactId>user-profile</artifactId>
-        <groupId>org.apache.airavata</groupId>
-        <version>0.17-SNAPSHOT</version>
-    </parent>
-    <modelVersion>4.0.0</modelVersion>
-
-    <artifactId>user-profile-core</artifactId>
-
-    <dependencies>
-        <dependency>
-            <groupId>org.slf4j</groupId>
-            <artifactId>slf4j-api</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.airavata</groupId>
-            <artifactId>airavata-commons</artifactId>
-            <version>${project.version}</version>
-        </dependency>
-        <!-- Test -->
-        <dependency>
-            <groupId>junit</groupId>
-            <artifactId>junit</artifactId>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.slf4j</groupId>
-            <artifactId>jcl-over-slf4j</artifactId>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.slf4j</groupId>
-            <artifactId>slf4j-log4j12</artifactId>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.openjpa</groupId>
-            <artifactId>openjpa-all</artifactId>
-            <version>2.2.0</version>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.airavata</groupId>
-            <artifactId>airavata-credential-store</artifactId>
-            <version>${project.version}</version>
-        </dependency>
-
-
-
-        <dependency>
-            <groupId>org.apache.airavata</groupId>
-            <artifactId>airavata-data-models</artifactId>
-            <version>${project.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.airavata</groupId>
-            <artifactId>user-profile-cpi</artifactId>
-            <version>${project.version}</version>
-        </dependency>
-
-        <dependency>
-            <groupId>org.apache.airavata</groupId>
-            <artifactId>airavata-server-configuration</artifactId>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.mongodb</groupId>
-            <artifactId>mongo-java-driver</artifactId>
-            <version>3.0.0</version>
-        </dependency>
-        <dependency>
-            <groupId>com.fasterxml.jackson.core</groupId>
-            <artifactId>jackson-databind</artifactId>
-            <version>2.5.3</version>
-        </dependency>
-    </dependencies>
-</project>
\ No newline at end of file