adding replica catalog related API methods
Project: http://git-wip-us.apache.org/repos/asf/airavata/repo Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/6c5645d3 Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/6c5645d3 Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/6c5645d3 Branch: refs/heads/develop Commit: 6c5645d3aad93e9b5185b950984c9fb5f9c278d2 Parents: d54afbd Author: scnakandala <[email protected]> Authored: Tue Mar 22 16:46:12 2016 -0400 Committer: scnakandala <[email protected]> Committed: Tue Mar 22 16:46:12 2016 -0400 ---------------------------------------------------------------------- .../server/handler/AiravataServerHandler.java | 60 + .../java/org/apache/airavata/api/Airavata.java | 40530 +++++++++-------- .../main/resources/lib/airavata/Airavata.cpp | 7297 +-- .../src/main/resources/lib/airavata/Airavata.h | 640 +- .../lib/airavata/Airavata_server.skeleton.cpp | 50 +- .../airavata/compute_resource_model_types.cpp | 50 +- .../lib/airavata/compute_resource_model_types.h | 18 +- .../resources/lib/Airavata/API/Airavata.php | 11050 +++-- .../Model/AppCatalog/ComputeResource/Types.php | 44 +- .../lib/apache/airavata/api/Airavata-remote | 21 + .../lib/apache/airavata/api/Airavata.py | 6107 +-- .../model/appcatalog/computeresource/ttypes.py | 34 +- .../client/samples/DataCatalogSample.java | 73 + .../computeresource/LOCALSubmission.java | 207 +- .../core/data/catalog/impl/DataCatalogImpl.java | 16 +- .../airavata/data/catalog/DataCatalogTest.java | 146 +- .../airavata/registry/cpi/DataCatalog.java | 1 + .../airavata-apis/airavata_api.thrift | 23 + 18 files changed, 37389 insertions(+), 28978 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/airavata/blob/6c5645d3/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 ed892c0..40877de 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 @@ -49,6 +49,8 @@ import org.apache.airavata.model.application.io.OutputDataObjectType; import org.apache.airavata.model.commons.airavata_commonsConstants; import org.apache.airavata.model.data.movement.DMType; import org.apache.airavata.model.data.movement.*; +import org.apache.airavata.model.data.product.DataProductModel; +import org.apache.airavata.model.data.product.DataReplicaLocationModel; import org.apache.airavata.model.error.*; import org.apache.airavata.model.experiment.*; import org.apache.airavata.model.job.JobModel; @@ -86,6 +88,7 @@ public class AiravataServerHandler implements Airavata.Iface { private ExperimentCatalog experimentCatalog; private AppCatalog appCatalog; private Publisher publisher; + private DataCatalog dataCatalog; private WorkflowCatalog workflowCatalog; private CredentialStoreService.Client csClient; @@ -4291,6 +4294,63 @@ public class AiravataServerHandler implements Airavata.Iface { return workflowCatalog; } + /** + * DataCatalog Related Methods + * @return + * @throws TException + * @throws ApplicationSettingsException + */ + @Override + @SecurityCheck + public String registerDataProduct(AuthzToken authzToken, DataProductModel dataProductModel) throws InvalidRequestException, + AiravataClientException, AiravataSystemException, AuthorizationException, TException { + try { + dataCatalog = RegistryFactory.getDataCatalog(); + String productUrl = dataCatalog.registerDataProduct(dataProductModel); + return productUrl; + } catch (Exception e) { + String msg = "Error in registering the data resource"+dataProductModel.getProductName()+"."; + logger.error(msg, e); + AiravataSystemException exception = new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR); + exception.setMessage(msg+" More info : " + e.getMessage()); + throw exception; + } + } + + @Override + @SecurityCheck + public DataProductModel getDataProduct(AuthzToken authzToken, String productUri) throws InvalidRequestException, + AiravataClientException, AiravataSystemException, AuthorizationException, TException { + try { + dataCatalog = RegistryFactory.getDataCatalog(); + DataProductModel dataProductModel = dataCatalog.getDataProduct(productUri); + return dataProductModel; + } catch (Exception e) { + String msg = "Error in retreiving the data product "+productUri+"."; + logger.error(msg, e); + AiravataSystemException exception = new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR); + exception.setMessage(msg+" More info : " + e.getMessage()); + throw exception; + } + } + + @Override + @SecurityCheck + public String registerReplicaLocation(AuthzToken authzToken, DataReplicaLocationModel replicaLocationModel) throws InvalidRequestException, + AiravataClientException, AiravataSystemException, AuthorizationException, TException { + try { + dataCatalog = RegistryFactory.getDataCatalog(); + String replicaId = dataCatalog.registerReplicaLocation(replicaLocationModel); + return replicaId; + } catch (Exception e) { + String msg = "Error in retreiving the data product "+replicaLocationModel.getReplicaName()+"."; + logger.error(msg, e); + AiravataSystemException exception = new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR); + exception.setMessage(msg+" More info : " + e.getMessage()); + throw exception; + } + } + private CredentialStoreService.Client getCredentialStoreServiceClient() throws TException, ApplicationSettingsException { final int serverPort = Integer.parseInt(ServerSettings.getCredentialStoreServerPort()); final String serverHost = ServerSettings.getCredentialStoreServerHost();
