airavata-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (AIRAVATA-2712) Refactoring App Catalog Implementation - User Resource Profile
Date Wed, 28 Mar 2018 21:14:00 GMT

    [ https://issues.apache.org/jira/browse/AIRAVATA-2712?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16418118#comment-16418118 ] 

ASF GitHub Bot commented on AIRAVATA-2712:
------------------------------------------

machristie closed pull request #185: [AIRAVATA-2712] Refactoring App Catalog Implementation - UserResourceProfile
URL: https://github.com/apache/airavata/pull/185
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/appcatalog/UserComputeResourcePreferenceEntity.java b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/appcatalog/UserComputeResourcePreferenceEntity.java
new file mode 100644
index 0000000000..3250b69393
--- /dev/null
+++ b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/appcatalog/UserComputeResourcePreferenceEntity.java
@@ -0,0 +1,198 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
+package org.apache.airavata.registry.core.entities.appcatalog;
+
+import javax.persistence.*;
+import java.sql.Timestamp;
+
+/**
+ * The persistent class for the user_compute_resource_preference database table.
+ */
+@Entity
+@Table(name = "USER_COMPUTE_RESOURCE_PREFERENCE")
+@IdClass(UserComputeResourcePreferencePK.class)
+public class UserComputeResourcePreferenceEntity {
+    private static final long serialVersionUID = 1L;
+
+    @Id
+    @Column(name = "RESOURCE_ID")
+    private String computeResourceId;
+
+    @Id
+    @Column(name = "USER_ID")
+    private String userId;
+
+    @Id
+    @Column(name = "GATEWAY_ID")
+    private String gatewayId;
+
+    @Column(name = "PREFERED_BATCH_QUEUE")
+    private String preferredBatchQueue;
+
+    @Column(name = "RESOURCE_CS_TOKEN")
+    private String resourceSpecificCredentialStoreToken;
+
+    @Column(name = "LOGIN_USERNAME")
+    private String loginUserName;
+
+    @Column(name = "ALLOCATION_PROJECT_NUMBER")
+    private String allocationProjectNumber;
+
+    @Column(name = "QUALITY_OF_SERVICE")
+    private String qualityOfService;
+
+    @Column(name = "RESERVATION")
+    private String reservation;
+
+    @Column(name = "RESERVATION_START_TIME")
+    private Timestamp reservationStartTime;
+
+    @Column(name = "RESERVATION_END_TIME")
+    private Timestamp reservationEndTime;
+
+    @Column(name = "SCRATCH_LOCATION")
+    private String scratchLocation;
+
+    @Column(name = "VALIDATED")
+    private boolean validated;
+
+    @ManyToOne(targetEntity = UserResourceProfileEntity.class, cascade = CascadeType.MERGE)
+    @JoinColumns({
+            @JoinColumn(name = "USER_ID"),
+            @JoinColumn(name="GATEWAY_ID")
+    })
+    private UserResourceProfileEntity userResourceProfile;
+
+    public UserComputeResourcePreferenceEntity() {
+    }
+
+    public String getComputeResourceId() {
+        return computeResourceId;
+    }
+
+    public void setComputeResourceId(String computeResourceId) {
+        this.computeResourceId = computeResourceId;
+    }
+
+    public String getUserId() {
+        return userId;
+    }
+
+    public void setUserId(String userId) {
+        this.userId = userId;
+    }
+
+    public String getGatewayId() {
+        return gatewayId;
+    }
+
+    public void setGatewayId(String gatewayId) {
+        this.gatewayId = gatewayId;
+    }
+
+    public String getPreferredBatchQueue() {
+        return preferredBatchQueue;
+    }
+
+    public void setPreferredBatchQueue(String preferredBatchQueue) {
+        this.preferredBatchQueue = preferredBatchQueue;
+    }
+
+    public String getResourceSpecificCredentialStoreToken() {
+        return resourceSpecificCredentialStoreToken;
+    }
+
+    public void setResourceSpecificCredentialStoreToken(String resourceSpecificCredentialStoreToken) {
+        this.resourceSpecificCredentialStoreToken = resourceSpecificCredentialStoreToken;
+    }
+
+    public String getLoginUserName() {
+        return loginUserName;
+    }
+
+    public void setLoginUserName(String loginUserName) {
+        this.loginUserName = loginUserName;
+    }
+
+    public String getAllocationProjectNumber() {
+        return allocationProjectNumber;
+    }
+
+    public void setAllocationProjectNumber(String allocationProjectNumber) {
+        this.allocationProjectNumber = allocationProjectNumber;
+    }
+
+    public String getQualityOfService() {
+        return qualityOfService;
+    }
+
+    public void setQualityOfService(String qualityOfService) {
+        this.qualityOfService = qualityOfService;
+    }
+
+    public String getReservation() {
+        return reservation;
+    }
+
+    public void setReservation(String reservation) {
+        this.reservation = reservation;
+    }
+
+    public Timestamp getReservationStartTime() {
+        return reservationStartTime;
+    }
+
+    public void setReservationStartTime(Timestamp reservationStartTime) {
+        this.reservationStartTime = reservationStartTime;
+    }
+
+    public Timestamp getReservationEndTime() {
+        return reservationEndTime;
+    }
+
+    public void setReservationEndTime(Timestamp reservationEndTime) {
+        this.reservationEndTime = reservationEndTime;
+    }
+
+    public String getScratchLocation() {
+        return scratchLocation;
+    }
+
+    public void setScratchLocation(String scratchLocation) {
+        this.scratchLocation = scratchLocation;
+    }
+
+    public boolean isValidated() {
+        return validated;
+    }
+
+    public void setValidated(boolean validated) {
+        this.validated = validated;
+    }
+
+    public UserResourceProfileEntity getUserResourceProfile() {
+        return userResourceProfile;
+    }
+
+    public void setUserResourceProfile(UserResourceProfileEntity userResourceProfile) {
+        this.userResourceProfile = userResourceProfile;
+    }
+}
diff --git a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/appcatalog/UserComputeResourcePreferencePK.java b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/appcatalog/UserComputeResourcePreferencePK.java
new file mode 100644
index 0000000000..e40ea53491
--- /dev/null
+++ b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/appcatalog/UserComputeResourcePreferencePK.java
@@ -0,0 +1,90 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
+package org.apache.airavata.registry.core.entities.appcatalog;
+
+import javax.persistence.Column;
+import javax.persistence.Id;
+import java.io.Serializable;
+
+/**
+ * The primary key class for the user_compute_resource_preference database table.
+ *
+ */
+public class UserComputeResourcePreferencePK implements Serializable {
+    //default serial version id, required for serializable classes.
+    private static final long serialVersionUID = 1L;
+
+    private String computeResourceId;
+    private String userId;
+    private String gatewayId;
+
+    public UserComputeResourcePreferencePK() {
+    }
+
+    public String getComputeResourceId() {
+        return computeResourceId;
+    }
+
+    public void setComputeResourceId(String computeResourceId) {
+        this.computeResourceId = computeResourceId;
+    }
+
+    public String getUserId() {
+        return userId;
+    }
+
+    public void setUserId(String userId) {
+        this.userId = userId;
+    }
+
+    public String getGatewayId() {
+        return gatewayId;
+    }
+
+    public void setGatewayId(String gatewayId) {
+        this.gatewayId = gatewayId;
+    }
+
+    public boolean equals(Object other) {
+        if (this == other) {
+            return true;
+        }
+        if (!(other instanceof UserComputeResourcePreferencePK)) {
+            return false;
+        }
+        UserComputeResourcePreferencePK castOther = (UserComputeResourcePreferencePK)other;
+        return
+                this.computeResourceId.equals(castOther.computeResourceId)
+                    && this.userId.equals(castOther.userId)
+                        && this.gatewayId.equals(castOther.gatewayId);
+    }
+
+    public int hashCode() {
+        final int prime = 31;
+        int hash = 17;
+        hash = hash * prime + this.computeResourceId.hashCode();
+        hash = hash * prime + this.userId.hashCode();
+        hash = hash * prime + this.gatewayId.hashCode();
+
+        return hash;
+    }
+
+}
diff --git a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/appcatalog/UserResourceProfileEntity.java b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/appcatalog/UserResourceProfileEntity.java
new file mode 100644
index 0000000000..2756219271
--- /dev/null
+++ b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/appcatalog/UserResourceProfileEntity.java
@@ -0,0 +1,142 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
+package org.apache.airavata.registry.core.entities.appcatalog;
+
+import java.util.*;
+import javax.persistence.*;
+import java.sql.Timestamp;
+
+/**
+ * The persistent class for the user_resource_profile database table.
+ */
+@Entity
+@Table(name = "USER_RESOURCE_PROFILE")
+@IdClass(UserResourceProfilePK.class)
+public class UserResourceProfileEntity {
+    private static final long serialVersionUID = 1L;
+
+    @Id
+    @Column(name = "USER_ID")
+    private String userId;
+
+    @Id
+    @Column(name = "GATEWAY_ID")
+    private String gatewayId;
+
+    @Column(name = "CS_TOKEN")
+    private String credentialStoreToken;
+
+    @Column(name = "IDENTITY_SERVER_PWD_CRED_TOKEN")
+    private String identityServerPwdCredToken;
+
+    @Column(name = "IDENTITY_SERVER_TENANT")
+    private String identityServerTenant;
+
+    @Column(name = "CREATION_TIME")
+    private Timestamp creationTime;
+
+    @Column(name = "UPDATE_TIME")
+    private Timestamp updateTime;
+
+    @OneToMany (targetEntity = UserComputeResourcePreferenceEntity.class, cascade = CascadeType.ALL,
+            mappedBy = "userResourceProfile", fetch = FetchType.EAGER)
+    private List<UserComputeResourcePreferenceEntity> userComputeResourcePreferences;
+
+    @OneToMany (targetEntity = UserStoragePreferenceEntity.class, cascade = CascadeType.ALL,
+            mappedBy = "userResourceProfile", fetch = FetchType.EAGER)
+    private List<UserStoragePreferenceEntity> userStoragePreferences;
+
+    public UserResourceProfileEntity() {
+    }
+
+    public String getUserId() {
+        return userId;
+    }
+
+    public void setUserId(String userId) {
+        this.userId = userId;
+    }
+
+    public String getGatewayId() {
+        return gatewayId;
+    }
+
+    public void setGatewayId(String gatewayId) {
+        this.gatewayId = gatewayId;
+    }
+
+    public String getCredentialStoreToken() {
+        return credentialStoreToken;
+    }
+
+    public void setCredentialStoreToken(String credentialStoreToken) {
+        this.credentialStoreToken = credentialStoreToken;
+    }
+
+    public String getIdentityServerPwdCredToken() {
+        return identityServerPwdCredToken;
+    }
+
+    public void setIdentityServerPwdCredToken(String identityServerPwdCredToken) {
+        this.identityServerPwdCredToken = identityServerPwdCredToken;
+    }
+
+    public String getIdentityServerTenant() {
+        return identityServerTenant;
+    }
+
+    public void setIdentityServerTenant(String identityServerTenant) {
+        this.identityServerTenant = identityServerTenant;
+    }
+
+    public Timestamp getCreationTime() {
+        return creationTime;
+    }
+
+    public void setCreationTime(Timestamp creationTime) {
+        this.creationTime = creationTime;
+    }
+
+    public Timestamp getUpdateTime() {
+        return updateTime;
+    }
+
+    public void setUpdateTime(Timestamp updateTime) {
+        this.updateTime = updateTime;
+    }
+
+    public List<UserComputeResourcePreferenceEntity> getUserComputeResourcePreferences() {
+        return userComputeResourcePreferences;
+    }
+
+    public void setUserComputeResourcePreferences(List<UserComputeResourcePreferenceEntity> userComputeResourcePreferences) {
+        this.userComputeResourcePreferences = userComputeResourcePreferences;
+    }
+
+    public List<UserStoragePreferenceEntity> getUserStoragePreferences() {
+        return userStoragePreferences;
+    }
+
+    public void setUserStoragePreferences(List<UserStoragePreferenceEntity> userStoragePreferences) {
+        this.userStoragePreferences = userStoragePreferences;
+    }
+
+}
diff --git a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/appcatalog/UserResourceProfilePK.java b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/appcatalog/UserResourceProfilePK.java
new file mode 100644
index 0000000000..6b530e99c4
--- /dev/null
+++ b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/appcatalog/UserResourceProfilePK.java
@@ -0,0 +1,78 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
+package org.apache.airavata.registry.core.entities.appcatalog;
+
+import javax.persistence.Column;
+import javax.persistence.Id;
+import java.io.Serializable;
+
+/**
+ * The primary key class for the user_resource_profile database table.
+ *
+ */
+public class UserResourceProfilePK implements Serializable {
+    //default serial version id, required for serializable classes.
+    private static final long serialVersionUID = 1L;
+
+    private String userId;
+    private String gatewayId;
+
+    public UserResourceProfilePK() {
+    }
+
+    public String getUserId() {
+        return userId;
+    }
+
+    public void setUserId(String userId) {
+        this.userId = userId;
+    }
+
+    public String getGatewayId() {
+        return gatewayId;
+    }
+
+    public void setGatewayId(String gatewayId) {
+        this.gatewayId = gatewayId;
+    }
+
+    public boolean equals(Object other) {
+        if (this == other) {
+            return true;
+        }
+        if (!(other instanceof UserResourceProfilePK)) {
+            return false;
+        }
+        UserResourceProfilePK castOther = (UserResourceProfilePK)other;
+        return
+                this.userId.equals(castOther.userId)
+                        && this.gatewayId.equals(castOther.gatewayId);
+    }
+
+    public int hashCode() {
+        final int prime = 31;
+        int hash = 17;
+        hash = hash * prime + this.userId.hashCode();
+        hash = hash * prime + this.gatewayId.hashCode();
+
+        return hash;
+    }
+}
diff --git a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/appcatalog/UserStoragePreferenceEntity.java b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/appcatalog/UserStoragePreferenceEntity.java
new file mode 100644
index 0000000000..8d73eafa24
--- /dev/null
+++ b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/appcatalog/UserStoragePreferenceEntity.java
@@ -0,0 +1,121 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
+package org.apache.airavata.registry.core.entities.appcatalog;
+
+import javax.persistence.*;
+
+/**
+ * The persistent class for the user_storage_preference database table.
+ */
+@Entity
+@Table(name = "USER_STORAGE_PREFERENCE")
+@IdClass(UserStoragePreferencePK.class)
+public class UserStoragePreferenceEntity {
+    private static final long serialVersionUID = 1L;
+
+    @Id
+    @Column(name = "STORAGE_RESOURCE_ID")
+    private String storageResourceId;
+
+    @Id
+    @Column(name = "USER_ID")
+    private String userId;
+
+    @Id
+    @Column(name = "GATEWAY_ID")
+    private String gatewayId;
+
+    @Column(name = "RESOURCE_CS_TOKEN")
+    private String resourceSpecificCredentialStoreToken;
+
+    @Column(name = "FS_ROOT_LOCATION")
+    private String fileSystemRootLocation;
+
+    @Column(name = "LOGIN_USERNAME")
+    private String loginUserName;
+
+    @ManyToOne(targetEntity = UserResourceProfileEntity.class, cascade = CascadeType.MERGE)
+    @JoinColumns({
+            @JoinColumn(name = "USER_ID"),
+            @JoinColumn(name="GATEWAY_ID")
+    })
+    private UserResourceProfileEntity userResourceProfile;
+
+    public UserStoragePreferenceEntity() {
+    }
+
+    public String getStorageResourceId() {
+        return storageResourceId;
+    }
+
+    public void setStorageResourceId(String storageResourceId) {
+        this.storageResourceId = storageResourceId;
+    }
+
+    public String getUserId() {
+        return userId;
+    }
+
+    public void setUserId(String userId) {
+        this.userId = userId;
+    }
+
+    public String getGatewayId() {
+        return gatewayId;
+    }
+
+    public void setGatewayId(String gatewayId) {
+        this.gatewayId = gatewayId;
+    }
+
+    public String getResourceSpecificCredentialStoreToken() {
+        return resourceSpecificCredentialStoreToken;
+    }
+
+    public void setResourceSpecificCredentialStoreToken(String resourceSpecificCredentialStoreToken) {
+        this.resourceSpecificCredentialStoreToken = resourceSpecificCredentialStoreToken;
+    }
+
+    public String getFileSystemRootLocation() {
+        return fileSystemRootLocation;
+    }
+
+    public void setFileSystemRootLocation(String fileSystemRootLocation) {
+        this.fileSystemRootLocation = fileSystemRootLocation;
+    }
+
+    public String getLoginUserName() {
+        return loginUserName;
+    }
+
+    public void setLoginUserName(String loginUserName) {
+        this.loginUserName = loginUserName;
+    }
+
+    public UserResourceProfileEntity getUserResourceProfile() {
+        return userResourceProfile;
+    }
+
+    public void setUserResourceProfile(UserResourceProfileEntity userResourceProfile) {
+        this.userResourceProfile = userResourceProfile;
+    }
+
+}
diff --git a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/appcatalog/UserStoragePreferencePK.java b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/appcatalog/UserStoragePreferencePK.java
new file mode 100644
index 0000000000..fa11d85179
--- /dev/null
+++ b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/appcatalog/UserStoragePreferencePK.java
@@ -0,0 +1,90 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
+package org.apache.airavata.registry.core.entities.appcatalog;
+
+import javax.persistence.Column;
+import javax.persistence.Id;
+import java.io.Serializable;
+
+/**
+ * The primary key class for the user_storage_preference database table.
+ *
+ */
+public class UserStoragePreferencePK implements Serializable {
+    //default serial version id, required for serializable classes.
+    private static final long serialVersionUID = 1L;
+
+    private String storageResourceId;
+    private String userId;
+    private String gatewayId;
+
+    public UserStoragePreferencePK() {
+    }
+
+    public String getStorageResourceId() {
+        return storageResourceId;
+    }
+
+    public void setStorageResourceId(String storageResourceId) {
+        this.storageResourceId = storageResourceId;
+    }
+
+    public String getUserId() {
+        return userId;
+    }
+
+    public void setUserId(String userId) {
+        this.userId = userId;
+    }
+
+    public String getGatewayId() {
+        return gatewayId;
+    }
+
+    public void setGatewayId(String gatewayId) {
+        this.gatewayId = gatewayId;
+    }
+
+    public boolean equals(Object other) {
+        if (this == other) {
+            return true;
+        }
+        if (!(other instanceof UserStoragePreferencePK)) {
+            return false;
+        }
+        UserStoragePreferencePK castOther = (UserStoragePreferencePK)other;
+        return
+                this.storageResourceId.equals(castOther.storageResourceId)
+                    && this.userId.equals(castOther.userId)
+                        && this.gatewayId.equals(castOther.gatewayId);
+    }
+
+    public int hashCode() {
+        final int prime = 31;
+        int hash = 17;
+        hash = hash * prime + this.storageResourceId.hashCode();
+        hash = hash * prime + this.userId.hashCode();
+        hash = hash * prime + this.gatewayId.hashCode();
+
+        return hash;
+    }
+
+}
diff --git a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/repositories/appcatalog/UserComputeResourcePreferenceRepository.java b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/repositories/appcatalog/UserComputeResourcePreferenceRepository.java
new file mode 100644
index 0000000000..3b2d3098a4
--- /dev/null
+++ b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/repositories/appcatalog/UserComputeResourcePreferenceRepository.java
@@ -0,0 +1,35 @@
+/**
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.airavata.registry.core.repositories.appcatalog;
+
+import org.apache.airavata.model.appcatalog.userresourceprofile.UserComputeResourcePreference;
+import org.apache.airavata.registry.core.entities.appcatalog.UserComputeResourcePreferenceEntity;
+import org.apache.airavata.registry.core.entities.appcatalog.UserComputeResourcePreferencePK;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class UserComputeResourcePreferenceRepository extends AppCatAbstractRepository<UserComputeResourcePreference, UserComputeResourcePreferenceEntity, UserComputeResourcePreferencePK> {
+    private final static Logger logger = LoggerFactory.getLogger(UserComputeResourcePreferenceRepository.class);
+
+    public UserComputeResourcePreferenceRepository() {
+        super(UserComputeResourcePreference.class, UserComputeResourcePreferenceEntity.class);
+    }
+
+}
diff --git a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/repositories/appcatalog/UserResourceProfileRepository.java b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/repositories/appcatalog/UserResourceProfileRepository.java
new file mode 100644
index 0000000000..5cf0c1126a
--- /dev/null
+++ b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/repositories/appcatalog/UserResourceProfileRepository.java
@@ -0,0 +1,207 @@
+/**
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.airavata.registry.core.repositories.appcatalog;
+
+import org.apache.airavata.model.appcatalog.userresourceprofile.UserComputeResourcePreference;
+import org.apache.airavata.model.appcatalog.userresourceprofile.UserResourceProfile;
+import org.apache.airavata.model.appcatalog.userresourceprofile.UserStoragePreference;
+import org.apache.airavata.registry.core.entities.appcatalog.UserComputeResourcePreferencePK;
+import org.apache.airavata.registry.core.entities.appcatalog.UserResourceProfileEntity;
+import org.apache.airavata.registry.core.entities.appcatalog.UserResourceProfilePK;
+import org.apache.airavata.registry.core.entities.appcatalog.UserStoragePreferencePK;
+import org.apache.airavata.registry.core.utils.DBConstants;
+import org.apache.airavata.registry.core.utils.ObjectMapperSingleton;
+import org.apache.airavata.registry.core.utils.QueryConstants;
+import org.apache.airavata.registry.cpi.AppCatalogException;
+import org.apache.airavata.registry.cpi.CompositeIdentifier;
+import org.apache.airavata.registry.cpi.UsrResourceProfile;
+import org.dozer.Mapper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.sql.Timestamp;
+import java.util.*;
+
+public class UserResourceProfileRepository extends AppCatAbstractRepository<UserResourceProfile, UserResourceProfileEntity, UserResourceProfilePK> implements UsrResourceProfile {
+    private final static Logger logger = LoggerFactory.getLogger(UserResourceProfileRepository.class);
+
+    public UserResourceProfileRepository() {
+        super(UserResourceProfile.class, UserResourceProfileEntity.class);
+    }
+
+    protected String saveUserResourceProfileData(UserResourceProfile userResourceProfile) throws AppCatalogException {
+        UserResourceProfileEntity userResourceProfileEntity = saveUserResourceProfile(userResourceProfile);
+        return userResourceProfileEntity.getUserId();
+    }
+
+    protected UserResourceProfileEntity saveUserResourceProfile(UserResourceProfile userResourceProfile) throws AppCatalogException {
+        String userId = userResourceProfile.getUserId();
+        String gatewayId = userResourceProfile.getGatewayID();
+        Mapper mapper = ObjectMapperSingleton.getInstance();
+        UserResourceProfileEntity userResourceProfileEntity = mapper.map(userResourceProfile, UserResourceProfileEntity.class);
+
+        if (userResourceProfileEntity.getUserComputeResourcePreferences() != null) {
+            logger.debug("Populating the Primary Key UserComputeResourcePreferences objects for the User Resource Profile");
+            userResourceProfileEntity.getUserComputeResourcePreferences().forEach(userComputeResourcePreferenceEntity -> { userComputeResourcePreferenceEntity.setUserId(userId);
+                userComputeResourcePreferenceEntity.setGatewayId(gatewayId); });
+        }
+
+        if (userResourceProfileEntity.getUserStoragePreferences() != null) {
+            logger.debug("Populating the Primary Key UserStoragePreferences objects for the User Resource Profile");
+            userResourceProfileEntity.getUserStoragePreferences().forEach(userStoragePreferenceEntity -> { userStoragePreferenceEntity.setUserId(userId);
+                userStoragePreferenceEntity.setGatewayId(gatewayId); });
+        }
+
+        if (!isUserResourceProfileExists(userId, gatewayId)) {
+            logger.debug("Checking if the User Resource Profile already exists");
+            userResourceProfileEntity.setCreationTime(new Timestamp(System.currentTimeMillis()));
+        }
+
+        userResourceProfileEntity.setUpdateTime(new Timestamp(System.currentTimeMillis()));
+        return execute(entityManager -> entityManager.merge(userResourceProfileEntity));
+    }
+
+    @Override
+    public String addUserResourceProfile(UserResourceProfile userResourceProfile) throws AppCatalogException {
+        return saveUserResourceProfileData(userResourceProfile);
+    }
+
+    @Override
+    public void updateUserResourceProfile(String userId, String gatewayId, UserResourceProfile updatedProfile) throws AppCatalogException {
+        saveUserResourceProfileData(updatedProfile);
+    }
+
+    @Override
+    public UserResourceProfile getUserResourceProfile(String userId, String gatewayId) throws AppCatalogException {
+        UserResourceProfilePK userResourceProfilePK = new UserResourceProfilePK();
+        userResourceProfilePK.setUserId(userId);
+        userResourceProfilePK.setGatewayId(gatewayId);
+        UserResourceProfile userResourceProfile = get(userResourceProfilePK);
+        return userResourceProfile;
+    }
+
+    @Override
+    public UserComputeResourcePreference getUserComputeResourcePreference(String userId, String gatewayId, String hostId) throws AppCatalogException {
+        UserComputeResourcePreferenceRepository userComputeResourcePreferenceRepository = new UserComputeResourcePreferenceRepository();
+        UserComputeResourcePreferencePK userComputeResourcePreferencePK = new UserComputeResourcePreferencePK();
+        userComputeResourcePreferencePK.setUserId(userId);
+        userComputeResourcePreferencePK.setGatewayId(gatewayId);
+        userComputeResourcePreferencePK.setComputeResourceId(hostId);
+        UserComputeResourcePreference userComputeResourcePreference = userComputeResourcePreferenceRepository.get(userComputeResourcePreferencePK);
+        return userComputeResourcePreference;
+    }
+
+    @Override
+    public UserStoragePreference getUserStoragePreference(String userId, String gatewayId, String storageId) throws AppCatalogException {
+        UserStoragePreferenceRepository userStoragePreferenceRepository = new UserStoragePreferenceRepository();
+        UserStoragePreferencePK userStoragePreferencePK = new UserStoragePreferencePK();
+        userStoragePreferencePK.setUserId(userId);
+        userStoragePreferencePK.setGatewayId(gatewayId);
+        userStoragePreferencePK.setStorageResourceId(storageId);
+        UserStoragePreference userStoragePreference = userStoragePreferenceRepository.get(userStoragePreferencePK);
+        return userStoragePreference;
+    }
+
+    @Override
+    public List<UserResourceProfile> getAllUserResourceProfiles() throws AppCatalogException {
+        List<UserResourceProfile> userResourceProfileList = select(QueryConstants.GET_ALL_USER_RESOURCE_PROFILE, 0);
+        return userResourceProfileList;
+    }
+
+    @Override
+    public List<UserComputeResourcePreference> getAllUserComputeResourcePreferences(String userId, String gatewayId) throws AppCatalogException {
+        UserComputeResourcePreferenceRepository userComputeResourcePreferenceRepository = new UserComputeResourcePreferenceRepository();
+        Map<String, Object> queryParameters = new HashMap<>();
+        queryParameters.put(DBConstants.UserComputeResourcePreference.USER_ID, userId);
+        queryParameters.put(DBConstants.UserComputeResourcePreference.GATEWAY_ID, gatewayId);
+        List<UserComputeResourcePreference> userComputeResourcePreferenceList =
+                userComputeResourcePreferenceRepository.select(QueryConstants.GET_ALL_USER_COMPUTE_RESOURCE_PREFERENCE, -1, 0, queryParameters);
+        return userComputeResourcePreferenceList;
+    }
+
+    @Override
+    public List<UserStoragePreference> getAllUserStoragePreferences(String userId, String gatewayId) throws AppCatalogException {
+        UserStoragePreferenceRepository userStoragePreferenceRepository = new UserStoragePreferenceRepository();
+        Map<String, Object> queryParameters = new HashMap<>();
+        queryParameters.put(DBConstants.UserStoragePreference.USER_ID, userId);
+        queryParameters.put(DBConstants.UserStoragePreference.GATEWAY_ID, gatewayId);
+        List<UserStoragePreference> userStoragePreferenceList =
+                userStoragePreferenceRepository.select(QueryConstants.GET_ALL_USER_STORAGE_PREFERENCE, -1, 0, queryParameters);
+        return userStoragePreferenceList;
+    }
+
+    @Override
+    public List<String> getGatewayProfileIds(String gatewayName) throws AppCatalogException {
+        Map<String, Object> queryParameters = new HashMap<>();
+        queryParameters.put(DBConstants.UserResourceProfile.GATEWAY_ID, gatewayName);
+        List<UserResourceProfile> userResourceProfileList = select(QueryConstants.GET_ALL_GATEWAY_ID, -1, 0, queryParameters);
+        List<String> gatewayIdList = new ArrayList<>();
+        for (UserResourceProfile userResourceProfile : userResourceProfileList) {
+            gatewayIdList.add(userResourceProfile.getGatewayID());
+        }
+        return gatewayIdList;
+    }
+
+    @Override
+    public String getUserNamefromID(String userId, String gatewayID) throws AppCatalogException {
+        return userId;
+    }
+
+    @Override
+    public boolean removeUserResourceProfile(String userId, String gatewayId) throws AppCatalogException {
+        UserResourceProfilePK userResourceProfilePK = new UserResourceProfilePK();
+        userResourceProfilePK.setUserId(userId);
+        userResourceProfilePK.setGatewayId(gatewayId);
+        return delete(userResourceProfilePK);
+    }
+
+    @Override
+    public boolean removeUserComputeResourcePreferenceFromGateway(String userId, String gatewayId, String preferenceId) throws AppCatalogException {
+        UserComputeResourcePreferenceRepository userComputeResourcePreferenceRepository = new UserComputeResourcePreferenceRepository();
+        UserComputeResourcePreferencePK userComputeResourcePreferencePK = new UserComputeResourcePreferencePK();
+        userComputeResourcePreferencePK.setUserId(userId);
+        userComputeResourcePreferencePK.setGatewayId(gatewayId);
+        userComputeResourcePreferencePK.setComputeResourceId(preferenceId);
+        return userComputeResourcePreferenceRepository.delete(userComputeResourcePreferencePK);
+    }
+
+    @Override
+    public boolean removeUserDataStoragePreferenceFromGateway(String userId, String gatewayId, String preferenceId) throws AppCatalogException {
+        UserStoragePreferenceRepository userStoragePreferenceRepository = new UserStoragePreferenceRepository();
+        UserStoragePreferencePK userStoragePreferencePK = new UserStoragePreferencePK();
+        userStoragePreferencePK.setUserId(userId);
+        userStoragePreferencePK.setGatewayId(gatewayId);
+        userStoragePreferencePK.setStorageResourceId(preferenceId);
+        return userStoragePreferenceRepository.delete(userStoragePreferencePK);
+    }
+
+    @Override
+    public boolean isUserResourceProfileExists(String userId, String gatewayId) throws AppCatalogException {
+        UserResourceProfilePK userResourceProfilePK = new UserResourceProfilePK();
+        userResourceProfilePK.setUserId(userId);
+        userResourceProfilePK.setGatewayId(gatewayId);
+        return isExists(userResourceProfilePK);
+    }
+
+    public static Logger getLogger() {
+        return logger;
+    }
+
+}
diff --git a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/repositories/appcatalog/UserStoragePreferenceRepository.java b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/repositories/appcatalog/UserStoragePreferenceRepository.java
new file mode 100644
index 0000000000..3c21ca90e3
--- /dev/null
+++ b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/repositories/appcatalog/UserStoragePreferenceRepository.java
@@ -0,0 +1,35 @@
+/**
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.airavata.registry.core.repositories.appcatalog;
+
+import org.apache.airavata.model.appcatalog.userresourceprofile.UserStoragePreference;
+import org.apache.airavata.registry.core.entities.appcatalog.UserStoragePreferenceEntity;
+import org.apache.airavata.registry.core.entities.appcatalog.UserStoragePreferencePK;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class UserStoragePreferenceRepository extends AppCatAbstractRepository<UserStoragePreference, UserStoragePreferenceEntity, UserStoragePreferencePK> {
+    private final static Logger logger = LoggerFactory.getLogger(UserStoragePreferenceRepository.class);
+
+    public UserStoragePreferenceRepository() {
+        super(UserStoragePreference.class, UserStoragePreferenceEntity.class);
+    }
+
+}
diff --git a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/utils/DBConstants.java b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/utils/DBConstants.java
index b79e8db62c..531153d422 100644
--- a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/utils/DBConstants.java
+++ b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/utils/DBConstants.java
@@ -26,4 +26,21 @@
         public static final String GROUP_RESOURCE_PROFILE_ID = "groupResourceProfileId";
     }
 
+    public static class UserResourceProfile {
+        public static final String USER_ID = "userId";
+        public static final String GATEWAY_ID = "gatewayId";
+    }
+
+    public static class UserComputeResourcePreference {
+        public static final String USER_ID = "userId";
+        public static final String GATEWAY_ID = "gatewayId";
+        public static final String COMPUTE_RESOURCE_ID = "computeResourceId";
+    }
+
+    public static class UserStoragePreference {
+        public static final String USER_ID = "userId";
+        public static final String GATEWAY_ID = "gatewayId";
+        public static final String STORAGE_RESOURCE_ID = "storageResourceId";
+    }
+
 }
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
index 73ab4d6932..57e7f231cd 100644
--- 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
@@ -37,4 +37,17 @@
             "WHERE BQ.groupResourceProfileId LIKE : " + DBConstants.GroupResourceProfile.GROUP_RESOURCE_PROFILE_ID;
     String FIND_ALL_GROUP_COMPUTE_RESOURCE_POLICY = "SELECT CR FROM "+ ComputeResourcePolicyEntity.class.getSimpleName() + " CR " +
             "WHERE CR.groupResourceProfileId LIKE : " + DBConstants.GroupResourceProfile.GROUP_RESOURCE_PROFILE_ID;
+
+    String GET_ALL_USER_RESOURCE_PROFILE = "SELECT URP FROM " + UserResourceProfileEntity.class.getSimpleName() + " URP";
+    String GET_ALL_GATEWAY_ID = "SELECT DISTINCT URP FROM " + UserResourceProfileEntity.class.getSimpleName() + " URP " +
+            "WHERE URP.gatewayId LIKE :" + DBConstants.UserResourceProfile.GATEWAY_ID;
+
+    String GET_ALL_USER_COMPUTE_RESOURCE_PREFERENCE = "SELECT UCRP FROM " + UserComputeResourcePreferenceEntity.class.getSimpleName() + " UCRP " +
+            "WHERE UCRP.userId LIKE :" + DBConstants.UserComputeResourcePreference.USER_ID + " AND UCRP.gatewayId LIKE :" +
+            DBConstants.UserComputeResourcePreference.GATEWAY_ID;
+
+    String GET_ALL_USER_STORAGE_PREFERENCE = "SELECT USP FROM " + UserStoragePreferenceEntity.class.getSimpleName() + " USP " +
+            "WHERE USP.userId LIKE :" + DBConstants.UserStoragePreference.USER_ID + " AND USP.gatewayId LIKE :" +
+            DBConstants.UserStoragePreference.GATEWAY_ID;
+
 }
diff --git a/modules/registry-refactoring/src/main/resources/META-INF/persistence.xml b/modules/registry-refactoring/src/main/resources/META-INF/persistence.xml
index a7edb6d3d0..8418eb975e 100644
--- a/modules/registry-refactoring/src/main/resources/META-INF/persistence.xml
+++ b/modules/registry-refactoring/src/main/resources/META-INF/persistence.xml
@@ -122,6 +122,9 @@
         <class>org.apache.airavata.registry.core.entities.appcatalog.StorageInterfacePK</class>
         <class>org.apache.airavata.registry.core.entities.appcatalog.JobManagerCommandPK</class>
         <class>org.apache.airavata.registry.core.entities.appcatalog.ParallelismCommandPK</class>
+        <class>org.apache.airavata.registry.core.entities.appcatalog.UserResourceProfileEntity</class>
+        <class>org.apache.airavata.registry.core.entities.appcatalog.UserComputeResourcePreferenceEntity</class>
+        <class>org.apache.airavata.registry.core.entities.appcatalog.UserStoragePreferenceEntity</class>
         <exclude-unlisted-classes>true</exclude-unlisted-classes>
     </persistence-unit>
 </persistence>
diff --git a/modules/registry-refactoring/src/test/java/org/apache/airavata/registry/core/repositories/appcatalog/UserResourceProfileRepositoryTest.java b/modules/registry-refactoring/src/test/java/org/apache/airavata/registry/core/repositories/appcatalog/UserResourceProfileRepositoryTest.java
new file mode 100644
index 0000000000..47fbfea57f
--- /dev/null
+++ b/modules/registry-refactoring/src/test/java/org/apache/airavata/registry/core/repositories/appcatalog/UserResourceProfileRepositoryTest.java
@@ -0,0 +1,97 @@
+package org.apache.airavata.registry.core.repositories.appcatalog;
+
+import org.apache.airavata.model.appcatalog.userresourceprofile.UserComputeResourcePreference;
+import org.apache.airavata.model.appcatalog.userresourceprofile.UserResourceProfile;
+import org.apache.airavata.model.appcatalog.userresourceprofile.UserStoragePreference;
+import org.apache.airavata.registry.core.repositories.util.Initialize;
+import org.apache.airavata.registry.cpi.AppCatalogException;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.util.*;
+
+public class UserResourceProfileRepositoryTest {
+
+    private static Initialize initialize;
+    private UserResourceProfileRepository userResourceProfileRepository;
+    private String userId = "testUser";
+    private String gatewayId = "testGateway";
+    private static final Logger logger = LoggerFactory.getLogger(UserResourceProfileRepositoryTest.class);
+
+    @Before
+    public void setUp() {
+        try {
+            initialize = new Initialize("appcatalog-derby.sql");
+            initialize.initializeDB();
+            userResourceProfileRepository = new UserResourceProfileRepository();
+        } catch (Exception e) {
+            logger.error(e.getMessage(), e);
+        }
+    }
+
+    @After
+    public void tearDown() throws Exception {
+        System.out.println("********** TEAR DOWN ************");
+        initialize.stopDerbyServer();
+    }
+
+    @Test
+    public void UserResourceProfileRepositoryTest() throws AppCatalogException {
+        UserComputeResourcePreference userComputeResourcePreference = new UserComputeResourcePreference();
+        userComputeResourcePreference.setComputeResourceId("computeResource1");
+        userComputeResourcePreference.setLoginUserName(userId);
+        userComputeResourcePreference.setPreferredBatchQueue("queue1");
+        userComputeResourcePreference.setScratchLocation("location1");
+
+        UserStoragePreference userStoragePreference = new UserStoragePreference();
+        userStoragePreference.setStorageResourceId("storageResource1");
+        userStoragePreference.setLoginUserName(userId);
+        userStoragePreference.setFileSystemRootLocation("location2");
+        userStoragePreference.setResourceSpecificCredentialStoreToken("token1");
+
+        UserResourceProfile userResourceProfile = new UserResourceProfile();
+        userResourceProfile.setUserId(userId);
+        userResourceProfile.setGatewayID(gatewayId);
+        userResourceProfile.setCredentialStoreToken("token");
+        userResourceProfile.setUserComputeResourcePreferences(Arrays.asList(userComputeResourcePreference));
+        userResourceProfile.setUserStoragePreferences(Arrays.asList(userStoragePreference));
+        userResourceProfile.setIdentityServerTenant("tenant1");
+        userResourceProfile.setIdentityServerPwdCredToken("password");
+        if (!userResourceProfileRepository.isUserResourceProfileExists(userId, gatewayId))
+            userResourceProfileRepository.addUserResourceProfile(userResourceProfile);
+        assertEquals(userId, userResourceProfile.getUserId());
+
+        userResourceProfile.setIdentityServerTenant("tenant2");
+        userResourceProfileRepository.updateUserResourceProfile(userId, gatewayId, userResourceProfile);
+
+        UserResourceProfile retrievedUserResourceProfile = userResourceProfileRepository.getUserResourceProfile(userId, gatewayId);
+        assertTrue(retrievedUserResourceProfile.getUserStoragePreferences().size() == 1);
+        assertEquals(userResourceProfile.getIdentityServerTenant(), retrievedUserResourceProfile.getIdentityServerTenant());
+
+        UserComputeResourcePreference retrievedUserComputeResourcePreference = userResourceProfileRepository.getUserComputeResourcePreference(
+                userId, gatewayId, userComputeResourcePreference.getComputeResourceId());
+        assertEquals(userComputeResourcePreference.getLoginUserName(), retrievedUserComputeResourcePreference.getLoginUserName());
+
+        UserStoragePreference retrievedUserStoragePreference = userResourceProfileRepository.getUserStoragePreference(
+                userId, gatewayId, userStoragePreference.getStorageResourceId());
+        assertEquals(userStoragePreference.getFileSystemRootLocation(), retrievedUserStoragePreference.getFileSystemRootLocation());
+
+        assertTrue(userResourceProfileRepository.getAllUserResourceProfiles().size() == 1);
+        assertTrue(userResourceProfileRepository.getAllUserComputeResourcePreferences(userId, gatewayId).size() == 1);
+        assertTrue(userResourceProfileRepository.getAllUserStoragePreferences(userId, gatewayId).size() == 1);
+        assertTrue(userResourceProfileRepository.getGatewayProfileIds(gatewayId).size() == 1);
+        assertEquals(userId, userResourceProfileRepository.getUserNamefromID(userId, gatewayId));
+
+        userResourceProfileRepository.removeUserComputeResourcePreferenceFromGateway(userId, gatewayId, userComputeResourcePreference.getComputeResourceId());
+        userResourceProfileRepository.removeUserDataStoragePreferenceFromGateway(userId, gatewayId, userStoragePreference.getStorageResourceId());
+        userResourceProfileRepository.removeUserResourceProfile(userId, gatewayId);
+
+    }
+
+}
diff --git a/modules/registry/registry-cpi/src/main/java/org/apache/airavata/registry/cpi/UsrResourceProfile.java b/modules/registry/registry-cpi/src/main/java/org/apache/airavata/registry/cpi/UsrResourceProfile.java
index b3ef0318f9..df0fa54221 100644
--- a/modules/registry/registry-cpi/src/main/java/org/apache/airavata/registry/cpi/UsrResourceProfile.java
+++ b/modules/registry/registry-cpi/src/main/java/org/apache/airavata/registry/cpi/UsrResourceProfile.java
@@ -26,14 +26,14 @@
 
 public interface UsrResourceProfile {
     /**
-     * This method will add a gateway profile
+     * This method will add user resource profile
      * @param userResourceProfile object of User resource profile
      * @return gateway id
      */
     String addUserResourceProfile(UserResourceProfile userResourceProfile) throws AppCatalogException;
 
     /**
-     * This method will update a gateway profile
+     * This method will update user resource profile
      * @param userId unique User id
      * @param gatewayId unique gateway id
      * @param updatedProfile updated profile
@@ -43,22 +43,38 @@
     /**
      * @param userId
      * @param gatewayId
-     * @return
+     * @return UserResourceProfile
      */
     UserResourceProfile getUserResourceProfile(String userId, String gatewayId) throws AppCatalogException;
 
     /**
-     * This method will remove a gateway profile
+     * This method will remove a user resource profile
      * @param userId
      * @param gatewayId unique gateway id
      * @return true or false
      */
     boolean removeUserResourceProfile(String userId, String gatewayId) throws AppCatalogException;
+
+    /**
+     * This method will remove a user compute resource preference
+     * @param userId
+     * @param gatewayId unique gateway id
+     * @param preferenceId
+     * @return true or false
+     */
     boolean removeUserComputeResourcePreferenceFromGateway(String userId, String gatewayId, String preferenceId) throws AppCatalogException;
+
+    /**
+     * This method will remove a user storage preference
+     * @param userId
+     * @param gatewayId unique gateway id
+     * @param preferenceId
+     * @return true or false
+     */
     boolean removeUserDataStoragePreferenceFromGateway(String userId, String gatewayId, String preferenceId) throws AppCatalogException;
 
     /**
-     * This method will check whether gateway profile exists
+     * This method will check whether user resource profile exists
      * @param userId
      * @param gatewayId unique gateway id
      * @return true or false
@@ -70,21 +86,46 @@
      * @param userId
      * @param gatewayId
      * @param hostId
-     * @return ComputeResourcePreference
+     * @return UserComputeResourcePreference
      */
     UserComputeResourcePreference getUserComputeResourcePreference(String userId, String gatewayId, String hostId) throws AppCatalogException;
-    UserStoragePreference getUserStoragePreference(String userId, String gatewayId, String storageId) throws AppCatalogException;
 
+    /**
+     * @param userId
+     * @param gatewayId
+     * @return UserStoragePreference
+     */
+    UserStoragePreference getUserStoragePreference(String userId, String gatewayId, String storageId) throws AppCatalogException;
 
+    /**
+     * @param gatewayName
+     * @return List of gateway ids
+     */
     List<String> getGatewayProfileIds(String gatewayName) throws AppCatalogException;
 
-    /* Implementing this method is critical to validate User Resource Profile
-     *
+    /**
+     * @param userId
+     * @param gatewayID
+     * @return username
      */
     String getUserNamefromID(String userId, String gatewayID) throws AppCatalogException;
 
+    /**
+     * @param userId
+     * @param gatewayId
+     * @return List of UserComputeResourcePreference for given user and gateway
+     */
     List<UserComputeResourcePreference> getAllUserComputeResourcePreferences (String userId, String gatewayId) throws AppCatalogException;
+
+    /**
+     * @param userId
+     * @param gatewayId
+     * @return List of UserStoragePreference for given user and gateway
+     */
     List<UserStoragePreference> getAllUserStoragePreferences(String userId, String gatewayId) throws AppCatalogException;
 
+    /**
+     * @return List of user resource profiles
+     */
     List<UserResourceProfile> getAllUserResourceProfiles() throws AppCatalogException;
 }
diff --git a/modules/registry/registry-server/registry-api-service/src/main/java/org/apache/airavata/registry/api/service/handler/RegistryServerHandler.java b/modules/registry/registry-server/registry-api-service/src/main/java/org/apache/airavata/registry/api/service/handler/RegistryServerHandler.java
index b7d9a47ba5..d8e7fb978d 100644
--- a/modules/registry/registry-server/registry-api-service/src/main/java/org/apache/airavata/registry/api/service/handler/RegistryServerHandler.java
+++ b/modules/registry/registry-server/registry-api-service/src/main/java/org/apache/airavata/registry/api/service/handler/RegistryServerHandler.java
@@ -68,6 +68,7 @@
 import org.apache.airavata.registry.core.repositories.appcatalog.ComputeResourceRepository;
 import org.apache.airavata.registry.core.repositories.appcatalog.GroupResourceProfileRepository;
 import org.apache.airavata.registry.core.repositories.appcatalog.GwyResourceProfileRepository;
+import org.apache.airavata.registry.core.repositories.appcatalog.UserResourceProfileRepository;
 import org.apache.airavata.registry.cpi.*;
 import org.apache.airavata.registry.cpi.utils.Constants;
 import org.apache.thrift.TException;
@@ -83,6 +84,7 @@
     private AppCatalog appCatalog;
     private ReplicaCatalog dataCatalog;
     private WorkflowCatalog workflowCatalog;
+    private UserResourceProfileRepository userResourceProfileRepository = new UserResourceProfileRepository();
 
     /**
      * Fetch Apache Registry API version
@@ -4352,9 +4354,7 @@ public String registerUserResourceProfile(UserResourceProfile userResourceProfil
                 logger.error("User does not exist.Please provide a valid user ID...");
                 throw new RegistryServiceException("User does not exist.Please provide a valid user ID...");
             }
-            appCatalog = RegistryFactory.getAppCatalog();
-            UsrResourceProfile userProfile = appCatalog.getUserResourceProfile();
-            String resourceProfile = userProfile.addUserResourceProfile(userResourceProfile);
+            String resourceProfile = userResourceProfileRepository.addUserResourceProfile(userResourceProfile);
             logger.debug("Airavata registered user resource profile with gateway id : " + userResourceProfile.getGatewayID() + "and user id : " + userResourceProfile.getUserId());
             return resourceProfile;
         } catch (AppCatalogException e) {
@@ -4384,9 +4384,7 @@ public UserResourceProfile getUserResourceProfile(String userId, String gatewayI
                 logger.error("user does not exist.Please provide a valid gateway id...");
                 throw new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
             }
-            appCatalog = RegistryFactory.getAppCatalog();
-            UsrResourceProfile usrResourceProfile = appCatalog.getUserResourceProfile();
-            UserResourceProfile userResourceProfile = usrResourceProfile.getUserResourceProfile(userId,gatewayId);
+            UserResourceProfile userResourceProfile = userResourceProfileRepository.getUserResourceProfile(userId, gatewayId);
             logger.debug("Airavata retrieved User resource profile with user id : " + userId);
             return userResourceProfile;
         } catch (AppCatalogException e) {
@@ -4418,9 +4416,7 @@ public boolean updateUserResourceProfile(String userId, String gatewayID, UserRe
                 logger.error("User does not exist.Please provide a valid user id...");
                 throw new RegistryServiceException("user does not exist.Please provide a valid user id...");
             }
-            appCatalog = RegistryFactory.getAppCatalog();
-            UsrResourceProfile userProfile = appCatalog.getUserResourceProfile();
-            userProfile.updateUserResourceProfile(userId, gatewayID, userResourceProfile);
+            userResourceProfileRepository.updateUserResourceProfile(userId, gatewayID, userResourceProfile);
             logger.debug("Airavata updated gateway profile with gateway id : " + userId);
             return true;
         } catch (AppCatalogException e) {
@@ -4450,9 +4446,7 @@ public boolean deleteUserResourceProfile(String userId, String gatewayID) throws
                 logger.error("user does not exist.Please provide a valid user id...");
                 throw new RegistryServiceException("user does not exist.Please provide a valid user id...");
             }
-            appCatalog = RegistryFactory.getAppCatalog();
-            UsrResourceProfile userResourceProfile = appCatalog.getUserResourceProfile();
-            userResourceProfile.removeUserResourceProfile(userId, gatewayID);
+            userResourceProfileRepository.removeUserResourceProfile(userId, gatewayID);
             logger.debug("Airavata deleted User profile with gateway id : " + gatewayID + " and user id : " + userId);
             return true;
         } catch (AppCatalogException e) {
@@ -4504,15 +4498,13 @@ public boolean addUserComputeResourcePreference(String userId, String gatewayID,
                 logger.error("user does not exist.Please provide a valid user id...");
                 throw new RegistryServiceException("user does not exist.Please provide a valid user id...");
             }
-            appCatalog = RegistryFactory.getAppCatalog();
-            UsrResourceProfile userProfile = appCatalog.getUserResourceProfile();
-            if (!userProfile.isUserResourceProfileExists(userId, gatewayID)){
+            if (! userResourceProfileRepository.isUserResourceProfileExists(userId, gatewayID)) {
                 throw new RegistryServiceException("User resource profile with user id'"+userId+" &  gateway Id"+gatewayID+"' does not exist!!!");
             }
-            UserResourceProfile profile = userProfile.getUserResourceProfile(userId,gatewayID);
+            UserResourceProfile profile = userResourceProfileRepository.getUserResourceProfile(userId, gatewayID);
 //            gatewayProfile.removeGatewayResourceProfile(gatewayID);
             profile.addToUserComputeResourcePreferences(userComputeResourcePreference);
-            userProfile.updateUserResourceProfile(userId, gatewayID, profile);
+            userResourceProfileRepository.updateUserResourceProfile(userId, gatewayID, profile);
             logger.debug("Airavata added User compute resource preference with gateway id : " + gatewayID + " and for compute resource id : " + computeResourceId );
             return true;
         } catch (AppCatalogException e) {
@@ -4545,16 +4537,14 @@ public boolean addUserStoragePreference(String userId, String gatewayID, String
                 logger.error("user does not exist.Please provide a valid user id...");
                 throw new RegistryServiceException("user does not exist.Please provide a valid user id...");
             }
-            appCatalog = RegistryFactory.getAppCatalog();
-            UsrResourceProfile userProfile = appCatalog.getUserResourceProfile();
-            if (!userProfile.isUserResourceProfileExists(userId, gatewayID)){
+            if (! userResourceProfileRepository.isUserResourceProfileExists(userId, gatewayID)){
                 throw new RegistryServiceException("User resource profile with user id'"+userId+" &  gateway Id"+gatewayID+"' does not exist!!!");
             }
-            UserResourceProfile profile = userProfile.getUserResourceProfile(userId,gatewayID);
+            UserResourceProfile profile = userResourceProfileRepository.getUserResourceProfile(userId,gatewayID);
 //            gatewayProfile.removeGatewayResourceProfile(gatewayID);
             dataStoragePreference.setStorageResourceId(storageResourceId);
             profile.addToUserStoragePreferences(dataStoragePreference);
-            userProfile.updateUserResourceProfile(userId, gatewayID, profile);
+            userResourceProfileRepository.updateUserResourceProfile(userId, gatewayID, profile);
             logger.debug("Airavata added storage resource preference with gateway id : " + gatewayID + " and for storage resource id : " + storageResourceId );
             return true;
         } catch (AppCatalogException e) {
@@ -4585,10 +4575,7 @@ public UserComputeResourcePreference getUserComputeResourcePreference(String use
                 logger.error("user does not exist.Please provide a valid user id...");
                 throw new RegistryServiceException("user does not exist.Please provide a valid user id...");
             }
-            appCatalog = RegistryFactory.getAppCatalog();
-            appCatalog = RegistryFactory.getAppCatalog();
-            UsrResourceProfile userProfile = appCatalog.getUserResourceProfile();
-            if (!userProfile.isUserResourceProfileExists(userId, gatewayID)){
+            if (!userResourceProfileRepository.isUserResourceProfileExists(userId, gatewayID)){
                 throw new RegistryServiceException("User resource profile with user id'"+userId+" &  gateway Id"+gatewayID+"' does not exist!!!");
             }
             ComputeResourceRepository computeResourceRepository = new ComputeResourceRepository();
@@ -4598,7 +4585,7 @@ public UserComputeResourcePreference getUserComputeResourcePreference(String use
                 exception.setMessage("Given compute resource does not exist in the system. Please provide a valid compute resource id...");
                 throw exception;
             }
-            UserComputeResourcePreference userComputeResourcePreference = userProfile.getUserComputeResourcePreference(userId, gatewayID, userComputeResourceId);
+            UserComputeResourcePreference userComputeResourcePreference = userResourceProfileRepository.getUserComputeResourcePreference(userId, gatewayID, userComputeResourceId);
             logger.debug("Airavata retrieved user compute resource preference with gateway id : " + gatewayID + " and for compute resoruce id : " + userComputeResourceId );
             return userComputeResourcePreference;
         } catch (AppCatalogException e) {
@@ -4629,13 +4616,11 @@ public UserStoragePreference getUserStoragePreference(String userId, String gate
                 logger.error("user does not exist.Please provide a valid user id...");
                 throw new RegistryServiceException("user does not exist.Please provide a valid user id...");
             }
-            appCatalog = RegistryFactory.getAppCatalog();
-            UsrResourceProfile userProfile = appCatalog.getUserResourceProfile();
-            if (!userProfile.isUserResourceProfileExists(userId, gatewayID)){
+            if (! userResourceProfileRepository.isUserResourceProfileExists(userId, gatewayID)){
                 throw new RegistryServiceException("User resource profile with user id'"+userId+" &  gateway Id"+gatewayID+"' does not exist!!!");
             }
 
-            UserStoragePreference storagePreference = userProfile.getUserStoragePreference(userId, gatewayID, storageId);
+            UserStoragePreference storagePreference = userResourceProfileRepository.getUserStoragePreference(userId, gatewayID, storageId);
             logger.debug("Airavata retrieved user storage resource preference with gateway id : " + gatewayID + " and for storage resource id : " + storageId);
             return storagePreference;
         } catch (AppCatalogException e) {
@@ -4660,9 +4645,7 @@ public UserStoragePreference getUserStoragePreference(String userId, String gate
     @Override
     public List<UserResourceProfile> getAllUserResourceProfiles() throws RegistryServiceException, TException {
         try {
-            appCatalog = RegistryFactory.getAppCatalog();
-            UsrResourceProfile userProfile = appCatalog.getUserResourceProfile();
-            return userProfile.getAllUserResourceProfiles();
+            return userResourceProfileRepository.getAllUserResourceProfiles();
         } catch (AppCatalogException e) {
             RegistryServiceException exception = new RegistryServiceException();
             exception.setMessage("Error while reading retrieving all gateway profiles. More info : " + e.getMessage());
@@ -4686,9 +4669,7 @@ public boolean updateUserComputeResourcePreference(String userId, String gateway
                 logger.error("user does not exist.Please provide a valid user id...");
                 throw new RegistryServiceException("user does not exist.Please provide a valid user id...");
             }
-            appCatalog = RegistryFactory.getAppCatalog();
-            UsrResourceProfile userProfile = appCatalog.getUserResourceProfile();
-            UserResourceProfile profile = userProfile.getUserResourceProfile(userId,gatewayID);
+            UserResourceProfile profile = userResourceProfileRepository.getUserResourceProfile(userId,gatewayID);
             List<UserComputeResourcePreference> userComputeResourcePreferences = profile.getUserComputeResourcePreferences();
             UserComputeResourcePreference preferenceToRemove = null;
             for (UserComputeResourcePreference preference : userComputeResourcePreferences) {
@@ -4702,7 +4683,7 @@ public boolean updateUserComputeResourcePreference(String userId, String gateway
                         preferenceToRemove);
             }
             profile.getUserComputeResourcePreferences().add(userComputeResourcePreference);
-            userProfile.updateUserResourceProfile(userId, gatewayID, profile);
+            userResourceProfileRepository.updateUserResourceProfile(userId, gatewayID, profile);
             logger.debug("Airavata updated compute resource preference with gateway id : " + gatewayID + " and for compute resource id : " + computeResourceId );
             return true;
         } catch (AppCatalogException e) {
@@ -4734,9 +4715,7 @@ public boolean updateUserStoragePreference(String userId, String gatewayID, Stri
                 logger.error("user does not exist.Please provide a valid user id...");
                 throw new RegistryServiceException("user does not exist.Please provide a valid user id...");
             }
-            appCatalog = RegistryFactory.getAppCatalog();
-            UsrResourceProfile userProfile = appCatalog.getUserResourceProfile();
-            UserResourceProfile profile = userProfile.getUserResourceProfile(userId,gatewayID);
+            UserResourceProfile profile = userResourceProfileRepository.getUserResourceProfile(userId,gatewayID);
             List<UserStoragePreference> dataStoragePreferences = profile.getUserStoragePreferences();
             UserStoragePreference preferenceToRemove = null;
             for (UserStoragePreference preference : dataStoragePreferences) {
@@ -4750,7 +4729,7 @@ public boolean updateUserStoragePreference(String userId, String gatewayID, Stri
                         preferenceToRemove);
             }
             profile.getUserStoragePreferences().add(userStoragePreference);
-            userProfile.updateUserResourceProfile(userId, gatewayID, profile);
+            userResourceProfileRepository.updateUserResourceProfile(userId, gatewayID, profile);
             logger.debug("Airavata updated user storage resource preference with gateway id : " + gatewayID + " and for storage resource id : " + storageId );
             return true;
         } catch (AppCatalogException e) {
@@ -4781,9 +4760,7 @@ public boolean deleteUserComputeResourcePreference(String userId, String gateway
                 logger.error("user does not exist.Please provide a valid user id...");
                 throw new RegistryServiceException("user does not exist.Please provide a valid user id...");
             }
-            appCatalog = RegistryFactory.getAppCatalog();
-            UsrResourceProfile userProfile = appCatalog.getUserResourceProfile();
-            return userProfile.removeUserComputeResourcePreferenceFromGateway(userId, gatewayID, computeResourceId);
+            return userResourceProfileRepository.removeUserComputeResourcePreferenceFromGateway(userId, gatewayID, computeResourceId);
         } catch (AppCatalogException e) {
             logger.error(userId, "Error while reading user compute resource preference...", e);
             RegistryServiceException exception = new RegistryServiceException();
@@ -4812,9 +4789,7 @@ public boolean deleteUserStoragePreference(String userId, String gatewayID, Stri
                 logger.error("user does not exist.Please provide a valid user id...");
                 throw new RegistryServiceException("user does not exist.Please provide a valid user id...");
             }
-            appCatalog = RegistryFactory.getAppCatalog();
-            UsrResourceProfile userProfile = appCatalog.getUserResourceProfile();
-            return userProfile.removeUserDataStoragePreferenceFromGateway(userId, gatewayID, storageId);
+            return userResourceProfileRepository.removeUserDataStoragePreferenceFromGateway(userId, gatewayID, storageId);
         } catch (AppCatalogException e) {
             logger.error(gatewayID, "Error while reading user data storage preference...", e);
             RegistryServiceException exception = new RegistryServiceException();
@@ -4878,9 +4853,7 @@ public void registerQueueStatuses(List<QueueStatusModel> queueStatuses) throws R
                 logger.error("User Resource Profile does not exist.Please provide a valid gateway id...");
                 throw new RegistryServiceException("User Resource Profile does not exist.Please provide a valid gateway id...");
             }
-            appCatalog = RegistryFactory.getAppCatalog();
-            UsrResourceProfile userProfile = appCatalog.getUserResourceProfile();
-            return userProfile.getUserResourceProfile(userId, gatewayID).getUserComputeResourcePreferences();
+            return userResourceProfileRepository.getUserResourceProfile(userId, gatewayID).getUserComputeResourcePreferences();
         } catch (AppCatalogException e) {
             logger.error(userId, "Error while reading User Resource Profile compute resource preferences...", e);
             RegistryServiceException exception = new RegistryServiceException();
@@ -4904,9 +4877,7 @@ public void registerQueueStatuses(List<QueueStatusModel> queueStatuses) throws R
                 logger.error("User does not exist.Please provide a valid gateway id...");
                 throw new RegistryServiceException("Gateway does not exist.Please provide a valid gateway id...");
             }
-            appCatalog = RegistryFactory.getAppCatalog();
-            UsrResourceProfile userProfile = appCatalog.getUserResourceProfile();
-            return userProfile.getUserResourceProfile(userId, gatewayID).getUserStoragePreferences();
+            return userResourceProfileRepository.getUserResourceProfile(userId, gatewayID).getUserStoragePreferences();
         } catch (AppCatalogException e) {
             logger.error(userId, "Error while reading user resource Profile data storage preferences...", e);
             RegistryServiceException exception = new RegistryServiceException();


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


> Refactoring App Catalog Implementation - User Resource Profile
> --------------------------------------------------------------
>
>                 Key: AIRAVATA-2712
>                 URL: https://issues.apache.org/jira/browse/AIRAVATA-2712
>             Project: Airavata
>          Issue Type: Improvement
>          Components: Registry API
>            Reporter: Sneha Tilak
>            Assignee: Sneha Tilak
>            Priority: Major
>




--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Mime
View raw message