airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From scnakand...@apache.org
Subject [2/3] airavata git commit: User Profile CPI Server
Date Sun, 20 Nov 2016 07:37:26 GMT
User Profile CPI Server


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

Branch: refs/heads/registry-refactoring
Commit: b10221a39280e56aae6b61e39b9a73224f3d0237
Parents: dbc6ed1
Author: Abhiit Karanjkar <aykaranj@indiana.edu>
Authored: Fri Nov 18 20:15:59 2016 -0500
Committer: Abhiit Karanjkar <aykaranj@indiana.edu>
Committed: Fri Nov 18 20:15:59 2016 -0500

----------------------------------------------------------------------
 airavata-api/airavata-model-utils/pom.xml       |   5 +
 .../common/utils/ApplicationSettings.java       |   8 +
 .../apache/airavata/common/utils/IServer.java   |  26 +--
 .../airavata/common/utils/ServerSettings.java   |   6 +
 .../main/resources/airavata-server.properties   |   8 +
 .../core/repositories/AbstractRepository.java   |  32 +++-
 .../workspacecatalog/UserProfileRepository.java |  45 +++++
 .../registry/core/utils/QueryConstants.java     |  22 +++
 modules/user-profile/.project                   |  17 ++
 .../.settings/org.eclipse.core.resources.prefs  |   2 +
 .../.settings/org.eclipse.m2e.core.prefs        |   4 +
 modules/user-profile/pom.xml                    |   2 +
 .../user-profile/user-profile-core/.classpath   |  26 +++
 modules/user-profile/user-profile-core/.project |  23 +++
 .../.settings/org.eclipse.core.resources.prefs  |   4 +
 .../.settings/org.eclipse.jdt.core.prefs        |   5 +
 .../.settings/org.eclipse.m2e.core.prefs        |   4 +
 .../core/AbstractThriftDeserializer.java        | 152 -----------------
 .../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 --------
 .../user-profile-service/.classpath             |  26 +++
 .../user-profile/user-profile-service/.project  |  23 +++
 .../.settings/org.eclipse.core.resources.prefs  |   3 +
 .../.settings/org.eclipse.jdt.core.prefs        |   5 +
 .../.settings/org.eclipse.m2e.core.prefs        |   4 +
 .../user-profile/user-profile-service/pom.xml   |  27 +++
 .../server/UserProfileHandler.java              |  83 ++++++++++
 .../server/UserProfileServer.java               | 141 ++++++++++++++++
 modules/user-profile/user-profile-stubs/pom.xml |   5 +
 .../airavata/userprofile/crude/cpi/Test.java    |  14 ++
 .../component-cpis/user-profile-crud-cpi.thrift |   2 +-
 38 files changed, 552 insertions(+), 899 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/b10221a3/airavata-api/airavata-model-utils/pom.xml
----------------------------------------------------------------------
diff --git a/airavata-api/airavata-model-utils/pom.xml b/airavata-api/airavata-model-utils/pom.xml
index 87c457e..84d6592 100644
--- a/airavata-api/airavata-model-utils/pom.xml
+++ b/airavata-api/airavata-model-utils/pom.xml
@@ -36,6 +36,11 @@
             <artifactId>slf4j-log4j12</artifactId>
             <version>${org.slf4j.version}</version>
         </dependency>
+        <dependency>
+            <groupId>org.apache.airavata</groupId>
+            <artifactId>airavata-data-models</artifactId>
+            <version>0.17-SNAPSHOT</version>
+        </dependency>
 
     </dependencies>
 

http://git-wip-us.apache.org/repos/asf/airavata/blob/b10221a3/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 9ce0786..db7e246 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
@@ -359,9 +359,17 @@ public class ApplicationSettings {
         return getSetting("credential.store.server.host");
     }
 
+    public static String getUserProfileServerHost() throws ApplicationSettingsException {
+        return getSetting(ServerSettings.USER_PROFILE_SERVER_HOST);
+    }
+
     public static String getCredentialStoreServerPort() throws ApplicationSettingsException {
         return getSetting("credential.store.server.port");
     }
+
+    public static String getUserProfileServerPort() throws ApplicationSettingsException {
+        return getSetting(ServerSettings.USER_PROFILE_SERVER_PORT);
+    }
     public static String getCredentialStoreNotifierEnabled() throws ApplicationSettingsException {
         return getSetting("notifier.enabled");
     }

http://git-wip-us.apache.org/repos/asf/airavata/blob/b10221a3/modules/commons/src/main/java/org/apache/airavata/common/utils/IServer.java
----------------------------------------------------------------------
diff --git a/modules/commons/src/main/java/org/apache/airavata/common/utils/IServer.java b/modules/commons/src/main/java/org/apache/airavata/common/utils/IServer.java
index 867eb45..29159f9 100644
--- a/modules/commons/src/main/java/org/apache/airavata/common/utils/IServer.java
+++ b/modules/commons/src/main/java/org/apache/airavata/common/utils/IServer.java
@@ -25,20 +25,20 @@ import java.util.Calendar;
 import java.util.Date;
 
 public interface IServer {
-	public enum ServerStatus{
-		STOPING,
-		STOPPED,
-		STARTING,
-		STARTED,
-		FAILED;
-		public void updateTime(){
-			now=Calendar.getInstance().getTime();
+		public enum ServerStatus{
+			STOPING,
+			STOPPED,
+			STARTING,
+			STARTED,
+			FAILED;
+			public void updateTime(){
+				now=Calendar.getInstance().getTime();
+			}
+			private Date now;
+			public Date getTime(){
+				return now;
+			}
 		}
-		private Date now;
-		public Date getTime(){
-			return now;
-		}
-	}
 	public String getName();
 	public String getVersion();
 	public void start() throws Exception;

http://git-wip-us.apache.org/repos/asf/airavata/blob/b10221a3/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 bb11264..97a16f9 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
@@ -57,6 +57,12 @@ public class ServerSettings extends ApplicationSettings {
     // Credential Store constants
     public static final String CREDENTIAL_SERVER_HOST = "credential.store.server.host";
     public static final String CREDENTIAL_SERVER_PORT = "credential.store.server.port";
+
+    //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";
+
     // Zookeeper + curator constants
     public static final String EMBEDDED_ZK = "embedded.zk";
     public static final String ZOOKEEPER_SERVER_CONNECTION = "zookeeper.server.connection";

http://git-wip-us.apache.org/repos/asf/airavata/blob/b10221a3/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 2ce3701..704c6e5 100644
--- a/modules/configuration/server/src/main/resources/airavata-server.properties
+++ b/modules/configuration/server/src/main/resources/airavata-server.properties
@@ -194,6 +194,14 @@ credential.store.server.host=localhost
 credential.store.server.port=8960
 credentialstore=org.apache.airavata.credential.store.server.CredentialStoreServer
 
+
+###########################################################################
+# User Profile module Configuration
+###########################################################################
+user.profile.server.host=localhost
+user.profile.server.port=8961
+user_profile=com.apache.airavata.user.profile.server.UserProfileServer
+
 # these properties used by credential store email notifications
 email.server=smtp.googlemail.com
 email.server.port=465

http://git-wip-us.apache.org/repos/asf/airavata/blob/b10221a3/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
index bc3a9da..a83928d 100644
--- 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
@@ -26,8 +26,10 @@ 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);
@@ -35,23 +37,23 @@ public abstract class AbstractRepository<T, E, Id> {
     private Class<T> thriftGenericClass;
     private Class<E> dbEntityGenericClass;
 
-    public AbstractRepository(Class<T> thriftGenericClass, Class<E> dbEntityGenericClass){
+    public AbstractRepository(Class<T> thriftGenericClass, Class<E> dbEntityGenericClass) {
         this.thriftGenericClass = thriftGenericClass;
         this.dbEntityGenericClass = dbEntityGenericClass;
     }
 
-    public T create(T t){
+    public T create(T t) {
         return update(t);
     }
 
-    public  T update(T 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){
+    public boolean delete(Id id) {
         JPAUtils.execute(entityManager -> {
             E entity = entityManager.find(dbEntityGenericClass, id);
             entityManager.remove(entity);
@@ -60,14 +62,14 @@ public abstract class AbstractRepository<T, E, Id> {
         return true;
     }
 
-    public T get(Id id){
+    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){
+    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();
@@ -75,4 +77,22 @@ public abstract class AbstractRepository<T, E, Id> {
         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/b10221a3/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
index f067370..7c5bd4b 100644
--- 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
@@ -23,10 +23,13 @@ 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);
@@ -40,4 +43,46 @@ public class UserProfileRepository extends AbstractRepository<UserProfile, UserP
         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)  {
+
+        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, 0, 1, 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/b10221a3/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/b10221a3/modules/user-profile/.project
----------------------------------------------------------------------
diff --git a/modules/user-profile/.project b/modules/user-profile/.project
new file mode 100644
index 0000000..788ce56
--- /dev/null
+++ b/modules/user-profile/.project
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>user-profile</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.m2e.core.maven2Builder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.m2e.core.maven2Nature</nature>
+	</natures>
+</projectDescription>

http://git-wip-us.apache.org/repos/asf/airavata/blob/b10221a3/modules/user-profile/.settings/org.eclipse.core.resources.prefs
----------------------------------------------------------------------
diff --git a/modules/user-profile/.settings/org.eclipse.core.resources.prefs b/modules/user-profile/.settings/org.eclipse.core.resources.prefs
new file mode 100644
index 0000000..99f26c0
--- /dev/null
+++ b/modules/user-profile/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,2 @@
+eclipse.preferences.version=1
+encoding/<project>=UTF-8

http://git-wip-us.apache.org/repos/asf/airavata/blob/b10221a3/modules/user-profile/.settings/org.eclipse.m2e.core.prefs
----------------------------------------------------------------------
diff --git a/modules/user-profile/.settings/org.eclipse.m2e.core.prefs b/modules/user-profile/.settings/org.eclipse.m2e.core.prefs
new file mode 100644
index 0000000..f897a7f
--- /dev/null
+++ b/modules/user-profile/.settings/org.eclipse.m2e.core.prefs
@@ -0,0 +1,4 @@
+activeProfiles=
+eclipse.preferences.version=1
+resolveWorkspaceProjects=true
+version=1

http://git-wip-us.apache.org/repos/asf/airavata/blob/b10221a3/modules/user-profile/pom.xml
----------------------------------------------------------------------
diff --git a/modules/user-profile/pom.xml b/modules/user-profile/pom.xml
index 7f60f9c..37efc57 100644
--- a/modules/user-profile/pom.xml
+++ b/modules/user-profile/pom.xml
@@ -22,6 +22,8 @@
     <packaging>pom</packaging>
     <modules>
         <module>user-profile-stubs</module>
+        <module>user-profile-service</module>
+
     </modules>
 
 

http://git-wip-us.apache.org/repos/asf/airavata/blob/b10221a3/modules/user-profile/user-profile-core/.classpath
----------------------------------------------------------------------
diff --git a/modules/user-profile/user-profile-core/.classpath b/modules/user-profile/user-profile-core/.classpath
new file mode 100644
index 0000000..af1430b
--- /dev/null
+++ b/modules/user-profile/user-profile-core/.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/b10221a3/modules/user-profile/user-profile-core/.project
----------------------------------------------------------------------
diff --git a/modules/user-profile/user-profile-core/.project b/modules/user-profile/user-profile-core/.project
new file mode 100644
index 0000000..e2dfe96
--- /dev/null
+++ b/modules/user-profile/user-profile-core/.project
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>user-profile-core</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.m2e.core.maven2Builder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+		<nature>org.eclipse.m2e.core.maven2Nature</nature>
+	</natures>
+</projectDescription>

http://git-wip-us.apache.org/repos/asf/airavata/blob/b10221a3/modules/user-profile/user-profile-core/.settings/org.eclipse.core.resources.prefs
----------------------------------------------------------------------
diff --git a/modules/user-profile/user-profile-core/.settings/org.eclipse.core.resources.prefs b/modules/user-profile/user-profile-core/.settings/org.eclipse.core.resources.prefs
new file mode 100644
index 0000000..f9fe345
--- /dev/null
+++ b/modules/user-profile/user-profile-core/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,4 @@
+eclipse.preferences.version=1
+encoding//src/main/java=UTF-8
+encoding//src/test/java=UTF-8
+encoding/<project>=UTF-8

http://git-wip-us.apache.org/repos/asf/airavata/blob/b10221a3/modules/user-profile/user-profile-core/.settings/org.eclipse.jdt.core.prefs
----------------------------------------------------------------------
diff --git a/modules/user-profile/user-profile-core/.settings/org.eclipse.jdt.core.prefs b/modules/user-profile/user-profile-core/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..714351a
--- /dev/null
+++ b/modules/user-profile/user-profile-core/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,5 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
+org.eclipse.jdt.core.compiler.compliance=1.8
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
+org.eclipse.jdt.core.compiler.source=1.8

http://git-wip-us.apache.org/repos/asf/airavata/blob/b10221a3/modules/user-profile/user-profile-core/.settings/org.eclipse.m2e.core.prefs
----------------------------------------------------------------------
diff --git a/modules/user-profile/user-profile-core/.settings/org.eclipse.m2e.core.prefs b/modules/user-profile/user-profile-core/.settings/org.eclipse.m2e.core.prefs
new file mode 100644
index 0000000..f897a7f
--- /dev/null
+++ b/modules/user-profile/user-profile-core/.settings/org.eclipse.m2e.core.prefs
@@ -0,0 +1,4 @@
+activeProfiles=
+eclipse.preferences.version=1
+resolveWorkspaceProjects=true
+version=1

http://git-wip-us.apache.org/repos/asf/airavata/blob/b10221a3/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 83af52b..0000000
--- a/modules/user-profile/user-profile-core/src/main/java/org/apache/airavata/userprofile/core/AbstractThriftDeserializer.java
+++ /dev/null
@@ -1,152 +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(String.format("Unable to deserialize JSON '%s' to type '%s'.",
-                    jp.getValueAsString(), instance.getClass().getName(), e));
-            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/b10221a3/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/b10221a3/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/b10221a3/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/b10221a3/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/b10221a3/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/b10221a3/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/b10221a3/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/b10221a3/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/b10221a3/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/b10221a3/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/b10221a3/modules/user-profile/user-profile-service/.project
----------------------------------------------------------------------
diff --git a/modules/user-profile/user-profile-service/.project b/modules/user-profile/user-profile-service/.project
new file mode 100644
index 0000000..15b1016
--- /dev/null
+++ b/modules/user-profile/user-profile-service/.project
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>user-profile-cpi</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.m2e.core.maven2Builder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+		<nature>org.eclipse.m2e.core.maven2Nature</nature>
+	</natures>
+</projectDescription>

http://git-wip-us.apache.org/repos/asf/airavata/blob/b10221a3/modules/user-profile/user-profile-service/.settings/org.eclipse.core.resources.prefs
----------------------------------------------------------------------
diff --git a/modules/user-profile/user-profile-service/.settings/org.eclipse.core.resources.prefs b/modules/user-profile/user-profile-service/.settings/org.eclipse.core.resources.prefs
new file mode 100644
index 0000000..e9441bb
--- /dev/null
+++ b/modules/user-profile/user-profile-service/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,3 @@
+eclipse.preferences.version=1
+encoding//src/main/java=UTF-8
+encoding/<project>=UTF-8

http://git-wip-us.apache.org/repos/asf/airavata/blob/b10221a3/modules/user-profile/user-profile-service/.settings/org.eclipse.jdt.core.prefs
----------------------------------------------------------------------
diff --git a/modules/user-profile/user-profile-service/.settings/org.eclipse.jdt.core.prefs b/modules/user-profile/user-profile-service/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..714351a
--- /dev/null
+++ b/modules/user-profile/user-profile-service/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,5 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
+org.eclipse.jdt.core.compiler.compliance=1.8
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
+org.eclipse.jdt.core.compiler.source=1.8

http://git-wip-us.apache.org/repos/asf/airavata/blob/b10221a3/modules/user-profile/user-profile-service/.settings/org.eclipse.m2e.core.prefs
----------------------------------------------------------------------
diff --git a/modules/user-profile/user-profile-service/.settings/org.eclipse.m2e.core.prefs b/modules/user-profile/user-profile-service/.settings/org.eclipse.m2e.core.prefs
new file mode 100644
index 0000000..f897a7f
--- /dev/null
+++ b/modules/user-profile/user-profile-service/.settings/org.eclipse.m2e.core.prefs
@@ -0,0 +1,4 @@
+activeProfiles=
+eclipse.preferences.version=1
+resolveWorkspaceProjects=true
+version=1

http://git-wip-us.apache.org/repos/asf/airavata/blob/b10221a3/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/b10221a3/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..8f04204
--- /dev/null
+++ b/modules/user-profile/user-profile-service/src/main/java/com.apache.airavata.user.profile/server/UserProfileHandler.java
@@ -0,0 +1,83 @@
+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) throws RegistryServiceException, TException {
+
+        List<UserProfile> usersInGateway = userProfileRepository.getAllUserProfilesInGateway(gatewayId);
+        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/b10221a3/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..5fb2ac2
--- /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("Credential store 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 Credential store Server on Port " + serverPort);
+                        logger.info("Listening to Credential store clients ....");
+                    }
+                }
+            }.start();
+        } catch (TTransportException e) {
+            setStatus(ServerStatus.FAILED);
+            throw new Exception("Error while starting the credential store 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/b10221a3/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
index 80ac86f..3f9bce8 100644
--- a/modules/user-profile/user-profile-stubs/pom.xml
+++ b/modules/user-profile/user-profile-stubs/pom.xml
@@ -26,5 +26,10 @@
             <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/b10221a3/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();
+    }
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/b10221a3/thrift-interface-descriptions/component-cpis/user-profile-crud-cpi.thrift
----------------------------------------------------------------------
diff --git a/thrift-interface-descriptions/component-cpis/user-profile-crud-cpi.thrift b/thrift-interface-descriptions/component-cpis/user-profile-crud-cpi.thrift
index b3951d2..bea5ca7 100644
--- a/thrift-interface-descriptions/component-cpis/user-profile-crud-cpi.thrift
+++ b/thrift-interface-descriptions/component-cpis/user-profile-crud-cpi.thrift
@@ -45,7 +45,7 @@ service UserProfileCrudeService {
   bool deleteUserProfile(1: required string userId)
                                                   throws (1:registry_api_errors.RegistryServiceException registryException);
 
-  list<user_profile_model.UserProfile> getAllUserProfilesInGateway (1: required string gatewayId)
+  list<user_profile_model.UserProfile> getAllUserProfilesInGateway (1: required string gatewayId, 2: required i32 offset, 3: required i32 limit)
                           throws (1:registry_api_errors.RegistryServiceException registryException);
 
  user_profile_model.UserProfile getUserProfileByName(1: required string userName, 2: required string gatewayId)


Mime
View raw message