Repository: airavata Updated Branches: refs/heads/master 07da736bc -> d84783da0
http://git-wip-us.apache.org/repos/asf/airavata/blob/d84783da/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/scheduling/ComputationalResourceSchedulingModel.java ---------------------------------------------------------------------- diff --git a/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/scheduling/ComputationalResourceSchedulingModel.java b/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/scheduling/ComputationalResourceSchedulingModel.java index e78762b..7ea49a1 100644 --- a/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/scheduling/ComputationalResourceSchedulingModel.java +++ b/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/scheduling/ComputationalResourceSchedulingModel.java @@ -56,7 +56,7 @@ import org.slf4j.LoggerFactory; * * */ -@Generated(value = "Autogenerated by Thrift Compiler (0.9.2)", date = "2015-9-11") +@Generated(value = "Autogenerated by Thrift Compiler (0.9.2)", date = "2015-9-28") public class ComputationalResourceSchedulingModel implements org.apache.thrift.TBase<ComputationalResourceSchedulingModel, ComputationalResourceSchedulingModel._Fields>, java.io.Serializable, Cloneable, Comparable<ComputationalResourceSchedulingModel> { private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("ComputationalResourceSchedulingModel"); http://git-wip-us.apache.org/repos/asf/airavata/blob/d84783da/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/security/AuthzToken.java ---------------------------------------------------------------------- diff --git a/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/security/AuthzToken.java b/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/security/AuthzToken.java index 7cbec78..0770f8a 100644 --- a/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/security/AuthzToken.java +++ b/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/security/AuthzToken.java @@ -51,7 +51,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"}) -@Generated(value = "Autogenerated by Thrift Compiler (0.9.2)", date = "2015-9-11") +@Generated(value = "Autogenerated by Thrift Compiler (0.9.2)", date = "2015-9-28") public class AuthzToken implements org.apache.thrift.TBase<AuthzToken, AuthzToken._Fields>, java.io.Serializable, Cloneable, Comparable<AuthzToken> { private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("AuthzToken"); http://git-wip-us.apache.org/repos/asf/airavata/blob/d84783da/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/status/ExperimentStatus.java ---------------------------------------------------------------------- diff --git a/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/status/ExperimentStatus.java b/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/status/ExperimentStatus.java index 300aaef..8a60e4d 100644 --- a/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/status/ExperimentStatus.java +++ b/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/status/ExperimentStatus.java @@ -64,7 +64,7 @@ import org.slf4j.LoggerFactory; * User friendly reason on how the state is inferred. * */ -@Generated(value = "Autogenerated by Thrift Compiler (0.9.2)", date = "2015-9-11") +@Generated(value = "Autogenerated by Thrift Compiler (0.9.2)", date = "2015-9-28") public class ExperimentStatus implements org.apache.thrift.TBase<ExperimentStatus, ExperimentStatus._Fields>, java.io.Serializable, Cloneable, Comparable<ExperimentStatus> { private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("ExperimentStatus"); http://git-wip-us.apache.org/repos/asf/airavata/blob/d84783da/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/status/JobStatus.java ---------------------------------------------------------------------- diff --git a/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/status/JobStatus.java b/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/status/JobStatus.java index 2f9f58c..0ff1255 100644 --- a/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/status/JobStatus.java +++ b/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/status/JobStatus.java @@ -51,7 +51,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"}) -@Generated(value = "Autogenerated by Thrift Compiler (0.9.2)", date = "2015-9-11") +@Generated(value = "Autogenerated by Thrift Compiler (0.9.2)", date = "2015-9-28") public class JobStatus implements org.apache.thrift.TBase<JobStatus, JobStatus._Fields>, java.io.Serializable, Cloneable, Comparable<JobStatus> { private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("JobStatus"); http://git-wip-us.apache.org/repos/asf/airavata/blob/d84783da/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/status/ProcessStatus.java ---------------------------------------------------------------------- diff --git a/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/status/ProcessStatus.java b/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/status/ProcessStatus.java index bc247ce..de8be7b 100644 --- a/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/status/ProcessStatus.java +++ b/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/status/ProcessStatus.java @@ -51,7 +51,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"}) -@Generated(value = "Autogenerated by Thrift Compiler (0.9.2)", date = "2015-9-11") +@Generated(value = "Autogenerated by Thrift Compiler (0.9.2)", date = "2015-9-28") public class ProcessStatus implements org.apache.thrift.TBase<ProcessStatus, ProcessStatus._Fields>, java.io.Serializable, Cloneable, Comparable<ProcessStatus> { private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("ProcessStatus"); http://git-wip-us.apache.org/repos/asf/airavata/blob/d84783da/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/status/TaskStatus.java ---------------------------------------------------------------------- diff --git a/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/status/TaskStatus.java b/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/status/TaskStatus.java index 14606b7..d50126d 100644 --- a/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/status/TaskStatus.java +++ b/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/status/TaskStatus.java @@ -51,7 +51,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"}) -@Generated(value = "Autogenerated by Thrift Compiler (0.9.2)", date = "2015-9-11") +@Generated(value = "Autogenerated by Thrift Compiler (0.9.2)", date = "2015-9-28") public class TaskStatus implements org.apache.thrift.TBase<TaskStatus, TaskStatus._Fields>, java.io.Serializable, Cloneable, Comparable<TaskStatus> { private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TaskStatus"); http://git-wip-us.apache.org/repos/asf/airavata/blob/d84783da/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/task/DataStagingTaskModel.java ---------------------------------------------------------------------- diff --git a/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/task/DataStagingTaskModel.java b/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/task/DataStagingTaskModel.java index d28b61d..c34336e 100644 --- a/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/task/DataStagingTaskModel.java +++ b/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/task/DataStagingTaskModel.java @@ -58,7 +58,7 @@ import org.slf4j.LoggerFactory; * A friendly description of the task, usally used to communicate information to users. * */ -@Generated(value = "Autogenerated by Thrift Compiler (0.9.2)", date = "2015-9-11") +@Generated(value = "Autogenerated by Thrift Compiler (0.9.2)", date = "2015-9-28") public class DataStagingTaskModel implements org.apache.thrift.TBase<DataStagingTaskModel, DataStagingTaskModel._Fields>, java.io.Serializable, Cloneable, Comparable<DataStagingTaskModel> { private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("DataStagingTaskModel"); http://git-wip-us.apache.org/repos/asf/airavata/blob/d84783da/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/task/TaskModel.java ---------------------------------------------------------------------- diff --git a/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/task/TaskModel.java b/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/task/TaskModel.java index 3b89d38..ff7927d 100644 --- a/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/task/TaskModel.java +++ b/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/task/TaskModel.java @@ -60,7 +60,7 @@ import org.slf4j.LoggerFactory; * subTaskModel: * A generic byte object for the Task developer to store internal serialized data into registry catalogs. */ -@Generated(value = "Autogenerated by Thrift Compiler (0.9.2)", date = "2015-9-11") +@Generated(value = "Autogenerated by Thrift Compiler (0.9.2)", date = "2015-9-28") public class TaskModel implements org.apache.thrift.TBase<TaskModel, TaskModel._Fields>, java.io.Serializable, Cloneable, Comparable<TaskModel> { private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TaskModel"); http://git-wip-us.apache.org/repos/asf/airavata/blob/d84783da/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/workspace/Gateway.java ---------------------------------------------------------------------- diff --git a/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/workspace/Gateway.java b/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/workspace/Gateway.java index 3bac9cd..021c468 100644 --- a/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/workspace/Gateway.java +++ b/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/workspace/Gateway.java @@ -51,7 +51,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"}) -@Generated(value = "Autogenerated by Thrift Compiler (0.9.2)", date = "2015-9-11") +@Generated(value = "Autogenerated by Thrift Compiler (0.9.2)", date = "2015-9-28") public class Gateway implements org.apache.thrift.TBase<Gateway, Gateway._Fields>, java.io.Serializable, Cloneable, Comparable<Gateway> { private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("Gateway"); http://git-wip-us.apache.org/repos/asf/airavata/blob/d84783da/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/workspace/Group.java ---------------------------------------------------------------------- diff --git a/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/workspace/Group.java b/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/workspace/Group.java index 846a9f2..386a5e6 100644 --- a/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/workspace/Group.java +++ b/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/workspace/Group.java @@ -51,7 +51,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"}) -@Generated(value = "Autogenerated by Thrift Compiler (0.9.2)", date = "2015-9-11") +@Generated(value = "Autogenerated by Thrift Compiler (0.9.2)", date = "2015-9-28") public class Group implements org.apache.thrift.TBase<Group, Group._Fields>, java.io.Serializable, Cloneable, Comparable<Group> { private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("Group"); http://git-wip-us.apache.org/repos/asf/airavata/blob/d84783da/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/workspace/Project.java ---------------------------------------------------------------------- diff --git a/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/workspace/Project.java b/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/workspace/Project.java index 057bc7e..6af0fab 100644 --- a/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/workspace/Project.java +++ b/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/workspace/Project.java @@ -51,7 +51,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"}) -@Generated(value = "Autogenerated by Thrift Compiler (0.9.2)", date = "2015-9-11") +@Generated(value = "Autogenerated by Thrift Compiler (0.9.2)", date = "2015-9-28") public class Project implements org.apache.thrift.TBase<Project, Project._Fields>, java.io.Serializable, Cloneable, Comparable<Project> { private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("Project"); http://git-wip-us.apache.org/repos/asf/airavata/blob/d84783da/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/workspace/User.java ---------------------------------------------------------------------- diff --git a/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/workspace/User.java b/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/workspace/User.java index 49eee38..f9dec17 100644 --- a/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/workspace/User.java +++ b/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/workspace/User.java @@ -51,7 +51,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"}) -@Generated(value = "Autogenerated by Thrift Compiler (0.9.2)", date = "2015-9-11") +@Generated(value = "Autogenerated by Thrift Compiler (0.9.2)", date = "2015-9-28") public class User implements org.apache.thrift.TBase<User, User._Fields>, java.io.Serializable, Cloneable, Comparable<User> { private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("User"); http://git-wip-us.apache.org/repos/asf/airavata/blob/d84783da/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/impl/GwyResourceProfileImpl.java ---------------------------------------------------------------------- diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/impl/GwyResourceProfileImpl.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/impl/GwyResourceProfileImpl.java index 359916d..f0085ed 100644 --- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/impl/GwyResourceProfileImpl.java +++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/impl/GwyResourceProfileImpl.java @@ -22,6 +22,7 @@ package org.apache.airavata.registry.core.app.catalog.impl; 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.registry.core.app.catalog.resources.*; import org.apache.airavata.registry.core.app.catalog.util.AppCatalogThriftConversion; @@ -58,6 +59,7 @@ public class GwyResourceProfileImpl implements GwyResourceProfile { resource.setGatewayId(profileResource.getGatewayID()); resource.setOverrideByAiravata(preference.isOverridebyAiravata()); resource.setLoginUserName(preference.getLoginUserName()); + resource.setResourceCSToken(preference.getResourceSpecificCredentialStoreToken()); if (preference.getPreferredJobSubmissionProtocol() != null){ resource.setPreferredJobProtocol(preference.getPreferredJobSubmissionProtocol().toString()); } @@ -72,6 +74,19 @@ public class GwyResourceProfileImpl implements GwyResourceProfile { resource.save(); } } + List<DataStoragePreference> dataStoragePreferences = gatewayProfile.getDataStoragePreferences(); + if (dataStoragePreferences != null && !dataStoragePreferences.isEmpty()){ + for (DataStoragePreference storagePreference : dataStoragePreferences){ + DataStoragePreferenceResource resource = new DataStoragePreferenceResource(); + resource.setDataMoveId(storagePreference.getDataMovememtResourceId()); + resource.setGatewayId(profileResource.getGatewayID()); + resource.setFsRootLocation(storagePreference.getFileSystemRootLocation()); + resource.setLoginUserName(storagePreference.getLoginUserName()); + resource.setResourceCSToken(storagePreference.getResourceSpecificCredentialStoreToken()); + resource.setGatewayProfile(profileResource); + resource.save(); + } + } return profileResource.getGatewayID(); }catch (Exception e) { logger.error("Error while saving gateway profile...", e); @@ -110,6 +125,19 @@ public class GwyResourceProfileImpl implements GwyResourceProfile { resource.save(); } } + List<DataStoragePreference> dataStoragePreferences = updatedProfile.getDataStoragePreferences(); + if (dataStoragePreferences != null && !dataStoragePreferences.isEmpty()){ + for (DataStoragePreference storagePreference : dataStoragePreferences){ + DataStoragePreferenceResource resource = new DataStoragePreferenceResource(); + resource.setDataMoveId(storagePreference.getDataMovememtResourceId()); + resource.setGatewayId(profileResource.getGatewayID()); + resource.setFsRootLocation(storagePreference.getFileSystemRootLocation()); + resource.setLoginUserName(storagePreference.getLoginUserName()); + resource.setResourceCSToken(storagePreference.getResourceSpecificCredentialStoreToken()); + resource.setGatewayProfile(profileResource); + resource.save(); + } + } }catch (Exception e) { logger.error("Error while updating gateway profile...", e); throw new AppCatalogException(e); @@ -124,7 +152,8 @@ public class GwyResourceProfileImpl implements GwyResourceProfile { ComputeHostPreferenceResource prefResource = new ComputeHostPreferenceResource(); List<AppCatalogResource> computePrefList = prefResource.get(AppCatAbstractResource.ComputeResourcePreferenceConstants.GATEWAY_ID, gatewayId); List<ComputeResourcePreference> computeResourcePreferences = AppCatalogThriftConversion.getComputeResourcePreferences(computePrefList); - return AppCatalogThriftConversion.getGatewayResourceProfile(gwresource, computeResourcePreferences); + List<DataStoragePreference> dataStoragePreferences = getAllDataStoragePreferences(gatewayId); + return AppCatalogThriftConversion.getGatewayResourceProfile(gwresource, computeResourcePreferences, dataStoragePreferences); }catch (Exception e) { logger.error("Error while retrieving gateway profile...", e); throw new AppCatalogException(e); @@ -159,6 +188,21 @@ public class GwyResourceProfileImpl implements GwyResourceProfile { } @Override + public boolean removeDataStoragePreferenceFromGateway(String gatewayId, String preferenceId) throws AppCatalogException { + try { + DataStoragePreferenceResource resource = new DataStoragePreferenceResource(); + Map<String, String> ids = new HashMap<String, String>(); + ids.put(AppCatAbstractResource.DataStoragePreferenceConstants.GATEWAY_ID, gatewayId); + ids.put(AppCatAbstractResource.DataStoragePreferenceConstants.DATA_MOVEMENT_ID, preferenceId); + resource.remove(ids); + return true; + }catch (Exception e) { + logger.error("Error while deleting gateway profile...", e); + throw new AppCatalogException(e); + } + } + + @Override public boolean isGatewayResourceProfileExists(String gatewayId) throws AppCatalogException { try { GatewayProfileResource resource = new GatewayProfileResource(); @@ -194,6 +238,26 @@ public class GwyResourceProfileImpl implements GwyResourceProfile { return null; } + @Override + public DataStoragePreference getDataStoragePreference(String gatewayId, String dataMoveId) throws AppCatalogException { + try { + DataStoragePreferenceResource prefResource = new DataStoragePreferenceResource(); + List<AppCatalogResource> computePrefList = prefResource.get(AppCatAbstractResource.ComputeResourcePreferenceConstants.GATEWAY_ID, gatewayId); + for (AppCatalogResource resource : computePrefList){ + DataStoragePreferenceResource dsP = (DataStoragePreferenceResource) resource; + if (dsP.getDataMoveId() != null && !dsP.getDataMoveId().equals("")){ + if (dsP.getDataMoveId().equals(dataMoveId)){ + return AppCatalogThriftConversion.getDataStoragePreference(dsP); + } + } + } + }catch (Exception e) { + logger.error("Error while retrieving data storage preference...", e); + throw new AppCatalogException(e); + } + return null; + } + /** * @param gatewayId * @return @@ -211,6 +275,18 @@ public class GwyResourceProfileImpl implements GwyResourceProfile { } @Override + public List<DataStoragePreference> getAllDataStoragePreferences(String gatewayId) throws AppCatalogException { + try { + DataStoragePreferenceResource prefResource = new DataStoragePreferenceResource(); + List<AppCatalogResource> dataStoragePrefList = prefResource.get(AppCatAbstractResource.DataStoragePreferenceConstants.GATEWAY_ID, gatewayId); + return AppCatalogThriftConversion.getDataStoragePreferences(dataStoragePrefList); + }catch (Exception e) { + logger.error("Error while retrieving data storage preference...", e); + throw new AppCatalogException(e); + } + } + + @Override public List<String> getGatewayProfileIds(String gatewayName) throws AppCatalogException { try { GatewayProfileResource profileResource = new GatewayProfileResource(); @@ -238,7 +314,8 @@ public class GwyResourceProfileImpl implements GwyResourceProfile { for (AppCatalogResource resource : resourceList){ GatewayProfileResource gatewayProfileResource = (GatewayProfileResource)resource; List<ComputeResourcePreference> computeResourcePreferences = getAllComputeResourcePreferences(gatewayProfileResource.getGatewayID()); - GatewayResourceProfile gatewayResourceProfile = AppCatalogThriftConversion.getGatewayResourceProfile(gatewayProfileResource, computeResourcePreferences); + List<DataStoragePreference> dataStoragePreferences = getAllDataStoragePreferences(gatewayProfileResource.getGatewayID()); + GatewayResourceProfile gatewayResourceProfile = AppCatalogThriftConversion.getGatewayResourceProfile(gatewayProfileResource, computeResourcePreferences, dataStoragePreferences); gatewayResourceProfileList.add(gatewayResourceProfile); } } http://git-wip-us.apache.org/repos/asf/airavata/blob/d84783da/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/ComputeResourcePreference.java ---------------------------------------------------------------------- diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/ComputeResourcePreference.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/ComputeResourcePreference.java index 0424d89..635c361 100644 --- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/ComputeResourcePreference.java +++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/ComputeResourcePreference.java @@ -55,6 +55,8 @@ public class ComputeResourcePreference { private String projectNumber; @Column(name = "LOGIN_USERNAME") private String loginUserName; + @Column(name = "RESOURCE_CS_TOKEN") + private String computeResourceCSToken; @ManyToOne(cascade= CascadeType.MERGE) @JoinColumn(name = "RESOURCE_ID") @@ -151,4 +153,12 @@ public class ComputeResourcePreference { public void setLoginUserName(String loginUserName) { this.loginUserName = loginUserName; } + + public String getComputeResourceCSToken() { + return computeResourceCSToken; + } + + public void setComputeResourceCSToken(String computeResourceCSToken) { + this.computeResourceCSToken = computeResourceCSToken; + } } http://git-wip-us.apache.org/repos/asf/airavata/blob/d84783da/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/DataStoragePreference.java ---------------------------------------------------------------------- diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/DataStoragePreference.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/DataStoragePreference.java new file mode 100644 index 0000000..601f0db --- /dev/null +++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/DataStoragePreference.java @@ -0,0 +1,96 @@ +/* + * + * 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.app.catalog.model; + + +import javax.persistence.*; + +@Entity +@Table(name = "DATA_STORAGE_PREFERENCE") +@IdClass(DataStoragePreferencePK.class) +public class DataStoragePreference { + @Id + @Column(name = "GATEWAY_ID") + private String gatewayId; + @Id + @Column(name = "DATA_MOVEMENT_ID") + private String dataMovementId; + @Column(name = "LOGIN_USERNAME") + private String loginUserName; + @Column(name = "FS_ROOT_LOCATION") + private String fsRootLocation; + @Column(name = "RESOURCE_CS_TOKEN") + private String computeResourceCSToken; + + @ManyToOne(cascade= CascadeType.MERGE) + @JoinColumn(name = "GATEWAY_ID") + private GatewayProfile gatewayProfile; + + public String getGatewayId() { + return gatewayId; + } + + public void setGatewayId(String gatewayId) { + this.gatewayId = gatewayId; + } + + public GatewayProfile getGatewayProfile() { + return gatewayProfile; + } + + public void setGatewayProfile(GatewayProfile gatewayProfile) { + this.gatewayProfile = gatewayProfile; + } + + public String getLoginUserName() { + return loginUserName; + } + + public void setLoginUserName(String loginUserName) { + this.loginUserName = loginUserName; + } + + public String getComputeResourceCSToken() { + return computeResourceCSToken; + } + + public void setComputeResourceCSToken(String computeResourceCSToken) { + this.computeResourceCSToken = computeResourceCSToken; + } + + public String getDataMovementID() { + return dataMovementId; + } + + public void setDataMovementID(String dataMovementId) { + this.dataMovementId = dataMovementId; + } + + public String getFsRootLocation() { + return fsRootLocation; + } + + public void setFsRootLocation(String fsRootLocation) { + this.fsRootLocation = fsRootLocation; + } + +} http://git-wip-us.apache.org/repos/asf/airavata/blob/d84783da/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/DataStoragePreferencePK.java ---------------------------------------------------------------------- diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/DataStoragePreferencePK.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/DataStoragePreferencePK.java new file mode 100644 index 0000000..b33f221 --- /dev/null +++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/DataStoragePreferencePK.java @@ -0,0 +1,64 @@ +/* + * + * 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.app.catalog.model; + +import java.io.Serializable; + +public class DataStoragePreferencePK implements Serializable { + private String gatewayId; + private String dataMovementId; + + public DataStoragePreferencePK(String gatewayId, String dataMoveId) { + this.gatewayId = gatewayId; + this.dataMovementId = dataMoveId; + } + + public DataStoragePreferencePK() { + ; + } + + @Override + public boolean equals(Object o) { + return false; + } + + @Override + public int hashCode() { + return 1; + } + + public String getGatewayId() { + return gatewayId; + } + + public void setGatewayId(String gatewayId) { + this.gatewayId = gatewayId; + } + + public String getDataMoveId() { + return dataMovementId; + } + + public void setDataMoveId(String dataMoveId) { + this.dataMovementId = dataMoveId; + } +} http://git-wip-us.apache.org/repos/asf/airavata/blob/d84783da/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/AppCatAbstractResource.java ---------------------------------------------------------------------- diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/AppCatAbstractResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/AppCatAbstractResource.java index 7e06859..ec669d2 100644 --- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/AppCatAbstractResource.java +++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/AppCatAbstractResource.java @@ -53,6 +53,7 @@ public abstract class AppCatAbstractResource implements AppCatalogResource { public static final String WORKFLOW_OUTPUT = "WorkflowOutput"; public static final String GATEWAY_PROFILE = "GatewayProfile"; public static final String COMPUTE_RESOURCE_PREFERENCE = "ComputeResourcePreference"; + public static final String DATA_STORAGE_PREFERENCE = "DataStoragePreference"; public static final String BATCH_QUEUE = "BatchQueue"; public static final String COMPUTE_RESOURCE_FILE_SYSTEM = "ComputeResourceFileSystem"; public static final String JOB_SUBMISSION_INTERFACE = "JobSubmissionInterface"; @@ -284,6 +285,11 @@ public abstract class AppCatAbstractResource implements AppCatalogResource { public static final String ALLOCATION_PROJECT_NUMBER = "projectNumber"; } + public final class DataStoragePreferenceConstants { + public static final String GATEWAY_ID = "gatewayId"; + public static final String DATA_MOVEMENT_ID = "dataMovementId"; + } + // Batch Queue Table public final class BatchQueueConstants { public static final String COMPUTE_RESOURCE_ID = "computeResourceId"; http://git-wip-us.apache.org/repos/asf/airavata/blob/d84783da/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/ComputeHostPreferenceResource.java ---------------------------------------------------------------------- diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/ComputeHostPreferenceResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/ComputeHostPreferenceResource.java index 46685c2..0528843 100644 --- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/ComputeHostPreferenceResource.java +++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/ComputeHostPreferenceResource.java @@ -51,6 +51,7 @@ public class ComputeHostPreferenceResource extends AppCatAbstractResource { private String scratchLocation; private String projectNumber; private String loginUserName; + private String resourceCSToken; private GatewayProfileResource gatewayProfile; private ComputeResourceResource computeHostResource; @@ -143,6 +144,14 @@ public class ComputeHostPreferenceResource extends AppCatAbstractResource { this.computeHostResource = computeHostResource; } + public String getResourceCSToken() { + return resourceCSToken; + } + + public void setResourceCSToken(String resourceCSToken) { + this.resourceCSToken = resourceCSToken; + } + @Override public void remove(Object identifier) throws AppCatalogException { HashMap<String, String> ids; @@ -349,6 +358,7 @@ public class ComputeHostPreferenceResource extends AppCatAbstractResource { existingPreference.setProjectNumber(projectNumber); existingPreference.setBatchQueue(batchQueue); existingPreference.setLoginUserName(loginUserName); + existingPreference.setComputeResourceCSToken(resourceCSToken); em.merge(existingPreference); } else { ComputeResourcePreference resourcePreference = new ComputeResourcePreference(); @@ -363,6 +373,7 @@ public class ComputeHostPreferenceResource extends AppCatAbstractResource { resourcePreference.setProjectNumber(projectNumber); resourcePreference.setBatchQueue(batchQueue); resourcePreference.setLoginUserName(loginUserName); + resourcePreference.setComputeResourceCSToken(resourceCSToken); em.persist(resourcePreference); } em.getTransaction().commit(); http://git-wip-us.apache.org/repos/asf/airavata/blob/d84783da/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/DataStoragePreferenceResource.java ---------------------------------------------------------------------- diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/DataStoragePreferenceResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/DataStoragePreferenceResource.java new file mode 100644 index 0000000..482589d --- /dev/null +++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/DataStoragePreferenceResource.java @@ -0,0 +1,323 @@ +/* + * + * 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.app.catalog.resources; + +import org.apache.airavata.common.exception.ApplicationSettingsException; +import org.apache.airavata.registry.core.app.catalog.model.*; +import org.apache.airavata.registry.core.app.catalog.util.AppCatalogJPAUtils; +import org.apache.airavata.registry.core.app.catalog.util.AppCatalogQueryGenerator; +import org.apache.airavata.registry.core.app.catalog.util.AppCatalogResourceType; +import org.apache.airavata.registry.cpi.AppCatalogException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import javax.persistence.EntityManager; +import javax.persistence.Query; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class DataStoragePreferenceResource extends AppCatAbstractResource { + private final static Logger logger = LoggerFactory.getLogger(DataStoragePreferenceResource.class); + private String gatewayId; + private String dataMoveId; + private String loginUserName; + private String fsRootLocation; + private String resourceCSToken; + + private GatewayProfileResource gatewayProfile; + + public String getLoginUserName() { + return loginUserName; + } + + public void setLoginUserName(String loginUserName) { + this.loginUserName = loginUserName; + } + + public String getGatewayId() { + return gatewayId; + } + + public void setGatewayId(String gatewayId) { + this.gatewayId = gatewayId; + } + + public GatewayProfileResource getGatewayProfile() { + return gatewayProfile; + } + + public void setGatewayProfile(GatewayProfileResource gatewayProfile) { + this.gatewayProfile = gatewayProfile; + } + + public String getResourceCSToken() { + return resourceCSToken; + } + + public void setResourceCSToken(String resourceCSToken) { + this.resourceCSToken = resourceCSToken; + } + + public String getDataMoveId() { + return dataMoveId; + } + + public void setDataMoveId(String dataMoveId) { + this.dataMoveId = dataMoveId; + } + + public String getFsRootLocation() { + return fsRootLocation; + } + + public void setFsRootLocation(String fsRootLocation) { + this.fsRootLocation = fsRootLocation; + } + + @Override + public void remove(Object identifier) throws AppCatalogException { + HashMap<String, String> ids; + if (identifier instanceof Map) { + ids = (HashMap) identifier; + } else { + logger.error("Identifier should be a map with the field name and it's value"); + throw new AppCatalogException("Identifier should be a map with the field name and it's value"); + } + + EntityManager em = null; + try { + em = AppCatalogJPAUtils.getEntityManager(); + em.getTransaction().begin(); + AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(DATA_STORAGE_PREFERENCE); + generator.setParameter(DataStoragePreferenceConstants.DATA_MOVEMENT_ID, ids.get(DataStoragePreferenceConstants.DATA_MOVEMENT_ID)); + generator.setParameter(DataStoragePreferenceConstants.GATEWAY_ID, ids.get(DataStoragePreferenceConstants.GATEWAY_ID)); + + Query q = generator.deleteQuery(em); + q.executeUpdate(); + em.getTransaction().commit(); + em.close(); + } catch (ApplicationSettingsException e) { + logger.error(e.getMessage(), e); + throw new AppCatalogException(e); + } finally { + if (em != null && em.isOpen()) { + if (em.getTransaction().isActive()) { + em.getTransaction().rollback(); + } + em.close(); + } + } + } + + @Override + public AppCatalogResource get(Object identifier) throws AppCatalogException { + HashMap<String, String> ids; + if (identifier instanceof Map) { + ids = (HashMap) identifier; + } else { + logger.error("Identifier should be a map with the field name and it's value"); + throw new AppCatalogException("Identifier should be a map with the field name and it's value"); + } + + EntityManager em = null; + try { + em = AppCatalogJPAUtils.getEntityManager(); + em.getTransaction().begin(); + AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(DATA_STORAGE_PREFERENCE); + generator.setParameter(DataStoragePreferenceConstants.GATEWAY_ID, ids.get(DataStoragePreferenceConstants.GATEWAY_ID)); + generator.setParameter(DataStoragePreferenceConstants.DATA_MOVEMENT_ID, ids.get(DataStoragePreferenceConstants.DATA_MOVEMENT_ID)); + Query q = generator.selectQuery(em); + DataStoragePreference preference = (DataStoragePreference) q.getSingleResult(); + DataStoragePreferenceResource preferenceResource = + (DataStoragePreferenceResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.DATA_STORAGE_PREFERENCE, preference); + em.getTransaction().commit(); + em.close(); + return preferenceResource; + } catch (ApplicationSettingsException e) { + logger.error(e.getMessage(), e); + throw new AppCatalogException(e); + } finally { + if (em != null && em.isOpen()) { + if (em.getTransaction().isActive()) { + em.getTransaction().rollback(); + } + em.close(); + } + } + } + + @Override + public List<AppCatalogResource> get(String fieldName, Object value) throws AppCatalogException { + List<AppCatalogResource> preferenceResourceList = new ArrayList<AppCatalogResource>(); + EntityManager em = null; + try { + em = AppCatalogJPAUtils.getEntityManager(); + em.getTransaction().begin(); + Query q; + AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(DATA_STORAGE_PREFERENCE); + List results; + if (fieldName.equals(DataStoragePreferenceConstants.DATA_MOVEMENT_ID)) { + generator.setParameter(DataStoragePreferenceConstants.DATA_MOVEMENT_ID, value); + q = generator.selectQuery(em); + results = q.getResultList(); + if (results.size() != 0) { + for (Object result : results) { + DataStoragePreference preference = (DataStoragePreference) result; + if (preference.getDataMovementID()!=null) { + DataStoragePreferenceResource preferenceResource = (DataStoragePreferenceResource) AppCatalogJPAUtils + .getResource( + AppCatalogResourceType.DATA_STORAGE_PREFERENCE, + preference); + preferenceResourceList.add(preferenceResource); + } + } + } + } else if (fieldName.equals(DataStoragePreferenceConstants.GATEWAY_ID)) { + generator.setParameter(DataStoragePreferenceConstants.GATEWAY_ID, value); + q = generator.selectQuery(em); + results = q.getResultList(); + if (results.size() != 0) { + for (Object result : results) { + DataStoragePreference preference = (DataStoragePreference) result; + if (preference.getDataMovementID()!=null) { + DataStoragePreferenceResource preferenceResource = + (DataStoragePreferenceResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.DATA_STORAGE_PREFERENCE, preference); + preferenceResourceList.add(preferenceResource); + } + } + } + } else { + em.getTransaction().commit(); + em.close(); + logger.error("Unsupported field name for data storage preference Resource.", new IllegalArgumentException()); + throw new IllegalArgumentException("Unsupported field name for data storage preference Resource."); + } + em.getTransaction().commit(); + em.close(); + } catch (Exception e) { + logger.error(e.getMessage(), e); + throw new AppCatalogException(e); + } finally { + if (em != null && em.isOpen()) { + if (em.getTransaction().isActive()) { + em.getTransaction().rollback(); + } + em.close(); + } + } + return preferenceResourceList; + } + + @Override + public List<AppCatalogResource> getAll() throws AppCatalogException { + return null; + } + + @Override + public List<String> getAllIds() throws AppCatalogException { + return null; + } + + @Override + public List<String> getIds(String fieldName, Object value) throws AppCatalogException { + logger.error("Unsupported for objects with a composite identifier"); + throw new AppCatalogException("Unsupported for objects with a composite identifier"); + } + + @Override + public void save() throws AppCatalogException { + EntityManager em = null; + try { + em = AppCatalogJPAUtils.getEntityManager(); + DataStoragePreference existingPreference = em.find(DataStoragePreference.class, new DataStoragePreferencePK(gatewayId, dataMoveId)); + em.close(); + + em = AppCatalogJPAUtils.getEntityManager(); + em.getTransaction().begin(); + DataMovementInterface dataMovementInterface = em.find(DataMovementInterface.class, dataMoveId); + GatewayProfile gatewayProf = em.find(GatewayProfile.class, gatewayId); + if (existingPreference != null) { + existingPreference.setDataMovementID(dataMoveId); + existingPreference.setGatewayId(gatewayId); + existingPreference.setGatewayProfile(gatewayProf); + existingPreference.setLoginUserName(loginUserName); + existingPreference.setComputeResourceCSToken(resourceCSToken); + existingPreference.setFsRootLocation(fsRootLocation); + em.merge(existingPreference); + } else { + DataStoragePreference resourcePreference = new DataStoragePreference(); + resourcePreference.setDataMovementID(dataMoveId); + resourcePreference.setGatewayId(gatewayId); + resourcePreference.setGatewayProfile(gatewayProf); + resourcePreference.setLoginUserName(loginUserName); + resourcePreference.setComputeResourceCSToken(resourceCSToken); + resourcePreference.setFsRootLocation(fsRootLocation); + em.persist(resourcePreference); + } + em.getTransaction().commit(); + em.close(); + } catch (Exception e) { + logger.error(e.getMessage(), e); + throw new AppCatalogException(e); + } finally { + if (em != null && em.isOpen()) { + if (em.getTransaction().isActive()) { + em.getTransaction().rollback(); + } + em.close(); + } + } + } + + @Override + public boolean isExists(Object identifier) throws AppCatalogException { + HashMap<String, String> ids; + if (identifier instanceof Map) { + ids = (HashMap) identifier; + } else { + logger.error("Identifier should be a map with the field name and it's value"); + throw new AppCatalogException("Identifier should be a map with the field name and it's value"); + } + + EntityManager em = null; + try { + em = AppCatalogJPAUtils.getEntityManager(); + DataStoragePreference existingPreference = em.find(DataStoragePreference.class, + new DataStoragePreferencePK(ids.get(DataStoragePreferenceConstants.GATEWAY_ID), + ids.get(DataStoragePreferenceConstants.DATA_MOVEMENT_ID))); + em.close(); + return existingPreference != null; + }catch (Exception e) { + logger.error(e.getMessage(), e); + throw new AppCatalogException(e); + } finally { + if (em != null && em.isOpen()) { + if (em.getTransaction().isActive()) { + em.getTransaction().rollback(); + } + em.close(); + } + } + } +} http://git-wip-us.apache.org/repos/asf/airavata/blob/d84783da/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/util/AppCatalogJPAUtils.java ---------------------------------------------------------------------- diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/util/AppCatalogJPAUtils.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/util/AppCatalogJPAUtils.java index 4ef21bd..a027ef4 100644 --- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/util/AppCatalogJPAUtils.java +++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/util/AppCatalogJPAUtils.java @@ -280,6 +280,13 @@ public class AppCatalogJPAUtils { logger.error("Object should be a Compute Resource Preference.", new IllegalArgumentException()); throw new IllegalArgumentException("Object should be a Compute Resource Preference."); } + case DATA_STORAGE_PREFERENCE: + if (o instanceof DataStoragePreference){ + return createDataStoragePref((DataStoragePreference) o); + }else { + logger.error("Object should be a data storage Preference.", new IllegalArgumentException()); + throw new IllegalArgumentException("Object should be a data storage Preference."); + } case APPLICATION_INPUT: if (o instanceof ApplicationIntInput){ return createApplicationInput((ApplicationIntInput) o); @@ -879,12 +886,26 @@ public class AppCatalogJPAUtils { resource.setScratchLocation(o.getScratchLocation()); resource.setProjectNumber(o.getProjectNumber()); resource.setLoginUserName(o.getLoginUserName()); + resource.setResourceCSToken(o.getComputeResourceCSToken()); resource.setComputeHostResource((ComputeResourceResource) createComputeResource(o.getComputeHostResource())); resource.setGatewayProfile((GatewayProfileResource) createGatewayProfile(o.getGatewayProfile())); } return resource; } + private static AppCatalogResource createDataStoragePref(DataStoragePreference o) { + DataStoragePreferenceResource resource = new DataStoragePreferenceResource(); + if (o != null) { + resource.setGatewayId(o.getGatewayId()); + resource.setDataMoveId(o.getDataMovementID()); + resource.setLoginUserName(o.getLoginUserName()); + resource.setResourceCSToken(o.getComputeResourceCSToken()); + resource.setFsRootLocation(o.getFsRootLocation()); + resource.setGatewayProfile((GatewayProfileResource) createGatewayProfile(o.getGatewayProfile())); + } + return resource; + } + private static AppCatalogResource createModuleLoadCmd(ModuleLoadCmd o) { ModuleLoadCmdResource moduleLoadCmdResource = new ModuleLoadCmdResource(); if (o != null){ http://git-wip-us.apache.org/repos/asf/airavata/blob/d84783da/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/util/AppCatalogResourceType.java ---------------------------------------------------------------------- diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/util/AppCatalogResourceType.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/util/AppCatalogResourceType.java index 96f020e..91f59ec 100644 --- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/util/AppCatalogResourceType.java +++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/util/AppCatalogResourceType.java @@ -50,6 +50,7 @@ public enum AppCatalogResourceType { APPLICATION_OUTPUT, GATEWAY_PROFILE, COMPUTE_RESOURCE_PREFERENCE, + DATA_STORAGE_PREFERENCE, BATCH_QUEUE, COMPUTE_RESOURCE_FILE_SYSTEM, JOB_SUBMISSION_INTERFACE, http://git-wip-us.apache.org/repos/asf/airavata/blob/d84783da/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/util/AppCatalogThriftConversion.java ---------------------------------------------------------------------- diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/util/AppCatalogThriftConversion.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/util/AppCatalogThriftConversion.java index 4b85765..58e9659 100644 --- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/util/AppCatalogThriftConversion.java +++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/util/AppCatalogThriftConversion.java @@ -37,6 +37,7 @@ import org.apache.airavata.model.appcatalog.computeresource.ResourceJobManager; import org.apache.airavata.model.appcatalog.computeresource.UnicoreDataMovement; import org.apache.airavata.model.appcatalog.computeresource.UnicoreJobSubmission; 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.DataType; import org.apache.airavata.model.application.io.InputDataObjectType; @@ -744,6 +745,7 @@ public class AppCatalogThriftConversion { preference.setScratchLocation(resource.getScratchLocation()); preference.setAllocationProjectNumber(resource.getProjectNumber()); preference.setLoginUserName(resource.getLoginUserName()); + preference.setResourceSpecificCredentialStoreToken(resource.getResourceCSToken()); return preference; } @@ -757,6 +759,25 @@ public class AppCatalogThriftConversion { return preferences; } + public static DataStoragePreference getDataStoragePreference (DataStoragePreferenceResource resource){ + DataStoragePreference preference = new DataStoragePreference(); + preference.setDataMovememtResourceId(resource.getDataMoveId()); + preference.setFileSystemRootLocation(resource.getFsRootLocation()); + preference.setLoginUserName(resource.getLoginUserName()); + preference.setResourceSpecificCredentialStoreToken(resource.getResourceCSToken()); + return preference; + } + + public static List<DataStoragePreference> getDataStoragePreferences (List<AppCatalogResource> resources){ + List<DataStoragePreference> preferences = new ArrayList<DataStoragePreference>(); + if (resources != null && !resources.isEmpty()){ + for (AppCatalogResource resource : resources){ + preferences.add(getDataStoragePreference((DataStoragePreferenceResource)resource)); + } + } + return preferences; + } + public static InputDataObjectType getWorkflowInput (WorkflowInputResource resource){ InputDataObjectType input = new InputDataObjectType(); input.setName(resource.getInputKey()); @@ -781,10 +802,11 @@ public class AppCatalogThriftConversion { return inputResources; } - public static GatewayResourceProfile getGatewayResourceProfile(GatewayProfileResource gw, List<ComputeResourcePreference> preferences){ + public static GatewayResourceProfile getGatewayResourceProfile(GatewayProfileResource gw, List<ComputeResourcePreference> preferences, List<DataStoragePreference> storagePreferences){ GatewayResourceProfile gatewayProfile = new GatewayResourceProfile(); gatewayProfile.setGatewayID(gw.getGatewayID()); gatewayProfile.setComputeResourcePreferences(preferences); + gatewayProfile.setDataStoragePreferences(storagePreferences); return gatewayProfile; } http://git-wip-us.apache.org/repos/asf/airavata/blob/d84783da/modules/registry/registry-core/src/main/resources/META-INF/persistence.xml ---------------------------------------------------------------------- diff --git a/modules/registry/registry-core/src/main/resources/META-INF/persistence.xml b/modules/registry/registry-core/src/main/resources/META-INF/persistence.xml index e9cc636..092ce1d 100644 --- a/modules/registry/registry-core/src/main/resources/META-INF/persistence.xml +++ b/modules/registry/registry-core/src/main/resources/META-INF/persistence.xml @@ -54,6 +54,7 @@ <class>org.apache.airavata.registry.core.app.catalog.model.ComputeResourceFileSystem</class> <class>org.apache.airavata.registry.core.app.catalog.model.JobSubmissionInterface</class> <class>org.apache.airavata.registry.core.app.catalog.model.DataMovementInterface</class> + <class>org.apache.airavata.registry.core.app.catalog.model.DataStoragePreference</class> <class>org.apache.airavata.registry.core.app.catalog.model.ResourceJobManager</class> <class>org.apache.airavata.registry.core.app.catalog.model.JobManagerCommand</class> <class>org.apache.airavata.registry.core.app.catalog.model.LocalSubmission</class> http://git-wip-us.apache.org/repos/asf/airavata/blob/d84783da/modules/registry/registry-core/src/main/resources/appcatalog-derby.sql ---------------------------------------------------------------------- diff --git a/modules/registry/registry-core/src/main/resources/appcatalog-derby.sql b/modules/registry/registry-core/src/main/resources/appcatalog-derby.sql index b3af3f7..f148e9c 100644 --- a/modules/registry/registry-core/src/main/resources/appcatalog-derby.sql +++ b/modules/registry/registry-core/src/main/resources/appcatalog-derby.sql @@ -332,6 +332,7 @@ CREATE TABLE COMPUTE_RESOURCE_PREFERENCE SCRATCH_LOCATION VARCHAR(255), ALLOCATION_PROJECT_NUMBER VARCHAR(255), LOGIN_USERNAME VARCHAR(255), + RESOURCE_CS_TOKEN VARCHAR(255), PRIMARY KEY(GATEWAY_ID,RESOURCE_ID), FOREIGN KEY (RESOURCE_ID) REFERENCES COMPUTE_RESOURCE(RESOURCE_ID) ON DELETE CASCADE, FOREIGN KEY (GATEWAY_ID) REFERENCES GATEWAY_PROFILE(GATEWAY_ID) ON DELETE CASCADE @@ -401,7 +402,18 @@ CREATE TABLE LOCAL_SUBMISSION UPDATE_TIME TIMESTAMP DEFAULT '0000-00-00 00:00:00', PRIMARY KEY (JOB_SUBMISSION_INTERFACE_ID), FOREIGN KEY (RESOURCE_JOB_MANAGER_ID) REFERENCES RESOURCE_JOB_MANAGER(RESOURCE_JOB_MANAGER_ID) - ); +); + +CREATE TABLE DATA_STORAGE_PREFERENCE +( + GATEWAY_ID VARCHAR(255), + DATA_MOVEMENT_ID VARCHAR(255), + LOGIN_USERNAME VARCHAR(255), + FS_ROOT_LOCATION VARCHAR(255), + RESOURCE_CS_TOKEN VARCHAR(255), + PRIMARY KEY(GATEWAY_ID,DATA_MOVEMENT_ID), + FOREIGN KEY (GATEWAY_ID) REFERENCES GATEWAY_PROFILE(GATEWAY_ID) ON DELETE CASCADE +); CREATE TABLE LOCAL_DATA_MOVEMENT ( http://git-wip-us.apache.org/repos/asf/airavata/blob/d84783da/modules/registry/registry-core/src/main/resources/appcatalog-mysql.sql ---------------------------------------------------------------------- diff --git a/modules/registry/registry-core/src/main/resources/appcatalog-mysql.sql b/modules/registry/registry-core/src/main/resources/appcatalog-mysql.sql index 5e869df..5cc5b8e 100644 --- a/modules/registry/registry-core/src/main/resources/appcatalog-mysql.sql +++ b/modules/registry/registry-core/src/main/resources/appcatalog-mysql.sql @@ -330,6 +330,7 @@ CREATE TABLE COMPUTE_RESOURCE_PREFERENCE SCRATCH_LOCATION VARCHAR(255), ALLOCATION_PROJECT_NUMBER VARCHAR(255), LOGIN_USERNAME VARCHAR(255), + RESOURCE_CS_TOKEN VARCHAR(255), PRIMARY KEY(GATEWAY_ID,RESOURCE_ID), FOREIGN KEY (RESOURCE_ID) REFERENCES COMPUTE_RESOURCE(RESOURCE_ID) ON DELETE CASCADE, FOREIGN KEY (GATEWAY_ID) REFERENCES GATEWAY_PROFILE(GATEWAY_ID) ON DELETE CASCADE @@ -407,6 +408,17 @@ CREATE TABLE LOCAL_DATA_MOVEMENT PRIMARY KEY (DATA_MOVEMENT_INTERFACE_ID) ); +CREATE TABLE DATA_STORAGE_PREFERENCE +( + GATEWAY_ID VARCHAR(255), + DATA_MOVEMENT_ID VARCHAR(255), + LOGIN_USERNAME VARCHAR(255), + FS_ROOT_LOCATION VARCHAR(255), + RESOURCE_CS_TOKEN VARCHAR(255), + PRIMARY KEY(GATEWAY_ID,DATA_MOVEMENT_ID), + FOREIGN KEY (GATEWAY_ID) REFERENCES GATEWAY_PROFILE(GATEWAY_ID) ON DELETE CASCADE +); + CREATE TABLE WORKFLOW ( WF_TEMPLATE_ID VARCHAR (255) NOT NULL, http://git-wip-us.apache.org/repos/asf/airavata/blob/d84783da/modules/registry/registry-core/src/test/resources/appcatalog-derby.sql ---------------------------------------------------------------------- diff --git a/modules/registry/registry-core/src/test/resources/appcatalog-derby.sql b/modules/registry/registry-core/src/test/resources/appcatalog-derby.sql index fc24d83..f148e9c 100644 --- a/modules/registry/registry-core/src/test/resources/appcatalog-derby.sql +++ b/modules/registry/registry-core/src/test/resources/appcatalog-derby.sql @@ -27,6 +27,7 @@ CREATE TABLE COMPUTE_RESOURCE CREATION_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP, UPDATE_TIME TIMESTAMP DEFAULT '0000-00-00 00:00:00', MAX_MEMORY_NODE INTEGER, + ENABLED SMALLINT, PRIMARY KEY (RESOURCE_ID) ); @@ -331,6 +332,7 @@ CREATE TABLE COMPUTE_RESOURCE_PREFERENCE SCRATCH_LOCATION VARCHAR(255), ALLOCATION_PROJECT_NUMBER VARCHAR(255), LOGIN_USERNAME VARCHAR(255), + RESOURCE_CS_TOKEN VARCHAR(255), PRIMARY KEY(GATEWAY_ID,RESOURCE_ID), FOREIGN KEY (RESOURCE_ID) REFERENCES COMPUTE_RESOURCE(RESOURCE_ID) ON DELETE CASCADE, FOREIGN KEY (GATEWAY_ID) REFERENCES GATEWAY_PROFILE(GATEWAY_ID) ON DELETE CASCADE @@ -400,7 +402,18 @@ CREATE TABLE LOCAL_SUBMISSION UPDATE_TIME TIMESTAMP DEFAULT '0000-00-00 00:00:00', PRIMARY KEY (JOB_SUBMISSION_INTERFACE_ID), FOREIGN KEY (RESOURCE_JOB_MANAGER_ID) REFERENCES RESOURCE_JOB_MANAGER(RESOURCE_JOB_MANAGER_ID) - ); +); + +CREATE TABLE DATA_STORAGE_PREFERENCE +( + GATEWAY_ID VARCHAR(255), + DATA_MOVEMENT_ID VARCHAR(255), + LOGIN_USERNAME VARCHAR(255), + FS_ROOT_LOCATION VARCHAR(255), + RESOURCE_CS_TOKEN VARCHAR(255), + PRIMARY KEY(GATEWAY_ID,DATA_MOVEMENT_ID), + FOREIGN KEY (GATEWAY_ID) REFERENCES GATEWAY_PROFILE(GATEWAY_ID) ON DELETE CASCADE +); CREATE TABLE LOCAL_DATA_MOVEMENT ( @@ -454,7 +467,7 @@ CREATE TABLE CONFIGURATION PRIMARY KEY(CONFIG_KEY, CONFIG_VAL) ); -INSERT INTO CONFIGURATION (CONFIG_KEY, CONFIG_VAL) VALUES('app_catalog_version', '0.15'); +INSERT INTO CONFIGURATION (CONFIG_KEY, CONFIG_VAL) VALUES('app_catalog_version', '0.16'); http://git-wip-us.apache.org/repos/asf/airavata/blob/d84783da/modules/registry/registry-cpi/src/main/java/org/apache/airavata/registry/cpi/GwyResourceProfile.java ---------------------------------------------------------------------- diff --git a/modules/registry/registry-cpi/src/main/java/org/apache/airavata/registry/cpi/GwyResourceProfile.java b/modules/registry/registry-cpi/src/main/java/org/apache/airavata/registry/cpi/GwyResourceProfile.java index 0988926..aeee0fc 100644 --- a/modules/registry/registry-cpi/src/main/java/org/apache/airavata/registry/cpi/GwyResourceProfile.java +++ b/modules/registry/registry-cpi/src/main/java/org/apache/airavata/registry/cpi/GwyResourceProfile.java @@ -20,6 +20,7 @@ package org.apache.airavata.registry.cpi; 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 java.util.List; @@ -53,6 +54,7 @@ public interface GwyResourceProfile { */ boolean removeGatewayResourceProfile(String gatewayId) throws AppCatalogException; boolean removeComputeResourcePreferenceFromGateway(String gatewayId, String preferenceId) throws AppCatalogException; + boolean removeDataStoragePreferenceFromGateway(String gatewayId, String preferenceId) throws AppCatalogException; /** * This method will check whether gateway profile exists @@ -68,6 +70,7 @@ public interface GwyResourceProfile { * @return ComputeResourcePreference */ ComputeResourcePreference getComputeResourcePreference (String gatewayId, String hostId) throws AppCatalogException; + DataStoragePreference getDataStoragePreference (String gatewayId, String dataMoveId) throws AppCatalogException; /** * @@ -75,6 +78,7 @@ public interface GwyResourceProfile { * @return */ List<ComputeResourcePreference> getAllComputeResourcePreferences (String gatewayId) throws AppCatalogException; + List<DataStoragePreference> getAllDataStoragePreferences (String gatewayId) throws AppCatalogException; List<String> getGatewayProfileIds (String gatewayName) throws AppCatalogException; List<GatewayResourceProfile> getAllGatewayProfiles () throws AppCatalogException; http://git-wip-us.apache.org/repos/asf/airavata/blob/d84783da/thrift-interface-descriptions/airavata-api/airavata_api.thrift ---------------------------------------------------------------------- diff --git a/thrift-interface-descriptions/airavata-api/airavata_api.thrift b/thrift-interface-descriptions/airavata-api/airavata_api.thrift index 5b64735..5da95cc 100644 --- a/thrift-interface-descriptions/airavata-api/airavata_api.thrift +++ b/thrift-interface-descriptions/airavata-api/airavata_api.thrift @@ -1994,6 +1994,13 @@ service Airavata { 3: airavata_errors.AiravataSystemException ase, 4: airavata_errors.AuthorizationException ae) + bool addGatewayDataStoragePreference(1: required security_model.AuthzToken authzToken, 2: required string gatewayID, + 3: required string dataMoveId, + 4: required gateway_resource_profile_model.DataStoragePreference dataStoragePreference) + throws (1: airavata_errors.InvalidRequestException ire, + 2: airavata_errors.AiravataClientException ace, + 3: airavata_errors.AiravataSystemException ase, + 4: airavata_errors.AuthorizationException ae) /** * Fetch a Compute Resource Preference of a registered gateway profile. * @@ -2015,6 +2022,14 @@ service Airavata { 3: airavata_errors.AiravataSystemException ase, 4: airavata_errors.AuthorizationException ae) + gateway_resource_profile_model.DataStoragePreference getGatewayDataStoragePreference(1: required security_model.AuthzToken authzToken, + 2: required string gatewayID, + 3: required string dataMoveId) + throws (1: airavata_errors.InvalidRequestException ire, + 2: airavata_errors.AiravataClientException ace, + 3: airavata_errors.AiravataSystemException ase, + 4: airavata_errors.AuthorizationException ae) + /** * Fetch all Compute Resource Preferences of a registered gateway profile. * @@ -2033,6 +2048,13 @@ service Airavata { 4: airavata_errors.AuthorizationException ae) + list<gateway_resource_profile_model.DataStoragePreference> + getAllGatewayDataStoragePreferences(1: required security_model.AuthzToken authzToken, 2: required string gatewayID) + throws (1: airavata_errors.InvalidRequestException ire, + 2: airavata_errors.AiravataClientException ace, + 3: airavata_errors.AiravataSystemException ase, + 4: airavata_errors.AuthorizationException ae) + /** * Fetch all gateway profiles registered **/ @@ -2067,6 +2089,14 @@ service Airavata { 3: airavata_errors.AiravataSystemException ase, 4: airavata_errors.AuthorizationException ae) + bool updateGatewayDataStoragePreference(1: required security_model.AuthzToken authzToken, 2: required string gatewayID, + 3: required string dataMoveId, + 4: required gateway_resource_profile_model.DataStoragePreference dataStoragePreference) + throws (1: airavata_errors.InvalidRequestException ire, + 2: airavata_errors.AiravataClientException ace, + 3: airavata_errors.AiravataSystemException ase, + 4: airavata_errors.AuthorizationException ae) + /** * Delete the Compute Resource Preference of a registered gateway profile. * @@ -2087,6 +2117,13 @@ service Airavata { 3: airavata_errors.AiravataSystemException ase, 4: airavata_errors.AuthorizationException ae) + bool deleteGatewayDataStoragePreference(1: required security_model.AuthzToken authzToken, 2: required string gatewayID, + 3: required string dataMoveId) + throws (1: airavata_errors.InvalidRequestException ire, + 2: airavata_errors.AiravataClientException ace, + 3: airavata_errors.AiravataSystemException ase, + 4: airavata_errors.AuthorizationException ae) + list<string> getAllWorkflows(1: required security_model.AuthzToken authzToken, 2: required string gatewayId) throws (1: airavata_errors.InvalidRequestException ire, 2: airavata_errors.AiravataClientException ace, http://git-wip-us.apache.org/repos/asf/airavata/blob/d84783da/thrift-interface-descriptions/airavata-api/gateway_resource_profile_model.thrift ---------------------------------------------------------------------- diff --git a/thrift-interface-descriptions/airavata-api/gateway_resource_profile_model.thrift b/thrift-interface-descriptions/airavata-api/gateway_resource_profile_model.thrift index bee5483..d22953f 100644 --- a/thrift-interface-descriptions/airavata-api/gateway_resource_profile_model.thrift +++ b/thrift-interface-descriptions/airavata-api/gateway_resource_profile_model.thrift @@ -75,7 +75,7 @@ struct DataStoragePreference { 1: required string dataMovememtResourceId, 2: optional string loginUserName, 3: optional string fileSystemRootLocation, - 3: optional string resourceSpecificCredentialStoreToken + 4: optional string resourceSpecificCredentialStoreToken } /**
