You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by sc...@apache.org on 2016/01/12 23:04:14 UTC
[03/50] [abbrv] airavata git commit: merging with remote master
merging with remote master
Project: http://git-wip-us.apache.org/repos/asf/airavata/repo
Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/6751a37b
Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/6751a37b
Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/6751a37b
Branch: refs/heads/data-manager
Commit: 6751a37b569afaebad45f280594e8df2d3decb08
Parents: d2d72e5
Author: scnakandala <su...@gmail.com>
Authored: Mon Jan 4 14:16:30 2016 -0500
Committer: scnakandala <su...@gmail.com>
Committed: Mon Jan 4 14:38:37 2016 -0500
----------------------------------------------------------------------
.../server/handler/AiravataServerHandler.java | 20 ++++++++++----------
.../api/server/util/RegistryInitUtil.java | 2 +-
.../experiment/catalog/ExpCatResourceUtils.java | 9 +++++----
.../catalog/impl/ExperimentCatalogImpl.java | 4 ++--
.../catalog/impl/ExperimentRegistry.java | 2 +-
.../catalog/impl/ProjectRegistry.java | 2 +-
.../src/main/resources/expcatalog-mysql.sql | 3 ++-
7 files changed, 22 insertions(+), 20 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/airavata/blob/6751a37b/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/handler/AiravataServerHandler.java
----------------------------------------------------------------------
diff --git a/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/handler/AiravataServerHandler.java b/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/handler/AiravataServerHandler.java
index 1ceb797..889b8d2 100644
--- a/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/handler/AiravataServerHandler.java
+++ b/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/handler/AiravataServerHandler.java
@@ -513,7 +513,7 @@ public class AiravataServerHandler implements Airavata.Iface {
}
List<Project> projects = new ArrayList<Project>();
try {
- if (!ExpCatResourceUtils.isUserExist(userName)){
+ if (!ExpCatResourceUtils.isUserExist(userName, gatewayId)){
logger.error("User does not exist in the system. Please provide a valid user..");
AiravataSystemException exception = new AiravataSystemException();
exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
@@ -573,7 +573,7 @@ public class AiravataServerHandler implements Airavata.Iface {
throw new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
}
try {
- if (!ExpCatResourceUtils.isUserExist(userName)){
+ if (!ExpCatResourceUtils.isUserExist(userName, gatewayId)){
logger.error("User does not exist in the system. Please provide a valid user..");
AiravataSystemException exception = new AiravataSystemException();
exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
@@ -633,7 +633,7 @@ public class AiravataServerHandler implements Airavata.Iface {
throw new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
}
try {
- if (!ExpCatResourceUtils.isUserExist(userName)){
+ if (!ExpCatResourceUtils.isUserExist(userName, gatewayId)){
logger.error("User does not exist in the system. Please provide a valid user..");
AiravataSystemException exception = new AiravataSystemException();
exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
@@ -693,7 +693,7 @@ public class AiravataServerHandler implements Airavata.Iface {
throw new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
}
try {
- if (!ExpCatResourceUtils.isUserExist(userName)){
+ if (!ExpCatResourceUtils.isUserExist(userName, gatewayId)){
logger.error("User does not exist in the system. Please provide a valid user..");
AiravataSystemException exception = new AiravataSystemException();
exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
@@ -753,7 +753,7 @@ public class AiravataServerHandler implements Airavata.Iface {
throw new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
}
try {
- if (!ExpCatResourceUtils.isUserExist(userName)){
+ if (!ExpCatResourceUtils.isUserExist(userName, gatewayId)){
logger.error("User does not exist in the system. Please provide a valid user..");
AiravataSystemException exception = new AiravataSystemException();
exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
@@ -814,7 +814,7 @@ public class AiravataServerHandler implements Airavata.Iface {
throw new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
}
try {
- if (!ExpCatResourceUtils.isUserExist(userName)){
+ if (!ExpCatResourceUtils.isUserExist(userName, gatewayId)){
logger.error("User does not exist in the system. Please provide a valid user..");
AiravataSystemException exception = new AiravataSystemException();
exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
@@ -875,7 +875,7 @@ public class AiravataServerHandler implements Airavata.Iface {
throw new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
}
try {
- if (!ExpCatResourceUtils.isUserExist(userName)){
+ if (!ExpCatResourceUtils.isUserExist(userName, gatewayId)){
logger.error("User does not exist in the system. Please provide a valid user..");
AiravataSystemException exception = new AiravataSystemException();
exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
@@ -938,7 +938,7 @@ public class AiravataServerHandler implements Airavata.Iface {
throw new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
}
try {
- if (!ExpCatResourceUtils.isUserExist(userName)){
+ if (!ExpCatResourceUtils.isUserExist(userName, gatewayId)){
logger.error("User does not exist in the system. Please provide a valid user..");
AiravataSystemException exception = new AiravataSystemException();
exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
@@ -999,7 +999,7 @@ public class AiravataServerHandler implements Airavata.Iface {
throw new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
}
try {
- if (!ExpCatResourceUtils.isUserExist(userName)){
+ if (!ExpCatResourceUtils.isUserExist(userName, gatewayId)){
logger.error("User does not exist in the system. Please provide a valid user..");
AiravataSystemException exception = new AiravataSystemException();
exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
@@ -1162,7 +1162,7 @@ public class AiravataServerHandler implements Airavata.Iface {
throw new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
}
try {
- if (!ExpCatResourceUtils.isUserExist(userName)){
+ if (!ExpCatResourceUtils.isUserExist(userName, gatewayId)){
logger.error("User does not exist in the system. Please provide a valid user..");
AiravataSystemException exception = new AiravataSystemException();
exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
http://git-wip-us.apache.org/repos/asf/airavata/blob/6751a37b/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/util/RegistryInitUtil.java
----------------------------------------------------------------------
diff --git a/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/util/RegistryInitUtil.java b/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/util/RegistryInitUtil.java
index 82cedba..9f61c65 100644
--- a/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/util/RegistryInitUtil.java
+++ b/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/util/RegistryInitUtil.java
@@ -93,7 +93,7 @@ public class RegistryInitUtil {
}
UserResource user;
- if (!ExpCatResourceUtils.isUserExist(ServerSettings.getDefaultUser())){
+ if (!ExpCatResourceUtils.isUserExist(ServerSettings.getDefaultUser(), ServerSettings.getDefaultUserGateway())){
user = ExpCatResourceUtils.createUser(ServerSettings.getDefaultUser(), ServerSettings.getDefaultUserPassword(), ServerSettings.getDefaultUserGateway());
user.save();
}else {
http://git-wip-us.apache.org/repos/asf/airavata/blob/6751a37b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/ExpCatResourceUtils.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/ExpCatResourceUtils.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/ExpCatResourceUtils.java
index 2777ff0..035a456 100644
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/ExpCatResourceUtils.java
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/ExpCatResourceUtils.java
@@ -85,7 +85,7 @@ public class ExpCatResourceUtils {
}
public static UserResource createUser(String username, String password, String gatewayId) throws RegistryException {
- if (!isUserExist(username)) {
+ if (!isUserExist(username, gatewayId)) {
UserResource userResource = new UserResource();
userResource.setUserName(username);
userResource.setPassword(password);
@@ -129,13 +129,14 @@ public class ExpCatResourceUtils {
resource.save();
}
- public static boolean isUserExist (String username) throws RegistryException{
+ public static boolean isUserExist (String username, String gatewayId) throws RegistryException{
EntityManager em = null;
try {
em = getEntityManager();
em.getTransaction().begin();
QueryGenerator generator = new QueryGenerator(AbstractExpCatResource.USERS);
generator.setParameter(AbstractExpCatResource.UserConstants.USERNAME, username);
+ generator.setParameter(AbstractExpCatResource.UserConstants.GATEWAY_ID, gatewayId);
Query q = generator.selectQuery(em);
int size = q.getResultList().size();
em.getTransaction().commit();
@@ -158,7 +159,7 @@ public class ExpCatResourceUtils {
public static ExperimentCatResource getUser(String userName, String gatewayId) throws RegistryException{
EntityManager em = null;
try {
- if (isUserExist(userName)) {
+ if (isUserExist(userName, gatewayId)) {
em = getEntityManager();
UserPK userPK = new UserPK();
userPK.setUserName(userName);
@@ -314,7 +315,7 @@ public class ExpCatResourceUtils {
if (!isGatewayExist(gatewayResource.getGatewayName())){
gatewayResource.save();
}
- if (!isUserExist(userResource.getUserName())){
+ if (!isUserExist(userResource.getUserName(), gatewayResource.getGatewayId())){
userResource.save();
}
Gateway gateway = em.find(Gateway.class, gatewayResource.getGatewayId());
http://git-wip-us.apache.org/repos/asf/airavata/blob/6751a37b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/impl/ExperimentCatalogImpl.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/impl/ExperimentCatalogImpl.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/impl/ExperimentCatalogImpl.java
index 7ef834e..48d31b0 100644
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/impl/ExperimentCatalogImpl.java
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/impl/ExperimentCatalogImpl.java
@@ -68,7 +68,7 @@ public class ExperimentCatalogImpl implements ExperimentCatalog {
gatewayResource = (GatewayResource) ExpCatResourceUtils.getGateway(ServerSettings.getDefaultUserGateway());
}
- if (!ExpCatResourceUtils.isUserExist(ServerSettings.getDefaultUser())){
+ if (!ExpCatResourceUtils.isUserExist(ServerSettings.getDefaultUser(), ServerSettings.getDefaultUserGateway())){
user = ExpCatResourceUtils.createUser(ServerSettings.getDefaultUser(), ServerSettings.getDefaultUserPassword(), ServerSettings.getDefaultUserGateway());
user.save();
}else {
@@ -91,7 +91,7 @@ public class ExperimentCatalogImpl implements ExperimentCatalog {
gatewayResource = (GatewayResource) ExpCatResourceUtils.getGateway(gateway);
}
- if (!ExpCatResourceUtils.isUserExist(username)){
+ if (!ExpCatResourceUtils.isUserExist(username, gatewayResource.getGatewayId())){
user = ExpCatResourceUtils.createUser(username, password, gateway);
user.save();
}else {
http://git-wip-us.apache.org/repos/asf/airavata/blob/6751a37b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/impl/ExperimentRegistry.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/impl/ExperimentRegistry.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/impl/ExperimentRegistry.java
index 533f55b..5e10395 100644
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/impl/ExperimentRegistry.java
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/impl/ExperimentRegistry.java
@@ -70,7 +70,7 @@ public class ExperimentRegistry {
public String addExperiment(ExperimentModel experiment) throws RegistryException {
String experimentId;
try {
- if (!ExpCatResourceUtils.isUserExist(experiment.getUserName())) {
+ if (!ExpCatResourceUtils.isUserExist(experiment.getUserName(), experiment.getGatewayId())) {
ExpCatResourceUtils.addUser(experiment.getUserName(), null, experiment.getGatewayId());
}
if (!workerResource.isProjectExists(experiment.getProjectId())) {
http://git-wip-us.apache.org/repos/asf/airavata/blob/6751a37b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/impl/ProjectRegistry.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/impl/ProjectRegistry.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/impl/ProjectRegistry.java
index 7d77308..ef44c64 100644
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/impl/ProjectRegistry.java
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/impl/ProjectRegistry.java
@@ -57,7 +57,7 @@ public class ProjectRegistry {
public String addProject (Project project, String gatewayId) throws RegistryException{
String projectId;
try {
- if (!ExpCatResourceUtils.isUserExist(project.getOwner())){
+ if (!ExpCatResourceUtils.isUserExist(project.getOwner(), gatewayId)){
ExpCatResourceUtils.addUser(project.getOwner(), null, gatewayId);
}
ProjectResource projectResource = new ProjectResource();
http://git-wip-us.apache.org/repos/asf/airavata/blob/6751a37b/modules/registry/registry-core/src/main/resources/expcatalog-mysql.sql
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/resources/expcatalog-mysql.sql b/modules/registry/registry-core/src/main/resources/expcatalog-mysql.sql
index b71b9b1..a3c335f 100644
--- a/modules/registry/registry-core/src/main/resources/expcatalog-mysql.sql
+++ b/modules/registry/registry-core/src/main/resources/expcatalog-mysql.sql
@@ -31,7 +31,8 @@ CREATE TABLE USERS
(
USER_NAME VARCHAR(255),
PASSWORD VARCHAR(255),
- PRIMARY KEY(USER_NAME)
+ GATEWAY_ID VARCHAR(255),
+ PRIMARY KEY(USER_NAME, GATEWAY_ID)
);
CREATE TABLE GATEWAY_WORKER