airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From scnakand...@apache.org
Subject [04/14] airavata git commit: Refactor profile-user-core code to use profile-user-commons entities and utilities
Date Wed, 08 Mar 2017 23:45:45 GMT
Refactor profile-user-core code to use profile-user-commons entities and utilities


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

Branch: refs/heads/user-profile
Commit: 5b35224995f1cdc1eaf36ca3c75fb26fea3fbaff
Parents: fd38523
Author: Gourav Shenoy <shenoy.200@gmail.com>
Authored: Wed Mar 8 16:25:16 2017 -0500
Committer: Gourav Shenoy <shenoy.200@gmail.com>
Committed: Wed Mar 8 16:25:16 2017 -0500

----------------------------------------------------------------------
 .../commons/tenant/entities/Gateway.java        |  42 ++-
 .../user/entities/UserProfileEntity.java        |  50 +++-
 .../profile-service/profile-user-core/pom.xml   |  36 +--
 .../user/core/UserProfileRegistryException.java |  28 --
 .../core/entities/NSFDemographicsEntity.java    |  94 ------
 .../user/core/entities/UserProfileEntity.java   | 285 -------------------
 .../UserProfileRegistryException.java           |  28 ++
 .../core/repositories/AbstractRepository.java   |  98 -------
 .../repositories/UserProfileRepository.java     |   6 +-
 .../profile/user/core/utils/Committer.java      |  27 --
 .../profile/user/core/utils/JPAConstants.java   |  33 ---
 .../profile/user/core/utils/JPAUtils.java       |  83 ------
 .../user/core/utils/ObjectMapperSingleton.java  |  39 ---
 .../profile/user/core/utils/QueryConstants.java |  22 --
 .../service/profile/user/core/utils/Utils.java  | 155 ----------
 15 files changed, 113 insertions(+), 913 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/5b352249/airavata-services/profile-service/profile-service-commons/src/main/java/org/apache/airavata/service/profile/commons/tenant/entities/Gateway.java
----------------------------------------------------------------------
diff --git a/airavata-services/profile-service/profile-service-commons/src/main/java/org/apache/airavata/service/profile/commons/tenant/entities/Gateway.java b/airavata-services/profile-service/profile-service-commons/src/main/java/org/apache/airavata/service/profile/commons/tenant/entities/Gateway.java
index ecf3023..edb2a70 100644
--- a/airavata-services/profile-service/profile-service-commons/src/main/java/org/apache/airavata/service/profile/commons/tenant/entities/Gateway.java
+++ b/airavata-services/profile-service/profile-service-commons/src/main/java/org/apache/airavata/service/profile/commons/tenant/entities/Gateway.java
@@ -23,11 +23,9 @@ package org.apache.airavata.service.profile.commons.tenant.entities;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.Id;
-import javax.persistence.Table;
+import javax.persistence.*;
 import java.sql.Timestamp;
+import java.util.Date;
 
 @Entity
 @Table(name = "GATEWAY")
@@ -50,7 +48,7 @@ public class Gateway {
     private String declinedReason;
     private String oauthClientId;
     private String getOauthClientSecret;
-    private Timestamp requestCreationTime;
+    private long requestCreationTime;
     private String requesterUsername;
 
     @Id
@@ -208,11 +206,11 @@ public class Gateway {
     }
 
     @Column(name = "REQUEST_CREATION_TIME")
-    public Timestamp getRequestCreationTime() {
+    public long getRequestCreationTime() {
         return requestCreationTime;
     }
 
-    public void setRequestCreationTime(Timestamp requestCreationTime) {
+    private void setRequestCreationTime(long requestCreationTime) {
         this.requestCreationTime = requestCreationTime;
     }
 
@@ -224,4 +222,34 @@ public class Gateway {
     public void setGetOauthClientSecret(String oauthClientSecret) {
         this.getOauthClientSecret = oauthClientSecret;
     }
+
+    @PrePersist
+    void createdAt() {
+        this.requestCreationTime = new Date().getTime();
+    }
+
+    @Override
+    public String toString() {
+        return "Gateway{" +
+                "gatewayId='" + gatewayId + '\'' +
+                ", gatewayName='" + gatewayName + '\'' +
+                ", domain='" + domain + '\'' +
+                ", emailAddress='" + emailAddress + '\'' +
+                ", gatewayApprovalStatus='" + gatewayApprovalStatus + '\'' +
+                ", gatewayAcronym='" + gatewayAcronym + '\'' +
+                ", gatewayUrl='" + gatewayUrl + '\'' +
+                ", gatewayPublicAbstract='" + gatewayPublicAbstract + '\'' +
+                ", reviewProposalDescription='" + reviewProposalDescription + '\'' +
+                ", gatewayAdminFirstName='" + gatewayAdminFirstName + '\'' +
+                ", getGatewayAdminLastName='" + getGatewayAdminLastName + '\'' +
+                ", gatewayAdminEmail='" + gatewayAdminEmail + '\'' +
+                ", identityServerUserName='" + identityServerUserName + '\'' +
+                ", identityServerPasswordToken='" + identityServerPasswordToken + '\'' +
+                ", declinedReason='" + declinedReason + '\'' +
+                ", oauthClientId='" + oauthClientId + '\'' +
+                ", getOauthClientSecret='" + getOauthClientSecret + '\'' +
+                ", requestCreationTime=" + requestCreationTime +
+                ", requesterUsername='" + requesterUsername + '\'' +
+                '}';
+    }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/5b352249/airavata-services/profile-service/profile-service-commons/src/main/java/org/apache/airavata/service/profile/commons/user/entities/UserProfileEntity.java
----------------------------------------------------------------------
diff --git a/airavata-services/profile-service/profile-service-commons/src/main/java/org/apache/airavata/service/profile/commons/user/entities/UserProfileEntity.java b/airavata-services/profile-service/profile-service-commons/src/main/java/org/apache/airavata/service/profile/commons/user/entities/UserProfileEntity.java
index 15196ff..b625f59 100644
--- a/airavata-services/profile-service/profile-service-commons/src/main/java/org/apache/airavata/service/profile/commons/user/entities/UserProfileEntity.java
+++ b/airavata-services/profile-service/profile-service-commons/src/main/java/org/apache/airavata/service/profile/commons/user/entities/UserProfileEntity.java
@@ -21,6 +21,7 @@
 package org.apache.airavata.service.profile.commons.user.entities;
 
 import javax.persistence.*;
+import java.util.Date;
 import java.util.List;
 
 @Entity
@@ -35,8 +36,8 @@ public class UserProfileEntity {
     private String country;
     private String homeOrganization;
     private String orginationAffiliation;
-    private long creationTime;
-    private long lastAccessTime;
+    private Date creationTime;
+    private Date lastAccessTime;
     private long validUntil;
     private String state;
     private String comments;
@@ -162,20 +163,20 @@ public class UserProfileEntity {
     }
 
     @Column(name="CREATION_TIME")
-    public long getCreationTime() {
+    public Date getCreationTime() {
         return creationTime;
     }
 
-    public void setCreationTime(long creationTime) {
+    private void setCreationTime(Date creationTime) {
         this.creationTime = creationTime;
     }
 
     @Column(name = "LAST_ACCESS_TIME")
-    public long getLastAccessTime() {
+    public Date getLastAccessTime() {
         return lastAccessTime;
     }
 
-    public void setLastAccessTime(long lastAccessTime) {
+    private void setLastAccessTime(Date lastAccessTime) {
         this.lastAccessTime = lastAccessTime;
     }
 
@@ -244,4 +245,41 @@ public class UserProfileEntity {
     public void setNsfDemographics(NSFDemographicsEntity nsfDemographics) {
         this.nsfDemographics = nsfDemographics;
     }
+
+    @PrePersist
+    void createdAt() {
+        this.creationTime = this.lastAccessTime = new Date();
+    }
+
+    @PreUpdate
+    void updatedAt() {
+        this.lastAccessTime = new Date();
+    }
+
+    @Override
+    public String toString() {
+        return "UserProfileEntity{" +
+                "airavataInternalUserId='" + airavataInternalUserId + '\'' +
+                ", userId='" + userId + '\'' +
+                ", gatewayId='" + gatewayId + '\'' +
+                ", userModelVersion='" + userModelVersion + '\'' +
+                ", userName='" + userName + '\'' +
+                ", orcidId='" + orcidId + '\'' +
+                ", country='" + country + '\'' +
+                ", homeOrganization='" + homeOrganization + '\'' +
+                ", orginationAffiliation='" + orginationAffiliation + '\'' +
+                ", creationTime=" + creationTime +
+                ", lastAccessTime=" + lastAccessTime +
+                ", validUntil=" + validUntil +
+                ", state='" + state + '\'' +
+                ", comments='" + comments + '\'' +
+                ", labeledURI=" + labeledURI +
+                ", gpgKey='" + gpgKey + '\'' +
+                ", timeZone='" + timeZone + '\'' +
+                ", nationality=" + nationality +
+                ", emails=" + emails +
+                ", phones=" + phones +
+                ", nsfDemographics=" + nsfDemographics +
+                '}';
+    }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/5b352249/airavata-services/profile-service/profile-user-core/pom.xml
----------------------------------------------------------------------
diff --git a/airavata-services/profile-service/profile-user-core/pom.xml b/airavata-services/profile-service/profile-user-core/pom.xml
index ef0814a..1ad210c 100644
--- a/airavata-services/profile-service/profile-user-core/pom.xml
+++ b/airavata-services/profile-service/profile-user-core/pom.xml
@@ -23,39 +23,9 @@
 
     <dependencies>
         <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>${openjpa.version}</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>
+            <groupId>org.apache.airavata</groupId>
+            <artifactId>profile-service-commons</artifactId>
+            <version>${project.version}</version>
         </dependency>
     </dependencies>
 

http://git-wip-us.apache.org/repos/asf/airavata/blob/5b352249/airavata-services/profile-service/profile-user-core/src/main/java/org/apache/airavata/service/profile/user/core/UserProfileRegistryException.java
----------------------------------------------------------------------
diff --git a/airavata-services/profile-service/profile-user-core/src/main/java/org/apache/airavata/service/profile/user/core/UserProfileRegistryException.java b/airavata-services/profile-service/profile-user-core/src/main/java/org/apache/airavata/service/profile/user/core/UserProfileRegistryException.java
deleted file mode 100644
index 7aee651..0000000
--- a/airavata-services/profile-service/profile-user-core/src/main/java/org/apache/airavata/service/profile/user/core/UserProfileRegistryException.java
+++ /dev/null
@@ -1,28 +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.service.profile.user.core;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class UserProfileRegistryException extends Exception {
-    private final static Logger logger = LoggerFactory.getLogger(UserProfileRegistryException.class);
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/5b352249/airavata-services/profile-service/profile-user-core/src/main/java/org/apache/airavata/service/profile/user/core/entities/NSFDemographicsEntity.java
----------------------------------------------------------------------
diff --git a/airavata-services/profile-service/profile-user-core/src/main/java/org/apache/airavata/service/profile/user/core/entities/NSFDemographicsEntity.java b/airavata-services/profile-service/profile-user-core/src/main/java/org/apache/airavata/service/profile/user/core/entities/NSFDemographicsEntity.java
deleted file mode 100644
index 7c1701b..0000000
--- a/airavata-services/profile-service/profile-user-core/src/main/java/org/apache/airavata/service/profile/user/core/entities/NSFDemographicsEntity.java
+++ /dev/null
@@ -1,94 +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.service.profile.user.core.entities;
-
-import javax.persistence.*;
-import java.util.List;
-
-@Entity
-@Table(name = "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/5b352249/airavata-services/profile-service/profile-user-core/src/main/java/org/apache/airavata/service/profile/user/core/entities/UserProfileEntity.java
----------------------------------------------------------------------
diff --git a/airavata-services/profile-service/profile-user-core/src/main/java/org/apache/airavata/service/profile/user/core/entities/UserProfileEntity.java b/airavata-services/profile-service/profile-user-core/src/main/java/org/apache/airavata/service/profile/user/core/entities/UserProfileEntity.java
deleted file mode 100644
index 7a7d5bd..0000000
--- a/airavata-services/profile-service/profile-user-core/src/main/java/org/apache/airavata/service/profile/user/core/entities/UserProfileEntity.java
+++ /dev/null
@@ -1,285 +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.service.profile.user.core.entities;
-
-import javax.persistence.*;
-import java.util.Date;
-import java.util.List;
-
-@Entity
-@Table(name="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 Date creationTime;
-    private Date 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(fetch = FetchType.EAGER)
-    @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(fetch = FetchType.EAGER)
-    @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(fetch = FetchType.EAGER)
-    @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 Date getCreationTime() {
-        return creationTime;
-    }
-
-    private void setCreationTime(Date creationTime) {
-        this.creationTime = creationTime;
-    }
-
-    @Column(name = "LAST_ACCESS_TIME")
-    public Date getLastAccessTime() {
-        return lastAccessTime;
-    }
-
-    private void setLastAccessTime(Date 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(fetch = FetchType.EAGER)
-    @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", fetch = FetchType.EAGER)
-    public NSFDemographicsEntity getNsfDemographics() {
-        return nsfDemographics;
-    }
-
-    public void setNsfDemographics(NSFDemographicsEntity nsfDemographics) {
-        this.nsfDemographics = nsfDemographics;
-    }
-
-    @PrePersist
-    void createdAt() {
-        this.creationTime = this.lastAccessTime = new Date();
-    }
-
-    @PreUpdate
-    void updatedAt() {
-        this.lastAccessTime = new Date();
-    }
-
-    @Override
-    public String toString() {
-        return "UserProfileEntity{" +
-                "airavataInternalUserId='" + airavataInternalUserId + '\'' +
-                ", userId='" + userId + '\'' +
-                ", gatewayId='" + gatewayId + '\'' +
-                ", userModelVersion='" + userModelVersion + '\'' +
-                ", userName='" + userName + '\'' +
-                ", orcidId='" + orcidId + '\'' +
-                ", country='" + country + '\'' +
-                ", homeOrganization='" + homeOrganization + '\'' +
-                ", orginationAffiliation='" + orginationAffiliation + '\'' +
-                ", creationTime=" + creationTime +
-                ", lastAccessTime=" + lastAccessTime +
-                ", validUntil=" + validUntil +
-                ", state='" + state + '\'' +
-                ", comments='" + comments + '\'' +
-                ", labeledURI=" + labeledURI +
-                ", gpgKey='" + gpgKey + '\'' +
-                ", timeZone='" + timeZone + '\'' +
-                ", nationality=" + nationality +
-                ", emails=" + emails +
-                ", phones=" + phones +
-                ", nsfDemographics=" + nsfDemographics +
-                '}';
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/5b352249/airavata-services/profile-service/profile-user-core/src/main/java/org/apache/airavata/service/profile/user/core/exceptions/UserProfileRegistryException.java
----------------------------------------------------------------------
diff --git a/airavata-services/profile-service/profile-user-core/src/main/java/org/apache/airavata/service/profile/user/core/exceptions/UserProfileRegistryException.java b/airavata-services/profile-service/profile-user-core/src/main/java/org/apache/airavata/service/profile/user/core/exceptions/UserProfileRegistryException.java
new file mode 100644
index 0000000..1a7677c
--- /dev/null
+++ b/airavata-services/profile-service/profile-user-core/src/main/java/org/apache/airavata/service/profile/user/core/exceptions/UserProfileRegistryException.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.service.profile.user.core.exceptions;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class UserProfileRegistryException extends Exception {
+    private final static Logger logger = LoggerFactory.getLogger(UserProfileRegistryException.class);
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/5b352249/airavata-services/profile-service/profile-user-core/src/main/java/org/apache/airavata/service/profile/user/core/repositories/AbstractRepository.java
----------------------------------------------------------------------
diff --git a/airavata-services/profile-service/profile-user-core/src/main/java/org/apache/airavata/service/profile/user/core/repositories/AbstractRepository.java b/airavata-services/profile-service/profile-user-core/src/main/java/org/apache/airavata/service/profile/user/core/repositories/AbstractRepository.java
deleted file mode 100644
index 3cf6925..0000000
--- a/airavata-services/profile-service/profile-user-core/src/main/java/org/apache/airavata/service/profile/user/core/repositories/AbstractRepository.java
+++ /dev/null
@@ -1,98 +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.service.profile.user.core.repositories;
-
-import org.apache.airavata.service.profile.user.core.utils.JPAUtils;
-import org.apache.airavata.service.profile.user.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/5b352249/airavata-services/profile-service/profile-user-core/src/main/java/org/apache/airavata/service/profile/user/core/repositories/UserProfileRepository.java
----------------------------------------------------------------------
diff --git a/airavata-services/profile-service/profile-user-core/src/main/java/org/apache/airavata/service/profile/user/core/repositories/UserProfileRepository.java b/airavata-services/profile-service/profile-user-core/src/main/java/org/apache/airavata/service/profile/user/core/repositories/UserProfileRepository.java
index 5421570..7f58bb0 100644
--- a/airavata-services/profile-service/profile-user-core/src/main/java/org/apache/airavata/service/profile/user/core/repositories/UserProfileRepository.java
+++ b/airavata-services/profile-service/profile-user-core/src/main/java/org/apache/airavata/service/profile/user/core/repositories/UserProfileRepository.java
@@ -21,9 +21,9 @@
 package org.apache.airavata.service.profile.user.core.repositories;
 
 import org.apache.airavata.model.user.UserProfile;
-import org.apache.airavata.service.profile.user.core.entities.UserProfileEntity;
-import org.apache.airavata.service.profile.user.core.utils.ObjectMapperSingleton;
-import org.apache.airavata.service.profile.user.core.utils.QueryConstants;
+import org.apache.airavata.service.profile.commons.repositories.AbstractRepository;
+import org.apache.airavata.service.profile.commons.user.entities.UserProfileEntity;
+import org.apache.airavata.service.profile.commons.utils.QueryConstants;
 import org.dozer.Mapper;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;

http://git-wip-us.apache.org/repos/asf/airavata/blob/5b352249/airavata-services/profile-service/profile-user-core/src/main/java/org/apache/airavata/service/profile/user/core/utils/Committer.java
----------------------------------------------------------------------
diff --git a/airavata-services/profile-service/profile-user-core/src/main/java/org/apache/airavata/service/profile/user/core/utils/Committer.java b/airavata-services/profile-service/profile-user-core/src/main/java/org/apache/airavata/service/profile/user/core/utils/Committer.java
deleted file mode 100644
index e55c2ad..0000000
--- a/airavata-services/profile-service/profile-user-core/src/main/java/org/apache/airavata/service/profile/user/core/utils/Committer.java
+++ /dev/null
@@ -1,27 +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.service.profile.user.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/5b352249/airavata-services/profile-service/profile-user-core/src/main/java/org/apache/airavata/service/profile/user/core/utils/JPAConstants.java
----------------------------------------------------------------------
diff --git a/airavata-services/profile-service/profile-user-core/src/main/java/org/apache/airavata/service/profile/user/core/utils/JPAConstants.java b/airavata-services/profile-service/profile-user-core/src/main/java/org/apache/airavata/service/profile/user/core/utils/JPAConstants.java
deleted file mode 100644
index 8350f4c..0000000
--- a/airavata-services/profile-service/profile-user-core/src/main/java/org/apache/airavata/service/profile/user/core/utils/JPAConstants.java
+++ /dev/null
@@ -1,33 +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.service.profile.user.core.utils;
-public class JPAConstants {
-	public static final String KEY_JDBC_URL = "user.profile.catalog.registry.jdbc.url";
-	public static final String KEY_JDBC_USER = "user.profile.catalog.registry.jdbc.user";
-	public static final String KEY_JDBC_PASSWORD = "user.profile.catalog.registry.jdbc.password";
-	public static final String KEY_JDBC_DRIVER = "user.profile.catalog.registry.jdbc.driver";
-	// TODO: is this needed?
-	public static final String KEY_DERBY_START_ENABLE = "user.profile.catalog.start.derby.server.mode";
-	public static final String VALIDATION_QUERY = "user.profile.catalog.validationQuery";
-	public static final String JPA_CACHE_SIZE = "user.profile.catalog.jpa.cache.size";
-	public static final String ENABLE_CACHING = "user.profile.catalog.cache.enable";
-}

http://git-wip-us.apache.org/repos/asf/airavata/blob/5b352249/airavata-services/profile-service/profile-user-core/src/main/java/org/apache/airavata/service/profile/user/core/utils/JPAUtils.java
----------------------------------------------------------------------
diff --git a/airavata-services/profile-service/profile-user-core/src/main/java/org/apache/airavata/service/profile/user/core/utils/JPAUtils.java b/airavata-services/profile-service/profile-user-core/src/main/java/org/apache/airavata/service/profile/user/core/utils/JPAUtils.java
deleted file mode 100644
index 3e95efd..0000000
--- a/airavata-services/profile-service/profile-user-core/src/main/java/org/apache/airavata/service/profile/user/core/utils/JPAUtils.java
+++ /dev/null
@@ -1,83 +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.service.profile.user.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 = "user_profile_catalog";
-    @PersistenceUnit(unitName = "user_profile_catalog")
-    protected static EntityManagerFactory factory;
-    @PersistenceContext(unitName = "user_profile_catalog")
-    private static EntityManager entityManager;
-
-    public static EntityManager getEntityManager(){
-
-        if (factory == null) {
-            //FIXME
-            String connectionProperties = "DriverClassName=" + Utils.getJDBCDriver() + "," + "Url=" +
-                    Utils.getJDBCURL() + "?autoReconnect=true," +
-                    "Username=" + Utils.getJDBCUser() + "," + "Password=" + Utils.getJDBCPassword() +
-                    ",validationQuery=" + Utils.getValidationQuery();
-            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/5b352249/airavata-services/profile-service/profile-user-core/src/main/java/org/apache/airavata/service/profile/user/core/utils/ObjectMapperSingleton.java
----------------------------------------------------------------------
diff --git a/airavata-services/profile-service/profile-user-core/src/main/java/org/apache/airavata/service/profile/user/core/utils/ObjectMapperSingleton.java b/airavata-services/profile-service/profile-user-core/src/main/java/org/apache/airavata/service/profile/user/core/utils/ObjectMapperSingleton.java
deleted file mode 100644
index 60f3292..0000000
--- a/airavata-services/profile-service/profile-user-core/src/main/java/org/apache/airavata/service/profile/user/core/utils/ObjectMapperSingleton.java
+++ /dev/null
@@ -1,39 +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.service.profile.user.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/5b352249/airavata-services/profile-service/profile-user-core/src/main/java/org/apache/airavata/service/profile/user/core/utils/QueryConstants.java
----------------------------------------------------------------------
diff --git a/airavata-services/profile-service/profile-user-core/src/main/java/org/apache/airavata/service/profile/user/core/utils/QueryConstants.java b/airavata-services/profile-service/profile-user-core/src/main/java/org/apache/airavata/service/profile/user/core/utils/QueryConstants.java
deleted file mode 100644
index 5ad5dde..0000000
--- a/airavata-services/profile-service/profile-user-core/src/main/java/org/apache/airavata/service/profile/user/core/utils/QueryConstants.java
+++ /dev/null
@@ -1,22 +0,0 @@
-package org.apache.airavata.service.profile.user.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/5b352249/airavata-services/profile-service/profile-user-core/src/main/java/org/apache/airavata/service/profile/user/core/utils/Utils.java
----------------------------------------------------------------------
diff --git a/airavata-services/profile-service/profile-user-core/src/main/java/org/apache/airavata/service/profile/user/core/utils/Utils.java b/airavata-services/profile-service/profile-user-core/src/main/java/org/apache/airavata/service/profile/user/core/utils/Utils.java
deleted file mode 100644
index a12a536..0000000
--- a/airavata-services/profile-service/profile-user-core/src/main/java/org/apache/airavata/service/profile/user/core/utils/Utils.java
+++ /dev/null
@@ -1,155 +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.service.profile.user.core.utils;
-
-import org.apache.airavata.common.exception.ApplicationSettingsException;
-import org.apache.airavata.common.utils.ServerSettings;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.net.URI;
-
-
-public class Utils {
-    private final static Logger logger = LoggerFactory.getLogger(Utils.class);
-
-    public static String getJDBCFullURL(){
-		String jdbcUrl = getJDBCURL();
-		String jdbcUser = getJDBCUser();
-		String jdbcPassword = getJDBCPassword();
-        jdbcUrl = jdbcUrl + "?"  + "user=" + jdbcUser + "&" + "password=" + jdbcPassword;
-        return jdbcUrl;
-    }
-
-    public static String getJDBCURL(){
-    	try {
-            return ServerSettings.getSetting(JPAConstants.KEY_JDBC_URL);
-		} catch (ApplicationSettingsException e) {
-            logger.error(e.getMessage(), e);
-            return null;
-        }
-    }
-
-    public static String getHost(){
-        try{
-            String jdbcURL = getJDBCURL();
-            String cleanURI = jdbcURL.substring(5);
-            URI uri = URI.create(cleanURI);
-            return uri.getHost();
-        } catch (Exception e) {
-            logger.error(e.getMessage(), e);
-            return null;
-        }
-    }
-
-    public static int getPort(){
-        try{
-            String jdbcURL = getJDBCURL();
-            String cleanURI = jdbcURL.substring(5);
-            URI uri = URI.create(cleanURI);
-            return uri.getPort();
-        } catch (Exception e) {
-            logger.error(e.getMessage(), e);
-            return -1;
-        }
-    }
-
-    public static int getJPACacheSize (){
-        try {
-            String cache = ServerSettings.getSetting(JPAConstants.JPA_CACHE_SIZE, "5000");
-            return Integer.parseInt(cache);
-        }catch (Exception e){
-            logger.error(e.getMessage(), e);
-            return -1;
-        }
-    }
-
-    public static String isCachingEnabled (){
-        try {
-            return ServerSettings.getSetting(JPAConstants.ENABLE_CACHING, "true");
-        }catch (Exception e){
-            logger.error(e.getMessage(), e);
-            return "true";
-        }
-    }
-
-    public static String getDBType(){
-        try{
-            String jdbcURL = getJDBCURL();
-            String cleanURI = jdbcURL.substring(5);
-            URI uri = URI.create(cleanURI);
-            return uri.getScheme();
-        } catch (Exception e) {
-            logger.error(e.getMessage(), e);
-            return null;
-        }
-    }
-
-    public static boolean isDerbyStartEnabled(){
-        try {
-            String s = ServerSettings.getSetting(JPAConstants.KEY_DERBY_START_ENABLE);
-            if("true".equals(s)){
-                return true;
-            }
-        } catch (ApplicationSettingsException e) {
-            logger.error(e.getMessage(), e);
-            return false;
-        }
-        return false;
-    }
-
-    public static String getJDBCUser(){
-    	try {
-		    return ServerSettings.getSetting(JPAConstants.KEY_JDBC_USER);
-		} catch (ApplicationSettingsException e) {
-            logger.error(e.getMessage(), e);
-            return null;
-		}
-    }
-
-    public static String getValidationQuery(){
-    	try {
-            return ServerSettings.getSetting(JPAConstants.VALIDATION_QUERY);
-		} catch (ApplicationSettingsException e) {
-            logger.error(e.getMessage(), e);
-            return null;
-		}
-    }
-
-    public static String getJDBCPassword(){
-    	try {
-            return ServerSettings.getSetting(JPAConstants.KEY_JDBC_PASSWORD);
-		} catch (ApplicationSettingsException e) {
-            logger.error(e.getMessage(), e);
-            return null;
-		}
-
-    }
-
-    public static String getJDBCDriver(){
-    	try {
-            return ServerSettings.getSetting(JPAConstants.KEY_JDBC_DRIVER);
-		} catch (ApplicationSettingsException e) {
-            logger.error(e.getMessage(), e);
-            return null;
-		}
-    }
-}
\ No newline at end of file


Mime
View raw message