Return-Path: X-Original-To: apmail-airavata-commits-archive@www.apache.org Delivered-To: apmail-airavata-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 268B118763 for ; Mon, 28 Sep 2015 17:58:29 +0000 (UTC) Received: (qmail 32699 invoked by uid 500); 28 Sep 2015 17:58:24 -0000 Delivered-To: apmail-airavata-commits-archive@airavata.apache.org Received: (qmail 32590 invoked by uid 500); 28 Sep 2015 17:58:24 -0000 Mailing-List: contact commits-help@airavata.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@airavata.apache.org Delivered-To: mailing list commits@airavata.apache.org Received: (qmail 32165 invoked by uid 99); 28 Sep 2015 17:58:23 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 28 Sep 2015 17:58:23 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 91915E03E8; Mon, 28 Sep 2015 17:58:23 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: chathuri@apache.org To: commits@airavata.apache.org Date: Mon, 28 Sep 2015 17:58:33 -0000 Message-Id: <097a039aeb1d44b1b7c0dd875da8b812@git.apache.org> In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [11/11] airavata git commit: data storage preference related changes to app catalog data storage preference related changes to app catalog Project: http://git-wip-us.apache.org/repos/asf/airavata/repo Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/d84783da Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/d84783da Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/d84783da Branch: refs/heads/master Commit: d84783da02f25e9a8f99178eecf6a626c28a5595 Parents: 07da736 Author: Chathuri Wimalasena Authored: Mon Sep 28 13:58:08 2015 -0400 Committer: Chathuri Wimalasena Committed: Mon Sep 28 13:58:08 2015 -0400 ---------------------------------------------------------------------- .../server/handler/AiravataServerHandler.java | 127 + .../java/org/apache/airavata/api/Airavata.java | 38423 ++++++++++------- .../main/resources/lib/airavata/Airavata.cpp | 9723 +++-- .../src/main/resources/lib/airavata/Airavata.h | 1319 +- .../lib/airavata/Airavata_server.skeleton.cpp | 25 + .../airavata/compute_resource_model_types.cpp | 420 +- .../lib/airavata/compute_resource_model_types.h | 14 +- .../gateway_resource_profile_model_types.cpp | 291 +- .../gateway_resource_profile_model_types.h | 108 +- .../resources/lib/Airavata/API/Airavata.php | 2190 +- .../Model/AppCatalog/ComputeResource/Types.php | 196 +- .../Model/AppCatalog/GatewayProfile/Types.php | 257 +- .../lib/apache/airavata/api/Airavata-remote | 35 + .../lib/apache/airavata/api/Airavata.py | 5361 ++- .../model/appcatalog/computeresource/ttypes.py | 124 +- .../model/appcatalog/gatewayprofile/ttypes.py | 176 +- .../org/apache/airavata/model/Workflow.java | 2 +- .../ApplicationDeploymentDescription.java | 2 +- .../appdeployment/ApplicationModule.java | 2 +- .../appcatalog/appdeployment/SetEnvPaths.java | 2 +- .../ApplicationInterfaceDescription.java | 2 +- .../appcatalog/computeresource/BatchQueue.java | 2 +- .../computeresource/CloudJobSubmission.java | 2 +- .../ComputeResourceDescription.java | 218 +- .../computeresource/DataMovementInterface.java | 2 +- .../computeresource/GlobusJobSubmission.java | 34 +- .../computeresource/GridFTPDataMovement.java | 2 +- .../computeresource/JobSubmissionInterface.java | 2 +- .../computeresource/LOCALDataMovement.java | 2 +- .../computeresource/LOCALSubmission.java | 2 +- .../computeresource/ResourceJobManager.java | 2 +- .../computeresource/SCPDataMovement.java | 2 +- .../computeresource/SSHJobSubmission.java | 172 +- .../computeresource/UnicoreDataMovement.java | 2 +- .../computeresource/UnicoreJobSubmission.java | 2 +- .../ComputeResourcePreference.java | 120 +- .../gatewayprofile/GatewayResourceProfile.java | 312 +- .../application/io/InputDataObjectType.java | 2 +- .../application/io/OutputDataObjectType.java | 2 +- .../airavata/model/commons/ErrorModel.java | 2 +- .../model/commons/ValidationResults.java | 2 +- .../airavata/model/commons/ValidatorResult.java | 2 +- .../model/error/AiravataClientException.java | 2 +- .../model/error/AiravataSystemException.java | 2 +- .../model/error/AuthenticationException.java | 2 +- .../model/error/AuthorizationException.java | 2 +- .../error/ExperimentNotFoundException.java | 2 +- .../model/error/InvalidRequestException.java | 2 +- .../model/error/LaunchValidationException.java | 2 +- .../model/error/ProjectNotFoundException.java | 2 +- .../airavata/model/error/TimedOutException.java | 2 +- .../airavata/model/error/ValidationResults.java | 2 +- .../airavata/model/error/ValidatorResult.java | 2 +- .../model/experiment/ExperimentModel.java | 2 +- .../model/experiment/ExperimentStatistics.java | 2 +- .../experiment/ExperimentSummaryModel.java | 2 +- .../experiment/UserConfigurationDataModel.java | 2 +- .../org/apache/airavata/model/job/JobModel.java | 2 +- .../event/ExperimentStatusChangeEvent.java | 2 +- .../model/messaging/event/JobIdentifier.java | 2 +- .../messaging/event/JobStatusChangeEvent.java | 2 +- .../event/JobStatusChangeRequestEvent.java | 2 +- .../airavata/model/messaging/event/Message.java | 2 +- .../messaging/event/ProcessIdentifier.java | 2 +- .../event/ProcessStatusChangeEvent.java | 2 +- .../event/ProcessStatusChangeRequestEvent.java | 2 +- .../messaging/event/ProcessSubmitEvent.java | 2 +- .../messaging/event/ProcessTerminateEvent.java | 2 +- .../model/messaging/event/TaskIdentifier.java | 2 +- .../messaging/event/TaskOutputChangeEvent.java | 2 +- .../messaging/event/TaskStatusChangeEvent.java | 2 +- .../event/TaskStatusChangeRequestEvent.java | 2 +- .../airavata/model/process/ProcessModel.java | 2 +- .../ComputationalResourceSchedulingModel.java | 2 +- .../airavata/model/security/AuthzToken.java | 2 +- .../airavata/model/status/ExperimentStatus.java | 2 +- .../apache/airavata/model/status/JobStatus.java | 2 +- .../airavata/model/status/ProcessStatus.java | 2 +- .../airavata/model/status/TaskStatus.java | 2 +- .../model/task/DataStagingTaskModel.java | 2 +- .../apache/airavata/model/task/TaskModel.java | 2 +- .../airavata/model/workspace/Gateway.java | 2 +- .../apache/airavata/model/workspace/Group.java | 2 +- .../airavata/model/workspace/Project.java | 2 +- .../apache/airavata/model/workspace/User.java | 2 +- .../catalog/impl/GwyResourceProfileImpl.java | 81 +- .../model/ComputeResourcePreference.java | 10 + .../catalog/model/DataStoragePreference.java | 96 + .../catalog/model/DataStoragePreferencePK.java | 64 + .../resources/AppCatAbstractResource.java | 6 + .../ComputeHostPreferenceResource.java | 11 + .../DataStoragePreferenceResource.java | 323 + .../app/catalog/util/AppCatalogJPAUtils.java | 21 + .../catalog/util/AppCatalogResourceType.java | 1 + .../util/AppCatalogThriftConversion.java | 24 +- .../src/main/resources/META-INF/persistence.xml | 1 + .../src/main/resources/appcatalog-derby.sql | 14 +- .../src/main/resources/appcatalog-mysql.sql | 12 + .../src/test/resources/appcatalog-derby.sql | 17 +- .../registry/cpi/GwyResourceProfile.java | 4 + .../airavata-api/airavata_api.thrift | 37 + .../gateway_resource_profile_model.thrift | 2 +- 102 files changed, 38638 insertions(+), 21859 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/airavata/blob/d84783da/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 dd30b9e..fccf66f 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 @@ -41,6 +41,7 @@ import org.apache.airavata.model.appcatalog.appdeployment.ApplicationModule; import org.apache.airavata.model.appcatalog.appinterface.ApplicationInterfaceDescription; import org.apache.airavata.model.appcatalog.computeresource.*; import org.apache.airavata.model.appcatalog.gatewayprofile.ComputeResourcePreference; +import org.apache.airavata.model.appcatalog.gatewayprofile.DataStoragePreference; import org.apache.airavata.model.appcatalog.gatewayprofile.GatewayResourceProfile; import org.apache.airavata.model.application.io.InputDataObjectType; import org.apache.airavata.model.application.io.OutputDataObjectType; @@ -3366,6 +3367,32 @@ public class AiravataServerHandler implements Airavata.Iface { } } + @Override + public boolean addGatewayDataStoragePreference(AuthzToken authzToken, String gatewayID, String dataMoveId, DataStoragePreference dataStoragePreference) throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException, TException { + try { + if (!isGatewayExistInternal(gatewayID)){ + logger.error("Gateway does not exist.Please provide a valid gateway id..."); + throw new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR); + } + appCatalog = RegistryFactory.getAppCatalog(); + GwyResourceProfile gatewayProfile = appCatalog.getGatewayProfile(); + if (!gatewayProfile.isGatewayResourceProfileExists(gatewayID)){ + throw new AppCatalogException("Gateway resource profile '"+gatewayID+"' does not exist!!!"); + } + GatewayResourceProfile profile = gatewayProfile.getGatewayProfile(gatewayID); +// gatewayProfile.removeGatewayResourceProfile(gatewayID); + profile.addToDataStoragePreferences(dataStoragePreference); + gatewayProfile.updateGatewayResourceProfile(gatewayID, profile); + return true; + } catch (AppCatalogException e) { + logger.error(gatewayID, "Error while registering gateway resource profile preference...", e); + AiravataSystemException exception = new AiravataSystemException(); + exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR); + exception.setMessage("Error while registering gateway resource profile preference. More info : " + e.getMessage()); + throw exception; + } + } + /** * Fetch a Compute Resource Preference of a registered gateway profile. * @@ -3410,6 +3437,34 @@ public class AiravataServerHandler implements Airavata.Iface { } } + @Override + public DataStoragePreference getGatewayDataStoragePreference(AuthzToken authzToken, String gatewayID, String dataMoveId) throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException, TException { + try { + if (!isGatewayExistInternal(gatewayID)){ + logger.error("Gateway does not exist.Please provide a valid gateway id..."); + throw new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR); + } + appCatalog = RegistryFactory.getAppCatalog(); + GwyResourceProfile gatewayProfile = appCatalog.getGatewayProfile(); + ComputeResource computeResource = appCatalog.getComputeResource(); + if (!gatewayProfile.isGatewayResourceProfileExists(gatewayID)){ + logger.error(gatewayID, "Given gateway profile does not exist in the system. Please provide a valid gateway id..."); + AiravataSystemException exception = new AiravataSystemException(); + exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR); + exception.setMessage("Given gateway profile does not exist in the system. Please provide a valid gateway id..."); + throw exception; + } + + return gatewayProfile.getDataStoragePreference(gatewayID, dataMoveId); + } catch (AppCatalogException e) { + logger.error(gatewayID, "Error while reading gateway data storage preference...", e); + AiravataSystemException exception = new AiravataSystemException(); + exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR); + exception.setMessage("Error while reading gateway data storage preference. More info : " + e.getMessage()); + throw exception; + } + } + /** * Fetch all Compute Resource Preferences of a registered gateway profile. * @@ -3439,6 +3494,25 @@ public class AiravataServerHandler implements Airavata.Iface { } @Override + public List getAllGatewayDataStoragePreferences(AuthzToken authzToken, String gatewayID) throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException, TException { + try { + if (!isGatewayExistInternal(gatewayID)){ + logger.error("Gateway does not exist.Please provide a valid gateway id..."); + throw new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR); + } + appCatalog = RegistryFactory.getAppCatalog(); + GwyResourceProfile gatewayProfile = appCatalog.getGatewayProfile(); + return gatewayProfile.getGatewayProfile(gatewayID).getDataStoragePreferences(); + } catch (AppCatalogException e) { + logger.error(gatewayID, "Error while reading gateway data storage preferences...", e); + AiravataSystemException exception = new AiravataSystemException(); + exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR); + exception.setMessage("Error while reading gateway data storage preferences. More info : " + e.getMessage()); + throw exception; + } + } + + @Override @SecurityCheck public List getAllGatewayComputeResources(AuthzToken authzToken) throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException, TException { @@ -3500,6 +3574,40 @@ public class AiravataServerHandler implements Airavata.Iface { } } + @Override + public boolean updateGatewayDataStoragePreference(AuthzToken authzToken, String gatewayID, String dataMoveId, DataStoragePreference dataStoragePreference) throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException, TException { + try { + if (!isGatewayExistInternal(gatewayID)){ + logger.error("Gateway does not exist.Please provide a valid gateway id..."); + throw new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR); + } + appCatalog = RegistryFactory.getAppCatalog(); + GwyResourceProfile gatewayProfile = appCatalog.getGatewayProfile(); + GatewayResourceProfile profile = gatewayProfile.getGatewayProfile(gatewayID); + List dataStoragePreferences = profile.getDataStoragePreferences(); + DataStoragePreference preferenceToRemove = null; + for (DataStoragePreference preference : dataStoragePreferences) { + if (preference.getDataMovememtResourceId().equals(dataMoveId)){ + preferenceToRemove=preference; + break; + } + } + if (preferenceToRemove!=null) { + profile.getDataStoragePreferences().remove( + preferenceToRemove); + } + profile.getDataStoragePreferences().add(dataStoragePreference); + gatewayProfile.updateGatewayResourceProfile(gatewayID, profile); + return true; + } catch (AppCatalogException e) { + logger.error(gatewayID, "Error while reading gateway data storage preference...", e); + AiravataSystemException exception = new AiravataSystemException(); + exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR); + exception.setMessage("Error while updating gateway data storage preference. More info : " + e.getMessage()); + throw exception; + } + } + /** * Delete the Compute Resource Preference of a registered gateway profile. * @@ -3530,6 +3638,25 @@ public class AiravataServerHandler implements Airavata.Iface { } @Override + public boolean deleteGatewayDataStoragePreference(AuthzToken authzToken, String gatewayID, String dataMoveId) throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException, TException { + try { + if (!isGatewayExistInternal(gatewayID)){ + logger.error("Gateway does not exist.Please provide a valid gateway id..."); + throw new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR); + } + appCatalog = RegistryFactory.getAppCatalog(); + GwyResourceProfile gatewayProfile = appCatalog.getGatewayProfile(); + return gatewayProfile.removeDataStoragePreferenceFromGateway(gatewayID, dataMoveId); + } catch (AppCatalogException e) { + logger.error(gatewayID, "Error while reading gateway data storage preference...", e); + AiravataSystemException exception = new AiravataSystemException(); + exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR); + exception.setMessage("Error while updating gateway data storage preference. More info : " + e.getMessage()); + throw exception; + } + } + + @Override @SecurityCheck public List getAllWorkflows(AuthzToken authzToken, String gatewayId) throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException, TException {