You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by sh...@apache.org on 2015/06/04 22:36:47 UTC
[01/52] [abbrv] [partial] airavata git commit: registry refactoring
Repository: airavata
Updated Branches:
refs/heads/master b4ede9cbe -> 2835d09ef
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/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
new file mode 100644
index 0000000..88fbe29
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/impl/ExperimentCatalogImpl.java
@@ -0,0 +1,735 @@
+/*
+ *
+ * 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.experiment.catalog.impl;
+
+import org.apache.airavata.common.exception.ApplicationSettingsException;
+import org.apache.airavata.common.utils.ServerSettings;
+import org.apache.airavata.model.appcatalog.appinterface.OutputDataObjectType;
+import org.apache.airavata.model.workspace.Gateway;
+import org.apache.airavata.model.workspace.Project;
+import org.apache.airavata.model.workspace.experiment.*;
+import org.apache.airavata.registry.core.experiment.catalog.ExpCatResourceUtils;
+import org.apache.airavata.registry.core.experiment.catalog.resources.GatewayExperimentCatResource;
+import org.apache.airavata.registry.core.experiment.catalog.resources.UserExperimentCatResource;
+import org.apache.airavata.registry.cpi.*;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+public class ExperimentCatalogImpl implements ExperimentCatalog {
+ private GatewayExperimentCatResource gatewayResource;
+ private UserExperimentCatResource user;
+ private final static Logger logger = LoggerFactory.getLogger(ExperimentCatalogImpl.class);
+ private ExperimentRegistry experimentRegistry = null;
+ private ProjectRegistry projectRegistry = null;
+ private GatewayRegistry gatewayRegistry = null;
+
+ public ExperimentCatalogImpl() throws RegistryException{
+ try {
+ if (!ExpCatResourceUtils.isGatewayExist(ServerSettings.getDefaultUserGateway())){
+ gatewayResource = (GatewayExperimentCatResource) ExpCatResourceUtils.createGateway(ServerSettings.getDefaultUserGateway());
+ gatewayResource.setGatewayName(ServerSettings.getDefaultUserGateway());
+ gatewayResource.save();
+ }else {
+ gatewayResource = (GatewayExperimentCatResource) ExpCatResourceUtils.getGateway(ServerSettings.getDefaultUserGateway());
+ }
+
+ if (!ExpCatResourceUtils.isUserExist(ServerSettings.getDefaultUser())){
+ user = ExpCatResourceUtils.createUser(ServerSettings.getDefaultUser(), ServerSettings.getDefaultUserPassword());
+ user.save();
+ }else {
+ user = (UserExperimentCatResource) ExpCatResourceUtils.getUser(ServerSettings.getDefaultUser());
+ }
+ experimentRegistry = new ExperimentRegistry(gatewayResource, user);
+ projectRegistry = new ProjectRegistry(gatewayResource, user);
+ gatewayRegistry = new GatewayRegistry();
+ } catch (ApplicationSettingsException e) {
+ logger.error("Unable to read airavata server properties..", e);
+ throw new RegistryException("Unable to read airavata server properties..", e);
+ }
+ }
+
+ public ExperimentCatalogImpl(String gateway, String username, String password) throws RegistryException{
+ if (!ExpCatResourceUtils.isGatewayExist(gateway)){
+ gatewayResource = (GatewayExperimentCatResource) ExpCatResourceUtils.createGateway(gateway);
+ gatewayResource.save();
+ }else {
+ gatewayResource = (GatewayExperimentCatResource) ExpCatResourceUtils.getGateway(gateway);
+ }
+
+ if (!ExpCatResourceUtils.isUserExist(username)){
+ user = ExpCatResourceUtils.createUser(username, password);
+ user.save();
+ }else {
+ user = (UserExperimentCatResource) ExpCatResourceUtils.getUser(username);
+ }
+ experimentRegistry = new ExperimentRegistry(gatewayResource, user);
+ projectRegistry = new ProjectRegistry(gatewayResource, user);
+ }
+
+ /**
+ * This method is to add an object in to the registry
+ *
+ * @param dataType Data type is a predefined type which the programmer should choose according to the object he
+ * is going to save in to registry
+ * @param newObjectToAdd Object which contains the fields that need to be saved in to registry. This object is a
+ * thrift model object. In experiment case this object can be BasicMetadata, ConfigurationData
+ * etc
+ * @return return the identifier to identify the object
+ */
+ @Override
+ public Object add(ExpCatParentDataType dataType, Object newObjectToAdd, String gatewayId) throws RegistryException {
+ try {
+ switch (dataType) {
+ case PROJECT:
+ return projectRegistry.addProject((Project)newObjectToAdd, gatewayId);
+ case EXPERIMENT:
+ return experimentRegistry.addExperiment((Experiment) newObjectToAdd, gatewayId);
+ case GATEWAY:
+ return gatewayRegistry.addGateway((Gateway)newObjectToAdd);
+ default:
+ logger.error("Unsupported top level type..", new UnsupportedOperationException());
+ throw new UnsupportedOperationException();
+ }
+ } catch (Exception e) {
+ logger.error("Error while adding the resource " + dataType.toString(), new RegistryException(e));
+ throw new RegistryException("Error while adding the resource " + dataType.toString(), e);
+ }
+ }
+
+ /**
+ * This method is to add an object in to the registry
+ *
+ * @param dataType Data type is a predefined type which the programmer should choose according to the object he
+ * is going to save in to registry
+ * @param newObjectToAdd Object which contains the fields that need to be saved in to registry. This object is a
+ * thrift model object. In experiment case this object can be BasicMetadata, ConfigurationData
+ * etc
+ * @param dependentIdentifier Object which contains the identifier if the object that is going to add is not a top
+ * level object in the data model. If it is a top level object, programmer can pass it as
+ * null
+ */
+ @Override
+ public Object add(ExpCatChildDataType dataType, Object newObjectToAdd, Object dependentIdentifier) throws RegistryException {
+ try {
+ switch (dataType) {
+ case EXPERIMENT_CONFIGURATION_DATA:
+ return experimentRegistry.addUserConfigData((UserConfigurationData) newObjectToAdd, (String) dependentIdentifier);
+ case EXPERIMENT_OUTPUT:
+ return experimentRegistry.addExpOutputs((List<OutputDataObjectType>) newObjectToAdd, (String) dependentIdentifier);
+ case EXPERIMENT_STATUS:
+ return experimentRegistry.updateExperimentStatus((ExperimentStatus) newObjectToAdd, (String) dependentIdentifier);
+ case WORKFLOW_NODE_DETAIL:
+ return experimentRegistry.addWorkflowNodeDetails((WorkflowNodeDetails) newObjectToAdd, (String) dependentIdentifier);
+ case WORKFLOW_NODE_STATUS:
+ return experimentRegistry.addWorkflowNodeStatus((WorkflowNodeStatus) newObjectToAdd, (CompositeIdentifier) dependentIdentifier);
+ case NODE_OUTPUT:
+ return experimentRegistry.addNodeOutputs((List<OutputDataObjectType>) newObjectToAdd, (CompositeIdentifier) dependentIdentifier);
+ case TASK_DETAIL:
+ return experimentRegistry.addTaskDetails((TaskDetails) newObjectToAdd, (String) dependentIdentifier);
+ case APPLICATION_OUTPUT:
+ return experimentRegistry.addApplicationOutputs((List<OutputDataObjectType>) newObjectToAdd, (CompositeIdentifier) dependentIdentifier);
+ case TASK_STATUS:
+ return experimentRegistry.addTaskStatus((TaskStatus) newObjectToAdd, (CompositeIdentifier) dependentIdentifier);
+ case JOB_DETAIL:
+ return experimentRegistry.addJobDetails((JobDetails) newObjectToAdd, (CompositeIdentifier) dependentIdentifier);
+ case JOB_STATUS:
+ return experimentRegistry.addJobStatus((JobStatus) newObjectToAdd, (CompositeIdentifier) dependentIdentifier);
+ case APPLICATION_STATUS:
+ return experimentRegistry.addApplicationStatus((ApplicationStatus) newObjectToAdd, (CompositeIdentifier) dependentIdentifier);
+ case DATA_TRANSFER_DETAIL:
+ return experimentRegistry.addDataTransferDetails((DataTransferDetails) newObjectToAdd, (String) dependentIdentifier);
+ case TRANSFER_STATUS:
+ return experimentRegistry.addTransferStatus((TransferStatus) newObjectToAdd, (CompositeIdentifier) dependentIdentifier);
+ case COMPUTATIONAL_RESOURCE_SCHEDULING:
+ return experimentRegistry.addComputationalResourceScheduling((ComputationalResourceScheduling) newObjectToAdd, (CompositeIdentifier) dependentIdentifier);
+ case ADVANCE_OUTPUT_DATA_HANDLING:
+ return experimentRegistry.addOutputDataHandling((AdvancedOutputDataHandling) newObjectToAdd, (CompositeIdentifier) dependentIdentifier);
+ case ADVANCE_INPUT_DATA_HANDLING:
+ return experimentRegistry.addInputDataHandling((AdvancedInputDataHandling) newObjectToAdd, (CompositeIdentifier) dependentIdentifier);
+ case QOS_PARAM:
+ return experimentRegistry.addQosParams((QualityOfServiceParams) newObjectToAdd, (CompositeIdentifier) dependentIdentifier);
+ case ERROR_DETAIL:
+ return experimentRegistry.addErrorDetails((ErrorDetails) newObjectToAdd, dependentIdentifier);
+ default:
+ logger.error("Unsupported dependent data type...", new UnsupportedOperationException());
+ throw new UnsupportedOperationException();
+ }
+ } catch (Exception e) {
+ logger.error("Error while adding " + dataType.toString() , new RegistryException(e));
+ throw new RegistryException("Error while adding " + dataType.toString(), e);
+ }
+
+ }
+
+ /**
+ * This method is to update the whole object in registry
+ *
+ * @param dataType Data type is a predefined type which the programmer should choose according to the object he
+ * is going to save in to registry
+ * @param newObjectToUpdate Object which contains the fields that need to be updated in to registry. This object is a
+ * thrift model object. In experiment case this object can be BasicMetadata, ConfigurationData
+ * etc. CPI programmer can only fill necessary fields that need to be updated. He does not
+ * have to fill the whole object. He needs to only fill the mandatory fields and whatever the
+ * other fields that need to be updated.
+ */
+ @Override
+ public void update(ExperimentCatalogModelType dataType, Object newObjectToUpdate, Object identifier) throws RegistryException {
+ try {
+ switch (dataType) {
+ case PROJECT:
+ projectRegistry.updateProject((Project)newObjectToUpdate, (String)identifier);
+ break;
+ case GATEWAY:
+ gatewayRegistry.updateGateway((String)identifier, (Gateway)newObjectToUpdate);
+ break;
+ case EXPERIMENT:
+ experimentRegistry.updateExperiment((Experiment) newObjectToUpdate, (String) identifier);
+ break;
+ case EXPERIMENT_CONFIGURATION_DATA:
+ experimentRegistry.updateUserConfigData((UserConfigurationData) newObjectToUpdate, (String) identifier);
+ break;
+ case EXPERIMENT_OUTPUT:
+ experimentRegistry.updateExpOutputs((List<OutputDataObjectType>) newObjectToUpdate, (String) identifier);
+ break;
+ case EXPERIMENT_STATUS:
+ experimentRegistry.updateExperimentStatus((ExperimentStatus) newObjectToUpdate, (String) identifier);
+ break;
+ case WORKFLOW_NODE_DETAIL:
+ experimentRegistry.updateWorkflowNodeDetails((WorkflowNodeDetails) newObjectToUpdate, (String) identifier);
+ break;
+ case WORKFLOW_NODE_STATUS:
+ experimentRegistry.updateWorkflowNodeStatus((WorkflowNodeStatus) newObjectToUpdate, (String) identifier);
+ break;
+ case NODE_OUTPUT:
+ experimentRegistry.updateNodeOutputs((List<OutputDataObjectType>) newObjectToUpdate, (String) identifier);
+ break;
+ case TASK_DETAIL:
+ experimentRegistry.updateTaskDetails((TaskDetails) newObjectToUpdate, (String) identifier);
+ break;
+ case APPLICATION_OUTPUT:
+ experimentRegistry.updateAppOutputs((List<OutputDataObjectType>) newObjectToUpdate, (String) identifier);
+ break;
+ case TASK_STATUS:
+ experimentRegistry.updateTaskStatus((TaskStatus) newObjectToUpdate, (String) identifier);
+ break;
+ case JOB_DETAIL:
+ experimentRegistry.updateJobDetails((JobDetails) newObjectToUpdate, (CompositeIdentifier) identifier);
+ break;
+ case JOB_STATUS:
+ experimentRegistry.updateJobStatus((JobStatus) newObjectToUpdate, (CompositeIdentifier) identifier);
+ break;
+ case APPLICATION_STATUS:
+ experimentRegistry.updateApplicationStatus((ApplicationStatus) newObjectToUpdate, (String) identifier);
+ break;
+ case DATA_TRANSFER_DETAIL:
+ experimentRegistry.updateDataTransferDetails((DataTransferDetails) newObjectToUpdate, (String) identifier);
+ break;
+ case TRANSFER_STATUS:
+ experimentRegistry.updateTransferStatus((TransferStatus) newObjectToUpdate, (String) identifier);
+ break;
+ case COMPUTATIONAL_RESOURCE_SCHEDULING:
+ experimentRegistry.updateScheduling((ComputationalResourceScheduling) newObjectToUpdate, (String) identifier, dataType.toString());
+ break;
+ case ADVANCE_INPUT_DATA_HANDLING:
+ experimentRegistry.updateInputDataHandling((AdvancedInputDataHandling) newObjectToUpdate, (String) identifier, dataType.toString());
+ break;
+ case ADVANCE_OUTPUT_DATA_HANDLING:
+ experimentRegistry.updateOutputDataHandling((AdvancedOutputDataHandling) newObjectToUpdate, (String) identifier, dataType.toString());
+ break;
+ case QOS_PARAM:
+ experimentRegistry.updateQOSParams((QualityOfServiceParams) newObjectToUpdate, (String) identifier, dataType.toString());
+ break;
+ default:
+ logger.error("Unsupported data type...", new UnsupportedOperationException());
+ throw new UnsupportedOperationException();
+ }
+ } catch (Exception e) {
+ logger.error("Error while updating the resource " + dataType.toString(), new RegistryException(e));
+ throw new RegistryException("Error while updating the resource.." + dataType.toString(), e);
+ }
+
+ }
+
+ /**
+ * This method is to update a specific field of the data model
+ *
+ * @param dataType Data type is a predefined type which the programmer should choose according to the object he
+ * is going to save in to registry
+ * @param identifier Identifier which will uniquely identify the data model. For example, in Experiment_Basic_Type,
+ * identifier will be generated experimentID
+ * @param fieldName Field which need to be updated in the registry. In Experiment_Basic_Type, if you want to update the
+ * description, field will be "description". Field names are defined in
+ * org.apache.airavata.registry.cpi.utils.Constants
+ * @param value Value by which the given field need to be updated. If the field is "description", that field will be
+ * updated by given value
+ */
+ @Override
+ public void update(ExperimentCatalogModelType dataType, Object identifier, String fieldName, Object value) throws RegistryException {
+ try {
+ switch (dataType) {
+ case EXPERIMENT:
+ experimentRegistry.updateExperimentField((String) identifier, fieldName, value);
+ break;
+ case EXPERIMENT_CONFIGURATION_DATA:
+ experimentRegistry.updateExpConfigDataField((String) identifier, fieldName, value);
+ break;
+ default:
+ logger.error("Unsupported data type...", new UnsupportedOperationException());
+ throw new UnsupportedOperationException();
+ }
+ } catch (Exception e) {
+ logger.error("Error while updating the resource " + dataType.toString(), new RegistryException(e));
+ throw new RegistryException("Error while updating the resource " + dataType.toString(), e);
+ }
+
+ }
+
+ /**
+ * This method is to retrieve object according to the identifier. In the experiment basic data type, if you give the
+ * experiment id, this method will return the BasicMetadata object
+ *
+ * @param dataType Data type is a predefined type which the programmer should choose according to the object he
+ * is going to save in to registry
+ * @param identifier Identifier which will uniquely identify the data model. For example, in Experiment_Basic_Type,
+ * identifier will be generated experimentID
+ * @return object according to the given identifier.
+ */
+ @Override
+ public Object get(ExperimentCatalogModelType dataType, Object identifier) throws RegistryException {
+ try {
+ switch (dataType) {
+ case PROJECT:
+ return projectRegistry.getProject((String)identifier);
+ case GATEWAY:
+ return gatewayRegistry.getGateway((String)identifier);
+ case EXPERIMENT:
+ return experimentRegistry.getExperiment((String) identifier, null);
+ case EXPERIMENT_CONFIGURATION_DATA:
+ return experimentRegistry.getConfigData((String) identifier, null);
+ case EXPERIMENT_OUTPUT:
+ return experimentRegistry.getExperimentOutputs((String) identifier);
+ case EXPERIMENT_STATUS:
+ return experimentRegistry.getExperimentStatus((String) identifier);
+ case WORKFLOW_NODE_DETAIL:
+ return experimentRegistry.getWorkflowNodeDetails((String) identifier);
+ case WORKFLOW_NODE_STATUS:
+ return experimentRegistry.getWorkflowNodeStatus((String) identifier);
+ case NODE_OUTPUT:
+ return experimentRegistry.getNodeOutputs((String) identifier);
+ case TASK_DETAIL:
+ return experimentRegistry.getTaskDetails((String) identifier);
+ case APPLICATION_OUTPUT:
+ return experimentRegistry.getApplicationOutputs((String) identifier);
+ case TASK_STATUS:
+ return experimentRegistry.getTaskStatus((String) identifier);
+ case JOB_DETAIL:
+ return experimentRegistry.getJobDetails((CompositeIdentifier) identifier);
+ case JOB_STATUS:
+ return experimentRegistry.getJobStatus((CompositeIdentifier) identifier);
+ case APPLICATION_STATUS:
+ return experimentRegistry.getApplicationStatus((CompositeIdentifier) identifier);
+ case DATA_TRANSFER_DETAIL:
+ return experimentRegistry.getDataTransferDetails((String) identifier);
+ case TRANSFER_STATUS:
+ return experimentRegistry.getDataTransferStatus((String) identifier);
+ case COMPUTATIONAL_RESOURCE_SCHEDULING:
+ return experimentRegistry.getComputationalScheduling(dataType, (String) identifier);
+ case ADVANCE_INPUT_DATA_HANDLING:
+ return experimentRegistry.getInputDataHandling(dataType, (String) identifier);
+ case ADVANCE_OUTPUT_DATA_HANDLING:
+ return experimentRegistry.getOutputDataHandling(dataType, (String) identifier);
+ case QOS_PARAM:
+ return experimentRegistry.getQosParams(dataType, (String) identifier);
+ default:
+ logger.error("Unsupported data type...", new UnsupportedOperationException());
+ throw new UnsupportedOperationException();
+ }
+ } catch (Exception e) {
+ logger.error("Error while retrieving the resource " + dataType.toString(), new RegistryException(e));
+ throw new RegistryException("Error while retrieving the resource " + dataType.toString() , e);
+ }
+ }
+
+ /**
+ * This method is to retrieve list of objects according to a given criteria
+ *
+ * @param dataType Data type is a predefined type which the programmer should choose according to the object he
+ * is going to save in to registry
+ * @param fieldName FieldName is the field that filtering should be done. For example, if we want to retrieve all
+ * the experiments for a given user, filterBy will be "userName"
+ * @param value value for the filtering field. In the experiment case, value for "userName" can be "admin"
+ * @return List of objects according to the given criteria
+ */
+ @Override
+ public List<Object> get(ExperimentCatalogModelType dataType, String fieldName, Object value) throws RegistryException {
+ try {
+ List<Object> result = new ArrayList<Object>();
+ switch (dataType) {
+ case PROJECT:
+ List<Project> projectList = projectRegistry.getProjectList(fieldName, value);
+ for (Project project : projectList ){
+ result.add(project);
+ }
+ return result;
+ case GATEWAY:
+ List<Gateway> allGateways = gatewayRegistry.getAllGateways();
+ for (Gateway gateway : allGateways){
+ result.add(gateway);
+ }
+ return result;
+ case EXPERIMENT:
+ List<Experiment> experimentList = experimentRegistry.getExperimentList(fieldName, value);
+ for (Experiment experiment : experimentList) {
+ result.add(experiment);
+ }
+ return result;
+ case WORKFLOW_NODE_DETAIL:
+ List<WorkflowNodeDetails> wfNodeDetails = experimentRegistry.getWFNodeDetails(fieldName, value);
+ for (WorkflowNodeDetails wf : wfNodeDetails) {
+ result.add(wf);
+ }
+ return result;
+ case WORKFLOW_NODE_STATUS:
+ List<WorkflowNodeStatus> wfNodeStatusList = experimentRegistry.getWFNodeStatusList(fieldName, value);
+ for (WorkflowNodeStatus wfs : wfNodeStatusList) {
+ result.add(wfs);
+ }
+ return result;
+ case TASK_DETAIL:
+ List<TaskDetails> taskDetails = experimentRegistry.getTaskDetails(fieldName, value);
+ for (TaskDetails task : taskDetails) {
+ result.add(task);
+ }
+ return result;
+ case JOB_DETAIL:
+ List<JobDetails> jobDetails = experimentRegistry.getJobDetails(fieldName, value);
+ for (JobDetails job : jobDetails) {
+ result.add(job);
+ }
+ return result;
+ case DATA_TRANSFER_DETAIL:
+ List<DataTransferDetails> dataTransferDetails = experimentRegistry.getDataTransferDetails(fieldName, value);
+ for (DataTransferDetails transferDetails : dataTransferDetails) {
+ result.add(transferDetails);
+ }
+ return result;
+ case ERROR_DETAIL:
+ List<ErrorDetails> errorDetails = experimentRegistry.getErrorDetails(fieldName, value);
+ for (ErrorDetails error : errorDetails) {
+ result.add(error);
+ }
+ return result;
+ default:
+ logger.error("Unsupported data type...", new UnsupportedOperationException());
+ throw new UnsupportedOperationException();
+ }
+ } catch (Exception e) {
+ logger.error("Error while retrieving the resource " + dataType.toString(), new RegistryException(e));
+ throw new RegistryException("Error while retrieving the resource " + dataType.toString(), e);
+ }
+
+ }
+
+ /**
+ * This method is to retrieve list of objects according to a given criteria with pagination and ordering
+ *
+ * @param dataType Data type is a predefined type which the programmer should choose according to the object he
+ * is going to save in to registry
+ * @param fieldName FieldName is the field that filtering should be done. For example, if we want to retrieve all
+ * the experiments for a given user, filterBy will be "userName"
+ * @param value value for the filtering field. In the experiment case, value for "userName" can be "admin"
+ * @param limit Size of the results to be returned
+ * @param offset Start position of the results to be retrieved
+ * @param orderByIdentifier Named of the column in which the ordering is based
+ * @param resultOrderType Type of ordering i.e ASC or DESC
+ * @return
+ * @throws RegistryException
+ */
+ @Override
+ public List<Object> get(ExperimentCatalogModelType dataType, String fieldName, Object value, int limit,
+ int offset, Object orderByIdentifier, ResultOrderType resultOrderType) throws RegistryException {
+ try {
+ List<Object> result = new ArrayList<Object>();
+ switch (dataType) {
+ case PROJECT:
+ List<Project> projectList = projectRegistry
+ .getProjectList(fieldName, value, limit, offset, orderByIdentifier, resultOrderType);
+ for (Project project : projectList ){
+ result.add(project);
+ }
+ return result;
+ case EXPERIMENT:
+ List<Experiment> experimentList = experimentRegistry.getExperimentList(fieldName, value,
+ limit, offset, orderByIdentifier, resultOrderType);
+ for (Experiment experiment : experimentList) {
+ result.add(experiment);
+ }
+ return result;
+ default:
+ logger.error("Unsupported data type...", new UnsupportedOperationException());
+ throw new UnsupportedOperationException();
+ }
+ } catch (Exception e) {
+ logger.error("Error while retrieving the resource " + dataType.toString(), new RegistryException(e));
+ throw new RegistryException("Error while retrieving the resource " + dataType.toString(), e);
+ }
+ }
+
+ /**
+ * This method is to retrieve list of objects according to a given criteria
+ * @param dataType Data type is a predefined type which the programmer should choose according to the object he
+ * is going to save in to registry
+ * @param filters filters is a map of field name and value that you need to use for search filtration
+ * @return List of objects according to the given criteria
+ */
+ @Override
+ public List<Object> search(ExperimentCatalogModelType dataType, Map<String, String> filters) throws RegistryException {
+ return search(dataType, filters, -1, -1, null, null);
+ }
+
+ /**
+ * This method is to retrieve list of objects with pagination according to a given criteria sorted
+ * according by the specified identified and specified ordering (i.e either ASC or DESC)
+ * @param dataType Data type is a predefined type which the programmer should choose according to the object he
+ * is going to save in to registry
+ * @param filters filters is a map of field name and value that you need to use for search filtration
+ * @param limit amount of the results to be returned
+ * @param offset offset of the results from the sorted list to be fetched from
+ * @param orderByIdentifier identifier (i.e the column) which will be used as the basis to sort the results
+ * @param resultOrderType The type of ordering (i.e ASC or DESC) that has to be used when retrieving the results
+ * @return List of objects according to the given criteria
+ */
+ @Override
+ public List<Object> search(ExperimentCatalogModelType dataType, Map<String, String> filters, int limit,
+ int offset, Object orderByIdentifier, ResultOrderType resultOrderType) throws RegistryException {
+ try {
+ List<Object> result = new ArrayList<Object>();
+ switch (dataType) {
+ case PROJECT:
+ List<Project> projectList
+ = projectRegistry.searchProjects(filters, limit, offset,
+ orderByIdentifier, resultOrderType);
+ for (Project project : projectList ){
+ result.add(project);
+ }
+ return result;
+ case EXPERIMENT:
+ List<ExperimentSummary> experimentSummaries = experimentRegistry
+ .searchExperiments(filters, limit, offset, orderByIdentifier,
+ resultOrderType);
+ for (ExperimentSummary ex : experimentSummaries){
+ result.add(ex);
+ }
+ return result;
+ default:
+ logger.error("Unsupported data type...", new UnsupportedOperationException());
+ throw new UnsupportedOperationException();
+ }
+ } catch (Exception e) {
+ logger.error("Error while retrieving the resource " + dataType.toString(), new RegistryException(e));
+ throw new RegistryException("Error while retrieving the resource " + dataType.toString(), e);
+ }
+ }
+
+ /**
+ * This method is to retrieve a specific value for a given field.
+ *
+ * @param dataType Data type is a predefined type which the programmer should choose according to the object he
+ * is going to save in to registry
+ * @param identifier Identifier which will uniquely identify the data model. For example, in Experiment_Basic_Type,
+ * identifier will be generated experimentID
+ * @param field field that filtering should be done. For example, if we want to execution user for a given
+ * experiment, field will be "userName"
+ * @return return the value for the specific field where data model is identified by the unique identifier that has
+ * given
+ */
+ @Override
+ public Object getValue(ExperimentCatalogModelType dataType, Object identifier, String field) throws RegistryException {
+ try {
+ switch (dataType) {
+ case EXPERIMENT:
+ return experimentRegistry.getExperiment((String) identifier, field);
+ case EXPERIMENT_CONFIGURATION_DATA:
+ return experimentRegistry.getConfigData((String) identifier, field);
+ default:
+ logger.error("Unsupported data type...", new UnsupportedOperationException());
+ throw new UnsupportedOperationException();
+ }
+ } catch (Exception e) {
+ logger.error("Error while retrieving the resource " + dataType.toString(), new RegistryException(e));
+ throw new RegistryException("Error while retrieving the resource " + dataType.toString(), e);
+ }
+
+ }
+
+ /**
+ * This method is to retrieve all the identifiers according to given filtering criteria. For an example, if you want
+ * to get all the experiment ids for a given gateway, your field name will be "gateway" and the value will be the
+ * name of the gateway ("default"). Similar manner you can retrieve all the experiment ids for a given user.
+ *
+ * @param dataType Data type is a predefined type which the programmer should choose according to the object he
+ * is going to save in to registry
+ * @param fieldName FieldName is the field that filtering should be done. For example, if we want to retrieve all
+ * the experiments for a given user, filterBy will be "userName"
+ * @param value value for the filtering field. In the experiment case, value for "userName" can be "admin"
+ * @return id list according to the filtering criteria
+ */
+ @Override
+ public List<String> getIds(ExperimentCatalogModelType dataType, String fieldName, Object value) throws RegistryException {
+ try {
+ switch (dataType) {
+ case PROJECT:
+ return projectRegistry.getProjectIDs(fieldName, value);
+ case EXPERIMENT:
+ return experimentRegistry.getExperimentIDs(fieldName, value);
+ case EXPERIMENT_CONFIGURATION_DATA:
+ return experimentRegistry.getExperimentIDs(fieldName, value);
+ case WORKFLOW_NODE_DETAIL:
+ return experimentRegistry.getWorkflowNodeIds(fieldName, value);
+ case TASK_DETAIL:
+ return experimentRegistry.getTaskDetailIds(fieldName, value);
+ case JOB_DETAIL:
+ return experimentRegistry.getJobDetailIds(fieldName, value);
+ case DATA_TRANSFER_DETAIL:
+ return experimentRegistry.getTransferDetailIds(fieldName, value);
+ default:
+ logger.error("Unsupported data type...", new UnsupportedOperationException());
+ throw new UnsupportedOperationException();
+ }
+ } catch (Exception e) {
+ logger.error("Error while retrieving the ids for" + dataType.toString(), new RegistryException(e));
+ throw new RegistryException("Error while retrieving the ids for " + dataType.toString(), e);
+ }
+
+ }
+
+ /**
+ * This method is to remove a item from the registry
+ *
+ * @param dataType Data type is a predefined type which the programmer should choose according to the object he
+ * is going to save in to registry
+ * @param identifier Identifier which will uniquely identify the data model. For example, in Experiment_Basic_Type,
+ * identifier will be generated experimentID
+ */
+ @Override
+ public void remove(ExperimentCatalogModelType dataType, Object identifier) throws RegistryException {
+ try {
+ switch (dataType) {
+ case PROJECT:
+ projectRegistry.removeProject((String)identifier);
+ break;
+ case GATEWAY:
+ gatewayRegistry.removeGateway((String)identifier);
+ break;
+ case EXPERIMENT:
+ experimentRegistry.removeExperiment((String) identifier);
+ break;
+ case EXPERIMENT_CONFIGURATION_DATA:
+ experimentRegistry.removeExperimentConfigData((String) identifier);
+ break;
+ case WORKFLOW_NODE_DETAIL:
+ experimentRegistry.removeWorkflowNode((String) identifier);
+ break;
+ case TASK_DETAIL:
+ experimentRegistry.removeTaskDetails((String) identifier);
+ break;
+ case JOB_DETAIL:
+ experimentRegistry.removeJobDetails((CompositeIdentifier) identifier);
+ break;
+ case DATA_TRANSFER_DETAIL:
+ experimentRegistry.removeDataTransferDetails((String) identifier);
+ break;
+ case COMPUTATIONAL_RESOURCE_SCHEDULING:
+ experimentRegistry.removeComputationalScheduling(dataType, (String) identifier);
+ break;
+ case ADVANCE_OUTPUT_DATA_HANDLING:
+ experimentRegistry.removeOutputDataHandling(dataType, (String) identifier);
+ break;
+ case ADVANCE_INPUT_DATA_HANDLING:
+ experimentRegistry.removeInputDataHandling(dataType, (String) identifier);
+ break;
+ case QOS_PARAM:
+ experimentRegistry.removeQOSParams(dataType, (String) identifier);
+ break;
+ default:
+ logger.error("Unsupported data type...", new UnsupportedOperationException());
+ throw new UnsupportedOperationException();
+ }
+ } catch (Exception e) {
+ logger.error("Error while removing the resource " + dataType.toString(), new RegistryException(e));
+ throw new RegistryException("Error while removing the resource " + dataType.toString(), e);
+ }
+
+ }
+
+ /**
+ * This method will check whether a given data type which can be identified with the identifier exists or not
+ *
+ * @param dataType Data type is a predefined type which the programmer should choose according to the object he
+ * is going to save in to registry
+ * @param identifier Identifier which will uniquely identify the data model. For example, in Experiment_Basic_Type,
+ * identifier will be generated experimentID
+ * @return whether the given data type exists or not
+ */
+ @Override
+ public boolean isExist(ExperimentCatalogModelType dataType, Object identifier) throws RegistryException {
+ try {
+ switch (dataType) {
+ case PROJECT:
+ return projectRegistry.isProjectExist((String)identifier);
+ case GATEWAY:
+ return gatewayRegistry.isGatewayExist((String)identifier);
+ case EXPERIMENT:
+ return experimentRegistry.isExperimentExist((String) identifier);
+ case EXPERIMENT_CONFIGURATION_DATA:
+ return experimentRegistry.isExperimentConfigDataExist((String) identifier);
+ case WORKFLOW_NODE_DETAIL:
+ return experimentRegistry.isWFNodeExist((String) identifier);
+ case TASK_DETAIL:
+ return experimentRegistry.isTaskDetailExist((String) identifier);
+ case JOB_DETAIL:
+ return experimentRegistry.isJobDetailExist((CompositeIdentifier) identifier);
+ case DATA_TRANSFER_DETAIL:
+ return experimentRegistry.isTransferDetailExist((String) identifier);
+ case COMPUTATIONAL_RESOURCE_SCHEDULING:
+ return experimentRegistry.isComputationalSchedulingExist(dataType, (String) identifier);
+ case ADVANCE_INPUT_DATA_HANDLING:
+ return experimentRegistry.isInputDataHandlingExist(dataType, (String) identifier);
+ case ADVANCE_OUTPUT_DATA_HANDLING:
+ return experimentRegistry.isOutputDataHandlingExist(dataType, (String) identifier);
+ case QOS_PARAM:
+ return experimentRegistry.isQOSParamsExist(dataType, (String) identifier);
+ default:
+ logger.error("Unsupported data type...", new UnsupportedOperationException());
+ throw new UnsupportedOperationException();
+ }
+ } catch (Exception e) {
+ logger.error("Error while checking existence of the resource " + dataType.toString(), new RegistryException(e));
+ throw new RegistryException("Error while checking existence of the resource " + dataType.toString(), e);
+ }
+ }
+
+}
[46/52] [abbrv] [partial] airavata git commit: registry refactoring
Posted by sh...@apache.org.
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/PostJobCommand.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/PostJobCommand.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/PostJobCommand.java
deleted file mode 100644
index 6b1a052..0000000
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/PostJobCommand.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- *
- * 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.aiaravata.application.catalog.data.model;
-
-import java.io.Serializable;
-
-import javax.persistence.CascadeType;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.Id;
-import javax.persistence.IdClass;
-import javax.persistence.JoinColumn;
-import javax.persistence.ManyToOne;
-import javax.persistence.Table;
-
-@Entity
-@Table(name = "POSTJOB_COMMAND")
-@IdClass(PostJobCommandPK.class)
-public class PostJobCommand implements Serializable {
- @Id
- @Column(name = "APPDEPLOYMENT_ID")
- private String deploymentId;
- @Id
- @Column(name = "COMMAND")
- private String command;
-
- @ManyToOne(cascade= CascadeType.MERGE)
- @JoinColumn(name = "APPDEPLOYMENT_ID")
- private ApplicationDeployment deployment;
-
- public String getDeploymentId() {
- return deploymentId;
- }
-
- public void setDeploymentId(String deploymentId) {
- this.deploymentId = deploymentId;
- }
-
- public String getCommand() {
- return command;
- }
-
- public void setCommand(String command) {
- this.command = command;
- }
-
- public ApplicationDeployment getDeployment() {
- return deployment;
- }
-
- public void setDeployment(ApplicationDeployment deployment) {
- this.deployment = deployment;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/PostJobCommandPK.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/PostJobCommandPK.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/PostJobCommandPK.java
deleted file mode 100644
index 907415e..0000000
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/PostJobCommandPK.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- *
- * 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.aiaravata.application.catalog.data.model;
-
-import java.io.Serializable;
-
-public class PostJobCommandPK implements Serializable {
- private String deploymentId;
- private String command;
-
- public PostJobCommandPK(String submissionID, String command) {
- this.deploymentId = submissionID;
- this.command = command;
- }
-
- public PostJobCommandPK() {
- ;
- }
-
- @Override
- public boolean equals(Object o) {
- return false;
- }
-
- @Override
- public int hashCode() {
- return 1;
- }
-
- public String getDeploymentId() {
- return deploymentId;
- }
-
- public void setDeploymentId(String deploymentId) {
- this.deploymentId = deploymentId;
- }
-
- public String getCommand() {
- return command;
- }
-
- public void setCommand(String command) {
- this.command = command;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/PreJobCommand.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/PreJobCommand.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/PreJobCommand.java
deleted file mode 100644
index 02e8a65..0000000
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/PreJobCommand.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- *
- * 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.aiaravata.application.catalog.data.model;
-
-import java.io.Serializable;
-
-import javax.persistence.CascadeType;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.Id;
-import javax.persistence.IdClass;
-import javax.persistence.JoinColumn;
-import javax.persistence.ManyToOne;
-import javax.persistence.Table;
-
-@Entity
-@Table(name = "PREJOB_COMMAND")
-@IdClass(PreJobCommandPK.class)
-public class PreJobCommand implements Serializable {
- @Id
- @Column(name = "APPDEPLOYMENT_ID")
- private String deploymentId;
- @Id
- @Column(name = "COMMAND")
- private String command;
-
- @ManyToOne(cascade= CascadeType.MERGE)
- @JoinColumn(name = "APPDEPLOYMENT_ID")
- private ApplicationDeployment applicationDeployment;
-
- public String getDeploymentId() {
- return deploymentId;
- }
-
- public void setDeploymentId(String deploymentId) {
- this.deploymentId = deploymentId;
- }
-
- public String getCommand() {
- return command;
- }
-
- public void setCommand(String command) {
- this.command = command;
- }
-
- public ApplicationDeployment getApplicationDeployment() {
- return applicationDeployment;
- }
-
- public void setApplicationDeployment(ApplicationDeployment applicationDeployment) {
- this.applicationDeployment = applicationDeployment;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/PreJobCommandPK.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/PreJobCommandPK.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/PreJobCommandPK.java
deleted file mode 100644
index 9382335..0000000
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/PreJobCommandPK.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- *
- * 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.aiaravata.application.catalog.data.model;
-
-import java.io.Serializable;
-
-public class PreJobCommandPK implements Serializable {
- private String deploymentId;
- private String command;
-
- public PreJobCommandPK(String deploymentId, String command) {
- this.deploymentId = deploymentId;
- this.command = command;
- }
-
- public PreJobCommandPK() {
- ;
- }
-
- @Override
- public boolean equals(Object o) {
- return false;
- }
-
- @Override
- public int hashCode() {
- return 1;
- }
-
- public String getDeploymentId() {
- return deploymentId;
- }
-
- public void setDeploymentId(String deploymentId) {
- this.deploymentId = deploymentId;
- }
-
- public String getCommand() {
- return command;
- }
-
- public void setCommand(String command) {
- this.command = command;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/ResourceJobManager.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/ResourceJobManager.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/ResourceJobManager.java
deleted file mode 100644
index 65b0f3c..0000000
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/ResourceJobManager.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- *
- * 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.aiaravata.application.catalog.data.model;
-
-import java.io.Serializable;
-import java.sql.Timestamp;
-
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.Id;
-import javax.persistence.Table;
-
-import org.apache.openjpa.persistence.DataCache;
-
-@DataCache
-@Entity
-@Table(name = "RESOURCE_JOB_MANAGER")
-public class ResourceJobManager implements Serializable {
-
- @Id
- @Column(name = "RESOURCE_JOB_MANAGER_ID")
- private String resourceJobManagerId;
-
- @Column(name = "PUSH_MONITORING_ENDPOINT")
- private String pushMonitoringEndpoint;
-
- @Column(name = "JOB_MANAGER_BIN_PATH")
- private String jobManagerBinPath;
-
- @Column(name = "RESOURCE_JOB_MANAGER_TYPE")
- private String resourceJobManagerType;
-
- @Column(name = "CREATION_TIME")
- private Timestamp creationTime;
-
- @Column(name = "UPDATE_TIME")
- private Timestamp updateTime;
-
- public Timestamp getCreationTime() {
- return creationTime;
- }
-
- public void setCreationTime(Timestamp creationTime) {
- this.creationTime = creationTime;
- }
-
- public Timestamp getUpdateTime() {
- return updateTime;
- }
-
- public void setUpdateTime(Timestamp updateTime) {
- this.updateTime = updateTime;
- }
-
- public String getResourceJobManagerId() {
- return resourceJobManagerId;
- }
-
- public String getPushMonitoringEndpoint() {
- return pushMonitoringEndpoint;
- }
-
- public String getJobManagerBinPath() {
- return jobManagerBinPath;
- }
-
- public String getResourceJobManagerType() {
- return resourceJobManagerType;
- }
-
- public void setResourceJobManagerId(String resourceJobManagerId) {
- this.resourceJobManagerId=resourceJobManagerId;
- }
-
- public void setPushMonitoringEndpoint(String pushMonitoringEndpoint) {
- this.pushMonitoringEndpoint=pushMonitoringEndpoint;
- }
-
- public void setJobManagerBinPath(String jobManagerBinPath) {
- this.jobManagerBinPath=jobManagerBinPath;
- }
-
- public void setResourceJobManagerType(String resourceJobManagerType) {
- this.resourceJobManagerType=resourceJobManagerType;
- }
-}
-
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/ScpDataMovement.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/ScpDataMovement.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/ScpDataMovement.java
deleted file mode 100644
index 3cf038b..0000000
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/ScpDataMovement.java
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- *
- * 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.aiaravata.application.catalog.data.model;
-
-import java.io.Serializable;
-import java.sql.Timestamp;
-
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.Id;
-import javax.persistence.Table;
-
-import org.apache.openjpa.persistence.DataCache;
-
-@DataCache
-@Entity
-@Table(name = "SCP_DATA_MOVEMENT")
-public class ScpDataMovement implements Serializable {
-
- @Column(name = "QUEUE_DESCRIPTION")
- private String queueDescription;
-
- @Id
- @Column(name = "DATA_MOVEMENT_INTERFACE_ID")
- private String dataMovementInterfaceId;
-
- @Column(name = "SECURITY_PROTOCOL")
- private String securityProtocol;
-
- @Column(name = "ALTERNATIVE_SCP_HOSTNAME")
- private String alternativeScpHostname;
-
- @Column(name = "SSH_PORT")
- private int sshPort;
-
- @Column(name = "CREATION_TIME")
- private Timestamp creationTime;
-
- @Column(name = "UPDATE_TIME")
- private Timestamp updateTime;
-
- public Timestamp getCreationTime() {
- return creationTime;
- }
-
- public void setCreationTime(Timestamp creationTime) {
- this.creationTime = creationTime;
- }
-
- public Timestamp getUpdateTime() {
- return updateTime;
- }
-
- public void setUpdateTime(Timestamp updateTime) {
- this.updateTime = updateTime;
- }
-
-
- public String getQueueDescription() {
- return queueDescription;
- }
-
- public String getDataMovementInterfaceId() {
- return dataMovementInterfaceId;
- }
-
- public String getSecurityProtocol() {
- return securityProtocol;
- }
-
- public String getAlternativeScpHostname() {
- return alternativeScpHostname;
- }
-
- public int getSshPort() {
- return sshPort;
- }
-
- public void setQueueDescription(String queueDescription) {
- this.queueDescription=queueDescription;
- }
-
- public void setDataMovementInterfaceId(String dataMovementInterfaceId) {
- this.dataMovementInterfaceId=dataMovementInterfaceId;
- }
-
- public void setSecurityProtocol(String securityProtocol) {
- this.securityProtocol=securityProtocol;
- }
-
- public void setAlternativeScpHostname(String alternativeScpHostname) {
- this.alternativeScpHostname=alternativeScpHostname;
- }
-
- public void setSshPort(int sshPort) {
- this.sshPort=sshPort;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/SshJobSubmission.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/SshJobSubmission.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/SshJobSubmission.java
deleted file mode 100644
index 13a7861..0000000
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/SshJobSubmission.java
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- *
- * 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.aiaravata.application.catalog.data.model;
-
-import java.io.Serializable;
-import java.sql.Timestamp;
-
-import javax.persistence.CascadeType;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.Id;
-import javax.persistence.JoinColumn;
-import javax.persistence.ManyToOne;
-import javax.persistence.Table;
-
-import org.apache.openjpa.persistence.DataCache;
-
-@DataCache
-@Entity
-@Table(name = "SSH_JOB_SUBMISSION")
-public class SshJobSubmission implements Serializable {
-
- @Column(name = "RESOURCE_JOB_MANAGER_ID")
- private String resourceJobManagerId;
-
- @ManyToOne(cascade= CascadeType.MERGE)
- @JoinColumn(name = "RESOURCE_JOB_MANAGER_ID")
- private ResourceJobManager resourceJobManager;
-
- @Id
- @Column(name = "JOB_SUBMISSION_INTERFACE_ID")
- private String jobSubmissionInterfaceId;
-
- @Column(name = "ALTERNATIVE_SSH_HOSTNAME")
- private String alternativeSshHostname;
-
- @Column(name = "SECURITY_PROTOCOL")
- private String securityProtocol;
-
- @Column(name = "SSH_PORT")
- private int sshPort;
-
- @Column(name = "MONITOR_MODE")
- private String monitorMode;
-
- @Column(name = "CREATION_TIME")
- private Timestamp creationTime;
-
- @Column(name = "UPDATE_TIME")
- private Timestamp updateTime;
-
- public Timestamp getCreationTime() {
- return creationTime;
- }
-
- public void setCreationTime(Timestamp creationTime) {
- this.creationTime = creationTime;
- }
-
- public Timestamp getUpdateTime() {
- return updateTime;
- }
-
- public void setUpdateTime(Timestamp updateTime) {
- this.updateTime = updateTime;
- }
-
-
- public String getResourceJobManagerId() {
- return resourceJobManagerId;
- }
-
- public ResourceJobManager getResourceJobManager() {
- return resourceJobManager;
- }
-
- public String getJobSubmissionInterfaceId() {
- return jobSubmissionInterfaceId;
- }
-
- public String getAlternativeSshHostname() {
- return alternativeSshHostname;
- }
-
- public String getSecurityProtocol() {
- return securityProtocol;
- }
-
- public int getSshPort() {
- return sshPort;
- }
-
- public void setResourceJobManagerId(String resourceJobManagerId) {
- this.resourceJobManagerId=resourceJobManagerId;
- }
-
- public void setResourceJobManager(ResourceJobManager resourceJobManager) {
- this.resourceJobManager=resourceJobManager;
- }
-
- public void setJobSubmissionInterfaceId(String jobSubmissionInterfaceId) {
- this.jobSubmissionInterfaceId=jobSubmissionInterfaceId;
- }
-
- public void setAlternativeSshHostname(String alternativeSshHostname) {
- this.alternativeSshHostname=alternativeSshHostname;
- }
-
- public void setSecurityProtocol(String securityProtocol) {
- this.securityProtocol=securityProtocol;
- }
-
- public void setSshPort(int sshPort) {
- this.sshPort=sshPort;
- }
-
- public String getMonitorMode() {
- return monitorMode;
- }
-
- public void setMonitorMode(String monitorMode) {
- this.monitorMode = monitorMode;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/UnicoreDataMovement.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/UnicoreDataMovement.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/UnicoreDataMovement.java
deleted file mode 100644
index a39821f..0000000
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/UnicoreDataMovement.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- *
- * 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.aiaravata.application.catalog.data.model;
-
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.Id;
-import javax.persistence.Table;
-
-@Entity
-@Table(name = "UNICORE_DATAMOVEMENT")
-public class UnicoreDataMovement {
- @Id
- @Column(name = "DATAMOVEMENT_ID")
- private String dataMovementId;
- @Column(name = "SECURITY_PROTOCAL")
- private String securityProtocol;
-
- @Column(name = "UNICORE_ENDPOINT_URL")
- private String unicoreEndpointUrl;
-
- public String getUnicoreEndpointUrl() {
- return unicoreEndpointUrl;
- }
-
- public void setUnicoreEndpointUrl(String unicoreEndpointUrl) {
- this.unicoreEndpointUrl = unicoreEndpointUrl;
- }
-
- public String getDataMovementId() {
- return dataMovementId;
- }
-
- public void setDataMovementId(String dataMovementId) {
- this.dataMovementId = dataMovementId;
- }
-
- public String getSecurityProtocol() {
- return securityProtocol;
- }
-
- public void setSecurityProtocol(String securityProtocol) {
- this.securityProtocol = securityProtocol;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/UnicoreJobSubmission.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/UnicoreJobSubmission.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/UnicoreJobSubmission.java
deleted file mode 100644
index 3655620..0000000
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/UnicoreJobSubmission.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- *
- * 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.aiaravata.application.catalog.data.model;
-
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.Id;
-import javax.persistence.Table;
-
-@Entity
-@Table(name = "UNICORE_SUBMISSION")
-public class UnicoreJobSubmission {
- @Id
- @Column(name = "SUBMISSION_ID")
- private String submissionID;
- @Column(name = "SECURITY_PROTOCAL")
- private String securityProtocol;
-
- @Column(name = "UNICORE_ENDPOINT_URL")
- private String unicoreEndpointUrl;
-
- public String getUnicoreEndpointUrl() {
- return unicoreEndpointUrl;
- }
-
- public void setUnicoreEndpointUrl(String unicoreEndpointUrl) {
- this.unicoreEndpointUrl = unicoreEndpointUrl;
- }
-
-
- public String getSubmissionID() {
- return submissionID;
- }
-
- public void setSubmissionID(String submissionID) {
- this.submissionID = submissionID;
- }
-
- public String getSecurityProtocol() {
- return securityProtocol;
- }
-
- public void setSecurityProtocol(String securityProtocol) {
- this.securityProtocol = securityProtocol;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/Workflow.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/Workflow.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/Workflow.java
deleted file mode 100644
index 910bd02..0000000
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/Workflow.java
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- *
- * 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.aiaravata.application.catalog.data.model;
-
-import org.apache.openjpa.persistence.DataCache;
-
-import javax.persistence.*;
-import java.io.Serializable;
-import java.sql.Timestamp;
-
-@DataCache
-@Entity
-@Table(name = "WORKFLOW")
-public class Workflow implements Serializable {
-
- @Column(name = "WF_NAME")
- private String wfName;
-
- @Column(name = "CREATED_USER")
- private String createdUser;
-
- @Lob
- @Column(name = "GRAPH")
- private char[] graph;
-
- @Id
- @Column(name = "WF_TEMPLATE_ID")
- private String wfTemplateId;
-
- @Column(name = "CREATION_TIME")
- private Timestamp creationTime;
-
- @Column(name = "UPDATE_TIME")
- private Timestamp updateTime;
-
- @Lob
- @Column(name = "IMAGE")
- private byte[] image;
-
- @Column(name = "GATEWAY_ID")
- private String gatewayId;
-
- public String getGatewayId() {
- return gatewayId;
- }
-
- public void setGatewayId(String gatewayId) {
- this.gatewayId = gatewayId;
- }
-
- public Timestamp getCreationTime() {
- return creationTime;
- }
-
- public void setCreationTime(Timestamp creationTime) {
- this.creationTime = creationTime;
- }
-
- public Timestamp getUpdateTime() {
- return updateTime;
- }
-
- public void setUpdateTime(Timestamp updateTime) {
- this.updateTime = updateTime;
- }
-
- public String getWfName() {
- return wfName;
- }
-
- public String getCreatedUser() {
- return createdUser;
- }
-
- public char[] getGraph() {
- return graph;
- }
-
- public String getWfTemplateId() {
- return wfTemplateId;
- }
-
- public void setWfName(String wfName) {
- this.wfName=wfName;
- }
-
- public void setCreatedUser(String createdUser) {
- this.createdUser=createdUser;
- }
-
- public void setGraph(char[] graph) {
- this.graph=graph;
- }
-
- public void setWfTemplateId(String wfTemplateId) {
- this.wfTemplateId=wfTemplateId;
- }
-
- public byte[] getImage() {
- return image;
- }
-
- public void setImage(byte[] image) {
- this.image = image;
- }
-}
-
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/WorkflowInput.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/WorkflowInput.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/WorkflowInput.java
deleted file mode 100644
index 7ec659f..0000000
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/WorkflowInput.java
+++ /dev/null
@@ -1,167 +0,0 @@
-/*
- *
- * 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.aiaravata.application.catalog.data.model;
-
-
-import javax.persistence.*;
-import java.io.Serializable;
-
-@Entity
-@Table(name = "WORKFLOW_INPUT")
-@IdClass(WorkflowInput_PK.class)
-public class WorkflowInput implements Serializable {
- @Id
- @Column(name = "WF_TEMPLATE_ID")
- private String wfTemplateId;
- @Id
- @Column(name = "INPUT_KEY")
- private String inputKey;
- @Lob
- @Column(name = "INPUT_VALUE")
- private char[] inputVal;
- @Column(name = "DATA_TYPE")
- private String dataType;
- @Column(name = "METADATA")
- private String metadata;
- @Column(name = "APP_ARGUMENT")
- private String appArgument;
- @Column(name = "USER_FRIENDLY_DESC")
- private String userFriendlyDesc;
- @Column(name = "STANDARD_INPUT")
- private boolean standardInput;
- @Column(name = "INPUT_ORDER")
- private int inputOrder;
- @Column(name="IS_REQUIRED")
- private boolean isRequired;
- @Column(name="REQUIRED_TO_COMMANDLINE")
- private boolean requiredToCMD;
- @Column(name = "DATA_STAGED")
- private boolean dataStaged;
-
- @ManyToOne(cascade = CascadeType.MERGE)
- @JoinColumn(name = "WF_TEMPLATE_ID")
- private Workflow workflow;
-
- public String getWfTemplateId() {
- return wfTemplateId;
- }
-
- public void setWfTemplateId(String wfTemplateId) {
- this.wfTemplateId = wfTemplateId;
- }
-
- public String getInputKey() {
- return inputKey;
- }
-
- public void setInputKey(String inputKey) {
- this.inputKey = inputKey;
- }
-
- public char[] getInputVal() {
- return inputVal;
- }
-
- public void setInputVal(char[] inputVal) {
- this.inputVal = inputVal;
- }
-
- public String getDataType() {
- return dataType;
- }
-
- public void setDataType(String dataType) {
- this.dataType = dataType;
- }
-
- public String getMetadata() {
- return metadata;
- }
-
- public void setMetadata(String metadata) {
- this.metadata = metadata;
- }
-
- public String getAppArgument() {
- return appArgument;
- }
-
- public void setAppArgument(String appArgument) {
- this.appArgument = appArgument;
- }
-
- public String getUserFriendlyDesc() {
- return userFriendlyDesc;
- }
-
- public void setUserFriendlyDesc(String userFriendlyDesc) {
- this.userFriendlyDesc = userFriendlyDesc;
- }
-
- public Workflow getWorkflow() {
- return workflow;
- }
-
- public void setWorkflow(Workflow workflow) {
- this.workflow = workflow;
- }
-
- public boolean isStandardInput() {
- return standardInput;
- }
-
- public void setStandardInput(boolean standardInput) {
- this.standardInput = standardInput;
- }
-
- public int getInputOrder() {
- return inputOrder;
- }
-
- public void setInputOrder(int inputOrder) {
- this.inputOrder = inputOrder;
- }
-
- public boolean isRequired() {
- return isRequired;
- }
-
- public void setRequired(boolean isRequired) {
- this.isRequired = isRequired;
- }
-
- public boolean isRequiredToCMD() {
- return requiredToCMD;
- }
-
- public void setRequiredToCMD(boolean requiredToCMD) {
- this.requiredToCMD = requiredToCMD;
- }
-
- public boolean isDataStaged() {
- return dataStaged;
- }
-
- public void setDataStaged(boolean dataStaged) {
- this.dataStaged = dataStaged;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/WorkflowInput_PK.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/WorkflowInput_PK.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/WorkflowInput_PK.java
deleted file mode 100644
index e84f572..0000000
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/WorkflowInput_PK.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- *
- * 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.aiaravata.application.catalog.data.model;
-
-import java.io.Serializable;
-
-public class WorkflowInput_PK implements Serializable {
- private String wfTemplateId;
- private String inputKey;
-
- public WorkflowInput_PK(String wfTemplateId, String inputKey) {
- this.wfTemplateId = wfTemplateId;
- this.inputKey = inputKey;
- }
-
- public WorkflowInput_PK() {
- ;
- }
-
- @Override
- public boolean equals(Object o) {
- return false;
- }
-
- @Override
- public int hashCode() {
- return 1;
- }
-
- public String getWfTemplateId() {
- return wfTemplateId;
- }
-
- public void setWfTemplateId(String wfTemplateId) {
- this.wfTemplateId = wfTemplateId;
- }
-
- public String getInputKey() {
- return inputKey;
- }
-
- public void setInputKey(String inputKey) {
- this.inputKey = inputKey;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/WorkflowOutput.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/WorkflowOutput.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/WorkflowOutput.java
deleted file mode 100644
index 8343a48..0000000
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/WorkflowOutput.java
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- *
- * 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.aiaravata.application.catalog.data.model;
-
-
-import javax.persistence.*;
-import java.io.Serializable;
-
-@Entity
-@Table(name = "WORKFLOW_OUTPUT")
-@IdClass(WorkflowOutput_PK.class)
-public class WorkflowOutput implements Serializable {
- @Id
- @Column(name = "WF_TEMPLATE_ID")
- private String wfTemplateId;
- @Id
- @Column(name = "OUTPUT_KEY")
- private String outputKey;
- @Lob
- @Column(name = "OUTPUT_VALUE")
- private char[] outputVal;
- @Column(name = "DATA_TYPE")
- private String dataType;
- @Column(name = "VALIDITY_TYPE")
- private String validityType;
- @Column(name = "DATA_MOVEMENT")
- private boolean dataMovement;
- @Column(name = "DATA_NAME_LOCATION")
- private String dataNameLocation;
-
- @ManyToOne(cascade= CascadeType.MERGE)
- @JoinColumn(name = "WF_TEMPLATE_ID")
- private Workflow workflow;
-
- public String getWfTemplateId() {
- return wfTemplateId;
- }
-
- public void setWfTemplateId(String wfTemplateId) {
- this.wfTemplateId = wfTemplateId;
- }
-
- public String getDataType() {
- return dataType;
- }
-
- public void setDataType(String dataType) {
- this.dataType = dataType;
- }
-
- public Workflow getWorkflow() {
- return workflow;
- }
-
- public void setWorkflow(Workflow workflow) {
- this.workflow = workflow;
- }
-
- public String getOutputKey() {
- return outputKey;
- }
-
- public void setOutputKey(String outputKey) {
- this.outputKey = outputKey;
- }
-
- public char[] getOutputVal() {
- return outputVal;
- }
-
- public void setOutputVal(char[] outputVal) {
- this.outputVal = outputVal;
- }
-
- public String getValidityType() {
- return validityType;
- }
-
- public void setValidityType(String validityType) {
- this.validityType = validityType;
- }
-
- public boolean isDataMovement() {
- return dataMovement;
- }
-
- public void setDataMovement(boolean dataMovement) {
- this.dataMovement = dataMovement;
- }
-
- public String getDataNameLocation() {
- return dataNameLocation;
- }
-
- public void setDataNameLocation(String dataNameLocation) {
- this.dataNameLocation = dataNameLocation;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/WorkflowOutput_PK.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/WorkflowOutput_PK.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/WorkflowOutput_PK.java
deleted file mode 100644
index 4439340..0000000
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/WorkflowOutput_PK.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- *
- * 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.aiaravata.application.catalog.data.model;
-
-import java.io.Serializable;
-
-public class WorkflowOutput_PK implements Serializable {
- private String wfTemplateId;
- private String outputKey;
-
- public WorkflowOutput_PK(String wfTemplateId, String outputKey) {
- this.wfTemplateId = wfTemplateId;
- this.outputKey = outputKey;
- }
-
- public WorkflowOutput_PK() {
- ;
- }
-
- @Override
- public boolean equals(Object o) {
- return false;
- }
-
- @Override
- public int hashCode() {
- return 1;
- }
-
- public String getWfTemplateId() {
- return wfTemplateId;
- }
-
- public void setWfTemplateId(String wfTemplateId) {
- this.wfTemplateId = wfTemplateId;
- }
-
- public String getOutputKey() {
- return outputKey;
- }
-
- public void setOutputKey(String outputKey) {
- this.outputKey = outputKey;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/AbstractResource.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/AbstractResource.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/AbstractResource.java
deleted file mode 100644
index e1b042d..0000000
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/AbstractResource.java
+++ /dev/null
@@ -1,382 +0,0 @@
-/*
- *
- * 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.aiaravata.application.catalog.data.resources;
-
-public abstract class AbstractResource implements Resource {
- // table names
- public static final String COMPUTE_RESOURCE = "ComputeResource";
- public static final String HOST_ALIAS = "HostAlias";
- public static final String HOST_IPADDRESS = "HostIPAddress";
- public static final String GSISSH_SUBMISSION = "GSISSHSubmission";
- public static final String GSISSH_EXPORT = "GSISSHExport";
- public static final String PRE_JOBCOMMAND = "PreJobCommand";
- public static final String POST_JOBCOMMAND = "PostJobCommand";
- public static final String GLOBUS_SUBMISSION = "GlobusJobSubmission";
- public static final String UNICORE_JOB_SUBMISSION = "UnicoreJobSubmission";
- public static final String UNICORE_DATA_MOVEMENT = "UnicoreDataMovement";
- public static final String GLOBUS_GK_ENDPOINT = "GlobusGKEndpoint";
- public static final String SSH_SUBMISSION = "SSHSubmission";
- public static final String SCP_DATA_MOVEMENT = "ScpDataMovement";
- public static final String GRIDFTP_DATA_MOVEMENT = "GridftpDataMovement";
- public static final String GRIDFTP_ENDPOINT = "GridftpEndpoint";
- public static final String JOB_SUBMISSION_PROTOCOL = "JobSubmissionProtocol";
- public static final String DATA_MOVEMENT_PROTOCOL = "DataMovementProtocol";
- public static final String APPLICATION_MODULE = "ApplicationModule";
- public static final String APPLICATION_DEPLOYMENT = "ApplicationDeployment";
- public static final String LIBRARY_PREPAND_PATH = "LibraryPrepandPath";
- public static final String LIBRARY_APEND_PATH = "LibraryApendPath";
- public static final String APP_ENVIRONMENT = "AppEnvironment";
- public static final String APPLICATION_INTERFACE = "ApplicationInterface";
- public static final String APP_MODULE_MAPPING = "AppModuleMapping";
- public static final String APPLICATION_INPUT = "ApplicationInput";
- public static final String WORKFLOW_INPUT = "WorkflowInput";
- public static final String APPLICATION_OUTPUT = "ApplicationOutput";
- 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 BATCH_QUEUE = "BatchQueue";
- public static final String COMPUTE_RESOURCE_FILE_SYSTEM = "ComputeResourceFileSystem";
- public static final String JOB_SUBMISSION_INTERFACE = "JobSubmissionInterface";
- public static final String DATA_MOVEMENT_INTERFACE = "DataMovementInterface";
- public static final String RESOURCE_JOB_MANAGER = "ResourceJobManager";
- public static final String JOB_MANAGER_COMMAND = "JobManagerCommand";
- public static final String LOCAL_SUBMISSION = "LocalSubmission";
- public static final String LOCAL_DATA_MOVEMENT = "LocalDataMovement";
- public static final String SSH_JOB_SUBMISSION = "SshJobSubmission";
- public static final String EMAIL_PROPERTY = "EmailMonitorProperty";
- public static final String CLOUD_JOB_SUBMISSION = "CloudJobSubmission";
- public static final String MODULE_LOAD_CMD = "ModuleLoadCmd";
- public static final String WORKFLOW = "Workflow";
-
- public final class EmailMonitorPropertyConstants {
- public static final String JOB_SUBMISSION_INTERFACE_ID = "jobSubmissionId";
- }
-
- // Compute Resource Table
- public final class ComputeResourceConstants {
- public static final String RESOURCE_DESCRIPTION = "resourceDescription";
- public static final String RESOURCE_ID = "resourceId";
- public static final String HOST_NAME = "hostName";
- }
-
- // Host Alias Table
- public final class HostAliasConstants {
- public static final String RESOURCE_ID = "resourceID";
- public static final String ALIAS = "alias";
- }
-
- // Host IPAddress Table
- public final class HostIPAddressConstants {
- public static final String RESOURCE_ID = "resourceID";
- public static final String IP_ADDRESS = "ipaddress";
- }
-
- // GSSISSH Submission Table
- public final class GSISSHSubmissionConstants {
- public static final String SUBMISSION_ID = "submissionID";
- public static final String RESOURCE_JOB_MANAGER = "resourceJobManager";
- public static final String SSH_PORT = "sshPort";
- public static final String INSTALLED_PATH = "installedPath";
- public static final String MONITOR_MODE = "monitorMode";
- }
-
- // GSSISSH Export Table
- public final class GSISSHExportConstants {
- public static final String SUBMISSION_ID = "submissionID";
- public static final String EXPORT = "export";
- }
-
- // GSSISSH Pre Job Command Table
- public final class PreJobCommandConstants {
- public static final String DEPLOYMENT_ID = "deploymentId";
- public static final String COMMAND = "command";
- }
-
- // GSSISSH Post Job Command Table
- public final class PostJobCommandConstants {
- public static final String DEPLOYMENT_ID = "deploymentId";
- public static final String COMMAND = "command";
- }
-
- // GSSISSH Post Job Command Table
- public final class GlobusJobSubmissionConstants {
- public static final String SUBMISSION_ID = "submissionID";
- public static final String RESOURCE_JOB_MANAGER = "resourceJobManager";
- public static final String SECURITY_PROTOCAL = "securityProtocol";
- public static final String GLOBUS_GATEKEEPER_EP = "globusEP";
- }
-
- // Unicore Post Job Command Table
- public final class UnicoreJobSubmissionConstants {
- public static final String SUBMISSION_ID = "submissionID";
- public static final String SECURITY_PROTOCAL = "securityProtocol";
- public static final String UNICORE_ENDPOINT_URL = "unicoreEndpointUrl";
-
- }
-
- public final class UnicoreDataMovementConstants {
- public static final String DATAMOVEMENT_ID = "dataMovementId";
- public static final String SECURITY_PROTOCAL = "securityProtocol";
- public static final String UNICORE_ENDPOINT_URL = "unicoreEndpointUrl";
- }
-
-
- public final class GlobusEPConstants{
- public static final String SUBMISSION_ID = "submissionID";
- public static final String ENDPOINT = "endpoint";
- }
-
- // GSSISSH Post Job Command Table
- public final class SSHSubmissionConstants {
- public static final String SUBMISSION_ID = "submissionID";
- public static final String RESOURCE_JOB_MANAGER = "resourceJobManager";
- public static final String SSH_PORT = "sshPort";
- }
-
- // Scp Data Movement Table
- public final class ScpDataMovementConstants {
- public static final String QUEUE_DESCRIPTION = "queueDescription";
- public static final String DATA_MOVEMENT_INTERFACE_ID = "dataMovementInterfaceId";
- public static final String SECURITY_PROTOCOL = "securityProtocol";
- public static final String ALTERNATIVE_SCP_HOSTNAME = "alternativeScpHostname";
- public static final String SSH_PORT = "sshPort";
- }
-
- public final class GridFTPDataMovementConstants {
- public static final String DATA_MOVE_ID = "dataMoveID";
- public static final String SECURITY_PROTOCOL = "securityProtocol";
- public static final String GRID_FTP_EP = "gridFTPEP";
- }
-
- public final class GridFTPDMEPConstants{
- public static final String DATA_MOVE_ID = "dataMoveId";
- public static final String ENDPOINT = "endpoint";
- }
-
- public final class JobSubmissionProtocolConstants {
- public static final String RESOURCE_ID = "resourceID";
- public static final String SUBMISSION_ID = "submissionID";
- public static final String JOB_TYPE = "jobType";
- }
-
- public final class DataMoveProtocolConstants {
- public static final String RESOURCE_ID = "resourceID";
- public static final String DATA_MOVE_ID = "dataMoveID";
- public static final String DATA_MOVE_TYPE = "dataMoveType";
- }
-
- public final class ApplicationModuleConstants {
- public static final String MODULE_ID = "moduleID";
- public static final String GATEWAY_ID = "gatewayId";
- public static final String MODULE_NAME = "moduleName";
- public static final String MODULE_VERSION = "moduleVersion";
- public static final String MODULE_DESC = "moduleDesc";
- }
-
- public final class ApplicationDeploymentConstants {
- public static final String APP_MODULE_ID = "appModuleID";
- public static final String DEPLOYMENT_ID = "deploymentID";
- public static final String COMPUTE_HOST_ID = "hostID";
- public static final String GATEWAY_ID = "gatewayId";
- public static final String EXECUTABLE_PATH = "executablePath";
- public static final String APPLICATION_DESC = "applicationDesc";
- public static final String ENV_MODULE_LOAD_CMD = "envModuleLoaString";
- public static final String PARALLELISM = "parallelism";
- }
-
- public final class LibraryPrepandPathConstants {
- public static final String DEPLOYMENT_ID = "deploymentID";
- public static final String NAME = "name";
- public static final String VALUE = "value";
- }
-
- public final class LibraryApendPathConstants {
- public static final String DEPLOYMENT_ID = "deploymentID";
- public static final String NAME = "name";
- public static final String VALUE = "value";
- }
-
- public final class AppEnvironmentConstants {
- public static final String DEPLOYMENT_ID = "deploymentID";
- public static final String NAME = "name";
- public static final String VALUE = "value";
- }
-
- public final class ApplicationInterfaceConstants {
- public static final String INTERFACE_ID = "interfaceID";
- public static final String APPLICATION_NAME = "appName";
- public static final String GATEWAY_ID = "gatewayId";
- }
-
- public final class AppModuleMappingConstants {
- public static final String INTERFACE_ID = "interfaceID";
- public static final String MODULE_ID = "moduleID";
- }
-
- public final class AppInputConstants {
- public static final String INTERFACE_ID = "interfaceID";
- public static final String INPUT_KEY = "inputKey";
- public static final String INPUT_VALUE = "inputVal";
- public static final String DATA_TYPE = "dataType";
- public static final String METADATA = "metadata";
- public static final String APP_ARGUMENT = "appArgument";
- public static final String USER_FRIENDLY_DESC = "userFriendlyDesc";
- public static final String STANDARD_INPUT = "standardInput";
- }
-
- public final class AppOutputConstants {
- public static final String INTERFACE_ID = "interfaceID";
- public static final String OUTPUT_KEY = "outputKey";
- public static final String OUTPUT_VALUE = "outputVal";
- public static final String DATA_TYPE = "dataType";
- }
-
- public final class WFInputConstants {
- public static final String WF_TEMPLATE_ID = "wfTemplateId";
- public static final String INPUT_KEY = "inputKey";
- public static final String INPUT_VALUE = "inputVal";
- public static final String DATA_TYPE = "dataType";
- public static final String METADATA = "metadata";
- public static final String APP_ARGUMENT = "appArgument";
- public static final String USER_FRIENDLY_DESC = "userFriendlyDesc";
- public static final String STANDARD_INPUT = "standardInput";
- }
-
- public final class WFOutputConstants {
- public static final String WF_TEMPLATE_ID = "wfTemplateId";
- public static final String OUTPUT_KEY = "outputKey";
- public static final String OUTPUT_VALUE = "outputVal";
- public static final String DATA_TYPE = "dataType";
- }
-
- public final class GatewayProfileConstants {
- public static final String GATEWAY_ID = "gatewayID";
- public static final String GATEWAY_DESC = "gatewayDesc";
- }
-
- public final class ComputeResourcePreferenceConstants {
- public static final String GATEWAY_ID = "gatewayId";
- public static final String RESOURCE_ID = "resourceId";
- public static final String OVERRIDE_BY_AIRAVATA = "overrideByAiravata";
- public static final String PREFERED_JOB_SUB_PROTOCOL = "preferedJobSubmissionProtocol";
- public static final String PREFERED_DATA_MOVE_PROTOCOL = "preferedDataMoveProtocol";
- public static final String PREFERED_BATCH_QUEUE = "batchQueue";
- public static final String SCRATCH_LOCATION = "scratchLocation";
- public static final String ALLOCATION_PROJECT_NUMBER = "projectNumber";
- }
-
- // Batch Queue Table
- public final class BatchQueueConstants {
- public static final String COMPUTE_RESOURCE_ID = "computeResourceId";
- public static final String MAX_RUNTIME = "maxRuntime";
- public static final String MAX_JOB_IN_QUEUE = "maxJobInQueue";
- public static final String QUEUE_DESCRIPTION = "queueDescription";
- public static final String QUEUE_NAME = "queueName";
- public static final String MAX_PROCESSORS = "maxProcessors";
- public static final String MAX_NODES = "maxNodes";
- }
-
- // Compute Resource File System Table
- public final class ComputeResourceFileSystemConstants {
- public static final String COMPUTE_RESOURCE_ID = "computeResourceId";
- public static final String PATH = "path";
- public static final String FILE_SYSTEM = "fileSystem";
- }
-
- // Job Submission Interface Table
- public final class JobSubmissionInterfaceConstants {
- public static final String JOB_SUBMISSION_INTERFACE_ID = "jobSubmissionInterfaceId";
- public static final String COMPUTE_RESOURCE_ID = "computeResourceId";
- public static final String JOB_SUBMISSION_PROTOCOL = "jobSubmissionProtocol";
- public static final String PRIORITY_ORDER = "priorityOrder";
- }
-
- // Data Movement Interface Table
- public final class DataMovementInterfaceConstants {
- public static final String COMPUTE_RESOURCE_ID = "computeResourceId";
- public static final String DATA_MOVEMENT_PROTOCOL = "dataMovementProtocol";
- public static final String DATA_MOVEMENT_INTERFACE_ID = "dataMovementInterfaceId";
- public static final String PRIORITY_ORDER = "priorityOrder";
- }
-
- // Resource Job Manager Table
- public final class ResourceJobManagerConstants {
- public static final String RESOURCE_JOB_MANAGER_ID = "resourceJobManagerId";
- public static final String PUSH_MONITORING_ENDPOINT = "pushMonitoringEndpoint";
- public static final String JOB_MANAGER_BIN_PATH = "jobManagerBinPath";
- public static final String RESOURCE_JOB_MANAGER_TYPE = "resourceJobManagerType";
- }
-
- // Job Manager Command Table
- public final class JobManagerCommandConstants {
- public static final String RESOURCE_JOB_MANAGER_ID = "resourceJobManagerId";
- public static final String COMMAND_TYPE = "commandType";
- public static final String COMMAND = "command";
- }
-
- // Gridftp Data Movement Table
- public final class GridftpDataMovementConstants {
- public static final String DATA_MOVEMENT_INTERFACE_ID = "dataMovementInterfaceId";
- public static final String SECURITY_PROTOCOL = "securityProtocol";
- }
-
- // Gridftp Endpoint Table
- public final class GridftpEndpointConstants {
- public static final String ENDPOINT = "endpoint";
- public static final String DATA_MOVEMENT_INTERFACE_ID = "dataMovementInterfaceId";
- }
-
- // Local Submission Table
- public final class LocalSubmissionConstants {
- public static final String RESOURCE_JOB_MANAGER_ID = "resourceJobManagerId";
- public static final String JOB_SUBMISSION_INTERFACE_ID = "jobSubmissionInterfaceId";
- }
-
- // Local Data Movement Table
- public final class LocalDataMovementConstants {
- public static final String DATA_MOVEMENT_INTERFACE_ID = "dataMovementInterfaceId";
- }
-
- // Ssh Job Submission Table
- public final class SshJobSubmissionConstants {
- public static final String RESOURCE_JOB_MANAGER_ID = "resourceJobManagerId";
- public static final String JOB_SUBMISSION_INTERFACE_ID = "jobSubmissionInterfaceId";
- public static final String ALTERNATIVE_SSH_HOSTNAME = "alternativeSshHostname";
- public static final String SECURITY_PROTOCOL = "securityProtocol";
- public static final String SSH_PORT = "sshPort";
- }
-
- // Module Load Cmd Table
- public final class ModuleLoadCmdConstants {
- public static final String CMD = "cmd";
- public static final String APP_DEPLOYMENT_ID = "appDeploymentId";
- }
-
- // Workflow Table
- public final class WorkflowConstants {
- public static final String WF_NAME = "wfName";
- public static final String CREATED_USER = "createdUser";
- public static final String GRAPH = "graph";
- public static final String WF_TEMPLATE_ID = "wfTemplateId";
- public static final String GATEWAY_ID = "gatewayId";
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/AppDeploymentResource.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/AppDeploymentResource.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/AppDeploymentResource.java
deleted file mode 100644
index a635666..0000000
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/AppDeploymentResource.java
+++ /dev/null
@@ -1,446 +0,0 @@
-/*
- *
- * 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.aiaravata.application.catalog.data.resources;
-
-import org.airavata.appcatalog.cpi.AppCatalogException;
-import org.apache.aiaravata.application.catalog.data.model.ApplicationDeployment;
-import org.apache.aiaravata.application.catalog.data.model.ApplicationModule;
-import org.apache.aiaravata.application.catalog.data.model.ComputeResource;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogJPAUtils;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogQueryGenerator;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogResourceType;
-import org.apache.airavata.common.exception.ApplicationSettingsException;
-import org.apache.airavata.common.utils.AiravataUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.persistence.EntityManager;
-import javax.persistence.Query;
-import java.sql.Timestamp;
-import java.util.ArrayList;
-import java.util.List;
-
-public class AppDeploymentResource extends AbstractResource {
- private final static Logger logger = LoggerFactory.getLogger(AppDeploymentResource.class);
- private String deploymentId;
- private String appModuleId;
- private String hostId;
- private String executablePath;
- private String parallelism;
- private String appDes;
- private String gatewayId;
- private ComputeResourceResource hostResource;
- private AppModuleResource moduleResource;
- private Timestamp createdTime;
- private Timestamp updatedTime;
-
- public String getGatewayId() {
- return gatewayId;
- }
-
- public void setGatewayId(String gatewayId) {
- this.gatewayId = gatewayId;
- }
-
- public Timestamp getCreatedTime() {
- return createdTime;
- }
-
- public void setCreatedTime(Timestamp createdTime) {
- this.createdTime = createdTime;
- }
-
- public Timestamp getUpdatedTime() {
- return updatedTime;
- }
-
- public void setUpdatedTime(Timestamp updatedTime) {
- this.updatedTime = updatedTime;
- }
-
- public String getDeploymentId() {
- return deploymentId;
- }
-
- public void setDeploymentId(String deploymentId) {
- this.deploymentId = deploymentId;
- }
-
- public String getAppModuleId() {
- return appModuleId;
- }
-
- public void setAppModuleId(String appModuleId) {
- this.appModuleId = appModuleId;
- }
-
- public String getHostId() {
- return hostId;
- }
-
- public void setHostId(String hostId) {
- this.hostId = hostId;
- }
-
- public String getExecutablePath() {
- return executablePath;
- }
-
- public void setExecutablePath(String executablePath) {
- this.executablePath = executablePath;
- }
-
- public String getAppDes() {
- return appDes;
- }
-
- public void setAppDes(String appDes) {
- this.appDes = appDes;
- }
-
- public ComputeResourceResource getHostResource() {
- return hostResource;
- }
-
- public void setHostResource(ComputeResourceResource hostResource) {
- this.hostResource = hostResource;
- }
-
- public AppModuleResource getModuleResource() {
- return moduleResource;
- }
-
- public void setModuleResource(AppModuleResource moduleResource) {
- this.moduleResource = moduleResource;
- }
-
- @Override
- public void remove(Object identifier) throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator= new AppCatalogQueryGenerator(APPLICATION_DEPLOYMENT);
- generator.setParameter(ApplicationDeploymentConstants.DEPLOYMENT_ID, identifier);
- 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 Resource get(Object identifier) throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(APPLICATION_DEPLOYMENT);
- generator.setParameter(ApplicationDeploymentConstants.DEPLOYMENT_ID, identifier);
- Query q = generator.selectQuery(em);
- ApplicationDeployment deployment = (ApplicationDeployment) q.getSingleResult();
- AppDeploymentResource deploymentResource =
- (AppDeploymentResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.APPLICATION_DEPLOYMENT, deployment);
- em.getTransaction().commit();
- em.close();
- return deploymentResource;
- } 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<Resource> get(String fieldName, Object value) throws AppCatalogException {
- List<Resource> appDeployments = new ArrayList<Resource>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- Query q;
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(APPLICATION_DEPLOYMENT);
- List results;
- if (fieldName.equals(ApplicationDeploymentConstants.APP_MODULE_ID)) {
- generator.setParameter(ApplicationDeploymentConstants.APP_MODULE_ID, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- ApplicationDeployment deployment = (ApplicationDeployment) result;
- AppDeploymentResource deploymentResource =
- (AppDeploymentResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.APPLICATION_DEPLOYMENT, deployment);
- appDeployments.add(deploymentResource);
- }
- }
- } else if (fieldName.equals(ApplicationDeploymentConstants.COMPUTE_HOST_ID)) {
- generator.setParameter(ApplicationDeploymentConstants.COMPUTE_HOST_ID, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- ApplicationDeployment deployment = (ApplicationDeployment) result;
- AppDeploymentResource deploymentResource =
- (AppDeploymentResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.APPLICATION_DEPLOYMENT, deployment);
- appDeployments.add(deploymentResource);
- }
- }
- }else {
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported field name for app deployment resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported field name for app deployment 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 appDeployments;
- }
-
- @Override
- public List<Resource> getAll() throws AppCatalogException {
- List<Resource> appDeployments = new ArrayList<Resource>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(APPLICATION_DEPLOYMENT);
- generator.setParameter(ApplicationDeploymentConstants.GATEWAY_ID, gatewayId);
- Query q = generator.selectQuery(em);
- List results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- ApplicationDeployment deployment = (ApplicationDeployment) result;
- AppDeploymentResource deploymentResource =
- (AppDeploymentResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.APPLICATION_DEPLOYMENT, deployment);
- appDeployments.add(deploymentResource);
- }
- }
- 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 appDeployments;
- }
-
- @Override
- public List<String> getAllIds() throws AppCatalogException {
- List<String> appDeployments = new ArrayList<String>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(APPLICATION_DEPLOYMENT);
- Query q = generator.selectQuery(em);
- List results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- ApplicationDeployment deployment = (ApplicationDeployment) result;
- appDeployments.add(deployment.getDeploymentID());
- }
- }
- 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 appDeployments;
- }
-
- @Override
- public List<String> getIds(String fieldName, Object value) throws AppCatalogException {
- List<String> appDeployments = new ArrayList<String>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- Query q;
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(APPLICATION_DEPLOYMENT);
- List results;
- if (fieldName.equals(ApplicationDeploymentConstants.APP_MODULE_ID)) {
- generator.setParameter(ApplicationDeploymentConstants.APP_MODULE_ID, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- ApplicationDeployment deployment = (ApplicationDeployment) result;
- appDeployments.add(deployment.getDeploymentID());
- }
- }
- } else if (fieldName.equals(ApplicationDeploymentConstants.COMPUTE_HOST_ID)) {
- generator.setParameter(ApplicationDeploymentConstants.COMPUTE_HOST_ID, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- ApplicationDeployment deployment = (ApplicationDeployment) result;
- appDeployments.add(deployment.getDeploymentID());
- }
- }
- }else {
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported field name for app deployment resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported field name for app deployment 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 appDeployments;
- }
-
- @Override
- public void save() throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- ApplicationDeployment existingDeployment = em.find(ApplicationDeployment.class, deploymentId);
- em.close();
-
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- ApplicationModule applicationModule = em.find(ApplicationModule.class, appModuleId);
- ComputeResource computeHost = em.find(ComputeResource.class, hostId);
- if (existingDeployment != null){
- existingDeployment.setDeploymentID(deploymentId);
- existingDeployment.setApplicationDesc(appDes);
- existingDeployment.setAppModuleID(appModuleId);
- existingDeployment.setApplicationModule(applicationModule);
- existingDeployment.setComputeResource(computeHost);
- existingDeployment.setHostID(hostId);
- existingDeployment.setExecutablePath(executablePath);
- existingDeployment.setParallelism(parallelism);
- existingDeployment.setGatewayId(gatewayId);
- existingDeployment.setUpdateTime(AiravataUtils.getCurrentTimestamp());
- em.merge(existingDeployment);
- }else {
- ApplicationDeployment deployment = new ApplicationDeployment();
- deployment.setApplicationDesc(appDes);
- deployment.setDeploymentID(deploymentId);
- deployment.setAppModuleID(appModuleId);
- deployment.setHostID(hostId);
- deployment.setApplicationModule(applicationModule);
- deployment.setComputeResource(computeHost);
- deployment.setExecutablePath(executablePath);
- deployment.setParallelism(parallelism);
- deployment.setGatewayId(gatewayId);
- deployment.setCreationTime(AiravataUtils.getCurrentTimestamp());
- em.persist(deployment);
- }
- 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 {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- ApplicationDeployment deployment = em.find(ApplicationDeployment.class, identifier);
- em.close();
- return deployment != null;
- } 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();
- }
- }
- }
-
- public String getParallelism() {
- return parallelism;
- }
-
- public void setParallelism(String parallelism) {
- this.parallelism = parallelism;
- }
-}
[05/52] [abbrv] [partial] airavata git commit: registry refactoring
Posted by sh...@apache.org.
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/SshJobSubmissionResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/SshJobSubmissionResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/SshJobSubmissionResource.java
new file mode 100644
index 0000000..ee14d76
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/SshJobSubmissionResource.java
@@ -0,0 +1,332 @@
+/**
+ * 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.aiaravata.application.catalog.data.resources;
+
+import java.sql.Timestamp;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.persistence.EntityManager;
+import javax.persistence.Query;
+
+import org.airavata.appcatalog.cpi.AppCatalogException;
+import org.apache.aiaravata.application.catalog.data.model.ResourceJobManager;
+import org.apache.aiaravata.application.catalog.data.model.SshJobSubmission;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogJPAUtils;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogQueryGenerator;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogResourceType;
+import org.apache.airavata.common.exception.ApplicationSettingsException;
+import org.apache.airavata.common.utils.AiravataUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class SshJobSubmissionResource extends AbstractResource {
+ private final static Logger logger = LoggerFactory.getLogger(SshJobSubmissionResource.class);
+ private String resourceJobManagerId;
+ private ResourceJobManagerResource resourceJobManagerResource;
+ private String jobSubmissionInterfaceId;
+ private String alternativeSshHostname;
+ private String securityProtocol;
+ private int sshPort;
+ private String monitorMode;
+ private Timestamp createdTime;
+ private Timestamp updatedTime;
+
+ public Timestamp getCreatedTime() {
+ return createdTime;
+ }
+
+ public void setCreatedTime(Timestamp createdTime) {
+ this.createdTime = createdTime;
+ }
+
+ public Timestamp getUpdatedTime() {
+ return updatedTime;
+ }
+
+ public void setUpdatedTime(Timestamp updatedTime) {
+ this.updatedTime = updatedTime;
+ }
+
+ @Override
+ public void remove(Object identifier) throws AppCatalogException {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(SSH_JOB_SUBMISSION);
+ generator.setParameter(SshJobSubmissionConstants.JOB_SUBMISSION_INTERFACE_ID, identifier);
+ 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 Resource get(Object identifier) throws AppCatalogException {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(SSH_JOB_SUBMISSION);
+ generator.setParameter(SshJobSubmissionConstants.JOB_SUBMISSION_INTERFACE_ID, identifier);
+ Query q = generator.selectQuery(em);
+ SshJobSubmission sshJobSubmission = (SshJobSubmission) q.getSingleResult();
+ SshJobSubmissionResource sshJobSubmissionResource = (SshJobSubmissionResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.SSH_JOB_SUBMISSION, sshJobSubmission);
+ em.getTransaction().commit();
+ em.close();
+ return sshJobSubmissionResource;
+ } 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<Resource> get(String fieldName, Object value) throws AppCatalogException {
+ List<Resource> sshJobSubmissionResources = new ArrayList<Resource>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(SSH_JOB_SUBMISSION);
+ Query q;
+ if ((fieldName.equals(SshJobSubmissionConstants.RESOURCE_JOB_MANAGER_ID)) || (fieldName.equals(SshJobSubmissionConstants.JOB_SUBMISSION_INTERFACE_ID)) || (fieldName.equals(SshJobSubmissionConstants.ALTERNATIVE_SSH_HOSTNAME)) || (fieldName.equals(SshJobSubmissionConstants.SECURITY_PROTOCOL)) || (fieldName.equals(SshJobSubmissionConstants.SSH_PORT))) {
+ generator.setParameter(fieldName, value);
+ q = generator.selectQuery(em);
+ List<?> results = q.getResultList();
+ for (Object result : results) {
+ SshJobSubmission sshJobSubmission = (SshJobSubmission) result;
+ SshJobSubmissionResource sshJobSubmissionResource = (SshJobSubmissionResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.SSH_JOB_SUBMISSION, sshJobSubmission);
+ sshJobSubmissionResources.add(sshJobSubmissionResource);
+ }
+ } else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for Ssh Job Submission Resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for Ssh Job Submission Resource.");
+ }
+ 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();
+ }
+ }
+ return sshJobSubmissionResources;
+ }
+
+ @Override
+ public List<Resource> 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 {
+ List<String> sshJobSubmissionResourceIDs = new ArrayList<String>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(SSH_JOB_SUBMISSION);
+ Query q;
+ if ((fieldName.equals(SshJobSubmissionConstants.RESOURCE_JOB_MANAGER_ID)) || (fieldName.equals(SshJobSubmissionConstants.JOB_SUBMISSION_INTERFACE_ID)) || (fieldName.equals(SshJobSubmissionConstants.ALTERNATIVE_SSH_HOSTNAME)) || (fieldName.equals(SshJobSubmissionConstants.SECURITY_PROTOCOL)) || (fieldName.equals(SshJobSubmissionConstants.SSH_PORT))) {
+ generator.setParameter(fieldName, value);
+ q = generator.selectQuery(em);
+ List<?> results = q.getResultList();
+ for (Object result : results) {
+ SshJobSubmission sshJobSubmission = (SshJobSubmission) result;
+ SshJobSubmissionResource sshJobSubmissionResource = (SshJobSubmissionResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.SSH_JOB_SUBMISSION, sshJobSubmission);
+ sshJobSubmissionResourceIDs.add(sshJobSubmissionResource.getJobSubmissionInterfaceId());
+ }
+ } else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for Ssh Job Submission Resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for Ssh Job Submission Resource.");
+ }
+ 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();
+ }
+ }
+ return sshJobSubmissionResourceIDs;
+ }
+
+ @Override
+ public void save() throws AppCatalogException {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ SshJobSubmission existingSshJobSubmission = em.find(SshJobSubmission.class, jobSubmissionInterfaceId);
+ em.close();
+ SshJobSubmission sshJobSubmission;
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ if (existingSshJobSubmission == null) {
+ sshJobSubmission = new SshJobSubmission();
+ sshJobSubmission.setCreationTime(AiravataUtils.getCurrentTimestamp());
+ } else {
+ sshJobSubmission = existingSshJobSubmission;
+ sshJobSubmission.setUpdateTime(AiravataUtils.getCurrentTimestamp());
+ }
+ sshJobSubmission.setResourceJobManagerId(getResourceJobManagerId());
+ ResourceJobManager resourceJobManager = em.find(ResourceJobManager.class, getResourceJobManagerId());
+ sshJobSubmission.setResourceJobManager(resourceJobManager);
+ sshJobSubmission.setJobSubmissionInterfaceId(getJobSubmissionInterfaceId());
+ sshJobSubmission.setAlternativeSshHostname(getAlternativeSshHostname());
+ sshJobSubmission.setSecurityProtocol(getSecurityProtocol());
+ sshJobSubmission.setSshPort(getSshPort());
+ sshJobSubmission.setMonitorMode(getMonitorMode());
+ if (existingSshJobSubmission == null) {
+ em.persist(sshJobSubmission);
+ } else {
+ em.merge(sshJobSubmission);
+ }
+ 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 {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ SshJobSubmission sshJobSubmission = em.find(SshJobSubmission.class, identifier);
+ em.close();
+ return sshJobSubmission != null;
+ } 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();
+ }
+ }
+ }
+
+ public String getResourceJobManagerId() {
+ return resourceJobManagerId;
+ }
+
+ public ResourceJobManagerResource getResourceJobManagerResource() {
+ return resourceJobManagerResource;
+ }
+
+ public String getJobSubmissionInterfaceId() {
+ return jobSubmissionInterfaceId;
+ }
+
+ public String getAlternativeSshHostname() {
+ return alternativeSshHostname;
+ }
+
+ public String getSecurityProtocol() {
+ return securityProtocol;
+ }
+
+ public int getSshPort() {
+ return sshPort;
+ }
+
+ public void setResourceJobManagerId(String resourceJobManagerId) {
+ this.resourceJobManagerId=resourceJobManagerId;
+ }
+
+ public void setResourceJobManagerResource(ResourceJobManagerResource resourceJobManagerResource) {
+ this.resourceJobManagerResource=resourceJobManagerResource;
+ }
+
+ public void setJobSubmissionInterfaceId(String jobSubmissionInterfaceId) {
+ this.jobSubmissionInterfaceId=jobSubmissionInterfaceId;
+ }
+
+ public void setAlternativeSshHostname(String alternativeSshHostname) {
+ this.alternativeSshHostname=alternativeSshHostname;
+ }
+
+ public void setSecurityProtocol(String securityProtocol) {
+ this.securityProtocol=securityProtocol;
+ }
+
+ public void setSshPort(int sshPort) {
+ this.sshPort=sshPort;
+ }
+
+ public String getMonitorMode() {
+ return monitorMode;
+ }
+
+ public void setMonitorMode(String monitorMode) {
+ this.monitorMode = monitorMode;
+ }
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/UnicoreDataMovementAppCatalogResourceAppCat.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/UnicoreDataMovementAppCatalogResourceAppCat.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/UnicoreDataMovementAppCatalogResourceAppCat.java
new file mode 100644
index 0000000..af8899a
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/UnicoreDataMovementAppCatalogResourceAppCat.java
@@ -0,0 +1,255 @@
+/*
+ *
+ * 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.UnicoreDataMovement;
+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.List;
+
+public class UnicoreDataMovementAppCatalogResourceAppCat extends AppCatAbstractResource {
+
+ private final static Logger logger = LoggerFactory.getLogger(UnicoreDataMovementAppCatalogResourceAppCat.class);
+
+ private String dataMovementId;
+ private String securityProtocol;
+ private String unicoreEndpointUrl;
+
+ public void remove(Object identifier) throws AppCatalogException {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(UNICORE_DATA_MOVEMENT);
+ generator.setParameter(UnicoreDataMovementConstants.DATAMOVEMENT_ID, identifier);
+ 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();
+ }
+ }
+ }
+
+ public AppCatalogResource get(Object identifier) throws AppCatalogException {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(UNICORE_DATA_MOVEMENT);
+ generator.setParameter(UnicoreDataMovementConstants.DATAMOVEMENT_ID, identifier);
+ Query q = generator.selectQuery(em);
+ UnicoreDataMovement unicoreDataMovement = (UnicoreDataMovement) q.getSingleResult();
+ UnicoreDataMovementAppCatalogResourceAppCat dataMovementResource =
+ (UnicoreDataMovementAppCatalogResourceAppCat) AppCatalogJPAUtils
+ .getResource(AppCatalogResourceType.UNICORE_DATA_MOVEMENT,
+ unicoreDataMovement);
+ em.getTransaction().commit();
+ em.close();
+ return dataMovementResource;
+ } 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();
+ }
+ }
+ }
+
+
+ public List<AppCatalogResource> get(String fieldName, Object value) throws AppCatalogException {
+ List<AppCatalogResource> unicoreDMResourceList = new ArrayList<AppCatalogResource>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ Query q;
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(UNICORE_DATA_MOVEMENT);
+ List results;
+ if (fieldName.equals(UnicoreDataMovementConstants.UNICORE_ENDPOINT_URL)) {
+ generator.setParameter(UnicoreDataMovementConstants.UNICORE_ENDPOINT_URL, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ UnicoreDataMovement dataMovement = (UnicoreDataMovement) result;
+ UnicoreDataMovementAppCatalogResourceAppCat unicoreJobSubmissionResource =
+ (UnicoreDataMovementAppCatalogResourceAppCat) AppCatalogJPAUtils.getResource(
+ AppCatalogResourceType.UNICORE_DATA_MOVEMENT, dataMovement);
+ unicoreDMResourceList.add(unicoreJobSubmissionResource);
+ }
+ }
+ } else if (fieldName.equals(UnicoreDataMovementConstants.SECURITY_PROTOCAL)) {
+ generator.setParameter(UnicoreDataMovementConstants.SECURITY_PROTOCAL, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ UnicoreDataMovement dataMovement = (UnicoreDataMovement) result;
+ UnicoreDataMovementAppCatalogResourceAppCat dataMovementResource =
+ (UnicoreDataMovementAppCatalogResourceAppCat) AppCatalogJPAUtils.getResource(
+ AppCatalogResourceType.UNICORE_DATA_MOVEMENT, dataMovement);
+ unicoreDMResourceList.add(dataMovementResource);
+ }
+ }
+ } else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for Unicore data movement resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for Unicore data movement 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 unicoreDMResourceList;
+ }
+
+ @Override
+ public List<AppCatalogResource> getAll() throws AppCatalogException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public List<String> getAllIds() throws AppCatalogException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public List<String> getIds(String fieldName, Object value) throws AppCatalogException {
+ return null;
+ }
+
+ public void save() throws AppCatalogException {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ UnicoreDataMovement existingDataMovement = em.find(UnicoreDataMovement.class, dataMovementId);
+ em.close();
+
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ if (existingDataMovement != null) {
+ existingDataMovement.setDataMovementId(dataMovementId);;
+ existingDataMovement.setUnicoreEndpointUrl(unicoreEndpointUrl);
+ existingDataMovement.setSecurityProtocol(securityProtocol);
+ em.merge(existingDataMovement);
+ } else {
+ UnicoreDataMovement unicoreJobSubmission = new UnicoreDataMovement();
+ unicoreJobSubmission.setDataMovementId(dataMovementId);
+ unicoreJobSubmission.setUnicoreEndpointUrl(unicoreEndpointUrl);
+ unicoreJobSubmission.setSecurityProtocol(securityProtocol);
+ em.persist(unicoreJobSubmission);
+ }
+ 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();
+ }
+ }
+ }
+
+ public boolean isExists(Object identifier) throws AppCatalogException {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ UnicoreDataMovement dataMovement = em.find(UnicoreDataMovement.class, identifier);
+ em.close();
+ return dataMovement != null;
+ } 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();
+ }
+ }
+ }
+
+
+ public String getDataMovementId() {
+ return dataMovementId;
+ }
+
+ public void setDataMovementId(String dataMovementId) {
+ this.dataMovementId = dataMovementId;
+ }
+
+ public String getSecurityProtocol() {
+ return securityProtocol;
+ }
+
+ public void setSecurityProtocol(String securityProtocol) {
+ this.securityProtocol = securityProtocol;
+ }
+
+ public String getUnicoreEndpointUrl() {
+ return unicoreEndpointUrl;
+ }
+
+ public void setUnicoreEndpointUrl(String unicoreEndpointUrl) {
+ this.unicoreEndpointUrl = unicoreEndpointUrl;
+ }
+
+
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/UnicoreDataMovementResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/UnicoreDataMovementResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/UnicoreDataMovementResource.java
new file mode 100644
index 0000000..63f2b70
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/UnicoreDataMovementResource.java
@@ -0,0 +1,255 @@
+/*
+ *
+ * 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.aiaravata.application.catalog.data.resources;
+
+import org.airavata.appcatalog.cpi.AppCatalogException;
+import org.apache.aiaravata.application.catalog.data.model.UnicoreDataMovement;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogJPAUtils;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogQueryGenerator;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogResourceType;
+import org.apache.airavata.common.exception.ApplicationSettingsException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.persistence.EntityManager;
+import javax.persistence.Query;
+import java.util.ArrayList;
+import java.util.List;
+
+public class UnicoreDataMovementResource extends AbstractResource {
+
+ private final static Logger logger = LoggerFactory.getLogger(UnicoreDataMovementResource.class);
+
+ private String dataMovementId;
+ private String securityProtocol;
+ private String unicoreEndpointUrl;
+
+ public void remove(Object identifier) throws AppCatalogException {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(UNICORE_DATA_MOVEMENT);
+ generator.setParameter(UnicoreDataMovementConstants.DATAMOVEMENT_ID, identifier);
+ 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();
+ }
+ }
+ }
+
+ public Resource get(Object identifier) throws AppCatalogException {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(UNICORE_DATA_MOVEMENT);
+ generator.setParameter(UnicoreDataMovementConstants.DATAMOVEMENT_ID, identifier);
+ Query q = generator.selectQuery(em);
+ UnicoreDataMovement unicoreDataMovement = (UnicoreDataMovement) q.getSingleResult();
+ UnicoreDataMovementResource dataMovementResource =
+ (UnicoreDataMovementResource) AppCatalogJPAUtils
+ .getResource(AppCatalogResourceType.UNICORE_DATA_MOVEMENT,
+ unicoreDataMovement);
+ em.getTransaction().commit();
+ em.close();
+ return dataMovementResource;
+ } 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();
+ }
+ }
+ }
+
+
+ public List<Resource> get(String fieldName, Object value) throws AppCatalogException {
+ List<Resource> unicoreDMResourceList = new ArrayList<Resource>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ Query q;
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(UNICORE_DATA_MOVEMENT);
+ List results;
+ if (fieldName.equals(UnicoreDataMovementConstants.UNICORE_ENDPOINT_URL)) {
+ generator.setParameter(UnicoreDataMovementConstants.UNICORE_ENDPOINT_URL, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ UnicoreDataMovement dataMovement = (UnicoreDataMovement) result;
+ UnicoreDataMovementResource unicoreJobSubmissionResource =
+ (UnicoreDataMovementResource) AppCatalogJPAUtils.getResource(
+ AppCatalogResourceType.UNICORE_DATA_MOVEMENT, dataMovement);
+ unicoreDMResourceList.add(unicoreJobSubmissionResource);
+ }
+ }
+ } else if (fieldName.equals(UnicoreDataMovementConstants.SECURITY_PROTOCAL)) {
+ generator.setParameter(UnicoreDataMovementConstants.SECURITY_PROTOCAL, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ UnicoreDataMovement dataMovement = (UnicoreDataMovement) result;
+ UnicoreDataMovementResource dataMovementResource =
+ (UnicoreDataMovementResource) AppCatalogJPAUtils.getResource(
+ AppCatalogResourceType.UNICORE_DATA_MOVEMENT, dataMovement);
+ unicoreDMResourceList.add(dataMovementResource);
+ }
+ }
+ } else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for Unicore data movement resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for Unicore data movement 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 unicoreDMResourceList;
+ }
+
+ @Override
+ public List<Resource> getAll() throws AppCatalogException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public List<String> getAllIds() throws AppCatalogException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public List<String> getIds(String fieldName, Object value) throws AppCatalogException {
+ return null;
+ }
+
+ public void save() throws AppCatalogException {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ UnicoreDataMovement existingDataMovement = em.find(UnicoreDataMovement.class, dataMovementId);
+ em.close();
+
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ if (existingDataMovement != null) {
+ existingDataMovement.setDataMovementId(dataMovementId);;
+ existingDataMovement.setUnicoreEndpointUrl(unicoreEndpointUrl);
+ existingDataMovement.setSecurityProtocol(securityProtocol);
+ em.merge(existingDataMovement);
+ } else {
+ UnicoreDataMovement unicoreJobSubmission = new UnicoreDataMovement();
+ unicoreJobSubmission.setDataMovementId(dataMovementId);
+ unicoreJobSubmission.setUnicoreEndpointUrl(unicoreEndpointUrl);
+ unicoreJobSubmission.setSecurityProtocol(securityProtocol);
+ em.persist(unicoreJobSubmission);
+ }
+ 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();
+ }
+ }
+ }
+
+ public boolean isExists(Object identifier) throws AppCatalogException {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ UnicoreDataMovement dataMovement = em.find(UnicoreDataMovement.class, identifier);
+ em.close();
+ return dataMovement != null;
+ } 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();
+ }
+ }
+ }
+
+
+ public String getDataMovementId() {
+ return dataMovementId;
+ }
+
+ public void setDataMovementId(String dataMovementId) {
+ this.dataMovementId = dataMovementId;
+ }
+
+ public String getSecurityProtocol() {
+ return securityProtocol;
+ }
+
+ public void setSecurityProtocol(String securityProtocol) {
+ this.securityProtocol = securityProtocol;
+ }
+
+ public String getUnicoreEndpointUrl() {
+ return unicoreEndpointUrl;
+ }
+
+ public void setUnicoreEndpointUrl(String unicoreEndpointUrl) {
+ this.unicoreEndpointUrl = unicoreEndpointUrl;
+ }
+
+
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/UnicoreJobSubmissionAppCatalogResourceAppCat.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/UnicoreJobSubmissionAppCatalogResourceAppCat.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/UnicoreJobSubmissionAppCatalogResourceAppCat.java
new file mode 100644
index 0000000..ae029f2
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/UnicoreJobSubmissionAppCatalogResourceAppCat.java
@@ -0,0 +1,328 @@
+/*
+ *
+ * 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 java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+
+import javax.persistence.EntityManager;
+import javax.persistence.Query;
+
+import org.apache.airavata.common.exception.ApplicationSettingsException;
+import org.apache.airavata.registry.core.app.catalog.model.GlobusJobSubmission;
+import org.apache.airavata.registry.core.app.catalog.model.UnicoreJobSubmission;
+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;
+
+public class UnicoreJobSubmissionAppCatalogResourceAppCat extends AppCatAbstractResource {
+
+ private final static Logger logger = LoggerFactory.getLogger(UnicoreJobSubmissionAppCatalogResourceAppCat.class);
+
+ private String jobSubmissionInterfaceId;
+ private String securityProtocol;
+ private String unicoreEndpointUrl;
+
+ public void remove(Object identifier) throws AppCatalogException {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(UNICORE_JOB_SUBMISSION);
+ generator.setParameter(UnicoreJobSubmissionConstants.SUBMISSION_ID, identifier);
+ 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();
+ }
+ }
+ }
+
+ public AppCatalogResource get(Object identifier) throws AppCatalogException {
+ HashMap<String, String> ids;
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(UNICORE_JOB_SUBMISSION);
+ generator.setParameter(UnicoreJobSubmissionConstants.SUBMISSION_ID, identifier);
+ Query q = generator.selectQuery(em);
+ UnicoreJobSubmission unicoreJobSubmission = (UnicoreJobSubmission) q.getSingleResult();
+ UnicoreJobSubmissionAppCatalogResourceAppCat unicoreSubmissionResource =
+ (UnicoreJobSubmissionAppCatalogResourceAppCat) AppCatalogJPAUtils
+ .getResource(AppCatalogResourceType.UNICORE_JOB_SUBMISSION,
+ unicoreJobSubmission);
+ em.getTransaction().commit();
+ em.close();
+ return unicoreSubmissionResource;
+ } 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();
+ }
+ }
+ }
+
+
+ public List<AppCatalogResource> get(String fieldName, Object value) throws AppCatalogException {
+ List<AppCatalogResource> unicoreSubmissionResourceList = new ArrayList<AppCatalogResource>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ Query q;
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(UNICORE_JOB_SUBMISSION);
+ List results;
+ if (fieldName.equals(UnicoreJobSubmissionConstants.UNICORE_ENDPOINT_URL)) {
+ generator.setParameter(UnicoreJobSubmissionConstants.UNICORE_ENDPOINT_URL, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ UnicoreJobSubmission unicoreJobSubmission = (UnicoreJobSubmission) result;
+ UnicoreJobSubmissionAppCatalogResourceAppCat unicoreJobSubmissionResource =
+ (UnicoreJobSubmissionAppCatalogResourceAppCat) AppCatalogJPAUtils.getResource(
+ AppCatalogResourceType.UNICORE_JOB_SUBMISSION, unicoreJobSubmission);
+ unicoreSubmissionResourceList.add(unicoreJobSubmissionResource);
+ }
+ }
+ } else if (fieldName.equals(UnicoreJobSubmissionConstants.SECURITY_PROTOCAL)) {
+ generator.setParameter(UnicoreJobSubmissionConstants.SECURITY_PROTOCAL, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ UnicoreJobSubmission unicoreJobSubmission = (UnicoreJobSubmission) result;
+ UnicoreJobSubmissionAppCatalogResourceAppCat unicoreJobSubmissionResource =
+ (UnicoreJobSubmissionAppCatalogResourceAppCat) AppCatalogJPAUtils.getResource(
+ AppCatalogResourceType.UNICORE_JOB_SUBMISSION, unicoreJobSubmission);
+ unicoreSubmissionResourceList.add(unicoreJobSubmissionResource);
+ }
+ }
+ }
+ else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for Unicore submission resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for Unicore Submission 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 unicoreSubmissionResourceList;
+ }
+
+ @Override
+ public List<AppCatalogResource> getAll() throws AppCatalogException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public List<String> getAllIds() throws AppCatalogException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public List<String> getIds(String fieldName, Object value) throws AppCatalogException {
+ List<String> globusSubmissionResourceIDs = new ArrayList<String>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ Query q;
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(GLOBUS_SUBMISSION);
+ List results;
+ if (fieldName.equals(GlobusJobSubmissionConstants.SUBMISSION_ID)) {
+ generator.setParameter(GlobusJobSubmissionConstants.SUBMISSION_ID, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ GlobusJobSubmission globusJobSubmission = (GlobusJobSubmission) result;
+ globusSubmissionResourceIDs.add(globusJobSubmission.getSubmissionID());
+ }
+ }
+ } else if (fieldName.equals(GlobusJobSubmissionConstants.GLOBUS_GATEKEEPER_EP)) {
+ generator.setParameter(GlobusJobSubmissionConstants.GLOBUS_GATEKEEPER_EP, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ GlobusJobSubmission globusJobSubmission = (GlobusJobSubmission) result;
+ globusSubmissionResourceIDs.add(globusJobSubmission.getSubmissionID());
+ }
+ }
+ }
+ else if (fieldName.equals(GlobusJobSubmissionConstants.SECURITY_PROTOCAL)) {
+ generator.setParameter(GlobusJobSubmissionConstants.SECURITY_PROTOCAL, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ GlobusJobSubmission globusJobSubmission = (GlobusJobSubmission) result;
+ globusSubmissionResourceIDs.add(globusJobSubmission.getSubmissionID());
+ }
+ }
+ } else if (fieldName.equals(GlobusJobSubmissionConstants.RESOURCE_JOB_MANAGER)) {
+ generator.setParameter(GlobusJobSubmissionConstants.RESOURCE_JOB_MANAGER, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ GlobusJobSubmission globusJobSubmission = (GlobusJobSubmission) result;
+ globusSubmissionResourceIDs.add(globusJobSubmission.getSubmissionID());
+ }
+ }
+ } else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for Globus Submission resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for Globus Submission 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 globusSubmissionResourceIDs;
+ }
+
+ public void save() throws AppCatalogException {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ UnicoreJobSubmission existingUnicoreSubmission = em.find(UnicoreJobSubmission.class, jobSubmissionInterfaceId);
+ em.close();
+
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ if (existingUnicoreSubmission != null) {
+ existingUnicoreSubmission.setSubmissionID(jobSubmissionInterfaceId);;
+ existingUnicoreSubmission.setUnicoreEndpointUrl(unicoreEndpointUrl);
+ existingUnicoreSubmission.setSecurityProtocol(securityProtocol);
+
+ em.merge(existingUnicoreSubmission);
+ } else {
+ UnicoreJobSubmission unicoreJobSubmission = new UnicoreJobSubmission();
+ unicoreJobSubmission.setSubmissionID(jobSubmissionInterfaceId);
+ unicoreJobSubmission.setUnicoreEndpointUrl(unicoreEndpointUrl);
+ unicoreJobSubmission.setSecurityProtocol(securityProtocol);
+ em.persist(unicoreJobSubmission);
+ }
+ 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();
+ }
+ }
+ }
+
+ public boolean isExists(Object identifier) throws AppCatalogException {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ UnicoreJobSubmission unicoreJobSubmission = em.find(UnicoreJobSubmission.class, identifier);
+ em.close();
+ return unicoreJobSubmission != null;
+ } 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();
+ }
+ }
+ }
+
+
+ public String getjobSubmissionInterfaceId() {
+ return jobSubmissionInterfaceId;
+ }
+
+ public void setjobSubmissionInterfaceId(String jobSubmissionInterfaceId) {
+ this.jobSubmissionInterfaceId = jobSubmissionInterfaceId;
+ }
+
+ public String getSecurityProtocol() {
+ return securityProtocol;
+ }
+
+ public void setSecurityProtocol(String securityProtocol) {
+ this.securityProtocol = securityProtocol;
+ }
+
+ public String getUnicoreEndpointUrl() {
+ return unicoreEndpointUrl;
+ }
+
+ public void setUnicoreEndpointUrl(String unicoreEndpointUrl) {
+ this.unicoreEndpointUrl = unicoreEndpointUrl;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/UnicoreJobSubmissionResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/UnicoreJobSubmissionResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/UnicoreJobSubmissionResource.java
new file mode 100644
index 0000000..4c772e1
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/UnicoreJobSubmissionResource.java
@@ -0,0 +1,328 @@
+/*
+ *
+ * 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.aiaravata.application.catalog.data.resources;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+
+import javax.persistence.EntityManager;
+import javax.persistence.Query;
+
+import org.airavata.appcatalog.cpi.AppCatalogException;
+import org.apache.aiaravata.application.catalog.data.model.GlobusJobSubmission;
+import org.apache.aiaravata.application.catalog.data.model.UnicoreJobSubmission;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogJPAUtils;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogQueryGenerator;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogResourceType;
+import org.apache.airavata.common.exception.ApplicationSettingsException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class UnicoreJobSubmissionResource extends AbstractResource {
+
+ private final static Logger logger = LoggerFactory.getLogger(UnicoreJobSubmissionResource.class);
+
+ private String jobSubmissionInterfaceId;
+ private String securityProtocol;
+ private String unicoreEndpointUrl;
+
+ public void remove(Object identifier) throws AppCatalogException {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(UNICORE_JOB_SUBMISSION);
+ generator.setParameter(UnicoreJobSubmissionConstants.SUBMISSION_ID, identifier);
+ 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();
+ }
+ }
+ }
+
+ public Resource get(Object identifier) throws AppCatalogException {
+ HashMap<String, String> ids;
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(UNICORE_JOB_SUBMISSION);
+ generator.setParameter(UnicoreJobSubmissionConstants.SUBMISSION_ID, identifier);
+ Query q = generator.selectQuery(em);
+ UnicoreJobSubmission unicoreJobSubmission = (UnicoreJobSubmission) q.getSingleResult();
+ UnicoreJobSubmissionResource unicoreSubmissionResource =
+ (UnicoreJobSubmissionResource) AppCatalogJPAUtils
+ .getResource(AppCatalogResourceType.UNICORE_JOB_SUBMISSION,
+ unicoreJobSubmission);
+ em.getTransaction().commit();
+ em.close();
+ return unicoreSubmissionResource;
+ } 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();
+ }
+ }
+ }
+
+
+ public List<Resource> get(String fieldName, Object value) throws AppCatalogException {
+ List<Resource> unicoreSubmissionResourceList = new ArrayList<Resource>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ Query q;
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(UNICORE_JOB_SUBMISSION);
+ List results;
+ if (fieldName.equals(UnicoreJobSubmissionConstants.UNICORE_ENDPOINT_URL)) {
+ generator.setParameter(UnicoreJobSubmissionConstants.UNICORE_ENDPOINT_URL, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ UnicoreJobSubmission unicoreJobSubmission = (UnicoreJobSubmission) result;
+ UnicoreJobSubmissionResource unicoreJobSubmissionResource =
+ (UnicoreJobSubmissionResource) AppCatalogJPAUtils.getResource(
+ AppCatalogResourceType.UNICORE_JOB_SUBMISSION, unicoreJobSubmission);
+ unicoreSubmissionResourceList.add(unicoreJobSubmissionResource);
+ }
+ }
+ } else if (fieldName.equals(UnicoreJobSubmissionConstants.SECURITY_PROTOCAL)) {
+ generator.setParameter(UnicoreJobSubmissionConstants.SECURITY_PROTOCAL, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ UnicoreJobSubmission unicoreJobSubmission = (UnicoreJobSubmission) result;
+ UnicoreJobSubmissionResource unicoreJobSubmissionResource =
+ (UnicoreJobSubmissionResource) AppCatalogJPAUtils.getResource(
+ AppCatalogResourceType.UNICORE_JOB_SUBMISSION, unicoreJobSubmission);
+ unicoreSubmissionResourceList.add(unicoreJobSubmissionResource);
+ }
+ }
+ }
+ else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for Unicore submission resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for Unicore Submission 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 unicoreSubmissionResourceList;
+ }
+
+ @Override
+ public List<Resource> getAll() throws AppCatalogException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public List<String> getAllIds() throws AppCatalogException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public List<String> getIds(String fieldName, Object value) throws AppCatalogException {
+ List<String> globusSubmissionResourceIDs = new ArrayList<String>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ Query q;
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(GLOBUS_SUBMISSION);
+ List results;
+ if (fieldName.equals(GlobusJobSubmissionConstants.SUBMISSION_ID)) {
+ generator.setParameter(GlobusJobSubmissionConstants.SUBMISSION_ID, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ GlobusJobSubmission globusJobSubmission = (GlobusJobSubmission) result;
+ globusSubmissionResourceIDs.add(globusJobSubmission.getSubmissionID());
+ }
+ }
+ } else if (fieldName.equals(GlobusJobSubmissionConstants.GLOBUS_GATEKEEPER_EP)) {
+ generator.setParameter(GlobusJobSubmissionConstants.GLOBUS_GATEKEEPER_EP, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ GlobusJobSubmission globusJobSubmission = (GlobusJobSubmission) result;
+ globusSubmissionResourceIDs.add(globusJobSubmission.getSubmissionID());
+ }
+ }
+ }
+ else if (fieldName.equals(GlobusJobSubmissionConstants.SECURITY_PROTOCAL)) {
+ generator.setParameter(GlobusJobSubmissionConstants.SECURITY_PROTOCAL, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ GlobusJobSubmission globusJobSubmission = (GlobusJobSubmission) result;
+ globusSubmissionResourceIDs.add(globusJobSubmission.getSubmissionID());
+ }
+ }
+ } else if (fieldName.equals(GlobusJobSubmissionConstants.RESOURCE_JOB_MANAGER)) {
+ generator.setParameter(GlobusJobSubmissionConstants.RESOURCE_JOB_MANAGER, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ GlobusJobSubmission globusJobSubmission = (GlobusJobSubmission) result;
+ globusSubmissionResourceIDs.add(globusJobSubmission.getSubmissionID());
+ }
+ }
+ } else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for Globus Submission resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for Globus Submission 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 globusSubmissionResourceIDs;
+ }
+
+ public void save() throws AppCatalogException {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ UnicoreJobSubmission existingUnicoreSubmission = em.find(UnicoreJobSubmission.class, jobSubmissionInterfaceId);
+ em.close();
+
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ if (existingUnicoreSubmission != null) {
+ existingUnicoreSubmission.setSubmissionID(jobSubmissionInterfaceId);;
+ existingUnicoreSubmission.setUnicoreEndpointUrl(unicoreEndpointUrl);
+ existingUnicoreSubmission.setSecurityProtocol(securityProtocol);
+
+ em.merge(existingUnicoreSubmission);
+ } else {
+ UnicoreJobSubmission unicoreJobSubmission = new UnicoreJobSubmission();
+ unicoreJobSubmission.setSubmissionID(jobSubmissionInterfaceId);
+ unicoreJobSubmission.setUnicoreEndpointUrl(unicoreEndpointUrl);
+ unicoreJobSubmission.setSecurityProtocol(securityProtocol);
+ em.persist(unicoreJobSubmission);
+ }
+ 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();
+ }
+ }
+ }
+
+ public boolean isExists(Object identifier) throws AppCatalogException {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ UnicoreJobSubmission unicoreJobSubmission = em.find(UnicoreJobSubmission.class, identifier);
+ em.close();
+ return unicoreJobSubmission != null;
+ } 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();
+ }
+ }
+ }
+
+
+ public String getjobSubmissionInterfaceId() {
+ return jobSubmissionInterfaceId;
+ }
+
+ public void setjobSubmissionInterfaceId(String jobSubmissionInterfaceId) {
+ this.jobSubmissionInterfaceId = jobSubmissionInterfaceId;
+ }
+
+ public String getSecurityProtocol() {
+ return securityProtocol;
+ }
+
+ public void setSecurityProtocol(String securityProtocol) {
+ this.securityProtocol = securityProtocol;
+ }
+
+ public String getUnicoreEndpointUrl() {
+ return unicoreEndpointUrl;
+ }
+
+ public void setUnicoreEndpointUrl(String unicoreEndpointUrl) {
+ this.unicoreEndpointUrl = unicoreEndpointUrl;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/WorkflowAppCatalogResourceAppCat.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/WorkflowAppCatalogResourceAppCat.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/WorkflowAppCatalogResourceAppCat.java
new file mode 100644
index 0000000..ffc0fff
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/WorkflowAppCatalogResourceAppCat.java
@@ -0,0 +1,382 @@
+/*
+ *
+ * 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.common.utils.AiravataUtils;
+import org.apache.airavata.registry.core.app.catalog.model.Workflow;
+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.sql.Timestamp;
+import java.util.ArrayList;
+import java.util.List;
+
+public class WorkflowAppCatalogResourceAppCat extends AppCatAbstractResource {
+ private final static Logger logger = LoggerFactory.getLogger(WorkflowAppCatalogResourceAppCat.class);
+ private String wfName;
+ private String createdUser;
+ private String graph;
+ private String wfTemplateId;
+ private Timestamp createdTime;
+ private Timestamp updatedTime;
+ private String image;
+ private String gatewayId;
+
+ public Timestamp getCreatedTime() {
+ return createdTime;
+ }
+
+ public void setCreatedTime(Timestamp createdTime) {
+ this.createdTime = createdTime;
+ }
+
+ public Timestamp getUpdatedTime() {
+ return updatedTime;
+ }
+
+ public void setUpdatedTime(Timestamp updatedTime) {
+ this.updatedTime = updatedTime;
+ }
+
+ public String getImage() {
+ return image;
+ }
+
+ public void setImage(String image) {
+ this.image = image;
+ }
+
+ public String getGatewayId() {
+ return gatewayId;
+ }
+
+ public void setGatewayId(String gatewayId) {
+ this.gatewayId = gatewayId;
+ }
+
+ @Override
+ public void remove(Object identifier) throws AppCatalogException {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(WORKFLOW);
+ generator.setParameter(WorkflowConstants.WF_TEMPLATE_ID, identifier);
+ 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 {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(WORKFLOW);
+ generator.setParameter(WorkflowConstants.WF_TEMPLATE_ID, identifier);
+ Query q = generator.selectQuery(em);
+ Workflow workflow = (Workflow) q.getSingleResult();
+ WorkflowAppCatalogResourceAppCat workflowResource = (WorkflowAppCatalogResourceAppCat) AppCatalogJPAUtils.getResource(AppCatalogResourceType.WORKFLOW, workflow);
+ em.getTransaction().commit();
+ em.close();
+ return workflowResource;
+ } 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> workflowResources = new ArrayList<AppCatalogResource>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(WORKFLOW);
+ Query q;
+ if ((fieldName.equals(WorkflowConstants.WF_NAME)) || (fieldName.equals(WorkflowConstants.CREATED_USER)) || (fieldName.equals(WorkflowConstants.GRAPH)) || (fieldName.equals(WorkflowConstants.WF_TEMPLATE_ID))) {
+ generator.setParameter(fieldName, value);
+ q = generator.selectQuery(em);
+ List<?> results = q.getResultList();
+ for (Object result : results) {
+ Workflow workflow = (Workflow) result;
+ WorkflowAppCatalogResourceAppCat workflowResource = (WorkflowAppCatalogResourceAppCat) AppCatalogJPAUtils.getResource(AppCatalogResourceType.WORKFLOW, workflow);
+ workflowResources.add(workflowResource);
+ }
+ } else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for Workflow Resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for Workflow Resource.");
+ }
+ 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();
+ }
+ }
+ return workflowResources;
+ }
+
+ @Override
+ public List<AppCatalogResource> getAll() throws AppCatalogException {
+ List<AppCatalogResource> workflows = new ArrayList<AppCatalogResource>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(WORKFLOW);
+ generator.setParameter(WorkflowConstants.GATEWAY_ID, gatewayId);
+ Query q = generator.selectQuery(em);
+ List results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ Workflow workflow = (Workflow) result;
+ WorkflowAppCatalogResourceAppCat wfResource =
+ (WorkflowAppCatalogResourceAppCat) AppCatalogJPAUtils.getResource(AppCatalogResourceType.WORKFLOW, workflow);
+ workflows.add(wfResource);
+ }
+ }
+ 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 workflows;
+ }
+
+ @Override
+ public List<String> getAllIds() throws AppCatalogException {
+ List<String> workflowIds = new ArrayList<String>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(WORKFLOW);
+ generator.setParameter(WorkflowConstants.GATEWAY_ID, gatewayId);
+ Query q = generator.selectQuery(em);
+ List results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ Workflow workflow = (Workflow) result;
+ workflowIds.add(workflow.getWfTemplateId());
+ }
+ }
+ 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 workflowIds;
+ }
+
+ @Override
+ public List<String> getIds(String fieldName, Object value) throws AppCatalogException {
+ List<String> workflowResourceIDs = new ArrayList<String>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(WORKFLOW);
+ Query q;
+ if ((fieldName.equals(WorkflowConstants.WF_NAME)) || (fieldName.equals(WorkflowConstants.CREATED_USER)) || (fieldName.equals(WorkflowConstants.GRAPH)) || (fieldName.equals(WorkflowConstants.WF_TEMPLATE_ID))) {
+ generator.setParameter(fieldName, value);
+ q = generator.selectQuery(em);
+ List<?> results = q.getResultList();
+ for (Object result : results) {
+ Workflow workflow = (Workflow) result;
+ WorkflowAppCatalogResourceAppCat workflowResource = (WorkflowAppCatalogResourceAppCat) AppCatalogJPAUtils.getResource(AppCatalogResourceType.WORKFLOW, workflow);
+ workflowResourceIDs.add(workflowResource.getWfTemplateId());
+ }
+ } else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for Workflow Resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for Workflow Resource.");
+ }
+ 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();
+ }
+ }
+ return workflowResourceIDs;
+ }
+
+ @Override
+ public void save() throws AppCatalogException {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ Workflow existingWorkflow = em.find(Workflow.class, wfTemplateId);
+ em.close();
+ Workflow workflow;
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ if (existingWorkflow == null) {
+ workflow = new Workflow();
+ workflow.setCreationTime(AiravataUtils.getCurrentTimestamp());
+ } else {
+ workflow = existingWorkflow;
+ workflow.setUpdateTime(AiravataUtils.getCurrentTimestamp());
+ }
+ workflow.setWfName(getWfName());
+ workflow.setCreatedUser(getCreatedUser());
+ workflow.setGatewayId(gatewayId);
+ if (getGraph() != null){
+ workflow.setGraph(getGraph().toCharArray());
+ }
+ if (image != null){
+ workflow.setImage(image.getBytes());
+ }
+ workflow.setWfTemplateId(getWfTemplateId());
+ if (existingWorkflow == null) {
+ em.persist(workflow);
+ } else {
+ em.merge(workflow);
+ }
+ 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 {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ Workflow workflow = em.find(Workflow.class, identifier);
+ em.close();
+ return workflow != null;
+ } 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();
+ }
+ }
+ }
+
+ public String getWfName() {
+ return wfName;
+ }
+
+ public String getCreatedUser() {
+ return createdUser;
+ }
+
+ public String getGraph() {
+ return graph;
+ }
+
+ public String getWfTemplateId() {
+ return wfTemplateId;
+ }
+
+ public void setWfName(String wfName) {
+ this.wfName=wfName;
+ }
+
+ public void setCreatedUser(String createdUser) {
+ this.createdUser=createdUser;
+ }
+
+ public void setGraph(String graph) {
+ this.graph=graph;
+ }
+
+ public void setWfTemplateId(String wfTemplateId) {
+ this.wfTemplateId=wfTemplateId;
+ }
+}
[31/52] [abbrv] [partial] airavata git commit: registry refactoring
Posted by sh...@apache.org.
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/ApplicationOutput.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/ApplicationOutput.java b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/ApplicationOutput.java
deleted file mode 100644
index d82ca87..0000000
--- a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/ApplicationOutput.java
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
- *
- * 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.experiment.catalog.model;
-
-import org.apache.openjpa.persistence.DataCache;
-
-import javax.persistence.*;
-import java.io.Serializable;
-
-@DataCache
-@Entity
-@Table(name = "APPLICATION_OUTPUT")
-@IdClass(ApplicationOutput_PK.class)
-public class ApplicationOutput implements Serializable {
- @Id
- @Column(name = "TASK_ID")
- private String taskId;
- @Id
- @Column(name = "OUTPUT_KEY")
- private String outputKey;
- @Column(name = "DATA_TYPE")
- private String dataType;
- @Lob
- @Column(name = "VALUE")
- private char[] value;
-
- @Column(name = "IS_REQUIRED")
- private boolean isRequired;
- @Column(name="REQUIRED_TO_COMMANDLINE")
- private boolean addedToCmd;
- @Column(name = "DATA_MOVEMENT")
- private boolean dataMovement;
- @Column(name = "DATA_NAME_LOCATION")
- private String dataNameLocation;
- @Column(name = "SEARCH_QUERY")
- private String searchQuery;
- @Column(name = "APP_ARGUMENT")
- private String applicationArgument;
-
- @ManyToOne(cascade= CascadeType.MERGE)
- @JoinColumn(name = "TASK_ID")
- private TaskDetail task;
-
- public String getTaskId() {
- return taskId;
- }
-
- public void setTaskId(String taskId) {
- this.taskId = taskId;
- }
-
- public char[] getValue() {
- return value;
- }
-
- public void setValue(char[] value) {
- this.value = value;
- }
-
- public String getOutputKey() {
- return outputKey;
- }
-
- public void setOutputKey(String outputKey) {
- this.outputKey = outputKey;
- }
-
- public String getDataType() {
- return dataType;
- }
-
- public void setDataType(String dataType) {
- this.dataType = dataType;
- }
-
- public boolean isRequired() {
- return isRequired;
- }
-
- public void setRequired(boolean isRequired) {
- this.isRequired = isRequired;
- }
-
- public boolean isAddedToCmd() {
- return addedToCmd;
- }
-
- public void setAddedToCmd(boolean addedToCmd) {
- this.addedToCmd = addedToCmd;
- }
-
- public boolean isDataMovement() {
- return dataMovement;
- }
-
- public void setDataMovement(boolean dataMovement) {
- this.dataMovement = dataMovement;
- }
-
- public String getDataNameLocation() {
- return dataNameLocation;
- }
-
- public void setDataNameLocation(String dataNameLocation) {
- this.dataNameLocation = dataNameLocation;
- }
-
- public String getSearchQuery() {
- return searchQuery;
- }
-
- public void setSearchQuery(String searchQuery) {
- this.searchQuery = searchQuery;
- }
-
- public String getApplicationArgument() {
- return applicationArgument;
- }
-
- public void setApplicationArgument(String applicationArgument) {
- this.applicationArgument = applicationArgument;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/ApplicationOutput_PK.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/ApplicationOutput_PK.java b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/ApplicationOutput_PK.java
deleted file mode 100644
index 3ebc57a..0000000
--- a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/ApplicationOutput_PK.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- *
- * 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.experiment.catalog.model;
-
-import java.io.Serializable;
-
-public class ApplicationOutput_PK implements Serializable {
- private String taskId;
- private String outputKey;
-
- public ApplicationOutput_PK(String outputKey, String taskId) {
- this.outputKey = outputKey;
- this.taskId = taskId;
- }
-
- public ApplicationOutput_PK() {
- ;
- }
-
- @Override
- public boolean equals(Object o) {
- return false;
- }
-
- @Override
- public int hashCode() {
- return 1;
- }
-
- public String getTaskId() {
- return taskId;
- }
-
- public void setTaskId(String taskId) {
- this.taskId = taskId;
- }
-
- public String getOutputKey() {
- return outputKey;
- }
-
- public void setOutputKey(String outputKey) {
- this.outputKey = outputKey;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/Computational_Resource_Scheduling.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/Computational_Resource_Scheduling.java b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/Computational_Resource_Scheduling.java
deleted file mode 100644
index a177722..0000000
--- a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/Computational_Resource_Scheduling.java
+++ /dev/null
@@ -1,174 +0,0 @@
-/*
- *
- * 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.experiment.catalog.model;
-
-import org.apache.openjpa.persistence.DataCache;
-
-import javax.persistence.*;
-import java.io.Serializable;
-import java.sql.Timestamp;
-
-@DataCache
-@Entity
-@Table(name = "COMPUTATIONAL_RESOURCE_SCHEDULING")
-public class Computational_Resource_Scheduling implements Serializable {
- @Id
- @GeneratedValue
- @Column(name = "RESOURCE_SCHEDULING_ID")
- private int schedulingId;
- @Column(name = "EXPERIMENT_ID")
- private String expId;
- @Column(name = "TASK_ID")
- private String taskId;
- @Column(name = "RESOURCE_HOST_ID")
- private String resourceHostId;
- @Column(name = "CPU_COUNT")
- private int cpuCount;
- @Column(name = "NODE_COUNT")
- private int nodeCount;
- @Column(name = "NO_OF_THREADS")
- private int numberOfThreads;
- @Column(name = "QUEUE_NAME")
- private String queueName;
- @Column(name = "WALLTIME_LIMIT")
- private int wallTimeLimit;
- @Column(name = "JOB_START_TIME")
- private Timestamp jobStartTime;
- @Column(name = "TOTAL_PHYSICAL_MEMORY")
- private int totalPhysicalmemory;
- @Column(name = "COMPUTATIONAL_PROJECT_ACCOUNT")
- private String projectName;
- @Column(name = "CHESSIS_NAME")
- private String chessisName;
-
- @ManyToOne(cascade= CascadeType.MERGE)
- @JoinColumn(name = "EXPERIMENT_ID")
- private Experiment experiment;
-
- @ManyToOne(cascade= CascadeType.MERGE)
- @JoinColumn(name = "TASK_ID")
- private TaskDetail task;
-
- public String getChessisName() {
- return chessisName;
- }
-
- public void setChessisName(String chessisName) {
- this.chessisName = chessisName;
- }
-
- public int getSchedulingId() {
- return schedulingId;
- }
-
- public void setSchedulingId(int schedulingId) {
- this.schedulingId = schedulingId;
- }
-
- public String getExpId() {
- return expId;
- }
-
- public void setExpId(String expId) {
- this.expId = expId;
- }
-
- public String getTaskId() {
- return taskId;
- }
-
- public void setTaskId(String taskId) {
- this.taskId = taskId;
- }
-
- public String getResourceHostId() {
- return resourceHostId;
- }
-
- public void setResourceHostId(String resourceHostId) {
- this.resourceHostId = resourceHostId;
- }
-
- public int getCpuCount() {
- return cpuCount;
- }
-
- public void setCpuCount(int cpuCount) {
- this.cpuCount = cpuCount;
- }
-
- public int getNodeCount() {
- return nodeCount;
- }
-
- public void setNodeCount(int nodeCount) {
- this.nodeCount = nodeCount;
- }
-
- public int getNumberOfThreads() {
- return numberOfThreads;
- }
-
- public void setNumberOfThreads(int numberOfThreads) {
- this.numberOfThreads = numberOfThreads;
- }
-
- public String getQueueName() {
- return queueName;
- }
-
- public void setQueueName(String queueName) {
- this.queueName = queueName;
- }
-
- public int getWallTimeLimit() {
- return wallTimeLimit;
- }
-
- public void setWallTimeLimit(int wallTimeLimit) {
- this.wallTimeLimit = wallTimeLimit;
- }
-
- public Timestamp getJobStartTime() {
- return jobStartTime;
- }
-
- public void setJobStartTime(Timestamp jobStartTime) {
- this.jobStartTime = jobStartTime;
- }
-
- public int getTotalPhysicalmemory() {
- return totalPhysicalmemory;
- }
-
- public void setTotalPhysicalmemory(int totalPhysicalmemory) {
- this.totalPhysicalmemory = totalPhysicalmemory;
- }
-
- public String getProjectName() {
- return projectName;
- }
-
- public void setProjectName(String projectName) {
- this.projectName = projectName;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/Configuration.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/Configuration.java b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/Configuration.java
deleted file mode 100644
index f3c72be..0000000
--- a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/Configuration.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
-*
-* 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.experiment.catalog.model;
-
-import org.apache.openjpa.persistence.DataCache;
-
-import javax.persistence.*;
-import java.io.Serializable;
-import java.sql.Timestamp;
-
-@DataCache
-@Entity
-@Table(name ="CONFIGURATION")
-@IdClass(Configuration_PK.class)
-public class Configuration implements Serializable {
- @Id
- @Column(name = "CONFIG_KEY")
- private String config_key;
-
- @Id
- @Column(name = "CONFIG_VAL")
- private String config_val;
-
- @Id
- @Column(name = "CATEGORY_ID")
- private String category_id;
-
- @Column(name = "EXPIRE_DATE")
- private Timestamp expire_date;
-
- public String getConfig_key() {
- return config_key;
- }
-
- public String getConfig_val() {
- return config_val;
- }
-
- public Timestamp getExpire_date() {
- return expire_date;
- }
-
- public void setConfig_key(String config_key) {
- this.config_key = config_key;
- }
-
- public void setConfig_val(String config_val) {
- this.config_val = config_val;
- }
-
- public void setExpire_date(Timestamp expire_date) {
- this.expire_date = expire_date;
- }
-
- public String getCategory_id() {
- return category_id;
- }
-
- public void setCategory_id(String category_id) {
- this.category_id = category_id;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/Configuration_PK.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/Configuration_PK.java b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/Configuration_PK.java
deleted file mode 100644
index 2f950dd..0000000
--- a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/Configuration_PK.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- *
- * 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.experiment.catalog.model;
-
-import java.io.Serializable;
-
-public class Configuration_PK implements Serializable {
- private String config_key;
- private String config_val;
- private String category_id;
-
- public Configuration_PK(String config_key, String config_val, String category_id) {
- this.config_key = config_key;
- this.config_val = config_val;
- this.category_id = category_id;
- }
-
- public Configuration_PK() {
- ;
- }
-
- @Override
- public boolean equals(Object o) {
- return false;
- }
-
- @Override
- public int hashCode() {
- return 1;
- }
-
- public String getConfig_key() {
- return config_key;
- }
-
- public void setConfig_key(String config_key) {
- this.config_key = config_key;
- }
-
- public void setConfig_val(String config_val) {
- this.config_val = config_val;
- }
-
- public String getConfig_val() {
- return config_val;
- }
-
- public String getCategory_id() {
- return category_id;
- }
-
- public void setCategory_id(String category_id) {
- this.category_id = category_id;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/DataTransferDetail.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/DataTransferDetail.java b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/DataTransferDetail.java
deleted file mode 100644
index ad41126..0000000
--- a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/DataTransferDetail.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- *
- * 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.experiment.catalog.model;
-
-import org.apache.openjpa.persistence.DataCache;
-
-import javax.persistence.*;
-import java.io.Serializable;
-import java.sql.Timestamp;
-
-@DataCache
-@Entity
-@Table(name = "DATA_TRANSFER_DETAIL")
-public class DataTransferDetail implements Serializable {
- @Id
- @Column(name = "TRANSFER_ID")
- private String transferId;
- @Column(name = "TASK_ID")
- private String taskId;
- @Column(name = "CREATION_TIME")
- private Timestamp creationTime;
- @Lob
- @Column(name = "TRANSFER_DESC")
- private char[] transferDesc;
-
- @ManyToOne(cascade= CascadeType.MERGE)
- @JoinColumn(name = "TASK_ID")
- private TaskDetail task;
-
- @OneToOne (fetch = FetchType.LAZY, mappedBy = "transferDetail")
- private Status dataTransferStatus;
-
- public String getTransferId() {
- return transferId;
- }
-
- public void setTransferId(String transferId) {
- this.transferId = transferId;
- }
-
- public String getTaskId() {
- return taskId;
- }
-
- public void setTaskId(String taskId) {
- this.taskId = taskId;
- }
-
- public Timestamp getCreationTime() {
- return creationTime;
- }
-
- public void setCreationTime(Timestamp creationTime) {
- this.creationTime = creationTime;
- }
-
- public char[] getTransferDesc() {
- return transferDesc;
- }
-
- public void setTransferDesc(char[] transferDesc) {
- this.transferDesc = transferDesc;
- }
-
- public Status getDataTransferStatus() {
- return dataTransferStatus;
- }
-
- public void setDataTransferStatus(Status dataTransferStatus) {
- this.dataTransferStatus = dataTransferStatus;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/ErrorDetail.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/ErrorDetail.java b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/ErrorDetail.java
deleted file mode 100644
index 46af8a5..0000000
--- a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/ErrorDetail.java
+++ /dev/null
@@ -1,176 +0,0 @@
-/*
- *
- * 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.experiment.catalog.model;
-
-import org.apache.openjpa.persistence.DataCache;
-
-import javax.persistence.*;
-
-import java.io.Serializable;
-import java.sql.Timestamp;
-
-@DataCache
-@Entity
-@Table(name = "ERROR_DETAIL")
-public class ErrorDetail implements Serializable {
- @Id
- @GeneratedValue
- @Column(name = "ERROR_ID")
- private int errorID;
- @Column(name = "EXPERIMENT_ID")
- private String expId;
- @Column(name = "TASK_ID")
- private String taskId;
- @Column(name = "NODE_INSTANCE_ID")
- private String nodeId;
- @Column(name = "CREATION_TIME")
- private Timestamp creationTime;
- @Lob
- @Column(name = "ACTUAL_ERROR_MESSAGE")
- private char[] actualErrorMsg;
-
- @Column(name = "USER_FRIEDNLY_ERROR_MSG")
- private String userFriendlyErrorMsg;
- @Column(name = "TRANSIENT_OR_PERSISTENT")
- private boolean transientPersistent;
- @Column(name = "ERROR_CATEGORY")
- private String errorCategory;
- @Column(name = "CORRECTIVE_ACTION")
- private String correctiveAction;
- @Column(name = "ACTIONABLE_GROUP")
- private String actionableGroup;
- @Column(name = "JOB_ID")
- private String jobId;
-
-
- @ManyToOne(fetch = FetchType.LAZY, cascade= CascadeType.MERGE)
- @JoinColumn(name = "EXPERIMENT_ID")
- private Experiment experiment;
-
- @ManyToOne(fetch = FetchType.LAZY, cascade= CascadeType.MERGE)
- @JoinColumn(name = "TASK_ID")
- private TaskDetail task;
-
- @ManyToOne(fetch = FetchType.LAZY, cascade= CascadeType.MERGE)
- @JoinColumn(name = "NODE_INSTANCE_ID")
- private WorkflowNodeDetail nodeDetail;
-
- @ManyToOne(fetch = FetchType.LAZY, cascade= CascadeType.MERGE)
- @JoinColumn(name = "JOB_ID")
- private JobDetail jobDetail;
-
- public int getErrorID() {
- return errorID;
- }
-
- public void setErrorID(int errorID) {
- this.errorID = errorID;
- }
-
- public String getExpId() {
- return expId;
- }
-
- public void setExpId(String expId) {
- this.expId = expId;
- }
-
- public String getTaskId() {
- return taskId;
- }
-
- public void setTaskId(String taskId) {
- this.taskId = taskId;
- }
-
- public String getNodeId() {
- return nodeId;
- }
-
- public void setNodeId(String nodeId) {
- this.nodeId = nodeId;
- }
-
- public Timestamp getCreationTime() {
- return creationTime;
- }
-
- public void setCreationTime(Timestamp creationTime) {
- this.creationTime = creationTime;
- }
-
- public char[] getActualErrorMsg() {
- return actualErrorMsg;
- }
-
- public void setActualErrorMsg(char[] actualErrorMsg) {
- this.actualErrorMsg = actualErrorMsg;
- }
-
- public String getUserFriendlyErrorMsg() {
- return userFriendlyErrorMsg;
- }
-
- public void setUserFriendlyErrorMsg(String userFriendlyErrorMsg) {
- this.userFriendlyErrorMsg = userFriendlyErrorMsg;
- }
-
- public boolean isTransientPersistent() {
- return transientPersistent;
- }
-
- public void setTransientPersistent(boolean transientPersistent) {
- this.transientPersistent = transientPersistent;
- }
-
- public String getErrorCategory() {
- return errorCategory;
- }
-
- public void setErrorCategory(String errorCategory) {
- this.errorCategory = errorCategory;
- }
-
- public String getActionableGroup() {
- return actionableGroup;
- }
-
- public void setActionableGroup(String actionableGroup) {
- this.actionableGroup = actionableGroup;
- }
-
- public String getCorrectiveAction() {
- return correctiveAction;
- }
-
- public void setCorrectiveAction(String correctiveAction) {
- this.correctiveAction = correctiveAction;
- }
-
- public String getJobId() {
- return jobId;
- }
-
- public void setJobId(String jobId) {
- this.jobId = jobId;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/Experiment.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/Experiment.java b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/Experiment.java
deleted file mode 100644
index 6a7b13a..0000000
--- a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/Experiment.java
+++ /dev/null
@@ -1,299 +0,0 @@
-/*
-*
-* 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.experiment.catalog.model;
-
-import org.apache.openjpa.persistence.DataCache;
-
-import javax.persistence.*;
-import java.io.Serializable;
-import java.sql.Timestamp;
-import java.util.Collection;
-import java.util.List;
-
-@Entity
-@Table(name = "EXPERIMENT")
-@DataCache
-public class Experiment implements Serializable {
- @Id
- @Column(name = "EXPERIMENT_ID")
- private String expId;
- @Column(name = "GATEWAY_ID")
- private String gatewayId;
- @Column(name = "EXECUTION_USER")
- private String executionUser;
- @Column(name = "PROJECT_ID")
- private String projectID;
- @Column(name = "CREATION_TIME")
- private Timestamp creationTime;
- @Column(name = "EXPERIMENT_NAME")
- private String expName;
- @Column(name = "EXPERIMENT_DESCRIPTION")
- private String expDesc;
- @Column(name = "APPLICATION_ID")
- private String applicationId;
- @Column(name = "APPLICATION_VERSION")
- private String appVersion;
- @Column(name = "WORKFLOW_TEMPLATE_ID")
- private String workflowTemplateId;
- @Column(name = "WORKFLOW_TEMPLATE_VERSION")
- private String workflowTemplateVersion;
- @Column(name = "WORKFLOW_EXECUTION_ID")
- private String workflowExecutionId;
- @Column(name = "ALLOW_NOTIFICATION")
- private boolean allowNotification;
- @Column(name = "GATEWAY_EXECUTION_ID")
- private String gatewayExecutionId;
-
- @ManyToOne(fetch=FetchType.LAZY, cascade=CascadeType.MERGE)
- @JoinColumn(name = "GATEWAY_ID")
- private Gateway gateway;
-
- @ManyToOne(fetch=FetchType.LAZY, cascade=CascadeType.MERGE)
- @JoinColumn(name = "PROJECT_ID")
- private Project project;
-
- @ManyToOne(fetch=FetchType.LAZY, cascade=CascadeType.MERGE)
- @JoinColumn(name = "EXECUTION_USER", referencedColumnName = "USER_NAME")
- private Users user;
-
- @OneToMany (fetch = FetchType.LAZY, mappedBy = "experiment")
- private List<Experiment_Output> experimentOutputs;
-
- @OneToMany (fetch = FetchType.LAZY, mappedBy = "experiment")
- private List<Experiment_Input> experimentInputs;
-
- @OneToOne (fetch = FetchType.LAZY, mappedBy = "experiment")
- private Computational_Resource_Scheduling resourceScheduling;
-
- @OneToOne (fetch = FetchType.LAZY, mappedBy = "experiment")
- private ExperimentConfigData userConfigurationData;
-
- @OneToMany (fetch = FetchType.LAZY, mappedBy = "experiment")
- private List<WorkflowNodeDetail> workflowNodeDetails;
-
- @OneToMany (fetch = FetchType.LAZY, mappedBy = "experiment")
- private List<Status> stateChangeList;
-
- @OneToMany (fetch = FetchType.LAZY, mappedBy = "experiment")
- private List<ErrorDetail> errorDetails;
-
- @OneToOne (fetch = FetchType.LAZY, mappedBy = "experiment")
- private Status experimentStatus;
-
- @OneToMany (fetch = FetchType.LAZY, mappedBy = "experiment")
- private List<Notification_Email> notificationEmails;
-
- @OneToMany(fetch=FetchType.LAZY, mappedBy = "experiment")
- private Collection<Status> statuses;
-
- public String getExpId() {
- return expId;
- }
-
- public void setExpId(String expId) {
- this.expId = expId;
- }
-
- public String getGatewayId() {
- return gatewayId;
- }
-
- public void setGatewayId(String gatewayId) {
- this.gatewayId = gatewayId;
- }
-
- public String getExecutionUser() {
- return executionUser;
- }
-
- public void setExecutionUser(String executionUser) {
- this.executionUser = executionUser;
- }
-
- public Timestamp getCreationTime() {
- return creationTime;
- }
-
- public void setCreationTime(Timestamp creationTime) {
- this.creationTime = creationTime;
- }
-
- public String getExpName() {
- return expName;
- }
-
- public void setExpName(String expName) {
- this.expName = expName;
- }
-
- public String getExpDesc() {
- return expDesc;
- }
-
- public void setExpDesc(String expDesc) {
- this.expDesc = expDesc;
- }
-
- public String getApplicationId() {
- return applicationId;
- }
-
- public void setApplicationId(String applicationId) {
- this.applicationId = applicationId;
- }
-
- public String getAppVersion() {
- return appVersion;
- }
-
- public void setAppVersion(String appVersion) {
- this.appVersion = appVersion;
- }
-
- public String getWorkflowTemplateId() {
- return workflowTemplateId;
- }
-
- public void setWorkflowTemplateId(String workflowTemplateId) {
- this.workflowTemplateId = workflowTemplateId;
- }
-
- public String getWorkflowTemplateVersion() {
- return workflowTemplateVersion;
- }
-
- public void setWorkflowTemplateVersion(String workflowTemplateVersion) {
- this.workflowTemplateVersion = workflowTemplateVersion;
- }
-
- public String getWorkflowExecutionId() {
- return workflowExecutionId;
- }
-
- public void setWorkflowExecutionId(String workflowExecutionId) {
- this.workflowExecutionId = workflowExecutionId;
- }
-
- public boolean isAllowNotification() {
- return allowNotification;
- }
-
- public void setAllowNotification(boolean allowNotification) {
- this.allowNotification = allowNotification;
- }
-
- public String getGatewayExecutionId() {
- return gatewayExecutionId;
- }
-
- public String getProjectID() {
- return projectID;
- }
-
- public void setProjectID(String projectID) {
- this.projectID = projectID;
- }
-
- public List<Experiment_Output> getExperimentOutputs() {
- return experimentOutputs;
- }
-
- public void setExperimentOutputs(List<Experiment_Output> experimentOutputs) {
- this.experimentOutputs = experimentOutputs;
- }
-
- public List<Experiment_Input> getExperimentInputs() {
- return experimentInputs;
- }
-
- public void setExperimentInputs(List<Experiment_Input> experimentInputs) {
- this.experimentInputs = experimentInputs;
- }
-
- public Computational_Resource_Scheduling getResourceScheduling() {
- return resourceScheduling;
- }
-
- public void setResourceScheduling(Computational_Resource_Scheduling resourceScheduling) {
- this.resourceScheduling = resourceScheduling;
- }
-
- public List<ErrorDetail> getErrorDetails() {
- return errorDetails;
- }
-
- public ExperimentConfigData getUserConfigurationData() {
- return userConfigurationData;
- }
-
- public void setUserConfigurationData(ExperimentConfigData userConfigurationData) {
- this.userConfigurationData = userConfigurationData;
- }
-
- public List<WorkflowNodeDetail> getWorkflowNodeDetails() {
- return workflowNodeDetails;
- }
-
- public void setWorkflowNodeDetails(List<WorkflowNodeDetail> workflowNodeDetails) {
- this.workflowNodeDetails = workflowNodeDetails;
- }
-
- public List<Status> getStateChangeList() {
- return stateChangeList;
- }
-
- public void setStateChangeList(List<Status> stateChangeList) {
- this.stateChangeList = stateChangeList;
- }
-
- public void setErrorDetails(List<ErrorDetail> errorDetails) {
- this.errorDetails = errorDetails;
- }
-
- public Status getExperimentStatus() {
- return experimentStatus;
- }
-
- public void setExperimentStatus(Status experimentStatus) {
- this.experimentStatus = experimentStatus;
- }
-
- public List<Notification_Email> getNotificationEmails() {
- return notificationEmails;
- }
-
- public void setNotificationEmails(List<Notification_Email> notificationEmails) {
- this.notificationEmails = notificationEmails;
- }
-
- public void setGatewayExecutionId(String gatewayExecutionId) {
- this.gatewayExecutionId = gatewayExecutionId;
- }
-
- public Collection<Status> getStatuses() {
- return statuses;
- }
-
- public void setStatuses(Collection<Status> statuses) {
- this.statuses = statuses;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/ExperimentConfigData.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/ExperimentConfigData.java b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/ExperimentConfigData.java
deleted file mode 100644
index 4510996..0000000
--- a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/ExperimentConfigData.java
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
- *
- * 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.experiment.catalog.model;
-
-import org.apache.openjpa.persistence.DataCache;
-
-import javax.persistence.*;
-import java.io.Serializable;
-
-@DataCache
-@Entity
-@Table(name = "CONFIG_DATA")
-public class ExperimentConfigData implements Serializable {
- @Id
- @Column(name = "EXPERIMENT_ID")
- private String expId;
- @Column(name = "AIRAVATA_AUTO_SCHEDULE")
- private boolean airavataAutoSchedule;
- @Column(name = "OVERRIDE_MANUAL_SCHEDULE_PARAMS")
- private boolean overrideManualParams;
- @Column(name = "SHARE_EXPERIMENT")
- private boolean shareExp;
- @Column(name = "USER_DN")
- private String userDn;
- @Column(name = "GENERATE_CERT")
- private boolean generateCert;
-
- @ManyToOne(cascade= CascadeType.MERGE)
- @JoinColumn(name = "EXPERIMENT_ID")
- private Experiment experiment;
-
- @OneToOne (fetch = FetchType.LAZY, mappedBy = "experiment")
- private Computational_Resource_Scheduling resourceScheduling;
-
- @OneToOne (fetch = FetchType.LAZY, mappedBy = "experiment")
- private AdvancedInputDataHandling inputDataHandling;
-
- @OneToOne (fetch = FetchType.LAZY, mappedBy = "experiment")
- private AdvancedOutputDataHandling outputDataHandling;
-
- @OneToOne (fetch = FetchType.LAZY, mappedBy = "experiment")
- private QosParam qosParam;
-
- public String getExpId() {
- return expId;
- }
-
- public void setExpId(String expId) {
- this.expId = expId;
- }
-
- public boolean isAiravataAutoSchedule() {
- return airavataAutoSchedule;
- }
-
- public void setAiravataAutoSchedule(boolean airavataAutoSchedule) {
- this.airavataAutoSchedule = airavataAutoSchedule;
- }
-
- public boolean isOverrideManualParams() {
- return overrideManualParams;
- }
-
- public void setOverrideManualParams(boolean overrideManualParams) {
- this.overrideManualParams = overrideManualParams;
- }
-
- public boolean isShareExp() {
- return shareExp;
- }
-
- public void setShareExp(boolean shareExp) {
- this.shareExp = shareExp;
- }
-
- public String getUserDn() {
- return userDn;
- }
-
- public void setUserDn(String userDn) {
- this.userDn = userDn;
- }
-
- public boolean isGenerateCert() {
- return generateCert;
- }
-
- public void setGenerateCert(boolean generateCert) {
- this.generateCert = generateCert;
- }
-
- public AdvancedInputDataHandling getInputDataHandling() {
- return inputDataHandling;
- }
-
- public void setInputDataHandling(AdvancedInputDataHandling inputDataHandling) {
- this.inputDataHandling = inputDataHandling;
- }
-
- public AdvancedOutputDataHandling getOutputDataHandling() {
- return outputDataHandling;
- }
-
- public void setOutputDataHandling(AdvancedOutputDataHandling outputDataHandling) {
- this.outputDataHandling = outputDataHandling;
- }
-
- public QosParam getQosParam() {
- return qosParam;
- }
-
- public void setQosParam(QosParam qosParam) {
- this.qosParam = qosParam;
- }
-
- public Computational_Resource_Scheduling getResourceScheduling() {
- return resourceScheduling;
- }
-
- public void setResourceScheduling(Computational_Resource_Scheduling resourceScheduling) {
- this.resourceScheduling = resourceScheduling;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/Experiment_Input.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/Experiment_Input.java b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/Experiment_Input.java
deleted file mode 100644
index c074889..0000000
--- a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/Experiment_Input.java
+++ /dev/null
@@ -1,170 +0,0 @@
-/*
- *
- * 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.experiment.catalog.model;
-
-import org.apache.openjpa.persistence.DataCache;
-
-import javax.persistence.*;
-import java.io.Serializable;
-
-@DataCache
-@Entity
-@Table(name ="EXPERIMENT_INPUT")
-@IdClass(Experiment_Input_PK.class)
-public class Experiment_Input implements Serializable {
- @Id
- @Column(name = "EXPERIMENT_ID")
- private String experiment_id;
-
- @Id
- @Column(name = "INPUT_KEY")
- private String ex_key;
-
- @Lob
- @Column(name = "VALUE")
- private char[] value;
-
- @Column(name = "DATA_TYPE")
- private String dataType;
-
- @Column(name = "APP_ARGUMENT")
- private String appArgument;
-
- @Column(name = "STANDARD_INPUT")
- private boolean standardInput;
-
- @Column(name = "USER_FRIENDLY_DESC")
- private String userFriendlyDesc;
-
- @Column(name = "METADATA")
- private String metadata;
-
- @Column(name = "INPUT_ORDER")
- private int inputOrder;
-
- @Column(name="IS_REQUIRED")
- private boolean isRequired;
- @Column(name="REQUIRED_TO_COMMANDLINE")
- private boolean requiredToCMD;
- @Column(name = "DATA_STAGED")
- private boolean dataStaged;
-
- @ManyToOne
- @JoinColumn(name = "EXPERIMENT_ID")
- private Experiment experiment;
-
- public int getInputOrder() {
- return inputOrder;
- }
-
- public void setInputOrder(int inputOrder) {
- this.inputOrder = inputOrder;
- }
-
- public String getExperiment_id() {
- return experiment_id;
- }
-
- public void setExperiment_id(String experiment_id) {
- this.experiment_id = experiment_id;
- }
-
- public String getEx_key() {
- return ex_key;
- }
-
- public void setEx_key(String ex_key) {
- this.ex_key = ex_key;
- }
-
- public char[] getValue() {
- return value;
- }
-
- public void setValue(char[] value) {
- this.value = value;
- }
-
- public String getDataType() {
- return dataType;
- }
-
- public void setDataType(String dataType) {
- this.dataType = dataType;
- }
-
- public String getMetadata() {
- return metadata;
- }
-
- public void setMetadata(String metadata) {
- this.metadata = metadata;
- }
-
- public String getAppArgument() {
- return appArgument;
- }
-
- public void setAppArgument(String appArgument) {
- this.appArgument = appArgument;
- }
-
- public boolean isStandardInput() {
- return standardInput;
- }
-
- public void setStandardInput(boolean standardInput) {
- this.standardInput = standardInput;
- }
-
- public String getUserFriendlyDesc() {
- return userFriendlyDesc;
- }
-
- public void setUserFriendlyDesc(String userFriendlyDesc) {
- this.userFriendlyDesc = userFriendlyDesc;
- }
-
- public boolean isRequired() {
- return isRequired;
- }
-
- public void setRequired(boolean isRequired) {
- this.isRequired = isRequired;
- }
-
- public boolean isRequiredToCMD() {
- return requiredToCMD;
- }
-
- public void setRequiredToCMD(boolean requiredToCMD) {
- this.requiredToCMD = requiredToCMD;
- }
-
- public boolean isDataStaged() {
- return dataStaged;
- }
-
- public void setDataStaged(boolean dataStaged) {
- this.dataStaged = dataStaged;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/Experiment_Input_PK.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/Experiment_Input_PK.java b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/Experiment_Input_PK.java
deleted file mode 100644
index 4a9886f..0000000
--- a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/Experiment_Input_PK.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- *
- * 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.experiment.catalog.model;
-
-import java.io.Serializable;
-
-public class Experiment_Input_PK implements Serializable {
- private String experiment_id;
- private String ex_key;
-
- public Experiment_Input_PK(String experiment_id, String ex_key) {
- this.experiment_id = experiment_id;
- this.ex_key = ex_key;
- }
-
- public Experiment_Input_PK() {
- ;
- }
-
- @Override
- public boolean equals(Object o) {
- return false;
- }
-
- @Override
- public int hashCode() {
- return 1;
- }
-
- public String getExperiment_id() {
- return experiment_id;
- }
-
- public void setExperiment_id(String experiment_id) {
- this.experiment_id = experiment_id;
- }
-
- public String getEx_key() {
- return ex_key;
- }
-
- public void setEx_key(String ex_key) {
- this.ex_key = ex_key;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/Experiment_Output.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/Experiment_Output.java b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/Experiment_Output.java
deleted file mode 100644
index d9d728f..0000000
--- a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/Experiment_Output.java
+++ /dev/null
@@ -1,143 +0,0 @@
-/*
- *
- * 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.experiment.catalog.model;
-
-import org.apache.openjpa.persistence.DataCache;
-
-import javax.persistence.*;
-import java.io.Serializable;
-
-@DataCache
-@Entity
-@Table(name ="EXPERIMENT_OUTPUT")
-@IdClass(Experiment_Output_PK.class)
-public class Experiment_Output implements Serializable {
- @Id
- @Column(name = "EXPERIMENT_ID")
- private String experiment_id;
-
- @Id
- @Column(name = "OUTPUT_KEY")
- private String ex_key;
- @Lob
- @Column(name = "VALUE")
- private char[] value;
- @Column(name = "DATA_TYPE")
- private String dataType;
-
- @Column(name = "IS_REQUIRED")
- private boolean isRequired;
- @Column(name="REQUIRED_TO_COMMANDLINE")
- private boolean requiredToCMD;
- @Column(name = "DATA_MOVEMENT")
- private boolean dataMovement;
- @Column(name = "DATA_NAME_LOCATION")
- private String dataNameLocation;
- @Column(name = "SEARCH_QUERY")
- private String searchQuery;
- @Column(name = "APP_ARGUMENT")
- private String applicationArgument;
-
- @ManyToOne
- @JoinColumn(name = "EXPERIMENT_ID")
- private Experiment experiment;
-
- public String getExperiment_id() {
- return experiment_id;
- }
-
- public void setExperiment_id(String experiment_id) {
- this.experiment_id = experiment_id;
- }
-
- public String getEx_key() {
- return ex_key;
- }
-
- public void setEx_key(String ex_key) {
- this.ex_key = ex_key;
- }
-
- public char[] getValue() {
- return value;
- }
-
- public void setValue(char[] value) {
- this.value = value;
- }
-
- public String getDataType() {
- return dataType;
- }
-
- public void setDataType(String dataType) {
- this.dataType = dataType;
- }
-
- public boolean isRequired() {
- return isRequired;
- }
-
- public void setRequired(boolean isRequired) {
- this.isRequired = isRequired;
- }
-
- public boolean isRequiredToCMD() {
- return requiredToCMD;
- }
-
- public void setRequiredToCMD(boolean requiredToCMD) {
- this.requiredToCMD = requiredToCMD;
- }
-
- public boolean isDataMovement() {
- return dataMovement;
- }
-
- public void setDataMovement(boolean dataMovement) {
- this.dataMovement = dataMovement;
- }
-
- public String getDataNameLocation() {
- return dataNameLocation;
- }
-
- public void setDataNameLocation(String dataNameLocation) {
- this.dataNameLocation = dataNameLocation;
- }
-
- public String getSearchQuery() {
- return searchQuery;
- }
-
- public void setSearchQuery(String searchQuery) {
- this.searchQuery = searchQuery;
- }
-
- public String getApplicationArgument() {
- return applicationArgument;
- }
-
- public void setApplicationArgument(String applicationArgument) {
- this.applicationArgument = applicationArgument;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/Experiment_Output_PK.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/Experiment_Output_PK.java b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/Experiment_Output_PK.java
deleted file mode 100644
index 822021a..0000000
--- a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/Experiment_Output_PK.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- *
- * 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.experiment.catalog.model;
-
-import java.io.Serializable;
-
-public class Experiment_Output_PK implements Serializable {
- private String experiment_id;
- private String ex_key;
-
- public Experiment_Output_PK(String experiment_id, String ex_key) {
- this.experiment_id = experiment_id;
- this.ex_key = ex_key;
- }
-
- public Experiment_Output_PK() {
- ;
- }
-
- @Override
- public boolean equals(Object o) {
- return false;
- }
-
- @Override
- public int hashCode() {
- return 1;
- }
-
- public String getExperiment_id() {
- return experiment_id;
- }
-
- public void setExperiment_id(String experiment_id) {
- this.experiment_id = experiment_id;
- }
-
- public String getEx_key() {
- return ex_key;
- }
-
- public void setEx_key(String ex_key) {
- this.ex_key = ex_key;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/Gateway.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/Gateway.java b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/Gateway.java
deleted file mode 100644
index f3e693c..0000000
--- a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/Gateway.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- *
- * 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.experiment.catalog.model;
-
-import org.apache.openjpa.persistence.DataCache;
-
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.Id;
-import javax.persistence.Table;
-import java.io.Serializable;
-
-@DataCache
-@Entity
-@Table(name ="GATEWAY")
-public class Gateway implements Serializable {
- @Id
- @Column(name = "GATEWAY_ID")
- private String gateway_id;
- @Column(name = "GATEWAY_NAME")
- private String gateway_name;
- @Column(name = "DOMAIN")
- private String domain;
- @Column(name = "EMAIL_ADDRESS")
- private String emailAddress;
-
- public String getGateway_name() {
- return gateway_name;
- }
-
- public void setGateway_name(String gateway_name) {
- this.gateway_name = gateway_name;
- }
-
- public String getDomain() {
- return domain;
- }
-
- public void setDomain(String domain) {
- this.domain = domain;
- }
-
- public String getGateway_id() {
- return gateway_id;
- }
-
- public void setGateway_id(String gateway_id) {
- this.gateway_id = gateway_id;
- }
-
- public String getEmailAddress() {
- return emailAddress;
- }
-
- public void setEmailAddress(String emailAddress) {
- this.emailAddress = emailAddress;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/Gateway_Worker.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/Gateway_Worker.java b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/Gateway_Worker.java
deleted file mode 100644
index d4ef9b9..0000000
--- a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/Gateway_Worker.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- *
- * 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.experiment.catalog.model;
-
-import org.apache.openjpa.persistence.DataCache;
-
-import javax.persistence.*;
-import java.io.Serializable;
-
-@DataCache
-@Entity
-@Table(name ="GATEWAY_WORKER")
-@IdClass(Gateway_Worker_PK.class)
-public class Gateway_Worker implements Serializable {
- @Id
- @Column(name = "GATEWAY_ID")
- private String gateway_id;
-
- @Id
- @Column(name = "USER_NAME")
- private String user_name;
-
- @ManyToOne(cascade=CascadeType.MERGE)
- @JoinColumn(name = "GATEWAY_ID")
- private Gateway gateway;
-
-
- @ManyToOne(cascade=CascadeType.MERGE)
- @JoinColumn(name = "USER_NAME")
- private Users user;
-
- public String getUser_name() {
- return user_name;
- }
-
- public void setUser_name(String user_name) {
- this.user_name = user_name;
- }
-
- public void setGateway(Gateway gateway) {
- this.gateway = gateway;
- }
-
- public Gateway getGateway() {
- return gateway;
- }
-
- public Users getUser() {
- return user;
- }
-
- public void setUser(Users user) {
- this.user = user;
- }
-
- public String getGateway_id() {
- return gateway_id;
- }
-
- public void setGateway_id(String gateway_id) {
- this.gateway_id = gateway_id;
- }
-}
-
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/Gateway_Worker_PK.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/Gateway_Worker_PK.java b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/Gateway_Worker_PK.java
deleted file mode 100644
index 49ca862..0000000
--- a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/Gateway_Worker_PK.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- *
- * 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.experiment.catalog.model;
-
-import java.io.Serializable;
-
-public class Gateway_Worker_PK implements Serializable {
- private String gateway_id;
- private String user_name;
-
- public Gateway_Worker_PK(String gateway_id, String user_name) {
- this.gateway_id = gateway_id;
- this.user_name = user_name;
- }
-
- public Gateway_Worker_PK() {
- ;
- }
-
- @Override
- public boolean equals(Object o) {
- return false;
- }
-
- @Override
- public int hashCode() {
- return 1;
- }
-
- public String getUser_name() {
- return user_name;
- }
-
- public void setUser_name(String user_name) {
- this.user_name = user_name;
- }
-
- public String getGateway_id() {
- return gateway_id;
- }
-
- public void setGateway_id(String gateway_id) {
- this.gateway_id = gateway_id;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/JobDetail.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/JobDetail.java b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/JobDetail.java
deleted file mode 100644
index 7142313..0000000
--- a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/JobDetail.java
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
- *
- * 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.experiment.catalog.model;
-
-import org.apache.openjpa.persistence.DataCache;
-
-import javax.persistence.*;
-import java.io.Serializable;
-import java.sql.Timestamp;
-import java.util.List;
-
-@DataCache
-@Entity
-@Table(name = "JOB_DETAIL")
-@IdClass(JobDetails_PK.class)
-public class JobDetail implements Serializable {
- @Id
- @Column(name = "JOB_ID")
- private String jobId;
- @Id
- @Column(name = "TASK_ID")
- private String taskId;
- @Column(name = "JOB_DESCRIPTION")
- @Lob
- private char[] jobDescription;
- @Column(name = "CREATION_TIME")
- private Timestamp creationTime;
- @Column(name = "COMPUTE_RESOURCE_CONSUMED")
- private String computeResourceConsumed;
- @Column(name = "JOBNAME")
- private String jobName;
- @Column(name = "WORKING_DIR")
- private String workingDir;
-
- @ManyToOne(cascade= CascadeType.MERGE)
- @JoinColumn(name = "TASK_ID")
- private TaskDetail task;
-
- @OneToOne (fetch = FetchType.LAZY, mappedBy = "jobDetail")
- private Status jobStatus;
-
- @OneToMany (fetch = FetchType.LAZY, mappedBy = "jobDetail")
- private List<ErrorDetail> errorDetails;
-
- public List<ErrorDetail> getErrorDetails() {
- return errorDetails;
- }
-
- public void setErrorDetails(List<ErrorDetail> errorDetails) {
- this.errorDetails = errorDetails;
- }
-
- public String getJobId() {
- return jobId;
- }
-
- public void setJobId(String jobId) {
- this.jobId = jobId;
- }
-
- public String getTaskId() {
- return taskId;
- }
-
- public void setTaskId(String taskId) {
- this.taskId = taskId;
- }
-
- public char[] getJobDescription() {
- return jobDescription;
- }
-
- public void setJobDescription(char[] jobDescription) {
- this.jobDescription = jobDescription;
- }
-
- public Timestamp getCreationTime() {
- return creationTime;
- }
-
- public void setCreationTime(Timestamp creationTime) {
- this.creationTime = creationTime;
- }
-
- public String getComputeResourceConsumed() {
- return computeResourceConsumed;
- }
-
- public void setComputeResourceConsumed(String computeResourceConsumed) {
- this.computeResourceConsumed = computeResourceConsumed;
- }
-
- public String getJobName() {
- return jobName;
- }
-
- public void setJobName(String jobName) {
- this.jobName = jobName;
- }
-
- public String getWorkingDir() {
- return workingDir;
- }
-
- public void setWorkingDir(String workingDir) {
- this.workingDir = workingDir;
- }
-
- public Status getJobStatus() {
- return jobStatus;
- }
-
- public void setJobStatus(Status jobStatus) {
- this.jobStatus = jobStatus;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/JobDetails_PK.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/JobDetails_PK.java b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/JobDetails_PK.java
deleted file mode 100644
index a68a1a0..0000000
--- a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/JobDetails_PK.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- *
- * 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.experiment.catalog.model;
-
-import java.io.Serializable;
-
-public class JobDetails_PK implements Serializable {
- private String jobId;
- private String taskId;
-
- public JobDetails_PK(String jobId, String taskId) {
- this.jobId = jobId;
- this.taskId = taskId;
- }
-
- public JobDetails_PK() {
- ;
- }
-
- @Override
- public boolean equals(Object o) {
- return false;
- }
-
- @Override
- public int hashCode() {
- return 1;
- }
-
- public String getJobId() {
- return jobId;
- }
-
- public void setJobId(String jobId) {
- this.jobId = jobId;
- }
-
- public String getTaskId() {
- return taskId;
- }
-
- public void setTaskId(String taskId) {
- this.taskId = taskId;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/NodeInput.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/NodeInput.java b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/NodeInput.java
deleted file mode 100644
index 1109774..0000000
--- a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/NodeInput.java
+++ /dev/null
@@ -1,163 +0,0 @@
-/*
- *
- * 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.experiment.catalog.model;
-
-import org.apache.openjpa.persistence.DataCache;
-
-import javax.persistence.*;
-import java.io.Serializable;
-
-@DataCache
-@Entity
-@Table(name = "NODE_INPUT")
-@IdClass(NodeInput_PK.class)
-public class NodeInput implements Serializable {
- @Id
- @Column(name = "NODE_INSTANCE_ID")
- private String nodeId;
- @Id
- @Column(name = "INPUT_KEY")
- private String inputKey;
- @Column(name = "DATA_TYPE")
- private String dataType;
- @Column(name = "METADATA")
- private String metadata;
- @Column(name = "VALUE")
- private String value;
- @Column(name = "APP_ARGUMENT")
- private String appArgument;
- @Column(name = "INPUT_ORDER")
- private int inputOrder;
-
- @Column(name = "STANDARD_INPUT")
- private boolean standardInput;
-
- @Column(name = "USER_FRIENDLY_DESC")
- private String userFriendlyDesc;
-
- @Column(name="IS_REQUIRED")
- private boolean isRequired;
- @Column(name="REQUIRED_TO_COMMANDLINE")
- private boolean requiredToCMD;
- @Column(name = "DATA_STAGED")
- private boolean dataStaged;
-
- @ManyToOne(cascade= CascadeType.MERGE)
- @JoinColumn(name = "NODE_INSTANCE_ID")
- private WorkflowNodeDetail nodeDetail;
-
- public String getInputKey() {
- return inputKey;
- }
-
- public void setInputKey(String inputKey) {
- this.inputKey = inputKey;
- }
-
- public String getDataType() {
- return dataType;
- }
-
- public void setDataType(String dataType) {
- this.dataType = dataType;
- }
-
- public String getMetadata() {
- return metadata;
- }
-
- public void setMetadata(String metadata) {
- this.metadata = metadata;
- }
-
- public String getValue() {
- return value;
- }
-
- public void setValue(String value) {
- this.value = value;
- }
-
- public String getNodeId() {
- return nodeId;
- }
-
- public void setNodeId(String nodeId) {
- this.nodeId = nodeId;
- }
-
- public String getAppArgument() {
- return appArgument;
- }
-
- public void setAppArgument(String appArgument) {
- this.appArgument = appArgument;
- }
-
- public boolean isStandardInput() {
- return standardInput;
- }
-
- public void setStandardInput(boolean standardInput) {
- this.standardInput = standardInput;
- }
-
- public String getUserFriendlyDesc() {
- return userFriendlyDesc;
- }
-
- public void setUserFriendlyDesc(String userFriendlyDesc) {
- this.userFriendlyDesc = userFriendlyDesc;
- }
-
- public int getInputOrder() {
- return inputOrder;
- }
-
- public void setInputOrder(int inputOrder) {
- this.inputOrder = inputOrder;
- }
-
- public boolean getIsRequired() {
- return isRequired;
- }
-
- public void setIsRequired(boolean isRequired) {
- this.isRequired = isRequired;
- }
-
- public boolean getRequiredToCMD() {
- return requiredToCMD;
- }
-
- public void setRequiredToCMD(boolean requiredToCMD) {
- this.requiredToCMD = requiredToCMD;
- }
-
- public boolean isDataStaged() {
- return dataStaged;
- }
-
- public void setDataStaged(boolean dataStaged) {
- this.dataStaged = dataStaged;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/NodeInput_PK.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/NodeInput_PK.java b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/NodeInput_PK.java
deleted file mode 100644
index 3aeb980..0000000
--- a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/NodeInput_PK.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- *
- * 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.experiment.catalog.model;
-
-import java.io.Serializable;
-
-public class NodeInput_PK implements Serializable {
- private String nodeId;
- private String inputKey;
-
- public NodeInput_PK(String nodeId, String inputKey) {
- this.nodeId = nodeId;
- this.inputKey = inputKey;
- }
-
- public NodeInput_PK() {
- ;
- }
-
- @Override
- public boolean equals(Object o) {
- return false;
- }
-
- @Override
- public int hashCode() {
- return 1;
- }
-
- public String getNodeId() {
- return nodeId;
- }
-
- public void setNodeId(String nodeId) {
- this.nodeId = nodeId;
- }
-
- public String getInputKey() {
- return inputKey;
- }
-
- public void setInputKey(String inputKey) {
- this.inputKey = inputKey;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/NodeOutput.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/NodeOutput.java b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/NodeOutput.java
deleted file mode 100644
index 9831805..0000000
--- a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/NodeOutput.java
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- *
- * 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.experiment.catalog.model;
-
-import org.apache.openjpa.persistence.DataCache;
-
-import javax.persistence.*;
-import java.io.Serializable;
-
-@DataCache
-@Entity
-@Table(name = "NODE_OUTPUT")
-@IdClass(NodeOutput_PK.class)
-public class NodeOutput implements Serializable {
- @Id
- @Column(name = "NODE_INSTANCE_ID")
- private String nodeId;
- @Id
- @Column(name = "OUTPUT_KEY")
- private String outputKey;
- @Column(name = "DATA_TYPE")
- private String dataType;
- @Column(name = "VALUE")
- private String value;
- @Column(name = "IS_REQUIRED")
- private boolean isRequired;
- @Column(name="REQUIRED_TO_COMMANDLINE")
- private boolean requiredToCMD;
- @Column(name = "DATA_MOVEMENT")
- private boolean dataMovement;
- @Column(name = "DATA_NAME_LOCATION")
- private String dataNameLocation;
- @Column(name = "SEARCH_QUERY")
- private String searchQuery;
- @Column(name = "APP_ARGUMENT")
- private String applicationArgument;
-
- @ManyToOne(cascade= CascadeType.MERGE)
- @JoinColumn(name = "NODE_INSTANCE_ID")
- private WorkflowNodeDetail nodeDetail;
-
- public String getNodeId() {
- return nodeId;
- }
-
- public void setNodeId(String nodeId) {
- this.nodeId = nodeId;
- }
-
- public String getValue() {
- return value;
- }
-
- public void setValue(String value) {
- this.value = value;
- }
-
- public String getOutputKey() {
- return outputKey;
- }
-
- public void setOutputKey(String outputKey) {
- this.outputKey = outputKey;
- }
-
- public String getDataType() {
- return dataType;
- }
-
- public void setDataType(String dataType) {
- this.dataType = dataType;
- }
-
- public boolean isRequired() {
- return isRequired;
- }
-
- public void setRequired(boolean isRequired) {
- this.isRequired = isRequired;
- }
-
- public boolean isRequiredToCMD() {
- return requiredToCMD;
- }
-
- public void setRequiredToCMD(boolean requiredToCMD) {
- this.requiredToCMD = requiredToCMD;
- }
-
- public boolean isDataMovement() {
- return dataMovement;
- }
-
- public void setDataMovement(boolean dataMovement) {
- this.dataMovement = dataMovement;
- }
-
- public String getDataNameLocation() {
- return dataNameLocation;
- }
-
- public void setDataNameLocation(String dataNameLocation) {
- this.dataNameLocation = dataNameLocation;
- }
-
- public String getSearchQuery() {
- return searchQuery;
- }
-
- public void setSearchQuery(String searchQuery) {
- this.searchQuery = searchQuery;
- }
-
- public String getApplicationArgument() {
- return applicationArgument;
- }
-
- public void setApplicationArgument(String applicationArgument) {
- this.applicationArgument = applicationArgument;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/NodeOutput_PK.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/NodeOutput_PK.java b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/NodeOutput_PK.java
deleted file mode 100644
index fcbd4cf..0000000
--- a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/NodeOutput_PK.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- *
- * 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.experiment.catalog.model;
-
-import java.io.Serializable;
-
-public class NodeOutput_PK implements Serializable {
- private String nodeId;
- private String outputKey;
-
- public NodeOutput_PK(String nodeId, String outputKey) {
- this.nodeId = nodeId;
- this.outputKey = outputKey;
- }
-
- public NodeOutput_PK() {
- ;
- }
-
- @Override
- public boolean equals(Object o) {
- return false;
- }
-
- @Override
- public int hashCode() {
- return 1;
- }
-
- public String getNodeId() {
- return nodeId;
- }
-
- public void setNodeId(String nodeId) {
- this.nodeId = nodeId;
- }
-
- public String getOutputKey() {
- return outputKey;
- }
-
- public void setOutputKey(String outputKey) {
- this.outputKey = outputKey;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/Notification_Email.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/Notification_Email.java b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/Notification_Email.java
deleted file mode 100644
index 8c8606e..0000000
--- a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/Notification_Email.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- *
- * 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.experiment.catalog.model;
-
-import org.apache.openjpa.persistence.DataCache;
-
-import javax.persistence.*;
-import java.io.Serializable;
-
-@DataCache
-@Entity
-@Table(name ="NOTIFICATION_EMAIL")
-public class Notification_Email implements Serializable {
- @Id
- @GeneratedValue
- private int emailId;
- @Column(name = "EXPERIMENT_ID")
- private String experiment_id;
- @Column(name = "TASK_ID")
- private String taskId;
- @Column(name = "EMAIL_ADDRESS")
- private String emailAddress;
-
- @ManyToOne
- @JoinColumn(name = "EXPERIMENT_ID")
- private Experiment experiment;
- @ManyToOne
- @JoinColumn(name = "TASK_ID")
- private TaskDetail task;
-
- public String getExperiment_id() {
- return experiment_id;
- }
-
- public void setExperiment_id(String experiment_id) {
- this.experiment_id = experiment_id;
- }
-
- public String getEmailAddress() {
- return emailAddress;
- }
-
- public void setEmailAddress(String emailAddress) {
- this.emailAddress = emailAddress;
- }
-
- public String getTaskId() {
- return taskId;
- }
-
- public void setTaskId(String taskId) {
- this.taskId = taskId;
- }
-
- public int getEmailId() {
- return emailId;
- }
-
- public void setEmailId(int emailId) {
- this.emailId = emailId;
- }
-}
[03/52] [abbrv] [partial] airavata git commit: registry refactoring
Posted by sh...@apache.org.
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/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
new file mode 100644
index 0000000..f91c71d
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/util/AppCatalogJPAUtils.java
@@ -0,0 +1,912 @@
+/*
+ *
+ * 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.util;
+
+import org.apache.airavata.common.exception.ApplicationSettingsException;
+import org.apache.airavata.common.utils.ServerSettings;
+import org.apache.airavata.registry.core.app.catalog.model.*;
+import org.apache.airavata.registry.core.app.catalog.resources.*;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.persistence.EntityManager;
+import javax.persistence.EntityManagerFactory;
+import javax.persistence.Persistence;
+import java.util.HashMap;
+import java.util.Map;
+
+public class AppCatalogJPAUtils {
+ private final static Logger logger = LoggerFactory.getLogger(AppCatalogJPAUtils.class);
+ private static final String PERSISTENCE_UNIT_NAME = "appcatalog_data";
+ private static final String APPCATALOG_JDBC_DRIVER = "appcatalog.jdbc.driver";
+ private static final String APPCATALOG_JDBC_URL = "appcatalog.jdbc.url";
+ private static final String APPCATALOG_JDBC_USER = "appcatalog.jdbc.user";
+ private static final String APPCATALOG_JDBC_PWD = "appcatalog.jdbc.password";
+ private static final String APPCATALOG_VALIDATION_QUERY = "appcatalog.validationQuery";
+ private static final String JPA_CACHE_SIZE = "jpa.cache.size";
+ protected static EntityManagerFactory factory;
+
+ public static EntityManager getEntityManager() throws ApplicationSettingsException {
+ if (factory == null) {
+ String connectionProperties = "DriverClassName=" + readServerProperties(APPCATALOG_JDBC_DRIVER) + "," +
+ "Url=" + readServerProperties(APPCATALOG_JDBC_URL) + "?autoReconnect=true," +
+ "Username=" + readServerProperties(APPCATALOG_JDBC_USER) + "," +
+ "Password=" + readServerProperties(APPCATALOG_JDBC_PWD) +
+ ",validationQuery=" + readServerProperties(APPCATALOG_VALIDATION_QUERY);
+ System.out.println(connectionProperties);
+ Map<String, String> properties = new HashMap<String, String>();
+ properties.put("persistenceXmlLocation", "META-INF/persistence.xml");
+ properties.put("openjpa.ConnectionDriverName", "org.apache.commons.dbcp.BasicDataSource");
+ properties.put("openjpa.ConnectionProperties", connectionProperties);
+ properties.put("openjpa.DynamicEnhancementAgent", "true");
+ properties.put("openjpa.RuntimeUnenhancedClasses", "unsupported");
+ properties.put("openjpa.DataCache","true(CacheSize=" + Integer.valueOf(readServerProperties(JPA_CACHE_SIZE)) + ", SoftReferenceSize=0)");
+ properties.put("openjpa.QueryCache","true(CacheSize=" + Integer.valueOf(readServerProperties(JPA_CACHE_SIZE)) + ", SoftReferenceSize=0)");
+ properties.put("openjpa.RemoteCommitProvider","sjvm");
+ properties.put("openjpa.Log","DefaultLevel=INFO, Runtime=INFO, Tool=INFO, SQL=INFO");
+ properties.put("openjpa.jdbc.SynchronizeMappings", "buildSchema(ForeignKeys=true)");
+ properties.put("openjpa.jdbc.QuerySQLCache", "false");
+ properties.put("openjpa.ConnectionFactoryProperties", "PrettyPrint=true, PrettyPrintLineLength=72, PrintParameters=true, MaxActive=10, MaxIdle=5, MinIdle=2, MaxWait=31536000, autoReconnect=true");
+ factory = Persistence.createEntityManagerFactory(PERSISTENCE_UNIT_NAME, properties);
+ }
+ return factory.createEntityManager();
+ }
+
+ private static String readServerProperties (String propertyName) throws ApplicationSettingsException {
+ try {
+ return ServerSettings.getSetting(propertyName);
+ } catch (ApplicationSettingsException e) {
+ logger.error("Unable to read airavata-server.properties...", e);
+ throw new ApplicationSettingsException("Unable to read airavata-server.properties...");
+ }
+ }
+
+ /**
+ *
+ * @param type model type
+ * @param o model type instance
+ * @return corresponding resource object
+ */
+ public static AppCatalogResource getResource(AppCatalogResourceType type, Object o) {
+ switch (type){
+ case COMPUTE_RESOURCE:
+ if (o instanceof ComputeResource){
+ return createComputeResource((ComputeResource) o);
+ }else{
+ logger.error("Object should be a Compute Resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Object should be a Compute Resource.");
+ }
+ case HOST_ALIAS:
+ if (o instanceof HostAlias){
+ return createHostAlias((HostAlias) o);
+ }else {
+ logger.error("Object should be a Host Alias.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Object should be a Host Alias.");
+ }
+ case HOST_IPADDRESS:
+ if (o instanceof HostIPAddress){
+ return createHostIPAddress((HostIPAddress) o);
+ }else {
+ logger.error("Object should be a Host IPAdress.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Object should be a Host IPAdress.");
+ }
+ case GSISSH_SUBMISSION:
+ if (o instanceof GSISSHSubmission){
+ return createGSSISSHSubmission((GSISSHSubmission) o);
+ }else {
+ logger.error("Object should be a GSISSH Submission", new IllegalArgumentException());
+ throw new IllegalArgumentException("Object should be a GSISSH Submission.");
+ }
+ case UNICORE_JOB_SUBMISSION:
+ if (o instanceof UnicoreJobSubmission){
+ return createUnicoreJobSubmission((UnicoreJobSubmission) o);
+ }else {
+ logger.error("Object should be a GSISSH Submission", new IllegalArgumentException());
+ throw new IllegalArgumentException("Object should be a GSISSH Submission.");
+ }
+ case UNICORE_DATA_MOVEMENT:
+ if (o instanceof UnicoreDataMovement){
+ return createUnicoreDataMovement((UnicoreDataMovement) o);
+ }else {
+ logger.error("Object should be a GSISSH Submission", new IllegalArgumentException());
+ throw new IllegalArgumentException("Object should be a GSISSH Submission.");
+ }
+ case GSISSH_EXPORT:
+ if (o instanceof GSISSHExport){
+ return createGSISSHExport((GSISSHExport) o);
+ }else {
+ logger.error("Object should be a GSISSH Export.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Object should be a GSISSH Export.");
+ }
+ case PRE_JOBCOMMAND:
+ if (o instanceof PreJobCommand){
+ return createPreJobCommand((PreJobCommand) o);
+ }else {
+ logger.error("Object should be a GSISSHPreJobCommand.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Object should be a GSISSHPreJobCommand.");
+ }
+ case POST_JOBCOMMAND:
+ if (o instanceof PostJobCommand){
+ return createPostJObCommand((PostJobCommand) o);
+ }else {
+ logger.error("Object should be a GSISSHPostJobCommand.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Object should be a GSISSHPostJobCommand.");
+ }
+ case GLOBUS_SUBMISSION:
+ if (o instanceof GlobusJobSubmission){
+ return createGlobusJobSubmission((GlobusJobSubmission) o);
+ }else {
+ logger.error("Object should be a GlobusJobSubmission.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Object should be a GlobusJobSubmission.");
+ }
+ case GLOBUS_GK_ENDPOINT:
+ if (o instanceof GlobusGKEndpoint){
+ return createGlobusEndpoint((GlobusGKEndpoint) o);
+ }else {
+ logger.error("Object should be a GlobusJobSubmission.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Object should be a GlobusJobSubmission.");
+ }
+ case SSH_JOB_SUBMISSION:
+ if (o instanceof SshJobSubmission){
+ return createSshJobSubmission((SshJobSubmission) o);
+ }else{
+ logger.error("Object should be a Ssh Job Submission.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Object should be a Ssh Job Submission.");
+ }
+ case SCP_DATA_MOVEMENT:
+ if (o instanceof ScpDataMovement){
+ return createScpDataMovement((ScpDataMovement) o);
+ }else{
+ logger.error("Object should be a Scp Data Movement.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Object should be a Scp Data Movement.");
+ }
+ case GRIDFTP_DATA_MOVEMENT:
+ if (o instanceof GridftpDataMovement){
+ return createGridftpDataMovement((GridftpDataMovement) o);
+ }else{
+ logger.error("Object should be a Gridftp Data Movement.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Object should be a Gridftp Data Movement.");
+ }
+ case GRIDFTP_ENDPOINT:
+ if (o instanceof GridftpEndpoint){
+ return createGridftpEndpoint((GridftpEndpoint) o);
+ }else{
+ logger.error("Object should be a Gridftp Endpoint.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Object should be a Gridftp Endpoint.");
+ }
+// case JOB_SUBMISSION_PROTOCOL:
+// if (o instanceof JobSubmissionProtocol){
+// return createJobSubmissionProtocol((JobSubmissionProtocol) o);
+// }else {
+// logger.error("Object should be a JobSubmissionProtocol.", new IllegalArgumentException());
+// throw new IllegalArgumentException("Object should be a JobSubmissionProtocol.");
+// }
+// case DATA_MOVEMENT_PROTOCOL:
+// if (o instanceof DataMovementProtocol){
+// return createDataMovementProtocol((DataMovementProtocol) o);
+// }else {
+// logger.error("Object should be a DataMovementProtocol.", new IllegalArgumentException());
+// throw new IllegalArgumentException("Object should be a DataMovementProtocol.");
+// }
+ case APPLICATION_MODULE:
+ if (o instanceof ApplicationModule){
+ return createApplicationModule((ApplicationModule) o);
+ }else {
+ logger.error("Object should be a Application Module.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Object should be a Application Module.");
+ }
+ case APPLICATION_DEPLOYMENT:
+ if (o instanceof ApplicationDeployment){
+ return createApplicationDeployment((ApplicationDeployment) o);
+ }else {
+ logger.error("Object should be a Application Deployment.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Object should be a Application Deployment.");
+ }
+ case LIBRARY_PREPAND_PATH:
+ if (o instanceof LibraryPrepandPath){
+ return createLibraryPrepPathResource((LibraryPrepandPath) o);
+ }else {
+ logger.error("Object should be a Library Prepand path.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Object should be a Library Prepand path.");
+ }
+ case LIBRARY_APEND_PATH:
+ if (o instanceof LibraryApendPath){
+ return createLibraryApendPathResource((LibraryApendPath) o);
+ }else {
+ logger.error("Object should be a Library Apend path.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Object should be a Library Apend.");
+ }
+ case APP_ENVIRONMENT:
+ if (o instanceof AppEnvironment){
+ return createAppEnvironmentResource((AppEnvironment) o);
+ }else {
+ logger.error("Object should be a AppEnvironment.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Object should be a AppEnvironment.");
+ }
+ case APPLICATION_INTERFACE:
+ if (o instanceof ApplicationInterface){
+ return createAppInterfaceResource((ApplicationInterface) o);
+ }else {
+ logger.error("Object should be a ApplicationInterface.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Object should be a ApplicationInterface.");
+ }
+ case APP_MODULE_MAPPING:
+ if (o instanceof AppModuleMapping){
+ return createAppModMappingResource((AppModuleMapping) o);
+ }else {
+ logger.error("Object should be a AppModuleMapping.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Object should be a AppModuleMapping.");
+ }
+ case APPLICATION_OUTPUT:
+ if (o instanceof ApplicationOutput){
+ return createApplicationOutput((ApplicationOutput) o);
+ }else {
+ logger.error("Object should be a ApplicationOutput.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Object should be a ApplicationOutput.");
+ }
+ case GATEWAY_PROFILE:
+ if (o instanceof GatewayProfile){
+ return createGatewayProfile((GatewayProfile) o);
+ }else {
+ logger.error("Object should be a GatewayProfile.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Object should be a GatewayProfile.");
+ }
+ case COMPUTE_RESOURCE_PREFERENCE:
+ if (o instanceof ComputeResourcePreference){
+ return createComputeResourcePref((ComputeResourcePreference) o);
+ }else {
+ logger.error("Object should be a Compute Resource Preference.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Object should be a Compute Resource Preference.");
+ }
+ case APPLICATION_INPUT:
+ if (o instanceof ApplicationInput){
+ return createApplicationInput((ApplicationInput) o);
+ }else {
+ logger.error("Object should be a ApplicationInput.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Object should be a ApplicationInput.");
+ }
+ case BATCH_QUEUE:
+ if (o instanceof BatchQueue){
+ return createBatchQueue((BatchQueue) o);
+ }else{
+ logger.error("Object should be a Batch Queue.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Object should be a Batch Queue.");
+ }
+ case COMPUTE_RESOURCE_FILE_SYSTEM:
+ if (o instanceof ComputeResourceFileSystem){
+ return createComputeResourceFileSystem((ComputeResourceFileSystem) o);
+ }else{
+ logger.error("Object should be a Compute Resource File System.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Object should be a Compute Resource File System.");
+ }
+ case JOB_SUBMISSION_INTERFACE:
+ if (o instanceof JobSubmissionInterface){
+ return createJobSubmissionInterface((JobSubmissionInterface) o);
+ }else{
+ logger.error("Object should be a Job Submission Interface.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Object should be a Job Submission Interface.");
+ }
+ case DATA_MOVEMENT_INTERFACE:
+ if (o instanceof DataMovementInterface){
+ return createDataMovementInterface((DataMovementInterface) o);
+ }else{
+ logger.error("Object should be a Data Movement Interface.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Object should be a Data Movement Interface.");
+ }
+ case RESOURCE_JOB_MANAGER:
+ if (o instanceof ResourceJobManager){
+ return createResourceJobManager((ResourceJobManager) o);
+ }else{
+ logger.error("Object should be a Resource Job Manager.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Object should be a Resource Job Manager.");
+ }
+ case JOB_MANAGER_COMMAND:
+ if (o instanceof JobManagerCommand){
+ return createJobManagerCommand((JobManagerCommand) o);
+ }else{
+ logger.error("Object should be a Job Manager Command.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Object should be a Job Manager Command.");
+ }
+ case LOCAL_SUBMISSION:
+ if (o instanceof LocalSubmission){
+ return createLocalSubmission((LocalSubmission) o);
+ }else{
+ logger.error("Object should be a Local Submission.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Object should be a Local Submission.");
+ }
+ case LOCAL_DATA_MOVEMENT:
+ if (o instanceof LocalDataMovement){
+ return createLocalDataMovement((LocalDataMovement) o);
+ }else{
+ logger.error("Object should be a Local Data Movement.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Object should be a Local Data Movement.");
+ }
+ case MODULE_LOAD_CMD:
+ if (o instanceof ModuleLoadCmd) {
+ return createModuleLoadCmd((ModuleLoadCmd) o);
+ } else {
+ logger.error("Object should be a Module Load Cmd.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Object should be a Module Load Cmd.");
+ }
+ case WORKFLOW:
+ if (o instanceof Workflow) {
+ return createWorkflow((Workflow) o);
+ } else {
+ logger.error("Object should be a Workflow.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Object should be a Workflow.");
+ }
+ case WORKFLOW_INPUT:
+ if (o instanceof WorkflowInput){
+ return createWorflowInput((WorkflowInput) o);
+ }else {
+ logger.error("Object should be a Workflow Input.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Object should be a Workflow Input.");
+ }
+ case WORKFLOW_OUTPUT:
+ if (o instanceof WorkflowOutput){
+ return createWorkflowOutput((WorkflowOutput) o);
+ }else {
+ logger.error("Object should be a Workflow Output.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Object should be a Workflow Output.");
+ }
+ default:
+ logger.error("Illegal data type..", new IllegalArgumentException());
+ throw new IllegalArgumentException("Illegal data type..");
+ }
+ }
+
+ private static AppCatalogResource createLocalDataMovement(LocalDataMovement o) {
+ LocalDataMovementAppCatalogResourceAppCat localDataMovementResource = new LocalDataMovementAppCatalogResourceAppCat();
+ if (o != null){
+ localDataMovementResource.setDataMovementInterfaceId(o.getDataMovementInterfaceId());
+ }
+ return localDataMovementResource;
+ }
+
+ private static AppCatalogResource createLocalSubmission(LocalSubmission o) {
+ LocalSubmissionAppCatalogResourceAppCat localSubmissionResource = new LocalSubmissionAppCatalogResourceAppCat();
+ if (o != null){
+ localSubmissionResource.setResourceJobManagerId(o.getResourceJobManagerId());
+ localSubmissionResource.setResourceJobManagerResource((ResourceJobManagerAppCatalogResourceAppCat)createResourceJobManager(o.getResourceJobManager()));
+ localSubmissionResource.setJobSubmissionInterfaceId(o.getJobSubmissionInterfaceId());
+ localSubmissionResource.setCreatedTime(o.getCreationTime());
+ if (o.getUpdateTime() != null){
+ localSubmissionResource.setUpdatedTime(o.getUpdateTime());
+ }
+ }
+ return localSubmissionResource;
+ }
+
+ private static AppCatalogResource createJobManagerCommand(JobManagerCommand o) {
+ JobManagerCommandAppCatalogResourceAppCat jobManagerCommandResource = new JobManagerCommandAppCatalogResourceAppCat();
+ if (o != null){
+ jobManagerCommandResource.setResourceJobManagerId(o.getResourceJobManagerId());
+ jobManagerCommandResource.setResourceJobManagerResource((ResourceJobManagerAppCatalogResourceAppCat)createResourceJobManager(o.getResourceJobManager()));
+ jobManagerCommandResource.setCommandType(o.getCommandType());
+ jobManagerCommandResource.setCommand(o.getCommand());
+ }
+ return jobManagerCommandResource;
+ }
+
+ private static AppCatalogResource createResourceJobManager(ResourceJobManager o) {
+ ResourceJobManagerAppCatalogResourceAppCat resourceJobManagerResource = new ResourceJobManagerAppCatalogResourceAppCat();
+ if (o != null) {
+ resourceJobManagerResource.setResourceJobManagerId(o.getResourceJobManagerId());
+ resourceJobManagerResource.setPushMonitoringEndpoint(o.getPushMonitoringEndpoint());
+ resourceJobManagerResource.setJobManagerBinPath(o.getJobManagerBinPath());
+ resourceJobManagerResource.setResourceJobManagerType(o.getResourceJobManagerType());
+ resourceJobManagerResource.setCreatedTime(o.getCreationTime());
+ if (o.getUpdateTime() != null){
+ resourceJobManagerResource.setUpdatedTime(o.getUpdateTime());
+ }
+ }
+ return resourceJobManagerResource;
+ }
+
+ private static AppCatalogResource createDataMovementInterface(DataMovementInterface o) {
+ DataMovementInterfaceAppCatalogResourceAppCat dataMovementInterfaceResource = new DataMovementInterfaceAppCatalogResourceAppCat();
+ if (o != null) {
+ dataMovementInterfaceResource.setComputeResourceId(o.getComputeResourceId());
+ dataMovementInterfaceResource.setComputeHostResource((ComputeResourceAppCatalogResourceAppCat)createComputeResource(o.getComputeResource()));
+ dataMovementInterfaceResource.setDataMovementProtocol(o.getDataMovementProtocol());
+ dataMovementInterfaceResource.setDataMovementInterfaceId(o.getDataMovementInterfaceId());
+ dataMovementInterfaceResource.setPriorityOrder(o.getPriorityOrder());
+ dataMovementInterfaceResource.setCreatedTime(o.getCreationTime());
+ if (o.getUpdateTime() != null){
+ dataMovementInterfaceResource.setUpdatedTime(o.getUpdateTime());
+ }
+ }
+ return dataMovementInterfaceResource;
+ }
+
+ private static AppCatalogResource createJobSubmissionInterface(JobSubmissionInterface o) {
+ JobSubmissionInterfaceAppCatalogResourceAppCat jobSubmissionInterfaceResource = new JobSubmissionInterfaceAppCatalogResourceAppCat();
+ if (o != null) {
+ jobSubmissionInterfaceResource.setJobSubmissionInterfaceId(o.getJobSubmissionInterfaceId());
+ jobSubmissionInterfaceResource.setComputeResourceId(o.getComputeResourceId());
+ jobSubmissionInterfaceResource.setComputeHostResource((ComputeResourceAppCatalogResourceAppCat)createComputeResource(o.getComputeResource()));
+ jobSubmissionInterfaceResource.setJobSubmissionProtocol(o.getJobSubmissionProtocol());
+ jobSubmissionInterfaceResource.setPriorityOrder(o.getPriorityOrder());
+ jobSubmissionInterfaceResource.setCreatedTime(o.getCreationTime());
+ if (o.getUpdateTime() != null){
+ jobSubmissionInterfaceResource.setUpdatedTime(o.getUpdateTime());
+ }
+ }
+ return jobSubmissionInterfaceResource;
+ }
+
+ private static AppCatalogResource createComputeResourceFileSystem(ComputeResourceFileSystem o) {
+ ComputeResourceFileSystemAppCatalogResourceAppCat computeResourceFileSystemResource = new ComputeResourceFileSystemAppCatalogResourceAppCat();
+ if (o != null){
+ computeResourceFileSystemResource.setComputeResourceId(o.getComputeResourceId());
+ computeResourceFileSystemResource.setComputeHostResource((ComputeResourceAppCatalogResourceAppCat)createComputeResource(o.getComputeResource()));
+ computeResourceFileSystemResource.setPath(o.getPath());
+ computeResourceFileSystemResource.setFileSystem(o.getFileSystem());
+ }
+ return computeResourceFileSystemResource;
+ }
+
+ private static AppCatalogResource createBatchQueue(BatchQueue o) {
+ BatchQueueAppCatalogResourceAppCat batchQueueResource = new BatchQueueAppCatalogResourceAppCat();
+ if (o != null){
+ batchQueueResource.setComputeResourceId(o.getComputeResourceId());
+ batchQueueResource.setComputeHostResource((ComputeResourceAppCatalogResourceAppCat)createComputeResource(o.getComputeResource()));
+ batchQueueResource.setMaxRuntime(o.getMaxRuntime());
+ batchQueueResource.setMaxJobInQueue(o.getMaxJobInQueue());
+ batchQueueResource.setQueueDescription(o.getQueueDescription());
+ batchQueueResource.setQueueName(o.getQueueName());
+ batchQueueResource.setMaxProcessors(o.getMaxProcessors());
+ batchQueueResource.setMaxNodes(o.getMaxNodes());
+ batchQueueResource.setMaxMemory(o.getMaxMemory());
+ }
+ return batchQueueResource;
+ }
+ private static AppCatalogResource createComputeResource(ComputeResource o) {
+ ComputeResourceAppCatalogResourceAppCat computeResourceResource = new ComputeResourceAppCatalogResourceAppCat();
+ if (o != null) {
+ computeResourceResource.setResourceDescription(o.getResourceDescription());
+ computeResourceResource.setResourceId(o.getResourceId());
+ computeResourceResource.setHostName(o.getHostName());
+ computeResourceResource.setCreatedTime(o.getCreationTime());
+ computeResourceResource.setMaxMemoryPerNode(o.getMaxMemoryPerNode());
+ if (o.getUpdateTime() != null){
+ computeResourceResource.setUpdatedTime(o.getUpdateTime());
+ }
+ }
+ return computeResourceResource;
+ }
+
+ private static AppCatalogResource createHostAlias(HostAlias o) {
+ HostAliasAppCatalogResourceAppCat aliasResource = new HostAliasAppCatalogResourceAppCat();
+ if (o != null){
+ aliasResource.setResourceID(o.getResourceID());
+ aliasResource.setAlias(o.getAlias());
+ aliasResource.setComputeHostResource((ComputeResourceAppCatalogResourceAppCat)createComputeResource(o.getComputeResource()));
+ }
+ return aliasResource;
+ }
+
+ private static AppCatalogResource createHostIPAddress(HostIPAddress o) {
+ HostIPAddressAppCatalogResourceAppCat ipAddressResource = new HostIPAddressAppCatalogResourceAppCat();
+ if (o != null){
+ ipAddressResource.setResourceID(o.getResourceID());
+ ipAddressResource.setIpaddress(o.getIpaddress());
+ ipAddressResource.setComputeHostResource((ComputeResourceAppCatalogResourceAppCat)createComputeResource(o.getComputeResource()));
+ }
+ return ipAddressResource;
+ }
+
+ private static AppCatalogResource createGSSISSHSubmission(GSISSHSubmission o) {
+ GSISSHSubmissionAppCatalogResourceAppCat submissionResource = new GSISSHSubmissionAppCatalogResourceAppCat();
+ if (o != null) {
+ submissionResource.setSubmissionID(o.getSubmissionID());
+ submissionResource.setResourceJobManager(o.getResourceJobManager());
+ submissionResource.setSshPort(o.getSshPort());
+ submissionResource.setInstalledPath(o.getInstalledPath());
+ submissionResource.setMonitorMode(o.getMonitorMode());
+ }
+ return submissionResource;
+ }
+
+
+ private static AppCatalogResource createUnicoreJobSubmission(UnicoreJobSubmission o) {
+ UnicoreJobSubmissionAppCatalogResourceAppCat submissionResource = new UnicoreJobSubmissionAppCatalogResourceAppCat();
+ if (o != null) {
+ submissionResource.setjobSubmissionInterfaceId(o.getSubmissionID());
+ submissionResource.setUnicoreEndpointUrl(o.getUnicoreEndpointUrl());
+ submissionResource.setSecurityProtocol(o.getSecurityProtocol());
+ }
+ return submissionResource;
+ }
+
+ private static AppCatalogResource createUnicoreDataMovement(UnicoreDataMovement o) {
+ UnicoreDataMovementAppCatalogResourceAppCat dataMovementResource = new UnicoreDataMovementAppCatalogResourceAppCat();
+ if (o != null) {
+ dataMovementResource.setDataMovementId(o.getDataMovementId());
+ dataMovementResource.setUnicoreEndpointUrl(o.getUnicoreEndpointUrl());
+ dataMovementResource.setSecurityProtocol(o.getSecurityProtocol());
+ }
+ return dataMovementResource;
+ }
+
+ private static AppCatalogResource createGSISSHExport(GSISSHExport o){
+ GSISSHExportAppCatalogResourceAppCat resource = new GSISSHExportAppCatalogResourceAppCat();
+ if (o != null) {
+ resource.setSubmissionID(o.getSubmissionID());
+ resource.setExport(o.getExport());
+ resource.setGsisshSubmissionResource((GSISSHSubmissionAppCatalogResourceAppCat)createGSSISSHSubmission(o.getGsisshJobSubmission()));
+ }
+ return resource;
+ }
+
+ private static AppCatalogResource createPreJobCommand(PreJobCommand o){
+ PreJobCommandAppCatalogResourceAppCat resource = new PreJobCommandAppCatalogResourceAppCat();
+ if (o != null) {
+ resource.setAppDeploymentId(o.getDeploymentId());
+ resource.setCommand(o.getCommand());
+ resource.setAppDeploymentResource((AppDeploymentAppCatalogResourceAppCat) createApplicationDeployment(o.getApplicationDeployment()));
+ }
+ return resource;
+ }
+
+ private static AppCatalogResource createPostJObCommand(PostJobCommand o){
+ PostJobCommandAppCatalogResourceAppCat resource = new PostJobCommandAppCatalogResourceAppCat();
+ if (o != null){
+ resource.setAppDeploymentId(o.getDeploymentId());
+ resource.setCommand(o.getCommand());
+ resource.setAppDeploymentResource((AppDeploymentAppCatalogResourceAppCat) createApplicationDeployment(o.getDeployment()));
+ }
+ return resource;
+ }
+
+ private static AppCatalogResource createGlobusJobSubmission(GlobusJobSubmission o) {
+ GlobusJobSubmissionAppCatalogResourceAppCat resource = new GlobusJobSubmissionAppCatalogResourceAppCat();
+ if (o != null){
+ resource.setSubmissionID(o.getSubmissionID());
+ resource.setResourceJobManager(o.getResourceJobManager());
+ resource.setSecurityProtocol(o.getSecurityProtocol());
+ }
+ return resource;
+ }
+
+ private static AppCatalogResource createGlobusEndpoint(GlobusGKEndpoint o) {
+ GlobusGKEndpointAppCatalogResourceAppCat resource = new GlobusGKEndpointAppCatalogResourceAppCat();
+ if (o != null){
+ resource.setSubmissionID(o.getSubmissionID());
+ resource.setEndpoint(o.getEndpoint());
+ resource.setGlobusJobSubmissionResource((GlobusJobSubmissionAppCatalogResourceAppCat)createGlobusJobSubmission(o.getGlobusSubmission()));
+ }
+ return resource;
+ }
+
+ private static AppCatalogResource createSshJobSubmission(SshJobSubmission o) {
+ SshJobSubmissionAppCatalogResourceAppCat sshJobSubmissionResource = new SshJobSubmissionAppCatalogResourceAppCat();
+ if (o != null) {
+ sshJobSubmissionResource.setResourceJobManagerId(o.getResourceJobManagerId());
+ sshJobSubmissionResource.setResourceJobManagerResource((ResourceJobManagerAppCatalogResourceAppCat) createResourceJobManager(o.getResourceJobManager()));
+ sshJobSubmissionResource.setJobSubmissionInterfaceId(o.getJobSubmissionInterfaceId());
+ sshJobSubmissionResource.setAlternativeSshHostname(o.getAlternativeSshHostname());
+ sshJobSubmissionResource.setSecurityProtocol(o.getSecurityProtocol());
+ sshJobSubmissionResource.setSshPort(o.getSshPort());
+ sshJobSubmissionResource.setMonitorMode(o.getMonitorMode());
+ sshJobSubmissionResource.setCreatedTime(o.getCreationTime());
+ if (o.getUpdateTime() != null){
+ sshJobSubmissionResource.setUpdatedTime(o.getUpdateTime());
+ }
+ }
+ return sshJobSubmissionResource;
+ }
+
+ private static AppCatalogResource createScpDataMovement(ScpDataMovement o) {
+ ScpDataMovementAppCatalogResourceAppCat scpDataMovementResource = new ScpDataMovementAppCatalogResourceAppCat();
+ if (o != null){
+ scpDataMovementResource.setQueueDescription(o.getQueueDescription());
+ scpDataMovementResource.setDataMovementInterfaceId(o.getDataMovementInterfaceId());
+ scpDataMovementResource.setSecurityProtocol(o.getSecurityProtocol());
+ scpDataMovementResource.setAlternativeScpHostname(o.getAlternativeScpHostname());
+ scpDataMovementResource.setSshPort(o.getSshPort());
+ scpDataMovementResource.setCreatedTime(o.getCreationTime());
+ if (o.getUpdateTime() != null){
+ scpDataMovementResource.setUpdatedTime(o.getUpdateTime());
+ }
+ }
+ return scpDataMovementResource;
+ }
+
+ private static AppCatalogResource createGridftpDataMovement(GridftpDataMovement o) {
+ GridftpDataMovementAppCatalogResourceAppCat gridftpDataMovementResource = new GridftpDataMovementAppCatalogResourceAppCat();
+ if (o != null){
+ gridftpDataMovementResource.setDataMovementInterfaceId(o.getDataMovementInterfaceId());
+ gridftpDataMovementResource.setSecurityProtocol(o.getSecurityProtocol());
+ gridftpDataMovementResource.setCreatedTime(o.getCreationTime());
+ if (o.getUpdateTime() != null){
+ gridftpDataMovementResource.setUpdatedTime(o.getUpdateTime());
+ }
+ }
+ return gridftpDataMovementResource;
+ }
+
+ private static AppCatalogResource createGridftpEndpoint(GridftpEndpoint o) {
+ GridftpEndpointAppCatalogResourceAppCat gridftpEndpointResource = new GridftpEndpointAppCatalogResourceAppCat();
+ if (o != null){
+ gridftpEndpointResource.setEndpoint(o.getEndpoint());
+ gridftpEndpointResource.setDataMovementInterfaceId(o.getDataMovementInterfaceId());
+ gridftpEndpointResource.setGridftpDataMovementResource((GridftpDataMovementAppCatalogResourceAppCat)createGridftpDataMovement(o.getGridftpDataMovement()));
+ gridftpEndpointResource.setCreatedTime(o.getCreationTime());
+ if (o.getUpdateTime() != null){
+ gridftpEndpointResource.setUpdatedTime(o.getUpdateTime());
+ }
+ }
+ return gridftpEndpointResource;
+ }
+
+// private static Resource createJobSubmissionProtocol(JobSubmissionProtocol o) {
+// JobSubmissionProtocolResource resource = new JobSubmissionProtocolResource();
+// if (o != null){
+// resource.setResourceID(o.getResourceID());
+// resource.setSubmissionID(o.getSubmissionID());
+// resource.setJobType(o.getJobType());
+// resource.setComputeHostResource((ComputeResourceResource)createComputeResource(o.getComputeResource()));
+// }
+// return resource;
+// }
+//
+// private static Resource createDataMovementProtocol(DataMovementProtocol o) {
+// DataMovementProtocolResource resource = new DataMovementProtocolResource();
+// if (o != null) {
+// resource.setResourceID(o.getResourceID());
+// resource.setDataMoveID(o.getDataMoveID());
+// resource.setDataMoveType(o.getDataMoveType());
+// resource.setComputeHostResource((ComputeResourceResource)createComputeResource(o.getComputeResource()));
+// }
+// return resource;
+// }
+
+ private static AppCatalogResource createApplicationModule(ApplicationModule o) {
+ AppModuleAppCatalogResourceAppCat moduleResource = new AppModuleAppCatalogResourceAppCat();
+ if (o != null){
+ moduleResource.setModuleId(o.getModuleID());
+ moduleResource.setModuleDesc(o.getModuleDesc());
+ moduleResource.setGatewayId(o.getGatewayId());
+ moduleResource.setModuleName(o.getModuleName());
+ moduleResource.setModuleVersion(o.getModuleVersion());
+ moduleResource.setCreatedTime(o.getCreationTime());
+ if (o.getUpdateTime() != null){
+ moduleResource.setUpdatedTime(o.getUpdateTime());
+ }
+ }
+ return moduleResource;
+ }
+
+ private static AppCatalogResource createApplicationDeployment(ApplicationDeployment o) {
+ AppDeploymentAppCatalogResourceAppCat resource = new AppDeploymentAppCatalogResourceAppCat();
+ if (o != null){
+ resource.setDeploymentId(o.getDeploymentID());
+ resource.setAppDes(o.getApplicationDesc());
+ resource.setAppModuleId(o.getAppModuleID());
+ resource.setHostId(o.getHostID());
+ resource.setExecutablePath(o.getExecutablePath());
+ resource.setGatewayId(o.getGatewayId());
+ resource.setParallelism(o.getParallelism());
+ resource.setModuleResource((AppModuleAppCatalogResourceAppCat) createApplicationModule(o.getApplicationModule()));
+ resource.setHostResource((ComputeResourceAppCatalogResourceAppCat) createComputeResource(o.getComputeResource()));
+ resource.setCreatedTime(o.getCreationTime());
+ if (o.getUpdateTime() != null){
+ resource.setUpdatedTime(o.getUpdateTime());
+ }
+ }
+ return resource;
+ }
+
+ private static AppCatalogResource createLibraryPrepPathResource(LibraryPrepandPath o) {
+ LibraryPrepandPathAppCatalogResourceAppCat resource = new LibraryPrepandPathAppCatalogResourceAppCat();
+ if (o != null){
+ resource.setDeploymentId(o.getDeploymentID());
+ resource.setName(o.getName());
+ resource.setValue(o.getValue());
+ resource.setAppDeploymentResource((AppDeploymentAppCatalogResourceAppCat) createApplicationDeployment(o.getApplicationDeployment()));
+ }
+ return resource;
+ }
+
+ private static AppCatalogResource createLibraryApendPathResource(LibraryApendPath o) {
+ LibraryApendPathAppCatalogResourceAppCat resource = new LibraryApendPathAppCatalogResourceAppCat();
+ if (o != null){
+ resource.setDeploymentId(o.getDeploymentID());
+ resource.setName(o.getName());
+ resource.setValue(o.getValue());
+ resource.setAppDeploymentResource((AppDeploymentAppCatalogResourceAppCat)createApplicationDeployment(o.getApplicationDeployment()));
+ }
+ return resource;
+ }
+
+ private static AppCatalogResource createAppEnvironmentResource(AppEnvironment o) {
+ AppEnvironmentAppCatalogResourceAppCat resource = new AppEnvironmentAppCatalogResourceAppCat();
+ if (o != null){
+ resource.setDeploymentId(o.getDeploymentID());
+ resource.setName(o.getName());
+ resource.setValue(o.getValue());
+ resource.setAppDeploymentResource((AppDeploymentAppCatalogResourceAppCat)createApplicationDeployment(o.getApplicationDeployment()));
+ }
+ return resource;
+ }
+
+ private static AppCatalogResource createAppInterfaceResource(ApplicationInterface o) {
+ AppInterfaceAppCatalogResourceAppCat resource = new AppInterfaceAppCatalogResourceAppCat();
+ if (o != null){
+ resource.setInterfaceId(o.getInterfaceID());
+ resource.setAppName(o.getAppName());
+ resource.setAppDescription(o.getAppDescription());
+ resource.setCreatedTime(o.getCreationTime());
+ resource.setGatewayId(o.getGatewayId());
+ if (o.getUpdateTime() != null){
+ resource.setUpdatedTime(o.getUpdateTime());
+ }
+ }
+ return resource;
+ }
+
+ private static AppCatalogResource createAppModMappingResource(AppModuleMapping o) {
+ AppModuleMappingAppCatalogResourceAppCat resource = new AppModuleMappingAppCatalogResourceAppCat();
+ if (o != null){
+ resource.setInterfaceId(o.getInterfaceID());
+ resource.setModuleId(o.getModuleID());
+ }
+ return resource;
+ }
+
+ private static AppCatalogResource createApplicationInput(ApplicationInput o) {
+ ApplicationInputAppCatalogResourceAppCat resource = new ApplicationInputAppCatalogResourceAppCat();
+ if (o != null){
+ resource.setInterfaceID(o.getInterfaceID());
+ resource.setInputKey(o.getInputKey());
+ resource.setInputVal(o.getInputVal());
+ resource.setDataType(o.getDataType());
+ resource.setMetadata(o.getMetadata());
+ resource.setAppArgument(o.getAppArgument());
+ resource.setUserFriendlyDesc(o.getUserFriendlyDesc());
+ resource.setStandardInput(o.isStandardInput());
+ resource.setInputOrder(o.getInputOrder());
+ resource.setRequired(o.isRequired());
+ resource.setRequiredToCMD(o.isRequiredToCMD());
+ resource.setDataStaged(o.isDataStaged());
+ resource.setAppInterfaceResource((AppInterfaceAppCatalogResourceAppCat)createAppInterfaceResource(o.getApplicationInterface()));
+ }
+ return resource;
+ }
+
+ private static AppCatalogResource createWorflowInput(WorkflowInput o) {
+ WorkflowInputAppCatalogResourceAppCat resource = new WorkflowInputAppCatalogResourceAppCat();
+ if (o != null){
+ resource.setWfTemplateId(o.getWfTemplateId());
+ resource.setInputKey(o.getInputKey());
+ if (o.getInputVal() != null){
+ resource.setInputVal(new String(o.getInputVal()));
+ }
+ resource.setDataType(o.getDataType());
+ resource.setMetadata(o.getMetadata());
+ resource.setAppArgument(o.getAppArgument());
+ resource.setInputOrder(o.getInputOrder());
+ resource.setUserFriendlyDesc(o.getUserFriendlyDesc());
+ resource.setStandardInput(o.isStandardInput());
+ resource.setRequired(o.isRequired());
+ resource.setRequiredToCMD(o.isRequiredToCMD());
+ resource.setDataStaged(o.isDataStaged());
+ resource.setWorkflowResource((WorkflowAppCatalogResourceAppCat)createWorkflow(o.getWorkflow()));
+ }
+ return resource;
+ }
+
+ private static AppCatalogResource createApplicationOutput(ApplicationOutput o) {
+ ApplicationOutputAppCatalogResourceAppCat resource = new ApplicationOutputAppCatalogResourceAppCat();
+ if (o != null){
+ resource.setInterfaceID(o.getInterfaceID());
+ resource.setOutputKey(o.getOutputKey());
+ resource.setOutputVal(o.getOutputVal());
+ resource.setDataType(o.getDataType());
+ resource.setRequired(o.isRequired());
+ resource.setRequiredToCMD(o.isRequiredToCMD());
+ resource.setDataMovement(o.isDataMovement());
+ resource.setDataNameLocation(o.getDataNameLocation());
+ resource.setSearchQuery(o.getSearchQuery());
+ resource.setAppArgument(o.getApplicationArgument());
+ resource.setAppInterfaceResource((AppInterfaceAppCatalogResourceAppCat)createAppInterfaceResource(o.getApplicationInterface()));
+ }
+ return resource;
+ }
+
+ private static AppCatalogResource createWorkflowOutput(WorkflowOutput o) {
+ WorkflowOutputAppCatalogResourceAppCat resource = new WorkflowOutputAppCatalogResourceAppCat();
+ if (o != null){
+ resource.setWfTemplateId(o.getWfTemplateId());
+ resource.setOutputKey(o.getOutputKey());
+ if (o.getOutputVal() != null){
+ resource.setOutputVal(new String(o.getOutputVal()));
+ }
+ resource.setDataType(o.getDataType());
+ resource.setValidityType(o.getValidityType());
+ resource.setDataMovement(o.isDataMovement());
+ resource.setDataNameLocation(o.getDataNameLocation());
+ resource.setWorkflowResource((WorkflowAppCatalogResourceAppCat)createWorkflow(o.getWorkflow()));
+ }
+ return resource;
+ }
+
+ private static AppCatalogResource createGatewayProfile(GatewayProfile o) {
+ GatewayProfileAppCatalogResourceAppCat resource = new GatewayProfileAppCatalogResourceAppCat();
+ if (o != null) {
+ resource.setGatewayID(o.getGatewayID());
+ resource.setCreatedTime(o.getCreationTime());
+ if (o.getUpdateTime() != null){
+ resource.setUpdatedTime(o.getUpdateTime());
+ }
+ }
+ return resource;
+ }
+
+ private static AppCatalogResource createComputeResourcePref(ComputeResourcePreference o) {
+ ComputeHostPreferenceAppCatalogResourceAppCat resource = new ComputeHostPreferenceAppCatalogResourceAppCat();
+ if (o != null) {
+ resource.setGatewayId(o.getGatewayId());
+ resource.setResourceId(o.getResourceId());
+ resource.setOverrideByAiravata(o.isOverrideByAiravata());
+ resource.setPreferredJobProtocol(o.getPreferedJobSubmissionProtocol());
+ resource.setPreferedDMProtocol(o.getPreferedDataMoveProtocol());
+ resource.setBatchQueue(o.getBatchQueue());
+ resource.setScratchLocation(o.getScratchLocation());
+ resource.setProjectNumber(o.getProjectNumber());
+ resource.setLoginUserName(o.getLoginUserName());
+ resource.setComputeHostResource((ComputeResourceAppCatalogResourceAppCat) createComputeResource(o.getComputeHostResource()));
+ resource.setGatewayProfile((GatewayProfileAppCatalogResourceAppCat) createGatewayProfile(o.getGatewayProfile()));
+ }
+ return resource;
+ }
+
+ private static AppCatalogResource createModuleLoadCmd(ModuleLoadCmd o) {
+ ModuleLoadCmdAppCatalogResourceAppCat moduleLoadCmdResource = new ModuleLoadCmdAppCatalogResourceAppCat();
+ if (o != null){
+ moduleLoadCmdResource.setCmd(o.getCmd());
+ moduleLoadCmdResource.setAppDeploymentId(o.getAppDeploymentId());
+ moduleLoadCmdResource.setAppDeploymentResource((AppDeploymentAppCatalogResourceAppCat)createApplicationDeployment(o.getApplicationDeployment()));
+ }
+ return moduleLoadCmdResource;
+ }
+
+ private static AppCatalogResource createWorkflow(Workflow o) {
+ WorkflowAppCatalogResourceAppCat workflowResource = new WorkflowAppCatalogResourceAppCat();
+ workflowResource.setWfName(o.getWfName());
+ workflowResource.setCreatedUser(o.getCreatedUser());
+ if (o.getGraph() != null){
+ workflowResource.setGraph(new String(o.getGraph()));
+ }
+ if (o.getImage() != null){
+ workflowResource.setImage(new String(o.getImage()));
+ }
+ workflowResource.setCreatedTime(o.getCreationTime());
+ if (o.getUpdateTime() != null){
+ workflowResource.setUpdatedTime(o.getUpdateTime());
+ }
+ workflowResource.setWfTemplateId(o.getWfTemplateId());
+ workflowResource.setGatewayId(o.getGatewayId());
+ return workflowResource;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/util/AppCatalogQueryGenerator.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/util/AppCatalogQueryGenerator.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/util/AppCatalogQueryGenerator.java
new file mode 100644
index 0000000..bcb6c3b
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/util/AppCatalogQueryGenerator.java
@@ -0,0 +1,90 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.airavata.registry.core.app.catalog.util;
+
+import javax.persistence.EntityManager;
+import javax.persistence.Query;
+import java.util.HashMap;
+import java.util.Map;
+
+public class AppCatalogQueryGenerator {
+ private String tableName;
+ private Map<String,Object> matches=new HashMap<String, Object>();
+ private static final String SELECT_OBJ="p";
+ private static final String DELETE_OBJ="p";
+ private static final String TABLE_OBJ="p";
+
+ public AppCatalogQueryGenerator(String tableName, Object[]...params) {
+ setTableName(tableName);
+ for (Object[] param : params) {
+ addMatch(param[0].toString(), param[1]);
+ }
+ }
+
+ public String getTableName() {
+ return tableName;
+ }
+ public void setTableName(String tableName) {
+ this.tableName = tableName;
+ }
+ public void addMatch(String colName, Object matchValue){
+ matches.put(colName, matchValue);
+ }
+
+ public void setParameter(String colName, Object matchValue){
+ addMatch(colName, matchValue);
+ }
+
+ public Query selectQuery(EntityManager entityManager){
+ String queryString="SELECT "+ SELECT_OBJ + " FROM " +getTableName()+" "+TABLE_OBJ;
+ return generateQueryWithParameters(entityManager, queryString);
+ }
+
+ public Query deleteQuery(EntityManager entityManager){
+ String queryString="Delete FROM "+getTableName()+" "+TABLE_OBJ;
+ return generateQueryWithParameters(entityManager, queryString);
+ }
+
+ private Query generateQueryWithParameters(EntityManager entityManager,
+ String queryString) {
+ Map<String,Object> queryParameters=new HashMap<String, Object>();
+ if (matches.size()>0){
+ String matchString = "";
+ int paramCount=0;
+ for (String colName : matches.keySet()) {
+ String paramName="param"+paramCount;
+ queryParameters.put(paramName, matches.get(colName));
+ if (!matchString.equals("")){
+ matchString+=" AND ";
+ }
+ matchString+=TABLE_OBJ+"."+colName+" =:"+paramName;
+ paramCount++;
+ }
+ queryString+=" WHERE "+matchString;
+ }
+ Query query = entityManager.createQuery(queryString);
+ for (String paramName : queryParameters.keySet()) {
+ query.setParameter(paramName, queryParameters.get(paramName));
+ }
+ return query;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/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
new file mode 100644
index 0000000..96f020e
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/util/AppCatalogResourceType.java
@@ -0,0 +1,66 @@
+/*
+ *
+ * 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.util;
+
+public enum AppCatalogResourceType {
+ COMPUTE_RESOURCE,
+ HOST_ALIAS,
+ HOST_IPADDRESS,
+ GSISSH_SUBMISSION,
+ GSISSH_EXPORT,
+ PRE_JOBCOMMAND,
+ POST_JOBCOMMAND,
+ GLOBUS_SUBMISSION,
+ UNICORE_JOB_SUBMISSION,
+ UNICORE_DATA_MOVEMENT,
+ GLOBUS_GK_ENDPOINT,
+ SSH_JOB_SUBMISSION,
+ SCP_DATA_MOVEMENT,
+ GRIDFTP_DATA_MOVEMENT,
+ GRIDFTP_ENDPOINT,
+ JOB_SUBMISSION_PROTOCOL,
+ DATA_MOVEMENT_PROTOCOL,
+ APPLICATION_MODULE,
+ APPLICATION_DEPLOYMENT,
+ LIBRARY_PREPAND_PATH,
+ LIBRARY_APEND_PATH,
+ APP_ENVIRONMENT,
+ APPLICATION_INTERFACE,
+ APP_MODULE_MAPPING,
+ APPLICATION_INPUT,
+ APPLICATION_OUTPUT,
+ GATEWAY_PROFILE,
+ COMPUTE_RESOURCE_PREFERENCE,
+ BATCH_QUEUE,
+ COMPUTE_RESOURCE_FILE_SYSTEM,
+ JOB_SUBMISSION_INTERFACE,
+ DATA_MOVEMENT_INTERFACE,
+ RESOURCE_JOB_MANAGER,
+ JOB_MANAGER_COMMAND,
+ LOCAL_SUBMISSION,
+ LOCAL_DATA_MOVEMENT,
+ MODULE_LOAD_CMD,
+ ClOUD_SUBMISSION,
+ WORKFLOW,
+ WORKFLOW_INPUT,
+ WORKFLOW_OUTPUT
+}
[44/52] [abbrv] [partial] airavata git commit: registry refactoring
Posted by sh...@apache.org.
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/ApplicationOutputResource.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/ApplicationOutputResource.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/ApplicationOutputResource.java
deleted file mode 100644
index feac711..0000000
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/ApplicationOutputResource.java
+++ /dev/null
@@ -1,432 +0,0 @@
-/**
- * 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.aiaravata.application.catalog.data.resources;
-
-import org.airavata.appcatalog.cpi.AppCatalogException;
-import org.apache.aiaravata.application.catalog.data.model.AppOutput_PK;
-import org.apache.aiaravata.application.catalog.data.model.ApplicationInterface;
-import org.apache.aiaravata.application.catalog.data.model.ApplicationOutput;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogJPAUtils;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogQueryGenerator;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogResourceType;
-import org.apache.airavata.common.exception.ApplicationSettingsException;
-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 ApplicationOutputResource extends AbstractResource {
- private final static Logger logger = LoggerFactory.getLogger(ApplicationOutputResource.class);
-
- private String interfaceID;
- private String outputKey;
- private String outputVal;
- private String dataType;
- private boolean isRequired;
- private boolean dataMovement;
- private String dataNameLocation;
- private boolean requiredToCMD;
- private String searchQuery;
- private String appArgument;
-
- private AppInterfaceResource appInterfaceResource;
-
- 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(APPLICATION_OUTPUT);
- generator.setParameter(AppOutputConstants.INTERFACE_ID, ids.get(AppOutputConstants.INTERFACE_ID));
- if (ids.get(AppOutputConstants.OUTPUT_KEY) != null){
- generator.setParameter(AppOutputConstants.OUTPUT_KEY, ids.get(AppOutputConstants.OUTPUT_KEY));
- }
- 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();
- }
- }
- }
-
- public Resource 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(APPLICATION_OUTPUT);
- generator.setParameter(AppOutputConstants.INTERFACE_ID, ids.get(AppOutputConstants.INTERFACE_ID));
- generator.setParameter(AppOutputConstants.OUTPUT_KEY, ids.get(AppOutputConstants.OUTPUT_KEY));
- Query q = generator.selectQuery(em);
- ApplicationOutput applicationOutput = (ApplicationOutput) q.getSingleResult();
- ApplicationOutputResource applicationOutputResource =
- (ApplicationOutputResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.APPLICATION_OUTPUT
- , applicationOutput);
- em.getTransaction().commit();
- em.close();
- return applicationOutputResource;
- } 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();
- }
- }
- }
-
- public List<Resource> get(String fieldName, Object value) throws AppCatalogException {
- List<Resource> appInputResources = new ArrayList<Resource>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- Query q;
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(APPLICATION_OUTPUT);
- List results;
- if (fieldName.equals(AppOutputConstants.INTERFACE_ID)) {
- generator.setParameter(AppOutputConstants.INTERFACE_ID, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- ApplicationOutput applicationOutput = (ApplicationOutput) result;
- ApplicationOutputResource applicationOutputResource =
- (ApplicationOutputResource) AppCatalogJPAUtils.getResource(
- AppCatalogResourceType.APPLICATION_OUTPUT, applicationOutput);
- appInputResources.add(applicationOutputResource);
- }
- }
- } else if (fieldName.equals(AppOutputConstants.OUTPUT_KEY)) {
- generator.setParameter(AppOutputConstants.OUTPUT_KEY, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- ApplicationOutput applicationOutput = (ApplicationOutput) result;
- ApplicationOutputResource applicationOutputResource =
- (ApplicationOutputResource) AppCatalogJPAUtils.getResource(
- AppCatalogResourceType.APPLICATION_OUTPUT, applicationOutput);
- appInputResources.add(applicationOutputResource);
- }
- }
- } else if (fieldName.equals(AppOutputConstants.DATA_TYPE)) {
- generator.setParameter(AppOutputConstants.DATA_TYPE, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- ApplicationOutput applicationOutput = (ApplicationOutput) result;
- ApplicationOutputResource applicationOutputResource =
- (ApplicationOutputResource) AppCatalogJPAUtils.getResource(
- AppCatalogResourceType.APPLICATION_OUTPUT, applicationOutput);
- appInputResources.add(applicationOutputResource);
- }
- }
- } else {
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported field name for App Output Resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported field name for App Output 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 appInputResources;
- }
-
- @Override
- public List<Resource> getAll() throws AppCatalogException {
- return null;
- }
-
- @Override
- public List<String> getAllIds() throws AppCatalogException {
- return null;
- }
-
- public List<String> getIds(String fieldName, Object value) throws AppCatalogException {
- List<String> appOutputResourceIDs = new ArrayList<String>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- Query q;
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(APPLICATION_OUTPUT);
- List results;
- if (fieldName.equals(AppOutputConstants.INTERFACE_ID)) {
- generator.setParameter(AppOutputConstants.INTERFACE_ID, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- ApplicationOutput applicationOutput = (ApplicationOutput) result;
- appOutputResourceIDs.add(applicationOutput.getInterfaceID());
- }
- }
- }
- if (fieldName.equals(AppOutputConstants.OUTPUT_KEY)) {
- generator.setParameter(AppOutputConstants.OUTPUT_KEY, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- ApplicationOutput applicationOutput = (ApplicationOutput) result;
- appOutputResourceIDs.add(applicationOutput.getInterfaceID());
- }
- }
- } else if (fieldName.equals(AppOutputConstants.DATA_TYPE)) {
- generator.setParameter(AppOutputConstants.DATA_TYPE, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- ApplicationOutput applicationOutput = (ApplicationOutput) result;
- appOutputResourceIDs.add(applicationOutput.getInterfaceID());
- }
- }
- } else {
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported field name for App Output resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported field name for App Output 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 appOutputResourceIDs;
- }
-
- public void save() throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- ApplicationOutput existingApplicationOutput = em.find(ApplicationOutput.class,
- new AppOutput_PK(interfaceID, outputKey));
- em.close();
-
- ApplicationOutput applicationOutput;
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- if (existingApplicationOutput == null) {
- applicationOutput = new ApplicationOutput();
- } else {
- applicationOutput = existingApplicationOutput;
- }
- ApplicationInterface applicationInterface = em.find(ApplicationInterface.class, interfaceID);
- applicationOutput.setApplicationInterface(applicationInterface);
- applicationOutput.setInterfaceID(applicationInterface.getInterfaceID());
- applicationOutput.setDataType(dataType);
- applicationOutput.setOutputKey(outputKey);
- applicationOutput.setOutputVal(outputVal);
- applicationOutput.setRequired(isRequired);
- applicationOutput.setRequiredToCMD(requiredToCMD);
- applicationOutput.setDataMovement(dataMovement);
- applicationOutput.setDataNameLocation(dataNameLocation);
- applicationOutput.setSearchQuery(searchQuery);
- applicationOutput.setApplicationArgument(appArgument);
- em.merge(applicationOutput);
- 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();
- }
- }
- }
-
- 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();
- ApplicationOutput applicationOutput = em.find(ApplicationOutput.class, new AppOutput_PK(
- ids.get(AppOutputConstants.INTERFACE_ID),
- ids.get(AppOutputConstants.OUTPUT_KEY)));
-
- em.close();
- return applicationOutput != null;
- } 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();
- }
- }
- }
-
- public String getInterfaceID() {
- return interfaceID;
- }
-
- public void setInterfaceID(String interfaceID) {
- this.interfaceID = interfaceID;
- }
-
- public String getOutputKey() {
- return outputKey;
- }
-
- public void setOutputKey(String outputKey) {
- this.outputKey = outputKey;
- }
-
- public String getOutputVal() {
- return outputVal;
- }
-
- public void setOutputVal(String outputVal) {
- this.outputVal = outputVal;
- }
-
- public String getDataType() {
- return dataType;
- }
-
- public void setDataType(String dataType) {
- this.dataType = dataType;
- }
-
- public AppInterfaceResource getAppInterfaceResource() {
- return appInterfaceResource;
- }
-
- public void setAppInterfaceResource(AppInterfaceResource appInterfaceResource) {
- this.appInterfaceResource = appInterfaceResource;
- }
-
- public boolean getRequired() {
- return isRequired;
- }
-
- public void setRequired(boolean required) {
- this.isRequired = required;
- }
-
- public boolean isDataMovement() {
- return dataMovement;
- }
-
- public void setDataMovement(boolean dataMovement) {
- this.dataMovement = dataMovement;
- }
-
- public String getDataNameLocation() {
- return dataNameLocation;
- }
-
- public void setDataNameLocation(String dataNameLocation) {
- this.dataNameLocation = dataNameLocation;
- }
-
- public boolean getRequiredToCMD() {
- return requiredToCMD;
- }
-
- public void setRequiredToCMD(boolean requiredToCMD) {
- this.requiredToCMD = requiredToCMD;
- }
-
- public String getSearchQuery() {
- return searchQuery;
- }
-
- public void setSearchQuery(String searchQuery) {
- this.searchQuery = searchQuery;
- }
-
- public String getAppArgument() {
- return appArgument;
- }
-
- public void setAppArgument(String appArgument) {
- this.appArgument = appArgument;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/BatchQueueResource.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/BatchQueueResource.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/BatchQueueResource.java
deleted file mode 100644
index e7f5bff..0000000
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/BatchQueueResource.java
+++ /dev/null
@@ -1,357 +0,0 @@
-/*
- *
- * 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.aiaravata.application.catalog.data.resources;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.persistence.EntityManager;
-import javax.persistence.Query;
-
-import org.airavata.appcatalog.cpi.AppCatalogException;
-import org.apache.aiaravata.application.catalog.data.model.BatchQueue;
-import org.apache.aiaravata.application.catalog.data.model.BatchQueue_PK;
-import org.apache.aiaravata.application.catalog.data.model.ComputeResource;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogJPAUtils;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogQueryGenerator;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogResourceType;
-import org.apache.airavata.common.exception.ApplicationSettingsException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class BatchQueueResource extends AbstractResource {
- private final static Logger logger = LoggerFactory.getLogger(BatchQueueResource.class);
- private String computeResourceId;
- private ComputeResourceResource computeHostResource;
- private int maxRuntime;
- private int maxJobInQueue;
- private String queueDescription;
- private String queueName;
- private int maxProcessors;
- private int maxNodes;
- private int maxMemory;
-
- @Override
- public void remove(Object identifier) throws AppCatalogException {
- HashMap<String, String> ids;
- if (identifier instanceof Map) {
- ids = (HashMap<String, String>) 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(BATCH_QUEUE);
- generator.setParameter(BatchQueueConstants.COMPUTE_RESOURCE_ID, ids.get(BatchQueueConstants.COMPUTE_RESOURCE_ID));
- generator.setParameter(BatchQueueConstants.QUEUE_NAME, ids.get(BatchQueueConstants.QUEUE_NAME));
- 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 Resource get(Object identifier) throws AppCatalogException {
- HashMap<String, String> ids;
- if (identifier instanceof Map) {
- ids = (HashMap<String, String>) 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(BATCH_QUEUE);
- generator.setParameter(BatchQueueConstants.COMPUTE_RESOURCE_ID, ids.get(BatchQueueConstants.COMPUTE_RESOURCE_ID));
- generator.setParameter(BatchQueueConstants.QUEUE_NAME, ids.get(BatchQueueConstants.QUEUE_NAME));
- Query q = generator.selectQuery(em);
- BatchQueue batchQueue = (BatchQueue) q.getSingleResult();
- BatchQueueResource batchQueueResource = (BatchQueueResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.BATCH_QUEUE, batchQueue);
- em.getTransaction().commit();
- em.close();
- return batchQueueResource;
- } 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<Resource> get(String fieldName, Object value) throws AppCatalogException {
- List<Resource> batchQueueResources = new ArrayList<Resource>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(BATCH_QUEUE);
- Query q;
- if ((fieldName.equals(BatchQueueConstants.COMPUTE_RESOURCE_ID)) || (fieldName.equals(BatchQueueConstants.MAX_RUNTIME)) || (fieldName.equals(BatchQueueConstants.MAX_JOB_IN_QUEUE)) || (fieldName.equals(BatchQueueConstants.QUEUE_DESCRIPTION)) || (fieldName.equals(BatchQueueConstants.QUEUE_NAME)) || (fieldName.equals(BatchQueueConstants.MAX_PROCESSORS)) || (fieldName.equals(BatchQueueConstants.MAX_NODES))) {
- generator.setParameter(fieldName, value);
- q = generator.selectQuery(em);
- List<?> results = q.getResultList();
- for (Object result : results) {
- BatchQueue batchQueue = (BatchQueue) result;
- BatchQueueResource batchQueueResource = (BatchQueueResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.BATCH_QUEUE, batchQueue);
- batchQueueResources.add(batchQueueResource);
- }
- } else {
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported field name for Batch Queue Resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported field name for Batch Queue Resource.");
- }
- 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();
- }
- }
- return batchQueueResources;
- }
-
- @Override
- public List<Resource> 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 {
- List<String> batchQueueResourceIDs = new ArrayList<String>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(BATCH_QUEUE);
- Query q;
- if ((fieldName.equals(BatchQueueConstants.COMPUTE_RESOURCE_ID)) || (fieldName.equals(BatchQueueConstants.MAX_RUNTIME)) || (fieldName.equals(BatchQueueConstants.MAX_JOB_IN_QUEUE)) || (fieldName.equals(BatchQueueConstants.QUEUE_DESCRIPTION)) || (fieldName.equals(BatchQueueConstants.QUEUE_NAME)) || (fieldName.equals(BatchQueueConstants.MAX_PROCESSORS)) || (fieldName.equals(BatchQueueConstants.MAX_NODES))) {
- generator.setParameter(fieldName, value);
- q = generator.selectQuery(em);
- List<?> results = q.getResultList();
- for (Object result : results) {
- BatchQueue batchQueue = (BatchQueue) result;
- BatchQueueResource batchQueueResource = (BatchQueueResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.BATCH_QUEUE, batchQueue);
- batchQueueResourceIDs.add(batchQueueResource.getComputeResourceId());
- }
- } else {
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported field name for Batch Queue Resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported field name for Batch Queue Resource.");
- }
- 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();
- }
- }
- return batchQueueResourceIDs;
- }
-
- @Override
- public void save() throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- BatchQueue existingBatchQueue = em.find(BatchQueue.class, new BatchQueue_PK(computeResourceId, queueName));
- em.close();
- BatchQueue batchQueue;
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- if (existingBatchQueue == null) {
- batchQueue = new BatchQueue();
- } else {
- batchQueue = existingBatchQueue;
- }
- batchQueue.setComputeResourceId(getComputeResourceId());
- ComputeResource computeResource = em.find(ComputeResource.class, getComputeResourceId());
- batchQueue.setComputeResource(computeResource);
- batchQueue.setMaxRuntime(getMaxRuntime());
- batchQueue.setMaxJobInQueue(getMaxJobInQueue());
- batchQueue.setQueueDescription(getQueueDescription());
- batchQueue.setQueueName(getQueueName());
- batchQueue.setMaxProcessors(getMaxProcessors());
- batchQueue.setMaxNodes(getMaxNodes());
- batchQueue.setMaxMemory(getMaxMemory());
- if (existingBatchQueue == null) {
- em.persist(batchQueue);
- } else {
- em.merge(batchQueue);
- }
- 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<String, String>) 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();
- BatchQueue batchQueue = em.find(BatchQueue.class, new BatchQueue_PK(ids.get(BatchQueueConstants.COMPUTE_RESOURCE_ID), ids.get(BatchQueueConstants.QUEUE_NAME)));
- em.close();
- return batchQueue != null;
- } 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();
- }
- }
- }
-
- public String getComputeResourceId() {
- return computeResourceId;
- }
-
- public ComputeResourceResource getComputeHostResource() {
- return computeHostResource;
- }
-
- public int getMaxRuntime() {
- return maxRuntime;
- }
-
- public int getMaxJobInQueue() {
- return maxJobInQueue;
- }
-
- public String getQueueDescription() {
- return queueDescription;
- }
-
- public String getQueueName() {
- return queueName;
- }
-
- public int getMaxProcessors() {
- return maxProcessors;
- }
-
- public int getMaxNodes() {
- return maxNodes;
- }
-
- public void setComputeResourceId(String computeResourceId) {
- this.computeResourceId=computeResourceId;
- }
-
- public void setComputeHostResource(ComputeResourceResource computeHostResource) {
- this.computeHostResource=computeHostResource;
- }
-
- public void setMaxRuntime(int maxRuntime) {
- this.maxRuntime=maxRuntime;
- }
-
- public void setMaxJobInQueue(int maxJobInQueue) {
- this.maxJobInQueue=maxJobInQueue;
- }
-
- public void setQueueDescription(String queueDescription) {
- this.queueDescription=queueDescription;
- }
-
- public void setQueueName(String queueName) {
- this.queueName=queueName;
- }
-
- public void setMaxProcessors(int maxProcessors) {
- this.maxProcessors=maxProcessors;
- }
-
- public void setMaxNodes(int maxNodes) {
- this.maxNodes=maxNodes;
- }
-
- public int getMaxMemory() {
- return maxMemory;
- }
-
- public void setMaxMemory(int maxMemory) {
- this.maxMemory = maxMemory;
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/CloudSubmissionResource.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/CloudSubmissionResource.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/CloudSubmissionResource.java
deleted file mode 100644
index 4f261f1..0000000
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/CloudSubmissionResource.java
+++ /dev/null
@@ -1,299 +0,0 @@
-/*
- *
- * 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.aiaravata.application.catalog.data.resources;
-
-import org.airavata.appcatalog.cpi.AppCatalogException;
-import org.apache.aiaravata.application.catalog.data.model.CloudJobSubmission;
-import org.apache.aiaravata.application.catalog.data.model.ResourceJobManager;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogJPAUtils;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogQueryGenerator;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogResourceType;
-import org.apache.airavata.common.exception.ApplicationSettingsException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.persistence.EntityManager;
-import javax.persistence.Query;
-import java.util.ArrayList;
-import java.util.List;
-
-public class CloudSubmissionResource extends AbstractResource {
- private final static Logger logger = LoggerFactory.getLogger(LocalSubmissionResource.class);
- private String jobSubmissionInterfaceId;
- private String securityProtocol;
- private String nodeId;
- private String executableType;
- private String providerName;
- private String userAccountName;
-
- @Override
- public void remove(Object identifier) throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(CLOUD_JOB_SUBMISSION);
- generator.setParameter(LocalSubmissionConstants.JOB_SUBMISSION_INTERFACE_ID, identifier);
- 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 Resource get(Object identifier) throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(CLOUD_JOB_SUBMISSION);
- generator.setParameter(LocalSubmissionConstants.JOB_SUBMISSION_INTERFACE_ID, identifier);
- Query q = generator.selectQuery(em);
- CloudJobSubmission cloudJobSubmission = (CloudJobSubmission) q.getSingleResult();
- CloudSubmissionResource localSubmissionResource = (CloudSubmissionResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.ClOUD_SUBMISSION, cloudJobSubmission);
- em.getTransaction().commit();
- em.close();
- return localSubmissionResource;
- } 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<Resource> get(String fieldName, Object value) throws AppCatalogException {
- List<Resource> localSubmissionResources = new ArrayList<Resource>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(CLOUD_JOB_SUBMISSION);
- Query q;
- if ((fieldName.equals(LocalSubmissionConstants.RESOURCE_JOB_MANAGER_ID)) || (fieldName.equals(LocalSubmissionConstants.JOB_SUBMISSION_INTERFACE_ID))) {
- generator.setParameter(fieldName, value);
- q = generator.selectQuery(em);
- List<?> results = q.getResultList();
- for (Object result : results) {
- CloudJobSubmission localSubmission = (CloudJobSubmission) result;
- CloudSubmissionResource localSubmissionResource = (CloudSubmissionResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.ClOUD_SUBMISSION, localSubmission);
- localSubmissionResources.add(localSubmissionResource);
- }
- } else {
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported field name for Local Submission Resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported field name for Local Submission Resource.");
- }
- 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();
- }
- }
- return localSubmissionResources;
- }
-
- @Override
- public List<Resource> 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 {
- List<String> localSubmissionResourceIDs = new ArrayList<String>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(CLOUD_JOB_SUBMISSION);
- Query q;
- if ((fieldName.equals(LocalSubmissionConstants.RESOURCE_JOB_MANAGER_ID)) || (fieldName.equals(LocalSubmissionConstants.JOB_SUBMISSION_INTERFACE_ID))) {
- generator.setParameter(fieldName, value);
- q = generator.selectQuery(em);
- List<?> results = q.getResultList();
- for (Object result : results) {
- CloudJobSubmission localSubmission = (CloudJobSubmission) result;
- LocalSubmissionResource localSubmissionResource = (LocalSubmissionResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.ClOUD_SUBMISSION, localSubmission);
- localSubmissionResourceIDs.add(localSubmissionResource.getJobSubmissionInterfaceId());
- }
- } else {
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported field name for Local Submission Resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported field name for Local Submission Resource.");
- }
- 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();
- }
- }
- return localSubmissionResourceIDs;
- }
-
- @Override
- public void save() throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- CloudJobSubmission existingLocalSubmission = em.find(CloudJobSubmission.class, jobSubmissionInterfaceId);
- em.close();
- CloudJobSubmission cloudJobSubmission;
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- if (existingLocalSubmission == null) {
- cloudJobSubmission = new CloudJobSubmission();
- } else {
- cloudJobSubmission = existingLocalSubmission;
- }
- cloudJobSubmission.setExecutableType(getExecutableType());
- cloudJobSubmission.setNodeId(getNodeId());
- cloudJobSubmission.setJobSubmissionInterfaceId(getJobSubmissionInterfaceId());
- cloudJobSubmission.setSecurityProtocol(getSecurityProtocol());
- cloudJobSubmission.setJobSubmissionInterfaceId(getJobSubmissionInterfaceId());
- cloudJobSubmission.setUserAccountName(getUserAccountName());
- cloudJobSubmission.setProviderName(getProviderName());
- if (existingLocalSubmission == null) {
- em.persist(cloudJobSubmission);
- } else {
- em.merge(cloudJobSubmission);
- }
- 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 {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- CloudJobSubmission localSubmission = em.find(CloudJobSubmission.class, identifier);
- em.close();
- return localSubmission != null;
- } 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();
- }
- }
- }
-
- public String getJobSubmissionInterfaceId() {
- return jobSubmissionInterfaceId;
- }
-
- public String getSecurityProtocol() {
- return securityProtocol;
- }
-
- public void setSecurityProtocol(String securityProtocol) {
- this.securityProtocol = securityProtocol;
- }
-
- public String getNodeId() {
- return nodeId;
- }
-
- public void setNodeId(String nodeId) {
- this.nodeId = nodeId;
- }
-
- public String getExecutableType() {
- return executableType;
- }
-
- public void setExecutableType(String executableType) {
- this.executableType = executableType;
- }
-
- public String getProviderName() {
- return providerName;
- }
-
- public void setProviderName(String providerName) {
- this.providerName = providerName;
- }
-
- public String getUserAccountName() {
- return userAccountName;
- }
-
- public void setUserAccountName(String userAccountName) {
- this.userAccountName = userAccountName;
- }
-
- public void setJobSubmissionInterfaceId(String jobSubmissionInterfaceId) {
- this.jobSubmissionInterfaceId=jobSubmissionInterfaceId;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/ComputeHostPreferenceResource.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/ComputeHostPreferenceResource.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/ComputeHostPreferenceResource.java
deleted file mode 100644
index 51f22d5..0000000
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/ComputeHostPreferenceResource.java
+++ /dev/null
@@ -1,413 +0,0 @@
-/*
- *
- * 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.aiaravata.application.catalog.data.resources;
-
-import org.airavata.appcatalog.cpi.AppCatalogException;
-import org.apache.aiaravata.application.catalog.data.model.ComputeResource;
-import org.apache.aiaravata.application.catalog.data.model.ComputeResourcePreference;
-import org.apache.aiaravata.application.catalog.data.model.ComputeResourcePreferencePK;
-import org.apache.aiaravata.application.catalog.data.model.GatewayProfile;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogJPAUtils;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogQueryGenerator;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogResourceType;
-import org.apache.airavata.common.exception.ApplicationSettingsException;
-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 ComputeHostPreferenceResource extends AbstractResource {
- private final static Logger logger = LoggerFactory.getLogger(ComputeHostPreferenceResource.class);
- private String gatewayId;
- private String resourceId;
- private boolean overrideByAiravata;
- private String preferredJobProtocol;
- private String preferedDMProtocol;
- private String batchQueue;
- private String scratchLocation;
- private String projectNumber;
- private String loginUserName;
-
- private GatewayProfileResource gatewayProfile;
- private ComputeResourceResource computeHostResource;
-
- 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 String getResourceId() {
- return resourceId;
- }
-
- public void setResourceId(String resourceId) {
- this.resourceId = resourceId;
- }
-
- public boolean getOverrideByAiravata() {
- return overrideByAiravata;
- }
-
- public void setOverrideByAiravata(boolean overrideByAiravata) {
- this.overrideByAiravata = overrideByAiravata;
- }
-
- public String getPreferredJobProtocol() {
- return preferredJobProtocol;
- }
-
- public void setPreferredJobProtocol(String preferredJobProtocol) {
- this.preferredJobProtocol = preferredJobProtocol;
- }
-
- public String getPreferedDMProtocol() {
- return preferedDMProtocol;
- }
-
- public void setPreferedDMProtocol(String preferedDMProtocol) {
- this.preferedDMProtocol = preferedDMProtocol;
- }
-
- public String getBatchQueue() {
- return batchQueue;
- }
-
- public void setBatchQueue(String batchQueue) {
- this.batchQueue = batchQueue;
- }
-
- public String getScratchLocation() {
- return scratchLocation;
- }
-
- public void setScratchLocation(String scratchLocation) {
- this.scratchLocation = scratchLocation;
- }
-
- public String getProjectNumber() {
- return projectNumber;
- }
-
- public void setProjectNumber(String projectNumber) {
- this.projectNumber = projectNumber;
- }
-
- public GatewayProfileResource getGatewayProfile() {
- return gatewayProfile;
- }
-
- public void setGatewayProfile(GatewayProfileResource gatewayProfile) {
- this.gatewayProfile = gatewayProfile;
- }
-
- public ComputeResourceResource getComputeHostResource() {
- return computeHostResource;
- }
-
- public void setComputeHostResource(ComputeResourceResource computeHostResource) {
- this.computeHostResource = computeHostResource;
- }
-
- @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(COMPUTE_RESOURCE_PREFERENCE);
- generator.setParameter(ComputeResourcePreferenceConstants.RESOURCE_ID, ids.get(ComputeResourcePreferenceConstants.RESOURCE_ID));
- generator.setParameter(ComputeResourcePreferenceConstants.GATEWAY_ID, ids.get(ComputeResourcePreferenceConstants.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 Resource 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(COMPUTE_RESOURCE_PREFERENCE);
- generator.setParameter(ComputeResourcePreferenceConstants.GATEWAY_ID, ids.get(ComputeResourcePreferenceConstants.GATEWAY_ID));
- generator.setParameter(ComputeResourcePreferenceConstants.RESOURCE_ID, ids.get(ComputeResourcePreferenceConstants.RESOURCE_ID));
- Query q = generator.selectQuery(em);
- ComputeResourcePreference preference = (ComputeResourcePreference) q.getSingleResult();
- ComputeHostPreferenceResource preferenceResource =
- (ComputeHostPreferenceResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.COMPUTE_RESOURCE_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<Resource> get(String fieldName, Object value) throws AppCatalogException {
- List<Resource> preferenceResourceList = new ArrayList<Resource>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- Query q;
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(COMPUTE_RESOURCE_PREFERENCE);
- List results;
- if (fieldName.equals(ComputeResourcePreferenceConstants.RESOURCE_ID)) {
- generator.setParameter(ComputeResourcePreferenceConstants.RESOURCE_ID, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- ComputeResourcePreference preference = (ComputeResourcePreference) result;
- if (preference.getComputeHostResource()!=null) {
- ComputeHostPreferenceResource preferenceResource = (ComputeHostPreferenceResource) AppCatalogJPAUtils
- .getResource(
- AppCatalogResourceType.COMPUTE_RESOURCE_PREFERENCE,
- preference);
- preferenceResourceList.add(preferenceResource);
- }
- }
- }
- } else if (fieldName.equals(ComputeResourcePreferenceConstants.GATEWAY_ID)) {
- generator.setParameter(ComputeResourcePreferenceConstants.GATEWAY_ID, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- ComputeResourcePreference preference = (ComputeResourcePreference) result;
- if (preference.getComputeHostResource()!=null) {
- ComputeHostPreferenceResource preferenceResource =
- (ComputeHostPreferenceResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.COMPUTE_RESOURCE_PREFERENCE, preference);
- preferenceResourceList.add(preferenceResource);
- }
- }
- }
- } else if (fieldName.equals(ComputeResourcePreferenceConstants.PREFERED_JOB_SUB_PROTOCOL)) {
- generator.setParameter(ComputeResourcePreferenceConstants.PREFERED_JOB_SUB_PROTOCOL, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- ComputeResourcePreference preference = (ComputeResourcePreference) result;
- if (preference.getComputeHostResource()!=null) {
- ComputeHostPreferenceResource preferenceResource = (ComputeHostPreferenceResource) AppCatalogJPAUtils
- .getResource(
- AppCatalogResourceType.COMPUTE_RESOURCE_PREFERENCE,
- preference);
- preferenceResourceList.add(preferenceResource);
- }
- }
- }
- } else if (fieldName.equals(ComputeResourcePreferenceConstants.PREFERED_DATA_MOVE_PROTOCOL)) {
- generator.setParameter(ComputeResourcePreferenceConstants.PREFERED_DATA_MOVE_PROTOCOL, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- ComputeResourcePreference preference = (ComputeResourcePreference) result;
- if (preference.getResourceId()!=null) {
- ComputeHostPreferenceResource preferenceResource = (ComputeHostPreferenceResource) AppCatalogJPAUtils
- .getResource(
- AppCatalogResourceType.COMPUTE_RESOURCE_PREFERENCE,
- preference);
- preferenceResourceList.add(preferenceResource);
- }
- }
- }
- } else {
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported field name for Compute host preference Resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported field name for Compute host 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<Resource> 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();
- ComputeResourcePreference existingPreference = em.find(ComputeResourcePreference.class, new ComputeResourcePreferencePK(gatewayId, resourceId));
- em.close();
-
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- ComputeResource computeResource = em.find(ComputeResource.class, resourceId);
- GatewayProfile gatewayProf = em.find(GatewayProfile.class, gatewayId);
- if (existingPreference != null) {
- existingPreference.setResourceId(resourceId);
- existingPreference.setGatewayId(gatewayId);
- existingPreference.setComputeHostResource(computeResource);
- existingPreference.setGatewayProfile(gatewayProf);
- existingPreference.setOverrideByAiravata(overrideByAiravata);
- existingPreference.setPreferedJobSubmissionProtocol(preferredJobProtocol);
- existingPreference.setPreferedDataMoveProtocol(preferedDMProtocol);
- existingPreference.setScratchLocation(scratchLocation);
- existingPreference.setProjectNumber(projectNumber);
- existingPreference.setBatchQueue(batchQueue);
- existingPreference.setLoginUserName(loginUserName);
- em.merge(existingPreference);
- } else {
- ComputeResourcePreference resourcePreference = new ComputeResourcePreference();
- resourcePreference.setResourceId(resourceId);
- resourcePreference.setGatewayId(gatewayId);
- resourcePreference.setComputeHostResource(computeResource);
- resourcePreference.setGatewayProfile(gatewayProf);
- resourcePreference.setOverrideByAiravata(overrideByAiravata);
- resourcePreference.setPreferedJobSubmissionProtocol(preferredJobProtocol);
- resourcePreference.setPreferedDataMoveProtocol(preferedDMProtocol);
- resourcePreference.setScratchLocation(scratchLocation);
- resourcePreference.setProjectNumber(projectNumber);
- resourcePreference.setBatchQueue(batchQueue);
- resourcePreference.setLoginUserName(loginUserName);
- 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();
- ComputeResourcePreference existingPreference = em.find(ComputeResourcePreference.class,
- new ComputeResourcePreferencePK(ids.get(ComputeResourcePreferenceConstants.GATEWAY_ID),
- ids.get(ComputeResourcePreferenceConstants.RESOURCE_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/ec8c6202/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/ComputeResourceFileSystemResource.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/ComputeResourceFileSystemResource.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/ComputeResourceFileSystemResource.java
deleted file mode 100644
index 7cbaac2..0000000
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/ComputeResourceFileSystemResource.java
+++ /dev/null
@@ -1,307 +0,0 @@
-/*
- *
- * 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.aiaravata.application.catalog.data.resources;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.persistence.EntityManager;
-import javax.persistence.Query;
-
-import org.airavata.appcatalog.cpi.AppCatalogException;
-import org.apache.aiaravata.application.catalog.data.model.ComputeResource;
-import org.apache.aiaravata.application.catalog.data.model.ComputeResourceFileSystem;
-import org.apache.aiaravata.application.catalog.data.model.ComputeResourceFileSystem_PK;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogJPAUtils;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogQueryGenerator;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogResourceType;
-import org.apache.airavata.common.exception.ApplicationSettingsException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class ComputeResourceFileSystemResource extends AbstractResource {
- private final static Logger logger = LoggerFactory.getLogger(ComputeResourceFileSystemResource.class);
- private String computeResourceId;
- private ComputeResourceResource computeHostResource;
- private String path;
- private String fileSystem;
-
- @Override
- public void remove(Object identifier) throws AppCatalogException {
- HashMap<String, String> ids;
- if (identifier instanceof Map) {
- ids = (HashMap<String, String>) 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(COMPUTE_RESOURCE_FILE_SYSTEM);
- generator.setParameter(ComputeResourceFileSystemConstants.COMPUTE_RESOURCE_ID, ids.get(ComputeResourceFileSystemConstants.COMPUTE_RESOURCE_ID));
- generator.setParameter(ComputeResourceFileSystemConstants.FILE_SYSTEM, ids.get(ComputeResourceFileSystemConstants.FILE_SYSTEM));
- 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 Resource get(Object identifier) throws AppCatalogException {
- HashMap<String, String> ids;
- if (identifier instanceof Map) {
- ids = (HashMap<String, String>) 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(COMPUTE_RESOURCE_FILE_SYSTEM);
- generator.setParameter(ComputeResourceFileSystemConstants.COMPUTE_RESOURCE_ID, ids.get(ComputeResourceFileSystemConstants.COMPUTE_RESOURCE_ID));
- generator.setParameter(ComputeResourceFileSystemConstants.FILE_SYSTEM, ids.get(ComputeResourceFileSystemConstants.FILE_SYSTEM));
- Query q = generator.selectQuery(em);
- ComputeResourceFileSystem computeResourceFileSystem = (ComputeResourceFileSystem) q.getSingleResult();
- ComputeResourceFileSystemResource computeResourceFileSystemResource = (ComputeResourceFileSystemResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.COMPUTE_RESOURCE_FILE_SYSTEM, computeResourceFileSystem);
- em.getTransaction().commit();
- em.close();
- return computeResourceFileSystemResource;
- } 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<Resource> get(String fieldName, Object value) throws AppCatalogException {
- List<Resource> computeResourceFileSystemResources = new ArrayList<Resource>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(COMPUTE_RESOURCE_FILE_SYSTEM);
- Query q;
- if ((fieldName.equals(ComputeResourceFileSystemConstants.COMPUTE_RESOURCE_ID)) || (fieldName.equals(ComputeResourceFileSystemConstants.PATH)) || (fieldName.equals(ComputeResourceFileSystemConstants.FILE_SYSTEM))) {
- generator.setParameter(fieldName, value);
- q = generator.selectQuery(em);
- List<?> results = q.getResultList();
- for (Object result : results) {
- ComputeResourceFileSystem computeResourceFileSystem = (ComputeResourceFileSystem) result;
- ComputeResourceFileSystemResource computeResourceFileSystemResource = (ComputeResourceFileSystemResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.COMPUTE_RESOURCE_FILE_SYSTEM, computeResourceFileSystem);
- computeResourceFileSystemResources.add(computeResourceFileSystemResource);
- }
- } else {
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported field name for Compute Resource File System Resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported field name for Compute Resource File System Resource.");
- }
- 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();
- }
- }
- return computeResourceFileSystemResources;
- }
-
- @Override
- public List<Resource> 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 {
- List<String> computeResourceFileSystemResourceIDs = new ArrayList<String>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(COMPUTE_RESOURCE_FILE_SYSTEM);
- Query q;
- if ((fieldName.equals(ComputeResourceFileSystemConstants.COMPUTE_RESOURCE_ID)) || (fieldName.equals(ComputeResourceFileSystemConstants.PATH)) || (fieldName.equals(ComputeResourceFileSystemConstants.FILE_SYSTEM))) {
- generator.setParameter(fieldName, value);
- q = generator.selectQuery(em);
- List<?> results = q.getResultList();
- for (Object result : results) {
- ComputeResourceFileSystem computeResourceFileSystem = (ComputeResourceFileSystem) result;
- ComputeResourceFileSystemResource computeResourceFileSystemResource = (ComputeResourceFileSystemResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.COMPUTE_RESOURCE_FILE_SYSTEM, computeResourceFileSystem);
- computeResourceFileSystemResourceIDs.add(computeResourceFileSystemResource.getComputeResourceId());
- }
- } else {
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported field name for Compute Resource File System Resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported field name for Compute Resource File System Resource.");
- }
- 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();
- }
- }
- return computeResourceFileSystemResourceIDs;
- }
-
- @Override
- public void save() throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- ComputeResourceFileSystem existingComputeResourceFileSystem = em.find(ComputeResourceFileSystem.class, new ComputeResourceFileSystem_PK(computeResourceId, fileSystem));
- em.close();
- ComputeResourceFileSystem computeResourceFileSystem;
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- if (existingComputeResourceFileSystem == null) {
- computeResourceFileSystem = new ComputeResourceFileSystem();
- } else {
- computeResourceFileSystem = existingComputeResourceFileSystem;
- }
- computeResourceFileSystem.setComputeResourceId(getComputeResourceId());
- ComputeResource computeResource = em.find(ComputeResource.class, getComputeResourceId());
- computeResourceFileSystem.setComputeResource(computeResource);
- computeResourceFileSystem.setPath(getPath());
- computeResourceFileSystem.setFileSystem(getFileSystem());
- if (existingComputeResourceFileSystem == null) {
- em.persist(computeResourceFileSystem);
- } else {
- em.merge(computeResourceFileSystem);
- }
- 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<String, String>) 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();
- ComputeResourceFileSystem computeResourceFileSystem = em.find(ComputeResourceFileSystem.class, new ComputeResourceFileSystem_PK(ids.get(ComputeResourceFileSystemConstants.COMPUTE_RESOURCE_ID), ids.get(ComputeResourceFileSystemConstants.FILE_SYSTEM)));
- em.close();
- return computeResourceFileSystem != null;
- } 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();
- }
- }
- }
-
- public String getComputeResourceId() {
- return computeResourceId;
- }
-
- public ComputeResourceResource getComputeHostResource() {
- return computeHostResource;
- }
-
- public String getPath() {
- return path;
- }
-
- public String getFileSystem() {
- return fileSystem;
- }
-
- public void setComputeResourceId(String computeResourceId) {
- this.computeResourceId=computeResourceId;
- }
-
- public void setComputeHostResource(ComputeResourceResource computeHostResource) {
- this.computeHostResource=computeHostResource;
- }
-
- public void setPath(String path) {
- this.path=path;
- }
-
- public void setFileSystem(String fileSystem) {
- this.fileSystem=fileSystem;
- }
-}
[19/52] [abbrv] [partial] airavata git commit: registry refactoring
Posted by sh...@apache.org.
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/GlobusJobSubmission.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/GlobusJobSubmission.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/GlobusJobSubmission.java
new file mode 100644
index 0000000..1286721
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/GlobusJobSubmission.java
@@ -0,0 +1,62 @@
+/*
+ *
+ * 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.*;
+import java.io.Serializable;
+
+@Entity
+@Table(name = "GLOBUS_SUBMISSION")
+public class GlobusJobSubmission implements Serializable {
+ @Id
+ @Column(name = "SUBMISSION_ID")
+ private String submissionID;
+ @Column(name = "RESOURCE_JOB_MANAGER")
+ private String resourceJobManager;
+ @Column(name = "SECURITY_PROTOCAL")
+ private String securityProtocol;
+
+ public String getSubmissionID() {
+ return submissionID;
+ }
+
+ public void setSubmissionID(String submissionID) {
+ this.submissionID = submissionID;
+ }
+
+ public String getResourceJobManager() {
+ return resourceJobManager;
+ }
+
+ public void setResourceJobManager(String resourceJobManager) {
+ this.resourceJobManager = resourceJobManager;
+ }
+
+ public String getSecurityProtocol() {
+ return securityProtocol;
+ }
+
+ public void setSecurityProtocol(String securityProtocol) {
+ this.securityProtocol = securityProtocol;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/GridftpDataMovement.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/GridftpDataMovement.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/GridftpDataMovement.java
new file mode 100644
index 0000000..91f0cd1
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/GridftpDataMovement.java
@@ -0,0 +1,83 @@
+/*
+ *
+ * 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;
+import java.sql.Timestamp;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+import org.apache.openjpa.persistence.DataCache;
+
+@DataCache
+@Entity
+@Table(name = "GRIDFTP_DATA_MOVEMENT")
+public class GridftpDataMovement implements Serializable {
+
+ @Id
+ @Column(name = "DATA_MOVEMENT_INTERFACE_ID")
+ private String dataMovementInterfaceId;
+
+ @Column(name = "SECURITY_PROTOCOL")
+ private String securityProtocol;
+
+ @Column(name = "CREATION_TIME")
+ private Timestamp creationTime;
+
+ @Column(name = "UPDATE_TIME")
+ private Timestamp updateTime;
+
+ public Timestamp getCreationTime() {
+ return creationTime;
+ }
+
+ public void setCreationTime(Timestamp creationTime) {
+ this.creationTime = creationTime;
+ }
+
+ public Timestamp getUpdateTime() {
+ return updateTime;
+ }
+
+ public void setUpdateTime(Timestamp updateTime) {
+ this.updateTime = updateTime;
+ }
+
+ public String getDataMovementInterfaceId() {
+ return dataMovementInterfaceId;
+ }
+
+ public String getSecurityProtocol() {
+ return securityProtocol;
+ }
+
+ public void setDataMovementInterfaceId(String dataMovementInterfaceId) {
+ this.dataMovementInterfaceId=dataMovementInterfaceId;
+ }
+
+ public void setSecurityProtocol(String securityProtocol) {
+ this.securityProtocol=securityProtocol;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/GridftpEndpoint.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/GridftpEndpoint.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/GridftpEndpoint.java
new file mode 100644
index 0000000..71e2379
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/GridftpEndpoint.java
@@ -0,0 +1,102 @@
+/*
+ *
+ * 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;
+import java.sql.Timestamp;
+
+import javax.persistence.CascadeType;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.IdClass;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
+import javax.persistence.Table;
+
+import org.apache.openjpa.persistence.DataCache;
+
+@DataCache
+@Entity
+@Table(name = "GRIDFTP_ENDPOINT")
+@IdClass(GridftpEndpoint_PK.class)
+public class GridftpEndpoint implements Serializable {
+
+ @Id
+ @Column(name = "ENDPOINT")
+ private String endpoint;
+
+ @Id
+ @Column(name = "DATA_MOVEMENT_INTERFACE_ID")
+ private String dataMovementInterfaceId;
+
+ @ManyToOne(cascade= CascadeType.MERGE)
+ @JoinColumn(name = "DATA_MOVEMENT_INTERFACE_ID")
+ private GridftpDataMovement gridftpDataMovement;
+
+ @Column(name = "CREATION_TIME")
+ private Timestamp creationTime;
+
+ @Column(name = "UPDATE_TIME")
+ private Timestamp updateTime;
+
+ public Timestamp getCreationTime() {
+ return creationTime;
+ }
+
+ public void setCreationTime(Timestamp creationTime) {
+ this.creationTime = creationTime;
+ }
+
+ public Timestamp getUpdateTime() {
+ return updateTime;
+ }
+
+ public void setUpdateTime(Timestamp updateTime) {
+ this.updateTime = updateTime;
+ }
+
+
+ public String getEndpoint() {
+ return endpoint;
+ }
+
+ public String getDataMovementInterfaceId() {
+ return dataMovementInterfaceId;
+ }
+
+ public GridftpDataMovement getGridftpDataMovement() {
+ return gridftpDataMovement;
+ }
+
+ public void setEndpoint(String endpoint) {
+ this.endpoint=endpoint;
+ }
+
+ public void setDataMovementInterfaceId(String dataMovementInterfaceId) {
+ this.dataMovementInterfaceId=dataMovementInterfaceId;
+ }
+
+ public void setGridftpDataMovement(GridftpDataMovement gridftpDataMovement) {
+ this.gridftpDataMovement=gridftpDataMovement;
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/GridftpEndpoint_PK.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/GridftpEndpoint_PK.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/GridftpEndpoint_PK.java
new file mode 100644
index 0000000..647d881
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/GridftpEndpoint_PK.java
@@ -0,0 +1,62 @@
+/*
+ *
+ * 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 GridftpEndpoint_PK implements Serializable {
+ private String endpoint;
+ private String dataMovementInterfaceId;
+ public GridftpEndpoint_PK(String endpoint, String dataMovementInterfaceId){
+ this.endpoint = endpoint;
+ this.dataMovementInterfaceId = dataMovementInterfaceId;
+ }
+
+ public GridftpEndpoint_PK() {
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ return false;
+ }
+
+ @Override
+ public int hashCode() {
+ return 1;
+ }
+
+ public String getEndpoint() {
+ return endpoint;
+ }
+
+ public String getDataMovementInterfaceId() {
+ return dataMovementInterfaceId;
+ }
+
+ public void setEndpoint(String endpoint) {
+ this.endpoint=endpoint;
+ }
+
+ public void setDataMovementInterfaceId(String dataMovementInterfaceId) {
+ this.dataMovementInterfaceId=dataMovementInterfaceId;
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/HostAlias.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/HostAlias.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/HostAlias.java
new file mode 100644
index 0000000..804767c
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/HostAlias.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 javax.persistence.*;
+import java.io.Serializable;
+
+@Entity
+@Table(name = "HOST_ALIAS")
+@IdClass(HostAliasPK.class)
+public class HostAlias implements Serializable {
+ @Id
+ @Column(name = "RESOURCE_ID")
+ private String resourceID;
+ @Id
+ @Column(name = "ALIAS")
+ private String alias;
+
+ @ManyToOne(cascade= CascadeType.MERGE)
+ @JoinColumn(name = "RESOURCE_ID")
+ private ComputeResource computeResource;
+
+ public String getResourceID() {
+ return resourceID;
+ }
+
+ public void setResourceID(String resourceID) {
+ this.resourceID = resourceID;
+ }
+
+ public String getAlias() {
+ return alias;
+ }
+
+ public void setAlias(String alias) {
+ this.alias = alias;
+ }
+
+ public ComputeResource getComputeResource() {
+ return computeResource;
+ }
+
+ public void setComputeResource(ComputeResource computeResource) {
+ this.computeResource = computeResource;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/HostAliasPK.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/HostAliasPK.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/HostAliasPK.java
new file mode 100644
index 0000000..5ee80ad
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/HostAliasPK.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 HostAliasPK implements Serializable {
+ private String resourceID;
+ private String alias;
+
+ public HostAliasPK(String resourceID, String alias) {
+ this.resourceID = resourceID;
+ this.alias = alias;
+ }
+
+ public HostAliasPK() {
+ ;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ return false;
+ }
+
+ @Override
+ public int hashCode() {
+ return 1;
+ }
+
+ public String getResourceID() {
+ return resourceID;
+ }
+
+ public void setResourceID(String resourceID) {
+ this.resourceID = resourceID;
+ }
+
+ public String getAlias() {
+ return alias;
+ }
+
+ public void setAlias(String alias) {
+ this.alias = alias;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/HostIPAddress.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/HostIPAddress.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/HostIPAddress.java
new file mode 100644
index 0000000..afe319d
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/HostIPAddress.java
@@ -0,0 +1,65 @@
+/*
+ *
+ * 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.*;
+import java.io.Serializable;
+
+@Entity
+@Table(name = "HOST_IPADDRESS")
+@IdClass(HostIPAddressPK.class)
+public class HostIPAddress implements Serializable {
+ @Id
+ @Column(name = "RESOURCE_ID")
+ private String resourceID;
+ @Id
+ @Column(name = "IP_ADDRESS")
+ private String ipaddress;
+
+ @ManyToOne(cascade= CascadeType.MERGE)
+ @JoinColumn(name = "RESOURCE_ID")
+ private ComputeResource computeResource;
+
+ public String getResourceID() {
+ return resourceID;
+ }
+
+ public void setResourceID(String resourceID) {
+ this.resourceID = resourceID;
+ }
+
+ public String getIpaddress() {
+ return ipaddress;
+ }
+
+ public void setIpaddress(String ipaddress) {
+ this.ipaddress = ipaddress;
+ }
+
+ public ComputeResource getComputeResource() {
+ return computeResource;
+ }
+
+ public void setComputeResource(ComputeResource computeResource) {
+ this.computeResource = computeResource;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/HostIPAddressPK.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/HostIPAddressPK.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/HostIPAddressPK.java
new file mode 100644
index 0000000..5c82be7
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/HostIPAddressPK.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 HostIPAddressPK implements Serializable {
+ private String resourceID;
+ private String ipaddress;
+
+ public HostIPAddressPK(String resourceID, String ipaddress) {
+ this.resourceID = resourceID;
+ this.ipaddress = ipaddress;
+ }
+
+ public HostIPAddressPK() {
+ ;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ return false;
+ }
+
+ @Override
+ public int hashCode() {
+ return 1;
+ }
+
+ public String getResourceID() {
+ return resourceID;
+ }
+
+ public void setResourceID(String resourceID) {
+ this.resourceID = resourceID;
+ }
+
+ public String getIpaddress() {
+ return ipaddress;
+ }
+
+ public void setIpaddress(String ipaddress) {
+ this.ipaddress = ipaddress;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/JobManagerCommand.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/JobManagerCommand.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/JobManagerCommand.java
new file mode 100644
index 0000000..a65e5e3
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/JobManagerCommand.java
@@ -0,0 +1,89 @@
+/*
+ *
+ * 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;
+
+import javax.persistence.CascadeType;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.IdClass;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
+import javax.persistence.Table;
+
+import org.apache.openjpa.persistence.DataCache;
+
+@DataCache
+@Entity
+@Table(name = "JOB_MANAGER_COMMAND")
+@IdClass(JobManagerCommand_PK.class)
+public class JobManagerCommand implements Serializable {
+
+ @Id
+ @Column(name = "RESOURCE_JOB_MANAGER_ID")
+ private String resourceJobManagerId;
+
+ @ManyToOne(cascade= CascadeType.MERGE)
+ @JoinColumn(name = "RESOURCE_JOB_MANAGER_ID")
+ private ResourceJobManager resourceJobManager;
+
+ @Id
+ @Column(name = "COMMAND_TYPE")
+ private String commandType;
+
+ @Column(name = "COMMAND")
+ private String command;
+
+ public String getResourceJobManagerId() {
+ return resourceJobManagerId;
+ }
+
+ public ResourceJobManager getResourceJobManager() {
+ return resourceJobManager;
+ }
+
+ public String getCommandType() {
+ return commandType;
+ }
+
+ public String getCommand() {
+ return command;
+ }
+
+ public void setResourceJobManagerId(String resourceJobManagerId) {
+ this.resourceJobManagerId=resourceJobManagerId;
+ }
+
+ public void setResourceJobManager(ResourceJobManager resourceJobManager) {
+ this.resourceJobManager=resourceJobManager;
+ }
+
+ public void setCommandType(String commandType) {
+ this.commandType=commandType;
+ }
+
+ public void setCommand(String command) {
+ this.command=command;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/JobManagerCommand_PK.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/JobManagerCommand_PK.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/JobManagerCommand_PK.java
new file mode 100644
index 0000000..8f64c3f
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/JobManagerCommand_PK.java
@@ -0,0 +1,62 @@
+/*
+ *
+ * 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 JobManagerCommand_PK implements Serializable {
+ private String resourceJobManagerId;
+ private String commandType;
+ public JobManagerCommand_PK(String resourceJobManagerId, String commandType){
+ this.resourceJobManagerId = resourceJobManagerId;
+ this.commandType = commandType;
+ }
+
+ public JobManagerCommand_PK() {
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ return false;
+ }
+
+ @Override
+ public int hashCode() {
+ return 1;
+ }
+
+ public String getResourceJobManagerId() {
+ return resourceJobManagerId;
+ }
+
+ public String getCommandType() {
+ return commandType;
+ }
+
+ public void setResourceJobManagerId(String resourceJobManagerId) {
+ this.resourceJobManagerId=resourceJobManagerId;
+ }
+
+ public void setCommandType(String commandType) {
+ this.commandType=commandType;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/JobSubmissionInterface.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/JobSubmissionInterface.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/JobSubmissionInterface.java
new file mode 100644
index 0000000..314de5b
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/JobSubmissionInterface.java
@@ -0,0 +1,124 @@
+/*
+ *
+ * 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;
+import java.sql.Timestamp;
+
+import javax.persistence.CascadeType;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.IdClass;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
+import javax.persistence.Table;
+
+import org.apache.openjpa.persistence.DataCache;
+
+@DataCache
+@Entity
+@Table(name = "JOB_SUBMISSION_INTERFACE")
+@IdClass(JobSubmissionInterface_PK.class)
+public class JobSubmissionInterface implements Serializable {
+
+ @Id
+ @Column(name = "JOB_SUBMISSION_INTERFACE_ID")
+ private String jobSubmissionInterfaceId;
+
+ @Id
+ @Column(name = "COMPUTE_RESOURCE_ID")
+ private String computeResourceId;
+
+ @ManyToOne(cascade= CascadeType.MERGE)
+ @JoinColumn(name = "COMPUTE_RESOURCE_ID")
+ private ComputeResource computeResource;
+
+ @Column(name = "JOB_SUBMISSION_PROTOCOL")
+ private String jobSubmissionProtocol;
+
+ @Column(name = "PRIORITY_ORDER")
+ private int priorityOrder;
+
+ @Column(name = "CREATION_TIME")
+ private Timestamp creationTime;
+
+ @Column(name = "UPDATE_TIME")
+ private Timestamp updateTime;
+
+ public Timestamp getCreationTime() {
+ return creationTime;
+ }
+
+ public void setCreationTime(Timestamp creationTime) {
+ this.creationTime = creationTime;
+ }
+
+ public Timestamp getUpdateTime() {
+ return updateTime;
+ }
+
+ public void setUpdateTime(Timestamp updateTime) {
+ this.updateTime = updateTime;
+ }
+
+
+ public String getJobSubmissionInterfaceId() {
+ return jobSubmissionInterfaceId;
+ }
+
+ public String getComputeResourceId() {
+ return computeResourceId;
+ }
+
+ public ComputeResource getComputeResource() {
+ return computeResource;
+ }
+
+ public String getJobSubmissionProtocol() {
+ return jobSubmissionProtocol;
+ }
+
+ public int getPriorityOrder() {
+ return priorityOrder;
+ }
+
+ public void setJobSubmissionInterfaceId(String jobSubmissionInterfaceId) {
+ this.jobSubmissionInterfaceId=jobSubmissionInterfaceId;
+ }
+
+ public void setComputeResourceId(String computeResourceId) {
+ this.computeResourceId=computeResourceId;
+ }
+
+ public void setComputeResource(ComputeResource computeResource) {
+ this.computeResource=computeResource;
+ }
+
+ public void setJobSubmissionProtocol(String jobSubmissionProtocol) {
+ this.jobSubmissionProtocol=jobSubmissionProtocol;
+ }
+
+ public void setPriorityOrder(int priorityOrder) {
+ this.priorityOrder=priorityOrder;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/JobSubmissionInterface_PK.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/JobSubmissionInterface_PK.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/JobSubmissionInterface_PK.java
new file mode 100644
index 0000000..cf7a9aa
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/JobSubmissionInterface_PK.java
@@ -0,0 +1,62 @@
+/*
+ *
+ * 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 JobSubmissionInterface_PK implements Serializable {
+ private String jobSubmissionInterfaceId;
+ private String computeResourceId;
+ public JobSubmissionInterface_PK(String jobSubmissionInterfaceId, String computeResourceId){
+ this.jobSubmissionInterfaceId = jobSubmissionInterfaceId;
+ this.computeResourceId = computeResourceId;
+ }
+
+ public JobSubmissionInterface_PK() {
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ return false;
+ }
+
+ @Override
+ public int hashCode() {
+ return 1;
+ }
+
+ public String getJobSubmissionInterfaceId() {
+ return jobSubmissionInterfaceId;
+ }
+
+ public String getComputeResourceId() {
+ return computeResourceId;
+ }
+
+ public void setJobSubmissionInterfaceId(String jobSubmissionInterfaceId) {
+ this.jobSubmissionInterfaceId=jobSubmissionInterfaceId;
+ }
+
+ public void setComputeResourceId(String computeResourceId) {
+ this.computeResourceId=computeResourceId;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/JobSubmissionProtocol.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/JobSubmissionProtocol.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/JobSubmissionProtocol.java
new file mode 100644
index 0000000..d913e58
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/JobSubmissionProtocol.java
@@ -0,0 +1,77 @@
+///*
+// *
+// * 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.aiaravata.application.catalog.data.model;
+//
+//import javax.persistence.*;
+//import java.io.Serializable;
+//
+//@Entity
+//@Table(name = "JOB_SUBMISSION_PROTOCOL")
+//@IdClass(JobSubmissionProtocolPK.class)
+//public class JobSubmissionProtocol implements Serializable {
+// @Id
+// @Column(name = "RESOURCE_ID")
+// private String resourceID;
+// @Id
+// @Column(name = "SUBMISSION_ID")
+// private String submissionID;
+//
+// @Id
+// @Column(name = "JOB_TYPE")
+// private String jobType;
+//
+// @ManyToOne(cascade= CascadeType.MERGE)
+// @JoinColumn(name = "RESOURCE_ID")
+// private ComputeResource computeResource;
+//
+// public String getResourceID() {
+// return resourceID;
+// }
+//
+// public void setResourceID(String resourceID) {
+// this.resourceID = resourceID;
+// }
+//
+// public String getSubmissionID() {
+// return submissionID;
+// }
+//
+// public void setSubmissionID(String submissionID) {
+// this.submissionID = submissionID;
+// }
+//
+// public String getJobType() {
+// return jobType;
+// }
+//
+// public void setJobType(String jobType) {
+// this.jobType = jobType;
+// }
+//
+// public ComputeResource getComputeResource() {
+// return computeResource;
+// }
+//
+// public void setComputeResource(ComputeResource computeResource) {
+// this.computeResource = computeResource;
+// }
+//}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/JobSubmissionProtocolPK.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/JobSubmissionProtocolPK.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/JobSubmissionProtocolPK.java
new file mode 100644
index 0000000..aefe87a
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/JobSubmissionProtocolPK.java
@@ -0,0 +1,74 @@
+///*
+// *
+// * 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.aiaravata.application.catalog.data.model;
+//
+//import java.io.Serializable;
+//
+//public class JobSubmissionProtocolPK implements Serializable {
+// private String resourceID;
+// private String submissionID;
+// private String jobType;
+//
+// public JobSubmissionProtocolPK(String resourceID, String submissionID, String jobType) {
+// this.resourceID = resourceID;
+// this.submissionID = submissionID;
+// this.jobType = jobType;
+// }
+//
+// public JobSubmissionProtocolPK() {
+// ;
+// }
+//
+// @Override
+// public boolean equals(Object o) {
+// return false;
+// }
+//
+// @Override
+// public int hashCode() {
+// return 1;
+// }
+//
+// public String getResourceID() {
+// return resourceID;
+// }
+//
+// public void setResourceID(String resourceID) {
+// this.resourceID = resourceID;
+// }
+//
+// public String getSubmissionID() {
+// return submissionID;
+// }
+//
+// public void setSubmissionID(String submissionID) {
+// this.submissionID = submissionID;
+// }
+//
+// public String getJobType() {
+// return jobType;
+// }
+//
+// public void setJobType(String jobType) {
+// this.jobType = jobType;
+// }
+//}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/LibraryApendPath.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/LibraryApendPath.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/LibraryApendPath.java
new file mode 100644
index 0000000..3243eec
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/LibraryApendPath.java
@@ -0,0 +1,76 @@
+/*
+ *
+ * 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.*;
+import java.io.Serializable;
+
+@Entity
+@Table(name = "LIBRARY_APEND_PATH")
+@IdClass(LibraryApendPath_PK.class)
+public class LibraryApendPath implements Serializable {
+ @Id
+ @Column(name = "DEPLOYMENT_ID")
+ private String deploymentID;
+ @Id
+ @Column(name = "NAME")
+ private String name;
+
+ @Column(name = "VALUE")
+ private String value;
+
+ @ManyToOne(cascade= CascadeType.MERGE)
+ @JoinColumn(name = "DEPLOYMENT_ID")
+ private ApplicationDeployment applicationDeployment;
+
+ public String getDeploymentID() {
+ return deploymentID;
+ }
+
+ public void setDeploymentID(String deploymentID) {
+ this.deploymentID = deploymentID;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getValue() {
+ return value;
+ }
+
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+ public ApplicationDeployment getApplicationDeployment() {
+ return applicationDeployment;
+ }
+
+ public void setApplicationDeployment(ApplicationDeployment applicationDeployment) {
+ this.applicationDeployment = applicationDeployment;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/LibraryApendPath_PK.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/LibraryApendPath_PK.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/LibraryApendPath_PK.java
new file mode 100644
index 0000000..44a6332
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/LibraryApendPath_PK.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 LibraryApendPath_PK implements Serializable {
+ private String deploymentID;
+ private String name;
+
+ public LibraryApendPath_PK(String deploymentID, String name) {
+ this.deploymentID = deploymentID;
+ this.name = name;
+ }
+
+ public LibraryApendPath_PK() {
+ ;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ return false;
+ }
+
+ @Override
+ public int hashCode() {
+ return 1;
+ }
+
+ public String getDeploymentID() {
+ return deploymentID;
+ }
+
+ public void setDeploymentID(String deploymentID) {
+ this.deploymentID = deploymentID;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/LibraryPrepandPath.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/LibraryPrepandPath.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/LibraryPrepandPath.java
new file mode 100644
index 0000000..2821021
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/LibraryPrepandPath.java
@@ -0,0 +1,76 @@
+/*
+ *
+ * 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.*;
+import java.io.Serializable;
+
+@Entity
+@Table(name = "LIBRARY_PREPAND_PATH")
+@IdClass(LibraryPrepandPath_PK.class)
+public class LibraryPrepandPath implements Serializable {
+ @Id
+ @Column(name = "DEPLOYMENT_ID")
+ private String deploymentID;
+ @Id
+ @Column(name = "NAME")
+ private String name;
+
+ @Column(name = "VALUE")
+ private String value;
+
+ @ManyToOne(cascade= CascadeType.MERGE)
+ @JoinColumn(name = "DEPLOYMENT_ID")
+ private ApplicationDeployment applicationDeployment;
+
+ public String getDeploymentID() {
+ return deploymentID;
+ }
+
+ public void setDeploymentID(String deploymentID) {
+ this.deploymentID = deploymentID;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getValue() {
+ return value;
+ }
+
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+ public ApplicationDeployment getApplicationDeployment() {
+ return applicationDeployment;
+ }
+
+ public void setApplicationDeployment(ApplicationDeployment applicationDeployment) {
+ this.applicationDeployment = applicationDeployment;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/LibraryPrepandPath_PK.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/LibraryPrepandPath_PK.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/LibraryPrepandPath_PK.java
new file mode 100644
index 0000000..d55c704
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/LibraryPrepandPath_PK.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 LibraryPrepandPath_PK implements Serializable {
+ private String deploymentID;
+ private String name;
+
+ public LibraryPrepandPath_PK(String deploymentID, String name) {
+ this.deploymentID = deploymentID;
+ this.name = name;
+ }
+
+ public LibraryPrepandPath_PK() {
+ ;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ return false;
+ }
+
+ @Override
+ public int hashCode() {
+ return 1;
+ }
+
+ public String getDeploymentID() {
+ return deploymentID;
+ }
+
+ public void setDeploymentID(String deploymentID) {
+ this.deploymentID = deploymentID;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/LocalDataMovement.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/LocalDataMovement.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/LocalDataMovement.java
new file mode 100644
index 0000000..8068faa
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/LocalDataMovement.java
@@ -0,0 +1,49 @@
+/*
+ *
+ * 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;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+import org.apache.openjpa.persistence.DataCache;
+
+@DataCache
+@Entity
+@Table(name = "LOCAL_DATA_MOVEMENT")
+public class LocalDataMovement implements Serializable {
+
+ @Id
+ @Column(name = "DATA_MOVEMENT_INTERFACE_ID")
+ private String dataMovementInterfaceId;
+
+ public String getDataMovementInterfaceId() {
+ return dataMovementInterfaceId;
+ }
+
+ public void setDataMovementInterfaceId(String dataMovementInterfaceId) {
+ this.dataMovementInterfaceId=dataMovementInterfaceId;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/LocalSubmission.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/LocalSubmission.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/LocalSubmission.java
new file mode 100644
index 0000000..02c3edf
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/LocalSubmission.java
@@ -0,0 +1,98 @@
+/*
+ *
+ * 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;
+import java.sql.Timestamp;
+
+import javax.persistence.CascadeType;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
+import javax.persistence.Table;
+
+import org.apache.openjpa.persistence.DataCache;
+
+@DataCache
+@Entity
+@Table(name = "LOCAL_SUBMISSION")
+public class LocalSubmission implements Serializable {
+
+ @Column(name = "RESOURCE_JOB_MANAGER_ID")
+ private String resourceJobManagerId;
+
+ @ManyToOne(cascade= CascadeType.MERGE)
+ @JoinColumn(name = "RESOURCE_JOB_MANAGER_ID")
+ private ResourceJobManager resourceJobManager;
+
+ @Id
+ @Column(name = "JOB_SUBMISSION_INTERFACE_ID")
+ private String jobSubmissionInterfaceId;
+
+ @Column(name = "CREATION_TIME")
+ private Timestamp creationTime;
+
+ @Column(name = "UPDATE_TIME")
+ private Timestamp updateTime;
+
+ public Timestamp getCreationTime() {
+ return creationTime;
+ }
+
+ public void setCreationTime(Timestamp creationTime) {
+ this.creationTime = creationTime;
+ }
+
+ public Timestamp getUpdateTime() {
+ return updateTime;
+ }
+
+ public void setUpdateTime(Timestamp updateTime) {
+ this.updateTime = updateTime;
+ }
+
+ public String getResourceJobManagerId() {
+ return resourceJobManagerId;
+ }
+
+ public ResourceJobManager getResourceJobManager() {
+ return resourceJobManager;
+ }
+
+ public String getJobSubmissionInterfaceId() {
+ return jobSubmissionInterfaceId;
+ }
+
+ public void setResourceJobManagerId(String resourceJobManagerId) {
+ this.resourceJobManagerId=resourceJobManagerId;
+ }
+
+ public void setResourceJobManager(ResourceJobManager resourceJobManager) {
+ this.resourceJobManager=resourceJobManager;
+ }
+
+ public void setJobSubmissionInterfaceId(String jobSubmissionInterfaceId) {
+ this.jobSubmissionInterfaceId=jobSubmissionInterfaceId;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/ModuleLoadCmd.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/ModuleLoadCmd.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/ModuleLoadCmd.java
new file mode 100644
index 0000000..dadf462
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/ModuleLoadCmd.java
@@ -0,0 +1,70 @@
+/*
+ *
+ * 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 org.apache.openjpa.persistence.DataCache;
+
+import javax.persistence.*;
+import java.io.Serializable;
+
+@DataCache
+@Entity
+@Table(name = "MODULE_LOAD_CMD")
+@IdClass(ModuleLoadCmd_PK.class)
+public class ModuleLoadCmd implements Serializable {
+
+ @Id
+ @Column(name = "CMD")
+ private String cmd;
+
+ @Id
+ @Column(name = "APP_DEPLOYMENT_ID")
+ private String appDeploymentId;
+
+ @ManyToOne(cascade= CascadeType.MERGE)
+ @JoinColumn(name = "APP_DEPLOYMENT_ID")
+ private ApplicationDeployment applicationDeployment;
+
+ public String getCmd() {
+ return cmd;
+ }
+
+ public String getAppDeploymentId() {
+ return appDeploymentId;
+ }
+
+ public ApplicationDeployment getApplicationDeployment() {
+ return applicationDeployment;
+ }
+
+ public void setCmd(String cmd) {
+ this.cmd=cmd;
+ }
+
+ public void setAppDeploymentId(String appDeploymentId) {
+ this.appDeploymentId=appDeploymentId;
+ }
+
+ public void setApplicationDeployment(ApplicationDeployment applicationDeployment) {
+ this.applicationDeployment=applicationDeployment;
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/ModuleLoadCmd_PK.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/ModuleLoadCmd_PK.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/ModuleLoadCmd_PK.java
new file mode 100644
index 0000000..2fc4c79
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/ModuleLoadCmd_PK.java
@@ -0,0 +1,63 @@
+/*
+ *
+ * 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 ModuleLoadCmd_PK implements Serializable {
+ private String cmd;
+ private String appDeploymentId;
+
+ public ModuleLoadCmd_PK(){
+ }
+
+ public ModuleLoadCmd_PK(String cmd, String appDeploymentId){
+ this.cmd = cmd;
+ this.appDeploymentId = appDeploymentId;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ return false;
+ }
+
+ @Override
+ public int hashCode() {
+ return 1;
+ }
+
+ public String getCmd() {
+ return cmd;
+ }
+
+ public String getAppDeploymentId() {
+ return appDeploymentId;
+ }
+
+ public void setCmd(String cmd) {
+ this.cmd=cmd;
+ }
+
+ public void setAppDeploymentId(String appDeploymentId) {
+ this.appDeploymentId=appDeploymentId;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/PostJobCommand.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/PostJobCommand.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/PostJobCommand.java
new file mode 100644
index 0000000..50471b0
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/PostJobCommand.java
@@ -0,0 +1,73 @@
+/*
+ *
+ * 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;
+
+import javax.persistence.CascadeType;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.IdClass;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
+import javax.persistence.Table;
+
+@Entity
+@Table(name = "POSTJOB_COMMAND")
+@IdClass(PostJobCommandPK.class)
+public class PostJobCommand implements Serializable {
+ @Id
+ @Column(name = "APPDEPLOYMENT_ID")
+ private String deploymentId;
+ @Id
+ @Column(name = "COMMAND")
+ private String command;
+
+ @ManyToOne(cascade= CascadeType.MERGE)
+ @JoinColumn(name = "APPDEPLOYMENT_ID")
+ private ApplicationDeployment deployment;
+
+ public String getDeploymentId() {
+ return deploymentId;
+ }
+
+ public void setDeploymentId(String deploymentId) {
+ this.deploymentId = deploymentId;
+ }
+
+ public String getCommand() {
+ return command;
+ }
+
+ public void setCommand(String command) {
+ this.command = command;
+ }
+
+ public ApplicationDeployment getDeployment() {
+ return deployment;
+ }
+
+ public void setDeployment(ApplicationDeployment deployment) {
+ this.deployment = deployment;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/PostJobCommandPK.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/PostJobCommandPK.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/PostJobCommandPK.java
new file mode 100644
index 0000000..ac95ca7
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/PostJobCommandPK.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 PostJobCommandPK implements Serializable {
+ private String deploymentId;
+ private String command;
+
+ public PostJobCommandPK(String submissionID, String command) {
+ this.deploymentId = submissionID;
+ this.command = command;
+ }
+
+ public PostJobCommandPK() {
+ ;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ return false;
+ }
+
+ @Override
+ public int hashCode() {
+ return 1;
+ }
+
+ public String getDeploymentId() {
+ return deploymentId;
+ }
+
+ public void setDeploymentId(String deploymentId) {
+ this.deploymentId = deploymentId;
+ }
+
+ public String getCommand() {
+ return command;
+ }
+
+ public void setCommand(String command) {
+ this.command = command;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/PreJobCommand.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/PreJobCommand.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/PreJobCommand.java
new file mode 100644
index 0000000..81a3c3f
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/PreJobCommand.java
@@ -0,0 +1,73 @@
+/*
+ *
+ * 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;
+
+import javax.persistence.CascadeType;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.IdClass;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
+import javax.persistence.Table;
+
+@Entity
+@Table(name = "PREJOB_COMMAND")
+@IdClass(PreJobCommandPK.class)
+public class PreJobCommand implements Serializable {
+ @Id
+ @Column(name = "APPDEPLOYMENT_ID")
+ private String deploymentId;
+ @Id
+ @Column(name = "COMMAND")
+ private String command;
+
+ @ManyToOne(cascade= CascadeType.MERGE)
+ @JoinColumn(name = "APPDEPLOYMENT_ID")
+ private ApplicationDeployment applicationDeployment;
+
+ public String getDeploymentId() {
+ return deploymentId;
+ }
+
+ public void setDeploymentId(String deploymentId) {
+ this.deploymentId = deploymentId;
+ }
+
+ public String getCommand() {
+ return command;
+ }
+
+ public void setCommand(String command) {
+ this.command = command;
+ }
+
+ public ApplicationDeployment getApplicationDeployment() {
+ return applicationDeployment;
+ }
+
+ public void setApplicationDeployment(ApplicationDeployment applicationDeployment) {
+ this.applicationDeployment = applicationDeployment;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/PreJobCommandPK.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/PreJobCommandPK.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/PreJobCommandPK.java
new file mode 100644
index 0000000..a64f698
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/PreJobCommandPK.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 PreJobCommandPK implements Serializable {
+ private String deploymentId;
+ private String command;
+
+ public PreJobCommandPK(String deploymentId, String command) {
+ this.deploymentId = deploymentId;
+ this.command = command;
+ }
+
+ public PreJobCommandPK() {
+ ;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ return false;
+ }
+
+ @Override
+ public int hashCode() {
+ return 1;
+ }
+
+ public String getDeploymentId() {
+ return deploymentId;
+ }
+
+ public void setDeploymentId(String deploymentId) {
+ this.deploymentId = deploymentId;
+ }
+
+ public String getCommand() {
+ return command;
+ }
+
+ public void setCommand(String command) {
+ this.command = command;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/ResourceJobManager.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/ResourceJobManager.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/ResourceJobManager.java
new file mode 100644
index 0000000..ad63caa
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/ResourceJobManager.java
@@ -0,0 +1,106 @@
+/*
+ *
+ * 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;
+import java.sql.Timestamp;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+import org.apache.openjpa.persistence.DataCache;
+
+@DataCache
+@Entity
+@Table(name = "RESOURCE_JOB_MANAGER")
+public class ResourceJobManager implements Serializable {
+
+ @Id
+ @Column(name = "RESOURCE_JOB_MANAGER_ID")
+ private String resourceJobManagerId;
+
+ @Column(name = "PUSH_MONITORING_ENDPOINT")
+ private String pushMonitoringEndpoint;
+
+ @Column(name = "JOB_MANAGER_BIN_PATH")
+ private String jobManagerBinPath;
+
+ @Column(name = "RESOURCE_JOB_MANAGER_TYPE")
+ private String resourceJobManagerType;
+
+ @Column(name = "CREATION_TIME")
+ private Timestamp creationTime;
+
+ @Column(name = "UPDATE_TIME")
+ private Timestamp updateTime;
+
+ public Timestamp getCreationTime() {
+ return creationTime;
+ }
+
+ public void setCreationTime(Timestamp creationTime) {
+ this.creationTime = creationTime;
+ }
+
+ public Timestamp getUpdateTime() {
+ return updateTime;
+ }
+
+ public void setUpdateTime(Timestamp updateTime) {
+ this.updateTime = updateTime;
+ }
+
+ public String getResourceJobManagerId() {
+ return resourceJobManagerId;
+ }
+
+ public String getPushMonitoringEndpoint() {
+ return pushMonitoringEndpoint;
+ }
+
+ public String getJobManagerBinPath() {
+ return jobManagerBinPath;
+ }
+
+ public String getResourceJobManagerType() {
+ return resourceJobManagerType;
+ }
+
+ public void setResourceJobManagerId(String resourceJobManagerId) {
+ this.resourceJobManagerId=resourceJobManagerId;
+ }
+
+ public void setPushMonitoringEndpoint(String pushMonitoringEndpoint) {
+ this.pushMonitoringEndpoint=pushMonitoringEndpoint;
+ }
+
+ public void setJobManagerBinPath(String jobManagerBinPath) {
+ this.jobManagerBinPath=jobManagerBinPath;
+ }
+
+ public void setResourceJobManagerType(String resourceJobManagerType) {
+ this.resourceJobManagerType=resourceJobManagerType;
+ }
+}
+
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/ScpDataMovement.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/ScpDataMovement.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/ScpDataMovement.java
new file mode 100644
index 0000000..a12b120
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/ScpDataMovement.java
@@ -0,0 +1,117 @@
+/*
+ *
+ * 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;
+import java.sql.Timestamp;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+import org.apache.openjpa.persistence.DataCache;
+
+@DataCache
+@Entity
+@Table(name = "SCP_DATA_MOVEMENT")
+public class ScpDataMovement implements Serializable {
+
+ @Column(name = "QUEUE_DESCRIPTION")
+ private String queueDescription;
+
+ @Id
+ @Column(name = "DATA_MOVEMENT_INTERFACE_ID")
+ private String dataMovementInterfaceId;
+
+ @Column(name = "SECURITY_PROTOCOL")
+ private String securityProtocol;
+
+ @Column(name = "ALTERNATIVE_SCP_HOSTNAME")
+ private String alternativeScpHostname;
+
+ @Column(name = "SSH_PORT")
+ private int sshPort;
+
+ @Column(name = "CREATION_TIME")
+ private Timestamp creationTime;
+
+ @Column(name = "UPDATE_TIME")
+ private Timestamp updateTime;
+
+ public Timestamp getCreationTime() {
+ return creationTime;
+ }
+
+ public void setCreationTime(Timestamp creationTime) {
+ this.creationTime = creationTime;
+ }
+
+ public Timestamp getUpdateTime() {
+ return updateTime;
+ }
+
+ public void setUpdateTime(Timestamp updateTime) {
+ this.updateTime = updateTime;
+ }
+
+
+ public String getQueueDescription() {
+ return queueDescription;
+ }
+
+ public String getDataMovementInterfaceId() {
+ return dataMovementInterfaceId;
+ }
+
+ public String getSecurityProtocol() {
+ return securityProtocol;
+ }
+
+ public String getAlternativeScpHostname() {
+ return alternativeScpHostname;
+ }
+
+ public int getSshPort() {
+ return sshPort;
+ }
+
+ public void setQueueDescription(String queueDescription) {
+ this.queueDescription=queueDescription;
+ }
+
+ public void setDataMovementInterfaceId(String dataMovementInterfaceId) {
+ this.dataMovementInterfaceId=dataMovementInterfaceId;
+ }
+
+ public void setSecurityProtocol(String securityProtocol) {
+ this.securityProtocol=securityProtocol;
+ }
+
+ public void setAlternativeScpHostname(String alternativeScpHostname) {
+ this.alternativeScpHostname=alternativeScpHostname;
+ }
+
+ public void setSshPort(int sshPort) {
+ this.sshPort=sshPort;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/SshJobSubmission.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/SshJobSubmission.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/SshJobSubmission.java
new file mode 100644
index 0000000..30e46f4
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/SshJobSubmission.java
@@ -0,0 +1,144 @@
+/*
+ *
+ * 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;
+import java.sql.Timestamp;
+
+import javax.persistence.CascadeType;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
+import javax.persistence.Table;
+
+import org.apache.openjpa.persistence.DataCache;
+
+@DataCache
+@Entity
+@Table(name = "SSH_JOB_SUBMISSION")
+public class SshJobSubmission implements Serializable {
+
+ @Column(name = "RESOURCE_JOB_MANAGER_ID")
+ private String resourceJobManagerId;
+
+ @ManyToOne(cascade= CascadeType.MERGE)
+ @JoinColumn(name = "RESOURCE_JOB_MANAGER_ID")
+ private ResourceJobManager resourceJobManager;
+
+ @Id
+ @Column(name = "JOB_SUBMISSION_INTERFACE_ID")
+ private String jobSubmissionInterfaceId;
+
+ @Column(name = "ALTERNATIVE_SSH_HOSTNAME")
+ private String alternativeSshHostname;
+
+ @Column(name = "SECURITY_PROTOCOL")
+ private String securityProtocol;
+
+ @Column(name = "SSH_PORT")
+ private int sshPort;
+
+ @Column(name = "MONITOR_MODE")
+ private String monitorMode;
+
+ @Column(name = "CREATION_TIME")
+ private Timestamp creationTime;
+
+ @Column(name = "UPDATE_TIME")
+ private Timestamp updateTime;
+
+ public Timestamp getCreationTime() {
+ return creationTime;
+ }
+
+ public void setCreationTime(Timestamp creationTime) {
+ this.creationTime = creationTime;
+ }
+
+ public Timestamp getUpdateTime() {
+ return updateTime;
+ }
+
+ public void setUpdateTime(Timestamp updateTime) {
+ this.updateTime = updateTime;
+ }
+
+
+ public String getResourceJobManagerId() {
+ return resourceJobManagerId;
+ }
+
+ public ResourceJobManager getResourceJobManager() {
+ return resourceJobManager;
+ }
+
+ public String getJobSubmissionInterfaceId() {
+ return jobSubmissionInterfaceId;
+ }
+
+ public String getAlternativeSshHostname() {
+ return alternativeSshHostname;
+ }
+
+ public String getSecurityProtocol() {
+ return securityProtocol;
+ }
+
+ public int getSshPort() {
+ return sshPort;
+ }
+
+ public void setResourceJobManagerId(String resourceJobManagerId) {
+ this.resourceJobManagerId=resourceJobManagerId;
+ }
+
+ public void setResourceJobManager(ResourceJobManager resourceJobManager) {
+ this.resourceJobManager=resourceJobManager;
+ }
+
+ public void setJobSubmissionInterfaceId(String jobSubmissionInterfaceId) {
+ this.jobSubmissionInterfaceId=jobSubmissionInterfaceId;
+ }
+
+ public void setAlternativeSshHostname(String alternativeSshHostname) {
+ this.alternativeSshHostname=alternativeSshHostname;
+ }
+
+ public void setSecurityProtocol(String securityProtocol) {
+ this.securityProtocol=securityProtocol;
+ }
+
+ public void setSshPort(int sshPort) {
+ this.sshPort=sshPort;
+ }
+
+ public String getMonitorMode() {
+ return monitorMode;
+ }
+
+ public void setMonitorMode(String monitorMode) {
+ this.monitorMode = monitorMode;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/UnicoreDataMovement.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/UnicoreDataMovement.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/UnicoreDataMovement.java
new file mode 100644
index 0000000..53cd4d5
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/UnicoreDataMovement.java
@@ -0,0 +1,65 @@
+/*
+ *
+ * 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.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+@Entity
+@Table(name = "UNICORE_DATAMOVEMENT")
+public class UnicoreDataMovement {
+ @Id
+ @Column(name = "DATAMOVEMENT_ID")
+ private String dataMovementId;
+ @Column(name = "SECURITY_PROTOCAL")
+ private String securityProtocol;
+
+ @Column(name = "UNICORE_ENDPOINT_URL")
+ private String unicoreEndpointUrl;
+
+ public String getUnicoreEndpointUrl() {
+ return unicoreEndpointUrl;
+ }
+
+ public void setUnicoreEndpointUrl(String unicoreEndpointUrl) {
+ this.unicoreEndpointUrl = unicoreEndpointUrl;
+ }
+
+ public String getDataMovementId() {
+ return dataMovementId;
+ }
+
+ public void setDataMovementId(String dataMovementId) {
+ this.dataMovementId = dataMovementId;
+ }
+
+ public String getSecurityProtocol() {
+ return securityProtocol;
+ }
+
+ public void setSecurityProtocol(String securityProtocol) {
+ this.securityProtocol = securityProtocol;
+ }
+
+}
[22/52] [abbrv] [partial] airavata git commit: registry refactoring
Posted by sh...@apache.org.
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/impl/ApplicationDeploymentImpl.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/impl/ApplicationDeploymentImpl.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/impl/ApplicationDeploymentImpl.java
new file mode 100644
index 0000000..cd9ccae
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/impl/ApplicationDeploymentImpl.java
@@ -0,0 +1,413 @@
+/*
+ *
+ * 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.impl;
+
+import org.apache.airavata.model.appcatalog.appdeployment.ApplicationDeploymentDescription;
+import org.apache.airavata.model.appcatalog.appdeployment.ApplicationParallelismType;
+import org.apache.airavata.model.appcatalog.appdeployment.SetEnvPaths;
+import org.apache.airavata.registry.core.app.catalog.resources.*;
+import org.apache.airavata.registry.core.app.catalog.util.AppCatalogThriftConversion;
+import org.apache.airavata.registry.cpi.AppCatalogException;
+import org.apache.airavata.registry.cpi.ApplicationDeployment;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+public class ApplicationDeploymentImpl implements ApplicationDeployment {
+ private final static Logger logger = LoggerFactory.getLogger(ApplicationDeploymentImpl.class);
+
+ @Override
+ public String addApplicationDeployment(ApplicationDeploymentDescription deploymentDescription, String gatewayId) throws AppCatalogException {
+ try {
+ AppDeploymentAppCatalogResourceAppCat deploymentResource = new AppDeploymentAppCatalogResourceAppCat();
+ ComputeResourceAppCatalogResourceAppCat computeHostResource = new ComputeResourceAppCatalogResourceAppCat();
+ AppModuleAppCatalogResourceAppCat moduleResource = new AppModuleAppCatalogResourceAppCat();
+ if (!computeHostResource.isExists(deploymentDescription.getComputeHostId())){
+ logger.error("Compute host does not exist in the system. Please create a Compute host first...");
+ throw new AppCatalogException("Compute host does not exist in the system. Please create a Compute host first...");
+ }
+ if (!moduleResource.isExists(deploymentDescription.getAppModuleId())){
+ logger.error("Application module does not exist in the system. Please create an application module first...");
+ throw new AppCatalogException("Application module does not exist in the system. Please create an application module first...");
+ }
+ AppModuleAppCatalogResourceAppCat module = (AppModuleAppCatalogResourceAppCat)moduleResource.get(deploymentDescription.getAppModuleId());
+ ComputeResourceAppCatalogResourceAppCat hostResource = (ComputeResourceAppCatalogResourceAppCat) computeHostResource.get(deploymentDescription.getComputeHostId());
+ deploymentResource.setDeploymentId(hostResource.getHostName() + "_" + deploymentDescription.getAppModuleId());
+ deploymentResource.setAppModuleId(deploymentDescription.getAppModuleId());
+ deploymentResource.setModuleResource(module);
+ deploymentResource.setHostId(deploymentDescription.getComputeHostId());
+ deploymentResource.setHostResource(hostResource);
+ deploymentResource.setAppDes(deploymentDescription.getAppDeploymentDescription());
+ deploymentResource.setExecutablePath(deploymentDescription.getExecutablePath());
+ deploymentResource.setGatewayId(gatewayId);
+ ApplicationParallelismType parallelism = deploymentDescription.getParallelism();
+ if (parallelism != null){
+ deploymentResource.setParallelism(parallelism.toString());
+ }
+ deploymentResource.save();
+ deploymentDescription.setAppDeploymentId(deploymentResource.getDeploymentId());
+
+ List<String> moduleLoadCmds = deploymentDescription.getModuleLoadCmds();
+ if (moduleLoadCmds != null && !moduleLoadCmds.isEmpty()){
+ for (String cmd : moduleLoadCmds){
+ ModuleLoadCmdAppCatalogResourceAppCat cmdResource = new ModuleLoadCmdAppCatalogResourceAppCat();
+ cmdResource.setAppDeploymentId(deploymentDescription.getAppDeploymentId());
+ cmdResource.setCmd(cmd);
+ cmdResource.save();
+ }
+ }
+
+ List<String> preJobCommands = deploymentDescription.getPreJobCommands();
+ if (preJobCommands != null && !preJobCommands.isEmpty()){
+ for (String cmd : preJobCommands){
+ PreJobCommandAppCatalogResourceAppCat cmdResource = new PreJobCommandAppCatalogResourceAppCat();
+ cmdResource.setAppDeploymentId(deploymentDescription.getAppDeploymentId());
+ cmdResource.setCommand(cmd);
+ cmdResource.save();
+ }
+ }
+
+ List<String> postJobCommands = deploymentDescription.getPostJobCommands();
+ if (postJobCommands != null && !postJobCommands.isEmpty()){
+ for (String cmd : postJobCommands){
+ PostJobCommandAppCatalogResourceAppCat cmdResource = new PostJobCommandAppCatalogResourceAppCat();
+ cmdResource.setAppDeploymentId(deploymentDescription.getAppDeploymentId());
+ cmdResource.setCommand(cmd);
+ cmdResource.save();
+ }
+ }
+
+ List<SetEnvPaths> libPrependPaths = deploymentDescription.getLibPrependPaths();
+ if (libPrependPaths != null && !libPrependPaths.isEmpty()){
+ for (SetEnvPaths path : libPrependPaths){
+ LibraryPrepandPathAppCatalogResourceAppCat prepandPathResource = new LibraryPrepandPathAppCatalogResourceAppCat();
+ prepandPathResource.setAppDeploymentResource(deploymentResource);
+ prepandPathResource.setName(path.getName());
+ prepandPathResource.setValue(path.getValue());
+ prepandPathResource.setDeploymentId(deploymentResource.getDeploymentId());
+ prepandPathResource.save();
+ }
+ }
+
+ List<SetEnvPaths> libApendPaths = deploymentDescription.getLibAppendPaths();
+ if (libApendPaths != null && !libApendPaths.isEmpty()){
+ for (SetEnvPaths path : libApendPaths){
+ LibraryApendPathAppCatalogResourceAppCat apendPathResource = new LibraryApendPathAppCatalogResourceAppCat();
+ apendPathResource.setAppDeploymentResource(deploymentResource);
+ apendPathResource.setName(path.getName());
+ apendPathResource.setValue(path.getValue());
+ apendPathResource.setDeploymentId(deploymentResource.getDeploymentId());
+ apendPathResource.save();
+ }
+ }
+ List<SetEnvPaths> setEnvironment = deploymentDescription.getSetEnvironment();
+ if (setEnvironment != null && !setEnvironment.isEmpty()){
+ for (SetEnvPaths path : setEnvironment){
+ AppEnvironmentAppCatalogResourceAppCat environmentResource = new AppEnvironmentAppCatalogResourceAppCat();
+ environmentResource.setAppDeploymentResource(deploymentResource);
+ environmentResource.setName(path.getName());
+ environmentResource.setValue(path.getValue());
+ environmentResource.setDeploymentId(deploymentResource.getDeploymentId());
+ environmentResource.save();
+ }
+ }
+ return deploymentResource.getDeploymentId();
+ }catch (Exception e) {
+ logger.error("Error while saving application deployment...", e);
+ throw new AppCatalogException(e);
+ }
+ }
+
+ @Override
+ public void updateApplicationDeployment(String deploymentId, ApplicationDeploymentDescription updatedDeployment) throws AppCatalogException {
+ try {
+ AppDeploymentAppCatalogResourceAppCat deploymentResource = new AppDeploymentAppCatalogResourceAppCat();
+ AppDeploymentAppCatalogResourceAppCat existingDep = (AppDeploymentAppCatalogResourceAppCat)deploymentResource.get(deploymentId);
+ ComputeResourceAppCatalogResourceAppCat computeHostResource = new ComputeResourceAppCatalogResourceAppCat();
+ AppModuleAppCatalogResourceAppCat moduleResource = new AppModuleAppCatalogResourceAppCat();
+ if (!computeHostResource.isExists(updatedDeployment.getComputeHostId())){
+ logger.error("Compute host does not exist in the system. Please create a Compute host first...");
+ throw new AppCatalogException("Compute host does not exist in the system. Please create a Compute host first...");
+ }
+ if (!moduleResource.isExists(updatedDeployment.getAppModuleId())){
+ logger.error("Application module does not exist in the system. Please create an application module first...");
+ throw new AppCatalogException("Application module does not exist in the system. Please create an application module first...");
+ }
+ AppModuleAppCatalogResourceAppCat module = (AppModuleAppCatalogResourceAppCat)moduleResource.get(updatedDeployment.getAppModuleId());
+ existingDep.setAppModuleId(updatedDeployment.getAppModuleId());
+ existingDep.setModuleResource(module);
+ existingDep.setHostId(updatedDeployment.getComputeHostId());
+ existingDep.setHostResource((ComputeResourceAppCatalogResourceAppCat)computeHostResource.get(updatedDeployment.getComputeHostId()));
+ existingDep.setAppDes(updatedDeployment.getAppDeploymentDescription());
+ existingDep.setExecutablePath(updatedDeployment.getExecutablePath());
+ if (updatedDeployment.getParallelism() != null){
+ deploymentResource.setParallelism(updatedDeployment.getParallelism().toString());
+ }
+
+ existingDep.save();
+
+ // remove existing module load commands
+ ModuleLoadCmdAppCatalogResourceAppCat cmdResource = new ModuleLoadCmdAppCatalogResourceAppCat();
+ Map<String, String> ids = new HashMap<String, String>();
+ ids.put(AppCatAbstractResource.ModuleLoadCmdConstants.APP_DEPLOYMENT_ID, deploymentId);
+ cmdResource.remove(ids);
+ List<String> moduleLoadCmds = updatedDeployment.getModuleLoadCmds();
+ if (moduleLoadCmds != null && !moduleLoadCmds.isEmpty()){
+ for (String cmd : moduleLoadCmds){
+ ids = new HashMap<String, String>();
+ ids.put(AppCatAbstractResource.ModuleLoadCmdConstants.APP_DEPLOYMENT_ID, deploymentId);
+ ids.put(AppCatAbstractResource.ModuleLoadCmdConstants.CMD, cmd);
+ if (cmdResource.isExists(ids)){
+ cmdResource = (ModuleLoadCmdAppCatalogResourceAppCat)cmdResource.get(ids);
+ }
+ cmdResource.setCmd(cmd);
+ cmdResource.setAppDeploymentResource(existingDep);
+ cmdResource.setAppDeploymentId(deploymentId);
+ cmdResource.save();
+ }
+ }
+
+ PreJobCommandAppCatalogResourceAppCat preJobCommandResource = new PreJobCommandAppCatalogResourceAppCat();
+ ids = new HashMap<String, String>();
+ ids.put(AppCatAbstractResource.PreJobCommandConstants.DEPLOYMENT_ID, deploymentId);
+ preJobCommandResource.remove(ids);
+ List<String> preJobCommands = updatedDeployment.getPreJobCommands();
+ if (preJobCommands != null && !preJobCommands.isEmpty()){
+ for (String cmd : preJobCommands){
+ ids = new HashMap<String, String>();
+ ids.put(AppCatAbstractResource.PreJobCommandConstants.DEPLOYMENT_ID, deploymentId);
+ ids.put(AppCatAbstractResource.PreJobCommandConstants.COMMAND, cmd);
+ if (preJobCommandResource.isExists(ids)){
+ preJobCommandResource = (PreJobCommandAppCatalogResourceAppCat)preJobCommandResource.get(ids);
+ }
+ preJobCommandResource.setCommand(cmd);
+ preJobCommandResource.setAppDeploymentResource(existingDep);
+ preJobCommandResource.setAppDeploymentId(deploymentId);
+ preJobCommandResource.save();
+ }
+ }
+
+ PostJobCommandAppCatalogResourceAppCat postJobCommandResource = new PostJobCommandAppCatalogResourceAppCat();
+ ids = new HashMap<String, String>();
+ ids.put(AppCatAbstractResource.PostJobCommandConstants.DEPLOYMENT_ID, deploymentId);
+ postJobCommandResource.remove(ids);
+ List<String> postJobCommands = updatedDeployment.getPostJobCommands();
+ if (postJobCommands != null && !postJobCommands.isEmpty()){
+ for (String cmd : postJobCommands){
+ ids = new HashMap<String, String>();
+ ids.put(AppCatAbstractResource.PostJobCommandConstants.DEPLOYMENT_ID, deploymentId);
+ ids.put(AppCatAbstractResource.PostJobCommandConstants.COMMAND, cmd);
+ if (postJobCommandResource.isExists(ids)){
+ postJobCommandResource = (PostJobCommandAppCatalogResourceAppCat)postJobCommandResource.get(ids);
+ }
+ postJobCommandResource.setCommand(cmd);
+ postJobCommandResource.setAppDeploymentResource(existingDep);
+ postJobCommandResource.setAppDeploymentId(deploymentId);
+ postJobCommandResource.save();
+ }
+ }
+
+ // remove existing lib prepand paths
+ LibraryPrepandPathAppCatalogResourceAppCat prepandPathResource = new LibraryPrepandPathAppCatalogResourceAppCat();
+ ids = new HashMap<String, String>();
+ ids.put(AppCatAbstractResource.LibraryPrepandPathConstants.DEPLOYMENT_ID, deploymentId);
+ prepandPathResource.remove(ids);
+ List<SetEnvPaths> libPrependPaths = updatedDeployment.getLibPrependPaths();
+ if (libPrependPaths != null && !libPrependPaths.isEmpty()){
+ for (SetEnvPaths path : libPrependPaths){
+ ids = new HashMap<String, String>();
+ ids.put(AppCatAbstractResource.LibraryPrepandPathConstants.DEPLOYMENT_ID, deploymentId);
+ ids.put(AppCatAbstractResource.LibraryPrepandPathConstants.NAME, path.getName());
+ if (prepandPathResource.isExists(ids)){
+ prepandPathResource = (LibraryPrepandPathAppCatalogResourceAppCat)prepandPathResource.get(ids);
+ }
+ prepandPathResource.setAppDeploymentResource(existingDep);
+ prepandPathResource.setName(path.getName());
+ prepandPathResource.setValue(path.getValue());
+ prepandPathResource.setDeploymentId(deploymentId);
+ prepandPathResource.save();
+ }
+ }
+
+ List<SetEnvPaths> libApendPaths = updatedDeployment.getLibAppendPaths();
+ // remove lib append paths
+ LibraryApendPathAppCatalogResourceAppCat apendPathResource = new LibraryApendPathAppCatalogResourceAppCat();
+ ids = new HashMap<String, String>();
+ ids.put(AppCatAbstractResource.LibraryApendPathConstants.DEPLOYMENT_ID, deploymentId);
+ apendPathResource.remove(ids);
+ if (libApendPaths != null && !libApendPaths.isEmpty()){
+ for (SetEnvPaths path : libApendPaths){
+ ids = new HashMap<String, String>();
+ ids.put(AppCatAbstractResource.LibraryApendPathConstants.DEPLOYMENT_ID, deploymentId);
+ ids.put(AppCatAbstractResource.LibraryApendPathConstants.NAME, path.getName());
+ if (apendPathResource.isExists(ids)){
+ apendPathResource = (LibraryApendPathAppCatalogResourceAppCat)apendPathResource.get(ids);
+ }
+ apendPathResource.setAppDeploymentResource(existingDep);
+ apendPathResource.setName(path.getName());
+ apendPathResource.setValue(path.getValue());
+ apendPathResource.setDeploymentId(deploymentId);
+ apendPathResource.save();
+ }
+ }
+
+ List<SetEnvPaths> setEnvironment = updatedDeployment.getSetEnvironment();
+ // remove existing setEnvPaths
+ AppEnvironmentAppCatalogResourceAppCat environmentResource = new AppEnvironmentAppCatalogResourceAppCat();
+ ids = new HashMap<String, String>();
+ ids.put(AppCatAbstractResource.AppEnvironmentConstants.DEPLOYMENT_ID, deploymentId);
+ environmentResource.remove(ids);
+ if (setEnvironment != null && !setEnvironment.isEmpty()){
+ for (SetEnvPaths path : setEnvironment){
+ ids = new HashMap<String, String>();
+ ids.put(AppCatAbstractResource.AppEnvironmentConstants.DEPLOYMENT_ID, deploymentId);
+ ids.put(AppCatAbstractResource.AppEnvironmentConstants.NAME, path.getName());
+ if (environmentResource.isExists(ids)){
+ environmentResource = (AppEnvironmentAppCatalogResourceAppCat)environmentResource.get(ids);
+ }
+ environmentResource.setAppDeploymentResource(existingDep);
+ environmentResource.setName(path.getName());
+ environmentResource.setValue(path.getValue());
+ environmentResource.setDeploymentId(deploymentId);
+ environmentResource.save();
+ }
+ }
+ }catch (Exception e) {
+ logger.error("Error while updating application deployment...", e);
+ throw new AppCatalogException(e);
+ }
+ }
+
+ @Override
+ public ApplicationDeploymentDescription getApplicationDeployement(String deploymentId) throws AppCatalogException {
+ try {
+ AppDeploymentAppCatalogResourceAppCat deploymentResource = new AppDeploymentAppCatalogResourceAppCat();
+ AppDeploymentAppCatalogResourceAppCat appDep = (AppDeploymentAppCatalogResourceAppCat)deploymentResource.get(deploymentId);
+ return AppCatalogThriftConversion.getApplicationDeploymentDescription(appDep);
+ }catch (Exception e) {
+ logger.error("Error while retrieving application deployment...", e);
+ throw new AppCatalogException(e);
+ }
+ }
+
+ @Override
+ public List<ApplicationDeploymentDescription> getApplicationDeployements(Map<String, String> filters) throws AppCatalogException {
+ List<ApplicationDeploymentDescription> deploymentDescriptions = new ArrayList<ApplicationDeploymentDescription>();
+ try {
+ AppDeploymentAppCatalogResourceAppCat resource = new AppDeploymentAppCatalogResourceAppCat();
+ boolean firstTry=true;
+ for (String fieldName : filters.keySet() ){
+ List<ApplicationDeploymentDescription> tmpDescriptions = new ArrayList<ApplicationDeploymentDescription>();
+ if (fieldName.equals(AppCatAbstractResource.ApplicationDeploymentConstants.APP_MODULE_ID)){
+ List<AppCatalogResource> resources = resource.get(AppCatAbstractResource.ApplicationDeploymentConstants.APP_MODULE_ID, filters.get(fieldName));
+ if (resources != null && !resources.isEmpty()){
+ tmpDescriptions = AppCatalogThriftConversion.getAppDepDescList(resources);
+ }
+ }else if (fieldName.equals(AppCatAbstractResource.ApplicationDeploymentConstants.COMPUTE_HOST_ID)){
+ List<AppCatalogResource> resources = resource.get(AppCatAbstractResource.ApplicationDeploymentConstants.COMPUTE_HOST_ID, filters.get(fieldName));
+ if (resources != null && !resources.isEmpty()){
+ tmpDescriptions = AppCatalogThriftConversion.getAppDepDescList(resources);
+ }
+ } else {
+ logger.error("Unsupported field name for app deployment.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for app deployment.");
+ }
+ if (firstTry){
+ deploymentDescriptions.addAll(tmpDescriptions);
+ firstTry=false;
+ }else{
+ List<String> ids=new ArrayList<String>();
+ for (ApplicationDeploymentDescription applicationDeploymentDescription : deploymentDescriptions) {
+ ids.add(applicationDeploymentDescription.getAppDeploymentId());
+ }
+ List<ApplicationDeploymentDescription> tmp2Descriptions = new ArrayList<ApplicationDeploymentDescription>();
+ for (ApplicationDeploymentDescription applicationDeploymentDescription : tmpDescriptions) {
+ if (ids.contains(applicationDeploymentDescription.getAppDeploymentId())){
+ tmp2Descriptions.add(applicationDeploymentDescription);
+ }
+ }
+ deploymentDescriptions.clear();
+ deploymentDescriptions.addAll(tmp2Descriptions);
+ }
+ }
+ }catch (Exception e){
+ logger.error("Error while retrieving app deployment list...", e);
+ throw new AppCatalogException(e);
+ }
+ return deploymentDescriptions;
+ }
+
+ @Override
+ public List<ApplicationDeploymentDescription> getAllApplicationDeployements(String gatewayId) throws AppCatalogException {
+ List<ApplicationDeploymentDescription> deploymentDescriptions = new ArrayList<ApplicationDeploymentDescription>();
+ try {
+ AppDeploymentAppCatalogResourceAppCat resource = new AppDeploymentAppCatalogResourceAppCat();
+ resource.setGatewayId(gatewayId);
+ List<AppCatalogResource> resources = resource.getAll();
+ if (resources != null && !resources.isEmpty()){
+ deploymentDescriptions = AppCatalogThriftConversion.getAppDepDescList(resources);
+ }
+
+ }catch (Exception e){
+ logger.error("Error while retrieving app deployment list...", e);
+ throw new AppCatalogException(e);
+ }
+ return deploymentDescriptions;
+ }
+
+ @Override
+ public List<String> getAllApplicationDeployementIds() throws AppCatalogException {
+ try {
+ AppDeploymentAppCatalogResourceAppCat resource = new AppDeploymentAppCatalogResourceAppCat();
+ return resource.getAllIds();
+ }catch (Exception e){
+ logger.error("Error while retrieving app deployment list...", e);
+ throw new AppCatalogException(e);
+ }
+ }
+
+ @Override
+ public boolean isAppDeploymentExists(String deploymentId) throws AppCatalogException {
+ try {
+ AppDeploymentAppCatalogResourceAppCat deploymentResource = new AppDeploymentAppCatalogResourceAppCat();
+ return deploymentResource.isExists(deploymentId);
+ }catch (Exception e){
+ logger.error("Error while retrieving app deployment...", e);
+ throw new AppCatalogException(e);
+ }
+ }
+
+ @Override
+ public void removeAppDeployment(String deploymentId) throws AppCatalogException {
+ try {
+ AppDeploymentAppCatalogResourceAppCat deploymentResource = new AppDeploymentAppCatalogResourceAppCat();
+ deploymentResource.remove(deploymentId);
+ }catch (Exception e){
+ logger.error("Error while deleting app deployment...", e);
+ throw new AppCatalogException(e);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/impl/ApplicationInterfaceImpl.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/impl/ApplicationInterfaceImpl.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/impl/ApplicationInterfaceImpl.java
new file mode 100644
index 0000000..c830f0a
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/impl/ApplicationInterfaceImpl.java
@@ -0,0 +1,450 @@
+/*
+ *
+ * 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.impl;
+
+import org.apache.airavata.model.appcatalog.appdeployment.ApplicationModule;
+import org.apache.airavata.model.appcatalog.appinterface.ApplicationInterfaceDescription;
+import org.apache.airavata.model.appcatalog.appinterface.InputDataObjectType;
+import org.apache.airavata.model.appcatalog.appinterface.OutputDataObjectType;
+import org.apache.airavata.model.appcatalog.appinterface.applicationInterfaceModelConstants;
+import org.apache.airavata.registry.core.app.catalog.resources.*;
+import org.apache.airavata.registry.core.app.catalog.util.AppCatalogThriftConversion;
+import org.apache.airavata.registry.core.app.catalog.util.AppCatalogUtils;
+import org.apache.airavata.registry.cpi.AppCatalogException;
+import org.apache.airavata.registry.cpi.ApplicationInterface;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+public class ApplicationInterfaceImpl implements ApplicationInterface {
+ private final static Logger logger = LoggerFactory.getLogger(ApplicationInterfaceImpl.class);
+
+ @Override
+ public String addApplicationModule(ApplicationModule applicationModule, String gatewayId) throws AppCatalogException {
+ try {
+ AppModuleAppCatalogResourceAppCat moduleResource = new AppModuleAppCatalogResourceAppCat();
+ moduleResource.setModuleName(applicationModule.getAppModuleName());
+ moduleResource.setGatewayId(gatewayId);
+ if (!applicationModule.getAppModuleId().equals("") && !applicationModule.getAppModuleId().equals(applicationInterfaceModelConstants.DEFAULT_ID)){
+ moduleResource.setModuleId(applicationModule.getAppModuleId());
+ }else {
+ moduleResource.setModuleId(AppCatalogUtils.getID(applicationModule.getAppModuleName()));
+ }
+ moduleResource.setModuleDesc(applicationModule.getAppModuleDescription());
+ moduleResource.setModuleVersion(applicationModule.getAppModuleVersion());
+ moduleResource.save();
+ applicationModule.setAppModuleId(moduleResource.getModuleId());
+ return moduleResource.getModuleId();
+ }catch (Exception e) {
+ logger.error("Error while adding application module "+applicationModule.getAppModuleName()+" ["+applicationModule.getAppModuleVersion()+"]", e);
+ throw new AppCatalogException(e);
+ }
+ }
+
+ @Override
+ public String addApplicationInterface(ApplicationInterfaceDescription applicationInterfaceDescription, String gatewayId) throws AppCatalogException {
+ try {
+ AppInterfaceAppCatalogResourceAppCat resource = new AppInterfaceAppCatalogResourceAppCat();
+ resource.setAppName(applicationInterfaceDescription.getApplicationName());
+ if (!applicationInterfaceDescription.getApplicationInterfaceId().equals("") && !applicationInterfaceDescription.getApplicationInterfaceId().equals(applicationInterfaceModelConstants.DEFAULT_ID)){
+ resource.setInterfaceId(applicationInterfaceDescription.getApplicationInterfaceId());
+ }else {
+ resource.setInterfaceId(AppCatalogUtils.getID(applicationInterfaceDescription.getApplicationName()));
+ }
+ resource.setAppDescription(applicationInterfaceDescription.getApplicationDescription());
+ resource.setGatewayId(gatewayId);
+ resource.save();
+ applicationInterfaceDescription.setApplicationInterfaceId(resource.getInterfaceId());
+
+ List<String> applicationModules = applicationInterfaceDescription.getApplicationModules();
+ if (applicationModules != null && !applicationModules.isEmpty()){
+ for (String moduleId : applicationModules){
+ AppModuleAppCatalogResourceAppCat appModuleResource = new AppModuleAppCatalogResourceAppCat();
+ AppModuleMappingAppCatalogResourceAppCat moduleMappingResource = new AppModuleMappingAppCatalogResourceAppCat();
+ moduleMappingResource.setInterfaceId(resource.getInterfaceId());
+ moduleMappingResource.setModuleId(moduleId);
+ moduleMappingResource.setModuleResource((AppModuleAppCatalogResourceAppCat)appModuleResource.get(moduleId));
+ moduleMappingResource.setAppInterfaceResource(resource);
+ moduleMappingResource.save();
+ }
+ }
+
+ List<InputDataObjectType> applicationInputs = applicationInterfaceDescription.getApplicationInputs();
+ if (applicationInputs != null && !applicationInputs.isEmpty()){
+ for (InputDataObjectType input : applicationInputs){
+ ApplicationInputAppCatalogResourceAppCat inputResource = new ApplicationInputAppCatalogResourceAppCat();
+ inputResource.setAppInterfaceResource(resource);
+ inputResource.setInterfaceID(resource.getInterfaceId());
+ inputResource.setUserFriendlyDesc(input.getUserFriendlyDescription());
+ inputResource.setInputKey(input.getName());
+ inputResource.setInputVal(input.getValue());
+ inputResource.setDataType(input.getType().toString());
+ inputResource.setMetadata(input.getMetaData());
+ inputResource.setStandardInput(input.isStandardInput());
+ inputResource.setAppArgument(input.getApplicationArgument());
+ inputResource.setInputOrder(input.getInputOrder());
+ inputResource.setRequired(input.isIsRequired());
+ inputResource.setRequiredToCMD(input.isRequiredToAddedToCommandLine());
+ inputResource.save();
+ }
+ }
+
+ List<OutputDataObjectType> applicationOutputs = applicationInterfaceDescription.getApplicationOutputs();
+ if (applicationOutputs != null && !applicationOutputs.isEmpty()) {
+ for (OutputDataObjectType output : applicationOutputs) {
+ ApplicationOutputAppCatalogResourceAppCat outputResource = new ApplicationOutputAppCatalogResourceAppCat();
+ outputResource.setInterfaceID(resource.getInterfaceId());
+ outputResource.setAppInterfaceResource(resource);
+ outputResource.setOutputKey(output.getName());
+ outputResource.setOutputVal(output.getValue());
+ outputResource.setDataType(output.getType().toString());
+ outputResource.setRequired(output.isIsRequired());
+ outputResource.setRequiredToCMD(output.isRequiredToAddedToCommandLine());
+ outputResource.setDataMovement(output.isDataMovement());
+ outputResource.setDataNameLocation(output.getLocation());
+ outputResource.setAppArgument(output.getApplicationArgument());
+ outputResource.setSearchQuery(output.getSearchQuery());
+ outputResource.save();
+ }
+ }
+ return resource.getInterfaceId();
+ }catch (Exception e) {
+ logger.error("Error while adding application interface "+applicationInterfaceDescription.getApplicationName(), e);
+ throw new AppCatalogException(e);
+ }
+ }
+
+ @Override
+ public void addApplicationModuleMapping(String moduleId, String interfaceId) throws AppCatalogException {
+ try {
+ AppModuleAppCatalogResourceAppCat appModuleResource = new AppModuleAppCatalogResourceAppCat();
+ AppInterfaceAppCatalogResourceAppCat interfaceResource = new AppInterfaceAppCatalogResourceAppCat();
+ AppModuleMappingAppCatalogResourceAppCat moduleMappingResource = new AppModuleMappingAppCatalogResourceAppCat();
+ moduleMappingResource.setInterfaceId(interfaceId);
+ moduleMappingResource.setModuleId(moduleId);
+ moduleMappingResource.setModuleResource((AppModuleAppCatalogResourceAppCat)appModuleResource.get(moduleId));
+ moduleMappingResource.setAppInterfaceResource((AppInterfaceAppCatalogResourceAppCat)interfaceResource.get(interfaceId));
+ moduleMappingResource.save();
+ }catch (Exception e) {
+ logger.error("Error while saving application module mapping "+moduleId, e);
+ throw new AppCatalogException(e);
+ }
+ }
+
+ @Override
+ public void updateApplicationModule(String moduleId, ApplicationModule updatedModule) throws AppCatalogException {
+ try {
+ AppModuleAppCatalogResourceAppCat moduleResource = new AppModuleAppCatalogResourceAppCat();
+ AppModuleAppCatalogResourceAppCat existingModule = (AppModuleAppCatalogResourceAppCat)moduleResource.get(moduleId);
+ existingModule.setModuleName(updatedModule.getAppModuleName());
+ existingModule.setModuleDesc(updatedModule.getAppModuleDescription());
+ existingModule.setModuleVersion(updatedModule.getAppModuleVersion());
+ existingModule.save();
+ }catch (Exception e) {
+ logger.error("Error while updating application module "+moduleId, e);
+ throw new AppCatalogException(e);
+ }
+ }
+
+ @Override
+ public void updateApplicationInterface(String interfaceId, ApplicationInterfaceDescription updatedInterface) throws AppCatalogException {
+ try {
+ AppInterfaceAppCatalogResourceAppCat resource = new AppInterfaceAppCatalogResourceAppCat();
+ AppInterfaceAppCatalogResourceAppCat existingInterface = (AppInterfaceAppCatalogResourceAppCat) resource.get(interfaceId);
+ existingInterface.setAppName(updatedInterface.getApplicationName());
+ existingInterface.setAppDescription(updatedInterface.getApplicationDescription());
+ existingInterface.save();
+
+ // remove existing modules before adding
+ Map<String, String> ids = new HashMap<String, String>();
+ ids.put(AppCatAbstractResource.AppModuleMappingConstants.INTERFACE_ID, interfaceId);
+ AppModuleMappingAppCatalogResourceAppCat moduleMappingResource = new AppModuleMappingAppCatalogResourceAppCat();
+ moduleMappingResource.remove(ids);
+ List<String> applicationModules = updatedInterface.getApplicationModules();
+ if (applicationModules != null && !applicationModules.isEmpty()) {
+ for (String moduleId : applicationModules) {
+ AppModuleAppCatalogResourceAppCat appModuleResource = new AppModuleAppCatalogResourceAppCat();
+ moduleMappingResource = new AppModuleMappingAppCatalogResourceAppCat();
+ ids = new HashMap<String, String>();
+ ids.put(AppCatAbstractResource.AppModuleMappingConstants.MODULE_ID, moduleId);
+ ids.put(AppCatAbstractResource.AppModuleMappingConstants.INTERFACE_ID, interfaceId);
+ AppModuleMappingAppCatalogResourceAppCat existingMapping;
+ if (!moduleMappingResource.isExists(ids)) {
+ existingMapping = new AppModuleMappingAppCatalogResourceAppCat();
+ } else {
+ existingMapping = (AppModuleMappingAppCatalogResourceAppCat) moduleMappingResource.get(ids);
+ }
+ existingMapping.setInterfaceId(interfaceId);
+ existingMapping.setModuleId(moduleId);
+ existingMapping.setModuleResource((AppModuleAppCatalogResourceAppCat) appModuleResource.get(moduleId));
+ existingMapping.setAppInterfaceResource(existingInterface);
+ existingMapping.save();
+ }
+ }
+
+ // remove existing application inputs
+ ApplicationInputAppCatalogResourceAppCat inputResource = new ApplicationInputAppCatalogResourceAppCat();
+ ids = new HashMap<String, String>();
+ ids.put(AppCatAbstractResource.AppInputConstants.INTERFACE_ID, interfaceId);
+ inputResource.remove(ids);
+ List<InputDataObjectType> applicationInputs = updatedInterface.getApplicationInputs();
+ if (applicationInputs != null && !applicationInputs.isEmpty()) {
+ for (InputDataObjectType input : applicationInputs) {
+ inputResource = new ApplicationInputAppCatalogResourceAppCat();
+ ids = new HashMap<String, String>();
+ ids.put(AppCatAbstractResource.AppInputConstants.INTERFACE_ID, interfaceId);
+ ids.put(AppCatAbstractResource.AppInputConstants.INPUT_KEY, input.getName());
+ if (inputResource.isExists(ids)) {
+ inputResource = (ApplicationInputAppCatalogResourceAppCat) inputResource.get(ids);
+ }
+ inputResource.setAppInterfaceResource(existingInterface);
+ inputResource.setInterfaceID(interfaceId);
+ inputResource.setUserFriendlyDesc(input.getUserFriendlyDescription());
+ inputResource.setInputKey(input.getName());
+ inputResource.setInputVal(input.getValue());
+ inputResource.setDataType(input.getType().toString());
+ inputResource.setMetadata(input.getMetaData());
+ inputResource.setStandardInput(input.isStandardInput());
+ inputResource.setAppArgument(input.getApplicationArgument());
+ inputResource.setInputOrder(input.getInputOrder());
+ inputResource.setRequired(input.isIsRequired());
+ inputResource.setRequiredToCMD(input.isRequiredToAddedToCommandLine());
+ inputResource.save();
+ }
+ }
+
+ // remove existing app outputs before adding
+ ApplicationOutputAppCatalogResourceAppCat outputResource = new ApplicationOutputAppCatalogResourceAppCat();
+ ids = new HashMap<String, String>();
+ ids.put(AppCatAbstractResource.AppOutputConstants.INTERFACE_ID, interfaceId);
+ outputResource.remove(ids);
+ List<OutputDataObjectType> applicationOutputs = updatedInterface.getApplicationOutputs();
+ if (applicationOutputs != null && !applicationOutputs.isEmpty()) {
+ for (OutputDataObjectType output : applicationOutputs) {
+ outputResource = new ApplicationOutputAppCatalogResourceAppCat();
+ ids = new HashMap<String, String>();
+ ids.put(AppCatAbstractResource.AppOutputConstants.INTERFACE_ID, interfaceId);
+ ids.put(AppCatAbstractResource.AppOutputConstants.OUTPUT_KEY, output.getName());
+ if (outputResource.isExists(ids)) {
+ outputResource = (ApplicationOutputAppCatalogResourceAppCat) outputResource.get(ids);
+ }
+ outputResource.setInterfaceID(interfaceId);
+ outputResource.setAppInterfaceResource(existingInterface);
+ outputResource.setOutputKey(output.getName());
+ outputResource.setOutputVal(output.getValue());
+ outputResource.setDataType(output.getType().toString());
+ outputResource.setRequired(output.isIsRequired());
+ outputResource.setRequiredToCMD(output.isRequiredToAddedToCommandLine());
+ outputResource.setDataMovement(output.isDataMovement());
+ outputResource.setDataNameLocation(output.getLocation());
+ outputResource.setAppArgument(output.getApplicationArgument());
+ outputResource.setSearchQuery(output.getSearchQuery());
+ outputResource.save();
+ }
+ }
+ } catch (Exception e) {
+ logger.error("Error while updating application interface " + interfaceId, e);
+ throw new AppCatalogException(e);
+ }
+ }
+
+ @Override
+ public ApplicationModule getApplicationModule(String moduleId) throws AppCatalogException {
+ try {
+ AppModuleAppCatalogResourceAppCat appModuleResource = new AppModuleAppCatalogResourceAppCat();
+ return AppCatalogThriftConversion.getApplicationModuleDesc((AppModuleAppCatalogResourceAppCat) appModuleResource.get(moduleId));
+ }catch (Exception e) {
+ logger.error("Error while retrieving application module "+moduleId, e);
+ throw new AppCatalogException(e);
+ }
+ }
+
+ @Override
+ public ApplicationInterfaceDescription getApplicationInterface(String interfaceId) throws AppCatalogException {
+ try {
+ AppInterfaceAppCatalogResourceAppCat interfaceResource = new AppInterfaceAppCatalogResourceAppCat();
+ return AppCatalogThriftConversion.getApplicationInterfaceDescription((AppInterfaceAppCatalogResourceAppCat)interfaceResource.get(interfaceId));
+ }catch (Exception e) {
+ logger.error("Error while retrieving application interface '"+interfaceId, e);
+ throw new AppCatalogException(e);
+ }
+ }
+
+ @Override
+ public List<ApplicationModule> getApplicationModules(Map<String, String> filters) throws AppCatalogException {
+ List<ApplicationModule> modules = new ArrayList<ApplicationModule>();
+ try {
+ AppModuleAppCatalogResourceAppCat resource = new AppModuleAppCatalogResourceAppCat();
+ for (String fieldName : filters.keySet() ){
+ if (fieldName.equals(AppCatAbstractResource.ApplicationModuleConstants.MODULE_NAME)){
+ List<AppCatalogResource> resources = resource.get(AppCatAbstractResource.ApplicationModuleConstants.MODULE_NAME, filters.get(fieldName));
+ if (resources != null && !resources.isEmpty()){
+ modules = AppCatalogThriftConversion.getAppModules(resources);
+ }
+ }else {
+ logger.error("Unsupported field name for app module.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for app module.");
+ }
+ }
+ }catch (Exception e){
+ logger.error("Error while retrieving app module list...", e);
+ throw new AppCatalogException(e);
+ }
+ return modules;
+ }
+
+ @Override
+ public List<ApplicationModule> getAllApplicationModules(String gatewayId) throws AppCatalogException {
+ List<ApplicationModule> applicationModules = new ArrayList<ApplicationModule>();
+ try {
+ AppModuleAppCatalogResourceAppCat resource = new AppModuleAppCatalogResourceAppCat();
+ resource.setGatewayId(gatewayId);
+ List<AppCatalogResource> resources = resource.getAll();
+ if (resources != null && !resources.isEmpty()){
+ applicationModules = AppCatalogThriftConversion.getAppModules(resources);
+ }
+ }catch (Exception e){
+ logger.error("Error while retrieving compute resource list...", e);
+ throw new AppCatalogException(e);
+ }
+ return applicationModules;
+ }
+
+ @Override
+ public List<ApplicationInterfaceDescription> getApplicationInterfaces(Map<String, String> filters) throws AppCatalogException {
+ List<ApplicationInterfaceDescription> appInterfaces = new ArrayList<ApplicationInterfaceDescription>();
+ try {
+ AppInterfaceAppCatalogResourceAppCat resource = new AppInterfaceAppCatalogResourceAppCat();
+ for (String fieldName : filters.keySet() ){
+ if (fieldName.equals(AppCatAbstractResource.ApplicationInterfaceConstants.APPLICATION_NAME)){
+ List<AppCatalogResource> resources = resource.get(AppCatAbstractResource.ApplicationInterfaceConstants.APPLICATION_NAME, filters.get(fieldName));
+ appInterfaces = AppCatalogThriftConversion.getAppInterfaceDescList(resources);
+ }else {
+ logger.error("Unsupported field name for app interface.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name '"+fieldName+"' for app interface.");
+ }
+ }
+ }catch (Exception e){
+ logger.error("Error while retrieving app interface list...", e);
+ throw new AppCatalogException(e);
+ }
+ return appInterfaces;
+ }
+
+ @Override
+ public List<ApplicationInterfaceDescription> getAllApplicationInterfaces(String gatewayId) throws AppCatalogException {
+ try {
+ AppInterfaceAppCatalogResourceAppCat resource = new AppInterfaceAppCatalogResourceAppCat();
+ resource.setGatewayId(gatewayId);
+ List<AppCatalogResource> resources = resource.getAll();
+ return AppCatalogThriftConversion.getAppInterfaceDescList(resources);
+ }catch (Exception e){
+ logger.error("Error while retrieving app interface list...", e);
+ throw new AppCatalogException(e);
+ }
+ }
+
+ @Override
+ public List<String> getAllApplicationInterfaceIds() throws AppCatalogException {
+ try {
+ AppInterfaceAppCatalogResourceAppCat resource = new AppInterfaceAppCatalogResourceAppCat();
+ return resource.getAllIds();
+ }catch (Exception e){
+ logger.error("Error while retrieving app interface list...", e);
+ throw new AppCatalogException(e);
+ }
+ }
+
+ @Override
+ public boolean removeApplicationInterface(String interfaceId) throws AppCatalogException {
+ try {
+ AppInterfaceAppCatalogResourceAppCat resource = new AppInterfaceAppCatalogResourceAppCat();
+ resource.remove(interfaceId);
+ return true;
+ }catch (Exception e){
+ logger.error("Error while removing app interface "+interfaceId, e);
+ throw new AppCatalogException(e);
+ }
+ }
+
+ @Override
+ public boolean removeApplicationModule(String moduleId) throws AppCatalogException {
+ try {
+ AppModuleAppCatalogResourceAppCat resource = new AppModuleAppCatalogResourceAppCat();
+ resource.remove(moduleId);
+ return true;
+ }catch (Exception e){
+ logger.error("Error while removing app module "+moduleId, e);
+ throw new AppCatalogException(e);
+ }
+ }
+
+ @Override
+ public boolean isApplicationInterfaceExists(String interfaceId) throws AppCatalogException {
+ try {
+ AppInterfaceAppCatalogResourceAppCat resource = new AppInterfaceAppCatalogResourceAppCat();
+ return resource.isExists(interfaceId);
+ }catch (Exception e){
+ logger.error("Error while checking app interface existence "+interfaceId, e);
+ throw new AppCatalogException(e);
+ }
+ }
+
+ @Override
+ public boolean isApplicationModuleExists(String moduleId) throws AppCatalogException {
+ try {
+ AppModuleAppCatalogResourceAppCat resource = new AppModuleAppCatalogResourceAppCat();
+ return resource.isExists(moduleId);
+ }catch (Exception e){
+ logger.error("Error while checking app module existence "+moduleId, e);
+ throw new AppCatalogException(e);
+ }
+ }
+
+ @Override
+ public List<InputDataObjectType> getApplicationInputs(String interfaceId) throws AppCatalogException {
+ try {
+ ApplicationInputAppCatalogResourceAppCat resource = new ApplicationInputAppCatalogResourceAppCat();
+ List<AppCatalogResource> resources = resource.get(AppCatAbstractResource.AppInputConstants.INTERFACE_ID, interfaceId);
+ return AppCatalogThriftConversion.getAppInputs(resources);
+ }catch (Exception e){
+ logger.error("Error while retrieving app inputs for application "+interfaceId, e);
+ throw new AppCatalogException(e);
+ }
+ }
+
+ @Override
+ public List<OutputDataObjectType> getApplicationOutputs(String interfaceId) throws AppCatalogException {
+ try {
+ ApplicationOutputAppCatalogResourceAppCat resource = new ApplicationOutputAppCatalogResourceAppCat();
+ List<AppCatalogResource> resources = resource.get(AppCatAbstractResource.AppOutputConstants.INTERFACE_ID, interfaceId);
+ return AppCatalogThriftConversion.getAppOutputs(resources);
+ }catch (Exception e){
+ logger.error("Error while retrieving app outputs for application "+interfaceId, e);
+ throw new AppCatalogException(e);
+ }
+ }
+}
[18/52] [abbrv] [partial] airavata git commit: registry refactoring
Posted by sh...@apache.org.
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/UnicoreJobSubmission.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/UnicoreJobSubmission.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/UnicoreJobSubmission.java
new file mode 100644
index 0000000..8395e40
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/UnicoreJobSubmission.java
@@ -0,0 +1,66 @@
+/*
+ *
+ * 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.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+@Entity
+@Table(name = "UNICORE_SUBMISSION")
+public class UnicoreJobSubmission {
+ @Id
+ @Column(name = "SUBMISSION_ID")
+ private String submissionID;
+ @Column(name = "SECURITY_PROTOCAL")
+ private String securityProtocol;
+
+ @Column(name = "UNICORE_ENDPOINT_URL")
+ private String unicoreEndpointUrl;
+
+ public String getUnicoreEndpointUrl() {
+ return unicoreEndpointUrl;
+ }
+
+ public void setUnicoreEndpointUrl(String unicoreEndpointUrl) {
+ this.unicoreEndpointUrl = unicoreEndpointUrl;
+ }
+
+
+ public String getSubmissionID() {
+ return submissionID;
+ }
+
+ public void setSubmissionID(String submissionID) {
+ this.submissionID = submissionID;
+ }
+
+ public String getSecurityProtocol() {
+ return securityProtocol;
+ }
+
+ public void setSecurityProtocol(String securityProtocol) {
+ this.securityProtocol = securityProtocol;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/Workflow.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/Workflow.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/Workflow.java
new file mode 100644
index 0000000..6520fd2
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/Workflow.java
@@ -0,0 +1,126 @@
+/*
+ *
+ * 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 org.apache.openjpa.persistence.DataCache;
+
+import javax.persistence.*;
+import java.io.Serializable;
+import java.sql.Timestamp;
+
+@DataCache
+@Entity
+@Table(name = "WORKFLOW")
+public class Workflow implements Serializable {
+
+ @Column(name = "WF_NAME")
+ private String wfName;
+
+ @Column(name = "CREATED_USER")
+ private String createdUser;
+
+ @Lob
+ @Column(name = "GRAPH")
+ private char[] graph;
+
+ @Id
+ @Column(name = "WF_TEMPLATE_ID")
+ private String wfTemplateId;
+
+ @Column(name = "CREATION_TIME")
+ private Timestamp creationTime;
+
+ @Column(name = "UPDATE_TIME")
+ private Timestamp updateTime;
+
+ @Lob
+ @Column(name = "IMAGE")
+ private byte[] image;
+
+ @Column(name = "GATEWAY_ID")
+ private String gatewayId;
+
+ public String getGatewayId() {
+ return gatewayId;
+ }
+
+ public void setGatewayId(String gatewayId) {
+ this.gatewayId = gatewayId;
+ }
+
+ public Timestamp getCreationTime() {
+ return creationTime;
+ }
+
+ public void setCreationTime(Timestamp creationTime) {
+ this.creationTime = creationTime;
+ }
+
+ public Timestamp getUpdateTime() {
+ return updateTime;
+ }
+
+ public void setUpdateTime(Timestamp updateTime) {
+ this.updateTime = updateTime;
+ }
+
+ public String getWfName() {
+ return wfName;
+ }
+
+ public String getCreatedUser() {
+ return createdUser;
+ }
+
+ public char[] getGraph() {
+ return graph;
+ }
+
+ public String getWfTemplateId() {
+ return wfTemplateId;
+ }
+
+ public void setWfName(String wfName) {
+ this.wfName=wfName;
+ }
+
+ public void setCreatedUser(String createdUser) {
+ this.createdUser=createdUser;
+ }
+
+ public void setGraph(char[] graph) {
+ this.graph=graph;
+ }
+
+ public void setWfTemplateId(String wfTemplateId) {
+ this.wfTemplateId=wfTemplateId;
+ }
+
+ public byte[] getImage() {
+ return image;
+ }
+
+ public void setImage(byte[] image) {
+ this.image = image;
+ }
+}
+
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/WorkflowInput.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/WorkflowInput.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/WorkflowInput.java
new file mode 100644
index 0000000..c559906
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/WorkflowInput.java
@@ -0,0 +1,167 @@
+/*
+ *
+ * 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.*;
+import java.io.Serializable;
+
+@Entity
+@Table(name = "WORKFLOW_INPUT")
+@IdClass(WorkflowInput_PK.class)
+public class WorkflowInput implements Serializable {
+ @Id
+ @Column(name = "WF_TEMPLATE_ID")
+ private String wfTemplateId;
+ @Id
+ @Column(name = "INPUT_KEY")
+ private String inputKey;
+ @Lob
+ @Column(name = "INPUT_VALUE")
+ private char[] inputVal;
+ @Column(name = "DATA_TYPE")
+ private String dataType;
+ @Column(name = "METADATA")
+ private String metadata;
+ @Column(name = "APP_ARGUMENT")
+ private String appArgument;
+ @Column(name = "USER_FRIENDLY_DESC")
+ private String userFriendlyDesc;
+ @Column(name = "STANDARD_INPUT")
+ private boolean standardInput;
+ @Column(name = "INPUT_ORDER")
+ private int inputOrder;
+ @Column(name="IS_REQUIRED")
+ private boolean isRequired;
+ @Column(name="REQUIRED_TO_COMMANDLINE")
+ private boolean requiredToCMD;
+ @Column(name = "DATA_STAGED")
+ private boolean dataStaged;
+
+ @ManyToOne(cascade = CascadeType.MERGE)
+ @JoinColumn(name = "WF_TEMPLATE_ID")
+ private Workflow workflow;
+
+ public String getWfTemplateId() {
+ return wfTemplateId;
+ }
+
+ public void setWfTemplateId(String wfTemplateId) {
+ this.wfTemplateId = wfTemplateId;
+ }
+
+ public String getInputKey() {
+ return inputKey;
+ }
+
+ public void setInputKey(String inputKey) {
+ this.inputKey = inputKey;
+ }
+
+ public char[] getInputVal() {
+ return inputVal;
+ }
+
+ public void setInputVal(char[] inputVal) {
+ this.inputVal = inputVal;
+ }
+
+ public String getDataType() {
+ return dataType;
+ }
+
+ public void setDataType(String dataType) {
+ this.dataType = dataType;
+ }
+
+ public String getMetadata() {
+ return metadata;
+ }
+
+ public void setMetadata(String metadata) {
+ this.metadata = metadata;
+ }
+
+ public String getAppArgument() {
+ return appArgument;
+ }
+
+ public void setAppArgument(String appArgument) {
+ this.appArgument = appArgument;
+ }
+
+ public String getUserFriendlyDesc() {
+ return userFriendlyDesc;
+ }
+
+ public void setUserFriendlyDesc(String userFriendlyDesc) {
+ this.userFriendlyDesc = userFriendlyDesc;
+ }
+
+ public Workflow getWorkflow() {
+ return workflow;
+ }
+
+ public void setWorkflow(Workflow workflow) {
+ this.workflow = workflow;
+ }
+
+ public boolean isStandardInput() {
+ return standardInput;
+ }
+
+ public void setStandardInput(boolean standardInput) {
+ this.standardInput = standardInput;
+ }
+
+ public int getInputOrder() {
+ return inputOrder;
+ }
+
+ public void setInputOrder(int inputOrder) {
+ this.inputOrder = inputOrder;
+ }
+
+ public boolean isRequired() {
+ return isRequired;
+ }
+
+ public void setRequired(boolean isRequired) {
+ this.isRequired = isRequired;
+ }
+
+ public boolean isRequiredToCMD() {
+ return requiredToCMD;
+ }
+
+ public void setRequiredToCMD(boolean requiredToCMD) {
+ this.requiredToCMD = requiredToCMD;
+ }
+
+ public boolean isDataStaged() {
+ return dataStaged;
+ }
+
+ public void setDataStaged(boolean dataStaged) {
+ this.dataStaged = dataStaged;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/WorkflowInput_PK.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/WorkflowInput_PK.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/WorkflowInput_PK.java
new file mode 100644
index 0000000..d72799c
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/WorkflowInput_PK.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 WorkflowInput_PK implements Serializable {
+ private String wfTemplateId;
+ private String inputKey;
+
+ public WorkflowInput_PK(String wfTemplateId, String inputKey) {
+ this.wfTemplateId = wfTemplateId;
+ this.inputKey = inputKey;
+ }
+
+ public WorkflowInput_PK() {
+ ;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ return false;
+ }
+
+ @Override
+ public int hashCode() {
+ return 1;
+ }
+
+ public String getWfTemplateId() {
+ return wfTemplateId;
+ }
+
+ public void setWfTemplateId(String wfTemplateId) {
+ this.wfTemplateId = wfTemplateId;
+ }
+
+ public String getInputKey() {
+ return inputKey;
+ }
+
+ public void setInputKey(String inputKey) {
+ this.inputKey = inputKey;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/WorkflowOutput.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/WorkflowOutput.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/WorkflowOutput.java
new file mode 100644
index 0000000..3080b0f
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/WorkflowOutput.java
@@ -0,0 +1,117 @@
+/*
+ *
+ * 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.*;
+import java.io.Serializable;
+
+@Entity
+@Table(name = "WORKFLOW_OUTPUT")
+@IdClass(WorkflowOutput_PK.class)
+public class WorkflowOutput implements Serializable {
+ @Id
+ @Column(name = "WF_TEMPLATE_ID")
+ private String wfTemplateId;
+ @Id
+ @Column(name = "OUTPUT_KEY")
+ private String outputKey;
+ @Lob
+ @Column(name = "OUTPUT_VALUE")
+ private char[] outputVal;
+ @Column(name = "DATA_TYPE")
+ private String dataType;
+ @Column(name = "VALIDITY_TYPE")
+ private String validityType;
+ @Column(name = "DATA_MOVEMENT")
+ private boolean dataMovement;
+ @Column(name = "DATA_NAME_LOCATION")
+ private String dataNameLocation;
+
+ @ManyToOne(cascade= CascadeType.MERGE)
+ @JoinColumn(name = "WF_TEMPLATE_ID")
+ private Workflow workflow;
+
+ public String getWfTemplateId() {
+ return wfTemplateId;
+ }
+
+ public void setWfTemplateId(String wfTemplateId) {
+ this.wfTemplateId = wfTemplateId;
+ }
+
+ public String getDataType() {
+ return dataType;
+ }
+
+ public void setDataType(String dataType) {
+ this.dataType = dataType;
+ }
+
+ public Workflow getWorkflow() {
+ return workflow;
+ }
+
+ public void setWorkflow(Workflow workflow) {
+ this.workflow = workflow;
+ }
+
+ public String getOutputKey() {
+ return outputKey;
+ }
+
+ public void setOutputKey(String outputKey) {
+ this.outputKey = outputKey;
+ }
+
+ public char[] getOutputVal() {
+ return outputVal;
+ }
+
+ public void setOutputVal(char[] outputVal) {
+ this.outputVal = outputVal;
+ }
+
+ public String getValidityType() {
+ return validityType;
+ }
+
+ public void setValidityType(String validityType) {
+ this.validityType = validityType;
+ }
+
+ public boolean isDataMovement() {
+ return dataMovement;
+ }
+
+ public void setDataMovement(boolean dataMovement) {
+ this.dataMovement = dataMovement;
+ }
+
+ public String getDataNameLocation() {
+ return dataNameLocation;
+ }
+
+ public void setDataNameLocation(String dataNameLocation) {
+ this.dataNameLocation = dataNameLocation;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/WorkflowOutput_PK.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/WorkflowOutput_PK.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/WorkflowOutput_PK.java
new file mode 100644
index 0000000..183afe8
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/WorkflowOutput_PK.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 WorkflowOutput_PK implements Serializable {
+ private String wfTemplateId;
+ private String outputKey;
+
+ public WorkflowOutput_PK(String wfTemplateId, String outputKey) {
+ this.wfTemplateId = wfTemplateId;
+ this.outputKey = outputKey;
+ }
+
+ public WorkflowOutput_PK() {
+ ;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ return false;
+ }
+
+ @Override
+ public int hashCode() {
+ return 1;
+ }
+
+ public String getWfTemplateId() {
+ return wfTemplateId;
+ }
+
+ public void setWfTemplateId(String wfTemplateId) {
+ this.wfTemplateId = wfTemplateId;
+ }
+
+ public String getOutputKey() {
+ return outputKey;
+ }
+
+ public void setOutputKey(String outputKey) {
+ this.outputKey = outputKey;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/AbstractResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/AbstractResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/AbstractResource.java
new file mode 100644
index 0000000..e1b042d
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/AbstractResource.java
@@ -0,0 +1,382 @@
+/*
+ *
+ * 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.aiaravata.application.catalog.data.resources;
+
+public abstract class AbstractResource implements Resource {
+ // table names
+ public static final String COMPUTE_RESOURCE = "ComputeResource";
+ public static final String HOST_ALIAS = "HostAlias";
+ public static final String HOST_IPADDRESS = "HostIPAddress";
+ public static final String GSISSH_SUBMISSION = "GSISSHSubmission";
+ public static final String GSISSH_EXPORT = "GSISSHExport";
+ public static final String PRE_JOBCOMMAND = "PreJobCommand";
+ public static final String POST_JOBCOMMAND = "PostJobCommand";
+ public static final String GLOBUS_SUBMISSION = "GlobusJobSubmission";
+ public static final String UNICORE_JOB_SUBMISSION = "UnicoreJobSubmission";
+ public static final String UNICORE_DATA_MOVEMENT = "UnicoreDataMovement";
+ public static final String GLOBUS_GK_ENDPOINT = "GlobusGKEndpoint";
+ public static final String SSH_SUBMISSION = "SSHSubmission";
+ public static final String SCP_DATA_MOVEMENT = "ScpDataMovement";
+ public static final String GRIDFTP_DATA_MOVEMENT = "GridftpDataMovement";
+ public static final String GRIDFTP_ENDPOINT = "GridftpEndpoint";
+ public static final String JOB_SUBMISSION_PROTOCOL = "JobSubmissionProtocol";
+ public static final String DATA_MOVEMENT_PROTOCOL = "DataMovementProtocol";
+ public static final String APPLICATION_MODULE = "ApplicationModule";
+ public static final String APPLICATION_DEPLOYMENT = "ApplicationDeployment";
+ public static final String LIBRARY_PREPAND_PATH = "LibraryPrepandPath";
+ public static final String LIBRARY_APEND_PATH = "LibraryApendPath";
+ public static final String APP_ENVIRONMENT = "AppEnvironment";
+ public static final String APPLICATION_INTERFACE = "ApplicationInterface";
+ public static final String APP_MODULE_MAPPING = "AppModuleMapping";
+ public static final String APPLICATION_INPUT = "ApplicationInput";
+ public static final String WORKFLOW_INPUT = "WorkflowInput";
+ public static final String APPLICATION_OUTPUT = "ApplicationOutput";
+ 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 BATCH_QUEUE = "BatchQueue";
+ public static final String COMPUTE_RESOURCE_FILE_SYSTEM = "ComputeResourceFileSystem";
+ public static final String JOB_SUBMISSION_INTERFACE = "JobSubmissionInterface";
+ public static final String DATA_MOVEMENT_INTERFACE = "DataMovementInterface";
+ public static final String RESOURCE_JOB_MANAGER = "ResourceJobManager";
+ public static final String JOB_MANAGER_COMMAND = "JobManagerCommand";
+ public static final String LOCAL_SUBMISSION = "LocalSubmission";
+ public static final String LOCAL_DATA_MOVEMENT = "LocalDataMovement";
+ public static final String SSH_JOB_SUBMISSION = "SshJobSubmission";
+ public static final String EMAIL_PROPERTY = "EmailMonitorProperty";
+ public static final String CLOUD_JOB_SUBMISSION = "CloudJobSubmission";
+ public static final String MODULE_LOAD_CMD = "ModuleLoadCmd";
+ public static final String WORKFLOW = "Workflow";
+
+ public final class EmailMonitorPropertyConstants {
+ public static final String JOB_SUBMISSION_INTERFACE_ID = "jobSubmissionId";
+ }
+
+ // Compute Resource Table
+ public final class ComputeResourceConstants {
+ public static final String RESOURCE_DESCRIPTION = "resourceDescription";
+ public static final String RESOURCE_ID = "resourceId";
+ public static final String HOST_NAME = "hostName";
+ }
+
+ // Host Alias Table
+ public final class HostAliasConstants {
+ public static final String RESOURCE_ID = "resourceID";
+ public static final String ALIAS = "alias";
+ }
+
+ // Host IPAddress Table
+ public final class HostIPAddressConstants {
+ public static final String RESOURCE_ID = "resourceID";
+ public static final String IP_ADDRESS = "ipaddress";
+ }
+
+ // GSSISSH Submission Table
+ public final class GSISSHSubmissionConstants {
+ public static final String SUBMISSION_ID = "submissionID";
+ public static final String RESOURCE_JOB_MANAGER = "resourceJobManager";
+ public static final String SSH_PORT = "sshPort";
+ public static final String INSTALLED_PATH = "installedPath";
+ public static final String MONITOR_MODE = "monitorMode";
+ }
+
+ // GSSISSH Export Table
+ public final class GSISSHExportConstants {
+ public static final String SUBMISSION_ID = "submissionID";
+ public static final String EXPORT = "export";
+ }
+
+ // GSSISSH Pre Job Command Table
+ public final class PreJobCommandConstants {
+ public static final String DEPLOYMENT_ID = "deploymentId";
+ public static final String COMMAND = "command";
+ }
+
+ // GSSISSH Post Job Command Table
+ public final class PostJobCommandConstants {
+ public static final String DEPLOYMENT_ID = "deploymentId";
+ public static final String COMMAND = "command";
+ }
+
+ // GSSISSH Post Job Command Table
+ public final class GlobusJobSubmissionConstants {
+ public static final String SUBMISSION_ID = "submissionID";
+ public static final String RESOURCE_JOB_MANAGER = "resourceJobManager";
+ public static final String SECURITY_PROTOCAL = "securityProtocol";
+ public static final String GLOBUS_GATEKEEPER_EP = "globusEP";
+ }
+
+ // Unicore Post Job Command Table
+ public final class UnicoreJobSubmissionConstants {
+ public static final String SUBMISSION_ID = "submissionID";
+ public static final String SECURITY_PROTOCAL = "securityProtocol";
+ public static final String UNICORE_ENDPOINT_URL = "unicoreEndpointUrl";
+
+ }
+
+ public final class UnicoreDataMovementConstants {
+ public static final String DATAMOVEMENT_ID = "dataMovementId";
+ public static final String SECURITY_PROTOCAL = "securityProtocol";
+ public static final String UNICORE_ENDPOINT_URL = "unicoreEndpointUrl";
+ }
+
+
+ public final class GlobusEPConstants{
+ public static final String SUBMISSION_ID = "submissionID";
+ public static final String ENDPOINT = "endpoint";
+ }
+
+ // GSSISSH Post Job Command Table
+ public final class SSHSubmissionConstants {
+ public static final String SUBMISSION_ID = "submissionID";
+ public static final String RESOURCE_JOB_MANAGER = "resourceJobManager";
+ public static final String SSH_PORT = "sshPort";
+ }
+
+ // Scp Data Movement Table
+ public final class ScpDataMovementConstants {
+ public static final String QUEUE_DESCRIPTION = "queueDescription";
+ public static final String DATA_MOVEMENT_INTERFACE_ID = "dataMovementInterfaceId";
+ public static final String SECURITY_PROTOCOL = "securityProtocol";
+ public static final String ALTERNATIVE_SCP_HOSTNAME = "alternativeScpHostname";
+ public static final String SSH_PORT = "sshPort";
+ }
+
+ public final class GridFTPDataMovementConstants {
+ public static final String DATA_MOVE_ID = "dataMoveID";
+ public static final String SECURITY_PROTOCOL = "securityProtocol";
+ public static final String GRID_FTP_EP = "gridFTPEP";
+ }
+
+ public final class GridFTPDMEPConstants{
+ public static final String DATA_MOVE_ID = "dataMoveId";
+ public static final String ENDPOINT = "endpoint";
+ }
+
+ public final class JobSubmissionProtocolConstants {
+ public static final String RESOURCE_ID = "resourceID";
+ public static final String SUBMISSION_ID = "submissionID";
+ public static final String JOB_TYPE = "jobType";
+ }
+
+ public final class DataMoveProtocolConstants {
+ public static final String RESOURCE_ID = "resourceID";
+ public static final String DATA_MOVE_ID = "dataMoveID";
+ public static final String DATA_MOVE_TYPE = "dataMoveType";
+ }
+
+ public final class ApplicationModuleConstants {
+ public static final String MODULE_ID = "moduleID";
+ public static final String GATEWAY_ID = "gatewayId";
+ public static final String MODULE_NAME = "moduleName";
+ public static final String MODULE_VERSION = "moduleVersion";
+ public static final String MODULE_DESC = "moduleDesc";
+ }
+
+ public final class ApplicationDeploymentConstants {
+ public static final String APP_MODULE_ID = "appModuleID";
+ public static final String DEPLOYMENT_ID = "deploymentID";
+ public static final String COMPUTE_HOST_ID = "hostID";
+ public static final String GATEWAY_ID = "gatewayId";
+ public static final String EXECUTABLE_PATH = "executablePath";
+ public static final String APPLICATION_DESC = "applicationDesc";
+ public static final String ENV_MODULE_LOAD_CMD = "envModuleLoaString";
+ public static final String PARALLELISM = "parallelism";
+ }
+
+ public final class LibraryPrepandPathConstants {
+ public static final String DEPLOYMENT_ID = "deploymentID";
+ public static final String NAME = "name";
+ public static final String VALUE = "value";
+ }
+
+ public final class LibraryApendPathConstants {
+ public static final String DEPLOYMENT_ID = "deploymentID";
+ public static final String NAME = "name";
+ public static final String VALUE = "value";
+ }
+
+ public final class AppEnvironmentConstants {
+ public static final String DEPLOYMENT_ID = "deploymentID";
+ public static final String NAME = "name";
+ public static final String VALUE = "value";
+ }
+
+ public final class ApplicationInterfaceConstants {
+ public static final String INTERFACE_ID = "interfaceID";
+ public static final String APPLICATION_NAME = "appName";
+ public static final String GATEWAY_ID = "gatewayId";
+ }
+
+ public final class AppModuleMappingConstants {
+ public static final String INTERFACE_ID = "interfaceID";
+ public static final String MODULE_ID = "moduleID";
+ }
+
+ public final class AppInputConstants {
+ public static final String INTERFACE_ID = "interfaceID";
+ public static final String INPUT_KEY = "inputKey";
+ public static final String INPUT_VALUE = "inputVal";
+ public static final String DATA_TYPE = "dataType";
+ public static final String METADATA = "metadata";
+ public static final String APP_ARGUMENT = "appArgument";
+ public static final String USER_FRIENDLY_DESC = "userFriendlyDesc";
+ public static final String STANDARD_INPUT = "standardInput";
+ }
+
+ public final class AppOutputConstants {
+ public static final String INTERFACE_ID = "interfaceID";
+ public static final String OUTPUT_KEY = "outputKey";
+ public static final String OUTPUT_VALUE = "outputVal";
+ public static final String DATA_TYPE = "dataType";
+ }
+
+ public final class WFInputConstants {
+ public static final String WF_TEMPLATE_ID = "wfTemplateId";
+ public static final String INPUT_KEY = "inputKey";
+ public static final String INPUT_VALUE = "inputVal";
+ public static final String DATA_TYPE = "dataType";
+ public static final String METADATA = "metadata";
+ public static final String APP_ARGUMENT = "appArgument";
+ public static final String USER_FRIENDLY_DESC = "userFriendlyDesc";
+ public static final String STANDARD_INPUT = "standardInput";
+ }
+
+ public final class WFOutputConstants {
+ public static final String WF_TEMPLATE_ID = "wfTemplateId";
+ public static final String OUTPUT_KEY = "outputKey";
+ public static final String OUTPUT_VALUE = "outputVal";
+ public static final String DATA_TYPE = "dataType";
+ }
+
+ public final class GatewayProfileConstants {
+ public static final String GATEWAY_ID = "gatewayID";
+ public static final String GATEWAY_DESC = "gatewayDesc";
+ }
+
+ public final class ComputeResourcePreferenceConstants {
+ public static final String GATEWAY_ID = "gatewayId";
+ public static final String RESOURCE_ID = "resourceId";
+ public static final String OVERRIDE_BY_AIRAVATA = "overrideByAiravata";
+ public static final String PREFERED_JOB_SUB_PROTOCOL = "preferedJobSubmissionProtocol";
+ public static final String PREFERED_DATA_MOVE_PROTOCOL = "preferedDataMoveProtocol";
+ public static final String PREFERED_BATCH_QUEUE = "batchQueue";
+ public static final String SCRATCH_LOCATION = "scratchLocation";
+ public static final String ALLOCATION_PROJECT_NUMBER = "projectNumber";
+ }
+
+ // Batch Queue Table
+ public final class BatchQueueConstants {
+ public static final String COMPUTE_RESOURCE_ID = "computeResourceId";
+ public static final String MAX_RUNTIME = "maxRuntime";
+ public static final String MAX_JOB_IN_QUEUE = "maxJobInQueue";
+ public static final String QUEUE_DESCRIPTION = "queueDescription";
+ public static final String QUEUE_NAME = "queueName";
+ public static final String MAX_PROCESSORS = "maxProcessors";
+ public static final String MAX_NODES = "maxNodes";
+ }
+
+ // Compute Resource File System Table
+ public final class ComputeResourceFileSystemConstants {
+ public static final String COMPUTE_RESOURCE_ID = "computeResourceId";
+ public static final String PATH = "path";
+ public static final String FILE_SYSTEM = "fileSystem";
+ }
+
+ // Job Submission Interface Table
+ public final class JobSubmissionInterfaceConstants {
+ public static final String JOB_SUBMISSION_INTERFACE_ID = "jobSubmissionInterfaceId";
+ public static final String COMPUTE_RESOURCE_ID = "computeResourceId";
+ public static final String JOB_SUBMISSION_PROTOCOL = "jobSubmissionProtocol";
+ public static final String PRIORITY_ORDER = "priorityOrder";
+ }
+
+ // Data Movement Interface Table
+ public final class DataMovementInterfaceConstants {
+ public static final String COMPUTE_RESOURCE_ID = "computeResourceId";
+ public static final String DATA_MOVEMENT_PROTOCOL = "dataMovementProtocol";
+ public static final String DATA_MOVEMENT_INTERFACE_ID = "dataMovementInterfaceId";
+ public static final String PRIORITY_ORDER = "priorityOrder";
+ }
+
+ // Resource Job Manager Table
+ public final class ResourceJobManagerConstants {
+ public static final String RESOURCE_JOB_MANAGER_ID = "resourceJobManagerId";
+ public static final String PUSH_MONITORING_ENDPOINT = "pushMonitoringEndpoint";
+ public static final String JOB_MANAGER_BIN_PATH = "jobManagerBinPath";
+ public static final String RESOURCE_JOB_MANAGER_TYPE = "resourceJobManagerType";
+ }
+
+ // Job Manager Command Table
+ public final class JobManagerCommandConstants {
+ public static final String RESOURCE_JOB_MANAGER_ID = "resourceJobManagerId";
+ public static final String COMMAND_TYPE = "commandType";
+ public static final String COMMAND = "command";
+ }
+
+ // Gridftp Data Movement Table
+ public final class GridftpDataMovementConstants {
+ public static final String DATA_MOVEMENT_INTERFACE_ID = "dataMovementInterfaceId";
+ public static final String SECURITY_PROTOCOL = "securityProtocol";
+ }
+
+ // Gridftp Endpoint Table
+ public final class GridftpEndpointConstants {
+ public static final String ENDPOINT = "endpoint";
+ public static final String DATA_MOVEMENT_INTERFACE_ID = "dataMovementInterfaceId";
+ }
+
+ // Local Submission Table
+ public final class LocalSubmissionConstants {
+ public static final String RESOURCE_JOB_MANAGER_ID = "resourceJobManagerId";
+ public static final String JOB_SUBMISSION_INTERFACE_ID = "jobSubmissionInterfaceId";
+ }
+
+ // Local Data Movement Table
+ public final class LocalDataMovementConstants {
+ public static final String DATA_MOVEMENT_INTERFACE_ID = "dataMovementInterfaceId";
+ }
+
+ // Ssh Job Submission Table
+ public final class SshJobSubmissionConstants {
+ public static final String RESOURCE_JOB_MANAGER_ID = "resourceJobManagerId";
+ public static final String JOB_SUBMISSION_INTERFACE_ID = "jobSubmissionInterfaceId";
+ public static final String ALTERNATIVE_SSH_HOSTNAME = "alternativeSshHostname";
+ public static final String SECURITY_PROTOCOL = "securityProtocol";
+ public static final String SSH_PORT = "sshPort";
+ }
+
+ // Module Load Cmd Table
+ public final class ModuleLoadCmdConstants {
+ public static final String CMD = "cmd";
+ public static final String APP_DEPLOYMENT_ID = "appDeploymentId";
+ }
+
+ // Workflow Table
+ public final class WorkflowConstants {
+ public static final String WF_NAME = "wfName";
+ public static final String CREATED_USER = "createdUser";
+ public static final String GRAPH = "graph";
+ public static final String WF_TEMPLATE_ID = "wfTemplateId";
+ public static final String GATEWAY_ID = "gatewayId";
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/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
new file mode 100644
index 0000000..7db1eb7
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/AppCatAbstractResource.java
@@ -0,0 +1,382 @@
+/*
+ *
+ * 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;
+
+public abstract class AppCatAbstractResource implements AppCatalogResource {
+ // table names
+ public static final String COMPUTE_RESOURCE = "ComputeResource";
+ public static final String HOST_ALIAS = "HostAlias";
+ public static final String HOST_IPADDRESS = "HostIPAddress";
+ public static final String GSISSH_SUBMISSION = "GSISSHSubmission";
+ public static final String GSISSH_EXPORT = "GSISSHExport";
+ public static final String PRE_JOBCOMMAND = "PreJobCommand";
+ public static final String POST_JOBCOMMAND = "PostJobCommand";
+ public static final String GLOBUS_SUBMISSION = "GlobusJobSubmission";
+ public static final String UNICORE_JOB_SUBMISSION = "UnicoreJobSubmission";
+ public static final String UNICORE_DATA_MOVEMENT = "UnicoreDataMovement";
+ public static final String GLOBUS_GK_ENDPOINT = "GlobusGKEndpoint";
+ public static final String SSH_SUBMISSION = "SSHSubmission";
+ public static final String SCP_DATA_MOVEMENT = "ScpDataMovement";
+ public static final String GRIDFTP_DATA_MOVEMENT = "GridftpDataMovement";
+ public static final String GRIDFTP_ENDPOINT = "GridftpEndpoint";
+ public static final String JOB_SUBMISSION_PROTOCOL = "JobSubmissionProtocol";
+ public static final String DATA_MOVEMENT_PROTOCOL = "DataMovementProtocol";
+ public static final String APPLICATION_MODULE = "ApplicationModule";
+ public static final String APPLICATION_DEPLOYMENT = "ApplicationDeployment";
+ public static final String LIBRARY_PREPAND_PATH = "LibraryPrepandPath";
+ public static final String LIBRARY_APEND_PATH = "LibraryApendPath";
+ public static final String APP_ENVIRONMENT = "AppEnvironment";
+ public static final String APPLICATION_INTERFACE = "ApplicationInterface";
+ public static final String APP_MODULE_MAPPING = "AppModuleMapping";
+ public static final String APPLICATION_INPUT = "ApplicationInput";
+ public static final String WORKFLOW_INPUT = "WorkflowInput";
+ public static final String APPLICATION_OUTPUT = "ApplicationOutput";
+ 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 BATCH_QUEUE = "BatchQueue";
+ public static final String COMPUTE_RESOURCE_FILE_SYSTEM = "ComputeResourceFileSystem";
+ public static final String JOB_SUBMISSION_INTERFACE = "JobSubmissionInterface";
+ public static final String DATA_MOVEMENT_INTERFACE = "DataMovementInterface";
+ public static final String RESOURCE_JOB_MANAGER = "ResourceJobManager";
+ public static final String JOB_MANAGER_COMMAND = "JobManagerCommand";
+ public static final String LOCAL_SUBMISSION = "LocalSubmission";
+ public static final String LOCAL_DATA_MOVEMENT = "LocalDataMovement";
+ public static final String SSH_JOB_SUBMISSION = "SshJobSubmission";
+ public static final String EMAIL_PROPERTY = "EmailMonitorProperty";
+ public static final String CLOUD_JOB_SUBMISSION = "CloudJobSubmission";
+ public static final String MODULE_LOAD_CMD = "ModuleLoadCmd";
+ public static final String WORKFLOW = "Workflow";
+
+ public final class EmailMonitorPropertyConstants {
+ public static final String JOB_SUBMISSION_INTERFACE_ID = "jobSubmissionId";
+ }
+
+ // Compute Resource Table
+ public final class ComputeResourceConstants {
+ public static final String RESOURCE_DESCRIPTION = "resourceDescription";
+ public static final String RESOURCE_ID = "resourceId";
+ public static final String HOST_NAME = "hostName";
+ }
+
+ // Host Alias Table
+ public final class HostAliasConstants {
+ public static final String RESOURCE_ID = "resourceID";
+ public static final String ALIAS = "alias";
+ }
+
+ // Host IPAddress Table
+ public final class HostIPAddressConstants {
+ public static final String RESOURCE_ID = "resourceID";
+ public static final String IP_ADDRESS = "ipaddress";
+ }
+
+ // GSSISSH Submission Table
+ public final class GSISSHSubmissionConstants {
+ public static final String SUBMISSION_ID = "submissionID";
+ public static final String RESOURCE_JOB_MANAGER = "resourceJobManager";
+ public static final String SSH_PORT = "sshPort";
+ public static final String INSTALLED_PATH = "installedPath";
+ public static final String MONITOR_MODE = "monitorMode";
+ }
+
+ // GSSISSH Export Table
+ public final class GSISSHExportConstants {
+ public static final String SUBMISSION_ID = "submissionID";
+ public static final String EXPORT = "export";
+ }
+
+ // GSSISSH Pre Job Command Table
+ public final class PreJobCommandConstants {
+ public static final String DEPLOYMENT_ID = "deploymentId";
+ public static final String COMMAND = "command";
+ }
+
+ // GSSISSH Post Job Command Table
+ public final class PostJobCommandConstants {
+ public static final String DEPLOYMENT_ID = "deploymentId";
+ public static final String COMMAND = "command";
+ }
+
+ // GSSISSH Post Job Command Table
+ public final class GlobusJobSubmissionConstants {
+ public static final String SUBMISSION_ID = "submissionID";
+ public static final String RESOURCE_JOB_MANAGER = "resourceJobManager";
+ public static final String SECURITY_PROTOCAL = "securityProtocol";
+ public static final String GLOBUS_GATEKEEPER_EP = "globusEP";
+ }
+
+ // Unicore Post Job Command Table
+ public final class UnicoreJobSubmissionConstants {
+ public static final String SUBMISSION_ID = "submissionID";
+ public static final String SECURITY_PROTOCAL = "securityProtocol";
+ public static final String UNICORE_ENDPOINT_URL = "unicoreEndpointUrl";
+
+ }
+
+ public final class UnicoreDataMovementConstants {
+ public static final String DATAMOVEMENT_ID = "dataMovementId";
+ public static final String SECURITY_PROTOCAL = "securityProtocol";
+ public static final String UNICORE_ENDPOINT_URL = "unicoreEndpointUrl";
+ }
+
+
+ public final class GlobusEPConstants{
+ public static final String SUBMISSION_ID = "submissionID";
+ public static final String ENDPOINT = "endpoint";
+ }
+
+ // GSSISSH Post Job Command Table
+ public final class SSHSubmissionConstants {
+ public static final String SUBMISSION_ID = "submissionID";
+ public static final String RESOURCE_JOB_MANAGER = "resourceJobManager";
+ public static final String SSH_PORT = "sshPort";
+ }
+
+ // Scp Data Movement Table
+ public final class ScpDataMovementConstants {
+ public static final String QUEUE_DESCRIPTION = "queueDescription";
+ public static final String DATA_MOVEMENT_INTERFACE_ID = "dataMovementInterfaceId";
+ public static final String SECURITY_PROTOCOL = "securityProtocol";
+ public static final String ALTERNATIVE_SCP_HOSTNAME = "alternativeScpHostname";
+ public static final String SSH_PORT = "sshPort";
+ }
+
+ public final class GridFTPDataMovementConstants {
+ public static final String DATA_MOVE_ID = "dataMoveID";
+ public static final String SECURITY_PROTOCOL = "securityProtocol";
+ public static final String GRID_FTP_EP = "gridFTPEP";
+ }
+
+ public final class GridFTPDMEPConstants{
+ public static final String DATA_MOVE_ID = "dataMoveId";
+ public static final String ENDPOINT = "endpoint";
+ }
+
+ public final class JobSubmissionProtocolConstants {
+ public static final String RESOURCE_ID = "resourceID";
+ public static final String SUBMISSION_ID = "submissionID";
+ public static final String JOB_TYPE = "jobType";
+ }
+
+ public final class DataMoveProtocolConstants {
+ public static final String RESOURCE_ID = "resourceID";
+ public static final String DATA_MOVE_ID = "dataMoveID";
+ public static final String DATA_MOVE_TYPE = "dataMoveType";
+ }
+
+ public final class ApplicationModuleConstants {
+ public static final String MODULE_ID = "moduleID";
+ public static final String GATEWAY_ID = "gatewayId";
+ public static final String MODULE_NAME = "moduleName";
+ public static final String MODULE_VERSION = "moduleVersion";
+ public static final String MODULE_DESC = "moduleDesc";
+ }
+
+ public final class ApplicationDeploymentConstants {
+ public static final String APP_MODULE_ID = "appModuleID";
+ public static final String DEPLOYMENT_ID = "deploymentID";
+ public static final String COMPUTE_HOST_ID = "hostID";
+ public static final String GATEWAY_ID = "gatewayId";
+ public static final String EXECUTABLE_PATH = "executablePath";
+ public static final String APPLICATION_DESC = "applicationDesc";
+ public static final String ENV_MODULE_LOAD_CMD = "envModuleLoaString";
+ public static final String PARALLELISM = "parallelism";
+ }
+
+ public final class LibraryPrepandPathConstants {
+ public static final String DEPLOYMENT_ID = "deploymentID";
+ public static final String NAME = "name";
+ public static final String VALUE = "value";
+ }
+
+ public final class LibraryApendPathConstants {
+ public static final String DEPLOYMENT_ID = "deploymentID";
+ public static final String NAME = "name";
+ public static final String VALUE = "value";
+ }
+
+ public final class AppEnvironmentConstants {
+ public static final String DEPLOYMENT_ID = "deploymentID";
+ public static final String NAME = "name";
+ public static final String VALUE = "value";
+ }
+
+ public final class ApplicationInterfaceConstants {
+ public static final String INTERFACE_ID = "interfaceID";
+ public static final String APPLICATION_NAME = "appName";
+ public static final String GATEWAY_ID = "gatewayId";
+ }
+
+ public final class AppModuleMappingConstants {
+ public static final String INTERFACE_ID = "interfaceID";
+ public static final String MODULE_ID = "moduleID";
+ }
+
+ public final class AppInputConstants {
+ public static final String INTERFACE_ID = "interfaceID";
+ public static final String INPUT_KEY = "inputKey";
+ public static final String INPUT_VALUE = "inputVal";
+ public static final String DATA_TYPE = "dataType";
+ public static final String METADATA = "metadata";
+ public static final String APP_ARGUMENT = "appArgument";
+ public static final String USER_FRIENDLY_DESC = "userFriendlyDesc";
+ public static final String STANDARD_INPUT = "standardInput";
+ }
+
+ public final class AppOutputConstants {
+ public static final String INTERFACE_ID = "interfaceID";
+ public static final String OUTPUT_KEY = "outputKey";
+ public static final String OUTPUT_VALUE = "outputVal";
+ public static final String DATA_TYPE = "dataType";
+ }
+
+ public final class WFInputConstants {
+ public static final String WF_TEMPLATE_ID = "wfTemplateId";
+ public static final String INPUT_KEY = "inputKey";
+ public static final String INPUT_VALUE = "inputVal";
+ public static final String DATA_TYPE = "dataType";
+ public static final String METADATA = "metadata";
+ public static final String APP_ARGUMENT = "appArgument";
+ public static final String USER_FRIENDLY_DESC = "userFriendlyDesc";
+ public static final String STANDARD_INPUT = "standardInput";
+ }
+
+ public final class WFOutputConstants {
+ public static final String WF_TEMPLATE_ID = "wfTemplateId";
+ public static final String OUTPUT_KEY = "outputKey";
+ public static final String OUTPUT_VALUE = "outputVal";
+ public static final String DATA_TYPE = "dataType";
+ }
+
+ public final class GatewayProfileConstants {
+ public static final String GATEWAY_ID = "gatewayID";
+ public static final String GATEWAY_DESC = "gatewayDesc";
+ }
+
+ public final class ComputeResourcePreferenceConstants {
+ public static final String GATEWAY_ID = "gatewayId";
+ public static final String RESOURCE_ID = "resourceId";
+ public static final String OVERRIDE_BY_AIRAVATA = "overrideByAiravata";
+ public static final String PREFERED_JOB_SUB_PROTOCOL = "preferedJobSubmissionProtocol";
+ public static final String PREFERED_DATA_MOVE_PROTOCOL = "preferedDataMoveProtocol";
+ public static final String PREFERED_BATCH_QUEUE = "batchQueue";
+ public static final String SCRATCH_LOCATION = "scratchLocation";
+ public static final String ALLOCATION_PROJECT_NUMBER = "projectNumber";
+ }
+
+ // Batch Queue Table
+ public final class BatchQueueConstants {
+ public static final String COMPUTE_RESOURCE_ID = "computeResourceId";
+ public static final String MAX_RUNTIME = "maxRuntime";
+ public static final String MAX_JOB_IN_QUEUE = "maxJobInQueue";
+ public static final String QUEUE_DESCRIPTION = "queueDescription";
+ public static final String QUEUE_NAME = "queueName";
+ public static final String MAX_PROCESSORS = "maxProcessors";
+ public static final String MAX_NODES = "maxNodes";
+ }
+
+ // Compute Resource File System Table
+ public final class ComputeResourceFileSystemConstants {
+ public static final String COMPUTE_RESOURCE_ID = "computeResourceId";
+ public static final String PATH = "path";
+ public static final String FILE_SYSTEM = "fileSystem";
+ }
+
+ // Job Submission Interface Table
+ public final class JobSubmissionInterfaceConstants {
+ public static final String JOB_SUBMISSION_INTERFACE_ID = "jobSubmissionInterfaceId";
+ public static final String COMPUTE_RESOURCE_ID = "computeResourceId";
+ public static final String JOB_SUBMISSION_PROTOCOL = "jobSubmissionProtocol";
+ public static final String PRIORITY_ORDER = "priorityOrder";
+ }
+
+ // Data Movement Interface Table
+ public final class DataMovementInterfaceConstants {
+ public static final String COMPUTE_RESOURCE_ID = "computeResourceId";
+ public static final String DATA_MOVEMENT_PROTOCOL = "dataMovementProtocol";
+ public static final String DATA_MOVEMENT_INTERFACE_ID = "dataMovementInterfaceId";
+ public static final String PRIORITY_ORDER = "priorityOrder";
+ }
+
+ // Resource Job Manager Table
+ public final class ResourceJobManagerConstants {
+ public static final String RESOURCE_JOB_MANAGER_ID = "resourceJobManagerId";
+ public static final String PUSH_MONITORING_ENDPOINT = "pushMonitoringEndpoint";
+ public static final String JOB_MANAGER_BIN_PATH = "jobManagerBinPath";
+ public static final String RESOURCE_JOB_MANAGER_TYPE = "resourceJobManagerType";
+ }
+
+ // Job Manager Command Table
+ public final class JobManagerCommandConstants {
+ public static final String RESOURCE_JOB_MANAGER_ID = "resourceJobManagerId";
+ public static final String COMMAND_TYPE = "commandType";
+ public static final String COMMAND = "command";
+ }
+
+ // Gridftp Data Movement Table
+ public final class GridftpDataMovementConstants {
+ public static final String DATA_MOVEMENT_INTERFACE_ID = "dataMovementInterfaceId";
+ public static final String SECURITY_PROTOCOL = "securityProtocol";
+ }
+
+ // Gridftp Endpoint Table
+ public final class GridftpEndpointConstants {
+ public static final String ENDPOINT = "endpoint";
+ public static final String DATA_MOVEMENT_INTERFACE_ID = "dataMovementInterfaceId";
+ }
+
+ // Local Submission Table
+ public final class LocalSubmissionConstants {
+ public static final String RESOURCE_JOB_MANAGER_ID = "resourceJobManagerId";
+ public static final String JOB_SUBMISSION_INTERFACE_ID = "jobSubmissionInterfaceId";
+ }
+
+ // Local Data Movement Table
+ public final class LocalDataMovementConstants {
+ public static final String DATA_MOVEMENT_INTERFACE_ID = "dataMovementInterfaceId";
+ }
+
+ // Ssh Job Submission Table
+ public final class SshJobSubmissionConstants {
+ public static final String RESOURCE_JOB_MANAGER_ID = "resourceJobManagerId";
+ public static final String JOB_SUBMISSION_INTERFACE_ID = "jobSubmissionInterfaceId";
+ public static final String ALTERNATIVE_SSH_HOSTNAME = "alternativeSshHostname";
+ public static final String SECURITY_PROTOCOL = "securityProtocol";
+ public static final String SSH_PORT = "sshPort";
+ }
+
+ // Module Load Cmd Table
+ public final class ModuleLoadCmdConstants {
+ public static final String CMD = "cmd";
+ public static final String APP_DEPLOYMENT_ID = "appDeploymentId";
+ }
+
+ // Workflow Table
+ public final class WorkflowConstants {
+ public static final String WF_NAME = "wfName";
+ public static final String CREATED_USER = "createdUser";
+ public static final String GRAPH = "graph";
+ public static final String WF_TEMPLATE_ID = "wfTemplateId";
+ public static final String GATEWAY_ID = "gatewayId";
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/AppCatalogResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/AppCatalogResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/AppCatalogResource.java
new file mode 100644
index 0000000..7492d9a
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/AppCatalogResource.java
@@ -0,0 +1,90 @@
+/*
+*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*
+*/
+package org.apache.airavata.registry.core.app.catalog.resources;
+
+
+import org.apache.airavata.registry.cpi.AppCatalogException;
+
+import java.util.List;
+
+public interface AppCatalogResource {
+
+ /**
+ * This method will remove the given resource from the database
+ *
+ * @param identifier identifier that can uniquely identify a single instance of the resource
+ */
+ void remove(Object identifier) throws AppCatalogException;
+
+ /**
+ * This method will return the given resource from the database
+ *
+ * @param identifier identifier that can uniquely identify a single instance of the resource
+ * @return associate resource
+ */
+ AppCatalogResource get(Object identifier) throws AppCatalogException;
+
+ /**
+ * This method will list all the resources according to the filtering criteria
+ * @param fieldName field name
+ * @param value value of the field
+ * @return list of resources
+ */
+ List<AppCatalogResource> get(String fieldName, Object value) throws AppCatalogException;
+
+ /**
+ *
+ * @return
+ * @throws AppCatalogException
+ */
+ List<AppCatalogResource> getAll() throws AppCatalogException;
+
+ /**
+ *
+ * @return
+ * @throws AppCatalogException
+ */
+ List<String> getAllIds() throws AppCatalogException;
+
+ /** This method will return list of resource ids according to given criteria
+ * @param fieldName field name
+ * @param value value of the field
+ * @return list of resource Ids
+ * @throws AppCatalogException
+ */
+ List<String> getIds(String fieldName, Object value) throws AppCatalogException;
+
+ /**
+ * This method will save the resource to the database.
+ */
+ void save() throws AppCatalogException;
+
+ /**
+ * This method will check whether an entry from the given resource and resource name
+ * exists in the database
+ *
+ * @param identifier identifier that can uniquely identify a single instance of the resource
+ * @return whether the entry exists in the database or not
+ */
+ boolean isExists(Object identifier) throws AppCatalogException;
+
+
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/AppDeploymentAppCatalogResourceAppCat.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/AppDeploymentAppCatalogResourceAppCat.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/AppDeploymentAppCatalogResourceAppCat.java
new file mode 100644
index 0000000..50136de
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/AppDeploymentAppCatalogResourceAppCat.java
@@ -0,0 +1,446 @@
+/*
+ *
+ * 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.common.utils.AiravataUtils;
+import org.apache.airavata.registry.core.app.catalog.model.ApplicationDeployment;
+import org.apache.airavata.registry.core.app.catalog.model.ApplicationModule;
+import org.apache.airavata.registry.core.app.catalog.model.ComputeResource;
+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.sql.Timestamp;
+import java.util.ArrayList;
+import java.util.List;
+
+public class AppDeploymentAppCatalogResourceAppCat extends AppCatAbstractResource {
+ private final static Logger logger = LoggerFactory.getLogger(AppDeploymentAppCatalogResourceAppCat.class);
+ private String deploymentId;
+ private String appModuleId;
+ private String hostId;
+ private String executablePath;
+ private String parallelism;
+ private String appDes;
+ private String gatewayId;
+ private ComputeResourceAppCatalogResourceAppCat hostResource;
+ private AppModuleAppCatalogResourceAppCat moduleResource;
+ private Timestamp createdTime;
+ private Timestamp updatedTime;
+
+ public String getGatewayId() {
+ return gatewayId;
+ }
+
+ public void setGatewayId(String gatewayId) {
+ this.gatewayId = gatewayId;
+ }
+
+ public Timestamp getCreatedTime() {
+ return createdTime;
+ }
+
+ public void setCreatedTime(Timestamp createdTime) {
+ this.createdTime = createdTime;
+ }
+
+ public Timestamp getUpdatedTime() {
+ return updatedTime;
+ }
+
+ public void setUpdatedTime(Timestamp updatedTime) {
+ this.updatedTime = updatedTime;
+ }
+
+ public String getDeploymentId() {
+ return deploymentId;
+ }
+
+ public void setDeploymentId(String deploymentId) {
+ this.deploymentId = deploymentId;
+ }
+
+ public String getAppModuleId() {
+ return appModuleId;
+ }
+
+ public void setAppModuleId(String appModuleId) {
+ this.appModuleId = appModuleId;
+ }
+
+ public String getHostId() {
+ return hostId;
+ }
+
+ public void setHostId(String hostId) {
+ this.hostId = hostId;
+ }
+
+ public String getExecutablePath() {
+ return executablePath;
+ }
+
+ public void setExecutablePath(String executablePath) {
+ this.executablePath = executablePath;
+ }
+
+ public String getAppDes() {
+ return appDes;
+ }
+
+ public void setAppDes(String appDes) {
+ this.appDes = appDes;
+ }
+
+ public ComputeResourceAppCatalogResourceAppCat getHostResource() {
+ return hostResource;
+ }
+
+ public void setHostResource(ComputeResourceAppCatalogResourceAppCat hostResource) {
+ this.hostResource = hostResource;
+ }
+
+ public AppModuleAppCatalogResourceAppCat getModuleResource() {
+ return moduleResource;
+ }
+
+ public void setModuleResource(AppModuleAppCatalogResourceAppCat moduleResource) {
+ this.moduleResource = moduleResource;
+ }
+
+ @Override
+ public void remove(Object identifier) throws AppCatalogException {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator= new AppCatalogQueryGenerator(APPLICATION_DEPLOYMENT);
+ generator.setParameter(ApplicationDeploymentConstants.DEPLOYMENT_ID, identifier);
+ 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 {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(APPLICATION_DEPLOYMENT);
+ generator.setParameter(ApplicationDeploymentConstants.DEPLOYMENT_ID, identifier);
+ Query q = generator.selectQuery(em);
+ ApplicationDeployment deployment = (ApplicationDeployment) q.getSingleResult();
+ AppDeploymentAppCatalogResourceAppCat deploymentResource =
+ (AppDeploymentAppCatalogResourceAppCat) AppCatalogJPAUtils.getResource(AppCatalogResourceType.APPLICATION_DEPLOYMENT, deployment);
+ em.getTransaction().commit();
+ em.close();
+ return deploymentResource;
+ } 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> appDeployments = new ArrayList<AppCatalogResource>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ Query q;
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(APPLICATION_DEPLOYMENT);
+ List results;
+ if (fieldName.equals(ApplicationDeploymentConstants.APP_MODULE_ID)) {
+ generator.setParameter(ApplicationDeploymentConstants.APP_MODULE_ID, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ ApplicationDeployment deployment = (ApplicationDeployment) result;
+ AppDeploymentAppCatalogResourceAppCat deploymentResource =
+ (AppDeploymentAppCatalogResourceAppCat) AppCatalogJPAUtils.getResource(AppCatalogResourceType.APPLICATION_DEPLOYMENT, deployment);
+ appDeployments.add(deploymentResource);
+ }
+ }
+ } else if (fieldName.equals(ApplicationDeploymentConstants.COMPUTE_HOST_ID)) {
+ generator.setParameter(ApplicationDeploymentConstants.COMPUTE_HOST_ID, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ ApplicationDeployment deployment = (ApplicationDeployment) result;
+ AppDeploymentAppCatalogResourceAppCat deploymentResource =
+ (AppDeploymentAppCatalogResourceAppCat) AppCatalogJPAUtils.getResource(AppCatalogResourceType.APPLICATION_DEPLOYMENT, deployment);
+ appDeployments.add(deploymentResource);
+ }
+ }
+ }else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for app deployment resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for app deployment 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 appDeployments;
+ }
+
+ @Override
+ public List<AppCatalogResource> getAll() throws AppCatalogException {
+ List<AppCatalogResource> appDeployments = new ArrayList<AppCatalogResource>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(APPLICATION_DEPLOYMENT);
+ generator.setParameter(ApplicationDeploymentConstants.GATEWAY_ID, gatewayId);
+ Query q = generator.selectQuery(em);
+ List results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ ApplicationDeployment deployment = (ApplicationDeployment) result;
+ AppDeploymentAppCatalogResourceAppCat deploymentResource =
+ (AppDeploymentAppCatalogResourceAppCat) AppCatalogJPAUtils.getResource(AppCatalogResourceType.APPLICATION_DEPLOYMENT, deployment);
+ appDeployments.add(deploymentResource);
+ }
+ }
+ 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 appDeployments;
+ }
+
+ @Override
+ public List<String> getAllIds() throws AppCatalogException {
+ List<String> appDeployments = new ArrayList<String>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(APPLICATION_DEPLOYMENT);
+ Query q = generator.selectQuery(em);
+ List results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ ApplicationDeployment deployment = (ApplicationDeployment) result;
+ appDeployments.add(deployment.getDeploymentID());
+ }
+ }
+ 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 appDeployments;
+ }
+
+ @Override
+ public List<String> getIds(String fieldName, Object value) throws AppCatalogException {
+ List<String> appDeployments = new ArrayList<String>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ Query q;
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(APPLICATION_DEPLOYMENT);
+ List results;
+ if (fieldName.equals(ApplicationDeploymentConstants.APP_MODULE_ID)) {
+ generator.setParameter(ApplicationDeploymentConstants.APP_MODULE_ID, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ ApplicationDeployment deployment = (ApplicationDeployment) result;
+ appDeployments.add(deployment.getDeploymentID());
+ }
+ }
+ } else if (fieldName.equals(ApplicationDeploymentConstants.COMPUTE_HOST_ID)) {
+ generator.setParameter(ApplicationDeploymentConstants.COMPUTE_HOST_ID, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ ApplicationDeployment deployment = (ApplicationDeployment) result;
+ appDeployments.add(deployment.getDeploymentID());
+ }
+ }
+ }else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for app deployment resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for app deployment 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 appDeployments;
+ }
+
+ @Override
+ public void save() throws AppCatalogException {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ ApplicationDeployment existingDeployment = em.find(ApplicationDeployment.class, deploymentId);
+ em.close();
+
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ ApplicationModule applicationModule = em.find(ApplicationModule.class, appModuleId);
+ ComputeResource computeHost = em.find(ComputeResource.class, hostId);
+ if (existingDeployment != null){
+ existingDeployment.setDeploymentID(deploymentId);
+ existingDeployment.setApplicationDesc(appDes);
+ existingDeployment.setAppModuleID(appModuleId);
+ existingDeployment.setApplicationModule(applicationModule);
+ existingDeployment.setComputeResource(computeHost);
+ existingDeployment.setHostID(hostId);
+ existingDeployment.setExecutablePath(executablePath);
+ existingDeployment.setParallelism(parallelism);
+ existingDeployment.setGatewayId(gatewayId);
+ existingDeployment.setUpdateTime(AiravataUtils.getCurrentTimestamp());
+ em.merge(existingDeployment);
+ }else {
+ ApplicationDeployment deployment = new ApplicationDeployment();
+ deployment.setApplicationDesc(appDes);
+ deployment.setDeploymentID(deploymentId);
+ deployment.setAppModuleID(appModuleId);
+ deployment.setHostID(hostId);
+ deployment.setApplicationModule(applicationModule);
+ deployment.setComputeResource(computeHost);
+ deployment.setExecutablePath(executablePath);
+ deployment.setParallelism(parallelism);
+ deployment.setGatewayId(gatewayId);
+ deployment.setCreationTime(AiravataUtils.getCurrentTimestamp());
+ em.persist(deployment);
+ }
+ 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 {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ ApplicationDeployment deployment = em.find(ApplicationDeployment.class, identifier);
+ em.close();
+ return deployment != null;
+ } 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();
+ }
+ }
+ }
+
+ public String getParallelism() {
+ return parallelism;
+ }
+
+ public void setParallelism(String parallelism) {
+ this.parallelism = parallelism;
+ }
+}
[12/52] [abbrv] [partial] airavata git commit: registry refactoring
Posted by sh...@apache.org.
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/GSISSHExportAppCatalogResourceAppCat.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/GSISSHExportAppCatalogResourceAppCat.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/GSISSHExportAppCatalogResourceAppCat.java
new file mode 100644
index 0000000..a127311
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/GSISSHExportAppCatalogResourceAppCat.java
@@ -0,0 +1,324 @@
+/**
+ * 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.GSISSHExport;
+import org.apache.airavata.registry.core.app.catalog.model.GSISSHExportPK;
+import org.apache.airavata.registry.core.app.catalog.model.GSISSHSubmission;
+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 GSISSHExportAppCatalogResourceAppCat extends AppCatAbstractResource {
+ private final static Logger logger = LoggerFactory.getLogger(GSISSHExportAppCatalogResourceAppCat.class);
+
+ private String submissionID;
+ private String export;
+
+ private GSISSHSubmissionAppCatalogResourceAppCat gsisshSubmissionResource;
+
+
+ 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(GSISSH_EXPORT);
+ generator.setParameter(GSISSHExportConstants.EXPORT, ids.get(GSISSHExportConstants.EXPORT));
+ generator.setParameter(GSISSHExportConstants.SUBMISSION_ID, ids.get(GSISSHExportConstants.SUBMISSION_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();
+ }
+ }
+ }
+
+ 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(GSISSH_EXPORT);
+ generator.setParameter(GSISSHExportConstants.SUBMISSION_ID, ids.get(GSISSHExportConstants.SUBMISSION_ID));
+ generator.setParameter(GSISSHExportConstants.EXPORT, ids.get(GSISSHExportConstants.EXPORT));
+ Query q = generator.selectQuery(em);
+ GSISSHExport gsisshExport = (GSISSHExport) q.getSingleResult();
+ GSISSHExportAppCatalogResourceAppCat gsisshExportResource =
+ (GSISSHExportAppCatalogResourceAppCat) AppCatalogJPAUtils.getResource(AppCatalogResourceType.GSISSH_EXPORT
+ , gsisshExport);
+ em.getTransaction().commit();
+ em.close();
+ return gsisshExportResource;
+ } 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();
+ }
+ }
+ }
+
+ public List<AppCatalogResource> get(String fieldName, Object value) throws AppCatalogException {
+ List<AppCatalogResource> gsiSSHExportResources = new ArrayList<AppCatalogResource>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ Query q;
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(GSISSH_EXPORT);
+ List results;
+ if (fieldName.equals(GSISSHExportConstants.EXPORT)) {
+ generator.setParameter(GSISSHExportConstants.EXPORT, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ GSISSHExport gsisshExport = (GSISSHExport) result;
+ GSISSHExportAppCatalogResourceAppCat gsisshExportResource =
+ (GSISSHExportAppCatalogResourceAppCat) AppCatalogJPAUtils.getResource(AppCatalogResourceType.GSISSH_EXPORT, gsisshExport);
+ gsiSSHExportResources.add(gsisshExportResource);
+ }
+ }
+ } else if (fieldName.equals(GSISSHExportConstants.SUBMISSION_ID)) {
+ generator.setParameter(GSISSHExportConstants.SUBMISSION_ID, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ GSISSHExport gsisshExport = (GSISSHExport) result;
+ GSISSHExportAppCatalogResourceAppCat gsisshExportResource =
+ (GSISSHExportAppCatalogResourceAppCat) AppCatalogJPAUtils.getResource(AppCatalogResourceType.GSISSH_EXPORT, gsisshExport);
+ gsiSSHExportResources.add(gsisshExportResource);
+ }
+ }
+ } else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for GSISSH Export Resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for GSISSH Export 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 gsiSSHExportResources;
+ }
+
+ @Override
+ public List<AppCatalogResource> getAll() throws AppCatalogException {
+ return null;
+ }
+
+ @Override
+ public List<String> getAllIds() throws AppCatalogException {
+ return null;
+ }
+
+ public List<String> getIds(String fieldName, Object value) throws AppCatalogException {
+ List<String> gsiSSHExportIDs = new ArrayList<String>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ Query q;
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(GSISSH_EXPORT);
+ List results;
+ if (fieldName.equals(GSISSHExportConstants.SUBMISSION_ID)) {
+ generator.setParameter(GSISSHExportConstants.SUBMISSION_ID, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ GSISSHExport gsisshExport = (GSISSHExport) result;
+ gsiSSHExportIDs.add(gsisshExport.getSubmissionID());
+ }
+ }
+ } else if (fieldName.equals(GSISSHExportConstants.EXPORT)) {
+ generator.setParameter(GSISSHExportConstants.EXPORT, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ GSISSHExport gsisshExport = (GSISSHExport) result;
+ gsiSSHExportIDs.add(gsisshExport.getSubmissionID());
+ }
+ }
+ } else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for GSISSH Export resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for GSISSH Export 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 gsiSSHExportIDs;
+ }
+
+ public void save() throws AppCatalogException {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ GSISSHExport existingGSIExport = em.find(GSISSHExport.class, new GSISSHExportPK(submissionID, export));
+ em.close();
+
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ GSISSHSubmission gsisshSubmission = em.find(GSISSHSubmission.class, submissionID);
+ if (existingGSIExport != null) {
+ existingGSIExport.setSubmissionID(submissionID);
+ existingGSIExport.setExport(export);
+ existingGSIExport.setGsisshJobSubmission(gsisshSubmission);
+ em.merge(existingGSIExport);
+ } else {
+ GSISSHExport gsisshExport = new GSISSHExport();
+ gsisshExport.setSubmissionID(submissionID);
+ gsisshExport.setExport(export);
+ gsisshExport.setGsisshJobSubmission(gsisshSubmission);
+ em.persist(gsisshExport);
+ }
+ 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();
+ }
+ }
+ }
+
+ 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();
+ GSISSHExport gsisshExport = em.find(GSISSHExport.class, new GSISSHExportPK(ids.get(GSISSHExportConstants.SUBMISSION_ID),
+ ids.get(GSISSHExportConstants.EXPORT)));
+
+ em.close();
+ return gsisshExport != null;
+ } 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();
+ }
+ } }
+
+ public String getSubmissionID() {
+ return submissionID;
+ }
+
+ public void setSubmissionID(String submissionID) {
+ this.submissionID = submissionID;
+ }
+
+ public String getExport() {
+ return export;
+ }
+
+ public void setExport(String export) {
+ this.export = export;
+ }
+
+ public GSISSHSubmissionAppCatalogResourceAppCat getGsisshSubmissionResource() {
+ return gsisshSubmissionResource;
+ }
+
+ public void setGsisshSubmissionResource(GSISSHSubmissionAppCatalogResourceAppCat gsisshSubmissionResource) {
+ this.gsisshSubmissionResource = gsisshSubmissionResource;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/GSISSHExportResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/GSISSHExportResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/GSISSHExportResource.java
new file mode 100644
index 0000000..92e2e43
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/GSISSHExportResource.java
@@ -0,0 +1,324 @@
+/**
+ * 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.aiaravata.application.catalog.data.resources;
+
+import org.airavata.appcatalog.cpi.AppCatalogException;
+import org.apache.aiaravata.application.catalog.data.model.GSISSHExport;
+import org.apache.aiaravata.application.catalog.data.model.GSISSHExportPK;
+import org.apache.aiaravata.application.catalog.data.model.GSISSHSubmission;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogJPAUtils;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogQueryGenerator;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogResourceType;
+import org.apache.airavata.common.exception.ApplicationSettingsException;
+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 GSISSHExportResource extends AbstractResource {
+ private final static Logger logger = LoggerFactory.getLogger(GSISSHExportResource.class);
+
+ private String submissionID;
+ private String export;
+
+ private GSISSHSubmissionResource gsisshSubmissionResource;
+
+
+ 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(GSISSH_EXPORT);
+ generator.setParameter(GSISSHExportConstants.EXPORT, ids.get(GSISSHExportConstants.EXPORT));
+ generator.setParameter(GSISSHExportConstants.SUBMISSION_ID, ids.get(GSISSHExportConstants.SUBMISSION_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();
+ }
+ }
+ }
+
+ public Resource 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(GSISSH_EXPORT);
+ generator.setParameter(GSISSHExportConstants.SUBMISSION_ID, ids.get(GSISSHExportConstants.SUBMISSION_ID));
+ generator.setParameter(GSISSHExportConstants.EXPORT, ids.get(GSISSHExportConstants.EXPORT));
+ Query q = generator.selectQuery(em);
+ GSISSHExport gsisshExport = (GSISSHExport) q.getSingleResult();
+ GSISSHExportResource gsisshExportResource =
+ (GSISSHExportResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.GSISSH_EXPORT
+ , gsisshExport);
+ em.getTransaction().commit();
+ em.close();
+ return gsisshExportResource;
+ } 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();
+ }
+ }
+ }
+
+ public List<Resource> get(String fieldName, Object value) throws AppCatalogException {
+ List<Resource> gsiSSHExportResources = new ArrayList<Resource>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ Query q;
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(GSISSH_EXPORT);
+ List results;
+ if (fieldName.equals(GSISSHExportConstants.EXPORT)) {
+ generator.setParameter(GSISSHExportConstants.EXPORT, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ GSISSHExport gsisshExport = (GSISSHExport) result;
+ GSISSHExportResource gsisshExportResource =
+ (GSISSHExportResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.GSISSH_EXPORT, gsisshExport);
+ gsiSSHExportResources.add(gsisshExportResource);
+ }
+ }
+ } else if (fieldName.equals(GSISSHExportConstants.SUBMISSION_ID)) {
+ generator.setParameter(GSISSHExportConstants.SUBMISSION_ID, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ GSISSHExport gsisshExport = (GSISSHExport) result;
+ GSISSHExportResource gsisshExportResource =
+ (GSISSHExportResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.GSISSH_EXPORT, gsisshExport);
+ gsiSSHExportResources.add(gsisshExportResource);
+ }
+ }
+ } else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for GSISSH Export Resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for GSISSH Export 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 gsiSSHExportResources;
+ }
+
+ @Override
+ public List<Resource> getAll() throws AppCatalogException {
+ return null;
+ }
+
+ @Override
+ public List<String> getAllIds() throws AppCatalogException {
+ return null;
+ }
+
+ public List<String> getIds(String fieldName, Object value) throws AppCatalogException {
+ List<String> gsiSSHExportIDs = new ArrayList<String>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ Query q;
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(GSISSH_EXPORT);
+ List results;
+ if (fieldName.equals(GSISSHExportConstants.SUBMISSION_ID)) {
+ generator.setParameter(GSISSHExportConstants.SUBMISSION_ID, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ GSISSHExport gsisshExport = (GSISSHExport) result;
+ gsiSSHExportIDs.add(gsisshExport.getSubmissionID());
+ }
+ }
+ } else if (fieldName.equals(GSISSHExportConstants.EXPORT)) {
+ generator.setParameter(GSISSHExportConstants.EXPORT, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ GSISSHExport gsisshExport = (GSISSHExport) result;
+ gsiSSHExportIDs.add(gsisshExport.getSubmissionID());
+ }
+ }
+ } else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for GSISSH Export resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for GSISSH Export 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 gsiSSHExportIDs;
+ }
+
+ public void save() throws AppCatalogException {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ GSISSHExport existingGSIExport = em.find(GSISSHExport.class, new GSISSHExportPK(submissionID, export));
+ em.close();
+
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ GSISSHSubmission gsisshSubmission = em.find(GSISSHSubmission.class, submissionID);
+ if (existingGSIExport != null) {
+ existingGSIExport.setSubmissionID(submissionID);
+ existingGSIExport.setExport(export);
+ existingGSIExport.setGsisshJobSubmission(gsisshSubmission);
+ em.merge(existingGSIExport);
+ } else {
+ GSISSHExport gsisshExport = new GSISSHExport();
+ gsisshExport.setSubmissionID(submissionID);
+ gsisshExport.setExport(export);
+ gsisshExport.setGsisshJobSubmission(gsisshSubmission);
+ em.persist(gsisshExport);
+ }
+ 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();
+ }
+ }
+ }
+
+ 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();
+ GSISSHExport gsisshExport = em.find(GSISSHExport.class, new GSISSHExportPK(ids.get(GSISSHExportConstants.SUBMISSION_ID),
+ ids.get(GSISSHExportConstants.EXPORT)));
+
+ em.close();
+ return gsisshExport != null;
+ } 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();
+ }
+ } }
+
+ public String getSubmissionID() {
+ return submissionID;
+ }
+
+ public void setSubmissionID(String submissionID) {
+ this.submissionID = submissionID;
+ }
+
+ public String getExport() {
+ return export;
+ }
+
+ public void setExport(String export) {
+ this.export = export;
+ }
+
+ public GSISSHSubmissionResource getGsisshSubmissionResource() {
+ return gsisshSubmissionResource;
+ }
+
+ public void setGsisshSubmissionResource(GSISSHSubmissionResource gsisshSubmissionResource) {
+ this.gsisshSubmissionResource = gsisshSubmissionResource;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/GSISSHSubmissionAppCatalogResourceAppCat.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/GSISSHSubmissionAppCatalogResourceAppCat.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/GSISSHSubmissionAppCatalogResourceAppCat.java
new file mode 100644
index 0000000..f2c5d5b
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/GSISSHSubmissionAppCatalogResourceAppCat.java
@@ -0,0 +1,373 @@
+/**
+ * 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.GSISSHSubmission;
+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.List;
+
+public class GSISSHSubmissionAppCatalogResourceAppCat extends AppCatAbstractResource {
+
+ private final static Logger logger = LoggerFactory.getLogger(GSISSHSubmissionAppCatalogResourceAppCat.class);
+
+ private String submissionID;
+ private String resourceJobManager;
+ private int sshPort;
+ private String installedPath;
+ private String monitorMode;
+
+ public void remove(Object identifier) throws AppCatalogException {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(GSISSH_SUBMISSION);
+ generator.setParameter(GSISSHSubmissionConstants.SUBMISSION_ID, identifier);
+ 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();
+ }
+ }
+ }
+
+ public AppCatalogResource get(Object identifier) throws AppCatalogException {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(GSISSH_SUBMISSION);
+ generator.setParameter(GSISSHSubmissionConstants.SUBMISSION_ID, identifier);
+ Query q = generator.selectQuery(em);
+ GSISSHSubmission gsisshSubmission = (GSISSHSubmission) q.getSingleResult();
+ GSISSHSubmissionAppCatalogResourceAppCat gsisshSubmissionResource =
+ (GSISSHSubmissionAppCatalogResourceAppCat) AppCatalogJPAUtils.getResource(AppCatalogResourceType.GSISSH_SUBMISSION
+ , gsisshSubmission);
+ em.getTransaction().commit();
+ em.close();
+ return gsisshSubmissionResource;
+ } 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();
+ }
+ }
+ }
+
+ public List<AppCatalogResource> get(String fieldName, Object value) throws AppCatalogException {
+ List<AppCatalogResource> gsiSSHSubmissionResourceList = new ArrayList<AppCatalogResource>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ Query q;
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(GSISSH_SUBMISSION);
+ List results;
+ if (fieldName.equals(GSISSHSubmissionConstants.MONITOR_MODE)) {
+ generator.setParameter(GSISSHSubmissionConstants.MONITOR_MODE, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ GSISSHSubmission gsisshSubmission = (GSISSHSubmission) result;
+ GSISSHSubmissionAppCatalogResourceAppCat gsisshSubmissionResource =
+ (GSISSHSubmissionAppCatalogResourceAppCat) AppCatalogJPAUtils.getResource(
+ AppCatalogResourceType.GSISSH_SUBMISSION, gsisshSubmission);
+ gsiSSHSubmissionResourceList.add(gsisshSubmissionResource);
+ }
+ }
+ } else if (fieldName.equals(GSISSHSubmissionConstants.INSTALLED_PATH)) {
+ generator.setParameter(GSISSHSubmissionConstants.INSTALLED_PATH, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ GSISSHSubmission gsisshSubmission = (GSISSHSubmission) result;
+ GSISSHSubmissionAppCatalogResourceAppCat gsisshSubmissionResource =
+ (GSISSHSubmissionAppCatalogResourceAppCat) AppCatalogJPAUtils.getResource(
+ AppCatalogResourceType.GSISSH_SUBMISSION, gsisshSubmission);
+ gsiSSHSubmissionResourceList.add(gsisshSubmissionResource);
+ }
+ }
+ } else if (fieldName.equals(GSISSHSubmissionConstants.SSH_PORT)) {
+ generator.setParameter(GSISSHSubmissionConstants.SSH_PORT, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ GSISSHSubmission gsisshSubmission = (GSISSHSubmission) result;
+ GSISSHSubmissionAppCatalogResourceAppCat gsisshSubmissionResource =
+ (GSISSHSubmissionAppCatalogResourceAppCat) AppCatalogJPAUtils.getResource(
+ AppCatalogResourceType.GSISSH_SUBMISSION, gsisshSubmission);
+ gsiSSHSubmissionResourceList.add(gsisshSubmissionResource);
+ }
+ }
+ } else if (fieldName.equals(GSISSHSubmissionConstants.RESOURCE_JOB_MANAGER)) {
+ generator.setParameter(GSISSHSubmissionConstants.RESOURCE_JOB_MANAGER, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ GSISSHSubmission gsisshSubmission = (GSISSHSubmission) result;
+ GSISSHSubmissionAppCatalogResourceAppCat gsisshSubmissionResource =
+ (GSISSHSubmissionAppCatalogResourceAppCat) AppCatalogJPAUtils.getResource(
+ AppCatalogResourceType.GSISSH_SUBMISSION, gsisshSubmission);
+ gsiSSHSubmissionResourceList.add(gsisshSubmissionResource);
+ }
+ }
+ } else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for GSISSH submission resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for GSISSH Submission 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 gsiSSHSubmissionResourceList;
+ }
+
+ @Override
+ public List<AppCatalogResource> getAll() throws AppCatalogException {
+ return null;
+ }
+
+ @Override
+ public List<String> getAllIds() throws AppCatalogException {
+ return null;
+ }
+
+ public List<String> getIds(String fieldName, Object value) throws AppCatalogException {
+ List<String> gsiSSHSubmissionResourceIDs = new ArrayList<String>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ Query q;
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(GSISSH_SUBMISSION);
+ List results;
+ if (fieldName.equals(GSISSHSubmissionConstants.SUBMISSION_ID)) {
+ generator.setParameter(GSISSHSubmissionConstants.SUBMISSION_ID, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ GSISSHSubmission gsisshSubmission = (GSISSHSubmission) result;
+ gsiSSHSubmissionResourceIDs.add(gsisshSubmission.getSubmissionID());
+ }
+ }
+ } else if (fieldName.equals(GSISSHSubmissionConstants.SSH_PORT)) {
+ generator.setParameter(GSISSHSubmissionConstants.SSH_PORT, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ GSISSHSubmission gsisshSubmission = (GSISSHSubmission) result;
+ gsiSSHSubmissionResourceIDs.add(gsisshSubmission.getSubmissionID());
+ }
+ }
+ } else if (fieldName.equals(GSISSHSubmissionConstants.MONITOR_MODE)) {
+ generator.setParameter(GSISSHSubmissionConstants.MONITOR_MODE, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ GSISSHSubmission gsisshSubmission = (GSISSHSubmission) result;
+ gsiSSHSubmissionResourceIDs.add(gsisshSubmission.getSubmissionID());
+ }
+ }
+ } else if (fieldName.equals(GSISSHSubmissionConstants.RESOURCE_JOB_MANAGER)) {
+ generator.setParameter(GSISSHSubmissionConstants.RESOURCE_JOB_MANAGER, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ GSISSHSubmission gsisshSubmission = (GSISSHSubmission) result;
+ gsiSSHSubmissionResourceIDs.add(gsisshSubmission.getSubmissionID());
+ }
+ }
+ } else if (fieldName.equals(GSISSHSubmissionConstants.INSTALLED_PATH)) {
+ generator.setParameter(GSISSHSubmissionConstants.INSTALLED_PATH, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ GSISSHSubmission gsisshSubmission = (GSISSHSubmission) result;
+ gsiSSHSubmissionResourceIDs.add(gsisshSubmission.getSubmissionID());
+ }
+ }
+ } else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for GSISSH Submission resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for GSISSH Submission 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 gsiSSHSubmissionResourceIDs;
+ }
+
+ public void save() throws AppCatalogException {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ GSISSHSubmission existingGSISSHSubmission = em.find(GSISSHSubmission.class, submissionID);
+ em.close();
+
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ if (existingGSISSHSubmission != null) {
+ existingGSISSHSubmission.setSubmissionID(submissionID);
+ existingGSISSHSubmission.setSshPort(sshPort);
+ existingGSISSHSubmission.setResourceJobManager(resourceJobManager);
+ existingGSISSHSubmission.setInstalledPath(installedPath);
+ existingGSISSHSubmission.setMonitorMode(monitorMode);
+ em.merge(existingGSISSHSubmission);
+ } else {
+ GSISSHSubmission gsisshSubmission = new GSISSHSubmission();
+ gsisshSubmission.setSubmissionID(submissionID);
+ gsisshSubmission.setSshPort(sshPort);
+ gsisshSubmission.setResourceJobManager(resourceJobManager);
+ gsisshSubmission.setInstalledPath(installedPath);
+ gsisshSubmission.setMonitorMode(monitorMode);
+ em.persist(gsisshSubmission);
+ }
+ 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();
+ }
+ }
+
+ }
+
+ public boolean isExists(Object identifier) throws AppCatalogException {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ GSISSHSubmission gsisshSubmission = em.find(GSISSHSubmission.class, identifier);
+ em.close();
+ return gsisshSubmission != null;
+ } 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();
+ }
+ }
+ }
+
+ public String getSubmissionID() {
+ return submissionID;
+ }
+
+ public void setSubmissionID(String submissionID) {
+ this.submissionID = submissionID;
+ }
+
+ public String getResourceJobManager() {
+ return resourceJobManager;
+ }
+
+ public void setResourceJobManager(String resourceJobManager) {
+ this.resourceJobManager = resourceJobManager;
+ }
+
+ public int getSshPort() {
+ return sshPort;
+ }
+
+ public void setSshPort(int sshPort) {
+ this.sshPort = sshPort;
+ }
+
+ public String getInstalledPath() {
+ return installedPath;
+ }
+
+ public void setInstalledPath(String installedPath) {
+ this.installedPath = installedPath;
+ }
+
+ public String getMonitorMode() {
+ return monitorMode;
+ }
+
+ public void setMonitorMode(String monitorMode) {
+ this.monitorMode = monitorMode;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/GSISSHSubmissionResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/GSISSHSubmissionResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/GSISSHSubmissionResource.java
new file mode 100644
index 0000000..938aa3f
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/GSISSHSubmissionResource.java
@@ -0,0 +1,373 @@
+/**
+ * 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.aiaravata.application.catalog.data.resources;
+
+import org.airavata.appcatalog.cpi.AppCatalogException;
+import org.apache.aiaravata.application.catalog.data.model.GSISSHSubmission;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogJPAUtils;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogQueryGenerator;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogResourceType;
+import org.apache.airavata.common.exception.ApplicationSettingsException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.persistence.EntityManager;
+import javax.persistence.Query;
+import java.util.ArrayList;
+import java.util.List;
+
+public class GSISSHSubmissionResource extends AbstractResource {
+
+ private final static Logger logger = LoggerFactory.getLogger(GSISSHSubmissionResource.class);
+
+ private String submissionID;
+ private String resourceJobManager;
+ private int sshPort;
+ private String installedPath;
+ private String monitorMode;
+
+ public void remove(Object identifier) throws AppCatalogException {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(GSISSH_SUBMISSION);
+ generator.setParameter(GSISSHSubmissionConstants.SUBMISSION_ID, identifier);
+ 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();
+ }
+ }
+ }
+
+ public Resource get(Object identifier) throws AppCatalogException {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(GSISSH_SUBMISSION);
+ generator.setParameter(GSISSHSubmissionConstants.SUBMISSION_ID, identifier);
+ Query q = generator.selectQuery(em);
+ GSISSHSubmission gsisshSubmission = (GSISSHSubmission) q.getSingleResult();
+ GSISSHSubmissionResource gsisshSubmissionResource =
+ (GSISSHSubmissionResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.GSISSH_SUBMISSION
+ , gsisshSubmission);
+ em.getTransaction().commit();
+ em.close();
+ return gsisshSubmissionResource;
+ } 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();
+ }
+ }
+ }
+
+ public List<Resource> get(String fieldName, Object value) throws AppCatalogException {
+ List<Resource> gsiSSHSubmissionResourceList = new ArrayList<Resource>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ Query q;
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(GSISSH_SUBMISSION);
+ List results;
+ if (fieldName.equals(GSISSHSubmissionConstants.MONITOR_MODE)) {
+ generator.setParameter(GSISSHSubmissionConstants.MONITOR_MODE, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ GSISSHSubmission gsisshSubmission = (GSISSHSubmission) result;
+ GSISSHSubmissionResource gsisshSubmissionResource =
+ (GSISSHSubmissionResource) AppCatalogJPAUtils.getResource(
+ AppCatalogResourceType.GSISSH_SUBMISSION, gsisshSubmission);
+ gsiSSHSubmissionResourceList.add(gsisshSubmissionResource);
+ }
+ }
+ } else if (fieldName.equals(GSISSHSubmissionConstants.INSTALLED_PATH)) {
+ generator.setParameter(GSISSHSubmissionConstants.INSTALLED_PATH, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ GSISSHSubmission gsisshSubmission = (GSISSHSubmission) result;
+ GSISSHSubmissionResource gsisshSubmissionResource =
+ (GSISSHSubmissionResource) AppCatalogJPAUtils.getResource(
+ AppCatalogResourceType.GSISSH_SUBMISSION, gsisshSubmission);
+ gsiSSHSubmissionResourceList.add(gsisshSubmissionResource);
+ }
+ }
+ } else if (fieldName.equals(GSISSHSubmissionConstants.SSH_PORT)) {
+ generator.setParameter(GSISSHSubmissionConstants.SSH_PORT, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ GSISSHSubmission gsisshSubmission = (GSISSHSubmission) result;
+ GSISSHSubmissionResource gsisshSubmissionResource =
+ (GSISSHSubmissionResource) AppCatalogJPAUtils.getResource(
+ AppCatalogResourceType.GSISSH_SUBMISSION, gsisshSubmission);
+ gsiSSHSubmissionResourceList.add(gsisshSubmissionResource);
+ }
+ }
+ } else if (fieldName.equals(GSISSHSubmissionConstants.RESOURCE_JOB_MANAGER)) {
+ generator.setParameter(GSISSHSubmissionConstants.RESOURCE_JOB_MANAGER, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ GSISSHSubmission gsisshSubmission = (GSISSHSubmission) result;
+ GSISSHSubmissionResource gsisshSubmissionResource =
+ (GSISSHSubmissionResource) AppCatalogJPAUtils.getResource(
+ AppCatalogResourceType.GSISSH_SUBMISSION, gsisshSubmission);
+ gsiSSHSubmissionResourceList.add(gsisshSubmissionResource);
+ }
+ }
+ } else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for GSISSH submission resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for GSISSH Submission 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 gsiSSHSubmissionResourceList;
+ }
+
+ @Override
+ public List<Resource> getAll() throws AppCatalogException {
+ return null;
+ }
+
+ @Override
+ public List<String> getAllIds() throws AppCatalogException {
+ return null;
+ }
+
+ public List<String> getIds(String fieldName, Object value) throws AppCatalogException {
+ List<String> gsiSSHSubmissionResourceIDs = new ArrayList<String>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ Query q;
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(GSISSH_SUBMISSION);
+ List results;
+ if (fieldName.equals(GSISSHSubmissionConstants.SUBMISSION_ID)) {
+ generator.setParameter(GSISSHSubmissionConstants.SUBMISSION_ID, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ GSISSHSubmission gsisshSubmission = (GSISSHSubmission) result;
+ gsiSSHSubmissionResourceIDs.add(gsisshSubmission.getSubmissionID());
+ }
+ }
+ } else if (fieldName.equals(GSISSHSubmissionConstants.SSH_PORT)) {
+ generator.setParameter(GSISSHSubmissionConstants.SSH_PORT, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ GSISSHSubmission gsisshSubmission = (GSISSHSubmission) result;
+ gsiSSHSubmissionResourceIDs.add(gsisshSubmission.getSubmissionID());
+ }
+ }
+ } else if (fieldName.equals(GSISSHSubmissionConstants.MONITOR_MODE)) {
+ generator.setParameter(GSISSHSubmissionConstants.MONITOR_MODE, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ GSISSHSubmission gsisshSubmission = (GSISSHSubmission) result;
+ gsiSSHSubmissionResourceIDs.add(gsisshSubmission.getSubmissionID());
+ }
+ }
+ } else if (fieldName.equals(GSISSHSubmissionConstants.RESOURCE_JOB_MANAGER)) {
+ generator.setParameter(GSISSHSubmissionConstants.RESOURCE_JOB_MANAGER, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ GSISSHSubmission gsisshSubmission = (GSISSHSubmission) result;
+ gsiSSHSubmissionResourceIDs.add(gsisshSubmission.getSubmissionID());
+ }
+ }
+ } else if (fieldName.equals(GSISSHSubmissionConstants.INSTALLED_PATH)) {
+ generator.setParameter(GSISSHSubmissionConstants.INSTALLED_PATH, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ GSISSHSubmission gsisshSubmission = (GSISSHSubmission) result;
+ gsiSSHSubmissionResourceIDs.add(gsisshSubmission.getSubmissionID());
+ }
+ }
+ } else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for GSISSH Submission resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for GSISSH Submission 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 gsiSSHSubmissionResourceIDs;
+ }
+
+ public void save() throws AppCatalogException {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ GSISSHSubmission existingGSISSHSubmission = em.find(GSISSHSubmission.class, submissionID);
+ em.close();
+
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ if (existingGSISSHSubmission != null) {
+ existingGSISSHSubmission.setSubmissionID(submissionID);
+ existingGSISSHSubmission.setSshPort(sshPort);
+ existingGSISSHSubmission.setResourceJobManager(resourceJobManager);
+ existingGSISSHSubmission.setInstalledPath(installedPath);
+ existingGSISSHSubmission.setMonitorMode(monitorMode);
+ em.merge(existingGSISSHSubmission);
+ } else {
+ GSISSHSubmission gsisshSubmission = new GSISSHSubmission();
+ gsisshSubmission.setSubmissionID(submissionID);
+ gsisshSubmission.setSshPort(sshPort);
+ gsisshSubmission.setResourceJobManager(resourceJobManager);
+ gsisshSubmission.setInstalledPath(installedPath);
+ gsisshSubmission.setMonitorMode(monitorMode);
+ em.persist(gsisshSubmission);
+ }
+ 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();
+ }
+ }
+
+ }
+
+ public boolean isExists(Object identifier) throws AppCatalogException {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ GSISSHSubmission gsisshSubmission = em.find(GSISSHSubmission.class, identifier);
+ em.close();
+ return gsisshSubmission != null;
+ } 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();
+ }
+ }
+ }
+
+ public String getSubmissionID() {
+ return submissionID;
+ }
+
+ public void setSubmissionID(String submissionID) {
+ this.submissionID = submissionID;
+ }
+
+ public String getResourceJobManager() {
+ return resourceJobManager;
+ }
+
+ public void setResourceJobManager(String resourceJobManager) {
+ this.resourceJobManager = resourceJobManager;
+ }
+
+ public int getSshPort() {
+ return sshPort;
+ }
+
+ public void setSshPort(int sshPort) {
+ this.sshPort = sshPort;
+ }
+
+ public String getInstalledPath() {
+ return installedPath;
+ }
+
+ public void setInstalledPath(String installedPath) {
+ this.installedPath = installedPath;
+ }
+
+ public String getMonitorMode() {
+ return monitorMode;
+ }
+
+ public void setMonitorMode(String monitorMode) {
+ this.monitorMode = monitorMode;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/GatewayProfileAppCatalogResourceAppCat.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/GatewayProfileAppCatalogResourceAppCat.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/GatewayProfileAppCatalogResourceAppCat.java
new file mode 100644
index 0000000..d5eaec8
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/GatewayProfileAppCatalogResourceAppCat.java
@@ -0,0 +1,318 @@
+/**
+ * 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.common.utils.AiravataUtils;
+import org.apache.airavata.registry.core.app.catalog.model.GatewayProfile;
+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.sql.Timestamp;
+import java.util.ArrayList;
+import java.util.List;
+
+public class GatewayProfileAppCatalogResourceAppCat extends AppCatAbstractResource {
+ private final static Logger logger = LoggerFactory.getLogger(GatewayProfileAppCatalogResourceAppCat.class);
+
+ private String gatewayID;
+ private Timestamp createdTime;
+ private Timestamp updatedTime;
+
+ public Timestamp getCreatedTime() {
+ return createdTime;
+ }
+
+ public void setCreatedTime(Timestamp createdTime) {
+ this.createdTime = createdTime;
+ }
+
+ public Timestamp getUpdatedTime() {
+ return updatedTime;
+ }
+
+ public void setUpdatedTime(Timestamp updatedTime) {
+ this.updatedTime = updatedTime;
+ }
+
+ public void remove(Object identifier) throws AppCatalogException {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(GATEWAY_PROFILE);
+ generator.setParameter(GatewayProfileConstants.GATEWAY_ID, identifier);
+ 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();
+ }
+ }
+ }
+
+ public AppCatalogResource get(Object identifier) throws AppCatalogException {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(GATEWAY_PROFILE);
+ generator.setParameter(GatewayProfileConstants.GATEWAY_ID, identifier);
+ Query q = generator.selectQuery(em);
+ GatewayProfile gatewayProfile = (GatewayProfile) q.getSingleResult();
+ GatewayProfileAppCatalogResourceAppCat gatewayProfileResource =
+ (GatewayProfileAppCatalogResourceAppCat) AppCatalogJPAUtils.getResource(
+ AppCatalogResourceType.GATEWAY_PROFILE, gatewayProfile);
+ em.getTransaction().commit();
+ em.close();
+ return gatewayProfileResource;
+ } 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();
+ }
+ }
+ }
+
+ public List<AppCatalogResource> get(String fieldName, Object value) throws AppCatalogException {
+ List<AppCatalogResource> gatewayProfileResources = new ArrayList<AppCatalogResource>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ Query q;
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(GATEWAY_PROFILE);
+ List results;
+ if (fieldName.equals(GatewayProfileConstants.GATEWAY_ID)) {
+ generator.setParameter(GatewayProfileConstants.GATEWAY_ID, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ GatewayProfile gatewayProfile = (GatewayProfile) result;
+ GatewayProfileAppCatalogResourceAppCat gatewayProfileResource =
+ (GatewayProfileAppCatalogResourceAppCat) AppCatalogJPAUtils.getResource(AppCatalogResourceType.GATEWAY_PROFILE, gatewayProfile);
+ gatewayProfileResources.add(gatewayProfileResource);
+ }
+ }
+ } else if (fieldName.equals(GatewayProfileConstants.GATEWAY_ID)) {
+ generator.setParameter(GatewayProfileConstants.GATEWAY_ID, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ GatewayProfile gatewayProfile = (GatewayProfile) result;
+ GatewayProfileAppCatalogResourceAppCat gatewayProfileResource =
+ (GatewayProfileAppCatalogResourceAppCat) AppCatalogJPAUtils.getResource(AppCatalogResourceType.GATEWAY_PROFILE, gatewayProfile);
+ gatewayProfileResources.add(gatewayProfileResource);
+ }
+ }
+ } else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for Gateway Profile resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for Gateway Profile 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 gatewayProfileResources;
+ }
+
+ @Override
+ public List<AppCatalogResource> getAll() throws AppCatalogException {
+ List<AppCatalogResource> resourceList = new ArrayList<AppCatalogResource>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(GATEWAY_PROFILE);
+ Query q = generator.selectQuery(em);
+ List results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ GatewayProfile gatewayProfile = (GatewayProfile) result;
+ GatewayProfileAppCatalogResourceAppCat gatewayProfileResource =
+ (GatewayProfileAppCatalogResourceAppCat) AppCatalogJPAUtils.getResource(AppCatalogResourceType.GATEWAY_PROFILE, gatewayProfile);
+ resourceList.add(gatewayProfileResource);
+ }
+ }
+ 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 resourceList;
+ }
+
+ @Override
+ public List<String> getAllIds() throws AppCatalogException {
+ return null;
+ }
+
+ public List<String> getIds(String fieldName, Object value) throws AppCatalogException {
+ List<String> gatewayProfileResourceIDs = new ArrayList<String>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ Query q;
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(GATEWAY_PROFILE);
+ List results;
+ if (fieldName.equals(GatewayProfileConstants.GATEWAY_ID)) {
+ generator.setParameter(GatewayProfileConstants.GATEWAY_ID, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ GatewayProfile gatewayProfile = (GatewayProfile) result;
+ gatewayProfileResourceIDs.add(gatewayProfile.getGatewayID());
+ }
+ }
+ } else if (fieldName.equals(GatewayProfileConstants.GATEWAY_ID)) {
+ generator.setParameter(GatewayProfileConstants.GATEWAY_ID, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ GatewayProfile gatewayProfile = (GatewayProfile) result;
+ gatewayProfileResourceIDs.add(gatewayProfile.getGatewayID());
+ }
+ }
+ } else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for Gateway Profile resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for Gateway Profile 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 gatewayProfileResourceIDs;
+ }
+
+ public void save() throws AppCatalogException {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ GatewayProfile existingGatewayProfile = em.find(GatewayProfile.class, gatewayID);
+ em.close();
+
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ if (existingGatewayProfile != null) {
+ existingGatewayProfile.setUpdateTime(AiravataUtils.getCurrentTimestamp());
+ em.merge(existingGatewayProfile);
+ } else {
+ GatewayProfile gatewayProfile = new GatewayProfile();
+ gatewayProfile.setGatewayID(gatewayID);
+ gatewayProfile.setCreationTime(AiravataUtils.getCurrentTimestamp());
+ em.persist(gatewayProfile);
+ }
+ 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();
+ }
+ }
+ }
+
+ public boolean isExists(Object identifier) throws AppCatalogException {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ GatewayProfile gatewayProfile = em.find(GatewayProfile.class, identifier);
+ em.close();
+ return gatewayProfile != null;
+ } 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();
+ }
+ }
+ }
+
+ public String getGatewayID() {
+ return gatewayID;
+ }
+
+ public void setGatewayID(String gatewayID) {
+ this.gatewayID = gatewayID;
+ }
+}
[02/52] [abbrv] [partial] airavata git commit: registry refactoring
Posted by sh...@apache.org.
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/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
new file mode 100644
index 0000000..cc0abc8
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/util/AppCatalogThriftConversion.java
@@ -0,0 +1,800 @@
+/*
+ *
+ * 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.util;
+
+import org.apache.airavata.model.Workflow;
+import org.apache.airavata.model.appcatalog.appdeployment.ApplicationDeploymentDescription;
+import org.apache.airavata.model.appcatalog.appdeployment.ApplicationModule;
+import org.apache.airavata.model.appcatalog.appdeployment.ApplicationParallelismType;
+import org.apache.airavata.model.appcatalog.appdeployment.SetEnvPaths;
+import org.apache.airavata.model.appcatalog.appinterface.*;
+import org.apache.airavata.model.appcatalog.computeresource.*;
+import org.apache.airavata.model.appcatalog.computeresource.BatchQueue;
+import org.apache.airavata.model.appcatalog.computeresource.CloudJobSubmission;
+import org.apache.airavata.model.appcatalog.computeresource.DataMovementInterface;
+import org.apache.airavata.model.appcatalog.computeresource.JobManagerCommand;
+import org.apache.airavata.model.appcatalog.computeresource.JobSubmissionInterface;
+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.GatewayResourceProfile;
+import org.apache.airavata.registry.core.app.catalog.resources.*;
+import org.apache.airavata.registry.cpi.AppCatalogException;
+
+import java.util.*;
+
+public class AppCatalogThriftConversion {
+ public static ComputeResourceAppCatalogResourceAppCat getComputeHostResource (ComputeResourceDescription description){
+ ComputeResourceAppCatalogResourceAppCat resource = new ComputeResourceAppCatalogResourceAppCat();
+ resource.setHostName(description.getHostName());
+ resource.setResourceDescription(description.getResourceDescription());
+ resource.setResourceId(description.getComputeResourceId());
+ resource.setMaxMemoryPerNode(description.getMaxMemoryPerNode());
+ return resource;
+ }
+
+ public static ComputeResourceDescription getComputeHostDescription (ComputeResourceAppCatalogResourceAppCat resource) throws AppCatalogException {
+ ComputeResourceDescription description = new ComputeResourceDescription();
+ description.setComputeResourceId(resource.getResourceId());
+ description.setHostName(resource.getHostName());
+ description.setResourceDescription(resource.getResourceDescription());
+ description.setMaxMemoryPerNode(resource.getMaxMemoryPerNode());
+ HostAliasAppCatalogResourceAppCat aliasResource = new HostAliasAppCatalogResourceAppCat();
+ List<AppCatalogResource> resources = aliasResource.get(AppCatAbstractResource.HostAliasConstants.RESOURCE_ID, resource.getResourceId());
+ if (resources != null && !resources.isEmpty()){
+ description.setHostAliases(getHostAliases(resources));
+ }
+ HostIPAddressAppCatalogResourceAppCat ipAddressResource = new HostIPAddressAppCatalogResourceAppCat();
+ List<AppCatalogResource> ipAddresses = ipAddressResource.get(AppCatAbstractResource.HostIPAddressConstants.RESOURCE_ID, resource.getResourceId());
+ if (ipAddresses != null && !ipAddresses.isEmpty()){
+ description.setIpAddresses(getIpAddresses(ipAddresses));
+ }
+
+ BatchQueueAppCatalogResourceAppCat bqResource = new BatchQueueAppCatalogResourceAppCat();
+ List<AppCatalogResource> batchQueues = bqResource.get(AppCatAbstractResource.BatchQueueConstants.COMPUTE_RESOURCE_ID, resource.getResourceId());
+ if (batchQueues != null && !batchQueues.isEmpty()){
+ description.setBatchQueues(getBatchQueues(batchQueues));
+ }
+
+ ComputeResourceFileSystemAppCatalogResourceAppCat fsResource = new ComputeResourceFileSystemAppCatalogResourceAppCat();
+ List<AppCatalogResource> fsList = fsResource.get(AppCatAbstractResource.ComputeResourceFileSystemConstants.COMPUTE_RESOURCE_ID, resource.getResourceId());
+ description.setFileSystems(new HashMap<FileSystems,String>());
+ if (fsList != null && !fsList.isEmpty()){
+ for (AppCatalogResource r : fsList) {
+ ComputeResourceFileSystemAppCatalogResourceAppCat rr=(ComputeResourceFileSystemAppCatalogResourceAppCat)r;
+ description.getFileSystems().put(FileSystems.valueOf(rr.getFileSystem()), rr.getPath());
+ }
+ }
+
+ JobSubmissionInterfaceAppCatalogResourceAppCat jsiResource = new JobSubmissionInterfaceAppCatalogResourceAppCat();
+ List<AppCatalogResource> hsiList = jsiResource.get(AppCatAbstractResource.JobSubmissionInterfaceConstants.COMPUTE_RESOURCE_ID, resource.getResourceId());
+ if (hsiList != null && !hsiList.isEmpty()){
+ description.setJobSubmissionInterfaces(getJobSubmissionInterfaces(hsiList));
+ }
+
+ DataMovementInterfaceAppCatalogResourceAppCat dmiResource = new DataMovementInterfaceAppCatalogResourceAppCat();
+ List<AppCatalogResource> dmiList = dmiResource.get(AppCatAbstractResource.DataMovementInterfaceConstants.COMPUTE_RESOURCE_ID, resource.getResourceId());
+ if (dmiList != null && !dmiList.isEmpty()){
+ description.setDataMovementInterfaces(getDataMovementInterfaces(dmiList));
+ }
+ return description;
+ }
+
+ public static List<ComputeResourceDescription> getComputeDescriptionList (List<AppCatalogResource> resources) throws AppCatalogException {
+ List<ComputeResourceDescription> list = new ArrayList<ComputeResourceDescription>();
+ for (AppCatalogResource resource : resources){
+ list.add(getComputeHostDescription((ComputeResourceAppCatalogResourceAppCat)resource));
+ }
+ return list;
+ }
+
+ public static List<String> getHostAliases (List<AppCatalogResource> resources){
+ List<String> hostAliases = new ArrayList<String>();
+ for (AppCatalogResource alias : resources){
+ hostAliases.add(((HostAliasAppCatalogResourceAppCat)alias).getAlias());
+ }
+ return hostAliases;
+ }
+
+ public static List<String> getIpAddresses (List<AppCatalogResource> resources){
+ List<String> hostIpAddresses = new ArrayList<String>();
+ for (AppCatalogResource resource : resources){
+ hostIpAddresses.add(((HostIPAddressAppCatalogResourceAppCat)resource).getIpaddress());
+ }
+ return hostIpAddresses;
+ }
+
+ public static List<BatchQueue> getBatchQueues (List<AppCatalogResource> resources){
+ List<BatchQueue> batchQueues = new ArrayList<BatchQueue>();
+ for (AppCatalogResource resource : resources){
+ batchQueues.add(getBatchQueue((BatchQueueAppCatalogResourceAppCat)resource));
+ }
+ return batchQueues;
+ }
+
+ public static List<DataMovementInterface> getDataMovementInterfaces(List<AppCatalogResource> resources){
+ List<DataMovementInterface> dataMovementInterfaces = new ArrayList<DataMovementInterface>();
+ for (AppCatalogResource resource : resources){
+ dataMovementInterfaces.add(getDataMovementInterface((DataMovementInterfaceAppCatalogResourceAppCat)resource));
+ }
+ return dataMovementInterfaces;
+ }
+
+ public static DataMovementInterface getDataMovementInterface(DataMovementInterfaceAppCatalogResourceAppCat resource){
+ DataMovementInterface dmi = new DataMovementInterface();
+ dmi.setDataMovementInterfaceId(resource.getDataMovementInterfaceId());
+ dmi.setDataMovementProtocol(DataMovementProtocol.valueOf(resource.getDataMovementProtocol()));
+ dmi.setPriorityOrder(resource.getPriorityOrder());
+ return dmi;
+ }
+
+ public static DataMovementInterfaceAppCatalogResourceAppCat getDataMovementInterface(DataMovementInterface resource){
+ DataMovementInterfaceAppCatalogResourceAppCat dmi = new DataMovementInterfaceAppCatalogResourceAppCat();
+ dmi.setDataMovementInterfaceId(resource.getDataMovementInterfaceId());
+ dmi.setDataMovementProtocol(resource.getDataMovementProtocol().toString());
+ dmi.setPriorityOrder(resource.getPriorityOrder());
+ return dmi;
+ }
+
+ public static List<JobSubmissionInterface> getJobSubmissionInterfaces(List<AppCatalogResource> resources){
+ List<JobSubmissionInterface> jobSubmissionInterfaces = new ArrayList<JobSubmissionInterface>();
+ for (AppCatalogResource resource : resources){
+ jobSubmissionInterfaces.add(getJobSubmissionInterface((JobSubmissionInterfaceAppCatalogResourceAppCat)resource));
+ }
+ return jobSubmissionInterfaces;
+ }
+
+ public static JobSubmissionInterface getJobSubmissionInterface(JobSubmissionInterfaceAppCatalogResourceAppCat resource){
+ JobSubmissionInterface jsi = new JobSubmissionInterface();
+ jsi.setJobSubmissionInterfaceId(resource.getJobSubmissionInterfaceId());
+ jsi.setJobSubmissionProtocol(JobSubmissionProtocol.valueOf(resource.getJobSubmissionProtocol()));
+ jsi.setPriorityOrder(resource.getPriorityOrder());
+ return jsi;
+ }
+
+ public static JobSubmissionInterfaceAppCatalogResourceAppCat getJobSubmissionInterface(JobSubmissionInterface resource){
+ JobSubmissionInterfaceAppCatalogResourceAppCat jsi = new JobSubmissionInterfaceAppCatalogResourceAppCat();
+ jsi.setJobSubmissionInterfaceId(resource.getJobSubmissionInterfaceId());
+ jsi.setJobSubmissionProtocol(resource.getJobSubmissionProtocol().toString());
+ jsi.setPriorityOrder(resource.getPriorityOrder());
+ return jsi;
+ }
+
+ public static BatchQueue getBatchQueue(BatchQueueAppCatalogResourceAppCat resource){
+ BatchQueue batchQueue = new BatchQueue();
+ batchQueue.setMaxJobsInQueue(resource.getMaxJobInQueue());
+ batchQueue.setMaxNodes(resource.getMaxNodes());
+ batchQueue.setMaxProcessors(resource.getMaxProcessors());
+ batchQueue.setMaxRunTime(resource.getMaxRuntime());
+ batchQueue.setMaxMemory(resource.getMaxMemory());
+ batchQueue.setQueueDescription(resource.getQueueDescription());
+ batchQueue.setQueueName(resource.getQueueName());
+ return batchQueue;
+ }
+
+ public static BatchQueueAppCatalogResourceAppCat getBatchQueue(BatchQueue resource){
+ BatchQueueAppCatalogResourceAppCat batchQueue = new BatchQueueAppCatalogResourceAppCat();
+ batchQueue.setMaxJobInQueue(resource.getMaxJobsInQueue());
+ batchQueue.setMaxNodes(resource.getMaxNodes());
+ batchQueue.setMaxProcessors(resource.getMaxProcessors());
+ batchQueue.setMaxRuntime(resource.getMaxRunTime());
+ batchQueue.setQueueDescription(resource.getQueueDescription());
+ batchQueue.setQueueName(resource.getQueueName());
+ batchQueue.setMaxMemory(resource.getMaxMemory());
+ return batchQueue;
+ }
+
+// public static Map<String, JobSubmissionProtocol> getJobSubmissionProtocolList(List<Resource> resources){
+// Map<String, JobSubmissionProtocol> protocols = new HashMap<String, JobSubmissionProtocol>();
+// for (Resource resource : resources){
+// JobSubmissionProtocolResource submission = (JobSubmissionProtocolResource) resource;
+// protocols.put(submission.getSubmissionID(), JobSubmissionProtocol.valueOf(submission.getJobType()));
+// }
+// return protocols;
+// }
+
+// public static Map<String, DataMovementProtocol> getDataMoveProtocolList(List<Resource> resources){
+// Map<String, DataMovementProtocol> protocols = new HashMap<String, DataMovementProtocol>();
+// for (Resource resource : resources){
+// DataMovementProtocolResource protocolResource = (DataMovementProtocolResource) resource;
+// protocols.put(protocolResource.getDataMoveID(), DataMovementProtocol.valueOf(protocolResource.getDataMoveType()));
+// }
+// return protocols;
+// }
+
+ public static SshJobSubmissionAppCatalogResourceAppCat getSSHJobSubmission (SSHJobSubmission submission){
+ SshJobSubmissionAppCatalogResourceAppCat resource = new SshJobSubmissionAppCatalogResourceAppCat();
+ resource.setAlternativeSshHostname(submission.getAlternativeSSHHostName());
+ resource.setJobSubmissionInterfaceId(submission.getJobSubmissionInterfaceId());
+ ResourceJobManagerAppCatalogResourceAppCat resourceJobManager = getResourceJobManager(submission.getResourceJobManager());
+// resourceJobManager.setResourceJobManagerId(submission.getJobSubmissionInterfaceId());
+ resource.setResourceJobManagerId(resourceJobManager.getResourceJobManagerId());
+ if (submission.getMonitorMode() != null){
+ resource.setMonitorMode(submission.getMonitorMode().toString());
+ }
+ resource.setResourceJobManagerResource(resourceJobManager);
+ if (submission.getSecurityProtocol() != null){
+ resource.setSecurityProtocol(submission.getSecurityProtocol().toString());
+ }
+ resource.setSshPort(submission.getSshPort());
+ return resource;
+ }
+
+
+ public static UnicoreJobSubmissionAppCatalogResourceAppCat getUnicoreJobSubmission (UnicoreJobSubmission submission){
+ UnicoreJobSubmissionAppCatalogResourceAppCat resource = new UnicoreJobSubmissionAppCatalogResourceAppCat();
+ resource.setjobSubmissionInterfaceId(submission.getJobSubmissionInterfaceId());
+ if (submission.getSecurityProtocol() != null){
+ resource.setSecurityProtocol(submission.getSecurityProtocol().toString());
+ }
+ resource.setUnicoreEndpointUrl(submission.getUnicoreEndPointURL());
+ return resource;
+ }
+
+ public static UnicoreDataMovementAppCatalogResourceAppCat getUnicoreDMResource (UnicoreDataMovement dataMovement){
+ UnicoreDataMovementAppCatalogResourceAppCat resource = new UnicoreDataMovementAppCatalogResourceAppCat();
+ resource.setDataMovementId(dataMovement.getDataMovementInterfaceId());
+ if (dataMovement.getSecurityProtocol() != null){
+ resource.setSecurityProtocol(dataMovement.getSecurityProtocol().toString());
+ }
+ resource.setUnicoreEndpointUrl(dataMovement.getUnicoreEndPointURL());
+ return resource;
+ }
+
+
+ public static CloudSubmissionAppCatalogResourceAppCat getCloudJobSubmission (CloudJobSubmission submission){
+ CloudSubmissionAppCatalogResourceAppCat resource = new CloudSubmissionAppCatalogResourceAppCat();
+ resource.setJobSubmissionInterfaceId(submission.getJobSubmissionInterfaceId());
+ if (submission.getSecurityProtocol() != null){
+ resource.setSecurityProtocol(submission.getSecurityProtocol().toString());
+ }
+ if(submission.getProviderName() != null){
+ resource.setProviderName(submission.getProviderName().toString());
+ }
+ resource.setUserAccountName(submission.getUserAccountName());
+ resource.setNodeId(submission.getNodeId());
+ resource.setExecutableType(submission.getExecutableType());
+ return resource;
+ }
+
+ public static LocalDataMovementAppCatalogResourceAppCat getLocalDataMovement(LOCALDataMovement localSubmission)throws AppCatalogException {
+ LocalDataMovementAppCatalogResourceAppCat submission = new LocalDataMovementAppCatalogResourceAppCat();
+ submission.setDataMovementInterfaceId(localSubmission.getDataMovementInterfaceId());
+ return submission;
+ }
+
+ public static LOCALDataMovement getLocalDataMovement(LocalDataMovementAppCatalogResourceAppCat localSubmission)throws AppCatalogException {
+ LOCALDataMovement submission = new LOCALDataMovement();
+ submission.setDataMovementInterfaceId(localSubmission.getDataMovementInterfaceId());
+ return submission;
+ }
+
+
+ public static LocalSubmissionAppCatalogResourceAppCat getLocalJobSubmission(LOCALSubmission localSubmission)throws AppCatalogException {
+ LocalSubmissionAppCatalogResourceAppCat submission = new LocalSubmissionAppCatalogResourceAppCat();
+ submission.setJobSubmissionInterfaceId(localSubmission.getJobSubmissionInterfaceId());
+ ResourceJobManagerAppCatalogResourceAppCat resourceJobManager = getResourceJobManager(localSubmission.getResourceJobManager());
+ submission.setResourceJobManagerId(resourceJobManager.getResourceJobManagerId());
+ submission.setResourceJobManagerResource(resourceJobManager);
+ return submission;
+ }
+
+ public static LOCALSubmission getLocalJobSubmission(LocalSubmissionAppCatalogResourceAppCat localSubmission)throws AppCatalogException {
+ LOCALSubmission submission = new LOCALSubmission();
+ submission.setJobSubmissionInterfaceId(localSubmission.getJobSubmissionInterfaceId());
+ submission.setResourceJobManager(getResourceJobManager(localSubmission.getResourceJobManagerResource()));
+ return submission;
+ }
+
+ public static ResourceJobManagerAppCatalogResourceAppCat getResourceJobManager(ResourceJobManager manager){
+ ResourceJobManagerAppCatalogResourceAppCat r = new ResourceJobManagerAppCatalogResourceAppCat();
+ r.setResourceJobManagerId(manager.getResourceJobManagerId());
+ r.setJobManagerBinPath(manager.getJobManagerBinPath());
+ r.setPushMonitoringEndpoint(manager.getPushMonitoringEndpoint());
+ r.setResourceJobManagerType(manager.getResourceJobManagerType().toString());
+ return r;
+ }
+
+ public static ResourceJobManager getResourceJobManager(ResourceJobManagerAppCatalogResourceAppCat manager) throws AppCatalogException {
+ ResourceJobManager r = new ResourceJobManager();
+ r.setResourceJobManagerId(manager.getResourceJobManagerId());
+ r.setJobManagerBinPath(manager.getJobManagerBinPath());
+ r.setPushMonitoringEndpoint(manager.getPushMonitoringEndpoint());
+ r.setResourceJobManagerType(ResourceJobManagerType.valueOf(manager.getResourceJobManagerType()));
+ r.setJobManagerCommands(new HashMap<JobManagerCommand, String>());
+ JobManagerCommandAppCatalogResourceAppCat jmcr=new JobManagerCommandAppCatalogResourceAppCat();
+ List<AppCatalogResource> jmcrList = jmcr.get(AppCatAbstractResource.JobManagerCommandConstants.RESOURCE_JOB_MANAGER_ID, manager.getResourceJobManagerId());
+ if (jmcrList != null && !jmcrList.isEmpty()){
+ for (AppCatalogResource rrr : jmcrList) {
+ JobManagerCommandAppCatalogResourceAppCat rr=(JobManagerCommandAppCatalogResourceAppCat)rrr;
+ r.getJobManagerCommands().put(JobManagerCommand.valueOf(rr.getCommandType()), rr.getCommand());
+ }
+ }
+ return r;
+ }
+
+
+ public static SSHJobSubmission getSSHJobSubmissionDescription (SshJobSubmissionAppCatalogResourceAppCat submission) throws AppCatalogException {
+ SSHJobSubmission sshJobSubmission = new SSHJobSubmission();
+ sshJobSubmission.setAlternativeSSHHostName(submission.getAlternativeSshHostname());
+ sshJobSubmission.setJobSubmissionInterfaceId(submission.getJobSubmissionInterfaceId());
+ sshJobSubmission.setResourceJobManager(getResourceJobManager(submission.getResourceJobManagerResource()));
+ sshJobSubmission.setSecurityProtocol(SecurityProtocol.valueOf(submission.getSecurityProtocol()));
+ sshJobSubmission.setSshPort(submission.getSshPort());
+ if (submission.getMonitorMode() != null){
+ sshJobSubmission.setMonitorMode(MonitorMode.valueOf(submission.getMonitorMode()));
+ }
+ return sshJobSubmission;
+ }
+
+ public static UnicoreJobSubmission getUnicoreJobSubmissionDescription (UnicoreJobSubmissionAppCatalogResourceAppCat submission) throws AppCatalogException {
+ UnicoreJobSubmission unicoreJobSubmission = new UnicoreJobSubmission();
+ unicoreJobSubmission.setUnicoreEndPointURL(submission.getUnicoreEndpointUrl());
+ unicoreJobSubmission.setJobSubmissionInterfaceId(submission.getjobSubmissionInterfaceId());
+ if (submission.getSecurityProtocol() != null){
+ unicoreJobSubmission.setSecurityProtocol(SecurityProtocol.valueOf(submission.getSecurityProtocol()));
+ }
+ return unicoreJobSubmission;
+ }
+
+ public static UnicoreDataMovement getUnicoreDMDescription (UnicoreDataMovementAppCatalogResourceAppCat resource) throws AppCatalogException {
+ UnicoreDataMovement dataMovement = new UnicoreDataMovement();
+ dataMovement.setUnicoreEndPointURL(resource.getUnicoreEndpointUrl());
+ dataMovement.setDataMovementInterfaceId(resource.getDataMovementId());
+ if (resource.getSecurityProtocol() != null){
+ dataMovement.setSecurityProtocol(SecurityProtocol.valueOf(resource.getSecurityProtocol()));
+ }
+ return dataMovement;
+ }
+
+
+ public static CloudJobSubmission getCloudJobSubmissionDescription (CloudSubmissionAppCatalogResourceAppCat submission) throws AppCatalogException {
+ CloudJobSubmission cloudJobSubmission = new CloudJobSubmission();
+ cloudJobSubmission.setJobSubmissionInterfaceId(submission.getJobSubmissionInterfaceId());
+ cloudJobSubmission.setExecutableType(submission.getExecutableType());
+ cloudJobSubmission.setSecurityProtocol(SecurityProtocol.valueOf(submission.getSecurityProtocol()));
+ cloudJobSubmission.setNodeId(submission.getNodeId());
+ cloudJobSubmission.setUserAccountName(submission.getUserAccountName());
+ cloudJobSubmission.setProviderName(ProviderName.valueOf(submission.getProviderName()));
+ return cloudJobSubmission;
+ }
+
+// public static GlobusJobSubmission getGlobusJobSubmissionDescription (GlobusJobSubmissionResource submission) throws AppCatalogException {
+// GlobusJobSubmission globusJobSubmission = new GlobusJobSubmission();
+// globusJobSubmission.setJobSubmissionInterfaceId(submission.getSubmissionID());
+// globusJobSubmission.setResourceJobManager(ResourceJobManager.valueOf(submission.getResourceJobManager()));
+// globusJobSubmission.setSecurityProtocol(SecurityProtocol.valueOf(submission.getSecurityProtocol()));
+//
+// GlobusGKEndpointResource endpointResource = new GlobusGKEndpointResource();
+// List<Resource> endpoints = endpointResource.get(AbstractResource.GlobusEPConstants.SUBMISSION_ID, submission.getSubmissionID());
+// if (endpoints != null && !endpoints.isEmpty()){
+// globusJobSubmission.setGlobusGateKeeperEndPoint(getGlobusGateKeeperEndPointList(endpoints));
+// }
+//
+// return globusJobSubmission;
+// }
+
+ public static SCPDataMovement getSCPDataMovementDescription (ScpDataMovementAppCatalogResourceAppCat dataMovementResource) throws AppCatalogException {
+ SCPDataMovement dataMovement = new SCPDataMovement();
+ dataMovement.setDataMovementInterfaceId(dataMovementResource.getDataMovementInterfaceId());
+ dataMovement.setAlternativeSCPHostName(dataMovementResource.getAlternativeScpHostname());
+ dataMovement.setSecurityProtocol(SecurityProtocol.valueOf(dataMovementResource.getSecurityProtocol()));
+ dataMovement.setSshPort(dataMovementResource.getSshPort());
+ return dataMovement;
+ }
+
+ public static ScpDataMovementAppCatalogResourceAppCat getSCPDataMovementDescription (SCPDataMovement dataMovementResource) throws AppCatalogException {
+ ScpDataMovementAppCatalogResourceAppCat dataMovement = new ScpDataMovementAppCatalogResourceAppCat();
+ dataMovement.setDataMovementInterfaceId(dataMovementResource.getDataMovementInterfaceId());
+ dataMovement.setAlternativeScpHostname(dataMovementResource.getAlternativeSCPHostName());
+ dataMovement.setSecurityProtocol(dataMovementResource.getSecurityProtocol().toString());
+ dataMovement.setSshPort(dataMovementResource.getSshPort());
+ return dataMovement;
+ }
+
+ public static GridFTPDataMovement getGridFTPDataMovementDescription (GridftpDataMovementAppCatalogResourceAppCat dataMovementResource) throws AppCatalogException {
+ GridFTPDataMovement dataMovement = new GridFTPDataMovement();
+ dataMovement.setDataMovementInterfaceId(dataMovementResource.getDataMovementInterfaceId());
+ dataMovement.setSecurityProtocol(SecurityProtocol.valueOf(dataMovementResource.getSecurityProtocol()));
+ GridftpEndpointAppCatalogResourceAppCat endpointResource = new GridftpEndpointAppCatalogResourceAppCat();
+ List<AppCatalogResource> endpoints = endpointResource.get(AppCatAbstractResource.GridftpEndpointConstants.DATA_MOVEMENT_INTERFACE_ID, dataMovementResource.getDataMovementInterfaceId());
+ if (endpoints != null && !endpoints.isEmpty()){
+ dataMovement.setGridFTPEndPoints(getGridFTPDMEPList(endpoints));
+ }
+ return dataMovement;
+ }
+
+ public static GridftpDataMovementAppCatalogResourceAppCat getGridFTPDataMovementDescription (GridFTPDataMovement dataMovementResource) throws AppCatalogException {
+ GridftpDataMovementAppCatalogResourceAppCat dataMovement = new GridftpDataMovementAppCatalogResourceAppCat();
+ dataMovement.setDataMovementInterfaceId(dataMovementResource.getDataMovementInterfaceId());
+ dataMovement.setSecurityProtocol(dataMovementResource.getSecurityProtocol().toString());
+ return dataMovement;
+ }
+
+ public static List<String> getGridFTPDMEPList (List<AppCatalogResource> endpoints){
+ List<String> list = new ArrayList<String>();
+ for (AppCatalogResource resource : endpoints){
+ list.add(((GridftpEndpointAppCatalogResourceAppCat) resource).getEndpoint());
+ }
+ return list;
+ }
+
+ public static List<String> getGlobusGateKeeperEndPointList (List<AppCatalogResource> resources) throws AppCatalogException {
+ List<String> list = new ArrayList<String>();
+ for (AppCatalogResource resource : resources){
+ list.add(((GlobusGKEndpointAppCatalogResourceAppCat) resource).getEndpoint());
+ }
+ return list;
+ }
+//
+// public static List<GSISSHJobSubmission> getGSISSHSubmissionList (List<Resource> resources) throws AppCatalogException {
+// List<GSISSHJobSubmission> list = new ArrayList<GSISSHJobSubmission>();
+// for (Resource resource : resources){
+// list.add(getGSISSHSubmissionDescription((GSISSHSubmissionResource) resource));
+// }
+// return list;
+// }
+//
+// public static List<GlobusJobSubmission> getGlobusSubmissionList (List<Resource> resources) throws AppCatalogException {
+// List<GlobusJobSubmission> list = new ArrayList<GlobusJobSubmission>();
+// for (Resource resource : resources){
+// list.add(getGlobusJobSubmissionDescription((GlobusJobSubmissionResource) resource));
+// }
+// return list;
+// }
+//
+// public static List<SSHJobSubmission> getSSHSubmissionList (List<Resource> resources) throws AppCatalogException {
+// List<SSHJobSubmission> list = new ArrayList<SSHJobSubmission>();
+// for (Resource resource : resources){
+// list.add(getSSHJobSubmissionDescription((SshJobSubmissionResource) resource));
+// }
+// return list;
+// }
+//
+// public static List<GridFTPDataMovement> getGridFTPDataMovementList (List<Resource> resources) throws AppCatalogException {
+// List<GridFTPDataMovement> list = new ArrayList<GridFTPDataMovement>();
+// for (Resource resource : resources){
+// list.add(getGridFTPDataMovementDescription((GridftpDataMovementResource) resource));
+// }
+// return list;
+// }
+//
+// public static List<SCPDataMovement> getSCPDataMovementList (List<Resource> resources) throws AppCatalogException {
+// List<SCPDataMovement> list = new ArrayList<SCPDataMovement>();
+// for (Resource resource : resources){
+// list.add(getSCPDataMovementDescription((ScpDataMovementResource) resource));
+// }
+// return list;
+// }
+//
+// public static Set<String> getGSISSHExports (List<Resource> gsisshExportResources){
+// Set<String> exports = new HashSet<String>();
+// for (Resource resource : gsisshExportResources){
+// exports.add(((GSISSHExportResource) resource).getExport());
+// }
+// return exports;
+// }
+//
+// public static List<String> getGSISSHPreJobCommands (List<Resource> gsisshPreJobCommandResources){
+// List<String> list = new ArrayList<String>();
+// for (Resource resource : gsisshPreJobCommandResources){
+// list.add(((GSISSHPreJobCommandResource) resource).getCommand());
+// }
+// return list;
+// }
+//
+// public static List<String> getGSISSHPostJobCommands (List<Resource> gsisshPostJobCommandResources){
+// List<String> list = new ArrayList<String>();
+// for (Resource resource : gsisshPostJobCommandResources){
+// list.add(((GSISSHPostJobCommandResource) resource).getCommand());
+// }
+// return list;
+// }
+//
+// public static GlobusJobSubmissionResource getGlobusJobSubmission (GlobusJobSubmission submission){
+// GlobusJobSubmissionResource resource = new GlobusJobSubmissionResource();
+// resource.setSubmissionID(submission.getJobSubmissionDataID());
+// resource.setSecurityProtocol(submission.getSecurityProtocol().toString());
+// resource.setResourceJobManager(submission.getResourceJobManager().toString());
+// return resource;
+// }
+
+ public static ApplicationModule getApplicationModuleDesc (AppModuleAppCatalogResourceAppCat resource){
+ ApplicationModule module = new ApplicationModule();
+ module.setAppModuleId(resource.getModuleId());
+ module.setAppModuleDescription(resource.getModuleDesc());
+ module.setAppModuleName(resource.getModuleName());
+ module.setAppModuleVersion(resource.getModuleVersion());
+ return module;
+ }
+
+ public static ApplicationInterfaceDescription getApplicationInterfaceDescription (AppInterfaceAppCatalogResourceAppCat resource) throws AppCatalogException {
+ ApplicationInterfaceDescription description = new ApplicationInterfaceDescription();
+ description.setApplicationInterfaceId(resource.getInterfaceId());
+ description.setApplicationName(resource.getAppName());
+ description.setApplicationDescription(resource.getAppDescription());
+
+ AppModuleMappingAppCatalogResourceAppCat appModuleMappingResource = new AppModuleMappingAppCatalogResourceAppCat();
+ List<AppCatalogResource> appModules = appModuleMappingResource.get(AppCatAbstractResource.AppModuleMappingConstants.INTERFACE_ID, resource.getInterfaceId());
+ if (appModules != null && !appModules.isEmpty()){
+ description.setApplicationModules(getAppModuleIds(appModules));
+ }
+
+ ApplicationInputAppCatalogResourceAppCat inputResource = new ApplicationInputAppCatalogResourceAppCat();
+ List<AppCatalogResource> appInputs = inputResource.get(AppCatAbstractResource.AppInputConstants.INTERFACE_ID, resource.getInterfaceId());
+ if (appInputs != null && !appInputs.isEmpty()){
+ description.setApplicationInputs(getAppInputs(appInputs));
+ }
+
+ ApplicationOutputAppCatalogResourceAppCat outputResource = new ApplicationOutputAppCatalogResourceAppCat();
+ List<AppCatalogResource> appOutputs = outputResource.get(AppCatAbstractResource.AppOutputConstants.INTERFACE_ID, resource.getInterfaceId());
+ if (appOutputs != null && !appOutputs.isEmpty()){
+ description.setApplicationOutputs(getAppOutputs(appOutputs));
+ }
+ return description;
+ }
+
+ public static List<String> getAppModuleIds (List<AppCatalogResource> appModuleMappings){
+ List<String> modules = new ArrayList<String>();
+ for (AppCatalogResource resource : appModuleMappings){
+ modules.add(((AppModuleMappingAppCatalogResourceAppCat)resource).getModuleId());
+ }
+ return modules;
+ }
+
+ public static List<ApplicationModule> getAppModules (List<AppCatalogResource> appModules){
+ List<ApplicationModule> modules = new ArrayList<ApplicationModule>();
+ for (AppCatalogResource resource : appModules){
+ modules.add(getApplicationModuleDesc((AppModuleAppCatalogResourceAppCat) resource));
+ }
+ return modules;
+ }
+
+ public static List<ApplicationInterfaceDescription> getAppInterfaceDescList (List<AppCatalogResource> appInterfaces) throws AppCatalogException {
+ List<ApplicationInterfaceDescription> interfaceDescriptions = new ArrayList<ApplicationInterfaceDescription>();
+ for (AppCatalogResource resource : appInterfaces){
+ interfaceDescriptions.add(getApplicationInterfaceDescription((AppInterfaceAppCatalogResourceAppCat) resource));
+ }
+ return interfaceDescriptions;
+ }
+
+ public static List<InputDataObjectType> getAppInputs (List<AppCatalogResource> resources){
+ List<InputDataObjectType> inputs = new ArrayList<InputDataObjectType>();
+ for (AppCatalogResource resource : resources){
+ inputs.add(getInputDataObjType((ApplicationInputAppCatalogResourceAppCat) resource));
+ }
+ return inputs;
+ }
+
+ public static InputDataObjectType getInputDataObjType (ApplicationInputAppCatalogResourceAppCat input){
+ InputDataObjectType inputDataObjectType = new InputDataObjectType();
+ inputDataObjectType.setName(input.getInputKey());
+ inputDataObjectType.setValue(input.getInputVal());
+ inputDataObjectType.setApplicationArgument(input.getAppArgument());
+ inputDataObjectType.setInputOrder(input.getInputOrder());
+ inputDataObjectType.setMetaData(input.getMetadata());
+ inputDataObjectType.setType(DataType.valueOf(input.getDataType()));
+ inputDataObjectType.setStandardInput(input.isStandardInput());
+ inputDataObjectType.setUserFriendlyDescription(input.getUserFriendlyDesc());
+ inputDataObjectType.setIsRequired(input.getRequired());
+ inputDataObjectType.setRequiredToAddedToCommandLine(input.getRequiredToCMD());
+ inputDataObjectType.setDataStaged(input.isDataStaged());
+ return inputDataObjectType;
+ }
+
+ public static List<OutputDataObjectType> getAppOutputs (List<AppCatalogResource> resources){
+ List<OutputDataObjectType> outputs = new ArrayList<OutputDataObjectType>();
+ for (AppCatalogResource resource : resources){
+ outputs.add(getOutputDataObjType((ApplicationOutputAppCatalogResourceAppCat) resource));
+ }
+ return outputs;
+ }
+ public static OutputDataObjectType getOutputDataObjType (ApplicationOutputAppCatalogResourceAppCat output){
+ OutputDataObjectType outputDataObjectType = new OutputDataObjectType();
+ outputDataObjectType.setName(output.getOutputKey());
+ outputDataObjectType.setValue(output.getOutputVal());
+ outputDataObjectType.setType(DataType.valueOf(output.getDataType()));
+ outputDataObjectType.setIsRequired(output.getRequired());
+ outputDataObjectType.setRequiredToAddedToCommandLine(output.getRequiredToCMD());
+ outputDataObjectType.setDataMovement(output.isDataMovement());
+ outputDataObjectType.setLocation(output.getDataNameLocation());
+ outputDataObjectType.setSearchQuery(output.getSearchQuery());
+ outputDataObjectType.setApplicationArgument(output.getAppArgument());
+ return outputDataObjectType;
+ }
+
+ public static ApplicationDeploymentDescription getApplicationDeploymentDescription (AppDeploymentAppCatalogResourceAppCat resource) throws AppCatalogException {
+ ApplicationDeploymentDescription description = new ApplicationDeploymentDescription();
+ description.setAppDeploymentId(resource.getDeploymentId());
+ description.setAppModuleId(resource.getAppModuleId());
+ description.setComputeHostId(resource.getHostId());
+ description.setExecutablePath(resource.getExecutablePath());
+ if (resource.getParallelism() != null){
+ description.setParallelism(ApplicationParallelismType.valueOf(resource.getParallelism()));
+ }
+ description.setAppDeploymentDescription(resource.getAppDes());
+ ModuleLoadCmdAppCatalogResourceAppCat cmdResource = new ModuleLoadCmdAppCatalogResourceAppCat();
+ List<AppCatalogResource> moduleLoadCmds = cmdResource.get(AppCatAbstractResource.ModuleLoadCmdConstants.APP_DEPLOYMENT_ID, resource.getDeploymentId());
+ if (moduleLoadCmds != null && !moduleLoadCmds.isEmpty()){
+ for (AppCatalogResource moduleLoadCmd : moduleLoadCmds){
+ description.addToModuleLoadCmds(((ModuleLoadCmdAppCatalogResourceAppCat) moduleLoadCmd).getCmd());
+ }
+ }
+ LibraryPrepandPathAppCatalogResourceAppCat prepandPathResource = new LibraryPrepandPathAppCatalogResourceAppCat();
+ List<AppCatalogResource> libPrepandPaths = prepandPathResource.get(AppCatAbstractResource.LibraryPrepandPathConstants.DEPLOYMENT_ID, resource.getDeploymentId());
+ if (libPrepandPaths != null && !libPrepandPaths.isEmpty()){
+ description.setLibPrependPaths(getLibPrepandPaths(libPrepandPaths));
+ }
+
+ LibraryApendPathAppCatalogResourceAppCat apendPathResource = new LibraryApendPathAppCatalogResourceAppCat();
+ List<AppCatalogResource> libApendPaths = apendPathResource.get(AppCatAbstractResource.LibraryPrepandPathConstants.DEPLOYMENT_ID, resource.getDeploymentId());
+ if (libApendPaths != null && !libApendPaths.isEmpty()){
+ description.setLibAppendPaths(getLibApendPaths(libApendPaths));
+ }
+
+ AppEnvironmentAppCatalogResourceAppCat appEnvironmentResource = new AppEnvironmentAppCatalogResourceAppCat();
+ List<AppCatalogResource> appEnvList = appEnvironmentResource.get(AppCatAbstractResource.LibraryPrepandPathConstants.DEPLOYMENT_ID, resource.getDeploymentId());
+ if (appEnvList != null && !appEnvList.isEmpty()){
+ description.setSetEnvironment(getAppEnvPaths(appEnvList));
+ }
+ PreJobCommandAppCatalogResourceAppCat preJobCommandResource = new PreJobCommandAppCatalogResourceAppCat();
+ List<AppCatalogResource> preJobCommands = preJobCommandResource.get(AppCatAbstractResource.PreJobCommandConstants.DEPLOYMENT_ID, resource.getDeploymentId());
+ if (preJobCommands != null && !preJobCommands.isEmpty()){
+ for (AppCatalogResource prejobCommand : preJobCommands){
+ description.addToPreJobCommands(((PreJobCommandAppCatalogResourceAppCat) prejobCommand).getCommand());
+ }
+ }
+ PostJobCommandAppCatalogResourceAppCat postJobCommandResource = new PostJobCommandAppCatalogResourceAppCat();
+ List<AppCatalogResource> postJobCommands = postJobCommandResource.get(AppCatAbstractResource.PostJobCommandConstants.DEPLOYMENT_ID, resource.getDeploymentId());
+ if (postJobCommands != null && !postJobCommands.isEmpty()){
+ for (AppCatalogResource postjobCommand : postJobCommands){
+ description.addToPostJobCommands(((PostJobCommandAppCatalogResourceAppCat) postjobCommand).getCommand());
+ }
+ }
+ return description;
+ }
+
+ public static List<ApplicationDeploymentDescription> getAppDepDescList (List<AppCatalogResource> resources) throws AppCatalogException {
+ List<ApplicationDeploymentDescription> appList = new ArrayList<ApplicationDeploymentDescription>();
+ for (AppCatalogResource resource : resources){
+ appList.add(getApplicationDeploymentDescription((AppDeploymentAppCatalogResourceAppCat)resource));
+ }
+ return appList;
+ }
+
+ public static SetEnvPaths getSetEnvPath(AppCatalogResource resource){
+ SetEnvPaths envPaths = new SetEnvPaths();
+ if (resource instanceof LibraryPrepandPathAppCatalogResourceAppCat){
+ envPaths.setName(((LibraryPrepandPathAppCatalogResourceAppCat) resource).getName());
+ envPaths.setValue(((LibraryPrepandPathAppCatalogResourceAppCat) resource).getValue());
+ return envPaths;
+ }else if (resource instanceof LibraryApendPathAppCatalogResourceAppCat){
+ envPaths.setName(((LibraryApendPathAppCatalogResourceAppCat) resource).getName());
+ envPaths.setValue(((LibraryApendPathAppCatalogResourceAppCat) resource).getValue());
+ return envPaths;
+ }else if (resource instanceof AppEnvironmentAppCatalogResourceAppCat){
+ envPaths.setName(((AppEnvironmentAppCatalogResourceAppCat) resource).getName());
+ envPaths.setValue(((AppEnvironmentAppCatalogResourceAppCat) resource).getValue());
+ return envPaths;
+ }else {
+ return null;
+ }
+ }
+
+ public static List<SetEnvPaths> getLibPrepandPaths (List<AppCatalogResource> prepandPaths){
+ List<SetEnvPaths> pathList = new ArrayList<SetEnvPaths>();
+ for (AppCatalogResource resource : prepandPaths){
+ pathList.add(getSetEnvPath(resource));
+ }
+ return pathList;
+ }
+
+ public static List<SetEnvPaths> getLibApendPaths (List<AppCatalogResource> appendPaths){
+ List<SetEnvPaths> pathList = new ArrayList<SetEnvPaths>();
+ for (AppCatalogResource resource : appendPaths){
+ pathList.add(getSetEnvPath(resource));
+ }
+ return pathList;
+ }
+
+ public static List<SetEnvPaths> getAppEnvPaths (List<AppCatalogResource> appEnvPaths){
+ List<SetEnvPaths> pathList = new ArrayList<SetEnvPaths>();
+ for (AppCatalogResource resource : appEnvPaths){
+ pathList.add(getSetEnvPath(resource));
+ }
+ return pathList;
+ }
+
+ public static ComputeResourcePreference getComputeResourcePreference (ComputeHostPreferenceAppCatalogResourceAppCat resource){
+ ComputeResourcePreference preference = new ComputeResourcePreference();
+ preference.setComputeResourceId(resource.getResourceId());
+ preference.setOverridebyAiravata(resource.getOverrideByAiravata());
+ if (resource.getPreferredJobProtocol() != null){
+ preference.setPreferredJobSubmissionProtocol(JobSubmissionProtocol.valueOf(resource.getPreferredJobProtocol()));
+ }
+ if (resource.getPreferedDMProtocol() != null){
+ preference.setPreferredDataMovementProtocol(DataMovementProtocol.valueOf(resource.getPreferedDMProtocol()));
+ }
+ preference.setPreferredBatchQueue(resource.getBatchQueue());
+ preference.setScratchLocation(resource.getScratchLocation());
+ preference.setAllocationProjectNumber(resource.getProjectNumber());
+ preference.setLoginUserName(resource.getLoginUserName());
+ return preference;
+ }
+
+ public static List<ComputeResourcePreference> getComputeResourcePreferences (List<AppCatalogResource> resources){
+ List<ComputeResourcePreference> preferences = new ArrayList<ComputeResourcePreference>();
+ if (resources != null && !resources.isEmpty()){
+ for (AppCatalogResource resource : resources){
+ preferences.add(getComputeResourcePreference((ComputeHostPreferenceAppCatalogResourceAppCat)resource));
+ }
+ }
+ return preferences;
+ }
+
+ public static InputDataObjectType getWorkflowInput (WorkflowInputAppCatalogResourceAppCat resource){
+ InputDataObjectType input = new InputDataObjectType();
+ input.setName(resource.getInputKey());
+ input.setApplicationArgument(resource.getAppArgument());
+ input.setInputOrder(resource.getInputOrder());
+ input.setType(DataType.valueOf(resource.getDataType()));
+ input.setMetaData(resource.getMetadata());
+ input.setUserFriendlyDescription(resource.getUserFriendlyDesc());
+ input.setIsRequired(resource.getRequired());
+ input.setRequiredToAddedToCommandLine(resource.getRequiredToCMD());
+ input.setDataStaged(resource.isDataStaged());
+ return input;
+ }
+
+ public static List<InputDataObjectType> getWFInputs(List<AppCatalogResource> resources){
+ List<InputDataObjectType> inputResources = new ArrayList<InputDataObjectType>();
+ if (resources != null && !resources.isEmpty()){
+ for (AppCatalogResource resource : resources){
+ inputResources.add(getWorkflowInput((WorkflowInputAppCatalogResourceAppCat) resource));
+ }
+ }
+ return inputResources;
+ }
+
+ public static GatewayResourceProfile getGatewayResourceProfile(GatewayProfileAppCatalogResourceAppCat gw, List<ComputeResourcePreference> preferences){
+ GatewayResourceProfile gatewayProfile = new GatewayResourceProfile();
+ gatewayProfile.setGatewayID(gw.getGatewayID());
+ gatewayProfile.setComputeResourcePreferences(preferences);
+ return gatewayProfile;
+ }
+
+ public static Workflow getWorkflow (WorkflowAppCatalogResourceAppCat resource) throws AppCatalogException {
+ Workflow workflow = new Workflow();
+ workflow.setTemplateId(resource.getWfTemplateId());
+ workflow.setGraph(resource.getGraph());
+ workflow.setName(resource.getWfName());
+ if (resource.getImage() != null){
+ workflow.setImage(resource.getImage().getBytes());
+ }
+ WorkflowInputAppCatalogResourceAppCat inputResource = new WorkflowInputAppCatalogResourceAppCat();
+ List<AppCatalogResource> resources = inputResource.get(AppCatAbstractResource.WFInputConstants.WF_TEMPLATE_ID, resource.getWfTemplateId());
+ workflow.setWorkflowInputs(getWFInputs(resources));
+
+ return workflow;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/util/AppCatalogUtils.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/util/AppCatalogUtils.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/util/AppCatalogUtils.java
new file mode 100644
index 0000000..d4bb3b1
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/util/AppCatalogUtils.java
@@ -0,0 +1,31 @@
+/*
+ *
+ * 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.util;
+
+import java.util.UUID;
+
+public class AppCatalogUtils {
+ public static String getID (String name){
+ String pro = name.replaceAll("\\s", "");
+ return pro + "_" + UUID.randomUUID();
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/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
new file mode 100644
index 0000000..ad96e67
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/ExpCatResourceUtils.java
@@ -0,0 +1,526 @@
+/*
+ *
+ * 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.experiment.catalog;
+
+import org.apache.airavata.registry.core.experiment.catalog.model.*;
+import org.apache.airavata.registry.core.experiment.catalog.resources.*;
+import org.apache.airavata.registry.core.experiment.catalog.utils.QueryGenerator;
+import org.apache.airavata.registry.cpi.RegistryException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.persistence.EntityManager;
+import javax.persistence.EntityManagerFactory;
+import javax.persistence.Persistence;
+import javax.persistence.Query;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+public class ExpCatResourceUtils {
+ private final static Logger logger = LoggerFactory.getLogger(ExpCatResourceUtils.class);
+ private static final String PERSISTENCE_UNIT_NAME = "experiment_data";
+ protected static EntityManagerFactory factory;
+
+ public static void reset(){
+ factory=null;
+ }
+
+ public static EntityManager getEntityManager(){
+ if (factory == null) {
+ String connectionProperties = "DriverClassName=" + Utils.getJDBCDriver() + "," + "Url=" + Utils.getJDBCURL() + "?autoReconnect=true,," +
+ "Username=" + Utils.getJDBCUser() + "," + "Password=" + Utils.getJDBCPassword() + ",validationQuery=" +
+ Utils.getValidationQuery();
+ System.out.println(connectionProperties);
+ Map<String, String> properties = new HashMap<String, String>();
+ properties.put("persistenceXmlLocation", "META-INF/experiment-catalog.xml");
+ properties.put("openjpa.ConnectionDriverName", "org.apache.commons.dbcp.BasicDataSource");
+ properties.put("openjpa.ConnectionProperties", connectionProperties);
+ properties.put("openjpa.DynamicEnhancementAgent", "true");
+ properties.put("openjpa.RuntimeUnenhancedClasses", "unsupported");
+ properties.put("openjpa.DataCache","" + Utils.isCachingEnabled() + "(CacheSize=" + Utils.getJPACacheSize() + ", SoftReferenceSize=0)");
+ properties.put("openjpa.QueryCache","" + Utils.isCachingEnabled() + "(CacheSize=" + Utils.getJPACacheSize() + ", SoftReferenceSize=0)");
+ properties.put("openjpa.RemoteCommitProvider","sjvm");
+ properties.put("openjpa.Log","DefaultLevel=INFO, Runtime=INFO, Tool=INFO, SQL=INFO");
+ properties.put("openjpa.jdbc.DBDictionary","SupportsMultipleNontransactionalResultSets=false");
+// properties.put("openjpa.ReadLockLevel", "none");
+// properties.put("openjpa.WriteLockLevel", "none");
+// properties.put("openjpa.LockTimeout", "30000");
+// properties.put("openjpa.LockManager", "none");
+ properties.put("openjpa.jdbc.SynchronizeMappings", "buildSchema(ForeignKeys=true)");
+ properties.put("openjpa.ConnectionFactoryProperties", "PrettyPrint=true, PrettyPrintLineLength=72, PrintParameters=true, MaxActive=10, MaxIdle=5, MinIdle=2, MaxWait=31536000, autoReconnect=true");
+ properties.put("openjpa.jdbc.QuerySQLCache", "false");
+ factory = Persistence.createEntityManagerFactory(PERSISTENCE_UNIT_NAME, properties);
+ }
+ return factory.createEntityManager();
+ }
+
+ /**
+ * @param gatewayId
+ * @return
+ */
+ public static ExperimentCatResource createGateway(String gatewayId) throws RegistryException {
+ if (!isGatewayExist(gatewayId)) {
+ GatewayExperimentCatResource gatewayResource = new GatewayExperimentCatResource();
+ gatewayResource.setGatewayId(gatewayId);
+ return gatewayResource;
+ }else {
+ return getGateway(gatewayId);
+ }
+ }
+
+ public static UserExperimentCatResource createUser(String username, String password) throws RegistryException {
+ if (!isUserExist(username)) {
+ UserExperimentCatResource userResource = new UserExperimentCatResource();
+ userResource.setUserName(username);
+ userResource.setPassword(password);
+ return userResource;
+ }else {
+ return (UserExperimentCatResource)getUser(username);
+ }
+
+ }
+
+ public static ExperimentCatResource getGateway(String gatewayId) throws RegistryException{
+ EntityManager em = null;
+ try {
+ if (isGatewayExist(gatewayId)) {
+ em = getEntityManager();
+ Gateway gateway = em.find(Gateway.class, gatewayId);
+ GatewayExperimentCatResource gatewayResource = (GatewayExperimentCatResource)Utils.getResource(ResourceType.GATEWAY, gateway);
+ em.close();
+ return gatewayResource;
+ }
+ }catch (Exception e){
+ logger.error(e.getMessage(), e);
+ throw new RegistryException(e);
+ }finally {
+ if (em != null && em.isOpen()){
+ if (em.getTransaction().isActive()){
+ em.getTransaction().rollback();
+ }
+ em.close();
+ }
+ }
+ return null;
+ }
+
+ public static void addUser (String userName, String password) throws RegistryException{
+ UserExperimentCatResource resource = new UserExperimentCatResource();
+ resource.setUserName(userName);
+ resource.setPassword(password);
+ resource.save();
+ }
+
+ public static boolean isUserExist (String username) throws RegistryException{
+ EntityManager em = null;
+ try {
+ em = getEntityManager();
+ em.getTransaction().begin();
+ QueryGenerator generator = new QueryGenerator(AbstractExperimentCatResource.USERS);
+ generator.setParameter(AbstractExperimentCatResource.UserConstants.USERNAME, username);
+ Query q = generator.selectQuery(em);
+ int size = q.getResultList().size();
+ em.getTransaction().commit();
+ em.close();
+ return size>0;
+ } catch (Exception e){
+ logger.error(e.getMessage(), e);
+ throw new RegistryException(e);
+ }finally {
+ if (em != null && em.isOpen()){
+ if (em.getTransaction().isActive()){
+ em.getTransaction().rollback();
+ }
+ em.close();
+ }
+ }
+ }
+
+
+ public static ExperimentCatResource getUser(String userName) throws RegistryException{
+ EntityManager em = null;
+ try {
+ if (isUserExist(userName)) {
+ em = getEntityManager();
+ Users user = em.find(Users.class, userName);
+ UserExperimentCatResource userResource = (UserExperimentCatResource)Utils.getResource(ResourceType.USER, user);
+ em.close();
+ return userResource;
+ }
+ }catch (Exception e){
+ logger.error(e.getMessage(), e);
+ throw new RegistryException(e);
+ }finally {
+ if (em != null && em.isOpen()){
+ if (em.getTransaction().isActive()){
+ em.getTransaction().rollback();
+ }
+ em.close();
+ }
+ }
+ return null;
+
+ }
+
+ public static ExperimentCatResource getWorker(String gatewayId, String userName) throws RegistryException{
+ EntityManager em = null;
+ try {
+ em = getEntityManager();
+ Gateway_Worker gatewayWorker = em.find(Gateway_Worker.class, new Gateway_Worker_PK(gatewayId, userName));
+ WorkerExperimentCatResource workerResource = (WorkerExperimentCatResource) Utils.getResource(ResourceType.GATEWAY_WORKER, gatewayWorker);
+ em.close();
+ return workerResource;
+ }catch (Exception e){
+ logger.error(e.getMessage(), e);
+ throw new RegistryException(e);
+ }finally {
+ if (em != null && em.isOpen()){
+ if (em.getTransaction().isActive()){
+ em.getTransaction().rollback();
+ }
+ em.close();
+ }
+ }
+
+
+ }
+
+
+ /**
+ * @param gatewayId
+ * @return
+ */
+ public static boolean isGatewayExist(String gatewayId) throws RegistryException{
+ EntityManager em = null;
+ try {
+ em = getEntityManager();
+ em.getTransaction().begin();
+ QueryGenerator generator = new QueryGenerator(AbstractExperimentCatResource.GATEWAY);
+ generator.setParameter(AbstractExperimentCatResource.GatewayConstants.GATEWAY_ID, gatewayId);
+ Query q = generator.selectQuery(em);
+ int size = q.getResultList().size();
+ em.getTransaction().commit();
+ em.close();
+ return size>0;
+ }catch (Exception e){
+ logger.error(e.getMessage(), e);
+ throw new RegistryException(e);
+ }finally {
+ if (em != null && em.isOpen()){
+ if (em.getTransaction().isActive()){
+ em.getTransaction().rollback();
+ }
+ em.close();
+ }
+ }
+
+ }
+
+ public static List<ExperimentCatResource> getAllGateways() throws RegistryException{
+ List<ExperimentCatResource> resourceList = new ArrayList<ExperimentCatResource>();
+ EntityManager em = null;
+ try {
+ em = getEntityManager();
+ em.getTransaction().begin();
+ QueryGenerator generator = new QueryGenerator(AbstractExperimentCatResource.GATEWAY);
+ Query q = generator.selectQuery(em);
+ List results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ Gateway gateway = (Gateway) result;
+ GatewayExperimentCatResource gatewayResource =
+ (GatewayExperimentCatResource) Utils.getResource(ResourceType.GATEWAY, gateway);
+ resourceList.add(gatewayResource);
+ }
+ }
+ em.getTransaction().commit();
+ em.close();
+ }catch (Exception e){
+ logger.error(e.getMessage(), e);
+ throw new RegistryException(e);
+ }finally {
+ if (em != null && em.isOpen()){
+ if (em.getTransaction().isActive()){
+ em.getTransaction().rollback();
+ }
+ em.close();
+ }
+ }
+ return resourceList;
+ }
+
+ /**
+ * @param gatewayId
+ * @return
+ */
+ public static boolean removeGateway(String gatewayId) {
+ EntityManager em = null;
+ try {
+ em = getEntityManager();
+ em.getTransaction().begin();
+ QueryGenerator generator = new QueryGenerator(AbstractExperimentCatResource.GATEWAY);
+ generator.setParameter(AbstractExperimentCatResource.GatewayConstants.GATEWAY_ID, gatewayId);
+ Query q = generator.deleteQuery(em);
+ q.executeUpdate();
+ em.getTransaction().commit();
+ em.close();
+ return true;
+ } catch (Exception e) {
+ logger.error(e.getMessage(), e);
+ return false;
+ }finally {
+ if (em != null && em.isOpen()){
+ if (em.getTransaction().isActive()){
+ em.getTransaction().rollback();
+ }
+ em.close();
+ }
+ }
+ }
+
+ /**
+ * @param gatewayResource
+ * @param userResource
+ */
+ public static WorkerExperimentCatResource addGatewayWorker(GatewayExperimentCatResource gatewayResource, UserExperimentCatResource userResource) throws RegistryException{
+ EntityManager em = null;
+ try {
+ em = getEntityManager();
+ em.getTransaction().begin();
+ if (!isGatewayExist(gatewayResource.getGatewayName())){
+ gatewayResource.save();
+ }
+ if (!isUserExist(userResource.getUserName())){
+ userResource.save();
+ }
+ Gateway gateway = em.find(Gateway.class, gatewayResource.getGatewayId());
+ Users user = em.find(Users.class, userResource.getUserName());
+ Gateway_Worker gatewayWorker = new Gateway_Worker();
+ gatewayWorker.setGateway(gateway);
+ gatewayWorker.setUser(user);
+ em.persist(gatewayWorker);
+ em.getTransaction().commit();
+ em.close();
+ return (WorkerExperimentCatResource)Utils.getResource(ResourceType.GATEWAY_WORKER, gatewayWorker);
+ } catch (Exception e){
+ logger.error(e.getMessage(), e);
+ throw new RegistryException(e);
+ }finally {
+ if (em != null && em.isOpen()){
+ if (em.getTransaction().isActive()){
+ em.getTransaction().rollback();
+ }
+ em.close();
+ }
+ }
+ }
+
+ /**
+ * @param gatewayResource
+ * @param userResource
+ * @return
+ */
+ public static boolean removeGatewayWorker(GatewayExperimentCatResource gatewayResource, UserExperimentCatResource userResource) {
+ EntityManager em = null;
+ try {
+ em = getEntityManager();
+ em.getTransaction().begin();
+ QueryGenerator generator = new QueryGenerator(AbstractExperimentCatResource.GATEWAY_WORKER);
+ generator.setParameter(AbstractExperimentCatResource.GatewayWorkerConstants.GATEWAY_ID,
+ gatewayResource.getGatewayName());
+ generator.setParameter(AbstractExperimentCatResource.UserConstants.USERNAME, userResource.getUserName());
+ Query q = generator.deleteQuery(em);
+ q.executeUpdate();
+ em.getTransaction().commit();
+ em.close();
+ return true;
+ } catch (Exception e) {
+ logger.error(e.getMessage(), e);
+ return false;
+ }finally {
+ if (em != null && em.isOpen()){
+ if (em.getTransaction().isActive()){
+ em.getTransaction().rollback();
+ }
+ em.close();
+ }
+ }
+
+ }
+
+ /**
+ * @param configKey
+ * @return
+ */
+ public static List<ConfigurationExperimentCatResource> getConfigurations(String configKey){
+ List<ConfigurationExperimentCatResource> list = new ArrayList<ConfigurationExperimentCatResource>();
+ EntityManager em = null;
+ try {
+ em = getEntityManager();
+ em.getTransaction().begin();
+ QueryGenerator generator = new QueryGenerator(AbstractExperimentCatResource.CONFIGURATION);
+ generator.setParameter(AbstractExperimentCatResource.ConfigurationConstants.CONFIG_KEY, configKey);
+ Query q = generator.selectQuery(em);
+ List<?> resultList = q.getResultList();
+ if (resultList.size() != 0) {
+ for (Object result : resultList) {
+ ConfigurationExperimentCatResource configurationResource = createConfigurationResourceObject(result);
+ list.add(configurationResource);
+ }
+ }
+ em.getTransaction().commit();
+ em.close();
+ }catch (Exception e) {
+ logger.error(e.getMessage(), e);
+ }finally {
+ if (em != null && em.isOpen()){
+ if (em.getTransaction().isActive()){
+ em.getTransaction().rollback();
+ }
+ em.close();
+ }
+ }
+ return list;
+ }
+
+ /**
+ * @param configKey
+ * @return
+ */
+ public static ConfigurationExperimentCatResource getConfiguration(String configKey){
+ List<ConfigurationExperimentCatResource> configurations = getConfigurations(configKey);
+ return (configurations != null && configurations.size() > 0) ? configurations.get(0) : null;
+ }
+
+ /**
+ * @param configKey
+ * @return
+ */
+ public static boolean isConfigurationExist(String configKey){
+ List<ConfigurationExperimentCatResource> configurations = getConfigurations(configKey);
+ return (configurations != null && configurations.size() > 0);
+ }
+
+ /**
+ * @param configKey
+ * @return
+ */
+ public static ConfigurationExperimentCatResource createConfiguration(String configKey) {
+ ConfigurationExperimentCatResource config = new ConfigurationExperimentCatResource();
+ config.setConfigKey(configKey);
+ return config;
+ }
+
+ /**
+ * @param result
+ * @return
+ */
+ private static ConfigurationExperimentCatResource createConfigurationResourceObject(
+ Object result) {
+ Configuration configuration = (Configuration) result;
+ ConfigurationExperimentCatResource configurationResource = new ConfigurationExperimentCatResource(configuration.getConfig_key(), configuration.getConfig_val());
+ configurationResource.setExpireDate(configuration.getExpire_date());
+ return configurationResource;
+ }
+
+ /**
+ * @param configkey
+ * @param configValue
+ */
+ public static void removeConfiguration(String configkey, String configValue) throws RegistryException{
+ QueryGenerator queryGenerator = new QueryGenerator(AbstractExperimentCatResource.CONFIGURATION);
+ queryGenerator.setParameter(AbstractExperimentCatResource.ConfigurationConstants.CONFIG_KEY, configkey);
+ queryGenerator.setParameter(AbstractExperimentCatResource.ConfigurationConstants.CONFIG_VAL, configValue);
+ EntityManager em = null;
+ try {
+ if(isConfigurationExists(configkey, configValue)){
+ em = getEntityManager();
+ em.getTransaction().begin();
+ Query q = queryGenerator.deleteQuery(em);
+ q.executeUpdate();
+ em.getTransaction().commit();
+ em.close();
+ }
+ }catch (Exception e){
+ logger.error(e.getMessage(), e);
+ throw new RegistryException(e);
+ }finally {
+ if (em != null && em.isOpen()){
+ if (em.getTransaction().isActive()){
+ em.getTransaction().rollback();
+ }
+ em.close();
+ }
+ }
+ }
+
+ /**
+ * @param configkey
+ */
+ public static void removeConfiguration(String configkey) throws RegistryException{
+ QueryGenerator queryGenerator = new QueryGenerator(AbstractExperimentCatResource.CONFIGURATION);
+ queryGenerator.setParameter(AbstractExperimentCatResource.ConfigurationConstants.CONFIG_KEY, configkey);
+ EntityManager em = null;
+ try {
+ if(isConfigurationExist(configkey)){
+ em = getEntityManager();
+ em.getTransaction().begin();
+ Query q = queryGenerator.deleteQuery(em);
+ q.executeUpdate();
+ em.getTransaction().commit();
+ em.close();
+ }
+ }catch (Exception e){
+ logger.error(e.getMessage(), e);
+ throw new RegistryException(e);
+ }finally {
+ if (em != null && em.isOpen()){
+ if (em.getTransaction().isActive()){
+ em.getTransaction().rollback();
+ }
+ em.close();
+ }
+ }
+ }
+
+ public static boolean isConfigurationExists(String configKey, String configVal) throws RegistryException{
+ EntityManager em = null;
+ try{
+ //Currently categoryID is hardcoded value
+ em = ExpCatResourceUtils.getEntityManager();
+ Configuration existing = em.find(Configuration.class, new Configuration_PK(configKey, configVal, AbstractExperimentCatResource.ConfigurationConstants.CATEGORY_ID_DEFAULT_VALUE));
+ em.close();
+ return existing!= null;
+ } catch (Exception e){
+ logger.error(e.getMessage(), e);
+ throw new RegistryException(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/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/ExperimentCatResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/ExperimentCatResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/ExperimentCatResource.java
new file mode 100644
index 0000000..ead6d13
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/ExperimentCatResource.java
@@ -0,0 +1,71 @@
+/*
+ *
+ * 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.experiment.catalog;
+
+import org.apache.airavata.registry.cpi.RegistryException;
+
+import java.util.List;
+
+public interface ExperimentCatResource {
+ /**
+ * This method will create associate resource objects for the given resource type.
+ * @param type child resource type
+ * @return associate child resource
+ */
+ ExperimentCatResource create(ResourceType type) throws RegistryException, RegistryException;
+
+ /**
+ * This method will remove the given child resource from the database
+ * @param type child resource type
+ * @param name child resource name
+ */
+ void remove(ResourceType type, Object name) throws RegistryException;
+
+ /**
+ * This method will return the given child resource from the database
+ * @param type child resource type
+ * @param name child resource name
+ * @return associate child resource
+ */
+ ExperimentCatResource get(ResourceType type, Object name) throws RegistryException;
+
+ /**
+ * This method will list all the child resources for the given resource type
+ * @param type child resource type
+ * @return list of child resources of the given child resource type
+ */
+ List<ExperimentCatResource> get(ResourceType type) throws RegistryException;
+
+ /**
+ * This method will save the resource to the database.
+ */
+ void save() throws RegistryException;
+
+ /**
+ * This method will check whether an entry from the given resource type and resource name
+ * exists in the database
+ * @param type child resource type
+ * @param name child resource name
+ * @return whether the entry exists in the database or not
+ */
+ boolean isExists(ResourceType type, Object name) throws RegistryException;
+
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/JPAConstants.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/JPAConstants.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/JPAConstants.java
new file mode 100644
index 0000000..359c02c
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/JPAConstants.java
@@ -0,0 +1,32 @@
+/*
+ *
+ * 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.experiment.catalog;
+public class JPAConstants {
+ public static final String KEY_JDBC_URL = "registry.jdbc.url";
+ public static final String KEY_JDBC_USER = "registry.jdbc.user";
+ public static final String KEY_JDBC_PASSWORD = "registry.jdbc.password";
+ public static final String KEY_JDBC_DRIVER = "registry.jdbc.driver";
+ public static final String KEY_DERBY_START_ENABLE = "start.derby.server.mode";
+ public static final String VALIDATION_QUERY = "validationQuery";
+ public static final String JPA_CACHE_SIZE = "jpa.cache.size";
+ public static final String ENABLE_CACHING = "cache.enable";
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/ResourceType.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/ResourceType.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/ResourceType.java
new file mode 100644
index 0000000..8224cf3
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/ResourceType.java
@@ -0,0 +1,49 @@
+/*
+ *
+ * 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.experiment.catalog;
+public enum ResourceType {
+ GATEWAY,
+ PROJECT,
+ USER,
+ PROJECT_USER,
+ CONFIGURATION,
+ GATEWAY_WORKER,
+ EXPERIMENT,
+ EXPERIMENT_SUMMARY,
+ NOTIFICATION_EMAIL,
+ EXPERIMENT_INPUT,
+ EXPERIMENT_OUTPUT,
+ WORKFLOW_NODE_DETAIL,
+ TASK_DETAIL,
+ ERROR_DETAIL,
+ APPLICATION_INPUT,
+ APPLICATION_OUTPUT,
+ NODE_INPUT,
+ NODE_OUTPUT,
+ JOB_DETAIL,
+ DATA_TRANSFER_DETAIL,
+ STATUS,
+ CONFIG_DATA,
+ COMPUTATIONAL_RESOURCE_SCHEDULING,
+ ADVANCE_INPUT_DATA_HANDLING,
+ ADVANCE_OUTPUT_DATA_HANDLING,
+ QOS_PARAM
+}
[20/52] [abbrv] [partial] airavata git commit: registry refactoring
Posted by sh...@apache.org.
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/AppModuleMapping_PK.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/AppModuleMapping_PK.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/AppModuleMapping_PK.java
new file mode 100644
index 0000000..b8881b1
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/AppModuleMapping_PK.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 AppModuleMapping_PK implements Serializable {
+ private String interfaceID;
+ private String moduleID;
+
+ public AppModuleMapping_PK(String interfaceID, String moduleID) {
+ this.interfaceID = interfaceID;
+ this.moduleID = moduleID;
+ }
+
+ public AppModuleMapping_PK() {
+ ;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ return false;
+ }
+
+ @Override
+ public int hashCode() {
+ return 1;
+ }
+
+ public String getInterfaceID() {
+ return interfaceID;
+ }
+
+ public void setInterfaceID(String interfaceID) {
+ this.interfaceID = interfaceID;
+ }
+
+ public String getModuleID() {
+ return moduleID;
+ }
+
+ public void setModuleID(String moduleID) {
+ this.moduleID = moduleID;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/AppOutput_PK.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/AppOutput_PK.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/AppOutput_PK.java
new file mode 100644
index 0000000..bdd6fd7
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/AppOutput_PK.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 AppOutput_PK implements Serializable {
+ private String interfaceID;
+ private String outputKey;
+
+ public AppOutput_PK(String interfaceID, String outputKey) {
+ this.interfaceID = interfaceID;
+ this.outputKey = outputKey;
+ }
+
+ public AppOutput_PK() {
+ ;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ return false;
+ }
+
+ @Override
+ public int hashCode() {
+ return 1;
+ }
+
+ public String getInterfaceID() {
+ return interfaceID;
+ }
+
+ public void setInterfaceID(String interfaceID) {
+ this.interfaceID = interfaceID;
+ }
+
+ public String getOutputKey() {
+ return outputKey;
+ }
+
+ public void setOutputKey(String outputKey) {
+ this.outputKey = outputKey;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/ApplicationDeployment.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/ApplicationDeployment.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/ApplicationDeployment.java
new file mode 100644
index 0000000..f42eb13
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/ApplicationDeployment.java
@@ -0,0 +1,148 @@
+/*
+ *
+ * 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.*;
+import java.io.Serializable;
+import java.sql.Timestamp;
+
+@Entity
+@Table(name = "APPLICATION_DEPLOYMENT")
+public class ApplicationDeployment implements Serializable {
+ @Id
+ @Column(name = "DEPLOYMENT_ID")
+ private String deploymentID;
+ @Column(name = "APP_MODULE_ID")
+ private String appModuleID;
+ @Column(name = "COMPUTE_HOST_ID")
+ private String hostID;
+ @Column(name = "EXECUTABLE_PATH")
+ private String executablePath;
+ @Column(name = "APPLICATION_DESC")
+ private String applicationDesc;
+ @Column(name = "PARALLELISM")
+ private String parallelism;
+ @Column(name = "GATEWAY_ID")
+ private String gatewayId;
+
+ @ManyToOne(cascade= CascadeType.MERGE)
+ @JoinColumn(name = "APP_MODULE_ID")
+ private ApplicationModule applicationModule;
+
+ @ManyToOne(cascade= CascadeType.MERGE)
+ @JoinColumn(name = "COMPUTE_HOSTID")
+ private ComputeResource computeResource;
+
+ @Column(name = "CREATION_TIME")
+ private Timestamp creationTime;
+
+ @Column(name = "UPDATE_TIME")
+ private Timestamp updateTime;
+
+ public String getGatewayId() {
+ return gatewayId;
+ }
+
+ public void setGatewayId(String gatewayId) {
+ this.gatewayId = gatewayId;
+ }
+
+ public Timestamp getCreationTime() {
+ return creationTime;
+ }
+
+ public void setCreationTime(Timestamp creationTime) {
+ this.creationTime = creationTime;
+ }
+
+ public Timestamp getUpdateTime() {
+ return updateTime;
+ }
+
+ public void setUpdateTime(Timestamp updateTime) {
+ this.updateTime = updateTime;
+ }
+
+ public String getDeploymentID() {
+ return deploymentID;
+ }
+
+ public void setDeploymentID(String deploymentID) {
+ this.deploymentID = deploymentID;
+ }
+
+ public String getAppModuleID() {
+ return appModuleID;
+ }
+
+ public void setAppModuleID(String appModuleID) {
+ this.appModuleID = appModuleID;
+ }
+
+ public String getHostID() {
+ return hostID;
+ }
+
+ public void setHostID(String hostID) {
+ this.hostID = hostID;
+ }
+
+ public String getExecutablePath() {
+ return executablePath;
+ }
+
+ public void setExecutablePath(String executablePath) {
+ this.executablePath = executablePath;
+ }
+
+ public String getApplicationDesc() {
+ return applicationDesc;
+ }
+
+ public void setApplicationDesc(String applicationDesc) {
+ this.applicationDesc = applicationDesc;
+ }
+
+ public ApplicationModule getApplicationModule() {
+ return applicationModule;
+ }
+
+ public void setApplicationModule(ApplicationModule applicationModule) {
+ this.applicationModule = applicationModule;
+ }
+
+ public ComputeResource getComputeResource() {
+ return computeResource;
+ }
+
+ public void setComputeResource(ComputeResource computeResource) {
+ this.computeResource = computeResource;
+ }
+
+ public String getParallelism() {
+ return parallelism;
+ }
+
+ public void setParallelism(String parallelism) {
+ this.parallelism = parallelism;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/ApplicationInput.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/ApplicationInput.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/ApplicationInput.java
new file mode 100644
index 0000000..d83e9e5
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/ApplicationInput.java
@@ -0,0 +1,166 @@
+/*
+ *
+ * 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.*;
+import java.io.Serializable;
+
+@Entity
+@Table(name = "APPLICATION_INPUT")
+@IdClass(AppInput_PK.class)
+public class ApplicationInput implements Serializable {
+ @Id
+ @Column(name = "INTERFACE_ID")
+ private String interfaceID;
+ @Id
+ @Column(name = "INPUT_KEY")
+ private String inputKey;
+ @Column(name = "INPUT_VALUE")
+ private String inputVal;
+ @Column(name = "DATA_TYPE")
+ private String dataType;
+ @Column(name = "METADATA")
+ private String metadata;
+ @Column(name = "APP_ARGUMENT")
+ private String appArgument;
+ @Column(name = "USER_FRIENDLY_DESC")
+ private String userFriendlyDesc;
+ @Column(name = "STANDARD_INPUT")
+ private boolean standardInput;
+ @Column(name="INPUT_ORDER")
+ private int inputOrder;
+ @Column(name="IS_REQUIRED")
+ private boolean isRequired;
+ @Column(name="REQUIRED_TO_COMMANDLINE")
+ private boolean requiredToCMD;
+ @Column(name = "DATA_STAGED")
+ private boolean dataStaged;
+
+ @ManyToOne(cascade= CascadeType.MERGE)
+ @JoinColumn(name = "INTERFACE_ID")
+ private ApplicationInterface applicationInterface;
+
+ public String getInterfaceID() {
+ return interfaceID;
+ }
+
+ public void setInterfaceID(String interfaceID) {
+ this.interfaceID = interfaceID;
+ }
+
+ public String getInputKey() {
+ return inputKey;
+ }
+
+ public void setInputKey(String inputKey) {
+ this.inputKey = inputKey;
+ }
+
+ public String getInputVal() {
+ return inputVal;
+ }
+
+ public void setInputVal(String inputVal) {
+ this.inputVal = inputVal;
+ }
+
+ public String getDataType() {
+ return dataType;
+ }
+
+ public void setDataType(String dataType) {
+ this.dataType = dataType;
+ }
+
+ public String getMetadata() {
+ return metadata;
+ }
+
+ public void setMetadata(String metadata) {
+ this.metadata = metadata;
+ }
+
+ public String getAppArgument() {
+ return appArgument;
+ }
+
+ public void setAppArgument(String appArgument) {
+ this.appArgument = appArgument;
+ }
+
+ public String getUserFriendlyDesc() {
+ return userFriendlyDesc;
+ }
+
+ public void setUserFriendlyDesc(String userFriendlyDesc) {
+ this.userFriendlyDesc = userFriendlyDesc;
+ }
+
+ public ApplicationInterface getApplicationInterface() {
+ return applicationInterface;
+ }
+
+ public void setApplicationInterface(ApplicationInterface applicationInterface) {
+ this.applicationInterface = applicationInterface;
+ }
+
+ public boolean isStandardInput() {
+ return standardInput;
+ }
+
+ public void setStandardInput(boolean standardInput) {
+ this.standardInput = standardInput;
+ }
+
+ public int getInputOrder() {
+ return inputOrder;
+ }
+
+ public void setInputOrder(int inputOrder) {
+ this.inputOrder = inputOrder;
+ }
+
+ public boolean isRequired() {
+ return isRequired;
+ }
+
+ public void setRequired(boolean isRequired) {
+ this.isRequired = isRequired;
+ }
+
+ public boolean isRequiredToCMD() {
+ return requiredToCMD;
+ }
+
+ public void setRequiredToCMD(boolean requiredToCMD) {
+ this.requiredToCMD = requiredToCMD;
+ }
+
+ public boolean isDataStaged() {
+ return dataStaged;
+ }
+
+ public void setDataStaged(boolean dataStaged) {
+ this.dataStaged = dataStaged;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/ApplicationInterface.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/ApplicationInterface.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/ApplicationInterface.java
new file mode 100644
index 0000000..7beb05c
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/ApplicationInterface.java
@@ -0,0 +1,97 @@
+/*
+ *
+ * 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.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.Table;
+import java.io.Serializable;
+import java.sql.Timestamp;
+
+@Entity
+@Table(name = "APPLICATION_INTERFACE")
+public class ApplicationInterface implements Serializable {
+ @Id
+ @Column(name = "INTERFACE_ID")
+ private String interfaceID;
+ @Column(name = "APPLICATION_NAME")
+ private String appName;
+ @Column(name = "APPLICATION_DESCRIPTION")
+ private String appDescription;
+ @Column(name = "CREATION_TIME")
+ private Timestamp creationTime;
+ @Column(name = "GATEWAY_ID")
+ private String gatewayId;
+
+ @Column(name = "UPDATE_TIME")
+ private Timestamp updateTime;
+
+ public String getGatewayId() {
+ return gatewayId;
+ }
+
+ public void setGatewayId(String gatewayId) {
+ this.gatewayId = gatewayId;
+ }
+
+ public Timestamp getCreationTime() {
+ return creationTime;
+ }
+
+ public void setCreationTime(Timestamp creationTime) {
+ this.creationTime = creationTime;
+ }
+
+ public Timestamp getUpdateTime() {
+ return updateTime;
+ }
+
+ public void setUpdateTime(Timestamp updateTime) {
+ this.updateTime = updateTime;
+ }
+
+
+ public String getInterfaceID() {
+ return interfaceID;
+ }
+
+ public void setInterfaceID(String interfaceID) {
+ this.interfaceID = interfaceID;
+ }
+
+ public String getAppName() {
+ return appName;
+ }
+
+ public void setAppName(String appName) {
+ this.appName = appName;
+ }
+
+ public String getAppDescription() {
+ return appDescription;
+ }
+
+ public void setAppDescription(String appDescription) {
+ this.appDescription = appDescription;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/ApplicationModule.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/ApplicationModule.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/ApplicationModule.java
new file mode 100644
index 0000000..0f78137
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/ApplicationModule.java
@@ -0,0 +1,107 @@
+/*
+ *
+ * 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.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.Table;
+import java.io.Serializable;
+import java.sql.Timestamp;
+
+@Entity
+@Table(name = "APPLICATION_MODULE")
+public class ApplicationModule implements Serializable {
+ @Id
+ @Column(name = "MODULE_ID")
+ private String moduleID;
+ @Column(name = "MODULE_NAME")
+ private String moduleName;
+ @Column(name = "MODULE_VERSION")
+ private String moduleVersion;
+ @Column(name = "MODULE_DESC")
+ private String moduleDesc;
+ @Column(name = "CREATION_TIME")
+ private Timestamp creationTime;
+ @Column(name = "GATEWAY_ID")
+ private String gatewayId;
+
+ @Column(name = "UPDATE_TIME")
+ private Timestamp updateTime;
+
+ public Timestamp getCreationTime() {
+ return creationTime;
+ }
+
+ public void setCreationTime(Timestamp creationTime) {
+ this.creationTime = creationTime;
+ }
+
+ public Timestamp getUpdateTime() {
+ return updateTime;
+ }
+
+ public void setUpdateTime(Timestamp updateTime) {
+ this.updateTime = updateTime;
+ }
+
+
+ public String getModuleID() {
+ return moduleID;
+ }
+
+ public void setModuleID(String moduleID) {
+ this.moduleID = moduleID;
+ }
+
+ public String getModuleName() {
+ return moduleName;
+ }
+
+ public void setModuleName(String moduleName) {
+ this.moduleName = moduleName;
+ }
+
+ public String getModuleVersion() {
+ return moduleVersion;
+ }
+
+ public void setModuleVersion(String moduleVersion) {
+ this.moduleVersion = moduleVersion;
+ }
+
+ public String getModuleDesc() {
+ return moduleDesc;
+ }
+
+ public void setModuleDesc(String moduleDesc) {
+ this.moduleDesc = moduleDesc;
+ }
+
+ public String getGatewayId() {
+ return gatewayId;
+ }
+
+ public void setGatewayId(String gatewayId) {
+ this.gatewayId = gatewayId;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/ApplicationOutput.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/ApplicationOutput.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/ApplicationOutput.java
new file mode 100644
index 0000000..2590913
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/ApplicationOutput.java
@@ -0,0 +1,146 @@
+/*
+ *
+ * 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.*;
+import java.io.Serializable;
+
+@Entity
+@Table(name = "APPLICATION_OUTPUT")
+@IdClass(AppOutput_PK.class)
+public class ApplicationOutput implements Serializable {
+ @Id
+ @Column(name = "INTERFACE_ID")
+ private String interfaceID;
+ @Id
+ @Column(name = "OUTPUT_KEY")
+ private String outputKey;
+ @Column(name = "OUTPUT_VALUE")
+ private String outputVal;
+ @Column(name = "DATA_TYPE")
+ private String dataType;
+ @Column(name = "IS_REQUIRED")
+ private boolean isRequired;
+ @Column(name="REQUIRED_TO_COMMANDLINE")
+ private boolean requiredToCMD;
+ @Column(name = "DATA_MOVEMENT")
+ private boolean dataMovement;
+ @Column(name = "DATA_NAME_LOCATION")
+ private String dataNameLocation;
+ @Column(name = "SEARCH_QUERY")
+ private String searchQuery;
+ @Column(name = "APP_ARGUMENT")
+ private String applicationArgument;
+
+ @ManyToOne(cascade= CascadeType.MERGE)
+ @JoinColumn(name = "INTERFACE_ID")
+ private ApplicationInterface applicationInterface;
+
+ public String getInterfaceID() {
+ return interfaceID;
+ }
+
+ public void setInterfaceID(String interfaceID) {
+ this.interfaceID = interfaceID;
+ }
+
+ public String getDataType() {
+ return dataType;
+ }
+
+ public void setDataType(String dataType) {
+ this.dataType = dataType;
+ }
+
+ public ApplicationInterface getApplicationInterface() {
+ return applicationInterface;
+ }
+
+ public void setApplicationInterface(ApplicationInterface applicationInterface) {
+ this.applicationInterface = applicationInterface;
+ }
+
+ public String getOutputKey() {
+ return outputKey;
+ }
+
+ public void setOutputKey(String outputKey) {
+ this.outputKey = outputKey;
+ }
+
+ public String getOutputVal() {
+ return outputVal;
+ }
+
+ public void setOutputVal(String outputVal) {
+ this.outputVal = outputVal;
+ }
+
+ public boolean isRequired() {
+ return isRequired;
+ }
+
+ public void setRequired(boolean isRequired) {
+ this.isRequired = isRequired;
+ }
+
+ public boolean isRequiredToCMD() {
+ return requiredToCMD;
+ }
+
+ public void setRequiredToCMD(boolean requiredToCMD) {
+ this.requiredToCMD = requiredToCMD;
+ }
+
+ public boolean isDataMovement() {
+ return dataMovement;
+ }
+
+ public void setDataMovement(boolean dataMovement) {
+ this.dataMovement = dataMovement;
+ }
+
+ public String getDataNameLocation() {
+ return dataNameLocation;
+ }
+
+ public void setDataNameLocation(String dataNameLocation) {
+ this.dataNameLocation = dataNameLocation;
+ }
+
+ public String getSearchQuery() {
+ return searchQuery;
+ }
+
+ public void setSearchQuery(String searchQuery) {
+ this.searchQuery = searchQuery;
+ }
+
+ public String getApplicationArgument() {
+ return applicationArgument;
+ }
+
+ public void setApplicationArgument(String applicationArgument) {
+ this.applicationArgument = applicationArgument;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/BatchQueue.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/BatchQueue.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/BatchQueue.java
new file mode 100644
index 0000000..4eb79dc
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/BatchQueue.java
@@ -0,0 +1,144 @@
+/*
+ *
+ * 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;
+
+import javax.persistence.CascadeType;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.IdClass;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
+import javax.persistence.Table;
+
+import org.apache.openjpa.persistence.DataCache;
+
+@DataCache
+@Entity
+@Table(name = "BATCH_QUEUE")
+@IdClass(BatchQueue_PK.class)
+public class BatchQueue implements Serializable {
+
+ @Id
+ @Column(name = "COMPUTE_RESOURCE_ID")
+ private String computeResourceId;
+
+ @ManyToOne(cascade= CascadeType.MERGE)
+ @JoinColumn(name = "COMPUTE_RESOURCE_ID")
+ private ComputeResource computeResource;
+
+ @Column(name = "MAX_RUNTIME")
+ private int maxRuntime;
+
+ @Column(name = "MAX_JOB_IN_QUEUE")
+ private int maxJobInQueue;
+
+ @Column(name = "QUEUE_DESCRIPTION")
+ private String queueDescription;
+
+ @Id
+ @Column(name = "QUEUE_NAME")
+ private String queueName;
+
+ @Column(name = "MAX_PROCESSORS")
+ private int maxProcessors;
+
+ @Column(name = "MAX_NODES")
+ private int maxNodes;
+
+ @Column(name = "MAX_MEMORY")
+ private int maxMemory;
+
+ public int getMaxMemory() {
+ return maxMemory;
+ }
+
+ public void setMaxMemory(int maxMemory) {
+ this.maxMemory = maxMemory;
+ }
+
+ public String getComputeResourceId() {
+ return computeResourceId;
+ }
+
+ public ComputeResource getComputeResource() {
+ return computeResource;
+ }
+
+ public int getMaxRuntime() {
+ return maxRuntime;
+ }
+
+ public int getMaxJobInQueue() {
+ return maxJobInQueue;
+ }
+
+ public String getQueueDescription() {
+ return queueDescription;
+ }
+
+ public String getQueueName() {
+ return queueName;
+ }
+
+ public int getMaxProcessors() {
+ return maxProcessors;
+ }
+
+ public int getMaxNodes() {
+ return maxNodes;
+ }
+
+ public void setComputeResourceId(String computeResourceId) {
+ this.computeResourceId=computeResourceId;
+ }
+
+ public void setComputeResource(ComputeResource computeResource) {
+ this.computeResource=computeResource;
+ }
+
+ public void setMaxRuntime(int maxRuntime) {
+ this.maxRuntime=maxRuntime;
+ }
+
+ public void setMaxJobInQueue(int maxJobInQueue) {
+ this.maxJobInQueue=maxJobInQueue;
+ }
+
+ public void setQueueDescription(String queueDescription) {
+ this.queueDescription=queueDescription;
+ }
+
+ public void setQueueName(String queueName) {
+ this.queueName=queueName;
+ }
+
+ public void setMaxProcessors(int maxProcessors) {
+ this.maxProcessors=maxProcessors;
+ }
+
+ public void setMaxNodes(int maxNodes) {
+ this.maxNodes=maxNodes;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/BatchQueue_PK.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/BatchQueue_PK.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/BatchQueue_PK.java
new file mode 100644
index 0000000..6e863f3
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/BatchQueue_PK.java
@@ -0,0 +1,63 @@
+/*
+ *
+ * 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 BatchQueue_PK implements Serializable {
+ private String computeResourceId;
+ private String queueName;
+ public BatchQueue_PK(String computeResourceId, String queueName){
+ this.computeResourceId = computeResourceId;
+ this.queueName = queueName;
+ }
+
+ public BatchQueue_PK() {
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ return false;
+ }
+
+ @Override
+ public int hashCode() {
+ return 1;
+ }
+
+ public String getComputeResourceId() {
+ return computeResourceId;
+ }
+
+ public String getQueueName() {
+ return queueName;
+ }
+
+ public void setComputeResourceId(String computeResourceId) {
+ this.computeResourceId=computeResourceId;
+ }
+
+ public void setQueueName(String queueName) {
+ this.queueName=queueName;
+ }
+}
+
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/CloudJobSubmission.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/CloudJobSubmission.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/CloudJobSubmission.java
new file mode 100644
index 0000000..1bd6554
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/CloudJobSubmission.java
@@ -0,0 +1,102 @@
+/*
+ *
+ * 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 org.apache.openjpa.persistence.DataCache;
+
+import javax.persistence.*;
+import java.io.Serializable;
+
+@DataCache
+@Entity
+@Table(name = "CLOUD_JOB_SUBMISSION")
+public class CloudJobSubmission implements Serializable {
+ @Id
+ @Column(name = "JOB_SUBMISSION_INTERFACE_ID")
+ private String jobSubmissionInterfaceId;
+
+ @Column(name = "SECURITY_PROTOCOL")
+ private String securityProtocol;
+
+ @Column(name = "NODE_ID")
+ private String nodeId;
+
+ @Column(name = "EXECUTABLE_TYPE")
+ private String executableType;
+
+ @Column(name = "PROVIDER_NAME")
+ private String providerName;
+
+ @Column(name = "USER_ACCOUNT_NAME")
+ private String userAccountName;
+
+
+ public String getExecutableType() {
+ return executableType;
+ }
+
+ public void setExecutableType(String executableType) {
+ this.executableType = executableType;
+ }
+
+ public String getProviderName() {
+ return providerName;
+ }
+
+ public void setProviderName(String providerName) {
+ this.providerName = providerName;
+ }
+
+ public String getUserAccountName() {
+ return userAccountName;
+ }
+
+ public void setUserAccountName(String userAccountName) {
+ this.userAccountName = userAccountName;
+ }
+
+ public String getNodeId() {
+ return nodeId;
+ }
+
+ public void setNodeId(String nodeId) {
+ this.nodeId = nodeId;
+ }
+
+ public String getJobSubmissionInterfaceId() {
+ return jobSubmissionInterfaceId;
+ }
+
+
+ public String getSecurityProtocol() {
+ return securityProtocol;
+ }
+
+
+ public void setJobSubmissionInterfaceId(String jobSubmissionInterfaceId) {
+ this.jobSubmissionInterfaceId=jobSubmissionInterfaceId;
+ }
+
+
+ public void setSecurityProtocol(String securityProtocol) {
+ this.securityProtocol=securityProtocol;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/ComputeResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/ComputeResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/ComputeResource.java
new file mode 100644
index 0000000..2c70f54
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/ComputeResource.java
@@ -0,0 +1,105 @@
+/*
+ *
+ * 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;
+import java.sql.Timestamp;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+import org.apache.openjpa.persistence.DataCache;
+
+@DataCache
+@Entity
+@Table(name = "COMPUTE_RESOURCE")
+public class ComputeResource implements Serializable {
+
+ @Column(name = "RESOURCE_DESCRIPTION")
+ private String resourceDescription;
+
+ @Id
+ @Column(name = "RESOURCE_ID")
+ private String resourceId;
+
+ @Column(name = "HOST_NAME")
+ private String hostName;
+
+ @Column(name = "MAX_MEMORY_NODE")
+ private int maxMemoryPerNode;
+
+ @Column(name = "CREATION_TIME")
+ private Timestamp creationTime;
+
+ @Column(name = "UPDATE_TIME")
+ private Timestamp updateTime;
+
+ public Timestamp getCreationTime() {
+ return creationTime;
+ }
+
+ public void setCreationTime(Timestamp creationTime) {
+ this.creationTime = creationTime;
+ }
+
+ public Timestamp getUpdateTime() {
+ return updateTime;
+ }
+
+ public void setUpdateTime(Timestamp updateTime) {
+ this.updateTime = updateTime;
+ }
+
+ public String getResourceDescription() {
+ return resourceDescription;
+ }
+
+ public String getResourceId() {
+ return resourceId;
+ }
+
+ public String getHostName() {
+ return hostName;
+ }
+
+ public void setResourceDescription(String resourceDescription) {
+ this.resourceDescription=resourceDescription;
+ }
+
+ public void setResourceId(String resourceId) {
+ this.resourceId=resourceId;
+ }
+
+ public void setHostName(String hostName) {
+ this.hostName=hostName;
+ }
+
+ public int getMaxMemoryPerNode() {
+ return maxMemoryPerNode;
+ }
+
+ public void setMaxMemoryPerNode(int maxMemoryPerNode) {
+ this.maxMemoryPerNode = maxMemoryPerNode;
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/ComputeResourceFileSystem.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/ComputeResourceFileSystem.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/ComputeResourceFileSystem.java
new file mode 100644
index 0000000..79f36c6
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/ComputeResourceFileSystem.java
@@ -0,0 +1,89 @@
+/*
+ *
+ * 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;
+
+import javax.persistence.CascadeType;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.IdClass;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
+import javax.persistence.Table;
+
+import org.apache.openjpa.persistence.DataCache;
+
+@DataCache
+@Entity
+@Table(name = "COMPUTE_RESOURCE_FILE_SYSTEM")
+@IdClass(ComputeResourceFileSystem_PK.class)
+public class ComputeResourceFileSystem implements Serializable {
+
+ @Id
+ @Column(name = "COMPUTE_RESOURCE_ID")
+ private String computeResourceId;
+
+ @ManyToOne(cascade= CascadeType.MERGE)
+ @JoinColumn(name = "COMPUTE_RESOURCE_ID")
+ private ComputeResource computeResource;
+
+ @Column(name = "PATH")
+ private String path;
+
+ @Id
+ @Column(name = "FILE_SYSTEM")
+ private String fileSystem;
+
+ public String getComputeResourceId() {
+ return computeResourceId;
+ }
+
+ public ComputeResource getComputeResource() {
+ return computeResource;
+ }
+
+ public String getPath() {
+ return path;
+ }
+
+ public String getFileSystem() {
+ return fileSystem;
+ }
+
+ public void setComputeResourceId(String computeResourceId) {
+ this.computeResourceId=computeResourceId;
+ }
+
+ public void setComputeResource(ComputeResource computeResource) {
+ this.computeResource=computeResource;
+ }
+
+ public void setPath(String path) {
+ this.path=path;
+ }
+
+ public void setFileSystem(String fileSystem) {
+ this.fileSystem=fileSystem;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/ComputeResourceFileSystem_PK.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/ComputeResourceFileSystem_PK.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/ComputeResourceFileSystem_PK.java
new file mode 100644
index 0000000..612b80f
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/ComputeResourceFileSystem_PK.java
@@ -0,0 +1,62 @@
+/*
+ *
+ * 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 ComputeResourceFileSystem_PK implements Serializable {
+ private String computeResourceId;
+ private String fileSystem;
+ public ComputeResourceFileSystem_PK(String computeResourceId, String fileSystem){
+ this.computeResourceId = computeResourceId;
+ this.fileSystem = fileSystem;
+ }
+
+ public ComputeResourceFileSystem_PK() {
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ return false;
+ }
+
+ @Override
+ public int hashCode() {
+ return 1;
+ }
+
+ public String getComputeResourceId() {
+ return computeResourceId;
+ }
+
+ public String getFileSystem() {
+ return fileSystem;
+ }
+
+ public void setComputeResourceId(String computeResourceId) {
+ this.computeResourceId=computeResourceId;
+ }
+
+ public void setFileSystem(String fileSystem) {
+ this.fileSystem=fileSystem;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/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
new file mode 100644
index 0000000..0424d89
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/ComputeResourcePreference.java
@@ -0,0 +1,154 @@
+/*
+ *
+ * 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.CascadeType;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.IdClass;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
+import javax.persistence.Table;
+
+@Entity
+@Table(name = "COMPUTE_RESOURCE_PREFERENCE")
+@IdClass(ComputeResourcePreferencePK.class)
+public class ComputeResourcePreference {
+ @Id
+ @Column(name = "GATEWAY_ID")
+ private String gatewayId;
+ @Id
+ @Column(name = "RESOURCE_ID")
+ private String resourceId;
+ @Column(name = "OVERRIDE_BY_AIRAVATA")
+ private boolean overrideByAiravata;
+ @Column(name = "PREFERED_JOB_SUB_PROTOCOL")
+ private String preferedJobSubmissionProtocol;
+ @Column(name = "PREFERED_DATA_MOVE_PROTOCOL")
+ private String preferedDataMoveProtocol;
+ @Column(name = "PREFERED_BATCH_QUEUE")
+ private String batchQueue;
+ @Column(name = "SCRATCH_LOCATION")
+ private String scratchLocation;
+ @Column(name = "ALLOCATION_PROJECT_NUMBER")
+ private String projectNumber;
+ @Column(name = "LOGIN_USERNAME")
+ private String loginUserName;
+
+ @ManyToOne(cascade= CascadeType.MERGE)
+ @JoinColumn(name = "RESOURCE_ID")
+ private ComputeResource computeHostResource;
+
+ @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 String getResourceId() {
+ return resourceId;
+ }
+
+ public void setResourceId(String resourceId) {
+ this.resourceId = resourceId;
+ }
+
+ public boolean isOverrideByAiravata() {
+ return overrideByAiravata;
+ }
+
+ public void setOverrideByAiravata(boolean overrideByAiravata) {
+ this.overrideByAiravata = overrideByAiravata;
+ }
+
+ public String getPreferedJobSubmissionProtocol() {
+ return preferedJobSubmissionProtocol;
+ }
+
+ public void setPreferedJobSubmissionProtocol(String preferedJobSubmissionProtocol) {
+ this.preferedJobSubmissionProtocol = preferedJobSubmissionProtocol;
+ }
+
+ public String getPreferedDataMoveProtocol() {
+ return preferedDataMoveProtocol;
+ }
+
+ public void setPreferedDataMoveProtocol(String preferedDataMoveProtocol) {
+ this.preferedDataMoveProtocol = preferedDataMoveProtocol;
+ }
+
+ public String getBatchQueue() {
+ return batchQueue;
+ }
+
+ public void setBatchQueue(String batchQueue) {
+ this.batchQueue = batchQueue;
+ }
+
+ public String getScratchLocation() {
+ return scratchLocation;
+ }
+
+ public void setScratchLocation(String scratchLocation) {
+ this.scratchLocation = scratchLocation;
+ }
+
+ public String getProjectNumber() {
+ return projectNumber;
+ }
+
+ public void setProjectNumber(String projectNumber) {
+ this.projectNumber = projectNumber;
+ }
+
+ public ComputeResource getComputeHostResource() {
+ return computeHostResource;
+ }
+
+ public void setComputeHostResource(ComputeResource computeHostResource) {
+ this.computeHostResource = computeHostResource;
+ }
+
+ 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;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/ComputeResourcePreferencePK.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/ComputeResourcePreferencePK.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/ComputeResourcePreferencePK.java
new file mode 100644
index 0000000..75c5f46
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/ComputeResourcePreferencePK.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 ComputeResourcePreferencePK implements Serializable {
+ private String gatewayId;
+ private String resourceId;
+
+ public ComputeResourcePreferencePK(String gatewayId, String resourceId) {
+ this.gatewayId = gatewayId;
+ this.resourceId = resourceId;
+ }
+
+ public ComputeResourcePreferencePK() {
+ ;
+ }
+
+ @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 getResourceId() {
+ return resourceId;
+ }
+
+ public void setResourceId(String resourceId) {
+ this.resourceId = resourceId;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/Configuration.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/Configuration.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/Configuration.java
new file mode 100644
index 0000000..2768e91
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/Configuration.java
@@ -0,0 +1,56 @@
+/*
+*
+* 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 org.apache.openjpa.persistence.DataCache;
+
+import javax.persistence.*;
+import java.io.Serializable;
+
+@DataCache
+@Entity
+@Table(name ="CONFIGURATION")
+@IdClass(Configuration_PK.class)
+public class Configuration implements Serializable {
+ @Id
+ @Column(name = "CONFIG_KEY")
+ private String config_key;
+
+ @Id
+ @Column(name = "CONFIG_VAL")
+ private String config_val;
+
+ public String getConfig_key() {
+ return config_key;
+ }
+
+ public String getConfig_val() {
+ return config_val;
+ }
+
+ public void setConfig_key(String config_key) {
+ this.config_key = config_key;
+ }
+
+ public void setConfig_val(String config_val) {
+ this.config_val = config_val;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/Configuration_PK.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/Configuration_PK.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/Configuration_PK.java
new file mode 100644
index 0000000..a19040c
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/Configuration_PK.java
@@ -0,0 +1,65 @@
+/*
+ *
+ * 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 Configuration_PK implements Serializable {
+ private String config_key;
+ private String config_val;
+
+ public Configuration_PK(String config_key, String config_val) {
+ this.config_key = config_key;
+ this.config_val = config_val;
+ }
+
+ public Configuration_PK() {
+ ;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ return false;
+ }
+
+ @Override
+ public int hashCode() {
+ return 1;
+ }
+
+ public String getConfig_key() {
+ return config_key;
+ }
+
+ public void setConfig_key(String config_key) {
+ this.config_key = config_key;
+ }
+
+ public void setConfig_val(String config_val) {
+ this.config_val = config_val;
+ }
+
+ public String getConfig_val() {
+ return config_val;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/DataMovementInterface.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/DataMovementInterface.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/DataMovementInterface.java
new file mode 100644
index 0000000..d95dfa0
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/DataMovementInterface.java
@@ -0,0 +1,124 @@
+/*
+ *
+ * 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;
+import java.sql.Timestamp;
+
+import javax.persistence.CascadeType;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.IdClass;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
+import javax.persistence.Table;
+
+import org.apache.openjpa.persistence.DataCache;
+
+@DataCache
+@Entity
+@Table(name = "DATA_MOVEMENT_INTERFACE")
+@IdClass(DataMovementInterface_PK.class)
+public class DataMovementInterface implements Serializable {
+
+ @Id
+ @Column(name = "COMPUTE_RESOURCE_ID")
+ private String computeResourceId;
+
+ @ManyToOne(cascade= CascadeType.MERGE)
+ @JoinColumn(name = "COMPUTE_RESOURCE_ID")
+ private ComputeResource computeResource;
+
+ @Column(name = "DATA_MOVEMENT_PROTOCOL")
+ private String dataMovementProtocol;
+
+ @Id
+ @Column(name = "DATA_MOVEMENT_INTERFACE_ID")
+ private String dataMovementInterfaceId;
+
+ @Column(name = "PRIORITY_ORDER")
+ private int priorityOrder;
+
+ @Column(name = "CREATION_TIME")
+ private Timestamp creationTime;
+
+ @Column(name = "UPDATE_TIME")
+ private Timestamp updateTime;
+
+ public Timestamp getCreationTime() {
+ return creationTime;
+ }
+
+ public void setCreationTime(Timestamp creationTime) {
+ this.creationTime = creationTime;
+ }
+
+ public Timestamp getUpdateTime() {
+ return updateTime;
+ }
+
+ public void setUpdateTime(Timestamp updateTime) {
+ this.updateTime = updateTime;
+ }
+
+
+ public String getComputeResourceId() {
+ return computeResourceId;
+ }
+
+ public ComputeResource getComputeResource() {
+ return computeResource;
+ }
+
+ public String getDataMovementProtocol() {
+ return dataMovementProtocol;
+ }
+
+ public String getDataMovementInterfaceId() {
+ return dataMovementInterfaceId;
+ }
+
+ public int getPriorityOrder() {
+ return priorityOrder;
+ }
+
+ public void setComputeResourceId(String computeResourceId) {
+ this.computeResourceId=computeResourceId;
+ }
+
+ public void setComputeResource(ComputeResource computeResource) {
+ this.computeResource=computeResource;
+ }
+
+ public void setDataMovementProtocol(String dataMovementProtocol) {
+ this.dataMovementProtocol=dataMovementProtocol;
+ }
+
+ public void setDataMovementInterfaceId(String dataMovementInterfaceId) {
+ this.dataMovementInterfaceId=dataMovementInterfaceId;
+ }
+
+ public void setPriorityOrder(int priorityOrder) {
+ this.priorityOrder=priorityOrder;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/DataMovementInterface_PK.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/DataMovementInterface_PK.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/DataMovementInterface_PK.java
new file mode 100644
index 0000000..be9e0f3
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/DataMovementInterface_PK.java
@@ -0,0 +1,62 @@
+/*
+ *
+ * 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 DataMovementInterface_PK implements Serializable {
+ private String computeResourceId;
+ private String dataMovementInterfaceId;
+ public DataMovementInterface_PK(String computeResourceId, String dataMovementInterfaceId){
+ this.computeResourceId = computeResourceId;
+ this.dataMovementInterfaceId = dataMovementInterfaceId;
+ }
+
+ public DataMovementInterface_PK() {
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ return false;
+ }
+
+ @Override
+ public int hashCode() {
+ return 1;
+ }
+
+ public String getComputeResourceId() {
+ return computeResourceId;
+ }
+
+ public String getDataMovementInterfaceId() {
+ return dataMovementInterfaceId;
+ }
+
+ public void setComputeResourceId(String computeResourceId) {
+ this.computeResourceId=computeResourceId;
+ }
+
+ public void setDataMovementInterfaceId(String dataMovementInterfaceId) {
+ this.dataMovementInterfaceId=dataMovementInterfaceId;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/DataMovementProtocol.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/DataMovementProtocol.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/DataMovementProtocol.java
new file mode 100644
index 0000000..d45c4e8
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/DataMovementProtocol.java
@@ -0,0 +1,76 @@
+///*
+// *
+// * 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.aiaravata.application.catalog.data.model;
+//
+//import javax.persistence.*;
+//import java.io.Serializable;
+//
+//@Entity
+//@Table(name = "DATA_MOVEMENT_PROTOCOL")
+//@IdClass(DataMovementProtocolPK.class)
+//public class DataMovementProtocol implements Serializable {
+// @Id
+// @Column(name = "RESOURCE_ID")
+// private String resourceID;
+// @Id
+// @Column(name = "DATA_MOVE_ID")
+// private String dataMoveID;
+// @Id
+// @Column(name = "DATA_MOVE_TYPE")
+// private String dataMoveType;
+//
+// @ManyToOne(cascade= CascadeType.MERGE)
+// @JoinColumn(name = "RESOURCE_ID")
+// private ComputeResource computeResource;
+//
+// public String getResourceID() {
+// return resourceID;
+// }
+//
+// public void setResourceID(String resourceID) {
+// this.resourceID = resourceID;
+// }
+//
+// public String getDataMoveID() {
+// return dataMoveID;
+// }
+//
+// public void setDataMoveID(String dataMoveID) {
+// this.dataMoveID = dataMoveID;
+// }
+//
+// public String getDataMoveType() {
+// return dataMoveType;
+// }
+//
+// public void setDataMoveType(String dataMoveType) {
+// this.dataMoveType = dataMoveType;
+// }
+//
+// public ComputeResource getComputeResource() {
+// return computeResource;
+// }
+//
+// public void setComputeResource(ComputeResource computeResource) {
+// this.computeResource = computeResource;
+// }
+//}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/DataMovementProtocolPK.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/DataMovementProtocolPK.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/DataMovementProtocolPK.java
new file mode 100644
index 0000000..9e53d1f
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/DataMovementProtocolPK.java
@@ -0,0 +1,74 @@
+///*
+// *
+// * 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.aiaravata.application.catalog.data.model;
+//
+//import java.io.Serializable;
+//
+//public class DataMovementProtocolPK implements Serializable {
+// private String resourceID;
+// private String dataMoveID;
+// private String dataMoveType;
+//
+// public DataMovementProtocolPK(String resourceID, String dataMoveID, String dataMoveType) {
+// this.resourceID = resourceID;
+// this.dataMoveID = dataMoveID;
+// this.dataMoveType = dataMoveType;
+// }
+//
+// public DataMovementProtocolPK() {
+// ;
+// }
+//
+// @Override
+// public boolean equals(Object o) {
+// return false;
+// }
+//
+// @Override
+// public int hashCode() {
+// return 1;
+// }
+//
+// public String getResourceID() {
+// return resourceID;
+// }
+//
+// public void setResourceID(String resourceID) {
+// this.resourceID = resourceID;
+// }
+//
+// public String getDataMoveID() {
+// return dataMoveID;
+// }
+//
+// public void setDataMoveID(String dataMoveID) {
+// this.dataMoveID = dataMoveID;
+// }
+//
+// public String getDataMoveType() {
+// return dataMoveType;
+// }
+//
+// public void setDataMoveType(String dataMoveType) {
+// this.dataMoveType = dataMoveType;
+// }
+//}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/GSISSHExport.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/GSISSHExport.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/GSISSHExport.java
new file mode 100644
index 0000000..6c17d0f
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/GSISSHExport.java
@@ -0,0 +1,73 @@
+/*
+ *
+ * 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;
+
+import javax.persistence.CascadeType;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.IdClass;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
+import javax.persistence.Table;
+
+@Entity
+@Table(name = "GSISSH_EXPORT")
+@IdClass(GSISSHExportPK.class)
+public class GSISSHExport implements Serializable {
+ @Id
+ @Column(name = "SUBMISSION_ID")
+ private String submissionID;
+ @Id
+ @Column(name = "EXPORT")
+ private String export;
+
+ @ManyToOne(cascade= CascadeType.MERGE)
+ @JoinColumn(name = "SUBMISSION_ID")
+ private GSISSHSubmission gsisshJobSubmission;
+
+ public String getSubmissionID() {
+ return submissionID;
+ }
+
+ public void setSubmissionID(String submissionID) {
+ this.submissionID = submissionID;
+ }
+
+ public String getExport() {
+ return export;
+ }
+
+ public void setExport(String export) {
+ this.export = export;
+ }
+
+ public GSISSHSubmission getGsisshJobSubmission() {
+ return gsisshJobSubmission;
+ }
+
+ public void setGsisshJobSubmission(GSISSHSubmission gsisshJobSubmission) {
+ this.gsisshJobSubmission = gsisshJobSubmission;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/GSISSHExportPK.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/GSISSHExportPK.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/GSISSHExportPK.java
new file mode 100644
index 0000000..07cff7f
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/GSISSHExportPK.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 GSISSHExportPK implements Serializable {
+ private String submissionID;
+ private String export;
+
+ public GSISSHExportPK(String submissionID, String export) {
+ this.submissionID = submissionID;
+ this.export = export;
+ }
+
+ public GSISSHExportPK() {
+ ;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ return false;
+ }
+
+ @Override
+ public int hashCode() {
+ return 1;
+ }
+
+ public String getSubmissionID() {
+ return submissionID;
+ }
+
+ public void setSubmissionID(String submissionID) {
+ this.submissionID = submissionID;
+ }
+
+ public String getExport() {
+ return export;
+ }
+
+ public void setExport(String export) {
+ this.export = export;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/GSISSHSubmission.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/GSISSHSubmission.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/GSISSHSubmission.java
new file mode 100644
index 0000000..92d448e
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/GSISSHSubmission.java
@@ -0,0 +1,82 @@
+/*
+ *
+ * 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.*;
+import java.io.Serializable;
+
+@Entity
+@Table(name = "GSISSH_SUBMISSION")
+public class GSISSHSubmission implements Serializable {
+ @Id
+ @Column(name = "SUBMISSION_ID")
+ private String submissionID;
+ @Column(name = "RESOURCE_JOB_MANAGER")
+ private String resourceJobManager;
+ @Column(name = "SSH_PORT")
+ private int sshPort;
+ @Column(name = "INSTALLED_PATH")
+ private String installedPath;
+ @Column(name = "MONITOR_MODE")
+ private String monitorMode;
+
+ public String getSubmissionID() {
+ return submissionID;
+ }
+
+ public void setSubmissionID(String submissionID) {
+ this.submissionID = submissionID;
+ }
+
+ public String getResourceJobManager() {
+ return resourceJobManager;
+ }
+
+ public void setResourceJobManager(String resourceJobManager) {
+ this.resourceJobManager = resourceJobManager;
+ }
+
+ public int getSshPort() {
+ return sshPort;
+ }
+
+ public void setSshPort(int sshPort) {
+ this.sshPort = sshPort;
+ }
+
+ public String getInstalledPath() {
+ return installedPath;
+ }
+
+ public void setInstalledPath(String installedPath) {
+ this.installedPath = installedPath;
+ }
+
+ public String getMonitorMode() {
+ return monitorMode;
+ }
+
+ public void setMonitorMode(String monitorMode) {
+ this.monitorMode = monitorMode;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/GatewayProfile.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/GatewayProfile.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/GatewayProfile.java
new file mode 100644
index 0000000..d369e5d
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/GatewayProfile.java
@@ -0,0 +1,68 @@
+/*
+ *
+ * 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.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.Table;
+import java.io.Serializable;
+import java.sql.Timestamp;
+
+@Entity
+@Table(name = "GATEWAY_PROFILE")
+public class GatewayProfile implements Serializable {
+ @Id
+ @Column(name = "GATEWAY_ID")
+ private String gatewayID;
+ @Column(name = "CREATION_TIME")
+ private Timestamp creationTime;
+
+ @Column(name = "UPDATE_TIME")
+ private Timestamp updateTime;
+
+ public Timestamp getCreationTime() {
+ return creationTime;
+ }
+
+ public void setCreationTime(Timestamp creationTime) {
+ this.creationTime = creationTime;
+ }
+
+ public Timestamp getUpdateTime() {
+ return updateTime;
+ }
+
+ public void setUpdateTime(Timestamp updateTime) {
+ this.updateTime = updateTime;
+ }
+
+
+ public String getGatewayID() {
+ return gatewayID;
+ }
+
+ public void setGatewayID(String gatewayID) {
+ this.gatewayID = gatewayID;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/GlobusGKEndPointPK.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/GlobusGKEndPointPK.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/GlobusGKEndPointPK.java
new file mode 100644
index 0000000..9d1ebce
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/GlobusGKEndPointPK.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 GlobusGKEndPointPK implements Serializable {
+ private String submissionID;
+ private String endpoint;
+
+ public GlobusGKEndPointPK(String submissionID, String endpoint) {
+ this.submissionID = submissionID;
+ this.endpoint = endpoint;
+ }
+
+ public GlobusGKEndPointPK() {
+ ;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ return false;
+ }
+
+ @Override
+ public int hashCode() {
+ return 1;
+ }
+
+ public String getSubmissionID() {
+ return submissionID;
+ }
+
+ public void setSubmissionID(String submissionID) {
+ this.submissionID = submissionID;
+ }
+
+ public String getEndpoint() {
+ return endpoint;
+ }
+
+ public void setEndpoint(String endpoint) {
+ this.endpoint = endpoint;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/GlobusGKEndpoint.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/GlobusGKEndpoint.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/GlobusGKEndpoint.java
new file mode 100644
index 0000000..72301bc
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/GlobusGKEndpoint.java
@@ -0,0 +1,65 @@
+/*
+ *
+ * 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.*;
+import java.io.Serializable;
+
+@Entity
+@Table(name = "GLOBUS_GK_ENDPOINT")
+@IdClass(GlobusGKEndPointPK.class)
+public class GlobusGKEndpoint implements Serializable {
+ @Id
+ @Column(name = "SUBMISSION_ID")
+ private String submissionID;
+ @Id
+ @Column(name = "ENDPOINT")
+ private String endpoint;
+
+ @ManyToOne(cascade= CascadeType.MERGE)
+ @JoinColumn(name = "SUBMISSION_ID")
+ private GlobusJobSubmission globusSubmission;
+
+ public String getSubmissionID() {
+ return submissionID;
+ }
+
+ public void setSubmissionID(String submissionID) {
+ this.submissionID = submissionID;
+ }
+
+ public String getEndpoint() {
+ return endpoint;
+ }
+
+ public void setEndpoint(String endpoint) {
+ this.endpoint = endpoint;
+ }
+
+ public GlobusJobSubmission getGlobusSubmission() {
+ return globusSubmission;
+ }
+
+ public void setGlobusSubmission(GlobusJobSubmission globusSubmission) {
+ this.globusSubmission = globusSubmission;
+ }
+}
[28/52] [abbrv] [partial] airavata git commit: registry refactoring
Posted by sh...@apache.org.
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/ExperimentResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/ExperimentResource.java b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/ExperimentResource.java
deleted file mode 100644
index 82c2c2b..0000000
--- a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/ExperimentResource.java
+++ /dev/null
@@ -1,831 +0,0 @@
-/*
-*
-* 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.experiment.catalog.resources;
-
-import java.sql.Timestamp;
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.persistence.EntityManager;
-import javax.persistence.Query;
-
-import org.apache.airavata.experiment.catalog.Resource;
-import org.apache.airavata.experiment.catalog.ResourceType;
-import org.apache.airavata.experiment.catalog.ResourceUtils;
-import org.apache.airavata.experiment.catalog.model.*;
-import org.apache.airavata.experiment.catalog.utils.QueryGenerator;
-import org.apache.airavata.registry.cpi.RegistryException;
-import org.apache.airavata.registry.cpi.utils.StatusType;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class ExperimentResource extends AbstractResource {
- private static final Logger logger = LoggerFactory.getLogger(ExperimentResource.class);
-// private WorkerResource worker;
- private String executionUser;
- private String expID;
- private Timestamp creationTime;
- private String gatewayId;
- private String projectId;
- private String expName;
- private String description;
- private String applicationId;
- private String applicationVersion;
- private String workflowTemplateId;
- private String workflowTemplateVersion;
- private String workflowExecutionId;
- private boolean enableEmailNotifications;
- private String gatewayExecutionId;
- private List<ExperimentInputResource> experimentInputResources;
- private List<ExperimentOutputResource> experimentOutputputResources;
- private ComputationSchedulingResource computationSchedulingResource;
- private ConfigDataResource userConfigDataResource;
- private List<WorkflowNodeDetailResource> workflowNodeDetailResourceList;
- private List<StatusResource> stateChangeList;
- private List<ErrorDetailResource> errorDetailList;
- private StatusResource experimentStatus;
- private List<NotificationEmailResource> emailResourceList;
-
- /**
- *
- * @return experiment ID
- */
- public String getExpID() {
- return expID;
- }
-
- public Timestamp getCreationTime() {
- return creationTime;
- }
-
- public void setCreationTime(Timestamp creationTime) {
- this.creationTime = creationTime;
- }
-
- public String getExpName() {
- return expName;
- }
-
- public void setExpName(String expName) {
- this.expName = expName;
- }
-
- public String getApplicationId() {
- return applicationId;
- }
-
- public void setApplicationId(String applicationId) {
- this.applicationId = applicationId;
- }
-
- public String getApplicationVersion() {
- return applicationVersion;
- }
-
- public void setApplicationVersion(String applicationVersion) {
- this.applicationVersion = applicationVersion;
- }
-
- public String getWorkflowTemplateId() {
- return workflowTemplateId;
- }
-
- public void setWorkflowTemplateId(String workflowTemplateId) {
- this.workflowTemplateId = workflowTemplateId;
- }
-
- public String getWorkflowTemplateVersion() {
- return workflowTemplateVersion;
- }
-
- public void setWorkflowTemplateVersion(String workflowTemplateVersion) {
- this.workflowTemplateVersion = workflowTemplateVersion;
- }
-
- public String getWorkflowExecutionId() {
- return workflowExecutionId;
- }
-
- public void setWorkflowExecutionId(String workflowExecutionId) {
- this.workflowExecutionId = workflowExecutionId;
- }
-
- public String getDescription() {
- return description;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
- public boolean isEnableEmailNotifications() {
- return enableEmailNotifications;
- }
-
- public void setEnableEmailNotifications(boolean enableEmailNotifications) {
- this.enableEmailNotifications = enableEmailNotifications;
- }
-
- public String getGatewayExecutionId() {
- return gatewayExecutionId;
- }
-
- public void setGatewayExecutionId(String gatewayExecutionId) {
- this.gatewayExecutionId = gatewayExecutionId;
- }
-
- public String getGatewayId() {
- return gatewayId;
- }
-
- public void setGatewayId(String gatewayId) {
- this.gatewayId = gatewayId;
- }
-
- public String getProjectId() {
- return projectId;
- }
-
- public void setProjectId(String projectId) {
- this.projectId = projectId;
- }
-
- public List<ExperimentInputResource> getExperimentInputResources() {
- return experimentInputResources;
- }
-
- public void setExperimentInputResources(List<ExperimentInputResource> experimentInputResources) {
- this.experimentInputResources = experimentInputResources;
- }
-
- public List<ExperimentOutputResource> getExperimentOutputputResources() {
- return experimentOutputputResources;
- }
-
- public void setExperimentOutputputResources(List<ExperimentOutputResource> experimentOutputputResources) {
- this.experimentOutputputResources = experimentOutputputResources;
- }
-
- public ComputationSchedulingResource getComputationSchedulingResource() {
- return computationSchedulingResource;
- }
-
- public void setComputationSchedulingResource(ComputationSchedulingResource computationSchedulingResource) {
- this.computationSchedulingResource = computationSchedulingResource;
- }
-
- public ConfigDataResource getUserConfigDataResource() {
- return userConfigDataResource;
- }
-
- public void setUserConfigDataResource(ConfigDataResource userConfigDataResource) {
- this.userConfigDataResource = userConfigDataResource;
- }
-
- public List<WorkflowNodeDetailResource> getWorkflowNodeDetailResourceList() {
- return workflowNodeDetailResourceList;
- }
-
- public void setWorkflowNodeDetailResourceList(List<WorkflowNodeDetailResource> workflowNodeDetailResourceList) {
- this.workflowNodeDetailResourceList = workflowNodeDetailResourceList;
- }
-
- public List<StatusResource> getStateChangeList() {
- return stateChangeList;
- }
-
- public void setStateChangeList(List<StatusResource> stateChangeList) {
- this.stateChangeList = stateChangeList;
- }
-
- public List<ErrorDetailResource> getErrorDetailList() {
- return errorDetailList;
- }
-
- public void setErrorDetailList(List<ErrorDetailResource> errorDetailList) {
- this.errorDetailList = errorDetailList;
- }
-
- public void setExperimentStatus(StatusResource experimentStatus) {
- this.experimentStatus = experimentStatus;
- }
-
- public List<NotificationEmailResource> getEmailResourceList() {
- return emailResourceList;
- }
-
- public void setEmailResourceList(List<NotificationEmailResource> emailResourceList) {
- this.emailResourceList = emailResourceList;
- }
-
-
- /**
- * Since experiments are at the leaf level, this method is not
- * valid for an experiment
- * @param type child resource types
- * @return UnsupportedOperationException
- */
- public Resource create(ResourceType type) throws RegistryException {
- switch (type){
- case EXPERIMENT_INPUT:
- ExperimentInputResource inputResource = new ExperimentInputResource();
- inputResource.setExperimentId(expID);
- return inputResource;
- case EXPERIMENT_OUTPUT:
- ExperimentOutputResource experimentOutputResource = new ExperimentOutputResource();
- experimentOutputResource.setExperimentId(expID);
- return experimentOutputResource;
- case NOTIFICATION_EMAIL:
- NotificationEmailResource emailResource = new NotificationEmailResource();
- emailResource.setExperimentId(expID);
- return emailResource;
- case WORKFLOW_NODE_DETAIL:
- WorkflowNodeDetailResource nodeDetailResource = new WorkflowNodeDetailResource();
- nodeDetailResource.setExperimentId(expID);
- return nodeDetailResource;
- case ERROR_DETAIL:
- ErrorDetailResource errorDetailResource = new ErrorDetailResource();
- errorDetailResource.setExperimentId(expID);
- return errorDetailResource;
- case STATUS:
- StatusResource statusResource = new StatusResource();
- statusResource.setExperimentId(expID);
- return statusResource;
- case CONFIG_DATA:
- ConfigDataResource configDataResource = new ConfigDataResource();
- configDataResource.setExperimentId(expID);
- return configDataResource;
- case COMPUTATIONAL_RESOURCE_SCHEDULING:
- ComputationSchedulingResource schedulingResource = new ComputationSchedulingResource();
- schedulingResource.setExperimentId(expID);
- return schedulingResource;
- case ADVANCE_INPUT_DATA_HANDLING:
- AdvanceInputDataHandlingResource dataHandlingResource = new AdvanceInputDataHandlingResource();
- dataHandlingResource.setExperimentId(expID);
- return dataHandlingResource;
- case ADVANCE_OUTPUT_DATA_HANDLING:
- AdvancedOutputDataHandlingResource outputDataHandlingResource = new AdvancedOutputDataHandlingResource();
- outputDataHandlingResource.setExperimentId(expID);
- return outputDataHandlingResource;
- case QOS_PARAM:
- QosParamResource qosParamResource = new QosParamResource();
- qosParamResource.setExperimentId(expID);
- return qosParamResource;
- default:
- logger.error("Unsupported resource type for experiment resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported resource type for experiment resource.");
- }
- }
-
- /**
- *
- * @param type child resource types
- * @param name name of the child resource
- * @return UnsupportedOperationException
- */
- public void remove(ResourceType type, Object name) throws RegistryException {
- EntityManager em = null;
- try {
- em = ResourceUtils.getEntityManager();
- em.getTransaction().begin();
- Query q;
- QueryGenerator generator;
- switch (type) {
- case EXPERIMENT_INPUT:
- generator = new QueryGenerator(EXPERIMENT_INPUT);
- generator.setParameter(ExperimentInputConstants.EXPERIMENT_ID, name);
- q = generator.deleteQuery(em);
- q.executeUpdate();
- break;
- case EXPERIMENT_OUTPUT:
- generator = new QueryGenerator(EXPERIMENT_OUTPUT);
- generator.setParameter(ExperimentOutputConstants.EXPERIMENT_ID, name);
- q = generator.deleteQuery(em);
- q.executeUpdate();
- break;
- case NOTIFICATION_EMAIL:
- generator = new QueryGenerator(NOTIFICATION_EMAIL);
- generator.setParameter(NotificationEmailConstants.EXPERIMENT_ID, name);
- q = generator.deleteQuery(em);
- q.executeUpdate();
- break;
- case WORKFLOW_NODE_DETAIL:
- generator = new QueryGenerator(WORKFLOW_NODE_DETAIL);
- generator.setParameter(WorkflowNodeDetailsConstants.NODE_INSTANCE_ID, name);
- q = generator.deleteQuery(em);
- q.executeUpdate();
- break;
- case ERROR_DETAIL:
- generator = new QueryGenerator(ERROR_DETAIL);
- generator.setParameter(ErrorDetailConstants.EXPERIMENT_ID, name);
- q = generator.deleteQuery(em);
- q.executeUpdate();
- break;
- case STATUS:
- generator = new QueryGenerator(STATUS);
- generator.setParameter(StatusConstants.EXPERIMENT_ID, name);
- generator.setParameter(StatusConstants.STATUS_TYPE, StatusType.EXPERIMENT.toString());
- q = generator.deleteQuery(em);
- q.executeUpdate();
- break;
- case CONFIG_DATA:
- generator = new QueryGenerator(CONFIG_DATA);
- generator.setParameter(ExperimentConfigurationDataConstants.EXPERIMENT_ID, name);
- q = generator.deleteQuery(em);
- q.executeUpdate();
- break;
- case COMPUTATIONAL_RESOURCE_SCHEDULING:
- generator = new QueryGenerator(COMPUTATIONAL_RESOURCE_SCHEDULING);
- generator.setParameter(ComputationalResourceSchedulingConstants.EXPERIMENT_ID, name);
- q = generator.deleteQuery(em);
- q.executeUpdate();
- break;
- case ADVANCE_INPUT_DATA_HANDLING:
- generator = new QueryGenerator(ADVANCE_INPUT_DATA_HANDLING);
- generator.setParameter(AdvancedInputDataHandlingConstants.EXPERIMENT_ID, name);
- q = generator.deleteQuery(em);
- q.executeUpdate();
- break;
- case ADVANCE_OUTPUT_DATA_HANDLING:
- generator = new QueryGenerator(ADVANCE_OUTPUT_DATA_HANDLING);
- generator.setParameter(AdvancedOutputDataHandlingConstants.EXPERIMENT_ID, name);
- q = generator.deleteQuery(em);
- q.executeUpdate();
- break;
- case QOS_PARAM:
- generator = new QueryGenerator(QOS_PARAMS);
- generator.setParameter(QosParamsConstants.EXPERIMENT_ID, name);
- q = generator.deleteQuery(em);
- q.executeUpdate();
- break;
- default:
- logger.error("Unsupported resource type for experiment resource.", new IllegalArgumentException());
- break;
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new RegistryException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- /**
- *
- * @param type child resource types
- * @param name name of the child resource
- * @return UnsupportedOperationException
- */
- public Resource get(ResourceType type, Object name) throws RegistryException {
- EntityManager em = null;
- try {
- em = ResourceUtils.getEntityManager();
- em.getTransaction().begin();
- QueryGenerator generator;
- Query q;
- switch (type) {
- case EXPERIMENT_INPUT:
- generator = new QueryGenerator(EXPERIMENT_INPUT);
- generator.setParameter(ExperimentInputConstants.EXPERIMENT_ID, name);
- q = generator.selectQuery(em);
- Experiment_Input experimentInput = (Experiment_Input) q.getSingleResult();
- ExperimentInputResource inputResource = (ExperimentInputResource) Utils.getResource(ResourceType.EXPERIMENT_INPUT, experimentInput);
- em.getTransaction().commit();
- em.close();
- return inputResource;
- case EXPERIMENT_OUTPUT:
- generator = new QueryGenerator(EXPERIMENT_OUTPUT);
- generator.setParameter(ExperimentOutputConstants.EXPERIMENT_ID, name);
- q = generator.selectQuery(em);
- Experiment_Output experimentOutput = (Experiment_Output) q.getSingleResult();
- ExperimentOutputResource outputResource = (ExperimentOutputResource) Utils.getResource(ResourceType.EXPERIMENT_OUTPUT, experimentOutput);
- em.getTransaction().commit();
- em.close();
- return outputResource;
- case NOTIFICATION_EMAIL:
- generator = new QueryGenerator(NOTIFICATION_EMAIL);
- generator.setParameter(NotificationEmailConstants.EXPERIMENT_ID, name);
- q = generator.selectQuery(em);
- Notification_Email notificationEmail = (Notification_Email) q.getSingleResult();
- NotificationEmailResource notificationEmailResource = (NotificationEmailResource) Utils.getResource(ResourceType.NOTIFICATION_EMAIL, notificationEmail);
- em.getTransaction().commit();
- em.close();
- return notificationEmailResource;
- case WORKFLOW_NODE_DETAIL:
- generator = new QueryGenerator(WORKFLOW_NODE_DETAIL);
- generator.setParameter(WorkflowNodeDetailsConstants.NODE_INSTANCE_ID, name);
- q = generator.selectQuery(em);
- WorkflowNodeDetail workflowNodeDetail = (WorkflowNodeDetail) q.getSingleResult();
- WorkflowNodeDetailResource nodeDetailResource = (WorkflowNodeDetailResource) Utils.getResource(ResourceType.WORKFLOW_NODE_DETAIL, workflowNodeDetail);
- em.getTransaction().commit();
- em.close();
- return nodeDetailResource;
- case ERROR_DETAIL:
- generator = new QueryGenerator(ERROR_DETAIL);
- generator.setParameter(ErrorDetailConstants.EXPERIMENT_ID, name);
- q = generator.selectQuery(em);
- ErrorDetail errorDetail = (ErrorDetail) q.getSingleResult();
- ErrorDetailResource errorDetailResource = (ErrorDetailResource) Utils.getResource(ResourceType.ERROR_DETAIL, errorDetail);
- em.getTransaction().commit();
- em.close();
- return errorDetailResource;
- case STATUS:
- generator = new QueryGenerator(STATUS);
- generator.setParameter(StatusConstants.EXPERIMENT_ID, name);
- generator.setParameter(StatusConstants.STATUS_TYPE, StatusType.EXPERIMENT.toString());
- q = generator.selectQuery(em);
- Status status = (Status) q.getSingleResult();
- StatusResource statusResource = (StatusResource) Utils.getResource(ResourceType.STATUS, status);
- em.getTransaction().commit();
- em.close();
- return statusResource;
- case CONFIG_DATA:
- generator = new QueryGenerator(CONFIG_DATA);
- generator.setParameter(ExperimentConfigurationDataConstants.EXPERIMENT_ID, name);
- q = generator.selectQuery(em);
- ExperimentConfigData configData = (ExperimentConfigData) q.getSingleResult();
- ConfigDataResource configDataResource = (ConfigDataResource) Utils.getResource(ResourceType.CONFIG_DATA, configData);
- em.getTransaction().commit();
- em.close();
- return configDataResource;
- case COMPUTATIONAL_RESOURCE_SCHEDULING:
- generator = new QueryGenerator(COMPUTATIONAL_RESOURCE_SCHEDULING);
- generator.setParameter(ComputationalResourceSchedulingConstants.EXPERIMENT_ID, name);
- generator.setParameter(ComputationalResourceSchedulingConstants.TASK_ID, null);
- q = generator.selectQuery(em);
- Computational_Resource_Scheduling scheduling = (Computational_Resource_Scheduling) q.getSingleResult();
- ComputationSchedulingResource schedulingResource = (ComputationSchedulingResource) Utils.getResource(ResourceType.COMPUTATIONAL_RESOURCE_SCHEDULING, scheduling);
- em.getTransaction().commit();
- em.close();
- return schedulingResource;
- case ADVANCE_INPUT_DATA_HANDLING:
- generator = new QueryGenerator(ADVANCE_INPUT_DATA_HANDLING);
- generator.setParameter(AdvancedInputDataHandlingConstants.EXPERIMENT_ID, name);
- generator.setParameter(AdvancedInputDataHandlingConstants.TASK_ID, null);
- q = generator.selectQuery(em);
- AdvancedInputDataHandling inputDataHandling = (AdvancedInputDataHandling) q.getSingleResult();
- AdvanceInputDataHandlingResource dataHandlingResource = (AdvanceInputDataHandlingResource) Utils.getResource(ResourceType.ADVANCE_INPUT_DATA_HANDLING, inputDataHandling);
- em.getTransaction().commit();
- em.close();
- return dataHandlingResource;
- case ADVANCE_OUTPUT_DATA_HANDLING:
- generator = new QueryGenerator(ADVANCE_OUTPUT_DATA_HANDLING);
- generator.setParameter(AdvancedOutputDataHandlingConstants.EXPERIMENT_ID, name);
- generator.setParameter(AdvancedOutputDataHandlingConstants.TASK_ID, null);
- q = generator.selectQuery(em);
- AdvancedOutputDataHandling outputDataHandling = (AdvancedOutputDataHandling) q.getSingleResult();
- AdvancedOutputDataHandlingResource outputDataHandlingResource = (AdvancedOutputDataHandlingResource) Utils.getResource(ResourceType.ADVANCE_OUTPUT_DATA_HANDLING, outputDataHandling);
- em.getTransaction().commit();
- em.close();
- return outputDataHandlingResource;
- case QOS_PARAM:
- generator = new QueryGenerator(QOS_PARAMS);
- generator.setParameter(QosParamsConstants.EXPERIMENT_ID, name);
- generator.setParameter(QosParamsConstants.TASK_ID, null);
- q = generator.selectQuery(em);
- QosParam qosParam = (QosParam) q.getSingleResult();
- QosParamResource qosParamResource = (QosParamResource) Utils.getResource(ResourceType.QOS_PARAM, qosParam);
- em.getTransaction().commit();
- em.close();
- return qosParamResource;
- default:
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported resource type for experiment resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported resource type for experiment data resource.");
- }
- } catch (Exception e) {
- throw new RegistryException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
-
- }
-
- /**
- *
- * @param type child resource types
- * @return UnsupportedOperationException
- */
- public List<Resource> get(ResourceType type) throws RegistryException{
- List<Resource> resourceList = new ArrayList<Resource>();
- EntityManager em = null;
- try {
- em = ResourceUtils.getEntityManager();
- em.getTransaction().begin();
- Query q;
- QueryGenerator generator;
- List results;
- switch (type) {
- case EXPERIMENT_INPUT:
- generator = new QueryGenerator(EXPERIMENT_INPUT);
- generator.setParameter(ExperimentInputConstants.EXPERIMENT_ID, expID);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- Experiment_Input exInput = (Experiment_Input) result;
- ExperimentInputResource inputResource =
- (ExperimentInputResource) Utils.getResource(ResourceType.EXPERIMENT_INPUT, exInput);
- resourceList.add(inputResource);
- }
- }
- break;
- case EXPERIMENT_OUTPUT:
- generator = new QueryGenerator(EXPERIMENT_OUTPUT);
- generator.setParameter(ExperimentOutputConstants.EXPERIMENT_ID, expID);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- Experiment_Output output = (Experiment_Output) result;
- ExperimentOutputResource outputResource =
- (ExperimentOutputResource) Utils.getResource(ResourceType.EXPERIMENT_OUTPUT, output);
- resourceList.add(outputResource);
- }
- }
- break;
- case NOTIFICATION_EMAIL:
- generator = new QueryGenerator(NOTIFICATION_EMAIL);
- generator.setParameter(NotificationEmailConstants.EXPERIMENT_ID, expID);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- Notification_Email notificationEmail = (Notification_Email) result;
- NotificationEmailResource emailResource =
- (NotificationEmailResource) Utils.getResource(ResourceType.NOTIFICATION_EMAIL, notificationEmail);
- resourceList.add(emailResource);
- }
- }
- break;
- case WORKFLOW_NODE_DETAIL:
- generator = new QueryGenerator(WORKFLOW_NODE_DETAIL);
- generator.setParameter(WorkflowNodeDetailsConstants.EXPERIMENT_ID, expID);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- WorkflowNodeDetail nodeDetail = (WorkflowNodeDetail) result;
- WorkflowNodeDetailResource nodeDetailResource =
- (WorkflowNodeDetailResource) Utils.getResource(ResourceType.WORKFLOW_NODE_DETAIL, nodeDetail);
- resourceList.add(nodeDetailResource);
- }
- }
- break;
- case ERROR_DETAIL:
- generator = new QueryGenerator(ERROR_DETAIL);
- generator.setParameter(ErrorDetailConstants.EXPERIMENT_ID, expID);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- ErrorDetail errorDetail = (ErrorDetail) result;
- ErrorDetailResource errorDetailResource =
- (ErrorDetailResource) Utils.getResource(ResourceType.ERROR_DETAIL, errorDetail);
- resourceList.add(errorDetailResource);
- }
- }
- break;
- case STATUS:
- generator = new QueryGenerator(STATUS);
- generator.setParameter(StatusConstants.EXPERIMENT_ID, expID);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- Status status = (Status) result;
- StatusResource statusResource =
- (StatusResource) Utils.getResource(ResourceType.STATUS, status);
- resourceList.add(statusResource);
- }
- }
- break;
- default:
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported resource type for experiment resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new RegistryException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- return resourceList;
- }
-
- /**
- * save experiment
- */
- public void save() throws RegistryException{
- EntityManager em = null;
- try {
- em = ResourceUtils.getEntityManager();
- Experiment existingExp = em.find(Experiment.class, expID);
- em.close();
-
- em = ResourceUtils.getEntityManager();
- em.getTransaction().begin();
- Experiment experiment = new Experiment();
- experiment.setProjectID(projectId);
- experiment.setExpId(expID);
- experiment.setExecutionUser(executionUser);
- experiment.setExecutionUser(executionUser);
- experiment.setGatewayId(gatewayId);
- experiment.setCreationTime(creationTime);
- experiment.setExpName(expName);
- experiment.setExpDesc(description);
- experiment.setApplicationId(applicationId);
- experiment.setAppVersion(applicationVersion);
- experiment.setWorkflowExecutionId(workflowExecutionId);
- experiment.setWorkflowTemplateVersion(workflowTemplateVersion);
- experiment.setWorkflowExecutionId(workflowExecutionId);
- experiment.setAllowNotification(enableEmailNotifications);
- experiment.setGatewayExecutionId(gatewayExecutionId);
- if (existingExp != null) {
- existingExp.setGatewayId(gatewayId);
- existingExp.setExecutionUser(executionUser);
- existingExp.setProjectID(projectId);
- existingExp.setCreationTime(creationTime);
- existingExp.setExpName(expName);
- existingExp.setExpDesc(description);
- existingExp.setApplicationId(applicationId);
- existingExp.setAppVersion(applicationVersion);
- existingExp.setWorkflowExecutionId(workflowExecutionId);
- existingExp.setWorkflowTemplateVersion(workflowTemplateVersion);
- existingExp.setWorkflowExecutionId(workflowExecutionId);
- existingExp.setAllowNotification(enableEmailNotifications);
- existingExp.setGatewayExecutionId(gatewayExecutionId);
- experiment = em.merge(existingExp);
- } else {
- em.persist(experiment);
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new RegistryException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- /**
- *
- * @param expID experiment ID
- */
- public void setExpID(String expID) {
- this.expID = expID;
- }
-
- public String getExecutionUser() {
- return executionUser;
- }
-
- public void setExecutionUser(String executionUser) {
- this.executionUser = executionUser;
- }
-
- public List<NotificationEmailResource> getNotificationEmails () throws RegistryException{
- List<NotificationEmailResource> emailResources = new ArrayList<NotificationEmailResource>();
- List<Resource> resources = get(ResourceType.NOTIFICATION_EMAIL);
- for (Resource resource : resources) {
- emailResources.add((NotificationEmailResource) resource);
- }
- return emailResources;
- }
-
- public List<ExperimentInputResource> getExperimentInputs () throws RegistryException{
- List<ExperimentInputResource> expInputs = new ArrayList<ExperimentInputResource>();
- List<Resource> resources = get(ResourceType.EXPERIMENT_INPUT);
- for (Resource resource : resources) {
- expInputs.add((ExperimentInputResource) resource);
- }
- return expInputs;
- }
-
- public List<ExperimentOutputResource> getExperimentOutputs () throws RegistryException{
- List<ExperimentOutputResource> expOutputs = new ArrayList<ExperimentOutputResource>();
- List<Resource> resources = get(ResourceType.EXPERIMENT_OUTPUT);
- for (Resource resource : resources) {
- expOutputs.add((ExperimentOutputResource) resource);
- }
- return expOutputs;
- }
-
- public StatusResource getExperimentStatus() throws RegistryException{
- List<Resource> resources = get(ResourceType.STATUS);
- for (Resource resource : resources) {
- StatusResource expStatus = (StatusResource) resource;
- if(expStatus.getStatusType().equals(StatusType.EXPERIMENT.toString())){
- if (expStatus.getState() == null || expStatus.getState().equals("") ){
- expStatus.setState("UNKNOWN");
- }
- return expStatus;
- }
- }
- return null;
- }
-
- public List<StatusResource> getWorkflowNodeStatuses() throws RegistryException{
- List<StatusResource> statuses = new ArrayList<StatusResource>();
- List<Resource> resources = get(ResourceType.STATUS);
- for (Resource resource : resources) {
- StatusResource workflowNodeStatus = (StatusResource) resource;
- if(workflowNodeStatus.getStatusType().equals(StatusType.WORKFLOW_NODE.toString())){
- if (workflowNodeStatus.getState() == null || workflowNodeStatus.getState().equals("")){
- workflowNodeStatus.setState("UNKNOWN");
- }
- statuses.add(workflowNodeStatus);
- }
- }
- return statuses;
- }
-
- public List<WorkflowNodeDetailResource> getWorkflowNodeDetails () throws RegistryException{
- List<WorkflowNodeDetailResource> workflowNodeDetailResourceList = new ArrayList<WorkflowNodeDetailResource>();
- List<Resource> resources = get(ResourceType.WORKFLOW_NODE_DETAIL);
- for (Resource resource : resources) {
- WorkflowNodeDetailResource nodeDetailResource = (WorkflowNodeDetailResource) resource;
- workflowNodeDetailResourceList.add(nodeDetailResource);
- }
- return workflowNodeDetailResourceList;
- }
-
- public List<ErrorDetailResource> getErrorDetails () throws RegistryException{
- List<ErrorDetailResource> errorDetailResources = new ArrayList<ErrorDetailResource>();
- List<Resource> resources = get(ResourceType.ERROR_DETAIL);
- for (Resource resource : resources) {
- ErrorDetailResource errorDetailResource = (ErrorDetailResource) resource;
- errorDetailResources.add(errorDetailResource);
- }
- return errorDetailResources;
- }
-
- public ComputationSchedulingResource getComputationScheduling (String expId) throws RegistryException{
- return (ComputationSchedulingResource)get(ResourceType.COMPUTATIONAL_RESOURCE_SCHEDULING, expId);
- }
-
- public AdvanceInputDataHandlingResource getInputDataHandling (String expId) throws RegistryException{
- return (AdvanceInputDataHandlingResource)get(ResourceType.ADVANCE_INPUT_DATA_HANDLING, expId);
- }
-
- public AdvancedOutputDataHandlingResource getOutputDataHandling (String expId) throws RegistryException{
- return (AdvancedOutputDataHandlingResource)get(ResourceType.ADVANCE_OUTPUT_DATA_HANDLING, expId);
- }
-
- public QosParamResource getQOSparams (String expId) throws RegistryException{
- return (QosParamResource)get(ResourceType.QOS_PARAM, expId);
- }
-
- public ConfigDataResource getUserConfigData(String expID) throws RegistryException{
- return (ConfigDataResource)get(ResourceType.CONFIG_DATA, expID);
- }
- public WorkflowNodeDetailResource getWorkflowNode (String nodeId) throws RegistryException{
- return (WorkflowNodeDetailResource)get(ResourceType.WORKFLOW_NODE_DETAIL, nodeId);
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/ExperimentSummaryResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/ExperimentSummaryResource.java b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/ExperimentSummaryResource.java
deleted file mode 100644
index 63d4e51..0000000
--- a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/ExperimentSummaryResource.java
+++ /dev/null
@@ -1,134 +0,0 @@
-/*
- *
- * 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.experiment.catalog.resources;
-
-import org.apache.airavata.experiment.catalog.Resource;
-import org.apache.airavata.experiment.catalog.ResourceType;
-import org.apache.airavata.registry.cpi.RegistryException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.el.MethodNotFoundException;
-import java.sql.Timestamp;
-import java.util.List;
-
-public class ExperimentSummaryResource extends AbstractResource {
- private final static Logger logger = LoggerFactory.getLogger(ExperimentSummaryResource.class);
-
- private String executionUser;
- private String expID;
- private String projectID;
- private Timestamp creationTime;
- private String expName;
- private String description;
- private String applicationId;
-
- private StatusResource status;
-
- @Override
- public Resource create(ResourceType type) throws RegistryException {
- throw new MethodNotFoundException();
- }
-
- @Override
- public void remove(ResourceType type, Object name) throws RegistryException {
- throw new MethodNotFoundException();
- }
-
- @Override
- public Resource get(ResourceType type, Object name) throws RegistryException {
- throw new MethodNotFoundException();
- }
-
- @Override
- public List<Resource> get(ResourceType type) throws RegistryException {
- throw new MethodNotFoundException();
- }
-
- @Override
- public void save() throws RegistryException {
- throw new MethodNotFoundException();
- }
-
- public String getExecutionUser() {
- return executionUser;
- }
-
- public void setExecutionUser(String executionUser) {
- this.executionUser = executionUser;
- }
-
- public String getExpID() {
- return expID;
- }
-
- public void setExpID(String expID) {
- this.expID = expID;
- }
-
- public String getProjectID() {
- return projectID;
- }
-
- public void setProjectID(String projectID) {
- this.projectID = projectID;
- }
-
- public Timestamp getCreationTime() {
- return creationTime;
- }
-
- public void setCreationTime(Timestamp creationTime) {
- this.creationTime = creationTime;
- }
-
- public String getExpName() {
- return expName;
- }
-
- public void setExpName(String expName) {
- this.expName = expName;
- }
-
- public String getDescription() {
- return description;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
- public String getApplicationId() {
- return applicationId;
- }
-
- public void setApplicationId(String applicationId) {
- this.applicationId = applicationId;
- }
-
- public StatusResource getStatus() {
- return status;
- }
-
- public void setStatus(StatusResource status) {
- this.status = status;
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/GatewayResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/GatewayResource.java b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/GatewayResource.java
deleted file mode 100644
index 90c3062..0000000
--- a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/GatewayResource.java
+++ /dev/null
@@ -1,437 +0,0 @@
-/*
- *
- * 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.experiment.catalog.resources;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.persistence.EntityManager;
-import javax.persistence.Query;
-
-import org.apache.airavata.experiment.catalog.Resource;
-import org.apache.airavata.experiment.catalog.ResourceType;
-import org.apache.airavata.experiment.catalog.ResourceUtils;
-import org.apache.airavata.experiment.catalog.model.*;
-import org.apache.airavata.experiment.catalog.utils.QueryGenerator;
-import org.apache.airavata.registry.cpi.RegistryException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class GatewayResource extends AbstractResource {
- private final static Logger logger = LoggerFactory.getLogger(GatewayResource.class);
-
- private String gatewayId;
- private String gatewayName;
- private String domain;
- private String emailAddress;
-
- public String getGatewayId() {
- return gatewayId;
- }
-
- public void setGatewayId(String gatewayId) {
- this.gatewayId = gatewayId;
- }
-
- public String getEmailAddress() {
- return emailAddress;
- }
-
- public void setEmailAddress(String emailAddress) {
- this.emailAddress = emailAddress;
- }
-
- /**
- *
- * @param gatewayId gateway name
- */
- public GatewayResource(String gatewayId) {
- setGatewayId(gatewayId);
- }
-
- /**
- *
- */
- public GatewayResource() {
- }
-
- /**
- *
- * @return gateway name
- */
- public String getGatewayName() {
- return gatewayName;
- }
-
- /**
- *
- * @param gatewayName
- */
- public void setGatewayName(String gatewayName) {
- this.gatewayName = gatewayName;
- }
-
- /**
- *
- * @return domain of the gateway
- */
- public String getDomain() {
- return domain;
- }
-
- /**
- *
- * @param domain domain of the gateway
- */
- public void setDomain(String domain) {
- this.domain = domain;
- }
-
-
- /**
- * Gateway is at the root level. So it can populate his child resources.
- * Project, User, Published Workflows, User workflows, Host descriptors,
- * Service Descriptors, Application descriptors and Experiments are all
- * its children
- * @param type resource type of the children
- * @return specific child resource type
- */
- public Resource create(ResourceType type) throws RegistryException {
- switch (type) {
- case PROJECT:
- ProjectResource projectResource = new ProjectResource();
- projectResource.setGatewayId(gatewayId);
- return projectResource;
- case EXPERIMENT:
- ExperimentResource experimentResource =new ExperimentResource();
- experimentResource.setGatewayId(gatewayId);
- return experimentResource;
- case GATEWAY_WORKER:
- WorkerResource workerResource = new WorkerResource();
- workerResource.setGatewayId(gatewayId);
- return workerResource;
- default:
- logger.error("Unsupported resource type for gateway resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported resource type for gateway resource.");
- }
- }
-
- /**
- * Child resources can be removed from a gateway
- * @param type child resource type
- * @param name child resource name
- */
- public void remove(ResourceType type, Object name) throws RegistryException{
- EntityManager em = null;
- try {
- em = ResourceUtils.getEntityManager();
- em.getTransaction().begin();
- Query q;
- QueryGenerator generator;
- switch (type) {
- case USER:
- generator = new QueryGenerator(USERS);
- generator.setParameter(UserConstants.USERNAME, name);
- q = generator.deleteQuery(em);
- q.executeUpdate();
- break;
- case EXPERIMENT:
- generator = new QueryGenerator(EXPERIMENT);
- generator.setParameter(ExperimentConstants.EXPERIMENT_ID, name);
- q = generator.deleteQuery(em);
- q.executeUpdate();
- break;
- default:
- logger.error("Unsupported resource type for gateway resource.", new IllegalArgumentException());
- break;
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new RegistryException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- /**
- * Gateway can get information of his children
- * @param type child resource type
- * @param name child resource name
- * @return specific child resource type
- */
- public Resource get(ResourceType type, Object name) throws RegistryException{
- EntityManager em = null;
- try {
- em = ResourceUtils.getEntityManager();
- em.getTransaction().begin();
- QueryGenerator generator;
- Query q;
- switch (type) {
- case GATEWAY_WORKER:
- generator = new QueryGenerator(GATEWAY_WORKER);
- generator.setParameter(GatewayWorkerConstants.USERNAME, name);
- generator.setParameter(GatewayWorkerConstants.GATEWAY_ID, gatewayId);
- q = generator.selectQuery(em);
- Gateway_Worker worker = (Gateway_Worker) q.getSingleResult();
- WorkerResource workerResource =
- (WorkerResource) Utils.getResource(ResourceType.GATEWAY_WORKER, worker);
- em.getTransaction().commit();
- em.close();
- return workerResource;
- case USER:
- generator = new QueryGenerator(USERS);
- generator.setParameter(UserConstants.USERNAME, name);
- q = generator.selectQuery(em);
- Users user = (Users) q.getSingleResult();
- UserResource userResource =
- (UserResource) Utils.getResource(ResourceType.USER, user);
- em.getTransaction().commit();
- em.close();
- return userResource;
- case EXPERIMENT:
- generator = new QueryGenerator(EXPERIMENT);
- generator.setParameter(ExperimentConstants.EXPERIMENT_ID, name);
- q = generator.selectQuery(em);
- Experiment experiment = (Experiment) q.getSingleResult();
- ExperimentResource experimentResource =
- (ExperimentResource) Utils.getResource(ResourceType.EXPERIMENT, experiment);
- em.getTransaction().commit();
- em.close();
- return experimentResource;
- default:
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported resource type for gateway resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported resource type for gateway resource.");
- }
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new RegistryException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- /**
- *
- * @param type child resource type
- * @return list of child resources
- */
- public List<Resource> get(ResourceType type) throws RegistryException{
- List<Resource> resourceList = new ArrayList<Resource>();
- EntityManager em = null;
- try {
- em = ResourceUtils.getEntityManager();
- em.getTransaction().begin();
- Query q;
- QueryGenerator generator;
- List results;
- switch (type) {
- case PROJECT:
- generator = new QueryGenerator(PROJECT);
- Gateway gatewayModel = em.find(Gateway.class, gatewayId);
- generator.setParameter("gateway", gatewayModel);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- Project project = (Project) result;
- ProjectResource projectResource =
- (ProjectResource) Utils.getResource(ResourceType.PROJECT, project);
- resourceList.add(projectResource);
- }
- }
- break;
- case GATEWAY_WORKER:
- generator = new QueryGenerator(GATEWAY_WORKER);
- generator.setParameter(GatewayWorkerConstants.GATEWAY_ID, gatewayId);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- Gateway_Worker gatewayWorker = (Gateway_Worker) result;
- WorkerResource workerResource =
- (WorkerResource) Utils.getResource(ResourceType.GATEWAY_WORKER, gatewayWorker);
- resourceList.add(workerResource);
- }
- }
- break;
- case EXPERIMENT:
- generator = new QueryGenerator(EXPERIMENT);
- generator.setParameter(ExperimentConstants.GATEWAY_ID, gatewayId);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- Experiment experiment = (Experiment) result;
- ExperimentResource experimentResource =
- (ExperimentResource) Utils.getResource(ResourceType.EXPERIMENT, experiment);
- resourceList.add(experimentResource);
- }
- }
- break;
- case USER:
- generator = new QueryGenerator(USERS);
- q = generator.selectQuery(em);
- for (Object o : q.getResultList()) {
- Users user = (Users) o;
- UserResource userResource =
- (UserResource) Utils.getResource(ResourceType.USER, user);
- resourceList.add(userResource);
- }
- break;
- default:
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported resource type for gateway resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported resource type for gateway resource.");
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new RegistryException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- return resourceList;
- }
-
- /**
- * save the gateway to the database
- */
- public void save() throws RegistryException {
- EntityManager em = null;
- try {
- em = ResourceUtils.getEntityManager();
- Gateway existingGateway = em.find(Gateway.class, gatewayId);
- em.close();
-
- em = ResourceUtils.getEntityManager();
- em.getTransaction().begin();
- Gateway gateway = new Gateway();
- gateway.setGateway_name(gatewayName);
- gateway.setGateway_id(gatewayId);
- gateway.setDomain(domain);
- gateway.setEmailAddress(emailAddress);
- if (existingGateway != null) {
- existingGateway.setDomain(domain);
- existingGateway.setGateway_name(gatewayName);
- existingGateway.setEmailAddress(emailAddress);
- gateway = em.merge(existingGateway);
- } else {
- em.persist(gateway);
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new RegistryException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
-
- }
-
- /**
- * check whether child resource already exist in the database
- * @param type child resource type
- * @param name name of the child resource
- * @return true or false
- */
- public boolean isExists(ResourceType type, Object name) throws RegistryException{
- EntityManager em = null;
- try {
- switch (type) {
- case GATEWAY_WORKER:
- em = ResourceUtils.getEntityManager();
- Gateway_Worker existingWorker = em.find(Gateway_Worker.class, new Gateway_Worker_PK(gatewayId, name.toString()));
- em.close();
- return existingWorker != null;
- case USER:
- em = ResourceUtils.getEntityManager();
- Users existingUser = em.find(Users.class, name);
- em.close();
- return existingUser != null;
- case EXPERIMENT:
- em = ResourceUtils.getEntityManager();
- Experiment existingExp = em.find(Experiment.class, name.toString());
- em.close();
- return existingExp != null;
- default:
- logger.error("Unsupported resource type for gateway resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported resource type for gateway resource.");
- }
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new RegistryException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- public ExperimentResource createExperiment (String experimentID) throws RegistryException{
- ExperimentResource metadataResource = (ExperimentResource)create(ResourceType.EXPERIMENT);
- metadataResource.setExpID(experimentID);
- return metadataResource;
- }
-
- public ExperimentResource getExperiment (String expId) throws RegistryException{
- return (ExperimentResource)get(ResourceType.EXPERIMENT, expId);
- }
-
- public List<ExperimentResource> getExperiments () throws RegistryException{
- List<ExperimentResource> experiments = new ArrayList<ExperimentResource>();
- List<Resource> resources = get(ResourceType.EXPERIMENT);
- for (Resource resource : resources){
- experiments.add((ExperimentResource)resource);
- }
- return experiments;
- }
-}
-
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/JobDetailResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/JobDetailResource.java b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/JobDetailResource.java
deleted file mode 100644
index b8ee0fa..0000000
--- a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/JobDetailResource.java
+++ /dev/null
@@ -1,376 +0,0 @@
-/*
- *
- * 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.experiment.catalog.resources;
-
-import org.apache.airavata.experiment.catalog.Resource;
-import org.apache.airavata.experiment.catalog.ResourceType;
-import org.apache.airavata.experiment.catalog.ResourceUtils;
-import org.apache.airavata.experiment.catalog.model.*;
-import org.apache.airavata.experiment.catalog.utils.QueryGenerator;
-import org.apache.airavata.registry.cpi.RegistryException;
-import org.apache.airavata.registry.cpi.utils.StatusType;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.persistence.EntityManager;
-import javax.persistence.Query;
-import java.sql.Timestamp;
-import java.util.ArrayList;
-import java.util.List;
-
-public class JobDetailResource extends AbstractResource {
- private static final Logger logger = LoggerFactory.getLogger(JobDetailResource.class);
- private String jobId;
- private String taskId;
- private String jobDescription;
- private Timestamp creationTime;
- private String computeResourceConsumed;
- private String jobName;
- private String workingDir;
- private StatusResource jobStatus;
- private List<ErrorDetailResource> errors;
-
- public void setJobStatus(StatusResource jobStatus) {
- this.jobStatus = jobStatus;
- }
-
- public List<ErrorDetailResource> getErrors() {
- return errors;
- }
-
- public void setErrors(List<ErrorDetailResource> errors) {
- this.errors = errors;
- }
-
- public String getJobName() {
- return jobName;
- }
-
- public void setJobName(String jobName) {
- this.jobName = jobName;
- }
-
- public String getWorkingDir() {
- return workingDir;
- }
-
- public void setWorkingDir(String workingDir) {
- this.workingDir = workingDir;
- }
-
- public String getJobId() {
- return jobId;
- }
-
- public void setJobId(String jobId) {
- this.jobId = jobId;
- }
-
- public String getTaskId() {
- return taskId;
- }
-
- public void setTaskId(String taskId) {
- this.taskId = taskId;
- }
-
- public String getJobDescription() {
- return jobDescription;
- }
-
- public void setJobDescription(String jobDescription) {
- this.jobDescription = jobDescription;
- }
-
- public Timestamp getCreationTime() {
- return creationTime;
- }
-
- public void setCreationTime(Timestamp creationTime) {
- this.creationTime = creationTime;
- }
-
- public String getComputeResourceConsumed() {
- return computeResourceConsumed;
- }
-
- public void setComputeResourceConsumed(String computeResourceConsumed) {
- this.computeResourceConsumed = computeResourceConsumed;
- }
-
-
- public Resource create(ResourceType type) throws RegistryException {
- switch (type){
- case STATUS:
- StatusResource statusResource = new StatusResource();
- statusResource.setJobId(jobId);
- return statusResource;
- case ERROR_DETAIL:
- ErrorDetailResource errorDetailResource = new ErrorDetailResource();
- errorDetailResource.setJobId(jobId);
- return errorDetailResource;
- default:
- logger.error("Unsupported resource type for job details data resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
- }
-
-
- public void remove(ResourceType type, Object name) throws RegistryException{
- EntityManager em = null;
- try {
- em = ResourceUtils.getEntityManager();
- em.getTransaction().begin();
- Query q;
- QueryGenerator generator;
- switch (type) {
- case STATUS:
- generator = new QueryGenerator(STATUS);
- generator.setParameter(StatusConstants.JOB_ID, name);
- generator.setParameter(StatusConstants.STATUS_TYPE, StatusType.JOB.toString());
- q = generator.deleteQuery(em);
- q.executeUpdate();
- break;
- case ERROR_DETAIL:
- generator = new QueryGenerator(STATUS);
- generator.setParameter(ErrorDetailConstants.JOB_ID, name);
- q = generator.deleteQuery(em);
- q.executeUpdate();
- break;
- default:
- logger.error("Unsupported resource type for job details resource.", new IllegalArgumentException());
- break;
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new RegistryException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
-
- public Resource get(ResourceType type, Object name) throws RegistryException {
- EntityManager em = null;
- try {
- em = ResourceUtils.getEntityManager();
- em.getTransaction().begin();
- QueryGenerator generator;
- Query q;
- switch (type) {
- case STATUS:
- generator = new QueryGenerator(STATUS);
- generator.setParameter(StatusConstants.JOB_ID, name);
- generator.setParameter(StatusConstants.STATUS_TYPE, StatusType.JOB.toString());
- q = generator.selectQuery(em);
- Status status = (Status) q.getSingleResult();
- StatusResource statusResource = (StatusResource) Utils.getResource(ResourceType.STATUS, status);
- em.getTransaction().commit();
- em.close();
- return statusResource;
- case ERROR_DETAIL:
- generator = new QueryGenerator(ERROR_DETAIL);
- generator.setParameter(ErrorDetailConstants.JOB_ID, name);
- q = generator.selectQuery(em);
- ErrorDetail errorDetail = (ErrorDetail) q.getSingleResult();
- ErrorDetailResource errorDetailResource = (ErrorDetailResource) Utils.getResource(ResourceType.ERROR_DETAIL, errorDetail);
- em.getTransaction().commit();
- em.close();
- return errorDetailResource;
- default:
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported resource type for job details resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported resource type for job details resource.");
- }
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new RegistryException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
-
- public List<Resource> get(ResourceType type) throws RegistryException{
- List<Resource> resourceList = new ArrayList<Resource>();
- EntityManager em = null;
- try {
- em = ResourceUtils.getEntityManager();
- em.getTransaction().begin();
- Query q;
- QueryGenerator generator;
- List results;
- switch (type) {
- case STATUS:
- generator = new QueryGenerator(STATUS);
- generator.setParameter(StatusConstants.JOB_ID, jobId);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- Status status = (Status) result;
- StatusResource statusResource =
- (StatusResource) Utils.getResource(ResourceType.STATUS, status);
- resourceList.add(statusResource);
- }
- }
- break;
- case ERROR_DETAIL:
- generator = new QueryGenerator(ERROR_DETAIL);
- generator.setParameter(ErrorDetailConstants.JOB_ID, jobId);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- ErrorDetail errorDetail = (ErrorDetail) result;
- ErrorDetailResource errorDetailResource =
- (ErrorDetailResource) Utils.getResource(ResourceType.ERROR_DETAIL, errorDetail);
- resourceList.add(errorDetailResource);
- }
- }
- break;
- default:
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported resource type for workflow node details resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- throw new RegistryException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- return resourceList;
- }
-
-
- public void save() throws RegistryException{
- EntityManager em = null;
- try {
- em = ResourceUtils.getEntityManager();
- JobDetail existingJobDetail = em.find(JobDetail.class, new JobDetails_PK(jobId, taskId));
- em.close();
-
- em = ResourceUtils.getEntityManager();
- em.getTransaction().begin();
- JobDetail jobDetail = new JobDetail();
- jobDetail.setJobId(jobId);
- jobDetail.setTaskId(taskId);
- jobDetail.setCreationTime(creationTime);
- jobDetail.setJobName(jobName);
- jobDetail.setWorkingDir(workingDir);
- if (jobDescription != null) {
- jobDetail.setJobDescription(jobDescription.toCharArray());
- }
- jobDetail.setComputeResourceConsumed(computeResourceConsumed);
- if (existingJobDetail != null) {
- existingJobDetail.setJobId(jobId);
- existingJobDetail.setTaskId(taskId);
- existingJobDetail.setCreationTime(creationTime);
- if (jobDescription != null) {
- existingJobDetail.setJobDescription(jobDescription.toCharArray());
- }
- existingJobDetail.setComputeResourceConsumed(computeResourceConsumed);
- existingJobDetail.setJobName(jobName);
- existingJobDetail.setWorkingDir(workingDir);
- jobDetail = em.merge(existingJobDetail);
- } else {
- em.persist(jobDetail);
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new RegistryException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- public StatusResource getJobStatus() {
- return jobStatus;
- }
-
- public StatusResource getJobStatus1() throws RegistryException{
- List<Resource> resources = get(ResourceType.STATUS);
- for (Resource resource : resources) {
- StatusResource jobStatus = (StatusResource) resource;
- if(jobStatus.getStatusType().equals(StatusType.JOB.toString())){
- if (jobStatus.getState() == null || jobStatus.getState().equals("") ){
- jobStatus.setState("UNKNOWN");
- }
- return jobStatus;
- }
- }
- return null;
- }
-
- public StatusResource getApplicationStatus() throws RegistryException{
- List<Resource> resources = get(ResourceType.STATUS);
- for (Resource resource : resources) {
- StatusResource appStatus = (StatusResource) resource;
- if(appStatus.getStatusType().equals(StatusType.APPLICATION.toString())){
- if (appStatus.getState() == null || appStatus.getState().equals("") ){
- appStatus.setState("UNKNOWN");
- }
- return appStatus;
- }
- }
- return null;
- }
-
- public List<ErrorDetailResource> getErrorDetails () throws RegistryException{
- List<ErrorDetailResource> errorDetailResources = new ArrayList<ErrorDetailResource>();
- List<Resource> resources = get(ResourceType.ERROR_DETAIL);
- for(Resource resource : resources){
- errorDetailResources.add((ErrorDetailResource)resource);
- }
- return errorDetailResources;
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/NodeInputResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/NodeInputResource.java b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/NodeInputResource.java
deleted file mode 100644
index 92aba23..0000000
--- a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/NodeInputResource.java
+++ /dev/null
@@ -1,227 +0,0 @@
-/*
- *
- * 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.experiment.catalog.resources;
-
-import java.util.List;
-
-import javax.persistence.EntityManager;
-
-import org.apache.airavata.experiment.catalog.Resource;
-import org.apache.airavata.experiment.catalog.ResourceType;
-import org.apache.airavata.experiment.catalog.ResourceUtils;
-import org.apache.airavata.experiment.catalog.model.NodeInput;
-import org.apache.airavata.experiment.catalog.model.NodeInput_PK;
-import org.apache.airavata.registry.cpi.RegistryException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class NodeInputResource extends AbstractResource {
- private static final Logger logger = LoggerFactory.getLogger(NodeInputResource.class);
-
- private String nodeId;
- private String inputKey;
- private String dataType;
- private String metadata;
- private String value;
- private String appArgument;
- private boolean standardInput;
- private String userFriendlyDesc;
- private int inputOrder;
- private boolean isRequired;
- private boolean requiredToCMD;
- private boolean dataStaged;
-
- public boolean getRequired() {
- return isRequired;
- }
-
- public void setRequired(boolean required) {
- this.isRequired = required;
- }
-
- public boolean getRequiredToCMD() {
- return requiredToCMD;
- }
-
- public void setRequiredToCMD(boolean requiredToCMD) {
- this.requiredToCMD = requiredToCMD;
- }
-
- public boolean isDataStaged() {
- return dataStaged;
- }
-
- public void setDataStaged(boolean dataStaged) {
- this.dataStaged = dataStaged;
- }
-
- public String getAppArgument() {
- return appArgument;
- }
-
- public void setAppArgument(String appArgument) {
- this.appArgument = appArgument;
- }
-
- public boolean isStandardInput() {
- return standardInput;
- }
-
- public void setStandardInput(boolean standardInput) {
- this.standardInput = standardInput;
- }
-
- public String getUserFriendlyDesc() {
- return userFriendlyDesc;
- }
-
- public void setUserFriendlyDesc(String userFriendlyDesc) {
- this.userFriendlyDesc = userFriendlyDesc;
- }
-
- public String getNodeId() {
- return nodeId;
- }
-
- public void setNodeId(String nodeId) {
- this.nodeId = nodeId;
- }
-
- public String getInputKey() {
- return inputKey;
- }
-
- public void setInputKey(String inputKey) {
- this.inputKey = inputKey;
- }
-
- public String getDataType() {
- return dataType;
- }
-
- public void setDataType(String dataType) {
- this.dataType = dataType;
- }
-
- public String getMetadata() {
- return metadata;
- }
-
- public void setMetadata(String metadata) {
- this.metadata = metadata;
- }
-
- public String getValue() {
- return value;
- }
-
- public void setValue(String value) {
- this.value = value;
- }
-
- public int getInputOrder() {
- return inputOrder;
- }
-
- public void setInputOrder(int inputOrder) {
- this.inputOrder = inputOrder;
- }
-
- public Resource create(ResourceType type) throws RegistryException {
- logger.error("Unsupported resource type for node input data resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
-
- public void remove(ResourceType type, Object name) throws RegistryException{
- logger.error("Unsupported resource type for node input data resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
-
- public Resource get(ResourceType type, Object name) throws RegistryException {
- logger.error("Unsupported resource type for node input data resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
-
- public List<Resource> get(ResourceType type) throws RegistryException {
- logger.error("Unsupported resource type for node input data resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
-
- public void save() throws RegistryException{
- EntityManager em = null;
- try {
- em = ResourceUtils.getEntityManager();
- NodeInput existingInput = em.find(NodeInput.class, new NodeInput_PK(inputKey, nodeId));
- em.close();
-
- em = ResourceUtils.getEntityManager();
- em.getTransaction().begin();
- NodeInput nodeInput = new NodeInput();
- nodeInput.setNodeId(nodeId);
- nodeInput.setInputKey(inputKey);
- nodeInput.setDataType(dataType);
- nodeInput.setValue(value);
- nodeInput.setMetadata(metadata);
- nodeInput.setAppArgument(appArgument);
- nodeInput.setStandardInput(standardInput);
- nodeInput.setUserFriendlyDesc(userFriendlyDesc);
- nodeInput.setInputOrder(inputOrder);
- nodeInput.setRequiredToCMD(requiredToCMD);
- nodeInput.setIsRequired(isRequired);
- nodeInput.setDataStaged(dataStaged);
-
- if (existingInput != null){
- existingInput.setNodeId(nodeId);
- existingInput.setInputKey(inputKey);
- existingInput.setDataType(dataType);
- existingInput.setValue(value);
- existingInput.setMetadata(metadata);
- existingInput.setAppArgument(appArgument);
- existingInput.setStandardInput(standardInput);
- existingInput.setUserFriendlyDesc(userFriendlyDesc);
- existingInput.setInputOrder(inputOrder);
- existingInput.setRequiredToCMD(requiredToCMD);
- existingInput.setIsRequired(isRequired);
- existingInput.setDataStaged(dataStaged);
- nodeInput = em.merge(existingInput);
- }else {
- em.persist(nodeInput);
- }
- em.getTransaction().commit();
- em.close();
- }catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new RegistryException(e);
- }finally {
- if (em != null && em.isOpen()){
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-}
[52/52] [abbrv] airavata git commit: Resolved ModuleRefactor merge
conflicts
Posted by sh...@apache.org.
Resolved ModuleRefactor merge conflicts
Project: http://git-wip-us.apache.org/repos/asf/airavata/repo
Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/2835d09e
Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/2835d09e
Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/2835d09e
Branch: refs/heads/master
Commit: 2835d09ef16e218d7c2224bbebe2a13dd440d23d
Parents: b4ede9c ec8c620
Author: Shameera Rathanyaka <sh...@gmail.com>
Authored: Thu Jun 4 16:36:38 2015 -0400
Committer: Shameera Rathanyaka <sh...@gmail.com>
Committed: Thu Jun 4 16:36:38 2015 -0400
----------------------------------------------------------------------
.../server/handler/AiravataServerHandler.java | 195 +-
.../AiravataExperimentStatusUpdator.java | 24 +-
.../api/server/util/DataModelUtils.java | 4 +-
.../api/server/util/DatabaseCreator.java | 4 +-
.../api/server/util/RegistryInitUtil.java | 12 +-
.../client/samples/CreateLaunchExperiment.java | 2 +-
.../org/airavata/appcatalog/cpi/AppCatalog.java | 54 -
.../appcatalog/cpi/AppCatalogException.java | 36 -
.../appcatalog/cpi/ApplicationDeployment.java | 72 -
.../appcatalog/cpi/ApplicationInterface.java | 148 -
.../appcatalog/cpi/ComputeResource.java | 249 --
.../appcatalog/cpi/GwyResourceProfile.java | 81 -
.../appcatalog/cpi/WorkflowCatalog.java | 45 -
.../catalog/data/impl/AppCatalogFactory.java | 46 -
.../catalog/data/impl/AppCatalogImpl.java | 52 -
.../data/impl/ApplicationDeploymentImpl.java | 414 ---
.../data/impl/ApplicationInterfaceImpl.java | 450 ---
.../catalog/data/impl/ComputeResourceImpl.java | 888 ------
.../data/impl/GwyResourceProfileImpl.java | 252 --
.../catalog/data/impl/WorkflowCatalogImpl.java | 232 --
.../catalog/data/model/AppEnvironment.java | 76 -
.../catalog/data/model/AppEnvironment_PK.java | 64 -
.../catalog/data/model/AppInput_PK.java | 64 -
.../catalog/data/model/AppModuleMapping.java | 77 -
.../catalog/data/model/AppModuleMapping_PK.java | 64 -
.../catalog/data/model/AppOutput_PK.java | 64 -
.../data/model/ApplicationDeployment.java | 148 -
.../catalog/data/model/ApplicationInput.java | 166 -
.../data/model/ApplicationInterface.java | 97 -
.../catalog/data/model/ApplicationModule.java | 107 -
.../catalog/data/model/ApplicationOutput.java | 146 -
.../catalog/data/model/BatchQueue.java | 144 -
.../catalog/data/model/BatchQueue_PK.java | 63 -
.../catalog/data/model/CloudJobSubmission.java | 102 -
.../catalog/data/model/ComputeResource.java | 105 -
.../data/model/ComputeResourceFileSystem.java | 89 -
.../model/ComputeResourceFileSystem_PK.java | 62 -
.../data/model/ComputeResourcePreference.java | 154 -
.../data/model/ComputeResourcePreferencePK.java | 64 -
.../catalog/data/model/Configuration.java | 57 -
.../catalog/data/model/Configuration_PK.java | 65 -
.../data/model/DataMovementInterface.java | 124 -
.../data/model/DataMovementInterface_PK.java | 62 -
.../data/model/DataMovementProtocol.java | 76 -
.../data/model/DataMovementProtocolPK.java | 74 -
.../catalog/data/model/GSISSHExport.java | 73 -
.../catalog/data/model/GSISSHExportPK.java | 64 -
.../catalog/data/model/GSISSHSubmission.java | 82 -
.../catalog/data/model/GatewayProfile.java | 68 -
.../catalog/data/model/GlobusGKEndPointPK.java | 64 -
.../catalog/data/model/GlobusGKEndpoint.java | 65 -
.../catalog/data/model/GlobusJobSubmission.java | 62 -
.../catalog/data/model/GridftpDataMovement.java | 83 -
.../catalog/data/model/GridftpEndpoint.java | 102 -
.../catalog/data/model/GridftpEndpoint_PK.java | 62 -
.../catalog/data/model/HostAlias.java | 65 -
.../catalog/data/model/HostAliasPK.java | 64 -
.../catalog/data/model/HostIPAddress.java | 65 -
.../catalog/data/model/HostIPAddressPK.java | 64 -
.../catalog/data/model/JobManagerCommand.java | 89 -
.../data/model/JobManagerCommand_PK.java | 62 -
.../data/model/JobSubmissionInterface.java | 124 -
.../data/model/JobSubmissionInterface_PK.java | 62 -
.../data/model/JobSubmissionProtocol.java | 77 -
.../data/model/JobSubmissionProtocolPK.java | 74 -
.../catalog/data/model/LibraryApendPath.java | 76 -
.../catalog/data/model/LibraryApendPath_PK.java | 64 -
.../catalog/data/model/LibraryPrepandPath.java | 76 -
.../data/model/LibraryPrepandPath_PK.java | 64 -
.../catalog/data/model/LocalDataMovement.java | 49 -
.../catalog/data/model/LocalSubmission.java | 98 -
.../catalog/data/model/ModuleLoadCmd.java | 70 -
.../catalog/data/model/ModuleLoadCmd_PK.java | 63 -
.../catalog/data/model/PostJobCommand.java | 73 -
.../catalog/data/model/PostJobCommandPK.java | 64 -
.../catalog/data/model/PreJobCommand.java | 73 -
.../catalog/data/model/PreJobCommandPK.java | 64 -
.../catalog/data/model/ResourceJobManager.java | 106 -
.../catalog/data/model/ScpDataMovement.java | 117 -
.../catalog/data/model/SshJobSubmission.java | 144 -
.../catalog/data/model/UnicoreDataMovement.java | 65 -
.../data/model/UnicoreJobSubmission.java | 66 -
.../catalog/data/model/Workflow.java | 126 -
.../catalog/data/model/WorkflowInput.java | 167 -
.../catalog/data/model/WorkflowInput_PK.java | 64 -
.../catalog/data/model/WorkflowOutput.java | 117 -
.../catalog/data/model/WorkflowOutput_PK.java | 64 -
.../data/resources/AbstractResource.java | 382 ---
.../data/resources/AppDeploymentResource.java | 446 ---
.../data/resources/AppEnvironmentResource.java | 293 --
.../data/resources/AppInterfaceResource.java | 363 ---
.../resources/AppModuleMappingResource.java | 317 --
.../data/resources/AppModuleResource.java | 344 --
.../resources/ApplicationInputResource.java | 454 ---
.../resources/ApplicationOutputResource.java | 432 ---
.../data/resources/BatchQueueResource.java | 357 ---
.../data/resources/CloudSubmissionResource.java | 299 --
.../ComputeHostPreferenceResource.java | 413 ---
.../ComputeResourceFileSystemResource.java | 307 --
.../data/resources/ComputeResourceResource.java | 351 ---
.../DataMovementInterfaceResource.java | 339 --
.../resources/DataMovementProtocolResource.java | 360 ---
.../data/resources/GSISSHExportResource.java | 324 --
.../resources/GSISSHSubmissionResource.java | 374 ---
.../data/resources/GatewayProfileResource.java | 318 --
.../resources/GlobusGKEndpointResource.java | 321 --
.../resources/GlobusJobSubmissionResource.java | 316 --
.../resources/GridftpDataMovementResource.java | 279 --
.../data/resources/GridftpEndpointResource.java | 317 --
.../data/resources/HostAliasResource.java | 317 --
.../data/resources/HostIPAddressResource.java | 318 --
.../resources/JobManagerCommandResource.java | 307 --
.../JobSubmissionInterfaceResource.java | 339 --
.../JobSubmissionProtocolResource.java | 359 ---
.../resources/LibraryApendPathResource.java | 292 --
.../resources/LibraryPrepandPathResource.java | 291 --
.../resources/LocalDataMovementResource.java | 249 --
.../data/resources/LocalSubmissionResource.java | 293 --
.../data/resources/ModuleLoadCmdResource.java | 300 --
.../data/resources/PostJobCommandResource.java | 333 --
.../data/resources/PreJobCommandResource.java | 333 --
.../catalog/data/resources/Resource.java | 89 -
.../resources/ResourceJobManagerResource.java | 301 --
.../data/resources/ScpDataMovementResource.java | 308 --
.../resources/SshJobSubmissionResource.java | 332 --
.../resources/UnicoreDataMovementResource.java | 255 --
.../resources/UnicoreJobSubmissionResource.java | 328 --
.../data/resources/WorkflowInputResource.java | 451 ---
.../data/resources/WorkflowOutputResource.java | 410 ---
.../data/resources/WorkflowResource.java | 382 ---
.../catalog/data/util/AppCatalogJPAUtils.java | 911 ------
.../data/util/AppCatalogQueryGenerator.java | 90 -
.../data/util/AppCatalogResourceType.java | 66 -
.../data/util/AppCatalogThriftConversion.java | 800 -----
.../catalog/data/util/AppCatalogUtils.java | 31 -
.../src/main/resources/META-INF/persistence.xml | 67 -
.../src/main/resources/appcatalog-derby.sql | 460 ---
.../src/main/resources/appcatalog-mysql.sql | 453 ---
.../app/catalog/test/AppDeploymentTest.java | 147 -
.../app/catalog/test/AppInterfaceTest.java | 192 --
.../app/catalog/test/ComputeResourceTest.java | 298 --
.../app/catalog/test/GatewayProfileTest.java | 128 -
.../app/catalog/test/util/Initialize.java | 320 --
.../gaussian/handler/GaussianHandler.java | 4 +-
.../gfac/bes/handlers/AbstractSMSHandler.java | 2 +-
.../gfac/bes/provider/impl/BESProvider.java | 2 +-
.../org/apache/airavata/gfac/Scheduler.java | 4 +-
.../org/apache/airavata/gfac/core/GFac.java | 8 +-
.../apache/airavata/gfac/core/GFacUtils.java | 33 +-
...ava~30f9d70adbd9ee7dd6f7d3eccbfca4baf19b09fa | 475 +++
.../airavata/gfac/core/JobDescriptor.java~HEAD | 475 +++
...ava~30f9d70adbd9ee7dd6f7d3eccbfca4baf19b09fa | 52 +
.../gfac/core/JobManagerConfiguration.java~HEAD | 52 +
...ava~30f9d70adbd9ee7dd6f7d3eccbfca4baf19b09fa | 34 +
.../gfac/core/cluster/CommandInfo.java~HEAD | 34 +
...ava~30f9d70adbd9ee7dd6f7d3eccbfca4baf19b09fa | 49 +
.../gfac/core/cluster/CommandOutput.java~HEAD | 49 +
...ava~30f9d70adbd9ee7dd6f7d3eccbfca4baf19b09fa | 65 +
.../gfac/core/cluster/ServerInfo.java~HEAD | 65 +
.../gfac/core/context/JobExecutionContext.java | 16 +-
.../gfac/core/handler/AbstractHandler.java | 20 +-
.../gfac/core/provider/AbstractProvider.java | 12 +-
...ava~30f9d70adbd9ee7dd6f7d3eccbfca4baf19b09fa | 29 +
.../jsch/GSISSHIdentityRepository.java~HEAD | 29 +
.../handler/GSISSHDirectorySetupHandler.java | 6 +-
.../gfac/gsissh/handler/GSISSHInputHandler.java | 6 +-
.../gsissh/handler/GSISSHOutputHandler.java | 12 +-
.../gsissh/handler/NewGSISSHOutputHandler.java | 4 +-
.../gsissh/provider/impl/GSISSHProvider.java | 2 +-
.../gfac/gsissh/util/GFACGSISSHUtils.java | 2 +-
.../gfac/impl/AiravataJobStatusUpdator.java | 22 +-
.../gfac/impl/AiravataTaskStatusUpdator.java | 22 +-
.../impl/AiravataWorkflowNodeStatusUpdator.java | 22 +-
.../airavata/gfac/impl/BetterGfacImpl.java | 26 +-
.../gfac/local/provider/impl/LocalProvider.java | 10 +-
.../ssh/handler/AdvancedSCPInputHandler.java | 4 +-
.../ssh/handler/AdvancedSCPOutputHandler.java | 4 +-
.../gfac/ssh/handler/NewSSHOutputHandler.java | 4 +-
.../ssh/handler/SSHDirectorySetupHandler.java | 6 +-
.../gfac/ssh/handler/SSHInputHandler.java | 6 +-
.../gfac/ssh/handler/SSHOutputHandler.java | 12 +-
.../gfac/ssh/provider/impl/SSHProvider.java | 2 +-
.../airavata/gfac/ssh/util/GFACSSHUtils.java | 8 +-
.../apache/airavata/job/AMQPMonitorTest.java | 2 +-
.../airavata/gfac/server/GfacServerHandler.java | 32 +-
.../gfac/client/GfacClientFactoryTest.java | 4 +-
.../airavata/gfac/client/util/Initialize.java | 4 +-
.../airavata/integration/DataRetrievalIT.java | 2 +-
.../integration/tools/DocumentCreatorNew.java | 5 +-
.../integration/tools/DocumentCreatorUtils.java | 3 +-
.../validator/impl/BatchQueueValidator.java | 2 +-
.../cpi/impl/AbstractOrchestrator.java | 2 +-
.../orchestrator/core/util/Initialize.java | 4 +-
.../server/OrchestratorServerHandler.java | 96 +-
.../orchestrator/util/DataModelUtils.java | 4 +-
...ies~30f9d70adbd9ee7dd6f7d3eccbfca4baf19b09fa | 26 +
.../src/main/resources/gsissh.properties~HEAD | 26 +
.../orchestrator/client/util/Initialize.java | 4 +-
...ies~30f9d70adbd9ee7dd6f7d3eccbfca4baf19b09fa | 26 +
.../src/test/resources/gsissh.properties~HEAD | 26 +
...ies~30f9d70adbd9ee7dd6f7d3eccbfca4baf19b09fa | 30 +
.../src/test/resources/monitor.properties~HEAD | 30 +
...sql~30f9d70adbd9ee7dd6f7d3eccbfca4baf19b09fa | 361 +++
.../src/test/resources/registry-derby.sql~HEAD | 361 +++
modules/registry/experiment-catalog/pom.xml | 151 -
.../experiment/catalog/JPAConstants.java | 33 -
.../airavata/experiment/catalog/Resource.java | 71 -
.../experiment/catalog/ResourceType.java | 50 -
.../experiment/catalog/ResourceUtils.java | 525 ---
.../catalog/impl/ExperimentRegistry.java | 2983 ------------------
.../catalog/impl/GatewayRegistry.java | 115 -
.../catalog/impl/LoggingRegistryImpl.java | 97 -
.../catalog/impl/ProjectRegistry.java | 303 --
.../catalog/impl/RegistryFactory.java | 80 -
.../experiment/catalog/impl/RegistryImpl.java | 735 -----
.../experiment/catalog/impl/UserReg.java | 41 -
.../model/AdvancedInputDataHandling.java | 113 -
.../model/AdvancedOutputDataHandling.java | 104 -
.../catalog/model/ApplicationInput.java | 165 -
.../catalog/model/ApplicationInput_PK.java | 65 -
.../catalog/model/ApplicationOutput.java | 142 -
.../catalog/model/ApplicationOutput_PK.java | 64 -
.../Computational_Resource_Scheduling.java | 174 -
.../experiment/catalog/model/Configuration.java | 80 -
.../catalog/model/Configuration_PK.java | 74 -
.../catalog/model/DataTransferDetail.java | 91 -
.../experiment/catalog/model/ErrorDetail.java | 176 --
.../experiment/catalog/model/Experiment.java | 299 --
.../catalog/model/ExperimentConfigData.java | 142 -
.../catalog/model/Experiment_Input.java | 170 -
.../catalog/model/Experiment_Input_PK.java | 64 -
.../catalog/model/Experiment_Output.java | 143 -
.../catalog/model/Experiment_Output_PK.java | 64 -
.../experiment/catalog/model/Gateway.java | 76 -
.../catalog/model/Gateway_Worker.java | 82 -
.../catalog/model/Gateway_Worker_PK.java | 64 -
.../experiment/catalog/model/JobDetail.java | 135 -
.../experiment/catalog/model/JobDetails_PK.java | 64 -
.../experiment/catalog/model/NodeInput.java | 163 -
.../experiment/catalog/model/NodeInput_PK.java | 64 -
.../experiment/catalog/model/NodeOutput.java | 140 -
.../experiment/catalog/model/NodeOutput_PK.java | 64 -
.../catalog/model/Notification_Email.java | 81 -
.../experiment/catalog/model/Project.java | 125 -
.../experiment/catalog/model/ProjectUser.java | 81 -
.../catalog/model/ProjectUser_PK.java | 64 -
.../experiment/catalog/model/QosParam.java | 103 -
.../experiment/catalog/model/Status.java | 146 -
.../experiment/catalog/model/TaskDetail.java | 221 --
.../experiment/catalog/model/Users.java | 55 -
.../catalog/model/WorkflowNodeDetail.java | 155 -
.../catalog/resources/AbstractResource.java | 317 --
.../AdvanceInputDataHandlingResource.java | 160 -
.../AdvancedOutputDataHandlingResource.java | 150 -
.../resources/ApplicationInputResource.java | 230 --
.../resources/ApplicationOutputResource.java | 208 --
.../ComputationSchedulingResource.java | 221 --
.../catalog/resources/ConfigDataResource.java | 194 --
.../resources/ConfigurationResource.java | 204 --
.../resources/DataTransferDetailResource.java | 276 --
.../catalog/resources/ErrorDetailResource.java | 215 --
.../resources/ExperimentInputResource.java | 225 --
.../resources/ExperimentOutputResource.java | 204 --
.../catalog/resources/ExperimentResource.java | 831 -----
.../resources/ExperimentSummaryResource.java | 134 -
.../catalog/resources/GatewayResource.java | 437 ---
.../catalog/resources/JobDetailResource.java | 376 ---
.../catalog/resources/NodeInputResource.java | 227 --
.../catalog/resources/NodeOutputResource.java | 207 --
.../resources/NotificationEmailResource.java | 119 -
.../catalog/resources/ProjectResource.java | 508 ---
.../catalog/resources/ProjectUserResource.java | 123 -
.../catalog/resources/QosParamResource.java | 144 -
.../catalog/resources/StatusResource.java | 181 --
.../catalog/resources/TaskDetailResource.java | 748 -----
.../catalog/resources/UserResource.java | 186 --
.../experiment/catalog/resources/Utils.java | 1011 ------
.../catalog/resources/WorkerResource.java | 725 -----
.../resources/WorkflowNodeDetailResource.java | 515 ---
.../catalog/utils/QueryGenerator.java | 128 -
.../utils/ThriftDataModelConversion.java | 686 ----
.../src/main/resources/META-INF/persistence.xml | 65 -
.../src/main/resources/registry-derby.sql | 391 ---
.../src/main/resources/registry-mysql.sql | 392 ---
.../catalog/AbstractResourceTest.java | 91 -
.../catalog/ComputationalSchedulingTest.java | 84 -
.../catalog/ConfigurationResourceTest.java | 58 -
.../catalog/ExecutionErrorResourceTest.java | 95 -
.../catalog/ExperimentDataResourceTest.java | 107 -
.../catalog/ExperimentInputResourceTest.java | 75 -
.../catalog/ExperimentMetadataResourceTest.java | 87 -
.../catalog/ExperimentOutputResourceTest.java | 76 -
.../catalog/ExperimentResourceTest.java | 77 -
.../catalog/GFacJobDataResourceTest.java | 77 -
.../catalog/GFacJobStatusResourceTest.java | 87 -
.../experiment/catalog/GatewayResourceTest.java | 120 -
.../catalog/GramDataResourceTest.java | 72 -
.../catalog/NodeDataResourceTest.java | 72 -
.../catalog/OrchestratorDataResourceTest.java | 69 -
.../experiment/catalog/RegistryUseCaseTest.java | 296 --
.../catalog/TaskDetailResourceTest.java | 93 -
.../experiment/catalog/UserResourceTest.java | 54 -
.../experiment/catalog/WorkerResourceTest.java | 122 -
.../catalog/WorkflowDataResourceTest.java | 106 -
.../catalog/WorkflowNodeDetailResourceTest.java | 85 -
.../experiment/catalog/util/Initialize.java | 333 --
.../src/test/resources/registry-derby.sql | 391 ---
modules/registry/pom.xml | 2 +-
modules/registry/registry-core/pom.xml | 147 +
.../app/catalog/impl/AppCatalogFactory.java | 46 +
.../core/app/catalog/impl/AppCatalogImpl.java | 52 +
.../catalog/impl/ApplicationDeploymentImpl.java | 413 +++
.../catalog/impl/ApplicationInterfaceImpl.java | 450 +++
.../app/catalog/impl/ComputeResourceImpl.java | 888 ++++++
.../catalog/impl/GwyResourceProfileImpl.java | 252 ++
.../app/catalog/impl/WorkflowCatalogImpl.java | 232 ++
.../core/app/catalog/model/AppEnvironment.java | 76 +
.../app/catalog/model/AppEnvironment_PK.java | 64 +
.../core/app/catalog/model/AppInput_PK.java | 64 +
.../app/catalog/model/AppModuleMapping.java | 77 +
.../app/catalog/model/AppModuleMapping_PK.java | 64 +
.../core/app/catalog/model/AppOutput_PK.java | 64 +
.../catalog/model/ApplicationDeployment.java | 148 +
.../app/catalog/model/ApplicationInput.java | 166 +
.../app/catalog/model/ApplicationInterface.java | 97 +
.../app/catalog/model/ApplicationModule.java | 107 +
.../app/catalog/model/ApplicationOutput.java | 146 +
.../core/app/catalog/model/BatchQueue.java | 144 +
.../core/app/catalog/model/BatchQueue_PK.java | 63 +
.../app/catalog/model/CloudJobSubmission.java | 102 +
.../core/app/catalog/model/ComputeResource.java | 105 +
.../model/ComputeResourceFileSystem.java | 89 +
.../model/ComputeResourceFileSystem_PK.java | 62 +
.../model/ComputeResourcePreference.java | 154 +
.../model/ComputeResourcePreferencePK.java | 64 +
.../core/app/catalog/model/Configuration.java | 56 +
.../app/catalog/model/Configuration_PK.java | 65 +
.../catalog/model/DataMovementInterface.java | 124 +
.../catalog/model/DataMovementInterface_PK.java | 62 +
.../app/catalog/model/DataMovementProtocol.java | 76 +
.../catalog/model/DataMovementProtocolPK.java | 74 +
.../core/app/catalog/model/GSISSHExport.java | 73 +
.../core/app/catalog/model/GSISSHExportPK.java | 64 +
.../app/catalog/model/GSISSHSubmission.java | 82 +
.../core/app/catalog/model/GatewayProfile.java | 68 +
.../app/catalog/model/GlobusGKEndPointPK.java | 64 +
.../app/catalog/model/GlobusGKEndpoint.java | 65 +
.../app/catalog/model/GlobusJobSubmission.java | 62 +
.../app/catalog/model/GridftpDataMovement.java | 83 +
.../core/app/catalog/model/GridftpEndpoint.java | 102 +
.../app/catalog/model/GridftpEndpoint_PK.java | 62 +
.../core/app/catalog/model/HostAlias.java | 64 +
.../core/app/catalog/model/HostAliasPK.java | 64 +
.../core/app/catalog/model/HostIPAddress.java | 65 +
.../core/app/catalog/model/HostIPAddressPK.java | 64 +
.../app/catalog/model/JobManagerCommand.java | 89 +
.../app/catalog/model/JobManagerCommand_PK.java | 62 +
.../catalog/model/JobSubmissionInterface.java | 124 +
.../model/JobSubmissionInterface_PK.java | 62 +
.../catalog/model/JobSubmissionProtocol.java | 77 +
.../catalog/model/JobSubmissionProtocolPK.java | 74 +
.../app/catalog/model/LibraryApendPath.java | 76 +
.../app/catalog/model/LibraryApendPath_PK.java | 64 +
.../app/catalog/model/LibraryPrepandPath.java | 76 +
.../catalog/model/LibraryPrepandPath_PK.java | 64 +
.../app/catalog/model/LocalDataMovement.java | 49 +
.../core/app/catalog/model/LocalSubmission.java | 98 +
.../core/app/catalog/model/ModuleLoadCmd.java | 70 +
.../app/catalog/model/ModuleLoadCmd_PK.java | 63 +
.../core/app/catalog/model/PostJobCommand.java | 73 +
.../app/catalog/model/PostJobCommandPK.java | 64 +
.../core/app/catalog/model/PreJobCommand.java | 73 +
.../core/app/catalog/model/PreJobCommandPK.java | 64 +
.../app/catalog/model/ResourceJobManager.java | 106 +
.../core/app/catalog/model/ScpDataMovement.java | 117 +
.../app/catalog/model/SshJobSubmission.java | 144 +
.../app/catalog/model/UnicoreDataMovement.java | 65 +
.../app/catalog/model/UnicoreJobSubmission.java | 66 +
.../core/app/catalog/model/Workflow.java | 126 +
.../core/app/catalog/model/WorkflowInput.java | 167 +
.../app/catalog/model/WorkflowInput_PK.java | 64 +
.../core/app/catalog/model/WorkflowOutput.java | 117 +
.../app/catalog/model/WorkflowOutput_PK.java | 64 +
.../app/catalog/resources/AbstractResource.java | 382 +++
.../resources/AppCatAbstractResource.java | 382 +++
.../catalog/resources/AppCatalogResource.java | 90 +
.../AppDeploymentAppCatalogResourceAppCat.java | 446 +++
.../resources/AppDeploymentResource.java | 446 +++
.../AppEnvironmentAppCatalogResourceAppCat.java | 293 ++
.../resources/AppEnvironmentResource.java | 293 ++
.../AppInterfaceAppCatalogResourceAppCat.java | 363 +++
.../catalog/resources/AppInterfaceResource.java | 363 +++
.../AppModuleAppCatalogResourceAppCat.java | 344 ++
...ppModuleMappingAppCatalogResourceAppCat.java | 317 ++
.../resources/AppModuleMappingResource.java | 317 ++
.../catalog/resources/AppModuleResource.java | 344 ++
...pplicationInputAppCatalogResourceAppCat.java | 454 +++
.../resources/ApplicationInputResource.java | 454 +++
...plicationOutputAppCatalogResourceAppCat.java | 433 +++
.../resources/ApplicationOutputResource.java | 432 +++
.../BatchQueueAppCatalogResourceAppCat.java | 357 +++
.../catalog/resources/BatchQueueResource.java | 357 +++
...CloudSubmissionAppCatalogResourceAppCat.java | 298 ++
.../resources/CloudSubmissionResource.java | 298 ++
...eHostPreferenceAppCatalogResourceAppCat.java | 413 +++
.../ComputeHostPreferenceResource.java | 413 +++
...ComputeResourceAppCatalogResourceAppCat.java | 351 +++
...ourceFileSystemAppCatalogResourceAppCat.java | 307 ++
.../ComputeResourceFileSystemResource.java | 307 ++
.../resources/ComputeResourceResource.java | 351 +++
...vementInterfaceAppCatalogResourceAppCat.java | 339 ++
.../DataMovementInterfaceResource.java | 339 ++
.../resources/DataMovementProtocolResource.java | 360 +++
.../GSISSHExportAppCatalogResourceAppCat.java | 324 ++
.../catalog/resources/GSISSHExportResource.java | 324 ++
...SISSHSubmissionAppCatalogResourceAppCat.java | 373 +++
.../resources/GSISSHSubmissionResource.java | 373 +++
.../GatewayProfileAppCatalogResourceAppCat.java | 318 ++
.../resources/GatewayProfileResource.java | 318 ++
...lobusGKEndpointAppCatalogResourceAppCat.java | 323 ++
.../resources/GlobusGKEndpointResource.java | 321 ++
...usJobSubmissionAppCatalogResourceAppCat.java | 315 ++
.../resources/GlobusJobSubmissionResource.java | 315 ++
...ftpDataMovementAppCatalogResourceAppCat.java | 279 ++
.../resources/GridftpDataMovementResource.java | 279 ++
...GridftpEndpointAppCatalogResourceAppCat.java | 317 ++
.../resources/GridftpEndpointResource.java | 317 ++
.../HostAliasAppCatalogResourceAppCat.java | 317 ++
.../catalog/resources/HostAliasResource.java | 317 ++
.../HostIPAddressAppCatalogResourceAppCat.java | 318 ++
.../resources/HostIPAddressResource.java | 318 ++
...bManagerCommandAppCatalogResourceAppCat.java | 307 ++
.../resources/JobManagerCommandResource.java | 307 ++
...issionInterfaceAppCatalogResourceAppCat.java | 339 ++
.../JobSubmissionInterfaceResource.java | 339 ++
.../JobSubmissionProtocolResource.java | 359 +++
...ibraryApendPathAppCatalogResourceAppCat.java | 292 ++
.../resources/LibraryApendPathResource.java | 292 ++
...raryPrepandPathAppCatalogResourceAppCat.java | 291 ++
.../resources/LibraryPrepandPathResource.java | 291 ++
...calDataMovementAppCatalogResourceAppCat.java | 249 ++
.../resources/LocalDataMovementResource.java | 249 ++
...LocalSubmissionAppCatalogResourceAppCat.java | 293 ++
.../resources/LocalSubmissionResource.java | 293 ++
.../ModuleLoadCmdAppCatalogResourceAppCat.java | 300 ++
.../resources/ModuleLoadCmdResource.java | 300 ++
.../PostJobCommandAppCatalogResourceAppCat.java | 333 ++
.../resources/PostJobCommandResource.java | 333 ++
.../PreJobCommandAppCatalogResourceAppCat.java | 333 ++
.../resources/PreJobCommandResource.java | 333 ++
.../core/app/catalog/resources/Resource.java | 89 +
...ourceJobManagerAppCatalogResourceAppCat.java | 301 ++
.../resources/ResourceJobManagerResource.java | 301 ++
...ScpDataMovementAppCatalogResourceAppCat.java | 308 ++
.../resources/ScpDataMovementResource.java | 308 ++
...shJobSubmissionAppCatalogResourceAppCat.java | 332 ++
.../resources/SshJobSubmissionResource.java | 332 ++
...oreDataMovementAppCatalogResourceAppCat.java | 255 ++
.../resources/UnicoreDataMovementResource.java | 255 ++
...reJobSubmissionAppCatalogResourceAppCat.java | 328 ++
.../resources/UnicoreJobSubmissionResource.java | 328 ++
.../WorkflowAppCatalogResourceAppCat.java | 382 +++
.../WorkflowInputAppCatalogResourceAppCat.java | 451 +++
.../resources/WorkflowInputResource.java | 451 +++
.../WorkflowOutputAppCatalogResourceAppCat.java | 410 +++
.../resources/WorkflowOutputResource.java | 410 +++
.../app/catalog/resources/WorkflowResource.java | 382 +++
.../app/catalog/util/AppCatalogJPAUtils.java | 912 ++++++
.../catalog/util/AppCatalogQueryGenerator.java | 90 +
.../catalog/util/AppCatalogResourceType.java | 66 +
.../util/AppCatalogThriftConversion.java | 800 +++++
.../core/app/catalog/util/AppCatalogUtils.java | 31 +
.../experiment/catalog/ExpCatResourceUtils.java | 526 +++
.../catalog/ExperimentCatResource.java | 71 +
.../core/experiment/catalog/JPAConstants.java | 32 +
.../core/experiment/catalog/ResourceType.java | 49 +
.../catalog/impl/ExperimentCatalogImpl.java | 735 +++++
.../catalog/impl/ExperimentRegistry.java | 2983 ++++++++++++++++++
.../catalog/impl/GatewayRegistry.java | 115 +
.../impl/LoggingExperimentCatalogImpl.java | 97 +
.../catalog/impl/ProjectRegistry.java | 303 ++
.../catalog/impl/RegistryFactory.java | 80 +
.../core/experiment/catalog/impl/UserReg.java | 41 +
.../model/AdvancedInputDataHandling.java | 113 +
.../model/AdvancedOutputDataHandling.java | 105 +
.../catalog/model/ApplicationInput.java | 167 +
.../catalog/model/ApplicationInput_PK.java | 65 +
.../catalog/model/ApplicationOutput.java | 143 +
.../catalog/model/ApplicationOutput_PK.java | 64 +
.../Computational_Resource_Scheduling.java | 175 +
.../experiment/catalog/model/Configuration.java | 80 +
.../catalog/model/Configuration_PK.java | 74 +
.../catalog/model/DataTransferDetail.java | 93 +
.../experiment/catalog/model/ErrorDetail.java | 179 ++
.../experiment/catalog/model/Experiment.java | 299 ++
.../catalog/model/ExperimentConfigData.java | 142 +
.../catalog/model/Experiment_Input.java | 170 +
.../catalog/model/Experiment_Input_PK.java | 64 +
.../catalog/model/Experiment_Output.java | 143 +
.../catalog/model/Experiment_Output_PK.java | 64 +
.../core/experiment/catalog/model/Gateway.java | 76 +
.../catalog/model/Gateway_Worker.java | 82 +
.../catalog/model/Gateway_Worker_PK.java | 64 +
.../experiment/catalog/model/JobDetail.java | 135 +
.../experiment/catalog/model/JobDetails_PK.java | 64 +
.../experiment/catalog/model/NodeInput.java | 163 +
.../experiment/catalog/model/NodeInput_PK.java | 64 +
.../experiment/catalog/model/NodeOutput.java | 140 +
.../experiment/catalog/model/NodeOutput_PK.java | 64 +
.../catalog/model/Notification_Email.java | 81 +
.../core/experiment/catalog/model/Project.java | 125 +
.../experiment/catalog/model/ProjectUser.java | 81 +
.../catalog/model/ProjectUser_PK.java | 64 +
.../core/experiment/catalog/model/QosParam.java | 103 +
.../core/experiment/catalog/model/Status.java | 146 +
.../experiment/catalog/model/TaskDetail.java | 221 ++
.../core/experiment/catalog/model/Users.java | 55 +
.../catalog/model/WorkflowNodeDetail.java | 155 +
.../AbstractExperimentCatResource.java | 317 ++
...eInputDataHandlingExperimentCatResource.java | 160 +
...OutputDataHandlingExperimentCatResource.java | 150 +
.../ApplicationInputExperimentCatResource.java | 230 ++
.../ApplicationOutputExperimentCatResource.java | 208 ++
...putationSchedulingExperimentCatResource.java | 221 ++
.../ConfigDataExperimentCatResource.java | 194 ++
.../ConfigurationExperimentCatResource.java | 204 ++
...DataTransferDetailExperimentCatResource.java | 276 ++
.../ErrorDetailExperimentCatResource.java | 215 ++
.../ExperimentExperimentCatResource.java | 831 +++++
.../ExperimentInputExperimentCatResource.java | 225 ++
.../ExperimentOutputExperimentCatResource.java | 204 ++
.../ExperimentSummaryExperimentCatResource.java | 134 +
.../resources/GatewayExperimentCatResource.java | 437 +++
.../JobDetailExperimentCatResource.java | 376 +++
.../NodeInputExperimentCatResource.java | 227 ++
.../NodeOutputExperimentCatResource.java | 207 ++
.../NotificationEmailExperimentCatResource.java | 119 +
.../resources/ProjectExperimentCatResource.java | 508 +++
.../ProjectUserExperimentCatResource.java | 123 +
.../QosParamExperimentCatResource.java | 144 +
.../resources/StatusExperimentCatResource.java | 181 ++
.../TaskDetailExperimentCatResource.java | 748 +++++
.../resources/UserExperimentCatResource.java | 186 ++
.../experiment/catalog/resources/Utils.java | 1011 ++++++
.../resources/WorkerExperimentCatResource.java | 725 +++++
...WorkflowNodeDetailExperimentCatResource.java | 515 +++
.../catalog/utils/QueryGenerator.java | 128 +
.../utils/ThriftDataModelConversion.java | 686 ++++
.../core/experimet/catalog/JPAConstants.java | 33 +
.../core/experimet/catalog/Resource.java | 71 +
.../core/experimet/catalog/ResourceType.java | 50 +
.../core/experimet/catalog/ResourceUtils.java | 525 +++
.../catalog/impl/ExperimentCatalogImpl.java | 735 +++++
.../catalog/impl/ExperimentRegistry.java | 2983 ++++++++++++++++++
.../experimet/catalog/impl/GatewayRegistry.java | 115 +
.../impl/LoggingExperimentCatalogImpl.java | 97 +
.../experimet/catalog/impl/ProjectRegistry.java | 303 ++
.../experimet/catalog/impl/RegistryFactory.java | 80 +
.../core/experimet/catalog/impl/UserReg.java | 41 +
.../model/AdvancedInputDataHandling.java | 113 +
.../model/AdvancedOutputDataHandling.java | 104 +
.../catalog/model/ApplicationInput.java | 165 +
.../catalog/model/ApplicationInput_PK.java | 65 +
.../catalog/model/ApplicationOutput.java | 142 +
.../catalog/model/ApplicationOutput_PK.java | 64 +
.../Computational_Resource_Scheduling.java | 174 +
.../experimet/catalog/model/Configuration.java | 80 +
.../catalog/model/Configuration_PK.java | 74 +
.../catalog/model/DataTransferDetail.java | 91 +
.../experimet/catalog/model/ErrorDetail.java | 176 ++
.../experimet/catalog/model/Experiment.java | 299 ++
.../catalog/model/ExperimentConfigData.java | 142 +
.../catalog/model/Experiment_Input.java | 170 +
.../catalog/model/Experiment_Input_PK.java | 64 +
.../catalog/model/Experiment_Output.java | 143 +
.../catalog/model/Experiment_Output_PK.java | 64 +
.../core/experimet/catalog/model/Gateway.java | 76 +
.../experimet/catalog/model/Gateway_Worker.java | 82 +
.../catalog/model/Gateway_Worker_PK.java | 64 +
.../core/experimet/catalog/model/JobDetail.java | 135 +
.../experimet/catalog/model/JobDetails_PK.java | 64 +
.../core/experimet/catalog/model/NodeInput.java | 163 +
.../experimet/catalog/model/NodeInput_PK.java | 64 +
.../experimet/catalog/model/NodeOutput.java | 140 +
.../experimet/catalog/model/NodeOutput_PK.java | 64 +
.../catalog/model/Notification_Email.java | 81 +
.../core/experimet/catalog/model/Project.java | 125 +
.../experimet/catalog/model/ProjectUser.java | 81 +
.../experimet/catalog/model/ProjectUser_PK.java | 64 +
.../core/experimet/catalog/model/QosParam.java | 103 +
.../core/experimet/catalog/model/Status.java | 146 +
.../experimet/catalog/model/TaskDetail.java | 221 ++
.../core/experimet/catalog/model/Users.java | 55 +
.../catalog/model/WorkflowNodeDetail.java | 155 +
.../catalog/resources/AbstractResource.java | 317 ++
.../AdvanceInputDataHandlingResource.java | 160 +
.../AdvancedOutputDataHandlingResource.java | 150 +
.../resources/ApplicationInputResource.java | 230 ++
.../resources/ApplicationOutputResource.java | 208 ++
.../ComputationSchedulingResource.java | 221 ++
.../catalog/resources/ConfigDataResource.java | 194 ++
.../resources/ConfigurationResource.java | 204 ++
.../resources/DataTransferDetailResource.java | 276 ++
.../catalog/resources/ErrorDetailResource.java | 215 ++
.../resources/ExperimentInputResource.java | 225 ++
.../resources/ExperimentOutputResource.java | 204 ++
.../catalog/resources/ExperimentResource.java | 831 +++++
.../resources/ExperimentSummaryResource.java | 134 +
.../catalog/resources/GatewayResource.java | 437 +++
.../catalog/resources/JobDetailResource.java | 376 +++
.../catalog/resources/NodeInputResource.java | 227 ++
.../catalog/resources/NodeOutputResource.java | 207 ++
.../resources/NotificationEmailResource.java | 119 +
.../catalog/resources/ProjectResource.java | 508 +++
.../catalog/resources/ProjectUserResource.java | 123 +
.../catalog/resources/QosParamResource.java | 144 +
.../catalog/resources/StatusResource.java | 181 ++
.../catalog/resources/TaskDetailResource.java | 748 +++++
.../catalog/resources/UserResource.java | 186 ++
.../core/experimet/catalog/resources/Utils.java | 1011 ++++++
.../catalog/resources/WorkerResource.java | 725 +++++
.../resources/WorkflowNodeDetailResource.java | 515 +++
.../experimet/catalog/utils/QueryGenerator.java | 128 +
.../utils/ThriftDataModelConversion.java | 686 ++++
.../src/main/resources/META-INF/app-catalog.xml | 67 +
.../resources/META-INF/experiment-catalog.xml | 65 +
.../src/main/resources/META-INF/persistence.xml | 96 +
.../src/main/resources/appcatalog-derby.sql | 460 +++
.../src/main/resources/appcatalog-mysql.sql | 453 +++
.../src/main/resources/expcatalog-derby.sql | 391 +++
.../src/main/resources/expcatalog-mysql.sql | 392 +++
.../airavata/app/catalog/AppDeploymentTest.java | 146 +
.../airavata/app/catalog/AppInterfaceTest.java | 191 ++
...puteAppCatalogExperimentCatResourceTest.java | 297 ++
.../app/catalog/ComputeResourceTest.java | 297 ++
.../app/catalog/GatewayProfileTest.java | 127 +
.../airavata/app/catalog/util/Initialize.java | 320 ++
.../catalog/AbstractResourceTest.java | 91 +
.../catalog/ComputationalSchedulingTest.java | 85 +
.../ConfigurationExperimentCatResourceTest.java | 58 +
.../catalog/ConfigurationResourceTest.java | 58 +
.../catalog/ExecutionErrorResourceTest.java | 95 +
.../catalog/ExperimentCatalogUseCaseTest.java | 296 ++
.../catalog/ExperimentDataResourceTest.java | 107 +
.../ExperimentExperimentCatResourceTest.java | 78 +
...xperimentInputExperimentCatResourceTest.java | 77 +
.../catalog/ExperimentInputResourceTest.java | 75 +
.../catalog/ExperimentMetadataResourceTest.java | 87 +
...perimentOutputExperimentCatResourceTest.java | 77 +
.../catalog/ExperimentOutputResourceTest.java | 76 +
.../catalog/ExperimentResourceTest.java | 77 +
.../catalog/GFacJobDataResourceTest.java | 77 +
.../catalog/GFacJobStatusResourceTest.java | 87 +
.../GatewayExperimentCatResourceTest.java | 122 +
.../experiment/catalog/GatewayResourceTest.java | 120 +
.../catalog/GramDataResourceTest.java | 72 +
.../catalog/NodeDataResourceTest.java | 72 +
.../catalog/OrchestratorDataResourceTest.java | 69 +
.../TaskDetailExperimentCatResourceTest.java | 94 +
.../catalog/TaskDetailResourceTest.java | 93 +
.../catalog/UserExperimentCatResourceTest.java | 55 +
.../experiment/catalog/UserResourceTest.java | 54 +
.../experiment/catalog/WorkerResourceTest.java | 122 +
.../catalog/WorkflowDataResourceTest.java | 106 +
...flowNodeDetailExperimentCatResourceTest.java | 86 +
.../catalog/WorkflowNodeDetailResourceTest.java | 85 +
.../experiment/catalog/util/Initialize.java | 329 ++
.../src/test/resources/appcatalog-derby.sql | 460 +++
.../src/test/resources/expcatalog-derby.sql | 391 +++
modules/registry/registry-cpi/pom.xml | 5 +
.../airavata/registry/cpi/AppCatalog.java | 54 +
.../registry/cpi/AppCatalogException.java | 36 +
.../registry/cpi/ApplicationDeployment.java | 72 +
.../registry/cpi/ApplicationInterface.java | 148 +
.../airavata/registry/cpi/ChildDataType.java | 45 -
.../airavata/registry/cpi/ComputeResource.java | 249 ++
.../registry/cpi/ExpCatChildDataType.java | 45 +
.../registry/cpi/ExpCatParentDataType.java | 32 +
.../registry/cpi/ExperimentCatalog.java | 193 ++
.../cpi/ExperimentCatalogException.java | 38 +
.../cpi/ExperimentCatalogModelType.java | 51 +
.../registry/cpi/GwyResourceProfile.java | 81 +
.../airavata/registry/cpi/ParentDataType.java | 32 -
.../apache/airavata/registry/cpi/Registry.java | 178 +-
.../registry/cpi/RegistryModelType.java | 51 -
.../airavata/registry/cpi/WorkflowCatalog.java | 45 +
.../catalog/WorkflowCatalogFactory.java | 4 +-
.../workflow/engine/WorkflowEngineImpl.java | 10 +-
.../airavata/workflow/engine/WorkflowUtils.java | 4 +-
.../engine/interpretor/WorkflowInterpreter.java | 32 +-
pom.xml | 1 -
691 files changed, 86626 insertions(+), 50265 deletions(-)
----------------------------------------------------------------------
[34/52] [abbrv] [partial] airavata git commit: registry refactoring
Posted by sh...@apache.org.
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/ResourceType.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/ResourceType.java b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/ResourceType.java
deleted file mode 100644
index ea66a90..0000000
--- a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/ResourceType.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- *
- * 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.experiment.catalog;
-
-public enum ResourceType {
- GATEWAY,
- PROJECT,
- USER,
- PROJECT_USER,
- CONFIGURATION,
- GATEWAY_WORKER,
- EXPERIMENT,
- EXPERIMENT_SUMMARY,
- NOTIFICATION_EMAIL,
- EXPERIMENT_INPUT,
- EXPERIMENT_OUTPUT,
- WORKFLOW_NODE_DETAIL,
- TASK_DETAIL,
- ERROR_DETAIL,
- APPLICATION_INPUT,
- APPLICATION_OUTPUT,
- NODE_INPUT,
- NODE_OUTPUT,
- JOB_DETAIL,
- DATA_TRANSFER_DETAIL,
- STATUS,
- CONFIG_DATA,
- COMPUTATIONAL_RESOURCE_SCHEDULING,
- ADVANCE_INPUT_DATA_HANDLING,
- ADVANCE_OUTPUT_DATA_HANDLING,
- QOS_PARAM
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/ResourceUtils.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/ResourceUtils.java b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/ResourceUtils.java
deleted file mode 100644
index a8d8e83..0000000
--- a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/ResourceUtils.java
+++ /dev/null
@@ -1,525 +0,0 @@
-/*
- *
- * 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.experiment.catalog;
-
-import org.apache.airavata.experiment.catalog.model.*;
-import org.apache.airavata.experiment.catalog.resources.*;
-import org.apache.airavata.experiment.catalog.utils.QueryGenerator;
-import org.apache.airavata.registry.cpi.RegistryException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.persistence.EntityManager;
-import javax.persistence.EntityManagerFactory;
-import javax.persistence.Persistence;
-import javax.persistence.Query;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-public class ResourceUtils {
- private final static Logger logger = LoggerFactory.getLogger(ResourceUtils.class);
- private static final String PERSISTENCE_UNIT_NAME = "airavata_data";
- protected static EntityManagerFactory factory;
-
- public static void reset(){
- factory=null;
- }
-
- public static EntityManager getEntityManager(){
- if (factory == null) {
- String connectionProperties = "DriverClassName=" + Utils.getJDBCDriver() + "," + "Url=" + Utils.getJDBCURL() + "?autoReconnect=true,," +
- "Username=" + Utils.getJDBCUser() + "," + "Password=" + Utils.getJDBCPassword() + ",validationQuery=" +
- Utils.getValidationQuery();
- System.out.println(connectionProperties);
- Map<String, String> properties = new HashMap<String, String>();
- properties.put("openjpa.ConnectionDriverName", "org.apache.commons.dbcp.BasicDataSource");
- properties.put("openjpa.ConnectionProperties", connectionProperties);
- properties.put("openjpa.DynamicEnhancementAgent", "true");
- properties.put("openjpa.RuntimeUnenhancedClasses", "unsupported");
- properties.put("openjpa.DataCache","" + Utils.isCachingEnabled() + "(CacheSize=" + Utils.getJPACacheSize() + ", SoftReferenceSize=0)");
- properties.put("openjpa.QueryCache","" + Utils.isCachingEnabled() + "(CacheSize=" + Utils.getJPACacheSize() + ", SoftReferenceSize=0)");
- properties.put("openjpa.RemoteCommitProvider","sjvm");
- properties.put("openjpa.Log","DefaultLevel=INFO, Runtime=INFO, Tool=INFO, SQL=INFO");
- properties.put("openjpa.jdbc.DBDictionary","SupportsMultipleNontransactionalResultSets=false");
-// properties.put("openjpa.ReadLockLevel", "none");
-// properties.put("openjpa.WriteLockLevel", "none");
-// properties.put("openjpa.LockTimeout", "30000");
-// properties.put("openjpa.LockManager", "none");
- properties.put("openjpa.jdbc.SynchronizeMappings", "buildSchema(ForeignKeys=true)");
- properties.put("openjpa.ConnectionFactoryProperties", "PrettyPrint=true, PrettyPrintLineLength=72, PrintParameters=true, MaxActive=10, MaxIdle=5, MinIdle=2, MaxWait=31536000, autoReconnect=true");
- properties.put("openjpa.jdbc.QuerySQLCache", "false");
- factory = Persistence.createEntityManagerFactory(PERSISTENCE_UNIT_NAME, properties);
- }
- return factory.createEntityManager();
- }
-
- /**
- * @param gatewayId
- * @return
- */
- public static Resource createGateway(String gatewayId) throws RegistryException {
- if (!isGatewayExist(gatewayId)) {
- GatewayResource gatewayResource = new GatewayResource();
- gatewayResource.setGatewayId(gatewayId);
- return gatewayResource;
- }else {
- return getGateway(gatewayId);
- }
- }
-
- public static UserResource createUser(String username, String password) throws RegistryException {
- if (!isUserExist(username)) {
- UserResource userResource = new UserResource();
- userResource.setUserName(username);
- userResource.setPassword(password);
- return userResource;
- }else {
- return (UserResource)getUser(username);
- }
-
- }
-
- public static Resource getGateway(String gatewayId) throws RegistryException{
- EntityManager em = null;
- try {
- if (isGatewayExist(gatewayId)) {
- em = getEntityManager();
- Gateway gateway = em.find(Gateway.class, gatewayId);
- GatewayResource gatewayResource = (GatewayResource)Utils.getResource(ResourceType.GATEWAY, gateway);
- em.close();
- return gatewayResource;
- }
- }catch (Exception e){
- logger.error(e.getMessage(), e);
- throw new RegistryException(e);
- }finally {
- if (em != null && em.isOpen()){
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- return null;
- }
-
- public static void addUser (String userName, String password) throws RegistryException{
- UserResource resource = new UserResource();
- resource.setUserName(userName);
- resource.setPassword(password);
- resource.save();
- }
-
- public static boolean isUserExist (String username) throws RegistryException{
- EntityManager em = null;
- try {
- em = getEntityManager();
- em.getTransaction().begin();
- QueryGenerator generator = new QueryGenerator(AbstractResource.USERS);
- generator.setParameter(AbstractResource.UserConstants.USERNAME, username);
- Query q = generator.selectQuery(em);
- int size = q.getResultList().size();
- em.getTransaction().commit();
- em.close();
- return size>0;
- } catch (Exception e){
- logger.error(e.getMessage(), e);
- throw new RegistryException(e);
- }finally {
- if (em != null && em.isOpen()){
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
-
- public static Resource getUser(String userName) throws RegistryException{
- EntityManager em = null;
- try {
- if (isUserExist(userName)) {
- em = getEntityManager();
- Users user = em.find(Users.class, userName);
- UserResource userResource = (UserResource)Utils.getResource(ResourceType.USER, user);
- em.close();
- return userResource;
- }
- }catch (Exception e){
- logger.error(e.getMessage(), e);
- throw new RegistryException(e);
- }finally {
- if (em != null && em.isOpen()){
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- return null;
-
- }
-
- public static Resource getWorker(String gatewayId, String userName) throws RegistryException{
- EntityManager em = null;
- try {
- em = getEntityManager();
- Gateway_Worker gatewayWorker = em.find(Gateway_Worker.class, new Gateway_Worker_PK(gatewayId, userName));
- WorkerResource workerResource = (WorkerResource) Utils.getResource(ResourceType.GATEWAY_WORKER, gatewayWorker);
- em.close();
- return workerResource;
- }catch (Exception e){
- logger.error(e.getMessage(), e);
- throw new RegistryException(e);
- }finally {
- if (em != null && em.isOpen()){
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
-
-
- }
-
-
- /**
- * @param gatewayId
- * @return
- */
- public static boolean isGatewayExist(String gatewayId) throws RegistryException{
- EntityManager em = null;
- try {
- em = getEntityManager();
- em.getTransaction().begin();
- QueryGenerator generator = new QueryGenerator(AbstractResource.GATEWAY);
- generator.setParameter(AbstractResource.GatewayConstants.GATEWAY_ID, gatewayId);
- Query q = generator.selectQuery(em);
- int size = q.getResultList().size();
- em.getTransaction().commit();
- em.close();
- return size>0;
- }catch (Exception e){
- logger.error(e.getMessage(), e);
- throw new RegistryException(e);
- }finally {
- if (em != null && em.isOpen()){
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
-
- }
-
- public static List<Resource> getAllGateways() throws RegistryException{
- List<Resource> resourceList = new ArrayList<Resource>();
- EntityManager em = null;
- try {
- em = getEntityManager();
- em.getTransaction().begin();
- QueryGenerator generator = new QueryGenerator(AbstractResource.GATEWAY);
- Query q = generator.selectQuery(em);
- List results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- Gateway gateway = (Gateway) result;
- GatewayResource gatewayResource =
- (GatewayResource) Utils.getResource(ResourceType.GATEWAY, gateway);
- resourceList.add(gatewayResource);
- }
- }
- em.getTransaction().commit();
- em.close();
- }catch (Exception e){
- logger.error(e.getMessage(), e);
- throw new RegistryException(e);
- }finally {
- if (em != null && em.isOpen()){
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- return resourceList;
- }
-
- /**
- * @param gatewayId
- * @return
- */
- public static boolean removeGateway(String gatewayId) {
- EntityManager em = null;
- try {
- em = getEntityManager();
- em.getTransaction().begin();
- QueryGenerator generator = new QueryGenerator(AbstractResource.GATEWAY);
- generator.setParameter(AbstractResource.GatewayConstants.GATEWAY_ID, gatewayId);
- Query q = generator.deleteQuery(em);
- q.executeUpdate();
- em.getTransaction().commit();
- em.close();
- return true;
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- return false;
- }finally {
- if (em != null && em.isOpen()){
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- /**
- * @param gatewayResource
- * @param userResource
- */
- public static WorkerResource addGatewayWorker(GatewayResource gatewayResource, UserResource userResource) throws RegistryException{
- EntityManager em = null;
- try {
- em = getEntityManager();
- em.getTransaction().begin();
- if (!isGatewayExist(gatewayResource.getGatewayName())){
- gatewayResource.save();
- }
- if (!isUserExist(userResource.getUserName())){
- userResource.save();
- }
- Gateway gateway = em.find(Gateway.class, gatewayResource.getGatewayId());
- Users user = em.find(Users.class, userResource.getUserName());
- Gateway_Worker gatewayWorker = new Gateway_Worker();
- gatewayWorker.setGateway(gateway);
- gatewayWorker.setUser(user);
- em.persist(gatewayWorker);
- em.getTransaction().commit();
- em.close();
- return (WorkerResource)Utils.getResource(ResourceType.GATEWAY_WORKER, gatewayWorker);
- } catch (Exception e){
- logger.error(e.getMessage(), e);
- throw new RegistryException(e);
- }finally {
- if (em != null && em.isOpen()){
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- /**
- * @param gatewayResource
- * @param userResource
- * @return
- */
- public static boolean removeGatewayWorker(GatewayResource gatewayResource, UserResource userResource) {
- EntityManager em = null;
- try {
- em = getEntityManager();
- em.getTransaction().begin();
- QueryGenerator generator = new QueryGenerator(AbstractResource.GATEWAY_WORKER);
- generator.setParameter(AbstractResource.GatewayWorkerConstants.GATEWAY_ID,
- gatewayResource.getGatewayName());
- generator.setParameter(AbstractResource.UserConstants.USERNAME, userResource.getUserName());
- Query q = generator.deleteQuery(em);
- q.executeUpdate();
- em.getTransaction().commit();
- em.close();
- return true;
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- return false;
- }finally {
- if (em != null && em.isOpen()){
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
-
- }
-
- /**
- * @param configKey
- * @return
- */
- public static List<ConfigurationResource> getConfigurations(String configKey){
- List<ConfigurationResource> list = new ArrayList<ConfigurationResource>();
- EntityManager em = null;
- try {
- em = getEntityManager();
- em.getTransaction().begin();
- QueryGenerator generator = new QueryGenerator(AbstractResource.CONFIGURATION);
- generator.setParameter(AbstractResource.ConfigurationConstants.CONFIG_KEY, configKey);
- Query q = generator.selectQuery(em);
- List<?> resultList = q.getResultList();
- if (resultList.size() != 0) {
- for (Object result : resultList) {
- ConfigurationResource configurationResource = createConfigurationResourceObject(result);
- list.add(configurationResource);
- }
- }
- em.getTransaction().commit();
- em.close();
- }catch (Exception e) {
- logger.error(e.getMessage(), e);
- }finally {
- if (em != null && em.isOpen()){
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- return list;
- }
-
- /**
- * @param configKey
- * @return
- */
- public static ConfigurationResource getConfiguration(String configKey){
- List<ConfigurationResource> configurations = getConfigurations(configKey);
- return (configurations != null && configurations.size() > 0) ? configurations.get(0) : null;
- }
-
- /**
- * @param configKey
- * @return
- */
- public static boolean isConfigurationExist(String configKey){
- List<ConfigurationResource> configurations = getConfigurations(configKey);
- return (configurations != null && configurations.size() > 0);
- }
-
- /**
- * @param configKey
- * @return
- */
- public static ConfigurationResource createConfiguration(String configKey) {
- ConfigurationResource config = new ConfigurationResource();
- config.setConfigKey(configKey);
- return config;
- }
-
- /**
- * @param result
- * @return
- */
- private static ConfigurationResource createConfigurationResourceObject(
- Object result) {
- Configuration configuration = (Configuration) result;
- ConfigurationResource configurationResource = new ConfigurationResource(configuration.getConfig_key(), configuration.getConfig_val());
- configurationResource.setExpireDate(configuration.getExpire_date());
- return configurationResource;
- }
-
- /**
- * @param configkey
- * @param configValue
- */
- public static void removeConfiguration(String configkey, String configValue) throws RegistryException{
- QueryGenerator queryGenerator = new QueryGenerator(AbstractResource.CONFIGURATION);
- queryGenerator.setParameter(AbstractResource.ConfigurationConstants.CONFIG_KEY, configkey);
- queryGenerator.setParameter(AbstractResource.ConfigurationConstants.CONFIG_VAL, configValue);
- EntityManager em = null;
- try {
- if(isConfigurationExists(configkey, configValue)){
- em = getEntityManager();
- em.getTransaction().begin();
- Query q = queryGenerator.deleteQuery(em);
- q.executeUpdate();
- em.getTransaction().commit();
- em.close();
- }
- }catch (Exception e){
- logger.error(e.getMessage(), e);
- throw new RegistryException(e);
- }finally {
- if (em != null && em.isOpen()){
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- /**
- * @param configkey
- */
- public static void removeConfiguration(String configkey) throws RegistryException{
- QueryGenerator queryGenerator = new QueryGenerator(AbstractResource.CONFIGURATION);
- queryGenerator.setParameter(AbstractResource.ConfigurationConstants.CONFIG_KEY, configkey);
- EntityManager em = null;
- try {
- if(isConfigurationExist(configkey)){
- em = getEntityManager();
- em.getTransaction().begin();
- Query q = queryGenerator.deleteQuery(em);
- q.executeUpdate();
- em.getTransaction().commit();
- em.close();
- }
- }catch (Exception e){
- logger.error(e.getMessage(), e);
- throw new RegistryException(e);
- }finally {
- if (em != null && em.isOpen()){
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- public static boolean isConfigurationExists(String configKey, String configVal) throws RegistryException{
- EntityManager em = null;
- try{
- //Currently categoryID is hardcoded value
- em = ResourceUtils.getEntityManager();
- Configuration existing = em.find(Configuration.class, new Configuration_PK(configKey, configVal, AbstractResource.ConfigurationConstants.CATEGORY_ID_DEFAULT_VALUE));
- em.close();
- return existing!= null;
- } catch (Exception e){
- logger.error(e.getMessage(), e);
- throw new RegistryException(e);
- }finally {
- if (em != null && em.isOpen()){
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-}
[24/52] [abbrv] [partial] airavata git commit: registry refactoring
Posted by sh...@apache.org.
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/experiment-catalog/src/main/resources/registry-mysql.sql
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/resources/registry-mysql.sql b/modules/registry/experiment-catalog/src/main/resources/registry-mysql.sql
deleted file mode 100644
index 14d7fc8..0000000
--- a/modules/registry/experiment-catalog/src/main/resources/registry-mysql.sql
+++ /dev/null
@@ -1,392 +0,0 @@
-/*
- *
- * 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.
- *
- */
-CREATE TABLE GATEWAY
-(
- GATEWAY_ID VARCHAR(255),
- GATEWAY_NAME VARCHAR(255),
- DOMAIN VARCHAR(255),
- EMAIL_ADDRESS VARCHAR(255),
- PRIMARY KEY (GATEWAY_ID)
-);
-
-CREATE TABLE CONFIGURATION
-(
- CONFIG_KEY VARCHAR(255),
- CONFIG_VAL VARCHAR(255),
- EXPIRE_DATE TIMESTAMP DEFAULT '0000-00-00 00:00:00',
- CATEGORY_ID VARCHAR (255),
- PRIMARY KEY(CONFIG_KEY, CONFIG_VAL, CATEGORY_ID)
-);
-
-INSERT INTO CONFIGURATION (CONFIG_KEY, CONFIG_VAL, EXPIRE_DATE, CATEGORY_ID) VALUES('registry.version', '0.15', CURRENT_TIMESTAMP ,'SYSTEM');
-
-CREATE TABLE USERS
-(
- USER_NAME VARCHAR(255),
- PASSWORD VARCHAR(255),
- PRIMARY KEY(USER_NAME)
-);
-
-CREATE TABLE GATEWAY_WORKER
-(
- GATEWAY_ID VARCHAR(255),
- USER_NAME VARCHAR(255),
- PRIMARY KEY (GATEWAY_ID, USER_NAME),
- FOREIGN KEY (GATEWAY_ID) REFERENCES GATEWAY(GATEWAY_ID) ON DELETE CASCADE,
- FOREIGN KEY (USER_NAME) REFERENCES USERS(USER_NAME) ON DELETE CASCADE
-);
-
-CREATE TABLE PROJECT
-(
- GATEWAY_ID VARCHAR(255),
- USER_NAME VARCHAR(255),
- PROJECT_NAME VARCHAR(255) NOT NULL,
- PROJECT_ID VARCHAR(255),
- DESCRIPTION VARCHAR(255),
- CREATION_TIME TIMESTAMP DEFAULT NOW(),
- PRIMARY KEY (PROJECT_ID),
- FOREIGN KEY (GATEWAY_ID) REFERENCES GATEWAY(GATEWAY_ID) ON DELETE CASCADE,
- FOREIGN KEY (USER_NAME) REFERENCES USERS(USER_NAME) ON DELETE CASCADE
-);
-
-CREATE TABLE PROJECT_USER
-(
- PROJECT_ID VARCHAR(255),
- USER_NAME VARCHAR(255),
- PRIMARY KEY (PROJECT_ID,USER_NAME),
- FOREIGN KEY (PROJECT_ID) REFERENCES PROJECT(PROJECT_ID) ON DELETE CASCADE,
- FOREIGN KEY (USER_NAME) REFERENCES USERS(USER_NAME) ON DELETE CASCADE
-);
-
-CREATE TABLE EXPERIMENT
-(
- EXPERIMENT_ID VARCHAR(255),
- GATEWAY_ID VARCHAR(255),
- EXECUTION_USER VARCHAR(255) NOT NULL,
- PROJECT_ID VARCHAR(255) NOT NULL,
- CREATION_TIME TIMESTAMP DEFAULT NOW(),
- EXPERIMENT_NAME VARCHAR(255) NOT NULL,
- EXPERIMENT_DESCRIPTION VARCHAR(255),
- APPLICATION_ID VARCHAR(255),
- APPLICATION_VERSION VARCHAR(255),
- WORKFLOW_TEMPLATE_ID VARCHAR(255),
- WORKFLOW_TEMPLATE_VERSION VARCHAR(255),
- WORKFLOW_EXECUTION_ID VARCHAR(255),
- ALLOW_NOTIFICATION SMALLINT,
- GATEWAY_EXECUTION_ID VARCHAR(255),
- PRIMARY KEY(EXPERIMENT_ID),
- FOREIGN KEY (GATEWAY_ID) REFERENCES GATEWAY(GATEWAY_ID) ON DELETE CASCADE,
- FOREIGN KEY (EXECUTION_USER) REFERENCES USERS(USER_NAME) ON DELETE CASCADE,
- FOREIGN KEY (PROJECT_ID) REFERENCES PROJECT(PROJECT_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE EXPERIMENT_INPUT
-(
- EXPERIMENT_ID VARCHAR(255),
- INPUT_KEY VARCHAR(255) NOT NULL,
- DATA_TYPE VARCHAR(255),
- APP_ARGUMENT VARCHAR(255),
- STANDARD_INPUT SMALLINT,
- USER_FRIENDLY_DESC VARCHAR(255),
- METADATA VARCHAR(255),
- VALUE LONGTEXT,
- INPUT_ORDER INTEGER,
- IS_REQUIRED SMALLINT,
- REQUIRED_TO_COMMANDLINE SMALLINT,
- DATA_STAGED SMALLINT,
- PRIMARY KEY(EXPERIMENT_ID,INPUT_KEY),
- FOREIGN KEY (EXPERIMENT_ID) REFERENCES EXPERIMENT(EXPERIMENT_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE EXPERIMENT_OUTPUT
-(
- EXPERIMENT_ID VARCHAR(255),
- OUTPUT_KEY VARCHAR(255) NOT NULL,
- DATA_TYPE VARCHAR(255),
- VALUE LONGTEXT,
- IS_REQUIRED SMALLINT,
- REQUIRED_TO_COMMANDLINE SMALLINT,
- DATA_MOVEMENT SMALLINT,
- DATA_NAME_LOCATION VARCHAR(255),
- SEARCH_QUERY VARCHAR(255),
- APP_ARGUMENT VARCHAR(255),
- PRIMARY KEY(EXPERIMENT_ID,OUTPUT_KEY),
- FOREIGN KEY (EXPERIMENT_ID) REFERENCES EXPERIMENT(EXPERIMENT_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE WORKFLOW_NODE_DETAIL
-(
- EXPERIMENT_ID VARCHAR(255) NOT NULL,
- NODE_INSTANCE_ID VARCHAR(255),
- CREATION_TIME TIMESTAMP DEFAULT NOW(),
- NODE_NAME VARCHAR(255) NOT NULL,
- EXECUTION_UNIT VARCHAR(255) NOT NULL,
- EXECUTION_UNIT_DATA VARCHAR(255),
- PRIMARY KEY(NODE_INSTANCE_ID),
- FOREIGN KEY (EXPERIMENT_ID) REFERENCES EXPERIMENT(EXPERIMENT_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE TASK_DETAIL
-(
- TASK_ID VARCHAR(255),
- NODE_INSTANCE_ID VARCHAR(255),
- CREATION_TIME TIMESTAMP DEFAULT NOW(),
- APPLICATION_ID VARCHAR(255),
- APPLICATION_VERSION VARCHAR(255),
- APPLICATION_DEPLOYMENT_ID VARCHAR(255),
- ALLOW_NOTIFICATION SMALLINT,
- PRIMARY KEY(TASK_ID),
- FOREIGN KEY (NODE_INSTANCE_ID) REFERENCES WORKFLOW_NODE_DETAIL(NODE_INSTANCE_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE NOTIFICATION_EMAIL
-(
- EMAIL_ID INTEGER NOT NULL AUTO_INCREMENT,
- EXPERIMENT_ID VARCHAR(255),
- TASK_ID VARCHAR(255),
- EMAIL_ADDRESS VARCHAR(255),
- PRIMARY KEY(EMAIL_ID),
- FOREIGN KEY (EXPERIMENT_ID) REFERENCES EXPERIMENT(EXPERIMENT_ID) ON DELETE CASCADE,
- FOREIGN KEY (TASK_ID) REFERENCES TASK_DETAIL(TASK_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE APPLICATION_INPUT
-(
- TASK_ID VARCHAR(255),
- INPUT_KEY VARCHAR(255) NOT NULL,
- DATA_TYPE VARCHAR(255),
- APP_ARGUMENT VARCHAR(255),
- STANDARD_INPUT SMALLINT,
- USER_FRIENDLY_DESC VARCHAR(255),
- METADATA VARCHAR(255),
- VALUE LONGTEXT,
- INPUT_ORDER INTEGER,
- IS_REQUIRED SMALLINT,
- REQUIRED_TO_COMMANDLINE SMALLINT,
- DATA_STAGED SMALLINT,
- PRIMARY KEY(TASK_ID,INPUT_KEY),
- FOREIGN KEY (TASK_ID) REFERENCES TASK_DETAIL(TASK_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE APPLICATION_OUTPUT
-(
- TASK_ID VARCHAR(255),
- OUTPUT_KEY VARCHAR(255) NOT NULL,
- DATA_TYPE VARCHAR(255),
- VALUE LONGTEXT,
- DATA_MOVEMENT SMALLINT,
- IS_REQUIRED SMALLINT,
- REQUIRED_TO_COMMANDLINE SMALLINT,
- DATA_NAME_LOCATION VARCHAR(255),
- SEARCH_QUERY VARCHAR(255),
- APP_ARGUMENT VARCHAR(255),
- PRIMARY KEY(TASK_ID,OUTPUT_KEY),
- FOREIGN KEY (TASK_ID) REFERENCES TASK_DETAIL(TASK_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE NODE_INPUT
-(
- NODE_INSTANCE_ID VARCHAR(255),
- INPUT_KEY VARCHAR(255) NOT NULL,
- DATA_TYPE VARCHAR(255),
- APP_ARGUMENT VARCHAR(255),
- STANDARD_INPUT SMALLINT,
- USER_FRIENDLY_DESC VARCHAR(255),
- METADATA VARCHAR(255),
- VALUE VARCHAR(255),
- INPUT_ORDER INTEGER,
- IS_REQUIRED SMALLINT,
- REQUIRED_TO_COMMANDLINE SMALLINT,
- DATA_STAGED SMALLINT,
- PRIMARY KEY(NODE_INSTANCE_ID,INPUT_KEY),
- FOREIGN KEY (NODE_INSTANCE_ID) REFERENCES WORKFLOW_NODE_DETAIL(NODE_INSTANCE_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE NODE_OUTPUT
-(
- NODE_INSTANCE_ID VARCHAR(255),
- OUTPUT_KEY VARCHAR(255) NOT NULL,
- DATA_TYPE VARCHAR(255),
- VALUE VARCHAR(255),
- IS_REQUIRED SMALLINT,
- REQUIRED_TO_COMMANDLINE SMALLINT,
- DATA_MOVEMENT SMALLINT,
- DATA_NAME_LOCATION VARCHAR(255),
- SEARCH_QUERY VARCHAR(255),
- APP_ARGUMENT VARCHAR(255),
- PRIMARY KEY(NODE_INSTANCE_ID,OUTPUT_KEY),
- FOREIGN KEY (NODE_INSTANCE_ID) REFERENCES WORKFLOW_NODE_DETAIL(NODE_INSTANCE_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE JOB_DETAIL
-(
- JOB_ID VARCHAR(255),
- TASK_ID VARCHAR(255),
- JOB_DESCRIPTION LONGTEXT NOT NULL,
- CREATION_TIME TIMESTAMP DEFAULT NOW(),
- COMPUTE_RESOURCE_CONSUMED VARCHAR(255),
- JOBNAME VARCHAR (255),
- WORKING_DIR VARCHAR(255),
- PRIMARY KEY (TASK_ID, JOB_ID),
- FOREIGN KEY (TASK_ID) REFERENCES TASK_DETAIL(TASK_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE DATA_TRANSFER_DETAIL
-(
- TRANSFER_ID VARCHAR(255),
- TASK_ID VARCHAR(255),
- CREATION_TIME TIMESTAMP DEFAULT NOW(),
- TRANSFER_DESC VARCHAR(255) NOT NULL,
- PRIMARY KEY(TRANSFER_ID),
- FOREIGN KEY (TASK_ID) REFERENCES TASK_DETAIL(TASK_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE ERROR_DETAIL
-(
- ERROR_ID INTEGER NOT NULL AUTO_INCREMENT,
- EXPERIMENT_ID VARCHAR(255),
- TASK_ID VARCHAR(255),
- NODE_INSTANCE_ID VARCHAR(255),
- JOB_ID VARCHAR(255),
- CREATION_TIME TIMESTAMP DEFAULT NOW(),
- ACTUAL_ERROR_MESSAGE LONGTEXT,
- USER_FRIEDNLY_ERROR_MSG VARCHAR(255),
- TRANSIENT_OR_PERSISTENT SMALLINT,
- ERROR_CATEGORY VARCHAR(255),
- CORRECTIVE_ACTION VARCHAR(255),
- ACTIONABLE_GROUP VARCHAR(255),
- PRIMARY KEY(ERROR_ID),
- FOREIGN KEY (EXPERIMENT_ID) REFERENCES EXPERIMENT(EXPERIMENT_ID) ON DELETE CASCADE,
- FOREIGN KEY (TASK_ID) REFERENCES TASK_DETAIL(TASK_ID) ON DELETE CASCADE,
- FOREIGN KEY (NODE_INSTANCE_ID) REFERENCES WORKFLOW_NODE_DETAIL(NODE_INSTANCE_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE STATUS
-(
- STATUS_ID INTEGER NOT NULL AUTO_INCREMENT,
- EXPERIMENT_ID VARCHAR(255),
- NODE_INSTANCE_ID VARCHAR(255),
- TRANSFER_ID VARCHAR(255),
- TASK_ID VARCHAR(255),
- JOB_ID VARCHAR(255),
- STATE VARCHAR(255),
- STATUS_UPDATE_TIME TIMESTAMP DEFAULT '0000-00-00 00:00:00' ON UPDATE now(),
- STATUS_TYPE VARCHAR(255),
- PRIMARY KEY(STATUS_ID),
- FOREIGN KEY (EXPERIMENT_ID) REFERENCES EXPERIMENT(EXPERIMENT_ID) ON DELETE CASCADE,
- FOREIGN KEY (TASK_ID) REFERENCES TASK_DETAIL(TASK_ID) ON DELETE CASCADE,
- FOREIGN KEY (NODE_INSTANCE_ID) REFERENCES WORKFLOW_NODE_DETAIL(NODE_INSTANCE_ID) ON DELETE CASCADE,
- FOREIGN KEY (TRANSFER_ID) REFERENCES DATA_TRANSFER_DETAIL(TRANSFER_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE CONFIG_DATA
-(
- EXPERIMENT_ID VARCHAR(255),
- AIRAVATA_AUTO_SCHEDULE SMALLINT NOT NULL,
- OVERRIDE_MANUAL_SCHEDULE_PARAMS SMALLINT NOT NULL,
- SHARE_EXPERIMENT SMALLINT,
- USER_DN VARCHAR(255),
- GENERATE_CERT SMALLINT,
- PRIMARY KEY(EXPERIMENT_ID),
- FOREIGN KEY (EXPERIMENT_ID) REFERENCES EXPERIMENT(EXPERIMENT_ID) ON DELETE CASCADE
-
-);
-
-CREATE TABLE COMPUTATIONAL_RESOURCE_SCHEDULING
-(
- RESOURCE_SCHEDULING_ID INTEGER NOT NULL AUTO_INCREMENT,
- EXPERIMENT_ID VARCHAR(255),
- TASK_ID VARCHAR(255),
- RESOURCE_HOST_ID VARCHAR(255),
- CPU_COUNT INTEGER,
- NODE_COUNT INTEGER,
- NO_OF_THREADS INTEGER,
- QUEUE_NAME VARCHAR(255),
- WALLTIME_LIMIT INTEGER,
- JOB_START_TIME TIMESTAMP DEFAULT '0000-00-00 00:00:00',
- TOTAL_PHYSICAL_MEMORY INTEGER,
- COMPUTATIONAL_PROJECT_ACCOUNT VARCHAR(255),
- CHESSIS_NAME VARCHAR(255),
- PRIMARY KEY(RESOURCE_SCHEDULING_ID),
- FOREIGN KEY (EXPERIMENT_ID) REFERENCES EXPERIMENT(EXPERIMENT_ID) ON DELETE CASCADE,
- FOREIGN KEY (TASK_ID) REFERENCES TASK_DETAIL(TASK_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE ADVANCE_INPUT_DATA_HANDLING
-(
- INPUT_DATA_HANDLING_ID INTEGER NOT NULL AUTO_INCREMENT,
- EXPERIMENT_ID VARCHAR(255),
- TASK_ID VARCHAR(255),
- WORKING_DIR_PARENT VARCHAR(255),
- UNIQUE_WORKING_DIR VARCHAR(255),
- STAGE_INPUT_FILES_TO_WORKING_DIR SMALLINT,
- CLEAN_AFTER_JOB SMALLINT,
- PRIMARY KEY(INPUT_DATA_HANDLING_ID),
- FOREIGN KEY (EXPERIMENT_ID) REFERENCES EXPERIMENT(EXPERIMENT_ID) ON DELETE CASCADE,
- FOREIGN KEY (TASK_ID) REFERENCES TASK_DETAIL(TASK_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE ADVANCE_OUTPUT_DATA_HANDLING
-(
- OUTPUT_DATA_HANDLING_ID INTEGER NOT NULL AUTO_INCREMENT,
- EXPERIMENT_ID VARCHAR(255),
- TASK_ID VARCHAR(255),
- OUTPUT_DATA_DIR VARCHAR(255),
- DATA_REG_URL VARCHAR (255),
- PERSIST_OUTPUT_DATA SMALLINT,
- PRIMARY KEY(OUTPUT_DATA_HANDLING_ID),
- FOREIGN KEY (EXPERIMENT_ID) REFERENCES EXPERIMENT(EXPERIMENT_ID) ON DELETE CASCADE,
- FOREIGN KEY (TASK_ID) REFERENCES TASK_DETAIL(TASK_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE QOS_PARAM
-(
- QOS_ID INTEGER NOT NULL AUTO_INCREMENT,
- EXPERIMENT_ID VARCHAR(255),
- TASK_ID VARCHAR(255),
- START_EXECUTION_AT VARCHAR(255),
- EXECUTE_BEFORE VARCHAR(255),
- NO_OF_RETRIES INTEGER,
- PRIMARY KEY(QOS_ID),
- FOREIGN KEY (EXPERIMENT_ID) REFERENCES EXPERIMENT(EXPERIMENT_ID) ON DELETE CASCADE,
- FOREIGN KEY (TASK_ID) REFERENCES TASK_DETAIL(TASK_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE COMMUNITY_USER
-(
- GATEWAY_ID VARCHAR(256) NOT NULL,
- COMMUNITY_USER_NAME VARCHAR(256) NOT NULL,
- TOKEN_ID VARCHAR(256) NOT NULL,
- COMMUNITY_USER_EMAIL VARCHAR(256) NOT NULL,
- PRIMARY KEY (GATEWAY_ID, COMMUNITY_USER_NAME, TOKEN_ID)
-);
-
-CREATE TABLE CREDENTIALS
-(
- GATEWAY_ID VARCHAR(256) NOT NULL,
- TOKEN_ID VARCHAR(256) NOT NULL,
- CREDENTIAL BLOB NOT NULL,
- PORTAL_USER_ID VARCHAR(256) NOT NULL,
- TIME_PERSISTED TIMESTAMP DEFAULT NOW() ON UPDATE NOW(),
- PRIMARY KEY (GATEWAY_ID, TOKEN_ID)
-);
-
-
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/AbstractResourceTest.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/AbstractResourceTest.java b/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/AbstractResourceTest.java
deleted file mode 100644
index 021ff1a..0000000
--- a/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/AbstractResourceTest.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- *
- * 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.experiment.catalog;
-
-import org.apache.airavata.common.utils.ServerSettings;
-import org.apache.airavata.experiment.catalog.resources.GatewayResource;
-import org.apache.airavata.experiment.catalog.resources.ProjectResource;
-import org.apache.airavata.experiment.catalog.resources.UserResource;
-import org.apache.airavata.experiment.catalog.resources.WorkerResource;
-import org.apache.airavata.experiment.catalog.util.Initialize;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.BeforeClass;
-
-import java.sql.Timestamp;
-import java.util.Calendar;
-
-public abstract class AbstractResourceTest {
-
- private GatewayResource gatewayResource;
- private WorkerResource workerResource;
- private UserResource userResource;
- private ProjectResource projectResource;
-
- private static Initialize initialize;
-
- @BeforeClass
- public static void setUpBeforeClass() throws Exception {
- initialize = new Initialize("registry-derby.sql");
- initialize.initializeDB();
- }
- @Before
- public void setUp() throws Exception {
- gatewayResource = (GatewayResource) ResourceUtils.getGateway(ServerSettings.getDefaultUserGateway());
- workerResource = (WorkerResource)ResourceUtils.getWorker(gatewayResource.getGatewayName(), ServerSettings.getDefaultUser());
- userResource = (UserResource)ResourceUtils.getUser(ServerSettings.getDefaultUser());
- projectResource = workerResource.getProject("default");
- }
-
- public Timestamp getCurrentTimestamp() {
- Calendar calender = Calendar.getInstance();
- java.util.Date d = calender.getTime();
- return new Timestamp(d.getTime());
- }
- @AfterClass
- public static void tearDownAfterClass() throws Exception {
- initialize.stopDerbyServer();
- }
-
-
- public GatewayResource getGatewayResource() {
- return gatewayResource;
- }
-
- public WorkerResource getWorkerResource() {
- return workerResource;
- }
-
- public UserResource getUserResource() {
- return userResource;
- }
-
- public ProjectResource getProjectResource() {
- return projectResource;
- }
-
- public void setProjectResource(ProjectResource projectResource) {
- this.projectResource = projectResource;
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/ComputationalSchedulingTest.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/ComputationalSchedulingTest.java b/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/ComputationalSchedulingTest.java
deleted file mode 100644
index 3f0115a..0000000
--- a/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/ComputationalSchedulingTest.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- *
- * 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.experiment.catalog;
-
-import org.apache.airavata.experiment.catalog.resources.ComputationSchedulingResource;
-import org.apache.airavata.experiment.catalog.resources.ExperimentResource;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-import java.sql.Timestamp;
-import java.util.Date;
-
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-public class ComputationalSchedulingTest extends AbstractResourceTest {
- private ExperimentResource experimentResource;
- private ComputationSchedulingResource schedulingResource;
- private String experimentID = "testExpID";
-
- @Override
- @Before
- public void setUp() throws Exception {
- super.setUp();
- experimentResource = (ExperimentResource) getGatewayResource().create(ResourceType.EXPERIMENT);
- experimentResource.setExpID(experimentID);
- experimentResource.setExecutionUser(getWorkerResource().getUser());
- experimentResource.setProjectId(getProjectResource().getId());
- Timestamp currentDate = new Timestamp(new Date().getTime());
- experimentResource.setCreationTime(currentDate);
- experimentResource.setApplicationId("testApplication");
- experimentResource.setApplicationVersion("1.0");
- experimentResource.setDescription("Test Application");
- experimentResource.setExpName("TestExperiment");
- experimentResource.save();
-
- schedulingResource = (ComputationSchedulingResource)experimentResource.create(ResourceType.COMPUTATIONAL_RESOURCE_SCHEDULING);
- schedulingResource.setResourceHostId("testResource");
- schedulingResource.setCpuCount(10);
- schedulingResource.setNodeCount(5);
- schedulingResource.setPhysicalMemory(1000);
- schedulingResource.setProjectName("project1");
- schedulingResource.setQueueName("testQueue");
- schedulingResource.save();
- System.out.println("scheduling id : " + schedulingResource.getSchedulingId());
- }
-
-
- @Test
- public void testSave() throws Exception {
- assertTrue("Computational schedule successfully", experimentResource.isExists(ResourceType.COMPUTATIONAL_RESOURCE_SCHEDULING, experimentID));
- }
-
- @Test
- public void testRemove() throws Exception {
- experimentResource.remove(ResourceType.COMPUTATIONAL_RESOURCE_SCHEDULING, experimentID);
- assertFalse("Computational schedule removed successfully", experimentResource.isExists(ResourceType.COMPUTATIONAL_RESOURCE_SCHEDULING, experimentID));
- }
-
- @After
- public void tearDown() throws Exception {
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/ConfigurationResourceTest.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/ConfigurationResourceTest.java b/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/ConfigurationResourceTest.java
deleted file mode 100644
index 66f025e..0000000
--- a/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/ConfigurationResourceTest.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
-*
-* 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.experiment.catalog;
-
-import static org.junit.Assert.*;
-
-import org.apache.airavata.experiment.catalog.resources.ConfigurationResource;
-import org.junit.After;
-import org.junit.Test;
-
-import java.sql.Timestamp;
-import java.util.Calendar;
-
-public class ConfigurationResourceTest extends AbstractResourceTest {
-
- @Override
- public void setUp() throws Exception {
- super.setUp();
- }
- @Test
- public void testSave() throws Exception {
- ConfigurationResource configuration = ResourceUtils.createConfiguration("testConfigKey");
- configuration.setConfigVal("testConfigValue");
- Calendar calender = Calendar.getInstance();
- java.util.Date d = calender.getTime();
- Timestamp currentTime = new Timestamp(d.getTime());
- configuration.setExpireDate(currentTime);
- configuration.setCategoryID("SYSTEM");
- configuration.save();
-
- assertTrue("Configuration Save succuessful", ResourceUtils.isConfigurationExist("testConfigKey"));
- //remove test configuration
- ResourceUtils.removeConfiguration("testConfigKey");
- }
-
- @After
- public void tearDown() throws Exception {
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/ExecutionErrorResourceTest.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/ExecutionErrorResourceTest.java b/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/ExecutionErrorResourceTest.java
deleted file mode 100644
index b61a16c..0000000
--- a/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/ExecutionErrorResourceTest.java
+++ /dev/null
@@ -1,95 +0,0 @@
-///*
-//*
-//* 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.experiment.registry.jpa;
-//
-//import org.apache.airavata.experiment.registry.jpa.resources.*;
-//
-//import java.sql.Timestamp;
-//import java.util.Calendar;
-//
-//public class ExecutionErrorResourceTest extends AbstractResourceTest {
-// private WorkflowDataResource workflowDataResource;
-// private NodeDataResource nodeDataResource;
-// private ExperimentMetadataResource experimentResource;
-//
-// @Override
-// public void setUp() throws Exception {
-// super.setUp();
-// GatewayResource gatewayResource = super.getGatewayResource();
-// WorkerResource workerResource = super.getWorkerResource();
-//
-// ProjectResource project = new ProjectResource(workerResource, gatewayResource, "testProject");
-// project.save();
-//
-// experimentResource = (ExperimentMetadataResource) gatewayResource.create(ResourceType.EXPERIMENT_METADATA);
-// experimentResource.setExpID("testExpID");
-// experimentResource.setExecutionUser(workerResource.getUser());
-//
-// experimentResource.setProject(project);
-// experimentResource.setDescription("testDescription");
-// experimentResource.setExperimentName("textExpID");
-// experimentResource.setSubmittedDate(getCurrentTimestamp());
-// experimentResource.setShareExp(true);
-// experimentResource.save();
-//
-// workflowDataResource = (WorkflowDataResource) experimentResource.create(ResourceType.WORKFLOW_DATA);
-// workflowDataResource.setWorkflowInstanceID("testWFInstance");
-// workflowDataResource.setTemplateName("testTemplate");
-// workflowDataResource.setExperimentID("testExpID");
-// Timestamp timestamp = getCurrentTimestamp();
-// workflowDataResource.setLastUpdatedTime(timestamp);
-// workflowDataResource.save();
-//
-// nodeDataResource = workflowDataResource.createNodeData("testNodeID");
-// nodeDataResource.setWorkflowDataResource(workflowDataResource);
-// nodeDataResource.setInputs("testInput");
-// nodeDataResource.setOutputs("testOutput");
-// nodeDataResource.setStatus("testStatus");
-// nodeDataResource.save();
-// }
-//
-//
-// public void testSave() throws Exception {
-// ExecutionErrorResource executionErrorResource = (ExecutionErrorResource) workflowDataResource.create(ResourceType.EXECUTION_ERROR);
-// executionErrorResource.setErrorCode("testErrorCode");
-// executionErrorResource.setActionTaken("testAction");
-// executionErrorResource.setErrorLocation("testErrorLocation");
-// executionErrorResource.setErrorReference(0);
-// executionErrorResource.setWorkflowDataResource(workflowDataResource);
-//
-// executionErrorResource.setMetadataResource(experimentResource);
-// executionErrorResource.setNodeID(nodeDataResource.getNodeID());
-// executionErrorResource.setGfacJobID("testGfacJobID");
-// executionErrorResource.setErrorDes("testDes");
-// executionErrorResource.setErrorMsg("errorMsg");
-// executionErrorResource.save();
-// System.out.println(executionErrorResource.getErrorID());
-//
-// assertTrue("Execution Error saved successfully", workflowDataResource.isExists(ResourceType.EXECUTION_ERROR, executionErrorResource.getErrorID()));
-//
-// }
-//
-// @Override
-// public void tearDown() throws Exception {
-// super.tearDown();
-// }
-//}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/ExperimentDataResourceTest.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/ExperimentDataResourceTest.java b/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/ExperimentDataResourceTest.java
deleted file mode 100644
index 1df8091..0000000
--- a/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/ExperimentDataResourceTest.java
+++ /dev/null
@@ -1,107 +0,0 @@
-///*
-//*
-//* 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.experiment.registry.jpa;
-//
-//import org.apache.airavata.experiment.registry.jpa.resources.*;
-//
-//import java.sql.Timestamp;
-//import java.util.Calendar;
-//
-//public class ExperimentDataResourceTest extends AbstractResourceTest {
-// private ExperimentDataResource experimentDataResource;
-// private ExperimentResource experimentResource;
-// private WorkflowDataResource workflowDataResource;
-// private ExperimentMetadataResource experimentMetadataResource;
-//
-// @Override
-// public void setUp() throws Exception {
-// super.setUp();
-// GatewayResource gatewayResource = super.getGatewayResource();
-// WorkerResource workerResource = super.getWorkerResource();
-//
-// experimentResource = (ExperimentResource) gatewayResource.create(ResourceType.EXPERIMENT);
-// experimentResource.setExpID("testExpID");
-// experimentResource.setWorker(workerResource);
-// experimentResource.setProject(new ProjectResource(workerResource, gatewayResource, "testProject"));
-// experimentResource.save();
-//
-// experimentDataResource = (ExperimentDataResource) experimentResource.create(ResourceType.EXPERIMENT_DATA);
-// experimentDataResource.setExpName("testExpID");
-// experimentDataResource.setUserName(workerResource.getUser());
-// experimentDataResource.save();
-//
-// experimentMetadataResource = experimentDataResource.createExperimentMetadata();
-// workflowDataResource = experimentDataResource.createWorkflowInstanceResource("testWorkflowInstance");
-//
-// experimentMetadataResource.setExpID("testExpID");
-// experimentMetadataResource.setMetadata("testMetadata");
-// experimentMetadataResource.save();
-//
-// workflowDataResource.setExperimentID("testExpID");
-// workflowDataResource.setStatus("testStatus");
-// workflowDataResource.setTemplateName("testWorkflowInstance");
-//
-// Calendar calender = Calendar.getInstance();
-// java.util.Date d = calender.getTime();
-// Timestamp currentTime = new Timestamp(d.getTime());
-//
-// workflowDataResource.setLastUpdatedTime(currentTime);
-// workflowDataResource.setStartTime(currentTime);
-// workflowDataResource.save();
-// }
-//
-// public void testCreate() throws Exception {
-// assertNotNull("workflowdata resource created", workflowDataResource);
-// assertNotNull("experimemt metadata resource created", experimentMetadataResource);
-// }
-//
-// public void testGet() throws Exception {
-// assertNotNull("workflow data retrieved successfully", experimentDataResource.getWorkflowInstance("testWorkflowInstance"));
-// assertNotNull("experiment meta data retrieved successfully", experimentDataResource.getExperimentMetadata());
-// }
-//
-// public void testGetList() throws Exception {
-// assertNotNull("workflow data retrieved successfully", experimentDataResource.get(ResourceType.WORKFLOW_DATA));
-// assertNotNull("experiment meta data retrieved successfully", experimentDataResource.get(ResourceType.EXPERIMENT_METADATA));
-// }
-//
-// public void testSave() throws Exception {
-// experimentDataResource.save();
-// assertTrue("experiment data saved successfully", experimentResource.isExists(ResourceType.EXPERIMENT_DATA, "testExpID"));
-// }
-//
-// public void testRemove() throws Exception {
-// experimentDataResource.remove(ResourceType.WORKFLOW_DATA, "testWFInstanceID");
-// assertTrue("workflow data resource removed successfully", !experimentResource.isExists(ResourceType.EXPERIMENT_DATA, "testWFInstanceID"));
-//
-// experimentDataResource.remove(ResourceType.EXPERIMENT_METADATA, "testExpID");
-// assertTrue("experiment meta data resource removed successfully", !experimentDataResource.isExists(ResourceType.EXPERIMENT_METADATA, "testExpID"));
-//
-// }
-//
-// @Override
-// public void tearDown() throws Exception {
-// super.tearDown();
-// }
-//
-//
-//}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/ExperimentInputResourceTest.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/ExperimentInputResourceTest.java b/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/ExperimentInputResourceTest.java
deleted file mode 100644
index 5372877..0000000
--- a/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/ExperimentInputResourceTest.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
-*
-* 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.experiment.catalog;
-
-import org.apache.airavata.experiment.catalog.resources.*;
-import org.junit.After;
-import org.junit.Test;
-
-import java.util.List;
-
-import static org.junit.Assert.assertTrue;
-
-
-public class ExperimentInputResourceTest extends AbstractResourceTest {
- private ExperimentResource experimentResource;
- private String experimentID = "testExpID";
- ExperimentInputResource experimentInputResource;
-
- @Override
- public void setUp() throws Exception {
- super.setUp();
- experimentResource = (ExperimentResource) getGatewayResource().create(ResourceType.EXPERIMENT);
- experimentResource.setExpID(experimentID);
- experimentResource.setExecutionUser(getWorkerResource().getUser());
- experimentResource.setProjectId(getProjectResource().getId());
- experimentResource.setCreationTime(getCurrentTimestamp());
- experimentResource.setApplicationId("testApplication");
- experimentResource.setApplicationVersion("1.0");
- experimentResource.setDescription("Test Application");
- experimentResource.setExpName("TestExperiment");
- experimentResource.save();
-
- experimentInputResource = (ExperimentInputResource)experimentResource.create(ResourceType.EXPERIMENT_INPUT);
- experimentInputResource.setExperimentId(experimentID);
- experimentInputResource.setExperimentKey("testKey");
- experimentInputResource.setValue("testValue");
- experimentInputResource.setDataType("string");
- experimentInputResource.save();
- }
-
- @Test
- public void testSave() throws Exception {
- assertTrue("Experiment Input saved successfully", experimentResource.isExists(ResourceType.EXPERIMENT_INPUT, experimentID));
- }
-
- @After
- public void tearDown() throws Exception {
- }
-
- @Test
- public void testGet () throws Exception {
- List<ExperimentInputResource> experimentInputs = experimentResource.getExperimentInputs();
- System.out.println("input counts : " + experimentInputs.size());
- assertTrue("Experiment input retrieved successfully...", experimentInputs.size() > 0);
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/ExperimentMetadataResourceTest.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/ExperimentMetadataResourceTest.java b/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/ExperimentMetadataResourceTest.java
deleted file mode 100644
index 86ca3d6..0000000
--- a/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/ExperimentMetadataResourceTest.java
+++ /dev/null
@@ -1,87 +0,0 @@
-///*
-//*
-//* 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.experiment.registry.jpa;
-//
-//
-//import org.apache.airavata.experiment.registry.jpa.resources.*;
-//
-//import java.sql.Date;
-//import java.sql.Timestamp;
-//import java.util.Calendar;
-//
-//public class ExperimentMetadataResourceTest extends AbstractResourceTest {
-//
-// private GatewayResource gatewayResource;
-// private WorkflowDataResource workflowDataResource;
-// private ExperimentMetadataResource experimentResource;
-//
-// @Override
-// public void setUp() throws Exception {
-// super.setUp();
-// gatewayResource = super.getGatewayResource();
-// WorkerResource workerResource = super.getWorkerResource();
-// experimentResource = (ExperimentMetadataResource) gatewayResource.create(ResourceType.EXPERIMENT_METADATA);
-// experimentResource.setExpID("testExpID");
-// experimentResource.setExecutionUser("admin");
-// experimentResource.setProject(new ProjectResource(workerResource, gatewayResource, "testProject"));
-// experimentResource.setDescription("testDescription");
-// experimentResource.setExperimentName("textExpID");
-// experimentResource.setSubmittedDate(getCurrentTimestamp());
-// experimentResource.setShareExp(true);
-// experimentResource.save();
-//
-// ExperimentConfigDataResource exConfig = (ExperimentConfigDataResource)experimentResource.create(ResourceType.EXPERIMENT_CONFIG_DATA);
-// exConfig.setExpID("testExpID");
-// exConfig.setNodeCount(5);
-// exConfig.setCpuCount(10);
-// exConfig.setApplicationID("testApp");
-// exConfig.setApplicationVersion("testAppVersion");
-// exConfig.save();
-//
-// workflowDataResource = experimentResource.createWorkflowInstanceResource("testWFInstance");
-// workflowDataResource.setExperimentID("testExpID");
-// workflowDataResource.setStatus("testStatus");
-// workflowDataResource.setTemplateName("testWFInstance");
-// workflowDataResource.setLastUpdatedTime(getCurrentTimestamp());
-// workflowDataResource.setStartTime(getCurrentTimestamp());
-// workflowDataResource.save();
-// }
-//
-// public void testSave() throws Exception {
-// assertTrue("experiment meta data saved successfully", gatewayResource.isExists(ResourceType.EXPERIMENT_METADATA, "testExpID"));
-//
-// }
-//
-// public void testRemove() throws Exception {
-// experimentResource.remove(ResourceType.WORKFLOW_DATA, "testWFInstance");
-// assertTrue("workflow data resource removed successfully", !experimentResource.isExists(ResourceType.WORKFLOW_DATA, "testWFInstance"));
-// }
-//
-// public void testGet() throws Exception {
-// assertNotNull("experiment configuration retrieved successfully...", experimentResource.get(ResourceType.EXPERIMENT_CONFIG_DATA, "testExpID"));
-// }
-//
-// @Override
-// public void tearDown() throws Exception {
-// super.tearDown();
-// }
-//}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/ExperimentOutputResourceTest.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/ExperimentOutputResourceTest.java b/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/ExperimentOutputResourceTest.java
deleted file mode 100644
index 605b0ae..0000000
--- a/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/ExperimentOutputResourceTest.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
-*
-* 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.experiment.catalog;
-
-import org.apache.airavata.experiment.catalog.resources.ExperimentOutputResource;
-import org.apache.airavata.experiment.catalog.resources.ExperimentResource;
-import org.junit.After;
-import org.junit.Test;
-
-import java.util.List;
-
-import static org.junit.Assert.assertTrue;
-
-
-public class ExperimentOutputResourceTest extends AbstractResourceTest {
- private ExperimentResource experimentResource;
- private String experimentID = "testExpID";
- ExperimentOutputResource outputResource;
-
- @Override
- public void setUp() throws Exception {
- super.setUp();
- experimentResource = (ExperimentResource) getGatewayResource().create(ResourceType.EXPERIMENT);
- experimentResource.setExpID(experimentID);
- experimentResource.setExecutionUser(getWorkerResource().getUser());
- experimentResource.setProjectId(getProjectResource().getId());
- experimentResource.setCreationTime(getCurrentTimestamp());
- experimentResource.setApplicationId("testApplication");
- experimentResource.setApplicationVersion("1.0");
- experimentResource.setDescription("Test Application");
- experimentResource.setExpName("TestExperiment");
- experimentResource.save();
-
- outputResource = (ExperimentOutputResource)experimentResource.create(ResourceType.EXPERIMENT_OUTPUT);
- outputResource.setExperimentId(experimentResource.getExpID());
- outputResource.setExperimentKey("testKey");
- outputResource.setValue("testValue");
- outputResource.setDataType("string");
- outputResource.save();
- }
-
- @Test
- public void testSave() throws Exception {
- assertTrue("Experiment output saved successfully", experimentResource.isExists(ResourceType.EXPERIMENT_OUTPUT, experimentID));
- }
-
- @After
- public void tearDown() throws Exception {
- }
-
- @Test
- public void testGet () throws Exception {
- List<ExperimentOutputResource> outputs = experimentResource.getExperimentOutputs();
- System.out.println("output counts : " + outputs.size());
- assertTrue("Experiment output retrieved successfully...", outputs.size() > 0);
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/ExperimentResourceTest.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/ExperimentResourceTest.java b/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/ExperimentResourceTest.java
deleted file mode 100644
index ac39f41..0000000
--- a/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/ExperimentResourceTest.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
-*
-* 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.experiment.catalog;
-
-import static org.junit.Assert.*;
-
-import java.sql.Timestamp;
-import java.util.Date;
-
-import org.apache.airavata.experiment.catalog.resources.ExperimentResource;
-import org.junit.After;
-import org.junit.Test;
-
-public class ExperimentResourceTest extends AbstractResourceTest {
- private ExperimentResource experimentResource;
- private String experimentID = "testExpID";
-
- @Override
- public void setUp() throws Exception {
- super.setUp();
- experimentResource = (ExperimentResource) getGatewayResource().create(ResourceType.EXPERIMENT);
- experimentResource.setExpID(experimentID);
- experimentResource.setExecutionUser(getWorkerResource().getUser());
- experimentResource.setProjectId(getProjectResource().getId());
- Timestamp currentDate = new Timestamp(new Date().getTime());
- experimentResource.setCreationTime(currentDate);
- experimentResource.setApplicationId("testApplication");
- experimentResource.setApplicationVersion("1.0");
- experimentResource.setDescription("Test Application");
- experimentResource.setExpName("TestExperiment");
- experimentResource.save();
- }
-
- @Test
- public void testCreate() throws Exception {
- assertNotNull("experiment data resource has being created ", experimentResource);
- }
-
- @Test
- public void testSave() throws Exception {
- assertTrue("experiment save successfully", getGatewayResource().isExists(ResourceType.EXPERIMENT, experimentID));
- }
-
- @Test
- public void testGet() throws Exception {
- assertNotNull("experiment data retrieved successfully", getGatewayResource().get(ResourceType.EXPERIMENT, experimentID));
- }
-
- @Test
- public void testRemove() throws Exception {
- getGatewayResource().remove(ResourceType.EXPERIMENT, experimentID);
- assertFalse("experiment data removed successfully", getGatewayResource().isExists(ResourceType.EXPERIMENT, experimentID));
- }
-
- @After
- public void tearDown() throws Exception {
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/GFacJobDataResourceTest.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/GFacJobDataResourceTest.java b/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/GFacJobDataResourceTest.java
deleted file mode 100644
index c546aca..0000000
--- a/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/GFacJobDataResourceTest.java
+++ /dev/null
@@ -1,77 +0,0 @@
-///*
-//*
-//* 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.experiment.registry.jpa;
-//
-//import org.apache.airavata.experiment.registry.jpa.resources.*;
-//
-//import java.sql.Timestamp;
-//import java.util.Calendar;
-//
-//public class GFacJobDataResourceTest extends AbstractResourceTest {
-// private WorkerResource workerResource;
-// private WorkflowDataResource workflowDataResource;
-// private ExperimentMetadataResource experimentResource;
-//
-// @Override
-// public void setUp() throws Exception {
-// super.setUp();
-// GatewayResource gatewayResource = super.getGatewayResource();
-// workerResource = super.getWorkerResource();
-//
-// experimentResource = (ExperimentMetadataResource) gatewayResource.create(ResourceType.EXPERIMENT_METADATA);
-// experimentResource.setExpID("testExpID");
-// experimentResource.setExperimentName("testExpID");
-// experimentResource.setExecutionUser(workerResource.getUser());
-// experimentResource.setProject(new ProjectResource(workerResource, gatewayResource, "testProject"));
-// experimentResource.save();
-//
-// workflowDataResource = (WorkflowDataResource) experimentResource.create(ResourceType.WORKFLOW_DATA);
-// workflowDataResource.setWorkflowInstanceID("testWFInstance");
-// workflowDataResource.setTemplateName("testTemplate");
-// workflowDataResource.setExperimentID("testExpID");
-// Calendar calender = Calendar.getInstance();
-// java.util.Date d = calender.getTime();
-// Timestamp timestamp = new Timestamp(d.getTime());
-// workflowDataResource.setLastUpdatedTime(timestamp);
-// workflowDataResource.save();
-// }
-//
-// @Override
-// public void tearDown() throws Exception {
-// super.tearDown();
-// }
-//
-// public void testSave() throws Exception {
-// GFacJobDataResource resource = (GFacJobDataResource)workflowDataResource.create(ResourceType.GFAC_JOB_DATA);
-// resource.setLocalJobID("testJobID");
-// resource.setApplicationDescID("testApplication");
-// resource.setMetadataResource(experimentResource);
-// resource.setNodeID("testNode");
-// resource.setHostDescID("testHost");
-// resource.setServiceDescID("testService");
-// resource.setStatus("testStatus");
-// resource.setJobData("testJobData");
-// resource.save();
-// assertTrue("GFac job data saved successfully", workerResource.isGFacJobExists("testJobID"));
-//// workflowDataResource.remove(ResourceType.GFAC_JOB_DATA, "testJobID");
-// }
-//}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/GFacJobStatusResourceTest.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/GFacJobStatusResourceTest.java b/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/GFacJobStatusResourceTest.java
deleted file mode 100644
index 9cf648e..0000000
--- a/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/GFacJobStatusResourceTest.java
+++ /dev/null
@@ -1,87 +0,0 @@
-///*
-//*
-//* 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.experiment.registry.jpa;
-//
-//import org.apache.airavata.experiment.registry.jpa.resources.*;
-//
-//import java.sql.Timestamp;
-//import java.util.Calendar;
-//import java.util.List;
-//
-//public class GFacJobStatusResourceTest extends AbstractResourceTest {
-// private GFacJobDataResource gFacJobDataResource;
-//
-// @Override
-// public void setUp() throws Exception {
-// super.setUp();
-// GatewayResource gatewayResource = super.getGatewayResource();
-// WorkerResource workerResource = super.getWorkerResource();
-//
-// ExperimentMetadataResource experimentResource = (ExperimentMetadataResource) gatewayResource.create(ResourceType.EXPERIMENT_METADATA);
-// experimentResource.setExpID("testExpID");
-// experimentResource.setExperimentName("testExpID");
-// experimentResource.setExecutionUser(workerResource.getUser());
-// experimentResource.setProject(new ProjectResource(workerResource, gatewayResource, "testProject"));
-// experimentResource.save();
-//
-//
-// WorkflowDataResource workflowDataResource = (WorkflowDataResource) experimentResource.create(ResourceType.WORKFLOW_DATA);
-// workflowDataResource.setWorkflowInstanceID("testWFInstance");
-// workflowDataResource.setTemplateName("testTemplate");
-// workflowDataResource.setExperimentID("testExpID");
-// Calendar calender = Calendar.getInstance();
-// java.util.Date d = calender.getTime();
-// Timestamp timestamp = new Timestamp(d.getTime());
-// workflowDataResource.setLastUpdatedTime(timestamp);
-// workflowDataResource.save();
-//
-// gFacJobDataResource = (GFacJobDataResource) workflowDataResource.create(ResourceType.GFAC_JOB_DATA);
-// gFacJobDataResource.setLocalJobID("testJobID");
-// gFacJobDataResource.setApplicationDescID("testApplication");
-// gFacJobDataResource.setMetadataResource(experimentResource);
-// gFacJobDataResource.setNodeID("testNode");
-// gFacJobDataResource.setHostDescID("testHost");
-// gFacJobDataResource.setServiceDescID("testService");
-// gFacJobDataResource.setStatus("testStatus");
-// gFacJobDataResource.setJobData("testJobData");
-// gFacJobDataResource.save();
-//
-// }
-//
-// @Override
-// public void tearDown() throws Exception {
-// super.tearDown();
-// }
-//
-// public void testSave() throws Exception {
-// GFacJobStatusResource resource = (GFacJobStatusResource)gFacJobDataResource.create(ResourceType.GFAC_JOB_STATUS);
-// resource.setStatus("testStatus");
-// resource.setgFacJobDataResource(gFacJobDataResource);
-// Calendar calender = Calendar.getInstance();
-// java.util.Date d = calender.getTime();
-// Timestamp timestamp = new Timestamp(d.getTime());
-// resource.setStatusUpdateTime(timestamp);
-// resource.save();
-// List<Resource> resources = gFacJobDataResource.get(ResourceType.GFAC_JOB_STATUS);
-// assertTrue("GFac job status saved successfully", resources.size() != 0);
-// }
-//}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/GatewayResourceTest.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/GatewayResourceTest.java b/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/GatewayResourceTest.java
deleted file mode 100644
index bd11353..0000000
--- a/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/GatewayResourceTest.java
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
-*
-* 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.experiment.catalog;
-
-import static org.junit.Assert.*;
-
-import org.apache.airavata.common.utils.ServerSettings;
-import org.apache.airavata.experiment.catalog.resources.*;
-import org.junit.After;
-import org.junit.Test;
-
-import java.sql.Timestamp;
-import java.util.Date;
-
-
-public class GatewayResourceTest extends AbstractResourceTest {
- private GatewayResource gatewayResource;
- private ProjectResource projectResource;
- private UserResource userResource;
- private WorkerResource workerResource;
- private ExperimentResource experimentResource;
-
-
- @Override
- public void setUp() throws Exception {
- super.setUp();
- Timestamp currentDate = new Timestamp(new Date().getTime());
-
- gatewayResource = super.getGatewayResource();
- workerResource = super.getWorkerResource();
- userResource = super.getUserResource();
- if (gatewayResource == null) {
- gatewayResource = (GatewayResource) ResourceUtils.getGateway(ServerSettings.getDefaultUserGateway());
- }
- projectResource = (ProjectResource) gatewayResource.create(ResourceType.PROJECT);
- projectResource.setId("testProject");
- projectResource.setName("testProject");
- projectResource.setWorker(workerResource);
- projectResource.save();
-
- experimentResource = (ExperimentResource) gatewayResource.create(ResourceType.EXPERIMENT);
-
- experimentResource.setExpID("testExpID");
- experimentResource.setExecutionUser(getWorkerResource().getUser());
- experimentResource.setProjectId(getProjectResource().getId());
- experimentResource.setCreationTime(currentDate);
- experimentResource.setApplicationId("testApplication");
- experimentResource.setApplicationVersion("1.0");
- experimentResource.setDescription("Test Application");
- experimentResource.setExpName("TestExperiment");
- experimentResource.save();
- }
- @Test
- public void testSave() throws Exception {
- gatewayResource.setDomain("owner1");
- gatewayResource.save();
-
- boolean gatewayExist = ResourceUtils.isGatewayExist(ServerSettings.getDefaultUserGateway());
- assertTrue("The gateway exisits", gatewayExist);
-
- }
-
- @Test
- public void testCreate() throws Exception {
- assertNotNull("project resource cannot be null", projectResource);
- assertNotNull("user resource cannot be null", userResource);
- assertNotNull("worker resource cannot be null", workerResource);
- assertNotNull("experiment resource cannot be null", experimentResource);
- }
-
- @Test
- public void testIsExists() throws Exception {
- assertTrue(gatewayResource.isExists(ResourceType.GATEWAY_WORKER, ServerSettings.getDefaultUser()));
- assertTrue(gatewayResource.isExists(ResourceType.EXPERIMENT, "testExpID"));
- }
-
- @Test
- public void testGet() throws Exception {
- assertNotNull(gatewayResource.get(ResourceType.GATEWAY_WORKER, ServerSettings.getDefaultUser()));
- assertNotNull(gatewayResource.get(ResourceType.EXPERIMENT, "testExpID"));
- }
-
- @Test
- public void testGetList() throws Exception {
- assertNotNull(gatewayResource.get(ResourceType.GATEWAY_WORKER));
- assertNotNull(gatewayResource.get(ResourceType.PROJECT));
- assertNotNull(gatewayResource.get(ResourceType.EXPERIMENT));
- }
-
- @Test
- public void testRemove() throws Exception {
-
- gatewayResource.remove(ResourceType.EXPERIMENT, "testExpID");
- assertFalse(gatewayResource.isExists(ResourceType.EXPERIMENT, "testExpID"));
-
- }
-
- @After
- public void tearDown() throws Exception {
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/GramDataResourceTest.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/GramDataResourceTest.java b/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/GramDataResourceTest.java
deleted file mode 100644
index 47f8399..0000000
--- a/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/GramDataResourceTest.java
+++ /dev/null
@@ -1,72 +0,0 @@
-///*
-//*
-//* 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.experiment.registry.jpa;
-//
-//import org.apache.airavata.experiment.registry.jpa.resources.*;
-//
-//import java.sql.Timestamp;
-//import java.util.Calendar;
-//
-//public class GramDataResourceTest extends AbstractResourceTest {
-// private WorkflowDataResource workflowDataResource;
-//
-// @Override
-// public void setUp() throws Exception {
-// super.setUp();
-// GatewayResource gatewayResource = super.getGatewayResource();
-// WorkerResource workerResource = super.getWorkerResource();
-//
-// ExperimentMetadataResource experimentResource = (ExperimentMetadataResource) gatewayResource.create(ResourceType.EXPERIMENT_METADATA);
-// experimentResource.setExpID("testExpID");
-// experimentResource.setExperimentName("testExpID");
-// experimentResource.setExecutionUser(workerResource.getUser());
-// experimentResource.setProject(new ProjectResource(workerResource, gatewayResource, "testProject"));
-// experimentResource.save();
-//
-// workflowDataResource = (WorkflowDataResource) experimentResource.create(ResourceType.WORKFLOW_DATA);
-// workflowDataResource.setWorkflowInstanceID("testWFInstance");
-// workflowDataResource.setTemplateName("testTemplate");
-// workflowDataResource.setExperimentID("testExpID");
-// Calendar calender = Calendar.getInstance();
-// java.util.Date d = calender.getTime();
-// Timestamp timestamp = new Timestamp(d.getTime());
-// workflowDataResource.setLastUpdatedTime(timestamp);
-// workflowDataResource.save();
-// }
-//
-// public void testSave() throws Exception {
-// GramDataResource gramDataResource = workflowDataResource.createGramData("testNode");
-// gramDataResource.setWorkflowDataResource(workflowDataResource);
-// gramDataResource.setInvokedHost("testhost");
-// gramDataResource.setRsl("testRSL");
-// gramDataResource.save();
-//
-// assertTrue("gram data saved successfully", workflowDataResource.isGramDataExists("testNode"));
-//
-// }
-//
-// @Override
-// public void tearDown() throws Exception {
-// super.tearDown();
-// }
-//
-//}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/NodeDataResourceTest.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/NodeDataResourceTest.java b/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/NodeDataResourceTest.java
deleted file mode 100644
index e13c1ff..0000000
--- a/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/NodeDataResourceTest.java
+++ /dev/null
@@ -1,72 +0,0 @@
-///*
-//*
-//* 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.experiment.registry.jpa;
-//
-//import org.apache.airavata.experiment.registry.jpa.resources.*;
-//
-//import java.sql.Timestamp;
-//import java.util.Calendar;
-//
-//public class NodeDataResourceTest extends AbstractResourceTest {
-// private WorkflowDataResource workflowDataResource;
-//
-// @Override
-// public void setUp() throws Exception {
-// super.setUp();
-// GatewayResource gatewayResource = super.getGatewayResource();
-// WorkerResource workerResource = super.getWorkerResource();
-//
-// ExperimentMetadataResource experimentResource = (ExperimentMetadataResource) gatewayResource.create(ResourceType.EXPERIMENT_METADATA);
-// experimentResource.setExpID("testExpID");
-// experimentResource.setExperimentName("testExpID");
-// experimentResource.setExecutionUser(workerResource.getUser());
-// experimentResource.setProject(new ProjectResource(workerResource, gatewayResource, "testProject"));
-// experimentResource.save();
-//
-// workflowDataResource = (WorkflowDataResource) experimentResource.create(ResourceType.WORKFLOW_DATA);
-// workflowDataResource.setWorkflowInstanceID("testWFInstance");
-// workflowDataResource.setTemplateName("testTemplate");
-// workflowDataResource.setExperimentID("testExpID");
-// Calendar calender = Calendar.getInstance();
-// java.util.Date d = calender.getTime();
-// Timestamp timestamp = new Timestamp(d.getTime());
-// workflowDataResource.setLastUpdatedTime(timestamp);
-// workflowDataResource.save();
-// }
-//
-// public void testSave() throws Exception {
-// NodeDataResource nodeDataResource = workflowDataResource.createNodeData("testNodeID");
-// nodeDataResource.setInputs("testInput");
-//
-// nodeDataResource.setStatus("testStatus");
-// nodeDataResource.setExecutionIndex(0);
-// nodeDataResource.save();
-//
-// assertTrue("node data resource saved successfully", workflowDataResource.isNodeExists("testNodeID"));
-// }
-//
-// @Override
-// public void tearDown() throws Exception {
-// super.tearDown();
-// }
-//
-//}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/OrchestratorDataResourceTest.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/OrchestratorDataResourceTest.java b/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/OrchestratorDataResourceTest.java
deleted file mode 100644
index e545965..0000000
--- a/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/OrchestratorDataResourceTest.java
+++ /dev/null
@@ -1,69 +0,0 @@
-///*
-// *
-// * 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.experiment.registry.jpa;
-//
-//import java.util.UUID;
-//
-//import org.apache.airavata.common.utils.AiravataJobState;
-//import org.apache.airavata.experiment.registry.jpa.resources.*;
-//
-//public class OrchestratorDataResourceTest extends AbstractResourceTest{
-// private OrchestratorDataResource dataResource;
-// private ExperimentMetadataResource experimentResource;
-// private WorkerResource workerResource;
-//// private String experimentID = UUID.randomUUID().toString();
-// private String applicationName = "echo_test";
-// private GatewayResource gatewayResource;
-//
-// @Override
-// public void setUp() throws Exception {
-// super.setUp();
-// gatewayResource = super.getGatewayResource();
-// workerResource = super.getWorkerResource();
-//
-// experimentResource = (ExperimentMetadataResource) gatewayResource.create(ResourceType.EXPERIMENT_METADATA);
-// experimentResource.setExpID("testExpID");
-// experimentResource.setExperimentName("testExpID");
-// experimentResource.setExecutionUser(workerResource.getUser());
-// experimentResource.setProject(new ProjectResource(workerResource, gatewayResource, "testProject"));
-// experimentResource.save();
-//
-// dataResource = (OrchestratorDataResource) gatewayResource.create(ResourceType.ORCHESTRATOR);
-//
-// }
-//
-// public void testSave() throws Exception {
-// dataResource.setExperimentID("testExpID");
-// dataResource.setStatus(AiravataJobState.State.CREATED.toString());
-// dataResource.setApplicationName(applicationName);
-// dataResource.save();
-// assertNotNull("Orchestrator data resource created successfully", dataResource);
-// // Get saved data
-// assertNotNull("Orchestrator data resource get successfully", gatewayResource.get(ResourceType.ORCHESTRATOR, "testExpID"));
-// }
-//
-// @Override
-// public void tearDown() throws Exception {
-// super.tearDown();
-// }
-//
-//
-//}
[30/52] [abbrv] [partial] airavata git commit: registry refactoring
Posted by sh...@apache.org.
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/Project.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/Project.java b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/Project.java
deleted file mode 100644
index 96bbf54..0000000
--- a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/Project.java
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- *
- * 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.experiment.catalog.model;
-
-import org.apache.openjpa.persistence.DataCache;
-
-import javax.persistence.*;
-import java.io.Serializable;
-import java.sql.Timestamp;
-
-@DataCache
-@Entity
-@Table(name ="PROJECT")
-public class Project implements Serializable {
- @Id
- @Column(name = "PROJECT_ID")
- private String project_id;
-
- @Column(name = "GATEWAY_ID")
- private String gateway_id;
-
- @Column(name = "PROJECT_NAME")
- private String project_name;
-
- @Column(name = "DESCRIPTION")
- private String description;
-
- @Column(name = "USER_NAME")
- private String user_name;
-
- @Column(name = "CREATION_TIME")
- private Timestamp creationTime;
-
- @ManyToOne(cascade=CascadeType.MERGE)
- @JoinColumn(name = "GATEWAY_ID")
- private Gateway gateway;
-
- @ManyToOne(cascade=CascadeType.MERGE)
- @JoinColumn(name = "USER_NAME")
- private Users users;
-
-
- public String getProject_name() {
- return project_name;
- }
-
- public Gateway getGateway() {
- return gateway;
- }
-
- public void setProject_name(String project_name) {
- this.project_name = project_name;
- }
-
- public void setGateway(Gateway gateway) {
- this.gateway = gateway;
- }
-
- public Users getUsers() {
- return users;
- }
-
- public void setUsers(Users users) {
- this.users = users;
- }
-
- public String getDescription() {
- return description;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
- public Timestamp getCreationTime() {
- return creationTime;
- }
-
- public void setCreationTime(Timestamp creationTime) {
- this.creationTime = creationTime;
- }
-
- public void setProject_id(String project_id) {
- this.project_id = project_id;
- }
-
- public String getProject_id() {
- return project_id;
- }
-
- public String getUser_name() {
- return user_name;
- }
-
- public void setUser_name(String user_name) {
- this.user_name = user_name;
- }
-
- public String getGateway_id() {
- return gateway_id;
- }
-
- public void setGateway_id(String gateway_id) {
- this.gateway_id = gateway_id;
- }
-}
-
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/ProjectUser.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/ProjectUser.java b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/ProjectUser.java
deleted file mode 100644
index 5bb8804..0000000
--- a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/ProjectUser.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- *
- * 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.experiment.catalog.model;
-
-
-import org.apache.openjpa.persistence.DataCache;
-
-import javax.persistence.*;
-import java.io.Serializable;
-
-@DataCache
-@Entity
-@IdClass(ProjectUser_PK.class)
-@Table(name = "PROJECT_USER")
-public class ProjectUser implements Serializable {
- @Id
- @Column(name = "PROJECT_ID")
- private String projectID;
- @Id
- @Column(name = "USER_NAME")
- private String userName;
-
- @ManyToOne(cascade=CascadeType.MERGE)
- @JoinColumn(name = "PROJECT_ID")
- private Project project;
-
- @ManyToOne(cascade=CascadeType.MERGE)
- @JoinColumn(name = "USER_NAME")
- private Users user;
-
- public String getProjectID() {
- return projectID;
- }
-
- public void setProjectID(String projectID) {
- this.projectID = projectID;
- }
-
- public String getUserName() {
- return userName;
- }
-
- public void setUserName(String userName) {
- this.userName = userName;
- }
-
- public Project getProject() {
- return project;
- }
-
- public void setProject(Project project) {
- this.project = project;
- }
-
- public Users getUser() {
- return user;
- }
-
- public void setUser(Users user) {
- this.user = user;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/ProjectUser_PK.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/ProjectUser_PK.java b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/ProjectUser_PK.java
deleted file mode 100644
index 0d0fb40..0000000
--- a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/ProjectUser_PK.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- *
- * 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.experiment.catalog.model;
-
-import java.io.Serializable;
-
-public class ProjectUser_PK implements Serializable {
- private String projectID;
- private String userName;
-
- public ProjectUser_PK(String projectID, String userName) {
- this.projectID = projectID;
- this.userName = userName;
- }
-
- public ProjectUser_PK() {
- ;
- }
-
- @Override
- public boolean equals(Object o) {
- return false;
- }
-
- @Override
- public int hashCode() {
- return 1;
- }
-
- public String getProjectID() {
- return projectID;
- }
-
- public void setProjectID(String projectID) {
- this.projectID = projectID;
- }
-
- public String getUserName() {
- return userName;
- }
-
- public void setUserName(String userName) {
- this.userName = userName;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/QosParam.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/QosParam.java b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/QosParam.java
deleted file mode 100644
index 9b3f081..0000000
--- a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/QosParam.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- *
- * 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.experiment.catalog.model;
-
-import org.apache.openjpa.persistence.DataCache;
-
-import javax.persistence.*;
-import java.io.Serializable;
-
-@DataCache
-@Entity
-@Table(name = "QOS_PARAMS")
-public class QosParam implements Serializable {
- @Id
- @GeneratedValue
- @Column(name = "QOS_ID")
- private int qosId;
- @Column(name = "EXPERIMENT_ID")
- private String expId;
- @Column(name = "TASK_ID")
- private String taskId;
- @Column(name = "START_EXECUTION_AT")
- private String startExecutionAt;
- @Column(name = "EXECUTE_BEFORE")
- private String executeBefore;
- @Column(name = "NO_OF_RETRIES")
- private int noOfRetries;
-
- @ManyToOne(cascade= CascadeType.MERGE)
- @JoinColumn(name = "EXPERIMENT_ID")
- private Experiment experiment;
-
- @ManyToOne(cascade= CascadeType.MERGE)
- @JoinColumn(name = "TASK_ID")
- private TaskDetail task;
-
- public int getQosId() {
- return qosId;
- }
-
- public void setQosId(int qosId) {
- this.qosId = qosId;
- }
-
- public String getExpId() {
- return expId;
- }
-
- public void setExpId(String expId) {
- this.expId = expId;
- }
-
- public String getTaskId() {
- return taskId;
- }
-
- public void setTaskId(String taskId) {
- this.taskId = taskId;
- }
-
- public String getStartExecutionAt() {
- return startExecutionAt;
- }
-
- public void setStartExecutionAt(String startExecutionAt) {
- this.startExecutionAt = startExecutionAt;
- }
-
- public String getExecuteBefore() {
- return executeBefore;
- }
-
- public void setExecuteBefore(String executeBefore) {
- this.executeBefore = executeBefore;
- }
-
- public int getNoOfRetries() {
- return noOfRetries;
- }
-
- public void setNoOfRetries(int noOfRetries) {
- this.noOfRetries = noOfRetries;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/Status.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/Status.java b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/Status.java
deleted file mode 100644
index 52e088a..0000000
--- a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/Status.java
+++ /dev/null
@@ -1,146 +0,0 @@
-/*
- *
- * 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.experiment.catalog.model;
-
-import org.apache.openjpa.persistence.DataCache;
-
-import javax.persistence.*;
-import java.io.Serializable;
-import java.sql.Timestamp;
-
-@DataCache
-@Entity
-@Table(name = "STATUS")
-public class Status implements Serializable {
- @Id
- @GeneratedValue
- @Column(name = "STATUS_ID")
- private int statusId;
- @Column(name = "EXPERIMENT_ID")
- private String expId;
- @Column(name = "NODE_INSTANCE_ID")
- private String nodeId;
- @Column(name = "TRANSFER_ID")
- private String transferId;
- @Column(name = "TASK_ID")
- private String taskId;
- @Column(name = "JOB_ID")
- private String jobId;
- @Column(name = "STATE")
- private String state;
- @Column(name = "STATUS_UPDATE_TIME")
- private Timestamp statusUpdateTime;
- @Column(name = "STATUS_TYPE")
- private String statusType;
-
- @ManyToOne(fetch = FetchType.LAZY, cascade= CascadeType.MERGE)
- @JoinColumn(name = "EXPERIMENT_ID")
- private Experiment experiment;
-
- @ManyToOne(fetch = FetchType.LAZY, cascade= CascadeType.MERGE)
- @JoinColumn(name = "TASK_ID")
- private TaskDetail task;
-
- @ManyToOne(fetch = FetchType.LAZY, cascade= CascadeType.MERGE)
- @JoinColumn(name = "NODE_INSTANCE_ID")
- private WorkflowNodeDetail nodeDetail;
-
- @ManyToOne(fetch = FetchType.LAZY, cascade= CascadeType.MERGE)
- @JoinColumn(name = "TRANSFER_ID")
- private DataTransferDetail transferDetail;
-
- @ManyToOne(fetch = FetchType.LAZY, cascade= CascadeType.MERGE)
- @JoinColumn(name = "JOB_ID")
- private JobDetail jobDetail;
-
- public int getStatusId() {
- return statusId;
- }
-
- public void setStatusId(int statusId) {
- this.statusId = statusId;
- }
-
- public String getExpId() {
- return expId;
- }
-
- public void setExpId(String expId) {
- this.expId = expId;
- }
-
- public String getNodeId() {
- return nodeId;
- }
-
- public void setNodeId(String nodeId) {
- this.nodeId = nodeId;
- }
-
- public String getTransferId() {
- return transferId;
- }
-
- public void setTransferId(String transferId) {
- this.transferId = transferId;
- }
-
- public String getTaskId() {
- return taskId;
- }
-
- public void setTaskId(String taskId) {
- this.taskId = taskId;
- }
-
- public String getJobId() {
- return jobId;
- }
-
- public void setJobId(String jobId) {
- this.jobId = jobId;
- }
-
- public String getState() {
- return state;
- }
-
- public void setState(String state) {
- this.state = state;
- }
-
- public Timestamp getStatusUpdateTime() {
- return statusUpdateTime;
- }
-
- public void setStatusUpdateTime(Timestamp statusUpdateTime) {
- this.statusUpdateTime = statusUpdateTime;
- }
-
- public String getStatusType() {
- return statusType;
- }
-
- public void setStatusType(String statusType) {
- this.statusType = statusType;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/TaskDetail.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/TaskDetail.java b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/TaskDetail.java
deleted file mode 100644
index 423b189..0000000
--- a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/TaskDetail.java
+++ /dev/null
@@ -1,221 +0,0 @@
-/*
- *
- * 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.experiment.catalog.model;
-
-import org.apache.openjpa.persistence.DataCache;
-
-import javax.persistence.*;
-import java.io.Serializable;
-import java.sql.Timestamp;
-import java.util.List;
-
-@DataCache
-@Entity
-@Table(name = "TASK_DETAIL")
-public class TaskDetail implements Serializable {
- @Id
- @Column(name = "TASK_ID")
- private String taskId;
- @Column(name = "NODE_INSTANCE_ID")
- private String nodeId;
- @Column(name = "CREATION_TIME")
- private Timestamp creationTime;
- @Column(name = "APPLICATION_ID")
- private String appId;
- @Column(name = "APPLICATION_VERSION")
- private String appVersion;
- @Column(name = "ALLOW_NOTIFICATION")
- private boolean allowNotification;
-
- @Column(name = "APPLICATION_DEPLOYMENT_ID")
- private String applicationDeploymentId;
-
- @ManyToOne(cascade= CascadeType.MERGE)
- @JoinColumn(name = "NODE_INSTANCE_ID")
- private WorkflowNodeDetail nodeDetail;
-
- @OneToMany (fetch = FetchType.LAZY, mappedBy = "task")
- private List<ApplicationOutput> applicationOutputs;
-
- @OneToMany (fetch = FetchType.LAZY, mappedBy = "task")
- private List<ApplicationInput> applicationInputs;
-
- @OneToOne (fetch = FetchType.LAZY, mappedBy = "task")
- private Computational_Resource_Scheduling resourceScheduling;
-
- @OneToOne (fetch = FetchType.LAZY, mappedBy = "task")
- private AdvancedInputDataHandling inputDataHandling;
-
- @OneToOne (fetch = FetchType.LAZY, mappedBy = "task")
- private AdvancedOutputDataHandling outputDataHandling;
-
- @OneToOne (fetch = FetchType.LAZY, mappedBy = "task")
- private Status taskStatus;
-
- @OneToMany (fetch = FetchType.LAZY, mappedBy = "task")
- private List<JobDetail> jobDetails;
-
- @OneToMany (fetch = FetchType.LAZY, mappedBy = "task")
- private List<DataTransferDetail> dataTransferDetails;
-
- @OneToMany (fetch = FetchType.LAZY, mappedBy = "task")
- private List<Notification_Email> notificationEmails;
-
- @OneToMany (fetch = FetchType.LAZY, mappedBy = "task")
- private List<ErrorDetail> errorDetails;
-
- public String getTaskId() {
- return taskId;
- }
-
- public void setTaskId(String taskId) {
- this.taskId = taskId;
- }
-
- public String getNodeId() {
- return nodeId;
- }
-
- public void setNodeId(String nodeId) {
- this.nodeId = nodeId;
- }
-
- public Timestamp getCreationTime() {
- return creationTime;
- }
-
- public void setCreationTime(Timestamp creationTime) {
- this.creationTime = creationTime;
- }
-
- public String getAppId() {
- return appId;
- }
-
- public void setAppId(String appId) {
- this.appId = appId;
- }
-
- public String getAppVersion() {
- return appVersion;
- }
-
- public void setAppVersion(String appVersion) {
- this.appVersion = appVersion;
- }
-
- public String getApplicationDeploymentId() {
- return applicationDeploymentId;
- }
-
- public void setApplicationDeploymentId(String applicationDeploymentId) {
- this.applicationDeploymentId = applicationDeploymentId;
- }
-
- public boolean isAllowNotification() {
- return allowNotification;
- }
-
- public void setAllowNotification(boolean allowNotification) {
- this.allowNotification = allowNotification;
- }
-
- public List<ApplicationOutput> getApplicationOutputs() {
- return applicationOutputs;
- }
-
- public void setApplicationOutputs(List<ApplicationOutput> applicationOutputs) {
- this.applicationOutputs = applicationOutputs;
- }
-
- public List<ApplicationInput> getApplicationInputs() {
- return applicationInputs;
- }
-
- public void setApplicationInputs(List<ApplicationInput> applicationInputs) {
- this.applicationInputs = applicationInputs;
- }
-
- public Computational_Resource_Scheduling getResourceScheduling() {
- return resourceScheduling;
- }
-
- public void setResourceScheduling(Computational_Resource_Scheduling resourceScheduling) {
- this.resourceScheduling = resourceScheduling;
- }
-
- public AdvancedInputDataHandling getInputDataHandling() {
- return inputDataHandling;
- }
-
- public void setInputDataHandling(AdvancedInputDataHandling inputDataHandling) {
- this.inputDataHandling = inputDataHandling;
- }
-
- public AdvancedOutputDataHandling getOutputDataHandling() {
- return outputDataHandling;
- }
-
- public void setOutputDataHandling(AdvancedOutputDataHandling outputDataHandling) {
- this.outputDataHandling = outputDataHandling;
- }
-
- public List<JobDetail> getJobDetails() {
- return jobDetails;
- }
-
- public void setJobDetails(List<JobDetail> jobDetails) {
- this.jobDetails = jobDetails;
- }
-
- public List<DataTransferDetail> getDataTransferDetails() {
- return dataTransferDetails;
- }
-
- public void setDataTransferDetails(List<DataTransferDetail> dataTransferDetails) {
- this.dataTransferDetails = dataTransferDetails;
- }
-
- public List<Notification_Email> getNotificationEmails() {
- return notificationEmails;
- }
-
- public void setNotificationEmails(List<Notification_Email> notificationEmails) {
- this.notificationEmails = notificationEmails;
- }
-
- public Status getTaskStatus() {
- return taskStatus;
- }
-
- public void setTaskStatus(Status taskStatus) {
- this.taskStatus = taskStatus;
- }
-
- public List<ErrorDetail> getErrorDetails() {
- return errorDetails;
- }
-
- public void setErrorDetails(List<ErrorDetail> errorDetails) {
- this.errorDetails = errorDetails;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/Users.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/Users.java b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/Users.java
deleted file mode 100644
index f0b9b49..0000000
--- a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/Users.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- *
- * 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.experiment.catalog.model;
-
-import org.apache.openjpa.persistence.DataCache;
-
-import javax.persistence.*;
-import java.io.Serializable;
-
-@DataCache
-@Entity
-@Table(name ="USERS")
-public class Users implements Serializable {
-
- @Id
- @Column(name = "USER_NAME")
- private String user_name;
- @Column(name = "PASSWORD")
- private String password;
-
-
- public String getUser_name() {
- return user_name;
- }
-
- public void setUser_name(String user_name) {
- this.user_name = user_name;
- }
-
- public String getPassword() {
- return password;
- }
-
- public void setPassword(String password) {
- this.password = password;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/WorkflowNodeDetail.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/WorkflowNodeDetail.java b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/WorkflowNodeDetail.java
deleted file mode 100644
index 7d38322..0000000
--- a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/WorkflowNodeDetail.java
+++ /dev/null
@@ -1,155 +0,0 @@
-/*
- *
- * 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.experiment.catalog.model;
-
-import org.apache.openjpa.persistence.DataCache;
-
-import javax.persistence.*;
-import java.io.Serializable;
-import java.sql.Timestamp;
-import java.util.List;
-
-@DataCache
-@Entity
-@Table(name = "WORKFLOW_NODE_DETAIL")
-public class WorkflowNodeDetail implements Serializable {
- @Column(name = "EXPERIMENT_ID")
- private String expId;
- @Id
- @Column(name = "NODE_INSTANCE_ID")
- private String nodeId;
- @Column(name = "EXECUTION_UNIT")
- private String executionUnit;
- @Column(name = "EXECUTION_UNIT_DATA")
- private String executionUnitData;
- @Column(name = "CREATION_TIME")
- private Timestamp creationTime;
- @Column(name = "NODE_NAME")
- private String nodeName;
-
- @ManyToOne(cascade= CascadeType.MERGE)
- @JoinColumn(name = "EXPERIMENT_ID")
- private Experiment experiment;
-
- @OneToMany (fetch = FetchType.LAZY, mappedBy = "nodeDetail")
- private List<TaskDetail> taskDetails;
-
- @OneToMany (fetch = FetchType.LAZY, mappedBy = "nodeDetail")
- private List<NodeInput> nodeInputs;
-
- @OneToMany (fetch = FetchType.LAZY, mappedBy = "nodeDetail")
- private List<NodeOutput> nodeOutputs;
-
- @OneToOne (fetch = FetchType.LAZY, mappedBy = "nodeDetail")
- private Status nodeStatus;
-
- @OneToMany (fetch = FetchType.LAZY, mappedBy = "nodeDetail")
- private List<ErrorDetail> errorDetails;
-
- public String getExpId() {
- return expId;
- }
-
- public void setExpId(String expId) {
- this.expId = expId;
- }
-
- public String getNodeId() {
- return nodeId;
- }
-
- public void setNodeId(String nodeId) {
- this.nodeId = nodeId;
- }
-
- public Timestamp getCreationTime() {
- return creationTime;
- }
-
- public void setCreationTime(Timestamp creationTime) {
- this.creationTime = creationTime;
- }
-
- public String getNodeName() {
- return nodeName;
- }
-
- public void setNodeName(String nodeName) {
- this.nodeName = nodeName;
- }
-
- public String getExecutionUnitData() {
- return executionUnitData;
- }
-
- public void setExecutionUnitData(String executionUnitData) {
- this.executionUnitData = executionUnitData;
- }
-
- public String getExecutionUnit() {
- return executionUnit;
- }
-
- public void setExecutionUnit(String executionUnit) {
- this.executionUnit = executionUnit;
- }
-
- public List<TaskDetail> getTaskDetails() {
- return taskDetails;
- }
-
- public void setTaskDetails(List<TaskDetail> taskDetails) {
- this.taskDetails = taskDetails;
- }
-
- public List<NodeInput> getNodeInputs() {
- return nodeInputs;
- }
-
- public void setNodeInputs(List<NodeInput> nodeInputs) {
- this.nodeInputs = nodeInputs;
- }
-
- public List<NodeOutput> getNodeOutputs() {
- return nodeOutputs;
- }
-
- public void setNodeOutputs(List<NodeOutput> nodeOutputs) {
- this.nodeOutputs = nodeOutputs;
- }
-
- public Status getNodeStatus() {
- return nodeStatus;
- }
-
- public void setNodeStatus(Status nodeStatus) {
- this.nodeStatus = nodeStatus;
- }
-
- public List<ErrorDetail> getErrorDetails() {
- return errorDetails;
- }
-
- public void setErrorDetails(List<ErrorDetail> errorDetails) {
- this.errorDetails = errorDetails;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/AbstractResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/AbstractResource.java b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/AbstractResource.java
deleted file mode 100644
index 86ae071..0000000
--- a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/AbstractResource.java
+++ /dev/null
@@ -1,317 +0,0 @@
-/*
- *
- * 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.experiment.catalog.resources;
-
-import org.apache.airavata.experiment.catalog.Resource;
-import org.apache.airavata.experiment.catalog.ResourceType;
-import org.apache.airavata.registry.cpi.RegistryException;
-
-import java.util.ArrayList;
-import java.util.List;
-
-public abstract class AbstractResource implements Resource {
- // table names
- public static final String GATEWAY = "Gateway";
- public static final String CONFIGURATION = "Configuration";
- public static final String USERS = "Users";
- public static final String GATEWAY_WORKER = "Gateway_Worker";
- public static final String PROJECT = "Project";
- public static final String PROJECT_USER = "ProjectUser";
- public static final String EXPERIMENT = "Experiment";
- public static final String NOTIFICATION_EMAIL = "Notification_Email";
- public static final String EXPERIMENT_CONFIG_DATA = "ExperimentConfigData";
- public static final String EXPERIMENT_INPUT = "Experiment_Input";
- public static final String EXPERIMENT_OUTPUT = "Experiment_Output";
- public static final String WORKFLOW_NODE_DETAIL = "WorkflowNodeDetail";
- public static final String TASK_DETAIL = "TaskDetail";
- public static final String ERROR_DETAIL = "ErrorDetail";
- public static final String APPLICATION_INPUT = "ApplicationInput";
- public static final String APPLICATION_OUTPUT = "ApplicationOutput";
- public static final String NODE_INPUT = "NodeInput";
- public static final String NODE_OUTPUT = "NodeOutput";
- public static final String JOB_DETAIL = "JobDetail";
- public static final String DATA_TRANSFER_DETAIL = "DataTransferDetail";
- public static final String STATUS = "Status";
- public static final String CONFIG_DATA = "ExperimentConfigData";
- public static final String COMPUTATIONAL_RESOURCE_SCHEDULING = "Computational_Resource_Scheduling";
- public static final String ADVANCE_INPUT_DATA_HANDLING = "AdvancedInputDataHandling";
- public static final String ADVANCE_OUTPUT_DATA_HANDLING = "AdvancedOutputDataHandling";
- public static final String QOS_PARAMS = "QosParam";
-
-
- // Gateway Table
- public final class GatewayConstants {
- public static final String GATEWAY_ID = "gateway_id";
- public static final String GATEWAY_NAME = "gateway_name";
- public static final String DOMAIN = "domain";
- public static final String EMAIL_ADDRESS = "emailAddress";
- }
-
- // Configuration Table
- public final class ConfigurationConstants {
- // public static final String CONFIG_ID = "config_ID";
- public static final String CONFIG_KEY = "config_key";
- public static final String CONFIG_VAL = "config_val";
- public static final String EXPIRE_DATE = "expire_date";
- public static final String CATEGORY_ID = "category_id";
- public static final String CATEGORY_ID_DEFAULT_VALUE = "SYSTEM";
- }
-
- // Users table
- public final class UserConstants {
- public static final String USERNAME = "user_name";
- public static final String PASSWORD = "password";
- }
-
- // Gateway_Worker table
- public final class GatewayWorkerConstants {
- public static final String USERNAME = "user_name";
- public static final String GATEWAY_ID = "gateway_id";
- }
-
- // Project table
- public final class ProjectConstants {
- public static final String GATEWAY_ID = "gateway_id";
- public static final String USERNAME = "user_name";
- public static final String PROJECT_NAME = "project_name";
- public static final String PROJECT_ID = "project_id";
- public static final String DESCRIPTION = "description";
- public static final String CREATION_TIME = "creationTime";
- }
-
- // Project table
- public final class ProjectUserConstants {
- public static final String USERNAME = "userName";
- public static final String PROJECT_ID = "projectID";
- }
-
- // Experiment table
- public final class ExperimentConstants {
- public static final String PROJECT_ID = "projectID";
- public static final String EXECUTION_USER = "executionUser";
- public static final String GATEWAY_ID = "gatewayId";
- public static final String EXPERIMENT_ID = "expId";
- public static final String EXPERIMENT_NAME = "expName";
- public static final String DESCRIPTION = "expDesc";
- public static final String CREATION_TIME = "creationTime";
- public static final String APPLICATION_ID = "applicationId";
- public static final String APPLICATION_VERSION = "appVersion";
- public static final String WORKFLOW_TEMPLATE_ID = "workflowTemplateId";
- public static final String WORKFLOW_TEMPLATE_VERSION = "workflowTemplateVersion";
- public static final String WORKFLOW_EXECUTION_ID = "workflowExecutionId";
- }
-
- // Experiment Configuration Data table
- public final class ExperimentConfigurationDataConstants {
- public static final String EXPERIMENT_ID = "expId";
- public static final String AIRAVATA_AUTO_SCHEDULE = "airavataAutoSchedule";
- public static final String OVERRIDE_MANUAL_SCHEDULE = "overrideManualParams";
- public static final String SHARE_EXPERIMENT = "shareExp";
- }
-
- public final class NotificationEmailConstants {
- public static final String EXPERIMENT_ID = "experiment_id";
- public static final String TASK_ID = "taskId";
- public static final String EMAIL_ADDRESS = "emailAddress";
- }
-
- //Experiment Input table
- public final class ExperimentInputConstants {
- public static final String EXPERIMENT_ID = "experiment_id";
- public static final String EXPERIMENT_INPUT_KEY = "ex_key";
- public static final String EXPERIMENT_INPUT_VAL = "value";
- public static final String INPUT_TYPE = "inputType";
- public static final String METADATA = "metadata";
- }
-
- //Experiment Output table
- public final class ExperimentOutputConstants {
- public static final String EXPERIMENT_ID = "experiment_id";
- public static final String EXPERIMENT_OUTPUT_KEY = "ex_key";
- public static final String EXPERIMENT_OUTPUT_VAL = "value";
- public static final String OUTPUT_TYPE = "outputKeyType";
- public static final String METADATA = "metadata";
- }
-
- // Workflow_Data table
- public final class WorkflowNodeDetailsConstants {
- public static final String EXPERIMENT_ID = "expId";
- public static final String NODE_INSTANCE_ID = "nodeId";
- public static final String CREATION_TIME = "creationTime";
- public static final String NODE_NAME = "nodeName";
- }
-
- // TaskDetail table
- public final class TaskDetailConstants {
- public static final String TASK_ID = "taskId";
- public static final String NODE_INSTANCE_ID = "nodeId";
- public static final String CREATION_TIME = "creationTime";
- public static final String APPLICATION_ID = "appId";
- public static final String APPLICATION_VERSION = "appVersion";
- }
-
- // ErrorDetails table
- public final class ErrorDetailConstants {
- public static final String ERROR_ID = "errorID";
- public static final String EXPERIMENT_ID = "expId";
- public static final String TASK_ID = "taskId";
- public static final String JOB_ID = "jobId";
- public static final String NODE_INSTANCE_ID = "nodeId";
- public static final String CREATION_TIME = "creationTime";
- public static final String ACTUAL_ERROR_MESSAGE = "actualErrorMsg";
- public static final String USER_FRIEDNLY_ERROR_MSG = "userFriendlyErrorMsg";
- public static final String TRANSIENT_OR_PERSISTENT = "transientPersistent";
- public static final String ERROR_CATEGORY = "errorCategory";
- public static final String CORRECTIVE_ACTION = "correctiveAction";
- public static final String ACTIONABLE_GROUP = "actionableGroup";
- }
-
- // ApplicationInput table
- public final class ApplicationInputConstants {
- public static final String TASK_ID = "taskId";
- public static final String INPUT_KEY = "inputKey";
- public static final String INPUT_KEY_TYPE = "inputKeyType";
- public static final String METADATA = "metadata";
- public static final String VALUE = "value";
- }
-
- // ApplicationOutput table
- public final class ApplicationOutputConstants {
- public static final String TASK_ID = "taskId";
- public static final String OUTPUT_KEY = "outputKey";
- public static final String OUTPUT_KEY_TYPE = "outputKeyType";
- public static final String METADATA = "metadata";
- public static final String VALUE = "value";
- }
-
- // NodeInput table
- public final class NodeInputConstants {
- public static final String NODE_INSTANCE_ID = "nodeId";
- public static final String INPUT_KEY = "inputKey";
- public static final String INPUT_KEY_TYPE = "inputKeyType";
- public static final String METADATA = "metadata";
- public static final String VALUE = "value";
- }
-
- // NodeOutput table
- public final class NodeOutputConstants {
- public static final String NODE_INSTANCE_ID = "nodeId";
- public static final String OUTPUT_KEY = "outputKey";
- public static final String OUTPUT_KEY_TYPE = "outputKeyType";
- public static final String METADATA = "metadata";
- public static final String VALUE = "value";
- }
-
- // Job Details table constants
- public final class JobDetailConstants{
- public static final String JOB_ID = "jobId";
- public static final String TASK_ID = "taskId";
- public static final String JOB_DESCRIPTION = "jobDescription";
- public static final String CREATION_TIME = "jobDescription";
- }
-
- // Data transfer Details table constants
- public final class DataTransferDetailConstants{
- public static final String TRANSFER_ID = "transferId";
- public static final String TASK_ID = "taskId";
- public static final String TRANSFER_DESC = "transferDesc";
- public static final String CREATION_TIME = "creationTime";
- }
-
- // Status table constants
- public final class StatusConstants {
- public static final String STATUS_ID = "statusId";
- public static final String EXPERIMENT_ID = "expId";
- public static final String NODE_INSTANCE_ID = "nodeId";
- public static final String TRANSFER_ID = "transferId";
- public static final String TASK_ID = "taskId";
- public static final String JOB_ID = "jobId";
- public static final String STATE = "state";
- public static final String STATUS_UPDATE_TIME = "statusUpdateTime";
- public static final String STATUS_TYPE = "statusType";
- }
-
- public static final class ComputationalResourceSchedulingConstants{
- public static final String RESOURCE_SCHEDULING_ID = "schedulingId";
- public static final String EXPERIMENT_ID = "expId";
- public static final String TASK_ID = "taskId";
- public static final String RESOURCE_HOST_ID = "resourceHostId";
- public static final String CPU_COUNT = "cpuCount";
- public static final String NODE_COUNT = "nodeCount";
- public static final String NO_OF_THREADS = "numberOfThreads";
- public static final String QUEUE_NAME = "queueName";
- public static final String WALLTIME_LIMIT = "wallTimeLimit";
- public static final String JOB_START_TIME = "jobStartTime";
- public static final String TOTAL_PHYSICAL_MEMORY = "totalPhysicalmemory";
- public static final String COMPUTATIONAL_PROJECT_ACCOUNT = "projectName";
- }
-
- public static final class AdvancedInputDataHandlingConstants {
- public static final String INPUT_DATA_HANDLING_ID = "dataHandlingId";
- public static final String EXPERIMENT_ID = "expId";
- public static final String TASK_ID = "taskId";
- public static final String WORKING_DIR_PARENT = "parentWorkingDir";
- public static final String UNIQUE_WORKING_DIR = "workingDir";
- public static final String STAGE_INPUT_FILES_TO_WORKING_DIR = "stageInputsToWorkingDir";
- public static final String CLEAN_AFTER_JOB = "cleanAfterJob";
- }
-
- public static final class AdvancedOutputDataHandlingConstants {
- public static final String OUTPUT_DATA_HANDLING_ID = "outputDataHandlingId";
- public static final String EXPERIMENT_ID = "expId";
- public static final String TASK_ID = "taskId";
- public static final String OUTPUT_DATA_DIR = "outputDataDir";
- public static final String DATA_REG_URL = "dataRegUrl";
- public static final String PERSIST_OUTPUT_DATA = "persistOutputData";
- }
-
- public static final class QosParamsConstants {
- public static final String QOS_ID = "qosId";
- public static final String EXPERIMENT_ID = "expId";
- public static final String TASK_ID = "taskId";
- public static final String START_EXECUTION_AT = "startExecutionAt";
- public static final String EXECUTE_BEFORE = "executeBefore";
- public static final String NO_OF_RETRIES = "noOfRetries";
- }
-
-
- protected AbstractResource() {
- }
-
- public boolean isExists(ResourceType type, Object name) throws RegistryException {
- try {
- return get(type, name) != null;
- } catch (Exception e) {
- return false;
- }
- }
-
- @SuppressWarnings("unchecked")
- public static <T> List<T> getResourceList(List<Resource> resources,
- Class<?> T) {
- List<T> list = new ArrayList<T>();
- for (Resource o : resources) {
- list.add((T) o);
- }
- return list;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/AdvanceInputDataHandlingResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/AdvanceInputDataHandlingResource.java b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/AdvanceInputDataHandlingResource.java
deleted file mode 100644
index b2995dd..0000000
--- a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/AdvanceInputDataHandlingResource.java
+++ /dev/null
@@ -1,160 +0,0 @@
-/*
- *
- * 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.experiment.catalog.resources;
-
-import org.apache.airavata.experiment.catalog.Resource;
-import org.apache.airavata.experiment.catalog.ResourceType;
-import org.apache.airavata.experiment.catalog.ResourceUtils;
-import org.apache.airavata.experiment.catalog.model.AdvancedInputDataHandling;
-import org.apache.airavata.registry.cpi.RegistryException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.persistence.EntityManager;
-import java.util.List;
-
-public class AdvanceInputDataHandlingResource extends AbstractResource {
- private static final Logger logger = LoggerFactory.getLogger(AdvanceInputDataHandlingResource.class);
- private int dataHandlingId = 0;
- private String workingDirParent;
- private String workingDir;
- private boolean stageInputFiles;
- private boolean cleanAfterJob;
- private String experimentId;
- private String taskId;
-
- public String getExperimentId() {
- return experimentId;
- }
-
- public void setExperimentId(String experimentId) {
- this.experimentId = experimentId;
- }
-
- public String getTaskId() {
- return taskId;
- }
-
- public void setTaskId(String taskId) {
- this.taskId = taskId;
- }
-
- public int getDataHandlingId() {
- return dataHandlingId;
- }
-
- public void setDataHandlingId(int dataHandlingId) {
- this.dataHandlingId = dataHandlingId;
- }
-
- public String getWorkingDirParent() {
- return workingDirParent;
- }
-
- public void setWorkingDirParent(String workingDirParent) {
- this.workingDirParent = workingDirParent;
- }
-
- public String getWorkingDir() {
- return workingDir;
- }
-
- public void setWorkingDir(String workingDir) {
- this.workingDir = workingDir;
- }
-
- public boolean isStageInputFiles() {
- return stageInputFiles;
- }
-
- public void setStageInputFiles(boolean stageInputFiles) {
- this.stageInputFiles = stageInputFiles;
- }
-
- public boolean isCleanAfterJob() {
- return cleanAfterJob;
- }
-
- public void setCleanAfterJob(boolean cleanAfterJob) {
- this.cleanAfterJob = cleanAfterJob;
- }
-
-
- public Resource create(ResourceType type) throws RegistryException {
- logger.error("Unsupported resource type for input data handling resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
-
- public void remove(ResourceType type, Object name) throws RegistryException {
- logger.error("Unsupported resource type for input data handling resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
-
- public Resource get(ResourceType type, Object name) throws RegistryException{
- logger.error("Unsupported resource type for input data handling resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
-
- public List<Resource> get(ResourceType type) throws RegistryException {
- logger.error("Unsupported resource type for input data handling resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
-
- public void save() throws RegistryException{
- EntityManager em = null;
- try {
- em = ResourceUtils.getEntityManager();
- em.getTransaction().begin();
- AdvancedInputDataHandling dataHandling;
- if (dataHandlingId != 0) {
- dataHandling = em.find(AdvancedInputDataHandling.class, dataHandlingId);
- dataHandling.setDataHandlingId(dataHandlingId);
- } else {
- dataHandling = new AdvancedInputDataHandling();
- }
- dataHandling.setWorkingDir(workingDir);
- dataHandling.setParentWorkingDir(workingDirParent);
- dataHandling.setStageInputsToWorkingDir(stageInputFiles);
- dataHandling.setCleanAfterJob(cleanAfterJob);
- dataHandling.setExpId(experimentId);
- dataHandling.setTaskId(taskId);
- em.persist(dataHandling);
- dataHandlingId = dataHandling.getDataHandlingId();
- em.getTransaction().commit();
- em.close();
- }catch (Exception e){
- logger.error(e.getMessage(), e);
- throw new RegistryException(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/ec8c6202/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/AdvancedOutputDataHandlingResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/AdvancedOutputDataHandlingResource.java b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/AdvancedOutputDataHandlingResource.java
deleted file mode 100644
index fc6b049..0000000
--- a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/AdvancedOutputDataHandlingResource.java
+++ /dev/null
@@ -1,150 +0,0 @@
-/*
- *
- * 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.experiment.catalog.resources;
-
-import org.apache.airavata.experiment.catalog.Resource;
-import org.apache.airavata.experiment.catalog.ResourceType;
-import org.apache.airavata.experiment.catalog.ResourceUtils;
-import org.apache.airavata.experiment.catalog.model.AdvancedOutputDataHandling;
-import org.apache.airavata.registry.cpi.RegistryException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.persistence.EntityManager;
-import java.util.List;
-
-public class AdvancedOutputDataHandlingResource extends AbstractResource {
- private static final Logger logger = LoggerFactory.getLogger(AdvancedOutputDataHandlingResource.class);
- private int outputDataHandlingId = 0;
- private String outputDataDir;
- private String dataRegUrl;
- private boolean persistOutputData;
- private String experimentId;
- private String taskId;
-
- public String getExperimentId() {
- return experimentId;
- }
-
- public void setExperimentId(String experimentId) {
- this.experimentId = experimentId;
- }
-
- public String getTaskId() {
- return taskId;
- }
-
- public void setTaskId(String taskId) {
- this.taskId = taskId;
- }
-
- public int getOutputDataHandlingId() {
- return outputDataHandlingId;
- }
-
- public void setOutputDataHandlingId(int outputDataHandlingId) {
- this.outputDataHandlingId = outputDataHandlingId;
- }
-
- public String getOutputDataDir() {
- return outputDataDir;
- }
-
- public void setOutputDataDir(String outputDataDir) {
- this.outputDataDir = outputDataDir;
- }
-
- public String getDataRegUrl() {
- return dataRegUrl;
- }
-
- public void setDataRegUrl(String dataRegUrl) {
- this.dataRegUrl = dataRegUrl;
- }
-
- public boolean isPersistOutputData() {
- return persistOutputData;
- }
-
- public void setPersistOutputData(boolean persistOutputData) {
- this.persistOutputData = persistOutputData;
- }
-
-
- public Resource create(ResourceType type) throws RegistryException {
- logger.error("Unsupported resource type for output data handling resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
-
- public void remove(ResourceType type, Object name) throws RegistryException {
- logger.error("Unsupported resource type for output data handling resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
-
- public Resource get(ResourceType type, Object name) throws RegistryException {
- logger.error("Unsupported resource type for output data handling resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
-
- public List<Resource> get(ResourceType type) throws RegistryException{
- logger.error("Unsupported resource type for output data handling resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
-
- public void save() throws RegistryException {
- EntityManager em = null;
- try {
- em = ResourceUtils.getEntityManager();
- em.getTransaction().begin();
- AdvancedOutputDataHandling dataHandling;
- if (outputDataHandlingId != 0 ){
- dataHandling = em.find(AdvancedOutputDataHandling.class, outputDataHandlingId);
- dataHandling.setOutputDataHandlingId(outputDataHandlingId);
- }else {
- dataHandling = new AdvancedOutputDataHandling();
- }
- dataHandling.setDataRegUrl(dataRegUrl);
- dataHandling.setOutputDataDir(outputDataDir);
- dataHandling.setPersistOutputData(persistOutputData);
- dataHandling.setExpId(experimentId);
- dataHandling.setTaskId(taskId);
- em.persist(dataHandling);
- outputDataHandlingId = dataHandling.getOutputDataHandlingId();
- em.getTransaction().commit();
- em.close();
- }catch (Exception e){
- logger.error(e.getMessage(), e);
- throw new RegistryException(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/ec8c6202/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/ApplicationInputResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/ApplicationInputResource.java b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/ApplicationInputResource.java
deleted file mode 100644
index b694d38..0000000
--- a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/ApplicationInputResource.java
+++ /dev/null
@@ -1,230 +0,0 @@
-/*
- *
- * 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.experiment.catalog.resources;
-
-import java.util.List;
-
-import javax.persistence.EntityManager;
-
-import org.apache.airavata.experiment.catalog.Resource;
-import org.apache.airavata.experiment.catalog.ResourceType;
-import org.apache.airavata.experiment.catalog.ResourceUtils;
-import org.apache.airavata.experiment.catalog.model.ApplicationInput;
-import org.apache.airavata.experiment.catalog.model.ApplicationInput_PK;
-import org.apache.airavata.registry.cpi.RegistryException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class ApplicationInputResource extends AbstractResource {
- private static final Logger logger = LoggerFactory.getLogger(ApplicationInputResource.class);
- private String inputKey;
- private String dataType;
- private String metadata;
- private String value;
- private String appArgument;
- private boolean standardInput;
- private String userFriendlyDesc;
- private int inputOrder;
- private boolean isRequired;
- private boolean requiredToCMD;
- private boolean dataStaged;
- private String taskId;
-
- public String getTaskId() {
- return taskId;
- }
-
- public void setTaskId(String taskId) {
- this.taskId = taskId;
- }
-
- public boolean isRequired() {
- return isRequired;
- }
-
- public void setRequired(boolean isRequired) {
- this.isRequired = isRequired;
- }
-
- public boolean isRequiredToCMD() {
- return requiredToCMD;
- }
-
- public void setRequiredToCMD(boolean requiredToCMD) {
- this.requiredToCMD = requiredToCMD;
- }
-
- public boolean isDataStaged() {
- return dataStaged;
- }
-
- public void setDataStaged(boolean dataStaged) {
- this.dataStaged = dataStaged;
- }
-
- public int getInputOrder() {
- return inputOrder;
- }
-
- public void setInputOrder(int inputOrder) {
- this.inputOrder = inputOrder;
- }
-
- public String getAppArgument() {
- return appArgument;
- }
-
- public void setAppArgument(String appArgument) {
- this.appArgument = appArgument;
- }
-
- public boolean isStandardInput() {
- return standardInput;
- }
-
- public void setStandardInput(boolean standardInput) {
- this.standardInput = standardInput;
- }
-
- public String getUserFriendlyDesc() {
- return userFriendlyDesc;
- }
-
- public void setUserFriendlyDesc(String userFriendlyDesc) {
- this.userFriendlyDesc = userFriendlyDesc;
- }
-
- public String getInputKey() {
- return inputKey;
- }
-
- public void setInputKey(String inputKey) {
- this.inputKey = inputKey;
- }
-
- public String getDataType() {
- return dataType;
- }
-
- public void setDataType(String dataType) {
- this.dataType = dataType;
- }
-
- public String getMetadata() {
- return metadata;
- }
-
- public void setMetadata(String metadata) {
- this.metadata = metadata;
- }
-
- public String getValue() {
- return value;
- }
-
- public void setValue(String value) {
- this.value = value;
- }
-
- public Resource create(ResourceType type) throws RegistryException {
- logger.error("Unsupported resource type for application input data resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
-
- public void remove(ResourceType type, Object name) throws RegistryException{
- logger.error("Unsupported resource type for application input data resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
-
- public Resource get(ResourceType type, Object name) throws RegistryException {
- logger.error("Unsupported resource type for application input data resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
-
- public List<Resource> get(ResourceType type) throws RegistryException{
- logger.error("Unsupported resource type for application input data resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
-
- public void save() throws RegistryException {
- EntityManager em = null;
- try {
- em = ResourceUtils.getEntityManager();
- ApplicationInput existingInput = em.find(ApplicationInput.class, new ApplicationInput_PK(inputKey, taskId));
- em.close();
-
- em = ResourceUtils.getEntityManager();
- em.getTransaction().begin();
- ApplicationInput applicationInput = new ApplicationInput();
- applicationInput.setTaskId(taskId);
- applicationInput.setInputKey(inputKey);
- applicationInput.setDataType(dataType);
- applicationInput.setAppArgument(appArgument);
- applicationInput.setStandardInput(standardInput);
- applicationInput.setUserFriendlyDesc(userFriendlyDesc);
- applicationInput.setInputOrder(inputOrder);
- applicationInput.setRequiredToCMD(requiredToCMD);
- applicationInput.setRequired(isRequired);
- applicationInput.setDataStaged(dataStaged);
- if (value != null) {
- applicationInput.setValue(value.toCharArray());
- }
-
- applicationInput.setMetadata(metadata);
-
- if (existingInput != null) {
- existingInput.setTaskId(taskId);
- existingInput.setInputKey(inputKey);
- existingInput.setDataType(dataType);
- existingInput.setAppArgument(appArgument);
- existingInput.setStandardInput(standardInput);
- existingInput.setUserFriendlyDesc(userFriendlyDesc);
- existingInput.setInputOrder(inputOrder);
- existingInput.setRequiredToCMD(requiredToCMD);
- existingInput.setRequired(isRequired);
- existingInput.setDataStaged(dataStaged);
- if (value != null) {
- existingInput.setValue(value.toCharArray());
- }
- existingInput.setMetadata(metadata);
- applicationInput = em.merge(existingInput);
- } else {
- em.persist(applicationInput);
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- throw new RegistryException(e.getMessage());
- } 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/ec8c6202/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/ApplicationOutputResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/ApplicationOutputResource.java b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/ApplicationOutputResource.java
deleted file mode 100644
index a1c3b5a..0000000
--- a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/ApplicationOutputResource.java
+++ /dev/null
@@ -1,208 +0,0 @@
-/*
- *
- * 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.experiment.catalog.resources;
-
-import java.util.List;
-
-import javax.persistence.EntityManager;
-
-import org.apache.airavata.experiment.catalog.Resource;
-import org.apache.airavata.experiment.catalog.ResourceType;
-import org.apache.airavata.experiment.catalog.ResourceUtils;
-import org.apache.airavata.experiment.catalog.model.ApplicationOutput;
-import org.apache.airavata.experiment.catalog.model.ApplicationOutput_PK;
-import org.apache.airavata.registry.cpi.RegistryException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class ApplicationOutputResource extends AbstractResource {
- private static final Logger logger = LoggerFactory.getLogger(ApplicationOutputResource.class);
- private String taskId;
- private String outputKey;
- private String dataType;
- private String value;
- private boolean isRequired;
- private boolean dataMovement;
- private String dataNameLocation;
- private boolean requiredToCMD;
- private String searchQuery;
- private String appArgument;
-
- public String getSearchQuery() {
- return searchQuery;
- }
-
- public void setSearchQuery(String searchQuery) {
- this.searchQuery = searchQuery;
- }
-
- public String getAppArgument() {
- return appArgument;
- }
-
- public void setAppArgument(String appArgument) {
- this.appArgument = appArgument;
- }
-
- public boolean isRequired() {
- return isRequired;
- }
-
- public void setRequired(boolean isRequired) {
- this.isRequired = isRequired;
- }
-
- public boolean isRequiredToCMD() {
- return requiredToCMD;
- }
-
- public void setRequiredToCMD(boolean requiredToCMD) {
- this.requiredToCMD = requiredToCMD;
- }
-
- public boolean isDataMovement() {
- return dataMovement;
- }
-
- public void setDataMovement(boolean dataMovement) {
- this.dataMovement = dataMovement;
- }
-
- public String getDataNameLocation() {
- return dataNameLocation;
- }
-
- public void setDataNameLocation(String dataNameLocation) {
- this.dataNameLocation = dataNameLocation;
- }
-
- public String getOutputKey() {
- return outputKey;
- }
-
- public void setOutputKey(String outputKey) {
- this.outputKey = outputKey;
- }
-
- public String getDataType() {
- return dataType;
- }
-
- public void setDataType(String dataType) {
- this.dataType = dataType;
- }
-
- public String getValue() {
- return value;
- }
-
- public void setValue(String value) {
- this.value = value;
- }
-
- public String getTaskId() {
- return taskId;
- }
-
- public void setTaskId(String taskId) {
- this.taskId = taskId;
- }
-
- public Resource create(ResourceType type) throws RegistryException {
- logger.error("Unsupported resource type for application output data resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
-
- public void remove(ResourceType type, Object name) throws RegistryException{
- logger.error("Unsupported resource type for application output data resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
-
- public Resource get(ResourceType type, Object name) throws RegistryException{
- logger.error("Unsupported resource type for application output data resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
-
- public List<Resource> get(ResourceType type) throws RegistryException{
- logger.error("Unsupported resource type for application output data resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
-
- public void save() throws RegistryException {
- EntityManager em = null;
- try {
- em = ResourceUtils.getEntityManager();
- ApplicationOutput existingOutput = em.find(ApplicationOutput.class, new ApplicationOutput_PK(outputKey, taskId));
- em.close();
-
- em = ResourceUtils.getEntityManager();
- em.getTransaction().begin();
- ApplicationOutput applicationOutput = new ApplicationOutput();
- applicationOutput.setTaskId(taskId);
- applicationOutput.setOutputKey(outputKey);
- applicationOutput.setDataType(dataType);
- applicationOutput.setRequired(isRequired);
- applicationOutput.setAddedToCmd(requiredToCMD);
- applicationOutput.setDataMovement(dataMovement);
- applicationOutput.setDataNameLocation(dataNameLocation);
- applicationOutput.setSearchQuery(searchQuery);
- applicationOutput.setApplicationArgument(appArgument);
- if (value != null){
- applicationOutput.setValue(value.toCharArray());
- }
-
- if (existingOutput != null) {
- existingOutput.setTaskId(taskId);
- existingOutput.setOutputKey(outputKey);
- existingOutput.setDataType(dataType);
- existingOutput.setRequired(isRequired);
- existingOutput.setAddedToCmd(requiredToCMD);
- existingOutput.setDataMovement(dataMovement);
- existingOutput.setDataNameLocation(dataNameLocation);
- existingOutput.setSearchQuery(searchQuery);
- existingOutput.setApplicationArgument(appArgument);
- if (value != null){
- existingOutput.setValue(value.toCharArray());
- }
- applicationOutput = em.merge(existingOutput);
- } else {
- em.persist(applicationOutput);
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new RegistryException(e.getMessage());
- } 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/ec8c6202/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/ComputationSchedulingResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/ComputationSchedulingResource.java b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/ComputationSchedulingResource.java
deleted file mode 100644
index 506e603..0000000
--- a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/ComputationSchedulingResource.java
+++ /dev/null
@@ -1,221 +0,0 @@
-/*
- *
- * 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.experiment.catalog.resources;
-
-import org.apache.airavata.experiment.catalog.Resource;
-import org.apache.airavata.experiment.catalog.ResourceType;
-import org.apache.airavata.experiment.catalog.ResourceUtils;
-import org.apache.airavata.experiment.catalog.model.Computational_Resource_Scheduling;
-import org.apache.airavata.registry.cpi.RegistryException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.persistence.EntityManager;
-import java.sql.Timestamp;
-import java.util.List;
-
-public class ComputationSchedulingResource extends AbstractResource {
- private static final Logger logger = LoggerFactory.getLogger(ComputationSchedulingResource.class);
- private int schedulingId = 0;
- private String experimentId;
- private String taskId;
- private String resourceHostId;
- private int cpuCount;
- private int nodeCount;
- private int numberOfThreads;
- private String queueName;
- private int walltimeLimit;
- private Timestamp jobStartTime;
- private int physicalMemory;
- private String projectName;
- private String chessisName;
-
- public String getChessisName() {
- return chessisName;
- }
-
- public void setChessisName(String chessisName) {
- this.chessisName = chessisName;
- }
-
- public int getSchedulingId() {
- return schedulingId;
- }
-
- public void setSchedulingId(int schedulingId) {
- this.schedulingId = schedulingId;
- }
-
- public String getExperimentId() {
- return experimentId;
- }
-
- public void setExperimentId(String experimentId) {
- this.experimentId = experimentId;
- }
-
- public String getTaskId() {
- return taskId;
- }
-
- public void setTaskId(String taskId) {
- this.taskId = taskId;
- }
-
- public String getResourceHostId() {
- return resourceHostId;
- }
-
- public void setResourceHostId(String resourceHostId) {
- this.resourceHostId = resourceHostId;
- }
-
- public int getCpuCount() {
- return cpuCount;
- }
-
- public void setCpuCount(int cpuCount) {
- this.cpuCount = cpuCount;
- }
-
- public int getNodeCount() {
- return nodeCount;
- }
-
- public void setNodeCount(int nodeCount) {
- this.nodeCount = nodeCount;
- }
-
- public int getNumberOfThreads() {
- return numberOfThreads;
- }
-
- public void setNumberOfThreads(int numberOfThreads) {
- this.numberOfThreads = numberOfThreads;
- }
-
- public String getQueueName() {
- return queueName;
- }
-
- public void setQueueName(String queueName) {
- this.queueName = queueName;
- }
-
- public int getWalltimeLimit() {
- return walltimeLimit;
- }
-
- public void setWalltimeLimit(int walltimeLimit) {
- this.walltimeLimit = walltimeLimit;
- }
-
- public Timestamp getJobStartTime() {
- return jobStartTime;
- }
-
- public void setJobStartTime(Timestamp jobStartTime) {
- this.jobStartTime = jobStartTime;
- }
-
- public int getPhysicalMemory() {
- return physicalMemory;
- }
-
- public void setPhysicalMemory(int physicalMemory) {
- this.physicalMemory = physicalMemory;
- }
-
- public String getProjectName() {
- return projectName;
- }
-
- public void setProjectName(String projectName) {
- this.projectName = projectName;
- }
-
-
- public Resource create(ResourceType type) throws RegistryException {
- logger.error("Unsupported resource type for computational scheduling resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
-
- public void remove(ResourceType type, Object name) throws RegistryException{
- logger.error("Unsupported resource type for computational scheduling resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
-
- public Resource get(ResourceType type, Object name) throws RegistryException{
- logger.error("Unsupported resource type for computational scheduling resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
-
- public List<Resource> get(ResourceType type) throws RegistryException{
- logger.error("Unsupported resource type for computational scheduling resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
-
- public void save() throws RegistryException{
- EntityManager em = null;
- try {
- em = ResourceUtils.getEntityManager();
- em.getTransaction().begin();
- Computational_Resource_Scheduling scheduling;
- if (schedulingId != 0) {
- scheduling = em.find(Computational_Resource_Scheduling.class, schedulingId);
- scheduling.setSchedulingId(schedulingId);
- } else {
- scheduling = new Computational_Resource_Scheduling();
- }
- scheduling.setExpId(experimentId);
- scheduling.setTaskId(taskId);
- scheduling.setResourceHostId(resourceHostId);
- scheduling.setCpuCount(cpuCount);
- scheduling.setNodeCount(nodeCount);
- scheduling.setNumberOfThreads(numberOfThreads);
- scheduling.setQueueName(queueName);
- scheduling.setWallTimeLimit(walltimeLimit);
- scheduling.setJobStartTime(jobStartTime);
- scheduling.setTotalPhysicalmemory(physicalMemory);
- scheduling.setProjectName(projectName);
- scheduling.setChessisName(chessisName);
- em.persist(scheduling);
- schedulingId = scheduling.getSchedulingId();
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new RegistryException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-}
[09/52] [abbrv] [partial] airavata git commit: registry refactoring
Posted by sh...@apache.org.
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/HostIPAddressResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/HostIPAddressResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/HostIPAddressResource.java
new file mode 100644
index 0000000..683efec
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/HostIPAddressResource.java
@@ -0,0 +1,318 @@
+/**
+ * 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.aiaravata.application.catalog.data.resources;
+
+import org.airavata.appcatalog.cpi.AppCatalogException;
+import org.apache.aiaravata.application.catalog.data.model.ComputeResource;
+import org.apache.aiaravata.application.catalog.data.model.HostIPAddress;
+import org.apache.aiaravata.application.catalog.data.model.HostIPAddressPK;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogJPAUtils;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogQueryGenerator;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogResourceType;
+import org.apache.airavata.common.exception.ApplicationSettingsException;
+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 HostIPAddressResource extends AbstractResource{
+
+ private final static Logger logger = LoggerFactory.getLogger(HostIPAddressResource.class);
+
+ private String resourceID;
+ private String ipaddress;
+ private ComputeResourceResource computeHostResource;
+
+ public void remove(Object identifier) throws AppCatalogException {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator= new AppCatalogQueryGenerator(HOST_IPADDRESS);
+ generator.setParameter(HostIPAddressConstants.RESOURCE_ID, identifier);
+ 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();
+ }
+ }
+
+ }
+
+ public Resource 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(HOST_IPADDRESS);
+ generator.setParameter(HostIPAddressConstants.RESOURCE_ID, ids.get(HostIPAddressConstants.RESOURCE_ID));
+ generator.setParameter(HostIPAddressConstants.IP_ADDRESS, ids.get(HostIPAddressConstants.IP_ADDRESS));
+ Query q = generator.selectQuery(em);
+ HostIPAddress hostIPAddress = (HostIPAddress) q.getSingleResult();
+ HostIPAddressResource hostIPAddressResource =
+ (HostIPAddressResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.HOST_IPADDRESS, hostIPAddress);
+ em.getTransaction().commit();
+ em.close();
+ return hostIPAddressResource;
+ } 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();
+ }
+ }
+ }
+
+ public List<Resource> get(String fieldName, Object value) throws AppCatalogException {
+
+ List<Resource> hostIPAddressResources = new ArrayList<Resource>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ Query q;
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(HOST_IPADDRESS);
+ List results;
+ if (fieldName.equals(HostIPAddressConstants.IP_ADDRESS)) {
+ generator.setParameter(HostIPAddressConstants.IP_ADDRESS, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ HostIPAddress hostIPAddress = (HostIPAddress) result;
+ HostIPAddressResource hostIPAddressResource =
+ (HostIPAddressResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.HOST_IPADDRESS, hostIPAddress);
+ hostIPAddressResources.add(hostIPAddressResource);
+ }
+ }
+ } else if (fieldName.equals(HostIPAddressConstants.RESOURCE_ID)) {
+ generator.setParameter(HostIPAddressConstants.RESOURCE_ID, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ HostIPAddress hostIPAddress = (HostIPAddress) result;
+ HostIPAddressResource hostIPAddressResource =
+ (HostIPAddressResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.HOST_IPADDRESS, hostIPAddress);
+ hostIPAddressResources.add(hostIPAddressResource);
+ }
+ }
+ } else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for Host IPAddress Resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for Host IPAddress 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 hostIPAddressResources;
+ }
+
+ @Override
+ public List<Resource> getAll() throws AppCatalogException {
+ return null;
+ }
+
+ @Override
+ public List<String> getAllIds() throws AppCatalogException {
+ return null;
+ }
+
+ public List<String> getIds(String fieldName, Object value) throws AppCatalogException {
+
+ List<String> hostIPAddressResourceIDs = new ArrayList<String>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ Query q;
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(HOST_IPADDRESS);
+ List results;
+ if (fieldName.equals(HostIPAddressConstants.IP_ADDRESS)) {
+ generator.setParameter(HostIPAddressConstants.IP_ADDRESS, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ HostIPAddress hostIPAddress = (HostIPAddress) result;
+ hostIPAddressResourceIDs.add(hostIPAddress.getResourceID());
+ }
+ }
+ } else if (fieldName.equals(HostIPAddressConstants.RESOURCE_ID)) {
+ generator.setParameter(HostIPAddressConstants.RESOURCE_ID, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ HostIPAddress hostIPAddress = (HostIPAddress) result;
+ hostIPAddressResourceIDs.add(hostIPAddress.getResourceID());
+ }
+ }
+ } else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for Host IP Address resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for Host IPAddress 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 hostIPAddressResourceIDs;
+ }
+
+ public void save() throws AppCatalogException {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ HostIPAddress existingHostIP = em.find(HostIPAddress.class, new HostIPAddressPK(resourceID,ipaddress));
+ em.close();
+
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ ComputeResource computeResource = em.find(ComputeResource.class, resourceID);
+ if (existingHostIP != null){
+ existingHostIP.setIpaddress(ipaddress);
+ existingHostIP.setResourceID(resourceID);
+ existingHostIP.setComputeResource(computeResource);
+ em.merge(existingHostIP);
+ }else {
+ HostIPAddress hostIPAddress = new HostIPAddress();
+ hostIPAddress.setIpaddress(ipaddress);
+ hostIPAddress.setResourceID(resourceID);
+ hostIPAddress.setComputeResource(computeResource);
+ em.persist(hostIPAddress);
+ }
+ 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();
+ }
+ }
+
+ }
+
+ 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();
+ HostIPAddress hostIPAddress = em.find(HostIPAddress.class, new HostIPAddressPK(ids.get(HostIPAddressConstants.RESOURCE_ID),
+ ids.get(HostIPAddressConstants.IP_ADDRESS)));
+
+ em.close();
+ return hostIPAddress != null;
+ } 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();
+ }
+ }
+ }
+
+ public String getResourceID() {
+ return resourceID;
+ }
+
+ public void setResourceID(String resourceID) {
+ this.resourceID = resourceID;
+ }
+
+ public String getIpaddress() {
+ return ipaddress;
+ }
+
+ public void setIpaddress(String ipaddress) {
+ this.ipaddress = ipaddress;
+ }
+
+ public ComputeResourceResource getComputeHostResource() {
+ return computeHostResource;
+ }
+
+ public void setComputeHostResource(ComputeResourceResource computeHostResource) {
+ this.computeHostResource = computeHostResource;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/JobManagerCommandAppCatalogResourceAppCat.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/JobManagerCommandAppCatalogResourceAppCat.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/JobManagerCommandAppCatalogResourceAppCat.java
new file mode 100644
index 0000000..a3c5e8f
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/JobManagerCommandAppCatalogResourceAppCat.java
@@ -0,0 +1,307 @@
+/*
+ *
+ * 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 java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.persistence.EntityManager;
+import javax.persistence.Query;
+
+import org.apache.airavata.common.exception.ApplicationSettingsException;
+import org.apache.airavata.registry.core.app.catalog.model.JobManagerCommand;
+import org.apache.airavata.registry.core.app.catalog.model.JobManagerCommand_PK;
+import org.apache.airavata.registry.core.app.catalog.model.ResourceJobManager;
+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;
+
+public class JobManagerCommandAppCatalogResourceAppCat extends AppCatAbstractResource {
+ private final static Logger logger = LoggerFactory.getLogger(JobManagerCommandAppCatalogResourceAppCat.class);
+ private String resourceJobManagerId;
+ private ResourceJobManagerAppCatalogResourceAppCat resourceJobManagerResource;
+ private String commandType;
+ private String command;
+
+ @Override
+ public void remove(Object identifier) throws AppCatalogException {
+ HashMap<String, String> ids;
+ if (identifier instanceof Map) {
+ ids = (HashMap<String, String>) 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(JOB_MANAGER_COMMAND);
+ generator.setParameter(JobManagerCommandConstants.RESOURCE_JOB_MANAGER_ID, ids.get(JobManagerCommandConstants.RESOURCE_JOB_MANAGER_ID));
+ generator.setParameter(JobManagerCommandConstants.COMMAND_TYPE, ids.get(JobManagerCommandConstants.COMMAND_TYPE));
+ 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<String, String>) 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(JOB_MANAGER_COMMAND);
+ generator.setParameter(JobManagerCommandConstants.RESOURCE_JOB_MANAGER_ID, ids.get(JobManagerCommandConstants.RESOURCE_JOB_MANAGER_ID));
+ generator.setParameter(JobManagerCommandConstants.COMMAND_TYPE, ids.get(JobManagerCommandConstants.COMMAND_TYPE));
+ Query q = generator.selectQuery(em);
+ JobManagerCommand jobManagerCommand = (JobManagerCommand) q.getSingleResult();
+ JobManagerCommandAppCatalogResourceAppCat jobManagerCommandResource = (JobManagerCommandAppCatalogResourceAppCat) AppCatalogJPAUtils.getResource(AppCatalogResourceType.JOB_MANAGER_COMMAND, jobManagerCommand);
+ em.getTransaction().commit();
+ em.close();
+ return jobManagerCommandResource;
+ } 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> jobManagerCommandResources = new ArrayList<AppCatalogResource>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(JOB_MANAGER_COMMAND);
+ Query q;
+ if ((fieldName.equals(JobManagerCommandConstants.RESOURCE_JOB_MANAGER_ID)) || (fieldName.equals(JobManagerCommandConstants.COMMAND_TYPE)) || (fieldName.equals(JobManagerCommandConstants.COMMAND))) {
+ generator.setParameter(fieldName, value);
+ q = generator.selectQuery(em);
+ List<?> results = q.getResultList();
+ for (Object result : results) {
+ JobManagerCommand jobManagerCommand = (JobManagerCommand) result;
+ JobManagerCommandAppCatalogResourceAppCat jobManagerCommandResource = (JobManagerCommandAppCatalogResourceAppCat) AppCatalogJPAUtils.getResource(AppCatalogResourceType.JOB_MANAGER_COMMAND, jobManagerCommand);
+ jobManagerCommandResources.add(jobManagerCommandResource);
+ }
+ } else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for Job Manager Command Resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for Job Manager Command Resource.");
+ }
+ 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();
+ }
+ }
+ return jobManagerCommandResources;
+ }
+
+ @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 {
+ List<String> jobManagerCommandResourceIDs = new ArrayList<String>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(JOB_MANAGER_COMMAND);
+ Query q;
+ if ((fieldName.equals(JobManagerCommandConstants.RESOURCE_JOB_MANAGER_ID)) || (fieldName.equals(JobManagerCommandConstants.COMMAND_TYPE)) || (fieldName.equals(JobManagerCommandConstants.COMMAND))) {
+ generator.setParameter(fieldName, value);
+ q = generator.selectQuery(em);
+ List<?> results = q.getResultList();
+ for (Object result : results) {
+ JobManagerCommand jobManagerCommand = (JobManagerCommand) result;
+ JobManagerCommandAppCatalogResourceAppCat jobManagerCommandResource = (JobManagerCommandAppCatalogResourceAppCat) AppCatalogJPAUtils.getResource(AppCatalogResourceType.JOB_MANAGER_COMMAND, jobManagerCommand);
+ jobManagerCommandResourceIDs.add(jobManagerCommandResource.getResourceJobManagerId());
+ }
+ } else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for Job Manager Command Resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for Job Manager Command Resource.");
+ }
+ 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();
+ }
+ }
+ return jobManagerCommandResourceIDs;
+ }
+
+ @Override
+ public void save() throws AppCatalogException {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ JobManagerCommand existingJobManagerCommand = em.find(JobManagerCommand.class, new JobManagerCommand_PK(resourceJobManagerId, commandType));
+ em.close();
+ JobManagerCommand jobManagerCommand;
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ if (existingJobManagerCommand == null) {
+ jobManagerCommand = new JobManagerCommand();
+ } else {
+ jobManagerCommand = existingJobManagerCommand;
+ }
+ jobManagerCommand.setResourceJobManagerId(getResourceJobManagerId());
+ ResourceJobManager resourceJobManager = em.find(ResourceJobManager.class, getResourceJobManagerId());
+ jobManagerCommand.setResourceJobManager(resourceJobManager);
+ jobManagerCommand.setCommandType(getCommandType());
+ jobManagerCommand.setCommand(getCommand());
+ if (existingJobManagerCommand == null) {
+ em.persist(jobManagerCommand);
+ } else {
+ em.merge(jobManagerCommand);
+ }
+ 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<String, String>) 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();
+ JobManagerCommand jobManagerCommand = em.find(JobManagerCommand.class, new JobManagerCommand_PK(ids.get(JobManagerCommandConstants.RESOURCE_JOB_MANAGER_ID), ids.get(JobManagerCommandConstants.COMMAND_TYPE)));
+ em.close();
+ return jobManagerCommand != null;
+ } 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();
+ }
+ }
+ }
+
+ public String getResourceJobManagerId() {
+ return resourceJobManagerId;
+ }
+
+ public ResourceJobManagerAppCatalogResourceAppCat getResourceJobManagerResource() {
+ return resourceJobManagerResource;
+ }
+
+ public String getCommandType() {
+ return commandType;
+ }
+
+ public String getCommand() {
+ return command;
+ }
+
+ public void setResourceJobManagerId(String resourceJobManagerId) {
+ this.resourceJobManagerId=resourceJobManagerId;
+ }
+
+ public void setResourceJobManagerResource(ResourceJobManagerAppCatalogResourceAppCat resourceJobManagerResource) {
+ this.resourceJobManagerResource=resourceJobManagerResource;
+ }
+
+ public void setCommandType(String commandType) {
+ this.commandType=commandType;
+ }
+
+ public void setCommand(String command) {
+ this.command=command;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/JobManagerCommandResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/JobManagerCommandResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/JobManagerCommandResource.java
new file mode 100644
index 0000000..e177cd3
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/JobManagerCommandResource.java
@@ -0,0 +1,307 @@
+/*
+ *
+ * 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.aiaravata.application.catalog.data.resources;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.persistence.EntityManager;
+import javax.persistence.Query;
+
+import org.airavata.appcatalog.cpi.AppCatalogException;
+import org.apache.aiaravata.application.catalog.data.model.JobManagerCommand;
+import org.apache.aiaravata.application.catalog.data.model.JobManagerCommand_PK;
+import org.apache.aiaravata.application.catalog.data.model.ResourceJobManager;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogJPAUtils;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogQueryGenerator;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogResourceType;
+import org.apache.airavata.common.exception.ApplicationSettingsException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class JobManagerCommandResource extends AbstractResource {
+ private final static Logger logger = LoggerFactory.getLogger(JobManagerCommandResource.class);
+ private String resourceJobManagerId;
+ private ResourceJobManagerResource resourceJobManagerResource;
+ private String commandType;
+ private String command;
+
+ @Override
+ public void remove(Object identifier) throws AppCatalogException {
+ HashMap<String, String> ids;
+ if (identifier instanceof Map) {
+ ids = (HashMap<String, String>) 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(JOB_MANAGER_COMMAND);
+ generator.setParameter(JobManagerCommandConstants.RESOURCE_JOB_MANAGER_ID, ids.get(JobManagerCommandConstants.RESOURCE_JOB_MANAGER_ID));
+ generator.setParameter(JobManagerCommandConstants.COMMAND_TYPE, ids.get(JobManagerCommandConstants.COMMAND_TYPE));
+ 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 Resource get(Object identifier) throws AppCatalogException {
+ HashMap<String, String> ids;
+ if (identifier instanceof Map) {
+ ids = (HashMap<String, String>) 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(JOB_MANAGER_COMMAND);
+ generator.setParameter(JobManagerCommandConstants.RESOURCE_JOB_MANAGER_ID, ids.get(JobManagerCommandConstants.RESOURCE_JOB_MANAGER_ID));
+ generator.setParameter(JobManagerCommandConstants.COMMAND_TYPE, ids.get(JobManagerCommandConstants.COMMAND_TYPE));
+ Query q = generator.selectQuery(em);
+ JobManagerCommand jobManagerCommand = (JobManagerCommand) q.getSingleResult();
+ JobManagerCommandResource jobManagerCommandResource = (JobManagerCommandResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.JOB_MANAGER_COMMAND, jobManagerCommand);
+ em.getTransaction().commit();
+ em.close();
+ return jobManagerCommandResource;
+ } 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<Resource> get(String fieldName, Object value) throws AppCatalogException {
+ List<Resource> jobManagerCommandResources = new ArrayList<Resource>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(JOB_MANAGER_COMMAND);
+ Query q;
+ if ((fieldName.equals(JobManagerCommandConstants.RESOURCE_JOB_MANAGER_ID)) || (fieldName.equals(JobManagerCommandConstants.COMMAND_TYPE)) || (fieldName.equals(JobManagerCommandConstants.COMMAND))) {
+ generator.setParameter(fieldName, value);
+ q = generator.selectQuery(em);
+ List<?> results = q.getResultList();
+ for (Object result : results) {
+ JobManagerCommand jobManagerCommand = (JobManagerCommand) result;
+ JobManagerCommandResource jobManagerCommandResource = (JobManagerCommandResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.JOB_MANAGER_COMMAND, jobManagerCommand);
+ jobManagerCommandResources.add(jobManagerCommandResource);
+ }
+ } else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for Job Manager Command Resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for Job Manager Command Resource.");
+ }
+ 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();
+ }
+ }
+ return jobManagerCommandResources;
+ }
+
+ @Override
+ public List<Resource> 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 {
+ List<String> jobManagerCommandResourceIDs = new ArrayList<String>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(JOB_MANAGER_COMMAND);
+ Query q;
+ if ((fieldName.equals(JobManagerCommandConstants.RESOURCE_JOB_MANAGER_ID)) || (fieldName.equals(JobManagerCommandConstants.COMMAND_TYPE)) || (fieldName.equals(JobManagerCommandConstants.COMMAND))) {
+ generator.setParameter(fieldName, value);
+ q = generator.selectQuery(em);
+ List<?> results = q.getResultList();
+ for (Object result : results) {
+ JobManagerCommand jobManagerCommand = (JobManagerCommand) result;
+ JobManagerCommandResource jobManagerCommandResource = (JobManagerCommandResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.JOB_MANAGER_COMMAND, jobManagerCommand);
+ jobManagerCommandResourceIDs.add(jobManagerCommandResource.getResourceJobManagerId());
+ }
+ } else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for Job Manager Command Resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for Job Manager Command Resource.");
+ }
+ 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();
+ }
+ }
+ return jobManagerCommandResourceIDs;
+ }
+
+ @Override
+ public void save() throws AppCatalogException {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ JobManagerCommand existingJobManagerCommand = em.find(JobManagerCommand.class, new JobManagerCommand_PK(resourceJobManagerId, commandType));
+ em.close();
+ JobManagerCommand jobManagerCommand;
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ if (existingJobManagerCommand == null) {
+ jobManagerCommand = new JobManagerCommand();
+ } else {
+ jobManagerCommand = existingJobManagerCommand;
+ }
+ jobManagerCommand.setResourceJobManagerId(getResourceJobManagerId());
+ ResourceJobManager resourceJobManager = em.find(ResourceJobManager.class, getResourceJobManagerId());
+ jobManagerCommand.setResourceJobManager(resourceJobManager);
+ jobManagerCommand.setCommandType(getCommandType());
+ jobManagerCommand.setCommand(getCommand());
+ if (existingJobManagerCommand == null) {
+ em.persist(jobManagerCommand);
+ } else {
+ em.merge(jobManagerCommand);
+ }
+ 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<String, String>) 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();
+ JobManagerCommand jobManagerCommand = em.find(JobManagerCommand.class, new JobManagerCommand_PK(ids.get(JobManagerCommandConstants.RESOURCE_JOB_MANAGER_ID), ids.get(JobManagerCommandConstants.COMMAND_TYPE)));
+ em.close();
+ return jobManagerCommand != null;
+ } 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();
+ }
+ }
+ }
+
+ public String getResourceJobManagerId() {
+ return resourceJobManagerId;
+ }
+
+ public ResourceJobManagerResource getResourceJobManagerResource() {
+ return resourceJobManagerResource;
+ }
+
+ public String getCommandType() {
+ return commandType;
+ }
+
+ public String getCommand() {
+ return command;
+ }
+
+ public void setResourceJobManagerId(String resourceJobManagerId) {
+ this.resourceJobManagerId=resourceJobManagerId;
+ }
+
+ public void setResourceJobManagerResource(ResourceJobManagerResource resourceJobManagerResource) {
+ this.resourceJobManagerResource=resourceJobManagerResource;
+ }
+
+ public void setCommandType(String commandType) {
+ this.commandType=commandType;
+ }
+
+ public void setCommand(String command) {
+ this.command=command;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/JobSubmissionInterfaceAppCatalogResourceAppCat.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/JobSubmissionInterfaceAppCatalogResourceAppCat.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/JobSubmissionInterfaceAppCatalogResourceAppCat.java
new file mode 100644
index 0000000..ab34dff
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/JobSubmissionInterfaceAppCatalogResourceAppCat.java
@@ -0,0 +1,339 @@
+/*
+ *
+ * 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 java.sql.Timestamp;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.persistence.EntityManager;
+import javax.persistence.Query;
+
+import org.apache.airavata.common.exception.ApplicationSettingsException;
+import org.apache.airavata.common.utils.AiravataUtils;
+import org.apache.airavata.registry.core.app.catalog.model.ComputeResource;
+import org.apache.airavata.registry.core.app.catalog.model.JobSubmissionInterface;
+import org.apache.airavata.registry.core.app.catalog.model.JobSubmissionInterface_PK;
+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;
+
+public class JobSubmissionInterfaceAppCatalogResourceAppCat extends AppCatAbstractResource {
+ private final static Logger logger = LoggerFactory.getLogger(JobSubmissionInterfaceAppCatalogResourceAppCat.class);
+ private String jobSubmissionInterfaceId;
+ private String computeResourceId;
+ private ComputeResourceAppCatalogResourceAppCat computeHostResource;
+ private String jobSubmissionProtocol;
+ private int priorityOrder;
+ private Timestamp createdTime;
+ private Timestamp updatedTime;
+
+ public Timestamp getCreatedTime() {
+ return createdTime;
+ }
+
+ public void setCreatedTime(Timestamp createdTime) {
+ this.createdTime = createdTime;
+ }
+
+ public Timestamp getUpdatedTime() {
+ return updatedTime;
+ }
+
+ public void setUpdatedTime(Timestamp updatedTime) {
+ this.updatedTime = updatedTime;
+ }
+
+ @Override
+ public void remove(Object identifier) throws AppCatalogException {
+ HashMap<String, String> ids;
+ if (identifier instanceof Map) {
+ ids = (HashMap<String, String>) 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(JOB_SUBMISSION_INTERFACE);
+ generator.setParameter(JobSubmissionInterfaceConstants.JOB_SUBMISSION_INTERFACE_ID, ids.get(JobSubmissionInterfaceConstants.JOB_SUBMISSION_INTERFACE_ID));
+ generator.setParameter(JobSubmissionInterfaceConstants.COMPUTE_RESOURCE_ID, ids.get(JobSubmissionInterfaceConstants.COMPUTE_RESOURCE_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<String, String>) 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(JOB_SUBMISSION_INTERFACE);
+ generator.setParameter(JobSubmissionInterfaceConstants.JOB_SUBMISSION_INTERFACE_ID, ids.get(JobSubmissionInterfaceConstants.JOB_SUBMISSION_INTERFACE_ID));
+ generator.setParameter(JobSubmissionInterfaceConstants.COMPUTE_RESOURCE_ID, ids.get(JobSubmissionInterfaceConstants.COMPUTE_RESOURCE_ID));
+ Query q = generator.selectQuery(em);
+ JobSubmissionInterface jobSubmissionInterface = (JobSubmissionInterface) q.getSingleResult();
+ JobSubmissionInterfaceAppCatalogResourceAppCat jobSubmissionInterfaceResource = (JobSubmissionInterfaceAppCatalogResourceAppCat) AppCatalogJPAUtils.getResource(AppCatalogResourceType.JOB_SUBMISSION_INTERFACE, jobSubmissionInterface);
+ em.getTransaction().commit();
+ em.close();
+ return jobSubmissionInterfaceResource;
+ } 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> jobSubmissionInterfaceResources = new ArrayList<AppCatalogResource>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(JOB_SUBMISSION_INTERFACE);
+ Query q;
+ if ((fieldName.equals(JobSubmissionInterfaceConstants.JOB_SUBMISSION_INTERFACE_ID)) || (fieldName.equals(JobSubmissionInterfaceConstants.COMPUTE_RESOURCE_ID)) || (fieldName.equals(JobSubmissionInterfaceConstants.JOB_SUBMISSION_PROTOCOL)) || (fieldName.equals(JobSubmissionInterfaceConstants.PRIORITY_ORDER))) {
+ generator.setParameter(fieldName, value);
+ q = generator.selectQuery(em);
+ List<?> results = q.getResultList();
+ for (Object result : results) {
+ JobSubmissionInterface jobSubmissionInterface = (JobSubmissionInterface) result;
+ JobSubmissionInterfaceAppCatalogResourceAppCat jobSubmissionInterfaceResource = (JobSubmissionInterfaceAppCatalogResourceAppCat) AppCatalogJPAUtils.getResource(AppCatalogResourceType.JOB_SUBMISSION_INTERFACE, jobSubmissionInterface);
+ jobSubmissionInterfaceResources.add(jobSubmissionInterfaceResource);
+ }
+ } else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for Job Submission Interface Resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for Job Submission Interface Resource.");
+ }
+ 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();
+ }
+ }
+ return jobSubmissionInterfaceResources;
+ }
+
+ @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 {
+ List<String> jobSubmissionInterfaceResourceIDs = new ArrayList<String>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(JOB_SUBMISSION_INTERFACE);
+ Query q;
+ if ((fieldName.equals(JobSubmissionInterfaceConstants.JOB_SUBMISSION_INTERFACE_ID)) || (fieldName.equals(JobSubmissionInterfaceConstants.COMPUTE_RESOURCE_ID)) || (fieldName.equals(JobSubmissionInterfaceConstants.JOB_SUBMISSION_PROTOCOL)) || (fieldName.equals(JobSubmissionInterfaceConstants.PRIORITY_ORDER))) {
+ generator.setParameter(fieldName, value);
+ q = generator.selectQuery(em);
+ List<?> results = q.getResultList();
+ for (Object result : results) {
+ JobSubmissionInterface jobSubmissionInterface = (JobSubmissionInterface) result;
+ JobSubmissionInterfaceAppCatalogResourceAppCat jobSubmissionInterfaceResource = (JobSubmissionInterfaceAppCatalogResourceAppCat) AppCatalogJPAUtils.getResource(AppCatalogResourceType.JOB_SUBMISSION_INTERFACE, jobSubmissionInterface);
+ jobSubmissionInterfaceResourceIDs.add(jobSubmissionInterfaceResource.getComputeResourceId());
+ }
+ } else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for Job Submission Interface Resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for Job Submission Interface Resource.");
+ }
+ 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();
+ }
+ }
+ return jobSubmissionInterfaceResourceIDs;
+ }
+
+ @Override
+ public void save() throws AppCatalogException {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ JobSubmissionInterface existingJobSubmissionInterface = em.find(JobSubmissionInterface.class, new JobSubmissionInterface_PK(jobSubmissionInterfaceId, computeResourceId));
+ em.close();
+ JobSubmissionInterface jobSubmissionInterface;
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ if (existingJobSubmissionInterface == null) {
+ jobSubmissionInterface = new JobSubmissionInterface();
+ jobSubmissionInterface.setCreationTime(AiravataUtils.getCurrentTimestamp());
+ } else {
+ jobSubmissionInterface = existingJobSubmissionInterface;
+ jobSubmissionInterface.setUpdateTime(AiravataUtils.getCurrentTimestamp());
+ }
+ jobSubmissionInterface.setJobSubmissionInterfaceId(getJobSubmissionInterfaceId());
+ jobSubmissionInterface.setComputeResourceId(getComputeResourceId());
+ ComputeResource computeResource = em.find(ComputeResource.class, getComputeResourceId());
+ jobSubmissionInterface.setComputeResource(computeResource);
+ jobSubmissionInterface.setJobSubmissionProtocol(getJobSubmissionProtocol());
+ jobSubmissionInterface.setPriorityOrder(getPriorityOrder());
+ if (existingJobSubmissionInterface == null) {
+ em.persist(jobSubmissionInterface);
+ } else {
+ em.merge(jobSubmissionInterface);
+ }
+ 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<String, String>) 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();
+ JobSubmissionInterface jobSubmissionInterface = em.find(JobSubmissionInterface.class, new JobSubmissionInterface_PK(ids.get(JobSubmissionInterfaceConstants.JOB_SUBMISSION_INTERFACE_ID), ids.get(JobSubmissionInterfaceConstants.COMPUTE_RESOURCE_ID)));
+ em.close();
+ return jobSubmissionInterface != null;
+ } 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();
+ }
+ }
+ }
+
+ public String getJobSubmissionInterfaceId() {
+ return jobSubmissionInterfaceId;
+ }
+
+ public String getComputeResourceId() {
+ return computeResourceId;
+ }
+
+ public ComputeResourceAppCatalogResourceAppCat getComputeHostResource() {
+ return computeHostResource;
+ }
+
+ public String getJobSubmissionProtocol() {
+ return jobSubmissionProtocol;
+ }
+
+ public int getPriorityOrder() {
+ return priorityOrder;
+ }
+
+ public void setJobSubmissionInterfaceId(String jobSubmissionInterfaceId) {
+ this.jobSubmissionInterfaceId=jobSubmissionInterfaceId;
+ }
+
+ public void setComputeResourceId(String computeResourceId) {
+ this.computeResourceId=computeResourceId;
+ }
+
+ public void setComputeHostResource(ComputeResourceAppCatalogResourceAppCat computeHostResource) {
+ this.computeHostResource=computeHostResource;
+ }
+
+ public void setJobSubmissionProtocol(String jobSubmissionProtocol) {
+ this.jobSubmissionProtocol=jobSubmissionProtocol;
+ }
+
+ public void setPriorityOrder(int priorityOrder) {
+ this.priorityOrder=priorityOrder;
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/JobSubmissionInterfaceResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/JobSubmissionInterfaceResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/JobSubmissionInterfaceResource.java
new file mode 100644
index 0000000..a5acbef
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/JobSubmissionInterfaceResource.java
@@ -0,0 +1,339 @@
+/*
+ *
+ * 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.aiaravata.application.catalog.data.resources;
+
+import java.sql.Timestamp;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.persistence.EntityManager;
+import javax.persistence.Query;
+
+import org.airavata.appcatalog.cpi.AppCatalogException;
+import org.apache.aiaravata.application.catalog.data.model.ComputeResource;
+import org.apache.aiaravata.application.catalog.data.model.JobSubmissionInterface;
+import org.apache.aiaravata.application.catalog.data.model.JobSubmissionInterface_PK;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogJPAUtils;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogQueryGenerator;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogResourceType;
+import org.apache.airavata.common.exception.ApplicationSettingsException;
+import org.apache.airavata.common.utils.AiravataUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class JobSubmissionInterfaceResource extends AbstractResource {
+ private final static Logger logger = LoggerFactory.getLogger(JobSubmissionInterfaceResource.class);
+ private String jobSubmissionInterfaceId;
+ private String computeResourceId;
+ private ComputeResourceResource computeHostResource;
+ private String jobSubmissionProtocol;
+ private int priorityOrder;
+ private Timestamp createdTime;
+ private Timestamp updatedTime;
+
+ public Timestamp getCreatedTime() {
+ return createdTime;
+ }
+
+ public void setCreatedTime(Timestamp createdTime) {
+ this.createdTime = createdTime;
+ }
+
+ public Timestamp getUpdatedTime() {
+ return updatedTime;
+ }
+
+ public void setUpdatedTime(Timestamp updatedTime) {
+ this.updatedTime = updatedTime;
+ }
+
+ @Override
+ public void remove(Object identifier) throws AppCatalogException {
+ HashMap<String, String> ids;
+ if (identifier instanceof Map) {
+ ids = (HashMap<String, String>) 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(JOB_SUBMISSION_INTERFACE);
+ generator.setParameter(JobSubmissionInterfaceConstants.JOB_SUBMISSION_INTERFACE_ID, ids.get(JobSubmissionInterfaceConstants.JOB_SUBMISSION_INTERFACE_ID));
+ generator.setParameter(JobSubmissionInterfaceConstants.COMPUTE_RESOURCE_ID, ids.get(JobSubmissionInterfaceConstants.COMPUTE_RESOURCE_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 Resource get(Object identifier) throws AppCatalogException {
+ HashMap<String, String> ids;
+ if (identifier instanceof Map) {
+ ids = (HashMap<String, String>) 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(JOB_SUBMISSION_INTERFACE);
+ generator.setParameter(JobSubmissionInterfaceConstants.JOB_SUBMISSION_INTERFACE_ID, ids.get(JobSubmissionInterfaceConstants.JOB_SUBMISSION_INTERFACE_ID));
+ generator.setParameter(JobSubmissionInterfaceConstants.COMPUTE_RESOURCE_ID, ids.get(JobSubmissionInterfaceConstants.COMPUTE_RESOURCE_ID));
+ Query q = generator.selectQuery(em);
+ JobSubmissionInterface jobSubmissionInterface = (JobSubmissionInterface) q.getSingleResult();
+ JobSubmissionInterfaceResource jobSubmissionInterfaceResource = (JobSubmissionInterfaceResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.JOB_SUBMISSION_INTERFACE, jobSubmissionInterface);
+ em.getTransaction().commit();
+ em.close();
+ return jobSubmissionInterfaceResource;
+ } 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<Resource> get(String fieldName, Object value) throws AppCatalogException {
+ List<Resource> jobSubmissionInterfaceResources = new ArrayList<Resource>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(JOB_SUBMISSION_INTERFACE);
+ Query q;
+ if ((fieldName.equals(JobSubmissionInterfaceConstants.JOB_SUBMISSION_INTERFACE_ID)) || (fieldName.equals(JobSubmissionInterfaceConstants.COMPUTE_RESOURCE_ID)) || (fieldName.equals(JobSubmissionInterfaceConstants.JOB_SUBMISSION_PROTOCOL)) || (fieldName.equals(JobSubmissionInterfaceConstants.PRIORITY_ORDER))) {
+ generator.setParameter(fieldName, value);
+ q = generator.selectQuery(em);
+ List<?> results = q.getResultList();
+ for (Object result : results) {
+ JobSubmissionInterface jobSubmissionInterface = (JobSubmissionInterface) result;
+ JobSubmissionInterfaceResource jobSubmissionInterfaceResource = (JobSubmissionInterfaceResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.JOB_SUBMISSION_INTERFACE, jobSubmissionInterface);
+ jobSubmissionInterfaceResources.add(jobSubmissionInterfaceResource);
+ }
+ } else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for Job Submission Interface Resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for Job Submission Interface Resource.");
+ }
+ 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();
+ }
+ }
+ return jobSubmissionInterfaceResources;
+ }
+
+ @Override
+ public List<Resource> 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 {
+ List<String> jobSubmissionInterfaceResourceIDs = new ArrayList<String>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(JOB_SUBMISSION_INTERFACE);
+ Query q;
+ if ((fieldName.equals(JobSubmissionInterfaceConstants.JOB_SUBMISSION_INTERFACE_ID)) || (fieldName.equals(JobSubmissionInterfaceConstants.COMPUTE_RESOURCE_ID)) || (fieldName.equals(JobSubmissionInterfaceConstants.JOB_SUBMISSION_PROTOCOL)) || (fieldName.equals(JobSubmissionInterfaceConstants.PRIORITY_ORDER))) {
+ generator.setParameter(fieldName, value);
+ q = generator.selectQuery(em);
+ List<?> results = q.getResultList();
+ for (Object result : results) {
+ JobSubmissionInterface jobSubmissionInterface = (JobSubmissionInterface) result;
+ JobSubmissionInterfaceResource jobSubmissionInterfaceResource = (JobSubmissionInterfaceResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.JOB_SUBMISSION_INTERFACE, jobSubmissionInterface);
+ jobSubmissionInterfaceResourceIDs.add(jobSubmissionInterfaceResource.getComputeResourceId());
+ }
+ } else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for Job Submission Interface Resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for Job Submission Interface Resource.");
+ }
+ 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();
+ }
+ }
+ return jobSubmissionInterfaceResourceIDs;
+ }
+
+ @Override
+ public void save() throws AppCatalogException {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ JobSubmissionInterface existingJobSubmissionInterface = em.find(JobSubmissionInterface.class, new JobSubmissionInterface_PK(jobSubmissionInterfaceId, computeResourceId));
+ em.close();
+ JobSubmissionInterface jobSubmissionInterface;
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ if (existingJobSubmissionInterface == null) {
+ jobSubmissionInterface = new JobSubmissionInterface();
+ jobSubmissionInterface.setCreationTime(AiravataUtils.getCurrentTimestamp());
+ } else {
+ jobSubmissionInterface = existingJobSubmissionInterface;
+ jobSubmissionInterface.setUpdateTime(AiravataUtils.getCurrentTimestamp());
+ }
+ jobSubmissionInterface.setJobSubmissionInterfaceId(getJobSubmissionInterfaceId());
+ jobSubmissionInterface.setComputeResourceId(getComputeResourceId());
+ ComputeResource computeResource = em.find(ComputeResource.class, getComputeResourceId());
+ jobSubmissionInterface.setComputeResource(computeResource);
+ jobSubmissionInterface.setJobSubmissionProtocol(getJobSubmissionProtocol());
+ jobSubmissionInterface.setPriorityOrder(getPriorityOrder());
+ if (existingJobSubmissionInterface == null) {
+ em.persist(jobSubmissionInterface);
+ } else {
+ em.merge(jobSubmissionInterface);
+ }
+ 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<String, String>) 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();
+ JobSubmissionInterface jobSubmissionInterface = em.find(JobSubmissionInterface.class, new JobSubmissionInterface_PK(ids.get(JobSubmissionInterfaceConstants.JOB_SUBMISSION_INTERFACE_ID), ids.get(JobSubmissionInterfaceConstants.COMPUTE_RESOURCE_ID)));
+ em.close();
+ return jobSubmissionInterface != null;
+ } 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();
+ }
+ }
+ }
+
+ public String getJobSubmissionInterfaceId() {
+ return jobSubmissionInterfaceId;
+ }
+
+ public String getComputeResourceId() {
+ return computeResourceId;
+ }
+
+ public ComputeResourceResource getComputeHostResource() {
+ return computeHostResource;
+ }
+
+ public String getJobSubmissionProtocol() {
+ return jobSubmissionProtocol;
+ }
+
+ public int getPriorityOrder() {
+ return priorityOrder;
+ }
+
+ public void setJobSubmissionInterfaceId(String jobSubmissionInterfaceId) {
+ this.jobSubmissionInterfaceId=jobSubmissionInterfaceId;
+ }
+
+ public void setComputeResourceId(String computeResourceId) {
+ this.computeResourceId=computeResourceId;
+ }
+
+ public void setComputeHostResource(ComputeResourceResource computeHostResource) {
+ this.computeHostResource=computeHostResource;
+ }
+
+ public void setJobSubmissionProtocol(String jobSubmissionProtocol) {
+ this.jobSubmissionProtocol=jobSubmissionProtocol;
+ }
+
+ public void setPriorityOrder(int priorityOrder) {
+ this.priorityOrder=priorityOrder;
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/JobSubmissionProtocolResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/JobSubmissionProtocolResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/JobSubmissionProtocolResource.java
new file mode 100644
index 0000000..c3c8315
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/JobSubmissionProtocolResource.java
@@ -0,0 +1,359 @@
+///**
+// * 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.aiaravata.application.catalog.data.resources;
+//
+//import org.apache.airavata.registry.cpi.AppCatalogException;
+//import org.apache.aiaravata.application.catalog.data.model.ComputeResource;
+//import org.apache.aiaravata.application.catalog.data.model.JobSubmissionProtocol;
+//import org.apache.aiaravata.application.catalog.data.model.JobSubmissionProtocolPK;
+//import org.apache.aiaravata.application.catalog.data.util.AppCatalogJPAUtils;
+//import org.apache.aiaravata.application.catalog.data.util.AppCatalogQueryGenerator;
+//import org.apache.aiaravata.application.catalog.data.util.AppCatalogResourceType;
+//import org.apache.airavata.common.exception.ApplicationSettingsException;
+//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 JobSubmissionProtocolResource extends AbstractResource {
+//
+// private final static Logger logger = LoggerFactory.getLogger(JobSubmissionProtocolResource.class);
+//
+// private String resourceID;
+// private String submissionID;
+// private String jobType;
+// private ComputeResourceResource computeHostResource;
+//
+// 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(JOB_SUBMISSION_PROTOCOL);
+// generator.setParameter(JobSubmissionProtocolConstants.RESOURCE_ID, ids.get(JobSubmissionProtocolConstants.RESOURCE_ID));
+// generator.setParameter(JobSubmissionProtocolConstants.SUBMISSION_ID, ids.get(JobSubmissionProtocolConstants.SUBMISSION_ID));
+// generator.setParameter(JobSubmissionProtocolConstants.JOB_TYPE, ids.get(JobSubmissionProtocolConstants.JOB_TYPE));
+// 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();
+// }
+// }
+// }
+//
+// public Resource 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(JOB_SUBMISSION_PROTOCOL);
+// generator.setParameter(JobSubmissionProtocolConstants.RESOURCE_ID, ids.get(JobSubmissionProtocolConstants.RESOURCE_ID));
+// generator.setParameter(JobSubmissionProtocolConstants.SUBMISSION_ID, ids.get(JobSubmissionProtocolConstants.SUBMISSION_ID));
+// generator.setParameter(JobSubmissionProtocolConstants.JOB_TYPE, ids.get(JobSubmissionProtocolConstants.JOB_TYPE));
+// Query q = generator.selectQuery(em);
+// JobSubmissionProtocol jobSubmissionProtocol = (JobSubmissionProtocol) q.getSingleResult();
+// JobSubmissionProtocolResource jobSubmissionProtocolResource =
+// (JobSubmissionProtocolResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.JOB_SUBMISSION_PROTOCOL, jobSubmissionProtocol);
+// em.getTransaction().commit();
+// em.close();
+// return jobSubmissionProtocolResource;
+// } 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();
+// }
+// }
+// }
+//
+// public List<Resource> get(String fieldName, Object value) throws AppCatalogException {
+// List<Resource> jobSubmissionProtocolResourceList = new ArrayList<Resource>();
+// EntityManager em = null;
+// try {
+// em = AppCatalogJPAUtils.getEntityManager();
+// em.getTransaction().begin();
+// Query q;
+// AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(JOB_SUBMISSION_PROTOCOL);
+// List results;
+// if (fieldName.equals(JobSubmissionProtocolConstants.SUBMISSION_ID)) {
+// generator.setParameter(JobSubmissionProtocolConstants.SUBMISSION_ID, value);
+// q = generator.selectQuery(em);
+// results = q.getResultList();
+// if (results.size() != 0) {
+// for (Object result : results) {
+// JobSubmissionProtocol jobSubmissionProtocol = (JobSubmissionProtocol) result;
+// JobSubmissionProtocolResource jobSubmissionProtocolResource =
+// (JobSubmissionProtocolResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.JOB_SUBMISSION_PROTOCOL, jobSubmissionProtocol);
+// jobSubmissionProtocolResourceList.add(jobSubmissionProtocolResource);
+// }
+// }
+// } else if (fieldName.equals(JobSubmissionProtocolConstants.JOB_TYPE)) {
+// generator.setParameter(JobSubmissionProtocolConstants.JOB_TYPE, value);
+// q = generator.selectQuery(em);
+// results = q.getResultList();
+// if (results.size() != 0) {
+// for (Object result : results) {
+// JobSubmissionProtocol jobSubmissionProtocol = (JobSubmissionProtocol) result;
+// JobSubmissionProtocolResource jobSubmissionProtocolResource =
+// (JobSubmissionProtocolResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.JOB_SUBMISSION_PROTOCOL, jobSubmissionProtocol);
+// jobSubmissionProtocolResourceList.add(jobSubmissionProtocolResource);
+// }
+// }
+// } else if (fieldName.equals(HostIPAddressConstants.RESOURCE_ID)) {
+// generator.setParameter(HostIPAddressConstants.RESOURCE_ID, value);
+// q = generator.selectQuery(em);
+// results = q.getResultList();
+// if (results.size() != 0) {
+// for (Object result : results) {
+// JobSubmissionProtocol jobSubmissionProtocol = (JobSubmissionProtocol) result;
+// JobSubmissionProtocolResource jobSubmissionProtocolResource =
+// (JobSubmissionProtocolResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.JOB_SUBMISSION_PROTOCOL, jobSubmissionProtocol);
+// jobSubmissionProtocolResourceList.add(jobSubmissionProtocolResource);
+// }
+// }
+// } else {
+// em.getTransaction().commit();
+// em.close();
+// logger.error("Unsupported field name for Job Submission Protocol Resource.", new IllegalArgumentException());
+// throw new IllegalArgumentException("Unsupported field name for Job Submission Protocol 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 jobSubmissionProtocolResourceList;
+// }
+//
+// @Override
+// public List<Resource> getAll() throws AppCatalogException {
+// return null;
+// }
+//
+// @Override
+// public List<String> getAllIds() throws AppCatalogException {
+// return null;
+// }
+//
+// public List<String> getIds(String fieldName, Object value) throws AppCatalogException {
+// List<String> jobSubmissionProtocolIDs = new ArrayList<String>();
+// EntityManager em = null;
+// try {
+// em = AppCatalogJPAUtils.getEntityManager();
+// em.getTransaction().begin();
+// Query q;
+// AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(JOB_SUBMISSION_PROTOCOL);
+// List results;
+// if (fieldName.equals(JobSubmissionProtocolConstants.SUBMISSION_ID)) {
+// generator.setParameter(JobSubmissionProtocolConstants.SUBMISSION_ID, value);
+// q = generator.selectQuery(em);
+// results = q.getResultList();
+// if (results.size() != 0) {
+// for (Object result : results) {
+// JobSubmissionProtocol jobSubmissionProtocol = (JobSubmissionProtocol) result;
+// jobSubmissionProtocolIDs.add(jobSubmissionProtocol.getSubmissionID());
+// }
+// }
+// } else if (fieldName.equals(JobSubmissionProtocolConstants.RESOURCE_ID)) {
+// generator.setParameter(JobSubmissionProtocolConstants.RESOURCE_ID, value);
+// q = generator.selectQuery(em);
+// results = q.getResultList();
+// if (results.size() != 0) {
+// for (Object result : results) {
+// JobSubmissionProtocol jobSubmissionProtocol = (JobSubmissionProtocol) result;
+// jobSubmissionProtocolIDs.add(jobSubmissionProtocol.getSubmissionID());
+// }
+// }
+// } else if (fieldName.equals(JobSubmissionProtocolConstants.JOB_TYPE)) {
+// generator.setParameter(JobSubmissionProtocolConstants.JOB_TYPE, value);
+// q = generator.selectQuery(em);
+// results = q.getResultList();
+// if (results.size() != 0) {
+// for (Object result : results) {
+// JobSubmissionProtocol jobSubmissionProtocol = (JobSubmissionProtocol) result;
+// jobSubmissionProtocolIDs.add(jobSubmissionProtocol.getSubmissionID());
+// }
+// }
+// } else {
+// em.getTransaction().commit();
+// em.close();
+// logger.error("Unsupported field name for Job Submission Protocol resource.", new IllegalArgumentException());
+// throw new IllegalArgumentException("Unsupported field name for Job Submission Protocol 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 jobSubmissionProtocolIDs;
+// }
+//
+// public void save() throws AppCatalogException {
+// EntityManager em = null;
+// try {
+// em = AppCatalogJPAUtils.getEntityManager();
+// JobSubmissionProtocol existingJobSubProtocol = em.find(JobSubmissionProtocol.class, new JobSubmissionProtocolPK(resourceID, submissionID, jobType));
+// em.close();
+//
+// em = AppCatalogJPAUtils.getEntityManager();
+// em.getTransaction().begin();
+// ComputeResource computeResource = em.find(ComputeResource.class, resourceID);
+// if (existingJobSubProtocol != null) {
+// existingJobSubProtocol.setJobType(jobType);
+// existingJobSubProtocol.setSubmissionID(submissionID);
+// existingJobSubProtocol.setComputeResource(computeResource);
+// existingJobSubProtocol.setResourceID(resourceID);
+// em.merge(existingJobSubProtocol);
+// } else {
+// JobSubmissionProtocol jobSubmissionProtocol = new JobSubmissionProtocol();
+// jobSubmissionProtocol.setJobType(jobType);
+// jobSubmissionProtocol.setSubmissionID(submissionID);
+// jobSubmissionProtocol.setResourceID(resourceID);
+// jobSubmissionProtocol.setComputeResource(computeResource);
+// em.persist(jobSubmissionProtocol);
+// }
+// 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();
+// }
+// }
+//
+// }
+//
+// 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();
+// JobSubmissionProtocol jobSubmissionProtocol = em.find(JobSubmissionProtocol.class, new JobSubmissionProtocolPK(ids.get(JobSubmissionProtocolConstants.RESOURCE_ID),
+// ids.get(JobSubmissionProtocolConstants.SUBMISSION_ID), ids.get(JobSubmissionProtocolConstants.JOB_TYPE)));
+//
+// em.close();
+// return jobSubmissionProtocol != null;
+// } 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();
+// }
+// }
+// }
+//
+// public String getResourceID() {
+// return resourceID;
+// }
+//
+// public void setResourceID(String resourceID) {
+// this.resourceID = resourceID;
+// }
+//
+// public String getSubmissionID() {
+// return submissionID;
+// }
+//
+// public void setSubmissionID(String submissionID) {
+// this.submissionID = submissionID;
+// }
+//
+// public String getJobType() {
+// return jobType;
+// }
+//
+// public void setJobType(String jobType) {
+// this.jobType = jobType;
+// }
+//
+// public ComputeResourceResource getComputeHostResource() {
+// return computeHostResource;
+// }
+//
+// public void setComputeHostResource(ComputeResourceResource computeHostResource) {
+// this.computeHostResource = computeHostResource;
+// }
+//}
[48/52] [abbrv] [partial] airavata git commit: registry refactoring
Posted by sh...@apache.org.
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/impl/WorkflowCatalogImpl.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/impl/WorkflowCatalogImpl.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/impl/WorkflowCatalogImpl.java
deleted file mode 100644
index 0c3f2ad..0000000
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/impl/WorkflowCatalogImpl.java
+++ /dev/null
@@ -1,232 +0,0 @@
-/*
- *
- * 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.aiaravata.application.catalog.data.impl;
-
-import org.airavata.appcatalog.cpi.AppCatalogException;
-import org.airavata.appcatalog.cpi.WorkflowCatalog;
-import org.apache.aiaravata.application.catalog.data.resources.*;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogThriftConversion;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogUtils;
-import org.apache.airavata.model.Workflow;
-import org.apache.airavata.model.appcatalog.appinterface.InputDataObjectType;
-import org.apache.airavata.model.appcatalog.appinterface.OutputDataObjectType;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-public class WorkflowCatalogImpl implements WorkflowCatalog {
- private final static Logger logger = LoggerFactory.getLogger(WorkflowCatalogImpl.class);
-
- @Override
- public List<String> getAllWorkflows(String gatewayId) throws AppCatalogException {
- List<String> workflowIds = new ArrayList<String>();
- try {
- WorkflowResource resource = new WorkflowResource();
- resource.setGatewayId(gatewayId);
- workflowIds = resource.getAllIds();
- } catch (Exception e) {
- logger.error("Error while retrieving all the workflow template ids...", e);
- throw new AppCatalogException(e);
- }
- return workflowIds;
- }
-
- @Override
- public Workflow getWorkflow(String workflowTemplateId) throws AppCatalogException {
- try {
- WorkflowResource resource = new WorkflowResource();
- WorkflowResource wfResource = (WorkflowResource)resource.get(workflowTemplateId);
- return AppCatalogThriftConversion.getWorkflow(wfResource);
- } catch (Exception e) {
- logger.error("Error while retrieving the workflow...", e);
- throw new AppCatalogException(e);
- }
- }
-
- @Override
- public void deleteWorkflow(String workflowTemplateId) throws AppCatalogException {
- try {
- WorkflowResource resource = new WorkflowResource();
- resource.remove(workflowTemplateId);
- } catch (Exception e) {
- logger.error("Error while deleting the workflow...", e);
- throw new AppCatalogException(e);
- }
- }
-
- @Override
- public String registerWorkflow(Workflow workflow, String gatewayId) throws AppCatalogException {
- try {
- WorkflowResource resource = new WorkflowResource();
- resource.setWfTemplateId(AppCatalogUtils.getID(workflow.getName()));
- resource.setWfName(workflow.getName());
- resource.setGraph(workflow.getGraph());
- resource.setGatewayId(gatewayId);
- if (workflow.getImage() != null){
- resource.setImage(new String(workflow.getImage()));
- }
- resource.save();
- workflow.setTemplateId(resource.getWfTemplateId());
- List<InputDataObjectType> workflowInputs = workflow.getWorkflowInputs();
- if (workflowInputs != null && workflowInputs.size() != 0){
- for (InputDataObjectType input : workflowInputs){
- WorkflowInputResource wfInputResource = new WorkflowInputResource();
- wfInputResource.setWorkflowResource(resource);
- wfInputResource.setInputKey(input.getName());
- wfInputResource.setInputVal(input.getValue());
- wfInputResource.setWfTemplateId(resource.getWfTemplateId());
- wfInputResource.setDataType(input.getType().toString());
- wfInputResource.setAppArgument(input.getApplicationArgument());
- wfInputResource.setStandardInput(input.isStandardInput());
- wfInputResource.setUserFriendlyDesc(input.getUserFriendlyDescription());
- wfInputResource.setMetadata(input.getMetaData());
- wfInputResource.save();
- }
- }
- List<OutputDataObjectType> workflowOutputs = workflow.getWorkflowOutputs();
- if (workflowOutputs != null && workflowOutputs.size() != 0){
- for (OutputDataObjectType output : workflowOutputs){
- WorkflowOutputResource outputResource = new WorkflowOutputResource();
- outputResource.setWorkflowResource(resource);
- outputResource.setOutputKey(output.getName());
- outputResource.setOutputVal(output.getValue());
- outputResource.setWfTemplateId(resource.getWfTemplateId());
- outputResource.setDataType(output.getType().toString());
- outputResource.save();
- }
- }
- return resource.getWfTemplateId();
- } catch (Exception e) {
- logger.error("Error while saving the workflow...", e);
- throw new AppCatalogException(e);
- }
- }
-
- @Override
- public void updateWorkflow(String workflowTemplateId, Workflow workflow) throws AppCatalogException {
- try {
- WorkflowResource resource = new WorkflowResource();
- WorkflowResource existingWF = (WorkflowResource)resource.get(workflowTemplateId);
- existingWF.setWfName(workflow.getName());
- existingWF.setGraph(workflow.getGraph());
- if (workflow.getImage() != null){
- existingWF.setImage(new String(workflow.getImage()));
- }
- existingWF.save();
- List<InputDataObjectType> existingwFInputs = workflow.getWorkflowInputs();
- if (existingwFInputs != null && existingwFInputs.size() != 0){
- for (InputDataObjectType input : existingwFInputs){
- WorkflowInputResource wfInputResource = new WorkflowInputResource();
- Map<String, String> ids = new HashMap<String, String>();
- ids.put(AbstractResource.WFInputConstants.WF_TEMPLATE_ID,existingWF.getWfTemplateId());
- ids.put(AbstractResource.WFInputConstants.INPUT_KEY,input.getName());
- WorkflowInputResource existingInput = (WorkflowInputResource)wfInputResource.get(ids);
- existingInput.setWorkflowResource(existingWF);
- existingInput.setInputKey(input.getName());
- existingInput.setInputVal(input.getValue());
- existingInput.setWfTemplateId(existingWF.getWfTemplateId());
- existingInput.setDataType(input.getType().toString());
- existingInput.setAppArgument(input.getApplicationArgument());
- existingInput.setStandardInput(input.isStandardInput());
- existingInput.setUserFriendlyDesc(input.getUserFriendlyDescription());
- existingInput.setMetadata(input.getMetaData());
- existingInput.save();
- }
- }
- List<OutputDataObjectType> workflowOutputs = workflow.getWorkflowOutputs();
- if (workflowOutputs != null && workflowOutputs.size() != 0){
- for (OutputDataObjectType output : workflowOutputs){
- WorkflowOutputResource outputResource = new WorkflowOutputResource();
- Map<String, String> ids = new HashMap<String, String>();
- ids.put(AbstractResource.WFOutputConstants.WF_TEMPLATE_ID,existingWF.getWfTemplateId());
- ids.put(AbstractResource.WFOutputConstants.OUTPUT_KEY,output.getName());
- WorkflowOutputResource existingOutput = (WorkflowOutputResource)outputResource.get(ids);
- existingOutput.setWorkflowResource(existingWF);
- existingOutput.setOutputKey(output.getName());
- existingOutput.setOutputVal(output.getValue());
- existingOutput.setWfTemplateId(existingWF.getWfTemplateId());
- existingOutput.setDataType(output.getType().toString());
- existingOutput.save();
- }
- }
- } catch (Exception e) {
- logger.error("Error while updating the workflow...", e);
- throw new AppCatalogException(e);
- }
- }
-
- @Override
- public String getWorkflowTemplateId(String workflowName) throws AppCatalogException {
- try {
- WorkflowResource resource = new WorkflowResource();
- List<Resource> resourceList = resource.get(AbstractResource.WorkflowConstants.WF_NAME, workflowName);
- if (resourceList != null && !resourceList.isEmpty()){
- WorkflowResource wfResource = (WorkflowResource)resourceList.get(0);
- return wfResource.getWfTemplateId();
- }
- } catch (Exception e) {
- logger.error("Error while retrieving the workflow with the workflow name...", e);
- throw new AppCatalogException(e);
- }
- return null;
- }
-
- @Override
- public boolean isWorkflowExistWithName(String workflowName) throws AppCatalogException {
- try {
- WorkflowResource resource = new WorkflowResource();
- List<Resource> resourceList = resource.get(AbstractResource.WorkflowConstants.WF_NAME, workflowName);
- if (resourceList != null && !resourceList.isEmpty()){
- return true;
- }
- } catch (Exception e) {
- logger.error("Error while retrieving the workflow with the workflow name...", e);
- throw new AppCatalogException(e);
- }
- return false;
- }
-
- @Override
- public void updateWorkflowOutputs(String workflowTemplateId, List<OutputDataObjectType> workflowOutputs) throws AppCatalogException {
- WorkflowResource resource = new WorkflowResource();
- WorkflowResource existingWF = (WorkflowResource)resource.get(workflowTemplateId);
- if (workflowOutputs != null && workflowOutputs.size() != 0) {
- for (OutputDataObjectType output : workflowOutputs) {
- WorkflowOutputResource outputResource = new WorkflowOutputResource();
- Map<String, String> ids = new HashMap<String, String>();
- ids.put(AbstractResource.WFOutputConstants.WF_TEMPLATE_ID, existingWF.getWfTemplateId());
- ids.put(AbstractResource.WFOutputConstants.OUTPUT_KEY, output.getName());
- WorkflowOutputResource existingOutput = (WorkflowOutputResource) outputResource.get(ids);
- existingOutput.setWorkflowResource(existingWF);
- existingOutput.setOutputKey(output.getName());
- existingOutput.setOutputVal(output.getValue());
- existingOutput.setWfTemplateId(existingWF.getWfTemplateId());
- existingOutput.setDataType(output.getType().toString());
- existingOutput.save();
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/AppEnvironment.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/AppEnvironment.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/AppEnvironment.java
deleted file mode 100644
index f3ca043..0000000
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/AppEnvironment.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- *
- * 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.aiaravata.application.catalog.data.model;
-
-import javax.persistence.*;
-import java.io.Serializable;
-
-@Entity
-@Table(name = "APP_ENVIRONMENT")
-@IdClass(AppEnvironment_PK.class)
-public class AppEnvironment implements Serializable {
- @Id
- @Column(name = "DEPLOYMENT_ID")
- private String deploymentID;
- @Id
- @Column(name = "NAME")
- private String name;
-
- @Column(name = "VALUE")
- private String value;
-
- @ManyToOne(cascade= CascadeType.MERGE)
- @JoinColumn(name = "DEPLOYMENT_ID")
- private ApplicationDeployment applicationDeployment;
-
- public String getDeploymentID() {
- return deploymentID;
- }
-
- public void setDeploymentID(String deploymentID) {
- this.deploymentID = deploymentID;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public String getValue() {
- return value;
- }
-
- public void setValue(String value) {
- this.value = value;
- }
-
- public ApplicationDeployment getApplicationDeployment() {
- return applicationDeployment;
- }
-
- public void setApplicationDeployment(ApplicationDeployment applicationDeployment) {
- this.applicationDeployment = applicationDeployment;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/AppEnvironment_PK.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/AppEnvironment_PK.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/AppEnvironment_PK.java
deleted file mode 100644
index 8d8e23a..0000000
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/AppEnvironment_PK.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- *
- * 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.aiaravata.application.catalog.data.model;
-
-import java.io.Serializable;
-
-public class AppEnvironment_PK implements Serializable {
- private String deploymentID;
- private String name;
-
- public AppEnvironment_PK(String deploymentID, String name) {
- this.deploymentID = deploymentID;
- this.name = name;
- }
-
- public AppEnvironment_PK() {
- ;
- }
-
- @Override
- public boolean equals(Object o) {
- return false;
- }
-
- @Override
- public int hashCode() {
- return 1;
- }
-
- public String getDeploymentID() {
- return deploymentID;
- }
-
- public void setDeploymentID(String deploymentID) {
- this.deploymentID = deploymentID;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/AppInput_PK.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/AppInput_PK.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/AppInput_PK.java
deleted file mode 100644
index 97a79cf..0000000
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/AppInput_PK.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- *
- * 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.aiaravata.application.catalog.data.model;
-
-import java.io.Serializable;
-
-public class AppInput_PK implements Serializable {
- private String interfaceID;
- private String inputKey;
-
- public AppInput_PK(String interfaceID, String inputKey) {
- this.interfaceID = interfaceID;
- this.inputKey = inputKey;
- }
-
- public AppInput_PK() {
- ;
- }
-
- @Override
- public boolean equals(Object o) {
- return false;
- }
-
- @Override
- public int hashCode() {
- return 1;
- }
-
- public String getInterfaceID() {
- return interfaceID;
- }
-
- public void setInterfaceID(String interfaceID) {
- this.interfaceID = interfaceID;
- }
-
- public String getInputKey() {
- return inputKey;
- }
-
- public void setInputKey(String inputKey) {
- this.inputKey = inputKey;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/AppModuleMapping.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/AppModuleMapping.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/AppModuleMapping.java
deleted file mode 100644
index d446e3a..0000000
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/AppModuleMapping.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- *
- * 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.aiaravata.application.catalog.data.model;
-
-import javax.persistence.*;
-import java.io.Serializable;
-
-@Entity
-@Table(name = "APP_MODULE_MAPPING")
-@IdClass(AppModuleMapping_PK.class)
-public class AppModuleMapping implements Serializable {
- @Id
- @Column(name = "INTERFACE_ID")
- private String interfaceID;
- @Id
- @Column(name = "MODULE_ID")
- private String moduleID;
-
- @ManyToOne(cascade= CascadeType.MERGE)
- @JoinColumn(name = "INTERFACE_ID")
- private ApplicationInterface applicationInterface;
-
- @ManyToOne(cascade= CascadeType.MERGE)
- @JoinColumn(name = "MODULE_ID")
- private ApplicationModule applicationModule;
-
- public String getInterfaceID() {
- return interfaceID;
- }
-
- public void setInterfaceID(String interfaceID) {
- this.interfaceID = interfaceID;
- }
-
- public String getModuleID() {
- return moduleID;
- }
-
- public void setModuleID(String moduleID) {
- this.moduleID = moduleID;
- }
-
- public ApplicationInterface getApplicationInterface() {
- return applicationInterface;
- }
-
- public void setApplicationInterface(ApplicationInterface applicationInterface) {
- this.applicationInterface = applicationInterface;
- }
-
- public ApplicationModule getApplicationModule() {
- return applicationModule;
- }
-
- public void setApplicationModule(ApplicationModule applicationModule) {
- this.applicationModule = applicationModule;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/AppModuleMapping_PK.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/AppModuleMapping_PK.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/AppModuleMapping_PK.java
deleted file mode 100644
index 3aeba37..0000000
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/AppModuleMapping_PK.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- *
- * 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.aiaravata.application.catalog.data.model;
-
-import java.io.Serializable;
-
-public class AppModuleMapping_PK implements Serializable {
- private String interfaceID;
- private String moduleID;
-
- public AppModuleMapping_PK(String interfaceID, String moduleID) {
- this.interfaceID = interfaceID;
- this.moduleID = moduleID;
- }
-
- public AppModuleMapping_PK() {
- ;
- }
-
- @Override
- public boolean equals(Object o) {
- return false;
- }
-
- @Override
- public int hashCode() {
- return 1;
- }
-
- public String getInterfaceID() {
- return interfaceID;
- }
-
- public void setInterfaceID(String interfaceID) {
- this.interfaceID = interfaceID;
- }
-
- public String getModuleID() {
- return moduleID;
- }
-
- public void setModuleID(String moduleID) {
- this.moduleID = moduleID;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/AppOutput_PK.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/AppOutput_PK.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/AppOutput_PK.java
deleted file mode 100644
index 9426072..0000000
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/AppOutput_PK.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- *
- * 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.aiaravata.application.catalog.data.model;
-
-import java.io.Serializable;
-
-public class AppOutput_PK implements Serializable {
- private String interfaceID;
- private String outputKey;
-
- public AppOutput_PK(String interfaceID, String outputKey) {
- this.interfaceID = interfaceID;
- this.outputKey = outputKey;
- }
-
- public AppOutput_PK() {
- ;
- }
-
- @Override
- public boolean equals(Object o) {
- return false;
- }
-
- @Override
- public int hashCode() {
- return 1;
- }
-
- public String getInterfaceID() {
- return interfaceID;
- }
-
- public void setInterfaceID(String interfaceID) {
- this.interfaceID = interfaceID;
- }
-
- public String getOutputKey() {
- return outputKey;
- }
-
- public void setOutputKey(String outputKey) {
- this.outputKey = outputKey;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/ApplicationDeployment.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/ApplicationDeployment.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/ApplicationDeployment.java
deleted file mode 100644
index e5468a0..0000000
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/ApplicationDeployment.java
+++ /dev/null
@@ -1,148 +0,0 @@
-/*
- *
- * 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.aiaravata.application.catalog.data.model;
-
-import javax.persistence.*;
-import java.io.Serializable;
-import java.sql.Timestamp;
-
-@Entity
-@Table(name = "APPLICATION_DEPLOYMENT")
-public class ApplicationDeployment implements Serializable {
- @Id
- @Column(name = "DEPLOYMENT_ID")
- private String deploymentID;
- @Column(name = "APP_MODULE_ID")
- private String appModuleID;
- @Column(name = "COMPUTE_HOST_ID")
- private String hostID;
- @Column(name = "EXECUTABLE_PATH")
- private String executablePath;
- @Column(name = "APPLICATION_DESC")
- private String applicationDesc;
- @Column(name = "PARALLELISM")
- private String parallelism;
- @Column(name = "GATEWAY_ID")
- private String gatewayId;
-
- @ManyToOne(cascade= CascadeType.MERGE)
- @JoinColumn(name = "APP_MODULE_ID")
- private ApplicationModule applicationModule;
-
- @ManyToOne(cascade= CascadeType.MERGE)
- @JoinColumn(name = "COMPUTE_HOSTID")
- private ComputeResource computeResource;
-
- @Column(name = "CREATION_TIME")
- private Timestamp creationTime;
-
- @Column(name = "UPDATE_TIME")
- private Timestamp updateTime;
-
- public String getGatewayId() {
- return gatewayId;
- }
-
- public void setGatewayId(String gatewayId) {
- this.gatewayId = gatewayId;
- }
-
- public Timestamp getCreationTime() {
- return creationTime;
- }
-
- public void setCreationTime(Timestamp creationTime) {
- this.creationTime = creationTime;
- }
-
- public Timestamp getUpdateTime() {
- return updateTime;
- }
-
- public void setUpdateTime(Timestamp updateTime) {
- this.updateTime = updateTime;
- }
-
- public String getDeploymentID() {
- return deploymentID;
- }
-
- public void setDeploymentID(String deploymentID) {
- this.deploymentID = deploymentID;
- }
-
- public String getAppModuleID() {
- return appModuleID;
- }
-
- public void setAppModuleID(String appModuleID) {
- this.appModuleID = appModuleID;
- }
-
- public String getHostID() {
- return hostID;
- }
-
- public void setHostID(String hostID) {
- this.hostID = hostID;
- }
-
- public String getExecutablePath() {
- return executablePath;
- }
-
- public void setExecutablePath(String executablePath) {
- this.executablePath = executablePath;
- }
-
- public String getApplicationDesc() {
- return applicationDesc;
- }
-
- public void setApplicationDesc(String applicationDesc) {
- this.applicationDesc = applicationDesc;
- }
-
- public ApplicationModule getApplicationModule() {
- return applicationModule;
- }
-
- public void setApplicationModule(ApplicationModule applicationModule) {
- this.applicationModule = applicationModule;
- }
-
- public ComputeResource getComputeResource() {
- return computeResource;
- }
-
- public void setComputeResource(ComputeResource computeResource) {
- this.computeResource = computeResource;
- }
-
- public String getParallelism() {
- return parallelism;
- }
-
- public void setParallelism(String parallelism) {
- this.parallelism = parallelism;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/ApplicationInput.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/ApplicationInput.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/ApplicationInput.java
deleted file mode 100644
index 5255bc0..0000000
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/ApplicationInput.java
+++ /dev/null
@@ -1,166 +0,0 @@
-/*
- *
- * 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.aiaravata.application.catalog.data.model;
-
-
-import javax.persistence.*;
-import java.io.Serializable;
-
-@Entity
-@Table(name = "APPLICATION_INPUT")
-@IdClass(AppInput_PK.class)
-public class ApplicationInput implements Serializable {
- @Id
- @Column(name = "INTERFACE_ID")
- private String interfaceID;
- @Id
- @Column(name = "INPUT_KEY")
- private String inputKey;
- @Column(name = "INPUT_VALUE")
- private String inputVal;
- @Column(name = "DATA_TYPE")
- private String dataType;
- @Column(name = "METADATA")
- private String metadata;
- @Column(name = "APP_ARGUMENT")
- private String appArgument;
- @Column(name = "USER_FRIENDLY_DESC")
- private String userFriendlyDesc;
- @Column(name = "STANDARD_INPUT")
- private boolean standardInput;
- @Column(name="INPUT_ORDER")
- private int inputOrder;
- @Column(name="IS_REQUIRED")
- private boolean isRequired;
- @Column(name="REQUIRED_TO_COMMANDLINE")
- private boolean requiredToCMD;
- @Column(name = "DATA_STAGED")
- private boolean dataStaged;
-
- @ManyToOne(cascade= CascadeType.MERGE)
- @JoinColumn(name = "INTERFACE_ID")
- private ApplicationInterface applicationInterface;
-
- public String getInterfaceID() {
- return interfaceID;
- }
-
- public void setInterfaceID(String interfaceID) {
- this.interfaceID = interfaceID;
- }
-
- public String getInputKey() {
- return inputKey;
- }
-
- public void setInputKey(String inputKey) {
- this.inputKey = inputKey;
- }
-
- public String getInputVal() {
- return inputVal;
- }
-
- public void setInputVal(String inputVal) {
- this.inputVal = inputVal;
- }
-
- public String getDataType() {
- return dataType;
- }
-
- public void setDataType(String dataType) {
- this.dataType = dataType;
- }
-
- public String getMetadata() {
- return metadata;
- }
-
- public void setMetadata(String metadata) {
- this.metadata = metadata;
- }
-
- public String getAppArgument() {
- return appArgument;
- }
-
- public void setAppArgument(String appArgument) {
- this.appArgument = appArgument;
- }
-
- public String getUserFriendlyDesc() {
- return userFriendlyDesc;
- }
-
- public void setUserFriendlyDesc(String userFriendlyDesc) {
- this.userFriendlyDesc = userFriendlyDesc;
- }
-
- public ApplicationInterface getApplicationInterface() {
- return applicationInterface;
- }
-
- public void setApplicationInterface(ApplicationInterface applicationInterface) {
- this.applicationInterface = applicationInterface;
- }
-
- public boolean isStandardInput() {
- return standardInput;
- }
-
- public void setStandardInput(boolean standardInput) {
- this.standardInput = standardInput;
- }
-
- public int getInputOrder() {
- return inputOrder;
- }
-
- public void setInputOrder(int inputOrder) {
- this.inputOrder = inputOrder;
- }
-
- public boolean isRequired() {
- return isRequired;
- }
-
- public void setRequired(boolean isRequired) {
- this.isRequired = isRequired;
- }
-
- public boolean isRequiredToCMD() {
- return requiredToCMD;
- }
-
- public void setRequiredToCMD(boolean requiredToCMD) {
- this.requiredToCMD = requiredToCMD;
- }
-
- public boolean isDataStaged() {
- return dataStaged;
- }
-
- public void setDataStaged(boolean dataStaged) {
- this.dataStaged = dataStaged;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/ApplicationInterface.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/ApplicationInterface.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/ApplicationInterface.java
deleted file mode 100644
index 4f9c6a3..0000000
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/ApplicationInterface.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- *
- * 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.aiaravata.application.catalog.data.model;
-
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.Id;
-import javax.persistence.Table;
-import java.io.Serializable;
-import java.sql.Timestamp;
-
-@Entity
-@Table(name = "APPLICATION_INTERFACE")
-public class ApplicationInterface implements Serializable {
- @Id
- @Column(name = "INTERFACE_ID")
- private String interfaceID;
- @Column(name = "APPLICATION_NAME")
- private String appName;
- @Column(name = "APPLICATION_DESCRIPTION")
- private String appDescription;
- @Column(name = "CREATION_TIME")
- private Timestamp creationTime;
- @Column(name = "GATEWAY_ID")
- private String gatewayId;
-
- @Column(name = "UPDATE_TIME")
- private Timestamp updateTime;
-
- public String getGatewayId() {
- return gatewayId;
- }
-
- public void setGatewayId(String gatewayId) {
- this.gatewayId = gatewayId;
- }
-
- public Timestamp getCreationTime() {
- return creationTime;
- }
-
- public void setCreationTime(Timestamp creationTime) {
- this.creationTime = creationTime;
- }
-
- public Timestamp getUpdateTime() {
- return updateTime;
- }
-
- public void setUpdateTime(Timestamp updateTime) {
- this.updateTime = updateTime;
- }
-
-
- public String getInterfaceID() {
- return interfaceID;
- }
-
- public void setInterfaceID(String interfaceID) {
- this.interfaceID = interfaceID;
- }
-
- public String getAppName() {
- return appName;
- }
-
- public void setAppName(String appName) {
- this.appName = appName;
- }
-
- public String getAppDescription() {
- return appDescription;
- }
-
- public void setAppDescription(String appDescription) {
- this.appDescription = appDescription;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/ApplicationModule.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/ApplicationModule.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/ApplicationModule.java
deleted file mode 100644
index b4bd8bc..0000000
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/ApplicationModule.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- *
- * 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.aiaravata.application.catalog.data.model;
-
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.Id;
-import javax.persistence.Table;
-import java.io.Serializable;
-import java.sql.Timestamp;
-
-@Entity
-@Table(name = "APPLICATION_MODULE")
-public class ApplicationModule implements Serializable {
- @Id
- @Column(name = "MODULE_ID")
- private String moduleID;
- @Column(name = "MODULE_NAME")
- private String moduleName;
- @Column(name = "MODULE_VERSION")
- private String moduleVersion;
- @Column(name = "MODULE_DESC")
- private String moduleDesc;
- @Column(name = "CREATION_TIME")
- private Timestamp creationTime;
- @Column(name = "GATEWAY_ID")
- private String gatewayId;
-
- @Column(name = "UPDATE_TIME")
- private Timestamp updateTime;
-
- public Timestamp getCreationTime() {
- return creationTime;
- }
-
- public void setCreationTime(Timestamp creationTime) {
- this.creationTime = creationTime;
- }
-
- public Timestamp getUpdateTime() {
- return updateTime;
- }
-
- public void setUpdateTime(Timestamp updateTime) {
- this.updateTime = updateTime;
- }
-
-
- public String getModuleID() {
- return moduleID;
- }
-
- public void setModuleID(String moduleID) {
- this.moduleID = moduleID;
- }
-
- public String getModuleName() {
- return moduleName;
- }
-
- public void setModuleName(String moduleName) {
- this.moduleName = moduleName;
- }
-
- public String getModuleVersion() {
- return moduleVersion;
- }
-
- public void setModuleVersion(String moduleVersion) {
- this.moduleVersion = moduleVersion;
- }
-
- public String getModuleDesc() {
- return moduleDesc;
- }
-
- public void setModuleDesc(String moduleDesc) {
- this.moduleDesc = moduleDesc;
- }
-
- public String getGatewayId() {
- return gatewayId;
- }
-
- public void setGatewayId(String gatewayId) {
- this.gatewayId = gatewayId;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/ApplicationOutput.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/ApplicationOutput.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/ApplicationOutput.java
deleted file mode 100644
index b2cb867..0000000
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/ApplicationOutput.java
+++ /dev/null
@@ -1,146 +0,0 @@
-/*
- *
- * 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.aiaravata.application.catalog.data.model;
-
-
-import javax.persistence.*;
-import java.io.Serializable;
-
-@Entity
-@Table(name = "APPLICATION_OUTPUT")
-@IdClass(AppOutput_PK.class)
-public class ApplicationOutput implements Serializable {
- @Id
- @Column(name = "INTERFACE_ID")
- private String interfaceID;
- @Id
- @Column(name = "OUTPUT_KEY")
- private String outputKey;
- @Column(name = "OUTPUT_VALUE")
- private String outputVal;
- @Column(name = "DATA_TYPE")
- private String dataType;
- @Column(name = "IS_REQUIRED")
- private boolean isRequired;
- @Column(name="REQUIRED_TO_COMMANDLINE")
- private boolean requiredToCMD;
- @Column(name = "DATA_MOVEMENT")
- private boolean dataMovement;
- @Column(name = "DATA_NAME_LOCATION")
- private String dataNameLocation;
- @Column(name = "SEARCH_QUERY")
- private String searchQuery;
- @Column(name = "APP_ARGUMENT")
- private String applicationArgument;
-
- @ManyToOne(cascade= CascadeType.MERGE)
- @JoinColumn(name = "INTERFACE_ID")
- private ApplicationInterface applicationInterface;
-
- public String getInterfaceID() {
- return interfaceID;
- }
-
- public void setInterfaceID(String interfaceID) {
- this.interfaceID = interfaceID;
- }
-
- public String getDataType() {
- return dataType;
- }
-
- public void setDataType(String dataType) {
- this.dataType = dataType;
- }
-
- public ApplicationInterface getApplicationInterface() {
- return applicationInterface;
- }
-
- public void setApplicationInterface(ApplicationInterface applicationInterface) {
- this.applicationInterface = applicationInterface;
- }
-
- public String getOutputKey() {
- return outputKey;
- }
-
- public void setOutputKey(String outputKey) {
- this.outputKey = outputKey;
- }
-
- public String getOutputVal() {
- return outputVal;
- }
-
- public void setOutputVal(String outputVal) {
- this.outputVal = outputVal;
- }
-
- public boolean isRequired() {
- return isRequired;
- }
-
- public void setRequired(boolean isRequired) {
- this.isRequired = isRequired;
- }
-
- public boolean isRequiredToCMD() {
- return requiredToCMD;
- }
-
- public void setRequiredToCMD(boolean requiredToCMD) {
- this.requiredToCMD = requiredToCMD;
- }
-
- public boolean isDataMovement() {
- return dataMovement;
- }
-
- public void setDataMovement(boolean dataMovement) {
- this.dataMovement = dataMovement;
- }
-
- public String getDataNameLocation() {
- return dataNameLocation;
- }
-
- public void setDataNameLocation(String dataNameLocation) {
- this.dataNameLocation = dataNameLocation;
- }
-
- public String getSearchQuery() {
- return searchQuery;
- }
-
- public void setSearchQuery(String searchQuery) {
- this.searchQuery = searchQuery;
- }
-
- public String getApplicationArgument() {
- return applicationArgument;
- }
-
- public void setApplicationArgument(String applicationArgument) {
- this.applicationArgument = applicationArgument;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/BatchQueue.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/BatchQueue.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/BatchQueue.java
deleted file mode 100644
index ac94b10..0000000
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/BatchQueue.java
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- *
- * 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.aiaravata.application.catalog.data.model;
-
-import java.io.Serializable;
-
-import javax.persistence.CascadeType;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.Id;
-import javax.persistence.IdClass;
-import javax.persistence.JoinColumn;
-import javax.persistence.ManyToOne;
-import javax.persistence.Table;
-
-import org.apache.openjpa.persistence.DataCache;
-
-@DataCache
-@Entity
-@Table(name = "BATCH_QUEUE")
-@IdClass(BatchQueue_PK.class)
-public class BatchQueue implements Serializable {
-
- @Id
- @Column(name = "COMPUTE_RESOURCE_ID")
- private String computeResourceId;
-
- @ManyToOne(cascade= CascadeType.MERGE)
- @JoinColumn(name = "COMPUTE_RESOURCE_ID")
- private ComputeResource computeResource;
-
- @Column(name = "MAX_RUNTIME")
- private int maxRuntime;
-
- @Column(name = "MAX_JOB_IN_QUEUE")
- private int maxJobInQueue;
-
- @Column(name = "QUEUE_DESCRIPTION")
- private String queueDescription;
-
- @Id
- @Column(name = "QUEUE_NAME")
- private String queueName;
-
- @Column(name = "MAX_PROCESSORS")
- private int maxProcessors;
-
- @Column(name = "MAX_NODES")
- private int maxNodes;
-
- @Column(name = "MAX_MEMORY")
- private int maxMemory;
-
- public int getMaxMemory() {
- return maxMemory;
- }
-
- public void setMaxMemory(int maxMemory) {
- this.maxMemory = maxMemory;
- }
-
- public String getComputeResourceId() {
- return computeResourceId;
- }
-
- public ComputeResource getComputeResource() {
- return computeResource;
- }
-
- public int getMaxRuntime() {
- return maxRuntime;
- }
-
- public int getMaxJobInQueue() {
- return maxJobInQueue;
- }
-
- public String getQueueDescription() {
- return queueDescription;
- }
-
- public String getQueueName() {
- return queueName;
- }
-
- public int getMaxProcessors() {
- return maxProcessors;
- }
-
- public int getMaxNodes() {
- return maxNodes;
- }
-
- public void setComputeResourceId(String computeResourceId) {
- this.computeResourceId=computeResourceId;
- }
-
- public void setComputeResource(ComputeResource computeResource) {
- this.computeResource=computeResource;
- }
-
- public void setMaxRuntime(int maxRuntime) {
- this.maxRuntime=maxRuntime;
- }
-
- public void setMaxJobInQueue(int maxJobInQueue) {
- this.maxJobInQueue=maxJobInQueue;
- }
-
- public void setQueueDescription(String queueDescription) {
- this.queueDescription=queueDescription;
- }
-
- public void setQueueName(String queueName) {
- this.queueName=queueName;
- }
-
- public void setMaxProcessors(int maxProcessors) {
- this.maxProcessors=maxProcessors;
- }
-
- public void setMaxNodes(int maxNodes) {
- this.maxNodes=maxNodes;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/BatchQueue_PK.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/BatchQueue_PK.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/BatchQueue_PK.java
deleted file mode 100644
index 1cd64d6..0000000
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/BatchQueue_PK.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- *
- * 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.aiaravata.application.catalog.data.model;
-
-import java.io.Serializable;
-
-public class BatchQueue_PK implements Serializable {
- private String computeResourceId;
- private String queueName;
- public BatchQueue_PK(String computeResourceId, String queueName){
- this.computeResourceId = computeResourceId;
- this.queueName = queueName;
- }
-
- public BatchQueue_PK() {
- }
-
- @Override
- public boolean equals(Object o) {
- return false;
- }
-
- @Override
- public int hashCode() {
- return 1;
- }
-
- public String getComputeResourceId() {
- return computeResourceId;
- }
-
- public String getQueueName() {
- return queueName;
- }
-
- public void setComputeResourceId(String computeResourceId) {
- this.computeResourceId=computeResourceId;
- }
-
- public void setQueueName(String queueName) {
- this.queueName=queueName;
- }
-}
-
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/CloudJobSubmission.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/CloudJobSubmission.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/CloudJobSubmission.java
deleted file mode 100644
index 2a9e8bb..0000000
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/CloudJobSubmission.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- *
- * 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.aiaravata.application.catalog.data.model;
-
-import org.apache.openjpa.persistence.DataCache;
-
-import javax.persistence.*;
-import java.io.Serializable;
-
-@DataCache
-@Entity
-@Table(name = "CLOUD_JOB_SUBMISSION")
-public class CloudJobSubmission implements Serializable {
- @Id
- @Column(name = "JOB_SUBMISSION_INTERFACE_ID")
- private String jobSubmissionInterfaceId;
-
- @Column(name = "SECURITY_PROTOCOL")
- private String securityProtocol;
-
- @Column(name = "NODE_ID")
- private String nodeId;
-
- @Column(name = "EXECUTABLE_TYPE")
- private String executableType;
-
- @Column(name = "PROVIDER_NAME")
- private String providerName;
-
- @Column(name = "USER_ACCOUNT_NAME")
- private String userAccountName;
-
-
- public String getExecutableType() {
- return executableType;
- }
-
- public void setExecutableType(String executableType) {
- this.executableType = executableType;
- }
-
- public String getProviderName() {
- return providerName;
- }
-
- public void setProviderName(String providerName) {
- this.providerName = providerName;
- }
-
- public String getUserAccountName() {
- return userAccountName;
- }
-
- public void setUserAccountName(String userAccountName) {
- this.userAccountName = userAccountName;
- }
-
- public String getNodeId() {
- return nodeId;
- }
-
- public void setNodeId(String nodeId) {
- this.nodeId = nodeId;
- }
-
- public String getJobSubmissionInterfaceId() {
- return jobSubmissionInterfaceId;
- }
-
-
- public String getSecurityProtocol() {
- return securityProtocol;
- }
-
-
- public void setJobSubmissionInterfaceId(String jobSubmissionInterfaceId) {
- this.jobSubmissionInterfaceId=jobSubmissionInterfaceId;
- }
-
-
- public void setSecurityProtocol(String securityProtocol) {
- this.securityProtocol=securityProtocol;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/ComputeResource.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/ComputeResource.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/ComputeResource.java
deleted file mode 100644
index 51141ec..0000000
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/ComputeResource.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- *
- * 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.aiaravata.application.catalog.data.model;
-
-import java.io.Serializable;
-import java.sql.Timestamp;
-
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.Id;
-import javax.persistence.Table;
-
-import org.apache.openjpa.persistence.DataCache;
-
-@DataCache
-@Entity
-@Table(name = "COMPUTE_RESOURCE")
-public class ComputeResource implements Serializable {
-
- @Column(name = "RESOURCE_DESCRIPTION")
- private String resourceDescription;
-
- @Id
- @Column(name = "RESOURCE_ID")
- private String resourceId;
-
- @Column(name = "HOST_NAME")
- private String hostName;
-
- @Column(name = "MAX_MEMORY_NODE")
- private int maxMemoryPerNode;
-
- @Column(name = "CREATION_TIME")
- private Timestamp creationTime;
-
- @Column(name = "UPDATE_TIME")
- private Timestamp updateTime;
-
- public Timestamp getCreationTime() {
- return creationTime;
- }
-
- public void setCreationTime(Timestamp creationTime) {
- this.creationTime = creationTime;
- }
-
- public Timestamp getUpdateTime() {
- return updateTime;
- }
-
- public void setUpdateTime(Timestamp updateTime) {
- this.updateTime = updateTime;
- }
-
- public String getResourceDescription() {
- return resourceDescription;
- }
-
- public String getResourceId() {
- return resourceId;
- }
-
- public String getHostName() {
- return hostName;
- }
-
- public void setResourceDescription(String resourceDescription) {
- this.resourceDescription=resourceDescription;
- }
-
- public void setResourceId(String resourceId) {
- this.resourceId=resourceId;
- }
-
- public void setHostName(String hostName) {
- this.hostName=hostName;
- }
-
- public int getMaxMemoryPerNode() {
- return maxMemoryPerNode;
- }
-
- public void setMaxMemoryPerNode(int maxMemoryPerNode) {
- this.maxMemoryPerNode = maxMemoryPerNode;
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/ComputeResourceFileSystem.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/ComputeResourceFileSystem.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/ComputeResourceFileSystem.java
deleted file mode 100644
index 184056a..0000000
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/ComputeResourceFileSystem.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- *
- * 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.aiaravata.application.catalog.data.model;
-
-import java.io.Serializable;
-
-import javax.persistence.CascadeType;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.Id;
-import javax.persistence.IdClass;
-import javax.persistence.JoinColumn;
-import javax.persistence.ManyToOne;
-import javax.persistence.Table;
-
-import org.apache.openjpa.persistence.DataCache;
-
-@DataCache
-@Entity
-@Table(name = "COMPUTE_RESOURCE_FILE_SYSTEM")
-@IdClass(ComputeResourceFileSystem_PK.class)
-public class ComputeResourceFileSystem implements Serializable {
-
- @Id
- @Column(name = "COMPUTE_RESOURCE_ID")
- private String computeResourceId;
-
- @ManyToOne(cascade= CascadeType.MERGE)
- @JoinColumn(name = "COMPUTE_RESOURCE_ID")
- private ComputeResource computeResource;
-
- @Column(name = "PATH")
- private String path;
-
- @Id
- @Column(name = "FILE_SYSTEM")
- private String fileSystem;
-
- public String getComputeResourceId() {
- return computeResourceId;
- }
-
- public ComputeResource getComputeResource() {
- return computeResource;
- }
-
- public String getPath() {
- return path;
- }
-
- public String getFileSystem() {
- return fileSystem;
- }
-
- public void setComputeResourceId(String computeResourceId) {
- this.computeResourceId=computeResourceId;
- }
-
- public void setComputeResource(ComputeResource computeResource) {
- this.computeResource=computeResource;
- }
-
- public void setPath(String path) {
- this.path=path;
- }
-
- public void setFileSystem(String fileSystem) {
- this.fileSystem=fileSystem;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/ComputeResourceFileSystem_PK.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/ComputeResourceFileSystem_PK.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/ComputeResourceFileSystem_PK.java
deleted file mode 100644
index 4df2d99..0000000
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/ComputeResourceFileSystem_PK.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- *
- * 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.aiaravata.application.catalog.data.model;
-
-import java.io.Serializable;
-
-public class ComputeResourceFileSystem_PK implements Serializable {
- private String computeResourceId;
- private String fileSystem;
- public ComputeResourceFileSystem_PK(String computeResourceId, String fileSystem){
- this.computeResourceId = computeResourceId;
- this.fileSystem = fileSystem;
- }
-
- public ComputeResourceFileSystem_PK() {
- }
-
- @Override
- public boolean equals(Object o) {
- return false;
- }
-
- @Override
- public int hashCode() {
- return 1;
- }
-
- public String getComputeResourceId() {
- return computeResourceId;
- }
-
- public String getFileSystem() {
- return fileSystem;
- }
-
- public void setComputeResourceId(String computeResourceId) {
- this.computeResourceId=computeResourceId;
- }
-
- public void setFileSystem(String fileSystem) {
- this.fileSystem=fileSystem;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/ComputeResourcePreference.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/ComputeResourcePreference.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/ComputeResourcePreference.java
deleted file mode 100644
index 7643519..0000000
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/ComputeResourcePreference.java
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
- *
- * 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.aiaravata.application.catalog.data.model;
-
-
-import javax.persistence.CascadeType;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.Id;
-import javax.persistence.IdClass;
-import javax.persistence.JoinColumn;
-import javax.persistence.ManyToOne;
-import javax.persistence.Table;
-
-@Entity
-@Table(name = "COMPUTE_RESOURCE_PREFERENCE")
-@IdClass(ComputeResourcePreferencePK.class)
-public class ComputeResourcePreference {
- @Id
- @Column(name = "GATEWAY_ID")
- private String gatewayId;
- @Id
- @Column(name = "RESOURCE_ID")
- private String resourceId;
- @Column(name = "OVERRIDE_BY_AIRAVATA")
- private boolean overrideByAiravata;
- @Column(name = "PREFERED_JOB_SUB_PROTOCOL")
- private String preferedJobSubmissionProtocol;
- @Column(name = "PREFERED_DATA_MOVE_PROTOCOL")
- private String preferedDataMoveProtocol;
- @Column(name = "PREFERED_BATCH_QUEUE")
- private String batchQueue;
- @Column(name = "SCRATCH_LOCATION")
- private String scratchLocation;
- @Column(name = "ALLOCATION_PROJECT_NUMBER")
- private String projectNumber;
- @Column(name = "LOGIN_USERNAME")
- private String loginUserName;
-
- @ManyToOne(cascade= CascadeType.MERGE)
- @JoinColumn(name = "RESOURCE_ID")
- private ComputeResource computeHostResource;
-
- @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 String getResourceId() {
- return resourceId;
- }
-
- public void setResourceId(String resourceId) {
- this.resourceId = resourceId;
- }
-
- public boolean isOverrideByAiravata() {
- return overrideByAiravata;
- }
-
- public void setOverrideByAiravata(boolean overrideByAiravata) {
- this.overrideByAiravata = overrideByAiravata;
- }
-
- public String getPreferedJobSubmissionProtocol() {
- return preferedJobSubmissionProtocol;
- }
-
- public void setPreferedJobSubmissionProtocol(String preferedJobSubmissionProtocol) {
- this.preferedJobSubmissionProtocol = preferedJobSubmissionProtocol;
- }
-
- public String getPreferedDataMoveProtocol() {
- return preferedDataMoveProtocol;
- }
-
- public void setPreferedDataMoveProtocol(String preferedDataMoveProtocol) {
- this.preferedDataMoveProtocol = preferedDataMoveProtocol;
- }
-
- public String getBatchQueue() {
- return batchQueue;
- }
-
- public void setBatchQueue(String batchQueue) {
- this.batchQueue = batchQueue;
- }
-
- public String getScratchLocation() {
- return scratchLocation;
- }
-
- public void setScratchLocation(String scratchLocation) {
- this.scratchLocation = scratchLocation;
- }
-
- public String getProjectNumber() {
- return projectNumber;
- }
-
- public void setProjectNumber(String projectNumber) {
- this.projectNumber = projectNumber;
- }
-
- public ComputeResource getComputeHostResource() {
- return computeHostResource;
- }
-
- public void setComputeHostResource(ComputeResource computeHostResource) {
- this.computeHostResource = computeHostResource;
- }
-
- 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;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/ComputeResourcePreferencePK.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/ComputeResourcePreferencePK.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/ComputeResourcePreferencePK.java
deleted file mode 100644
index 5e2c0b7..0000000
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/ComputeResourcePreferencePK.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- *
- * 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.aiaravata.application.catalog.data.model;
-
-import java.io.Serializable;
-
-public class ComputeResourcePreferencePK implements Serializable {
- private String gatewayId;
- private String resourceId;
-
- public ComputeResourcePreferencePK(String gatewayId, String resourceId) {
- this.gatewayId = gatewayId;
- this.resourceId = resourceId;
- }
-
- public ComputeResourcePreferencePK() {
- ;
- }
-
- @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 getResourceId() {
- return resourceId;
- }
-
- public void setResourceId(String resourceId) {
- this.resourceId = resourceId;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/Configuration.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/Configuration.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/Configuration.java
deleted file mode 100644
index 5bee8bf..0000000
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/Configuration.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
-*
-* 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.aiaravata.application.catalog.data.model;
-
-import org.apache.openjpa.persistence.DataCache;
-
-import javax.persistence.*;
-import java.io.Serializable;
-import java.sql.Timestamp;
-
-@DataCache
-@Entity
-@Table(name ="CONFIGURATION")
-@IdClass(Configuration_PK.class)
-public class Configuration implements Serializable {
- @Id
- @Column(name = "CONFIG_KEY")
- private String config_key;
-
- @Id
- @Column(name = "CONFIG_VAL")
- private String config_val;
-
- public String getConfig_key() {
- return config_key;
- }
-
- public String getConfig_val() {
- return config_val;
- }
-
- public void setConfig_key(String config_key) {
- this.config_key = config_key;
- }
-
- public void setConfig_val(String config_val) {
- this.config_val = config_val;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/Configuration_PK.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/Configuration_PK.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/Configuration_PK.java
deleted file mode 100644
index f9cfbab..0000000
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/Configuration_PK.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- *
- * 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.aiaravata.application.catalog.data.model;
-
-import java.io.Serializable;
-
-public class Configuration_PK implements Serializable {
- private String config_key;
- private String config_val;
-
- public Configuration_PK(String config_key, String config_val) {
- this.config_key = config_key;
- this.config_val = config_val;
- }
-
- public Configuration_PK() {
- ;
- }
-
- @Override
- public boolean equals(Object o) {
- return false;
- }
-
- @Override
- public int hashCode() {
- return 1;
- }
-
- public String getConfig_key() {
- return config_key;
- }
-
- public void setConfig_key(String config_key) {
- this.config_key = config_key;
- }
-
- public void setConfig_val(String config_val) {
- this.config_val = config_val;
- }
-
- public String getConfig_val() {
- return config_val;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/DataMovementInterface.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/DataMovementInterface.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/DataMovementInterface.java
deleted file mode 100644
index 9ba1a6d..0000000
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/DataMovementInterface.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- *
- * 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.aiaravata.application.catalog.data.model;
-
-import java.io.Serializable;
-import java.sql.Timestamp;
-
-import javax.persistence.CascadeType;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.Id;
-import javax.persistence.IdClass;
-import javax.persistence.JoinColumn;
-import javax.persistence.ManyToOne;
-import javax.persistence.Table;
-
-import org.apache.openjpa.persistence.DataCache;
-
-@DataCache
-@Entity
-@Table(name = "DATA_MOVEMENT_INTERFACE")
-@IdClass(DataMovementInterface_PK.class)
-public class DataMovementInterface implements Serializable {
-
- @Id
- @Column(name = "COMPUTE_RESOURCE_ID")
- private String computeResourceId;
-
- @ManyToOne(cascade= CascadeType.MERGE)
- @JoinColumn(name = "COMPUTE_RESOURCE_ID")
- private ComputeResource computeResource;
-
- @Column(name = "DATA_MOVEMENT_PROTOCOL")
- private String dataMovementProtocol;
-
- @Id
- @Column(name = "DATA_MOVEMENT_INTERFACE_ID")
- private String dataMovementInterfaceId;
-
- @Column(name = "PRIORITY_ORDER")
- private int priorityOrder;
-
- @Column(name = "CREATION_TIME")
- private Timestamp creationTime;
-
- @Column(name = "UPDATE_TIME")
- private Timestamp updateTime;
-
- public Timestamp getCreationTime() {
- return creationTime;
- }
-
- public void setCreationTime(Timestamp creationTime) {
- this.creationTime = creationTime;
- }
-
- public Timestamp getUpdateTime() {
- return updateTime;
- }
-
- public void setUpdateTime(Timestamp updateTime) {
- this.updateTime = updateTime;
- }
-
-
- public String getComputeResourceId() {
- return computeResourceId;
- }
-
- public ComputeResource getComputeResource() {
- return computeResource;
- }
-
- public String getDataMovementProtocol() {
- return dataMovementProtocol;
- }
-
- public String getDataMovementInterfaceId() {
- return dataMovementInterfaceId;
- }
-
- public int getPriorityOrder() {
- return priorityOrder;
- }
-
- public void setComputeResourceId(String computeResourceId) {
- this.computeResourceId=computeResourceId;
- }
-
- public void setComputeResource(ComputeResource computeResource) {
- this.computeResource=computeResource;
- }
-
- public void setDataMovementProtocol(String dataMovementProtocol) {
- this.dataMovementProtocol=dataMovementProtocol;
- }
-
- public void setDataMovementInterfaceId(String dataMovementInterfaceId) {
- this.dataMovementInterfaceId=dataMovementInterfaceId;
- }
-
- public void setPriorityOrder(int priorityOrder) {
- this.priorityOrder=priorityOrder;
- }
-}
[14/52] [abbrv] [partial] airavata git commit: registry refactoring
Posted by sh...@apache.org.
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/CloudSubmissionAppCatalogResourceAppCat.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/CloudSubmissionAppCatalogResourceAppCat.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/CloudSubmissionAppCatalogResourceAppCat.java
new file mode 100644
index 0000000..cb01e2a
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/CloudSubmissionAppCatalogResourceAppCat.java
@@ -0,0 +1,298 @@
+/*
+ *
+ * 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.CloudJobSubmission;
+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.List;
+
+public class CloudSubmissionAppCatalogResourceAppCat extends AppCatAbstractResource {
+ private final static Logger logger = LoggerFactory.getLogger(LocalSubmissionAppCatalogResourceAppCat.class);
+ private String jobSubmissionInterfaceId;
+ private String securityProtocol;
+ private String nodeId;
+ private String executableType;
+ private String providerName;
+ private String userAccountName;
+
+ @Override
+ public void remove(Object identifier) throws AppCatalogException {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(CLOUD_JOB_SUBMISSION);
+ generator.setParameter(LocalSubmissionConstants.JOB_SUBMISSION_INTERFACE_ID, identifier);
+ 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 {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(CLOUD_JOB_SUBMISSION);
+ generator.setParameter(LocalSubmissionConstants.JOB_SUBMISSION_INTERFACE_ID, identifier);
+ Query q = generator.selectQuery(em);
+ CloudJobSubmission cloudJobSubmission = (CloudJobSubmission) q.getSingleResult();
+ CloudSubmissionAppCatalogResourceAppCat localSubmissionResource = (CloudSubmissionAppCatalogResourceAppCat) AppCatalogJPAUtils.getResource(AppCatalogResourceType.ClOUD_SUBMISSION, cloudJobSubmission);
+ em.getTransaction().commit();
+ em.close();
+ return localSubmissionResource;
+ } 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> localSubmissionResources = new ArrayList<AppCatalogResource>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(CLOUD_JOB_SUBMISSION);
+ Query q;
+ if ((fieldName.equals(LocalSubmissionConstants.RESOURCE_JOB_MANAGER_ID)) || (fieldName.equals(LocalSubmissionConstants.JOB_SUBMISSION_INTERFACE_ID))) {
+ generator.setParameter(fieldName, value);
+ q = generator.selectQuery(em);
+ List<?> results = q.getResultList();
+ for (Object result : results) {
+ CloudJobSubmission localSubmission = (CloudJobSubmission) result;
+ CloudSubmissionAppCatalogResourceAppCat localSubmissionResource = (CloudSubmissionAppCatalogResourceAppCat) AppCatalogJPAUtils.getResource(AppCatalogResourceType.ClOUD_SUBMISSION, localSubmission);
+ localSubmissionResources.add(localSubmissionResource);
+ }
+ } else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for Local Submission Resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for Local Submission Resource.");
+ }
+ 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();
+ }
+ }
+ return localSubmissionResources;
+ }
+
+ @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 {
+ List<String> localSubmissionResourceIDs = new ArrayList<String>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(CLOUD_JOB_SUBMISSION);
+ Query q;
+ if ((fieldName.equals(LocalSubmissionConstants.RESOURCE_JOB_MANAGER_ID)) || (fieldName.equals(LocalSubmissionConstants.JOB_SUBMISSION_INTERFACE_ID))) {
+ generator.setParameter(fieldName, value);
+ q = generator.selectQuery(em);
+ List<?> results = q.getResultList();
+ for (Object result : results) {
+ CloudJobSubmission localSubmission = (CloudJobSubmission) result;
+ LocalSubmissionAppCatalogResourceAppCat localSubmissionResource = (LocalSubmissionAppCatalogResourceAppCat) AppCatalogJPAUtils.getResource(AppCatalogResourceType.ClOUD_SUBMISSION, localSubmission);
+ localSubmissionResourceIDs.add(localSubmissionResource.getJobSubmissionInterfaceId());
+ }
+ } else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for Local Submission Resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for Local Submission Resource.");
+ }
+ 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();
+ }
+ }
+ return localSubmissionResourceIDs;
+ }
+
+ @Override
+ public void save() throws AppCatalogException {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ CloudJobSubmission existingLocalSubmission = em.find(CloudJobSubmission.class, jobSubmissionInterfaceId);
+ em.close();
+ CloudJobSubmission cloudJobSubmission;
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ if (existingLocalSubmission == null) {
+ cloudJobSubmission = new CloudJobSubmission();
+ } else {
+ cloudJobSubmission = existingLocalSubmission;
+ }
+ cloudJobSubmission.setExecutableType(getExecutableType());
+ cloudJobSubmission.setNodeId(getNodeId());
+ cloudJobSubmission.setJobSubmissionInterfaceId(getJobSubmissionInterfaceId());
+ cloudJobSubmission.setSecurityProtocol(getSecurityProtocol());
+ cloudJobSubmission.setJobSubmissionInterfaceId(getJobSubmissionInterfaceId());
+ cloudJobSubmission.setUserAccountName(getUserAccountName());
+ cloudJobSubmission.setProviderName(getProviderName());
+ if (existingLocalSubmission == null) {
+ em.persist(cloudJobSubmission);
+ } else {
+ em.merge(cloudJobSubmission);
+ }
+ 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 {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ CloudJobSubmission localSubmission = em.find(CloudJobSubmission.class, identifier);
+ em.close();
+ return localSubmission != null;
+ } 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();
+ }
+ }
+ }
+
+ public String getJobSubmissionInterfaceId() {
+ return jobSubmissionInterfaceId;
+ }
+
+ public String getSecurityProtocol() {
+ return securityProtocol;
+ }
+
+ public void setSecurityProtocol(String securityProtocol) {
+ this.securityProtocol = securityProtocol;
+ }
+
+ public String getNodeId() {
+ return nodeId;
+ }
+
+ public void setNodeId(String nodeId) {
+ this.nodeId = nodeId;
+ }
+
+ public String getExecutableType() {
+ return executableType;
+ }
+
+ public void setExecutableType(String executableType) {
+ this.executableType = executableType;
+ }
+
+ public String getProviderName() {
+ return providerName;
+ }
+
+ public void setProviderName(String providerName) {
+ this.providerName = providerName;
+ }
+
+ public String getUserAccountName() {
+ return userAccountName;
+ }
+
+ public void setUserAccountName(String userAccountName) {
+ this.userAccountName = userAccountName;
+ }
+
+ public void setJobSubmissionInterfaceId(String jobSubmissionInterfaceId) {
+ this.jobSubmissionInterfaceId=jobSubmissionInterfaceId;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/CloudSubmissionResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/CloudSubmissionResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/CloudSubmissionResource.java
new file mode 100644
index 0000000..de55ca8
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/CloudSubmissionResource.java
@@ -0,0 +1,298 @@
+/*
+ *
+ * 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.aiaravata.application.catalog.data.resources;
+
+import org.airavata.appcatalog.cpi.AppCatalogException;
+import org.apache.aiaravata.application.catalog.data.model.CloudJobSubmission;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogJPAUtils;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogQueryGenerator;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogResourceType;
+import org.apache.airavata.common.exception.ApplicationSettingsException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.persistence.EntityManager;
+import javax.persistence.Query;
+import java.util.ArrayList;
+import java.util.List;
+
+public class CloudSubmissionResource extends AbstractResource {
+ private final static Logger logger = LoggerFactory.getLogger(LocalSubmissionResource.class);
+ private String jobSubmissionInterfaceId;
+ private String securityProtocol;
+ private String nodeId;
+ private String executableType;
+ private String providerName;
+ private String userAccountName;
+
+ @Override
+ public void remove(Object identifier) throws AppCatalogException {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(CLOUD_JOB_SUBMISSION);
+ generator.setParameter(LocalSubmissionConstants.JOB_SUBMISSION_INTERFACE_ID, identifier);
+ 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 Resource get(Object identifier) throws AppCatalogException {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(CLOUD_JOB_SUBMISSION);
+ generator.setParameter(LocalSubmissionConstants.JOB_SUBMISSION_INTERFACE_ID, identifier);
+ Query q = generator.selectQuery(em);
+ CloudJobSubmission cloudJobSubmission = (CloudJobSubmission) q.getSingleResult();
+ CloudSubmissionResource localSubmissionResource = (CloudSubmissionResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.ClOUD_SUBMISSION, cloudJobSubmission);
+ em.getTransaction().commit();
+ em.close();
+ return localSubmissionResource;
+ } 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<Resource> get(String fieldName, Object value) throws AppCatalogException {
+ List<Resource> localSubmissionResources = new ArrayList<Resource>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(CLOUD_JOB_SUBMISSION);
+ Query q;
+ if ((fieldName.equals(LocalSubmissionConstants.RESOURCE_JOB_MANAGER_ID)) || (fieldName.equals(LocalSubmissionConstants.JOB_SUBMISSION_INTERFACE_ID))) {
+ generator.setParameter(fieldName, value);
+ q = generator.selectQuery(em);
+ List<?> results = q.getResultList();
+ for (Object result : results) {
+ CloudJobSubmission localSubmission = (CloudJobSubmission) result;
+ CloudSubmissionResource localSubmissionResource = (CloudSubmissionResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.ClOUD_SUBMISSION, localSubmission);
+ localSubmissionResources.add(localSubmissionResource);
+ }
+ } else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for Local Submission Resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for Local Submission Resource.");
+ }
+ 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();
+ }
+ }
+ return localSubmissionResources;
+ }
+
+ @Override
+ public List<Resource> 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 {
+ List<String> localSubmissionResourceIDs = new ArrayList<String>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(CLOUD_JOB_SUBMISSION);
+ Query q;
+ if ((fieldName.equals(LocalSubmissionConstants.RESOURCE_JOB_MANAGER_ID)) || (fieldName.equals(LocalSubmissionConstants.JOB_SUBMISSION_INTERFACE_ID))) {
+ generator.setParameter(fieldName, value);
+ q = generator.selectQuery(em);
+ List<?> results = q.getResultList();
+ for (Object result : results) {
+ CloudJobSubmission localSubmission = (CloudJobSubmission) result;
+ LocalSubmissionResource localSubmissionResource = (LocalSubmissionResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.ClOUD_SUBMISSION, localSubmission);
+ localSubmissionResourceIDs.add(localSubmissionResource.getJobSubmissionInterfaceId());
+ }
+ } else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for Local Submission Resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for Local Submission Resource.");
+ }
+ 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();
+ }
+ }
+ return localSubmissionResourceIDs;
+ }
+
+ @Override
+ public void save() throws AppCatalogException {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ CloudJobSubmission existingLocalSubmission = em.find(CloudJobSubmission.class, jobSubmissionInterfaceId);
+ em.close();
+ CloudJobSubmission cloudJobSubmission;
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ if (existingLocalSubmission == null) {
+ cloudJobSubmission = new CloudJobSubmission();
+ } else {
+ cloudJobSubmission = existingLocalSubmission;
+ }
+ cloudJobSubmission.setExecutableType(getExecutableType());
+ cloudJobSubmission.setNodeId(getNodeId());
+ cloudJobSubmission.setJobSubmissionInterfaceId(getJobSubmissionInterfaceId());
+ cloudJobSubmission.setSecurityProtocol(getSecurityProtocol());
+ cloudJobSubmission.setJobSubmissionInterfaceId(getJobSubmissionInterfaceId());
+ cloudJobSubmission.setUserAccountName(getUserAccountName());
+ cloudJobSubmission.setProviderName(getProviderName());
+ if (existingLocalSubmission == null) {
+ em.persist(cloudJobSubmission);
+ } else {
+ em.merge(cloudJobSubmission);
+ }
+ 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 {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ CloudJobSubmission localSubmission = em.find(CloudJobSubmission.class, identifier);
+ em.close();
+ return localSubmission != null;
+ } 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();
+ }
+ }
+ }
+
+ public String getJobSubmissionInterfaceId() {
+ return jobSubmissionInterfaceId;
+ }
+
+ public String getSecurityProtocol() {
+ return securityProtocol;
+ }
+
+ public void setSecurityProtocol(String securityProtocol) {
+ this.securityProtocol = securityProtocol;
+ }
+
+ public String getNodeId() {
+ return nodeId;
+ }
+
+ public void setNodeId(String nodeId) {
+ this.nodeId = nodeId;
+ }
+
+ public String getExecutableType() {
+ return executableType;
+ }
+
+ public void setExecutableType(String executableType) {
+ this.executableType = executableType;
+ }
+
+ public String getProviderName() {
+ return providerName;
+ }
+
+ public void setProviderName(String providerName) {
+ this.providerName = providerName;
+ }
+
+ public String getUserAccountName() {
+ return userAccountName;
+ }
+
+ public void setUserAccountName(String userAccountName) {
+ this.userAccountName = userAccountName;
+ }
+
+ public void setJobSubmissionInterfaceId(String jobSubmissionInterfaceId) {
+ this.jobSubmissionInterfaceId=jobSubmissionInterfaceId;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/ComputeHostPreferenceAppCatalogResourceAppCat.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/ComputeHostPreferenceAppCatalogResourceAppCat.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/ComputeHostPreferenceAppCatalogResourceAppCat.java
new file mode 100644
index 0000000..80f03f7
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/ComputeHostPreferenceAppCatalogResourceAppCat.java
@@ -0,0 +1,413 @@
+/*
+ *
+ * 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.ComputeResource;
+import org.apache.airavata.registry.core.app.catalog.model.ComputeResourcePreference;
+import org.apache.airavata.registry.core.app.catalog.model.ComputeResourcePreferencePK;
+import org.apache.airavata.registry.core.app.catalog.model.GatewayProfile;
+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 ComputeHostPreferenceAppCatalogResourceAppCat extends AppCatAbstractResource {
+ private final static Logger logger = LoggerFactory.getLogger(ComputeHostPreferenceAppCatalogResourceAppCat.class);
+ private String gatewayId;
+ private String resourceId;
+ private boolean overrideByAiravata;
+ private String preferredJobProtocol;
+ private String preferedDMProtocol;
+ private String batchQueue;
+ private String scratchLocation;
+ private String projectNumber;
+ private String loginUserName;
+
+ private GatewayProfileAppCatalogResourceAppCat gatewayProfile;
+ private ComputeResourceAppCatalogResourceAppCat computeHostResource;
+
+ 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 String getResourceId() {
+ return resourceId;
+ }
+
+ public void setResourceId(String resourceId) {
+ this.resourceId = resourceId;
+ }
+
+ public boolean getOverrideByAiravata() {
+ return overrideByAiravata;
+ }
+
+ public void setOverrideByAiravata(boolean overrideByAiravata) {
+ this.overrideByAiravata = overrideByAiravata;
+ }
+
+ public String getPreferredJobProtocol() {
+ return preferredJobProtocol;
+ }
+
+ public void setPreferredJobProtocol(String preferredJobProtocol) {
+ this.preferredJobProtocol = preferredJobProtocol;
+ }
+
+ public String getPreferedDMProtocol() {
+ return preferedDMProtocol;
+ }
+
+ public void setPreferedDMProtocol(String preferedDMProtocol) {
+ this.preferedDMProtocol = preferedDMProtocol;
+ }
+
+ public String getBatchQueue() {
+ return batchQueue;
+ }
+
+ public void setBatchQueue(String batchQueue) {
+ this.batchQueue = batchQueue;
+ }
+
+ public String getScratchLocation() {
+ return scratchLocation;
+ }
+
+ public void setScratchLocation(String scratchLocation) {
+ this.scratchLocation = scratchLocation;
+ }
+
+ public String getProjectNumber() {
+ return projectNumber;
+ }
+
+ public void setProjectNumber(String projectNumber) {
+ this.projectNumber = projectNumber;
+ }
+
+ public GatewayProfileAppCatalogResourceAppCat getGatewayProfile() {
+ return gatewayProfile;
+ }
+
+ public void setGatewayProfile(GatewayProfileAppCatalogResourceAppCat gatewayProfile) {
+ this.gatewayProfile = gatewayProfile;
+ }
+
+ public ComputeResourceAppCatalogResourceAppCat getComputeHostResource() {
+ return computeHostResource;
+ }
+
+ public void setComputeHostResource(ComputeResourceAppCatalogResourceAppCat computeHostResource) {
+ this.computeHostResource = computeHostResource;
+ }
+
+ @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(COMPUTE_RESOURCE_PREFERENCE);
+ generator.setParameter(ComputeResourcePreferenceConstants.RESOURCE_ID, ids.get(ComputeResourcePreferenceConstants.RESOURCE_ID));
+ generator.setParameter(ComputeResourcePreferenceConstants.GATEWAY_ID, ids.get(ComputeResourcePreferenceConstants.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(COMPUTE_RESOURCE_PREFERENCE);
+ generator.setParameter(ComputeResourcePreferenceConstants.GATEWAY_ID, ids.get(ComputeResourcePreferenceConstants.GATEWAY_ID));
+ generator.setParameter(ComputeResourcePreferenceConstants.RESOURCE_ID, ids.get(ComputeResourcePreferenceConstants.RESOURCE_ID));
+ Query q = generator.selectQuery(em);
+ ComputeResourcePreference preference = (ComputeResourcePreference) q.getSingleResult();
+ ComputeHostPreferenceAppCatalogResourceAppCat preferenceResource =
+ (ComputeHostPreferenceAppCatalogResourceAppCat) AppCatalogJPAUtils.getResource(AppCatalogResourceType.COMPUTE_RESOURCE_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(COMPUTE_RESOURCE_PREFERENCE);
+ List results;
+ if (fieldName.equals(ComputeResourcePreferenceConstants.RESOURCE_ID)) {
+ generator.setParameter(ComputeResourcePreferenceConstants.RESOURCE_ID, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ ComputeResourcePreference preference = (ComputeResourcePreference) result;
+ if (preference.getComputeHostResource()!=null) {
+ ComputeHostPreferenceAppCatalogResourceAppCat preferenceResource = (ComputeHostPreferenceAppCatalogResourceAppCat) AppCatalogJPAUtils
+ .getResource(
+ AppCatalogResourceType.COMPUTE_RESOURCE_PREFERENCE,
+ preference);
+ preferenceResourceList.add(preferenceResource);
+ }
+ }
+ }
+ } else if (fieldName.equals(ComputeResourcePreferenceConstants.GATEWAY_ID)) {
+ generator.setParameter(ComputeResourcePreferenceConstants.GATEWAY_ID, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ ComputeResourcePreference preference = (ComputeResourcePreference) result;
+ if (preference.getComputeHostResource()!=null) {
+ ComputeHostPreferenceAppCatalogResourceAppCat preferenceResource =
+ (ComputeHostPreferenceAppCatalogResourceAppCat) AppCatalogJPAUtils.getResource(AppCatalogResourceType.COMPUTE_RESOURCE_PREFERENCE, preference);
+ preferenceResourceList.add(preferenceResource);
+ }
+ }
+ }
+ } else if (fieldName.equals(ComputeResourcePreferenceConstants.PREFERED_JOB_SUB_PROTOCOL)) {
+ generator.setParameter(ComputeResourcePreferenceConstants.PREFERED_JOB_SUB_PROTOCOL, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ ComputeResourcePreference preference = (ComputeResourcePreference) result;
+ if (preference.getComputeHostResource()!=null) {
+ ComputeHostPreferenceAppCatalogResourceAppCat preferenceResource = (ComputeHostPreferenceAppCatalogResourceAppCat) AppCatalogJPAUtils
+ .getResource(
+ AppCatalogResourceType.COMPUTE_RESOURCE_PREFERENCE,
+ preference);
+ preferenceResourceList.add(preferenceResource);
+ }
+ }
+ }
+ } else if (fieldName.equals(ComputeResourcePreferenceConstants.PREFERED_DATA_MOVE_PROTOCOL)) {
+ generator.setParameter(ComputeResourcePreferenceConstants.PREFERED_DATA_MOVE_PROTOCOL, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ ComputeResourcePreference preference = (ComputeResourcePreference) result;
+ if (preference.getResourceId()!=null) {
+ ComputeHostPreferenceAppCatalogResourceAppCat preferenceResource = (ComputeHostPreferenceAppCatalogResourceAppCat) AppCatalogJPAUtils
+ .getResource(
+ AppCatalogResourceType.COMPUTE_RESOURCE_PREFERENCE,
+ preference);
+ preferenceResourceList.add(preferenceResource);
+ }
+ }
+ }
+ } else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for Compute host preference Resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for Compute host 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();
+ ComputeResourcePreference existingPreference = em.find(ComputeResourcePreference.class, new ComputeResourcePreferencePK(gatewayId, resourceId));
+ em.close();
+
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ ComputeResource computeResource = em.find(ComputeResource.class, resourceId);
+ GatewayProfile gatewayProf = em.find(GatewayProfile.class, gatewayId);
+ if (existingPreference != null) {
+ existingPreference.setResourceId(resourceId);
+ existingPreference.setGatewayId(gatewayId);
+ existingPreference.setComputeHostResource(computeResource);
+ existingPreference.setGatewayProfile(gatewayProf);
+ existingPreference.setOverrideByAiravata(overrideByAiravata);
+ existingPreference.setPreferedJobSubmissionProtocol(preferredJobProtocol);
+ existingPreference.setPreferedDataMoveProtocol(preferedDMProtocol);
+ existingPreference.setScratchLocation(scratchLocation);
+ existingPreference.setProjectNumber(projectNumber);
+ existingPreference.setBatchQueue(batchQueue);
+ existingPreference.setLoginUserName(loginUserName);
+ em.merge(existingPreference);
+ } else {
+ ComputeResourcePreference resourcePreference = new ComputeResourcePreference();
+ resourcePreference.setResourceId(resourceId);
+ resourcePreference.setGatewayId(gatewayId);
+ resourcePreference.setComputeHostResource(computeResource);
+ resourcePreference.setGatewayProfile(gatewayProf);
+ resourcePreference.setOverrideByAiravata(overrideByAiravata);
+ resourcePreference.setPreferedJobSubmissionProtocol(preferredJobProtocol);
+ resourcePreference.setPreferedDataMoveProtocol(preferedDMProtocol);
+ resourcePreference.setScratchLocation(scratchLocation);
+ resourcePreference.setProjectNumber(projectNumber);
+ resourcePreference.setBatchQueue(batchQueue);
+ resourcePreference.setLoginUserName(loginUserName);
+ 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();
+ ComputeResourcePreference existingPreference = em.find(ComputeResourcePreference.class,
+ new ComputeResourcePreferencePK(ids.get(ComputeResourcePreferenceConstants.GATEWAY_ID),
+ ids.get(ComputeResourcePreferenceConstants.RESOURCE_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/ec8c6202/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
new file mode 100644
index 0000000..51f22d5
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/ComputeHostPreferenceResource.java
@@ -0,0 +1,413 @@
+/*
+ *
+ * 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.aiaravata.application.catalog.data.resources;
+
+import org.airavata.appcatalog.cpi.AppCatalogException;
+import org.apache.aiaravata.application.catalog.data.model.ComputeResource;
+import org.apache.aiaravata.application.catalog.data.model.ComputeResourcePreference;
+import org.apache.aiaravata.application.catalog.data.model.ComputeResourcePreferencePK;
+import org.apache.aiaravata.application.catalog.data.model.GatewayProfile;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogJPAUtils;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogQueryGenerator;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogResourceType;
+import org.apache.airavata.common.exception.ApplicationSettingsException;
+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 ComputeHostPreferenceResource extends AbstractResource {
+ private final static Logger logger = LoggerFactory.getLogger(ComputeHostPreferenceResource.class);
+ private String gatewayId;
+ private String resourceId;
+ private boolean overrideByAiravata;
+ private String preferredJobProtocol;
+ private String preferedDMProtocol;
+ private String batchQueue;
+ private String scratchLocation;
+ private String projectNumber;
+ private String loginUserName;
+
+ private GatewayProfileResource gatewayProfile;
+ private ComputeResourceResource computeHostResource;
+
+ 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 String getResourceId() {
+ return resourceId;
+ }
+
+ public void setResourceId(String resourceId) {
+ this.resourceId = resourceId;
+ }
+
+ public boolean getOverrideByAiravata() {
+ return overrideByAiravata;
+ }
+
+ public void setOverrideByAiravata(boolean overrideByAiravata) {
+ this.overrideByAiravata = overrideByAiravata;
+ }
+
+ public String getPreferredJobProtocol() {
+ return preferredJobProtocol;
+ }
+
+ public void setPreferredJobProtocol(String preferredJobProtocol) {
+ this.preferredJobProtocol = preferredJobProtocol;
+ }
+
+ public String getPreferedDMProtocol() {
+ return preferedDMProtocol;
+ }
+
+ public void setPreferedDMProtocol(String preferedDMProtocol) {
+ this.preferedDMProtocol = preferedDMProtocol;
+ }
+
+ public String getBatchQueue() {
+ return batchQueue;
+ }
+
+ public void setBatchQueue(String batchQueue) {
+ this.batchQueue = batchQueue;
+ }
+
+ public String getScratchLocation() {
+ return scratchLocation;
+ }
+
+ public void setScratchLocation(String scratchLocation) {
+ this.scratchLocation = scratchLocation;
+ }
+
+ public String getProjectNumber() {
+ return projectNumber;
+ }
+
+ public void setProjectNumber(String projectNumber) {
+ this.projectNumber = projectNumber;
+ }
+
+ public GatewayProfileResource getGatewayProfile() {
+ return gatewayProfile;
+ }
+
+ public void setGatewayProfile(GatewayProfileResource gatewayProfile) {
+ this.gatewayProfile = gatewayProfile;
+ }
+
+ public ComputeResourceResource getComputeHostResource() {
+ return computeHostResource;
+ }
+
+ public void setComputeHostResource(ComputeResourceResource computeHostResource) {
+ this.computeHostResource = computeHostResource;
+ }
+
+ @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(COMPUTE_RESOURCE_PREFERENCE);
+ generator.setParameter(ComputeResourcePreferenceConstants.RESOURCE_ID, ids.get(ComputeResourcePreferenceConstants.RESOURCE_ID));
+ generator.setParameter(ComputeResourcePreferenceConstants.GATEWAY_ID, ids.get(ComputeResourcePreferenceConstants.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 Resource 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(COMPUTE_RESOURCE_PREFERENCE);
+ generator.setParameter(ComputeResourcePreferenceConstants.GATEWAY_ID, ids.get(ComputeResourcePreferenceConstants.GATEWAY_ID));
+ generator.setParameter(ComputeResourcePreferenceConstants.RESOURCE_ID, ids.get(ComputeResourcePreferenceConstants.RESOURCE_ID));
+ Query q = generator.selectQuery(em);
+ ComputeResourcePreference preference = (ComputeResourcePreference) q.getSingleResult();
+ ComputeHostPreferenceResource preferenceResource =
+ (ComputeHostPreferenceResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.COMPUTE_RESOURCE_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<Resource> get(String fieldName, Object value) throws AppCatalogException {
+ List<Resource> preferenceResourceList = new ArrayList<Resource>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ Query q;
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(COMPUTE_RESOURCE_PREFERENCE);
+ List results;
+ if (fieldName.equals(ComputeResourcePreferenceConstants.RESOURCE_ID)) {
+ generator.setParameter(ComputeResourcePreferenceConstants.RESOURCE_ID, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ ComputeResourcePreference preference = (ComputeResourcePreference) result;
+ if (preference.getComputeHostResource()!=null) {
+ ComputeHostPreferenceResource preferenceResource = (ComputeHostPreferenceResource) AppCatalogJPAUtils
+ .getResource(
+ AppCatalogResourceType.COMPUTE_RESOURCE_PREFERENCE,
+ preference);
+ preferenceResourceList.add(preferenceResource);
+ }
+ }
+ }
+ } else if (fieldName.equals(ComputeResourcePreferenceConstants.GATEWAY_ID)) {
+ generator.setParameter(ComputeResourcePreferenceConstants.GATEWAY_ID, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ ComputeResourcePreference preference = (ComputeResourcePreference) result;
+ if (preference.getComputeHostResource()!=null) {
+ ComputeHostPreferenceResource preferenceResource =
+ (ComputeHostPreferenceResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.COMPUTE_RESOURCE_PREFERENCE, preference);
+ preferenceResourceList.add(preferenceResource);
+ }
+ }
+ }
+ } else if (fieldName.equals(ComputeResourcePreferenceConstants.PREFERED_JOB_SUB_PROTOCOL)) {
+ generator.setParameter(ComputeResourcePreferenceConstants.PREFERED_JOB_SUB_PROTOCOL, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ ComputeResourcePreference preference = (ComputeResourcePreference) result;
+ if (preference.getComputeHostResource()!=null) {
+ ComputeHostPreferenceResource preferenceResource = (ComputeHostPreferenceResource) AppCatalogJPAUtils
+ .getResource(
+ AppCatalogResourceType.COMPUTE_RESOURCE_PREFERENCE,
+ preference);
+ preferenceResourceList.add(preferenceResource);
+ }
+ }
+ }
+ } else if (fieldName.equals(ComputeResourcePreferenceConstants.PREFERED_DATA_MOVE_PROTOCOL)) {
+ generator.setParameter(ComputeResourcePreferenceConstants.PREFERED_DATA_MOVE_PROTOCOL, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ ComputeResourcePreference preference = (ComputeResourcePreference) result;
+ if (preference.getResourceId()!=null) {
+ ComputeHostPreferenceResource preferenceResource = (ComputeHostPreferenceResource) AppCatalogJPAUtils
+ .getResource(
+ AppCatalogResourceType.COMPUTE_RESOURCE_PREFERENCE,
+ preference);
+ preferenceResourceList.add(preferenceResource);
+ }
+ }
+ }
+ } else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for Compute host preference Resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for Compute host 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<Resource> 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();
+ ComputeResourcePreference existingPreference = em.find(ComputeResourcePreference.class, new ComputeResourcePreferencePK(gatewayId, resourceId));
+ em.close();
+
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ ComputeResource computeResource = em.find(ComputeResource.class, resourceId);
+ GatewayProfile gatewayProf = em.find(GatewayProfile.class, gatewayId);
+ if (existingPreference != null) {
+ existingPreference.setResourceId(resourceId);
+ existingPreference.setGatewayId(gatewayId);
+ existingPreference.setComputeHostResource(computeResource);
+ existingPreference.setGatewayProfile(gatewayProf);
+ existingPreference.setOverrideByAiravata(overrideByAiravata);
+ existingPreference.setPreferedJobSubmissionProtocol(preferredJobProtocol);
+ existingPreference.setPreferedDataMoveProtocol(preferedDMProtocol);
+ existingPreference.setScratchLocation(scratchLocation);
+ existingPreference.setProjectNumber(projectNumber);
+ existingPreference.setBatchQueue(batchQueue);
+ existingPreference.setLoginUserName(loginUserName);
+ em.merge(existingPreference);
+ } else {
+ ComputeResourcePreference resourcePreference = new ComputeResourcePreference();
+ resourcePreference.setResourceId(resourceId);
+ resourcePreference.setGatewayId(gatewayId);
+ resourcePreference.setComputeHostResource(computeResource);
+ resourcePreference.setGatewayProfile(gatewayProf);
+ resourcePreference.setOverrideByAiravata(overrideByAiravata);
+ resourcePreference.setPreferedJobSubmissionProtocol(preferredJobProtocol);
+ resourcePreference.setPreferedDataMoveProtocol(preferedDMProtocol);
+ resourcePreference.setScratchLocation(scratchLocation);
+ resourcePreference.setProjectNumber(projectNumber);
+ resourcePreference.setBatchQueue(batchQueue);
+ resourcePreference.setLoginUserName(loginUserName);
+ 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();
+ ComputeResourcePreference existingPreference = em.find(ComputeResourcePreference.class,
+ new ComputeResourcePreferencePK(ids.get(ComputeResourcePreferenceConstants.GATEWAY_ID),
+ ids.get(ComputeResourcePreferenceConstants.RESOURCE_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/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/ComputeResourceAppCatalogResourceAppCat.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/ComputeResourceAppCatalogResourceAppCat.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/ComputeResourceAppCatalogResourceAppCat.java
new file mode 100644
index 0000000..38e6988
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/ComputeResourceAppCatalogResourceAppCat.java
@@ -0,0 +1,351 @@
+/*
+ *
+ * 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.common.utils.AiravataUtils;
+import org.apache.airavata.registry.core.app.catalog.model.ComputeResource;
+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.sql.Timestamp;
+import java.util.ArrayList;
+import java.util.List;
+
+public class ComputeResourceAppCatalogResourceAppCat extends AppCatAbstractResource {
+ private final static Logger logger = LoggerFactory.getLogger(ComputeResourceAppCatalogResourceAppCat.class);
+ private String resourceDescription;
+ private String resourceId;
+ private String hostName;
+ private Timestamp createdTime;
+ private Timestamp updatedTime;
+ private int maxMemoryPerNode;
+
+ public int getMaxMemoryPerNode() {
+ return maxMemoryPerNode;
+ }
+
+ public void setMaxMemoryPerNode(int maxMemoryPerNode) {
+ this.maxMemoryPerNode = maxMemoryPerNode;
+ }
+
+ public Timestamp getCreatedTime() {
+ return createdTime;
+ }
+
+ public void setCreatedTime(Timestamp createdTime) {
+ this.createdTime = createdTime;
+ }
+
+ public Timestamp getUpdatedTime() {
+ return updatedTime;
+ }
+
+ public void setUpdatedTime(Timestamp updatedTime) {
+ this.updatedTime = updatedTime;
+ }
+
+ @Override
+ public void remove(Object identifier) throws AppCatalogException {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(COMPUTE_RESOURCE);
+ generator.setParameter(ComputeResourceConstants.RESOURCE_ID, identifier);
+ 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 {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(COMPUTE_RESOURCE);
+ generator.setParameter(ComputeResourceConstants.RESOURCE_ID, identifier);
+ Query q = generator.selectQuery(em);
+ ComputeResource computeResource = (ComputeResource) q.getSingleResult();
+ ComputeResourceAppCatalogResourceAppCat computeResourceResource = (ComputeResourceAppCatalogResourceAppCat) AppCatalogJPAUtils.getResource(AppCatalogResourceType.COMPUTE_RESOURCE, computeResource);
+ em.getTransaction().commit();
+ em.close();
+ return computeResourceResource;
+ } 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> computeResourceResources = new ArrayList<AppCatalogResource>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(COMPUTE_RESOURCE);
+ Query q;
+ if ((fieldName.equals(ComputeResourceConstants.RESOURCE_DESCRIPTION)) || (fieldName.equals(ComputeResourceConstants.RESOURCE_ID)) || (fieldName.equals(ComputeResourceConstants.HOST_NAME))) {
+ generator.setParameter(fieldName, value);
+ q = generator.selectQuery(em);
+ List<?> results = q.getResultList();
+ for (Object result : results) {
+ ComputeResource computeResource = (ComputeResource) result;
+ ComputeResourceAppCatalogResourceAppCat computeResourceResource = (ComputeResourceAppCatalogResourceAppCat) AppCatalogJPAUtils.getResource(AppCatalogResourceType.COMPUTE_RESOURCE, computeResource);
+ computeResourceResources.add(computeResourceResource);
+ }
+ } else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for Compute Resource Resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for Compute Resource Resource.");
+ }
+ 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();
+ }
+ }
+ return computeResourceResources;
+ }
+
+ @Override
+ public List<AppCatalogResource> getAll() throws AppCatalogException {
+ List<AppCatalogResource> computeResourceResources = new ArrayList<AppCatalogResource>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(COMPUTE_RESOURCE);
+ Query q = generator.selectQuery(em);
+ List<?> results = q.getResultList();
+ for (Object result : results) {
+ ComputeResource computeResource = (ComputeResource) result;
+ ComputeResourceAppCatalogResourceAppCat computeResourceResource = (ComputeResourceAppCatalogResourceAppCat) AppCatalogJPAUtils.getResource(AppCatalogResourceType.COMPUTE_RESOURCE, computeResource);
+ computeResourceResources.add(computeResourceResource);
+ }
+ 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();
+ }
+ }
+ return computeResourceResources;
+ }
+
+ @Override
+ public List<String> getAllIds() throws AppCatalogException {
+ List<String> computeResourceResources = new ArrayList<String>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(COMPUTE_RESOURCE);
+ Query q = generator.selectQuery(em);
+ List<?> results = q.getResultList();
+ for (Object result : results) {
+ ComputeResource computeResource = (ComputeResource) result;
+ computeResourceResources.add(computeResource.getResourceId());
+ }
+ 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();
+ }
+ }
+ return computeResourceResources;
+ }
+
+ @Override
+ public List<String> getIds(String fieldName, Object value) throws AppCatalogException {
+ List<String> computeResourceResourceIDs = new ArrayList<String>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(COMPUTE_RESOURCE);
+ Query q;
+ if ((fieldName.equals(ComputeResourceConstants.RESOURCE_DESCRIPTION)) || (fieldName.equals(ComputeResourceConstants.RESOURCE_ID)) || (fieldName.equals(ComputeResourceConstants.HOST_NAME))) {
+ generator.setParameter(fieldName, value);
+ q = generator.selectQuery(em);
+ List<?> results = q.getResultList();
+ for (Object result : results) {
+ ComputeResource computeResource = (ComputeResource) result;
+ ComputeResourceAppCatalogResourceAppCat computeResourceResource = (ComputeResourceAppCatalogResourceAppCat) AppCatalogJPAUtils.getResource(AppCatalogResourceType.COMPUTE_RESOURCE, computeResource);
+ computeResourceResourceIDs.add(computeResourceResource.getResourceId());
+ }
+ } else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for Compute Resource Resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for Compute Resource Resource.");
+ }
+ 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();
+ }
+ }
+ return computeResourceResourceIDs;
+ }
+
+ @Override
+ public void save() throws AppCatalogException {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ ComputeResource existingComputeResource = em.find(ComputeResource.class, resourceId);
+ em.close();
+ ComputeResource computeResource;
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ if (existingComputeResource == null) {
+ computeResource = new ComputeResource();
+ computeResource.setCreationTime(AiravataUtils.getCurrentTimestamp());
+ } else {
+ computeResource = existingComputeResource;
+ computeResource.setUpdateTime(AiravataUtils.getCurrentTimestamp());
+ }
+ computeResource.setResourceDescription(getResourceDescription());
+ computeResource.setResourceId(getResourceId());
+ computeResource.setHostName(getHostName());
+ computeResource.setMaxMemoryPerNode(getMaxMemoryPerNode());
+ if (existingComputeResource == null) {
+ em.persist(computeResource);
+ } else {
+ em.merge(computeResource);
+ }
+ 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 {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ ComputeResource computeResource = em.find(ComputeResource.class, identifier);
+ em.close();
+ return computeResource != null;
+ } 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();
+ }
+ }
+ }
+
+ public String getResourceDescription() {
+ return resourceDescription;
+ }
+
+ public String getResourceId() {
+ return resourceId;
+ }
+
+ public String getHostName() {
+ return hostName;
+ }
+
+ public void setResourceDescription(String resourceDescription) {
+ this.resourceDescription=resourceDescription;
+ }
+
+ public void setResourceId(String resourceId) {
+ this.resourceId=resourceId;
+ }
+
+ public void setHostName(String hostName) {
+ this.hostName=hostName;
+ }
+}
\ No newline at end of file
[21/52] [abbrv] [partial] airavata git commit: registry refactoring
Posted by sh...@apache.org.
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/impl/ComputeResourceImpl.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/impl/ComputeResourceImpl.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/impl/ComputeResourceImpl.java
new file mode 100644
index 0000000..0f14078
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/impl/ComputeResourceImpl.java
@@ -0,0 +1,888 @@
+/*
+ *
+ * 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.impl;
+
+import java.util.*;
+
+import org.apache.airavata.model.appcatalog.computeresource.*;
+import org.apache.airavata.registry.core.app.catalog.resources.*;
+import org.apache.airavata.registry.core.app.catalog.util.AppCatalogThriftConversion;
+import org.apache.airavata.registry.core.app.catalog.util.AppCatalogUtils;
+import org.apache.airavata.registry.cpi.AppCatalogException;
+import org.apache.airavata.registry.cpi.ComputeResource;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class ComputeResourceImpl implements ComputeResource {
+ private final static Logger logger = LoggerFactory.getLogger(ComputeResourceImpl.class);
+
+ @Override
+ public String addComputeResource(ComputeResourceDescription description) throws AppCatalogException {
+ try {
+ if (description.getComputeResourceId().equals("") || description.getComputeResourceId().equals(computeResourceModelConstants.DEFAULT_ID)){
+ description.setComputeResourceId(AppCatalogUtils.getID(description.getHostName()));
+ }
+ return saveComputeResourceDescriptorData(description);
+ } catch (Exception e) {
+ logger.error("Error while saving compute resource...", e);
+ throw new AppCatalogException(e);
+ }
+ }
+
+ protected String saveComputeResourceDescriptorData(
+ ComputeResourceDescription description) throws AppCatalogException {
+ //TODO remove existing one
+ ComputeResourceAppCatalogResourceAppCat computeHostResource = saveComputeResource(description);
+ saveHostAliases(description, computeHostResource);
+ saveIpAddresses(description, computeHostResource);
+ saveBatchQueues(description, computeHostResource);
+ saveFileSystems(description, computeHostResource);
+ saveJobSubmissionInterfaces(description, computeHostResource);
+ saveDataMovementInterfaces(description, computeHostResource);
+ return computeHostResource.getResourceId();
+ }
+
+ protected ComputeResourceAppCatalogResourceAppCat saveComputeResource(
+ ComputeResourceDescription description) throws AppCatalogException {
+ ComputeResourceAppCatalogResourceAppCat computeHostResource = AppCatalogThriftConversion.getComputeHostResource(description);
+ computeHostResource.save();
+ return computeHostResource;
+ }
+
+ protected void saveDataMovementInterfaces(
+ ComputeResourceDescription description,
+ ComputeResourceAppCatalogResourceAppCat computeHostResource)
+ throws AppCatalogException {
+ List<DataMovementInterface> dataMovemenetInterfaces = description.getDataMovementInterfaces();
+ if (dataMovemenetInterfaces != null && !dataMovemenetInterfaces.isEmpty()) {
+ for (DataMovementInterface dataMovementInterface : dataMovemenetInterfaces) {
+ DataMovementInterfaceAppCatalogResourceAppCat dmir = AppCatalogThriftConversion.getDataMovementInterface(dataMovementInterface);
+ dmir.setComputeHostResource(computeHostResource);
+ dmir.setComputeResourceId(computeHostResource.getResourceId());
+ dmir.save();
+ }
+ }
+ }
+
+ protected void saveJobSubmissionInterfaces(
+ ComputeResourceDescription description,
+ ComputeResourceAppCatalogResourceAppCat computeHostResource)
+ throws AppCatalogException {
+ List<JobSubmissionInterface> jobSubmissionInterfaces = description.getJobSubmissionInterfaces();
+ if (jobSubmissionInterfaces != null && !jobSubmissionInterfaces.isEmpty()) {
+ for (JobSubmissionInterface jobSubmissionInterface : jobSubmissionInterfaces) {
+ JobSubmissionInterfaceAppCatalogResourceAppCat jsir = AppCatalogThriftConversion.getJobSubmissionInterface(jobSubmissionInterface);
+ jsir.setComputeHostResource(computeHostResource);
+ jsir.setComputeResourceId(computeHostResource.getResourceId());
+ jsir.save();
+ }
+ }
+ }
+
+ protected void saveFileSystems(ComputeResourceDescription description,
+ ComputeResourceAppCatalogResourceAppCat computeHostResource)
+ throws AppCatalogException {
+ Map<FileSystems, String> fileSystems = description.getFileSystems();
+ if (fileSystems != null && !fileSystems.isEmpty()) {
+ for (FileSystems key : fileSystems.keySet()) {
+ ComputeResourceFileSystemAppCatalogResourceAppCat computeResourceFileSystemResource = new ComputeResourceFileSystemAppCatalogResourceAppCat();
+ computeResourceFileSystemResource.setComputeHostResource(computeHostResource);
+ computeResourceFileSystemResource.setComputeResourceId(computeHostResource.getResourceId());
+ computeResourceFileSystemResource.setFileSystem(key.toString());
+ computeResourceFileSystemResource.setPath(fileSystems.get(key));
+ computeResourceFileSystemResource.save();
+ }
+ }
+ }
+
+ protected void saveBatchQueues(ComputeResourceDescription description,
+ ComputeResourceAppCatalogResourceAppCat computeHostResource)
+ throws AppCatalogException {
+ List<BatchQueue> batchQueueList = description.getBatchQueues();
+ if (batchQueueList != null && !batchQueueList.isEmpty()) {
+ for (BatchQueue batchQueue : batchQueueList) {
+ BatchQueueAppCatalogResourceAppCat bq = AppCatalogThriftConversion.getBatchQueue(batchQueue);
+ bq.setComputeResourceId(computeHostResource.getResourceId());
+ bq.setComputeHostResource(computeHostResource);
+ bq.save();
+ }
+ }
+ }
+
+ protected void saveIpAddresses(ComputeResourceDescription description,
+ ComputeResourceAppCatalogResourceAppCat computeHostResource)
+ throws AppCatalogException {
+ List<String> ipAddresses = description.getIpAddresses();
+ HostIPAddressAppCatalogResourceAppCat resource = new HostIPAddressAppCatalogResourceAppCat();
+ resource.remove(description.getComputeResourceId());
+ if (ipAddresses != null && !ipAddresses.isEmpty()) {
+ for (String ipAddress : ipAddresses) {
+ HostIPAddressAppCatalogResourceAppCat ipAddressResource = new HostIPAddressAppCatalogResourceAppCat();
+ ipAddressResource.setComputeHostResource(computeHostResource);
+ ipAddressResource.setResourceID(computeHostResource.getResourceId());
+ ipAddressResource.setIpaddress(ipAddress);
+ ipAddressResource.save();
+ }
+ }
+ }
+
+ protected void saveHostAliases(ComputeResourceDescription description,
+ ComputeResourceAppCatalogResourceAppCat computeHostResource)
+ throws AppCatalogException {
+ List<String> hostAliases = description.getHostAliases();
+ // delete previous host aliases
+ HostAliasAppCatalogResourceAppCat resource = new HostAliasAppCatalogResourceAppCat();
+ resource.remove(description.getComputeResourceId());
+ if (hostAliases != null && !hostAliases.isEmpty()) {
+ for (String alias : hostAliases) {
+ HostAliasAppCatalogResourceAppCat aliasResource = new HostAliasAppCatalogResourceAppCat();
+ aliasResource.setComputeHostResource(computeHostResource);
+ aliasResource.setResourceID(computeHostResource.getResourceId());
+ aliasResource.setAlias(alias);
+ aliasResource.save();
+ }
+ }
+ }
+
+ @Override
+ public void updateComputeResource(String computeResourceId, ComputeResourceDescription updatedComputeResource) throws AppCatalogException{
+ try {
+ saveComputeResourceDescriptorData(updatedComputeResource);
+ } catch (Exception e) {
+ logger.error("Error while updating compute resource...", e);
+ throw new AppCatalogException(e);
+ }
+ }
+
+ @Override
+ public String addSSHJobSubmission(SSHJobSubmission sshJobSubmission) throws AppCatalogException {
+ try {
+ String submissionId = AppCatalogUtils.getID("SSH");
+ sshJobSubmission.setJobSubmissionInterfaceId(submissionId);
+ String resourceJobManagerId = addResourceJobManager(sshJobSubmission.getResourceJobManager());
+ SshJobSubmissionAppCatalogResourceAppCat resource = AppCatalogThriftConversion.getSSHJobSubmission(sshJobSubmission);
+ resource.setResourceJobManagerId(resourceJobManagerId);
+ resource.getResourceJobManagerResource().setResourceJobManagerId(resourceJobManagerId);
+ if (sshJobSubmission.getMonitorMode() != null){
+ resource.setMonitorMode(sshJobSubmission.getMonitorMode().toString());
+ }
+ resource.save();
+ return submissionId;
+ }catch (Exception e) {
+ logger.error("Error while saving SSH Job Submission...", e);
+ throw new AppCatalogException(e);
+ }
+ }
+
+ @Override
+ public String addCloudJobSubmission(CloudJobSubmission sshJobSubmission) throws AppCatalogException {
+ try {
+ sshJobSubmission.setJobSubmissionInterfaceId(AppCatalogUtils.getID("Cloud"));
+ CloudSubmissionAppCatalogResourceAppCat resource = AppCatalogThriftConversion.getCloudJobSubmission(sshJobSubmission);
+ resource.save();
+ return resource.getJobSubmissionInterfaceId();
+ }catch (Exception e) {
+ logger.error("Error while saving SSH Job Submission...", e);
+ throw new AppCatalogException(e);
+ }
+ }
+
+ @Override
+ public String addUNICOREJobSubmission(UnicoreJobSubmission unicoreJobSubmission)
+ throws AppCatalogException {
+ try {
+ unicoreJobSubmission.setJobSubmissionInterfaceId(AppCatalogUtils.getID("UNICORE"));
+ UnicoreJobSubmissionAppCatalogResourceAppCat resource = AppCatalogThriftConversion.getUnicoreJobSubmission(unicoreJobSubmission);
+ resource.setUnicoreEndpointUrl(unicoreJobSubmission.getUnicoreEndPointURL());
+ if (unicoreJobSubmission.getSecurityProtocol() != null){
+ resource.setSecurityProtocol(unicoreJobSubmission.getSecurityProtocol().toString());
+ }
+ resource.save();
+ return resource.getjobSubmissionInterfaceId();
+ }catch (Exception e){
+ logger.error("Error while retrieving SSH Job Submission...", e);
+ throw new AppCatalogException(e);
+ }
+
+ }
+
+ @Override
+ public String addJobSubmissionProtocol(String computeResourceId, JobSubmissionInterface jobSubmissionInterface) throws AppCatalogException {
+ try {
+ JobSubmissionInterfaceAppCatalogResourceAppCat jsi = AppCatalogThriftConversion.getJobSubmissionInterface(jobSubmissionInterface);
+ jsi.setComputeResourceId(computeResourceId);
+ ComputeResourceAppCatalogResourceAppCat computeResourceResource = new ComputeResourceAppCatalogResourceAppCat();
+ computeResourceResource=(ComputeResourceAppCatalogResourceAppCat)computeResourceResource.get(computeResourceId);
+ jsi.setComputeHostResource(computeResourceResource);
+ jsi.save();
+ return jsi.getJobSubmissionInterfaceId();
+ }catch (Exception e){
+ logger.error("Error while saving "+jobSubmissionInterface.getJobSubmissionProtocol().toString()+" Job Submission Protocol...", e);
+ throw new AppCatalogException(e);
+ }
+ }
+
+// @Override
+// public String addGSISSHJobSubmission(GSISSHJobSubmission gsisshJobSubmission) throws AppCatalogException {
+// try {
+// GSISSHSubmissionResource resource = new GSISSHSubmissionResource();
+// String hostName = "GSISSH";
+// resource.setDeploymentId(AppCatalogUtils.getID(hostName));
+// resource.setSshPort(resource.getSshPort());
+// resource.setResourceJobManager(gsisshJobSubmission.getResourceJobManager().toString());
+// resource.setInstalledPath(gsisshJobSubmission.getInstalledPath());
+// resource.setMonitorMode(gsisshJobSubmission.getMonitorMode());
+// resource.save();
+// gsisshJobSubmission.setJobSubmissionDataID(resource.getDeploymentId());
+//
+// Set<String> exports = gsisshJobSubmission.getExports();
+// if (exports != null && !exports.isEmpty()){
+// for (String export : exports){
+// GSISSHExportResource exportResource = new GSISSHExportResource();
+// exportResource.setDeploymentId(resource.getDeploymentId());
+// exportResource.setExport(export);
+// exportResource.setAppDeploymentResource(resource);
+// exportResource.save();
+// }
+// }
+//
+// List<String> preJobCommands = gsisshJobSubmission.getPreJobCommands();
+// if (preJobCommands != null && !preJobCommands.isEmpty()){
+// for (String command : preJobCommands){
+// GSISSHPreJobCommandResource commandResource = new GSISSHPreJobCommandResource();
+// commandResource.setDeploymentId(resource.getDeploymentId());
+// commandResource.setCommand(command);
+// commandResource.setAppDeploymentResource(resource);
+// commandResource.save();
+// }
+// }
+//
+// List<String> postJobCommands = gsisshJobSubmission.getPostJobCommands();
+// if (postJobCommands != null && !postJobCommands.isEmpty()){
+// for (String command : postJobCommands){
+// GSISSHPostJobCommandResource commandResource = new GSISSHPostJobCommandResource();
+// commandResource.setDeploymentId(resource.getDeploymentId());
+// commandResource.setCommand(command);
+// commandResource.setAppDeploymentResource(resource);
+// commandResource.save();
+// }
+// }
+// return resource.getDeploymentId();
+// }catch (Exception e) {
+// logger.error("Error while saving GSISSH Job Submission...", e);
+// throw new AppCatalogException(e);
+// }
+// }
+//
+// @Override
+// public void addGSISSHJobSubmissionProtocol(String computeResourceId, String jobSubmissionId) throws AppCatalogException {
+// try {
+// JobSubmissionProtocolResource resource = new JobSubmissionProtocolResource();
+// resource.setResourceID(computeResourceId);
+// resource.setDeploymentId(jobSubmissionId);
+// ComputeResourceDescription computeResource = getComputeResource(computeResourceId);
+// resource.setComputeHostResource(AppCatalogThriftConversion.getComputeHostResource(computeResource));
+// resource.setJobType(JobSubmissionProtocol.GSISSH.toString());
+// resource.save();
+// }catch (Exception e){
+// logger.error("Error while saving GSISSH Job Submission Protocol...", e);
+// throw new AppCatalogException(e);
+// }
+// }
+
+ @Override
+ public String addGlobusJobSubmission(GlobusJobSubmission globusJobSubmission) throws AppCatalogException {
+// try {
+// GlobusJobSubmissionResource resource = new GlobusJobSubmissionResource();
+// String hostName = "GLOBUS";
+// resource.setDeploymentId(AppCatalogUtils.getID(hostName));
+// resource.setSecurityProtocol(globusJobSubmission.getSecurityProtocol().toString());
+// resource.setResourceJobManager(globusJobSubmission.getResourceJobManager().toString());
+// resource.save();
+// globusJobSubmission.setJobSubmissionDataID(resource.getDeploymentId());
+// List<String> globusGateKeeperEndPoint = globusJobSubmission.getGlobusGateKeeperEndPoint();
+// if (globusGateKeeperEndPoint != null && !globusGateKeeperEndPoint.isEmpty()) {
+// for (String endpoint : globusGateKeeperEndPoint) {
+// GlobusGKEndpointResource endpointResource = new GlobusGKEndpointResource();
+// endpointResource.setDeploymentId(resource.getDeploymentId());
+// endpointResource.setEndpoint(endpoint);
+// endpointResource.setGlobusJobSubmissionResource(resource);
+// endpointResource.save();
+// }
+// }
+// return resource.getDeploymentId();
+// } catch (Exception e) {
+// logger.error("Error while saving Globus Job Submission...", e);
+// throw new AppCatalogException(e);
+// }
+ return null;
+ }
+
+ @Override
+ public String addScpDataMovement(SCPDataMovement scpDataMovement) throws AppCatalogException {
+ try {
+ scpDataMovement.setDataMovementInterfaceId(AppCatalogUtils.getID("SCP"));
+ ScpDataMovementAppCatalogResourceAppCat resource = AppCatalogThriftConversion.getSCPDataMovementDescription(scpDataMovement);
+ resource.save();
+ return resource.getDataMovementInterfaceId();
+ }catch (Exception e){
+ logger.error("Error while saving SCP Data Movement...", e);
+ throw new AppCatalogException(e);
+ }
+ }
+
+ @Override
+ public String addUnicoreDataMovement(UnicoreDataMovement unicoreDataMovement) throws AppCatalogException {
+ try {
+ unicoreDataMovement.setDataMovementInterfaceId(AppCatalogUtils.getID("UNICORE"));
+ UnicoreDataMovementAppCatalogResourceAppCat resource = AppCatalogThriftConversion.getUnicoreDMResource(unicoreDataMovement);
+ resource.save();
+ return resource.getDataMovementId();
+ }catch (Exception e){
+ logger.error("Error while saving UNICORE Data Movement...", e);
+ throw new AppCatalogException(e);
+ }
+ }
+
+ @Override
+ public String addDataMovementProtocol(String computeResourceId, DataMovementInterface dataMovementInterface) throws AppCatalogException {
+ try {
+ DataMovementInterfaceAppCatalogResourceAppCat dmi = AppCatalogThriftConversion.getDataMovementInterface(dataMovementInterface);
+ dmi.setComputeResourceId(computeResourceId);
+ ComputeResourceAppCatalogResourceAppCat computeResourceResource = new ComputeResourceAppCatalogResourceAppCat();
+ computeResourceResource=(ComputeResourceAppCatalogResourceAppCat)computeResourceResource.get(computeResourceId);
+ dmi.setComputeHostResource(computeResourceResource);
+ dmi.save();
+ return dmi.getDataMovementInterfaceId();
+ }catch (Exception e){
+ logger.error("Error while saving "+dataMovementInterface.getDataMovementProtocol().toString()+" data movement Protocol...", e);
+ throw new AppCatalogException(e);
+ }
+ }
+
+ @Override
+ public String addGridFTPDataMovement(GridFTPDataMovement gridFTPDataMovement) throws AppCatalogException {
+ try {
+ gridFTPDataMovement.setDataMovementInterfaceId(AppCatalogUtils.getID("GRIDFTP"));
+ GridftpDataMovementAppCatalogResourceAppCat resource = AppCatalogThriftConversion.getGridFTPDataMovementDescription(gridFTPDataMovement);
+ resource.save();
+ List<String> gridFTPEndPoint = gridFTPDataMovement.getGridFTPEndPoints();
+ if (gridFTPEndPoint != null && !gridFTPEndPoint.isEmpty()) {
+ for (String endpoint : gridFTPEndPoint) {
+ GridftpEndpointAppCatalogResourceAppCat endpointResource = new GridftpEndpointAppCatalogResourceAppCat();
+ endpointResource.setDataMovementInterfaceId(resource.getDataMovementInterfaceId());
+ endpointResource.setEndpoint(endpoint);
+ endpointResource.setGridftpDataMovementResource(resource);
+ endpointResource.save();
+ }
+ }
+ return resource.getDataMovementInterfaceId();
+ }catch (Exception e){
+ logger.error("Error while saving GridFTP Data Movement...", e);
+ throw new AppCatalogException(e);
+ }
+ }
+
+ @Override
+ public ComputeResourceDescription getComputeResource(String resourceId) throws AppCatalogException {
+ try {
+ ComputeResourceAppCatalogResourceAppCat resource = new ComputeResourceAppCatalogResourceAppCat();
+ ComputeResourceAppCatalogResourceAppCat computeResource = (ComputeResourceAppCatalogResourceAppCat)resource.get(resourceId);
+ return AppCatalogThriftConversion.getComputeHostDescription(computeResource);
+ }catch (Exception e){
+ logger.error("Error while retrieving compute resource...", e);
+ throw new AppCatalogException(e);
+ }
+ }
+
+ @Override
+ public List<ComputeResourceDescription> getComputeResourceList(Map<String, String> filters) throws AppCatalogException {
+ List<ComputeResourceDescription> computeResourceDescriptions = new ArrayList<ComputeResourceDescription>();
+ try {
+ //TODO check if this is correct way to do this
+ ComputeResourceAppCatalogResourceAppCat resource = new ComputeResourceAppCatalogResourceAppCat();
+ for (String fieldName : filters.keySet() ){
+ if (fieldName.equals(AppCatAbstractResource.ComputeResourceConstants.HOST_NAME)){
+ List<AppCatalogResource> resources = resource.get(AppCatAbstractResource.ComputeResourceConstants.HOST_NAME, filters.get(fieldName));
+ if (resources != null && !resources.isEmpty()){
+ computeResourceDescriptions = AppCatalogThriftConversion.getComputeDescriptionList(resources);
+ }
+ }else {
+ logger.error("Unsupported field name for compute resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for compute resource.");
+ }
+ }
+ }catch (Exception e){
+ logger.error("Error while retrieving compute resource list...", e);
+ throw new AppCatalogException(e);
+ }
+ return computeResourceDescriptions;
+ }
+
+ @Override
+ public List<ComputeResourceDescription> getAllComputeResourceList() throws AppCatalogException {
+ List<ComputeResourceDescription> computeResourceDescriptions = new ArrayList<ComputeResourceDescription>();
+ try {
+ ComputeResourceAppCatalogResourceAppCat resource = new ComputeResourceAppCatalogResourceAppCat();
+ List<AppCatalogResource> resources = resource.getAll();
+ if (resources != null && !resources.isEmpty()){
+ computeResourceDescriptions = AppCatalogThriftConversion.getComputeDescriptionList(resources);
+ }
+ }catch (Exception e){
+ logger.error("Error while retrieving compute resource list...", e);
+ throw new AppCatalogException(e);
+ }
+ return computeResourceDescriptions;
+ }
+
+ @Override
+ public Map<String, String> getAllComputeResourceIdList() throws AppCatalogException {
+ try {
+ Map<String, String> computeResourceMap = new HashMap<String, String>();
+ ComputeResourceAppCatalogResourceAppCat resource = new ComputeResourceAppCatalogResourceAppCat();
+ List<AppCatalogResource> allComputeResources = resource.getAll();
+ if (allComputeResources != null && !allComputeResources.isEmpty()){
+ for (AppCatalogResource cm : allComputeResources){
+ ComputeResourceAppCatalogResourceAppCat cmr = (ComputeResourceAppCatalogResourceAppCat)cm;
+ computeResourceMap.put(cmr.getResourceId(), cmr.getHostName());
+ }
+ }
+ return computeResourceMap;
+ }catch (Exception e){
+ logger.error("Error while retrieving compute resource list...", e);
+ throw new AppCatalogException(e);
+ }
+ }
+
+// @Override
+// public GSISSHJobSubmission getGSISSHJobSubmission(String submissionId) throws AppCatalogException {
+// try {
+// GSISSHSubmissionResource resource = new GSISSHSubmissionResource();
+// GSISSHSubmissionResource submissionResource = (GSISSHSubmissionResource)resource.get(submissionId);
+// return AppCatalogThriftConversion.getGSISSHSubmissionDescription(submissionResource);
+// }catch (Exception e){
+// logger.error("Error while retrieving GSISSH Job Submission...", e);
+// throw new AppCatalogException(e);
+// }
+// }
+//
+// @Override
+// public List<GSISSHJobSubmission> getGSISSHJobSubmissionList(Map<String, String> filters) throws AppCatalogException {
+// try {
+// GSISSHSubmissionResource resource = new GSISSHSubmissionResource();
+// for (String fieldName : filters.keySet() ){
+// if (fieldName.equals(AbstractResource.GSISSHSubmissionConstants.RESOURCE_JOB_MANAGER)){
+// List<Resource> resources = resource.get(AbstractResource.GSISSHSubmissionConstants.RESOURCE_JOB_MANAGER, filters.get(fieldName));
+// if (resources != null && !resources.isEmpty()){
+// return AppCatalogThriftConversion.getGSISSHSubmissionList(resources);
+// }
+// }else {
+// logger.error("Unsupported field name for GSISSH Submission.", new IllegalArgumentException());
+// throw new IllegalArgumentException("Unsupported field name for GSISSH Submission.");
+// }
+// }
+// }catch (Exception e){
+// logger.error("Error while retrieving GSISSH Submission list...", e);
+// throw new AppCatalogException(e);
+// }
+// return null;
+// }
+//
+// @Override
+// public GlobusJobSubmission getGlobusJobSubmission(String submissionId) throws AppCatalogException {
+// try {
+// GlobusJobSubmissionResource globusJobSubmissionResource = new GlobusJobSubmissionResource();
+// globusJobSubmissionResource=(GlobusJobSubmissionResource)globusJobSubmissionResource.get(submissionId);
+// AppCatalogThriftConversion.getglo
+// GlobusJobSubmissionResource resource = globusJobSubmissionResource;
+// GlobusJobSubmissionResource submissionResource = (GlobusJobSubmissionResource)resource.get(submissionId);
+// return AppCatalogThriftConversion.getGlobusJobSubmissionDescription(submissionResource);
+// }catch (Exception e){
+// logger.error("Error while retrieving Globus Job Submission...", e);
+// throw new AppCatalogException(e);
+// }
+// }
+//
+// @Override
+// public List<GlobusJobSubmission> getGlobusJobSubmissionList(Map<String, String> filters) throws AppCatalogException {
+// try {
+// GlobusJobSubmissionResource resource = new GlobusJobSubmissionResource();
+// for (String fieldName : filters.keySet() ){
+// if (fieldName.equals(AbstractResource.GlobusJobSubmissionConstants.RESOURCE_JOB_MANAGER)){
+// List<Resource> resources = resource.get(AbstractResource.GlobusJobSubmissionConstants.RESOURCE_JOB_MANAGER, filters.get(fieldName));
+// if (resources != null && !resources.isEmpty()){
+// return AppCatalogThriftConversion.getGlobusSubmissionList(resources);
+// }
+// }else if (fieldName.equals(AbstractResource.GlobusJobSubmissionConstants.SECURITY_PROTOCAL)){
+// List<Resource> resources = resource.get(AbstractResource.GlobusJobSubmissionConstants.SECURITY_PROTOCAL, filters.get(fieldName));
+// if (resources != null && !resources.isEmpty()){
+// return AppCatalogThriftConversion.getGlobusSubmissionList(resources);
+// }
+// }else {
+// logger.error("Unsupported field name for Globus Submission.", new IllegalArgumentException());
+// throw new IllegalArgumentException("Unsupported field name for Globus Submission.");
+// }
+// }
+// }catch (Exception e){
+// logger.error("Error while retrieving Globus Submission list...", e);
+// throw new AppCatalogException(e);
+// }
+// return null;
+// }
+
+ @Override
+ public SSHJobSubmission getSSHJobSubmission(String submissionId) throws AppCatalogException {
+ try {
+ SshJobSubmissionAppCatalogResourceAppCat resource = new SshJobSubmissionAppCatalogResourceAppCat();
+ resource = (SshJobSubmissionAppCatalogResourceAppCat)resource.get(submissionId);
+ return AppCatalogThriftConversion.getSSHJobSubmissionDescription(resource);
+ }catch (Exception e){
+ logger.error("Error while retrieving SSH Job Submission...", e);
+ throw new AppCatalogException(e);
+ }
+ }
+
+ // @Override
+ // public List<GridFTPDataMovement> getGridFTPDataMovementList(Map<String, String> filters) throws AppCatalogException {
+ // try {
+ // GridftpDataMovementResource resource = new GridftpDataMovementResource();
+ // for (String fieldName : filters.keySet() ){
+ // if (fieldName.equals(AbstractResource.GridFTPDataMovementConstants.SECURITY_PROTOCOL)){
+ // List<Resource> resources = resource.get(AbstractResource.GridFTPDataMovementConstants.SECURITY_PROTOCOL, filters.get(fieldName));
+ // if (resources != null && !resources.isEmpty()){
+ // return AppCatalogThriftConversion.getGridFTPDataMovementList(resources);
+ // }
+ // }else {
+ // logger.error("Unsupported field name for GridFTP Data movement.", new IllegalArgumentException());
+ // throw new IllegalArgumentException("Unsupported field name for GridFTP Data movement.");
+ // }
+ // }
+ // }catch (Exception e){
+ // logger.error("Error while retrieving GridFTP Data movement list...", e);
+ // throw new AppCatalogException(e);
+ // }
+ // return null;
+ // }
+
+ @Override
+ public UnicoreJobSubmission getUNICOREJobSubmission(String submissionId)
+ throws AppCatalogException {
+ try {
+ UnicoreJobSubmissionAppCatalogResourceAppCat resource = new UnicoreJobSubmissionAppCatalogResourceAppCat();
+ resource = (UnicoreJobSubmissionAppCatalogResourceAppCat)resource.get(submissionId);
+ return AppCatalogThriftConversion.getUnicoreJobSubmissionDescription(resource);
+ }catch (Exception e){
+ logger.error("Error while retrieving UNICORE Job Submission model instance...", e);
+ throw new AppCatalogException(e);
+ }
+ }
+
+ @Override
+ public UnicoreDataMovement getUNICOREDataMovement(String dataMovementId)
+ throws AppCatalogException {
+ try {
+ UnicoreDataMovementAppCatalogResourceAppCat resource = new UnicoreDataMovementAppCatalogResourceAppCat();
+ resource = (UnicoreDataMovementAppCatalogResourceAppCat)resource.get(dataMovementId);
+ return AppCatalogThriftConversion.getUnicoreDMDescription(resource);
+ }catch (Exception e){
+ logger.error("Error while retrieving UNICORE data movement...", e);
+ throw new AppCatalogException(e);
+ }
+ }
+
+ @Override
+ public CloudJobSubmission getCloudJobSubmission(String submissionId) throws AppCatalogException {
+ try {
+ CloudSubmissionAppCatalogResourceAppCat resource = new CloudSubmissionAppCatalogResourceAppCat();
+ resource = (CloudSubmissionAppCatalogResourceAppCat)resource.get(submissionId);
+ return AppCatalogThriftConversion.getCloudJobSubmissionDescription(resource);
+ }catch (Exception e){
+ logger.error("Error while retrieving SSH Job Submission...", e);
+ throw new AppCatalogException(e);
+ }
+ }
+//
+// @Override
+// public List<SSHJobSubmission> getSSHJobSubmissionList(Map<String, String> filters) throws AppCatalogException {
+// try {
+// SshJobSubmissionResource resource = new SshJobSubmissionResource();
+// for (String fieldName : filters.keySet() ){
+// if (fieldName.equals(AbstractResource.SSHSubmissionConstants.RESOURCE_JOB_MANAGER)){
+// List<Resource> resources = resource.get(AbstractResource.SSHSubmissionConstants.RESOURCE_JOB_MANAGER, filters.get(fieldName));
+// if (resources != null && !resources.isEmpty()){
+// return AppCatalogThriftConversion.getSSHSubmissionList(resources);
+// }
+// }else {
+// logger.error("Unsupported field name for SSH Submission.", new IllegalArgumentException());
+// throw new IllegalArgumentException("Unsupported field name for SSH Submission.");
+// }
+// }
+// }catch (Exception e){
+// logger.error("Error while retrieving SSH Submission list...", e);
+// throw new AppCatalogException(e);
+// }
+// return null;
+// }
+
+ @Override
+ public SCPDataMovement getSCPDataMovement(String dataMoveId) throws AppCatalogException {
+ try {
+ ScpDataMovementAppCatalogResourceAppCat resource = new ScpDataMovementAppCatalogResourceAppCat();
+ ScpDataMovementAppCatalogResourceAppCat dataMovementResource = (ScpDataMovementAppCatalogResourceAppCat)resource.get(dataMoveId);
+ return AppCatalogThriftConversion.getSCPDataMovementDescription(dataMovementResource);
+ }catch (Exception e){
+ logger.error("Error while retrieving SCP Data Movement...", e);
+ throw new AppCatalogException(e);
+ }
+ }
+
+// @Override
+// public List<SCPDataMovement> getSCPDataMovementList(Map<String, String> filters) throws AppCatalogException {
+// try {
+// ScpDataMovementResource resource = new ScpDataMovementResource();
+// for (String fieldName : filters.keySet() ){
+// if (fieldName.equals(AbstractResource.SCPDataMovementConstants.SECURITY_PROTOCOL)){
+// List<Resource> resources = resource.get(AbstractResource.SCPDataMovementConstants.SECURITY_PROTOCOL, filters.get(fieldName));
+// if (resources != null && !resources.isEmpty()){
+// return AppCatalogThriftConversion.getSCPDataMovementList(resources);
+// }
+// }else {
+// logger.error("Unsupported field name for SCP Data movement.", new IllegalArgumentException());
+// throw new IllegalArgumentException("Unsupported field name for SCP Data movement.");
+// }
+// }
+// }catch (Exception e){
+// logger.error("Error while retrieving SCP Data movement list...", e);
+// throw new AppCatalogException(e);
+// }
+// return null;
+// }
+
+ @Override
+ public GridFTPDataMovement getGridFTPDataMovement(String dataMoveId) throws AppCatalogException {
+ try {
+ GridftpDataMovementAppCatalogResourceAppCat resource = new GridftpDataMovementAppCatalogResourceAppCat();
+ GridftpDataMovementAppCatalogResourceAppCat dataMovementResource = (GridftpDataMovementAppCatalogResourceAppCat)resource.get(dataMoveId);
+ return AppCatalogThriftConversion.getGridFTPDataMovementDescription(dataMovementResource);
+ }catch (Exception e){
+ logger.error("Error while retrieving Grid FTP Data Movement...", e);
+ throw new AppCatalogException(e);
+ }
+ }
+
+// @Override
+// public List<GridFTPDataMovement> getGridFTPDataMovementList(Map<String, String> filters) throws AppCatalogException {
+// try {
+// GridftpDataMovementResource resource = new GridftpDataMovementResource();
+// for (String fieldName : filters.keySet() ){
+// if (fieldName.equals(AbstractResource.GridFTPDataMovementConstants.SECURITY_PROTOCOL)){
+// List<Resource> resources = resource.get(AbstractResource.GridFTPDataMovementConstants.SECURITY_PROTOCOL, filters.get(fieldName));
+// if (resources != null && !resources.isEmpty()){
+// return AppCatalogThriftConversion.getGridFTPDataMovementList(resources);
+// }
+// }else {
+// logger.error("Unsupported field name for GridFTP Data movement.", new IllegalArgumentException());
+// throw new IllegalArgumentException("Unsupported field name for GridFTP Data movement.");
+// }
+// }
+// }catch (Exception e){
+// logger.error("Error while retrieving GridFTP Data movement list...", e);
+// throw new AppCatalogException(e);
+// }
+// return null;
+// }
+
+ @Override
+ public boolean isComputeResourceExists(String resourceId) throws AppCatalogException {
+ try {
+ ComputeResourceAppCatalogResourceAppCat resource = new ComputeResourceAppCatalogResourceAppCat();
+ return resource.isExists(resourceId);
+ }catch (Exception e){
+ logger.error("Error while retrieving compute resource...", e);
+ throw new AppCatalogException(e);
+ }
+ }
+
+ @Override
+ public void removeComputeResource(String resourceId) throws AppCatalogException {
+ try {
+ ComputeResourceAppCatalogResourceAppCat resource = new ComputeResourceAppCatalogResourceAppCat();
+ resource.remove(resourceId);
+ }catch (Exception e){
+ logger.error("Error while removing compute resource...", e);
+ throw new AppCatalogException(e);
+ }
+ }
+
+ @Override
+ public void removeJobSubmissionInterface(String computeResourceId, String jobSubmissionInterfaceId) throws AppCatalogException {
+ try {
+ JobSubmissionInterfaceAppCatalogResourceAppCat resource = new JobSubmissionInterfaceAppCatalogResourceAppCat();
+ Map<String, String> ids = new HashMap<String, String>();
+ ids.put(AppCatAbstractResource.JobSubmissionInterfaceConstants.COMPUTE_RESOURCE_ID, computeResourceId);
+ ids.put(AppCatAbstractResource.JobSubmissionInterfaceConstants.JOB_SUBMISSION_INTERFACE_ID, jobSubmissionInterfaceId);
+ resource.remove(ids);
+ }catch (Exception e){
+ logger.error("Error while removing job submission interface..", e);
+ throw new AppCatalogException(e);
+ }
+ }
+
+ @Override
+ public void removeDataMovementInterface(String computeResourceId, String dataMovementInterfaceId) throws AppCatalogException {
+ try {
+ DataMovementInterfaceAppCatalogResourceAppCat resource = new DataMovementInterfaceAppCatalogResourceAppCat();
+ Map<String, String> ids = new HashMap<String, String>();
+ ids.put(AppCatAbstractResource.DataMovementInterfaceConstants.COMPUTE_RESOURCE_ID, computeResourceId);
+ ids.put(AppCatAbstractResource.DataMovementInterfaceConstants.DATA_MOVEMENT_INTERFACE_ID, dataMovementInterfaceId);
+ resource.remove(ids);
+ }catch (Exception e){
+ logger.error("Error while removing data movement interface..", e);
+ throw new AppCatalogException(e);
+ }
+ }
+
+ @Override
+ public void removeBatchQueue(String computeResourceId, String queueName) throws AppCatalogException {
+ try {
+ BatchQueueAppCatalogResourceAppCat resource = new BatchQueueAppCatalogResourceAppCat();
+ Map<String, String> ids = new HashMap<String, String>();
+ ids.put(AppCatAbstractResource.BatchQueueConstants.COMPUTE_RESOURCE_ID, computeResourceId);
+ ids.put(AppCatAbstractResource.BatchQueueConstants.QUEUE_NAME, queueName);
+ resource.remove(ids);
+ }catch (Exception e){
+ logger.error("Error while removing batch queue..", e);
+ throw new AppCatalogException(e);
+ }
+ }
+
+ @Override
+ public String addResourceJobManager(ResourceJobManager resourceJobManager)
+ throws AppCatalogException {
+ resourceJobManager.setResourceJobManagerId(AppCatalogUtils.getID("RJM"));
+ ResourceJobManagerAppCatalogResourceAppCat resource = AppCatalogThriftConversion.getResourceJobManager(resourceJobManager);
+ resource.save();
+ Map<JobManagerCommand, String> jobManagerCommands = resourceJobManager.getJobManagerCommands();
+ if (jobManagerCommands!=null && jobManagerCommands.size() != 0) {
+ for (JobManagerCommand commandType : jobManagerCommands.keySet()) {
+ JobManagerCommandAppCatalogResourceAppCat r = new JobManagerCommandAppCatalogResourceAppCat();
+ r.setCommandType(commandType.toString());
+ r.setCommand(jobManagerCommands.get(commandType));
+ r.setResourceJobManagerId(resource.getResourceJobManagerId());
+ r.save();
+ }
+ }
+ return resource.getResourceJobManagerId();
+ }
+
+ @Override
+ public void updateResourceJobManager(String resourceJobManagerId, ResourceJobManager updatedResourceJobManager) throws AppCatalogException {
+ try {
+ ResourceJobManagerAppCatalogResourceAppCat resource = AppCatalogThriftConversion.getResourceJobManager(updatedResourceJobManager);
+ resource.setResourceJobManagerId(resourceJobManagerId);
+ resource.save();
+ Map<JobManagerCommand, String> jobManagerCommands = updatedResourceJobManager.getJobManagerCommands();
+ if (jobManagerCommands!=null && jobManagerCommands.size() != 0) {
+ for (JobManagerCommand commandType : jobManagerCommands.keySet()) {
+ JobManagerCommandAppCatalogResourceAppCat r = new JobManagerCommandAppCatalogResourceAppCat();
+ Map<String, String> ids = new HashMap<String, String>();
+ ids.put(AppCatAbstractResource.JobManagerCommandConstants.RESOURCE_JOB_MANAGER_ID, resourceJobManagerId);
+ ids.put(AppCatAbstractResource.JobManagerCommandConstants.COMMAND_TYPE, commandType.toString());
+ JobManagerCommandAppCatalogResourceAppCat existingCommand;
+ if (r.isExists(ids)){
+ existingCommand = (JobManagerCommandAppCatalogResourceAppCat)r.get(ids);
+ }else {
+ existingCommand = new JobManagerCommandAppCatalogResourceAppCat();
+ }
+ existingCommand.setCommandType(commandType.toString());
+ existingCommand.setCommand(jobManagerCommands.get(commandType));
+ existingCommand.setResourceJobManagerId(resource.getResourceJobManagerId());
+ existingCommand.save();
+ }
+ }
+ }catch (Exception e){
+ logger.error("Error while updating resource job manager..", e);
+ throw new AppCatalogException(e);
+ }
+ }
+
+ @Override
+ public ResourceJobManager getResourceJobManager(String resourceJobManagerId) throws AppCatalogException {
+ try {
+ ResourceJobManagerAppCatalogResourceAppCat resource = new ResourceJobManagerAppCatalogResourceAppCat();
+ ResourceJobManagerAppCatalogResourceAppCat jobManagerResource = (ResourceJobManagerAppCatalogResourceAppCat)resource.get(resourceJobManagerId);
+ return AppCatalogThriftConversion.getResourceJobManager(jobManagerResource);
+ }catch (Exception e){
+ logger.error("Error while retrieving resource job manager..", e);
+ throw new AppCatalogException(e);
+ }
+ }
+
+ @Override
+ public void deleteResourceJobManager(String resourceJobManagerId) throws AppCatalogException {
+ try {
+ ResourceJobManagerAppCatalogResourceAppCat resource = new ResourceJobManagerAppCatalogResourceAppCat();
+ resource.remove(resourceJobManagerId);
+ }catch (Exception e){
+ logger.error("Error while deleting resource job manager..", e);
+ throw new AppCatalogException(e);
+ }
+ }
+
+ @Override
+ public String addLocalJobSubmission(LOCALSubmission localSubmission)
+ throws AppCatalogException {
+ localSubmission.setJobSubmissionInterfaceId(AppCatalogUtils.getID("LOCAL"));
+ String resourceJobManagerId = addResourceJobManager(localSubmission.getResourceJobManager());
+ LocalSubmissionAppCatalogResourceAppCat localJobSubmission = AppCatalogThriftConversion.getLocalJobSubmission(localSubmission);
+ localJobSubmission.setResourceJobManagerId(resourceJobManagerId);
+ localJobSubmission.getResourceJobManagerResource().setResourceJobManagerId(resourceJobManagerId);
+ localJobSubmission.save();
+ return localJobSubmission.getJobSubmissionInterfaceId();
+ }
+
+ @Override
+ public String addLocalDataMovement(LOCALDataMovement localDataMovement)
+ throws AppCatalogException {
+ localDataMovement.setDataMovementInterfaceId(AppCatalogUtils.getID("LOCAL"));
+ LocalDataMovementAppCatalogResourceAppCat ldm = AppCatalogThriftConversion.getLocalDataMovement(localDataMovement);
+ ldm.save();
+ return ldm.getDataMovementInterfaceId();
+ }
+
+ @Override
+ public LOCALSubmission getLocalJobSubmission(String submissionId)
+ throws AppCatalogException {
+ LocalSubmissionAppCatalogResourceAppCat localSubmissionResource = new LocalSubmissionAppCatalogResourceAppCat();
+ localSubmissionResource= (LocalSubmissionAppCatalogResourceAppCat)localSubmissionResource.get(submissionId);
+ return AppCatalogThriftConversion.getLocalJobSubmission(localSubmissionResource);
+ }
+
+ @Override
+ public LOCALDataMovement getLocalDataMovement(String datamovementId)
+ throws AppCatalogException {
+ LocalDataMovementAppCatalogResourceAppCat localDataMovementResource = new LocalDataMovementAppCatalogResourceAppCat();
+ localDataMovementResource = (LocalDataMovementAppCatalogResourceAppCat) localDataMovementResource.get(datamovementId);
+ return AppCatalogThriftConversion.getLocalDataMovement(localDataMovementResource);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/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
new file mode 100644
index 0000000..05cbcdc
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/impl/GwyResourceProfileImpl.java
@@ -0,0 +1,252 @@
+/*
+ *
+ * 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.impl;
+
+import org.apache.airavata.model.appcatalog.gatewayprofile.ComputeResourcePreference;
+import org.apache.airavata.model.appcatalog.gatewayprofile.GatewayResourceProfile;
+import org.apache.airavata.model.appcatalog.gatewayprofile.gatewayResourceProfileModelConstants;
+import org.apache.airavata.registry.core.app.catalog.resources.*;
+import org.apache.airavata.registry.core.app.catalog.util.AppCatalogThriftConversion;
+import org.apache.airavata.registry.cpi.AppCatalogException;
+import org.apache.airavata.registry.cpi.GwyResourceProfile;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+public class GwyResourceProfileImpl implements GwyResourceProfile {
+ private final static Logger logger = LoggerFactory.getLogger(GwyResourceProfileImpl.class);
+
+ @Override
+ public String addGatewayResourceProfile(org.apache.airavata.model.appcatalog.gatewayprofile.GatewayResourceProfile gatewayProfile) throws AppCatalogException {
+ try {
+ GatewayProfileAppCatalogResourceAppCat profileResource = new GatewayProfileAppCatalogResourceAppCat();
+ if (!gatewayProfile.getGatewayID().equals("") && !gatewayProfile.getGatewayID().equals(gatewayResourceProfileModelConstants.DEFAULT_ID)){
+ profileResource.setGatewayID(gatewayProfile.getGatewayID());
+ }
+// profileResource.setGatewayID(gatewayProfile.getGatewayID());
+ profileResource.save();
+ List<ComputeResourcePreference> computeResourcePreferences = gatewayProfile.getComputeResourcePreferences();
+ if (computeResourcePreferences != null && !computeResourcePreferences.isEmpty()){
+ for (ComputeResourcePreference preference : computeResourcePreferences ){
+ ComputeHostPreferenceAppCatalogResourceAppCat resource = new ComputeHostPreferenceAppCatalogResourceAppCat();
+ resource.setGatewayProfile(profileResource);
+ resource.setResourceId(preference.getComputeResourceId());
+ ComputeResourceAppCatalogResourceAppCat computeHostResource = new ComputeResourceAppCatalogResourceAppCat();
+ resource.setComputeHostResource((ComputeResourceAppCatalogResourceAppCat)computeHostResource.get(preference.getComputeResourceId()));
+ resource.setGatewayId(profileResource.getGatewayID());
+ resource.setOverrideByAiravata(preference.isOverridebyAiravata());
+ resource.setLoginUserName(preference.getLoginUserName());
+ if (preference.getPreferredJobSubmissionProtocol() != null){
+ resource.setPreferredJobProtocol(preference.getPreferredJobSubmissionProtocol().toString());
+ }
+
+ if (preference.getPreferredDataMovementProtocol() != null){
+ resource.setPreferedDMProtocol(preference.getPreferredDataMovementProtocol().toString());
+ }
+
+ resource.setBatchQueue(preference.getPreferredBatchQueue());
+ resource.setProjectNumber(preference.getAllocationProjectNumber());
+ resource.setScratchLocation(preference.getScratchLocation());
+ resource.save();
+ }
+ }
+ return profileResource.getGatewayID();
+ }catch (Exception e) {
+ logger.error("Error while saving gateway profile...", e);
+ throw new AppCatalogException(e);
+ }
+ }
+
+ @Override
+ public void updateGatewayResourceProfile(String gatewayId, org.apache.airavata.model.appcatalog.gatewayprofile.GatewayResourceProfile updatedProfile) throws AppCatalogException {
+ try {
+ GatewayProfileAppCatalogResourceAppCat profileResource = new GatewayProfileAppCatalogResourceAppCat();
+ GatewayProfileAppCatalogResourceAppCat existingGP = (GatewayProfileAppCatalogResourceAppCat)profileResource.get(gatewayId);
+ existingGP.save();
+
+ List<ComputeResourcePreference> computeResourcePreferences = updatedProfile.getComputeResourcePreferences();
+ if (computeResourcePreferences != null && !computeResourcePreferences.isEmpty()){
+ for (ComputeResourcePreference preference : computeResourcePreferences ){
+ ComputeHostPreferenceAppCatalogResourceAppCat resource = new ComputeHostPreferenceAppCatalogResourceAppCat();
+ resource.setGatewayProfile(existingGP);
+ resource.setResourceId(preference.getComputeResourceId());
+ ComputeResourceAppCatalogResourceAppCat computeHostResource = new ComputeResourceAppCatalogResourceAppCat();
+ resource.setComputeHostResource((ComputeResourceAppCatalogResourceAppCat)computeHostResource.get(preference.getComputeResourceId()));
+ resource.setGatewayId(gatewayId);
+ resource.setLoginUserName(preference.getLoginUserName());
+ resource.setOverrideByAiravata(preference.isOverridebyAiravata());
+ if (preference.getPreferredJobSubmissionProtocol() != null){
+ resource.setPreferredJobProtocol(preference.getPreferredJobSubmissionProtocol().toString());
+ }
+
+ if (preference.getPreferredDataMovementProtocol() != null){
+ resource.setPreferedDMProtocol(preference.getPreferredDataMovementProtocol().toString());
+ }
+ resource.setBatchQueue(preference.getPreferredBatchQueue());
+ resource.setProjectNumber(preference.getAllocationProjectNumber());
+ resource.setScratchLocation(preference.getScratchLocation());
+ resource.save();
+ }
+ }
+ }catch (Exception e) {
+ logger.error("Error while updating gateway profile...", e);
+ throw new AppCatalogException(e);
+ }
+ }
+
+ @Override
+ public GatewayResourceProfile getGatewayProfile(String gatewayId) throws AppCatalogException {
+ try {
+ GatewayProfileAppCatalogResourceAppCat resource = new GatewayProfileAppCatalogResourceAppCat();
+ GatewayProfileAppCatalogResourceAppCat gwresource = (GatewayProfileAppCatalogResourceAppCat)resource.get(gatewayId);
+ ComputeHostPreferenceAppCatalogResourceAppCat prefResource = new ComputeHostPreferenceAppCatalogResourceAppCat();
+ List<AppCatalogResource> computePrefList = prefResource.get(AppCatAbstractResource.ComputeResourcePreferenceConstants.GATEWAY_ID, gatewayId);
+ List<ComputeResourcePreference> computeResourcePreferences = AppCatalogThriftConversion.getComputeResourcePreferences(computePrefList);
+ return AppCatalogThriftConversion.getGatewayResourceProfile(gwresource, computeResourcePreferences);
+ }catch (Exception e) {
+ logger.error("Error while retrieving gateway profile...", e);
+ throw new AppCatalogException(e);
+ }
+ }
+
+ @Override
+ public boolean removeGatewayResourceProfile(String gatewayId) throws AppCatalogException {
+ try {
+ GatewayProfileAppCatalogResourceAppCat resource = new GatewayProfileAppCatalogResourceAppCat();
+ resource.remove(gatewayId);
+ return true;
+ }catch (Exception e) {
+ logger.error("Error while deleting gateway profile...", e);
+ throw new AppCatalogException(e);
+ }
+ }
+
+ @Override
+ public boolean removeComputeResourcePreferenceFromGateway(String gatewayId, String preferenceId) throws AppCatalogException {
+ try {
+ ComputeHostPreferenceAppCatalogResourceAppCat resource = new ComputeHostPreferenceAppCatalogResourceAppCat();
+ Map<String, String> ids = new HashMap<String, String>();
+ ids.put(AppCatAbstractResource.ComputeResourcePreferenceConstants.GATEWAY_ID, gatewayId);
+ ids.put(AppCatAbstractResource.ComputeResourcePreferenceConstants.RESOURCE_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 {
+ GatewayProfileAppCatalogResourceAppCat resource = new GatewayProfileAppCatalogResourceAppCat();
+ return resource.isExists(gatewayId);
+ }catch (Exception e) {
+ logger.error("Error while retrieving gateway profile...", e);
+ throw new AppCatalogException(e);
+ }
+ }
+
+ /**
+ * @param gatewayId
+ * @param hostId
+ * @return ComputeResourcePreference
+ */
+ @Override
+ public ComputeResourcePreference getComputeResourcePreference(String gatewayId, String hostId) throws AppCatalogException {
+ try {
+ ComputeHostPreferenceAppCatalogResourceAppCat prefResource = new ComputeHostPreferenceAppCatalogResourceAppCat();
+ List<AppCatalogResource> computePrefList = prefResource.get(AppCatAbstractResource.ComputeResourcePreferenceConstants.GATEWAY_ID, gatewayId);
+ for (AppCatalogResource resource : computePrefList){
+ ComputeHostPreferenceAppCatalogResourceAppCat cmP = (ComputeHostPreferenceAppCatalogResourceAppCat) resource;
+ if (cmP.getResourceId() != null && !cmP.getResourceId().equals("")){
+ if (cmP.getResourceId().equals(hostId)){
+ return AppCatalogThriftConversion.getComputeResourcePreference(cmP);
+ }
+ }
+ }
+ }catch (Exception e) {
+ logger.error("Error while retrieving compute resource preference...", e);
+ throw new AppCatalogException(e);
+ }
+ return null;
+ }
+
+ /**
+ * @param gatewayId
+ * @return
+ */
+ @Override
+ public List<ComputeResourcePreference> getAllComputeResourcePreferences(String gatewayId) throws AppCatalogException {
+ try {
+ ComputeHostPreferenceAppCatalogResourceAppCat prefResource = new ComputeHostPreferenceAppCatalogResourceAppCat();
+ List<AppCatalogResource> computePrefList = prefResource.get(AppCatAbstractResource.ComputeResourcePreferenceConstants.GATEWAY_ID, gatewayId);
+ return AppCatalogThriftConversion.getComputeResourcePreferences(computePrefList);
+ }catch (Exception e) {
+ logger.error("Error while retrieving compute resource preference...", e);
+ throw new AppCatalogException(e);
+ }
+ }
+
+ @Override
+ public List<String> getGatewayProfileIds(String gatewayName) throws AppCatalogException {
+ try {
+ GatewayProfileAppCatalogResourceAppCat profileResource = new GatewayProfileAppCatalogResourceAppCat();
+ List<AppCatalogResource> resourceList = profileResource.get(AppCatAbstractResource.GatewayProfileConstants.GATEWAY_ID, gatewayName);
+ List<String> gatewayIds = new ArrayList<String>();
+ if (resourceList != null && !resourceList.isEmpty()){
+ for (AppCatalogResource resource : resourceList){
+ gatewayIds.add(((GatewayProfileAppCatalogResourceAppCat)resource).getGatewayID());
+ }
+ }
+ return gatewayIds;
+ }catch (Exception e) {
+ logger.error("Error while retrieving gateway ids...", e);
+ throw new AppCatalogException(e);
+ }
+ }
+
+ @Override
+ public List<GatewayResourceProfile> getAllGatewayProfiles() throws AppCatalogException {
+ try {
+ List<GatewayResourceProfile> gatewayResourceProfileList = new ArrayList<GatewayResourceProfile>();
+ GatewayProfileAppCatalogResourceAppCat profileResource = new GatewayProfileAppCatalogResourceAppCat();
+ List<AppCatalogResource> resourceList = profileResource.getAll();
+ if (resourceList != null && !resourceList.isEmpty()){
+ for (AppCatalogResource resource : resourceList){
+ GatewayProfileAppCatalogResourceAppCat gatewayProfileResource = (GatewayProfileAppCatalogResourceAppCat)resource;
+ List<ComputeResourcePreference> computeResourcePreferences = getAllComputeResourcePreferences(gatewayProfileResource.getGatewayID());
+ GatewayResourceProfile gatewayResourceProfile = AppCatalogThriftConversion.getGatewayResourceProfile(gatewayProfileResource, computeResourcePreferences);
+ gatewayResourceProfileList.add(gatewayResourceProfile);
+ }
+ }
+ return gatewayResourceProfileList;
+ }catch (Exception e) {
+ logger.error("Error while retrieving gateway ids...", e);
+ throw new AppCatalogException(e);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/impl/WorkflowCatalogImpl.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/impl/WorkflowCatalogImpl.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/impl/WorkflowCatalogImpl.java
new file mode 100644
index 0000000..3a400cc
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/impl/WorkflowCatalogImpl.java
@@ -0,0 +1,232 @@
+/*
+ *
+ * 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.impl;
+
+import org.apache.airavata.model.Workflow;
+import org.apache.airavata.model.appcatalog.appinterface.InputDataObjectType;
+import org.apache.airavata.model.appcatalog.appinterface.OutputDataObjectType;
+import org.apache.airavata.registry.core.app.catalog.resources.*;
+import org.apache.airavata.registry.core.app.catalog.util.AppCatalogThriftConversion;
+import org.apache.airavata.registry.core.app.catalog.util.AppCatalogUtils;
+import org.apache.airavata.registry.cpi.AppCatalogException;
+import org.apache.airavata.registry.cpi.WorkflowCatalog;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+public class WorkflowCatalogImpl implements WorkflowCatalog {
+ private final static Logger logger = LoggerFactory.getLogger(WorkflowCatalogImpl.class);
+
+ @Override
+ public List<String> getAllWorkflows(String gatewayId) throws AppCatalogException {
+ List<String> workflowIds = new ArrayList<String>();
+ try {
+ WorkflowAppCatalogResourceAppCat resource = new WorkflowAppCatalogResourceAppCat();
+ resource.setGatewayId(gatewayId);
+ workflowIds = resource.getAllIds();
+ } catch (Exception e) {
+ logger.error("Error while retrieving all the workflow template ids...", e);
+ throw new AppCatalogException(e);
+ }
+ return workflowIds;
+ }
+
+ @Override
+ public Workflow getWorkflow(String workflowTemplateId) throws AppCatalogException {
+ try {
+ WorkflowAppCatalogResourceAppCat resource = new WorkflowAppCatalogResourceAppCat();
+ WorkflowAppCatalogResourceAppCat wfResource = (WorkflowAppCatalogResourceAppCat)resource.get(workflowTemplateId);
+ return AppCatalogThriftConversion.getWorkflow(wfResource);
+ } catch (Exception e) {
+ logger.error("Error while retrieving the workflow...", e);
+ throw new AppCatalogException(e);
+ }
+ }
+
+ @Override
+ public void deleteWorkflow(String workflowTemplateId) throws AppCatalogException {
+ try {
+ WorkflowAppCatalogResourceAppCat resource = new WorkflowAppCatalogResourceAppCat();
+ resource.remove(workflowTemplateId);
+ } catch (Exception e) {
+ logger.error("Error while deleting the workflow...", e);
+ throw new AppCatalogException(e);
+ }
+ }
+
+ @Override
+ public String registerWorkflow(Workflow workflow, String gatewayId) throws AppCatalogException {
+ try {
+ WorkflowAppCatalogResourceAppCat resource = new WorkflowAppCatalogResourceAppCat();
+ resource.setWfTemplateId(AppCatalogUtils.getID(workflow.getName()));
+ resource.setWfName(workflow.getName());
+ resource.setGraph(workflow.getGraph());
+ resource.setGatewayId(gatewayId);
+ if (workflow.getImage() != null){
+ resource.setImage(new String(workflow.getImage()));
+ }
+ resource.save();
+ workflow.setTemplateId(resource.getWfTemplateId());
+ List<InputDataObjectType> workflowInputs = workflow.getWorkflowInputs();
+ if (workflowInputs != null && workflowInputs.size() != 0){
+ for (InputDataObjectType input : workflowInputs){
+ WorkflowInputAppCatalogResourceAppCat wfInputResource = new WorkflowInputAppCatalogResourceAppCat();
+ wfInputResource.setWorkflowResource(resource);
+ wfInputResource.setInputKey(input.getName());
+ wfInputResource.setInputVal(input.getValue());
+ wfInputResource.setWfTemplateId(resource.getWfTemplateId());
+ wfInputResource.setDataType(input.getType().toString());
+ wfInputResource.setAppArgument(input.getApplicationArgument());
+ wfInputResource.setStandardInput(input.isStandardInput());
+ wfInputResource.setUserFriendlyDesc(input.getUserFriendlyDescription());
+ wfInputResource.setMetadata(input.getMetaData());
+ wfInputResource.save();
+ }
+ }
+ List<OutputDataObjectType> workflowOutputs = workflow.getWorkflowOutputs();
+ if (workflowOutputs != null && workflowOutputs.size() != 0){
+ for (OutputDataObjectType output : workflowOutputs){
+ WorkflowOutputAppCatalogResourceAppCat outputResource = new WorkflowOutputAppCatalogResourceAppCat();
+ outputResource.setWorkflowResource(resource);
+ outputResource.setOutputKey(output.getName());
+ outputResource.setOutputVal(output.getValue());
+ outputResource.setWfTemplateId(resource.getWfTemplateId());
+ outputResource.setDataType(output.getType().toString());
+ outputResource.save();
+ }
+ }
+ return resource.getWfTemplateId();
+ } catch (Exception e) {
+ logger.error("Error while saving the workflow...", e);
+ throw new AppCatalogException(e);
+ }
+ }
+
+ @Override
+ public void updateWorkflow(String workflowTemplateId, Workflow workflow) throws AppCatalogException {
+ try {
+ WorkflowAppCatalogResourceAppCat resource = new WorkflowAppCatalogResourceAppCat();
+ WorkflowAppCatalogResourceAppCat existingWF = (WorkflowAppCatalogResourceAppCat)resource.get(workflowTemplateId);
+ existingWF.setWfName(workflow.getName());
+ existingWF.setGraph(workflow.getGraph());
+ if (workflow.getImage() != null){
+ existingWF.setImage(new String(workflow.getImage()));
+ }
+ existingWF.save();
+ List<InputDataObjectType> existingwFInputs = workflow.getWorkflowInputs();
+ if (existingwFInputs != null && existingwFInputs.size() != 0){
+ for (InputDataObjectType input : existingwFInputs){
+ WorkflowInputAppCatalogResourceAppCat wfInputResource = new WorkflowInputAppCatalogResourceAppCat();
+ Map<String, String> ids = new HashMap<String, String>();
+ ids.put(AppCatAbstractResource.WFInputConstants.WF_TEMPLATE_ID,existingWF.getWfTemplateId());
+ ids.put(AppCatAbstractResource.WFInputConstants.INPUT_KEY,input.getName());
+ WorkflowInputAppCatalogResourceAppCat existingInput = (WorkflowInputAppCatalogResourceAppCat)wfInputResource.get(ids);
+ existingInput.setWorkflowResource(existingWF);
+ existingInput.setInputKey(input.getName());
+ existingInput.setInputVal(input.getValue());
+ existingInput.setWfTemplateId(existingWF.getWfTemplateId());
+ existingInput.setDataType(input.getType().toString());
+ existingInput.setAppArgument(input.getApplicationArgument());
+ existingInput.setStandardInput(input.isStandardInput());
+ existingInput.setUserFriendlyDesc(input.getUserFriendlyDescription());
+ existingInput.setMetadata(input.getMetaData());
+ existingInput.save();
+ }
+ }
+ List<OutputDataObjectType> workflowOutputs = workflow.getWorkflowOutputs();
+ if (workflowOutputs != null && workflowOutputs.size() != 0){
+ for (OutputDataObjectType output : workflowOutputs){
+ WorkflowOutputAppCatalogResourceAppCat outputResource = new WorkflowOutputAppCatalogResourceAppCat();
+ Map<String, String> ids = new HashMap<String, String>();
+ ids.put(AppCatAbstractResource.WFOutputConstants.WF_TEMPLATE_ID,existingWF.getWfTemplateId());
+ ids.put(AppCatAbstractResource.WFOutputConstants.OUTPUT_KEY,output.getName());
+ WorkflowOutputAppCatalogResourceAppCat existingOutput = (WorkflowOutputAppCatalogResourceAppCat)outputResource.get(ids);
+ existingOutput.setWorkflowResource(existingWF);
+ existingOutput.setOutputKey(output.getName());
+ existingOutput.setOutputVal(output.getValue());
+ existingOutput.setWfTemplateId(existingWF.getWfTemplateId());
+ existingOutput.setDataType(output.getType().toString());
+ existingOutput.save();
+ }
+ }
+ } catch (Exception e) {
+ logger.error("Error while updating the workflow...", e);
+ throw new AppCatalogException(e);
+ }
+ }
+
+ @Override
+ public String getWorkflowTemplateId(String workflowName) throws AppCatalogException {
+ try {
+ WorkflowAppCatalogResourceAppCat resource = new WorkflowAppCatalogResourceAppCat();
+ List<AppCatalogResource> resourceList = resource.get(AppCatAbstractResource.WorkflowConstants.WF_NAME, workflowName);
+ if (resourceList != null && !resourceList.isEmpty()){
+ WorkflowAppCatalogResourceAppCat wfResource = (WorkflowAppCatalogResourceAppCat)resourceList.get(0);
+ return wfResource.getWfTemplateId();
+ }
+ } catch (Exception e) {
+ logger.error("Error while retrieving the workflow with the workflow name...", e);
+ throw new AppCatalogException(e);
+ }
+ return null;
+ }
+
+ @Override
+ public boolean isWorkflowExistWithName(String workflowName) throws AppCatalogException {
+ try {
+ WorkflowAppCatalogResourceAppCat resource = new WorkflowAppCatalogResourceAppCat();
+ List<AppCatalogResource> resourceList = resource.get(AppCatAbstractResource.WorkflowConstants.WF_NAME, workflowName);
+ if (resourceList != null && !resourceList.isEmpty()){
+ return true;
+ }
+ } catch (Exception e) {
+ logger.error("Error while retrieving the workflow with the workflow name...", e);
+ throw new AppCatalogException(e);
+ }
+ return false;
+ }
+
+ @Override
+ public void updateWorkflowOutputs(String workflowTemplateId, List<OutputDataObjectType> workflowOutputs) throws AppCatalogException {
+ WorkflowAppCatalogResourceAppCat resource = new WorkflowAppCatalogResourceAppCat();
+ WorkflowAppCatalogResourceAppCat existingWF = (WorkflowAppCatalogResourceAppCat)resource.get(workflowTemplateId);
+ if (workflowOutputs != null && workflowOutputs.size() != 0) {
+ for (OutputDataObjectType output : workflowOutputs) {
+ WorkflowOutputAppCatalogResourceAppCat outputResource = new WorkflowOutputAppCatalogResourceAppCat();
+ Map<String, String> ids = new HashMap<String, String>();
+ ids.put(AppCatAbstractResource.WFOutputConstants.WF_TEMPLATE_ID, existingWF.getWfTemplateId());
+ ids.put(AppCatAbstractResource.WFOutputConstants.OUTPUT_KEY, output.getName());
+ WorkflowOutputAppCatalogResourceAppCat existingOutput = (WorkflowOutputAppCatalogResourceAppCat) outputResource.get(ids);
+ existingOutput.setWorkflowResource(existingWF);
+ existingOutput.setOutputKey(output.getName());
+ existingOutput.setOutputVal(output.getValue());
+ existingOutput.setWfTemplateId(existingWF.getWfTemplateId());
+ existingOutput.setDataType(output.getType().toString());
+ existingOutput.save();
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/AppEnvironment.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/AppEnvironment.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/AppEnvironment.java
new file mode 100644
index 0000000..3d5a842
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/AppEnvironment.java
@@ -0,0 +1,76 @@
+/*
+ *
+ * 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.*;
+import java.io.Serializable;
+
+@Entity
+@Table(name = "APP_ENVIRONMENT")
+@IdClass(AppEnvironment_PK.class)
+public class AppEnvironment implements Serializable {
+ @Id
+ @Column(name = "DEPLOYMENT_ID")
+ private String deploymentID;
+ @Id
+ @Column(name = "NAME")
+ private String name;
+
+ @Column(name = "VALUE")
+ private String value;
+
+ @ManyToOne(cascade= CascadeType.MERGE)
+ @JoinColumn(name = "DEPLOYMENT_ID")
+ private ApplicationDeployment applicationDeployment;
+
+ public String getDeploymentID() {
+ return deploymentID;
+ }
+
+ public void setDeploymentID(String deploymentID) {
+ this.deploymentID = deploymentID;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getValue() {
+ return value;
+ }
+
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+ public ApplicationDeployment getApplicationDeployment() {
+ return applicationDeployment;
+ }
+
+ public void setApplicationDeployment(ApplicationDeployment applicationDeployment) {
+ this.applicationDeployment = applicationDeployment;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/AppEnvironment_PK.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/AppEnvironment_PK.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/AppEnvironment_PK.java
new file mode 100644
index 0000000..3859ebd
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/AppEnvironment_PK.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 AppEnvironment_PK implements Serializable {
+ private String deploymentID;
+ private String name;
+
+ public AppEnvironment_PK(String deploymentID, String name) {
+ this.deploymentID = deploymentID;
+ this.name = name;
+ }
+
+ public AppEnvironment_PK() {
+ ;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ return false;
+ }
+
+ @Override
+ public int hashCode() {
+ return 1;
+ }
+
+ public String getDeploymentID() {
+ return deploymentID;
+ }
+
+ public void setDeploymentID(String deploymentID) {
+ this.deploymentID = deploymentID;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/AppInput_PK.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/AppInput_PK.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/AppInput_PK.java
new file mode 100644
index 0000000..fe9254c
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/AppInput_PK.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 AppInput_PK implements Serializable {
+ private String interfaceID;
+ private String inputKey;
+
+ public AppInput_PK(String interfaceID, String inputKey) {
+ this.interfaceID = interfaceID;
+ this.inputKey = inputKey;
+ }
+
+ public AppInput_PK() {
+ ;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ return false;
+ }
+
+ @Override
+ public int hashCode() {
+ return 1;
+ }
+
+ public String getInterfaceID() {
+ return interfaceID;
+ }
+
+ public void setInterfaceID(String interfaceID) {
+ this.interfaceID = interfaceID;
+ }
+
+ public String getInputKey() {
+ return inputKey;
+ }
+
+ public void setInputKey(String inputKey) {
+ this.inputKey = inputKey;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/AppModuleMapping.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/AppModuleMapping.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/AppModuleMapping.java
new file mode 100644
index 0000000..6c17af6
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/AppModuleMapping.java
@@ -0,0 +1,77 @@
+/*
+ *
+ * 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.*;
+import java.io.Serializable;
+
+@Entity
+@Table(name = "APP_MODULE_MAPPING")
+@IdClass(AppModuleMapping_PK.class)
+public class AppModuleMapping implements Serializable {
+ @Id
+ @Column(name = "INTERFACE_ID")
+ private String interfaceID;
+ @Id
+ @Column(name = "MODULE_ID")
+ private String moduleID;
+
+ @ManyToOne(cascade= CascadeType.MERGE)
+ @JoinColumn(name = "INTERFACE_ID")
+ private ApplicationInterface applicationInterface;
+
+ @ManyToOne(cascade= CascadeType.MERGE)
+ @JoinColumn(name = "MODULE_ID")
+ private ApplicationModule applicationModule;
+
+ public String getInterfaceID() {
+ return interfaceID;
+ }
+
+ public void setInterfaceID(String interfaceID) {
+ this.interfaceID = interfaceID;
+ }
+
+ public String getModuleID() {
+ return moduleID;
+ }
+
+ public void setModuleID(String moduleID) {
+ this.moduleID = moduleID;
+ }
+
+ public ApplicationInterface getApplicationInterface() {
+ return applicationInterface;
+ }
+
+ public void setApplicationInterface(ApplicationInterface applicationInterface) {
+ this.applicationInterface = applicationInterface;
+ }
+
+ public ApplicationModule getApplicationModule() {
+ return applicationModule;
+ }
+
+ public void setApplicationModule(ApplicationModule applicationModule) {
+ this.applicationModule = applicationModule;
+ }
+}
[42/52] [abbrv] [partial] airavata git commit: registry refactoring
Posted by sh...@apache.org.
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/GatewayProfileResource.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/GatewayProfileResource.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/GatewayProfileResource.java
deleted file mode 100644
index 84a90ec..0000000
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/GatewayProfileResource.java
+++ /dev/null
@@ -1,318 +0,0 @@
-/**
- * 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.aiaravata.application.catalog.data.resources;
-
-import org.airavata.appcatalog.cpi.AppCatalogException;
-import org.apache.aiaravata.application.catalog.data.model.GatewayProfile;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogJPAUtils;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogQueryGenerator;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogResourceType;
-import org.apache.airavata.common.exception.ApplicationSettingsException;
-import org.apache.airavata.common.utils.AiravataUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.persistence.EntityManager;
-import javax.persistence.Query;
-import java.sql.Timestamp;
-import java.util.ArrayList;
-import java.util.List;
-
-public class GatewayProfileResource extends AbstractResource {
- private final static Logger logger = LoggerFactory.getLogger(GatewayProfileResource.class);
-
- private String gatewayID;
- private Timestamp createdTime;
- private Timestamp updatedTime;
-
- public Timestamp getCreatedTime() {
- return createdTime;
- }
-
- public void setCreatedTime(Timestamp createdTime) {
- this.createdTime = createdTime;
- }
-
- public Timestamp getUpdatedTime() {
- return updatedTime;
- }
-
- public void setUpdatedTime(Timestamp updatedTime) {
- this.updatedTime = updatedTime;
- }
-
- public void remove(Object identifier) throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(GATEWAY_PROFILE);
- generator.setParameter(GatewayProfileConstants.GATEWAY_ID, identifier);
- 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();
- }
- }
- }
-
- public Resource get(Object identifier) throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(GATEWAY_PROFILE);
- generator.setParameter(GatewayProfileConstants.GATEWAY_ID, identifier);
- Query q = generator.selectQuery(em);
- GatewayProfile gatewayProfile = (GatewayProfile) q.getSingleResult();
- GatewayProfileResource gatewayProfileResource =
- (GatewayProfileResource) AppCatalogJPAUtils.getResource(
- AppCatalogResourceType.GATEWAY_PROFILE, gatewayProfile);
- em.getTransaction().commit();
- em.close();
- return gatewayProfileResource;
- } 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();
- }
- }
- }
-
- public List<Resource> get(String fieldName, Object value) throws AppCatalogException {
- List<Resource> gatewayProfileResources = new ArrayList<Resource>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- Query q;
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(GATEWAY_PROFILE);
- List results;
- if (fieldName.equals(GatewayProfileConstants.GATEWAY_ID)) {
- generator.setParameter(GatewayProfileConstants.GATEWAY_ID, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- GatewayProfile gatewayProfile = (GatewayProfile) result;
- GatewayProfileResource gatewayProfileResource =
- (GatewayProfileResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.GATEWAY_PROFILE, gatewayProfile);
- gatewayProfileResources.add(gatewayProfileResource);
- }
- }
- } else if (fieldName.equals(GatewayProfileConstants.GATEWAY_ID)) {
- generator.setParameter(GatewayProfileConstants.GATEWAY_ID, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- GatewayProfile gatewayProfile = (GatewayProfile) result;
- GatewayProfileResource gatewayProfileResource =
- (GatewayProfileResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.GATEWAY_PROFILE, gatewayProfile);
- gatewayProfileResources.add(gatewayProfileResource);
- }
- }
- } else {
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported field name for Gateway Profile resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported field name for Gateway Profile 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 gatewayProfileResources;
- }
-
- @Override
- public List<Resource> getAll() throws AppCatalogException {
- List<Resource> resourceList = new ArrayList<Resource>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(GATEWAY_PROFILE);
- Query q = generator.selectQuery(em);
- List results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- GatewayProfile gatewayProfile = (GatewayProfile) result;
- GatewayProfileResource gatewayProfileResource =
- (GatewayProfileResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.GATEWAY_PROFILE, gatewayProfile);
- resourceList.add(gatewayProfileResource);
- }
- }
- 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 resourceList;
- }
-
- @Override
- public List<String> getAllIds() throws AppCatalogException {
- return null;
- }
-
- public List<String> getIds(String fieldName, Object value) throws AppCatalogException {
- List<String> gatewayProfileResourceIDs = new ArrayList<String>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- Query q;
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(GATEWAY_PROFILE);
- List results;
- if (fieldName.equals(GatewayProfileConstants.GATEWAY_ID)) {
- generator.setParameter(GatewayProfileConstants.GATEWAY_ID, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- GatewayProfile gatewayProfile = (GatewayProfile) result;
- gatewayProfileResourceIDs.add(gatewayProfile.getGatewayID());
- }
- }
- } else if (fieldName.equals(GatewayProfileConstants.GATEWAY_ID)) {
- generator.setParameter(GatewayProfileConstants.GATEWAY_ID, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- GatewayProfile gatewayProfile = (GatewayProfile) result;
- gatewayProfileResourceIDs.add(gatewayProfile.getGatewayID());
- }
- }
- } else {
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported field name for Gateway Profile resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported field name for Gateway Profile 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 gatewayProfileResourceIDs;
- }
-
- public void save() throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- GatewayProfile existingGatewayProfile = em.find(GatewayProfile.class, gatewayID);
- em.close();
-
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- if (existingGatewayProfile != null) {
- existingGatewayProfile.setUpdateTime(AiravataUtils.getCurrentTimestamp());
- em.merge(existingGatewayProfile);
- } else {
- GatewayProfile gatewayProfile = new GatewayProfile();
- gatewayProfile.setGatewayID(gatewayID);
- gatewayProfile.setCreationTime(AiravataUtils.getCurrentTimestamp());
- em.persist(gatewayProfile);
- }
- 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();
- }
- }
- }
-
- public boolean isExists(Object identifier) throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- GatewayProfile gatewayProfile = em.find(GatewayProfile.class, identifier);
- em.close();
- return gatewayProfile != null;
- } 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();
- }
- }
- }
-
- public String getGatewayID() {
- return gatewayID;
- }
-
- public void setGatewayID(String gatewayID) {
- this.gatewayID = gatewayID;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/GlobusGKEndpointResource.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/GlobusGKEndpointResource.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/GlobusGKEndpointResource.java
deleted file mode 100644
index c933600..0000000
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/GlobusGKEndpointResource.java
+++ /dev/null
@@ -1,321 +0,0 @@
-/**
- * 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.aiaravata.application.catalog.data.resources;
-
-import org.airavata.appcatalog.cpi.AppCatalogException;
-import org.apache.aiaravata.application.catalog.data.model.*;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogJPAUtils;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogQueryGenerator;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogResourceType;
-import org.apache.airavata.common.exception.ApplicationSettingsException;
-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 GlobusGKEndpointResource extends AbstractResource {
- private final static Logger logger = LoggerFactory.getLogger(GlobusGKEndpointResource.class);
-
- private String submissionID;
- private String endpoint;
-
- private GlobusJobSubmissionResource globusJobSubmissionResource;
-
-
- 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(GLOBUS_GK_ENDPOINT);
- generator.setParameter(GlobusEPConstants.ENDPOINT, ids.get(GlobusEPConstants.ENDPOINT));
- generator.setParameter(GlobusEPConstants.SUBMISSION_ID, ids.get(GlobusEPConstants.SUBMISSION_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();
- }
- }
- }
-
- public Resource 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(GLOBUS_GK_ENDPOINT);
- generator.setParameter(GlobusEPConstants.SUBMISSION_ID, ids.get(GlobusEPConstants.SUBMISSION_ID));
- generator.setParameter(GlobusEPConstants.ENDPOINT, ids.get(GlobusEPConstants.ENDPOINT));
- Query q = generator.selectQuery(em);
- GlobusGKEndpoint gkEndpoint = (GlobusGKEndpoint) q.getSingleResult();
- GlobusGKEndpointResource gkEndpointResource =
- (GlobusGKEndpointResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.GLOBUS_GK_ENDPOINT, gkEndpoint);
- em.getTransaction().commit();
- em.close();
- return gkEndpointResource;
- } 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();
- }
- }
- }
-
- public List<Resource> get(String fieldName, Object value) throws AppCatalogException {
- List<Resource> resources = new ArrayList<Resource>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- Query q;
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(GLOBUS_GK_ENDPOINT);
- List results;
- if (fieldName.equals(GlobusEPConstants.ENDPOINT)) {
- generator.setParameter(GlobusEPConstants.ENDPOINT, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- GlobusGKEndpoint gkEndpoint = (GlobusGKEndpoint) result;
- GlobusGKEndpointResource gkEndpointResource =
- (GlobusGKEndpointResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.GLOBUS_GK_ENDPOINT, gkEndpoint);
- resources.add(gkEndpointResource);
- }
- }
- } else if (fieldName.equals(GlobusEPConstants.SUBMISSION_ID)) {
- generator.setParameter(GlobusEPConstants.SUBMISSION_ID, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- GlobusGKEndpoint globusGKEndpoint = (GlobusGKEndpoint) result;
- GlobusGKEndpointResource gkEndpointResource =
- (GlobusGKEndpointResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.GLOBUS_GK_ENDPOINT, globusGKEndpoint);
- resources.add(gkEndpointResource);
- }
- }
- } else {
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported field name for Globus Endpoint Resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported field name for Globus Endpoint 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 resources;
- }
-
- @Override
- public List<Resource> getAll() throws AppCatalogException {
- return null;
- }
-
- @Override
- public List<String> getAllIds() throws AppCatalogException {
- return null;
- }
-
- public List<String> getIds(String fieldName, Object value) throws AppCatalogException {
- List<String> list = new ArrayList<String>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- Query q;
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(GLOBUS_GK_ENDPOINT);
- List results;
- if (fieldName.equals(GlobusEPConstants.SUBMISSION_ID)) {
- generator.setParameter(GlobusEPConstants.SUBMISSION_ID, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- GlobusGKEndpoint globusGKEndpoint = (GlobusGKEndpoint) result;
- list.add(globusGKEndpoint.getSubmissionID());
- }
- }
- } else if (fieldName.equals(GlobusEPConstants.ENDPOINT)) {
- generator.setParameter(GlobusEPConstants.ENDPOINT, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- GlobusGKEndpoint globusGKEndpoint = (GlobusGKEndpoint) result;
- list.add(globusGKEndpoint.getSubmissionID());
- }
- }
- } else {
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported field name for Globus EP resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported field name for Globus EP 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 list;
- }
-
- public void save() throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- GlobusGKEndpoint existingGlobusEP = em.find(GlobusGKEndpoint.class, new GlobusGKEndPointPK(submissionID, endpoint));
- em.close();
-
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- GlobusJobSubmission globusJobSubmission = em.find(GlobusJobSubmission.class, submissionID);
- if (existingGlobusEP != null) {
- existingGlobusEP.setSubmissionID(submissionID);
- existingGlobusEP.setEndpoint(endpoint);
- existingGlobusEP.setGlobusSubmission(globusJobSubmission);
- em.merge(existingGlobusEP);
- } else {
- GlobusGKEndpoint globusGKEndpoint = new GlobusGKEndpoint();
- globusGKEndpoint.setSubmissionID(submissionID);
- globusGKEndpoint.setEndpoint(endpoint);
- globusGKEndpoint.setGlobusSubmission(globusJobSubmission);
- em.persist(globusGKEndpoint);
- }
- 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();
- }
- }
- }
-
- 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();
- GlobusGKEndpoint gkEndpoint = em.find(GlobusGKEndpoint.class, new GlobusGKEndPointPK(ids.get(GlobusEPConstants.SUBMISSION_ID),
- ids.get(GlobusEPConstants.ENDPOINT)));
-
- em.close();
- return gkEndpoint != null;
- } 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();
- }
- } }
-
- public String getSubmissionID() {
- return submissionID;
- }
-
- public void setSubmissionID(String submissionID) {
- this.submissionID = submissionID;
- }
-
- public String getEndpoint() {
- return endpoint;
- }
-
- public void setEndpoint(String endpoint) {
- this.endpoint = endpoint;
- }
-
- public GlobusJobSubmissionResource getGlobusJobSubmissionResource() {
- return globusJobSubmissionResource;
- }
-
- public void setGlobusJobSubmissionResource(GlobusJobSubmissionResource globusJobSubmissionResource) {
- this.globusJobSubmissionResource = globusJobSubmissionResource;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/GlobusJobSubmissionResource.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/GlobusJobSubmissionResource.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/GlobusJobSubmissionResource.java
deleted file mode 100644
index 6830004..0000000
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/GlobusJobSubmissionResource.java
+++ /dev/null
@@ -1,316 +0,0 @@
-/**
- * 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.aiaravata.application.catalog.data.resources;
-
-import org.airavata.appcatalog.cpi.AppCatalogException;
-import org.apache.aiaravata.application.catalog.data.model.ComputeResource;
-import org.apache.aiaravata.application.catalog.data.model.GlobusJobSubmission;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogJPAUtils;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogQueryGenerator;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogResourceType;
-import org.apache.airavata.common.exception.ApplicationSettingsException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.persistence.EntityManager;
-import javax.persistence.Query;
-import java.util.ArrayList;
-import java.util.List;
-
-public class GlobusJobSubmissionResource extends AbstractResource {
-
- private final static Logger logger = LoggerFactory.getLogger(GlobusJobSubmissionResource.class);
-
- private String submissionID;
- private String resourceJobManager;
- private String securityProtocol;
-
- public void remove(Object identifier) throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(GLOBUS_SUBMISSION);
- generator.setParameter(GlobusJobSubmissionConstants.SUBMISSION_ID, identifier);
- 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();
- }
- }
- }
-
- public Resource get(Object identifier) throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(GLOBUS_SUBMISSION);
- generator.setParameter(GlobusJobSubmissionConstants.SUBMISSION_ID, identifier);
- Query q = generator.selectQuery(em);
- GlobusJobSubmission globusJobSubmission = (GlobusJobSubmission) q.getSingleResult();
- GlobusJobSubmissionResource globusJobSubmissionResource =
- (GlobusJobSubmissionResource) AppCatalogJPAUtils.getResource(
- AppCatalogResourceType.GLOBUS_SUBMISSION, globusJobSubmission);
- em.getTransaction().commit();
- em.close();
- return globusJobSubmissionResource;
- } 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();
- }
- }
- }
-
- public List<Resource> get(String fieldName, Object value) throws AppCatalogException {
- List<Resource> globusSubmissionResourceList = new ArrayList<Resource>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- Query q;
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(GLOBUS_SUBMISSION);
- List results;
- if (fieldName.equals(GlobusJobSubmissionConstants.RESOURCE_JOB_MANAGER)) {
- generator.setParameter(GlobusJobSubmissionConstants.RESOURCE_JOB_MANAGER, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- GlobusJobSubmission globusJobSubmission = (GlobusJobSubmission) result;
- GlobusJobSubmissionResource globusJobSubmissionResource =
- (GlobusJobSubmissionResource) AppCatalogJPAUtils.getResource(
- AppCatalogResourceType.GLOBUS_SUBMISSION, globusJobSubmission);
- globusSubmissionResourceList.add(globusJobSubmissionResource);
- }
- }
- } else if (fieldName.equals(GlobusJobSubmissionConstants.SECURITY_PROTOCAL)) {
- generator.setParameter(GlobusJobSubmissionConstants.SECURITY_PROTOCAL, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- GlobusJobSubmission globusJobSubmission = (GlobusJobSubmission) result;
- GlobusJobSubmissionResource globusJobSubmissionResource =
- (GlobusJobSubmissionResource) AppCatalogJPAUtils.getResource(
- AppCatalogResourceType.GLOBUS_SUBMISSION, globusJobSubmission);
- globusSubmissionResourceList.add(globusJobSubmissionResource);
- }
- }
- } else {
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported field name for Globus submission resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported field name for Globus Submission 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 globusSubmissionResourceList;
- }
-
- @Override
- public List<Resource> getAll() throws AppCatalogException {
- return null;
- }
-
- @Override
- public List<String> getAllIds() throws AppCatalogException {
- return null;
- }
-
- public List<String> getIds(String fieldName, Object value) throws AppCatalogException {
- List<String> globusSubmissionResourceIDs = new ArrayList<String>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- Query q;
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(GLOBUS_SUBMISSION);
- List results;
- if (fieldName.equals(GlobusJobSubmissionConstants.SUBMISSION_ID)) {
- generator.setParameter(GlobusJobSubmissionConstants.SUBMISSION_ID, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- GlobusJobSubmission globusJobSubmission = (GlobusJobSubmission) result;
- globusSubmissionResourceIDs.add(globusJobSubmission.getSubmissionID());
- }
- }
- } else if (fieldName.equals(GlobusJobSubmissionConstants.GLOBUS_GATEKEEPER_EP)) {
- generator.setParameter(GlobusJobSubmissionConstants.GLOBUS_GATEKEEPER_EP, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- GlobusJobSubmission globusJobSubmission = (GlobusJobSubmission) result;
- globusSubmissionResourceIDs.add(globusJobSubmission.getSubmissionID());
- }
- }
- }
- else if (fieldName.equals(GlobusJobSubmissionConstants.SECURITY_PROTOCAL)) {
- generator.setParameter(GlobusJobSubmissionConstants.SECURITY_PROTOCAL, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- GlobusJobSubmission globusJobSubmission = (GlobusJobSubmission) result;
- globusSubmissionResourceIDs.add(globusJobSubmission.getSubmissionID());
- }
- }
- } else if (fieldName.equals(GlobusJobSubmissionConstants.RESOURCE_JOB_MANAGER)) {
- generator.setParameter(GlobusJobSubmissionConstants.RESOURCE_JOB_MANAGER, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- GlobusJobSubmission globusJobSubmission = (GlobusJobSubmission) result;
- globusSubmissionResourceIDs.add(globusJobSubmission.getSubmissionID());
- }
- }
- } else {
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported field name for Globus Submission resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported field name for Globus Submission 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 globusSubmissionResourceIDs;
- }
-
- public void save() throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- GlobusJobSubmission existingGlobusSubmission = em.find(GlobusJobSubmission.class, submissionID);
- em.close();
-
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- if (existingGlobusSubmission != null) {
- existingGlobusSubmission.setSubmissionID(submissionID);
- existingGlobusSubmission.setResourceJobManager(resourceJobManager);
- existingGlobusSubmission.setSecurityProtocol(securityProtocol);
- em.merge(existingGlobusSubmission);
- } else {
- GlobusJobSubmission globusJobSubmission = new GlobusJobSubmission();
- globusJobSubmission.setSubmissionID(submissionID);
- globusJobSubmission.setSecurityProtocol(securityProtocol);
- globusJobSubmission.setResourceJobManager(resourceJobManager);
- em.persist(globusJobSubmission);
- }
- 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();
- }
- }
- }
-
- public boolean isExists(Object identifier) throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- GlobusJobSubmission globusJobSubmission = em.find(GlobusJobSubmission.class, identifier);
- em.close();
- return globusJobSubmission != null;
- } 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();
- }
- }
- }
-
- public String getSubmissionID() {
- return submissionID;
- }
-
- public void setSubmissionID(String submissionID) {
- this.submissionID = submissionID;
- }
-
- public String getResourceJobManager() {
- return resourceJobManager;
- }
-
- public void setResourceJobManager(String resourceJobManager) {
- this.resourceJobManager = resourceJobManager;
- }
-
- public String getSecurityProtocol() {
- return securityProtocol;
- }
-
- public void setSecurityProtocol(String securityProtocol) {
- this.securityProtocol = securityProtocol;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/GridftpDataMovementResource.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/GridftpDataMovementResource.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/GridftpDataMovementResource.java
deleted file mode 100644
index 35b36e0..0000000
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/GridftpDataMovementResource.java
+++ /dev/null
@@ -1,279 +0,0 @@
-/**
- * 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.aiaravata.application.catalog.data.resources;
-
-import java.sql.Timestamp;
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.persistence.EntityManager;
-import javax.persistence.Query;
-
-import org.airavata.appcatalog.cpi.AppCatalogException;
-import org.apache.aiaravata.application.catalog.data.model.GridftpDataMovement;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogJPAUtils;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogQueryGenerator;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogResourceType;
-import org.apache.airavata.common.exception.ApplicationSettingsException;
-import org.apache.airavata.common.utils.AiravataUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class GridftpDataMovementResource extends AbstractResource {
- private final static Logger logger = LoggerFactory.getLogger(GridftpDataMovementResource.class);
- private String dataMovementInterfaceId;
- private String securityProtocol;
- private Timestamp createdTime;
- private Timestamp updatedTime;
-
- public Timestamp getCreatedTime() {
- return createdTime;
- }
-
- public void setCreatedTime(Timestamp createdTime) {
- this.createdTime = createdTime;
- }
-
- public Timestamp getUpdatedTime() {
- return updatedTime;
- }
-
- public void setUpdatedTime(Timestamp updatedTime) {
- this.updatedTime = updatedTime;
- }
-
- @Override
- public void remove(Object identifier) throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(GRIDFTP_DATA_MOVEMENT);
- generator.setParameter(GridftpDataMovementConstants.DATA_MOVEMENT_INTERFACE_ID, identifier);
- 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 Resource get(Object identifier) throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(GRIDFTP_DATA_MOVEMENT);
- generator.setParameter(GridftpDataMovementConstants.DATA_MOVEMENT_INTERFACE_ID, identifier);
- Query q = generator.selectQuery(em);
- GridftpDataMovement gridftpDataMovement = (GridftpDataMovement) q.getSingleResult();
- GridftpDataMovementResource gridftpDataMovementResource = (GridftpDataMovementResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.GRIDFTP_DATA_MOVEMENT, gridftpDataMovement);
- em.getTransaction().commit();
- em.close();
- return gridftpDataMovementResource;
- } 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<Resource> get(String fieldName, Object value) throws AppCatalogException {
- List<Resource> gridftpDataMovementResources = new ArrayList<Resource>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(GRIDFTP_DATA_MOVEMENT);
- Query q;
- if ((fieldName.equals(GridftpDataMovementConstants.DATA_MOVEMENT_INTERFACE_ID)) || (fieldName.equals(GridftpDataMovementConstants.SECURITY_PROTOCOL))) {
- generator.setParameter(fieldName, value);
- q = generator.selectQuery(em);
- List<?> results = q.getResultList();
- for (Object result : results) {
- GridftpDataMovement gridftpDataMovement = (GridftpDataMovement) result;
- GridftpDataMovementResource gridftpDataMovementResource = (GridftpDataMovementResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.GRIDFTP_DATA_MOVEMENT, gridftpDataMovement);
- gridftpDataMovementResources.add(gridftpDataMovementResource);
- }
- } else {
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported field name for Gridftp Data Movement Resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported field name for Gridftp Data Movement Resource.");
- }
- 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();
- }
- }
- return gridftpDataMovementResources;
- }
-
- @Override
- public List<Resource> 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 {
- List<String> gridftpDataMovementResourceIDs = new ArrayList<String>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(GRIDFTP_DATA_MOVEMENT);
- Query q;
- if ((fieldName.equals(GridftpDataMovementConstants.DATA_MOVEMENT_INTERFACE_ID)) || (fieldName.equals(GridftpDataMovementConstants.SECURITY_PROTOCOL))) {
- generator.setParameter(fieldName, value);
- q = generator.selectQuery(em);
- List<?> results = q.getResultList();
- for (Object result : results) {
- GridftpDataMovement gridftpDataMovement = (GridftpDataMovement) result;
- GridftpDataMovementResource gridftpDataMovementResource = (GridftpDataMovementResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.GRIDFTP_DATA_MOVEMENT, gridftpDataMovement);
- gridftpDataMovementResourceIDs.add(gridftpDataMovementResource.getDataMovementInterfaceId());
- }
- } else {
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported field name for Gridftp Data Movement Resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported field name for Gridftp Data Movement Resource.");
- }
- 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();
- }
- }
- return gridftpDataMovementResourceIDs;
- }
-
- @Override
- public void save() throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- GridftpDataMovement existingGridftpDataMovement = em.find(GridftpDataMovement.class, dataMovementInterfaceId);
- em.close();
- GridftpDataMovement gridftpDataMovement;
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- if (existingGridftpDataMovement == null) {
- gridftpDataMovement = new GridftpDataMovement();
- gridftpDataMovement.setCreationTime(AiravataUtils.getCurrentTimestamp());
- } else {
- gridftpDataMovement = existingGridftpDataMovement;
- gridftpDataMovement.setUpdateTime(AiravataUtils.getCurrentTimestamp());
- }
- gridftpDataMovement.setDataMovementInterfaceId(getDataMovementInterfaceId());
- gridftpDataMovement.setSecurityProtocol(getSecurityProtocol());
- if (existingGridftpDataMovement == null) {
- em.persist(gridftpDataMovement);
- } else {
- em.merge(gridftpDataMovement);
- }
- 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 {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- GridftpDataMovement gridftpDataMovement = em.find(GridftpDataMovement.class, identifier);
- em.close();
- return gridftpDataMovement != null;
- } 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();
- }
- }
- }
-
- public String getDataMovementInterfaceId() {
- return dataMovementInterfaceId;
- }
-
- public String getSecurityProtocol() {
- return securityProtocol;
- }
-
- public void setDataMovementInterfaceId(String dataMovementInterfaceId) {
- this.dataMovementInterfaceId=dataMovementInterfaceId;
- }
-
- public void setSecurityProtocol(String securityProtocol) {
- this.securityProtocol=securityProtocol;
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/GridftpEndpointResource.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/GridftpEndpointResource.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/GridftpEndpointResource.java
deleted file mode 100644
index f484568..0000000
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/GridftpEndpointResource.java
+++ /dev/null
@@ -1,317 +0,0 @@
-/**
- * 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.aiaravata.application.catalog.data.resources;
-
-import java.sql.Timestamp;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.persistence.EntityManager;
-import javax.persistence.Query;
-
-import org.airavata.appcatalog.cpi.AppCatalogException;
-import org.apache.aiaravata.application.catalog.data.model.GridftpDataMovement;
-import org.apache.aiaravata.application.catalog.data.model.GridftpEndpoint;
-import org.apache.aiaravata.application.catalog.data.model.GridftpEndpoint_PK;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogJPAUtils;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogQueryGenerator;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogResourceType;
-import org.apache.airavata.common.exception.ApplicationSettingsException;
-import org.apache.airavata.common.utils.AiravataUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class GridftpEndpointResource extends AbstractResource {
- private final static Logger logger = LoggerFactory.getLogger(GridftpEndpointResource.class);
- private String endpoint;
- private String dataMovementInterfaceId;
- private GridftpDataMovementResource gridftpDataMovementResource;
- private Timestamp createdTime;
- private Timestamp updatedTime;
-
- public Timestamp getCreatedTime() {
- return createdTime;
- }
-
- public void setCreatedTime(Timestamp createdTime) {
- this.createdTime = createdTime;
- }
-
- public Timestamp getUpdatedTime() {
- return updatedTime;
- }
-
- public void setUpdatedTime(Timestamp updatedTime) {
- this.updatedTime = updatedTime;
- }
-
- @Override
- public void remove(Object identifier) throws AppCatalogException {
- HashMap<String, String> ids;
- if (identifier instanceof Map) {
- ids = (HashMap<String, String>) 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(GRIDFTP_ENDPOINT);
- generator.setParameter(GridftpEndpointConstants.ENDPOINT, ids.get(GridftpEndpointConstants.ENDPOINT));
- generator.setParameter(GridftpEndpointConstants.DATA_MOVEMENT_INTERFACE_ID, ids.get(GridftpEndpointConstants.DATA_MOVEMENT_INTERFACE_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 Resource get(Object identifier) throws AppCatalogException {
- HashMap<String, String> ids;
- if (identifier instanceof Map) {
- ids = (HashMap<String, String>) 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(GRIDFTP_ENDPOINT);
- generator.setParameter(GridftpEndpointConstants.ENDPOINT, ids.get(GridftpEndpointConstants.ENDPOINT));
- generator.setParameter(GridftpEndpointConstants.DATA_MOVEMENT_INTERFACE_ID, ids.get(GridftpEndpointConstants.DATA_MOVEMENT_INTERFACE_ID));
- Query q = generator.selectQuery(em);
- GridftpEndpoint gridftpEndpoint = (GridftpEndpoint) q.getSingleResult();
- GridftpEndpointResource gridftpEndpointResource = (GridftpEndpointResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.GRIDFTP_ENDPOINT, gridftpEndpoint);
- em.getTransaction().commit();
- em.close();
- return gridftpEndpointResource;
- } 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<Resource> get(String fieldName, Object value) throws AppCatalogException {
- List<Resource> gridftpEndpointResources = new ArrayList<Resource>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(GRIDFTP_ENDPOINT);
- Query q;
- if ((fieldName.equals(GridftpEndpointConstants.ENDPOINT)) || (fieldName.equals(GridftpEndpointConstants.DATA_MOVEMENT_INTERFACE_ID))) {
- generator.setParameter(fieldName, value);
- q = generator.selectQuery(em);
- List<?> results = q.getResultList();
- for (Object result : results) {
- GridftpEndpoint gridftpEndpoint = (GridftpEndpoint) result;
- GridftpEndpointResource gridftpEndpointResource = (GridftpEndpointResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.GRIDFTP_ENDPOINT, gridftpEndpoint);
- gridftpEndpointResources.add(gridftpEndpointResource);
- }
- } else {
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported field name for Gridftp Endpoint Resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported field name for Gridftp Endpoint Resource.");
- }
- 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();
- }
- }
- return gridftpEndpointResources;
- }
-
- @Override
- public List<Resource> 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 {
- List<String> gridftpEndpointResourceIDs = new ArrayList<String>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(GRIDFTP_ENDPOINT);
- Query q;
- if ((fieldName.equals(GridftpEndpointConstants.ENDPOINT)) || (fieldName.equals(GridftpEndpointConstants.DATA_MOVEMENT_INTERFACE_ID))) {
- generator.setParameter(fieldName, value);
- q = generator.selectQuery(em);
- List<?> results = q.getResultList();
- for (Object result : results) {
- GridftpEndpoint gridftpEndpoint = (GridftpEndpoint) result;
- GridftpEndpointResource gridftpEndpointResource = (GridftpEndpointResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.GRIDFTP_ENDPOINT, gridftpEndpoint);
- gridftpEndpointResourceIDs.add(gridftpEndpointResource.getDataMovementInterfaceId());
- }
- } else {
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported field name for Gridftp Endpoint Resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported field name for Gridftp Endpoint Resource.");
- }
- 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();
- }
- }
- return gridftpEndpointResourceIDs;
- }
-
- @Override
- public void save() throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- GridftpEndpoint existingGridftpEndpoint = em.find(GridftpEndpoint.class, new GridftpEndpoint_PK(endpoint, dataMovementInterfaceId));
- em.close();
- GridftpEndpoint gridftpEndpoint;
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- if (existingGridftpEndpoint == null) {
- gridftpEndpoint = new GridftpEndpoint();
- gridftpEndpoint.setCreationTime(AiravataUtils.getCurrentTimestamp());
- } else {
- gridftpEndpoint = existingGridftpEndpoint;
- gridftpEndpoint.setUpdateTime(AiravataUtils.getCurrentTimestamp());
- }
- gridftpEndpoint.setEndpoint(getEndpoint());
- gridftpEndpoint.setDataMovementInterfaceId(getDataMovementInterfaceId());
- GridftpDataMovement gridftpDataMovement = em.find(GridftpDataMovement.class, getDataMovementInterfaceId());
- gridftpEndpoint.setGridftpDataMovement(gridftpDataMovement);
- if (existingGridftpEndpoint == null) {
- em.persist(gridftpEndpoint);
- } else {
- em.merge(gridftpEndpoint);
- }
- 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<String, String>) 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();
- GridftpEndpoint gridftpEndpoint = em.find(GridftpEndpoint.class, new GridftpEndpoint_PK(ids.get(GridftpEndpointConstants.ENDPOINT), ids.get(GridftpEndpointConstants.DATA_MOVEMENT_INTERFACE_ID)));
- em.close();
- return gridftpEndpoint != null;
- } 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();
- }
- }
- }
-
- public String getEndpoint() {
- return endpoint;
- }
-
- public String getDataMovementInterfaceId() {
- return dataMovementInterfaceId;
- }
-
- public GridftpDataMovementResource getGridftpDataMovementResource() {
- return gridftpDataMovementResource;
- }
-
- public void setEndpoint(String endpoint) {
- this.endpoint=endpoint;
- }
-
- public void setDataMovementInterfaceId(String dataMovementInterfaceId) {
- this.dataMovementInterfaceId=dataMovementInterfaceId;
- }
-
- public void setGridftpDataMovementResource(GridftpDataMovementResource gridftpDataMovementResource) {
- this.gridftpDataMovementResource=gridftpDataMovementResource;
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/HostAliasResource.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/HostAliasResource.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/HostAliasResource.java
deleted file mode 100644
index f267a72..0000000
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/HostAliasResource.java
+++ /dev/null
@@ -1,317 +0,0 @@
-/**
- * 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.aiaravata.application.catalog.data.resources;
-
-import org.airavata.appcatalog.cpi.AppCatalogException;
-import org.apache.aiaravata.application.catalog.data.model.ComputeResource;
-import org.apache.aiaravata.application.catalog.data.model.HostAlias;
-import org.apache.aiaravata.application.catalog.data.model.HostAliasPK;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogJPAUtils;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogQueryGenerator;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogResourceType;
-import org.apache.airavata.common.exception.ApplicationSettingsException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.persistence.EntityManager;
-import javax.persistence.Query;
-import java.util.*;
-
-public class HostAliasResource extends AbstractResource {
-
- private final static Logger logger = LoggerFactory.getLogger(HostAliasResource.class);
-
- private String resourceID;
- private String alias;
- private ComputeResourceResource computeHostResource;
-
- public void remove(Object identifier) throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator= new AppCatalogQueryGenerator(HOST_ALIAS);
- generator.setParameter(HostAliasConstants.RESOURCE_ID, (String)identifier);
-// generator.setParameter(HostAliasConstants.ALIAS, ids.get(HostAliasConstants.ALIAS));
- 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();
- }
- }
- }
-
- public Resource 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(HOST_ALIAS);
- generator.setParameter(HostAliasConstants.RESOURCE_ID, ids.get(HostAliasConstants.RESOURCE_ID));
- generator.setParameter(HostAliasConstants.ALIAS, ids.get(HostAliasConstants.ALIAS));
- Query q = generator.selectQuery(em);
- HostAlias hostAlias = (HostAlias) q.getSingleResult();
- HostAliasResource hostAliasResource =
- (HostAliasResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.HOST_ALIAS, hostAlias);
- em.getTransaction().commit();
- em.close();
- return hostAliasResource;
- } 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();
- }
- }
- }
-
- public List<Resource> get(String fieldName, Object value) throws AppCatalogException {
-
- List<Resource> hostAliasResources = new ArrayList<Resource>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- Query q;
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(HOST_ALIAS);
- List results;
- if (fieldName.equals(HostAliasConstants.ALIAS)) {
- generator.setParameter(HostAliasConstants.ALIAS, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- HostAlias hostAlias = (HostAlias) result;
- HostAliasResource hostAliasResource =
- (HostAliasResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.HOST_ALIAS, hostAlias);
- hostAliasResources.add(hostAliasResource);
- }
- }
- } else if (fieldName.equals(HostAliasConstants.RESOURCE_ID)) {
- generator.setParameter(HostAliasConstants.RESOURCE_ID, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- HostAlias hostAlias = (HostAlias) result;
- HostAliasResource hostAliasResource =
- (HostAliasResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.HOST_ALIAS, hostAlias);
- hostAliasResources.add(hostAliasResource);
- }
- }
- } else {
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported field name for Host Alias Resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported field name for Host Alias 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 hostAliasResources;
- }
-
- @Override
- public List<Resource> getAll() throws AppCatalogException {
- return null;
- }
-
- @Override
- public List<String> getAllIds() throws AppCatalogException {
- return null;
- }
-
- public List<String> getIds(String fieldName, Object value) throws AppCatalogException {
-
- List<String> hostAliasResourceIDs = new ArrayList<String>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- Query q;
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(HOST_ALIAS);
- List results;
- if (fieldName.equals(HostAliasConstants.ALIAS)) {
- generator.setParameter(HostAliasConstants.ALIAS, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- HostAlias hostAlias = (HostAlias) result;
- hostAliasResourceIDs.add(hostAlias.getResourceID());
- }
- }
- } else if (fieldName.equals(HostAliasConstants.RESOURCE_ID)) {
- generator.setParameter(HostAliasConstants.RESOURCE_ID, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- HostAlias hostAlias = (HostAlias) result;
- hostAliasResourceIDs.add(hostAlias.getResourceID());
- }
- }
- } else {
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported field name for Host Alias resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported field name for Host Alias 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 hostAliasResourceIDs;
- }
-
- public void save() throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- HostAlias existingHostAlias = em.find(HostAlias.class, new HostAliasPK(resourceID, alias));
- em.close();
-
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- ComputeResource computeResource = em.find(ComputeResource.class, resourceID);
- if (existingHostAlias != null){
- existingHostAlias.setAlias(alias);
- existingHostAlias.setComputeResource(computeResource);
- existingHostAlias.setResourceID(resourceID);
- em.merge(existingHostAlias);
- }else {
- HostAlias hostAlias = new HostAlias();
- hostAlias.setAlias(alias);
- hostAlias.setResourceID(resourceID);
- hostAlias.setComputeResource(computeResource);
-
- em.persist(hostAlias);
- }
- 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();
- }
- }
- }
-
- 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();
- HostAlias hostAlias = em.find(HostAlias.class, new HostAliasPK(ids.get(HostAliasConstants.RESOURCE_ID),
- ids.get(HostAliasConstants.ALIAS)));
-
- em.close();
- return hostAlias != null;
- } 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();
- }
- }
-
- }
-
- public String getResourceID() {
- return resourceID;
- }
-
- public void setResourceID(String resourceID) {
- this.resourceID = resourceID;
- }
-
- public String getAlias() {
- return alias;
- }
-
- public void setAlias(String alias) {
- this.alias = alias;
- }
-
- public ComputeResourceResource getComputeHostResource() {
- return computeHostResource;
- }
-
- public void setComputeHostResource(ComputeResourceResource computeHostResource) {
- this.computeHostResource = computeHostResource;
- }
-}
[40/52] [abbrv] [partial] airavata git commit: registry refactoring
Posted by sh...@apache.org.
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/LocalDataMovementResource.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/LocalDataMovementResource.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/LocalDataMovementResource.java
deleted file mode 100644
index a909122..0000000
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/LocalDataMovementResource.java
+++ /dev/null
@@ -1,249 +0,0 @@
-/*
- *
- * 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.aiaravata.application.catalog.data.resources;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.persistence.EntityManager;
-import javax.persistence.Query;
-
-import org.airavata.appcatalog.cpi.AppCatalogException;
-import org.apache.aiaravata.application.catalog.data.model.LocalDataMovement;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogJPAUtils;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogQueryGenerator;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogResourceType;
-import org.apache.airavata.common.exception.ApplicationSettingsException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class LocalDataMovementResource extends AbstractResource {
- private final static Logger logger = LoggerFactory.getLogger(LocalDataMovementResource.class);
- private String dataMovementInterfaceId;
-
- @Override
- public void remove(Object identifier) throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(LOCAL_DATA_MOVEMENT);
- generator.setParameter(LocalDataMovementConstants.DATA_MOVEMENT_INTERFACE_ID, identifier);
- 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 Resource get(Object identifier) throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(LOCAL_DATA_MOVEMENT);
- generator.setParameter(LocalDataMovementConstants.DATA_MOVEMENT_INTERFACE_ID, identifier);
- Query q = generator.selectQuery(em);
- LocalDataMovement localDataMovement = (LocalDataMovement) q.getSingleResult();
- LocalDataMovementResource localDataMovementResource = (LocalDataMovementResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.LOCAL_DATA_MOVEMENT, localDataMovement);
- em.getTransaction().commit();
- em.close();
- return localDataMovementResource;
- } 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<Resource> get(String fieldName, Object value) throws AppCatalogException {
- List<Resource> localDataMovementResources = new ArrayList<Resource>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(LOCAL_DATA_MOVEMENT);
- Query q;
- if ((fieldName.equals(LocalDataMovementConstants.DATA_MOVEMENT_INTERFACE_ID))) {
- generator.setParameter(fieldName, value);
- q = generator.selectQuery(em);
- List<?> results = q.getResultList();
- for (Object result : results) {
- LocalDataMovement localDataMovement = (LocalDataMovement) result;
- LocalDataMovementResource localDataMovementResource = (LocalDataMovementResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.LOCAL_DATA_MOVEMENT, localDataMovement);
- localDataMovementResources.add(localDataMovementResource);
- }
- } else {
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported field name for Local Data Movement Resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported field name for Local Data Movement Resource.");
- }
- 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();
- }
- }
- return localDataMovementResources;
- }
-
- @Override
- public List<Resource> 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 {
- List<String> localDataMovementResourceIDs = new ArrayList<String>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(LOCAL_DATA_MOVEMENT);
- Query q;
- if ((fieldName.equals(LocalDataMovementConstants.DATA_MOVEMENT_INTERFACE_ID))) {
- generator.setParameter(fieldName, value);
- q = generator.selectQuery(em);
- List<?> results = q.getResultList();
- for (Object result : results) {
- LocalDataMovement localDataMovement = (LocalDataMovement) result;
- LocalDataMovementResource localDataMovementResource = (LocalDataMovementResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.LOCAL_DATA_MOVEMENT, localDataMovement);
- localDataMovementResourceIDs.add(localDataMovementResource.getDataMovementInterfaceId());
- }
- } else {
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported field name for Local Data Movement Resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported field name for Local Data Movement Resource.");
- }
- 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();
- }
- }
- return localDataMovementResourceIDs;
- }
-
- @Override
- public void save() throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- LocalDataMovement existingLocalDataMovement = em.find(LocalDataMovement.class, dataMovementInterfaceId);
- em.close();
- LocalDataMovement localDataMovement;
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- if (existingLocalDataMovement == null) {
- localDataMovement = new LocalDataMovement();
- } else {
- localDataMovement = existingLocalDataMovement;
- }
- localDataMovement.setDataMovementInterfaceId(getDataMovementInterfaceId());
- if (existingLocalDataMovement == null) {
- em.persist(localDataMovement);
- } else {
- em.merge(localDataMovement);
- }
- 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 {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- LocalDataMovement localDataMovement = em.find(LocalDataMovement.class, identifier);
- em.close();
- return localDataMovement != null;
- } 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();
- }
- }
- }
-
- public String getDataMovementInterfaceId() {
- return dataMovementInterfaceId;
- }
-
- public void setDataMovementInterfaceId(String dataMovementInterfaceId) {
- this.dataMovementInterfaceId=dataMovementInterfaceId;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/LocalSubmissionResource.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/LocalSubmissionResource.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/LocalSubmissionResource.java
deleted file mode 100644
index 487e5dc..0000000
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/LocalSubmissionResource.java
+++ /dev/null
@@ -1,293 +0,0 @@
-/*
- *
- * 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.aiaravata.application.catalog.data.resources;
-
-import java.sql.Timestamp;
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.persistence.EntityManager;
-import javax.persistence.Query;
-
-import org.airavata.appcatalog.cpi.AppCatalogException;
-import org.apache.aiaravata.application.catalog.data.model.LocalSubmission;
-import org.apache.aiaravata.application.catalog.data.model.ResourceJobManager;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogJPAUtils;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogQueryGenerator;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogResourceType;
-import org.apache.airavata.common.exception.ApplicationSettingsException;
-import org.apache.airavata.common.utils.AiravataUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class LocalSubmissionResource extends AbstractResource {
- private final static Logger logger = LoggerFactory.getLogger(LocalSubmissionResource.class);
- private String resourceJobManagerId;
- private ResourceJobManagerResource resourceJobManagerResource;
- private String jobSubmissionInterfaceId;
- private Timestamp createdTime;
- private Timestamp updatedTime;
-
- public Timestamp getCreatedTime() {
- return createdTime;
- }
-
- public void setCreatedTime(Timestamp createdTime) {
- this.createdTime = createdTime;
- }
-
- public Timestamp getUpdatedTime() {
- return updatedTime;
- }
-
- public void setUpdatedTime(Timestamp updatedTime) {
- this.updatedTime = updatedTime;
- }
-
- @Override
- public void remove(Object identifier) throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(LOCAL_SUBMISSION);
- generator.setParameter(LocalSubmissionConstants.JOB_SUBMISSION_INTERFACE_ID, identifier);
- 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 Resource get(Object identifier) throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(LOCAL_SUBMISSION);
- generator.setParameter(LocalSubmissionConstants.JOB_SUBMISSION_INTERFACE_ID, identifier);
- Query q = generator.selectQuery(em);
- LocalSubmission localSubmission = (LocalSubmission) q.getSingleResult();
- LocalSubmissionResource localSubmissionResource = (LocalSubmissionResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.LOCAL_SUBMISSION, localSubmission);
- em.getTransaction().commit();
- em.close();
- return localSubmissionResource;
- } 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<Resource> get(String fieldName, Object value) throws AppCatalogException {
- List<Resource> localSubmissionResources = new ArrayList<Resource>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(LOCAL_SUBMISSION);
- Query q;
- if ((fieldName.equals(LocalSubmissionConstants.RESOURCE_JOB_MANAGER_ID)) || (fieldName.equals(LocalSubmissionConstants.JOB_SUBMISSION_INTERFACE_ID))) {
- generator.setParameter(fieldName, value);
- q = generator.selectQuery(em);
- List<?> results = q.getResultList();
- for (Object result : results) {
- LocalSubmission localSubmission = (LocalSubmission) result;
- LocalSubmissionResource localSubmissionResource = (LocalSubmissionResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.LOCAL_SUBMISSION, localSubmission);
- localSubmissionResources.add(localSubmissionResource);
- }
- } else {
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported field name for Local Submission Resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported field name for Local Submission Resource.");
- }
- 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();
- }
- }
- return localSubmissionResources;
- }
-
- @Override
- public List<Resource> 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 {
- List<String> localSubmissionResourceIDs = new ArrayList<String>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(LOCAL_SUBMISSION);
- Query q;
- if ((fieldName.equals(LocalSubmissionConstants.RESOURCE_JOB_MANAGER_ID)) || (fieldName.equals(LocalSubmissionConstants.JOB_SUBMISSION_INTERFACE_ID))) {
- generator.setParameter(fieldName, value);
- q = generator.selectQuery(em);
- List<?> results = q.getResultList();
- for (Object result : results) {
- LocalSubmission localSubmission = (LocalSubmission) result;
- LocalSubmissionResource localSubmissionResource = (LocalSubmissionResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.LOCAL_SUBMISSION, localSubmission);
- localSubmissionResourceIDs.add(localSubmissionResource.getJobSubmissionInterfaceId());
- }
- } else {
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported field name for Local Submission Resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported field name for Local Submission Resource.");
- }
- 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();
- }
- }
- return localSubmissionResourceIDs;
- }
-
- @Override
- public void save() throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- LocalSubmission existingLocalSubmission = em.find(LocalSubmission.class, jobSubmissionInterfaceId);
- em.close();
- LocalSubmission localSubmission;
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- if (existingLocalSubmission == null) {
- localSubmission = new LocalSubmission();
- localSubmission.setCreationTime(AiravataUtils.getCurrentTimestamp());
- } else {
- localSubmission = existingLocalSubmission;
- localSubmission.setUpdateTime(AiravataUtils.getCurrentTimestamp());
- }
- localSubmission.setResourceJobManagerId(getResourceJobManagerId());
- ResourceJobManager resourceJobManager = em.find(ResourceJobManager.class, getResourceJobManagerId());
- localSubmission.setResourceJobManager(resourceJobManager);
- localSubmission.setJobSubmissionInterfaceId(getJobSubmissionInterfaceId());
- if (existingLocalSubmission == null) {
- em.persist(localSubmission);
- } else {
- em.merge(localSubmission);
- }
- 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 {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- LocalSubmission localSubmission = em.find(LocalSubmission.class, identifier);
- em.close();
- return localSubmission != null;
- } 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();
- }
- }
- }
-
- public String getResourceJobManagerId() {
- return resourceJobManagerId;
- }
-
- public ResourceJobManagerResource getResourceJobManagerResource() {
- return resourceJobManagerResource;
- }
-
- public String getJobSubmissionInterfaceId() {
- return jobSubmissionInterfaceId;
- }
-
- public void setResourceJobManagerId(String resourceJobManagerId) {
- this.resourceJobManagerId=resourceJobManagerId;
- }
-
- public void setResourceJobManagerResource(ResourceJobManagerResource resourceJobManagerResource) {
- this.resourceJobManagerResource=resourceJobManagerResource;
- }
-
- public void setJobSubmissionInterfaceId(String jobSubmissionInterfaceId) {
- this.jobSubmissionInterfaceId=jobSubmissionInterfaceId;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/ModuleLoadCmdResource.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/ModuleLoadCmdResource.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/ModuleLoadCmdResource.java
deleted file mode 100644
index 99faacf..0000000
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/ModuleLoadCmdResource.java
+++ /dev/null
@@ -1,300 +0,0 @@
-/*
- *
- * 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.aiaravata.application.catalog.data.resources;
-
-import org.airavata.appcatalog.cpi.AppCatalogException;
-import org.apache.aiaravata.application.catalog.data.model.ApplicationDeployment;
-import org.apache.aiaravata.application.catalog.data.model.ModuleLoadCmd;
-import org.apache.aiaravata.application.catalog.data.model.ModuleLoadCmd_PK;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogJPAUtils;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogQueryGenerator;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogResourceType;
-import org.apache.airavata.common.exception.ApplicationSettingsException;
-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 ModuleLoadCmdResource extends AbstractResource {
- private final static Logger logger = LoggerFactory.getLogger(ModuleLoadCmdResource.class);
- private String cmd;
- private String appDeploymentId;
- private AppDeploymentResource appDeploymentResource;
-
- @Override
- public void remove(Object identifier) throws AppCatalogException {
- HashMap<String, String> ids;
- if (identifier instanceof Map) {
- ids = (HashMap<String, String>) 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(MODULE_LOAD_CMD);
- generator.setParameter(ModuleLoadCmdConstants.APP_DEPLOYMENT_ID, ids.get(ModuleLoadCmdConstants.APP_DEPLOYMENT_ID));
- if (ids.get(ModuleLoadCmdConstants.CMD) != null){
- generator.setParameter(ModuleLoadCmdConstants.CMD, ids.get(ModuleLoadCmdConstants.CMD));
- }
- 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 Resource get(Object identifier) throws AppCatalogException {
- HashMap<String, String> ids;
- if (identifier instanceof Map) {
- ids = (HashMap<String, String>) 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(MODULE_LOAD_CMD);
- generator.setParameter(ModuleLoadCmdConstants.CMD, ids.get(ModuleLoadCmdConstants.CMD));
- generator.setParameter(ModuleLoadCmdConstants.APP_DEPLOYMENT_ID, ids.get(ModuleLoadCmdConstants.APP_DEPLOYMENT_ID));
- Query q = generator.selectQuery(em);
- ModuleLoadCmd moduleLoadCmd = (ModuleLoadCmd) q.getSingleResult();
- ModuleLoadCmdResource moduleLoadCmdResource = (ModuleLoadCmdResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.MODULE_LOAD_CMD, moduleLoadCmd);
- em.getTransaction().commit();
- em.close();
- return moduleLoadCmdResource;
- } 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<Resource> get(String fieldName, Object value) throws AppCatalogException {
- List<Resource> moduleLoadCmdResources = new ArrayList<Resource>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(MODULE_LOAD_CMD);
- Query q;
- if ((fieldName.equals(ModuleLoadCmdConstants.CMD)) || (fieldName.equals(ModuleLoadCmdConstants.APP_DEPLOYMENT_ID))) {
- generator.setParameter(fieldName, value);
- q = generator.selectQuery(em);
- List<?> results = q.getResultList();
- for (Object result : results) {
- ModuleLoadCmd moduleLoadCmd = (ModuleLoadCmd) result;
- ModuleLoadCmdResource moduleLoadCmdResource = (ModuleLoadCmdResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.MODULE_LOAD_CMD, moduleLoadCmd);
- moduleLoadCmdResources.add(moduleLoadCmdResource);
- }
- } else {
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported field name for Module Load Cmd Resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported field name for Module Load Cmd Resource.");
- }
- 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();
- }
- }
- return moduleLoadCmdResources;
- }
-
- @Override
- public List<Resource> 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 {
- List<String> moduleLoadCmdResourceIDs = new ArrayList<String>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(MODULE_LOAD_CMD);
- Query q;
- if ((fieldName.equals(ModuleLoadCmdConstants.CMD)) || (fieldName.equals(ModuleLoadCmdConstants.APP_DEPLOYMENT_ID))) {
- generator.setParameter(fieldName, value);
- q = generator.selectQuery(em);
- List<?> results = q.getResultList();
- for (Object result : results) {
- ModuleLoadCmd moduleLoadCmd = (ModuleLoadCmd) result;
- ModuleLoadCmdResource moduleLoadCmdResource = (ModuleLoadCmdResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.MODULE_LOAD_CMD, moduleLoadCmd);
- moduleLoadCmdResourceIDs.add(moduleLoadCmdResource.getAppDeploymentId());
- }
- } else {
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported field name for Module Load Cmd Resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported field name for Module Load Cmd Resource.");
- }
- 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();
- }
- }
- return moduleLoadCmdResourceIDs;
- }
-
- @Override
- public void save() throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- ModuleLoadCmd existingModuleLoadCmd = em.find(ModuleLoadCmd.class, new ModuleLoadCmd_PK(cmd, appDeploymentId));
- em.close();
- ModuleLoadCmd moduleLoadCmd;
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- if (existingModuleLoadCmd == null) {
- moduleLoadCmd = new ModuleLoadCmd();
- } else {
- moduleLoadCmd = existingModuleLoadCmd;
- }
- moduleLoadCmd.setCmd(getCmd());
- moduleLoadCmd.setAppDeploymentId(getAppDeploymentId());
- ApplicationDeployment applicationDeployment = em.find(ApplicationDeployment.class, getAppDeploymentId());
- moduleLoadCmd.setApplicationDeployment(applicationDeployment);
- if (existingModuleLoadCmd == null) {
- em.persist(moduleLoadCmd);
- } else {
- em.merge(moduleLoadCmd);
- }
- 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<String, String>) 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();
- ModuleLoadCmd moduleLoadCmd = em.find(ModuleLoadCmd.class, new ModuleLoadCmd_PK(ids.get(ModuleLoadCmdConstants.CMD), ids.get(ModuleLoadCmdConstants.APP_DEPLOYMENT_ID)));
- em.close();
- return moduleLoadCmd != null;
- } 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();
- }
- }
- }
-
- public String getCmd() {
- return cmd;
- }
-
- public String getAppDeploymentId() {
- return appDeploymentId;
- }
-
- public AppDeploymentResource getAppDeploymentResource() {
- return appDeploymentResource;
- }
-
- public void setCmd(String cmd) {
- this.cmd=cmd;
- }
-
- public void setAppDeploymentId(String appDeploymentId) {
- this.appDeploymentId=appDeploymentId;
- }
-
- public void setAppDeploymentResource(AppDeploymentResource appDeploymentResource) {
- this.appDeploymentResource=appDeploymentResource;
- }
-}
-
-
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/PostJobCommandResource.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/PostJobCommandResource.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/PostJobCommandResource.java
deleted file mode 100644
index 7cde166..0000000
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/PostJobCommandResource.java
+++ /dev/null
@@ -1,333 +0,0 @@
-/**
- * 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.aiaravata.application.catalog.data.resources;
-
-import org.airavata.appcatalog.cpi.AppCatalogException;
-import org.apache.aiaravata.application.catalog.data.model.ApplicationDeployment;
-import org.apache.aiaravata.application.catalog.data.model.PostJobCommand;
-import org.apache.aiaravata.application.catalog.data.model.PostJobCommandPK;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogJPAUtils;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogQueryGenerator;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogResourceType;
-import org.apache.airavata.common.exception.ApplicationSettingsException;
-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 PostJobCommandResource extends AbstractResource {
- private final static Logger logger = LoggerFactory.getLogger(PostJobCommandResource.class);
-
- private String appDeploymentId;
- private String command;
-
- private AppDeploymentResource appDeploymentResource;
-
-
- 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(POST_JOBCOMMAND);
- generator.setParameter(PostJobCommandConstants.DEPLOYMENT_ID,
- ids.get(PostJobCommandConstants.DEPLOYMENT_ID));
- if (ids.get(PostJobCommandConstants.COMMAND) != null){
- generator.setParameter(PostJobCommandConstants.COMMAND, ids.get(PostJobCommandConstants.COMMAND));
- }
- 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();
- }
- }
- }
-
- public Resource 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(POST_JOBCOMMAND);
- generator.setParameter(PostJobCommandConstants.DEPLOYMENT_ID,
- ids.get(PostJobCommandConstants.DEPLOYMENT_ID));
- generator.setParameter(PostJobCommandConstants.COMMAND, ids.get(PostJobCommandConstants.COMMAND));
- Query q = generator.selectQuery(em);
- PostJobCommand postJobCommand = (PostJobCommand) q.getSingleResult();
- PostJobCommandResource postJobCommandResource =
- (PostJobCommandResource) AppCatalogJPAUtils.getResource(
- AppCatalogResourceType.POST_JOBCOMMAND, postJobCommand);
- em.getTransaction().commit();
- em.close();
- return postJobCommandResource;
- } 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();
- }
- }
- }
-
- public List<Resource> get(String fieldName, Object value) throws AppCatalogException {
- List<Resource> gsiSSHPostJobCommandResources = new ArrayList<Resource>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- Query q;
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(POST_JOBCOMMAND);
- List results;
- if (fieldName.equals(PostJobCommandConstants.DEPLOYMENT_ID)) {
- generator.setParameter(PostJobCommandConstants.DEPLOYMENT_ID, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- PostJobCommand postJobCommand = (PostJobCommand) result;
- PostJobCommandResource postJobCommandResource =
- (PostJobCommandResource) AppCatalogJPAUtils.getResource(
- AppCatalogResourceType.POST_JOBCOMMAND, postJobCommand);
- gsiSSHPostJobCommandResources.add(postJobCommandResource);
- }
- }
- } else if (fieldName.equals(PostJobCommandConstants.COMMAND)) {
- generator.setParameter(PostJobCommandConstants.COMMAND, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- PostJobCommand postJobCommand = (PostJobCommand) result;
- PostJobCommandResource postJobCommandResource =
- (PostJobCommandResource) AppCatalogJPAUtils.getResource(
- AppCatalogResourceType.POST_JOBCOMMAND, postJobCommand);
- gsiSSHPostJobCommandResources.add(postJobCommandResource);
- }
- }
- } else {
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported field name for GSISSH Post Job Command Resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported field name for GSISSH Post Job Command 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 gsiSSHPostJobCommandResources;
- }
-
- @Override
- public List<Resource> getAll() throws AppCatalogException {
- return null;
- }
-
- @Override
- public List<String> getAllIds() throws AppCatalogException {
- return null;
- }
-
- public List<String> getIds(String fieldName, Object value) throws AppCatalogException {
- List<String> gsiSSHPostJobResourceIDs = new ArrayList<String>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- Query q;
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(POST_JOBCOMMAND);
- List results;
- if (fieldName.equals(PostJobCommandConstants.DEPLOYMENT_ID)) {
- generator.setParameter(PostJobCommandConstants.DEPLOYMENT_ID, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- PostJobCommand postJobCommand = (PostJobCommand) result;
- gsiSSHPostJobResourceIDs.add(postJobCommand.getDeploymentId());
- }
- }
- } else if (fieldName.equals(PostJobCommandConstants.COMMAND)) {
- generator.setParameter(PostJobCommandConstants.COMMAND, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- PostJobCommand postJobCommand = (PostJobCommand) result;
- gsiSSHPostJobResourceIDs.add(postJobCommand.getDeploymentId());
- }
- }
- } else {
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported field name for GSISSH Post Job resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported field name for GSISSH Post JOb 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 gsiSSHPostJobResourceIDs;
- }
-
- public void save() throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- PostJobCommand existingPostJobCommand = em.find(PostJobCommand.class,
- new PostJobCommandPK(appDeploymentId, command));
- em.close();
-
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- ApplicationDeployment deployment = em.find(ApplicationDeployment.class, appDeploymentId);
- if (existingPostJobCommand != null){
- existingPostJobCommand.setDeploymentId(appDeploymentId);
- existingPostJobCommand.setCommand(command);
- existingPostJobCommand.setDeployment(deployment);
- em.merge(existingPostJobCommand);
- }else {
- PostJobCommand postJobCommand = new PostJobCommand();
- postJobCommand.setDeploymentId(appDeploymentId);
- postJobCommand.setCommand(command);
- postJobCommand.setDeployment(deployment);
- em.persist(postJobCommand);
- }
- 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();
- }
- }
- }
-
- 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();
- PostJobCommand postJobCommand = em.find(PostJobCommand.class, new PostJobCommandPK(
- ids.get(PostJobCommandConstants.DEPLOYMENT_ID),
- ids.get(PostJobCommandConstants.COMMAND)));
-
- em.close();
- return postJobCommand != null;
- } 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();
- }
- }
- }
-
- public String getAppDeploymentId() {
- return appDeploymentId;
- }
-
- public void setAppDeploymentId(String appDeploymentId) {
- this.appDeploymentId = appDeploymentId;
- }
-
- public String getCommand() {
- return command;
- }
-
- public void setCommand(String command) {
- this.command = command;
- }
-
- public AppDeploymentResource getAppDeploymentResource() {
- return appDeploymentResource;
- }
-
- public void setAppDeploymentResource(AppDeploymentResource appDeploymentResource) {
- this.appDeploymentResource = appDeploymentResource;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/PreJobCommandResource.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/PreJobCommandResource.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/PreJobCommandResource.java
deleted file mode 100644
index 09a8fa1..0000000
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/PreJobCommandResource.java
+++ /dev/null
@@ -1,333 +0,0 @@
-/**
- * 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.aiaravata.application.catalog.data.resources;
-
-import org.airavata.appcatalog.cpi.AppCatalogException;
-import org.apache.aiaravata.application.catalog.data.model.ApplicationDeployment;
-import org.apache.aiaravata.application.catalog.data.model.PreJobCommand;
-import org.apache.aiaravata.application.catalog.data.model.PreJobCommandPK;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogJPAUtils;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogQueryGenerator;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogResourceType;
-import org.apache.airavata.common.exception.ApplicationSettingsException;
-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 PreJobCommandResource extends AbstractResource {
- private final static Logger logger = LoggerFactory.getLogger(PreJobCommandResource.class);
-
- private String appDeploymentId;
- private String command;
-
- private AppDeploymentResource appDeploymentResource;
-
-
- 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(PRE_JOBCOMMAND);
- generator.setParameter(PreJobCommandConstants.DEPLOYMENT_ID,
- ids.get(PreJobCommandConstants.DEPLOYMENT_ID));
- if (ids.get(PreJobCommandConstants.COMMAND) != null){
- generator.setParameter(PreJobCommandConstants.COMMAND, ids.get(PreJobCommandConstants.COMMAND));
- }
- 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();
- }
- }
- }
-
- public Resource 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(PRE_JOBCOMMAND);
- generator.setParameter(PreJobCommandConstants.DEPLOYMENT_ID,
- ids.get(PreJobCommandConstants.DEPLOYMENT_ID));
- generator.setParameter(PreJobCommandConstants.COMMAND, ids.get(PreJobCommandConstants.COMMAND));
- Query q = generator.selectQuery(em);
- PreJobCommand preJobCommand = (PreJobCommand) q.getSingleResult();
- PreJobCommandResource preJobCommandResource =
- (PreJobCommandResource) AppCatalogJPAUtils.getResource(
- AppCatalogResourceType.PRE_JOBCOMMAND, preJobCommand);
- em.getTransaction().commit();
- em.close();
- return preJobCommandResource;
- } 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();
- }
- }
- }
-
- public List<Resource> get(String fieldName, Object value) throws AppCatalogException {
- List<Resource> gsiSSHPreJobResources = new ArrayList<Resource>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- Query q;
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(PRE_JOBCOMMAND);
- List results;
- if (fieldName.equals(PreJobCommandConstants.DEPLOYMENT_ID)) {
- generator.setParameter(PreJobCommandConstants.DEPLOYMENT_ID, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- PreJobCommand preJobCommand = (PreJobCommand) result;
- PreJobCommandResource preJobCommandResource =
- (PreJobCommandResource) AppCatalogJPAUtils.getResource(
- AppCatalogResourceType.PRE_JOBCOMMAND, preJobCommand);
- gsiSSHPreJobResources.add(preJobCommandResource);
- }
- }
- } else if (fieldName.equals(PreJobCommandConstants.COMMAND)) {
- generator.setParameter(PreJobCommandConstants.COMMAND, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- PreJobCommand preJobCommand = (PreJobCommand) result;
- PreJobCommandResource preJobCommandResource =
- (PreJobCommandResource) AppCatalogJPAUtils.getResource(
- AppCatalogResourceType.PRE_JOBCOMMAND, preJobCommand);
- gsiSSHPreJobResources.add(preJobCommandResource);
- }
- }
- } else {
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported field name for GSISSH Pre Job Command Resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported field name for GSISSH Pre Job Command 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 gsiSSHPreJobResources;
- }
-
- @Override
- public List<Resource> getAll() throws AppCatalogException {
- return null;
- }
-
- @Override
- public List<String> getAllIds() throws AppCatalogException {
- return null;
- }
-
- public List<String> getIds(String fieldName, Object value) throws AppCatalogException {
- List<String> gsiSSHPreJobResourceIDs = new ArrayList<String>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- Query q;
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(PRE_JOBCOMMAND);
- List results;
- if (fieldName.equals(PreJobCommandConstants.DEPLOYMENT_ID)) {
- generator.setParameter(PreJobCommandConstants.DEPLOYMENT_ID, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- PreJobCommand preJobCommand = (PreJobCommand) result;
- gsiSSHPreJobResourceIDs.add(preJobCommand.getDeploymentId());
- }
- }
- } else if (fieldName.equals(PreJobCommandConstants.COMMAND)) {
- generator.setParameter(PreJobCommandConstants.COMMAND, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- PreJobCommand preJobCommand = (PreJobCommand) result;
- gsiSSHPreJobResourceIDs.add(preJobCommand.getDeploymentId());
- }
- }
- } else {
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported field name for GSISSH Pre Job resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported field name for GSISSH Pre JOb 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 gsiSSHPreJobResourceIDs;
- }
-
- public void save() throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- PreJobCommand existingGSIsshPreJobCommand = em.find(PreJobCommand.class,
- new PreJobCommandPK(appDeploymentId, command));
- em.close();
-
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- ApplicationDeployment deployment = em.find(ApplicationDeployment.class, appDeploymentId);
- if (existingGSIsshPreJobCommand != null){
- existingGSIsshPreJobCommand.setDeploymentId(appDeploymentId);
- existingGSIsshPreJobCommand.setCommand(command);
- existingGSIsshPreJobCommand.setApplicationDeployment(deployment);
- em.merge(existingGSIsshPreJobCommand);
- }else {
- PreJobCommand preJobCommand = new PreJobCommand();
- preJobCommand.setDeploymentId(appDeploymentId);
- preJobCommand.setCommand(command);
- preJobCommand.setApplicationDeployment(deployment);
- em.persist(preJobCommand);
- }
- 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();
- }
- }
- }
-
- 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();
- PreJobCommand preJobCommand = em.find(PreJobCommand.class, new PreJobCommandPK(
- ids.get(PreJobCommandConstants.DEPLOYMENT_ID),
- ids.get(PreJobCommandConstants.COMMAND)));
-
- em.close();
- return preJobCommand != null;
- } 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();
- }
- }
- }
-
- public String getAppDeploymentId() {
- return appDeploymentId;
- }
-
- public void setAppDeploymentId(String appDeploymentId) {
- this.appDeploymentId = appDeploymentId;
- }
-
- public String getCommand() {
- return command;
- }
-
- public void setCommand(String command) {
- this.command = command;
- }
-
- public AppDeploymentResource getAppDeploymentResource() {
- return appDeploymentResource;
- }
-
- public void setAppDeploymentResource(AppDeploymentResource appDeploymentResource) {
- this.appDeploymentResource = appDeploymentResource;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/Resource.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/Resource.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/Resource.java
deleted file mode 100644
index d4ad2fd..0000000
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/Resource.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
-*
-* 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.aiaravata.application.catalog.data.resources;
-
-import org.airavata.appcatalog.cpi.AppCatalogException;
-
-import java.util.List;
-
-public interface Resource {
-
- /**
- * This method will remove the given resource from the database
- *
- * @param identifier identifier that can uniquely identify a single instance of the resource
- */
- void remove(Object identifier) throws AppCatalogException;
-
- /**
- * This method will return the given resource from the database
- *
- * @param identifier identifier that can uniquely identify a single instance of the resource
- * @return associate resource
- */
- Resource get(Object identifier) throws AppCatalogException;
-
- /**
- * This method will list all the resources according to the filtering criteria
- * @param fieldName field name
- * @param value value of the field
- * @return list of resources
- */
- List<Resource> get(String fieldName, Object value) throws AppCatalogException;
-
- /**
- *
- * @return
- * @throws AppCatalogException
- */
- List<Resource> getAll() throws AppCatalogException;
-
- /**
- *
- * @return
- * @throws AppCatalogException
- */
- List<String> getAllIds() throws AppCatalogException;
-
- /** This method will return list of resource ids according to given criteria
- * @param fieldName field name
- * @param value value of the field
- * @return list of resource Ids
- * @throws AppCatalogException
- */
- List<String> getIds(String fieldName, Object value) throws AppCatalogException;
-
- /**
- * This method will save the resource to the database.
- */
- void save() throws AppCatalogException;
-
- /**
- * This method will check whether an entry from the given resource and resource name
- * exists in the database
- *
- * @param identifier identifier that can uniquely identify a single instance of the resource
- * @return whether the entry exists in the database or not
- */
- boolean isExists(Object identifier) throws AppCatalogException;
-
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/ResourceJobManagerResource.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/ResourceJobManagerResource.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/ResourceJobManagerResource.java
deleted file mode 100644
index 0cc5a18..0000000
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/ResourceJobManagerResource.java
+++ /dev/null
@@ -1,301 +0,0 @@
-/*
- *
- * 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.aiaravata.application.catalog.data.resources;
-
-import java.sql.Timestamp;
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.persistence.EntityManager;
-import javax.persistence.Query;
-
-import org.airavata.appcatalog.cpi.AppCatalogException;
-import org.apache.aiaravata.application.catalog.data.model.ResourceJobManager;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogJPAUtils;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogQueryGenerator;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogResourceType;
-import org.apache.airavata.common.exception.ApplicationSettingsException;
-import org.apache.airavata.common.utils.AiravataUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class ResourceJobManagerResource extends AbstractResource {
- private final static Logger logger = LoggerFactory.getLogger(ResourceJobManagerResource.class);
- private String resourceJobManagerId;
- private String pushMonitoringEndpoint;
- private String jobManagerBinPath;
- private String resourceJobManagerType;
- private Timestamp createdTime;
- private Timestamp updatedTime;
-
- public Timestamp getCreatedTime() {
- return createdTime;
- }
-
- public void setCreatedTime(Timestamp createdTime) {
- this.createdTime = createdTime;
- }
-
- public Timestamp getUpdatedTime() {
- return updatedTime;
- }
-
- public void setUpdatedTime(Timestamp updatedTime) {
- this.updatedTime = updatedTime;
- }
-
- @Override
- public void remove(Object identifier) throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(RESOURCE_JOB_MANAGER);
- generator.setParameter(ResourceJobManagerConstants.RESOURCE_JOB_MANAGER_ID, identifier);
- 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 Resource get(Object identifier) throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(RESOURCE_JOB_MANAGER);
- generator.setParameter(ResourceJobManagerConstants.RESOURCE_JOB_MANAGER_ID, identifier);
- Query q = generator.selectQuery(em);
- ResourceJobManager resourceJobManager = (ResourceJobManager) q.getSingleResult();
- ResourceJobManagerResource resourceJobManagerResource = (ResourceJobManagerResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.RESOURCE_JOB_MANAGER, resourceJobManager);
- em.getTransaction().commit();
- em.close();
- return resourceJobManagerResource;
- } 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<Resource> get(String fieldName, Object value) throws AppCatalogException {
- List<Resource> resourceJobManagerResources = new ArrayList<Resource>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(RESOURCE_JOB_MANAGER);
- Query q;
- if ((fieldName.equals(ResourceJobManagerConstants.RESOURCE_JOB_MANAGER_ID)) || (fieldName.equals(ResourceJobManagerConstants.PUSH_MONITORING_ENDPOINT)) || (fieldName.equals(ResourceJobManagerConstants.JOB_MANAGER_BIN_PATH)) || (fieldName.equals(ResourceJobManagerConstants.RESOURCE_JOB_MANAGER_TYPE))) {
- generator.setParameter(fieldName, value);
- q = generator.selectQuery(em);
- List<?> results = q.getResultList();
- for (Object result : results) {
- ResourceJobManager resourceJobManager = (ResourceJobManager) result;
- ResourceJobManagerResource resourceJobManagerResource = (ResourceJobManagerResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.RESOURCE_JOB_MANAGER, resourceJobManager);
- resourceJobManagerResources.add(resourceJobManagerResource);
- }
- } else {
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported field name for Resource Job Manager Resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported field name for Resource Job Manager Resource.");
- }
- 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();
- }
- }
- return resourceJobManagerResources;
- }
-
- @Override
- public List<Resource> 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 {
- List<String> resourceJobManagerResourceIDs = new ArrayList<String>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(RESOURCE_JOB_MANAGER);
- Query q;
- if ((fieldName.equals(ResourceJobManagerConstants.RESOURCE_JOB_MANAGER_ID)) || (fieldName.equals(ResourceJobManagerConstants.PUSH_MONITORING_ENDPOINT)) || (fieldName.equals(ResourceJobManagerConstants.JOB_MANAGER_BIN_PATH)) || (fieldName.equals(ResourceJobManagerConstants.RESOURCE_JOB_MANAGER_TYPE))) {
- generator.setParameter(fieldName, value);
- q = generator.selectQuery(em);
- List<?> results = q.getResultList();
- for (Object result : results) {
- ResourceJobManager resourceJobManager = (ResourceJobManager) result;
- ResourceJobManagerResource resourceJobManagerResource = (ResourceJobManagerResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.RESOURCE_JOB_MANAGER, resourceJobManager);
- resourceJobManagerResourceIDs.add(resourceJobManagerResource.getResourceJobManagerId());
- }
- } else {
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported field name for Resource Job Manager Resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported field name for Resource Job Manager Resource.");
- }
- 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();
- }
- }
- return resourceJobManagerResourceIDs;
- }
-
- @Override
- public void save() throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- ResourceJobManager existingResourceJobManager = em.find(ResourceJobManager.class, resourceJobManagerId);
- em.close();
- ResourceJobManager resourceJobManager;
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- if (existingResourceJobManager == null) {
- resourceJobManager = new ResourceJobManager();
- resourceJobManager.setCreationTime(AiravataUtils.getCurrentTimestamp());
- } else {
- resourceJobManager = existingResourceJobManager;
- resourceJobManager.setUpdateTime(AiravataUtils.getCurrentTimestamp());
- }
- resourceJobManager.setResourceJobManagerId(getResourceJobManagerId());
- resourceJobManager.setPushMonitoringEndpoint(getPushMonitoringEndpoint());
- resourceJobManager.setJobManagerBinPath(getJobManagerBinPath());
- resourceJobManager.setResourceJobManagerType(getResourceJobManagerType());
- if (existingResourceJobManager == null) {
- em.persist(resourceJobManager);
- } else {
- em.merge(resourceJobManager);
- }
- 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 {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- ResourceJobManager resourceJobManager = em.find(ResourceJobManager.class, identifier);
- em.close();
- return resourceJobManager != null;
- } 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();
- }
- }
- }
-
- public String getResourceJobManagerId() {
- return resourceJobManagerId;
- }
-
- public String getPushMonitoringEndpoint() {
- return pushMonitoringEndpoint;
- }
-
- public String getJobManagerBinPath() {
- return jobManagerBinPath;
- }
-
- public String getResourceJobManagerType() {
- return resourceJobManagerType;
- }
-
- public void setResourceJobManagerId(String resourceJobManagerId) {
- this.resourceJobManagerId=resourceJobManagerId;
- }
-
- public void setPushMonitoringEndpoint(String pushMonitoringEndpoint) {
- this.pushMonitoringEndpoint=pushMonitoringEndpoint;
- }
-
- public void setJobManagerBinPath(String jobManagerBinPath) {
- this.jobManagerBinPath=jobManagerBinPath;
- }
-
- public void setResourceJobManagerType(String resourceJobManagerType) {
- this.resourceJobManagerType=resourceJobManagerType;
- }
-}
[50/52] [abbrv] [partial] airavata git commit: registry refactoring
Posted by sh...@apache.org.
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/listener/AiravataExperimentStatusUpdator.java
----------------------------------------------------------------------
diff --git a/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/listener/AiravataExperimentStatusUpdator.java b/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/listener/AiravataExperimentStatusUpdator.java
index f59179e..5f25f8a 100644
--- a/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/listener/AiravataExperimentStatusUpdator.java
+++ b/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/listener/AiravataExperimentStatusUpdator.java
@@ -38,8 +38,8 @@ import org.apache.airavata.model.messaging.event.WorkflowNodeStatusChangeEvent;
import org.apache.airavata.model.util.ExecutionType;
import org.apache.airavata.model.workspace.experiment.Experiment;
import org.apache.airavata.model.workspace.experiment.ExperimentState;
-import org.apache.airavata.registry.cpi.Registry;
-import org.apache.airavata.registry.cpi.RegistryModelType;
+import org.apache.airavata.registry.cpi.ExperimentCatalog;
+import org.apache.airavata.registry.cpi.ExperimentCatalogModelType;
import org.apache.curator.framework.CuratorFramework;
import org.apache.curator.utils.ZKPaths;
import org.slf4j.Logger;
@@ -50,18 +50,18 @@ import java.util.Calendar;
public class AiravataExperimentStatusUpdator implements AbstractActivityListener {
private final static Logger logger = LoggerFactory.getLogger(AiravataExperimentStatusUpdator.class);
- private Registry airavataRegistry;
+ private ExperimentCatalog airavataExperimentCatalog;
private MonitorPublisher monitorPublisher;
private Publisher publisher;
private CuratorFramework curatorClient;
private RabbitMQTaskLaunchConsumer consumer;
- public Registry getAiravataRegistry() {
- return airavataRegistry;
+ public ExperimentCatalog getAiravataExperimentCatalog() {
+ return airavataExperimentCatalog;
}
- public void setAiravataRegistry(Registry airavataRegistry) {
- this.airavataRegistry = airavataRegistry;
+ public void setAiravataExperimentCatalog(ExperimentCatalog airavataExperimentCatalog) {
+ this.airavataExperimentCatalog = airavataExperimentCatalog;
}
@Subscribe
@@ -69,7 +69,7 @@ public class AiravataExperimentStatusUpdator implements AbstractActivityListener
try {
boolean updateExperimentStatus=true;
boolean clean= false;
- ExecutionType executionType = DataModelUtils.getExecutionType((Experiment) airavataRegistry.get(RegistryModelType.EXPERIMENT, nodeStatus.getWorkflowNodeIdentity().getExperimentId()));
+ ExecutionType executionType = DataModelUtils.getExecutionType((Experiment) airavataExperimentCatalog.get(ExperimentCatalogModelType.EXPERIMENT, nodeStatus.getWorkflowNodeIdentity().getExperimentId()));
String experimentNode = ServerSettings.getSetting(Constants.ZOOKEEPER_GFAC_EXPERIMENT_NODE, "/gfac-experiments");
String experimentPath = experimentNode + File.separator + ServerSettings.getSetting(Constants.ZOOKEEPER_GFAC_SERVER_NAME)
+ File.separator + nodeStatus.getWorkflowNodeIdentity().getExperimentId();
@@ -183,7 +183,7 @@ public class AiravataExperimentStatusUpdator implements AbstractActivityListener
}
public ExperimentState updateExperimentStatus(String experimentId, ExperimentState state) throws Exception {
- Experiment details = (Experiment)airavataRegistry.get(RegistryModelType.EXPERIMENT, experimentId);
+ Experiment details = (Experiment) airavataExperimentCatalog.get(ExperimentCatalogModelType.EXPERIMENT, experimentId);
if(details == null) {
details = new Experiment();
details.setExperimentID(experimentId);
@@ -194,15 +194,15 @@ public class AiravataExperimentStatusUpdator implements AbstractActivityListener
status.setExperimentState(state);
details.setExperimentStatus(status);
logger.info("Updating the experiment status of experiment: " + experimentId + " to " + status.getExperimentState().toString());
- airavataRegistry.update(RegistryModelType.EXPERIMENT_STATUS, status, experimentId);
+ airavataExperimentCatalog.update(ExperimentCatalogModelType.EXPERIMENT_STATUS, status, experimentId);
return details.getExperimentStatus().getExperimentState();
}
public void setup(Object... configurations) {
for (Object configuration : configurations) {
- if (configuration instanceof Registry){
- this.airavataRegistry=(Registry)configuration;
+ if (configuration instanceof ExperimentCatalog){
+ this.airavataExperimentCatalog =(ExperimentCatalog)configuration;
} else if (configuration instanceof MonitorPublisher){
this.monitorPublisher=(MonitorPublisher) configuration;
} else if (configuration instanceof Publisher){
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/util/DataModelUtils.java
----------------------------------------------------------------------
diff --git a/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/util/DataModelUtils.java b/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/util/DataModelUtils.java
index 8af8956..8ca5c8c 100644
--- a/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/util/DataModelUtils.java
+++ b/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/util/DataModelUtils.java
@@ -21,8 +21,8 @@
package org.apache.airavata.api.server.util;
-import org.airavata.appcatalog.cpi.AppCatalogException;
-import org.airavata.appcatalog.cpi.ApplicationInterface;
+import org.apache.airavata.registry.cpi.AppCatalogException;
+import org.apache.airavata.registry.cpi.ApplicationInterface;
import org.apache.aiaravata.application.catalog.data.impl.AppCatalogFactory;
import org.apache.airavata.common.utils.ServerSettings;
import org.apache.airavata.model.util.ExecutionType;
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/util/DatabaseCreator.java
----------------------------------------------------------------------
diff --git a/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/util/DatabaseCreator.java b/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/util/DatabaseCreator.java
index 0d857ba..3a62688 100644
--- a/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/util/DatabaseCreator.java
+++ b/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/util/DatabaseCreator.java
@@ -266,10 +266,10 @@ public class DatabaseCreator {
DatabaseType databaseType = DatabaseCreator.getDatabaseType(conn);
if(databaseType.equals(DatabaseType.derby)){
is = Thread.currentThread().getContextClassLoader()
- .getResourceAsStream("registry-derby.sql");
+ .getResourceAsStream("registry-core/src/main/resources/registry-derby.sql");
}else if(databaseType.equals(DatabaseType.derby)){
is = Thread.currentThread().getContextClassLoader()
- .getResourceAsStream("registry-mysql.sql");
+ .getResourceAsStream("registry-core/src/main/resources/registry-mysql.sql");
}
}
reader = new BufferedReader(new InputStreamReader(is));
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/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 d7c100b..438bc6a 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
@@ -29,12 +29,12 @@ import java.sql.SQLException;
import org.apache.airavata.common.exception.ApplicationSettingsException;
import org.apache.airavata.common.utils.ServerSettings;
-import org.apache.airavata.experiment.catalog.ResourceType;
-import org.apache.airavata.experiment.catalog.ResourceUtils;
-import org.apache.airavata.experiment.catalog.resources.GatewayResource;
-import org.apache.airavata.experiment.catalog.resources.ProjectResource;
-import org.apache.airavata.experiment.catalog.resources.UserResource;
-import org.apache.airavata.experiment.catalog.resources.WorkerResource;
+import org.apache.airavata.registry.core.experiment.catalog.ResourceType;
+import org.apache.airavata.registry.core.experiment.catalog.ResourceUtils;
+import org.apache.airavata.registry.core.experiment.catalog.resources.GatewayResource;
+import org.apache.airavata.registry.core.experiment.catalog.resources.ProjectResource;
+import org.apache.airavata.registry.core.experiment.catalog.resources.UserResource;
+import org.apache.airavata.registry.core.experiment.catalog.resources.WorkerResource;
import org.apache.derby.drda.NetworkServerControl;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/samples/CreateLaunchExperiment.java
----------------------------------------------------------------------
diff --git a/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/samples/CreateLaunchExperiment.java b/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/samples/CreateLaunchExperiment.java
index 5809122..dd7856e 100644
--- a/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/samples/CreateLaunchExperiment.java
+++ b/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/samples/CreateLaunchExperiment.java
@@ -83,7 +83,7 @@ public class CreateLaunchExperiment {
airavataClient = AiravataClientFactory.createAiravataClient(THRIFT_SERVER_HOST, THRIFT_SERVER_PORT);
AuthzToken token = new AuthzToken("empty_token");
System.out.println("API version is " + airavataClient.getAPIVersion(token));
-// registerApplications(); // run this only the first time
+ registerApplications(); // run this only the first time
createAndLaunchExp();
}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/app-catalog/app-catalog-cpi/src/main/java/org/airavata/appcatalog/cpi/AppCatalog.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-cpi/src/main/java/org/airavata/appcatalog/cpi/AppCatalog.java b/modules/app-catalog/app-catalog-cpi/src/main/java/org/airavata/appcatalog/cpi/AppCatalog.java
deleted file mode 100644
index 8ae92c9..0000000
--- a/modules/app-catalog/app-catalog-cpi/src/main/java/org/airavata/appcatalog/cpi/AppCatalog.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/**
- * 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.airavata.appcatalog.cpi;
-
-public interface AppCatalog {
- /**
- * Get ComputeResource interface
- * @return ComputeResource interface
- */
- ComputeResource getComputeResource() throws AppCatalogException;
-
- /**
- * Get application interface
- * @return application interface
- */
- ApplicationInterface getApplicationInterface() throws AppCatalogException;
-
- /**
- * Get application deployment interface
- * @return application deployment interface
- */
- ApplicationDeployment getApplicationDeployment() throws AppCatalogException;
-
- /**
- * Get Gateway profile interface
- * @return Gateway profile interface
- * @throws AppCatalogException
- */
- GwyResourceProfile getGatewayProfile() throws AppCatalogException;
-
- /**
- * Get workflow catalog interface
- * @return workflow catalog interface
- * @throws AppCatalogException
- */
- WorkflowCatalog getWorkflowCatalog() throws AppCatalogException;
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/app-catalog/app-catalog-cpi/src/main/java/org/airavata/appcatalog/cpi/AppCatalogException.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-cpi/src/main/java/org/airavata/appcatalog/cpi/AppCatalogException.java b/modules/app-catalog/app-catalog-cpi/src/main/java/org/airavata/appcatalog/cpi/AppCatalogException.java
deleted file mode 100644
index c1a3c9b..0000000
--- a/modules/app-catalog/app-catalog-cpi/src/main/java/org/airavata/appcatalog/cpi/AppCatalogException.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/**
- * 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.airavata.appcatalog.cpi;
-
-public class AppCatalogException extends Exception{
- private static final long serialVersionUID = -2849422320139467602L;
-
- public AppCatalogException(Throwable e) {
- super(e);
- }
-
- public AppCatalogException(String message) {
- super(message, null);
- }
-
- public AppCatalogException(String message, Throwable e) {
- super(message, e);
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/app-catalog/app-catalog-cpi/src/main/java/org/airavata/appcatalog/cpi/ApplicationDeployment.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-cpi/src/main/java/org/airavata/appcatalog/cpi/ApplicationDeployment.java b/modules/app-catalog/app-catalog-cpi/src/main/java/org/airavata/appcatalog/cpi/ApplicationDeployment.java
deleted file mode 100644
index b3dfcba..0000000
--- a/modules/app-catalog/app-catalog-cpi/src/main/java/org/airavata/appcatalog/cpi/ApplicationDeployment.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/**
- * 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.airavata.appcatalog.cpi;
-
-import org.apache.airavata.model.appcatalog.appdeployment.ApplicationDeploymentDescription;
-
-import java.util.List;
-import java.util.Map;
-
-public interface ApplicationDeployment {
- /**
- * Add application deployment
- * @param deploymentDescription application deployment
- * @return unique id for application deployment
- */
- String addApplicationDeployment (ApplicationDeploymentDescription deploymentDescription, String gatewayId) throws AppCatalogException;
-
- /**
- * This method will update application deployment
- * @param deploymentId unique deployment id
- * @param updatedDeployment updated deployment
- */
- void updateApplicationDeployment (String deploymentId, ApplicationDeploymentDescription updatedDeployment) throws AppCatalogException;;
-
- /**
- * This method will retrive application deployement
- * @param deploymentId unique deployment id
- * @return application deployment
- */
- ApplicationDeploymentDescription getApplicationDeployement (String deploymentId) throws AppCatalogException;
-
- /**
- * This method will return a list of application deployments according to given search criteria
- * @param filters map should be provided as the field name and it's value
- * @return list of application deployments
- */
- List<ApplicationDeploymentDescription> getApplicationDeployements (Map<String, String> filters) throws AppCatalogException;
-
- List<ApplicationDeploymentDescription> getAllApplicationDeployements (String gatewayId) throws AppCatalogException;
-
- List<String> getAllApplicationDeployementIds () throws AppCatalogException;
-
- /**
- * Check whether application deployment exists
- * @param deploymentId unique deployment id
- * @return true or false
- */
- boolean isAppDeploymentExists (String deploymentId) throws AppCatalogException;
-
- /**
- * Remove application deployment
- * @param deploymentId unique deployment id
- */
- void removeAppDeployment (String deploymentId) throws AppCatalogException;
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/app-catalog/app-catalog-cpi/src/main/java/org/airavata/appcatalog/cpi/ApplicationInterface.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-cpi/src/main/java/org/airavata/appcatalog/cpi/ApplicationInterface.java b/modules/app-catalog/app-catalog-cpi/src/main/java/org/airavata/appcatalog/cpi/ApplicationInterface.java
deleted file mode 100644
index 6b5a42d..0000000
--- a/modules/app-catalog/app-catalog-cpi/src/main/java/org/airavata/appcatalog/cpi/ApplicationInterface.java
+++ /dev/null
@@ -1,148 +0,0 @@
-/**
- * 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.airavata.appcatalog.cpi;
-
-import org.apache.airavata.model.appcatalog.appdeployment.ApplicationModule;
-import org.apache.airavata.model.appcatalog.appinterface.ApplicationInterfaceDescription;
-import org.apache.airavata.model.appcatalog.appinterface.InputDataObjectType;
-import org.apache.airavata.model.appcatalog.appinterface.OutputDataObjectType;
-
-import java.util.List;
-import java.util.Map;
-
-public interface ApplicationInterface {
- /**
- * This method will add an application module
- * @param applicationModule application module
- * @return unique module id
- */
- String addApplicationModule (ApplicationModule applicationModule, String gatewayId) throws AppCatalogException;
-
- /**
- * This method will add application interface description
- * @param applicationInterfaceDescription application interface
- * @return unique app interface id
- */
- String addApplicationInterface(ApplicationInterfaceDescription applicationInterfaceDescription, String gatewayId) throws AppCatalogException;
-
- /**
- * This method will add an application module mapping
- * @param moduleId unique module Id
- * @param interfaceId unique interface id
- */
- void addApplicationModuleMapping (String moduleId, String interfaceId) throws AppCatalogException;
-
- /**
- * This method will update application module
- * @param moduleId unique module Id
- * @param updatedModule updated module
- * @throws AppCatalogException
- */
- void updateApplicationModule (String moduleId, ApplicationModule updatedModule) throws AppCatalogException;
-
- /**
- * This method will update application interface
- * @param interfaceId unique interface id
- * @param updatedInterface updated app interface
- * @throws AppCatalogException
- */
- void updateApplicationInterface (String interfaceId, ApplicationInterfaceDescription updatedInterface) throws AppCatalogException;
-
- /**
- * This method will retrieve application module by given module id
- * @param moduleId unique module Id
- * @return application module object
- */
- ApplicationModule getApplicationModule (String moduleId) throws AppCatalogException;
-
- /**
- * This method will retrieve application interface by given interface id
- * @param interfaceId unique interface id
- * @return application interface desc
- */
- ApplicationInterfaceDescription getApplicationInterface(String interfaceId) throws AppCatalogException;
-
- /**
- * This method will return a list of application modules according to given search criteria
- * @param filters map should be provided as the field name and it's value
- * @return list of application modules
- */
- List<ApplicationModule> getApplicationModules(Map<String, String> filters) throws AppCatalogException;
-
- List<ApplicationModule> getAllApplicationModules(String gatewayId) throws AppCatalogException;
-
- /**
- * This method will return a list of application interfaces according to given search criteria
- * @param filters map should be provided as the field name and it's value
- * @return list of application interfaces
- */
- List<ApplicationInterfaceDescription> getApplicationInterfaces(Map<String, String> filters) throws AppCatalogException;
-
- /**
- * This method will return all the application interfaces
- * @return list of all the application interfaces
- */
- List<ApplicationInterfaceDescription> getAllApplicationInterfaces(String gatewayId) throws AppCatalogException;
-
- List<String> getAllApplicationInterfaceIds() throws AppCatalogException;
-
- /**
- * Remove application interface
- * @param interfaceId unique interface id
- */
- boolean removeApplicationInterface (String interfaceId) throws AppCatalogException;
-
- /**
- * Remove application module
- * @param moduleId unique module Id
- */
- boolean removeApplicationModule (String moduleId) throws AppCatalogException;
-
- /**
- * Check whether application interface exists
- * @param interfaceId unique interface id
- * @return true or false
- */
- boolean isApplicationInterfaceExists(String interfaceId) throws AppCatalogException;
-
- /**
- * Check whether application module exists
- * @param moduleId unique module Id
- * @return true or false
- */
- boolean isApplicationModuleExists(String moduleId) throws AppCatalogException;
-
- /**
- * This method will retrieve application inputs for given application interface
- * @param interfaceId application interface id
- * @return list of inputs
- * @throws AppCatalogException
- */
- List<InputDataObjectType> getApplicationInputs(String interfaceId) throws AppCatalogException;
-
- /**
- * This method will retrieve application outputs for given application interface
- * @param interfaceId application interface id
- * @return list of output
- * @throws AppCatalogException
- */
- List<OutputDataObjectType> getApplicationOutputs(String interfaceId) throws AppCatalogException;
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/app-catalog/app-catalog-cpi/src/main/java/org/airavata/appcatalog/cpi/ComputeResource.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-cpi/src/main/java/org/airavata/appcatalog/cpi/ComputeResource.java b/modules/app-catalog/app-catalog-cpi/src/main/java/org/airavata/appcatalog/cpi/ComputeResource.java
deleted file mode 100644
index c17da17..0000000
--- a/modules/app-catalog/app-catalog-cpi/src/main/java/org/airavata/appcatalog/cpi/ComputeResource.java
+++ /dev/null
@@ -1,249 +0,0 @@
-/**
- * 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.airavata.appcatalog.cpi;
-
-import java.util.List;
-import java.util.Map;
-
-import org.apache.airavata.model.appcatalog.computeresource.*;
-
-public interface ComputeResource {
- /**
- * This function will add a compute resource description to the database
- * @param description compute resource description
- * @return unique resource ID generated by airavata
- */
- String addComputeResource (ComputeResourceDescription description) throws AppCatalogException;
-
- /**
- * This method will update compute resource
- * @param computeResourceId unique compute resource id
- * @param updatedComputeResource updated compute resource
- */
- void updateComputeResource (String computeResourceId, ComputeResourceDescription updatedComputeResource) throws AppCatalogException;
- /**
- * This function will add a SSHJobSubmission to the database
- * @param sshJobSubmission sshJobSubmission object
- * @return unique submission ID generated by airavata
- */
- String addSSHJobSubmission (SSHJobSubmission sshJobSubmission) throws AppCatalogException;
-
-
- /**
- * This function will add a SSHJobSubmission to the database
- * @param sshJobSubmission sshJobSubmission object
- * @return unique submission ID generated by airavata
- */
- String addCloudJobSubmission (CloudJobSubmission sshJobSubmission) throws AppCatalogException;
-
-
- String addResourceJobManager(ResourceJobManager resourceJobManager) throws AppCatalogException;
-
- void updateResourceJobManager (String resourceJobManagerId, ResourceJobManager updatedResourceJobManager) throws AppCatalogException;
-
- ResourceJobManager getResourceJobManager (String resourceJobManagerId) throws AppCatalogException;
-
- void deleteResourceJobManager (String resourceJobManagerId) throws AppCatalogException;
-
- /**
- * This will add a SSHJobSubmission protocol to the database
- * @param computeResourceId compute resource id
- */
- String addJobSubmissionProtocol(String computeResourceId, JobSubmissionInterface jobSubmissionInterface) throws AppCatalogException;
-
- String addLocalJobSubmission (LOCALSubmission localSubmission) throws AppCatalogException;
-
- /**
- * This method will add a GlobusJobSubmission to the database
- * @param globusJobSubmission GSISSHJobSubmission object
- * @return uniquely generated submission id
- */
- String addGlobusJobSubmission (GlobusJobSubmission globusJobSubmission) throws AppCatalogException;
-
- /**
- * This method will add a UNICOREJobSubmission to the database
- * @param unicoreJobSubmission
- * @return uniquely generated submission id
- */
- String addUNICOREJobSubmission (UnicoreJobSubmission unicoreJobSubmission) throws AppCatalogException;
-
-
-
- String addLocalDataMovement (LOCALDataMovement localDataMovement) throws AppCatalogException;
-
- /**
- * This method will add a SCPData movement to the database
- * @param scpDataMovement SCPData movement object
- * @return uniquely generated data move id
- */
- String addScpDataMovement (SCPDataMovement scpDataMovement) throws AppCatalogException;
-
- String addUnicoreDataMovement (UnicoreDataMovement unicoreDataMovement) throws AppCatalogException;
-
- /**
- * This will add a SCPDataMovement protocol to the database
- * @param computeResourceId compute resource id
- */
- String addDataMovementProtocol (String computeResourceId, DataMovementInterface dataMovementInterface) throws AppCatalogException;
-
- /**
- * This method will add a GridFTP Data movement to the database
- * @param gridFTPDataMovement GridFTP Data movement object
- * @return uniquely generated data move id
- */
- String addGridFTPDataMovement (GridFTPDataMovement gridFTPDataMovement) throws AppCatalogException;
-
- /**
- * This method will retrieve compute resource object on given resource id
- * @param resourceId unique resource id
- * @return ComputeResource object
- */
- ComputeResourceDescription getComputeResource (String resourceId) throws AppCatalogException;
-
- /**
- * This method will return a list of computeResource descriptions according to given search criteria
- * @param filters map should be provided as the field name and it's value
- * @return list of compute resources
- */
- List<ComputeResourceDescription> getComputeResourceList (Map<String, String> filters) throws AppCatalogException;
-
- /**
- * This method will retrieve all the compute resources
- * @return list of compute resources
- * @throws AppCatalogException
- */
- List<ComputeResourceDescription> getAllComputeResourceList () throws AppCatalogException;
-
- /**
- * This method will retrieve all the compute resource id with it's name
- * @return map of compute resource ids + name
- * @throws AppCatalogException
- */
- Map<String, String> getAllComputeResourceIdList () throws AppCatalogException;
-
-
-
-// /**
-// * This method will retrieve GlobusJobSubmission object
-// * @param submissionId unique submission id
-// * @return GlobusJobSubmission object
-// */
-// GlobusJobSubmission getGlobusJobSubmission (String submissionId) throws AppCatalogException;
-//
-// /**
-// * This method will return a list of GlobusJobSubmission objects according to given search criteria
-// * @param filters map should be provided as the field name and it's value
-// * @return list of GlobusJobSubmission objects
-// */
-// List<GlobusJobSubmission> getGlobusJobSubmissionList (Map<String, String> filters) throws AppCatalogException;
-
- /**
- * This method will retrieve GSISSHJobSubmission object
- * @param submissionId unique submission id
- * @return GSISSHSubmission object
- */
- SSHJobSubmission getSSHJobSubmission (String submissionId) throws AppCatalogException;
-
- /**
- * This method will retrieve UnicoreJobSubmission object
- * @param submissionId unique submission id
- * @return UnicoreSubmission object
- */
- UnicoreJobSubmission getUNICOREJobSubmission (String submissionId) throws AppCatalogException;
- UnicoreDataMovement getUNICOREDataMovement (String dataMovementId) throws AppCatalogException;
-
-
-
- /**
- * This method will retrieve GSISSHJobSubmission object
- * @param submissionId unique submission id
- * @return GSISSHSubmission object
- */
- CloudJobSubmission getCloudJobSubmission (String submissionId) throws AppCatalogException;
-// /**
-// * This method will return a list of GSISSHSubmission objects according to given search criteria
-// * @param filters map should be provided as the field name and it's value
-// * @return list of GSISSHSubmission objects
-// */
-// List<SSHJobSubmission> getSSHJobSubmissionList (Map<String, String> filters) throws AppCatalogException;
- /**
- * This method will retrieve SCP Data movement object
- * @param dataMoveId unique data move id
- * @return SCPDataMovement object
- */
- SCPDataMovement getSCPDataMovement (String dataMoveId) throws AppCatalogException;
-
-// /**
-// * This method will return a list of SCPDataMovement objects according to given search criteria
-// * @param filters map should be provided as the field name and it's value
-// * @return list of SCPDataMovement objects
-// */
-// List<SCPDataMovement> getSCPDataMovementList (Map<String, String> filters) throws AppCatalogException;
-
- /**
- * This method will retrieve GridFTPDataMovement object
- * @param dataMoveId unique data move id
- * @return GridFTPDataMovement object
- */
- GridFTPDataMovement getGridFTPDataMovement (String dataMoveId) throws AppCatalogException;
-
-// /**
-// * This method will return a list of GridFTPDataMovement objects according to given search criteria
-// * @param filters map should be provided as the field name and it's value
-// * @return list of GridFTPDataMovement objects
-// */
-// List<GridFTPDataMovement> getGridFTPDataMovementList (Map<String, String> filters) throws AppCatalogException;
-
- /**
- * This method will check whether the given resource already exists in the system
- * @param resourceId unique resource id
- * @return true or false
- */
- boolean isComputeResourceExists (String resourceId) throws AppCatalogException;
-
- /**
- * This method will remove given resource from the system
- * @param resourceId unique resource id
- */
- void removeComputeResource (String resourceId) throws AppCatalogException;
-
- /**
- * This method will remove job submission interface
- * @param jobSubmissionInterfaceId unique job submission interface id
- * @throws AppCatalogException
- */
- void removeJobSubmissionInterface(String computeResourceId, String jobSubmissionInterfaceId) throws AppCatalogException;
-
- /**
- * This method will remove data movement interface
- * @param dataMovementInterfaceId unique data movement id
- * @throws AppCatalogException
- */
- void removeDataMovementInterface(String computeResourceId, String dataMovementInterfaceId) throws AppCatalogException;
-
- void removeBatchQueue(String computeResourceId, String queueName) throws AppCatalogException;
-
-
-
- LOCALSubmission getLocalJobSubmission(String submissionId) throws AppCatalogException;
-
- LOCALDataMovement getLocalDataMovement(String datamovementId) throws AppCatalogException;
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/app-catalog/app-catalog-cpi/src/main/java/org/airavata/appcatalog/cpi/GwyResourceProfile.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-cpi/src/main/java/org/airavata/appcatalog/cpi/GwyResourceProfile.java b/modules/app-catalog/app-catalog-cpi/src/main/java/org/airavata/appcatalog/cpi/GwyResourceProfile.java
deleted file mode 100644
index d6d04fc..0000000
--- a/modules/app-catalog/app-catalog-cpi/src/main/java/org/airavata/appcatalog/cpi/GwyResourceProfile.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/**
- * 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.airavata.appcatalog.cpi;
-
-import org.apache.airavata.model.appcatalog.gatewayprofile.ComputeResourcePreference;
-import org.apache.airavata.model.appcatalog.gatewayprofile.GatewayResourceProfile;
-
-import java.util.List;
-
-public interface GwyResourceProfile {
- /**
- * This method will add a gateway profile
- * @param gatewayProfile gateway profile
- * @return gateway id
- */
- String addGatewayResourceProfile(GatewayResourceProfile gatewayProfile) throws AppCatalogException;
-
- /**
- * This method will update a gateway profile
- * @param gatewayId unique gateway id
- * @param updatedProfile updated profile
- */
- void updateGatewayResourceProfile(String gatewayId, GatewayResourceProfile updatedProfile) throws AppCatalogException;
-
- /**
- *
- * @param gatewayId
- * @return
- */
- GatewayResourceProfile getGatewayProfile (String gatewayId) throws AppCatalogException;
-
- /**
- * This method will remove a gateway profile
- * @param gatewayId unique gateway id
- * @return true or false
- */
- boolean removeGatewayResourceProfile(String gatewayId) throws AppCatalogException;
- boolean removeComputeResourcePreferenceFromGateway(String gatewayId, String preferenceId) throws AppCatalogException;
-
- /**
- * This method will check whether gateway profile exists
- * @param gatewayId unique gateway id
- * @return true or false
- */
- boolean isGatewayResourceProfileExists(String gatewayId) throws AppCatalogException;
-
- /**
- *
- * @param gatewayId
- * @param hostId
- * @return ComputeResourcePreference
- */
- ComputeResourcePreference getComputeResourcePreference (String gatewayId, String hostId) throws AppCatalogException;
-
- /**
- *
- * @param gatewayId
- * @return
- */
- List<ComputeResourcePreference> getAllComputeResourcePreferences (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/ec8c6202/modules/app-catalog/app-catalog-cpi/src/main/java/org/airavata/appcatalog/cpi/WorkflowCatalog.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-cpi/src/main/java/org/airavata/appcatalog/cpi/WorkflowCatalog.java b/modules/app-catalog/app-catalog-cpi/src/main/java/org/airavata/appcatalog/cpi/WorkflowCatalog.java
deleted file mode 100644
index 6beeb60..0000000
--- a/modules/app-catalog/app-catalog-cpi/src/main/java/org/airavata/appcatalog/cpi/WorkflowCatalog.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- *
- * 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.airavata.appcatalog.cpi;
-
-import org.apache.airavata.model.appcatalog.appinterface.OutputDataObjectType;
-
-import java.util.List;
-
-public interface WorkflowCatalog {
-
- public List<String> getAllWorkflows(String gatewayId) throws AppCatalogException;
-
- public org.apache.airavata.model.Workflow getWorkflow(String workflowTemplateId) throws AppCatalogException;
-
- public void deleteWorkflow(String workflowTemplateId) throws AppCatalogException;
-
- public String registerWorkflow(org.apache.airavata.model.Workflow workflow, String gatewayId) throws AppCatalogException;
-
- public void updateWorkflow(String workflowTemplateId, org.apache.airavata.model.Workflow workflow) throws AppCatalogException;
-
- public String getWorkflowTemplateId(String workflowName) throws AppCatalogException;
-
- public boolean isWorkflowExistWithName(String workflowName) throws AppCatalogException;
-
- public void updateWorkflowOutputs(String workflowTemplateId, List<OutputDataObjectType> workflowOutputs) throws AppCatalogException;
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/impl/AppCatalogFactory.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/impl/AppCatalogFactory.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/impl/AppCatalogFactory.java
deleted file mode 100644
index 34e0976..0000000
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/impl/AppCatalogFactory.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- *
- * 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.aiaravata.application.catalog.data.impl;
-
-import org.airavata.appcatalog.cpi.AppCatalog;
-import org.airavata.appcatalog.cpi.AppCatalogException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class AppCatalogFactory {
- private static AppCatalog appCatalog;
-
- private static Logger logger = LoggerFactory.getLogger(AppCatalogFactory.class);
-
- public static AppCatalog getAppCatalog() throws AppCatalogException{
- try {
- if (appCatalog == null){
- appCatalog = new AppCatalogImpl();
- }
-
- }catch (Exception e){
- logger.error("Unable to create app catalog instance", e);
- throw new AppCatalogException(e);
- }
- return appCatalog;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/impl/AppCatalogImpl.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/impl/AppCatalogImpl.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/impl/AppCatalogImpl.java
deleted file mode 100644
index 246554b..0000000
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/impl/AppCatalogImpl.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- *
- * 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.aiaravata.application.catalog.data.impl;
-
-import org.airavata.appcatalog.cpi.*;
-import org.airavata.appcatalog.cpi.GwyResourceProfile;
-
-public class AppCatalogImpl implements AppCatalog {
- @Override
- public ComputeResource getComputeResource() {
- return new ComputeResourceImpl();
- }
-
- @Override
- public ApplicationInterface getApplicationInterface() {
- return new ApplicationInterfaceImpl();
- }
-
- @Override
- public ApplicationDeployment getApplicationDeployment() {
- return new ApplicationDeploymentImpl();
- }
-
- @Override
- public GwyResourceProfile getGatewayProfile() throws AppCatalogException {
- return new GwyResourceProfileImpl();
- }
-
- @Override
- public WorkflowCatalog getWorkflowCatalog() throws AppCatalogException {
- return new WorkflowCatalogImpl();
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/impl/ApplicationDeploymentImpl.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/impl/ApplicationDeploymentImpl.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/impl/ApplicationDeploymentImpl.java
deleted file mode 100644
index f0027ab..0000000
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/impl/ApplicationDeploymentImpl.java
+++ /dev/null
@@ -1,414 +0,0 @@
-/*
- *
- * 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.aiaravata.application.catalog.data.impl;
-
-import org.airavata.appcatalog.cpi.AppCatalogException;
-import org.airavata.appcatalog.cpi.ApplicationDeployment;
-import org.apache.aiaravata.application.catalog.data.resources.*;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogThriftConversion;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogUtils;
-import org.apache.airavata.model.appcatalog.appdeployment.ApplicationDeploymentDescription;
-import org.apache.airavata.model.appcatalog.appdeployment.ApplicationParallelismType;
-import org.apache.airavata.model.appcatalog.appdeployment.SetEnvPaths;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-public class ApplicationDeploymentImpl implements ApplicationDeployment {
- private final static Logger logger = LoggerFactory.getLogger(ApplicationDeploymentImpl.class);
-
- @Override
- public String addApplicationDeployment(ApplicationDeploymentDescription deploymentDescription, String gatewayId) throws AppCatalogException {
- try {
- AppDeploymentResource deploymentResource = new AppDeploymentResource();
- ComputeResourceResource computeHostResource = new ComputeResourceResource();
- AppModuleResource moduleResource = new AppModuleResource();
- if (!computeHostResource.isExists(deploymentDescription.getComputeHostId())){
- logger.error("Compute host does not exist in the system. Please create a Compute host first...");
- throw new AppCatalogException("Compute host does not exist in the system. Please create a Compute host first...");
- }
- if (!moduleResource.isExists(deploymentDescription.getAppModuleId())){
- logger.error("Application module does not exist in the system. Please create an application module first...");
- throw new AppCatalogException("Application module does not exist in the system. Please create an application module first...");
- }
- AppModuleResource module = (AppModuleResource)moduleResource.get(deploymentDescription.getAppModuleId());
- ComputeResourceResource hostResource = (ComputeResourceResource) computeHostResource.get(deploymentDescription.getComputeHostId());
- deploymentResource.setDeploymentId(hostResource.getHostName() + "_" + deploymentDescription.getAppModuleId());
- deploymentResource.setAppModuleId(deploymentDescription.getAppModuleId());
- deploymentResource.setModuleResource(module);
- deploymentResource.setHostId(deploymentDescription.getComputeHostId());
- deploymentResource.setHostResource(hostResource);
- deploymentResource.setAppDes(deploymentDescription.getAppDeploymentDescription());
- deploymentResource.setExecutablePath(deploymentDescription.getExecutablePath());
- deploymentResource.setGatewayId(gatewayId);
- ApplicationParallelismType parallelism = deploymentDescription.getParallelism();
- if (parallelism != null){
- deploymentResource.setParallelism(parallelism.toString());
- }
- deploymentResource.save();
- deploymentDescription.setAppDeploymentId(deploymentResource.getDeploymentId());
-
- List<String> moduleLoadCmds = deploymentDescription.getModuleLoadCmds();
- if (moduleLoadCmds != null && !moduleLoadCmds.isEmpty()){
- for (String cmd : moduleLoadCmds){
- ModuleLoadCmdResource cmdResource = new ModuleLoadCmdResource();
- cmdResource.setAppDeploymentId(deploymentDescription.getAppDeploymentId());
- cmdResource.setCmd(cmd);
- cmdResource.save();
- }
- }
-
- List<String> preJobCommands = deploymentDescription.getPreJobCommands();
- if (preJobCommands != null && !preJobCommands.isEmpty()){
- for (String cmd : preJobCommands){
- PreJobCommandResource cmdResource = new PreJobCommandResource();
- cmdResource.setAppDeploymentId(deploymentDescription.getAppDeploymentId());
- cmdResource.setCommand(cmd);
- cmdResource.save();
- }
- }
-
- List<String> postJobCommands = deploymentDescription.getPostJobCommands();
- if (postJobCommands != null && !postJobCommands.isEmpty()){
- for (String cmd : postJobCommands){
- PostJobCommandResource cmdResource = new PostJobCommandResource();
- cmdResource.setAppDeploymentId(deploymentDescription.getAppDeploymentId());
- cmdResource.setCommand(cmd);
- cmdResource.save();
- }
- }
-
- List<SetEnvPaths> libPrependPaths = deploymentDescription.getLibPrependPaths();
- if (libPrependPaths != null && !libPrependPaths.isEmpty()){
- for (SetEnvPaths path : libPrependPaths){
- LibraryPrepandPathResource prepandPathResource = new LibraryPrepandPathResource();
- prepandPathResource.setAppDeploymentResource(deploymentResource);
- prepandPathResource.setName(path.getName());
- prepandPathResource.setValue(path.getValue());
- prepandPathResource.setDeploymentId(deploymentResource.getDeploymentId());
- prepandPathResource.save();
- }
- }
-
- List<SetEnvPaths> libApendPaths = deploymentDescription.getLibAppendPaths();
- if (libApendPaths != null && !libApendPaths.isEmpty()){
- for (SetEnvPaths path : libApendPaths){
- LibraryApendPathResource apendPathResource = new LibraryApendPathResource();
- apendPathResource.setAppDeploymentResource(deploymentResource);
- apendPathResource.setName(path.getName());
- apendPathResource.setValue(path.getValue());
- apendPathResource.setDeploymentId(deploymentResource.getDeploymentId());
- apendPathResource.save();
- }
- }
- List<SetEnvPaths> setEnvironment = deploymentDescription.getSetEnvironment();
- if (setEnvironment != null && !setEnvironment.isEmpty()){
- for (SetEnvPaths path : setEnvironment){
- AppEnvironmentResource environmentResource = new AppEnvironmentResource();
- environmentResource.setAppDeploymentResource(deploymentResource);
- environmentResource.setName(path.getName());
- environmentResource.setValue(path.getValue());
- environmentResource.setDeploymentId(deploymentResource.getDeploymentId());
- environmentResource.save();
- }
- }
- return deploymentResource.getDeploymentId();
- }catch (Exception e) {
- logger.error("Error while saving application deployment...", e);
- throw new AppCatalogException(e);
- }
- }
-
- @Override
- public void updateApplicationDeployment(String deploymentId, ApplicationDeploymentDescription updatedDeployment) throws AppCatalogException {
- try {
- AppDeploymentResource deploymentResource = new AppDeploymentResource();
- AppDeploymentResource existingDep = (AppDeploymentResource)deploymentResource.get(deploymentId);
- ComputeResourceResource computeHostResource = new ComputeResourceResource();
- AppModuleResource moduleResource = new AppModuleResource();
- if (!computeHostResource.isExists(updatedDeployment.getComputeHostId())){
- logger.error("Compute host does not exist in the system. Please create a Compute host first...");
- throw new AppCatalogException("Compute host does not exist in the system. Please create a Compute host first...");
- }
- if (!moduleResource.isExists(updatedDeployment.getAppModuleId())){
- logger.error("Application module does not exist in the system. Please create an application module first...");
- throw new AppCatalogException("Application module does not exist in the system. Please create an application module first...");
- }
- AppModuleResource module = (AppModuleResource)moduleResource.get(updatedDeployment.getAppModuleId());
- existingDep.setAppModuleId(updatedDeployment.getAppModuleId());
- existingDep.setModuleResource(module);
- existingDep.setHostId(updatedDeployment.getComputeHostId());
- existingDep.setHostResource((ComputeResourceResource)computeHostResource.get(updatedDeployment.getComputeHostId()));
- existingDep.setAppDes(updatedDeployment.getAppDeploymentDescription());
- existingDep.setExecutablePath(updatedDeployment.getExecutablePath());
- if (updatedDeployment.getParallelism() != null){
- deploymentResource.setParallelism(updatedDeployment.getParallelism().toString());
- }
-
- existingDep.save();
-
- // remove existing module load commands
- ModuleLoadCmdResource cmdResource = new ModuleLoadCmdResource();
- Map<String, String> ids = new HashMap<String, String>();
- ids.put(AbstractResource.ModuleLoadCmdConstants.APP_DEPLOYMENT_ID, deploymentId);
- cmdResource.remove(ids);
- List<String> moduleLoadCmds = updatedDeployment.getModuleLoadCmds();
- if (moduleLoadCmds != null && !moduleLoadCmds.isEmpty()){
- for (String cmd : moduleLoadCmds){
- ids = new HashMap<String, String>();
- ids.put(AbstractResource.ModuleLoadCmdConstants.APP_DEPLOYMENT_ID, deploymentId);
- ids.put(AbstractResource.ModuleLoadCmdConstants.CMD, cmd);
- if (cmdResource.isExists(ids)){
- cmdResource = (ModuleLoadCmdResource)cmdResource.get(ids);
- }
- cmdResource.setCmd(cmd);
- cmdResource.setAppDeploymentResource(existingDep);
- cmdResource.setAppDeploymentId(deploymentId);
- cmdResource.save();
- }
- }
-
- PreJobCommandResource preJobCommandResource = new PreJobCommandResource();
- ids = new HashMap<String, String>();
- ids.put(AbstractResource.PreJobCommandConstants.DEPLOYMENT_ID, deploymentId);
- preJobCommandResource.remove(ids);
- List<String> preJobCommands = updatedDeployment.getPreJobCommands();
- if (preJobCommands != null && !preJobCommands.isEmpty()){
- for (String cmd : preJobCommands){
- ids = new HashMap<String, String>();
- ids.put(AbstractResource.PreJobCommandConstants.DEPLOYMENT_ID, deploymentId);
- ids.put(AbstractResource.PreJobCommandConstants.COMMAND, cmd);
- if (preJobCommandResource.isExists(ids)){
- preJobCommandResource = (PreJobCommandResource)preJobCommandResource.get(ids);
- }
- preJobCommandResource.setCommand(cmd);
- preJobCommandResource.setAppDeploymentResource(existingDep);
- preJobCommandResource.setAppDeploymentId(deploymentId);
- preJobCommandResource.save();
- }
- }
-
- PostJobCommandResource postJobCommandResource = new PostJobCommandResource();
- ids = new HashMap<String, String>();
- ids.put(AbstractResource.PostJobCommandConstants.DEPLOYMENT_ID, deploymentId);
- postJobCommandResource.remove(ids);
- List<String> postJobCommands = updatedDeployment.getPostJobCommands();
- if (postJobCommands != null && !postJobCommands.isEmpty()){
- for (String cmd : postJobCommands){
- ids = new HashMap<String, String>();
- ids.put(AbstractResource.PostJobCommandConstants.DEPLOYMENT_ID, deploymentId);
- ids.put(AbstractResource.PostJobCommandConstants.COMMAND, cmd);
- if (postJobCommandResource.isExists(ids)){
- postJobCommandResource = (PostJobCommandResource)postJobCommandResource.get(ids);
- }
- postJobCommandResource.setCommand(cmd);
- postJobCommandResource.setAppDeploymentResource(existingDep);
- postJobCommandResource.setAppDeploymentId(deploymentId);
- postJobCommandResource.save();
- }
- }
-
- // remove existing lib prepand paths
- LibraryPrepandPathResource prepandPathResource = new LibraryPrepandPathResource();
- ids = new HashMap<String, String>();
- ids.put(AbstractResource.LibraryPrepandPathConstants.DEPLOYMENT_ID, deploymentId);
- prepandPathResource.remove(ids);
- List<SetEnvPaths> libPrependPaths = updatedDeployment.getLibPrependPaths();
- if (libPrependPaths != null && !libPrependPaths.isEmpty()){
- for (SetEnvPaths path : libPrependPaths){
- ids = new HashMap<String, String>();
- ids.put(AbstractResource.LibraryPrepandPathConstants.DEPLOYMENT_ID, deploymentId);
- ids.put(AbstractResource.LibraryPrepandPathConstants.NAME, path.getName());
- if (prepandPathResource.isExists(ids)){
- prepandPathResource = (LibraryPrepandPathResource)prepandPathResource.get(ids);
- }
- prepandPathResource.setAppDeploymentResource(existingDep);
- prepandPathResource.setName(path.getName());
- prepandPathResource.setValue(path.getValue());
- prepandPathResource.setDeploymentId(deploymentId);
- prepandPathResource.save();
- }
- }
-
- List<SetEnvPaths> libApendPaths = updatedDeployment.getLibAppendPaths();
- // remove lib append paths
- LibraryApendPathResource apendPathResource = new LibraryApendPathResource();
- ids = new HashMap<String, String>();
- ids.put(AbstractResource.LibraryApendPathConstants.DEPLOYMENT_ID, deploymentId);
- apendPathResource.remove(ids);
- if (libApendPaths != null && !libApendPaths.isEmpty()){
- for (SetEnvPaths path : libApendPaths){
- ids = new HashMap<String, String>();
- ids.put(AbstractResource.LibraryApendPathConstants.DEPLOYMENT_ID, deploymentId);
- ids.put(AbstractResource.LibraryApendPathConstants.NAME, path.getName());
- if (apendPathResource.isExists(ids)){
- apendPathResource = (LibraryApendPathResource)apendPathResource.get(ids);
- }
- apendPathResource.setAppDeploymentResource(existingDep);
- apendPathResource.setName(path.getName());
- apendPathResource.setValue(path.getValue());
- apendPathResource.setDeploymentId(deploymentId);
- apendPathResource.save();
- }
- }
-
- List<SetEnvPaths> setEnvironment = updatedDeployment.getSetEnvironment();
- // remove existing setEnvPaths
- AppEnvironmentResource environmentResource = new AppEnvironmentResource();
- ids = new HashMap<String, String>();
- ids.put(AbstractResource.AppEnvironmentConstants.DEPLOYMENT_ID, deploymentId);
- environmentResource.remove(ids);
- if (setEnvironment != null && !setEnvironment.isEmpty()){
- for (SetEnvPaths path : setEnvironment){
- ids = new HashMap<String, String>();
- ids.put(AbstractResource.AppEnvironmentConstants.DEPLOYMENT_ID, deploymentId);
- ids.put(AbstractResource.AppEnvironmentConstants.NAME, path.getName());
- if (environmentResource.isExists(ids)){
- environmentResource = (AppEnvironmentResource)environmentResource.get(ids);
- }
- environmentResource.setAppDeploymentResource(existingDep);
- environmentResource.setName(path.getName());
- environmentResource.setValue(path.getValue());
- environmentResource.setDeploymentId(deploymentId);
- environmentResource.save();
- }
- }
- }catch (Exception e) {
- logger.error("Error while updating application deployment...", e);
- throw new AppCatalogException(e);
- }
- }
-
- @Override
- public ApplicationDeploymentDescription getApplicationDeployement(String deploymentId) throws AppCatalogException {
- try {
- AppDeploymentResource deploymentResource = new AppDeploymentResource();
- AppDeploymentResource appDep = (AppDeploymentResource)deploymentResource.get(deploymentId);
- return AppCatalogThriftConversion.getApplicationDeploymentDescription(appDep);
- }catch (Exception e) {
- logger.error("Error while retrieving application deployment...", e);
- throw new AppCatalogException(e);
- }
- }
-
- @Override
- public List<ApplicationDeploymentDescription> getApplicationDeployements(Map<String, String> filters) throws AppCatalogException {
- List<ApplicationDeploymentDescription> deploymentDescriptions = new ArrayList<ApplicationDeploymentDescription>();
- try {
- AppDeploymentResource resource = new AppDeploymentResource();
- boolean firstTry=true;
- for (String fieldName : filters.keySet() ){
- List<ApplicationDeploymentDescription> tmpDescriptions = new ArrayList<ApplicationDeploymentDescription>();
- if (fieldName.equals(AbstractResource.ApplicationDeploymentConstants.APP_MODULE_ID)){
- List<Resource> resources = resource.get(AbstractResource.ApplicationDeploymentConstants.APP_MODULE_ID, filters.get(fieldName));
- if (resources != null && !resources.isEmpty()){
- tmpDescriptions = AppCatalogThriftConversion.getAppDepDescList(resources);
- }
- }else if (fieldName.equals(AbstractResource.ApplicationDeploymentConstants.COMPUTE_HOST_ID)){
- List<Resource> resources = resource.get(AbstractResource.ApplicationDeploymentConstants.COMPUTE_HOST_ID, filters.get(fieldName));
- if (resources != null && !resources.isEmpty()){
- tmpDescriptions = AppCatalogThriftConversion.getAppDepDescList(resources);
- }
- } else {
- logger.error("Unsupported field name for app deployment.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported field name for app deployment.");
- }
- if (firstTry){
- deploymentDescriptions.addAll(tmpDescriptions);
- firstTry=false;
- }else{
- List<String> ids=new ArrayList<String>();
- for (ApplicationDeploymentDescription applicationDeploymentDescription : deploymentDescriptions) {
- ids.add(applicationDeploymentDescription.getAppDeploymentId());
- }
- List<ApplicationDeploymentDescription> tmp2Descriptions = new ArrayList<ApplicationDeploymentDescription>();
- for (ApplicationDeploymentDescription applicationDeploymentDescription : tmpDescriptions) {
- if (ids.contains(applicationDeploymentDescription.getAppDeploymentId())){
- tmp2Descriptions.add(applicationDeploymentDescription);
- }
- }
- deploymentDescriptions.clear();
- deploymentDescriptions.addAll(tmp2Descriptions);
- }
- }
- }catch (Exception e){
- logger.error("Error while retrieving app deployment list...", e);
- throw new AppCatalogException(e);
- }
- return deploymentDescriptions;
- }
-
- @Override
- public List<ApplicationDeploymentDescription> getAllApplicationDeployements(String gatewayId) throws AppCatalogException {
- List<ApplicationDeploymentDescription> deploymentDescriptions = new ArrayList<ApplicationDeploymentDescription>();
- try {
- AppDeploymentResource resource = new AppDeploymentResource();
- resource.setGatewayId(gatewayId);
- List<Resource> resources = resource.getAll();
- if (resources != null && !resources.isEmpty()){
- deploymentDescriptions = AppCatalogThriftConversion.getAppDepDescList(resources);
- }
-
- }catch (Exception e){
- logger.error("Error while retrieving app deployment list...", e);
- throw new AppCatalogException(e);
- }
- return deploymentDescriptions;
- }
-
- @Override
- public List<String> getAllApplicationDeployementIds() throws AppCatalogException {
- try {
- AppDeploymentResource resource = new AppDeploymentResource();
- return resource.getAllIds();
- }catch (Exception e){
- logger.error("Error while retrieving app deployment list...", e);
- throw new AppCatalogException(e);
- }
- }
-
- @Override
- public boolean isAppDeploymentExists(String deploymentId) throws AppCatalogException {
- try {
- AppDeploymentResource deploymentResource = new AppDeploymentResource();
- return deploymentResource.isExists(deploymentId);
- }catch (Exception e){
- logger.error("Error while retrieving app deployment...", e);
- throw new AppCatalogException(e);
- }
- }
-
- @Override
- public void removeAppDeployment(String deploymentId) throws AppCatalogException {
- try {
- AppDeploymentResource deploymentResource = new AppDeploymentResource();
- deploymentResource.remove(deploymentId);
- }catch (Exception e){
- logger.error("Error while deleting app deployment...", e);
- throw new AppCatalogException(e);
- }
- }
-}
[10/52] [abbrv] [partial] airavata git commit: registry refactoring
Posted by sh...@apache.org.
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/GridftpDataMovementResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/GridftpDataMovementResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/GridftpDataMovementResource.java
new file mode 100644
index 0000000..35b36e0
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/GridftpDataMovementResource.java
@@ -0,0 +1,279 @@
+/**
+ * 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.aiaravata.application.catalog.data.resources;
+
+import java.sql.Timestamp;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.persistence.EntityManager;
+import javax.persistence.Query;
+
+import org.airavata.appcatalog.cpi.AppCatalogException;
+import org.apache.aiaravata.application.catalog.data.model.GridftpDataMovement;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogJPAUtils;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogQueryGenerator;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogResourceType;
+import org.apache.airavata.common.exception.ApplicationSettingsException;
+import org.apache.airavata.common.utils.AiravataUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class GridftpDataMovementResource extends AbstractResource {
+ private final static Logger logger = LoggerFactory.getLogger(GridftpDataMovementResource.class);
+ private String dataMovementInterfaceId;
+ private String securityProtocol;
+ private Timestamp createdTime;
+ private Timestamp updatedTime;
+
+ public Timestamp getCreatedTime() {
+ return createdTime;
+ }
+
+ public void setCreatedTime(Timestamp createdTime) {
+ this.createdTime = createdTime;
+ }
+
+ public Timestamp getUpdatedTime() {
+ return updatedTime;
+ }
+
+ public void setUpdatedTime(Timestamp updatedTime) {
+ this.updatedTime = updatedTime;
+ }
+
+ @Override
+ public void remove(Object identifier) throws AppCatalogException {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(GRIDFTP_DATA_MOVEMENT);
+ generator.setParameter(GridftpDataMovementConstants.DATA_MOVEMENT_INTERFACE_ID, identifier);
+ 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 Resource get(Object identifier) throws AppCatalogException {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(GRIDFTP_DATA_MOVEMENT);
+ generator.setParameter(GridftpDataMovementConstants.DATA_MOVEMENT_INTERFACE_ID, identifier);
+ Query q = generator.selectQuery(em);
+ GridftpDataMovement gridftpDataMovement = (GridftpDataMovement) q.getSingleResult();
+ GridftpDataMovementResource gridftpDataMovementResource = (GridftpDataMovementResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.GRIDFTP_DATA_MOVEMENT, gridftpDataMovement);
+ em.getTransaction().commit();
+ em.close();
+ return gridftpDataMovementResource;
+ } 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<Resource> get(String fieldName, Object value) throws AppCatalogException {
+ List<Resource> gridftpDataMovementResources = new ArrayList<Resource>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(GRIDFTP_DATA_MOVEMENT);
+ Query q;
+ if ((fieldName.equals(GridftpDataMovementConstants.DATA_MOVEMENT_INTERFACE_ID)) || (fieldName.equals(GridftpDataMovementConstants.SECURITY_PROTOCOL))) {
+ generator.setParameter(fieldName, value);
+ q = generator.selectQuery(em);
+ List<?> results = q.getResultList();
+ for (Object result : results) {
+ GridftpDataMovement gridftpDataMovement = (GridftpDataMovement) result;
+ GridftpDataMovementResource gridftpDataMovementResource = (GridftpDataMovementResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.GRIDFTP_DATA_MOVEMENT, gridftpDataMovement);
+ gridftpDataMovementResources.add(gridftpDataMovementResource);
+ }
+ } else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for Gridftp Data Movement Resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for Gridftp Data Movement Resource.");
+ }
+ 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();
+ }
+ }
+ return gridftpDataMovementResources;
+ }
+
+ @Override
+ public List<Resource> 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 {
+ List<String> gridftpDataMovementResourceIDs = new ArrayList<String>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(GRIDFTP_DATA_MOVEMENT);
+ Query q;
+ if ((fieldName.equals(GridftpDataMovementConstants.DATA_MOVEMENT_INTERFACE_ID)) || (fieldName.equals(GridftpDataMovementConstants.SECURITY_PROTOCOL))) {
+ generator.setParameter(fieldName, value);
+ q = generator.selectQuery(em);
+ List<?> results = q.getResultList();
+ for (Object result : results) {
+ GridftpDataMovement gridftpDataMovement = (GridftpDataMovement) result;
+ GridftpDataMovementResource gridftpDataMovementResource = (GridftpDataMovementResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.GRIDFTP_DATA_MOVEMENT, gridftpDataMovement);
+ gridftpDataMovementResourceIDs.add(gridftpDataMovementResource.getDataMovementInterfaceId());
+ }
+ } else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for Gridftp Data Movement Resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for Gridftp Data Movement Resource.");
+ }
+ 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();
+ }
+ }
+ return gridftpDataMovementResourceIDs;
+ }
+
+ @Override
+ public void save() throws AppCatalogException {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ GridftpDataMovement existingGridftpDataMovement = em.find(GridftpDataMovement.class, dataMovementInterfaceId);
+ em.close();
+ GridftpDataMovement gridftpDataMovement;
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ if (existingGridftpDataMovement == null) {
+ gridftpDataMovement = new GridftpDataMovement();
+ gridftpDataMovement.setCreationTime(AiravataUtils.getCurrentTimestamp());
+ } else {
+ gridftpDataMovement = existingGridftpDataMovement;
+ gridftpDataMovement.setUpdateTime(AiravataUtils.getCurrentTimestamp());
+ }
+ gridftpDataMovement.setDataMovementInterfaceId(getDataMovementInterfaceId());
+ gridftpDataMovement.setSecurityProtocol(getSecurityProtocol());
+ if (existingGridftpDataMovement == null) {
+ em.persist(gridftpDataMovement);
+ } else {
+ em.merge(gridftpDataMovement);
+ }
+ 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 {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ GridftpDataMovement gridftpDataMovement = em.find(GridftpDataMovement.class, identifier);
+ em.close();
+ return gridftpDataMovement != null;
+ } 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();
+ }
+ }
+ }
+
+ public String getDataMovementInterfaceId() {
+ return dataMovementInterfaceId;
+ }
+
+ public String getSecurityProtocol() {
+ return securityProtocol;
+ }
+
+ public void setDataMovementInterfaceId(String dataMovementInterfaceId) {
+ this.dataMovementInterfaceId=dataMovementInterfaceId;
+ }
+
+ public void setSecurityProtocol(String securityProtocol) {
+ this.securityProtocol=securityProtocol;
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/GridftpEndpointAppCatalogResourceAppCat.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/GridftpEndpointAppCatalogResourceAppCat.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/GridftpEndpointAppCatalogResourceAppCat.java
new file mode 100644
index 0000000..6d04b6c
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/GridftpEndpointAppCatalogResourceAppCat.java
@@ -0,0 +1,317 @@
+/**
+ * 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 java.sql.Timestamp;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.persistence.EntityManager;
+import javax.persistence.Query;
+
+import org.apache.airavata.common.exception.ApplicationSettingsException;
+import org.apache.airavata.common.utils.AiravataUtils;
+import org.apache.airavata.registry.core.app.catalog.model.GridftpDataMovement;
+import org.apache.airavata.registry.core.app.catalog.model.GridftpEndpoint;
+import org.apache.airavata.registry.core.app.catalog.model.GridftpEndpoint_PK;
+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;
+
+public class GridftpEndpointAppCatalogResourceAppCat extends AppCatAbstractResource {
+ private final static Logger logger = LoggerFactory.getLogger(GridftpEndpointAppCatalogResourceAppCat.class);
+ private String endpoint;
+ private String dataMovementInterfaceId;
+ private GridftpDataMovementAppCatalogResourceAppCat gridftpDataMovementResource;
+ private Timestamp createdTime;
+ private Timestamp updatedTime;
+
+ public Timestamp getCreatedTime() {
+ return createdTime;
+ }
+
+ public void setCreatedTime(Timestamp createdTime) {
+ this.createdTime = createdTime;
+ }
+
+ public Timestamp getUpdatedTime() {
+ return updatedTime;
+ }
+
+ public void setUpdatedTime(Timestamp updatedTime) {
+ this.updatedTime = updatedTime;
+ }
+
+ @Override
+ public void remove(Object identifier) throws AppCatalogException {
+ HashMap<String, String> ids;
+ if (identifier instanceof Map) {
+ ids = (HashMap<String, String>) 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(GRIDFTP_ENDPOINT);
+ generator.setParameter(GridftpEndpointConstants.ENDPOINT, ids.get(GridftpEndpointConstants.ENDPOINT));
+ generator.setParameter(GridftpEndpointConstants.DATA_MOVEMENT_INTERFACE_ID, ids.get(GridftpEndpointConstants.DATA_MOVEMENT_INTERFACE_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<String, String>) 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(GRIDFTP_ENDPOINT);
+ generator.setParameter(GridftpEndpointConstants.ENDPOINT, ids.get(GridftpEndpointConstants.ENDPOINT));
+ generator.setParameter(GridftpEndpointConstants.DATA_MOVEMENT_INTERFACE_ID, ids.get(GridftpEndpointConstants.DATA_MOVEMENT_INTERFACE_ID));
+ Query q = generator.selectQuery(em);
+ GridftpEndpoint gridftpEndpoint = (GridftpEndpoint) q.getSingleResult();
+ GridftpEndpointAppCatalogResourceAppCat gridftpEndpointResource = (GridftpEndpointAppCatalogResourceAppCat) AppCatalogJPAUtils.getResource(AppCatalogResourceType.GRIDFTP_ENDPOINT, gridftpEndpoint);
+ em.getTransaction().commit();
+ em.close();
+ return gridftpEndpointResource;
+ } 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> gridftpEndpointResources = new ArrayList<AppCatalogResource>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(GRIDFTP_ENDPOINT);
+ Query q;
+ if ((fieldName.equals(GridftpEndpointConstants.ENDPOINT)) || (fieldName.equals(GridftpEndpointConstants.DATA_MOVEMENT_INTERFACE_ID))) {
+ generator.setParameter(fieldName, value);
+ q = generator.selectQuery(em);
+ List<?> results = q.getResultList();
+ for (Object result : results) {
+ GridftpEndpoint gridftpEndpoint = (GridftpEndpoint) result;
+ GridftpEndpointAppCatalogResourceAppCat gridftpEndpointResource = (GridftpEndpointAppCatalogResourceAppCat) AppCatalogJPAUtils.getResource(AppCatalogResourceType.GRIDFTP_ENDPOINT, gridftpEndpoint);
+ gridftpEndpointResources.add(gridftpEndpointResource);
+ }
+ } else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for Gridftp Endpoint Resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for Gridftp Endpoint Resource.");
+ }
+ 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();
+ }
+ }
+ return gridftpEndpointResources;
+ }
+
+ @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 {
+ List<String> gridftpEndpointResourceIDs = new ArrayList<String>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(GRIDFTP_ENDPOINT);
+ Query q;
+ if ((fieldName.equals(GridftpEndpointConstants.ENDPOINT)) || (fieldName.equals(GridftpEndpointConstants.DATA_MOVEMENT_INTERFACE_ID))) {
+ generator.setParameter(fieldName, value);
+ q = generator.selectQuery(em);
+ List<?> results = q.getResultList();
+ for (Object result : results) {
+ GridftpEndpoint gridftpEndpoint = (GridftpEndpoint) result;
+ GridftpEndpointAppCatalogResourceAppCat gridftpEndpointResource = (GridftpEndpointAppCatalogResourceAppCat) AppCatalogJPAUtils.getResource(AppCatalogResourceType.GRIDFTP_ENDPOINT, gridftpEndpoint);
+ gridftpEndpointResourceIDs.add(gridftpEndpointResource.getDataMovementInterfaceId());
+ }
+ } else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for Gridftp Endpoint Resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for Gridftp Endpoint Resource.");
+ }
+ 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();
+ }
+ }
+ return gridftpEndpointResourceIDs;
+ }
+
+ @Override
+ public void save() throws AppCatalogException {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ GridftpEndpoint existingGridftpEndpoint = em.find(GridftpEndpoint.class, new GridftpEndpoint_PK(endpoint, dataMovementInterfaceId));
+ em.close();
+ GridftpEndpoint gridftpEndpoint;
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ if (existingGridftpEndpoint == null) {
+ gridftpEndpoint = new GridftpEndpoint();
+ gridftpEndpoint.setCreationTime(AiravataUtils.getCurrentTimestamp());
+ } else {
+ gridftpEndpoint = existingGridftpEndpoint;
+ gridftpEndpoint.setUpdateTime(AiravataUtils.getCurrentTimestamp());
+ }
+ gridftpEndpoint.setEndpoint(getEndpoint());
+ gridftpEndpoint.setDataMovementInterfaceId(getDataMovementInterfaceId());
+ GridftpDataMovement gridftpDataMovement = em.find(GridftpDataMovement.class, getDataMovementInterfaceId());
+ gridftpEndpoint.setGridftpDataMovement(gridftpDataMovement);
+ if (existingGridftpEndpoint == null) {
+ em.persist(gridftpEndpoint);
+ } else {
+ em.merge(gridftpEndpoint);
+ }
+ 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<String, String>) 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();
+ GridftpEndpoint gridftpEndpoint = em.find(GridftpEndpoint.class, new GridftpEndpoint_PK(ids.get(GridftpEndpointConstants.ENDPOINT), ids.get(GridftpEndpointConstants.DATA_MOVEMENT_INTERFACE_ID)));
+ em.close();
+ return gridftpEndpoint != null;
+ } 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();
+ }
+ }
+ }
+
+ public String getEndpoint() {
+ return endpoint;
+ }
+
+ public String getDataMovementInterfaceId() {
+ return dataMovementInterfaceId;
+ }
+
+ public GridftpDataMovementAppCatalogResourceAppCat getGridftpDataMovementResource() {
+ return gridftpDataMovementResource;
+ }
+
+ public void setEndpoint(String endpoint) {
+ this.endpoint=endpoint;
+ }
+
+ public void setDataMovementInterfaceId(String dataMovementInterfaceId) {
+ this.dataMovementInterfaceId=dataMovementInterfaceId;
+ }
+
+ public void setGridftpDataMovementResource(GridftpDataMovementAppCatalogResourceAppCat gridftpDataMovementResource) {
+ this.gridftpDataMovementResource=gridftpDataMovementResource;
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/GridftpEndpointResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/GridftpEndpointResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/GridftpEndpointResource.java
new file mode 100644
index 0000000..f484568
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/GridftpEndpointResource.java
@@ -0,0 +1,317 @@
+/**
+ * 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.aiaravata.application.catalog.data.resources;
+
+import java.sql.Timestamp;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.persistence.EntityManager;
+import javax.persistence.Query;
+
+import org.airavata.appcatalog.cpi.AppCatalogException;
+import org.apache.aiaravata.application.catalog.data.model.GridftpDataMovement;
+import org.apache.aiaravata.application.catalog.data.model.GridftpEndpoint;
+import org.apache.aiaravata.application.catalog.data.model.GridftpEndpoint_PK;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogJPAUtils;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogQueryGenerator;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogResourceType;
+import org.apache.airavata.common.exception.ApplicationSettingsException;
+import org.apache.airavata.common.utils.AiravataUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class GridftpEndpointResource extends AbstractResource {
+ private final static Logger logger = LoggerFactory.getLogger(GridftpEndpointResource.class);
+ private String endpoint;
+ private String dataMovementInterfaceId;
+ private GridftpDataMovementResource gridftpDataMovementResource;
+ private Timestamp createdTime;
+ private Timestamp updatedTime;
+
+ public Timestamp getCreatedTime() {
+ return createdTime;
+ }
+
+ public void setCreatedTime(Timestamp createdTime) {
+ this.createdTime = createdTime;
+ }
+
+ public Timestamp getUpdatedTime() {
+ return updatedTime;
+ }
+
+ public void setUpdatedTime(Timestamp updatedTime) {
+ this.updatedTime = updatedTime;
+ }
+
+ @Override
+ public void remove(Object identifier) throws AppCatalogException {
+ HashMap<String, String> ids;
+ if (identifier instanceof Map) {
+ ids = (HashMap<String, String>) 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(GRIDFTP_ENDPOINT);
+ generator.setParameter(GridftpEndpointConstants.ENDPOINT, ids.get(GridftpEndpointConstants.ENDPOINT));
+ generator.setParameter(GridftpEndpointConstants.DATA_MOVEMENT_INTERFACE_ID, ids.get(GridftpEndpointConstants.DATA_MOVEMENT_INTERFACE_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 Resource get(Object identifier) throws AppCatalogException {
+ HashMap<String, String> ids;
+ if (identifier instanceof Map) {
+ ids = (HashMap<String, String>) 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(GRIDFTP_ENDPOINT);
+ generator.setParameter(GridftpEndpointConstants.ENDPOINT, ids.get(GridftpEndpointConstants.ENDPOINT));
+ generator.setParameter(GridftpEndpointConstants.DATA_MOVEMENT_INTERFACE_ID, ids.get(GridftpEndpointConstants.DATA_MOVEMENT_INTERFACE_ID));
+ Query q = generator.selectQuery(em);
+ GridftpEndpoint gridftpEndpoint = (GridftpEndpoint) q.getSingleResult();
+ GridftpEndpointResource gridftpEndpointResource = (GridftpEndpointResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.GRIDFTP_ENDPOINT, gridftpEndpoint);
+ em.getTransaction().commit();
+ em.close();
+ return gridftpEndpointResource;
+ } 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<Resource> get(String fieldName, Object value) throws AppCatalogException {
+ List<Resource> gridftpEndpointResources = new ArrayList<Resource>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(GRIDFTP_ENDPOINT);
+ Query q;
+ if ((fieldName.equals(GridftpEndpointConstants.ENDPOINT)) || (fieldName.equals(GridftpEndpointConstants.DATA_MOVEMENT_INTERFACE_ID))) {
+ generator.setParameter(fieldName, value);
+ q = generator.selectQuery(em);
+ List<?> results = q.getResultList();
+ for (Object result : results) {
+ GridftpEndpoint gridftpEndpoint = (GridftpEndpoint) result;
+ GridftpEndpointResource gridftpEndpointResource = (GridftpEndpointResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.GRIDFTP_ENDPOINT, gridftpEndpoint);
+ gridftpEndpointResources.add(gridftpEndpointResource);
+ }
+ } else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for Gridftp Endpoint Resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for Gridftp Endpoint Resource.");
+ }
+ 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();
+ }
+ }
+ return gridftpEndpointResources;
+ }
+
+ @Override
+ public List<Resource> 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 {
+ List<String> gridftpEndpointResourceIDs = new ArrayList<String>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(GRIDFTP_ENDPOINT);
+ Query q;
+ if ((fieldName.equals(GridftpEndpointConstants.ENDPOINT)) || (fieldName.equals(GridftpEndpointConstants.DATA_MOVEMENT_INTERFACE_ID))) {
+ generator.setParameter(fieldName, value);
+ q = generator.selectQuery(em);
+ List<?> results = q.getResultList();
+ for (Object result : results) {
+ GridftpEndpoint gridftpEndpoint = (GridftpEndpoint) result;
+ GridftpEndpointResource gridftpEndpointResource = (GridftpEndpointResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.GRIDFTP_ENDPOINT, gridftpEndpoint);
+ gridftpEndpointResourceIDs.add(gridftpEndpointResource.getDataMovementInterfaceId());
+ }
+ } else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for Gridftp Endpoint Resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for Gridftp Endpoint Resource.");
+ }
+ 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();
+ }
+ }
+ return gridftpEndpointResourceIDs;
+ }
+
+ @Override
+ public void save() throws AppCatalogException {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ GridftpEndpoint existingGridftpEndpoint = em.find(GridftpEndpoint.class, new GridftpEndpoint_PK(endpoint, dataMovementInterfaceId));
+ em.close();
+ GridftpEndpoint gridftpEndpoint;
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ if (existingGridftpEndpoint == null) {
+ gridftpEndpoint = new GridftpEndpoint();
+ gridftpEndpoint.setCreationTime(AiravataUtils.getCurrentTimestamp());
+ } else {
+ gridftpEndpoint = existingGridftpEndpoint;
+ gridftpEndpoint.setUpdateTime(AiravataUtils.getCurrentTimestamp());
+ }
+ gridftpEndpoint.setEndpoint(getEndpoint());
+ gridftpEndpoint.setDataMovementInterfaceId(getDataMovementInterfaceId());
+ GridftpDataMovement gridftpDataMovement = em.find(GridftpDataMovement.class, getDataMovementInterfaceId());
+ gridftpEndpoint.setGridftpDataMovement(gridftpDataMovement);
+ if (existingGridftpEndpoint == null) {
+ em.persist(gridftpEndpoint);
+ } else {
+ em.merge(gridftpEndpoint);
+ }
+ 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<String, String>) 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();
+ GridftpEndpoint gridftpEndpoint = em.find(GridftpEndpoint.class, new GridftpEndpoint_PK(ids.get(GridftpEndpointConstants.ENDPOINT), ids.get(GridftpEndpointConstants.DATA_MOVEMENT_INTERFACE_ID)));
+ em.close();
+ return gridftpEndpoint != null;
+ } 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();
+ }
+ }
+ }
+
+ public String getEndpoint() {
+ return endpoint;
+ }
+
+ public String getDataMovementInterfaceId() {
+ return dataMovementInterfaceId;
+ }
+
+ public GridftpDataMovementResource getGridftpDataMovementResource() {
+ return gridftpDataMovementResource;
+ }
+
+ public void setEndpoint(String endpoint) {
+ this.endpoint=endpoint;
+ }
+
+ public void setDataMovementInterfaceId(String dataMovementInterfaceId) {
+ this.dataMovementInterfaceId=dataMovementInterfaceId;
+ }
+
+ public void setGridftpDataMovementResource(GridftpDataMovementResource gridftpDataMovementResource) {
+ this.gridftpDataMovementResource=gridftpDataMovementResource;
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/HostAliasAppCatalogResourceAppCat.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/HostAliasAppCatalogResourceAppCat.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/HostAliasAppCatalogResourceAppCat.java
new file mode 100644
index 0000000..936b6c6
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/HostAliasAppCatalogResourceAppCat.java
@@ -0,0 +1,317 @@
+/**
+ * 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.ComputeResource;
+import org.apache.airavata.registry.core.app.catalog.model.HostAlias;
+import org.apache.airavata.registry.core.app.catalog.model.HostAliasPK;
+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.*;
+
+public class HostAliasAppCatalogResourceAppCat extends AppCatAbstractResource {
+
+ private final static Logger logger = LoggerFactory.getLogger(HostAliasAppCatalogResourceAppCat.class);
+
+ private String resourceID;
+ private String alias;
+ private ComputeResourceAppCatalogResourceAppCat computeHostResource;
+
+ public void remove(Object identifier) throws AppCatalogException {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator= new AppCatalogQueryGenerator(HOST_ALIAS);
+ generator.setParameter(HostAliasConstants.RESOURCE_ID, (String)identifier);
+// generator.setParameter(HostAliasConstants.ALIAS, ids.get(HostAliasConstants.ALIAS));
+ 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();
+ }
+ }
+ }
+
+ 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(HOST_ALIAS);
+ generator.setParameter(HostAliasConstants.RESOURCE_ID, ids.get(HostAliasConstants.RESOURCE_ID));
+ generator.setParameter(HostAliasConstants.ALIAS, ids.get(HostAliasConstants.ALIAS));
+ Query q = generator.selectQuery(em);
+ HostAlias hostAlias = (HostAlias) q.getSingleResult();
+ HostAliasAppCatalogResourceAppCat hostAliasResource =
+ (HostAliasAppCatalogResourceAppCat) AppCatalogJPAUtils.getResource(AppCatalogResourceType.HOST_ALIAS, hostAlias);
+ em.getTransaction().commit();
+ em.close();
+ return hostAliasResource;
+ } 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();
+ }
+ }
+ }
+
+ public List<AppCatalogResource> get(String fieldName, Object value) throws AppCatalogException {
+
+ List<AppCatalogResource> hostAliasResources = new ArrayList<AppCatalogResource>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ Query q;
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(HOST_ALIAS);
+ List results;
+ if (fieldName.equals(HostAliasConstants.ALIAS)) {
+ generator.setParameter(HostAliasConstants.ALIAS, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ HostAlias hostAlias = (HostAlias) result;
+ HostAliasAppCatalogResourceAppCat hostAliasResource =
+ (HostAliasAppCatalogResourceAppCat) AppCatalogJPAUtils.getResource(AppCatalogResourceType.HOST_ALIAS, hostAlias);
+ hostAliasResources.add(hostAliasResource);
+ }
+ }
+ } else if (fieldName.equals(HostAliasConstants.RESOURCE_ID)) {
+ generator.setParameter(HostAliasConstants.RESOURCE_ID, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ HostAlias hostAlias = (HostAlias) result;
+ HostAliasAppCatalogResourceAppCat hostAliasResource =
+ (HostAliasAppCatalogResourceAppCat) AppCatalogJPAUtils.getResource(AppCatalogResourceType.HOST_ALIAS, hostAlias);
+ hostAliasResources.add(hostAliasResource);
+ }
+ }
+ } else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for Host Alias Resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for Host Alias 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 hostAliasResources;
+ }
+
+ @Override
+ public List<AppCatalogResource> getAll() throws AppCatalogException {
+ return null;
+ }
+
+ @Override
+ public List<String> getAllIds() throws AppCatalogException {
+ return null;
+ }
+
+ public List<String> getIds(String fieldName, Object value) throws AppCatalogException {
+
+ List<String> hostAliasResourceIDs = new ArrayList<String>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ Query q;
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(HOST_ALIAS);
+ List results;
+ if (fieldName.equals(HostAliasConstants.ALIAS)) {
+ generator.setParameter(HostAliasConstants.ALIAS, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ HostAlias hostAlias = (HostAlias) result;
+ hostAliasResourceIDs.add(hostAlias.getResourceID());
+ }
+ }
+ } else if (fieldName.equals(HostAliasConstants.RESOURCE_ID)) {
+ generator.setParameter(HostAliasConstants.RESOURCE_ID, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ HostAlias hostAlias = (HostAlias) result;
+ hostAliasResourceIDs.add(hostAlias.getResourceID());
+ }
+ }
+ } else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for Host Alias resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for Host Alias 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 hostAliasResourceIDs;
+ }
+
+ public void save() throws AppCatalogException {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ HostAlias existingHostAlias = em.find(HostAlias.class, new HostAliasPK(resourceID, alias));
+ em.close();
+
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ ComputeResource computeResource = em.find(ComputeResource.class, resourceID);
+ if (existingHostAlias != null){
+ existingHostAlias.setAlias(alias);
+ existingHostAlias.setComputeResource(computeResource);
+ existingHostAlias.setResourceID(resourceID);
+ em.merge(existingHostAlias);
+ }else {
+ HostAlias hostAlias = new HostAlias();
+ hostAlias.setAlias(alias);
+ hostAlias.setResourceID(resourceID);
+ hostAlias.setComputeResource(computeResource);
+
+ em.persist(hostAlias);
+ }
+ 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();
+ }
+ }
+ }
+
+ 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();
+ HostAlias hostAlias = em.find(HostAlias.class, new HostAliasPK(ids.get(HostAliasConstants.RESOURCE_ID),
+ ids.get(HostAliasConstants.ALIAS)));
+
+ em.close();
+ return hostAlias != null;
+ } 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();
+ }
+ }
+
+ }
+
+ public String getResourceID() {
+ return resourceID;
+ }
+
+ public void setResourceID(String resourceID) {
+ this.resourceID = resourceID;
+ }
+
+ public String getAlias() {
+ return alias;
+ }
+
+ public void setAlias(String alias) {
+ this.alias = alias;
+ }
+
+ public ComputeResourceAppCatalogResourceAppCat getComputeHostResource() {
+ return computeHostResource;
+ }
+
+ public void setComputeHostResource(ComputeResourceAppCatalogResourceAppCat computeHostResource) {
+ this.computeHostResource = computeHostResource;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/HostAliasResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/HostAliasResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/HostAliasResource.java
new file mode 100644
index 0000000..f267a72
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/HostAliasResource.java
@@ -0,0 +1,317 @@
+/**
+ * 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.aiaravata.application.catalog.data.resources;
+
+import org.airavata.appcatalog.cpi.AppCatalogException;
+import org.apache.aiaravata.application.catalog.data.model.ComputeResource;
+import org.apache.aiaravata.application.catalog.data.model.HostAlias;
+import org.apache.aiaravata.application.catalog.data.model.HostAliasPK;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogJPAUtils;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogQueryGenerator;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogResourceType;
+import org.apache.airavata.common.exception.ApplicationSettingsException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.persistence.EntityManager;
+import javax.persistence.Query;
+import java.util.*;
+
+public class HostAliasResource extends AbstractResource {
+
+ private final static Logger logger = LoggerFactory.getLogger(HostAliasResource.class);
+
+ private String resourceID;
+ private String alias;
+ private ComputeResourceResource computeHostResource;
+
+ public void remove(Object identifier) throws AppCatalogException {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator= new AppCatalogQueryGenerator(HOST_ALIAS);
+ generator.setParameter(HostAliasConstants.RESOURCE_ID, (String)identifier);
+// generator.setParameter(HostAliasConstants.ALIAS, ids.get(HostAliasConstants.ALIAS));
+ 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();
+ }
+ }
+ }
+
+ public Resource 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(HOST_ALIAS);
+ generator.setParameter(HostAliasConstants.RESOURCE_ID, ids.get(HostAliasConstants.RESOURCE_ID));
+ generator.setParameter(HostAliasConstants.ALIAS, ids.get(HostAliasConstants.ALIAS));
+ Query q = generator.selectQuery(em);
+ HostAlias hostAlias = (HostAlias) q.getSingleResult();
+ HostAliasResource hostAliasResource =
+ (HostAliasResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.HOST_ALIAS, hostAlias);
+ em.getTransaction().commit();
+ em.close();
+ return hostAliasResource;
+ } 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();
+ }
+ }
+ }
+
+ public List<Resource> get(String fieldName, Object value) throws AppCatalogException {
+
+ List<Resource> hostAliasResources = new ArrayList<Resource>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ Query q;
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(HOST_ALIAS);
+ List results;
+ if (fieldName.equals(HostAliasConstants.ALIAS)) {
+ generator.setParameter(HostAliasConstants.ALIAS, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ HostAlias hostAlias = (HostAlias) result;
+ HostAliasResource hostAliasResource =
+ (HostAliasResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.HOST_ALIAS, hostAlias);
+ hostAliasResources.add(hostAliasResource);
+ }
+ }
+ } else if (fieldName.equals(HostAliasConstants.RESOURCE_ID)) {
+ generator.setParameter(HostAliasConstants.RESOURCE_ID, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ HostAlias hostAlias = (HostAlias) result;
+ HostAliasResource hostAliasResource =
+ (HostAliasResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.HOST_ALIAS, hostAlias);
+ hostAliasResources.add(hostAliasResource);
+ }
+ }
+ } else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for Host Alias Resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for Host Alias 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 hostAliasResources;
+ }
+
+ @Override
+ public List<Resource> getAll() throws AppCatalogException {
+ return null;
+ }
+
+ @Override
+ public List<String> getAllIds() throws AppCatalogException {
+ return null;
+ }
+
+ public List<String> getIds(String fieldName, Object value) throws AppCatalogException {
+
+ List<String> hostAliasResourceIDs = new ArrayList<String>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ Query q;
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(HOST_ALIAS);
+ List results;
+ if (fieldName.equals(HostAliasConstants.ALIAS)) {
+ generator.setParameter(HostAliasConstants.ALIAS, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ HostAlias hostAlias = (HostAlias) result;
+ hostAliasResourceIDs.add(hostAlias.getResourceID());
+ }
+ }
+ } else if (fieldName.equals(HostAliasConstants.RESOURCE_ID)) {
+ generator.setParameter(HostAliasConstants.RESOURCE_ID, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ HostAlias hostAlias = (HostAlias) result;
+ hostAliasResourceIDs.add(hostAlias.getResourceID());
+ }
+ }
+ } else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for Host Alias resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for Host Alias 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 hostAliasResourceIDs;
+ }
+
+ public void save() throws AppCatalogException {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ HostAlias existingHostAlias = em.find(HostAlias.class, new HostAliasPK(resourceID, alias));
+ em.close();
+
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ ComputeResource computeResource = em.find(ComputeResource.class, resourceID);
+ if (existingHostAlias != null){
+ existingHostAlias.setAlias(alias);
+ existingHostAlias.setComputeResource(computeResource);
+ existingHostAlias.setResourceID(resourceID);
+ em.merge(existingHostAlias);
+ }else {
+ HostAlias hostAlias = new HostAlias();
+ hostAlias.setAlias(alias);
+ hostAlias.setResourceID(resourceID);
+ hostAlias.setComputeResource(computeResource);
+
+ em.persist(hostAlias);
+ }
+ 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();
+ }
+ }
+ }
+
+ 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();
+ HostAlias hostAlias = em.find(HostAlias.class, new HostAliasPK(ids.get(HostAliasConstants.RESOURCE_ID),
+ ids.get(HostAliasConstants.ALIAS)));
+
+ em.close();
+ return hostAlias != null;
+ } 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();
+ }
+ }
+
+ }
+
+ public String getResourceID() {
+ return resourceID;
+ }
+
+ public void setResourceID(String resourceID) {
+ this.resourceID = resourceID;
+ }
+
+ public String getAlias() {
+ return alias;
+ }
+
+ public void setAlias(String alias) {
+ this.alias = alias;
+ }
+
+ public ComputeResourceResource getComputeHostResource() {
+ return computeHostResource;
+ }
+
+ public void setComputeHostResource(ComputeResourceResource computeHostResource) {
+ this.computeHostResource = computeHostResource;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/HostIPAddressAppCatalogResourceAppCat.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/HostIPAddressAppCatalogResourceAppCat.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/HostIPAddressAppCatalogResourceAppCat.java
new file mode 100644
index 0000000..e32fc36
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/HostIPAddressAppCatalogResourceAppCat.java
@@ -0,0 +1,318 @@
+/**
+ * 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.ComputeResource;
+import org.apache.airavata.registry.core.app.catalog.model.HostIPAddress;
+import org.apache.airavata.registry.core.app.catalog.model.HostIPAddressPK;
+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 HostIPAddressAppCatalogResourceAppCat extends AppCatAbstractResource {
+
+ private final static Logger logger = LoggerFactory.getLogger(HostIPAddressAppCatalogResourceAppCat.class);
+
+ private String resourceID;
+ private String ipaddress;
+ private ComputeResourceAppCatalogResourceAppCat computeHostResource;
+
+ public void remove(Object identifier) throws AppCatalogException {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator= new AppCatalogQueryGenerator(HOST_IPADDRESS);
+ generator.setParameter(HostIPAddressConstants.RESOURCE_ID, identifier);
+ 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();
+ }
+ }
+
+ }
+
+ 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(HOST_IPADDRESS);
+ generator.setParameter(HostIPAddressConstants.RESOURCE_ID, ids.get(HostIPAddressConstants.RESOURCE_ID));
+ generator.setParameter(HostIPAddressConstants.IP_ADDRESS, ids.get(HostIPAddressConstants.IP_ADDRESS));
+ Query q = generator.selectQuery(em);
+ HostIPAddress hostIPAddress = (HostIPAddress) q.getSingleResult();
+ HostIPAddressAppCatalogResourceAppCat hostIPAddressResource =
+ (HostIPAddressAppCatalogResourceAppCat) AppCatalogJPAUtils.getResource(AppCatalogResourceType.HOST_IPADDRESS, hostIPAddress);
+ em.getTransaction().commit();
+ em.close();
+ return hostIPAddressResource;
+ } 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();
+ }
+ }
+ }
+
+ public List<AppCatalogResource> get(String fieldName, Object value) throws AppCatalogException {
+
+ List<AppCatalogResource> hostIPAddressResources = new ArrayList<AppCatalogResource>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ Query q;
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(HOST_IPADDRESS);
+ List results;
+ if (fieldName.equals(HostIPAddressConstants.IP_ADDRESS)) {
+ generator.setParameter(HostIPAddressConstants.IP_ADDRESS, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ HostIPAddress hostIPAddress = (HostIPAddress) result;
+ HostIPAddressAppCatalogResourceAppCat hostIPAddressResource =
+ (HostIPAddressAppCatalogResourceAppCat) AppCatalogJPAUtils.getResource(AppCatalogResourceType.HOST_IPADDRESS, hostIPAddress);
+ hostIPAddressResources.add(hostIPAddressResource);
+ }
+ }
+ } else if (fieldName.equals(HostIPAddressConstants.RESOURCE_ID)) {
+ generator.setParameter(HostIPAddressConstants.RESOURCE_ID, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ HostIPAddress hostIPAddress = (HostIPAddress) result;
+ HostIPAddressAppCatalogResourceAppCat hostIPAddressResource =
+ (HostIPAddressAppCatalogResourceAppCat) AppCatalogJPAUtils.getResource(AppCatalogResourceType.HOST_IPADDRESS, hostIPAddress);
+ hostIPAddressResources.add(hostIPAddressResource);
+ }
+ }
+ } else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for Host IPAddress Resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for Host IPAddress 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 hostIPAddressResources;
+ }
+
+ @Override
+ public List<AppCatalogResource> getAll() throws AppCatalogException {
+ return null;
+ }
+
+ @Override
+ public List<String> getAllIds() throws AppCatalogException {
+ return null;
+ }
+
+ public List<String> getIds(String fieldName, Object value) throws AppCatalogException {
+
+ List<String> hostIPAddressResourceIDs = new ArrayList<String>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ Query q;
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(HOST_IPADDRESS);
+ List results;
+ if (fieldName.equals(HostIPAddressConstants.IP_ADDRESS)) {
+ generator.setParameter(HostIPAddressConstants.IP_ADDRESS, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ HostIPAddress hostIPAddress = (HostIPAddress) result;
+ hostIPAddressResourceIDs.add(hostIPAddress.getResourceID());
+ }
+ }
+ } else if (fieldName.equals(HostIPAddressConstants.RESOURCE_ID)) {
+ generator.setParameter(HostIPAddressConstants.RESOURCE_ID, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ HostIPAddress hostIPAddress = (HostIPAddress) result;
+ hostIPAddressResourceIDs.add(hostIPAddress.getResourceID());
+ }
+ }
+ } else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for Host IP Address resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for Host IPAddress 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 hostIPAddressResourceIDs;
+ }
+
+ public void save() throws AppCatalogException {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ HostIPAddress existingHostIP = em.find(HostIPAddress.class, new HostIPAddressPK(resourceID,ipaddress));
+ em.close();
+
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ ComputeResource computeResource = em.find(ComputeResource.class, resourceID);
+ if (existingHostIP != null){
+ existingHostIP.setIpaddress(ipaddress);
+ existingHostIP.setResourceID(resourceID);
+ existingHostIP.setComputeResource(computeResource);
+ em.merge(existingHostIP);
+ }else {
+ HostIPAddress hostIPAddress = new HostIPAddress();
+ hostIPAddress.setIpaddress(ipaddress);
+ hostIPAddress.setResourceID(resourceID);
+ hostIPAddress.setComputeResource(computeResource);
+ em.persist(hostIPAddress);
+ }
+ 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();
+ }
+ }
+
+ }
+
+ 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();
+ HostIPAddress hostIPAddress = em.find(HostIPAddress.class, new HostIPAddressPK(ids.get(HostIPAddressConstants.RESOURCE_ID),
+ ids.get(HostIPAddressConstants.IP_ADDRESS)));
+
+ em.close();
+ return hostIPAddress != null;
+ } 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();
+ }
+ }
+ }
+
+ public String getResourceID() {
+ return resourceID;
+ }
+
+ public void setResourceID(String resourceID) {
+ this.resourceID = resourceID;
+ }
+
+ public String getIpaddress() {
+ return ipaddress;
+ }
+
+ public void setIpaddress(String ipaddress) {
+ this.ipaddress = ipaddress;
+ }
+
+ public ComputeResourceAppCatalogResourceAppCat getComputeHostResource() {
+ return computeHostResource;
+ }
+
+ public void setComputeHostResource(ComputeResourceAppCatalogResourceAppCat computeHostResource) {
+ this.computeHostResource = computeHostResource;
+ }
+}
[04/52] [abbrv] [partial] airavata git commit: registry refactoring
Posted by sh...@apache.org.
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/WorkflowInputAppCatalogResourceAppCat.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/WorkflowInputAppCatalogResourceAppCat.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/WorkflowInputAppCatalogResourceAppCat.java
new file mode 100644
index 0000000..89a34f4
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/WorkflowInputAppCatalogResourceAppCat.java
@@ -0,0 +1,451 @@
+/**
+ * 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.Workflow;
+import org.apache.airavata.registry.core.app.catalog.model.WorkflowInput;
+import org.apache.airavata.registry.core.app.catalog.model.WorkflowInput_PK;
+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 WorkflowInputAppCatalogResourceAppCat extends AppCatAbstractResource {
+
+ private final static Logger logger = LoggerFactory.getLogger(WorkflowInputAppCatalogResourceAppCat.class);
+
+ private String wfTemplateId;
+ private String inputKey;
+ private String dataType;
+ private String inputVal;
+ private String metadata;
+ private String appArgument;
+ private String userFriendlyDesc;
+ private boolean standardInput;
+ private int inputOrder;
+ private boolean isRequired;
+ private boolean requiredToCMD;
+ private boolean dataStaged;
+
+ private WorkflowAppCatalogResourceAppCat workflowResource;
+
+ 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(WORKFLOW_INPUT);
+ generator.setParameter(WFInputConstants.WF_TEMPLATE_ID, ids.get(WFInputConstants.WF_TEMPLATE_ID));
+ generator.setParameter(WFInputConstants.INPUT_KEY, ids.get(WFInputConstants.INPUT_KEY));
+ 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();
+ }
+ }
+ }
+
+ public AppCatalogResource get(Object identifier) throws AppCatalogException {
+ HashMap<String, String> ids;
+ if (identifier instanceof Map) {
+ ids = (HashMap<String, String>) 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(WORKFLOW_INPUT);
+ generator.setParameter(WFInputConstants.WF_TEMPLATE_ID, ids.get(WFInputConstants.WF_TEMPLATE_ID));
+ generator.setParameter(WFInputConstants.INPUT_KEY, ids.get(WFInputConstants.INPUT_KEY));
+ Query q = generator.selectQuery(em);
+ WorkflowInput workflowInput = (WorkflowInput) q.getSingleResult();
+ WorkflowInputAppCatalogResourceAppCat workflowInputResource =
+ (WorkflowInputAppCatalogResourceAppCat) AppCatalogJPAUtils.getResource(AppCatalogResourceType.WORKFLOW_INPUT
+ , workflowInput);
+ em.getTransaction().commit();
+ em.close();
+ return workflowInputResource;
+ } 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();
+ }
+ }
+ }
+
+ public List<AppCatalogResource> get(String fieldName, Object value) throws AppCatalogException {
+ List<AppCatalogResource> wfInputResources = new ArrayList<AppCatalogResource>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ Query q;
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(WORKFLOW_INPUT);
+ List results;
+ if (fieldName.equals(WFInputConstants.WF_TEMPLATE_ID)) {
+ generator.setParameter(WFInputConstants.WF_TEMPLATE_ID, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ WorkflowInput workflowInput = (WorkflowInput) result;
+ WorkflowInputAppCatalogResourceAppCat workflowInputResource =
+ (WorkflowInputAppCatalogResourceAppCat) AppCatalogJPAUtils.getResource(
+ AppCatalogResourceType.WORKFLOW_INPUT, workflowInput);
+ wfInputResources.add(workflowInputResource);
+ }
+ }
+ } else if (fieldName.equals(WFInputConstants.INPUT_KEY)) {
+ generator.setParameter(WFInputConstants.INPUT_KEY, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ WorkflowInput workflowInput = (WorkflowInput) result;
+ WorkflowInputAppCatalogResourceAppCat workflowInputResource =
+ (WorkflowInputAppCatalogResourceAppCat) AppCatalogJPAUtils.getResource(
+ AppCatalogResourceType.WORKFLOW_INPUT, workflowInput);
+ wfInputResources.add(workflowInputResource);
+ }
+ }
+ } else if (fieldName.equals(WFInputConstants.DATA_TYPE)) {
+ generator.setParameter(WFInputConstants.DATA_TYPE, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ WorkflowInput workflowInput = (WorkflowInput) result;
+ WorkflowInputAppCatalogResourceAppCat workflowInputResource =
+ (WorkflowInputAppCatalogResourceAppCat) AppCatalogJPAUtils.getResource(
+ AppCatalogResourceType.WORKFLOW_INPUT, workflowInput);
+ wfInputResources.add(workflowInputResource);
+ }
+ }
+ } else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for WFInput Resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for WFInput 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 wfInputResources;
+ }
+
+ public List<AppCatalogResource> getAll() throws AppCatalogException {
+ return null;
+ }
+
+ public List<String> getAllIds() throws AppCatalogException {
+ return null;
+ }
+
+ public List<String> getIds(String fieldName, Object value) throws AppCatalogException {
+ List<String> wfInputResourceIDs = new ArrayList<String>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ Query q;
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(WORKFLOW_INPUT);
+ List results;
+ if (fieldName.equals(WFInputConstants.WF_TEMPLATE_ID)) {
+ generator.setParameter(WFInputConstants.WF_TEMPLATE_ID, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ WorkflowInput workflowInput = (WorkflowInput) result;
+ wfInputResourceIDs.add(workflowInput.getWfTemplateId());
+ }
+ }
+ } else if (fieldName.equals(WFInputConstants.INPUT_KEY)) {
+ generator.setParameter(WFInputConstants.INPUT_KEY, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ WorkflowInput workflowInput = (WorkflowInput) result;
+ wfInputResourceIDs.add(workflowInput.getWfTemplateId());
+ }
+ }
+ } else if (fieldName.equals(WFInputConstants.DATA_TYPE)) {
+ generator.setParameter(WFInputConstants.DATA_TYPE, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ WorkflowInput workflowInput = (WorkflowInput) result;
+ wfInputResourceIDs.add(workflowInput.getWfTemplateId());
+ }
+ }
+ } else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for WFInput resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for WFInput 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 wfInputResourceIDs;
+ }
+
+ public void save() throws AppCatalogException {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ WorkflowInput existingWFInput = em.find(WorkflowInput.class, new WorkflowInput_PK(wfTemplateId, inputKey));
+ em.close();
+ WorkflowInput workflowInput;
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ if (existingWFInput == null) {
+ workflowInput = new WorkflowInput();
+ } else {
+ workflowInput=existingWFInput;
+ }
+ workflowInput.setWfTemplateId(wfTemplateId);
+ Workflow workflow = em.find(Workflow.class, wfTemplateId);
+ workflowInput.setWorkflow(workflow);
+ workflowInput.setDataType(dataType);
+ workflowInput.setInputKey(inputKey);
+ if (inputVal != null){
+ workflowInput.setInputVal(inputVal.toCharArray());
+ }
+ workflowInput.setMetadata(metadata);
+ workflowInput.setAppArgument(appArgument);
+ workflowInput.setUserFriendlyDesc(userFriendlyDesc);
+ workflowInput.setStandardInput(standardInput);
+ workflowInput.setRequiredToCMD(requiredToCMD);
+ workflowInput.setRequired(isRequired);
+ workflowInput.setDataStaged(dataStaged);
+ if (existingWFInput == null) {
+ em.persist(workflowInput);
+ } else {
+ em.merge(workflowInput);
+ }
+ 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();
+ }
+ }
+ }
+
+ public boolean isExists(Object identifier) throws AppCatalogException {
+ HashMap<String, String> ids;
+ if (identifier instanceof Map) {
+ ids = (HashMap<String, String>) 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();
+ WorkflowInput workflowInput = em.find(WorkflowInput.class, new WorkflowInput_PK(
+ ids.get(WFInputConstants.WF_TEMPLATE_ID),
+ ids.get(WFInputConstants.INPUT_KEY)));
+
+ em.close();
+ return workflowInput != null;
+ } 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();
+ }
+ }
+ }
+
+ public String getWfTemplateId() {
+ return wfTemplateId;
+ }
+
+ public void setWfTemplateId(String wfTemplateId) {
+ this.wfTemplateId = wfTemplateId;
+ }
+
+ public String getInputKey() {
+ return inputKey;
+ }
+
+ public void setInputKey(String inputKey) {
+ this.inputKey = inputKey;
+ }
+
+ public String getDataType() {
+ return dataType;
+ }
+
+ public void setDataType(String dataType) {
+ this.dataType = dataType;
+ }
+
+ public String getInputVal() {
+ return inputVal;
+ }
+
+ public void setInputVal(String inputVal) {
+ this.inputVal = inputVal;
+ }
+
+ public String getMetadata() {
+ return metadata;
+ }
+
+ public void setMetadata(String metadata) {
+ this.metadata = metadata;
+ }
+
+ public String getAppArgument() {
+ return appArgument;
+ }
+
+ public void setAppArgument(String appArgument) {
+ this.appArgument = appArgument;
+ }
+
+ public String getUserFriendlyDesc() {
+ return userFriendlyDesc;
+ }
+
+ public void setUserFriendlyDesc(String userFriendlyDesc) {
+ this.userFriendlyDesc = userFriendlyDesc;
+ }
+
+ public WorkflowAppCatalogResourceAppCat getWorkflowResource() {
+ return workflowResource;
+ }
+
+ public void setWorkflowResource(WorkflowAppCatalogResourceAppCat workflowResource) {
+ this.workflowResource = workflowResource;
+ }
+
+ public boolean isStandardInput() {
+ return standardInput;
+ }
+
+ public void setStandardInput(boolean standardInput) {
+ this.standardInput = standardInput;
+ }
+
+ public int getInputOrder() {
+ return inputOrder;
+ }
+
+ public void setInputOrder(int inputOrder) {
+ this.inputOrder = inputOrder;
+ }
+
+ public boolean getRequired() {
+ return isRequired;
+ }
+
+ public void setRequired(boolean required) {
+ this.isRequired = required;
+ }
+
+ public boolean getRequiredToCMD() {
+ return requiredToCMD;
+ }
+
+ public void setRequiredToCMD(boolean requiredToCMD) {
+ this.requiredToCMD = requiredToCMD;
+ }
+
+ public boolean isDataStaged() {
+ return dataStaged;
+ }
+
+ public void setDataStaged(boolean dataStaged) {
+ this.dataStaged = dataStaged;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/WorkflowInputResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/WorkflowInputResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/WorkflowInputResource.java
new file mode 100644
index 0000000..ac22744
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/WorkflowInputResource.java
@@ -0,0 +1,451 @@
+/**
+ * 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.aiaravata.application.catalog.data.resources;
+
+import org.airavata.appcatalog.cpi.AppCatalogException;
+import org.apache.aiaravata.application.catalog.data.model.Workflow;
+import org.apache.aiaravata.application.catalog.data.model.WorkflowInput;
+import org.apache.aiaravata.application.catalog.data.model.WorkflowInput_PK;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogJPAUtils;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogQueryGenerator;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogResourceType;
+import org.apache.airavata.common.exception.ApplicationSettingsException;
+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 WorkflowInputResource extends AbstractResource {
+
+ private final static Logger logger = LoggerFactory.getLogger(WorkflowInputResource.class);
+
+ private String wfTemplateId;
+ private String inputKey;
+ private String dataType;
+ private String inputVal;
+ private String metadata;
+ private String appArgument;
+ private String userFriendlyDesc;
+ private boolean standardInput;
+ private int inputOrder;
+ private boolean isRequired;
+ private boolean requiredToCMD;
+ private boolean dataStaged;
+
+ private WorkflowResource workflowResource;
+
+ 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(WORKFLOW_INPUT);
+ generator.setParameter(WFInputConstants.WF_TEMPLATE_ID, ids.get(WFInputConstants.WF_TEMPLATE_ID));
+ generator.setParameter(WFInputConstants.INPUT_KEY, ids.get(WFInputConstants.INPUT_KEY));
+ 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();
+ }
+ }
+ }
+
+ public Resource get(Object identifier) throws AppCatalogException {
+ HashMap<String, String> ids;
+ if (identifier instanceof Map) {
+ ids = (HashMap<String, String>) 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(WORKFLOW_INPUT);
+ generator.setParameter(WFInputConstants.WF_TEMPLATE_ID, ids.get(WFInputConstants.WF_TEMPLATE_ID));
+ generator.setParameter(WFInputConstants.INPUT_KEY, ids.get(WFInputConstants.INPUT_KEY));
+ Query q = generator.selectQuery(em);
+ WorkflowInput workflowInput = (WorkflowInput) q.getSingleResult();
+ WorkflowInputResource workflowInputResource =
+ (WorkflowInputResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.WORKFLOW_INPUT
+ , workflowInput);
+ em.getTransaction().commit();
+ em.close();
+ return workflowInputResource;
+ } 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();
+ }
+ }
+ }
+
+ public List<Resource> get(String fieldName, Object value) throws AppCatalogException {
+ List<Resource> wfInputResources = new ArrayList<Resource>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ Query q;
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(WORKFLOW_INPUT);
+ List results;
+ if (fieldName.equals(WFInputConstants.WF_TEMPLATE_ID)) {
+ generator.setParameter(WFInputConstants.WF_TEMPLATE_ID, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ WorkflowInput workflowInput = (WorkflowInput) result;
+ WorkflowInputResource workflowInputResource =
+ (WorkflowInputResource) AppCatalogJPAUtils.getResource(
+ AppCatalogResourceType.WORKFLOW_INPUT, workflowInput);
+ wfInputResources.add(workflowInputResource);
+ }
+ }
+ } else if (fieldName.equals(WFInputConstants.INPUT_KEY)) {
+ generator.setParameter(WFInputConstants.INPUT_KEY, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ WorkflowInput workflowInput = (WorkflowInput) result;
+ WorkflowInputResource workflowInputResource =
+ (WorkflowInputResource) AppCatalogJPAUtils.getResource(
+ AppCatalogResourceType.WORKFLOW_INPUT, workflowInput);
+ wfInputResources.add(workflowInputResource);
+ }
+ }
+ } else if (fieldName.equals(WFInputConstants.DATA_TYPE)) {
+ generator.setParameter(WFInputConstants.DATA_TYPE, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ WorkflowInput workflowInput = (WorkflowInput) result;
+ WorkflowInputResource workflowInputResource =
+ (WorkflowInputResource) AppCatalogJPAUtils.getResource(
+ AppCatalogResourceType.WORKFLOW_INPUT, workflowInput);
+ wfInputResources.add(workflowInputResource);
+ }
+ }
+ } else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for WFInput Resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for WFInput 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 wfInputResources;
+ }
+
+ public List<Resource> getAll() throws AppCatalogException {
+ return null;
+ }
+
+ public List<String> getAllIds() throws AppCatalogException {
+ return null;
+ }
+
+ public List<String> getIds(String fieldName, Object value) throws AppCatalogException {
+ List<String> wfInputResourceIDs = new ArrayList<String>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ Query q;
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(WORKFLOW_INPUT);
+ List results;
+ if (fieldName.equals(WFInputConstants.WF_TEMPLATE_ID)) {
+ generator.setParameter(WFInputConstants.WF_TEMPLATE_ID, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ WorkflowInput workflowInput = (WorkflowInput) result;
+ wfInputResourceIDs.add(workflowInput.getWfTemplateId());
+ }
+ }
+ } else if (fieldName.equals(WFInputConstants.INPUT_KEY)) {
+ generator.setParameter(WFInputConstants.INPUT_KEY, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ WorkflowInput workflowInput = (WorkflowInput) result;
+ wfInputResourceIDs.add(workflowInput.getWfTemplateId());
+ }
+ }
+ } else if (fieldName.equals(WFInputConstants.DATA_TYPE)) {
+ generator.setParameter(WFInputConstants.DATA_TYPE, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ WorkflowInput workflowInput = (WorkflowInput) result;
+ wfInputResourceIDs.add(workflowInput.getWfTemplateId());
+ }
+ }
+ } else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for WFInput resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for WFInput 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 wfInputResourceIDs;
+ }
+
+ public void save() throws AppCatalogException {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ WorkflowInput existingWFInput = em.find(WorkflowInput.class, new WorkflowInput_PK(wfTemplateId, inputKey));
+ em.close();
+ WorkflowInput workflowInput;
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ if (existingWFInput == null) {
+ workflowInput = new WorkflowInput();
+ } else {
+ workflowInput=existingWFInput;
+ }
+ workflowInput.setWfTemplateId(wfTemplateId);
+ Workflow workflow = em.find(Workflow.class, wfTemplateId);
+ workflowInput.setWorkflow(workflow);
+ workflowInput.setDataType(dataType);
+ workflowInput.setInputKey(inputKey);
+ if (inputVal != null){
+ workflowInput.setInputVal(inputVal.toCharArray());
+ }
+ workflowInput.setMetadata(metadata);
+ workflowInput.setAppArgument(appArgument);
+ workflowInput.setUserFriendlyDesc(userFriendlyDesc);
+ workflowInput.setStandardInput(standardInput);
+ workflowInput.setRequiredToCMD(requiredToCMD);
+ workflowInput.setRequired(isRequired);
+ workflowInput.setDataStaged(dataStaged);
+ if (existingWFInput == null) {
+ em.persist(workflowInput);
+ } else {
+ em.merge(workflowInput);
+ }
+ 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();
+ }
+ }
+ }
+
+ public boolean isExists(Object identifier) throws AppCatalogException {
+ HashMap<String, String> ids;
+ if (identifier instanceof Map) {
+ ids = (HashMap<String, String>) 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();
+ WorkflowInput workflowInput = em.find(WorkflowInput.class, new WorkflowInput_PK(
+ ids.get(WFInputConstants.WF_TEMPLATE_ID),
+ ids.get(WFInputConstants.INPUT_KEY)));
+
+ em.close();
+ return workflowInput != null;
+ } 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();
+ }
+ }
+ }
+
+ public String getWfTemplateId() {
+ return wfTemplateId;
+ }
+
+ public void setWfTemplateId(String wfTemplateId) {
+ this.wfTemplateId = wfTemplateId;
+ }
+
+ public String getInputKey() {
+ return inputKey;
+ }
+
+ public void setInputKey(String inputKey) {
+ this.inputKey = inputKey;
+ }
+
+ public String getDataType() {
+ return dataType;
+ }
+
+ public void setDataType(String dataType) {
+ this.dataType = dataType;
+ }
+
+ public String getInputVal() {
+ return inputVal;
+ }
+
+ public void setInputVal(String inputVal) {
+ this.inputVal = inputVal;
+ }
+
+ public String getMetadata() {
+ return metadata;
+ }
+
+ public void setMetadata(String metadata) {
+ this.metadata = metadata;
+ }
+
+ public String getAppArgument() {
+ return appArgument;
+ }
+
+ public void setAppArgument(String appArgument) {
+ this.appArgument = appArgument;
+ }
+
+ public String getUserFriendlyDesc() {
+ return userFriendlyDesc;
+ }
+
+ public void setUserFriendlyDesc(String userFriendlyDesc) {
+ this.userFriendlyDesc = userFriendlyDesc;
+ }
+
+ public WorkflowResource getWorkflowResource() {
+ return workflowResource;
+ }
+
+ public void setWorkflowResource(WorkflowResource workflowResource) {
+ this.workflowResource = workflowResource;
+ }
+
+ public boolean isStandardInput() {
+ return standardInput;
+ }
+
+ public void setStandardInput(boolean standardInput) {
+ this.standardInput = standardInput;
+ }
+
+ public int getInputOrder() {
+ return inputOrder;
+ }
+
+ public void setInputOrder(int inputOrder) {
+ this.inputOrder = inputOrder;
+ }
+
+ public boolean getRequired() {
+ return isRequired;
+ }
+
+ public void setRequired(boolean required) {
+ this.isRequired = required;
+ }
+
+ public boolean getRequiredToCMD() {
+ return requiredToCMD;
+ }
+
+ public void setRequiredToCMD(boolean requiredToCMD) {
+ this.requiredToCMD = requiredToCMD;
+ }
+
+ public boolean isDataStaged() {
+ return dataStaged;
+ }
+
+ public void setDataStaged(boolean dataStaged) {
+ this.dataStaged = dataStaged;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/WorkflowOutputAppCatalogResourceAppCat.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/WorkflowOutputAppCatalogResourceAppCat.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/WorkflowOutputAppCatalogResourceAppCat.java
new file mode 100644
index 0000000..75f5f7e
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/WorkflowOutputAppCatalogResourceAppCat.java
@@ -0,0 +1,410 @@
+/**
+ * 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.Workflow;
+import org.apache.airavata.registry.core.app.catalog.model.WorkflowOutput;
+import org.apache.airavata.registry.core.app.catalog.model.WorkflowOutput_PK;
+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 WorkflowOutputAppCatalogResourceAppCat extends AppCatAbstractResource {
+ private final static Logger logger = LoggerFactory.getLogger(WorkflowOutputAppCatalogResourceAppCat.class);
+
+ private String wfTemplateId;
+ private String outputKey;
+ private String outputVal;
+ private String dataType;
+ private String validityType;
+ private boolean dataMovement;
+ private String dataNameLocation;
+
+ private WorkflowAppCatalogResourceAppCat workflowResource;
+
+ 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(WORKFLOW_OUTPUT);
+ generator.setParameter(WFOutputConstants.WF_TEMPLATE_ID, ids.get(WFOutputConstants.WF_TEMPLATE_ID));
+ generator.setParameter(WFOutputConstants.OUTPUT_KEY, ids.get(WFOutputConstants.OUTPUT_KEY));
+ 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();
+ }
+ }
+ }
+
+ 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(WORKFLOW_OUTPUT);
+ generator.setParameter(WFOutputConstants.WF_TEMPLATE_ID, ids.get(WFOutputConstants.WF_TEMPLATE_ID));
+ generator.setParameter(WFOutputConstants.OUTPUT_KEY, ids.get(WFOutputConstants.OUTPUT_KEY));
+ Query q = generator.selectQuery(em);
+ WorkflowOutput wfOutput = (WorkflowOutput) q.getSingleResult();
+ WorkflowOutputAppCatalogResourceAppCat workflowOutputResource =
+ (WorkflowOutputAppCatalogResourceAppCat) AppCatalogJPAUtils.getResource(AppCatalogResourceType.WORKFLOW_OUTPUT
+ , wfOutput);
+ em.getTransaction().commit();
+ em.close();
+ return workflowOutputResource;
+ } 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();
+ }
+ }
+ }
+
+ public List<AppCatalogResource> get(String fieldName, Object value) throws AppCatalogException {
+ List<AppCatalogResource> wfOutputResources = new ArrayList<AppCatalogResource>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ Query q;
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(WORKFLOW_OUTPUT);
+ List results;
+ if (fieldName.equals(WFOutputConstants.WF_TEMPLATE_ID)) {
+ generator.setParameter(WFOutputConstants.WF_TEMPLATE_ID, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ WorkflowOutput wfOutput = (WorkflowOutput) result;
+ WorkflowOutputAppCatalogResourceAppCat workflowOutputResource =
+ (WorkflowOutputAppCatalogResourceAppCat) AppCatalogJPAUtils.getResource(
+ AppCatalogResourceType.WORKFLOW_OUTPUT, wfOutput);
+ wfOutputResources.add(workflowOutputResource);
+ }
+ }
+ } else if (fieldName.equals(WFOutputConstants.OUTPUT_KEY)) {
+ generator.setParameter(WFOutputConstants.OUTPUT_KEY, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ WorkflowOutput workflowOutput = (WorkflowOutput) result;
+ WorkflowOutputAppCatalogResourceAppCat workflowOutputResource =
+ (WorkflowOutputAppCatalogResourceAppCat) AppCatalogJPAUtils.getResource(
+ AppCatalogResourceType.WORKFLOW_OUTPUT, workflowOutput);
+ wfOutputResources.add(workflowOutputResource);
+ }
+ }
+ } else if (fieldName.equals(WFOutputConstants.DATA_TYPE)) {
+ generator.setParameter(WFOutputConstants.DATA_TYPE, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ WorkflowOutput workflowOutput = (WorkflowOutput) result;
+ WorkflowOutputAppCatalogResourceAppCat workflowOutputResource =
+ (WorkflowOutputAppCatalogResourceAppCat) AppCatalogJPAUtils.getResource(
+ AppCatalogResourceType.WORKFLOW_OUTPUT, workflowOutput);
+ wfOutputResources.add(workflowOutputResource);
+ }
+ }
+ } else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for WF Output Resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for WF Output 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 wfOutputResources;
+ }
+
+ public List<AppCatalogResource> getAll() throws AppCatalogException {
+ return null;
+ }
+
+ public List<String> getAllIds() throws AppCatalogException {
+ return null;
+ }
+
+ public List<String> getIds(String fieldName, Object value) throws AppCatalogException {
+ List<String> wfOutputResourceIDs = new ArrayList<String>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ Query q;
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(WORKFLOW_OUTPUT);
+ List results;
+ if (fieldName.equals(WFOutputConstants.WF_TEMPLATE_ID)) {
+ generator.setParameter(WFOutputConstants.WF_TEMPLATE_ID, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ WorkflowOutput workflowOutput = (WorkflowOutput) result;
+ wfOutputResourceIDs.add(workflowOutput.getWfTemplateId());
+ }
+ }
+ }
+ if (fieldName.equals(WFOutputConstants.OUTPUT_KEY)) {
+ generator.setParameter(WFOutputConstants.OUTPUT_KEY, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ WorkflowOutput workflowOutput = (WorkflowOutput) result;
+ wfOutputResourceIDs.add(workflowOutput.getWfTemplateId());
+ }
+ }
+ } else if (fieldName.equals(WFOutputConstants.DATA_TYPE)) {
+ generator.setParameter(WFOutputConstants.DATA_TYPE, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ WorkflowOutput workflowOutput = (WorkflowOutput) result;
+ wfOutputResourceIDs.add(workflowOutput.getWfTemplateId());
+ }
+ }
+ } else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for WF Output resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for WF Output 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 wfOutputResourceIDs;
+ }
+
+ public void save() throws AppCatalogException {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ WorkflowOutput existingWorkflowOutput = em.find(WorkflowOutput.class,
+ new WorkflowOutput_PK(wfTemplateId, outputKey));
+ em.close();
+
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ if (existingWorkflowOutput != null) {
+ existingWorkflowOutput.setWfTemplateId(wfTemplateId);
+ Workflow workflow = em.find(Workflow.class, wfTemplateId);
+ existingWorkflowOutput.setWorkflow(workflow);
+ existingWorkflowOutput.setDataType(dataType);
+ existingWorkflowOutput.setOutputKey(outputKey);
+ if (outputVal != null){
+ existingWorkflowOutput.setOutputVal(outputVal.toCharArray());
+ }
+ existingWorkflowOutput.setValidityType(validityType);
+ existingWorkflowOutput.setDataMovement(dataMovement);
+ existingWorkflowOutput.setDataNameLocation(dataNameLocation);
+ em.merge(existingWorkflowOutput);
+ } else {
+ WorkflowOutput workflowOutput = new WorkflowOutput();
+ workflowOutput.setWfTemplateId(wfTemplateId);
+ Workflow workflow = em.find(Workflow.class, wfTemplateId);
+ workflowOutput.setWorkflow(workflow);
+ workflowOutput.setDataType(dataType);
+ workflowOutput.setOutputKey(outputKey);
+ if (outputVal != null){
+ workflowOutput.setOutputVal(outputVal.toCharArray());
+ }
+ workflowOutput.setValidityType(validityType);
+ workflowOutput.setDataMovement(dataMovement);
+ workflowOutput.setDataNameLocation(dataNameLocation);
+ em.persist(workflowOutput);
+ }
+ 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();
+ }
+ }
+ }
+
+ 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();
+ WorkflowOutput workflowOutput = em.find(WorkflowOutput.class, new WorkflowOutput_PK(
+ ids.get(WFOutputConstants.WF_TEMPLATE_ID),
+ ids.get(WFOutputConstants.OUTPUT_KEY)));
+
+ em.close();
+ return workflowOutput != null;
+ } 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();
+ }
+ }
+ }
+
+ public String getWfTemplateId() {
+ return wfTemplateId;
+ }
+
+ public void setWfTemplateId(String wfTemplateId) {
+ this.wfTemplateId = wfTemplateId;
+ }
+
+ public String getOutputKey() {
+ return outputKey;
+ }
+
+ public void setOutputKey(String outputKey) {
+ this.outputKey = outputKey;
+ }
+
+ public String getOutputVal() {
+ return outputVal;
+ }
+
+ public void setOutputVal(String outputVal) {
+ this.outputVal = outputVal;
+ }
+
+ public String getDataType() {
+ return dataType;
+ }
+
+ public void setDataType(String dataType) {
+ this.dataType = dataType;
+ }
+
+ public WorkflowAppCatalogResourceAppCat getWorkflowResource() {
+ return workflowResource;
+ }
+
+ public void setWorkflowResource(WorkflowAppCatalogResourceAppCat workflowResource) {
+ this.workflowResource = workflowResource;
+ }
+
+ public String getValidityType() {
+ return validityType;
+ }
+
+ public void setValidityType(String validityType) {
+ this.validityType = validityType;
+ }
+
+ public boolean isDataMovement() {
+ return dataMovement;
+ }
+
+ public void setDataMovement(boolean dataMovement) {
+ this.dataMovement = dataMovement;
+ }
+
+ public String getDataNameLocation() {
+ return dataNameLocation;
+ }
+
+ public void setDataNameLocation(String dataNameLocation) {
+ this.dataNameLocation = dataNameLocation;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/WorkflowOutputResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/WorkflowOutputResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/WorkflowOutputResource.java
new file mode 100644
index 0000000..7f180bd
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/WorkflowOutputResource.java
@@ -0,0 +1,410 @@
+/**
+ * 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.aiaravata.application.catalog.data.resources;
+
+import org.airavata.appcatalog.cpi.AppCatalogException;
+import org.apache.aiaravata.application.catalog.data.model.Workflow;
+import org.apache.aiaravata.application.catalog.data.model.WorkflowOutput;
+import org.apache.aiaravata.application.catalog.data.model.WorkflowOutput_PK;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogJPAUtils;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogQueryGenerator;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogResourceType;
+import org.apache.airavata.common.exception.ApplicationSettingsException;
+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 WorkflowOutputResource extends AbstractResource {
+ private final static Logger logger = LoggerFactory.getLogger(WorkflowOutputResource.class);
+
+ private String wfTemplateId;
+ private String outputKey;
+ private String outputVal;
+ private String dataType;
+ private String validityType;
+ private boolean dataMovement;
+ private String dataNameLocation;
+
+ private WorkflowResource workflowResource;
+
+ 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(WORKFLOW_OUTPUT);
+ generator.setParameter(WFOutputConstants.WF_TEMPLATE_ID, ids.get(WFOutputConstants.WF_TEMPLATE_ID));
+ generator.setParameter(WFOutputConstants.OUTPUT_KEY, ids.get(WFOutputConstants.OUTPUT_KEY));
+ 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();
+ }
+ }
+ }
+
+ public Resource 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(WORKFLOW_OUTPUT);
+ generator.setParameter(WFOutputConstants.WF_TEMPLATE_ID, ids.get(WFOutputConstants.WF_TEMPLATE_ID));
+ generator.setParameter(WFOutputConstants.OUTPUT_KEY, ids.get(WFOutputConstants.OUTPUT_KEY));
+ Query q = generator.selectQuery(em);
+ WorkflowOutput wfOutput = (WorkflowOutput) q.getSingleResult();
+ WorkflowOutputResource workflowOutputResource =
+ (WorkflowOutputResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.WORKFLOW_OUTPUT
+ , wfOutput);
+ em.getTransaction().commit();
+ em.close();
+ return workflowOutputResource;
+ } 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();
+ }
+ }
+ }
+
+ public List<Resource> get(String fieldName, Object value) throws AppCatalogException {
+ List<Resource> wfOutputResources = new ArrayList<Resource>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ Query q;
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(WORKFLOW_OUTPUT);
+ List results;
+ if (fieldName.equals(WFOutputConstants.WF_TEMPLATE_ID)) {
+ generator.setParameter(WFOutputConstants.WF_TEMPLATE_ID, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ WorkflowOutput wfOutput = (WorkflowOutput) result;
+ WorkflowOutputResource workflowOutputResource =
+ (WorkflowOutputResource) AppCatalogJPAUtils.getResource(
+ AppCatalogResourceType.WORKFLOW_OUTPUT, wfOutput);
+ wfOutputResources.add(workflowOutputResource);
+ }
+ }
+ } else if (fieldName.equals(WFOutputConstants.OUTPUT_KEY)) {
+ generator.setParameter(WFOutputConstants.OUTPUT_KEY, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ WorkflowOutput workflowOutput = (WorkflowOutput) result;
+ WorkflowOutputResource workflowOutputResource =
+ (WorkflowOutputResource) AppCatalogJPAUtils.getResource(
+ AppCatalogResourceType.WORKFLOW_OUTPUT, workflowOutput);
+ wfOutputResources.add(workflowOutputResource);
+ }
+ }
+ } else if (fieldName.equals(WFOutputConstants.DATA_TYPE)) {
+ generator.setParameter(WFOutputConstants.DATA_TYPE, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ WorkflowOutput workflowOutput = (WorkflowOutput) result;
+ WorkflowOutputResource workflowOutputResource =
+ (WorkflowOutputResource) AppCatalogJPAUtils.getResource(
+ AppCatalogResourceType.WORKFLOW_OUTPUT, workflowOutput);
+ wfOutputResources.add(workflowOutputResource);
+ }
+ }
+ } else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for WF Output Resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for WF Output 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 wfOutputResources;
+ }
+
+ public List<Resource> getAll() throws AppCatalogException {
+ return null;
+ }
+
+ public List<String> getAllIds() throws AppCatalogException {
+ return null;
+ }
+
+ public List<String> getIds(String fieldName, Object value) throws AppCatalogException {
+ List<String> wfOutputResourceIDs = new ArrayList<String>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ Query q;
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(WORKFLOW_OUTPUT);
+ List results;
+ if (fieldName.equals(WFOutputConstants.WF_TEMPLATE_ID)) {
+ generator.setParameter(WFOutputConstants.WF_TEMPLATE_ID, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ WorkflowOutput workflowOutput = (WorkflowOutput) result;
+ wfOutputResourceIDs.add(workflowOutput.getWfTemplateId());
+ }
+ }
+ }
+ if (fieldName.equals(WFOutputConstants.OUTPUT_KEY)) {
+ generator.setParameter(WFOutputConstants.OUTPUT_KEY, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ WorkflowOutput workflowOutput = (WorkflowOutput) result;
+ wfOutputResourceIDs.add(workflowOutput.getWfTemplateId());
+ }
+ }
+ } else if (fieldName.equals(WFOutputConstants.DATA_TYPE)) {
+ generator.setParameter(WFOutputConstants.DATA_TYPE, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ WorkflowOutput workflowOutput = (WorkflowOutput) result;
+ wfOutputResourceIDs.add(workflowOutput.getWfTemplateId());
+ }
+ }
+ } else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for WF Output resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for WF Output 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 wfOutputResourceIDs;
+ }
+
+ public void save() throws AppCatalogException {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ WorkflowOutput existingWorkflowOutput = em.find(WorkflowOutput.class,
+ new WorkflowOutput_PK(wfTemplateId, outputKey));
+ em.close();
+
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ if (existingWorkflowOutput != null) {
+ existingWorkflowOutput.setWfTemplateId(wfTemplateId);
+ Workflow workflow = em.find(Workflow.class, wfTemplateId);
+ existingWorkflowOutput.setWorkflow(workflow);
+ existingWorkflowOutput.setDataType(dataType);
+ existingWorkflowOutput.setOutputKey(outputKey);
+ if (outputVal != null){
+ existingWorkflowOutput.setOutputVal(outputVal.toCharArray());
+ }
+ existingWorkflowOutput.setValidityType(validityType);
+ existingWorkflowOutput.setDataMovement(dataMovement);
+ existingWorkflowOutput.setDataNameLocation(dataNameLocation);
+ em.merge(existingWorkflowOutput);
+ } else {
+ WorkflowOutput workflowOutput = new WorkflowOutput();
+ workflowOutput.setWfTemplateId(wfTemplateId);
+ Workflow workflow = em.find(Workflow.class, wfTemplateId);
+ workflowOutput.setWorkflow(workflow);
+ workflowOutput.setDataType(dataType);
+ workflowOutput.setOutputKey(outputKey);
+ if (outputVal != null){
+ workflowOutput.setOutputVal(outputVal.toCharArray());
+ }
+ workflowOutput.setValidityType(validityType);
+ workflowOutput.setDataMovement(dataMovement);
+ workflowOutput.setDataNameLocation(dataNameLocation);
+ em.persist(workflowOutput);
+ }
+ 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();
+ }
+ }
+ }
+
+ 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();
+ WorkflowOutput workflowOutput = em.find(WorkflowOutput.class, new WorkflowOutput_PK(
+ ids.get(WFOutputConstants.WF_TEMPLATE_ID),
+ ids.get(WFOutputConstants.OUTPUT_KEY)));
+
+ em.close();
+ return workflowOutput != null;
+ } 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();
+ }
+ }
+ }
+
+ public String getWfTemplateId() {
+ return wfTemplateId;
+ }
+
+ public void setWfTemplateId(String wfTemplateId) {
+ this.wfTemplateId = wfTemplateId;
+ }
+
+ public String getOutputKey() {
+ return outputKey;
+ }
+
+ public void setOutputKey(String outputKey) {
+ this.outputKey = outputKey;
+ }
+
+ public String getOutputVal() {
+ return outputVal;
+ }
+
+ public void setOutputVal(String outputVal) {
+ this.outputVal = outputVal;
+ }
+
+ public String getDataType() {
+ return dataType;
+ }
+
+ public void setDataType(String dataType) {
+ this.dataType = dataType;
+ }
+
+ public WorkflowResource getWorkflowResource() {
+ return workflowResource;
+ }
+
+ public void setWorkflowResource(WorkflowResource workflowResource) {
+ this.workflowResource = workflowResource;
+ }
+
+ public String getValidityType() {
+ return validityType;
+ }
+
+ public void setValidityType(String validityType) {
+ this.validityType = validityType;
+ }
+
+ public boolean isDataMovement() {
+ return dataMovement;
+ }
+
+ public void setDataMovement(boolean dataMovement) {
+ this.dataMovement = dataMovement;
+ }
+
+ public String getDataNameLocation() {
+ return dataNameLocation;
+ }
+
+ public void setDataNameLocation(String dataNameLocation) {
+ this.dataNameLocation = dataNameLocation;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/WorkflowResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/WorkflowResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/WorkflowResource.java
new file mode 100644
index 0000000..3e52019
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/WorkflowResource.java
@@ -0,0 +1,382 @@
+/*
+ *
+ * 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.aiaravata.application.catalog.data.resources;
+
+import org.airavata.appcatalog.cpi.AppCatalogException;
+import org.apache.aiaravata.application.catalog.data.model.Workflow;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogJPAUtils;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogQueryGenerator;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogResourceType;
+import org.apache.airavata.common.exception.ApplicationSettingsException;
+import org.apache.airavata.common.utils.AiravataUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.persistence.EntityManager;
+import javax.persistence.Query;
+import java.sql.Timestamp;
+import java.util.ArrayList;
+import java.util.List;
+
+public class WorkflowResource extends AbstractResource {
+ private final static Logger logger = LoggerFactory.getLogger(WorkflowResource.class);
+ private String wfName;
+ private String createdUser;
+ private String graph;
+ private String wfTemplateId;
+ private Timestamp createdTime;
+ private Timestamp updatedTime;
+ private String image;
+ private String gatewayId;
+
+ public Timestamp getCreatedTime() {
+ return createdTime;
+ }
+
+ public void setCreatedTime(Timestamp createdTime) {
+ this.createdTime = createdTime;
+ }
+
+ public Timestamp getUpdatedTime() {
+ return updatedTime;
+ }
+
+ public void setUpdatedTime(Timestamp updatedTime) {
+ this.updatedTime = updatedTime;
+ }
+
+ public String getImage() {
+ return image;
+ }
+
+ public void setImage(String image) {
+ this.image = image;
+ }
+
+ public String getGatewayId() {
+ return gatewayId;
+ }
+
+ public void setGatewayId(String gatewayId) {
+ this.gatewayId = gatewayId;
+ }
+
+ @Override
+ public void remove(Object identifier) throws AppCatalogException {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(WORKFLOW);
+ generator.setParameter(WorkflowConstants.WF_TEMPLATE_ID, identifier);
+ 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 Resource get(Object identifier) throws AppCatalogException {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(WORKFLOW);
+ generator.setParameter(WorkflowConstants.WF_TEMPLATE_ID, identifier);
+ Query q = generator.selectQuery(em);
+ Workflow workflow = (Workflow) q.getSingleResult();
+ WorkflowResource workflowResource = (WorkflowResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.WORKFLOW, workflow);
+ em.getTransaction().commit();
+ em.close();
+ return workflowResource;
+ } 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<Resource> get(String fieldName, Object value) throws AppCatalogException {
+ List<Resource> workflowResources = new ArrayList<Resource>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(WORKFLOW);
+ Query q;
+ if ((fieldName.equals(WorkflowConstants.WF_NAME)) || (fieldName.equals(WorkflowConstants.CREATED_USER)) || (fieldName.equals(WorkflowConstants.GRAPH)) || (fieldName.equals(WorkflowConstants.WF_TEMPLATE_ID))) {
+ generator.setParameter(fieldName, value);
+ q = generator.selectQuery(em);
+ List<?> results = q.getResultList();
+ for (Object result : results) {
+ Workflow workflow = (Workflow) result;
+ WorkflowResource workflowResource = (WorkflowResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.WORKFLOW, workflow);
+ workflowResources.add(workflowResource);
+ }
+ } else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for Workflow Resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for Workflow Resource.");
+ }
+ 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();
+ }
+ }
+ return workflowResources;
+ }
+
+ @Override
+ public List<Resource> getAll() throws AppCatalogException {
+ List<Resource> workflows = new ArrayList<Resource>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(WORKFLOW);
+ generator.setParameter(WorkflowConstants.GATEWAY_ID, gatewayId);
+ Query q = generator.selectQuery(em);
+ List results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ Workflow workflow = (Workflow) result;
+ WorkflowResource wfResource =
+ (WorkflowResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.WORKFLOW, workflow);
+ workflows.add(wfResource);
+ }
+ }
+ 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 workflows;
+ }
+
+ @Override
+ public List<String> getAllIds() throws AppCatalogException {
+ List<String> workflowIds = new ArrayList<String>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(WORKFLOW);
+ generator.setParameter(WorkflowConstants.GATEWAY_ID, gatewayId);
+ Query q = generator.selectQuery(em);
+ List results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ Workflow workflow = (Workflow) result;
+ workflowIds.add(workflow.getWfTemplateId());
+ }
+ }
+ 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 workflowIds;
+ }
+
+ @Override
+ public List<String> getIds(String fieldName, Object value) throws AppCatalogException {
+ List<String> workflowResourceIDs = new ArrayList<String>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(WORKFLOW);
+ Query q;
+ if ((fieldName.equals(WorkflowConstants.WF_NAME)) || (fieldName.equals(WorkflowConstants.CREATED_USER)) || (fieldName.equals(WorkflowConstants.GRAPH)) || (fieldName.equals(WorkflowConstants.WF_TEMPLATE_ID))) {
+ generator.setParameter(fieldName, value);
+ q = generator.selectQuery(em);
+ List<?> results = q.getResultList();
+ for (Object result : results) {
+ Workflow workflow = (Workflow) result;
+ WorkflowResource workflowResource = (WorkflowResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.WORKFLOW, workflow);
+ workflowResourceIDs.add(workflowResource.getWfTemplateId());
+ }
+ } else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for Workflow Resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for Workflow Resource.");
+ }
+ 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();
+ }
+ }
+ return workflowResourceIDs;
+ }
+
+ @Override
+ public void save() throws AppCatalogException {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ Workflow existingWorkflow = em.find(Workflow.class, wfTemplateId);
+ em.close();
+ Workflow workflow;
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ if (existingWorkflow == null) {
+ workflow = new Workflow();
+ workflow.setCreationTime(AiravataUtils.getCurrentTimestamp());
+ } else {
+ workflow = existingWorkflow;
+ workflow.setUpdateTime(AiravataUtils.getCurrentTimestamp());
+ }
+ workflow.setWfName(getWfName());
+ workflow.setCreatedUser(getCreatedUser());
+ workflow.setGatewayId(gatewayId);
+ if (getGraph() != null){
+ workflow.setGraph(getGraph().toCharArray());
+ }
+ if (image != null){
+ workflow.setImage(image.getBytes());
+ }
+ workflow.setWfTemplateId(getWfTemplateId());
+ if (existingWorkflow == null) {
+ em.persist(workflow);
+ } else {
+ em.merge(workflow);
+ }
+ 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 {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ Workflow workflow = em.find(Workflow.class, identifier);
+ em.close();
+ return workflow != null;
+ } 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();
+ }
+ }
+ }
+
+ public String getWfName() {
+ return wfName;
+ }
+
+ public String getCreatedUser() {
+ return createdUser;
+ }
+
+ public String getGraph() {
+ return graph;
+ }
+
+ public String getWfTemplateId() {
+ return wfTemplateId;
+ }
+
+ public void setWfName(String wfName) {
+ this.wfName=wfName;
+ }
+
+ public void setCreatedUser(String createdUser) {
+ this.createdUser=createdUser;
+ }
+
+ public void setGraph(String graph) {
+ this.graph=graph;
+ }
+
+ public void setWfTemplateId(String wfTemplateId) {
+ this.wfTemplateId=wfTemplateId;
+ }
+}
[36/52] [abbrv] [partial] airavata git commit: registry refactoring
Posted by sh...@apache.org.
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/app-catalog/app-catalog-data/src/test/java/org/apache/airavata/app/catalog/test/AppDeploymentTest.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/test/java/org/apache/airavata/app/catalog/test/AppDeploymentTest.java b/modules/app-catalog/app-catalog-data/src/test/java/org/apache/airavata/app/catalog/test/AppDeploymentTest.java
deleted file mode 100644
index 62ad814..0000000
--- a/modules/app-catalog/app-catalog-data/src/test/java/org/apache/airavata/app/catalog/test/AppDeploymentTest.java
+++ /dev/null
@@ -1,147 +0,0 @@
-/*
- *
- * 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.app.catalog.test;
-
-import org.airavata.appcatalog.cpi.*;
-import org.apache.aiaravata.application.catalog.data.impl.AppCatalogFactory;
-import org.apache.aiaravata.application.catalog.data.resources.AbstractResource;
-import org.apache.airavata.app.catalog.test.util.Initialize;
-import org.apache.airavata.common.utils.AiravataUtils;
-import org.apache.airavata.common.utils.ServerSettings;
-import org.apache.airavata.model.appcatalog.appdeployment.ApplicationDeploymentDescription;
-import org.apache.airavata.model.appcatalog.appdeployment.ApplicationModule;
-import org.apache.airavata.model.appcatalog.appdeployment.SetEnvPaths;
-import org.apache.airavata.model.appcatalog.computeresource.ComputeResourceDescription;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import static org.junit.Assert.assertTrue;
-
-public class AppDeploymentTest {
- private static Initialize initialize;
- private static AppCatalog appcatalog;
- private static final Logger logger = LoggerFactory.getLogger(AppDeploymentTest.class);
-
- @Before
- public void setUp() {
- try {
- initialize = new Initialize("appcatalog-derby.sql");
- initialize.initializeDB();
- appcatalog = AppCatalogFactory.getAppCatalog();
- } catch (AppCatalogException e) {
- logger.error(e.getMessage(), e);
- }
- }
-
- @After
- public void tearDown() throws Exception {
- System.out.println("********** TEAR DOWN ************");
- initialize.stopDerbyServer();
- }
-
- @Test
- public void testAppDeployment () throws Exception {
- ApplicationDeployment appDep = appcatalog.getApplicationDeployment();
- ApplicationInterface appInt = appcatalog.getApplicationInterface();
- ComputeResource computeRs = appcatalog.getComputeResource();
- ComputeResourceDescription cm = new ComputeResourceDescription();
- cm.setHostName("localhost");
- cm.setResourceDescription("test compute host");
- String hostId = computeRs.addComputeResource(cm);
-
- ApplicationModule module = new ApplicationModule();
- module.setAppModuleName("WRF");
- module.setAppModuleVersion("1.0.0");
- String wrfModuleId = appInt.addApplicationModule(module, ServerSettings.getDefaultUserGateway());
-
- ApplicationDeploymentDescription description = new ApplicationDeploymentDescription();
- description.setAppModuleId(wrfModuleId);
- description.setComputeHostId(hostId);
- description.setExecutablePath("/home/a/b/c");
- description.setAppDeploymentDescription("test app deployment");
- description.addToModuleLoadCmds("cmd1");
- description.addToModuleLoadCmds("cmd2");
-
- List<SetEnvPaths> libPrepandPaths = new ArrayList<SetEnvPaths>();
- libPrepandPaths.add(createSetEnvPath("name1", "val1"));
- libPrepandPaths.add(createSetEnvPath("name2", "val2"));
- description.setLibPrependPaths(libPrepandPaths);
- List<SetEnvPaths> libApendPaths = new ArrayList<SetEnvPaths>();
- libApendPaths.add(createSetEnvPath("name3", "val3"));
- libApendPaths.add(createSetEnvPath("name4", "val4"));
- description.setLibAppendPaths(libApendPaths);
- List<SetEnvPaths> appEvns = new ArrayList<SetEnvPaths>();
- appEvns.add(createSetEnvPath("name5", "val5"));
- appEvns.add(createSetEnvPath("name6", "val6"));
- description.setSetEnvironment(appEvns);
-
- String appDepId = appDep.addApplicationDeployment(description, ServerSettings.getDefaultUserGateway());
- ApplicationDeploymentDescription app = null;
- if (appDep.isAppDeploymentExists(appDepId)){
- app = appDep.getApplicationDeployement(appDepId);
- System.out.println("*********** application deployment id ********* : " + app.getAppDeploymentId());
- System.out.println("*********** application deployment desc ********* : " + app.getAppDeploymentDescription());
- }
-
- description.setAppDeploymentDescription("test app deployment2");
- appDep.updateApplicationDeployment(appDepId, description);
-
- if (appDep.isAppDeploymentExists(appDepId)){
- app = appDep.getApplicationDeployement(appDepId);
- System.out.println("*********** application deployment desc ********* : " + app.getAppDeploymentDescription());
- }
-
- Map<String, String> moduleIdFilter = new HashMap<String, String>();
- moduleIdFilter.put(AbstractResource.ApplicationDeploymentConstants.APP_MODULE_ID, wrfModuleId);
- List<ApplicationDeploymentDescription> applicationDeployements = appDep.getApplicationDeployements(moduleIdFilter);
- System.out.println("******** Size of App deployments for module *********** : " + applicationDeployements.size());
- Map<String, String> hostFilter = new HashMap<String, String>();
- hostFilter.put(AbstractResource.ApplicationDeploymentConstants.COMPUTE_HOST_ID, hostId);
- List<ApplicationDeploymentDescription> applicationDeployementsForHost = appDep.getApplicationDeployements(hostFilter);
- System.out.println("******** Size of App deployments for host *********** : " + applicationDeployementsForHost.size());
-
- List<String> allApplicationDeployementIds = appDep.getAllApplicationDeployementIds();
- System.out.println("******** Size of all App deployments ids *********** : " + allApplicationDeployementIds.size());
-
- List<ApplicationDeploymentDescription> allApplicationDeployements = appDep.getAllApplicationDeployements(ServerSettings.getDefaultUserGateway());
- System.out.println("******** Size of all App deployments *********** : " + allApplicationDeployements.size());
-
- assertTrue("App interface saved successfully", app != null);
- }
-
- public SetEnvPaths createSetEnvPath (String name, String val){
- SetEnvPaths setEnvPaths = new SetEnvPaths();
- setEnvPaths.setName(name);
- setEnvPaths.setValue(val);
- return setEnvPaths;
-
- }
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/app-catalog/app-catalog-data/src/test/java/org/apache/airavata/app/catalog/test/AppInterfaceTest.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/test/java/org/apache/airavata/app/catalog/test/AppInterfaceTest.java b/modules/app-catalog/app-catalog-data/src/test/java/org/apache/airavata/app/catalog/test/AppInterfaceTest.java
deleted file mode 100644
index dd72b8e..0000000
--- a/modules/app-catalog/app-catalog-data/src/test/java/org/apache/airavata/app/catalog/test/AppInterfaceTest.java
+++ /dev/null
@@ -1,192 +0,0 @@
-/*
- *
- * 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.app.catalog.test;
-
-import org.airavata.appcatalog.cpi.AppCatalog;
-import org.airavata.appcatalog.cpi.AppCatalogException;
-import org.airavata.appcatalog.cpi.ApplicationInterface;
-import org.apache.aiaravata.application.catalog.data.impl.AppCatalogFactory;
-import org.apache.aiaravata.application.catalog.data.resources.AbstractResource;
-import org.apache.airavata.app.catalog.test.util.Initialize;
-import org.apache.airavata.common.exception.ApplicationSettingsException;
-import org.apache.airavata.common.utils.AiravataUtils;
-import org.apache.airavata.common.utils.ServerSettings;
-import org.apache.airavata.model.appcatalog.appdeployment.ApplicationModule;
-import org.apache.airavata.model.appcatalog.appinterface.ApplicationInterfaceDescription;
-import org.apache.airavata.model.appcatalog.appinterface.DataType;
-import org.apache.airavata.model.appcatalog.appinterface.InputDataObjectType;
-import org.apache.airavata.model.appcatalog.appinterface.OutputDataObjectType;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import static org.junit.Assert.assertTrue;
-
-public class AppInterfaceTest {
- private static Initialize initialize;
- private static AppCatalog appcatalog;
- private static int order = 1;
- private static final Logger logger = LoggerFactory.getLogger(AppInterfaceTest.class);
-
- @Before
- public void setUp() {
- try {
- initialize = new Initialize("appcatalog-derby.sql");
- initialize.initializeDB();
- appcatalog = AppCatalogFactory.getAppCatalog();
- } catch (AppCatalogException e) {
- logger.error(e.getMessage(), e);
- }
- }
-
- @After
- public void tearDown() throws Exception {
- System.out.println("********** TEAR DOWN ************");
- initialize.stopDerbyServer();
-
- }
-
- @Test
- public void testAppInterface(){
- try {
- ApplicationInterface appInterface = appcatalog.getApplicationInterface();
- ApplicationInterfaceDescription description = new ApplicationInterfaceDescription();
- String wrfModuleId = addAppModule("WRF");
- String amberModuleId = addAppModule("AMBER");
- List<String> modules = new ArrayList<String>();
- modules.add(wrfModuleId);
- modules.add(amberModuleId);
- InputDataObjectType appInput1 = createAppInput("input1", "input1", DataType.STRING);
- InputDataObjectType appInput2 = createAppInput("input2", "input2", DataType.INTEGER);
- List<InputDataObjectType> inputs = new ArrayList<InputDataObjectType>();
- inputs.add(appInput1);
- inputs.add(appInput2);
- OutputDataObjectType output1 = createAppOutput("output1", "", DataType.STRING);
- OutputDataObjectType output2 = createAppOutput("output2", "", DataType.STRING);
- List<OutputDataObjectType> outputs = new ArrayList<OutputDataObjectType>();
- outputs.add(output1);
- outputs.add(output2);
- description.setApplicationName("testApplication");
- description.setApplicationDescription("my testApplication");
- description.setApplicationModules(modules);
- description.setApplicationInputs(inputs);
- description.setApplicationOutputs(outputs);
- String appID = appInterface.addApplicationInterface(description, ServerSettings.getDefaultUserGateway());
- System.out.println("********** application id ************* : " + appID);
- ApplicationInterfaceDescription ainterface = null;
- if (appInterface.isApplicationInterfaceExists(appID)){
- ainterface = appInterface.getApplicationInterface(appID);
- OutputDataObjectType output3 = createAppOutput("output3", "", DataType.STRING);
- OutputDataObjectType output4 = createAppOutput("output4", "", DataType.STRING);
- outputs.add(output3);
- outputs.add(output4);
- ainterface.setApplicationOutputs(outputs);
- appInterface.updateApplicationInterface(appID, ainterface);
- ApplicationInterfaceDescription updateApp = appInterface.getApplicationInterface(appID);
- List<OutputDataObjectType> appOutputs = updateApp.getApplicationOutputs();
- System.out.println("********** application name ************* : " + updateApp.getApplicationName());
- System.out.println("********** application description ************* : " + updateApp.getApplicationDescription());
- System.out.println("********** output size ************* : " + appOutputs.size());
- }
- ApplicationModule wrfModule = appInterface.getApplicationModule(wrfModuleId);
- System.out.println("********** WRF module name ************* : " + wrfModule.getAppModuleName());
- ApplicationModule amberModule = appInterface.getApplicationModule(amberModuleId);
- System.out.println("********** Amber module name ************* : " + amberModule.getAppModuleName());
-
- List<InputDataObjectType> applicationInputs = appInterface.getApplicationInputs(appID);
- System.out.println("********** App Input size ************* : " + applicationInputs.size());
-
- List<OutputDataObjectType> applicationOutputs = appInterface.getApplicationOutputs(appID);
- System.out.println("********** App output size ************* : " + applicationOutputs.size());
-
- description.setApplicationName("testApplication2");
- appInterface.updateApplicationInterface(appID, description);
- if (appInterface.isApplicationInterfaceExists(appID)){
- ainterface = appInterface.getApplicationInterface(appID);
- System.out.println("********** updated application name ************* : " + ainterface.getApplicationName());
- }
-
- wrfModule.setAppModuleVersion("1.0.1");
- appInterface.updateApplicationModule(wrfModuleId, wrfModule);
- wrfModule = appInterface.getApplicationModule(wrfModuleId);
- System.out.println("********** Updated WRF module version ************* : " + wrfModule.getAppModuleVersion());
-
- Map<String, String> filters = new HashMap<String, String>();
- filters.put(AbstractResource.ApplicationInterfaceConstants.APPLICATION_NAME, "testApplication2");
- List<ApplicationInterfaceDescription> apps = appInterface.getApplicationInterfaces(filters);
- System.out.println("********** Size og app interfaces ************* : " + apps.size());
-
- List<ApplicationInterfaceDescription> appInts = appInterface.getAllApplicationInterfaces(ServerSettings.getDefaultUserGateway());
- System.out.println("********** Size of all app interfaces ************* : " + appInts.size());
-
- List<String> appIntIds = appInterface.getAllApplicationInterfaceIds();
- System.out.println("********** Size of all app interface ids ************* : " + appIntIds.size());
-
- assertTrue("App interface saved successfully", ainterface != null);
- }catch (AppCatalogException e) {
- e.printStackTrace();
- } catch (ApplicationSettingsException e) {
- e.printStackTrace();
- }
-
- }
-
- public String addAppModule (String moduleName){
- try {
- ApplicationModule module = new ApplicationModule();
- module.setAppModuleName(moduleName);
- module.setAppModuleVersion("1.0.0");
- module.setAppModuleDescription("WeatherForcast");
- return appcatalog.getApplicationInterface().addApplicationModule(module, ServerSettings.getDefaultUserGateway());
- } catch (AppCatalogException e) {
- logger.error(e.getMessage(), e);
- } catch (ApplicationSettingsException e) {
- e.printStackTrace();
- }
- return null;
- }
-
- public InputDataObjectType createAppInput (String inputName, String value, DataType type ){
- InputDataObjectType input = new InputDataObjectType();
- input.setName(inputName);
- input.setValue(value);
- input.setType(type);
- input.setApplicationArgument("test arg");
- input.setInputOrder(order++);
- return input;
- }
-
- public OutputDataObjectType createAppOutput (String inputName, String value, DataType type ){
- OutputDataObjectType outputDataObjectType = new OutputDataObjectType();
- outputDataObjectType.setName(inputName);
- outputDataObjectType.setValue(value);
- outputDataObjectType.setType(type);
- return outputDataObjectType;
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/app-catalog/app-catalog-data/src/test/java/org/apache/airavata/app/catalog/test/ComputeResourceTest.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/test/java/org/apache/airavata/app/catalog/test/ComputeResourceTest.java b/modules/app-catalog/app-catalog-data/src/test/java/org/apache/airavata/app/catalog/test/ComputeResourceTest.java
deleted file mode 100644
index 9b8ec4b..0000000
--- a/modules/app-catalog/app-catalog-data/src/test/java/org/apache/airavata/app/catalog/test/ComputeResourceTest.java
+++ /dev/null
@@ -1,298 +0,0 @@
-/*
- *
- * 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.app.catalog.test;
-
-
-import org.airavata.appcatalog.cpi.AppCatalog;
-import org.airavata.appcatalog.cpi.AppCatalogException;
-import org.airavata.appcatalog.cpi.ComputeResource;
-import org.apache.aiaravata.application.catalog.data.impl.AppCatalogFactory;
-import org.apache.aiaravata.application.catalog.data.resources.AbstractResource;
-import org.apache.airavata.app.catalog.test.util.Initialize;
-import org.apache.airavata.common.utils.AiravataUtils;
-import org.apache.airavata.model.appcatalog.computeresource.*;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.*;
-
-import static org.junit.Assert.assertTrue;
-
-public class ComputeResourceTest {
- private static Initialize initialize;
- private static AppCatalog appcatalog;
- private static final Logger logger = LoggerFactory.getLogger(ComputeResourceTest.class);
-
- @Before
- public void setUp() {
- try {
- initialize = new Initialize("appcatalog-derby.sql");
- initialize.initializeDB();
- appcatalog = AppCatalogFactory.getAppCatalog();
- } catch (AppCatalogException e) {
- logger.error(e.getMessage(), e);
- }
- }
-
- @After
- public void tearDown() throws Exception {
- System.out.println("********** TEAR DOWN ************");
- initialize.stopDerbyServer();
-
- }
-
- @Test
- public void testAddComputeResource (){
- try {
- ComputeResource computeResource = appcatalog.getComputeResource();
- ComputeResourceDescription description = new ComputeResourceDescription();
-
- description.setHostName("localhost");
- description.setResourceDescription("test compute resource");
- List<String> ipdaresses = new ArrayList<String>();
- ipdaresses.add("222.33.43.444");
- ipdaresses.add("23.344.44.454");
- description.setIpAddresses(ipdaresses);
-// List<String> aliases = new ArrayList<String>();
-// aliases.add("test.alias1");
-// aliases.add("test.alias2");
-// description.setHostAliases(aliases);
- String sshsubmissionId = addSSHJobSubmission();
- System.out.println("**** SSH Submission id ****** :" + sshsubmissionId);
-// String gsiSSHsubmissionId = addGSISSHJobSubmission();
-// System.out.println("**** GSISSH Submission id ****** :" + gsiSSHsubmissionId);
-// String globusSubmissionId = addGlobusJobSubmission();
-// System.out.println("**** Globus Submission id ****** :" + globusSubmissionId);
- JobSubmissionInterface sshSubmissionInt = new JobSubmissionInterface();
- sshSubmissionInt.setJobSubmissionInterfaceId(sshsubmissionId);
- sshSubmissionInt.setPriorityOrder(1);
- sshSubmissionInt.setJobSubmissionProtocol(JobSubmissionProtocol.SSH);
-// JobSubmissionInterface globusSubInt = new JobSubmissionInterface();
-// globusSubInt.setJobSubmissionInterfaceId(globusSubmissionId);
-// globusSubInt.setPriorityOrder(2);
-// globusSubInt.setJobSubmissionProtocol(JobSubmissionProtocol.GLOBUS);
- List<JobSubmissionInterface> interfaceList = new ArrayList<JobSubmissionInterface>();
- interfaceList.add(sshSubmissionInt);
-// interfaceList.add(globusSubInt);
- description.setJobSubmissionInterfaces(interfaceList);
-
- String scpDataMoveId = addSCPDataMovement();
- System.out.println("**** SCP DataMoveId****** :" + scpDataMoveId);
- String gridFTPDataMoveId = addGridFTPDataMovement();
- System.out.println("**** grid FTP DataMoveId****** :" + gridFTPDataMoveId);
-
- List<DataMovementInterface> dataMovementInterfaces = new ArrayList<DataMovementInterface>();
- DataMovementInterface scpInterface = new DataMovementInterface();
- scpInterface.setDataMovementInterfaceId(scpDataMoveId);
- scpInterface.setDataMovementProtocol(DataMovementProtocol.SCP);
- scpInterface.setPriorityOrder(1);
-
- DataMovementInterface gridFTPMv = new DataMovementInterface();
- gridFTPMv.setDataMovementInterfaceId(gridFTPDataMoveId);
- gridFTPMv.setDataMovementProtocol(DataMovementProtocol.GridFTP);
- gridFTPMv.setPriorityOrder(2);
-
- description.setDataMovementInterfaces(dataMovementInterfaces);
-
- BatchQueue batchQueue1 = new BatchQueue();
- batchQueue1.setQueueName("queue1");
- batchQueue1.setQueueDescription("que1Desc1");
- batchQueue1.setMaxRunTime(10);
- batchQueue1.setMaxNodes(4);
- batchQueue1.setMaxJobsInQueue(1);
-
- BatchQueue batchQueue2 = new BatchQueue();
- batchQueue2.setQueueName("queue2");
- batchQueue2.setQueueDescription("que1Desc2");
- batchQueue2.setMaxRunTime(10);
- batchQueue2.setMaxNodes(4);
- batchQueue2.setMaxJobsInQueue(1);
-
- List<BatchQueue> batchQueueList = new ArrayList<BatchQueue>();
- batchQueueList.add(batchQueue1);
- batchQueueList.add(batchQueue2);
- description.setBatchQueues(batchQueueList);
-
- Map<FileSystems, String> fileSysMap = new HashMap<FileSystems, String>();
- fileSysMap.put(FileSystems.HOME, "/home");
- fileSysMap.put(FileSystems.SCRATCH, "/tmp");
- description.setFileSystems(fileSysMap);
-
- String resourceId = computeResource.addComputeResource(description);
- System.out.println("**********Resource id ************* : " + resourceId);
- ComputeResourceDescription host = null;
- if (computeResource.isComputeResourceExists(resourceId)){
- host = computeResource.getComputeResource(resourceId);
- List<BatchQueue> batchQueues = host.getBatchQueues();
- for (BatchQueue queue : batchQueues){
- System.out.println("%%%%%%%%%%%%%%%% queue description : %%%%%%%%%%%%%%%%%%% : " + queue.getQueueDescription());
- }
- List<String> hostAliases = host.getHostAliases();
- if (hostAliases != null && !hostAliases.isEmpty()){
- for (String alias : hostAliases){
- System.out.println("%%%%%%%%%%%%%%%% alias value : %%%%%%%%%%%%%%%%%%% : " + alias);
- }
- }
- host.addToHostAliases("abc");
- computeResource.updateComputeResource(resourceId, host);
- List<String> hostAliases1 = computeResource.getComputeResource(resourceId).getHostAliases();
- for (String alias : hostAliases1){
- System.out.println("%%%%%%%%%%%%%%%% alias value : %%%%%%%%%%%%%%%%%%% : " + alias);
- }
- System.out.println("**********Resource name ************* : " + host.getHostName());
- }
-
- SSHJobSubmission sshJobSubmission = computeResource.getSSHJobSubmission(sshsubmissionId);
- System.out.println("**********SSH Submission resource job manager ************* : " + sshJobSubmission.getResourceJobManager().toString());
- System.out.println("**********Monitor mode ************* : " + sshJobSubmission.getMonitorMode().toString());
-
-// GlobusJobSubmission globusJobSubmission = computeResource.get(globusSubmissionId);
-// System.out.println("**********Globus Submission resource job manager ************* : " + globusJobSubmission.getResourceJobManager().toString());
-
- SCPDataMovement scpDataMovement = computeResource.getSCPDataMovement(scpDataMoveId);
- System.out.println("**********SCP Data Move Security protocol ************* : " + scpDataMovement.getSecurityProtocol().toString());
-
- GridFTPDataMovement gridFTPDataMovement = computeResource.getGridFTPDataMovement(gridFTPDataMoveId);
- System.out.println("**********GRID FTP Data Move Security protocol ************* : " + gridFTPDataMovement.getSecurityProtocol().toString());
-
- description.setHostName("localhost2");
- computeResource.updateComputeResource(resourceId, description);
- if (computeResource.isComputeResourceExists(resourceId)){
- host = computeResource.getComputeResource(resourceId);
- System.out.println("**********Updated Resource name ************* : " + host.getHostName());
- }
-
- Map<String, String> cfilters = new HashMap<String, String>();
- cfilters.put(AbstractResource.ComputeResourceConstants.HOST_NAME, "localhost2");
- List<ComputeResourceDescription> computeResourceList = computeResource.getComputeResourceList(cfilters);
- System.out.println("**********Size of compute resources ************* : " + computeResourceList.size());
-
- List<ComputeResourceDescription> allComputeResourceList = computeResource.getAllComputeResourceList();
- System.out.println("**********Size of all compute resources ************* : " + allComputeResourceList.size());
-
- Map<String, String> allComputeResourceIdList = computeResource.getAllComputeResourceIdList();
- System.out.println("**********Size of all compute resources ids ************* : " + allComputeResourceIdList.size());
-
-// Map<String, String> globusfilters = new HashMap<String, String>();
-// globusfilters.put(AbstractResource.GlobusJobSubmissionConstants.RESOURCE_JOB_MANAGER, ResourceJobManager.PBS.toString());
-// List<GlobusJobSubmission> gList = computeResource.getGlobusJobSubmissionList(globusfilters);
-// System.out.println("**********Size of globus jobs ************* : " + gList.size());
-
-// Map<String, String> sshfilters = new HashMap<String, String>();
-// sshfilters.put(AbstractResource.SSHSubmissionConstants.RESOURCE_JOB_MANAGER, ResourceJobManager.PBS.toString());
-// List<SSHJobSubmission> sshList = computeResource.getSS(sshfilters);
-// System.out.println("**********Size of SSH jobs ************* : " + sshList.size());
-
-// Map<String, String> gsishfilters = new HashMap<String, String>();
-// gsishfilters.put(AbstractResource.GSISSHSubmissionConstants.RESOURCE_JOB_MANAGER, ResourceJobManager.PBS.toString());
-// List<GSISSHJobSubmission> gsisshList = computeResource.getGSISSHJobSubmissionList(gsishfilters);
-// System.out.println("**********Size of GSISSH jobs ************* : " + gsisshList.size());
-
-// Map<String, String> scpfilters = new HashMap<String, String>();
-// scpfilters.put(AbstractResource.SCPDataMovementConstants.SECURITY_PROTOCOL, SecurityProtocol.SSH_KEYS.toString());
-// List<SCPDataMovement> scpDataMovementList = computeResource.getSCPDataMovementList(scpfilters);
-// System.out.println("**********Size of SCP DM list ************* : " + scpDataMovementList.size());
-//
-// Map<String, String> ftpfilters = new HashMap<String, String>();
-// ftpfilters.put(AbstractResource.GridFTPDataMovementConstants.SECURITY_PROTOCOL, SecurityProtocol.SSH_KEYS.toString());
-// List<GridFTPDataMovement> ftpDataMovementList = computeResource.getGridFTPDataMovementList(ftpfilters);
-// System.out.println("**********Size of FTP DM list ************* : " + ftpDataMovementList.size());
-
- assertTrue("Compute resource save successfully", host != null);
- } catch (AppCatalogException e) {
- logger.error(e.getMessage(), e);
- }
- }
-
- public String addSSHJobSubmission (){
- try {
- SSHJobSubmission jobSubmission = new SSHJobSubmission();
- jobSubmission.setSshPort(22);
- jobSubmission.setSecurityProtocol(SecurityProtocol.GSI);
- ResourceJobManager jobManager = new ResourceJobManager();
- jobManager.setResourceJobManagerType(ResourceJobManagerType.PBS);
- jobManager.setPushMonitoringEndpoint("monitor ep");
- jobManager.setJobManagerBinPath("/bin");
- Map<JobManagerCommand, String> commands = new HashMap<JobManagerCommand, String>();
- commands.put(JobManagerCommand.SUBMISSION, "Sub command");
- commands.put(JobManagerCommand.SHOW_QUEUE, "show q command");
- jobManager.setJobManagerCommands(commands);
- jobSubmission.setMonitorMode(MonitorMode.POLL_JOB_MANAGER);
-// String jobManagerID = appcatalog.getComputeResource().addResourceJobManager(jobManager);
-// jobManager.setResourceJobManagerId(jobManagerID);
- jobSubmission.setResourceJobManager(jobManager);
- return appcatalog.getComputeResource().addSSHJobSubmission(jobSubmission);
- } catch (AppCatalogException e) {
- logger.error(e.getMessage(), e);
- }
- return null;
- }
-
-// public String addGlobusJobSubmission (){
-// try {
-// GlobusJobSubmission jobSubmission = new GlobusJobSubmission();
-// jobSubmission.setSecurityProtocol(SecurityProtocol.GSI);
-// jobSubmission.setResourceJobManager(ResourceJobManager.PBS);
-// List<String> endPoints = new ArrayList<String>();
-// endPoints.add("222.33.43.444");
-// endPoints.add("23.344.44.454");
-// jobSubmission.setGlobusGateKeeperEndPoint(endPoints);
-// return appcatalog.getComputeResource().addGlobusJobSubmission(jobSubmission);
-// } catch (AppCatalogException e) {
-// e.printStackTrace();
-// }
-// return null;
-// }
-
- public String addSCPDataMovement (){
- try {
- SCPDataMovement dataMovement = new SCPDataMovement();
- dataMovement.setSshPort(22);
- dataMovement.setSecurityProtocol(SecurityProtocol.SSH_KEYS);
- return appcatalog.getComputeResource().addScpDataMovement(dataMovement);
- }catch (AppCatalogException e) {
- logger.error(e.getMessage(), e);
- }
- return null;
- }
-
- public String addGridFTPDataMovement (){
- try {
- GridFTPDataMovement dataMovement = new GridFTPDataMovement();
- dataMovement.setSecurityProtocol(SecurityProtocol.SSH_KEYS);
- List<String> endPoints = new ArrayList<String>();
- endPoints.add("222.33.43.444");
- endPoints.add("23.344.44.454");
- dataMovement.setGridFTPEndPoints(endPoints);
- return appcatalog.getComputeResource().addGridFTPDataMovement(dataMovement);
- }catch (AppCatalogException e) {
- logger.error(e.getMessage(), e);
- }
- return null;
- }
-
-
-}
-
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/app-catalog/app-catalog-data/src/test/java/org/apache/airavata/app/catalog/test/GatewayProfileTest.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/test/java/org/apache/airavata/app/catalog/test/GatewayProfileTest.java b/modules/app-catalog/app-catalog-data/src/test/java/org/apache/airavata/app/catalog/test/GatewayProfileTest.java
deleted file mode 100644
index b2b8555..0000000
--- a/modules/app-catalog/app-catalog-data/src/test/java/org/apache/airavata/app/catalog/test/GatewayProfileTest.java
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- *
- * 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.app.catalog.test;
-
-import org.airavata.appcatalog.cpi.AppCatalog;
-import org.airavata.appcatalog.cpi.AppCatalogException;
-import org.airavata.appcatalog.cpi.ComputeResource;
-import org.airavata.appcatalog.cpi.GwyResourceProfile;
-import org.apache.aiaravata.application.catalog.data.impl.AppCatalogFactory;
-import org.apache.airavata.app.catalog.test.util.Initialize;
-import org.apache.airavata.common.utils.AiravataUtils;
-import org.apache.airavata.model.appcatalog.computeresource.ComputeResourceDescription;
-import org.apache.airavata.model.appcatalog.computeresource.DataMovementProtocol;
-import org.apache.airavata.model.appcatalog.computeresource.JobSubmissionProtocol;
-import org.apache.airavata.model.appcatalog.gatewayprofile.ComputeResourcePreference;
-import org.apache.airavata.model.appcatalog.gatewayprofile.GatewayResourceProfile;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import static org.junit.Assert.assertTrue;
-
-public class GatewayProfileTest {
- private static Initialize initialize;
- private static AppCatalog appcatalog;
- private static final Logger logger = LoggerFactory.getLogger(GatewayProfileTest.class);
-
- @Before
- public void setUp() {
- try {
- initialize = new Initialize("appcatalog-derby.sql");
- initialize.initializeDB();
- appcatalog = AppCatalogFactory.getAppCatalog();
- } catch (AppCatalogException e) {
- logger.error(e.getMessage(), e);
- }
- }
-
- @After
- public void tearDown() throws Exception {
- System.out.println("********** TEAR DOWN ************");
- initialize.stopDerbyServer();
- }
-
- @Test
- public void gatewayProfileTest() throws Exception {
- GwyResourceProfile gatewayProfile = appcatalog.getGatewayProfile();
- GatewayResourceProfile gf = new GatewayResourceProfile();
- ComputeResource computeRs = appcatalog.getComputeResource();
- ComputeResourceDescription cm1 = new ComputeResourceDescription();
- cm1.setHostName("localhost");
- cm1.setResourceDescription("test compute host");
- String hostId1 = computeRs.addComputeResource(cm1);
-
- ComputeResourceDescription cm2 = new ComputeResourceDescription();
- cm2.setHostName("localhost");
- cm2.setResourceDescription("test compute host");
- String hostId2 = computeRs.addComputeResource(cm2);
-
- ComputeResourcePreference preference1 = new ComputeResourcePreference();
- preference1.setComputeResourceId(hostId1);
- preference1.setOverridebyAiravata(true);
- preference1.setPreferredJobSubmissionProtocol(JobSubmissionProtocol.SSH);
- preference1.setPreferredDataMovementProtocol(DataMovementProtocol.SCP);
- preference1.setPreferredBatchQueue("queue1");
- preference1.setScratchLocation("/tmp");
- preference1.setAllocationProjectNumber("project1");
-
- ComputeResourcePreference preference2 = new ComputeResourcePreference();
- preference2.setComputeResourceId(hostId2);
- preference2.setOverridebyAiravata(true);
- preference2.setPreferredJobSubmissionProtocol(JobSubmissionProtocol.LOCAL);
- preference2.setPreferredDataMovementProtocol(DataMovementProtocol.GridFTP);
- preference2.setPreferredBatchQueue("queue2");
- preference2.setScratchLocation("/tmp");
- preference2.setAllocationProjectNumber("project2");
-
- List<ComputeResourcePreference> list = new ArrayList<ComputeResourcePreference>();
- list.add(preference1);
- list.add(preference2);
- gf.setComputeResourcePreferences(list);
- gf.setGatewayID("testGateway");
-
- String gwId = gatewayProfile.addGatewayResourceProfile(gf);
- GatewayResourceProfile retrievedProfile = null;
- if (gatewayProfile.isGatewayResourceProfileExists(gwId)){
- retrievedProfile = gatewayProfile.getGatewayProfile(gwId);
- System.out.println("************ gateway id ************** :" + retrievedProfile.getGatewayID());
- }
- List<ComputeResourcePreference> preferences = gatewayProfile.getAllComputeResourcePreferences(gwId);
- System.out.println("compute preferences size : " + preferences.size());
- if (preferences != null && !preferences.isEmpty()){
- for (ComputeResourcePreference cm : preferences){
- System.out.println("******** host id ********* : " + cm.getComputeResourceId());
- System.out.println(cm.getPreferredBatchQueue());
- System.out.println(cm.getPreferredDataMovementProtocol());
- System.out.println(cm.getPreferredJobSubmissionProtocol());
- }
- }
-
- assertTrue("App interface saved successfully", retrievedProfile != null);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/app-catalog/app-catalog-data/src/test/java/org/apache/airavata/app/catalog/test/util/Initialize.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/test/java/org/apache/airavata/app/catalog/test/util/Initialize.java b/modules/app-catalog/app-catalog-data/src/test/java/org/apache/airavata/app/catalog/test/util/Initialize.java
deleted file mode 100644
index 5e8be65..0000000
--- a/modules/app-catalog/app-catalog-data/src/test/java/org/apache/airavata/app/catalog/test/util/Initialize.java
+++ /dev/null
@@ -1,320 +0,0 @@
-/*
- *
- * 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.app.catalog.test.util;
-
-import org.apache.airavata.common.exception.ApplicationSettingsException;
-import org.apache.airavata.common.utils.ServerSettings;
-import org.apache.derby.drda.NetworkServerControl;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.net.InetAddress;
-import java.net.URI;
-import java.sql.*;
-import java.util.StringTokenizer;
-
-public class Initialize {
- private static final Logger logger = LoggerFactory.getLogger(Initialize.class);
- public static final String DERBY_SERVER_MODE_SYS_PROPERTY = "derby.drda.startNetworkServer";
- public String scriptName = "appcatalog-derby.sql";
- private NetworkServerControl server;
- private static final String delimiter = ";";
- public static final String COMPUTE_RESOURCE_TABLE = "COMPUTE_RESOURCE";
- private String jdbcUrl = null;
- private String jdbcDriver = null;
- private String jdbcUser = null;
- private String jdbcPassword = null;
-
- public Initialize(String scriptName) {
- this.scriptName = scriptName;
- }
-
- public static boolean checkStringBufferEndsWith(StringBuffer buffer, String suffix) {
- if (suffix.length() > buffer.length()) {
- return false;
- }
- // this loop is done on purpose to avoid memory allocation performance
- // problems on various JDKs
- // StringBuffer.lastIndexOf() was introduced in jdk 1.4 and
- // implementation is ok though does allocation/copying
- // StringBuffer.toString().endsWith() does massive memory
- // allocation/copying on JDK 1.5
- // See http://issues.apache.org/bugzilla/show_bug.cgi?id=37169
- int endIndex = suffix.length() - 1;
- int bufferIndex = buffer.length() - 1;
- while (endIndex >= 0) {
- if (buffer.charAt(bufferIndex) != suffix.charAt(endIndex)) {
- return false;
- }
- bufferIndex--;
- endIndex--;
- }
- return true;
- }
-
- private static boolean isServerStarted(NetworkServerControl server, int ntries)
- {
- for (int i = 1; i <= ntries; i ++)
- {
- try {
- Thread.sleep(500);
- server.ping();
- return true;
- }
- catch (Exception e) {
- if (i == ntries)
- return false;
- }
- }
- return false;
- }
-
- public void initializeDB() {
-
- try{
- jdbcDriver = ServerSettings.getSetting("appcatalog.jdbc.driver");
- jdbcUrl = ServerSettings.getSetting("appcatalog.jdbc.url");
- jdbcUser = ServerSettings.getSetting("appcatalog.jdbc.user");
- jdbcPassword = ServerSettings.getSetting("appcatalog.jdbc.password");
- jdbcUrl = jdbcUrl + "?" + "user=" + jdbcUser + "&" + "password=" + jdbcPassword;
- } catch (ApplicationSettingsException e) {
- logger.error("Unable to read properties", e);
- }
-
- startDerbyInServerMode();
- if(!isServerStarted(server, 20)){
- throw new RuntimeException("Derby server cound not started within five seconds...");
- }
-// startDerbyInEmbeddedMode();
-
- Connection conn = null;
- try {
- Class.forName(jdbcDriver).newInstance();
- conn = DriverManager.getConnection(jdbcUrl, jdbcUser, jdbcPassword);
- if (!isDatabaseStructureCreated(COMPUTE_RESOURCE_TABLE, conn)) {
- executeSQLScript(conn);
- logger.info("New Database created for App Catalog !!!");
- } else {
- logger.debug("Database already created for App Catalog!");
- }
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new RuntimeException("Database failure", e);
- } finally {
- try {
- if (conn != null){
- if (!conn.getAutoCommit()) {
- conn.commit();
- }
- conn.close();
- }
- } catch (SQLException e) {
- logger.error(e.getMessage(), e);
- }
- }
- }
-
- public static boolean isDatabaseStructureCreated(String tableName, Connection conn) {
- try {
- System.out.println("Running a query to test the database tables existence.");
- // check whether the tables are already created with a query
- Statement statement = null;
- try {
- statement = conn.createStatement();
- ResultSet rs = statement.executeQuery("select * from " + tableName);
- if (rs != null) {
- rs.close();
- }
- } finally {
- try {
- if (statement != null) {
- statement.close();
- }
- } catch (SQLException e) {
- return false;
- }
- }
- } catch (SQLException e) {
- return false;
- }
-
- return true;
- }
-
- private void executeSQLScript(Connection conn) throws Exception {
- StringBuffer sql = new StringBuffer();
- BufferedReader reader = null;
- try{
-
- InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream(scriptName);
- reader = new BufferedReader(new InputStreamReader(inputStream));
- String line;
- while ((line = reader.readLine()) != null) {
- line = line.trim();
- if (line.startsWith("//")) {
- continue;
- }
- if (line.startsWith("--")) {
- continue;
- }
- StringTokenizer st = new StringTokenizer(line);
- if (st.hasMoreTokens()) {
- String token = st.nextToken();
- if ("REM".equalsIgnoreCase(token)) {
- continue;
- }
- }
- sql.append(" ").append(line);
-
- // SQL defines "--" as a comment to EOL
- // and in Oracle it may contain a hint
- // so we cannot just remove it, instead we must end it
- if (line.indexOf("--") >= 0) {
- sql.append("\n");
- }
- if ((checkStringBufferEndsWith(sql, delimiter))) {
- executeSQL(sql.substring(0, sql.length() - delimiter.length()), conn);
- sql.replace(0, sql.length(), "");
- }
- }
- // Catch any statements not followed by ;
- if (sql.length() > 0) {
- executeSQL(sql.toString(), conn);
- }
- }catch (IOException e){
- logger.error("Error occurred while executing SQL script for creating Airavata database", e);
- throw new Exception("Error occurred while executing SQL script for creating Airavata database", e);
- }finally {
- if (reader != null) {
- reader.close();
- }
-
- }
-
- }
-
- private static void executeSQL(String sql, Connection conn) throws Exception {
- // Check and ignore empty statements
- if ("".equals(sql.trim())) {
- return;
- }
-
- Statement statement = null;
- try {
- logger.debug("SQL : " + sql);
-
- boolean ret;
- int updateCount = 0, updateCountTotal = 0;
- statement = conn.createStatement();
- ret = statement.execute(sql);
- updateCount = statement.getUpdateCount();
- do {
- if (!ret) {
- if (updateCount != -1) {
- updateCountTotal += updateCount;
- }
- }
- ret = statement.getMoreResults();
- if (ret) {
- updateCount = statement.getUpdateCount();
- }
- } while (ret);
-
- logger.debug(sql + " : " + updateCountTotal + " rows affected");
-
- SQLWarning warning = conn.getWarnings();
- while (warning != null) {
- logger.warn(warning + " sql warning");
- warning = warning.getNextWarning();
- }
- conn.clearWarnings();
- } catch (SQLException e) {
- if (e.getSQLState().equals("X0Y32")) {
- // eliminating the table already exception for the derby
- // database
- logger.info("Table Already Exists", e);
- } else {
- throw new Exception("Error occurred while executing : " + sql, e);
- }
- } finally {
- if (statement != null) {
- try {
- statement.close();
- } catch (SQLException e) {
- logger.error("Error occurred while closing result set.", e);
- }
- }
- }
- }
-
- private void startDerbyInServerMode() {
- try {
- System.setProperty(DERBY_SERVER_MODE_SYS_PROPERTY, "true");
- server = new NetworkServerControl(InetAddress.getByName("0.0.0.0"),
- 20000,
- jdbcUser, jdbcPassword);
- java.io.PrintWriter consoleWriter = new java.io.PrintWriter(System.out, true);
- server.start(consoleWriter);
- } catch (IOException e) {
- logger.error("Unable to start Apache derby in the server mode! Check whether " +
- "specified port is available");
- } catch (Exception e) {
- logger.error("Unable to start Apache derby in the server mode! Check whether " +
- "specified port is available");
- }
-
- }
-
- public static int getPort(String jdbcURL){
- try{
- String cleanURI = jdbcURL.substring(5);
- URI uri = URI.create(cleanURI);
- return uri.getPort();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- return -1;
- }
- }
-
- private void startDerbyInEmbeddedMode(){
- try {
- Class.forName("org.apache.derby.jdbc.EmbeddedDriver");
- DriverManager.getConnection("jdbc:derby:memory:unit-testing-jpa;create=true").close();
- } catch (ClassNotFoundException e) {
- logger.error(e.getMessage(), e);
- } catch (SQLException e) {
- logger.error(e.getMessage(), e);
- }
- }
-
- public void stopDerbyServer() {
- try {
- server.shutdown();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/gfac/gfac-application-specific-handlers/src/main/java/org/apache/airavata/application/gaussian/handler/GaussianHandler.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-application-specific-handlers/src/main/java/org/apache/airavata/application/gaussian/handler/GaussianHandler.java b/modules/gfac/gfac-application-specific-handlers/src/main/java/org/apache/airavata/application/gaussian/handler/GaussianHandler.java
index 0d21665..9b37ffa 100644
--- a/modules/gfac/gfac-application-specific-handlers/src/main/java/org/apache/airavata/application/gaussian/handler/GaussianHandler.java
+++ b/modules/gfac/gfac-application-specific-handlers/src/main/java/org/apache/airavata/application/gaussian/handler/GaussianHandler.java
@@ -26,8 +26,8 @@ import org.apache.airavata.gfac.core.handler.AbstractHandler;
import org.apache.airavata.gfac.core.handler.GFacHandlerException;
import org.apache.airavata.model.appcatalog.appinterface.InputDataObjectType;
import org.apache.airavata.model.workspace.experiment.ComputationalResourceScheduling;
+import org.apache.airavata.registry.cpi.ExperimentCatalogModelType;
import org.apache.airavata.registry.cpi.RegistryException;
-import org.apache.airavata.registry.cpi.RegistryModelType;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -88,7 +88,7 @@ public class GaussianHandler extends AbstractHandler {
}
logger.info("$$$$$$$$ " + inputConfig.getKey() + " --> " + inputConfig.getValue() + " $$$$$$$$$$$");
}
- registry.update(RegistryModelType.TASK_DETAIL, jobExecutionContext.getTaskData(), jobExecutionContext.getTaskData().getTaskID());
+ experimentCatalog.update(ExperimentCatalogModelType.TASK_DETAIL, jobExecutionContext.getTaskData(), jobExecutionContext.getTaskData().getTaskID());
} catch (IOException e) {
throw new GFacHandlerException("Error while reading main input file ", e);
} catch (RegistryException e) {
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/gfac/gfac-bes/src/main/java/org/apache/airavata/gfac/bes/handlers/AbstractSMSHandler.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-bes/src/main/java/org/apache/airavata/gfac/bes/handlers/AbstractSMSHandler.java b/modules/gfac/gfac-bes/src/main/java/org/apache/airavata/gfac/bes/handlers/AbstractSMSHandler.java
index 7b369f7..34a00e3 100644
--- a/modules/gfac/gfac-bes/src/main/java/org/apache/airavata/gfac/bes/handlers/AbstractSMSHandler.java
+++ b/modules/gfac/gfac-bes/src/main/java/org/apache/airavata/gfac/bes/handlers/AbstractSMSHandler.java
@@ -25,7 +25,7 @@ import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.Properties;
-import org.airavata.appcatalog.cpi.AppCatalogException;
+import org.apache.airavata.registry.cpi.AppCatalogException;
import org.apache.airavata.gfac.GFacException;
import org.apache.airavata.gfac.bes.security.UNICORESecurityContext;
import org.apache.airavata.gfac.bes.security.X509SecurityContext;
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/gfac/gfac-bes/src/main/java/org/apache/airavata/gfac/bes/provider/impl/BESProvider.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-bes/src/main/java/org/apache/airavata/gfac/bes/provider/impl/BESProvider.java b/modules/gfac/gfac-bes/src/main/java/org/apache/airavata/gfac/bes/provider/impl/BESProvider.java
index edac12f..19f4e3b 100644
--- a/modules/gfac/gfac-bes/src/main/java/org/apache/airavata/gfac/bes/provider/impl/BESProvider.java
+++ b/modules/gfac/gfac-bes/src/main/java/org/apache/airavata/gfac/bes/provider/impl/BESProvider.java
@@ -23,7 +23,7 @@ package org.apache.airavata.gfac.bes.provider.impl;
import java.util.Calendar;
import java.util.Map;
-import org.airavata.appcatalog.cpi.AppCatalogException;
+import org.apache.airavata.registry.cpi.AppCatalogException;
import org.apache.airavata.common.exception.ApplicationSettingsException;
import org.apache.airavata.gfac.GFacException;
import org.apache.airavata.gfac.bes.security.UNICORESecurityContext;
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/Scheduler.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/Scheduler.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/Scheduler.java
index b9c17e7..c9a1ce0 100644
--- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/Scheduler.java
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/Scheduler.java
@@ -21,8 +21,8 @@
package org.apache.airavata.gfac;
-import org.airavata.appcatalog.cpi.AppCatalog;
-import org.airavata.appcatalog.cpi.AppCatalogException;
+import org.apache.airavata.registry.cpi.AppCatalog;
+import org.apache.airavata.registry.cpi.AppCatalogException;
import org.apache.airavata.gfac.core.context.JobExecutionContext;
import org.apache.airavata.gfac.core.provider.GFacProvider;
import org.apache.airavata.gfac.core.provider.GFacProviderConfig;
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/GFac.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/GFac.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/GFac.java
index d3e1c70..584a581 100644
--- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/GFac.java
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/GFac.java
@@ -20,11 +20,11 @@
*/
package org.apache.airavata.gfac.core;
-import org.airavata.appcatalog.cpi.AppCatalog;
+import org.apache.airavata.registry.cpi.AppCatalog;
import org.apache.airavata.common.utils.MonitorPublisher;
import org.apache.airavata.gfac.GFacException;
import org.apache.airavata.gfac.core.context.JobExecutionContext;
-import org.apache.airavata.registry.cpi.Registry;
+import org.apache.airavata.registry.cpi.ExperimentCatalog;
import org.apache.curator.framework.CuratorFramework;
/**
@@ -35,13 +35,13 @@ public interface GFac {
/**
* Initialized method, this method must call one time before use any other method.
- * @param registry
+ * @param experimentCatalog
* @param appCatalog
* @param curatorClient
* @param publisher
* @return
*/
- public boolean init(Registry registry, AppCatalog appCatalog, CuratorFramework curatorClient, MonitorPublisher publisher);
+ public boolean init(ExperimentCatalog experimentCatalog, AppCatalog appCatalog, CuratorFramework curatorClient, MonitorPublisher publisher);
/**
* This is the job launching method outsiders of GFac can use, this will invoke the GFac handler chain and providers
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/GFacUtils.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/GFacUtils.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/GFacUtils.java
index 3756140..16ffee9 100644
--- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/GFacUtils.java
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/GFacUtils.java
@@ -20,8 +20,8 @@
*/
package org.apache.airavata.gfac.core;
-import org.airavata.appcatalog.cpi.AppCatalog;
-import org.airavata.appcatalog.cpi.AppCatalogException;
+import org.apache.airavata.registry.cpi.AppCatalog;
+import org.apache.airavata.registry.cpi.AppCatalogException;
import org.apache.aiaravata.application.catalog.data.impl.AppCatalogFactory;
import org.apache.airavata.common.exception.ApplicationSettingsException;
import org.apache.airavata.common.utils.AiravataZKUtils;
@@ -57,12 +57,9 @@ import org.apache.airavata.model.workspace.experiment.JobDetails;
import org.apache.airavata.model.workspace.experiment.JobState;
import org.apache.airavata.model.workspace.experiment.JobStatus;
import org.apache.airavata.model.workspace.experiment.TaskState;
-import org.apache.airavata.experiment.catalog.impl.RegistryFactory;
-import org.apache.airavata.registry.cpi.ChildDataType;
-import org.apache.airavata.registry.cpi.CompositeIdentifier;
-import org.apache.airavata.registry.cpi.Registry;
-import org.apache.airavata.registry.cpi.RegistryException;
-import org.apache.airavata.registry.cpi.RegistryModelType;
+import org.apache.airavata.registry.core.experiment.catalog.impl.RegistryFactory;
+import org.apache.airavata.registry.cpi.*;
+import org.apache.airavata.registry.cpi.ExperimentCatalog;
import org.apache.curator.framework.CuratorFramework;
import org.apache.curator.utils.ZKPaths;
import org.apache.zookeeper.CreateMode;
@@ -264,11 +261,11 @@ public class GFacUtils {
JobDetails details, JobState state) throws GFacException {
try {
// first we save job details to the registry for sa and then save the job status.
- Registry registry = jobExecutionContext.getRegistry();
+ ExperimentCatalog experimentCatalog = jobExecutionContext.getExperimentCatalog();
JobStatus status = new JobStatus();
status.setJobState(state);
details.setJobStatus(status);
- registry.add(ChildDataType.JOB_DETAIL, details,
+ experimentCatalog.add(ExpCatChildDataType.JOB_DETAIL, details,
new CompositeIdentifier(jobExecutionContext.getTaskData()
.getTaskID(), details.getJobID()));
JobIdentifier identifier = new JobIdentifier(details.getJobID(), jobExecutionContext.getTaskData().getTaskID(),
@@ -285,14 +282,14 @@ public class GFacUtils {
public static void updateJobStatus(JobExecutionContext jobExecutionContext,
JobDetails details, JobState state) throws GFacException {
try {
- Registry registry = jobExecutionContext.getRegistry();
+ ExperimentCatalog experimentCatalog = jobExecutionContext.getExperimentCatalog();
JobStatus status = new JobStatus();
status.setJobState(state);
status.setTimeOfStateChange(Calendar.getInstance()
.getTimeInMillis());
details.setJobStatus(status);
- registry.update(
- org.apache.airavata.registry.cpi.RegistryModelType.JOB_DETAIL,
+ experimentCatalog.update(
+ ExperimentCatalogModelType.JOB_DETAIL,
details, details.getJobID());
} catch (Exception e) {
throw new GFacException("Error persisting job status"
@@ -305,14 +302,14 @@ public class GFacUtils {
CorrectiveAction action, ErrorCategory errorCatogory)
throws GFacException {
try {
- Registry registry = jobExecutionContext.getRegistry();
+ ExperimentCatalog experimentCatalog = jobExecutionContext.getExperimentCatalog();
ErrorDetails details = new ErrorDetails();
details.setActualErrorMessage(errorMessage);
details.setCorrectiveAction(action);
details.setActionableGroup(ActionableGroup.GATEWAYS_ADMINS);
details.setCreationTime(Calendar.getInstance().getTimeInMillis());
details.setErrorCategory(errorCatogory);
- registry.add(ChildDataType.ERROR_DETAIL, details,
+ experimentCatalog.add(ExpCatChildDataType.ERROR_DETAIL, details,
jobExecutionContext.getTaskData().getTaskID());
} catch (Exception e) {
throw new GFacException("Error persisting job status"
@@ -690,8 +687,8 @@ public class GFacUtils {
}
public static ExperimentState updateExperimentStatus(String experimentId, ExperimentState state) throws RegistryException {
- Registry airavataRegistry = RegistryFactory.getDefaultRegistry();
- Experiment details = (Experiment) airavataRegistry.get(RegistryModelType.EXPERIMENT, experimentId);
+ ExperimentCatalog airavataExperimentCatalog = RegistryFactory.getDefaultRegistry();
+ Experiment details = (Experiment) airavataExperimentCatalog.get(ExperimentCatalogModelType.EXPERIMENT, experimentId);
if (details == null) {
details = new Experiment();
details.setExperimentID(experimentId);
@@ -707,7 +704,7 @@ public class GFacUtils {
}
details.setExperimentStatus(status);
log.info("Updating the experiment status of experiment: " + experimentId + " to " + status.getExperimentState().toString());
- airavataRegistry.update(RegistryModelType.EXPERIMENT_STATUS, status, experimentId);
+ airavataExperimentCatalog.update(ExperimentCatalogModelType.EXPERIMENT_STATUS, status, experimentId);
return details.getExperimentStatus().getExperimentState();
}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/context/JobExecutionContext.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/context/JobExecutionContext.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/context/JobExecutionContext.java
index 67c80cf..9b3f5da 100644
--- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/context/JobExecutionContext.java
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/context/JobExecutionContext.java
@@ -27,8 +27,8 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import org.airavata.appcatalog.cpi.AppCatalog;
-import org.airavata.appcatalog.cpi.AppCatalogException;
+import org.apache.airavata.registry.cpi.AppCatalog;
+import org.apache.airavata.registry.cpi.AppCatalogException;
import org.apache.aiaravata.application.catalog.data.impl.AppCatalogFactory;
import org.apache.airavata.common.utils.MonitorPublisher;
import org.apache.airavata.gfac.GFacConfiguration;
@@ -41,7 +41,7 @@ import org.apache.airavata.model.workspace.experiment.Experiment;
import org.apache.airavata.model.workspace.experiment.JobDetails;
import org.apache.airavata.model.workspace.experiment.TaskDetails;
import org.apache.airavata.model.workspace.experiment.WorkflowNodeDetails;
-import org.apache.airavata.registry.cpi.Registry;
+import org.apache.airavata.registry.cpi.ExperimentCatalog;
import org.apache.curator.framework.CuratorFramework;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -143,7 +143,7 @@ public class JobExecutionContext extends AbstractContext implements Serializable
private String gatewayID;
private String status;
private List<String> outputFileList;
- private Registry registry;
+ private ExperimentCatalog experimentCatalog;
private MonitorPublisher monitorPublisher;
public String getGatewayID() {
@@ -316,16 +316,16 @@ public class JobExecutionContext extends AbstractContext implements Serializable
return outputFileList;
}
- public Registry getRegistry() {
- return registry;
+ public ExperimentCatalog getExperimentCatalog() {
+ return experimentCatalog;
}
public Map<String, SecurityContext> getAllSecurityContexts(){
return securityContext;
}
- public void setRegistry(Registry registry) {
- this.registry = registry;
+ public void setExperimentCatalog(ExperimentCatalog experimentCatalog) {
+ this.experimentCatalog = experimentCatalog;
}
public Experiment getExperiment() {
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/handler/AbstractHandler.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/handler/AbstractHandler.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/handler/AbstractHandler.java
index 27bc424..21c5d06 100644
--- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/handler/AbstractHandler.java
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/handler/AbstractHandler.java
@@ -27,8 +27,8 @@ import org.apache.airavata.gfac.core.GFacUtils;
import org.apache.airavata.model.appcatalog.appinterface.OutputDataObjectType;
import org.apache.airavata.model.messaging.event.TaskIdentifier;
import org.apache.airavata.model.messaging.event.TaskOutputChangeEvent;
-import org.apache.airavata.experiment.catalog.impl.RegistryFactory;
-import org.apache.airavata.registry.cpi.Registry;
+import org.apache.airavata.registry.core.experiment.catalog.impl.RegistryFactory;
+import org.apache.airavata.registry.cpi.ExperimentCatalog;
import org.apache.airavata.registry.cpi.RegistryException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -37,7 +37,7 @@ import java.util.List;
public abstract class AbstractHandler implements GFacHandler {
private static final Logger logger = LoggerFactory.getLogger(AbstractHandler.class);
- protected Registry registry = null;
+ protected ExperimentCatalog experimentCatalog = null;
protected MonitorPublisher publisher = null;
@@ -48,22 +48,22 @@ public abstract class AbstractHandler implements GFacHandler {
} catch (Exception e) {
logger.error("Error saving Recoverable provider state", e);
}
- registry = jobExecutionContext.getRegistry();
- if(registry == null){
+ experimentCatalog = jobExecutionContext.getExperimentCatalog();
+ if(experimentCatalog == null){
try {
- registry = RegistryFactory.getDefaultRegistry();
+ experimentCatalog = RegistryFactory.getDefaultRegistry();
} catch (RegistryException e) {
throw new GFacHandlerException("unable to create registry instance", e);
}
}
}
- public Registry getRegistry() {
- return registry;
+ public ExperimentCatalog getExperimentCatalog() {
+ return experimentCatalog;
}
- public void setRegistry(Registry registry) {
- this.registry = registry;
+ public void setExperimentCatalog(ExperimentCatalog experimentCatalog) {
+ this.experimentCatalog = experimentCatalog;
}
protected void fireTaskOutputChangeEvent(JobExecutionContext jobExecutionContext, List<OutputDataObjectType> outputArray) {
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/provider/AbstractProvider.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/provider/AbstractProvider.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/provider/AbstractProvider.java
index c531cb2..43cf08e 100644
--- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/provider/AbstractProvider.java
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/provider/AbstractProvider.java
@@ -25,8 +25,8 @@ import org.apache.airavata.gfac.GFacException;
import org.apache.airavata.gfac.core.context.JobExecutionContext;
import org.apache.airavata.model.workspace.experiment.JobDetails;
import org.apache.airavata.model.workspace.experiment.JobStatus;
-import org.apache.airavata.experiment.catalog.impl.RegistryFactory;
-import org.apache.airavata.registry.cpi.Registry;
+import org.apache.airavata.registry.core.experiment.catalog.impl.RegistryFactory;
+import org.apache.airavata.registry.cpi.ExperimentCatalog;
import org.apache.airavata.registry.cpi.RegistryException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -34,21 +34,21 @@ import org.slf4j.LoggerFactory;
public abstract class AbstractProvider implements GFacProvider{
private final Logger log = LoggerFactory.getLogger(this.getClass());
- protected Registry registry = null;
+ protected ExperimentCatalog experimentCatalog = null;
protected JobDetails details; //todo we need to remove this and add methods to fill Job details, this is not a property of a provider
protected JobStatus status; //todo we need to remove this and add methods to fill Job details, this is not a property of a provider
protected JobExecutionContext jobExecutionContext;
public void initialize(JobExecutionContext jobExecutionContext) throws GFacProviderException, GFacException {
log.debug("Initializing " + this.getClass().getName());
- if(jobExecutionContext.getRegistry() == null) {
+ if(jobExecutionContext.getExperimentCatalog() == null) {
try {
- registry = RegistryFactory.getDefaultRegistry();
+ experimentCatalog = RegistryFactory.getDefaultRegistry();
} catch (RegistryException e) {
throw new GFacException("Unable to create registry instance", e);
}
}else{
- registry = jobExecutionContext.getRegistry();
+ experimentCatalog = jobExecutionContext.getExperimentCatalog();
}
details = new JobDetails();
status = new JobStatus();
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsissh/handler/GSISSHDirectorySetupHandler.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsissh/handler/GSISSHDirectorySetupHandler.java b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsissh/handler/GSISSHDirectorySetupHandler.java
index 8151647..df91310 100644
--- a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsissh/handler/GSISSHDirectorySetupHandler.java
+++ b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsissh/handler/GSISSHDirectorySetupHandler.java
@@ -29,7 +29,7 @@ import org.apache.airavata.gfac.gsissh.security.GSISecurityContext;
import org.apache.airavata.gfac.gsissh.util.GFACGSISSHUtils;
import org.apache.airavata.gfac.core.cluster.Cluster;
import org.apache.airavata.model.workspace.experiment.*;
-import org.apache.airavata.registry.cpi.ChildDataType;
+import org.apache.airavata.registry.cpi.ExpCatChildDataType;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -90,7 +90,7 @@ public class GSISSHDirectorySetupHandler extends AbstractHandler {
detail.setTransferStatus(status);
detail.setTransferDescription("Working directory = " + workingDirectory);
- registry.add(ChildDataType.DATA_TRANSFER_DETAIL, detail, jobExecutionContext.getTaskData().getTaskID());
+ experimentCatalog.add(ExpCatChildDataType.DATA_TRANSFER_DETAIL, detail, jobExecutionContext.getTaskData().getTaskID());
} catch (Exception e) {
DataTransferDetails detail = new DataTransferDetails();
@@ -99,7 +99,7 @@ public class GSISSHDirectorySetupHandler extends AbstractHandler {
status.setTransferState(TransferState.FAILED);
detail.setTransferStatus(status);
try {
- registry.add(ChildDataType.DATA_TRANSFER_DETAIL, detail, jobExecutionContext.getTaskData().getTaskID());
+ experimentCatalog.add(ExpCatChildDataType.DATA_TRANSFER_DETAIL, detail, jobExecutionContext.getTaskData().getTaskID());
GFacUtils.saveErrorDetails(jobExecutionContext, e.getCause().toString(), CorrectiveAction.CONTACT_SUPPORT, ErrorCategory.FILE_SYSTEM_FAILURE);
} catch (Exception e1) {
throw new GFacHandlerException("Error persisting status", e1, e1.getLocalizedMessage());
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsissh/handler/GSISSHInputHandler.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsissh/handler/GSISSHInputHandler.java b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsissh/handler/GSISSHInputHandler.java
index 72f738f..014ad65 100644
--- a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsissh/handler/GSISSHInputHandler.java
+++ b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsissh/handler/GSISSHInputHandler.java
@@ -37,7 +37,7 @@ import org.apache.airavata.model.workspace.experiment.DataTransferDetails;
import org.apache.airavata.model.workspace.experiment.ErrorCategory;
import org.apache.airavata.model.workspace.experiment.TransferState;
import org.apache.airavata.model.workspace.experiment.TransferStatus;
-import org.apache.airavata.registry.cpi.ChildDataType;
+import org.apache.airavata.registry.cpi.ExpCatChildDataType;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -129,7 +129,7 @@ public class GSISSHInputHandler extends AbstractHandler {
status.setTransferState(TransferState.UPLOAD);
detail.setTransferStatus(status);
detail.setTransferDescription("Input Data Staged: " + stageInputFile);
- registry.add(ChildDataType.DATA_TRANSFER_DETAIL, detail, jobExecutionContext.getTaskData().getTaskID());
+ experimentCatalog.add(ExpCatChildDataType.DATA_TRANSFER_DETAIL, detail, jobExecutionContext.getTaskData().getTaskID());
GFacUtils.saveHandlerData(jobExecutionContext, temp.insert(0, ++index), this.getClass().getName());
}
@@ -165,7 +165,7 @@ public class GSISSHInputHandler extends AbstractHandler {
detail.setTransferStatus(status);
try {
GFacUtils.saveErrorDetails(jobExecutionContext, e.getCause().toString(), CorrectiveAction.CONTACT_SUPPORT, ErrorCategory.FILE_SYSTEM_FAILURE);
- registry.add(ChildDataType.DATA_TRANSFER_DETAIL, detail, jobExecutionContext.getTaskData().getTaskID());
+ experimentCatalog.add(ExpCatChildDataType.DATA_TRANSFER_DETAIL, detail, jobExecutionContext.getTaskData().getTaskID());
} catch (Exception e1) {
throw new GFacHandlerException("Error persisting status", e1, e1.getLocalizedMessage());
}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsissh/handler/GSISSHOutputHandler.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsissh/handler/GSISSHOutputHandler.java b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsissh/handler/GSISSHOutputHandler.java
index 4ad4ae5..a7cb806 100644
--- a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsissh/handler/GSISSHOutputHandler.java
+++ b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsissh/handler/GSISSHOutputHandler.java
@@ -40,7 +40,7 @@ import org.apache.airavata.model.workspace.experiment.ErrorCategory;
import org.apache.airavata.model.workspace.experiment.TaskDetails;
import org.apache.airavata.model.workspace.experiment.TransferState;
import org.apache.airavata.model.workspace.experiment.TransferStatus;
-import org.apache.airavata.registry.cpi.ChildDataType;
+import org.apache.airavata.registry.cpi.ExpCatChildDataType;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -159,12 +159,12 @@ public class GSISSHOutputHandler extends AbstractHandler {
status.setTransferState(TransferState.STDOUT_DOWNLOAD);
detail.setTransferStatus(status);
detail.setTransferDescription("STDOUT:" + localStdOutFile.getAbsolutePath());
- registry.add(ChildDataType.DATA_TRANSFER_DETAIL, detail, jobExecutionContext.getTaskData().getTaskID());
+ experimentCatalog.add(ExpCatChildDataType.DATA_TRANSFER_DETAIL, detail, jobExecutionContext.getTaskData().getTaskID());
status.setTransferState(TransferState.STDERROR_DOWNLOAD);
detail.setTransferStatus(status);
detail.setTransferDescription("STDERR:" + localStdErrFile.getAbsolutePath());
- registry.add(ChildDataType.DATA_TRANSFER_DETAIL, detail, jobExecutionContext.getTaskData().getTaskID());
+ experimentCatalog.add(ExpCatChildDataType.DATA_TRANSFER_DETAIL, detail, jobExecutionContext.getTaskData().getTaskID());
//todo this is a mess we have to fix this
List<OutputDataObjectType> outputArray = new ArrayList<OutputDataObjectType>();
@@ -296,15 +296,15 @@ public class GSISSHOutputHandler extends AbstractHandler {
status.setTransferState(TransferState.DOWNLOAD);
detail.setTransferStatus(status);
detail.setTransferDescription(outputDataDir);
- registry.add(ChildDataType.DATA_TRANSFER_DETAIL, detail, jobExecutionContext.getTaskData().getTaskID());
- registry.add(ChildDataType.EXPERIMENT_OUTPUT, outputArray, jobExecutionContext.getExperimentID());
+ experimentCatalog.add(ExpCatChildDataType.DATA_TRANSFER_DETAIL, detail, jobExecutionContext.getTaskData().getTaskID());
+ experimentCatalog.add(ExpCatChildDataType.EXPERIMENT_OUTPUT, outputArray, jobExecutionContext.getExperimentID());
fireTaskOutputChangeEvent(jobExecutionContext, outputArray);
} catch (Exception e) {
try {
status.setTransferState(TransferState.FAILED);
detail.setTransferStatus(status);
detail.setTransferDescription(e.getLocalizedMessage());
- registry.add(ChildDataType.DATA_TRANSFER_DETAIL, detail, jobExecutionContext.getTaskData().getTaskID());
+ experimentCatalog.add(ExpCatChildDataType.DATA_TRANSFER_DETAIL, detail, jobExecutionContext.getTaskData().getTaskID());
GFacUtils.saveErrorDetails(jobExecutionContext, e.getCause().toString(), CorrectiveAction.CONTACT_SUPPORT, ErrorCategory.FILE_SYSTEM_FAILURE);
} catch (Exception e1) {
throw new GFacHandlerException("Error persisting status", e1, e1.getLocalizedMessage());
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsissh/handler/NewGSISSHOutputHandler.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsissh/handler/NewGSISSHOutputHandler.java b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsissh/handler/NewGSISSHOutputHandler.java
index 03ebb94..f8a6439 100644
--- a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsissh/handler/NewGSISSHOutputHandler.java
+++ b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsissh/handler/NewGSISSHOutputHandler.java
@@ -16,7 +16,7 @@ import org.apache.airavata.gfac.core.cluster.Cluster;
import org.apache.airavata.model.appcatalog.appinterface.OutputDataObjectType;
import org.apache.airavata.model.workspace.experiment.CorrectiveAction;
import org.apache.airavata.model.workspace.experiment.ErrorCategory;
-import org.apache.airavata.registry.cpi.ChildDataType;
+import org.apache.airavata.registry.cpi.ExpCatChildDataType;
import org.apache.airavata.registry.cpi.RegistryException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -63,7 +63,7 @@ public class NewGSISSHOutputHandler extends AbstractHandler{
super.invoke(jobExecutionContext);
List<OutputDataObjectType> outputArray = HandleOutputs.handleOutputs(jobExecutionContext, cluster);
try {
- registry.add(ChildDataType.EXPERIMENT_OUTPUT, outputArray, jobExecutionContext.getExperimentID());
+ experimentCatalog.add(ExpCatChildDataType.EXPERIMENT_OUTPUT, outputArray, jobExecutionContext.getExperimentID());
} catch (RegistryException e) {
throw new GFacHandlerException(e);
}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsissh/provider/impl/GSISSHProvider.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsissh/provider/impl/GSISSHProvider.java b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsissh/provider/impl/GSISSHProvider.java
index 1578b9d..ce7fec8 100644
--- a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsissh/provider/impl/GSISSHProvider.java
+++ b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsissh/provider/impl/GSISSHProvider.java
@@ -20,7 +20,7 @@
*/
package org.apache.airavata.gfac.gsissh.provider.impl;
-import org.airavata.appcatalog.cpi.AppCatalogException;
+import org.apache.airavata.registry.cpi.AppCatalogException;
import org.apache.airavata.common.exception.AiravataException;
import org.apache.airavata.common.exception.ApplicationSettingsException;
import org.apache.airavata.gfac.GFacException;
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsissh/util/GFACGSISSHUtils.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsissh/util/GFACGSISSHUtils.java b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsissh/util/GFACGSISSHUtils.java
index 3a9e83e..622e660 100644
--- a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsissh/util/GFACGSISSHUtils.java
+++ b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsissh/util/GFACGSISSHUtils.java
@@ -20,7 +20,7 @@
*/
package org.apache.airavata.gfac.gsissh.util;
-import org.airavata.appcatalog.cpi.AppCatalog;
+import org.apache.airavata.registry.cpi.AppCatalog;
import org.apache.airavata.common.exception.ApplicationSettingsException;
import org.apache.airavata.common.utils.ServerSettings;
import org.apache.airavata.credential.store.credential.impl.certificate.CertificateCredential;
[47/52] [abbrv] [partial] airavata git commit: registry refactoring
Posted by sh...@apache.org.
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/DataMovementInterface_PK.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/DataMovementInterface_PK.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/DataMovementInterface_PK.java
deleted file mode 100644
index f71046a..0000000
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/DataMovementInterface_PK.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- *
- * 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.aiaravata.application.catalog.data.model;
-
-import java.io.Serializable;
-
-public class DataMovementInterface_PK implements Serializable {
- private String computeResourceId;
- private String dataMovementInterfaceId;
- public DataMovementInterface_PK(String computeResourceId, String dataMovementInterfaceId){
- this.computeResourceId = computeResourceId;
- this.dataMovementInterfaceId = dataMovementInterfaceId;
- }
-
- public DataMovementInterface_PK() {
- }
-
- @Override
- public boolean equals(Object o) {
- return false;
- }
-
- @Override
- public int hashCode() {
- return 1;
- }
-
- public String getComputeResourceId() {
- return computeResourceId;
- }
-
- public String getDataMovementInterfaceId() {
- return dataMovementInterfaceId;
- }
-
- public void setComputeResourceId(String computeResourceId) {
- this.computeResourceId=computeResourceId;
- }
-
- public void setDataMovementInterfaceId(String dataMovementInterfaceId) {
- this.dataMovementInterfaceId=dataMovementInterfaceId;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/DataMovementProtocol.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/DataMovementProtocol.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/DataMovementProtocol.java
deleted file mode 100644
index d45c4e8..0000000
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/DataMovementProtocol.java
+++ /dev/null
@@ -1,76 +0,0 @@
-///*
-// *
-// * 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.aiaravata.application.catalog.data.model;
-//
-//import javax.persistence.*;
-//import java.io.Serializable;
-//
-//@Entity
-//@Table(name = "DATA_MOVEMENT_PROTOCOL")
-//@IdClass(DataMovementProtocolPK.class)
-//public class DataMovementProtocol implements Serializable {
-// @Id
-// @Column(name = "RESOURCE_ID")
-// private String resourceID;
-// @Id
-// @Column(name = "DATA_MOVE_ID")
-// private String dataMoveID;
-// @Id
-// @Column(name = "DATA_MOVE_TYPE")
-// private String dataMoveType;
-//
-// @ManyToOne(cascade= CascadeType.MERGE)
-// @JoinColumn(name = "RESOURCE_ID")
-// private ComputeResource computeResource;
-//
-// public String getResourceID() {
-// return resourceID;
-// }
-//
-// public void setResourceID(String resourceID) {
-// this.resourceID = resourceID;
-// }
-//
-// public String getDataMoveID() {
-// return dataMoveID;
-// }
-//
-// public void setDataMoveID(String dataMoveID) {
-// this.dataMoveID = dataMoveID;
-// }
-//
-// public String getDataMoveType() {
-// return dataMoveType;
-// }
-//
-// public void setDataMoveType(String dataMoveType) {
-// this.dataMoveType = dataMoveType;
-// }
-//
-// public ComputeResource getComputeResource() {
-// return computeResource;
-// }
-//
-// public void setComputeResource(ComputeResource computeResource) {
-// this.computeResource = computeResource;
-// }
-//}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/DataMovementProtocolPK.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/DataMovementProtocolPK.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/DataMovementProtocolPK.java
deleted file mode 100644
index 9e53d1f..0000000
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/DataMovementProtocolPK.java
+++ /dev/null
@@ -1,74 +0,0 @@
-///*
-// *
-// * 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.aiaravata.application.catalog.data.model;
-//
-//import java.io.Serializable;
-//
-//public class DataMovementProtocolPK implements Serializable {
-// private String resourceID;
-// private String dataMoveID;
-// private String dataMoveType;
-//
-// public DataMovementProtocolPK(String resourceID, String dataMoveID, String dataMoveType) {
-// this.resourceID = resourceID;
-// this.dataMoveID = dataMoveID;
-// this.dataMoveType = dataMoveType;
-// }
-//
-// public DataMovementProtocolPK() {
-// ;
-// }
-//
-// @Override
-// public boolean equals(Object o) {
-// return false;
-// }
-//
-// @Override
-// public int hashCode() {
-// return 1;
-// }
-//
-// public String getResourceID() {
-// return resourceID;
-// }
-//
-// public void setResourceID(String resourceID) {
-// this.resourceID = resourceID;
-// }
-//
-// public String getDataMoveID() {
-// return dataMoveID;
-// }
-//
-// public void setDataMoveID(String dataMoveID) {
-// this.dataMoveID = dataMoveID;
-// }
-//
-// public String getDataMoveType() {
-// return dataMoveType;
-// }
-//
-// public void setDataMoveType(String dataMoveType) {
-// this.dataMoveType = dataMoveType;
-// }
-//}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/GSISSHExport.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/GSISSHExport.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/GSISSHExport.java
deleted file mode 100644
index c4d305b..0000000
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/GSISSHExport.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- *
- * 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.aiaravata.application.catalog.data.model;
-
-import java.io.Serializable;
-
-import javax.persistence.CascadeType;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.Id;
-import javax.persistence.IdClass;
-import javax.persistence.JoinColumn;
-import javax.persistence.ManyToOne;
-import javax.persistence.Table;
-
-@Entity
-@Table(name = "GSISSH_EXPORT")
-@IdClass(GSISSHExportPK.class)
-public class GSISSHExport implements Serializable {
- @Id
- @Column(name = "SUBMISSION_ID")
- private String submissionID;
- @Id
- @Column(name = "EXPORT")
- private String export;
-
- @ManyToOne(cascade= CascadeType.MERGE)
- @JoinColumn(name = "SUBMISSION_ID")
- private GSISSHSubmission gsisshJobSubmission;
-
- public String getSubmissionID() {
- return submissionID;
- }
-
- public void setSubmissionID(String submissionID) {
- this.submissionID = submissionID;
- }
-
- public String getExport() {
- return export;
- }
-
- public void setExport(String export) {
- this.export = export;
- }
-
- public GSISSHSubmission getGsisshJobSubmission() {
- return gsisshJobSubmission;
- }
-
- public void setGsisshJobSubmission(GSISSHSubmission gsisshJobSubmission) {
- this.gsisshJobSubmission = gsisshJobSubmission;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/GSISSHExportPK.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/GSISSHExportPK.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/GSISSHExportPK.java
deleted file mode 100644
index 5deb8ed..0000000
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/GSISSHExportPK.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- *
- * 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.aiaravata.application.catalog.data.model;
-
-import java.io.Serializable;
-
-public class GSISSHExportPK implements Serializable {
- private String submissionID;
- private String export;
-
- public GSISSHExportPK(String submissionID, String export) {
- this.submissionID = submissionID;
- this.export = export;
- }
-
- public GSISSHExportPK() {
- ;
- }
-
- @Override
- public boolean equals(Object o) {
- return false;
- }
-
- @Override
- public int hashCode() {
- return 1;
- }
-
- public String getSubmissionID() {
- return submissionID;
- }
-
- public void setSubmissionID(String submissionID) {
- this.submissionID = submissionID;
- }
-
- public String getExport() {
- return export;
- }
-
- public void setExport(String export) {
- this.export = export;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/GSISSHSubmission.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/GSISSHSubmission.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/GSISSHSubmission.java
deleted file mode 100644
index 6793fcf..0000000
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/GSISSHSubmission.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- *
- * 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.aiaravata.application.catalog.data.model;
-
-import javax.persistence.*;
-import java.io.Serializable;
-
-@Entity
-@Table(name = "GSISSH_SUBMISSION")
-public class GSISSHSubmission implements Serializable {
- @Id
- @Column(name = "SUBMISSION_ID")
- private String submissionID;
- @Column(name = "RESOURCE_JOB_MANAGER")
- private String resourceJobManager;
- @Column(name = "SSH_PORT")
- private int sshPort;
- @Column(name = "INSTALLED_PATH")
- private String installedPath;
- @Column(name = "MONITOR_MODE")
- private String monitorMode;
-
- public String getSubmissionID() {
- return submissionID;
- }
-
- public void setSubmissionID(String submissionID) {
- this.submissionID = submissionID;
- }
-
- public String getResourceJobManager() {
- return resourceJobManager;
- }
-
- public void setResourceJobManager(String resourceJobManager) {
- this.resourceJobManager = resourceJobManager;
- }
-
- public int getSshPort() {
- return sshPort;
- }
-
- public void setSshPort(int sshPort) {
- this.sshPort = sshPort;
- }
-
- public String getInstalledPath() {
- return installedPath;
- }
-
- public void setInstalledPath(String installedPath) {
- this.installedPath = installedPath;
- }
-
- public String getMonitorMode() {
- return monitorMode;
- }
-
- public void setMonitorMode(String monitorMode) {
- this.monitorMode = monitorMode;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/GatewayProfile.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/GatewayProfile.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/GatewayProfile.java
deleted file mode 100644
index a771393..0000000
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/GatewayProfile.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- *
- * 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.aiaravata.application.catalog.data.model;
-
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.Id;
-import javax.persistence.Table;
-import java.io.Serializable;
-import java.sql.Timestamp;
-
-@Entity
-@Table(name = "GATEWAY_PROFILE")
-public class GatewayProfile implements Serializable {
- @Id
- @Column(name = "GATEWAY_ID")
- private String gatewayID;
- @Column(name = "CREATION_TIME")
- private Timestamp creationTime;
-
- @Column(name = "UPDATE_TIME")
- private Timestamp updateTime;
-
- public Timestamp getCreationTime() {
- return creationTime;
- }
-
- public void setCreationTime(Timestamp creationTime) {
- this.creationTime = creationTime;
- }
-
- public Timestamp getUpdateTime() {
- return updateTime;
- }
-
- public void setUpdateTime(Timestamp updateTime) {
- this.updateTime = updateTime;
- }
-
-
- public String getGatewayID() {
- return gatewayID;
- }
-
- public void setGatewayID(String gatewayID) {
- this.gatewayID = gatewayID;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/GlobusGKEndPointPK.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/GlobusGKEndPointPK.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/GlobusGKEndPointPK.java
deleted file mode 100644
index a7d9b68..0000000
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/GlobusGKEndPointPK.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- *
- * 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.aiaravata.application.catalog.data.model;
-
-import java.io.Serializable;
-
-public class GlobusGKEndPointPK implements Serializable {
- private String submissionID;
- private String endpoint;
-
- public GlobusGKEndPointPK(String submissionID, String endpoint) {
- this.submissionID = submissionID;
- this.endpoint = endpoint;
- }
-
- public GlobusGKEndPointPK() {
- ;
- }
-
- @Override
- public boolean equals(Object o) {
- return false;
- }
-
- @Override
- public int hashCode() {
- return 1;
- }
-
- public String getSubmissionID() {
- return submissionID;
- }
-
- public void setSubmissionID(String submissionID) {
- this.submissionID = submissionID;
- }
-
- public String getEndpoint() {
- return endpoint;
- }
-
- public void setEndpoint(String endpoint) {
- this.endpoint = endpoint;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/GlobusGKEndpoint.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/GlobusGKEndpoint.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/GlobusGKEndpoint.java
deleted file mode 100644
index 62b8b12..0000000
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/GlobusGKEndpoint.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- *
- * 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.aiaravata.application.catalog.data.model;
-
-import javax.persistence.*;
-import java.io.Serializable;
-
-@Entity
-@Table(name = "GLOBUS_GK_ENDPOINT")
-@IdClass(GlobusGKEndPointPK.class)
-public class GlobusGKEndpoint implements Serializable {
- @Id
- @Column(name = "SUBMISSION_ID")
- private String submissionID;
- @Id
- @Column(name = "ENDPOINT")
- private String endpoint;
-
- @ManyToOne(cascade= CascadeType.MERGE)
- @JoinColumn(name = "SUBMISSION_ID")
- private GlobusJobSubmission globusSubmission;
-
- public String getSubmissionID() {
- return submissionID;
- }
-
- public void setSubmissionID(String submissionID) {
- this.submissionID = submissionID;
- }
-
- public String getEndpoint() {
- return endpoint;
- }
-
- public void setEndpoint(String endpoint) {
- this.endpoint = endpoint;
- }
-
- public GlobusJobSubmission getGlobusSubmission() {
- return globusSubmission;
- }
-
- public void setGlobusSubmission(GlobusJobSubmission globusSubmission) {
- this.globusSubmission = globusSubmission;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/GlobusJobSubmission.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/GlobusJobSubmission.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/GlobusJobSubmission.java
deleted file mode 100644
index 19f80b1..0000000
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/GlobusJobSubmission.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- *
- * 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.aiaravata.application.catalog.data.model;
-
-import javax.persistence.*;
-import java.io.Serializable;
-
-@Entity
-@Table(name = "GLOBUS_SUBMISSION")
-public class GlobusJobSubmission implements Serializable {
- @Id
- @Column(name = "SUBMISSION_ID")
- private String submissionID;
- @Column(name = "RESOURCE_JOB_MANAGER")
- private String resourceJobManager;
- @Column(name = "SECURITY_PROTOCAL")
- private String securityProtocol;
-
- public String getSubmissionID() {
- return submissionID;
- }
-
- public void setSubmissionID(String submissionID) {
- this.submissionID = submissionID;
- }
-
- public String getResourceJobManager() {
- return resourceJobManager;
- }
-
- public void setResourceJobManager(String resourceJobManager) {
- this.resourceJobManager = resourceJobManager;
- }
-
- public String getSecurityProtocol() {
- return securityProtocol;
- }
-
- public void setSecurityProtocol(String securityProtocol) {
- this.securityProtocol = securityProtocol;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/GridftpDataMovement.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/GridftpDataMovement.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/GridftpDataMovement.java
deleted file mode 100644
index 1d5ac9e..0000000
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/GridftpDataMovement.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- *
- * 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.aiaravata.application.catalog.data.model;
-
-import java.io.Serializable;
-import java.sql.Timestamp;
-
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.Id;
-import javax.persistence.Table;
-
-import org.apache.openjpa.persistence.DataCache;
-
-@DataCache
-@Entity
-@Table(name = "GRIDFTP_DATA_MOVEMENT")
-public class GridftpDataMovement implements Serializable {
-
- @Id
- @Column(name = "DATA_MOVEMENT_INTERFACE_ID")
- private String dataMovementInterfaceId;
-
- @Column(name = "SECURITY_PROTOCOL")
- private String securityProtocol;
-
- @Column(name = "CREATION_TIME")
- private Timestamp creationTime;
-
- @Column(name = "UPDATE_TIME")
- private Timestamp updateTime;
-
- public Timestamp getCreationTime() {
- return creationTime;
- }
-
- public void setCreationTime(Timestamp creationTime) {
- this.creationTime = creationTime;
- }
-
- public Timestamp getUpdateTime() {
- return updateTime;
- }
-
- public void setUpdateTime(Timestamp updateTime) {
- this.updateTime = updateTime;
- }
-
- public String getDataMovementInterfaceId() {
- return dataMovementInterfaceId;
- }
-
- public String getSecurityProtocol() {
- return securityProtocol;
- }
-
- public void setDataMovementInterfaceId(String dataMovementInterfaceId) {
- this.dataMovementInterfaceId=dataMovementInterfaceId;
- }
-
- public void setSecurityProtocol(String securityProtocol) {
- this.securityProtocol=securityProtocol;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/GridftpEndpoint.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/GridftpEndpoint.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/GridftpEndpoint.java
deleted file mode 100644
index be2a833..0000000
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/GridftpEndpoint.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- *
- * 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.aiaravata.application.catalog.data.model;
-
-import java.io.Serializable;
-import java.sql.Timestamp;
-
-import javax.persistence.CascadeType;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.Id;
-import javax.persistence.IdClass;
-import javax.persistence.JoinColumn;
-import javax.persistence.ManyToOne;
-import javax.persistence.Table;
-
-import org.apache.openjpa.persistence.DataCache;
-
-@DataCache
-@Entity
-@Table(name = "GRIDFTP_ENDPOINT")
-@IdClass(GridftpEndpoint_PK.class)
-public class GridftpEndpoint implements Serializable {
-
- @Id
- @Column(name = "ENDPOINT")
- private String endpoint;
-
- @Id
- @Column(name = "DATA_MOVEMENT_INTERFACE_ID")
- private String dataMovementInterfaceId;
-
- @ManyToOne(cascade= CascadeType.MERGE)
- @JoinColumn(name = "DATA_MOVEMENT_INTERFACE_ID")
- private GridftpDataMovement gridftpDataMovement;
-
- @Column(name = "CREATION_TIME")
- private Timestamp creationTime;
-
- @Column(name = "UPDATE_TIME")
- private Timestamp updateTime;
-
- public Timestamp getCreationTime() {
- return creationTime;
- }
-
- public void setCreationTime(Timestamp creationTime) {
- this.creationTime = creationTime;
- }
-
- public Timestamp getUpdateTime() {
- return updateTime;
- }
-
- public void setUpdateTime(Timestamp updateTime) {
- this.updateTime = updateTime;
- }
-
-
- public String getEndpoint() {
- return endpoint;
- }
-
- public String getDataMovementInterfaceId() {
- return dataMovementInterfaceId;
- }
-
- public GridftpDataMovement getGridftpDataMovement() {
- return gridftpDataMovement;
- }
-
- public void setEndpoint(String endpoint) {
- this.endpoint=endpoint;
- }
-
- public void setDataMovementInterfaceId(String dataMovementInterfaceId) {
- this.dataMovementInterfaceId=dataMovementInterfaceId;
- }
-
- public void setGridftpDataMovement(GridftpDataMovement gridftpDataMovement) {
- this.gridftpDataMovement=gridftpDataMovement;
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/GridftpEndpoint_PK.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/GridftpEndpoint_PK.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/GridftpEndpoint_PK.java
deleted file mode 100644
index 7055dbc..0000000
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/GridftpEndpoint_PK.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- *
- * 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.aiaravata.application.catalog.data.model;
-
-import java.io.Serializable;
-
-public class GridftpEndpoint_PK implements Serializable {
- private String endpoint;
- private String dataMovementInterfaceId;
- public GridftpEndpoint_PK(String endpoint, String dataMovementInterfaceId){
- this.endpoint = endpoint;
- this.dataMovementInterfaceId = dataMovementInterfaceId;
- }
-
- public GridftpEndpoint_PK() {
- }
-
- @Override
- public boolean equals(Object o) {
- return false;
- }
-
- @Override
- public int hashCode() {
- return 1;
- }
-
- public String getEndpoint() {
- return endpoint;
- }
-
- public String getDataMovementInterfaceId() {
- return dataMovementInterfaceId;
- }
-
- public void setEndpoint(String endpoint) {
- this.endpoint=endpoint;
- }
-
- public void setDataMovementInterfaceId(String dataMovementInterfaceId) {
- this.dataMovementInterfaceId=dataMovementInterfaceId;
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/HostAlias.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/HostAlias.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/HostAlias.java
deleted file mode 100644
index 8005d6f..0000000
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/HostAlias.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- *
- * 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.aiaravata.application.catalog.data.model;
-
-import javax.persistence.*;
-import java.io.Serializable;
-
-@Entity
-@Table(name = "HOST_ALIAS")
-@IdClass(HostAliasPK.class)
-public class HostAlias implements Serializable {
- @Id
- @Column(name = "RESOURCE_ID")
- private String resourceID;
- @Id
- @Column(name = "ALIAS")
- private String alias;
-
- @ManyToOne(cascade= CascadeType.MERGE)
- @JoinColumn(name = "RESOURCE_ID")
- private ComputeResource computeResource;
-
- public String getResourceID() {
- return resourceID;
- }
-
- public void setResourceID(String resourceID) {
- this.resourceID = resourceID;
- }
-
- public String getAlias() {
- return alias;
- }
-
- public void setAlias(String alias) {
- this.alias = alias;
- }
-
- public ComputeResource getComputeResource() {
- return computeResource;
- }
-
- public void setComputeResource(ComputeResource computeResource) {
- this.computeResource = computeResource;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/HostAliasPK.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/HostAliasPK.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/HostAliasPK.java
deleted file mode 100644
index 498e7fa..0000000
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/HostAliasPK.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- *
- * 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.aiaravata.application.catalog.data.model;
-
-import java.io.Serializable;
-
-public class HostAliasPK implements Serializable {
- private String resourceID;
- private String alias;
-
- public HostAliasPK(String resourceID, String alias) {
- this.resourceID = resourceID;
- this.alias = alias;
- }
-
- public HostAliasPK() {
- ;
- }
-
- @Override
- public boolean equals(Object o) {
- return false;
- }
-
- @Override
- public int hashCode() {
- return 1;
- }
-
- public String getResourceID() {
- return resourceID;
- }
-
- public void setResourceID(String resourceID) {
- this.resourceID = resourceID;
- }
-
- public String getAlias() {
- return alias;
- }
-
- public void setAlias(String alias) {
- this.alias = alias;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/HostIPAddress.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/HostIPAddress.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/HostIPAddress.java
deleted file mode 100644
index 4ae29b4..0000000
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/HostIPAddress.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- *
- * 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.aiaravata.application.catalog.data.model;
-
-import javax.persistence.*;
-import java.io.Serializable;
-
-@Entity
-@Table(name = "HOST_IPADDRESS")
-@IdClass(HostIPAddressPK.class)
-public class HostIPAddress implements Serializable {
- @Id
- @Column(name = "RESOURCE_ID")
- private String resourceID;
- @Id
- @Column(name = "IP_ADDRESS")
- private String ipaddress;
-
- @ManyToOne(cascade= CascadeType.MERGE)
- @JoinColumn(name = "RESOURCE_ID")
- private ComputeResource computeResource;
-
- public String getResourceID() {
- return resourceID;
- }
-
- public void setResourceID(String resourceID) {
- this.resourceID = resourceID;
- }
-
- public String getIpaddress() {
- return ipaddress;
- }
-
- public void setIpaddress(String ipaddress) {
- this.ipaddress = ipaddress;
- }
-
- public ComputeResource getComputeResource() {
- return computeResource;
- }
-
- public void setComputeResource(ComputeResource computeResource) {
- this.computeResource = computeResource;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/HostIPAddressPK.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/HostIPAddressPK.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/HostIPAddressPK.java
deleted file mode 100644
index da16e36..0000000
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/HostIPAddressPK.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- *
- * 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.aiaravata.application.catalog.data.model;
-
-import java.io.Serializable;
-
-public class HostIPAddressPK implements Serializable {
- private String resourceID;
- private String ipaddress;
-
- public HostIPAddressPK(String resourceID, String ipaddress) {
- this.resourceID = resourceID;
- this.ipaddress = ipaddress;
- }
-
- public HostIPAddressPK() {
- ;
- }
-
- @Override
- public boolean equals(Object o) {
- return false;
- }
-
- @Override
- public int hashCode() {
- return 1;
- }
-
- public String getResourceID() {
- return resourceID;
- }
-
- public void setResourceID(String resourceID) {
- this.resourceID = resourceID;
- }
-
- public String getIpaddress() {
- return ipaddress;
- }
-
- public void setIpaddress(String ipaddress) {
- this.ipaddress = ipaddress;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/JobManagerCommand.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/JobManagerCommand.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/JobManagerCommand.java
deleted file mode 100644
index ec64d4b..0000000
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/JobManagerCommand.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- *
- * 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.aiaravata.application.catalog.data.model;
-
-import java.io.Serializable;
-
-import javax.persistence.CascadeType;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.Id;
-import javax.persistence.IdClass;
-import javax.persistence.JoinColumn;
-import javax.persistence.ManyToOne;
-import javax.persistence.Table;
-
-import org.apache.openjpa.persistence.DataCache;
-
-@DataCache
-@Entity
-@Table(name = "JOB_MANAGER_COMMAND")
-@IdClass(JobManagerCommand_PK.class)
-public class JobManagerCommand implements Serializable {
-
- @Id
- @Column(name = "RESOURCE_JOB_MANAGER_ID")
- private String resourceJobManagerId;
-
- @ManyToOne(cascade= CascadeType.MERGE)
- @JoinColumn(name = "RESOURCE_JOB_MANAGER_ID")
- private ResourceJobManager resourceJobManager;
-
- @Id
- @Column(name = "COMMAND_TYPE")
- private String commandType;
-
- @Column(name = "COMMAND")
- private String command;
-
- public String getResourceJobManagerId() {
- return resourceJobManagerId;
- }
-
- public ResourceJobManager getResourceJobManager() {
- return resourceJobManager;
- }
-
- public String getCommandType() {
- return commandType;
- }
-
- public String getCommand() {
- return command;
- }
-
- public void setResourceJobManagerId(String resourceJobManagerId) {
- this.resourceJobManagerId=resourceJobManagerId;
- }
-
- public void setResourceJobManager(ResourceJobManager resourceJobManager) {
- this.resourceJobManager=resourceJobManager;
- }
-
- public void setCommandType(String commandType) {
- this.commandType=commandType;
- }
-
- public void setCommand(String command) {
- this.command=command;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/JobManagerCommand_PK.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/JobManagerCommand_PK.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/JobManagerCommand_PK.java
deleted file mode 100644
index fee97bf..0000000
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/JobManagerCommand_PK.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- *
- * 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.aiaravata.application.catalog.data.model;
-
-import java.io.Serializable;
-
-public class JobManagerCommand_PK implements Serializable {
- private String resourceJobManagerId;
- private String commandType;
- public JobManagerCommand_PK(String resourceJobManagerId, String commandType){
- this.resourceJobManagerId = resourceJobManagerId;
- this.commandType = commandType;
- }
-
- public JobManagerCommand_PK() {
- }
-
- @Override
- public boolean equals(Object o) {
- return false;
- }
-
- @Override
- public int hashCode() {
- return 1;
- }
-
- public String getResourceJobManagerId() {
- return resourceJobManagerId;
- }
-
- public String getCommandType() {
- return commandType;
- }
-
- public void setResourceJobManagerId(String resourceJobManagerId) {
- this.resourceJobManagerId=resourceJobManagerId;
- }
-
- public void setCommandType(String commandType) {
- this.commandType=commandType;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/JobSubmissionInterface.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/JobSubmissionInterface.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/JobSubmissionInterface.java
deleted file mode 100644
index 2b89ee7..0000000
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/JobSubmissionInterface.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- *
- * 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.aiaravata.application.catalog.data.model;
-
-import java.io.Serializable;
-import java.sql.Timestamp;
-
-import javax.persistence.CascadeType;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.Id;
-import javax.persistence.IdClass;
-import javax.persistence.JoinColumn;
-import javax.persistence.ManyToOne;
-import javax.persistence.Table;
-
-import org.apache.openjpa.persistence.DataCache;
-
-@DataCache
-@Entity
-@Table(name = "JOB_SUBMISSION_INTERFACE")
-@IdClass(JobSubmissionInterface_PK.class)
-public class JobSubmissionInterface implements Serializable {
-
- @Id
- @Column(name = "JOB_SUBMISSION_INTERFACE_ID")
- private String jobSubmissionInterfaceId;
-
- @Id
- @Column(name = "COMPUTE_RESOURCE_ID")
- private String computeResourceId;
-
- @ManyToOne(cascade= CascadeType.MERGE)
- @JoinColumn(name = "COMPUTE_RESOURCE_ID")
- private ComputeResource computeResource;
-
- @Column(name = "JOB_SUBMISSION_PROTOCOL")
- private String jobSubmissionProtocol;
-
- @Column(name = "PRIORITY_ORDER")
- private int priorityOrder;
-
- @Column(name = "CREATION_TIME")
- private Timestamp creationTime;
-
- @Column(name = "UPDATE_TIME")
- private Timestamp updateTime;
-
- public Timestamp getCreationTime() {
- return creationTime;
- }
-
- public void setCreationTime(Timestamp creationTime) {
- this.creationTime = creationTime;
- }
-
- public Timestamp getUpdateTime() {
- return updateTime;
- }
-
- public void setUpdateTime(Timestamp updateTime) {
- this.updateTime = updateTime;
- }
-
-
- public String getJobSubmissionInterfaceId() {
- return jobSubmissionInterfaceId;
- }
-
- public String getComputeResourceId() {
- return computeResourceId;
- }
-
- public ComputeResource getComputeResource() {
- return computeResource;
- }
-
- public String getJobSubmissionProtocol() {
- return jobSubmissionProtocol;
- }
-
- public int getPriorityOrder() {
- return priorityOrder;
- }
-
- public void setJobSubmissionInterfaceId(String jobSubmissionInterfaceId) {
- this.jobSubmissionInterfaceId=jobSubmissionInterfaceId;
- }
-
- public void setComputeResourceId(String computeResourceId) {
- this.computeResourceId=computeResourceId;
- }
-
- public void setComputeResource(ComputeResource computeResource) {
- this.computeResource=computeResource;
- }
-
- public void setJobSubmissionProtocol(String jobSubmissionProtocol) {
- this.jobSubmissionProtocol=jobSubmissionProtocol;
- }
-
- public void setPriorityOrder(int priorityOrder) {
- this.priorityOrder=priorityOrder;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/JobSubmissionInterface_PK.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/JobSubmissionInterface_PK.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/JobSubmissionInterface_PK.java
deleted file mode 100644
index 25e7f9a..0000000
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/JobSubmissionInterface_PK.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- *
- * 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.aiaravata.application.catalog.data.model;
-
-import java.io.Serializable;
-
-public class JobSubmissionInterface_PK implements Serializable {
- private String jobSubmissionInterfaceId;
- private String computeResourceId;
- public JobSubmissionInterface_PK(String jobSubmissionInterfaceId, String computeResourceId){
- this.jobSubmissionInterfaceId = jobSubmissionInterfaceId;
- this.computeResourceId = computeResourceId;
- }
-
- public JobSubmissionInterface_PK() {
- }
-
- @Override
- public boolean equals(Object o) {
- return false;
- }
-
- @Override
- public int hashCode() {
- return 1;
- }
-
- public String getJobSubmissionInterfaceId() {
- return jobSubmissionInterfaceId;
- }
-
- public String getComputeResourceId() {
- return computeResourceId;
- }
-
- public void setJobSubmissionInterfaceId(String jobSubmissionInterfaceId) {
- this.jobSubmissionInterfaceId=jobSubmissionInterfaceId;
- }
-
- public void setComputeResourceId(String computeResourceId) {
- this.computeResourceId=computeResourceId;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/JobSubmissionProtocol.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/JobSubmissionProtocol.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/JobSubmissionProtocol.java
deleted file mode 100644
index d913e58..0000000
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/JobSubmissionProtocol.java
+++ /dev/null
@@ -1,77 +0,0 @@
-///*
-// *
-// * 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.aiaravata.application.catalog.data.model;
-//
-//import javax.persistence.*;
-//import java.io.Serializable;
-//
-//@Entity
-//@Table(name = "JOB_SUBMISSION_PROTOCOL")
-//@IdClass(JobSubmissionProtocolPK.class)
-//public class JobSubmissionProtocol implements Serializable {
-// @Id
-// @Column(name = "RESOURCE_ID")
-// private String resourceID;
-// @Id
-// @Column(name = "SUBMISSION_ID")
-// private String submissionID;
-//
-// @Id
-// @Column(name = "JOB_TYPE")
-// private String jobType;
-//
-// @ManyToOne(cascade= CascadeType.MERGE)
-// @JoinColumn(name = "RESOURCE_ID")
-// private ComputeResource computeResource;
-//
-// public String getResourceID() {
-// return resourceID;
-// }
-//
-// public void setResourceID(String resourceID) {
-// this.resourceID = resourceID;
-// }
-//
-// public String getSubmissionID() {
-// return submissionID;
-// }
-//
-// public void setSubmissionID(String submissionID) {
-// this.submissionID = submissionID;
-// }
-//
-// public String getJobType() {
-// return jobType;
-// }
-//
-// public void setJobType(String jobType) {
-// this.jobType = jobType;
-// }
-//
-// public ComputeResource getComputeResource() {
-// return computeResource;
-// }
-//
-// public void setComputeResource(ComputeResource computeResource) {
-// this.computeResource = computeResource;
-// }
-//}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/JobSubmissionProtocolPK.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/JobSubmissionProtocolPK.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/JobSubmissionProtocolPK.java
deleted file mode 100644
index aefe87a..0000000
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/JobSubmissionProtocolPK.java
+++ /dev/null
@@ -1,74 +0,0 @@
-///*
-// *
-// * 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.aiaravata.application.catalog.data.model;
-//
-//import java.io.Serializable;
-//
-//public class JobSubmissionProtocolPK implements Serializable {
-// private String resourceID;
-// private String submissionID;
-// private String jobType;
-//
-// public JobSubmissionProtocolPK(String resourceID, String submissionID, String jobType) {
-// this.resourceID = resourceID;
-// this.submissionID = submissionID;
-// this.jobType = jobType;
-// }
-//
-// public JobSubmissionProtocolPK() {
-// ;
-// }
-//
-// @Override
-// public boolean equals(Object o) {
-// return false;
-// }
-//
-// @Override
-// public int hashCode() {
-// return 1;
-// }
-//
-// public String getResourceID() {
-// return resourceID;
-// }
-//
-// public void setResourceID(String resourceID) {
-// this.resourceID = resourceID;
-// }
-//
-// public String getSubmissionID() {
-// return submissionID;
-// }
-//
-// public void setSubmissionID(String submissionID) {
-// this.submissionID = submissionID;
-// }
-//
-// public String getJobType() {
-// return jobType;
-// }
-//
-// public void setJobType(String jobType) {
-// this.jobType = jobType;
-// }
-//}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/LibraryApendPath.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/LibraryApendPath.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/LibraryApendPath.java
deleted file mode 100644
index 6df1f45..0000000
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/LibraryApendPath.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- *
- * 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.aiaravata.application.catalog.data.model;
-
-import javax.persistence.*;
-import java.io.Serializable;
-
-@Entity
-@Table(name = "LIBRARY_APEND_PATH")
-@IdClass(LibraryApendPath_PK.class)
-public class LibraryApendPath implements Serializable {
- @Id
- @Column(name = "DEPLOYMENT_ID")
- private String deploymentID;
- @Id
- @Column(name = "NAME")
- private String name;
-
- @Column(name = "VALUE")
- private String value;
-
- @ManyToOne(cascade= CascadeType.MERGE)
- @JoinColumn(name = "DEPLOYMENT_ID")
- private ApplicationDeployment applicationDeployment;
-
- public String getDeploymentID() {
- return deploymentID;
- }
-
- public void setDeploymentID(String deploymentID) {
- this.deploymentID = deploymentID;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public String getValue() {
- return value;
- }
-
- public void setValue(String value) {
- this.value = value;
- }
-
- public ApplicationDeployment getApplicationDeployment() {
- return applicationDeployment;
- }
-
- public void setApplicationDeployment(ApplicationDeployment applicationDeployment) {
- this.applicationDeployment = applicationDeployment;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/LibraryApendPath_PK.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/LibraryApendPath_PK.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/LibraryApendPath_PK.java
deleted file mode 100644
index 3969a9b..0000000
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/LibraryApendPath_PK.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- *
- * 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.aiaravata.application.catalog.data.model;
-
-import java.io.Serializable;
-
-public class LibraryApendPath_PK implements Serializable {
- private String deploymentID;
- private String name;
-
- public LibraryApendPath_PK(String deploymentID, String name) {
- this.deploymentID = deploymentID;
- this.name = name;
- }
-
- public LibraryApendPath_PK() {
- ;
- }
-
- @Override
- public boolean equals(Object o) {
- return false;
- }
-
- @Override
- public int hashCode() {
- return 1;
- }
-
- public String getDeploymentID() {
- return deploymentID;
- }
-
- public void setDeploymentID(String deploymentID) {
- this.deploymentID = deploymentID;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/LibraryPrepandPath.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/LibraryPrepandPath.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/LibraryPrepandPath.java
deleted file mode 100644
index f01855e..0000000
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/LibraryPrepandPath.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- *
- * 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.aiaravata.application.catalog.data.model;
-
-import javax.persistence.*;
-import java.io.Serializable;
-
-@Entity
-@Table(name = "LIBRARY_PREPAND_PATH")
-@IdClass(LibraryPrepandPath_PK.class)
-public class LibraryPrepandPath implements Serializable {
- @Id
- @Column(name = "DEPLOYMENT_ID")
- private String deploymentID;
- @Id
- @Column(name = "NAME")
- private String name;
-
- @Column(name = "VALUE")
- private String value;
-
- @ManyToOne(cascade= CascadeType.MERGE)
- @JoinColumn(name = "DEPLOYMENT_ID")
- private ApplicationDeployment applicationDeployment;
-
- public String getDeploymentID() {
- return deploymentID;
- }
-
- public void setDeploymentID(String deploymentID) {
- this.deploymentID = deploymentID;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public String getValue() {
- return value;
- }
-
- public void setValue(String value) {
- this.value = value;
- }
-
- public ApplicationDeployment getApplicationDeployment() {
- return applicationDeployment;
- }
-
- public void setApplicationDeployment(ApplicationDeployment applicationDeployment) {
- this.applicationDeployment = applicationDeployment;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/LibraryPrepandPath_PK.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/LibraryPrepandPath_PK.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/LibraryPrepandPath_PK.java
deleted file mode 100644
index a944f32..0000000
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/LibraryPrepandPath_PK.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- *
- * 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.aiaravata.application.catalog.data.model;
-
-import java.io.Serializable;
-
-public class LibraryPrepandPath_PK implements Serializable {
- private String deploymentID;
- private String name;
-
- public LibraryPrepandPath_PK(String deploymentID, String name) {
- this.deploymentID = deploymentID;
- this.name = name;
- }
-
- public LibraryPrepandPath_PK() {
- ;
- }
-
- @Override
- public boolean equals(Object o) {
- return false;
- }
-
- @Override
- public int hashCode() {
- return 1;
- }
-
- public String getDeploymentID() {
- return deploymentID;
- }
-
- public void setDeploymentID(String deploymentID) {
- this.deploymentID = deploymentID;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/LocalDataMovement.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/LocalDataMovement.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/LocalDataMovement.java
deleted file mode 100644
index de637ea..0000000
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/LocalDataMovement.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- *
- * 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.aiaravata.application.catalog.data.model;
-
-import java.io.Serializable;
-
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.Id;
-import javax.persistence.Table;
-
-import org.apache.openjpa.persistence.DataCache;
-
-@DataCache
-@Entity
-@Table(name = "LOCAL_DATA_MOVEMENT")
-public class LocalDataMovement implements Serializable {
-
- @Id
- @Column(name = "DATA_MOVEMENT_INTERFACE_ID")
- private String dataMovementInterfaceId;
-
- public String getDataMovementInterfaceId() {
- return dataMovementInterfaceId;
- }
-
- public void setDataMovementInterfaceId(String dataMovementInterfaceId) {
- this.dataMovementInterfaceId=dataMovementInterfaceId;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/LocalSubmission.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/LocalSubmission.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/LocalSubmission.java
deleted file mode 100644
index 01df76b..0000000
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/LocalSubmission.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- *
- * 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.aiaravata.application.catalog.data.model;
-
-import java.io.Serializable;
-import java.sql.Timestamp;
-
-import javax.persistence.CascadeType;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.Id;
-import javax.persistence.JoinColumn;
-import javax.persistence.ManyToOne;
-import javax.persistence.Table;
-
-import org.apache.openjpa.persistence.DataCache;
-
-@DataCache
-@Entity
-@Table(name = "LOCAL_SUBMISSION")
-public class LocalSubmission implements Serializable {
-
- @Column(name = "RESOURCE_JOB_MANAGER_ID")
- private String resourceJobManagerId;
-
- @ManyToOne(cascade= CascadeType.MERGE)
- @JoinColumn(name = "RESOURCE_JOB_MANAGER_ID")
- private ResourceJobManager resourceJobManager;
-
- @Id
- @Column(name = "JOB_SUBMISSION_INTERFACE_ID")
- private String jobSubmissionInterfaceId;
-
- @Column(name = "CREATION_TIME")
- private Timestamp creationTime;
-
- @Column(name = "UPDATE_TIME")
- private Timestamp updateTime;
-
- public Timestamp getCreationTime() {
- return creationTime;
- }
-
- public void setCreationTime(Timestamp creationTime) {
- this.creationTime = creationTime;
- }
-
- public Timestamp getUpdateTime() {
- return updateTime;
- }
-
- public void setUpdateTime(Timestamp updateTime) {
- this.updateTime = updateTime;
- }
-
- public String getResourceJobManagerId() {
- return resourceJobManagerId;
- }
-
- public ResourceJobManager getResourceJobManager() {
- return resourceJobManager;
- }
-
- public String getJobSubmissionInterfaceId() {
- return jobSubmissionInterfaceId;
- }
-
- public void setResourceJobManagerId(String resourceJobManagerId) {
- this.resourceJobManagerId=resourceJobManagerId;
- }
-
- public void setResourceJobManager(ResourceJobManager resourceJobManager) {
- this.resourceJobManager=resourceJobManager;
- }
-
- public void setJobSubmissionInterfaceId(String jobSubmissionInterfaceId) {
- this.jobSubmissionInterfaceId=jobSubmissionInterfaceId;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/ModuleLoadCmd.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/ModuleLoadCmd.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/ModuleLoadCmd.java
deleted file mode 100644
index 7204390..0000000
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/ModuleLoadCmd.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- *
- * 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.aiaravata.application.catalog.data.model;
-
-import org.apache.openjpa.persistence.DataCache;
-
-import javax.persistence.*;
-import java.io.Serializable;
-
-@DataCache
-@Entity
-@Table(name = "MODULE_LOAD_CMD")
-@IdClass(ModuleLoadCmd_PK.class)
-public class ModuleLoadCmd implements Serializable {
-
- @Id
- @Column(name = "CMD")
- private String cmd;
-
- @Id
- @Column(name = "APP_DEPLOYMENT_ID")
- private String appDeploymentId;
-
- @ManyToOne(cascade= CascadeType.MERGE)
- @JoinColumn(name = "APP_DEPLOYMENT_ID")
- private ApplicationDeployment applicationDeployment;
-
- public String getCmd() {
- return cmd;
- }
-
- public String getAppDeploymentId() {
- return appDeploymentId;
- }
-
- public ApplicationDeployment getApplicationDeployment() {
- return applicationDeployment;
- }
-
- public void setCmd(String cmd) {
- this.cmd=cmd;
- }
-
- public void setAppDeploymentId(String appDeploymentId) {
- this.appDeploymentId=appDeploymentId;
- }
-
- public void setApplicationDeployment(ApplicationDeployment applicationDeployment) {
- this.applicationDeployment=applicationDeployment;
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/ModuleLoadCmd_PK.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/ModuleLoadCmd_PK.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/ModuleLoadCmd_PK.java
deleted file mode 100644
index cb38153..0000000
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/ModuleLoadCmd_PK.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- *
- * 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.aiaravata.application.catalog.data.model;
-
-import java.io.Serializable;
-
-public class ModuleLoadCmd_PK implements Serializable {
- private String cmd;
- private String appDeploymentId;
-
- public ModuleLoadCmd_PK(){
- }
-
- public ModuleLoadCmd_PK(String cmd, String appDeploymentId){
- this.cmd = cmd;
- this.appDeploymentId = appDeploymentId;
- }
-
- @Override
- public boolean equals(Object o) {
- return false;
- }
-
- @Override
- public int hashCode() {
- return 1;
- }
-
- public String getCmd() {
- return cmd;
- }
-
- public String getAppDeploymentId() {
- return appDeploymentId;
- }
-
- public void setCmd(String cmd) {
- this.cmd=cmd;
- }
-
- public void setAppDeploymentId(String appDeploymentId) {
- this.appDeploymentId=appDeploymentId;
- }
-}
[27/52] [abbrv] [partial] airavata git commit: registry refactoring
Posted by sh...@apache.org.
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/NodeOutputResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/NodeOutputResource.java b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/NodeOutputResource.java
deleted file mode 100644
index 5edc314..0000000
--- a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/NodeOutputResource.java
+++ /dev/null
@@ -1,207 +0,0 @@
-/*
- *
- * 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.experiment.catalog.resources;
-
-import java.util.List;
-
-import javax.persistence.EntityManager;
-
-import org.apache.airavata.experiment.catalog.Resource;
-import org.apache.airavata.experiment.catalog.ResourceType;
-import org.apache.airavata.experiment.catalog.ResourceUtils;
-import org.apache.airavata.experiment.catalog.model.NodeOutput;
-import org.apache.airavata.experiment.catalog.model.NodeOutput_PK;
-import org.apache.airavata.registry.cpi.RegistryException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class NodeOutputResource extends AbstractResource {
- private static final Logger logger = LoggerFactory.getLogger(NodeOutputResource.class);
-
- private String nodeId;
- private String outputKey;
- private String dataType;
- private String value;
- private boolean isRequired;
- private boolean dataMovement;
- private String dataNameLocation;
- private boolean requiredToCMD;
- private String searchQuery;
- private String appArgument;
-
- public String getSearchQuery() {
- return searchQuery;
- }
-
- public void setSearchQuery(String searchQuery) {
- this.searchQuery = searchQuery;
- }
-
- public String getAppArgument() {
- return appArgument;
- }
-
- public void setAppArgument(String appArgument) {
- this.appArgument = appArgument;
- }
-
-
- public boolean getRequiredToCMD() {
- return requiredToCMD;
- }
-
- public void setRequiredToCMD(boolean requiredToCMD) {
- this.requiredToCMD = requiredToCMD;
- }
-
- public boolean getRequired() {
- return isRequired;
- }
-
- public void setRequired(boolean required) {
- this.isRequired = required;
- }
-
- public boolean isDataMovement() {
- return dataMovement;
- }
-
- public void setDataMovement(boolean dataMovement) {
- this.dataMovement = dataMovement;
- }
-
- public String getDataNameLocation() {
- return dataNameLocation;
- }
-
- public void setDataNameLocation(String dataNameLocation) {
- this.dataNameLocation = dataNameLocation;
- }
-
- public String getNodeId() {
- return nodeId;
- }
-
- public void setNodeId(String nodeId) {
- this.nodeId = nodeId;
- }
-
- public String getOutputKey() {
- return outputKey;
- }
-
- public void setOutputKey(String outputKey) {
- this.outputKey = outputKey;
- }
-
- public String getDataType() {
- return dataType;
- }
-
- public void setDataType(String dataType) {
- this.dataType = dataType;
- }
-
- public String getValue() {
- return value;
- }
-
- public void setValue(String value) {
- this.value = value;
- }
-
-
- public Resource create(ResourceType type) throws RegistryException {
- logger.error("Unsupported resource type for node output data resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
-
- public void remove(ResourceType type, Object name) throws RegistryException{
- logger.error("Unsupported resource type for node output data resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
-
- public Resource get(ResourceType type, Object name) throws RegistryException{
- logger.error("Unsupported resource type for node output data resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
-
- public List<Resource> get(ResourceType type) throws RegistryException{
- logger.error("Unsupported resource type for node output data resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
-
- public void save() throws RegistryException{
- EntityManager em = null;
- try {
- em = ResourceUtils.getEntityManager();
- NodeOutput existingOutput = em.find(NodeOutput.class, new NodeOutput_PK(outputKey, nodeId));
- em.close();
-
- em = ResourceUtils.getEntityManager();
- em.getTransaction().begin();
- NodeOutput nodeOutput = new NodeOutput();
- nodeOutput.setNodeId(nodeId);
- nodeOutput.setOutputKey(outputKey);
- nodeOutput.setDataType(dataType);
- nodeOutput.setValue(value);
- nodeOutput.setRequired(isRequired);
- nodeOutput.setRequiredToCMD(requiredToCMD);
- nodeOutput.setDataMovement(dataMovement);
- nodeOutput.setDataNameLocation(dataNameLocation);
- nodeOutput.setApplicationArgument(appArgument);
- nodeOutput.setSearchQuery(searchQuery);
-
- if (existingOutput != null) {
- existingOutput.setNodeId(nodeId);
- existingOutput.setOutputKey(outputKey);
- existingOutput.setDataType(dataType);
- existingOutput.setValue(value);
- existingOutput.setRequired(isRequired);
- existingOutput.setRequiredToCMD(requiredToCMD);
- existingOutput.setDataMovement(dataMovement);
- existingOutput.setDataNameLocation(dataNameLocation);
- existingOutput.setApplicationArgument(appArgument);
- existingOutput.setSearchQuery(searchQuery);
- nodeOutput = em.merge(existingOutput);
- } else {
- em.persist(nodeOutput);
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new RegistryException(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/ec8c6202/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/NotificationEmailResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/NotificationEmailResource.java b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/NotificationEmailResource.java
deleted file mode 100644
index 1bcce9c..0000000
--- a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/NotificationEmailResource.java
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
-*
-* 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.experiment.catalog.resources;
-
-import org.apache.airavata.experiment.catalog.Resource;
-import org.apache.airavata.experiment.catalog.ResourceType;
-import org.apache.airavata.experiment.catalog.ResourceUtils;
-import org.apache.airavata.experiment.catalog.model.*;
-import org.apache.airavata.registry.cpi.RegistryException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.persistence.EntityManager;
-import java.util.List;
-
-public class NotificationEmailResource extends AbstractResource {
- private static final Logger logger = LoggerFactory.getLogger(NotificationEmailResource.class);
-
- private int emailId = 0;
- private String experimentId;
- private String taskId;
- private String emailAddress;
-
-
- public String getEmailAddress() {
- return emailAddress;
- }
-
- public void setEmailAddress(String emailAddress) {
- this.emailAddress = emailAddress;
- }
-
- public String getExperimentId() {
- return experimentId;
- }
-
- public void setExperimentId(String experimentId) {
- this.experimentId = experimentId;
- }
-
- public String getTaskId() {
- return taskId;
- }
-
- public void setTaskId(String taskId) {
- this.taskId = taskId;
- }
-
- public Resource create(ResourceType type) throws RegistryException {
- logger.error("Unsupported resource type for experiment input data resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
- public void remove(ResourceType type, Object name) throws RegistryException{
- logger.error("Unsupported resource type for experiment input data resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
- public Resource get(ResourceType type, Object name) throws RegistryException {
- logger.error("Unsupported resource type for experiment input data resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
- public List<Resource> get(ResourceType type) throws RegistryException {
- logger.error("Unsupported resource type for experiment input data resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
- public void save() throws RegistryException{
- EntityManager em = null;
- try {
- em = ResourceUtils.getEntityManager();
- em.getTransaction().begin();
- Notification_Email notification_email;
- if (emailId != 0 ){
- notification_email = em.find(Notification_Email.class, emailId);
- notification_email.setEmailId(emailId);
- }else {
- notification_email = new Notification_Email();
- }
- notification_email.setExperiment_id(experimentId);
- notification_email.setTaskId(taskId);
- notification_email.setEmailAddress(emailAddress);
- em.persist(notification_email);
- emailId = notification_email.getEmailId();
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new RegistryException(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/ec8c6202/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/ProjectResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/ProjectResource.java b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/ProjectResource.java
deleted file mode 100644
index 687a8cb..0000000
--- a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/ProjectResource.java
+++ /dev/null
@@ -1,508 +0,0 @@
-/*
- *
- * 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.experiment.catalog.resources;
-
-import org.apache.airavata.experiment.catalog.Resource;
-import org.apache.airavata.experiment.catalog.ResourceType;
-import org.apache.airavata.experiment.catalog.ResourceUtils;
-import org.apache.airavata.experiment.catalog.model.*;
-import org.apache.airavata.experiment.catalog.utils.QueryGenerator;
-import org.apache.airavata.registry.cpi.RegistryException;
-import org.apache.airavata.registry.cpi.ResultOrderType;
-import org.apache.airavata.registry.cpi.utils.Constants;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.persistence.EntityManager;
-import javax.persistence.Query;
-import java.sql.Timestamp;
-import java.util.ArrayList;
-import java.util.List;
-
-public class ProjectResource extends AbstractResource {
- private final static Logger logger = LoggerFactory.getLogger(ProjectResource.class);
- private String name;
- private String id;
- private String gatewayId;
- private WorkerResource worker;
- private String description;
- private Timestamp creationTime;
-
- /**
- *
- */
- public ProjectResource() {
- }
-
- /**
- *
- * @param type child resource type
- * @return child resource
- */
- public Resource create(ResourceType type) throws RegistryException {
- if (type == ResourceType.EXPERIMENT) {
- ExperimentResource experimentResource = new ExperimentResource();
- experimentResource.setGatewayId(gatewayId);
- experimentResource.setExecutionUser(worker.getUser());
- experimentResource.setProjectId(id);
- return experimentResource;
- } else if (type == ResourceType.PROJECT_USER){
- ProjectUserResource pr = new ProjectUserResource();
- pr.setProjectId(id);
- pr.setUserName(worker.getUser());
- return pr;
- }
- else {
- logger.error("Unsupported resource type for project resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported resource type for project resource.");
- }
- }
-
- /**
- *
- * @param type child resource type
- * @param name child resource name
- */
- public void remove(ResourceType type, Object name) throws RegistryException{
- EntityManager em = null;
- try {
- em = ResourceUtils.getEntityManager();
- em.getTransaction().begin();
- if (type == ResourceType.EXPERIMENT) {
- QueryGenerator generator = new QueryGenerator(EXPERIMENT);
- generator.setParameter(ExperimentConstants.EXPERIMENT_ID, name);
- Query q = generator.deleteQuery(em);
- q.executeUpdate();
- } else if (type == ResourceType.PROJECT_USER) {
- QueryGenerator generator = new QueryGenerator(PROJECT_USER);
- generator.setParameter(ProjectUserConstants.USERNAME, name);
- generator.setParameter(ProjectUserConstants.PROJECT_ID, this.id);
- Query q = generator.deleteQuery(em);
- q.executeUpdate();
- } else {
- logger.error("Unsupported resource type for project resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported resource type for project resource.");
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new RegistryException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- /**
- *
- * @param type child resource type
- * @param name child resource name
- * @return child resource
- */
- public Resource get(ResourceType type, Object name) throws RegistryException {
- EntityManager em = null;
- try {
- if (type == ResourceType.EXPERIMENT) {
- em = ResourceUtils.getEntityManager();
- em.getTransaction().begin();
- QueryGenerator generator = new QueryGenerator(EXPERIMENT);
- generator.setParameter(ExperimentConstants.EXPERIMENT_ID, name);
- Query q = generator.selectQuery(em);
- Experiment experiment = (Experiment) q.getSingleResult();
- ExperimentResource experimentResource = (ExperimentResource)
- Utils.getResource(ResourceType.EXPERIMENT, experiment);
- em.getTransaction().commit();
- em.close();
- return experimentResource;
- } else if (type == ResourceType.PROJECT_USER) {
- em = ResourceUtils.getEntityManager();
- em.getTransaction().begin();
- QueryGenerator generator = new QueryGenerator(PROJECT_USER);
- generator.setParameter(ProjectUserConstants.USERNAME, name);
- generator.setParameter(ProjectUserConstants.PROJECT_ID, this.id);
- Query q = generator.selectQuery(em);
- ProjectUser prUser = (ProjectUser) q.getSingleResult();
- ExperimentResource experimentResource = (ExperimentResource)
- Utils.getResource(ResourceType.PROJECT_USER, prUser);
- em.getTransaction().commit();
- em.close();
- return experimentResource;
- } else {
- logger.error("Unsupported resource type for project resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported resource type for project resource.");
- }
- } catch (Exception e) {
- throw new RegistryException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- /**
- *
- * @param type child resource type
- * @return list of child resources
- */
- @Override
- public List<Resource> get(ResourceType type) throws RegistryException{
- List<Resource> resourceList = new ArrayList<Resource>();
- EntityManager em = null;
- try {
- if (type == ResourceType.EXPERIMENT) {
- em = ResourceUtils.getEntityManager();
- em.getTransaction().begin();
- QueryGenerator generator = new QueryGenerator(EXPERIMENT);
- generator.setParameter(ExperimentConstants.PROJECT_ID, id);
- Query q = generator.selectQuery(em);
- List<?> results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- Experiment experiment = (Experiment) result;
- ExperimentResource experimentResource = (ExperimentResource)
- Utils.getResource(ResourceType.EXPERIMENT, experiment);
- resourceList.add(experimentResource);
- }
- }
- em.getTransaction().commit();
- em.close();
- } else if (type == ResourceType.PROJECT_USER) {
- em = ResourceUtils.getEntityManager();
- em.getTransaction().begin();
- QueryGenerator generator = new QueryGenerator(PROJECT_USER);
- generator.setParameter(ProjectUserConstants.PROJECT_ID, id);
- Query q = generator.selectQuery(em);
- List<?> results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- ProjectUser projectUser = (ProjectUser) result;
- ProjectUserResource pr = (ProjectUserResource)
- Utils.getResource(ResourceType.PROJECT_USER, projectUser);
- resourceList.add(pr);
- }
- }
- em.getTransaction().commit();
- em.close();
- } else {
- logger.error("Unsupported resource type for project resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported resource type for project resource.");
- }
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new RegistryException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- return resourceList;
- }
-
- /**
- * Get results with pagination and ordering
- *
- * @param type
- * @param limit
- * @param offset
- * @param orderByIdentifier
- * @return
- * @throws RegistryException
- */
- public List<Resource> get(ResourceType type, int limit, int offset, Object orderByIdentifier,
- ResultOrderType resultOrderType) throws RegistryException{
- List<Resource> resourceList = new ArrayList<Resource>();
- EntityManager em = null;
- try {
- if (type == ResourceType.EXPERIMENT) {
- em = ResourceUtils.getEntityManager();
- em.getTransaction().begin();
- QueryGenerator generator = new QueryGenerator(EXPERIMENT);
- generator.setParameter(ExperimentConstants.PROJECT_ID, id);
- Query q;
- //ordering - supported only by CREATION_TIME
- if(orderByIdentifier != null && resultOrderType != null
- && orderByIdentifier.equals(Constants.FieldConstants.ExperimentConstants.CREATION_TIME)) {
- q = generator.selectQuery(em, ExperimentConstants.CREATION_TIME, resultOrderType);
- }else{
- q = generator.selectQuery(em);
- }
-
- //pagination
- if(limit>0 && offset>=0){
- q.setFirstResult(offset);
- q.setMaxResults(limit);
- }
- List<?> results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- Experiment experiment = (Experiment) result;
- ExperimentResource experimentResource = (ExperimentResource)
- Utils.getResource(ResourceType.EXPERIMENT, experiment);
- resourceList.add(experimentResource);
- }
- }
- em.getTransaction().commit();
- em.close();
- } else if (type == ResourceType.PROJECT_USER) {
- em = ResourceUtils.getEntityManager();
- em.getTransaction().begin();
- QueryGenerator generator = new QueryGenerator(PROJECT_USER);
- generator.setParameter(ProjectUserConstants.PROJECT_ID, id);
- Query q;
- //ordering - only supported only by CREATION_TIME
- if(orderByIdentifier != null && resultOrderType != null
- && orderByIdentifier.equals(Constants.FieldConstants.ProjectConstants.CREATION_TIME)) {
- q = generator.selectQuery(em, ProjectConstants.CREATION_TIME, resultOrderType);
- }else{
- q = generator.selectQuery(em);
- }
-
- //pagination
- if(limit>0 && offset>=0){
- q.setFirstResult(offset);
- q.setMaxResults(limit);
- }
- List<?> results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- ProjectUser projectUser = (ProjectUser) result;
- ProjectUserResource pr = (ProjectUserResource)
- Utils.getResource(ResourceType.PROJECT_USER, projectUser);
- resourceList.add(pr);
- }
- }
- em.getTransaction().commit();
- em.close();
- } else {
- logger.error("Unsupported resource type for project resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported resource type for project resource.");
- }
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new RegistryException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- return resourceList;
- }
-
- /**
- * save project to the database
- */
- public void save() throws RegistryException{
- EntityManager em = null;
- try {
- em = ResourceUtils.getEntityManager();
- Project existingProject = em.find(Project.class, id);
- em.close();
-
- em = ResourceUtils.getEntityManager();
- em.getTransaction().begin();
- Project project = new Project();
- project.setProject_id(id);
- project.setProject_name(name);
- project.setGateway_id(gatewayId);
- Users user = em.find(Users.class, worker.getUser());
- project.setUsers(user);
- project.setUser_name(user.getUser_name());
- project.setDescription(description);
- project.setCreationTime(creationTime);
-
- if (existingProject != null) {
- existingProject.setProject_name(name);
- existingProject.setGateway_id(gatewayId);
- existingProject.setUsers(user);
- existingProject.setUser_name(user.getUser_name());
- existingProject.setDescription(description);
- existingProject.setCreationTime(creationTime);
- project = em.merge(existingProject);
- } else {
- em.persist(project);
- }
-
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new RegistryException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- /**
- *
- * @return project name
- */
- public String getName() {
- return name;
- }
-
- /**
- *
- * @param name project name
- */
- public void setName(String name) {
- this.name = name;
- }
-
- /**
- *
- * @return gateway worker
- */
- public WorkerResource getWorker() {
- return worker;
- }
-
- /**
- *
- * @param worker gateway worker
- */
- public void setWorker(WorkerResource worker) {
- this.worker = worker;
- }
-
- public String getGatewayId() {
- return gatewayId;
- }
-
- public void setGatewayId(String gatewayId) {
- this.gatewayId = gatewayId;
- }
-
- public String getDescription() {
- return description;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
- public Timestamp getCreationTime() {
- return creationTime;
- }
-
- public void setCreationTime(Timestamp creationTime) {
- this.creationTime = creationTime;
- }
-
- /**
- *
- * @param experimentId experiment ID
- * @return whether the experiment exist
- */
- public boolean isExperimentExists(String experimentId) throws RegistryException{
- return isExists(ResourceType.EXPERIMENT, experimentId);
- }
-
- /**
- *
- * @param experimentId experiment ID
- * @return experiment resource
- */
- public ExperimentResource createExperiment(String experimentId) throws RegistryException{
- ExperimentResource experimentResource = (ExperimentResource)create(ResourceType.EXPERIMENT);
- experimentResource.setExpID(experimentId);
- return experimentResource;
- }
-
- /**
- *
- * @param experimentId experiment ID
- * @return experiment resource
- */
- public ExperimentResource getExperiment(String experimentId) throws RegistryException{
- return (ExperimentResource)get(ResourceType.EXPERIMENT,experimentId);
- }
-
- /**
- *
- * @return list of experiments
- */
- public List<ExperimentResource> getExperiments() throws RegistryException{
- List<Resource> list = get(ResourceType.EXPERIMENT);
- List<ExperimentResource> result=new ArrayList<ExperimentResource>();
- for (Resource resource : list) {
- result.add((ExperimentResource) resource);
- }
- return result;
- }
-
- public List<ExperimentResource> getExperiments(int limit, int offset, Object orderByIdentifier,
- ResultOrderType resultOrderType) throws RegistryException{
- List<Resource> list = get(ResourceType.EXPERIMENT, limit, offset, orderByIdentifier, resultOrderType);
- List<ExperimentResource> result=new ArrayList<ExperimentResource>();
- for (Resource resource : list) {
- result.add((ExperimentResource) resource);
- }
- return result;
- }
-
- /**
- *
- * @param experimentId experiment ID
- */
- public void removeExperiment(String experimentId) throws RegistryException{
- remove(ResourceType.EXPERIMENT, experimentId);
- }
-
- public List<ProjectUserResource> getProjectUserList () throws RegistryException{
- List<Resource> resources = get(ResourceType.PROJECT_USER);
- List<ProjectUserResource> projectUserResources = new ArrayList<ProjectUserResource>();
- if (resources != null && !resources.isEmpty()){
- for (Resource r : resources){
- projectUserResources.add((ProjectUserResource)r);
- }
- }
- return projectUserResources;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/ProjectUserResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/ProjectUserResource.java b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/ProjectUserResource.java
deleted file mode 100644
index f272433..0000000
--- a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/ProjectUserResource.java
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- *
- * 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.experiment.catalog.resources;
-
-import org.apache.airavata.experiment.catalog.Resource;
-import org.apache.airavata.experiment.catalog.ResourceType;
-import org.apache.airavata.experiment.catalog.ResourceUtils;
-import org.apache.airavata.experiment.catalog.model.*;
-import org.apache.airavata.registry.cpi.RegistryException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.persistence.EntityManager;
-import java.util.List;
-
-public class ProjectUserResource extends AbstractResource {
- private String projectId;
- private String userName;
-
- private static final Logger logger = LoggerFactory.getLogger(ProjectUserResource.class);
-
- public String getProjectId() {
- return projectId;
- }
-
- public void setProjectId(String projectId) {
- this.projectId = projectId;
- }
-
- public String getUserName() {
- return userName;
- }
-
- public void setUserName(String userName) {
- this.userName = userName;
- }
-
-
- public Resource create(ResourceType type) throws RegistryException {
- logger.error("Unsupported resource type for project resource data resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
-
- public void remove(ResourceType type, Object name) throws RegistryException{
- logger.error("Unsupported resource type for project resource data resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
-
- public Resource get(ResourceType type, Object name) throws RegistryException{
- logger.error("Unsupported resource type for project resource data resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
-
- public List<Resource> get(ResourceType type) throws RegistryException{
- logger.error("Unsupported resource type for project resource data resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
-
- public void save() throws RegistryException{
- EntityManager em = null;
- try {
- em = ResourceUtils.getEntityManager();
- ProjectUser existingPrUser = em.find(ProjectUser.class, new ProjectUser_PK(projectId, userName));
- em.close();
-
- em = ResourceUtils.getEntityManager();
- em.getTransaction().begin();
- ProjectUser prUser = new ProjectUser();
- prUser.setProjectID(projectId);
- prUser.setUserName(userName);
- Users user = em.find(Users.class, userName);
- prUser.setUser(user);
- Project project = em.find(Project.class, projectId);
- prUser.setProject(project);
-
- if (existingPrUser != null) {
- existingPrUser.setProjectID(projectId);
- existingPrUser.setUserName(userName);
- existingPrUser.setUser(user);
- existingPrUser.setProject(project);
- prUser = em.merge(existingPrUser);
- } else {
- em.persist(prUser);
- }
-
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new RegistryException(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/ec8c6202/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/QosParamResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/QosParamResource.java b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/QosParamResource.java
deleted file mode 100644
index 1d00a5c..0000000
--- a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/QosParamResource.java
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- *
- * 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.experiment.catalog.resources;
-
-import org.apache.airavata.experiment.catalog.Resource;
-import org.apache.airavata.experiment.catalog.ResourceType;
-import org.apache.airavata.experiment.catalog.ResourceUtils;
-import org.apache.airavata.experiment.catalog.model.QosParam;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.apache.airavata.registry.cpi.RegistryException;
-
-import javax.persistence.EntityManager;
-import java.util.List;
-
-public class QosParamResource extends AbstractResource {
- private static final Logger logger = LoggerFactory.getLogger(QosParamResource.class);
- private int qosId;
- private String experimentId;
- private String taskId;
- private String startExecutionAt;
- private String executeBefore;
- private int noOfRetries;
-
- public int getQosId() {
- return qosId;
- }
-
- public void setQosId(int qosId) {
- this.qosId = qosId;
- }
-
- public String getExperimentId() {
- return experimentId;
- }
-
- public void setExperimentId(String experimentId) {
- this.experimentId = experimentId;
- }
-
- public String getTaskId() {
- return taskId;
- }
-
- public void setTaskId(String taskId) {
- this.taskId = taskId;
- }
-
- public String getStartExecutionAt() {
- return startExecutionAt;
- }
-
- public void setStartExecutionAt(String startExecutionAt) {
- this.startExecutionAt = startExecutionAt;
- }
-
- public String getExecuteBefore() {
- return executeBefore;
- }
-
- public void setExecuteBefore(String executeBefore) {
- this.executeBefore = executeBefore;
- }
-
- public int getNoOfRetries() {
- return noOfRetries;
- }
-
- public void setNoOfRetries(int noOfRetries) {
- this.noOfRetries = noOfRetries;
- }
-
-
- public Resource create(ResourceType type) throws RegistryException{
- logger.error("Unsupported resource type for qos params resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
-
- public void remove(ResourceType type, Object name) throws RegistryException{
- logger.error("Unsupported resource type for qos params resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
-
- public Resource get(ResourceType type, Object name) throws RegistryException{
- logger.error("Unsupported resource type for qos params resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
-
- public List<Resource> get(ResourceType type) throws RegistryException{
- logger.error("Unsupported resource type for qos params resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
-
- public void save() throws RegistryException{
- EntityManager em = null;
- try {
- em = ResourceUtils.getEntityManager();
- em.getTransaction().begin();
- QosParam qosParam = new QosParam();
- qosParam.setTaskId(taskId);
- qosParam.setExpId(experimentId);
- qosParam.setStartExecutionAt(startExecutionAt);
- qosParam.setExecuteBefore(executeBefore);
- qosParam.setNoOfRetries(noOfRetries);
- em.persist(qosParam);
- qosId = qosParam.getQosId();
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new RegistryException(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/ec8c6202/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/StatusResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/StatusResource.java b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/StatusResource.java
deleted file mode 100644
index 257b657..0000000
--- a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/StatusResource.java
+++ /dev/null
@@ -1,181 +0,0 @@
-/*
- *
- * 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.experiment.catalog.resources;
-
-import org.apache.airavata.experiment.catalog.Resource;
-import org.apache.airavata.experiment.catalog.ResourceType;
-import org.apache.airavata.experiment.catalog.ResourceUtils;
-import org.apache.airavata.experiment.catalog.model.*;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.apache.airavata.registry.cpi.RegistryException;
-
-import javax.persistence.EntityManager;
-import java.sql.Timestamp;
-import java.util.List;
-
-public class StatusResource extends AbstractResource {
- private static final Logger logger = LoggerFactory.getLogger(StatusResource.class);
- private int statusId = 0;
- private String experimentId;
- private String nodeId;
- private String transferId;
- private String taskId;
- private String jobId;
- private String state;
- private Timestamp statusUpdateTime;
- private String statusType;
-
- public int getStatusId() {
- return statusId;
- }
-
- public void setStatusId(int statusId) {
- this.statusId = statusId;
- }
-
- public String getExperimentId() {
- return experimentId;
- }
-
- public void setExperimentId(String experimentId) {
- this.experimentId = experimentId;
- }
-
- public String getNodeId() {
- return nodeId;
- }
-
- public void setNodeId(String nodeId) {
- this.nodeId = nodeId;
- }
-
- public String getTransferId() {
- return transferId;
- }
-
- public void setTransferId(String transferId) {
- this.transferId = transferId;
- }
-
- public String getTaskId() {
- return taskId;
- }
-
- public void setTaskId(String taskId) {
- this.taskId = taskId;
- }
-
- public String getJobId() {
- return jobId;
- }
-
- public void setJobId(String jobId) {
- this.jobId = jobId;
- }
-
- public String getState() {
- return state;
- }
-
- public void setState(String state) {
- this.state = state;
- }
-
- public Timestamp getStatusUpdateTime() {
- return statusUpdateTime;
- }
-
- public void setStatusUpdateTime(Timestamp statusUpdateTime) {
- this.statusUpdateTime = statusUpdateTime;
- }
-
- public String getStatusType() {
- return statusType;
- }
-
- public void setStatusType(String statusType) {
- this.statusType = statusType;
- }
-
-
- public Resource create(ResourceType type) throws RegistryException{
- logger.error("Unsupported resource type for status resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
-
- public void remove(ResourceType type, Object name) throws RegistryException{
- logger.error("Unsupported resource type for status resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
-
- public Resource get(ResourceType type, Object name) throws RegistryException{
- logger.error("Unsupported resource type for status resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
-
- public List<Resource> get(ResourceType type) throws RegistryException{
- logger.error("Unsupported resource type for status resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
-
- public void save() throws RegistryException{
- EntityManager em = null;
- try {
- em = ResourceUtils.getEntityManager();
- em.getTransaction().begin();
- Status status;
- if (statusId != 0) {
- status = em.find(Status.class, statusId);
- status.setStatusId(statusId);
- } else {
- status = new Status();
- }
- status.setExpId(experimentId);
- status.setTaskId(taskId);
- status.setNodeId(nodeId);
- status.setTransferId(transferId);
- status.setJobId(jobId);
- status.setState(state);
- status.setStatusUpdateTime(statusUpdateTime);
- status.setStatusType(statusType);
- em.persist(status);
- statusId = status.getStatusId();
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new RegistryException(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/ec8c6202/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/TaskDetailResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/TaskDetailResource.java b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/TaskDetailResource.java
deleted file mode 100644
index 5144fe2..0000000
--- a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/TaskDetailResource.java
+++ /dev/null
@@ -1,748 +0,0 @@
-/*
- *
- * 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.experiment.catalog.resources;
-
-import org.apache.airavata.experiment.catalog.Resource;
-import org.apache.airavata.experiment.catalog.ResourceType;
-import org.apache.airavata.experiment.catalog.ResourceUtils;
-import org.apache.airavata.experiment.catalog.model.*;
-import org.apache.airavata.experiment.catalog.utils.QueryGenerator;
-import org.apache.airavata.registry.cpi.RegistryException;
-import org.apache.airavata.registry.cpi.utils.StatusType;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.persistence.EntityManager;
-import javax.persistence.Query;
-import java.sql.Timestamp;
-import java.util.ArrayList;
-import java.util.List;
-
-public class TaskDetailResource extends AbstractResource {
- private static final Logger logger = LoggerFactory.getLogger(TaskDetailResource.class);
- private String taskId;
- private String nodeId;
- private Timestamp creationTime;
- private String applicationId;
- private String applicationVersion;
- private String applicationDeploymentId;
- private boolean enableEmailNotifications;
- private List<ApplicationInputResource> applicationInputs;
- private List<ApplicationOutputResource> applicationOutputs;
- private ComputationSchedulingResource schedulingResource;
- private AdvanceInputDataHandlingResource inputDataHandlingResource;
- private AdvancedOutputDataHandlingResource outputDataHandlingResource;
- private StatusResource taskStatus;
- private List<JobDetailResource> jobDetailResources;
- private List<DataTransferDetailResource> transferDetailResourceList;
- private List<NotificationEmailResource> emailResourceList;
- private List<ErrorDetailResource> errors;
-
- public List<JobDetailResource> getJobDetailResources() {
- return jobDetailResources;
- }
-
- public void setJobDetailResources(List<JobDetailResource> jobDetailResources) {
- this.jobDetailResources = jobDetailResources;
- }
-
- public void setApplicationInputs(List<ApplicationInputResource> applicationInputs) {
- this.applicationInputs = applicationInputs;
- }
-
- public void setApplicationOutputs(List<ApplicationOutputResource> applicationOutputs) {
- this.applicationOutputs = applicationOutputs;
- }
-
- public ComputationSchedulingResource getSchedulingResource() {
- return schedulingResource;
- }
-
- public void setSchedulingResource(ComputationSchedulingResource schedulingResource) {
- this.schedulingResource = schedulingResource;
- }
-
- public AdvanceInputDataHandlingResource getInputDataHandlingResource() {
- return inputDataHandlingResource;
- }
-
- public void setInputDataHandlingResource(AdvanceInputDataHandlingResource inputDataHandlingResource) {
- this.inputDataHandlingResource = inputDataHandlingResource;
- }
-
- public AdvancedOutputDataHandlingResource getOutputDataHandlingResource() {
- return outputDataHandlingResource;
- }
-
- public void setOutputDataHandlingResource(AdvancedOutputDataHandlingResource outputDataHandlingResource) {
- this.outputDataHandlingResource = outputDataHandlingResource;
- }
-
- public void setTaskStatus(StatusResource taskStatus) {
- this.taskStatus = taskStatus;
- }
-
- public List<DataTransferDetailResource> getTransferDetailResourceList() {
- return transferDetailResourceList;
- }
-
- public void setTransferDetailResourceList(List<DataTransferDetailResource> transferDetailResourceList) {
- this.transferDetailResourceList = transferDetailResourceList;
- }
-
- public List<NotificationEmailResource> getEmailResourceList() {
- return emailResourceList;
- }
-
- public void setEmailResourceList(List<NotificationEmailResource> emailResourceList) {
- this.emailResourceList = emailResourceList;
- }
-
- public List<ErrorDetailResource> getErrors() {
- return errors;
- }
-
- public void setErrors(List<ErrorDetailResource> errors) {
- this.errors = errors;
- }
-
- public boolean isEnableEmailNotifications() {
- return enableEmailNotifications;
- }
-
- public void setEnableEmailNotifications(boolean enableEmailNotifications) {
- this.enableEmailNotifications = enableEmailNotifications;
- }
-
- public String getTaskId() {
- return taskId;
- }
-
- public void setTaskId(String taskId) {
- this.taskId = taskId;
- }
-
- public String getNodeId() {
- return nodeId;
- }
-
- public void setNodeId(String nodeId) {
- this.nodeId = nodeId;
- }
-
- public Timestamp getCreationTime() {
- return creationTime;
- }
-
- public void setCreationTime(Timestamp creationTime) {
- this.creationTime = creationTime;
- }
-
- public String getApplicationId() {
- return applicationId;
- }
-
- public void setApplicationId(String applicationId) {
- this.applicationId = applicationId;
- }
-
- public String getApplicationVersion() {
- return applicationVersion;
- }
-
- public void setApplicationVersion(String applicationVersion) {
- this.applicationVersion = applicationVersion;
- }
-
-
- public Resource create(ResourceType type) throws RegistryException{
- switch (type){
- case ERROR_DETAIL:
- ErrorDetailResource errorDetailResource = new ErrorDetailResource();
- errorDetailResource.setTaskId(taskId);
- return errorDetailResource;
- case NOTIFICATION_EMAIL:
- NotificationEmailResource emailResource = new NotificationEmailResource();
- emailResource.setTaskId(taskId);
- return emailResource;
- case APPLICATION_INPUT:
- ApplicationInputResource applicationInputResource = new ApplicationInputResource();
- applicationInputResource.setTaskId(taskId);
- return applicationInputResource;
- case APPLICATION_OUTPUT:
- ApplicationOutputResource applicationOutputResource = new ApplicationOutputResource();
- applicationOutputResource.setTaskId(taskId);
- return applicationOutputResource;
- case JOB_DETAIL:
- JobDetailResource jobDetailResource = new JobDetailResource();
- jobDetailResource.setTaskId(taskId);
- return jobDetailResource;
- case DATA_TRANSFER_DETAIL:
- DataTransferDetailResource dataTransferDetailResource = new DataTransferDetailResource();
- dataTransferDetailResource.setTaskId(taskId);
- return dataTransferDetailResource;
- case STATUS:
- StatusResource statusResource = new StatusResource();
- statusResource.setTaskId(taskId);
- return statusResource;
- case COMPUTATIONAL_RESOURCE_SCHEDULING:
- ComputationSchedulingResource schedulingResource = new ComputationSchedulingResource();
- schedulingResource.setTaskId(taskId);
- return schedulingResource;
- case ADVANCE_INPUT_DATA_HANDLING:
- AdvanceInputDataHandlingResource inputDataHandlingResource = new AdvanceInputDataHandlingResource();
- inputDataHandlingResource.setTaskId(taskId);
- return inputDataHandlingResource;
- case ADVANCE_OUTPUT_DATA_HANDLING:
- AdvancedOutputDataHandlingResource outputDataHandlingResource = new AdvancedOutputDataHandlingResource();
- outputDataHandlingResource.setTaskId(taskId);
- return outputDataHandlingResource;
- case QOS_PARAM:
- QosParamResource qosParamResource = new QosParamResource();
- qosParamResource.setTaskId(taskId);
- return qosParamResource;
- default:
- logger.error("Unsupported resource type for task detail resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported resource type for task detail resource.");
- }
- }
-
-
- public void remove(ResourceType type, Object name) throws RegistryException{
- EntityManager em = null;
- try {
- em = ResourceUtils.getEntityManager();
- em.getTransaction().begin();
- Query q;
- QueryGenerator generator;
- switch (type) {
- case ERROR_DETAIL:
- generator = new QueryGenerator(ERROR_DETAIL);
- generator.setParameter(ErrorDetailConstants.TASK_ID, name);
- q = generator.deleteQuery(em);
- q.executeUpdate();
- break;
- case NOTIFICATION_EMAIL:
- generator = new QueryGenerator(NOTIFICATION_EMAIL);
- generator.setParameter(NotificationEmailConstants.TASK_ID, name);
- q = generator.deleteQuery(em);
- q.executeUpdate();
- break;
- case APPLICATION_INPUT:
- generator = new QueryGenerator(APPLICATION_INPUT);
- generator.setParameter(ApplicationInputConstants.TASK_ID, name);
- q = generator.deleteQuery(em);
- q.executeUpdate();
- break;
- case APPLICATION_OUTPUT:
- generator = new QueryGenerator(APPLICATION_OUTPUT);
- generator.setParameter(ApplicationOutputConstants.TASK_ID, name);
- q = generator.deleteQuery(em);
- q.executeUpdate();
- break;
- case JOB_DETAIL:
- generator = new QueryGenerator(JOB_DETAIL);
- generator.setParameter(JobDetailConstants.TASK_ID, taskId);
- generator.setParameter(JobDetailConstants.JOB_ID, name);
- q = generator.deleteQuery(em);
- q.executeUpdate();
- break;
- case DATA_TRANSFER_DETAIL:
- generator = new QueryGenerator(DATA_TRANSFER_DETAIL);
- generator.setParameter(DataTransferDetailConstants.TRANSFER_ID, name);
- q = generator.deleteQuery(em);
- q.executeUpdate();
- break;
- case STATUS:
- generator = new QueryGenerator(STATUS);
- generator.setParameter(StatusConstants.TASK_ID, name);
- generator.setParameter(StatusConstants.STATUS_TYPE, StatusType.TASK.toString());
- q = generator.deleteQuery(em);
- q.executeUpdate();
- break;
- case COMPUTATIONAL_RESOURCE_SCHEDULING:
- generator = new QueryGenerator(COMPUTATIONAL_RESOURCE_SCHEDULING);
- generator.setParameter(ComputationalResourceSchedulingConstants.TASK_ID, name);
- q = generator.deleteQuery(em);
- q.executeUpdate();
- break;
- case ADVANCE_INPUT_DATA_HANDLING:
- generator = new QueryGenerator(ADVANCE_INPUT_DATA_HANDLING);
- generator.setParameter(AdvancedInputDataHandlingConstants.TASK_ID, name);
- q = generator.deleteQuery(em);
- q.executeUpdate();
- break;
- case ADVANCE_OUTPUT_DATA_HANDLING:
- generator = new QueryGenerator(ADVANCE_OUTPUT_DATA_HANDLING);
- generator.setParameter(AdvancedOutputDataHandlingConstants.TASK_ID, name);
- q = generator.deleteQuery(em);
- q.executeUpdate();
- break;
- case QOS_PARAM:
- generator = new QueryGenerator(QOS_PARAMS);
- generator.setParameter(QosParamsConstants.TASK_ID, name);
- q = generator.deleteQuery(em);
- q.executeUpdate();
- break;
- default:
- logger.error("Unsupported resource type for task detail resource.", new IllegalArgumentException());
- break;
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new RegistryException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
-
- public Resource get(ResourceType type, Object name) throws RegistryException{
- EntityManager em = null;
- try {
- em = ResourceUtils.getEntityManager();
- em.getTransaction().begin();
- QueryGenerator generator;
- Query q;
- switch (type) {
- case ERROR_DETAIL:
- generator = new QueryGenerator(ERROR_DETAIL);
- generator.setParameter(ErrorDetailConstants.TASK_ID, name);
- q = generator.selectQuery(em);
- ErrorDetail errorDetail = (ErrorDetail) q.getSingleResult();
- ErrorDetailResource errorDetailResource = (ErrorDetailResource) Utils.getResource(ResourceType.ERROR_DETAIL, errorDetail);
- em.getTransaction().commit();
- em.close();
- return errorDetailResource;
- case NOTIFICATION_EMAIL:
- generator = new QueryGenerator(NOTIFICATION_EMAIL);
- generator.setParameter(NotificationEmailConstants.TASK_ID, name);
- q = generator.selectQuery(em);
- Notification_Email notificationEmail = (Notification_Email) q.getSingleResult();
- NotificationEmailResource emailResource = (NotificationEmailResource) Utils.getResource(ResourceType.NOTIFICATION_EMAIL, notificationEmail);
- em.getTransaction().commit();
- em.close();
- return emailResource;
- case APPLICATION_INPUT:
- generator = new QueryGenerator(APPLICATION_INPUT);
- generator.setParameter(ApplicationInputConstants.TASK_ID, name);
- q = generator.selectQuery(em);
- ApplicationInput applicationInput = (ApplicationInput) q.getSingleResult();
- ApplicationInputResource inputResource = (ApplicationInputResource) Utils.getResource(ResourceType.APPLICATION_INPUT, applicationInput);
- em.getTransaction().commit();
- em.close();
- return inputResource;
- case APPLICATION_OUTPUT:
- generator = new QueryGenerator(APPLICATION_OUTPUT);
- generator.setParameter(ApplicationOutputConstants.TASK_ID, name);
- q = generator.selectQuery(em);
- ApplicationOutput applicationOutput = (ApplicationOutput) q.getSingleResult();
- ApplicationOutputResource outputResource = (ApplicationOutputResource) Utils.getResource(ResourceType.APPLICATION_OUTPUT, applicationOutput);
- em.getTransaction().commit();
- em.close();
- return outputResource;
- case JOB_DETAIL:
- generator = new QueryGenerator(JOB_DETAIL);
- generator.setParameter(JobDetailConstants.JOB_ID, name);
- generator.setParameter(JobDetailConstants.TASK_ID, taskId);
- q = generator.selectQuery(em);
- JobDetail jobDetail = (JobDetail) q.getSingleResult();
- JobDetailResource jobDetailResource = (JobDetailResource) Utils.getResource(ResourceType.JOB_DETAIL, jobDetail);
- em.getTransaction().commit();
- em.close();
- return jobDetailResource;
- case DATA_TRANSFER_DETAIL:
- generator = new QueryGenerator(DATA_TRANSFER_DETAIL);
- generator.setParameter(DataTransferDetailConstants.TRANSFER_ID, name);
- q = generator.selectQuery(em);
- DataTransferDetail transferDetail = (DataTransferDetail) q.getSingleResult();
- DataTransferDetailResource transferDetailResource = (DataTransferDetailResource) Utils.getResource(ResourceType.DATA_TRANSFER_DETAIL, transferDetail);
- em.getTransaction().commit();
- em.close();
- return transferDetailResource;
- case STATUS:
- generator = new QueryGenerator(STATUS);
- generator.setParameter(StatusConstants.TASK_ID, name);
- generator.setParameter(StatusConstants.STATUS_TYPE, StatusType.TASK.toString());
- q = generator.selectQuery(em);
- Status status = (Status) q.getSingleResult();
- StatusResource statusResource = (StatusResource) Utils.getResource(ResourceType.STATUS, status);
- em.getTransaction().commit();
- em.close();
- return statusResource;
- case COMPUTATIONAL_RESOURCE_SCHEDULING:
- generator = new QueryGenerator(COMPUTATIONAL_RESOURCE_SCHEDULING);
- generator.setParameter(ComputationalResourceSchedulingConstants.TASK_ID, name);
- q = generator.selectQuery(em);
- Computational_Resource_Scheduling resourceScheduling = (Computational_Resource_Scheduling) q.getSingleResult();
- ComputationSchedulingResource schedulingResource = (ComputationSchedulingResource) Utils.getResource(ResourceType.COMPUTATIONAL_RESOURCE_SCHEDULING, resourceScheduling);
- em.getTransaction().commit();
- em.close();
- return schedulingResource;
- case ADVANCE_INPUT_DATA_HANDLING:
- generator = new QueryGenerator(ADVANCE_INPUT_DATA_HANDLING);
- generator.setParameter(AdvancedInputDataHandlingConstants.TASK_ID, name);
- q = generator.selectQuery(em);
- AdvancedInputDataHandling dataHandling = (AdvancedInputDataHandling) q.getSingleResult();
- AdvanceInputDataHandlingResource inputDataHandlingResource = (AdvanceInputDataHandlingResource) Utils.getResource(ResourceType.ADVANCE_INPUT_DATA_HANDLING, dataHandling);
- em.getTransaction().commit();
- em.close();
- return inputDataHandlingResource;
- case ADVANCE_OUTPUT_DATA_HANDLING:
- generator = new QueryGenerator(ADVANCE_OUTPUT_DATA_HANDLING);
- generator.setParameter(AdvancedOutputDataHandlingConstants.TASK_ID, name);
- q = generator.selectQuery(em);
- AdvancedOutputDataHandling outputDataHandling = (AdvancedOutputDataHandling) q.getSingleResult();
- AdvancedOutputDataHandlingResource outputDataHandlingResource = (AdvancedOutputDataHandlingResource) Utils.getResource(ResourceType.ADVANCE_OUTPUT_DATA_HANDLING, outputDataHandling);
- em.getTransaction().commit();
- em.close();
- return outputDataHandlingResource;
- case QOS_PARAM:
- generator = new QueryGenerator(QOS_PARAMS);
- generator.setParameter(QosParamsConstants.TASK_ID, name);
- q = generator.selectQuery(em);
- QosParam qosParam = (QosParam) q.getSingleResult();
- QosParamResource qosParamResource = (QosParamResource) Utils.getResource(ResourceType.QOS_PARAM, qosParam);
- em.getTransaction().commit();
- em.close();
- return qosParamResource;
- default:
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported resource type for workflow node resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported resource type for workflow node resource.");
- }
- } catch (Exception e) {
-// logger.error(e.getMessage(), e);
- throw new RegistryException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
-
- public List<Resource> get(ResourceType type) throws RegistryException{
- List<Resource> resourceList = new ArrayList<Resource>();
- EntityManager em = null;
- try {
- em = ResourceUtils.getEntityManager();
- em.getTransaction().begin();
- Query q;
- QueryGenerator generator;
- List results;
- switch (type) {
- case ERROR_DETAIL:
- generator = new QueryGenerator(ERROR_DETAIL);
- generator.setParameter(ErrorDetailConstants.TASK_ID, taskId);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- ErrorDetail errorDetail = (ErrorDetail) result;
- ErrorDetailResource errorDetailResource =
- (ErrorDetailResource) Utils.getResource(ResourceType.ERROR_DETAIL, errorDetail);
- resourceList.add(errorDetailResource);
- }
- }
- break;
- case NOTIFICATION_EMAIL:
- generator = new QueryGenerator(NOTIFICATION_EMAIL);
- generator.setParameter(NotificationEmailConstants.TASK_ID, taskId);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- Notification_Email notificationEmail = (Notification_Email) result;
- NotificationEmailResource emailResource =
- (NotificationEmailResource) Utils.getResource(ResourceType.NOTIFICATION_EMAIL, notificationEmail);
- resourceList.add(emailResource);
- }
- }
- break;
- case APPLICATION_INPUT:
- generator = new QueryGenerator(APPLICATION_INPUT);
- generator.setParameter(ApplicationInputConstants.TASK_ID, taskId);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- ApplicationInput applicationInput = (ApplicationInput) result;
- ApplicationInputResource inputResource =
- (ApplicationInputResource) Utils.getResource(ResourceType.APPLICATION_INPUT, applicationInput);
- resourceList.add(inputResource);
- }
- }
- break;
- case APPLICATION_OUTPUT:
- generator = new QueryGenerator(APPLICATION_OUTPUT);
- generator.setParameter(ApplicationOutputConstants.TASK_ID, taskId);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- ApplicationOutput applicationOutput = (ApplicationOutput) result;
- ApplicationOutputResource outputResource =
- (ApplicationOutputResource) Utils.getResource(ResourceType.APPLICATION_OUTPUT, applicationOutput);
- resourceList.add(outputResource);
- }
- }
- break;
- case JOB_DETAIL:
- generator = new QueryGenerator(JOB_DETAIL);
- generator.setParameter(JobDetailConstants.TASK_ID, taskId);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- JobDetail jobDetail = (JobDetail) result;
- JobDetailResource jobDetailResource =
- (JobDetailResource) Utils.getResource(ResourceType.JOB_DETAIL, jobDetail);
- resourceList.add(jobDetailResource);
- }
- }
- break;
- case DATA_TRANSFER_DETAIL:
- generator = new QueryGenerator(DATA_TRANSFER_DETAIL);
- generator.setParameter(DataTransferDetailConstants.TASK_ID, taskId);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- DataTransferDetail transferDetail = (DataTransferDetail) result;
- DataTransferDetailResource transferDetailResource =
- (DataTransferDetailResource) Utils.getResource(ResourceType.DATA_TRANSFER_DETAIL, transferDetail);
- resourceList.add(transferDetailResource);
- }
- }
- break;
- case STATUS:
- generator = new QueryGenerator(STATUS);
- generator.setParameter(StatusConstants.TASK_ID, taskId);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- Status status = (Status) result;
- StatusResource statusResource =
- (StatusResource) Utils.getResource(ResourceType.STATUS, status);
- resourceList.add(statusResource);
- }
- }
- break;
- default:
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported resource type for workflow node details resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new RegistryException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- return resourceList;
- }
-
-
- public void save() throws RegistryException{
- EntityManager em = null;
- try {
- em = ResourceUtils.getEntityManager();
- TaskDetail taskDetail = em.find(TaskDetail.class, taskId);
- em.close();
- em = ResourceUtils.getEntityManager();
- em.getTransaction().begin();
- if (taskDetail != null) {
- updateTaskDetail(taskDetail, nodeId);
- em.merge(taskDetail);
- } else {
- taskDetail = new TaskDetail();
- updateTaskDetail(taskDetail, nodeId);
- em.persist(taskDetail);
- }
- em.getTransaction().commit();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new RegistryException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- private void updateTaskDetail(TaskDetail taskDetail, String nodeId) {
- taskDetail.setTaskId(taskId);
- taskDetail.setNodeId(nodeId);
- taskDetail.setCreationTime(creationTime);
- taskDetail.setAppId(applicationId);
- taskDetail.setAppVersion(applicationVersion);
- taskDetail.setAllowNotification(enableEmailNotifications);
- taskDetail.setApplicationDeploymentId(getApplicationDeploymentId());
- }
-
- public List<ApplicationInputResource> getApplicationInputs() {
- return applicationInputs;
- }
-
- public List<ApplicationOutputResource> getApplicationOutputs() {
- return applicationOutputs;
- }
-
- public List<ApplicationInputResource> getApplicationInputs1() throws RegistryException{
- List<ApplicationInputResource> applicationInputResources = new ArrayList<ApplicationInputResource>();
- List<Resource> resources = get(ResourceType.APPLICATION_INPUT);
- for (Resource resource : resources) {
- ApplicationInputResource inputResource = (ApplicationInputResource) resource;
- applicationInputResources.add(inputResource);
- }
- return applicationInputResources;
- }
-
- public List<ApplicationOutputResource> getApplicationOutputs1() throws RegistryException{
- List<ApplicationOutputResource> outputResources = new ArrayList<ApplicationOutputResource>();
- List<Resource> resources = get(ResourceType.APPLICATION_OUTPUT);
- for (Resource resource : resources) {
- ApplicationOutputResource outputResource = (ApplicationOutputResource) resource;
- outputResources.add(outputResource);
- }
- return outputResources;
- }
-
- public StatusResource getTaskStatus() {
- return taskStatus;
- }
-
- public StatusResource getTaskStatus1() throws RegistryException{
- List<Resource> resources = get(ResourceType.STATUS);
- for (Resource resource : resources) {
- StatusResource taskStatus = (StatusResource) resource;
- if(taskStatus.getStatusType().equals(StatusType.TASK.toString())){
- if (taskStatus.getState() == null || taskStatus.getState().equals("") ){
- taskStatus.setState("UNKNOWN");
- }
- return taskStatus;
- }
- }
- return null;
- }
-
- public List<JobDetailResource> getJobDetailList() throws RegistryException{
- List<JobDetailResource> jobDetailResources = new ArrayList<JobDetailResource>();
- List<Resource> resources = get(ResourceType.JOB_DETAIL);
- for (Resource resource : resources) {
- JobDetailResource jobDetailResource = (JobDetailResource) resource;
- jobDetailResources.add(jobDetailResource);
- }
- return jobDetailResources;
- }
-
- public List<DataTransferDetailResource> getDataTransferDetailList() throws RegistryException{
- List<DataTransferDetailResource> transferDetails = new ArrayList<DataTransferDetailResource>();
- List<Resource> resources = get(ResourceType.DATA_TRANSFER_DETAIL);
- for (Resource resource : resources) {
- DataTransferDetailResource transferDetailResource = (DataTransferDetailResource) resource;
- transferDetails.add(transferDetailResource);
- }
- return transferDetails;
- }
-
- public List<ErrorDetailResource> getErrorDetailList() throws RegistryException{
- List<ErrorDetailResource> errorDetailResources = new ArrayList<ErrorDetailResource>();
- List<Resource> resources = get(ResourceType.ERROR_DETAIL);
- for (Resource resource : resources) {
- ErrorDetailResource errorDetailResource = (ErrorDetailResource) resource;
- errorDetailResources.add(errorDetailResource);
- }
- return errorDetailResources;
- }
-
- public ComputationSchedulingResource getComputationScheduling (String taskId) throws RegistryException{
- return (ComputationSchedulingResource)get(ResourceType.COMPUTATIONAL_RESOURCE_SCHEDULING, taskId);
- }
-
- public AdvanceInputDataHandlingResource getInputDataHandling (String taskId) throws RegistryException{
- return (AdvanceInputDataHandlingResource)get(ResourceType.ADVANCE_INPUT_DATA_HANDLING, taskId);
- }
-
- public AdvancedOutputDataHandlingResource getOutputDataHandling (String taskId) throws RegistryException{
- return (AdvancedOutputDataHandlingResource)get(ResourceType.ADVANCE_OUTPUT_DATA_HANDLING, taskId);
- }
-
- public JobDetailResource createJobDetail (String jobId) throws RegistryException{
- JobDetailResource resource = (JobDetailResource)create(ResourceType.JOB_DETAIL);
- resource.setJobId(jobId);
- return resource;
- }
-
- public JobDetailResource getJobDetail (String jobId) throws RegistryException{
- return (JobDetailResource)get(ResourceType.JOB_DETAIL, jobId);
- }
-
- public DataTransferDetailResource getDataTransferDetail (String dataTransferId) throws RegistryException{
- return (DataTransferDetailResource)get(ResourceType.DATA_TRANSFER_DETAIL, dataTransferId);
- }
-
- public boolean isTaskStatusExist (String taskId) throws RegistryException{
- return isExists(ResourceType.STATUS, taskId);
- }
-
- public String getApplicationDeploymentId() {
- return applicationDeploymentId;
- }
-
- public void setApplicationDeploymentId(String applicationDeploymentId) {
- this.applicationDeploymentId = applicationDeploymentId;
- }
-
- public List<NotificationEmailResource> getNotificationEmails () throws RegistryException{
- List<NotificationEmailResource> emailResources = new ArrayList<NotificationEmailResource>();
- List<Resource> resources = get(ResourceType.NOTIFICATION_EMAIL);
- for (Resource resource : resources) {
- emailResources.add((NotificationEmailResource) resource);
- }
- return emailResources;
- }
-}
[38/52] [abbrv] [partial] airavata git commit: registry refactoring
Posted by sh...@apache.org.
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/WorkflowResource.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/WorkflowResource.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/WorkflowResource.java
deleted file mode 100644
index 3e52019..0000000
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/WorkflowResource.java
+++ /dev/null
@@ -1,382 +0,0 @@
-/*
- *
- * 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.aiaravata.application.catalog.data.resources;
-
-import org.airavata.appcatalog.cpi.AppCatalogException;
-import org.apache.aiaravata.application.catalog.data.model.Workflow;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogJPAUtils;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogQueryGenerator;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogResourceType;
-import org.apache.airavata.common.exception.ApplicationSettingsException;
-import org.apache.airavata.common.utils.AiravataUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.persistence.EntityManager;
-import javax.persistence.Query;
-import java.sql.Timestamp;
-import java.util.ArrayList;
-import java.util.List;
-
-public class WorkflowResource extends AbstractResource {
- private final static Logger logger = LoggerFactory.getLogger(WorkflowResource.class);
- private String wfName;
- private String createdUser;
- private String graph;
- private String wfTemplateId;
- private Timestamp createdTime;
- private Timestamp updatedTime;
- private String image;
- private String gatewayId;
-
- public Timestamp getCreatedTime() {
- return createdTime;
- }
-
- public void setCreatedTime(Timestamp createdTime) {
- this.createdTime = createdTime;
- }
-
- public Timestamp getUpdatedTime() {
- return updatedTime;
- }
-
- public void setUpdatedTime(Timestamp updatedTime) {
- this.updatedTime = updatedTime;
- }
-
- public String getImage() {
- return image;
- }
-
- public void setImage(String image) {
- this.image = image;
- }
-
- public String getGatewayId() {
- return gatewayId;
- }
-
- public void setGatewayId(String gatewayId) {
- this.gatewayId = gatewayId;
- }
-
- @Override
- public void remove(Object identifier) throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(WORKFLOW);
- generator.setParameter(WorkflowConstants.WF_TEMPLATE_ID, identifier);
- 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 Resource get(Object identifier) throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(WORKFLOW);
- generator.setParameter(WorkflowConstants.WF_TEMPLATE_ID, identifier);
- Query q = generator.selectQuery(em);
- Workflow workflow = (Workflow) q.getSingleResult();
- WorkflowResource workflowResource = (WorkflowResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.WORKFLOW, workflow);
- em.getTransaction().commit();
- em.close();
- return workflowResource;
- } 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<Resource> get(String fieldName, Object value) throws AppCatalogException {
- List<Resource> workflowResources = new ArrayList<Resource>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(WORKFLOW);
- Query q;
- if ((fieldName.equals(WorkflowConstants.WF_NAME)) || (fieldName.equals(WorkflowConstants.CREATED_USER)) || (fieldName.equals(WorkflowConstants.GRAPH)) || (fieldName.equals(WorkflowConstants.WF_TEMPLATE_ID))) {
- generator.setParameter(fieldName, value);
- q = generator.selectQuery(em);
- List<?> results = q.getResultList();
- for (Object result : results) {
- Workflow workflow = (Workflow) result;
- WorkflowResource workflowResource = (WorkflowResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.WORKFLOW, workflow);
- workflowResources.add(workflowResource);
- }
- } else {
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported field name for Workflow Resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported field name for Workflow Resource.");
- }
- 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();
- }
- }
- return workflowResources;
- }
-
- @Override
- public List<Resource> getAll() throws AppCatalogException {
- List<Resource> workflows = new ArrayList<Resource>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(WORKFLOW);
- generator.setParameter(WorkflowConstants.GATEWAY_ID, gatewayId);
- Query q = generator.selectQuery(em);
- List results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- Workflow workflow = (Workflow) result;
- WorkflowResource wfResource =
- (WorkflowResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.WORKFLOW, workflow);
- workflows.add(wfResource);
- }
- }
- 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 workflows;
- }
-
- @Override
- public List<String> getAllIds() throws AppCatalogException {
- List<String> workflowIds = new ArrayList<String>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(WORKFLOW);
- generator.setParameter(WorkflowConstants.GATEWAY_ID, gatewayId);
- Query q = generator.selectQuery(em);
- List results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- Workflow workflow = (Workflow) result;
- workflowIds.add(workflow.getWfTemplateId());
- }
- }
- 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 workflowIds;
- }
-
- @Override
- public List<String> getIds(String fieldName, Object value) throws AppCatalogException {
- List<String> workflowResourceIDs = new ArrayList<String>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(WORKFLOW);
- Query q;
- if ((fieldName.equals(WorkflowConstants.WF_NAME)) || (fieldName.equals(WorkflowConstants.CREATED_USER)) || (fieldName.equals(WorkflowConstants.GRAPH)) || (fieldName.equals(WorkflowConstants.WF_TEMPLATE_ID))) {
- generator.setParameter(fieldName, value);
- q = generator.selectQuery(em);
- List<?> results = q.getResultList();
- for (Object result : results) {
- Workflow workflow = (Workflow) result;
- WorkflowResource workflowResource = (WorkflowResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.WORKFLOW, workflow);
- workflowResourceIDs.add(workflowResource.getWfTemplateId());
- }
- } else {
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported field name for Workflow Resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported field name for Workflow Resource.");
- }
- 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();
- }
- }
- return workflowResourceIDs;
- }
-
- @Override
- public void save() throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- Workflow existingWorkflow = em.find(Workflow.class, wfTemplateId);
- em.close();
- Workflow workflow;
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- if (existingWorkflow == null) {
- workflow = new Workflow();
- workflow.setCreationTime(AiravataUtils.getCurrentTimestamp());
- } else {
- workflow = existingWorkflow;
- workflow.setUpdateTime(AiravataUtils.getCurrentTimestamp());
- }
- workflow.setWfName(getWfName());
- workflow.setCreatedUser(getCreatedUser());
- workflow.setGatewayId(gatewayId);
- if (getGraph() != null){
- workflow.setGraph(getGraph().toCharArray());
- }
- if (image != null){
- workflow.setImage(image.getBytes());
- }
- workflow.setWfTemplateId(getWfTemplateId());
- if (existingWorkflow == null) {
- em.persist(workflow);
- } else {
- em.merge(workflow);
- }
- 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 {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- Workflow workflow = em.find(Workflow.class, identifier);
- em.close();
- return workflow != null;
- } 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();
- }
- }
- }
-
- public String getWfName() {
- return wfName;
- }
-
- public String getCreatedUser() {
- return createdUser;
- }
-
- public String getGraph() {
- return graph;
- }
-
- public String getWfTemplateId() {
- return wfTemplateId;
- }
-
- public void setWfName(String wfName) {
- this.wfName=wfName;
- }
-
- public void setCreatedUser(String createdUser) {
- this.createdUser=createdUser;
- }
-
- public void setGraph(String graph) {
- this.graph=graph;
- }
-
- public void setWfTemplateId(String wfTemplateId) {
- this.wfTemplateId=wfTemplateId;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/util/AppCatalogJPAUtils.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/util/AppCatalogJPAUtils.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/util/AppCatalogJPAUtils.java
deleted file mode 100644
index 4ee983f..0000000
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/util/AppCatalogJPAUtils.java
+++ /dev/null
@@ -1,911 +0,0 @@
-/*
- *
- * 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.aiaravata.application.catalog.data.util;
-
-import org.apache.aiaravata.application.catalog.data.model.*;
-import org.apache.aiaravata.application.catalog.data.resources.*;
-import org.apache.airavata.common.exception.ApplicationSettingsException;
-import org.apache.airavata.common.utils.ServerSettings;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.persistence.EntityManager;
-import javax.persistence.EntityManagerFactory;
-import javax.persistence.Persistence;
-import java.util.HashMap;
-import java.util.Map;
-
-public class AppCatalogJPAUtils {
- private final static Logger logger = LoggerFactory.getLogger(AppCatalogJPAUtils.class);
- private static final String PERSISTENCE_UNIT_NAME = "appcatalog_data";
- private static final String APPCATALOG_JDBC_DRIVER = "appcatalog.jdbc.driver";
- private static final String APPCATALOG_JDBC_URL = "appcatalog.jdbc.url";
- private static final String APPCATALOG_JDBC_USER = "appcatalog.jdbc.user";
- private static final String APPCATALOG_JDBC_PWD = "appcatalog.jdbc.password";
- private static final String APPCATALOG_VALIDATION_QUERY = "appcatalog.validationQuery";
- private static final String JPA_CACHE_SIZE = "jpa.cache.size";
- protected static EntityManagerFactory factory;
-
- public static EntityManager getEntityManager() throws ApplicationSettingsException {
- if (factory == null) {
- String connectionProperties = "DriverClassName=" + readServerProperties(APPCATALOG_JDBC_DRIVER) + "," +
- "Url=" + readServerProperties(APPCATALOG_JDBC_URL) + "?autoReconnect=true," +
- "Username=" + readServerProperties(APPCATALOG_JDBC_USER) + "," +
- "Password=" + readServerProperties(APPCATALOG_JDBC_PWD) +
- ",validationQuery=" + readServerProperties(APPCATALOG_VALIDATION_QUERY);
- System.out.println(connectionProperties);
- Map<String, String> properties = new HashMap<String, String>();
- properties.put("openjpa.ConnectionDriverName", "org.apache.commons.dbcp.BasicDataSource");
- properties.put("openjpa.ConnectionProperties", connectionProperties);
- properties.put("openjpa.DynamicEnhancementAgent", "true");
- properties.put("openjpa.RuntimeUnenhancedClasses", "unsupported");
- properties.put("openjpa.DataCache","true(CacheSize=" + Integer.valueOf(readServerProperties(JPA_CACHE_SIZE)) + ", SoftReferenceSize=0)");
- properties.put("openjpa.QueryCache","true(CacheSize=" + Integer.valueOf(readServerProperties(JPA_CACHE_SIZE)) + ", SoftReferenceSize=0)");
- properties.put("openjpa.RemoteCommitProvider","sjvm");
- properties.put("openjpa.Log","DefaultLevel=INFO, Runtime=INFO, Tool=INFO, SQL=INFO");
- properties.put("openjpa.jdbc.SynchronizeMappings", "buildSchema(ForeignKeys=true)");
- properties.put("openjpa.jdbc.QuerySQLCache", "false");
- properties.put("openjpa.ConnectionFactoryProperties", "PrettyPrint=true, PrettyPrintLineLength=72, PrintParameters=true, MaxActive=10, MaxIdle=5, MinIdle=2, MaxWait=31536000, autoReconnect=true");
- factory = Persistence.createEntityManagerFactory(PERSISTENCE_UNIT_NAME, properties);
- }
- return factory.createEntityManager();
- }
-
- private static String readServerProperties (String propertyName) throws ApplicationSettingsException {
- try {
- return ServerSettings.getSetting(propertyName);
- } catch (ApplicationSettingsException e) {
- logger.error("Unable to read airavata-server.properties...", e);
- throw new ApplicationSettingsException("Unable to read airavata-server.properties...");
- }
- }
-
- /**
- *
- * @param type model type
- * @param o model type instance
- * @return corresponding resource object
- */
- public static Resource getResource(AppCatalogResourceType type, Object o) {
- switch (type){
- case COMPUTE_RESOURCE:
- if (o instanceof ComputeResource){
- return createComputeResource((ComputeResource) o);
- }else{
- logger.error("Object should be a Compute Resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Object should be a Compute Resource.");
- }
- case HOST_ALIAS:
- if (o instanceof HostAlias){
- return createHostAlias((HostAlias) o);
- }else {
- logger.error("Object should be a Host Alias.", new IllegalArgumentException());
- throw new IllegalArgumentException("Object should be a Host Alias.");
- }
- case HOST_IPADDRESS:
- if (o instanceof HostIPAddress){
- return createHostIPAddress((HostIPAddress) o);
- }else {
- logger.error("Object should be a Host IPAdress.", new IllegalArgumentException());
- throw new IllegalArgumentException("Object should be a Host IPAdress.");
- }
- case GSISSH_SUBMISSION:
- if (o instanceof GSISSHSubmission){
- return createGSSISSHSubmission((GSISSHSubmission) o);
- }else {
- logger.error("Object should be a GSISSH Submission", new IllegalArgumentException());
- throw new IllegalArgumentException("Object should be a GSISSH Submission.");
- }
- case UNICORE_JOB_SUBMISSION:
- if (o instanceof UnicoreJobSubmission){
- return createUnicoreJobSubmission((UnicoreJobSubmission) o);
- }else {
- logger.error("Object should be a GSISSH Submission", new IllegalArgumentException());
- throw new IllegalArgumentException("Object should be a GSISSH Submission.");
- }
- case UNICORE_DATA_MOVEMENT:
- if (o instanceof UnicoreDataMovement){
- return createUnicoreDataMovement((UnicoreDataMovement) o);
- }else {
- logger.error("Object should be a GSISSH Submission", new IllegalArgumentException());
- throw new IllegalArgumentException("Object should be a GSISSH Submission.");
- }
- case GSISSH_EXPORT:
- if (o instanceof GSISSHExport){
- return createGSISSHExport((GSISSHExport) o);
- }else {
- logger.error("Object should be a GSISSH Export.", new IllegalArgumentException());
- throw new IllegalArgumentException("Object should be a GSISSH Export.");
- }
- case PRE_JOBCOMMAND:
- if (o instanceof PreJobCommand){
- return createPreJobCommand((PreJobCommand) o);
- }else {
- logger.error("Object should be a GSISSHPreJobCommand.", new IllegalArgumentException());
- throw new IllegalArgumentException("Object should be a GSISSHPreJobCommand.");
- }
- case POST_JOBCOMMAND:
- if (o instanceof PostJobCommand){
- return createPostJObCommand((PostJobCommand) o);
- }else {
- logger.error("Object should be a GSISSHPostJobCommand.", new IllegalArgumentException());
- throw new IllegalArgumentException("Object should be a GSISSHPostJobCommand.");
- }
- case GLOBUS_SUBMISSION:
- if (o instanceof GlobusJobSubmission){
- return createGlobusJobSubmission((GlobusJobSubmission) o);
- }else {
- logger.error("Object should be a GlobusJobSubmission.", new IllegalArgumentException());
- throw new IllegalArgumentException("Object should be a GlobusJobSubmission.");
- }
- case GLOBUS_GK_ENDPOINT:
- if (o instanceof GlobusGKEndpoint){
- return createGlobusEndpoint((GlobusGKEndpoint) o);
- }else {
- logger.error("Object should be a GlobusJobSubmission.", new IllegalArgumentException());
- throw new IllegalArgumentException("Object should be a GlobusJobSubmission.");
- }
- case SSH_JOB_SUBMISSION:
- if (o instanceof SshJobSubmission){
- return createSshJobSubmission((SshJobSubmission) o);
- }else{
- logger.error("Object should be a Ssh Job Submission.", new IllegalArgumentException());
- throw new IllegalArgumentException("Object should be a Ssh Job Submission.");
- }
- case SCP_DATA_MOVEMENT:
- if (o instanceof ScpDataMovement){
- return createScpDataMovement((ScpDataMovement) o);
- }else{
- logger.error("Object should be a Scp Data Movement.", new IllegalArgumentException());
- throw new IllegalArgumentException("Object should be a Scp Data Movement.");
- }
- case GRIDFTP_DATA_MOVEMENT:
- if (o instanceof GridftpDataMovement){
- return createGridftpDataMovement((GridftpDataMovement) o);
- }else{
- logger.error("Object should be a Gridftp Data Movement.", new IllegalArgumentException());
- throw new IllegalArgumentException("Object should be a Gridftp Data Movement.");
- }
- case GRIDFTP_ENDPOINT:
- if (o instanceof GridftpEndpoint){
- return createGridftpEndpoint((GridftpEndpoint) o);
- }else{
- logger.error("Object should be a Gridftp Endpoint.", new IllegalArgumentException());
- throw new IllegalArgumentException("Object should be a Gridftp Endpoint.");
- }
-// case JOB_SUBMISSION_PROTOCOL:
-// if (o instanceof JobSubmissionProtocol){
-// return createJobSubmissionProtocol((JobSubmissionProtocol) o);
-// }else {
-// logger.error("Object should be a JobSubmissionProtocol.", new IllegalArgumentException());
-// throw new IllegalArgumentException("Object should be a JobSubmissionProtocol.");
-// }
-// case DATA_MOVEMENT_PROTOCOL:
-// if (o instanceof DataMovementProtocol){
-// return createDataMovementProtocol((DataMovementProtocol) o);
-// }else {
-// logger.error("Object should be a DataMovementProtocol.", new IllegalArgumentException());
-// throw new IllegalArgumentException("Object should be a DataMovementProtocol.");
-// }
- case APPLICATION_MODULE:
- if (o instanceof ApplicationModule){
- return createApplicationModule((ApplicationModule) o);
- }else {
- logger.error("Object should be a Application Module.", new IllegalArgumentException());
- throw new IllegalArgumentException("Object should be a Application Module.");
- }
- case APPLICATION_DEPLOYMENT:
- if (o instanceof ApplicationDeployment){
- return createApplicationDeployment((ApplicationDeployment) o);
- }else {
- logger.error("Object should be a Application Deployment.", new IllegalArgumentException());
- throw new IllegalArgumentException("Object should be a Application Deployment.");
- }
- case LIBRARY_PREPAND_PATH:
- if (o instanceof LibraryPrepandPath){
- return createLibraryPrepPathResource((LibraryPrepandPath) o);
- }else {
- logger.error("Object should be a Library Prepand path.", new IllegalArgumentException());
- throw new IllegalArgumentException("Object should be a Library Prepand path.");
- }
- case LIBRARY_APEND_PATH:
- if (o instanceof LibraryApendPath){
- return createLibraryApendPathResource((LibraryApendPath) o);
- }else {
- logger.error("Object should be a Library Apend path.", new IllegalArgumentException());
- throw new IllegalArgumentException("Object should be a Library Apend.");
- }
- case APP_ENVIRONMENT:
- if (o instanceof AppEnvironment){
- return createAppEnvironmentResource((AppEnvironment) o);
- }else {
- logger.error("Object should be a AppEnvironment.", new IllegalArgumentException());
- throw new IllegalArgumentException("Object should be a AppEnvironment.");
- }
- case APPLICATION_INTERFACE:
- if (o instanceof ApplicationInterface){
- return createAppInterfaceResource((ApplicationInterface) o);
- }else {
- logger.error("Object should be a ApplicationInterface.", new IllegalArgumentException());
- throw new IllegalArgumentException("Object should be a ApplicationInterface.");
- }
- case APP_MODULE_MAPPING:
- if (o instanceof AppModuleMapping){
- return createAppModMappingResource((AppModuleMapping) o);
- }else {
- logger.error("Object should be a AppModuleMapping.", new IllegalArgumentException());
- throw new IllegalArgumentException("Object should be a AppModuleMapping.");
- }
- case APPLICATION_OUTPUT:
- if (o instanceof ApplicationOutput){
- return createApplicationOutput((ApplicationOutput) o);
- }else {
- logger.error("Object should be a ApplicationOutput.", new IllegalArgumentException());
- throw new IllegalArgumentException("Object should be a ApplicationOutput.");
- }
- case GATEWAY_PROFILE:
- if (o instanceof GatewayProfile){
- return createGatewayProfile((GatewayProfile) o);
- }else {
- logger.error("Object should be a GatewayProfile.", new IllegalArgumentException());
- throw new IllegalArgumentException("Object should be a GatewayProfile.");
- }
- case COMPUTE_RESOURCE_PREFERENCE:
- if (o instanceof ComputeResourcePreference){
- return createComputeResourcePref((ComputeResourcePreference) o);
- }else {
- logger.error("Object should be a Compute Resource Preference.", new IllegalArgumentException());
- throw new IllegalArgumentException("Object should be a Compute Resource Preference.");
- }
- case APPLICATION_INPUT:
- if (o instanceof ApplicationInput){
- return createApplicationInput((ApplicationInput) o);
- }else {
- logger.error("Object should be a ApplicationInput.", new IllegalArgumentException());
- throw new IllegalArgumentException("Object should be a ApplicationInput.");
- }
- case BATCH_QUEUE:
- if (o instanceof BatchQueue){
- return createBatchQueue((BatchQueue) o);
- }else{
- logger.error("Object should be a Batch Queue.", new IllegalArgumentException());
- throw new IllegalArgumentException("Object should be a Batch Queue.");
- }
- case COMPUTE_RESOURCE_FILE_SYSTEM:
- if (o instanceof ComputeResourceFileSystem){
- return createComputeResourceFileSystem((ComputeResourceFileSystem) o);
- }else{
- logger.error("Object should be a Compute Resource File System.", new IllegalArgumentException());
- throw new IllegalArgumentException("Object should be a Compute Resource File System.");
- }
- case JOB_SUBMISSION_INTERFACE:
- if (o instanceof JobSubmissionInterface){
- return createJobSubmissionInterface((JobSubmissionInterface) o);
- }else{
- logger.error("Object should be a Job Submission Interface.", new IllegalArgumentException());
- throw new IllegalArgumentException("Object should be a Job Submission Interface.");
- }
- case DATA_MOVEMENT_INTERFACE:
- if (o instanceof DataMovementInterface){
- return createDataMovementInterface((DataMovementInterface) o);
- }else{
- logger.error("Object should be a Data Movement Interface.", new IllegalArgumentException());
- throw new IllegalArgumentException("Object should be a Data Movement Interface.");
- }
- case RESOURCE_JOB_MANAGER:
- if (o instanceof ResourceJobManager){
- return createResourceJobManager((ResourceJobManager) o);
- }else{
- logger.error("Object should be a Resource Job Manager.", new IllegalArgumentException());
- throw new IllegalArgumentException("Object should be a Resource Job Manager.");
- }
- case JOB_MANAGER_COMMAND:
- if (o instanceof JobManagerCommand){
- return createJobManagerCommand((JobManagerCommand) o);
- }else{
- logger.error("Object should be a Job Manager Command.", new IllegalArgumentException());
- throw new IllegalArgumentException("Object should be a Job Manager Command.");
- }
- case LOCAL_SUBMISSION:
- if (o instanceof LocalSubmission){
- return createLocalSubmission((LocalSubmission) o);
- }else{
- logger.error("Object should be a Local Submission.", new IllegalArgumentException());
- throw new IllegalArgumentException("Object should be a Local Submission.");
- }
- case LOCAL_DATA_MOVEMENT:
- if (o instanceof LocalDataMovement){
- return createLocalDataMovement((LocalDataMovement) o);
- }else{
- logger.error("Object should be a Local Data Movement.", new IllegalArgumentException());
- throw new IllegalArgumentException("Object should be a Local Data Movement.");
- }
- case MODULE_LOAD_CMD:
- if (o instanceof ModuleLoadCmd) {
- return createModuleLoadCmd((ModuleLoadCmd) o);
- } else {
- logger.error("Object should be a Module Load Cmd.", new IllegalArgumentException());
- throw new IllegalArgumentException("Object should be a Module Load Cmd.");
- }
- case WORKFLOW:
- if (o instanceof Workflow) {
- return createWorkflow((Workflow) o);
- } else {
- logger.error("Object should be a Workflow.", new IllegalArgumentException());
- throw new IllegalArgumentException("Object should be a Workflow.");
- }
- case WORKFLOW_INPUT:
- if (o instanceof WorkflowInput){
- return createWorflowInput((WorkflowInput) o);
- }else {
- logger.error("Object should be a Workflow Input.", new IllegalArgumentException());
- throw new IllegalArgumentException("Object should be a Workflow Input.");
- }
- case WORKFLOW_OUTPUT:
- if (o instanceof WorkflowOutput){
- return createWorkflowOutput((WorkflowOutput) o);
- }else {
- logger.error("Object should be a Workflow Output.", new IllegalArgumentException());
- throw new IllegalArgumentException("Object should be a Workflow Output.");
- }
- default:
- logger.error("Illegal data type..", new IllegalArgumentException());
- throw new IllegalArgumentException("Illegal data type..");
- }
- }
-
- private static Resource createLocalDataMovement(LocalDataMovement o) {
- LocalDataMovementResource localDataMovementResource = new LocalDataMovementResource();
- if (o != null){
- localDataMovementResource.setDataMovementInterfaceId(o.getDataMovementInterfaceId());
- }
- return localDataMovementResource;
- }
-
- private static Resource createLocalSubmission(LocalSubmission o) {
- LocalSubmissionResource localSubmissionResource = new LocalSubmissionResource();
- if (o != null){
- localSubmissionResource.setResourceJobManagerId(o.getResourceJobManagerId());
- localSubmissionResource.setResourceJobManagerResource((ResourceJobManagerResource)createResourceJobManager(o.getResourceJobManager()));
- localSubmissionResource.setJobSubmissionInterfaceId(o.getJobSubmissionInterfaceId());
- localSubmissionResource.setCreatedTime(o.getCreationTime());
- if (o.getUpdateTime() != null){
- localSubmissionResource.setUpdatedTime(o.getUpdateTime());
- }
- }
- return localSubmissionResource;
- }
-
- private static Resource createJobManagerCommand(JobManagerCommand o) {
- JobManagerCommandResource jobManagerCommandResource = new JobManagerCommandResource();
- if (o != null){
- jobManagerCommandResource.setResourceJobManagerId(o.getResourceJobManagerId());
- jobManagerCommandResource.setResourceJobManagerResource((ResourceJobManagerResource)createResourceJobManager(o.getResourceJobManager()));
- jobManagerCommandResource.setCommandType(o.getCommandType());
- jobManagerCommandResource.setCommand(o.getCommand());
- }
- return jobManagerCommandResource;
- }
-
- private static Resource createResourceJobManager(ResourceJobManager o) {
- ResourceJobManagerResource resourceJobManagerResource = new ResourceJobManagerResource();
- if (o != null) {
- resourceJobManagerResource.setResourceJobManagerId(o.getResourceJobManagerId());
- resourceJobManagerResource.setPushMonitoringEndpoint(o.getPushMonitoringEndpoint());
- resourceJobManagerResource.setJobManagerBinPath(o.getJobManagerBinPath());
- resourceJobManagerResource.setResourceJobManagerType(o.getResourceJobManagerType());
- resourceJobManagerResource.setCreatedTime(o.getCreationTime());
- if (o.getUpdateTime() != null){
- resourceJobManagerResource.setUpdatedTime(o.getUpdateTime());
- }
- }
- return resourceJobManagerResource;
- }
-
- private static Resource createDataMovementInterface(DataMovementInterface o) {
- DataMovementInterfaceResource dataMovementInterfaceResource = new DataMovementInterfaceResource();
- if (o != null) {
- dataMovementInterfaceResource.setComputeResourceId(o.getComputeResourceId());
- dataMovementInterfaceResource.setComputeHostResource((ComputeResourceResource)createComputeResource(o.getComputeResource()));
- dataMovementInterfaceResource.setDataMovementProtocol(o.getDataMovementProtocol());
- dataMovementInterfaceResource.setDataMovementInterfaceId(o.getDataMovementInterfaceId());
- dataMovementInterfaceResource.setPriorityOrder(o.getPriorityOrder());
- dataMovementInterfaceResource.setCreatedTime(o.getCreationTime());
- if (o.getUpdateTime() != null){
- dataMovementInterfaceResource.setUpdatedTime(o.getUpdateTime());
- }
- }
- return dataMovementInterfaceResource;
- }
-
- private static Resource createJobSubmissionInterface(JobSubmissionInterface o) {
- JobSubmissionInterfaceResource jobSubmissionInterfaceResource = new JobSubmissionInterfaceResource();
- if (o != null) {
- jobSubmissionInterfaceResource.setJobSubmissionInterfaceId(o.getJobSubmissionInterfaceId());
- jobSubmissionInterfaceResource.setComputeResourceId(o.getComputeResourceId());
- jobSubmissionInterfaceResource.setComputeHostResource((ComputeResourceResource)createComputeResource(o.getComputeResource()));
- jobSubmissionInterfaceResource.setJobSubmissionProtocol(o.getJobSubmissionProtocol());
- jobSubmissionInterfaceResource.setPriorityOrder(o.getPriorityOrder());
- jobSubmissionInterfaceResource.setCreatedTime(o.getCreationTime());
- if (o.getUpdateTime() != null){
- jobSubmissionInterfaceResource.setUpdatedTime(o.getUpdateTime());
- }
- }
- return jobSubmissionInterfaceResource;
- }
-
- private static Resource createComputeResourceFileSystem(ComputeResourceFileSystem o) {
- ComputeResourceFileSystemResource computeResourceFileSystemResource = new ComputeResourceFileSystemResource();
- if (o != null){
- computeResourceFileSystemResource.setComputeResourceId(o.getComputeResourceId());
- computeResourceFileSystemResource.setComputeHostResource((ComputeResourceResource)createComputeResource(o.getComputeResource()));
- computeResourceFileSystemResource.setPath(o.getPath());
- computeResourceFileSystemResource.setFileSystem(o.getFileSystem());
- }
- return computeResourceFileSystemResource;
- }
-
- private static Resource createBatchQueue(BatchQueue o) {
- BatchQueueResource batchQueueResource = new BatchQueueResource();
- if (o != null){
- batchQueueResource.setComputeResourceId(o.getComputeResourceId());
- batchQueueResource.setComputeHostResource((ComputeResourceResource)createComputeResource(o.getComputeResource()));
- batchQueueResource.setMaxRuntime(o.getMaxRuntime());
- batchQueueResource.setMaxJobInQueue(o.getMaxJobInQueue());
- batchQueueResource.setQueueDescription(o.getQueueDescription());
- batchQueueResource.setQueueName(o.getQueueName());
- batchQueueResource.setMaxProcessors(o.getMaxProcessors());
- batchQueueResource.setMaxNodes(o.getMaxNodes());
- batchQueueResource.setMaxMemory(o.getMaxMemory());
- }
- return batchQueueResource;
- }
- private static Resource createComputeResource(ComputeResource o) {
- ComputeResourceResource computeResourceResource = new ComputeResourceResource();
- if (o != null) {
- computeResourceResource.setResourceDescription(o.getResourceDescription());
- computeResourceResource.setResourceId(o.getResourceId());
- computeResourceResource.setHostName(o.getHostName());
- computeResourceResource.setCreatedTime(o.getCreationTime());
- computeResourceResource.setMaxMemoryPerNode(o.getMaxMemoryPerNode());
- if (o.getUpdateTime() != null){
- computeResourceResource.setUpdatedTime(o.getUpdateTime());
- }
- }
- return computeResourceResource;
- }
-
- private static Resource createHostAlias(HostAlias o) {
- HostAliasResource aliasResource = new HostAliasResource();
- if (o != null){
- aliasResource.setResourceID(o.getResourceID());
- aliasResource.setAlias(o.getAlias());
- aliasResource.setComputeHostResource((ComputeResourceResource)createComputeResource(o.getComputeResource()));
- }
- return aliasResource;
- }
-
- private static Resource createHostIPAddress(HostIPAddress o) {
- HostIPAddressResource ipAddressResource = new HostIPAddressResource();
- if (o != null){
- ipAddressResource.setResourceID(o.getResourceID());
- ipAddressResource.setIpaddress(o.getIpaddress());
- ipAddressResource.setComputeHostResource((ComputeResourceResource)createComputeResource(o.getComputeResource()));
- }
- return ipAddressResource;
- }
-
- private static Resource createGSSISSHSubmission(GSISSHSubmission o) {
- GSISSHSubmissionResource submissionResource = new GSISSHSubmissionResource();
- if (o != null) {
- submissionResource.setSubmissionID(o.getSubmissionID());
- submissionResource.setResourceJobManager(o.getResourceJobManager());
- submissionResource.setSshPort(o.getSshPort());
- submissionResource.setInstalledPath(o.getInstalledPath());
- submissionResource.setMonitorMode(o.getMonitorMode());
- }
- return submissionResource;
- }
-
-
- private static Resource createUnicoreJobSubmission(UnicoreJobSubmission o) {
- UnicoreJobSubmissionResource submissionResource = new UnicoreJobSubmissionResource();
- if (o != null) {
- submissionResource.setjobSubmissionInterfaceId(o.getSubmissionID());
- submissionResource.setUnicoreEndpointUrl(o.getUnicoreEndpointUrl());
- submissionResource.setSecurityProtocol(o.getSecurityProtocol());
- }
- return submissionResource;
- }
-
- private static Resource createUnicoreDataMovement(UnicoreDataMovement o) {
- UnicoreDataMovementResource dataMovementResource = new UnicoreDataMovementResource();
- if (o != null) {
- dataMovementResource.setDataMovementId(o.getDataMovementId());
- dataMovementResource.setUnicoreEndpointUrl(o.getUnicoreEndpointUrl());
- dataMovementResource.setSecurityProtocol(o.getSecurityProtocol());
- }
- return dataMovementResource;
- }
-
- private static Resource createGSISSHExport(GSISSHExport o){
- GSISSHExportResource resource = new GSISSHExportResource();
- if (o != null) {
- resource.setSubmissionID(o.getSubmissionID());
- resource.setExport(o.getExport());
- resource.setGsisshSubmissionResource((GSISSHSubmissionResource)createGSSISSHSubmission(o.getGsisshJobSubmission()));
- }
- return resource;
- }
-
- private static Resource createPreJobCommand(PreJobCommand o){
- PreJobCommandResource resource = new PreJobCommandResource();
- if (o != null) {
- resource.setAppDeploymentId(o.getDeploymentId());
- resource.setCommand(o.getCommand());
- resource.setAppDeploymentResource((AppDeploymentResource) createApplicationDeployment(o.getApplicationDeployment()));
- }
- return resource;
- }
-
- private static Resource createPostJObCommand(PostJobCommand o){
- PostJobCommandResource resource = new PostJobCommandResource();
- if (o != null){
- resource.setAppDeploymentId(o.getDeploymentId());
- resource.setCommand(o.getCommand());
- resource.setAppDeploymentResource((AppDeploymentResource) createApplicationDeployment(o.getDeployment()));
- }
- return resource;
- }
-
- private static Resource createGlobusJobSubmission(GlobusJobSubmission o) {
- GlobusJobSubmissionResource resource = new GlobusJobSubmissionResource();
- if (o != null){
- resource.setSubmissionID(o.getSubmissionID());
- resource.setResourceJobManager(o.getResourceJobManager());
- resource.setSecurityProtocol(o.getSecurityProtocol());
- }
- return resource;
- }
-
- private static Resource createGlobusEndpoint(GlobusGKEndpoint o) {
- GlobusGKEndpointResource resource = new GlobusGKEndpointResource();
- if (o != null){
- resource.setSubmissionID(o.getSubmissionID());
- resource.setEndpoint(o.getEndpoint());
- resource.setGlobusJobSubmissionResource((GlobusJobSubmissionResource)createGlobusJobSubmission(o.getGlobusSubmission()));
- }
- return resource;
- }
-
- private static Resource createSshJobSubmission(SshJobSubmission o) {
- SshJobSubmissionResource sshJobSubmissionResource = new SshJobSubmissionResource();
- if (o != null) {
- sshJobSubmissionResource.setResourceJobManagerId(o.getResourceJobManagerId());
- sshJobSubmissionResource.setResourceJobManagerResource((ResourceJobManagerResource) createResourceJobManager(o.getResourceJobManager()));
- sshJobSubmissionResource.setJobSubmissionInterfaceId(o.getJobSubmissionInterfaceId());
- sshJobSubmissionResource.setAlternativeSshHostname(o.getAlternativeSshHostname());
- sshJobSubmissionResource.setSecurityProtocol(o.getSecurityProtocol());
- sshJobSubmissionResource.setSshPort(o.getSshPort());
- sshJobSubmissionResource.setMonitorMode(o.getMonitorMode());
- sshJobSubmissionResource.setCreatedTime(o.getCreationTime());
- if (o.getUpdateTime() != null){
- sshJobSubmissionResource.setUpdatedTime(o.getUpdateTime());
- }
- }
- return sshJobSubmissionResource;
- }
-
- private static Resource createScpDataMovement(ScpDataMovement o) {
- ScpDataMovementResource scpDataMovementResource = new ScpDataMovementResource();
- if (o != null){
- scpDataMovementResource.setQueueDescription(o.getQueueDescription());
- scpDataMovementResource.setDataMovementInterfaceId(o.getDataMovementInterfaceId());
- scpDataMovementResource.setSecurityProtocol(o.getSecurityProtocol());
- scpDataMovementResource.setAlternativeScpHostname(o.getAlternativeScpHostname());
- scpDataMovementResource.setSshPort(o.getSshPort());
- scpDataMovementResource.setCreatedTime(o.getCreationTime());
- if (o.getUpdateTime() != null){
- scpDataMovementResource.setUpdatedTime(o.getUpdateTime());
- }
- }
- return scpDataMovementResource;
- }
-
- private static Resource createGridftpDataMovement(GridftpDataMovement o) {
- GridftpDataMovementResource gridftpDataMovementResource = new GridftpDataMovementResource();
- if (o != null){
- gridftpDataMovementResource.setDataMovementInterfaceId(o.getDataMovementInterfaceId());
- gridftpDataMovementResource.setSecurityProtocol(o.getSecurityProtocol());
- gridftpDataMovementResource.setCreatedTime(o.getCreationTime());
- if (o.getUpdateTime() != null){
- gridftpDataMovementResource.setUpdatedTime(o.getUpdateTime());
- }
- }
- return gridftpDataMovementResource;
- }
-
- private static Resource createGridftpEndpoint(GridftpEndpoint o) {
- GridftpEndpointResource gridftpEndpointResource = new GridftpEndpointResource();
- if (o != null){
- gridftpEndpointResource.setEndpoint(o.getEndpoint());
- gridftpEndpointResource.setDataMovementInterfaceId(o.getDataMovementInterfaceId());
- gridftpEndpointResource.setGridftpDataMovementResource((GridftpDataMovementResource)createGridftpDataMovement(o.getGridftpDataMovement()));
- gridftpEndpointResource.setCreatedTime(o.getCreationTime());
- if (o.getUpdateTime() != null){
- gridftpEndpointResource.setUpdatedTime(o.getUpdateTime());
- }
- }
- return gridftpEndpointResource;
- }
-
-// private static Resource createJobSubmissionProtocol(JobSubmissionProtocol o) {
-// JobSubmissionProtocolResource resource = new JobSubmissionProtocolResource();
-// if (o != null){
-// resource.setResourceID(o.getResourceID());
-// resource.setSubmissionID(o.getSubmissionID());
-// resource.setJobType(o.getJobType());
-// resource.setComputeHostResource((ComputeResourceResource)createComputeResource(o.getComputeResource()));
-// }
-// return resource;
-// }
-//
-// private static Resource createDataMovementProtocol(DataMovementProtocol o) {
-// DataMovementProtocolResource resource = new DataMovementProtocolResource();
-// if (o != null) {
-// resource.setResourceID(o.getResourceID());
-// resource.setDataMoveID(o.getDataMoveID());
-// resource.setDataMoveType(o.getDataMoveType());
-// resource.setComputeHostResource((ComputeResourceResource)createComputeResource(o.getComputeResource()));
-// }
-// return resource;
-// }
-
- private static Resource createApplicationModule(ApplicationModule o) {
- AppModuleResource moduleResource = new AppModuleResource();
- if (o != null){
- moduleResource.setModuleId(o.getModuleID());
- moduleResource.setModuleDesc(o.getModuleDesc());
- moduleResource.setGatewayId(o.getGatewayId());
- moduleResource.setModuleName(o.getModuleName());
- moduleResource.setModuleVersion(o.getModuleVersion());
- moduleResource.setCreatedTime(o.getCreationTime());
- if (o.getUpdateTime() != null){
- moduleResource.setUpdatedTime(o.getUpdateTime());
- }
- }
- return moduleResource;
- }
-
- private static Resource createApplicationDeployment(ApplicationDeployment o) {
- AppDeploymentResource resource = new AppDeploymentResource();
- if (o != null){
- resource.setDeploymentId(o.getDeploymentID());
- resource.setAppDes(o.getApplicationDesc());
- resource.setAppModuleId(o.getAppModuleID());
- resource.setHostId(o.getHostID());
- resource.setExecutablePath(o.getExecutablePath());
- resource.setGatewayId(o.getGatewayId());
- resource.setParallelism(o.getParallelism());
- resource.setModuleResource((AppModuleResource) createApplicationModule(o.getApplicationModule()));
- resource.setHostResource((ComputeResourceResource) createComputeResource(o.getComputeResource()));
- resource.setCreatedTime(o.getCreationTime());
- if (o.getUpdateTime() != null){
- resource.setUpdatedTime(o.getUpdateTime());
- }
- }
- return resource;
- }
-
- private static Resource createLibraryPrepPathResource(LibraryPrepandPath o) {
- LibraryPrepandPathResource resource = new LibraryPrepandPathResource();
- if (o != null){
- resource.setDeploymentId(o.getDeploymentID());
- resource.setName(o.getName());
- resource.setValue(o.getValue());
- resource.setAppDeploymentResource((AppDeploymentResource) createApplicationDeployment(o.getApplicationDeployment()));
- }
- return resource;
- }
-
- private static Resource createLibraryApendPathResource(LibraryApendPath o) {
- LibraryApendPathResource resource = new LibraryApendPathResource();
- if (o != null){
- resource.setDeploymentId(o.getDeploymentID());
- resource.setName(o.getName());
- resource.setValue(o.getValue());
- resource.setAppDeploymentResource((AppDeploymentResource)createApplicationDeployment(o.getApplicationDeployment()));
- }
- return resource;
- }
-
- private static Resource createAppEnvironmentResource(AppEnvironment o) {
- AppEnvironmentResource resource = new AppEnvironmentResource();
- if (o != null){
- resource.setDeploymentId(o.getDeploymentID());
- resource.setName(o.getName());
- resource.setValue(o.getValue());
- resource.setAppDeploymentResource((AppDeploymentResource)createApplicationDeployment(o.getApplicationDeployment()));
- }
- return resource;
- }
-
- private static Resource createAppInterfaceResource(ApplicationInterface o) {
- AppInterfaceResource resource = new AppInterfaceResource();
- if (o != null){
- resource.setInterfaceId(o.getInterfaceID());
- resource.setAppName(o.getAppName());
- resource.setAppDescription(o.getAppDescription());
- resource.setCreatedTime(o.getCreationTime());
- resource.setGatewayId(o.getGatewayId());
- if (o.getUpdateTime() != null){
- resource.setUpdatedTime(o.getUpdateTime());
- }
- }
- return resource;
- }
-
- private static Resource createAppModMappingResource(AppModuleMapping o) {
- AppModuleMappingResource resource = new AppModuleMappingResource();
- if (o != null){
- resource.setInterfaceId(o.getInterfaceID());
- resource.setModuleId(o.getModuleID());
- }
- return resource;
- }
-
- private static Resource createApplicationInput(ApplicationInput o) {
- ApplicationInputResource resource = new ApplicationInputResource();
- if (o != null){
- resource.setInterfaceID(o.getInterfaceID());
- resource.setInputKey(o.getInputKey());
- resource.setInputVal(o.getInputVal());
- resource.setDataType(o.getDataType());
- resource.setMetadata(o.getMetadata());
- resource.setAppArgument(o.getAppArgument());
- resource.setUserFriendlyDesc(o.getUserFriendlyDesc());
- resource.setStandardInput(o.isStandardInput());
- resource.setInputOrder(o.getInputOrder());
- resource.setRequired(o.isRequired());
- resource.setRequiredToCMD(o.isRequiredToCMD());
- resource.setDataStaged(o.isDataStaged());
- resource.setAppInterfaceResource((AppInterfaceResource)createAppInterfaceResource(o.getApplicationInterface()));
- }
- return resource;
- }
-
- private static Resource createWorflowInput(WorkflowInput o) {
- WorkflowInputResource resource = new WorkflowInputResource();
- if (o != null){
- resource.setWfTemplateId(o.getWfTemplateId());
- resource.setInputKey(o.getInputKey());
- if (o.getInputVal() != null){
- resource.setInputVal(new String(o.getInputVal()));
- }
- resource.setDataType(o.getDataType());
- resource.setMetadata(o.getMetadata());
- resource.setAppArgument(o.getAppArgument());
- resource.setInputOrder(o.getInputOrder());
- resource.setUserFriendlyDesc(o.getUserFriendlyDesc());
- resource.setStandardInput(o.isStandardInput());
- resource.setRequired(o.isRequired());
- resource.setRequiredToCMD(o.isRequiredToCMD());
- resource.setDataStaged(o.isDataStaged());
- resource.setWorkflowResource((WorkflowResource)createWorkflow(o.getWorkflow()));
- }
- return resource;
- }
-
- private static Resource createApplicationOutput(ApplicationOutput o) {
- ApplicationOutputResource resource = new ApplicationOutputResource();
- if (o != null){
- resource.setInterfaceID(o.getInterfaceID());
- resource.setOutputKey(o.getOutputKey());
- resource.setOutputVal(o.getOutputVal());
- resource.setDataType(o.getDataType());
- resource.setRequired(o.isRequired());
- resource.setRequiredToCMD(o.isRequiredToCMD());
- resource.setDataMovement(o.isDataMovement());
- resource.setDataNameLocation(o.getDataNameLocation());
- resource.setSearchQuery(o.getSearchQuery());
- resource.setAppArgument(o.getApplicationArgument());
- resource.setAppInterfaceResource((AppInterfaceResource)createAppInterfaceResource(o.getApplicationInterface()));
- }
- return resource;
- }
-
- private static Resource createWorkflowOutput(WorkflowOutput o) {
- WorkflowOutputResource resource = new WorkflowOutputResource();
- if (o != null){
- resource.setWfTemplateId(o.getWfTemplateId());
- resource.setOutputKey(o.getOutputKey());
- if (o.getOutputVal() != null){
- resource.setOutputVal(new String(o.getOutputVal()));
- }
- resource.setDataType(o.getDataType());
- resource.setValidityType(o.getValidityType());
- resource.setDataMovement(o.isDataMovement());
- resource.setDataNameLocation(o.getDataNameLocation());
- resource.setWorkflowResource((WorkflowResource)createWorkflow(o.getWorkflow()));
- }
- return resource;
- }
-
- private static Resource createGatewayProfile(GatewayProfile o) {
- GatewayProfileResource resource = new GatewayProfileResource();
- if (o != null) {
- resource.setGatewayID(o.getGatewayID());
- resource.setCreatedTime(o.getCreationTime());
- if (o.getUpdateTime() != null){
- resource.setUpdatedTime(o.getUpdateTime());
- }
- }
- return resource;
- }
-
- private static Resource createComputeResourcePref(ComputeResourcePreference o) {
- ComputeHostPreferenceResource resource = new ComputeHostPreferenceResource();
- if (o != null) {
- resource.setGatewayId(o.getGatewayId());
- resource.setResourceId(o.getResourceId());
- resource.setOverrideByAiravata(o.isOverrideByAiravata());
- resource.setPreferredJobProtocol(o.getPreferedJobSubmissionProtocol());
- resource.setPreferedDMProtocol(o.getPreferedDataMoveProtocol());
- resource.setBatchQueue(o.getBatchQueue());
- resource.setScratchLocation(o.getScratchLocation());
- resource.setProjectNumber(o.getProjectNumber());
- resource.setLoginUserName(o.getLoginUserName());
- resource.setComputeHostResource((ComputeResourceResource) createComputeResource(o.getComputeHostResource()));
- resource.setGatewayProfile((GatewayProfileResource) createGatewayProfile(o.getGatewayProfile()));
- }
- return resource;
- }
-
- private static Resource createModuleLoadCmd(ModuleLoadCmd o) {
- ModuleLoadCmdResource moduleLoadCmdResource = new ModuleLoadCmdResource();
- if (o != null){
- moduleLoadCmdResource.setCmd(o.getCmd());
- moduleLoadCmdResource.setAppDeploymentId(o.getAppDeploymentId());
- moduleLoadCmdResource.setAppDeploymentResource((AppDeploymentResource)createApplicationDeployment(o.getApplicationDeployment()));
- }
- return moduleLoadCmdResource;
- }
-
- private static Resource createWorkflow(Workflow o) {
- WorkflowResource workflowResource = new WorkflowResource();
- workflowResource.setWfName(o.getWfName());
- workflowResource.setCreatedUser(o.getCreatedUser());
- if (o.getGraph() != null){
- workflowResource.setGraph(new String(o.getGraph()));
- }
- if (o.getImage() != null){
- workflowResource.setImage(new String(o.getImage()));
- }
- workflowResource.setCreatedTime(o.getCreationTime());
- if (o.getUpdateTime() != null){
- workflowResource.setUpdatedTime(o.getUpdateTime());
- }
- workflowResource.setWfTemplateId(o.getWfTemplateId());
- workflowResource.setGatewayId(o.getGatewayId());
- return workflowResource;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/util/AppCatalogQueryGenerator.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/util/AppCatalogQueryGenerator.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/util/AppCatalogQueryGenerator.java
deleted file mode 100644
index 8f41538..0000000
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/util/AppCatalogQueryGenerator.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- *
- * 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.aiaravata.application.catalog.data.util;
-
-import javax.persistence.EntityManager;
-import javax.persistence.Query;
-import java.util.HashMap;
-import java.util.Map;
-
-public class AppCatalogQueryGenerator {
- private String tableName;
- private Map<String,Object> matches=new HashMap<String, Object>();
- private static final String SELECT_OBJ="p";
- private static final String DELETE_OBJ="p";
- private static final String TABLE_OBJ="p";
-
- public AppCatalogQueryGenerator(String tableName, Object[]...params) {
- setTableName(tableName);
- for (Object[] param : params) {
- addMatch(param[0].toString(), param[1]);
- }
- }
-
- public String getTableName() {
- return tableName;
- }
- public void setTableName(String tableName) {
- this.tableName = tableName;
- }
- public void addMatch(String colName, Object matchValue){
- matches.put(colName, matchValue);
- }
-
- public void setParameter(String colName, Object matchValue){
- addMatch(colName, matchValue);
- }
-
- public Query selectQuery(EntityManager entityManager){
- String queryString="SELECT "+ SELECT_OBJ + " FROM " +getTableName()+" "+TABLE_OBJ;
- return generateQueryWithParameters(entityManager, queryString);
- }
-
- public Query deleteQuery(EntityManager entityManager){
- String queryString="Delete FROM "+getTableName()+" "+TABLE_OBJ;
- return generateQueryWithParameters(entityManager, queryString);
- }
-
- private Query generateQueryWithParameters(EntityManager entityManager,
- String queryString) {
- Map<String,Object> queryParameters=new HashMap<String, Object>();
- if (matches.size()>0){
- String matchString = "";
- int paramCount=0;
- for (String colName : matches.keySet()) {
- String paramName="param"+paramCount;
- queryParameters.put(paramName, matches.get(colName));
- if (!matchString.equals("")){
- matchString+=" AND ";
- }
- matchString+=TABLE_OBJ+"."+colName+" =:"+paramName;
- paramCount++;
- }
- queryString+=" WHERE "+matchString;
- }
- Query query = entityManager.createQuery(queryString);
- for (String paramName : queryParameters.keySet()) {
- query.setParameter(paramName, queryParameters.get(paramName));
- }
- return query;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/util/AppCatalogResourceType.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/util/AppCatalogResourceType.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/util/AppCatalogResourceType.java
deleted file mode 100644
index 196d3a1..0000000
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/util/AppCatalogResourceType.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- *
- * 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.aiaravata.application.catalog.data.util;
-
-public enum AppCatalogResourceType {
- COMPUTE_RESOURCE,
- HOST_ALIAS,
- HOST_IPADDRESS,
- GSISSH_SUBMISSION,
- GSISSH_EXPORT,
- PRE_JOBCOMMAND,
- POST_JOBCOMMAND,
- GLOBUS_SUBMISSION,
- UNICORE_JOB_SUBMISSION,
- UNICORE_DATA_MOVEMENT,
- GLOBUS_GK_ENDPOINT,
- SSH_JOB_SUBMISSION,
- SCP_DATA_MOVEMENT,
- GRIDFTP_DATA_MOVEMENT,
- GRIDFTP_ENDPOINT,
- JOB_SUBMISSION_PROTOCOL,
- DATA_MOVEMENT_PROTOCOL,
- APPLICATION_MODULE,
- APPLICATION_DEPLOYMENT,
- LIBRARY_PREPAND_PATH,
- LIBRARY_APEND_PATH,
- APP_ENVIRONMENT,
- APPLICATION_INTERFACE,
- APP_MODULE_MAPPING,
- APPLICATION_INPUT,
- APPLICATION_OUTPUT,
- GATEWAY_PROFILE,
- COMPUTE_RESOURCE_PREFERENCE,
- BATCH_QUEUE,
- COMPUTE_RESOURCE_FILE_SYSTEM,
- JOB_SUBMISSION_INTERFACE,
- DATA_MOVEMENT_INTERFACE,
- RESOURCE_JOB_MANAGER,
- JOB_MANAGER_COMMAND,
- LOCAL_SUBMISSION,
- LOCAL_DATA_MOVEMENT,
- MODULE_LOAD_CMD,
- ClOUD_SUBMISSION,
- WORKFLOW,
- WORKFLOW_INPUT,
- WORKFLOW_OUTPUT
-}
[15/52] [abbrv] [partial] airavata git commit: registry refactoring
Posted by sh...@apache.org.
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/ApplicationInputResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/ApplicationInputResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/ApplicationInputResource.java
new file mode 100644
index 0000000..3dcb6b4
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/ApplicationInputResource.java
@@ -0,0 +1,454 @@
+/**
+ * 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.aiaravata.application.catalog.data.resources;
+
+import org.airavata.appcatalog.cpi.AppCatalogException;
+import org.apache.aiaravata.application.catalog.data.model.AppInput_PK;
+import org.apache.aiaravata.application.catalog.data.model.ApplicationInput;
+import org.apache.aiaravata.application.catalog.data.model.ApplicationInterface;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogJPAUtils;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogQueryGenerator;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogResourceType;
+import org.apache.airavata.common.exception.ApplicationSettingsException;
+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 ApplicationInputResource extends AbstractResource {
+
+ private final static Logger logger = LoggerFactory.getLogger(ApplicationInputResource.class);
+
+ private String interfaceID;
+ private String inputKey;
+ private String dataType;
+ private String inputVal;
+ private String metadata;
+ private String appArgument;
+ private String userFriendlyDesc;
+ private int inputOrder;
+ private boolean standardInput;
+ private boolean isRequired;
+ private boolean requiredToCMD;
+ private boolean dataStaged;
+
+ private AppInterfaceResource appInterfaceResource;
+
+ 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(APPLICATION_INPUT);
+ generator.setParameter(AppInputConstants.INTERFACE_ID, ids.get(AppInputConstants.INTERFACE_ID));
+ if (ids.get(AppInputConstants.INPUT_KEY) != null){
+ generator.setParameter(AppInputConstants.INPUT_KEY, ids.get(AppInputConstants.INPUT_KEY));
+ }
+ 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();
+ }
+ }
+ }
+
+ public Resource get(Object identifier) throws AppCatalogException {
+ HashMap<String, String> ids;
+ if (identifier instanceof Map) {
+ ids = (HashMap<String, String>) 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(APPLICATION_INPUT);
+ generator.setParameter(AppInputConstants.INTERFACE_ID, ids.get(AppInputConstants.INTERFACE_ID));
+ generator.setParameter(AppInputConstants.INPUT_KEY, ids.get(AppInputConstants.INPUT_KEY));
+ Query q = generator.selectQuery(em);
+ ApplicationInput applicationInput = (ApplicationInput) q.getSingleResult();
+ ApplicationInputResource applicationInputResource =
+ (ApplicationInputResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.APPLICATION_INPUT
+ , applicationInput);
+ em.getTransaction().commit();
+ em.close();
+ return applicationInputResource;
+ } 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();
+ }
+ }
+ }
+
+ public List<Resource> get(String fieldName, Object value) throws AppCatalogException {
+ List<Resource> appInputResources = new ArrayList<Resource>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ Query q;
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(APPLICATION_INPUT);
+ List results;
+ if (fieldName.equals(AppInputConstants.INTERFACE_ID)) {
+ generator.setParameter(AppInputConstants.INTERFACE_ID, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ ApplicationInput applicationInput = (ApplicationInput) result;
+ ApplicationInputResource applicationInputResource =
+ (ApplicationInputResource) AppCatalogJPAUtils.getResource(
+ AppCatalogResourceType.APPLICATION_INPUT, applicationInput);
+ appInputResources.add(applicationInputResource);
+ }
+ }
+ } else if (fieldName.equals(AppInputConstants.INPUT_KEY)) {
+ generator.setParameter(AppInputConstants.INPUT_KEY, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ ApplicationInput applicationInput = (ApplicationInput) result;
+ ApplicationInputResource applicationInputResource =
+ (ApplicationInputResource) AppCatalogJPAUtils.getResource(
+ AppCatalogResourceType.APPLICATION_INPUT, applicationInput);
+ appInputResources.add(applicationInputResource);
+ }
+ }
+ } else if (fieldName.equals(AppInputConstants.DATA_TYPE)) {
+ generator.setParameter(AppInputConstants.DATA_TYPE, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ ApplicationInput applicationInput = (ApplicationInput) result;
+ ApplicationInputResource applicationInputResource =
+ (ApplicationInputResource) AppCatalogJPAUtils.getResource(
+ AppCatalogResourceType.APPLICATION_INPUT, applicationInput);
+ appInputResources.add(applicationInputResource);
+ }
+ }
+ } else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for AppInput Resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for AppInput 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 appInputResources;
+ }
+
+ @Override
+ public List<Resource> getAll() throws AppCatalogException {
+ return null;
+ }
+
+ @Override
+ public List<String> getAllIds() throws AppCatalogException {
+ return null;
+ }
+
+ public List<String> getIds(String fieldName, Object value) throws AppCatalogException {
+ List<String> appInputResourceIDs = new ArrayList<String>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ Query q;
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(APPLICATION_INPUT);
+ List results;
+ if (fieldName.equals(AppInputConstants.INTERFACE_ID)) {
+ generator.setParameter(AppInputConstants.INTERFACE_ID, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ ApplicationInput applicationInput = (ApplicationInput) result;
+ appInputResourceIDs.add(applicationInput.getInterfaceID());
+ }
+ }
+ } else if (fieldName.equals(AppInputConstants.INPUT_KEY)) {
+ generator.setParameter(AppInputConstants.INPUT_KEY, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ ApplicationInput applicationInput = (ApplicationInput) result;
+ appInputResourceIDs.add(applicationInput.getInterfaceID());
+ }
+ }
+ } else if (fieldName.equals(AppInputConstants.DATA_TYPE)) {
+ generator.setParameter(AppInputConstants.DATA_TYPE, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ ApplicationInput applicationInput = (ApplicationInput) result;
+ appInputResourceIDs.add(applicationInput.getInterfaceID());
+ }
+ }
+ } else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for AppInput resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for AppInput 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 appInputResourceIDs;
+ }
+
+ public void save() throws AppCatalogException {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ ApplicationInput existingApplicationInput = em.find(ApplicationInput.class, new AppInput_PK(interfaceID, inputKey));
+ em.close();
+ ApplicationInput applicationInput;
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ if (existingApplicationInput == null) {
+ applicationInput = new ApplicationInput();
+ } else {
+ applicationInput=existingApplicationInput;
+ }
+ ApplicationInterface applicationInterface = em.find(ApplicationInterface.class, interfaceID);
+ applicationInput.setApplicationInterface(applicationInterface);
+ applicationInput.setInterfaceID(applicationInterface.getInterfaceID());
+ applicationInput.setDataType(dataType);
+ applicationInput.setInputKey(inputKey);
+ applicationInput.setInputVal(inputVal);
+ applicationInput.setMetadata(metadata);
+ applicationInput.setAppArgument(appArgument);
+ applicationInput.setUserFriendlyDesc(userFriendlyDesc);
+ applicationInput.setStandardInput(standardInput);
+ applicationInput.setInputOrder(inputOrder);
+ applicationInput.setRequiredToCMD(requiredToCMD);
+ applicationInput.setRequired(isRequired);
+ applicationInput.setDataStaged(dataStaged);
+ if (existingApplicationInput == null) {
+ em.persist(applicationInput);
+ } else {
+ em.merge(applicationInput);
+ }
+ 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();
+ }
+ }
+ }
+
+ public boolean isExists(Object identifier) throws AppCatalogException {
+ HashMap<String, String> ids;
+ if (identifier instanceof Map) {
+ ids = (HashMap<String, String>) 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();
+ ApplicationInput applicationInput = em.find(ApplicationInput.class, new AppInput_PK(
+ ids.get(AppInputConstants.INTERFACE_ID),
+ ids.get(AppInputConstants.INPUT_KEY)));
+
+ em.close();
+ return applicationInput != null;
+ } 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();
+ }
+ }
+ }
+
+ public String getInterfaceID() {
+ return interfaceID;
+ }
+
+ public void setInterfaceID(String interfaceID) {
+ this.interfaceID = interfaceID;
+ }
+
+ public String getInputKey() {
+ return inputKey;
+ }
+
+ public void setInputKey(String inputKey) {
+ this.inputKey = inputKey;
+ }
+
+ public String getDataType() {
+ return dataType;
+ }
+
+ public void setDataType(String dataType) {
+ this.dataType = dataType;
+ }
+
+ public String getInputVal() {
+ return inputVal;
+ }
+
+ public void setInputVal(String inputVal) {
+ this.inputVal = inputVal;
+ }
+
+ public String getMetadata() {
+ return metadata;
+ }
+
+ public void setMetadata(String metadata) {
+ this.metadata = metadata;
+ }
+
+ public String getAppArgument() {
+ return appArgument;
+ }
+
+ public void setAppArgument(String appArgument) {
+ this.appArgument = appArgument;
+ }
+
+ public String getUserFriendlyDesc() {
+ return userFriendlyDesc;
+ }
+
+ public void setUserFriendlyDesc(String userFriendlyDesc) {
+ this.userFriendlyDesc = userFriendlyDesc;
+ }
+
+ public AppInterfaceResource getAppInterfaceResource() {
+ return appInterfaceResource;
+ }
+
+ public void setAppInterfaceResource(AppInterfaceResource appInterfaceResource) {
+ this.appInterfaceResource = appInterfaceResource;
+ }
+
+ public boolean isStandardInput() {
+ return standardInput;
+ }
+
+ public void setStandardInput(boolean standardInput) {
+ this.standardInput = standardInput;
+ }
+
+ public int getInputOrder() {
+ return inputOrder;
+ }
+
+ public void setInputOrder(int inputOrder) {
+ this.inputOrder = inputOrder;
+ }
+
+ public boolean getRequired() {
+ return isRequired;
+ }
+
+ public void setRequired(boolean required) {
+ this.isRequired = required;
+ }
+
+ public boolean getRequiredToCMD() {
+ return requiredToCMD;
+ }
+
+ public void setRequiredToCMD(boolean requiredToCMD) {
+ this.requiredToCMD = requiredToCMD;
+ }
+
+ public boolean isDataStaged() {
+ return dataStaged;
+ }
+
+ public void setDataStaged(boolean dataStaged) {
+ this.dataStaged = dataStaged;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/ApplicationOutputAppCatalogResourceAppCat.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/ApplicationOutputAppCatalogResourceAppCat.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/ApplicationOutputAppCatalogResourceAppCat.java
new file mode 100644
index 0000000..e383c1c
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/ApplicationOutputAppCatalogResourceAppCat.java
@@ -0,0 +1,433 @@
+/**
+ * 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.AppOutput_PK;
+import org.apache.airavata.registry.core.app.catalog.model.ApplicationInterface;
+import org.apache.airavata.registry.core.app.catalog.model.ApplicationOutput;
+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 ApplicationOutputAppCatalogResourceAppCat extends AppCatAbstractResource {
+ private final static Logger logger = LoggerFactory.getLogger(ApplicationOutputAppCatalogResourceAppCat.class);
+
+ private String interfaceID;
+ private String outputKey;
+ private String outputVal;
+ private String dataType;
+ private boolean isRequired;
+ private boolean dataMovement;
+ private String dataNameLocation;
+ private boolean requiredToCMD;
+ private String searchQuery;
+ private String appArgument;
+
+ private AppInterfaceAppCatalogResourceAppCat appInterfaceResource;
+
+ 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(APPLICATION_OUTPUT);
+ generator.setParameter(AppOutputConstants.INTERFACE_ID, ids.get(AppOutputConstants.INTERFACE_ID));
+ if (ids.get(AppOutputConstants.OUTPUT_KEY) != null){
+ generator.setParameter(AppOutputConstants.OUTPUT_KEY, ids.get(AppOutputConstants.OUTPUT_KEY));
+ }
+ 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();
+ }
+ }
+ }
+
+ 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(APPLICATION_OUTPUT);
+ generator.setParameter(AppOutputConstants.INTERFACE_ID, ids.get(AppOutputConstants.INTERFACE_ID));
+ generator.setParameter(AppOutputConstants.OUTPUT_KEY, ids.get(AppOutputConstants.OUTPUT_KEY));
+ Query q = generator.selectQuery(em);
+ ApplicationOutput applicationOutput = (ApplicationOutput) q.getSingleResult();
+ ApplicationOutputAppCatalogResourceAppCat applicationOutputResource =
+ (ApplicationOutputAppCatalogResourceAppCat) AppCatalogJPAUtils.getResource(AppCatalogResourceType.APPLICATION_OUTPUT
+ , applicationOutput);
+ em.getTransaction().commit();
+ em.close();
+ return applicationOutputResource;
+ } 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();
+ }
+ }
+ }
+
+ public List<AppCatalogResource> get(String fieldName, Object value) throws AppCatalogException {
+ List<AppCatalogResource> appInputResources = new ArrayList<AppCatalogResource>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ Query q;
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(APPLICATION_OUTPUT);
+ List results;
+ if (fieldName.equals(AppOutputConstants.INTERFACE_ID)) {
+ generator.setParameter(AppOutputConstants.INTERFACE_ID, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ ApplicationOutput applicationOutput = (ApplicationOutput) result;
+ ApplicationOutputAppCatalogResourceAppCat applicationOutputResource =
+ (ApplicationOutputAppCatalogResourceAppCat) AppCatalogJPAUtils.getResource(
+ AppCatalogResourceType.APPLICATION_OUTPUT, applicationOutput);
+ appInputResources.add(applicationOutputResource);
+ }
+ }
+ } else if (fieldName.equals(AppOutputConstants.OUTPUT_KEY)) {
+ generator.setParameter(AppOutputConstants.OUTPUT_KEY, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ ApplicationOutput applicationOutput = (ApplicationOutput) result;
+ ApplicationOutputAppCatalogResourceAppCat applicationOutputResource =
+ (ApplicationOutputAppCatalogResourceAppCat) AppCatalogJPAUtils.getResource(
+ AppCatalogResourceType.APPLICATION_OUTPUT, applicationOutput);
+ appInputResources.add(applicationOutputResource);
+ }
+ }
+ } else if (fieldName.equals(AppOutputConstants.DATA_TYPE)) {
+ generator.setParameter(AppOutputConstants.DATA_TYPE, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ ApplicationOutput applicationOutput = (ApplicationOutput) result;
+ ApplicationOutputAppCatalogResourceAppCat applicationOutputResource =
+ (ApplicationOutputAppCatalogResourceAppCat) AppCatalogJPAUtils.getResource(
+ AppCatalogResourceType.APPLICATION_OUTPUT, applicationOutput);
+ appInputResources.add(applicationOutputResource);
+ }
+ }
+ } else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for App Output Resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for App Output 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 appInputResources;
+ }
+
+ @Override
+ public List<AppCatalogResource> getAll() throws AppCatalogException {
+ return null;
+ }
+
+ @Override
+ public List<String> getAllIds() throws AppCatalogException {
+ return null;
+ }
+
+ public List<String> getIds(String fieldName, Object value) throws AppCatalogException {
+ List<String> appOutputResourceIDs = new ArrayList<String>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ Query q;
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(APPLICATION_OUTPUT);
+ List results;
+ if (fieldName.equals(AppOutputConstants.INTERFACE_ID)) {
+ generator.setParameter(AppOutputConstants.INTERFACE_ID, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ ApplicationOutput applicationOutput = (ApplicationOutput) result;
+ appOutputResourceIDs.add(applicationOutput.getInterfaceID());
+ }
+ }
+ }
+ if (fieldName.equals(AppOutputConstants.OUTPUT_KEY)) {
+ generator.setParameter(AppOutputConstants.OUTPUT_KEY, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ ApplicationOutput applicationOutput = (ApplicationOutput) result;
+ appOutputResourceIDs.add(applicationOutput.getInterfaceID());
+ }
+ }
+ } else if (fieldName.equals(AppOutputConstants.DATA_TYPE)) {
+ generator.setParameter(AppOutputConstants.DATA_TYPE, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ ApplicationOutput applicationOutput = (ApplicationOutput) result;
+ appOutputResourceIDs.add(applicationOutput.getInterfaceID());
+ }
+ }
+ } else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for App Output resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for App Output 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 appOutputResourceIDs;
+ }
+
+ public void save() throws AppCatalogException {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ ApplicationOutput existingApplicationOutput = em.find(ApplicationOutput.class,
+ new AppOutput_PK(interfaceID, outputKey));
+ em.close();
+
+ ApplicationOutput applicationOutput;
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ if (existingApplicationOutput == null) {
+ applicationOutput = new ApplicationOutput();
+ } else {
+ applicationOutput = existingApplicationOutput;
+ }
+ ApplicationInterface applicationInterface = em.find(ApplicationInterface.class, interfaceID);
+ applicationOutput.setApplicationInterface(applicationInterface);
+ applicationOutput.setInterfaceID(applicationInterface.getInterfaceID());
+ applicationOutput.setDataType(dataType);
+ applicationOutput.setOutputKey(outputKey);
+ applicationOutput.setOutputVal(outputVal);
+ applicationOutput.setRequired(isRequired);
+ applicationOutput.setRequiredToCMD(requiredToCMD);
+ applicationOutput.setDataMovement(dataMovement);
+ applicationOutput.setDataNameLocation(dataNameLocation);
+ applicationOutput.setSearchQuery(searchQuery);
+ applicationOutput.setApplicationArgument(appArgument);
+ em.merge(applicationOutput);
+ 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();
+ }
+ }
+ }
+
+ 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();
+ ApplicationOutput applicationOutput = em.find(ApplicationOutput.class, new AppOutput_PK(
+ ids.get(AppOutputConstants.INTERFACE_ID),
+ ids.get(AppOutputConstants.OUTPUT_KEY)));
+
+ em.close();
+ return applicationOutput != null;
+ } 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();
+ }
+ }
+ }
+
+ public String getInterfaceID() {
+ return interfaceID;
+ }
+
+ public void setInterfaceID(String interfaceID) {
+ this.interfaceID = interfaceID;
+ }
+
+ public String getOutputKey() {
+ return outputKey;
+ }
+
+ public void setOutputKey(String outputKey) {
+ this.outputKey = outputKey;
+ }
+
+ public String getOutputVal() {
+ return outputVal;
+ }
+
+ public void setOutputVal(String outputVal) {
+ this.outputVal = outputVal;
+ }
+
+ public String getDataType() {
+ return dataType;
+ }
+
+ public void setDataType(String dataType) {
+ this.dataType = dataType;
+ }
+
+ public AppInterfaceAppCatalogResourceAppCat getAppInterfaceResource() {
+ return appInterfaceResource;
+ }
+
+ public void setAppInterfaceResource(AppInterfaceAppCatalogResourceAppCat appInterfaceResource) {
+ this.appInterfaceResource = appInterfaceResource;
+ }
+
+ public boolean getRequired() {
+ return isRequired;
+ }
+
+ public void setRequired(boolean required) {
+ this.isRequired = required;
+ }
+
+ public boolean isDataMovement() {
+ return dataMovement;
+ }
+
+ public void setDataMovement(boolean dataMovement) {
+ this.dataMovement = dataMovement;
+ }
+
+ public String getDataNameLocation() {
+ return dataNameLocation;
+ }
+
+ public void setDataNameLocation(String dataNameLocation) {
+ this.dataNameLocation = dataNameLocation;
+ }
+
+ public boolean getRequiredToCMD() {
+ return requiredToCMD;
+ }
+
+ public void setRequiredToCMD(boolean requiredToCMD) {
+ this.requiredToCMD = requiredToCMD;
+ }
+
+ public String getSearchQuery() {
+ return searchQuery;
+ }
+
+ public void setSearchQuery(String searchQuery) {
+ this.searchQuery = searchQuery;
+ }
+
+ public String getAppArgument() {
+ return appArgument;
+ }
+
+ public void setAppArgument(String appArgument) {
+ this.appArgument = appArgument;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/ApplicationOutputResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/ApplicationOutputResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/ApplicationOutputResource.java
new file mode 100644
index 0000000..feac711
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/ApplicationOutputResource.java
@@ -0,0 +1,432 @@
+/**
+ * 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.aiaravata.application.catalog.data.resources;
+
+import org.airavata.appcatalog.cpi.AppCatalogException;
+import org.apache.aiaravata.application.catalog.data.model.AppOutput_PK;
+import org.apache.aiaravata.application.catalog.data.model.ApplicationInterface;
+import org.apache.aiaravata.application.catalog.data.model.ApplicationOutput;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogJPAUtils;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogQueryGenerator;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogResourceType;
+import org.apache.airavata.common.exception.ApplicationSettingsException;
+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 ApplicationOutputResource extends AbstractResource {
+ private final static Logger logger = LoggerFactory.getLogger(ApplicationOutputResource.class);
+
+ private String interfaceID;
+ private String outputKey;
+ private String outputVal;
+ private String dataType;
+ private boolean isRequired;
+ private boolean dataMovement;
+ private String dataNameLocation;
+ private boolean requiredToCMD;
+ private String searchQuery;
+ private String appArgument;
+
+ private AppInterfaceResource appInterfaceResource;
+
+ 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(APPLICATION_OUTPUT);
+ generator.setParameter(AppOutputConstants.INTERFACE_ID, ids.get(AppOutputConstants.INTERFACE_ID));
+ if (ids.get(AppOutputConstants.OUTPUT_KEY) != null){
+ generator.setParameter(AppOutputConstants.OUTPUT_KEY, ids.get(AppOutputConstants.OUTPUT_KEY));
+ }
+ 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();
+ }
+ }
+ }
+
+ public Resource 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(APPLICATION_OUTPUT);
+ generator.setParameter(AppOutputConstants.INTERFACE_ID, ids.get(AppOutputConstants.INTERFACE_ID));
+ generator.setParameter(AppOutputConstants.OUTPUT_KEY, ids.get(AppOutputConstants.OUTPUT_KEY));
+ Query q = generator.selectQuery(em);
+ ApplicationOutput applicationOutput = (ApplicationOutput) q.getSingleResult();
+ ApplicationOutputResource applicationOutputResource =
+ (ApplicationOutputResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.APPLICATION_OUTPUT
+ , applicationOutput);
+ em.getTransaction().commit();
+ em.close();
+ return applicationOutputResource;
+ } 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();
+ }
+ }
+ }
+
+ public List<Resource> get(String fieldName, Object value) throws AppCatalogException {
+ List<Resource> appInputResources = new ArrayList<Resource>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ Query q;
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(APPLICATION_OUTPUT);
+ List results;
+ if (fieldName.equals(AppOutputConstants.INTERFACE_ID)) {
+ generator.setParameter(AppOutputConstants.INTERFACE_ID, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ ApplicationOutput applicationOutput = (ApplicationOutput) result;
+ ApplicationOutputResource applicationOutputResource =
+ (ApplicationOutputResource) AppCatalogJPAUtils.getResource(
+ AppCatalogResourceType.APPLICATION_OUTPUT, applicationOutput);
+ appInputResources.add(applicationOutputResource);
+ }
+ }
+ } else if (fieldName.equals(AppOutputConstants.OUTPUT_KEY)) {
+ generator.setParameter(AppOutputConstants.OUTPUT_KEY, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ ApplicationOutput applicationOutput = (ApplicationOutput) result;
+ ApplicationOutputResource applicationOutputResource =
+ (ApplicationOutputResource) AppCatalogJPAUtils.getResource(
+ AppCatalogResourceType.APPLICATION_OUTPUT, applicationOutput);
+ appInputResources.add(applicationOutputResource);
+ }
+ }
+ } else if (fieldName.equals(AppOutputConstants.DATA_TYPE)) {
+ generator.setParameter(AppOutputConstants.DATA_TYPE, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ ApplicationOutput applicationOutput = (ApplicationOutput) result;
+ ApplicationOutputResource applicationOutputResource =
+ (ApplicationOutputResource) AppCatalogJPAUtils.getResource(
+ AppCatalogResourceType.APPLICATION_OUTPUT, applicationOutput);
+ appInputResources.add(applicationOutputResource);
+ }
+ }
+ } else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for App Output Resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for App Output 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 appInputResources;
+ }
+
+ @Override
+ public List<Resource> getAll() throws AppCatalogException {
+ return null;
+ }
+
+ @Override
+ public List<String> getAllIds() throws AppCatalogException {
+ return null;
+ }
+
+ public List<String> getIds(String fieldName, Object value) throws AppCatalogException {
+ List<String> appOutputResourceIDs = new ArrayList<String>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ Query q;
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(APPLICATION_OUTPUT);
+ List results;
+ if (fieldName.equals(AppOutputConstants.INTERFACE_ID)) {
+ generator.setParameter(AppOutputConstants.INTERFACE_ID, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ ApplicationOutput applicationOutput = (ApplicationOutput) result;
+ appOutputResourceIDs.add(applicationOutput.getInterfaceID());
+ }
+ }
+ }
+ if (fieldName.equals(AppOutputConstants.OUTPUT_KEY)) {
+ generator.setParameter(AppOutputConstants.OUTPUT_KEY, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ ApplicationOutput applicationOutput = (ApplicationOutput) result;
+ appOutputResourceIDs.add(applicationOutput.getInterfaceID());
+ }
+ }
+ } else if (fieldName.equals(AppOutputConstants.DATA_TYPE)) {
+ generator.setParameter(AppOutputConstants.DATA_TYPE, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ ApplicationOutput applicationOutput = (ApplicationOutput) result;
+ appOutputResourceIDs.add(applicationOutput.getInterfaceID());
+ }
+ }
+ } else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for App Output resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for App Output 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 appOutputResourceIDs;
+ }
+
+ public void save() throws AppCatalogException {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ ApplicationOutput existingApplicationOutput = em.find(ApplicationOutput.class,
+ new AppOutput_PK(interfaceID, outputKey));
+ em.close();
+
+ ApplicationOutput applicationOutput;
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ if (existingApplicationOutput == null) {
+ applicationOutput = new ApplicationOutput();
+ } else {
+ applicationOutput = existingApplicationOutput;
+ }
+ ApplicationInterface applicationInterface = em.find(ApplicationInterface.class, interfaceID);
+ applicationOutput.setApplicationInterface(applicationInterface);
+ applicationOutput.setInterfaceID(applicationInterface.getInterfaceID());
+ applicationOutput.setDataType(dataType);
+ applicationOutput.setOutputKey(outputKey);
+ applicationOutput.setOutputVal(outputVal);
+ applicationOutput.setRequired(isRequired);
+ applicationOutput.setRequiredToCMD(requiredToCMD);
+ applicationOutput.setDataMovement(dataMovement);
+ applicationOutput.setDataNameLocation(dataNameLocation);
+ applicationOutput.setSearchQuery(searchQuery);
+ applicationOutput.setApplicationArgument(appArgument);
+ em.merge(applicationOutput);
+ 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();
+ }
+ }
+ }
+
+ 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();
+ ApplicationOutput applicationOutput = em.find(ApplicationOutput.class, new AppOutput_PK(
+ ids.get(AppOutputConstants.INTERFACE_ID),
+ ids.get(AppOutputConstants.OUTPUT_KEY)));
+
+ em.close();
+ return applicationOutput != null;
+ } 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();
+ }
+ }
+ }
+
+ public String getInterfaceID() {
+ return interfaceID;
+ }
+
+ public void setInterfaceID(String interfaceID) {
+ this.interfaceID = interfaceID;
+ }
+
+ public String getOutputKey() {
+ return outputKey;
+ }
+
+ public void setOutputKey(String outputKey) {
+ this.outputKey = outputKey;
+ }
+
+ public String getOutputVal() {
+ return outputVal;
+ }
+
+ public void setOutputVal(String outputVal) {
+ this.outputVal = outputVal;
+ }
+
+ public String getDataType() {
+ return dataType;
+ }
+
+ public void setDataType(String dataType) {
+ this.dataType = dataType;
+ }
+
+ public AppInterfaceResource getAppInterfaceResource() {
+ return appInterfaceResource;
+ }
+
+ public void setAppInterfaceResource(AppInterfaceResource appInterfaceResource) {
+ this.appInterfaceResource = appInterfaceResource;
+ }
+
+ public boolean getRequired() {
+ return isRequired;
+ }
+
+ public void setRequired(boolean required) {
+ this.isRequired = required;
+ }
+
+ public boolean isDataMovement() {
+ return dataMovement;
+ }
+
+ public void setDataMovement(boolean dataMovement) {
+ this.dataMovement = dataMovement;
+ }
+
+ public String getDataNameLocation() {
+ return dataNameLocation;
+ }
+
+ public void setDataNameLocation(String dataNameLocation) {
+ this.dataNameLocation = dataNameLocation;
+ }
+
+ public boolean getRequiredToCMD() {
+ return requiredToCMD;
+ }
+
+ public void setRequiredToCMD(boolean requiredToCMD) {
+ this.requiredToCMD = requiredToCMD;
+ }
+
+ public String getSearchQuery() {
+ return searchQuery;
+ }
+
+ public void setSearchQuery(String searchQuery) {
+ this.searchQuery = searchQuery;
+ }
+
+ public String getAppArgument() {
+ return appArgument;
+ }
+
+ public void setAppArgument(String appArgument) {
+ this.appArgument = appArgument;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/BatchQueueAppCatalogResourceAppCat.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/BatchQueueAppCatalogResourceAppCat.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/BatchQueueAppCatalogResourceAppCat.java
new file mode 100644
index 0000000..6ba1762
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/BatchQueueAppCatalogResourceAppCat.java
@@ -0,0 +1,357 @@
+/*
+ *
+ * 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 java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.persistence.EntityManager;
+import javax.persistence.Query;
+
+import org.apache.airavata.common.exception.ApplicationSettingsException;
+import org.apache.airavata.registry.core.app.catalog.model.BatchQueue;
+import org.apache.airavata.registry.core.app.catalog.model.BatchQueue_PK;
+import org.apache.airavata.registry.core.app.catalog.model.ComputeResource;
+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;
+
+public class BatchQueueAppCatalogResourceAppCat extends AppCatAbstractResource {
+ private final static Logger logger = LoggerFactory.getLogger(BatchQueueAppCatalogResourceAppCat.class);
+ private String computeResourceId;
+ private ComputeResourceAppCatalogResourceAppCat computeHostResource;
+ private int maxRuntime;
+ private int maxJobInQueue;
+ private String queueDescription;
+ private String queueName;
+ private int maxProcessors;
+ private int maxNodes;
+ private int maxMemory;
+
+ @Override
+ public void remove(Object identifier) throws AppCatalogException {
+ HashMap<String, String> ids;
+ if (identifier instanceof Map) {
+ ids = (HashMap<String, String>) 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(BATCH_QUEUE);
+ generator.setParameter(BatchQueueConstants.COMPUTE_RESOURCE_ID, ids.get(BatchQueueConstants.COMPUTE_RESOURCE_ID));
+ generator.setParameter(BatchQueueConstants.QUEUE_NAME, ids.get(BatchQueueConstants.QUEUE_NAME));
+ 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<String, String>) 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(BATCH_QUEUE);
+ generator.setParameter(BatchQueueConstants.COMPUTE_RESOURCE_ID, ids.get(BatchQueueConstants.COMPUTE_RESOURCE_ID));
+ generator.setParameter(BatchQueueConstants.QUEUE_NAME, ids.get(BatchQueueConstants.QUEUE_NAME));
+ Query q = generator.selectQuery(em);
+ BatchQueue batchQueue = (BatchQueue) q.getSingleResult();
+ BatchQueueAppCatalogResourceAppCat batchQueueResource = (BatchQueueAppCatalogResourceAppCat) AppCatalogJPAUtils.getResource(AppCatalogResourceType.BATCH_QUEUE, batchQueue);
+ em.getTransaction().commit();
+ em.close();
+ return batchQueueResource;
+ } 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> batchQueueResources = new ArrayList<AppCatalogResource>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(BATCH_QUEUE);
+ Query q;
+ if ((fieldName.equals(BatchQueueConstants.COMPUTE_RESOURCE_ID)) || (fieldName.equals(BatchQueueConstants.MAX_RUNTIME)) || (fieldName.equals(BatchQueueConstants.MAX_JOB_IN_QUEUE)) || (fieldName.equals(BatchQueueConstants.QUEUE_DESCRIPTION)) || (fieldName.equals(BatchQueueConstants.QUEUE_NAME)) || (fieldName.equals(BatchQueueConstants.MAX_PROCESSORS)) || (fieldName.equals(BatchQueueConstants.MAX_NODES))) {
+ generator.setParameter(fieldName, value);
+ q = generator.selectQuery(em);
+ List<?> results = q.getResultList();
+ for (Object result : results) {
+ BatchQueue batchQueue = (BatchQueue) result;
+ BatchQueueAppCatalogResourceAppCat batchQueueResource = (BatchQueueAppCatalogResourceAppCat) AppCatalogJPAUtils.getResource(AppCatalogResourceType.BATCH_QUEUE, batchQueue);
+ batchQueueResources.add(batchQueueResource);
+ }
+ } else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for Batch Queue Resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for Batch Queue Resource.");
+ }
+ 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();
+ }
+ }
+ return batchQueueResources;
+ }
+
+ @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 {
+ List<String> batchQueueResourceIDs = new ArrayList<String>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(BATCH_QUEUE);
+ Query q;
+ if ((fieldName.equals(BatchQueueConstants.COMPUTE_RESOURCE_ID)) || (fieldName.equals(BatchQueueConstants.MAX_RUNTIME)) || (fieldName.equals(BatchQueueConstants.MAX_JOB_IN_QUEUE)) || (fieldName.equals(BatchQueueConstants.QUEUE_DESCRIPTION)) || (fieldName.equals(BatchQueueConstants.QUEUE_NAME)) || (fieldName.equals(BatchQueueConstants.MAX_PROCESSORS)) || (fieldName.equals(BatchQueueConstants.MAX_NODES))) {
+ generator.setParameter(fieldName, value);
+ q = generator.selectQuery(em);
+ List<?> results = q.getResultList();
+ for (Object result : results) {
+ BatchQueue batchQueue = (BatchQueue) result;
+ BatchQueueAppCatalogResourceAppCat batchQueueResource = (BatchQueueAppCatalogResourceAppCat) AppCatalogJPAUtils.getResource(AppCatalogResourceType.BATCH_QUEUE, batchQueue);
+ batchQueueResourceIDs.add(batchQueueResource.getComputeResourceId());
+ }
+ } else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for Batch Queue Resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for Batch Queue Resource.");
+ }
+ 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();
+ }
+ }
+ return batchQueueResourceIDs;
+ }
+
+ @Override
+ public void save() throws AppCatalogException {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ BatchQueue existingBatchQueue = em.find(BatchQueue.class, new BatchQueue_PK(computeResourceId, queueName));
+ em.close();
+ BatchQueue batchQueue;
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ if (existingBatchQueue == null) {
+ batchQueue = new BatchQueue();
+ } else {
+ batchQueue = existingBatchQueue;
+ }
+ batchQueue.setComputeResourceId(getComputeResourceId());
+ ComputeResource computeResource = em.find(ComputeResource.class, getComputeResourceId());
+ batchQueue.setComputeResource(computeResource);
+ batchQueue.setMaxRuntime(getMaxRuntime());
+ batchQueue.setMaxJobInQueue(getMaxJobInQueue());
+ batchQueue.setQueueDescription(getQueueDescription());
+ batchQueue.setQueueName(getQueueName());
+ batchQueue.setMaxProcessors(getMaxProcessors());
+ batchQueue.setMaxNodes(getMaxNodes());
+ batchQueue.setMaxMemory(getMaxMemory());
+ if (existingBatchQueue == null) {
+ em.persist(batchQueue);
+ } else {
+ em.merge(batchQueue);
+ }
+ 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<String, String>) 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();
+ BatchQueue batchQueue = em.find(BatchQueue.class, new BatchQueue_PK(ids.get(BatchQueueConstants.COMPUTE_RESOURCE_ID), ids.get(BatchQueueConstants.QUEUE_NAME)));
+ em.close();
+ return batchQueue != null;
+ } 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();
+ }
+ }
+ }
+
+ public String getComputeResourceId() {
+ return computeResourceId;
+ }
+
+ public ComputeResourceAppCatalogResourceAppCat getComputeHostResource() {
+ return computeHostResource;
+ }
+
+ public int getMaxRuntime() {
+ return maxRuntime;
+ }
+
+ public int getMaxJobInQueue() {
+ return maxJobInQueue;
+ }
+
+ public String getQueueDescription() {
+ return queueDescription;
+ }
+
+ public String getQueueName() {
+ return queueName;
+ }
+
+ public int getMaxProcessors() {
+ return maxProcessors;
+ }
+
+ public int getMaxNodes() {
+ return maxNodes;
+ }
+
+ public void setComputeResourceId(String computeResourceId) {
+ this.computeResourceId=computeResourceId;
+ }
+
+ public void setComputeHostResource(ComputeResourceAppCatalogResourceAppCat computeHostResource) {
+ this.computeHostResource=computeHostResource;
+ }
+
+ public void setMaxRuntime(int maxRuntime) {
+ this.maxRuntime=maxRuntime;
+ }
+
+ public void setMaxJobInQueue(int maxJobInQueue) {
+ this.maxJobInQueue=maxJobInQueue;
+ }
+
+ public void setQueueDescription(String queueDescription) {
+ this.queueDescription=queueDescription;
+ }
+
+ public void setQueueName(String queueName) {
+ this.queueName=queueName;
+ }
+
+ public void setMaxProcessors(int maxProcessors) {
+ this.maxProcessors=maxProcessors;
+ }
+
+ public void setMaxNodes(int maxNodes) {
+ this.maxNodes=maxNodes;
+ }
+
+ public int getMaxMemory() {
+ return maxMemory;
+ }
+
+ public void setMaxMemory(int maxMemory) {
+ this.maxMemory = maxMemory;
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/BatchQueueResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/BatchQueueResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/BatchQueueResource.java
new file mode 100644
index 0000000..e7f5bff
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/BatchQueueResource.java
@@ -0,0 +1,357 @@
+/*
+ *
+ * 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.aiaravata.application.catalog.data.resources;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.persistence.EntityManager;
+import javax.persistence.Query;
+
+import org.airavata.appcatalog.cpi.AppCatalogException;
+import org.apache.aiaravata.application.catalog.data.model.BatchQueue;
+import org.apache.aiaravata.application.catalog.data.model.BatchQueue_PK;
+import org.apache.aiaravata.application.catalog.data.model.ComputeResource;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogJPAUtils;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogQueryGenerator;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogResourceType;
+import org.apache.airavata.common.exception.ApplicationSettingsException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class BatchQueueResource extends AbstractResource {
+ private final static Logger logger = LoggerFactory.getLogger(BatchQueueResource.class);
+ private String computeResourceId;
+ private ComputeResourceResource computeHostResource;
+ private int maxRuntime;
+ private int maxJobInQueue;
+ private String queueDescription;
+ private String queueName;
+ private int maxProcessors;
+ private int maxNodes;
+ private int maxMemory;
+
+ @Override
+ public void remove(Object identifier) throws AppCatalogException {
+ HashMap<String, String> ids;
+ if (identifier instanceof Map) {
+ ids = (HashMap<String, String>) 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(BATCH_QUEUE);
+ generator.setParameter(BatchQueueConstants.COMPUTE_RESOURCE_ID, ids.get(BatchQueueConstants.COMPUTE_RESOURCE_ID));
+ generator.setParameter(BatchQueueConstants.QUEUE_NAME, ids.get(BatchQueueConstants.QUEUE_NAME));
+ 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 Resource get(Object identifier) throws AppCatalogException {
+ HashMap<String, String> ids;
+ if (identifier instanceof Map) {
+ ids = (HashMap<String, String>) 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(BATCH_QUEUE);
+ generator.setParameter(BatchQueueConstants.COMPUTE_RESOURCE_ID, ids.get(BatchQueueConstants.COMPUTE_RESOURCE_ID));
+ generator.setParameter(BatchQueueConstants.QUEUE_NAME, ids.get(BatchQueueConstants.QUEUE_NAME));
+ Query q = generator.selectQuery(em);
+ BatchQueue batchQueue = (BatchQueue) q.getSingleResult();
+ BatchQueueResource batchQueueResource = (BatchQueueResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.BATCH_QUEUE, batchQueue);
+ em.getTransaction().commit();
+ em.close();
+ return batchQueueResource;
+ } 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<Resource> get(String fieldName, Object value) throws AppCatalogException {
+ List<Resource> batchQueueResources = new ArrayList<Resource>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(BATCH_QUEUE);
+ Query q;
+ if ((fieldName.equals(BatchQueueConstants.COMPUTE_RESOURCE_ID)) || (fieldName.equals(BatchQueueConstants.MAX_RUNTIME)) || (fieldName.equals(BatchQueueConstants.MAX_JOB_IN_QUEUE)) || (fieldName.equals(BatchQueueConstants.QUEUE_DESCRIPTION)) || (fieldName.equals(BatchQueueConstants.QUEUE_NAME)) || (fieldName.equals(BatchQueueConstants.MAX_PROCESSORS)) || (fieldName.equals(BatchQueueConstants.MAX_NODES))) {
+ generator.setParameter(fieldName, value);
+ q = generator.selectQuery(em);
+ List<?> results = q.getResultList();
+ for (Object result : results) {
+ BatchQueue batchQueue = (BatchQueue) result;
+ BatchQueueResource batchQueueResource = (BatchQueueResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.BATCH_QUEUE, batchQueue);
+ batchQueueResources.add(batchQueueResource);
+ }
+ } else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for Batch Queue Resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for Batch Queue Resource.");
+ }
+ 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();
+ }
+ }
+ return batchQueueResources;
+ }
+
+ @Override
+ public List<Resource> 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 {
+ List<String> batchQueueResourceIDs = new ArrayList<String>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(BATCH_QUEUE);
+ Query q;
+ if ((fieldName.equals(BatchQueueConstants.COMPUTE_RESOURCE_ID)) || (fieldName.equals(BatchQueueConstants.MAX_RUNTIME)) || (fieldName.equals(BatchQueueConstants.MAX_JOB_IN_QUEUE)) || (fieldName.equals(BatchQueueConstants.QUEUE_DESCRIPTION)) || (fieldName.equals(BatchQueueConstants.QUEUE_NAME)) || (fieldName.equals(BatchQueueConstants.MAX_PROCESSORS)) || (fieldName.equals(BatchQueueConstants.MAX_NODES))) {
+ generator.setParameter(fieldName, value);
+ q = generator.selectQuery(em);
+ List<?> results = q.getResultList();
+ for (Object result : results) {
+ BatchQueue batchQueue = (BatchQueue) result;
+ BatchQueueResource batchQueueResource = (BatchQueueResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.BATCH_QUEUE, batchQueue);
+ batchQueueResourceIDs.add(batchQueueResource.getComputeResourceId());
+ }
+ } else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for Batch Queue Resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for Batch Queue Resource.");
+ }
+ 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();
+ }
+ }
+ return batchQueueResourceIDs;
+ }
+
+ @Override
+ public void save() throws AppCatalogException {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ BatchQueue existingBatchQueue = em.find(BatchQueue.class, new BatchQueue_PK(computeResourceId, queueName));
+ em.close();
+ BatchQueue batchQueue;
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ if (existingBatchQueue == null) {
+ batchQueue = new BatchQueue();
+ } else {
+ batchQueue = existingBatchQueue;
+ }
+ batchQueue.setComputeResourceId(getComputeResourceId());
+ ComputeResource computeResource = em.find(ComputeResource.class, getComputeResourceId());
+ batchQueue.setComputeResource(computeResource);
+ batchQueue.setMaxRuntime(getMaxRuntime());
+ batchQueue.setMaxJobInQueue(getMaxJobInQueue());
+ batchQueue.setQueueDescription(getQueueDescription());
+ batchQueue.setQueueName(getQueueName());
+ batchQueue.setMaxProcessors(getMaxProcessors());
+ batchQueue.setMaxNodes(getMaxNodes());
+ batchQueue.setMaxMemory(getMaxMemory());
+ if (existingBatchQueue == null) {
+ em.persist(batchQueue);
+ } else {
+ em.merge(batchQueue);
+ }
+ 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<String, String>) 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();
+ BatchQueue batchQueue = em.find(BatchQueue.class, new BatchQueue_PK(ids.get(BatchQueueConstants.COMPUTE_RESOURCE_ID), ids.get(BatchQueueConstants.QUEUE_NAME)));
+ em.close();
+ return batchQueue != null;
+ } 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();
+ }
+ }
+ }
+
+ public String getComputeResourceId() {
+ return computeResourceId;
+ }
+
+ public ComputeResourceResource getComputeHostResource() {
+ return computeHostResource;
+ }
+
+ public int getMaxRuntime() {
+ return maxRuntime;
+ }
+
+ public int getMaxJobInQueue() {
+ return maxJobInQueue;
+ }
+
+ public String getQueueDescription() {
+ return queueDescription;
+ }
+
+ public String getQueueName() {
+ return queueName;
+ }
+
+ public int getMaxProcessors() {
+ return maxProcessors;
+ }
+
+ public int getMaxNodes() {
+ return maxNodes;
+ }
+
+ public void setComputeResourceId(String computeResourceId) {
+ this.computeResourceId=computeResourceId;
+ }
+
+ public void setComputeHostResource(ComputeResourceResource computeHostResource) {
+ this.computeHostResource=computeHostResource;
+ }
+
+ public void setMaxRuntime(int maxRuntime) {
+ this.maxRuntime=maxRuntime;
+ }
+
+ public void setMaxJobInQueue(int maxJobInQueue) {
+ this.maxJobInQueue=maxJobInQueue;
+ }
+
+ public void setQueueDescription(String queueDescription) {
+ this.queueDescription=queueDescription;
+ }
+
+ public void setQueueName(String queueName) {
+ this.queueName=queueName;
+ }
+
+ public void setMaxProcessors(int maxProcessors) {
+ this.maxProcessors=maxProcessors;
+ }
+
+ public void setMaxNodes(int maxNodes) {
+ this.maxNodes=maxNodes;
+ }
+
+ public int getMaxMemory() {
+ return maxMemory;
+ }
+
+ public void setMaxMemory(int maxMemory) {
+ this.maxMemory = maxMemory;
+ }
+}
\ No newline at end of file
[25/52] [abbrv] [partial] airavata git commit: registry refactoring
Posted by sh...@apache.org.
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/WorkflowNodeDetailResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/WorkflowNodeDetailResource.java b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/WorkflowNodeDetailResource.java
deleted file mode 100644
index 47bd072..0000000
--- a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/WorkflowNodeDetailResource.java
+++ /dev/null
@@ -1,515 +0,0 @@
-/*
- *
- * 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.experiment.catalog.resources;
-
-import org.apache.airavata.experiment.catalog.Resource;
-import org.apache.airavata.experiment.catalog.ResourceType;
-import org.apache.airavata.experiment.catalog.ResourceUtils;
-import org.apache.airavata.experiment.catalog.model.*;
-import org.apache.airavata.experiment.catalog.utils.QueryGenerator;
-import org.apache.airavata.registry.cpi.utils.StatusType;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.apache.airavata.registry.cpi.RegistryException;
-
-import javax.persistence.EntityManager;
-import javax.persistence.Query;
-import java.sql.Timestamp;
-import java.util.ArrayList;
-import java.util.List;
-
-public class WorkflowNodeDetailResource extends AbstractResource {
- private static final Logger logger = LoggerFactory.getLogger(WorkflowNodeDetailResource.class);
- private String experimentId;
- private String nodeInstanceId;
- private Timestamp creationTime;
- private String nodeName;
- private String executionUnit;
- private String executionUnitData;
- private List<TaskDetailResource> taskDetailResourceList;
- private List<NodeInputResource> nodeInputs;
- private List<NodeOutputResource> nodeOutputs;
- private StatusResource nodeStatus;
- private List<ErrorDetailResource> erros;
-
- public List<TaskDetailResource> getTaskDetailResourceList() {
- return taskDetailResourceList;
- }
-
- public void setTaskDetailResourceList(List<TaskDetailResource> taskDetailResourceList) {
- this.taskDetailResourceList = taskDetailResourceList;
- }
-
- public void setNodeInputs(List<NodeInputResource> nodeInputs) {
- this.nodeInputs = nodeInputs;
- }
-
- public void setNodeOutputs(List<NodeOutputResource> nodeOutputs) {
- this.nodeOutputs = nodeOutputs;
- }
-
- public StatusResource getNodeStatus() {
- return nodeStatus;
- }
-
- public void setNodeStatus(StatusResource nodeStatus) {
- this.nodeStatus = nodeStatus;
- }
-
- public List<ErrorDetailResource> getErros() {
- return erros;
- }
-
- public void setErros(List<ErrorDetailResource> erros) {
- this.erros = erros;
- }
-
- public String getExperimentId() {
- return experimentId;
- }
-
- public void setExperimentId(String experimentId) {
- this.experimentId = experimentId;
- }
-
- public String getNodeInstanceId() {
- return nodeInstanceId;
- }
-
- public void setNodeInstanceId(String nodeInstanceId) {
- this.nodeInstanceId = nodeInstanceId;
- }
-
- public Timestamp getCreationTime() {
- return creationTime;
- }
-
- public void setCreationTime(Timestamp creationTime) {
- this.creationTime = creationTime;
- }
-
- public String getNodeName() {
- return nodeName;
- }
-
- public void setNodeName(String nodeName) {
- this.nodeName = nodeName;
- }
-
- public Resource create(ResourceType type) throws RegistryException{
- switch (type){
- case TASK_DETAIL:
- TaskDetailResource taskDetailResource = new TaskDetailResource();
- taskDetailResource.setNodeId(nodeInstanceId);
- return taskDetailResource;
- case ERROR_DETAIL:
- ErrorDetailResource errorDetailResource = new ErrorDetailResource();
- errorDetailResource.setNodeId(nodeInstanceId);;
- return errorDetailResource;
- case NODE_INPUT:
- NodeInputResource nodeInputResource = new NodeInputResource();
- nodeInputResource.setNodeId(nodeInstanceId);
- return nodeInputResource;
- case NODE_OUTPUT:
- NodeOutputResource nodeOutputResource = new NodeOutputResource();
- nodeOutputResource.setNodeId(nodeInstanceId);
- return nodeOutputResource;
- case STATUS:
- StatusResource statusResource = new StatusResource();
- statusResource.setNodeId(nodeInstanceId);
- return statusResource;
- default:
- logger.error("Unsupported resource type for workflow node detail resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported resource type for workflow node detail resource.");
- }
- }
-
- public void remove(ResourceType type, Object name) throws RegistryException{
- EntityManager em = null;
- try {
- em = ResourceUtils.getEntityManager();
- em.getTransaction().begin();
- Query q;
- QueryGenerator generator;
- switch (type) {
- case TASK_DETAIL:
- generator = new QueryGenerator(TASK_DETAIL);
- generator.setParameter(TaskDetailConstants.TASK_ID, name);
- q = generator.deleteQuery(em);
- q.executeUpdate();
- break;
- case ERROR_DETAIL:
- generator = new QueryGenerator(ERROR_DETAIL);
- generator.setParameter(ErrorDetailConstants.NODE_INSTANCE_ID, name);
- q = generator.deleteQuery(em);
- q.executeUpdate();
- break;
- case NODE_INPUT:
- generator = new QueryGenerator(NODE_INPUT);
- generator.setParameter(NodeInputConstants.NODE_INSTANCE_ID, name);
- q = generator.deleteQuery(em);
- q.executeUpdate();
- break;
- case NODE_OUTPUT:
- generator = new QueryGenerator(NODE_OUTPUT);
- generator.setParameter(NodeOutputConstants.NODE_INSTANCE_ID, name);
- q = generator.deleteQuery(em);
- q.executeUpdate();
- break;
- case STATUS:
- generator = new QueryGenerator(STATUS);
- generator.setParameter(StatusConstants.NODE_INSTANCE_ID, name);
- generator.setParameter(StatusConstants.STATUS_TYPE, StatusType.WORKFLOW_NODE.toString());
- q = generator.deleteQuery(em);
- q.executeUpdate();
- break;
- default:
- logger.error("Unsupported resource type for experiment resource.", new IllegalArgumentException());
- break;
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new RegistryException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- public Resource get(ResourceType type, Object name) throws RegistryException{
- EntityManager em = null;
- try {
- em = ResourceUtils.getEntityManager();
- em.getTransaction().begin();
- QueryGenerator generator;
- Query q;
- switch (type) {
- case TASK_DETAIL:
- generator = new QueryGenerator(TASK_DETAIL);
- generator.setParameter(TaskDetailConstants.TASK_ID, name);
- q = generator.selectQuery(em);
- TaskDetail taskDetail = (TaskDetail) q.getSingleResult();
- TaskDetailResource taskDetailResource = (TaskDetailResource) Utils.getResource(ResourceType.TASK_DETAIL, taskDetail);
- em.getTransaction().commit();
- em.close();
- return taskDetailResource;
- case ERROR_DETAIL:
- generator = new QueryGenerator(ERROR_DETAIL);
- generator.setParameter(ErrorDetailConstants.NODE_INSTANCE_ID, name);
- q = generator.selectQuery(em);
- ErrorDetail errorDetail = (ErrorDetail) q.getSingleResult();
- ErrorDetailResource errorDetailResource = (ErrorDetailResource) Utils.getResource(ResourceType.ERROR_DETAIL, errorDetail);
- em.getTransaction().commit();
- em.close();
- return errorDetailResource;
- case NODE_INPUT:
- generator = new QueryGenerator(NODE_INPUT);
- generator.setParameter(NodeInputConstants.NODE_INSTANCE_ID, name);
- q = generator.selectQuery(em);
- NodeInput nodeInput = (NodeInput) q.getSingleResult();
- NodeInputResource nodeInputResource = (NodeInputResource) Utils.getResource(ResourceType.NODE_INPUT, nodeInput);
- em.getTransaction().commit();
- em.close();
- return nodeInputResource;
- case NODE_OUTPUT:
- generator = new QueryGenerator(NODE_OUTPUT);
- generator.setParameter(NodeOutputConstants.NODE_INSTANCE_ID, name);
- q = generator.selectQuery(em);
- NodeOutput nodeOutput = (NodeOutput) q.getSingleResult();
- NodeOutputResource nodeOutputResource = (NodeOutputResource) Utils.getResource(ResourceType.NODE_OUTPUT, nodeOutput);
- em.getTransaction().commit();
- em.close();
- return nodeOutputResource;
- case STATUS:
- generator = new QueryGenerator(STATUS);
- generator.setParameter(StatusConstants.NODE_INSTANCE_ID, name);
- generator.setParameter(StatusConstants.STATUS_TYPE, StatusType.WORKFLOW_NODE.toString());
- q = generator.selectQuery(em);
- Status status = (Status) q.getSingleResult();
- StatusResource statusResource = (StatusResource) Utils.getResource(ResourceType.STATUS, status);
- em.getTransaction().commit();
- em.close();
- return statusResource;
- default:
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported resource type for workflow node resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported resource type for workflow node resource.");
- }
- } catch (Exception e) {
- throw new RegistryException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- public List<Resource> get(ResourceType type) throws RegistryException{
- List<Resource> resourceList = new ArrayList<Resource>();
- EntityManager em = null;
- try {
- em = ResourceUtils.getEntityManager();
- em.getTransaction().begin();
- Query q;
- QueryGenerator generator;
- List results;
- switch (type) {
- case TASK_DETAIL:
- generator = new QueryGenerator(TASK_DETAIL);
- generator.setParameter(TaskDetailConstants.NODE_INSTANCE_ID, nodeInstanceId);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- TaskDetail taskDetail = (TaskDetail) result;
- TaskDetailResource taskDetailResource =
- (TaskDetailResource) Utils.getResource(ResourceType.TASK_DETAIL, taskDetail);
- resourceList.add(taskDetailResource);
- }
- }
- break;
- case ERROR_DETAIL:
- generator = new QueryGenerator(ERROR_DETAIL);
- generator.setParameter(ErrorDetailConstants.NODE_INSTANCE_ID, nodeInstanceId);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- ErrorDetail errorDetail = (ErrorDetail) result;
- ErrorDetailResource errorDetailResource =
- (ErrorDetailResource) Utils.getResource(ResourceType.ERROR_DETAIL, errorDetail);
- resourceList.add(errorDetailResource);
- }
- }
- break;
- case NODE_INPUT:
- generator = new QueryGenerator(NODE_INPUT);
- generator.setParameter(NodeInputConstants.NODE_INSTANCE_ID, nodeInstanceId);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- NodeInput nodeInput = (NodeInput) result;
- NodeInputResource nodeInputResource =
- (NodeInputResource) Utils.getResource(ResourceType.NODE_INPUT, nodeInput);
- resourceList.add(nodeInputResource);
- }
- }
- break;
- case NODE_OUTPUT:
- generator = new QueryGenerator(NODE_OUTPUT);
- generator.setParameter(NodeOutputConstants.NODE_INSTANCE_ID, nodeInstanceId);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- NodeOutput nodeOutput = (NodeOutput) result;
- NodeOutputResource nodeOutputResource =
- (NodeOutputResource) Utils.getResource(ResourceType.NODE_OUTPUT, nodeOutput);
- resourceList.add(nodeOutputResource);
- }
- }
- break;
- case STATUS:
- generator = new QueryGenerator(STATUS);
- generator.setParameter(StatusConstants.NODE_INSTANCE_ID, nodeInstanceId);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- Status status = (Status) result;
- StatusResource statusResource =
- (StatusResource) Utils.getResource(ResourceType.STATUS, status);
- resourceList.add(statusResource);
- }
- }
- break;
- default:
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported resource type for workflow node details resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
-// logger.error(e.getMessage(), e);
- throw new RegistryException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- return resourceList;
- }
-
- public void save() throws RegistryException{
- EntityManager em = null;
- try {
- em = ResourceUtils.getEntityManager();
- WorkflowNodeDetail existingNode = em.find(WorkflowNodeDetail.class, nodeInstanceId);
- em.close();
-
- em = ResourceUtils.getEntityManager();
- em.getTransaction().begin();
- WorkflowNodeDetail workflowNodeDetail = new WorkflowNodeDetail();
- workflowNodeDetail.setNodeId(nodeInstanceId);
- workflowNodeDetail.setExpId(experimentId);
- workflowNodeDetail.setCreationTime(creationTime);
- workflowNodeDetail.setNodeName(nodeName);
- workflowNodeDetail.setExecutionUnit(getExecutionUnit());
- workflowNodeDetail.setExecutionUnitData(getExecutionUnitData());
-
- if (existingNode != null) {
- existingNode.setExpId(experimentId);
- existingNode.setCreationTime(creationTime);
- existingNode.setNodeName(nodeName);
- existingNode.setExecutionUnit(getExecutionUnit());
- existingNode.setExecutionUnitData(getExecutionUnitData());
- workflowNodeDetail = em.merge(existingNode);
- } else {
- em.persist(workflowNodeDetail);
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new RegistryException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- public List<NodeInputResource> getNodeInputs() {
- return nodeInputs;
- }
-
- public List<NodeOutputResource> getNodeOutputs() {
- return nodeOutputs;
- }
-
- public List<NodeInputResource> getNodeInputs1() throws RegistryException{
- List<NodeInputResource> nodeInputResourceList = new ArrayList<NodeInputResource>();
- List<Resource> resources = get(ResourceType.NODE_INPUT);
- for (Resource resource : resources) {
- NodeInputResource nodeInputResource = (NodeInputResource) resource;
- nodeInputResourceList.add(nodeInputResource);
- }
- return nodeInputResourceList;
- }
-
- public List<NodeOutputResource> getNodeOutputs1() throws RegistryException{
- List<NodeOutputResource> outputResources = new ArrayList<NodeOutputResource>();
- List<Resource> resources = get(ResourceType.NODE_OUTPUT);
- for (Resource resource : resources) {
- NodeOutputResource nodeOutputResource = (NodeOutputResource) resource;
- outputResources.add(nodeOutputResource);
- }
- return outputResources;
- }
-
- public StatusResource getWorkflowNodeStatus() throws RegistryException{
- List<Resource> resources = get(ResourceType.STATUS);
- for (Resource resource : resources) {
- StatusResource nodeStatus = (StatusResource) resource;
- if(nodeStatus.getStatusType().equals(StatusType.WORKFLOW_NODE.toString())){
- if (nodeStatus.getState() == null || nodeStatus.getState().equals("") ){
- nodeStatus.setState("UNKNOWN");
- }
- return nodeStatus;
- }
- }
- return null;
- }
-
- public StatusResource getTaskStatus(String taskId) throws RegistryException{
- List<Resource> resources = get(ResourceType.STATUS);
- for (Resource resource : resources) {
- StatusResource taskStatus = (StatusResource) resource;
- if(taskStatus.getStatusType().equals(StatusType.TASK.toString()) && taskStatus.getTaskId().equals(taskId)){
- if (taskStatus.getState() == null || taskStatus.getState().equals("") ){
- taskStatus.setState("UNKNOWN");
- }
- return taskStatus;
- }
- }
- return null;
- }
-
- public List<TaskDetailResource> getTaskDetails() throws RegistryException{
- List<TaskDetailResource> taskDetailResources = new ArrayList<TaskDetailResource>();
- List<Resource> resources = get(ResourceType.TASK_DETAIL);
- for (Resource resource : resources) {
- TaskDetailResource taskDetailResource = (TaskDetailResource) resource;
- taskDetailResources.add(taskDetailResource);
- }
- return taskDetailResources;
- }
-
- public List<ErrorDetailResource> getErrorDetails() throws RegistryException{
- List<ErrorDetailResource> errorDetails = new ArrayList<ErrorDetailResource>();
- List<Resource> resources = get(ResourceType.ERROR_DETAIL);
- for (Resource resource : resources) {
- ErrorDetailResource errorDetailResource = (ErrorDetailResource) resource;
- errorDetails.add(errorDetailResource);
- }
- return errorDetails;
- }
-
- public TaskDetailResource getTaskDetail(String taskId) throws RegistryException{
- return (TaskDetailResource)get(ResourceType.TASK_DETAIL, taskId);
- }
-
- public String getExecutionUnit() {
- return executionUnit;
- }
-
- public void setExecutionUnit(String executionUnit) {
- this.executionUnit = executionUnit;
- }
-
- public String getExecutionUnitData() {
- return executionUnitData;
- }
-
- public void setExecutionUnitData(String executionUnitData) {
- this.executionUnitData = executionUnitData;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/utils/QueryGenerator.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/utils/QueryGenerator.java b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/utils/QueryGenerator.java
deleted file mode 100644
index 2c6c219..0000000
--- a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/utils/QueryGenerator.java
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- *
- * 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.experiment.catalog.utils;
-
-import org.apache.airavata.registry.cpi.ResultOrderType;
-
-import javax.persistence.EntityManager;
-import javax.persistence.Query;
-import java.util.HashMap;
-import java.util.Map;
-
-public class QueryGenerator {
- private String tableName;
- private Map<String,Object> matches=new HashMap<String, Object>();
- private static final String SELECT_OBJ="p";
- private static final String DELETE_OBJ="p";
- private static final String TABLE_OBJ="p";
-//
-// public QueryGenerator(String tableName) {
-// setTableName(tableName);
-// }
-
- public QueryGenerator(String tableName, Object[]...params) {
- setTableName(tableName);
- for (Object[] param : params) {
- addMatch(param[0].toString(), param[1]);
- }
- }
-
- public String getTableName() {
- return tableName;
- }
- public void setTableName(String tableName) {
- this.tableName = tableName;
- }
- public void addMatch(String colName, Object matchValue){
- matches.put(colName, matchValue);
- }
-
- public void setParameter(String colName, Object matchValue){
- addMatch(colName, matchValue);
- }
-
- /**
- * Select query
- * @param entityManager
- * @return
- */
- public Query selectQuery(EntityManager entityManager){
- String queryString="SELECT "+ SELECT_OBJ + " FROM " +getTableName()+" "+TABLE_OBJ;
- return generateQueryWithParameters(entityManager, queryString);
- }
-
- /**
- * Select query with pagination
- * @param entityManager
- * @param orderByColumn
- * @param resultOrderType
- * @return
- */
- public Query selectQuery(EntityManager entityManager, String orderByColumn,
- ResultOrderType resultOrderType){
- String order = (resultOrderType == ResultOrderType.ASC) ? "ASC" : "DESC";
- String orderByClause = " ORDER BY " + SELECT_OBJ + "." + orderByColumn + " " + order;
- String queryString="SELECT "+ SELECT_OBJ + " FROM " +getTableName()+" "+TABLE_OBJ;
- return generateQueryWithParameters(entityManager, queryString, orderByClause);
- }
-
-// public Query countQuery(EntityManager entityManager){
-// SELECT COUNT(p.host_descriptor_ID) FROM Host_Descriptor p WHERE p.gateway_name =:gate_ID and p.host_descriptor_ID =:host_desc_name")
-// String queryString="SELECT COUNT("+ SELECT_OBJ + " FROM " +getTableName()+" "+TABLE_OBJ;
-// return generateQueryWithParameters(entityManager, queryString);
-// }
-
- public Query deleteQuery(EntityManager entityManager){
- String queryString="Delete FROM "+getTableName()+" "+TABLE_OBJ;
- return generateQueryWithParameters(entityManager, queryString);
- }
-
- private Query generateQueryWithParameters(EntityManager entityManager,
- String queryString) {
- return generateQueryWithParameters(entityManager, queryString, "");
- }
-
- private Query generateQueryWithParameters(EntityManager entityManager,
- String queryString, String orderByClause) {
- Map<String,Object> queryParameters=new HashMap<String, Object>();
- if (matches.size()>0){
- String matchString = "";
- int paramCount=0;
- for (String colName : matches.keySet()) {
- String paramName="param"+paramCount;
- queryParameters.put(paramName, matches.get(colName));
- if (!matchString.equals("")){
- matchString+=" AND ";
- }
- matchString+=TABLE_OBJ+"."+colName+" =:"+paramName;
- paramCount++;
- }
- queryString+=" WHERE "+matchString;
- }
- queryString += orderByClause;
- Query query = entityManager.createQuery(queryString);
- for (String paramName : queryParameters.keySet()) {
- query.setParameter(paramName, queryParameters.get(paramName));
- }
- return query;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/utils/ThriftDataModelConversion.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/utils/ThriftDataModelConversion.java b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/utils/ThriftDataModelConversion.java
deleted file mode 100644
index 45acd3a..0000000
--- a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/utils/ThriftDataModelConversion.java
+++ /dev/null
@@ -1,686 +0,0 @@
-/*
-*
-* 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.experiment.catalog.utils;
-
-import org.apache.airavata.common.utils.AiravataUtils;
-import org.apache.airavata.model.appcatalog.appinterface.DataType;
-import org.apache.airavata.model.appcatalog.appinterface.InputDataObjectType;
-import org.apache.airavata.model.appcatalog.appinterface.OutputDataObjectType;
-import org.apache.airavata.model.workspace.Gateway;
-import org.apache.airavata.model.workspace.Project;
-import org.apache.airavata.model.workspace.experiment.*;
-import org.apache.airavata.experiment.catalog.Resource;
-import org.apache.airavata.experiment.catalog.ResourceType;
-import org.apache.airavata.experiment.catalog.resources.*;
-import org.apache.airavata.registry.cpi.RegistryException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.ArrayList;
-import java.util.List;
-
-public class ThriftDataModelConversion {
- private final static Logger logger = LoggerFactory.getLogger(ThriftDataModelConversion.class);
-
- public static Project getProject (ProjectResource pr) throws RegistryException {
- if (pr != null) {
- Project project = new Project();
- project.setProjectID(pr.getId());
- project.setName(pr.getName());
- if (pr.getCreationTime()!=null) {
- project.setCreationTime(pr.getCreationTime().getTime());
- }
- project.setDescription(pr.getDescription());
- project.setOwner(pr.getWorker().getUser());
- List<ProjectUserResource> projectUserList = pr.getProjectUserList();
- List<String> sharedUsers = new ArrayList<String>();
- if (projectUserList != null && !projectUserList.isEmpty()){
- for (ProjectUserResource resource : projectUserList){
- sharedUsers.add(resource.getUserName());
- }
- }
- project.setSharedUsers(sharedUsers);
- return project;
- }
- return null;
- }
-
- public static Gateway getGateway (GatewayResource resource){
- Gateway gateway = new Gateway();
- gateway.setGatewayId(resource.getGatewayId());
- gateway.setGatewayName(resource.getGatewayName());
- gateway.setDomain(resource.getDomain());
- gateway.setEmailAddress(resource.getEmailAddress());
- return gateway;
- }
-
- public static List<Gateway> getAllGateways (List<Resource> gatewayList){
- List<Gateway> gateways = new ArrayList<Gateway>();
- for (Resource resource : gatewayList){
- gateways.add(getGateway((GatewayResource)resource));
- }
- return gateways;
- }
-
-
- public static Experiment getExperiment(ExperimentResource experimentResource) throws RegistryException {
- if (experimentResource != null){
- Experiment experiment = new Experiment();
- experiment.setProjectID(experimentResource.getProjectId());
- experiment.setExperimentID(experimentResource.getExpID());
- experiment.setCreationTime(experimentResource.getCreationTime().getTime());
- experiment.setUserName(experimentResource.getExecutionUser());
- experiment.setName(experimentResource.getExpName());
- experiment.setDescription(experimentResource.getDescription());
- experiment.setApplicationId(experimentResource.getApplicationId());
- experiment.setApplicationVersion(experimentResource.getApplicationVersion());
- experiment.setWorkflowTemplateId(experimentResource.getWorkflowTemplateId());
- experiment.setEnableEmailNotification(experimentResource.isEnableEmailNotifications());
- experiment.setGatewayExecutionId(experimentResource.getGatewayExecutionId());
- if (experiment.isEnableEmailNotification()){
- List<NotificationEmailResource> notificationEmails = experimentResource.getNotificationEmails();
- experiment.setEmailAddresses(getEmailAddresses(notificationEmails));
- }
- experiment.setWorkflowTemplateVersion(experimentResource.getWorkflowTemplateVersion());
- experiment.setWorkflowExecutionInstanceId(experimentResource.getWorkflowExecutionId());
- List<ExperimentInputResource> experimentInputs = experimentResource.getExperimentInputs();
- experiment.setExperimentInputs(getExpInputs(experimentInputs));
- List<ExperimentOutputResource> experimentOutputs = experimentResource.getExperimentOutputs();
- experiment.setExperimentOutputs(getExpOutputs(experimentOutputs));
- StatusResource experimentStatus = experimentResource.getExperimentStatus();
- if (experimentStatus != null){
- experiment.setExperimentStatus(getExperimentStatus(experimentStatus));
- }
- List<StatusResource> changeList = experimentResource.getWorkflowNodeStatuses();
- if (changeList != null && !changeList.isEmpty()){
- experiment.setStateChangeList(getWorkflowNodeStatusList(changeList));
- }
-
- List<WorkflowNodeDetailResource> workflowNodeDetails = experimentResource.getWorkflowNodeDetails();
- if (workflowNodeDetails != null && !workflowNodeDetails.isEmpty()){
- experiment.setWorkflowNodeDetailsList(getWfNodeList(workflowNodeDetails));
- }
- List<ErrorDetailResource> errorDetails = experimentResource.getErrorDetails();
- if (errorDetails!= null && !errorDetails.isEmpty()){
- experiment.setErrors(getErrorDetailList(errorDetails));
- }
- if (experimentResource.isExists(ResourceType.CONFIG_DATA, experimentResource.getExpID())){
- ConfigDataResource userConfigData = experimentResource.getUserConfigData(experimentResource.getExpID());
- experiment.setUserConfigurationData(getUserConfigData(userConfigData));
- }
- return experiment;
- }
- return null;
- }
-
- public static ExperimentSummary getExperimentSummary(ExperimentSummaryResource experimentSummaryResource) throws RegistryException {
- if (experimentSummaryResource != null){
- ExperimentSummary experimentSummary = new ExperimentSummary();
- experimentSummary.setProjectID(experimentSummaryResource.getProjectID());
- experimentSummary.setExperimentID(experimentSummaryResource.getExpID());
- experimentSummary.setCreationTime(experimentSummaryResource.getCreationTime().getTime());
- experimentSummary.setUserName(experimentSummaryResource.getExecutionUser());
- experimentSummary.setName(experimentSummaryResource.getExpName());
- experimentSummary.setDescription(experimentSummaryResource.getDescription());
- experimentSummary.setApplicationId(experimentSummaryResource.getApplicationId());
- StatusResource experimentStatus = experimentSummaryResource.getStatus();
- if (experimentStatus != null){
- experimentSummary.setExperimentStatus(getExperimentStatus(experimentStatus));
- }
- return experimentSummary;
- }
- return null;
- }
-
- public static InputDataObjectType getInput(Object object){
- if (object != null){
- InputDataObjectType dataObjectType = new InputDataObjectType();
- if (object instanceof ExperimentInputResource){
- ExperimentInputResource expInput = (ExperimentInputResource) object;
- dataObjectType.setName(expInput.getExperimentKey());
- dataObjectType.setValue(expInput.getValue());
- if (expInput.getDataType() != null){
- dataObjectType.setType(DataType.valueOf(expInput.getDataType()));
- }
- dataObjectType.setMetaData(expInput.getMetadata());
- dataObjectType.setApplicationArgument(expInput.getAppArgument());
- dataObjectType.setStandardInput(expInput.isStandardInput());
- dataObjectType.setUserFriendlyDescription(expInput.getUserFriendlyDesc());
- dataObjectType.setInputOrder(expInput.getInputOrder());
- dataObjectType.setIsRequired(expInput.getRequired());
- dataObjectType.setRequiredToAddedToCommandLine(expInput.getRequiredToCMD());
- dataObjectType.setDataStaged(expInput.isDataStaged());
- return dataObjectType;
- }else if (object instanceof NodeInputResource){
- NodeInputResource nodeInputResource = (NodeInputResource)object;
- dataObjectType.setName(nodeInputResource.getInputKey());
- dataObjectType.setValue(nodeInputResource.getValue());
- if (nodeInputResource.getDataType() != null){
- dataObjectType.setType(DataType.valueOf(nodeInputResource.getDataType()));
- }
- dataObjectType.setMetaData(nodeInputResource.getMetadata());
- dataObjectType.setApplicationArgument(nodeInputResource.getAppArgument());
- dataObjectType.setStandardInput(nodeInputResource.isStandardInput());
- dataObjectType.setUserFriendlyDescription(nodeInputResource.getUserFriendlyDesc());
- dataObjectType.setInputOrder(nodeInputResource.getInputOrder());
- dataObjectType.setIsRequired(nodeInputResource.getRequired());
- dataObjectType.setRequiredToAddedToCommandLine(nodeInputResource.getRequiredToCMD());
- dataObjectType.setDataStaged(nodeInputResource.isDataStaged());
- return dataObjectType;
- }else if (object instanceof ApplicationInputResource){
- ApplicationInputResource inputResource = (ApplicationInputResource)object;
- dataObjectType.setName(inputResource.getInputKey());
- dataObjectType.setValue(inputResource.getValue());
- if (inputResource.getDataType() != null){
- dataObjectType.setType(DataType.valueOf(inputResource.getDataType()));
- }
- dataObjectType.setMetaData(inputResource.getMetadata());
- dataObjectType.setApplicationArgument(inputResource.getAppArgument());
- dataObjectType.setStandardInput(inputResource.isStandardInput());
- dataObjectType.setUserFriendlyDescription(inputResource.getUserFriendlyDesc());
- dataObjectType.setInputOrder(inputResource.getInputOrder());
- dataObjectType.setIsRequired(inputResource.isRequired());
- dataObjectType.setRequiredToAddedToCommandLine(inputResource.isRequiredToCMD());
- dataObjectType.setDataStaged(inputResource.isDataStaged());
- return dataObjectType;
- }else {
- return null;
- }
- }
- return null;
- }
-
- public static OutputDataObjectType getOutput(Object object){
- if (object != null){
- OutputDataObjectType dataObjectType = new OutputDataObjectType();
- if (object instanceof ExperimentOutputResource){
- ExperimentOutputResource expOutput = (ExperimentOutputResource)object;
- dataObjectType.setName(expOutput.getExperimentKey());
- dataObjectType.setValue(expOutput.getValue());
- if (expOutput.getDataType() != null){
- dataObjectType.setType(DataType.valueOf(expOutput.getDataType()));
- }
- dataObjectType.setIsRequired(expOutput.getRequired());
- dataObjectType.setRequiredToAddedToCommandLine(expOutput.getRequiredToCMD());
- dataObjectType.setDataMovement(expOutput.isDataMovement());
- dataObjectType.setLocation(expOutput.getDataNameLocation());
- dataObjectType.setSearchQuery(expOutput.getSearchQuery());
- dataObjectType.setApplicationArgument(expOutput.getAppArgument());
- return dataObjectType;
- }else if (object instanceof NodeOutputResource){
- NodeOutputResource nodeOutputResource = (NodeOutputResource)object;
- dataObjectType.setName(nodeOutputResource.getOutputKey());
- dataObjectType.setValue(nodeOutputResource.getValue());
- if (nodeOutputResource.getDataType() != null){
- dataObjectType.setType(DataType.valueOf(nodeOutputResource.getDataType()));
- }
- dataObjectType.setIsRequired(nodeOutputResource.getRequired());
- dataObjectType.setRequiredToAddedToCommandLine(nodeOutputResource.getRequiredToCMD());
- dataObjectType.setDataMovement(nodeOutputResource.isDataMovement());
- dataObjectType.setLocation(nodeOutputResource.getDataNameLocation());
- dataObjectType.setSearchQuery(nodeOutputResource.getSearchQuery());
- dataObjectType.setApplicationArgument(nodeOutputResource.getAppArgument());
- return dataObjectType;
- }else if (object instanceof ApplicationOutputResource){
- ApplicationOutputResource outputResource = (ApplicationOutputResource)object;
- dataObjectType.setName(outputResource.getOutputKey());
- dataObjectType.setValue(outputResource.getValue());
- dataObjectType.setIsRequired(outputResource.isRequired());
- dataObjectType.setRequiredToAddedToCommandLine(outputResource.isRequiredToCMD());
- if (outputResource.getDataType() != null){
- dataObjectType.setType(DataType.valueOf(outputResource.getDataType()));
- }
- dataObjectType.setDataMovement(outputResource.isDataMovement());
- dataObjectType.setLocation(outputResource.getDataNameLocation());
- dataObjectType.setSearchQuery(outputResource.getSearchQuery());
- dataObjectType.setApplicationArgument(outputResource.getAppArgument());
- return dataObjectType;
- }else {
- return null;
- }
- }
- return null;
- }
-
- public static List<String> getEmailAddresses (List<NotificationEmailResource> resourceList){
- List<String> emailAddresses = new ArrayList<String>();
- if (resourceList != null && !resourceList.isEmpty()){
- for (NotificationEmailResource emailResource : resourceList){
- emailAddresses.add(emailResource.getEmailAddress());
- }
- }
- return emailAddresses;
- }
-
- public static List<InputDataObjectType> getExpInputs (List<ExperimentInputResource> exInputList){
- List<InputDataObjectType> expInputs = new ArrayList<InputDataObjectType>();
- if (exInputList != null && !exInputList.isEmpty()){
- for (ExperimentInputResource inputResource : exInputList){
- InputDataObjectType exInput = getInput(inputResource);
- expInputs.add(exInput);
- }
- }
- return expInputs;
- }
-
- public static List<OutputDataObjectType> getExpOutputs (List<ExperimentOutputResource> experimentOutputResourceList){
- List<OutputDataObjectType> exOutputs = new ArrayList<OutputDataObjectType>();
- if (experimentOutputResourceList != null && !experimentOutputResourceList.isEmpty()){
- for (ExperimentOutputResource outputResource : experimentOutputResourceList){
- OutputDataObjectType output = getOutput(outputResource);
- exOutputs.add(output);
- }
- }
- return exOutputs;
- }
-
- public static List<InputDataObjectType> getNodeInputs (List<NodeInputResource> nodeInputResources){
- List<InputDataObjectType> nodeInputs = new ArrayList<InputDataObjectType>();
- if (nodeInputResources != null && !nodeInputResources.isEmpty()){
- for (NodeInputResource inputResource : nodeInputResources){
- InputDataObjectType nodeInput = getInput(inputResource);
- nodeInputs.add(nodeInput);
- }
- }
- return nodeInputs;
- }
-
- public static List<OutputDataObjectType> getNodeOutputs (List<NodeOutputResource> nodeOutputResourceList){
- List<OutputDataObjectType> nodeOutputs = new ArrayList<OutputDataObjectType>();
- if (nodeOutputResourceList != null && !nodeOutputResourceList.isEmpty()){
- for (NodeOutputResource outputResource : nodeOutputResourceList){
- OutputDataObjectType output = getOutput(outputResource);
- nodeOutputs.add(output);
- }
- }
- return nodeOutputs;
- }
-
- public static List<InputDataObjectType> getApplicationInputs (List<ApplicationInputResource> applicationInputResources){
- List<InputDataObjectType> appInputs = new ArrayList<InputDataObjectType>();
- if (applicationInputResources != null && !applicationInputResources.isEmpty()){
- for (ApplicationInputResource inputResource : applicationInputResources){
- InputDataObjectType appInput = getInput(inputResource);
- appInputs.add(appInput);
- }
- }
- return appInputs;
- }
-
- public static List<OutputDataObjectType> getApplicationOutputs (List<ApplicationOutputResource> outputResources){
- List<OutputDataObjectType> appOutputs = new ArrayList<OutputDataObjectType>();
- if (outputResources != null && !outputResources.isEmpty()){
- for (ApplicationOutputResource outputResource : outputResources){
- OutputDataObjectType output = getOutput(outputResource);
- appOutputs.add(output);
- }
- }
- return appOutputs;
- }
-
- public static ExperimentStatus getExperimentStatus(StatusResource status){
- if (status != null){
- ExperimentStatus experimentStatus = new ExperimentStatus();
- if (status.getState() == null || status.getState().equals("")){
- status.setState("UNKNOWN");
- }
- experimentStatus.setExperimentState(ExperimentState.valueOf(status.getState()));
- experimentStatus.setTimeOfStateChange(status.getStatusUpdateTime().getTime());
- return experimentStatus;
- }
- return null;
- }
-
- public static WorkflowNodeStatus getWorkflowNodeStatus (StatusResource status){
- if (status != null){
- WorkflowNodeStatus workflowNodeStatus = new WorkflowNodeStatus();
- if (status.getState() == null || status.getState().equals("")){
- status.setState("UNKNOWN");
- }
- workflowNodeStatus.setWorkflowNodeState(WorkflowNodeState.valueOf(status.getState()));
- workflowNodeStatus.setTimeOfStateChange(status.getStatusUpdateTime().getTime());
- return workflowNodeStatus;
- }
- return null;
- }
-
- public static TaskStatus getTaskStatus (StatusResource status){
- if (status != null){
- TaskStatus taskStatus = new TaskStatus();
- if (status.getState() == null || status.getState().equals("")){
- status.setState("UNKNOWN");
- }
- taskStatus.setExecutionState(TaskState.valueOf(status.getState()));
- taskStatus.setTimeOfStateChange(status.getStatusUpdateTime().getTime());
- return taskStatus;
- }
- return null;
- }
-
- public static JobStatus getJobStatus (StatusResource status){
- if (status != null){
- JobStatus jobStatus = new JobStatus();
- if (status.getState() == null || status.getState().equals("")){
- status.setState("UNKNOWN");
- }
- jobStatus.setJobState(JobState.valueOf(status.getState()));
- if (status.getStatusUpdateTime() == null){
- jobStatus.setTimeOfStateChange(AiravataUtils.getCurrentTimestamp().getTime());
- }else {
- jobStatus.setTimeOfStateChange(status.getStatusUpdateTime().getTime());
- }
- return jobStatus;
- }
- return null;
- }
-
- public static TransferStatus getTransferStatus (StatusResource status){
- if (status != null){
- TransferStatus transferStatus = new TransferStatus();
- if (status.getState() == null || status.getState().equals("")){
- status.setState("UNKNOWN");
- }
- transferStatus.setTransferState(TransferState.valueOf(status.getState()));
- transferStatus.setTimeOfStateChange(status.getStatusUpdateTime().getTime());
- return transferStatus;
- }
- return null;
- }
-
- public static ApplicationStatus getApplicationStatus (StatusResource status){
- if (status != null){
- ApplicationStatus applicationStatus = new ApplicationStatus();
- if (status.getState() == null || status.getState().equals("")){
- status.setState("UNKNOWN");
- }
- applicationStatus.setApplicationState(status.getState());
- applicationStatus.setTimeOfStateChange(status.getStatusUpdateTime().getTime());
- return applicationStatus;
- }
- return null;
- }
-
- public static List<WorkflowNodeStatus> getWorkflowNodeStatusList(List<StatusResource> statuses){
- List<WorkflowNodeStatus> wfNodeStatuses = new ArrayList<WorkflowNodeStatus>();
- if (statuses != null && !statuses.isEmpty()){
- for (StatusResource statusResource : statuses){
- wfNodeStatuses.add(getWorkflowNodeStatus(statusResource));
- }
- }
- return wfNodeStatuses;
- }
-
- public static WorkflowNodeDetails getWorkflowNodeDetails(WorkflowNodeDetailResource nodeDetailResource) throws RegistryException {
- if (nodeDetailResource != null){
- WorkflowNodeDetails wfNode = new WorkflowNodeDetails();
- wfNode.setNodeInstanceId(nodeDetailResource.getNodeInstanceId());
- wfNode.setCreationTime(nodeDetailResource.getCreationTime().getTime());
- wfNode.setNodeName(nodeDetailResource.getNodeName());
- List<NodeInputResource> nodeInputs = nodeDetailResource.getNodeInputs();
- wfNode.setNodeInputs(getNodeInputs(nodeInputs));
- List<NodeOutputResource> nodeOutputs = nodeDetailResource.getNodeOutputs();
- wfNode.setNodeOutputs(getNodeOutputs(nodeOutputs));
- List<TaskDetailResource> taskDetails = nodeDetailResource.getTaskDetails();
- wfNode.setTaskDetailsList(getTaskDetailsList(taskDetails));
- wfNode.setWorkflowNodeStatus(getWorkflowNodeStatus(nodeDetailResource.getWorkflowNodeStatus()));
- List<ErrorDetailResource> errorDetails = nodeDetailResource.getErrorDetails();
- wfNode.setErrors(getErrorDetailList(errorDetails));
- wfNode.setExecutionUnit(ExecutionUnit.valueOf(nodeDetailResource.getExecutionUnit()));
- wfNode.setExecutionUnitData(nodeDetailResource.getExecutionUnitData());
- return wfNode;
- }
- return null;
- }
-
- public static List<WorkflowNodeDetails> getWfNodeList (List<WorkflowNodeDetailResource> resources) throws RegistryException {
- List<WorkflowNodeDetails> workflowNodeDetailsList = new ArrayList<WorkflowNodeDetails>();
- if (resources != null && !resources.isEmpty()){
- for (WorkflowNodeDetailResource resource : resources){
- workflowNodeDetailsList.add(getWorkflowNodeDetails(resource));
- }
- }
- return workflowNodeDetailsList;
- }
-
- public static TaskDetails getTaskDetail (TaskDetailResource taskDetailResource) throws RegistryException {
- if (taskDetailResource != null){
- TaskDetails taskDetails = new TaskDetails();
- String taskId = taskDetailResource.getTaskId();
- taskDetails.setTaskID(taskId);
- taskDetails.setApplicationId(taskDetailResource.getApplicationId());
- taskDetails.setApplicationVersion(taskDetailResource.getApplicationVersion());
- List<ApplicationInputResource> applicationInputs = taskDetailResource.getApplicationInputs();
- taskDetails.setApplicationInputs(getApplicationInputs(applicationInputs));
- List<ApplicationOutputResource> applicationOutputs = taskDetailResource.getApplicationOutputs();
- taskDetails.setApplicationOutputs(getApplicationOutputs(applicationOutputs));
- taskDetails.setEnableEmailNotification(taskDetailResource.isEnableEmailNotifications());
- if (taskDetails.isEnableEmailNotification()){
- List<NotificationEmailResource> notificationEmails = taskDetailResource.getNotificationEmails();
- taskDetails.setEmailAddresses(getEmailAddresses(notificationEmails));
- }
- taskDetails.setApplicationDeploymentId(taskDetailResource.getApplicationDeploymentId());
- if (taskDetailResource.isExists(ResourceType.COMPUTATIONAL_RESOURCE_SCHEDULING, taskId)){
- ComputationSchedulingResource computationScheduling = taskDetailResource.getComputationScheduling(taskId);
- taskDetails.setTaskScheduling(getComputationalResourceScheduling(computationScheduling));
- }
-
- if (taskDetailResource.isExists(ResourceType.ADVANCE_INPUT_DATA_HANDLING, taskId)){
- AdvanceInputDataHandlingResource inputDataHandling = taskDetailResource.getInputDataHandling(taskId);
- taskDetails.setAdvancedInputDataHandling(getAdvanceInputDataHandling(inputDataHandling));
- }
-
- if (taskDetailResource.isExists(ResourceType.ADVANCE_OUTPUT_DATA_HANDLING, taskId)){
- AdvancedOutputDataHandlingResource outputDataHandling = taskDetailResource.getOutputDataHandling(taskId);
- taskDetails.setAdvancedOutputDataHandling(getAdvanceOutputDataHandling(outputDataHandling));
- }
-
- taskDetails.setTaskStatus(getTaskStatus(taskDetailResource.getTaskStatus()));
- List<JobDetailResource> jobDetailList = taskDetailResource.getJobDetailList();
- taskDetails.setJobDetailsList(getJobDetailsList(jobDetailList));
- taskDetails.setErrors(getErrorDetailList(taskDetailResource.getErrorDetailList()));
- taskDetails.setDataTransferDetailsList(getDataTransferlList(taskDetailResource.getDataTransferDetailList()));
- return taskDetails;
- }
- return null;
- }
-
- public static List<TaskDetails> getTaskDetailsList (List<TaskDetailResource> resources) throws RegistryException {
- List<TaskDetails> taskDetailsList = new ArrayList<TaskDetails>();
- if (resources != null && !resources.isEmpty()){
- for (TaskDetailResource resource : resources){
- taskDetailsList.add(getTaskDetail(resource));
- }
- }
- return taskDetailsList;
- }
-
- public static List<JobDetails> getJobDetailsList(List<JobDetailResource> jobs) throws RegistryException {
- List<JobDetails> jobDetailsList = new ArrayList<JobDetails>();
- if (jobs != null && !jobs.isEmpty()){
- for (JobDetailResource resource : jobs){
- jobDetailsList.add(getJobDetail(resource));
- }
- }
- return jobDetailsList;
- }
-
-
- public static JobDetails getJobDetail(JobDetailResource jobDetailResource) throws RegistryException {
- if (jobDetailResource != null){
- JobDetails jobDetails = new JobDetails();
- jobDetails.setJobID(jobDetailResource.getJobId());
- jobDetails.setJobDescription(jobDetailResource.getJobDescription());
- jobDetails.setCreationTime(jobDetailResource.getCreationTime().getTime());
- StatusResource jobStatus = jobDetailResource.getJobStatus();
- jobDetails.setJobStatus(getJobStatus(jobStatus));
- jobDetails.setJobName(jobDetailResource.getJobName());
- jobDetails.setWorkingDir(jobDetailResource.getWorkingDir());
- StatusResource applicationStatus = jobDetailResource.getApplicationStatus();
- jobDetails.setApplicationStatus(getApplicationStatus(applicationStatus));
- List<ErrorDetailResource> errorDetails = jobDetailResource.getErrorDetails();
- jobDetails.setErrors(getErrorDetailList(errorDetails));
- jobDetails.setComputeResourceConsumed(jobDetailResource.getComputeResourceConsumed());
- return jobDetails;
- }
- return null;
- }
-
- public static ErrorDetails getErrorDetails (ErrorDetailResource resource){
- if (resource != null){
- ErrorDetails errorDetails = new ErrorDetails();
- errorDetails.setErrorID(String.valueOf(resource.getErrorId()));
- errorDetails.setCreationTime(resource.getCreationTime().getTime());
- errorDetails.setActualErrorMessage(resource.getActualErrorMsg());
- errorDetails.setUserFriendlyMessage(resource.getUserFriendlyErrorMsg());
- errorDetails.setErrorCategory(ErrorCategory.valueOf(resource.getErrorCategory()));
- errorDetails.setTransientOrPersistent(resource.isTransientPersistent());
- errorDetails.setCorrectiveAction(CorrectiveAction.valueOf(resource.getCorrectiveAction()));
- errorDetails.setActionableGroup(ActionableGroup.valueOf(resource.getActionableGroup()));
- return errorDetails;
- }
- return null;
- }
-
- public static List<ErrorDetails> getErrorDetailList (List<ErrorDetailResource> errorDetailResources){
- List<ErrorDetails> errorDetailsList = new ArrayList<ErrorDetails>();
- if (errorDetailResources != null && !errorDetailResources.isEmpty()){
- for (ErrorDetailResource errorDetailResource : errorDetailResources){
- errorDetailsList.add(getErrorDetails(errorDetailResource));
- }
- }
- return errorDetailsList;
- }
-
- public static DataTransferDetails getDataTransferDetail (DataTransferDetailResource resource) throws RegistryException {
- if (resource != null){
- DataTransferDetails details = new DataTransferDetails();
- details.setTransferID(resource.getTransferId());
- details.setCreationTime(resource.getCreationTime().getTime());
- details.setTransferDescription(resource.getTransferDescription());
- details.setTransferStatus(getTransferStatus(resource.getDataTransferStatus()));
- return details;
- }
- return null;
- }
-
- public static List<DataTransferDetails> getDataTransferlList (List<DataTransferDetailResource> resources) throws RegistryException {
- List<DataTransferDetails> transferDetailsList = new ArrayList<DataTransferDetails>();
- if (resources != null && !resources.isEmpty()){
- for (DataTransferDetailResource resource : resources){
- transferDetailsList.add(getDataTransferDetail(resource));
- }
- }
- return transferDetailsList;
- }
-
-
- public static UserConfigurationData getUserConfigData (ConfigDataResource resource) throws RegistryException {
- if (resource != null){
- UserConfigurationData data = new UserConfigurationData();
- data.setAiravataAutoSchedule(resource.isAiravataAutoSchedule());
- data.setOverrideManualScheduledParams(resource.isOverrideManualParams());
- data.setShareExperimentPublicly(resource.isShareExp());
- data.setUserDN(resource.getUserDn());
- data.setGenerateCert(resource.isGenerateCert());
- String expID = resource.getExperimentId();
- ExperimentResource experimentResource = new ExperimentResource();
- experimentResource.setExpID(expID);
- if (experimentResource.isExists(ResourceType.COMPUTATIONAL_RESOURCE_SCHEDULING, expID)){
- ComputationSchedulingResource computationScheduling = experimentResource.getComputationScheduling(expID);
- data.setComputationalResourceScheduling(getComputationalResourceScheduling(computationScheduling));
- }
-
- if (experimentResource.isExists(ResourceType.ADVANCE_INPUT_DATA_HANDLING, expID)){
- AdvanceInputDataHandlingResource inputDataHandling = experimentResource.getInputDataHandling(expID);
- data.setAdvanceInputDataHandling(getAdvanceInputDataHandling(inputDataHandling));
- }
-
- if (experimentResource.isExists(ResourceType.ADVANCE_OUTPUT_DATA_HANDLING, expID)){
- AdvancedOutputDataHandlingResource outputDataHandling = experimentResource.getOutputDataHandling(expID);
- data.setAdvanceOutputDataHandling(getAdvanceOutputDataHandling(outputDataHandling));
- }
-
- if (experimentResource.isExists(ResourceType.QOS_PARAM, expID)){
- QosParamResource qoSparams = experimentResource.getQOSparams(expID);
- data.setQosParams(getQOSParams(qoSparams));
- }
- return data;
- }
- return null;
- }
-
-
- public static ComputationalResourceScheduling getComputationalResourceScheduling (ComputationSchedulingResource csr){
- if (csr != null){
- ComputationalResourceScheduling scheduling = new ComputationalResourceScheduling();
- scheduling.setResourceHostId(csr.getResourceHostId());
- scheduling.setTotalCPUCount(csr.getCpuCount());
- scheduling.setNodeCount(csr.getNodeCount());
- scheduling.setNumberOfThreads(csr.getNumberOfThreads());
- scheduling.setQueueName(csr.getQueueName());
- scheduling.setWallTimeLimit(csr.getWalltimeLimit());
- scheduling.setJobStartTime((int)csr.getJobStartTime().getTime());
- scheduling.setTotalPhysicalMemory(csr.getPhysicalMemory());
- scheduling.setComputationalProjectAccount(csr.getProjectName());
- scheduling.setChassisName(csr.getChessisName());
- return scheduling;
- }
- return null;
- }
-
- public static AdvancedInputDataHandling getAdvanceInputDataHandling(AdvanceInputDataHandlingResource adhr){
- if (adhr != null){
- AdvancedInputDataHandling adih = new AdvancedInputDataHandling();
- adih.setStageInputFilesToWorkingDir(adhr.isStageInputFiles());
- adih.setParentWorkingDirectory(adhr.getWorkingDirParent());
- adih.setUniqueWorkingDirectory(adhr.getWorkingDir());
- adih.setCleanUpWorkingDirAfterJob(adhr.isCleanAfterJob());
- return adih;
- }
- return null;
- }
-
- public static AdvancedOutputDataHandling getAdvanceOutputDataHandling(AdvancedOutputDataHandlingResource adodh){
- if (adodh != null){
- AdvancedOutputDataHandling outputDataHandling = new AdvancedOutputDataHandling();
- outputDataHandling.setOutputDataDir(adodh.getOutputDataDir());
- outputDataHandling.setDataRegistryURL(adodh.getDataRegUrl());
- outputDataHandling.setPersistOutputData(adodh.isPersistOutputData());
- return outputDataHandling;
- }
- return null;
- }
-
- public static QualityOfServiceParams getQOSParams (QosParamResource qos){
- if (qos != null){
- QualityOfServiceParams qosParams = new QualityOfServiceParams();
- qosParams.setStartExecutionAt(qos.getStartExecutionAt());
- qosParams.setExecuteBefore(qos.getExecuteBefore());
- qosParams.setNumberofRetries(qos.getNoOfRetries());
- return qosParams;
- }
- return null;
- }
-
-
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/experiment-catalog/src/main/resources/META-INF/persistence.xml
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/resources/META-INF/persistence.xml b/modules/registry/experiment-catalog/src/main/resources/META-INF/persistence.xml
deleted file mode 100644
index 8df44f9..0000000
--- a/modules/registry/experiment-catalog/src/main/resources/META-INF/persistence.xml
+++ /dev/null
@@ -1,65 +0,0 @@
-<?xml version="1.0"?>
-<!--*
- *
- * 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.
- *
-* -->
-<persistence xmlns="http://java.sun.com/xml/ns/persistence"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.0">
- <persistence-unit name="airavata_data">
- <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
- <class>org.apache.airavata.experiment.catalog.model.Gateway</class>
- <class>org.apache.airavata.experiment.catalog.model.Configuration</class>
- <class>org.apache.airavata.experiment.catalog.model.Users</class>
- <class>org.apache.airavata.experiment.catalog.model.Gateway_Worker</class>
- <class>org.apache.airavata.experiment.catalog.model.Project</class>
- <class>org.apache.airavata.experiment.catalog.model.ProjectUser</class>
- <class>org.apache.airavata.experiment.catalog.model.Experiment</class>
- <class>org.apache.airavata.experiment.catalog.model.Notification_Email</class>
- <class>org.apache.airavata.experiment.catalog.model.Experiment_Input</class>
- <class>org.apache.airavata.experiment.catalog.model.Experiment_Output</class>
- <class>org.apache.airavata.experiment.catalog.model.WorkflowNodeDetail</class>
- <class>org.apache.airavata.experiment.catalog.model.TaskDetail</class>
- <class>org.apache.airavata.experiment.catalog.model.ErrorDetail</class>
- <class>org.apache.airavata.experiment.catalog.model.ApplicationInput</class>
- <class>org.apache.airavata.experiment.catalog.model.ApplicationOutput</class>
- <class>org.apache.airavata.experiment.catalog.model.NodeInput</class>
- <class>org.apache.airavata.experiment.catalog.model.NodeOutput</class>
- <class>org.apache.airavata.experiment.catalog.model.JobDetail</class>
- <class>org.apache.airavata.experiment.catalog.model.DataTransferDetail</class>
- <class>org.apache.airavata.experiment.catalog.model.Status</class>
- <class>org.apache.airavata.experiment.catalog.model.ExperimentConfigData</class>
- <class>org.apache.airavata.experiment.catalog.model.Computational_Resource_Scheduling</class>
- <class>org.apache.airavata.experiment.catalog.model.AdvancedInputDataHandling</class>
- <class>org.apache.airavata.experiment.catalog.model.AdvancedOutputDataHandling</class>
- <class>org.apache.airavata.experiment.catalog.model.QosParam</class>
- <exclude-unlisted-classes>true</exclude-unlisted-classes>
- <!--properties>
- <property name="openjpa.ConnectionURL"
- value="jdbc:mysql://localhost:3306/persitant_data" />
- <property name="openjpa.ConnectionDriverName" value="com.mysql.jdbc.Driver" />
- <property name="openjpa.ConnectionUserName" value="airavata" />
- <property name="openjpa.ConnectionPassword" value="airavata" />
- <property name="openjpa.DynamicEnhancementAgent" value="true" />
- <property name="openjpa.RuntimeUnenhancedClasses" value="supported" />
- <property name="openjpa.Log" value="SQL=TRACE" />
- <property name="openjpa.ConnectionFactoryProperties"
- value="PrettyPrint=true, PrettyPrintLineLength=72, PrintParameters=true, MaxActive=10, MaxIdle=5, MinIdle=2, MaxWait=60000" />
- </properties-->
- </persistence-unit>
-</persistence>
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/experiment-catalog/src/main/resources/registry-derby.sql
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/resources/registry-derby.sql b/modules/registry/experiment-catalog/src/main/resources/registry-derby.sql
deleted file mode 100644
index 7ab3755..0000000
--- a/modules/registry/experiment-catalog/src/main/resources/registry-derby.sql
+++ /dev/null
@@ -1,391 +0,0 @@
-/*
- *
- * 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.
- *
- */
-CREATE TABLE GATEWAY
-(
- GATEWAY_ID VARCHAR (255),
- GATEWAY_NAME VARCHAR(255),
- DOMAIN VARCHAR(255),
- EMAIL_ADDRESS VARCHAR(255),
- PRIMARY KEY (GATEWAY_ID)
-);
-
-CREATE TABLE CONFIGURATION
-(
- CONFIG_KEY VARCHAR(255),
- CONFIG_VAL VARCHAR(255),
- EXPIRE_DATE TIMESTAMP DEFAULT '0000-00-00 00:00:00',
- CATEGORY_ID VARCHAR (255),
- PRIMARY KEY(CONFIG_KEY, CONFIG_VAL, CATEGORY_ID)
-);
-
-INSERT INTO CONFIGURATION (CONFIG_KEY, CONFIG_VAL, EXPIRE_DATE, CATEGORY_ID) VALUES('registry.version', '0.15', CURRENT_TIMESTAMP ,'SYSTEM');
-
-CREATE TABLE USERS
-(
- USER_NAME VARCHAR(255),
- PASSWORD VARCHAR(255),
- PRIMARY KEY(USER_NAME)
-);
-
-CREATE TABLE GATEWAY_WORKER
-(
- GATEWAY_ID VARCHAR(255),
- USER_NAME VARCHAR(255),
- PRIMARY KEY (GATEWAY_ID, USER_NAME),
- FOREIGN KEY (GATEWAY_ID) REFERENCES GATEWAY(GATEWAY_ID) ON DELETE CASCADE,
- FOREIGN KEY (USER_NAME) REFERENCES USERS(USER_NAME) ON DELETE CASCADE
-);
-
-CREATE TABLE PROJECT
-(
- GATEWAY_ID VARCHAR(255),
- USER_NAME VARCHAR(255) NOT NULL,
- PROJECT_ID VARCHAR(255),
- PROJECT_NAME VARCHAR(255) NOT NULL,
- DESCRIPTION VARCHAR(255),
- CREATION_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
- PRIMARY KEY (PROJECT_ID),
- FOREIGN KEY (GATEWAY_ID) REFERENCES GATEWAY(GATEWAY_ID) ON DELETE CASCADE,
- FOREIGN KEY (USER_NAME) REFERENCES USERS(USER_NAME) ON DELETE CASCADE
-);
-
-CREATE TABLE PROJECT_USER
-(
- PROJECT_ID VARCHAR(255),
- USER_NAME VARCHAR(255),
- PRIMARY KEY (PROJECT_ID,USER_NAME),
- FOREIGN KEY (PROJECT_ID) REFERENCES PROJECT(PROJECT_ID) ON DELETE CASCADE,
- FOREIGN KEY (USER_NAME) REFERENCES USERS(USER_NAME) ON DELETE CASCADE
-);
-
-CREATE TABLE EXPERIMENT
-(
- EXPERIMENT_ID VARCHAR(255),
- GATEWAY_ID VARCHAR(255),
- EXECUTION_USER VARCHAR(255) NOT NULL,
- PROJECT_ID VARCHAR(255) NOT NULL,
- CREATION_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
- EXPERIMENT_NAME VARCHAR(255) NOT NULL,
- EXPERIMENT_DESCRIPTION VARCHAR(255),
- APPLICATION_ID VARCHAR(255),
- APPLICATION_VERSION VARCHAR(255),
- WORKFLOW_TEMPLATE_ID VARCHAR(255),
- WORKFLOW_TEMPLATE_VERSION VARCHAR(255),
- WORKFLOW_EXECUTION_ID VARCHAR(255),
- ALLOW_NOTIFICATION SMALLINT,
- GATEWAY_EXECUTION_ID VARCHAR(255),
- PRIMARY KEY(EXPERIMENT_ID),
- FOREIGN KEY (GATEWAY_ID) REFERENCES GATEWAY(GATEWAY_ID) ON DELETE CASCADE,
- FOREIGN KEY (EXECUTION_USER) REFERENCES USERS(USER_NAME) ON DELETE CASCADE,
- FOREIGN KEY (PROJECT_ID) REFERENCES PROJECT(PROJECT_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE EXPERIMENT_INPUT
-(
- EXPERIMENT_ID VARCHAR(255),
- INPUT_KEY VARCHAR(255) NOT NULL,
- DATA_TYPE VARCHAR(255),
- METADATA VARCHAR(255),
- APP_ARGUMENT VARCHAR(255),
- STANDARD_INPUT SMALLINT,
- USER_FRIENDLY_DESC VARCHAR(255),
- VALUE CLOB,
- INPUT_ORDER INTEGER,
- IS_REQUIRED SMALLINT,
- REQUIRED_TO_COMMANDLINE SMALLINT,
- DATA_STAGED SMALLINT,
- PRIMARY KEY(EXPERIMENT_ID,INPUT_KEY),
- FOREIGN KEY (EXPERIMENT_ID) REFERENCES EXPERIMENT(EXPERIMENT_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE EXPERIMENT_OUTPUT
-(
- EXPERIMENT_ID VARCHAR(255),
- OUTPUT_KEY VARCHAR(255) NOT NULL,
- DATA_TYPE VARCHAR(255),
- VALUE CLOB,
- IS_REQUIRED SMALLINT,
- REQUIRED_TO_COMMANDLINE SMALLINT,
- DATA_MOVEMENT SMALLINT,
- DATA_NAME_LOCATION VARCHAR(255),
- SEARCH_QUERY VARCHAR(255),
- APP_ARGUMENT VARCHAR(255),
- PRIMARY KEY(EXPERIMENT_ID,OUTPUT_KEY),
- FOREIGN KEY (EXPERIMENT_ID) REFERENCES EXPERIMENT(EXPERIMENT_ID) ON DELETE CASCADE
-);
-
-
-CREATE TABLE WORKFLOW_NODE_DETAIL
-(
- EXPERIMENT_ID VARCHAR(255) NOT NULL,
- NODE_INSTANCE_ID VARCHAR(255),
- CREATION_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
- NODE_NAME VARCHAR(255) NOT NULL,
- EXECUTION_UNIT VARCHAR(255) NOT NULL,
- EXECUTION_UNIT_DATA VARCHAR(255),
- PRIMARY KEY(NODE_INSTANCE_ID),
- FOREIGN KEY (EXPERIMENT_ID) REFERENCES EXPERIMENT(EXPERIMENT_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE TASK_DETAIL
-(
- TASK_ID VARCHAR(255),
- NODE_INSTANCE_ID VARCHAR(255),
- CREATION_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
- APPLICATION_ID VARCHAR(255),
- APPLICATION_VERSION VARCHAR(255),
- APPLICATION_DEPLOYMENT_ID VARCHAR(255),
- ALLOW_NOTIFICATION SMALLINT,
- PRIMARY KEY(TASK_ID),
- FOREIGN KEY (NODE_INSTANCE_ID) REFERENCES WORKFLOW_NODE_DETAIL(NODE_INSTANCE_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE NOTIFICATION_EMAIL
-(
- EMAIL_ID INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY,
- EXPERIMENT_ID VARCHAR(255),
- TASK_ID VARCHAR(255),
- EMAIL_ADDRESS VARCHAR(255),
- PRIMARY KEY(EMAIL_ID),
- FOREIGN KEY (EXPERIMENT_ID) REFERENCES EXPERIMENT(EXPERIMENT_ID) ON DELETE CASCADE,
- FOREIGN KEY (TASK_ID) REFERENCES TASK_DETAIL(TASK_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE ERROR_DETAIL
-(
- ERROR_ID INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY,
- EXPERIMENT_ID VARCHAR(255),
- TASK_ID VARCHAR(255),
- NODE_INSTANCE_ID VARCHAR(255),
- JOB_ID VARCHAR(255),
- CREATION_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
- ACTUAL_ERROR_MESSAGE CLOB,
- USER_FRIEDNLY_ERROR_MSG VARCHAR(255),
- TRANSIENT_OR_PERSISTENT SMALLINT,
- ERROR_CATEGORY VARCHAR(255),
- CORRECTIVE_ACTION VARCHAR(255),
- ACTIONABLE_GROUP VARCHAR(255),
- PRIMARY KEY(ERROR_ID),
- FOREIGN KEY (EXPERIMENT_ID) REFERENCES EXPERIMENT(EXPERIMENT_ID) ON DELETE CASCADE,
- FOREIGN KEY (TASK_ID) REFERENCES TASK_DETAIL(TASK_ID) ON DELETE CASCADE,
- FOREIGN KEY (NODE_INSTANCE_ID) REFERENCES WORKFLOW_NODE_DETAIL(NODE_INSTANCE_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE APPLICATION_INPUT
-(
- TASK_ID VARCHAR(255),
- INPUT_KEY VARCHAR(255) NOT NULL,
- DATA_TYPE VARCHAR(255),
- METADATA VARCHAR(255),
- APP_ARGUMENT VARCHAR(255),
- STANDARD_INPUT SMALLINT,
- USER_FRIENDLY_DESC VARCHAR(255),
- VALUE CLOB,
- INPUT_ORDER INTEGER,
- IS_REQUIRED SMALLINT,
- REQUIRED_TO_COMMANDLINE SMALLINT,
- DATA_STAGED SMALLINT,
- PRIMARY KEY(TASK_ID,INPUT_KEY),
- FOREIGN KEY (TASK_ID) REFERENCES TASK_DETAIL(TASK_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE APPLICATION_OUTPUT
-(
- TASK_ID VARCHAR(255),
- OUTPUT_KEY VARCHAR(255) NOT NULL,
- DATA_TYPE VARCHAR(255),
- VALUE CLOB,
- IS_REQUIRED SMALLINT,
- REQUIRED_TO_COMMANDLINE SMALLINT,
- DATA_MOVEMENT SMALLINT,
- DATA_NAME_LOCATION VARCHAR(255),
- SEARCH_QUERY VARCHAR(255),
- APP_ARGUMENT VARCHAR(255),
- PRIMARY KEY(TASK_ID,OUTPUT_KEY),
- FOREIGN KEY (TASK_ID) REFERENCES TASK_DETAIL(TASK_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE NODE_INPUT
-(
- NODE_INSTANCE_ID VARCHAR(255),
- INPUT_KEY VARCHAR(255) NOT NULL,
- DATA_TYPE VARCHAR(255),
- METADATA VARCHAR(255),
- APP_ARGUMENT VARCHAR(255),
- STANDARD_INPUT SMALLINT,
- USER_FRIENDLY_DESC VARCHAR(255),
- VALUE VARCHAR(255),
- INPUT_ORDER INTEGER,
- IS_REQUIRED SMALLINT,
- REQUIRED_TO_COMMANDLINE SMALLINT,
- DATA_STAGED SMALLINT,
- PRIMARY KEY(NODE_INSTANCE_ID,INPUT_KEY),
- FOREIGN KEY (NODE_INSTANCE_ID) REFERENCES WORKFLOW_NODE_DETAIL(NODE_INSTANCE_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE NODE_OUTPUT
-(
- NODE_INSTANCE_ID VARCHAR(255),
- OUTPUT_KEY VARCHAR(255) NOT NULL,
- DATA_TYPE VARCHAR(255),
- VALUE VARCHAR(255),
- IS_REQUIRED SMALLINT,
- REQUIRED_TO_COMMANDLINE SMALLINT,
- DATA_MOVEMENT SMALLINT,
- DATA_NAME_LOCATION VARCHAR(255),
- SEARCH_QUERY VARCHAR(255),
- APP_ARGUMENT VARCHAR(255),
- PRIMARY KEY(NODE_INSTANCE_ID,OUTPUT_KEY),
- FOREIGN KEY (NODE_INSTANCE_ID) REFERENCES WORKFLOW_NODE_DETAIL(NODE_INSTANCE_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE JOB_DETAIL
-(
- JOB_ID VARCHAR(255),
- TASK_ID VARCHAR(255),
- JOB_DESCRIPTION CLOB NOT NULL,
- CREATION_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
- COMPUTE_RESOURCE_CONSUMED VARCHAR(255),
- JOBNAME VARCHAR (255),
- WORKING_DIR VARCHAR(255),
- PRIMARY KEY (TASK_ID, JOB_ID),
- FOREIGN KEY (TASK_ID) REFERENCES TASK_DETAIL(TASK_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE DATA_TRANSFER_DETAIL
-(
- TRANSFER_ID VARCHAR(255),
- TASK_ID VARCHAR(255),
- CREATION_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
- TRANSFER_DESC VARCHAR(255) NOT NULL,
- PRIMARY KEY(TRANSFER_ID),
- FOREIGN KEY (TASK_ID) REFERENCES TASK_DETAIL(TASK_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE STATUS
-(
- STATUS_ID INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY,
- EXPERIMENT_ID VARCHAR(255),
- NODE_INSTANCE_ID VARCHAR(255),
- TRANSFER_ID VARCHAR(255),
- TASK_ID VARCHAR(255),
- JOB_ID VARCHAR(255),
- STATE VARCHAR(255),
- STATUS_UPDATE_TIME TIMESTAMP DEFAULT '0000-00-00 00:00:00',
- STATUS_TYPE VARCHAR(255),
- PRIMARY KEY(STATUS_ID),
- FOREIGN KEY (EXPERIMENT_ID) REFERENCES EXPERIMENT(EXPERIMENT_ID) ON DELETE CASCADE,
- FOREIGN KEY (TASK_ID) REFERENCES TASK_DETAIL(TASK_ID) ON DELETE CASCADE,
- FOREIGN KEY (NODE_INSTANCE_ID) REFERENCES WORKFLOW_NODE_DETAIL(NODE_INSTANCE_ID) ON DELETE CASCADE,
- FOREIGN KEY (TRANSFER_ID) REFERENCES DATA_TRANSFER_DETAIL(TRANSFER_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE CONFIG_DATA
-(
- EXPERIMENT_ID VARCHAR(255),
- AIRAVATA_AUTO_SCHEDULE SMALLINT NOT NULL,
- OVERRIDE_MANUAL_SCHEDULE_PARAMS SMALLINT NOT NULL,
- SHARE_EXPERIMENT SMALLINT,
- USER_DN VARCHAR(255),
- GENERATE_CERT SMALLINT,
- PRIMARY KEY(EXPERIMENT_ID)
-);
-
-CREATE TABLE COMPUTATIONAL_RESOURCE_SCHEDULING
-(
- RESOURCE_SCHEDULING_ID INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY,
- EXPERIMENT_ID VARCHAR(255),
- TASK_ID VARCHAR(255),
- RESOURCE_HOST_ID VARCHAR(255),
- CPU_COUNT INTEGER,
- NODE_COUNT INTEGER,
- NO_OF_THREADS INTEGER,
- QUEUE_NAME VARCHAR(255),
- WALLTIME_LIMIT INTEGER,
- JOB_START_TIME TIMESTAMP DEFAULT '0000-00-00 00:00:00',
- TOTAL_PHYSICAL_MEMORY INTEGER,
- COMPUTATIONAL_PROJECT_ACCOUNT VARCHAR(255),
- CHESSIS_NAME VARCHAR(255),
- PRIMARY KEY(RESOURCE_SCHEDULING_ID),
- FOREIGN KEY (EXPERIMENT_ID) REFERENCES EXPERIMENT(EXPERIMENT_ID) ON DELETE CASCADE,
- FOREIGN KEY (TASK_ID) REFERENCES TASK_DETAIL(TASK_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE ADVANCE_INPUT_DATA_HANDLING
-(
- INPUT_DATA_HANDLING_ID INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY,
- EXPERIMENT_ID VARCHAR(255),
- TASK_ID VARCHAR(255),
- WORKING_DIR_PARENT VARCHAR(255),
- UNIQUE_WORKING_DIR VARCHAR(255),
- STAGE_INPUT_FILES_TO_WORKING_DIR SMALLINT,
- CLEAN_AFTER_JOB SMALLINT,
- PRIMARY KEY(INPUT_DATA_HANDLING_ID),
- FOREIGN KEY (EXPERIMENT_ID) REFERENCES EXPERIMENT(EXPERIMENT_ID) ON DELETE CASCADE,
- FOREIGN KEY (TASK_ID) REFERENCES TASK_DETAIL(TASK_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE ADVANCE_OUTPUT_DATA_HANDLING
-(
- OUTPUT_DATA_HANDLING_ID INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY,
- EXPERIMENT_ID VARCHAR(255),
- TASK_ID VARCHAR(255),
- OUTPUT_DATA_DIR VARCHAR(255),
- DATA_REG_URL VARCHAR (255),
- PERSIST_OUTPUT_DATA SMALLINT,
- PRIMARY KEY(OUTPUT_DATA_HANDLING_ID),
- FOREIGN KEY (EXPERIMENT_ID) REFERENCES EXPERIMENT(EXPERIMENT_ID) ON DELETE CASCADE,
- FOREIGN KEY (TASK_ID) REFERENCES TASK_DETAIL(TASK_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE QOS_PARAM
-(
- QOS_ID INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY,
- EXPERIMENT_ID VARCHAR(255),
- TASK_ID VARCHAR(255),
- START_EXECUTION_AT VARCHAR(255),
- EXECUTE_BEFORE VARCHAR(255),
- NO_OF_RETRIES INTEGER,
- PRIMARY KEY(QOS_ID),
- FOREIGN KEY (EXPERIMENT_ID) REFERENCES EXPERIMENT(EXPERIMENT_ID) ON DELETE CASCADE,
- FOREIGN KEY (TASK_ID) REFERENCES TASK_DETAIL(TASK_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE COMMUNITY_USER
-(
- GATEWAY_ID VARCHAR(256) NOT NULL,
- COMMUNITY_USER_NAME VARCHAR(256) NOT NULL,
- TOKEN_ID VARCHAR(256) NOT NULL,
- COMMUNITY_USER_EMAIL VARCHAR(256) NOT NULL,
- PRIMARY KEY (GATEWAY_ID, COMMUNITY_USER_NAME, TOKEN_ID)
-);
-
-CREATE TABLE CREDENTIALS
-(
- GATEWAY_ID VARCHAR(256) NOT NULL,
- TOKEN_ID VARCHAR(256) NOT NULL,
- CREDENTIAL BLOB NOT NULL,
- PORTAL_USER_ID VARCHAR(256) NOT NULL,
- TIME_PERSISTED TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
- PRIMARY KEY (GATEWAY_ID, TOKEN_ID)
-);
-
-
[11/52] [abbrv] [partial] airavata git commit: registry refactoring
Posted by sh...@apache.org.
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/GatewayProfileResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/GatewayProfileResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/GatewayProfileResource.java
new file mode 100644
index 0000000..84a90ec
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/GatewayProfileResource.java
@@ -0,0 +1,318 @@
+/**
+ * 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.aiaravata.application.catalog.data.resources;
+
+import org.airavata.appcatalog.cpi.AppCatalogException;
+import org.apache.aiaravata.application.catalog.data.model.GatewayProfile;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogJPAUtils;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogQueryGenerator;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogResourceType;
+import org.apache.airavata.common.exception.ApplicationSettingsException;
+import org.apache.airavata.common.utils.AiravataUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.persistence.EntityManager;
+import javax.persistence.Query;
+import java.sql.Timestamp;
+import java.util.ArrayList;
+import java.util.List;
+
+public class GatewayProfileResource extends AbstractResource {
+ private final static Logger logger = LoggerFactory.getLogger(GatewayProfileResource.class);
+
+ private String gatewayID;
+ private Timestamp createdTime;
+ private Timestamp updatedTime;
+
+ public Timestamp getCreatedTime() {
+ return createdTime;
+ }
+
+ public void setCreatedTime(Timestamp createdTime) {
+ this.createdTime = createdTime;
+ }
+
+ public Timestamp getUpdatedTime() {
+ return updatedTime;
+ }
+
+ public void setUpdatedTime(Timestamp updatedTime) {
+ this.updatedTime = updatedTime;
+ }
+
+ public void remove(Object identifier) throws AppCatalogException {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(GATEWAY_PROFILE);
+ generator.setParameter(GatewayProfileConstants.GATEWAY_ID, identifier);
+ 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();
+ }
+ }
+ }
+
+ public Resource get(Object identifier) throws AppCatalogException {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(GATEWAY_PROFILE);
+ generator.setParameter(GatewayProfileConstants.GATEWAY_ID, identifier);
+ Query q = generator.selectQuery(em);
+ GatewayProfile gatewayProfile = (GatewayProfile) q.getSingleResult();
+ GatewayProfileResource gatewayProfileResource =
+ (GatewayProfileResource) AppCatalogJPAUtils.getResource(
+ AppCatalogResourceType.GATEWAY_PROFILE, gatewayProfile);
+ em.getTransaction().commit();
+ em.close();
+ return gatewayProfileResource;
+ } 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();
+ }
+ }
+ }
+
+ public List<Resource> get(String fieldName, Object value) throws AppCatalogException {
+ List<Resource> gatewayProfileResources = new ArrayList<Resource>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ Query q;
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(GATEWAY_PROFILE);
+ List results;
+ if (fieldName.equals(GatewayProfileConstants.GATEWAY_ID)) {
+ generator.setParameter(GatewayProfileConstants.GATEWAY_ID, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ GatewayProfile gatewayProfile = (GatewayProfile) result;
+ GatewayProfileResource gatewayProfileResource =
+ (GatewayProfileResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.GATEWAY_PROFILE, gatewayProfile);
+ gatewayProfileResources.add(gatewayProfileResource);
+ }
+ }
+ } else if (fieldName.equals(GatewayProfileConstants.GATEWAY_ID)) {
+ generator.setParameter(GatewayProfileConstants.GATEWAY_ID, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ GatewayProfile gatewayProfile = (GatewayProfile) result;
+ GatewayProfileResource gatewayProfileResource =
+ (GatewayProfileResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.GATEWAY_PROFILE, gatewayProfile);
+ gatewayProfileResources.add(gatewayProfileResource);
+ }
+ }
+ } else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for Gateway Profile resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for Gateway Profile 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 gatewayProfileResources;
+ }
+
+ @Override
+ public List<Resource> getAll() throws AppCatalogException {
+ List<Resource> resourceList = new ArrayList<Resource>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(GATEWAY_PROFILE);
+ Query q = generator.selectQuery(em);
+ List results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ GatewayProfile gatewayProfile = (GatewayProfile) result;
+ GatewayProfileResource gatewayProfileResource =
+ (GatewayProfileResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.GATEWAY_PROFILE, gatewayProfile);
+ resourceList.add(gatewayProfileResource);
+ }
+ }
+ 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 resourceList;
+ }
+
+ @Override
+ public List<String> getAllIds() throws AppCatalogException {
+ return null;
+ }
+
+ public List<String> getIds(String fieldName, Object value) throws AppCatalogException {
+ List<String> gatewayProfileResourceIDs = new ArrayList<String>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ Query q;
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(GATEWAY_PROFILE);
+ List results;
+ if (fieldName.equals(GatewayProfileConstants.GATEWAY_ID)) {
+ generator.setParameter(GatewayProfileConstants.GATEWAY_ID, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ GatewayProfile gatewayProfile = (GatewayProfile) result;
+ gatewayProfileResourceIDs.add(gatewayProfile.getGatewayID());
+ }
+ }
+ } else if (fieldName.equals(GatewayProfileConstants.GATEWAY_ID)) {
+ generator.setParameter(GatewayProfileConstants.GATEWAY_ID, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ GatewayProfile gatewayProfile = (GatewayProfile) result;
+ gatewayProfileResourceIDs.add(gatewayProfile.getGatewayID());
+ }
+ }
+ } else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for Gateway Profile resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for Gateway Profile 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 gatewayProfileResourceIDs;
+ }
+
+ public void save() throws AppCatalogException {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ GatewayProfile existingGatewayProfile = em.find(GatewayProfile.class, gatewayID);
+ em.close();
+
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ if (existingGatewayProfile != null) {
+ existingGatewayProfile.setUpdateTime(AiravataUtils.getCurrentTimestamp());
+ em.merge(existingGatewayProfile);
+ } else {
+ GatewayProfile gatewayProfile = new GatewayProfile();
+ gatewayProfile.setGatewayID(gatewayID);
+ gatewayProfile.setCreationTime(AiravataUtils.getCurrentTimestamp());
+ em.persist(gatewayProfile);
+ }
+ 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();
+ }
+ }
+ }
+
+ public boolean isExists(Object identifier) throws AppCatalogException {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ GatewayProfile gatewayProfile = em.find(GatewayProfile.class, identifier);
+ em.close();
+ return gatewayProfile != null;
+ } 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();
+ }
+ }
+ }
+
+ public String getGatewayID() {
+ return gatewayID;
+ }
+
+ public void setGatewayID(String gatewayID) {
+ this.gatewayID = gatewayID;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/GlobusGKEndpointAppCatalogResourceAppCat.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/GlobusGKEndpointAppCatalogResourceAppCat.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/GlobusGKEndpointAppCatalogResourceAppCat.java
new file mode 100644
index 0000000..2902f89
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/GlobusGKEndpointAppCatalogResourceAppCat.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.GlobusGKEndPointPK;
+import org.apache.airavata.registry.core.app.catalog.model.GlobusGKEndpoint;
+import org.apache.airavata.registry.core.app.catalog.model.GlobusJobSubmission;
+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 GlobusGKEndpointAppCatalogResourceAppCat extends AppCatAbstractResource {
+ private final static Logger logger = LoggerFactory.getLogger(GlobusGKEndpointAppCatalogResourceAppCat.class);
+
+ private String submissionID;
+ private String endpoint;
+
+ private GlobusJobSubmissionAppCatalogResourceAppCat globusJobSubmissionResource;
+
+
+ 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(GLOBUS_GK_ENDPOINT);
+ generator.setParameter(GlobusEPConstants.ENDPOINT, ids.get(GlobusEPConstants.ENDPOINT));
+ generator.setParameter(GlobusEPConstants.SUBMISSION_ID, ids.get(GlobusEPConstants.SUBMISSION_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();
+ }
+ }
+ }
+
+ 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(GLOBUS_GK_ENDPOINT);
+ generator.setParameter(GlobusEPConstants.SUBMISSION_ID, ids.get(GlobusEPConstants.SUBMISSION_ID));
+ generator.setParameter(GlobusEPConstants.ENDPOINT, ids.get(GlobusEPConstants.ENDPOINT));
+ Query q = generator.selectQuery(em);
+ GlobusGKEndpoint gkEndpoint = (GlobusGKEndpoint) q.getSingleResult();
+ GlobusGKEndpointAppCatalogResourceAppCat gkEndpointResource =
+ (GlobusGKEndpointAppCatalogResourceAppCat) AppCatalogJPAUtils.getResource(AppCatalogResourceType.GLOBUS_GK_ENDPOINT, gkEndpoint);
+ em.getTransaction().commit();
+ em.close();
+ return gkEndpointResource;
+ } 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();
+ }
+ }
+ }
+
+ public List<AppCatalogResource> get(String fieldName, Object value) throws AppCatalogException {
+ List<AppCatalogResource> resources = new ArrayList<AppCatalogResource>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ Query q;
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(GLOBUS_GK_ENDPOINT);
+ List results;
+ if (fieldName.equals(GlobusEPConstants.ENDPOINT)) {
+ generator.setParameter(GlobusEPConstants.ENDPOINT, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ GlobusGKEndpoint gkEndpoint = (GlobusGKEndpoint) result;
+ GlobusGKEndpointAppCatalogResourceAppCat gkEndpointResource =
+ (GlobusGKEndpointAppCatalogResourceAppCat) AppCatalogJPAUtils.getResource(AppCatalogResourceType.GLOBUS_GK_ENDPOINT, gkEndpoint);
+ resources.add(gkEndpointResource);
+ }
+ }
+ } else if (fieldName.equals(GlobusEPConstants.SUBMISSION_ID)) {
+ generator.setParameter(GlobusEPConstants.SUBMISSION_ID, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ GlobusGKEndpoint globusGKEndpoint = (GlobusGKEndpoint) result;
+ GlobusGKEndpointAppCatalogResourceAppCat gkEndpointResource =
+ (GlobusGKEndpointAppCatalogResourceAppCat) AppCatalogJPAUtils.getResource(AppCatalogResourceType.GLOBUS_GK_ENDPOINT, globusGKEndpoint);
+ resources.add(gkEndpointResource);
+ }
+ }
+ } else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for Globus Endpoint Resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for Globus Endpoint 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 resources;
+ }
+
+ @Override
+ public List<AppCatalogResource> getAll() throws AppCatalogException {
+ return null;
+ }
+
+ @Override
+ public List<String> getAllIds() throws AppCatalogException {
+ return null;
+ }
+
+ public List<String> getIds(String fieldName, Object value) throws AppCatalogException {
+ List<String> list = new ArrayList<String>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ Query q;
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(GLOBUS_GK_ENDPOINT);
+ List results;
+ if (fieldName.equals(GlobusEPConstants.SUBMISSION_ID)) {
+ generator.setParameter(GlobusEPConstants.SUBMISSION_ID, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ GlobusGKEndpoint globusGKEndpoint = (GlobusGKEndpoint) result;
+ list.add(globusGKEndpoint.getSubmissionID());
+ }
+ }
+ } else if (fieldName.equals(GlobusEPConstants.ENDPOINT)) {
+ generator.setParameter(GlobusEPConstants.ENDPOINT, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ GlobusGKEndpoint globusGKEndpoint = (GlobusGKEndpoint) result;
+ list.add(globusGKEndpoint.getSubmissionID());
+ }
+ }
+ } else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for Globus EP resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for Globus EP 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 list;
+ }
+
+ public void save() throws AppCatalogException {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ GlobusGKEndpoint existingGlobusEP = em.find(GlobusGKEndpoint.class, new GlobusGKEndPointPK(submissionID, endpoint));
+ em.close();
+
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ GlobusJobSubmission globusJobSubmission = em.find(GlobusJobSubmission.class, submissionID);
+ if (existingGlobusEP != null) {
+ existingGlobusEP.setSubmissionID(submissionID);
+ existingGlobusEP.setEndpoint(endpoint);
+ existingGlobusEP.setGlobusSubmission(globusJobSubmission);
+ em.merge(existingGlobusEP);
+ } else {
+ GlobusGKEndpoint globusGKEndpoint = new GlobusGKEndpoint();
+ globusGKEndpoint.setSubmissionID(submissionID);
+ globusGKEndpoint.setEndpoint(endpoint);
+ globusGKEndpoint.setGlobusSubmission(globusJobSubmission);
+ em.persist(globusGKEndpoint);
+ }
+ 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();
+ }
+ }
+ }
+
+ 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();
+ GlobusGKEndpoint gkEndpoint = em.find(GlobusGKEndpoint.class, new GlobusGKEndPointPK(ids.get(GlobusEPConstants.SUBMISSION_ID),
+ ids.get(GlobusEPConstants.ENDPOINT)));
+
+ em.close();
+ return gkEndpoint != null;
+ } 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();
+ }
+ } }
+
+ public String getSubmissionID() {
+ return submissionID;
+ }
+
+ public void setSubmissionID(String submissionID) {
+ this.submissionID = submissionID;
+ }
+
+ public String getEndpoint() {
+ return endpoint;
+ }
+
+ public void setEndpoint(String endpoint) {
+ this.endpoint = endpoint;
+ }
+
+ public GlobusJobSubmissionAppCatalogResourceAppCat getGlobusJobSubmissionResource() {
+ return globusJobSubmissionResource;
+ }
+
+ public void setGlobusJobSubmissionResource(GlobusJobSubmissionAppCatalogResourceAppCat globusJobSubmissionResource) {
+ this.globusJobSubmissionResource = globusJobSubmissionResource;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/GlobusGKEndpointResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/GlobusGKEndpointResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/GlobusGKEndpointResource.java
new file mode 100644
index 0000000..c933600
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/GlobusGKEndpointResource.java
@@ -0,0 +1,321 @@
+/**
+ * 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.aiaravata.application.catalog.data.resources;
+
+import org.airavata.appcatalog.cpi.AppCatalogException;
+import org.apache.aiaravata.application.catalog.data.model.*;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogJPAUtils;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogQueryGenerator;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogResourceType;
+import org.apache.airavata.common.exception.ApplicationSettingsException;
+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 GlobusGKEndpointResource extends AbstractResource {
+ private final static Logger logger = LoggerFactory.getLogger(GlobusGKEndpointResource.class);
+
+ private String submissionID;
+ private String endpoint;
+
+ private GlobusJobSubmissionResource globusJobSubmissionResource;
+
+
+ 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(GLOBUS_GK_ENDPOINT);
+ generator.setParameter(GlobusEPConstants.ENDPOINT, ids.get(GlobusEPConstants.ENDPOINT));
+ generator.setParameter(GlobusEPConstants.SUBMISSION_ID, ids.get(GlobusEPConstants.SUBMISSION_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();
+ }
+ }
+ }
+
+ public Resource 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(GLOBUS_GK_ENDPOINT);
+ generator.setParameter(GlobusEPConstants.SUBMISSION_ID, ids.get(GlobusEPConstants.SUBMISSION_ID));
+ generator.setParameter(GlobusEPConstants.ENDPOINT, ids.get(GlobusEPConstants.ENDPOINT));
+ Query q = generator.selectQuery(em);
+ GlobusGKEndpoint gkEndpoint = (GlobusGKEndpoint) q.getSingleResult();
+ GlobusGKEndpointResource gkEndpointResource =
+ (GlobusGKEndpointResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.GLOBUS_GK_ENDPOINT, gkEndpoint);
+ em.getTransaction().commit();
+ em.close();
+ return gkEndpointResource;
+ } 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();
+ }
+ }
+ }
+
+ public List<Resource> get(String fieldName, Object value) throws AppCatalogException {
+ List<Resource> resources = new ArrayList<Resource>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ Query q;
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(GLOBUS_GK_ENDPOINT);
+ List results;
+ if (fieldName.equals(GlobusEPConstants.ENDPOINT)) {
+ generator.setParameter(GlobusEPConstants.ENDPOINT, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ GlobusGKEndpoint gkEndpoint = (GlobusGKEndpoint) result;
+ GlobusGKEndpointResource gkEndpointResource =
+ (GlobusGKEndpointResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.GLOBUS_GK_ENDPOINT, gkEndpoint);
+ resources.add(gkEndpointResource);
+ }
+ }
+ } else if (fieldName.equals(GlobusEPConstants.SUBMISSION_ID)) {
+ generator.setParameter(GlobusEPConstants.SUBMISSION_ID, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ GlobusGKEndpoint globusGKEndpoint = (GlobusGKEndpoint) result;
+ GlobusGKEndpointResource gkEndpointResource =
+ (GlobusGKEndpointResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.GLOBUS_GK_ENDPOINT, globusGKEndpoint);
+ resources.add(gkEndpointResource);
+ }
+ }
+ } else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for Globus Endpoint Resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for Globus Endpoint 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 resources;
+ }
+
+ @Override
+ public List<Resource> getAll() throws AppCatalogException {
+ return null;
+ }
+
+ @Override
+ public List<String> getAllIds() throws AppCatalogException {
+ return null;
+ }
+
+ public List<String> getIds(String fieldName, Object value) throws AppCatalogException {
+ List<String> list = new ArrayList<String>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ Query q;
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(GLOBUS_GK_ENDPOINT);
+ List results;
+ if (fieldName.equals(GlobusEPConstants.SUBMISSION_ID)) {
+ generator.setParameter(GlobusEPConstants.SUBMISSION_ID, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ GlobusGKEndpoint globusGKEndpoint = (GlobusGKEndpoint) result;
+ list.add(globusGKEndpoint.getSubmissionID());
+ }
+ }
+ } else if (fieldName.equals(GlobusEPConstants.ENDPOINT)) {
+ generator.setParameter(GlobusEPConstants.ENDPOINT, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ GlobusGKEndpoint globusGKEndpoint = (GlobusGKEndpoint) result;
+ list.add(globusGKEndpoint.getSubmissionID());
+ }
+ }
+ } else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for Globus EP resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for Globus EP 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 list;
+ }
+
+ public void save() throws AppCatalogException {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ GlobusGKEndpoint existingGlobusEP = em.find(GlobusGKEndpoint.class, new GlobusGKEndPointPK(submissionID, endpoint));
+ em.close();
+
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ GlobusJobSubmission globusJobSubmission = em.find(GlobusJobSubmission.class, submissionID);
+ if (existingGlobusEP != null) {
+ existingGlobusEP.setSubmissionID(submissionID);
+ existingGlobusEP.setEndpoint(endpoint);
+ existingGlobusEP.setGlobusSubmission(globusJobSubmission);
+ em.merge(existingGlobusEP);
+ } else {
+ GlobusGKEndpoint globusGKEndpoint = new GlobusGKEndpoint();
+ globusGKEndpoint.setSubmissionID(submissionID);
+ globusGKEndpoint.setEndpoint(endpoint);
+ globusGKEndpoint.setGlobusSubmission(globusJobSubmission);
+ em.persist(globusGKEndpoint);
+ }
+ 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();
+ }
+ }
+ }
+
+ 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();
+ GlobusGKEndpoint gkEndpoint = em.find(GlobusGKEndpoint.class, new GlobusGKEndPointPK(ids.get(GlobusEPConstants.SUBMISSION_ID),
+ ids.get(GlobusEPConstants.ENDPOINT)));
+
+ em.close();
+ return gkEndpoint != null;
+ } 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();
+ }
+ } }
+
+ public String getSubmissionID() {
+ return submissionID;
+ }
+
+ public void setSubmissionID(String submissionID) {
+ this.submissionID = submissionID;
+ }
+
+ public String getEndpoint() {
+ return endpoint;
+ }
+
+ public void setEndpoint(String endpoint) {
+ this.endpoint = endpoint;
+ }
+
+ public GlobusJobSubmissionResource getGlobusJobSubmissionResource() {
+ return globusJobSubmissionResource;
+ }
+
+ public void setGlobusJobSubmissionResource(GlobusJobSubmissionResource globusJobSubmissionResource) {
+ this.globusJobSubmissionResource = globusJobSubmissionResource;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/GlobusJobSubmissionAppCatalogResourceAppCat.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/GlobusJobSubmissionAppCatalogResourceAppCat.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/GlobusJobSubmissionAppCatalogResourceAppCat.java
new file mode 100644
index 0000000..b473905
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/GlobusJobSubmissionAppCatalogResourceAppCat.java
@@ -0,0 +1,315 @@
+/**
+ * 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.GlobusJobSubmission;
+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.List;
+
+public class GlobusJobSubmissionAppCatalogResourceAppCat extends AppCatAbstractResource {
+
+ private final static Logger logger = LoggerFactory.getLogger(GlobusJobSubmissionAppCatalogResourceAppCat.class);
+
+ private String submissionID;
+ private String resourceJobManager;
+ private String securityProtocol;
+
+ public void remove(Object identifier) throws AppCatalogException {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(GLOBUS_SUBMISSION);
+ generator.setParameter(GlobusJobSubmissionConstants.SUBMISSION_ID, identifier);
+ 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();
+ }
+ }
+ }
+
+ public AppCatalogResource get(Object identifier) throws AppCatalogException {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(GLOBUS_SUBMISSION);
+ generator.setParameter(GlobusJobSubmissionConstants.SUBMISSION_ID, identifier);
+ Query q = generator.selectQuery(em);
+ GlobusJobSubmission globusJobSubmission = (GlobusJobSubmission) q.getSingleResult();
+ GlobusJobSubmissionAppCatalogResourceAppCat globusJobSubmissionResource =
+ (GlobusJobSubmissionAppCatalogResourceAppCat) AppCatalogJPAUtils.getResource(
+ AppCatalogResourceType.GLOBUS_SUBMISSION, globusJobSubmission);
+ em.getTransaction().commit();
+ em.close();
+ return globusJobSubmissionResource;
+ } 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();
+ }
+ }
+ }
+
+ public List<AppCatalogResource> get(String fieldName, Object value) throws AppCatalogException {
+ List<AppCatalogResource> globusSubmissionResourceList = new ArrayList<AppCatalogResource>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ Query q;
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(GLOBUS_SUBMISSION);
+ List results;
+ if (fieldName.equals(GlobusJobSubmissionConstants.RESOURCE_JOB_MANAGER)) {
+ generator.setParameter(GlobusJobSubmissionConstants.RESOURCE_JOB_MANAGER, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ GlobusJobSubmission globusJobSubmission = (GlobusJobSubmission) result;
+ GlobusJobSubmissionAppCatalogResourceAppCat globusJobSubmissionResource =
+ (GlobusJobSubmissionAppCatalogResourceAppCat) AppCatalogJPAUtils.getResource(
+ AppCatalogResourceType.GLOBUS_SUBMISSION, globusJobSubmission);
+ globusSubmissionResourceList.add(globusJobSubmissionResource);
+ }
+ }
+ } else if (fieldName.equals(GlobusJobSubmissionConstants.SECURITY_PROTOCAL)) {
+ generator.setParameter(GlobusJobSubmissionConstants.SECURITY_PROTOCAL, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ GlobusJobSubmission globusJobSubmission = (GlobusJobSubmission) result;
+ GlobusJobSubmissionAppCatalogResourceAppCat globusJobSubmissionResource =
+ (GlobusJobSubmissionAppCatalogResourceAppCat) AppCatalogJPAUtils.getResource(
+ AppCatalogResourceType.GLOBUS_SUBMISSION, globusJobSubmission);
+ globusSubmissionResourceList.add(globusJobSubmissionResource);
+ }
+ }
+ } else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for Globus submission resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for Globus Submission 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 globusSubmissionResourceList;
+ }
+
+ @Override
+ public List<AppCatalogResource> getAll() throws AppCatalogException {
+ return null;
+ }
+
+ @Override
+ public List<String> getAllIds() throws AppCatalogException {
+ return null;
+ }
+
+ public List<String> getIds(String fieldName, Object value) throws AppCatalogException {
+ List<String> globusSubmissionResourceIDs = new ArrayList<String>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ Query q;
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(GLOBUS_SUBMISSION);
+ List results;
+ if (fieldName.equals(GlobusJobSubmissionConstants.SUBMISSION_ID)) {
+ generator.setParameter(GlobusJobSubmissionConstants.SUBMISSION_ID, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ GlobusJobSubmission globusJobSubmission = (GlobusJobSubmission) result;
+ globusSubmissionResourceIDs.add(globusJobSubmission.getSubmissionID());
+ }
+ }
+ } else if (fieldName.equals(GlobusJobSubmissionConstants.GLOBUS_GATEKEEPER_EP)) {
+ generator.setParameter(GlobusJobSubmissionConstants.GLOBUS_GATEKEEPER_EP, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ GlobusJobSubmission globusJobSubmission = (GlobusJobSubmission) result;
+ globusSubmissionResourceIDs.add(globusJobSubmission.getSubmissionID());
+ }
+ }
+ }
+ else if (fieldName.equals(GlobusJobSubmissionConstants.SECURITY_PROTOCAL)) {
+ generator.setParameter(GlobusJobSubmissionConstants.SECURITY_PROTOCAL, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ GlobusJobSubmission globusJobSubmission = (GlobusJobSubmission) result;
+ globusSubmissionResourceIDs.add(globusJobSubmission.getSubmissionID());
+ }
+ }
+ } else if (fieldName.equals(GlobusJobSubmissionConstants.RESOURCE_JOB_MANAGER)) {
+ generator.setParameter(GlobusJobSubmissionConstants.RESOURCE_JOB_MANAGER, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ GlobusJobSubmission globusJobSubmission = (GlobusJobSubmission) result;
+ globusSubmissionResourceIDs.add(globusJobSubmission.getSubmissionID());
+ }
+ }
+ } else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for Globus Submission resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for Globus Submission 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 globusSubmissionResourceIDs;
+ }
+
+ public void save() throws AppCatalogException {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ GlobusJobSubmission existingGlobusSubmission = em.find(GlobusJobSubmission.class, submissionID);
+ em.close();
+
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ if (existingGlobusSubmission != null) {
+ existingGlobusSubmission.setSubmissionID(submissionID);
+ existingGlobusSubmission.setResourceJobManager(resourceJobManager);
+ existingGlobusSubmission.setSecurityProtocol(securityProtocol);
+ em.merge(existingGlobusSubmission);
+ } else {
+ GlobusJobSubmission globusJobSubmission = new GlobusJobSubmission();
+ globusJobSubmission.setSubmissionID(submissionID);
+ globusJobSubmission.setSecurityProtocol(securityProtocol);
+ globusJobSubmission.setResourceJobManager(resourceJobManager);
+ em.persist(globusJobSubmission);
+ }
+ 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();
+ }
+ }
+ }
+
+ public boolean isExists(Object identifier) throws AppCatalogException {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ GlobusJobSubmission globusJobSubmission = em.find(GlobusJobSubmission.class, identifier);
+ em.close();
+ return globusJobSubmission != null;
+ } 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();
+ }
+ }
+ }
+
+ public String getSubmissionID() {
+ return submissionID;
+ }
+
+ public void setSubmissionID(String submissionID) {
+ this.submissionID = submissionID;
+ }
+
+ public String getResourceJobManager() {
+ return resourceJobManager;
+ }
+
+ public void setResourceJobManager(String resourceJobManager) {
+ this.resourceJobManager = resourceJobManager;
+ }
+
+ public String getSecurityProtocol() {
+ return securityProtocol;
+ }
+
+ public void setSecurityProtocol(String securityProtocol) {
+ this.securityProtocol = securityProtocol;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/GlobusJobSubmissionResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/GlobusJobSubmissionResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/GlobusJobSubmissionResource.java
new file mode 100644
index 0000000..4d0f7ef
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/GlobusJobSubmissionResource.java
@@ -0,0 +1,315 @@
+/**
+ * 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.aiaravata.application.catalog.data.resources;
+
+import org.airavata.appcatalog.cpi.AppCatalogException;
+import org.apache.aiaravata.application.catalog.data.model.GlobusJobSubmission;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogJPAUtils;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogQueryGenerator;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogResourceType;
+import org.apache.airavata.common.exception.ApplicationSettingsException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.persistence.EntityManager;
+import javax.persistence.Query;
+import java.util.ArrayList;
+import java.util.List;
+
+public class GlobusJobSubmissionResource extends AbstractResource {
+
+ private final static Logger logger = LoggerFactory.getLogger(GlobusJobSubmissionResource.class);
+
+ private String submissionID;
+ private String resourceJobManager;
+ private String securityProtocol;
+
+ public void remove(Object identifier) throws AppCatalogException {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(GLOBUS_SUBMISSION);
+ generator.setParameter(GlobusJobSubmissionConstants.SUBMISSION_ID, identifier);
+ 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();
+ }
+ }
+ }
+
+ public Resource get(Object identifier) throws AppCatalogException {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(GLOBUS_SUBMISSION);
+ generator.setParameter(GlobusJobSubmissionConstants.SUBMISSION_ID, identifier);
+ Query q = generator.selectQuery(em);
+ GlobusJobSubmission globusJobSubmission = (GlobusJobSubmission) q.getSingleResult();
+ GlobusJobSubmissionResource globusJobSubmissionResource =
+ (GlobusJobSubmissionResource) AppCatalogJPAUtils.getResource(
+ AppCatalogResourceType.GLOBUS_SUBMISSION, globusJobSubmission);
+ em.getTransaction().commit();
+ em.close();
+ return globusJobSubmissionResource;
+ } 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();
+ }
+ }
+ }
+
+ public List<Resource> get(String fieldName, Object value) throws AppCatalogException {
+ List<Resource> globusSubmissionResourceList = new ArrayList<Resource>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ Query q;
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(GLOBUS_SUBMISSION);
+ List results;
+ if (fieldName.equals(GlobusJobSubmissionConstants.RESOURCE_JOB_MANAGER)) {
+ generator.setParameter(GlobusJobSubmissionConstants.RESOURCE_JOB_MANAGER, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ GlobusJobSubmission globusJobSubmission = (GlobusJobSubmission) result;
+ GlobusJobSubmissionResource globusJobSubmissionResource =
+ (GlobusJobSubmissionResource) AppCatalogJPAUtils.getResource(
+ AppCatalogResourceType.GLOBUS_SUBMISSION, globusJobSubmission);
+ globusSubmissionResourceList.add(globusJobSubmissionResource);
+ }
+ }
+ } else if (fieldName.equals(GlobusJobSubmissionConstants.SECURITY_PROTOCAL)) {
+ generator.setParameter(GlobusJobSubmissionConstants.SECURITY_PROTOCAL, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ GlobusJobSubmission globusJobSubmission = (GlobusJobSubmission) result;
+ GlobusJobSubmissionResource globusJobSubmissionResource =
+ (GlobusJobSubmissionResource) AppCatalogJPAUtils.getResource(
+ AppCatalogResourceType.GLOBUS_SUBMISSION, globusJobSubmission);
+ globusSubmissionResourceList.add(globusJobSubmissionResource);
+ }
+ }
+ } else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for Globus submission resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for Globus Submission 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 globusSubmissionResourceList;
+ }
+
+ @Override
+ public List<Resource> getAll() throws AppCatalogException {
+ return null;
+ }
+
+ @Override
+ public List<String> getAllIds() throws AppCatalogException {
+ return null;
+ }
+
+ public List<String> getIds(String fieldName, Object value) throws AppCatalogException {
+ List<String> globusSubmissionResourceIDs = new ArrayList<String>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ Query q;
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(GLOBUS_SUBMISSION);
+ List results;
+ if (fieldName.equals(GlobusJobSubmissionConstants.SUBMISSION_ID)) {
+ generator.setParameter(GlobusJobSubmissionConstants.SUBMISSION_ID, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ GlobusJobSubmission globusJobSubmission = (GlobusJobSubmission) result;
+ globusSubmissionResourceIDs.add(globusJobSubmission.getSubmissionID());
+ }
+ }
+ } else if (fieldName.equals(GlobusJobSubmissionConstants.GLOBUS_GATEKEEPER_EP)) {
+ generator.setParameter(GlobusJobSubmissionConstants.GLOBUS_GATEKEEPER_EP, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ GlobusJobSubmission globusJobSubmission = (GlobusJobSubmission) result;
+ globusSubmissionResourceIDs.add(globusJobSubmission.getSubmissionID());
+ }
+ }
+ }
+ else if (fieldName.equals(GlobusJobSubmissionConstants.SECURITY_PROTOCAL)) {
+ generator.setParameter(GlobusJobSubmissionConstants.SECURITY_PROTOCAL, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ GlobusJobSubmission globusJobSubmission = (GlobusJobSubmission) result;
+ globusSubmissionResourceIDs.add(globusJobSubmission.getSubmissionID());
+ }
+ }
+ } else if (fieldName.equals(GlobusJobSubmissionConstants.RESOURCE_JOB_MANAGER)) {
+ generator.setParameter(GlobusJobSubmissionConstants.RESOURCE_JOB_MANAGER, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ GlobusJobSubmission globusJobSubmission = (GlobusJobSubmission) result;
+ globusSubmissionResourceIDs.add(globusJobSubmission.getSubmissionID());
+ }
+ }
+ } else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for Globus Submission resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for Globus Submission 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 globusSubmissionResourceIDs;
+ }
+
+ public void save() throws AppCatalogException {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ GlobusJobSubmission existingGlobusSubmission = em.find(GlobusJobSubmission.class, submissionID);
+ em.close();
+
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ if (existingGlobusSubmission != null) {
+ existingGlobusSubmission.setSubmissionID(submissionID);
+ existingGlobusSubmission.setResourceJobManager(resourceJobManager);
+ existingGlobusSubmission.setSecurityProtocol(securityProtocol);
+ em.merge(existingGlobusSubmission);
+ } else {
+ GlobusJobSubmission globusJobSubmission = new GlobusJobSubmission();
+ globusJobSubmission.setSubmissionID(submissionID);
+ globusJobSubmission.setSecurityProtocol(securityProtocol);
+ globusJobSubmission.setResourceJobManager(resourceJobManager);
+ em.persist(globusJobSubmission);
+ }
+ 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();
+ }
+ }
+ }
+
+ public boolean isExists(Object identifier) throws AppCatalogException {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ GlobusJobSubmission globusJobSubmission = em.find(GlobusJobSubmission.class, identifier);
+ em.close();
+ return globusJobSubmission != null;
+ } 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();
+ }
+ }
+ }
+
+ public String getSubmissionID() {
+ return submissionID;
+ }
+
+ public void setSubmissionID(String submissionID) {
+ this.submissionID = submissionID;
+ }
+
+ public String getResourceJobManager() {
+ return resourceJobManager;
+ }
+
+ public void setResourceJobManager(String resourceJobManager) {
+ this.resourceJobManager = resourceJobManager;
+ }
+
+ public String getSecurityProtocol() {
+ return securityProtocol;
+ }
+
+ public void setSecurityProtocol(String securityProtocol) {
+ this.securityProtocol = securityProtocol;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/GridftpDataMovementAppCatalogResourceAppCat.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/GridftpDataMovementAppCatalogResourceAppCat.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/GridftpDataMovementAppCatalogResourceAppCat.java
new file mode 100644
index 0000000..4b55e20
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/GridftpDataMovementAppCatalogResourceAppCat.java
@@ -0,0 +1,279 @@
+/**
+ * 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 java.sql.Timestamp;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.persistence.EntityManager;
+import javax.persistence.Query;
+
+import org.apache.airavata.common.exception.ApplicationSettingsException;
+import org.apache.airavata.common.utils.AiravataUtils;
+import org.apache.airavata.registry.core.app.catalog.model.GridftpDataMovement;
+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;
+
+public class GridftpDataMovementAppCatalogResourceAppCat extends AppCatAbstractResource {
+ private final static Logger logger = LoggerFactory.getLogger(GridftpDataMovementAppCatalogResourceAppCat.class);
+ private String dataMovementInterfaceId;
+ private String securityProtocol;
+ private Timestamp createdTime;
+ private Timestamp updatedTime;
+
+ public Timestamp getCreatedTime() {
+ return createdTime;
+ }
+
+ public void setCreatedTime(Timestamp createdTime) {
+ this.createdTime = createdTime;
+ }
+
+ public Timestamp getUpdatedTime() {
+ return updatedTime;
+ }
+
+ public void setUpdatedTime(Timestamp updatedTime) {
+ this.updatedTime = updatedTime;
+ }
+
+ @Override
+ public void remove(Object identifier) throws AppCatalogException {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(GRIDFTP_DATA_MOVEMENT);
+ generator.setParameter(GridftpDataMovementConstants.DATA_MOVEMENT_INTERFACE_ID, identifier);
+ 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 {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(GRIDFTP_DATA_MOVEMENT);
+ generator.setParameter(GridftpDataMovementConstants.DATA_MOVEMENT_INTERFACE_ID, identifier);
+ Query q = generator.selectQuery(em);
+ GridftpDataMovement gridftpDataMovement = (GridftpDataMovement) q.getSingleResult();
+ GridftpDataMovementAppCatalogResourceAppCat gridftpDataMovementResource = (GridftpDataMovementAppCatalogResourceAppCat) AppCatalogJPAUtils.getResource(AppCatalogResourceType.GRIDFTP_DATA_MOVEMENT, gridftpDataMovement);
+ em.getTransaction().commit();
+ em.close();
+ return gridftpDataMovementResource;
+ } 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> gridftpDataMovementResources = new ArrayList<AppCatalogResource>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(GRIDFTP_DATA_MOVEMENT);
+ Query q;
+ if ((fieldName.equals(GridftpDataMovementConstants.DATA_MOVEMENT_INTERFACE_ID)) || (fieldName.equals(GridftpDataMovementConstants.SECURITY_PROTOCOL))) {
+ generator.setParameter(fieldName, value);
+ q = generator.selectQuery(em);
+ List<?> results = q.getResultList();
+ for (Object result : results) {
+ GridftpDataMovement gridftpDataMovement = (GridftpDataMovement) result;
+ GridftpDataMovementAppCatalogResourceAppCat gridftpDataMovementResource = (GridftpDataMovementAppCatalogResourceAppCat) AppCatalogJPAUtils.getResource(AppCatalogResourceType.GRIDFTP_DATA_MOVEMENT, gridftpDataMovement);
+ gridftpDataMovementResources.add(gridftpDataMovementResource);
+ }
+ } else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for Gridftp Data Movement Resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for Gridftp Data Movement Resource.");
+ }
+ 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();
+ }
+ }
+ return gridftpDataMovementResources;
+ }
+
+ @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 {
+ List<String> gridftpDataMovementResourceIDs = new ArrayList<String>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(GRIDFTP_DATA_MOVEMENT);
+ Query q;
+ if ((fieldName.equals(GridftpDataMovementConstants.DATA_MOVEMENT_INTERFACE_ID)) || (fieldName.equals(GridftpDataMovementConstants.SECURITY_PROTOCOL))) {
+ generator.setParameter(fieldName, value);
+ q = generator.selectQuery(em);
+ List<?> results = q.getResultList();
+ for (Object result : results) {
+ GridftpDataMovement gridftpDataMovement = (GridftpDataMovement) result;
+ GridftpDataMovementAppCatalogResourceAppCat gridftpDataMovementResource = (GridftpDataMovementAppCatalogResourceAppCat) AppCatalogJPAUtils.getResource(AppCatalogResourceType.GRIDFTP_DATA_MOVEMENT, gridftpDataMovement);
+ gridftpDataMovementResourceIDs.add(gridftpDataMovementResource.getDataMovementInterfaceId());
+ }
+ } else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for Gridftp Data Movement Resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for Gridftp Data Movement Resource.");
+ }
+ 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();
+ }
+ }
+ return gridftpDataMovementResourceIDs;
+ }
+
+ @Override
+ public void save() throws AppCatalogException {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ GridftpDataMovement existingGridftpDataMovement = em.find(GridftpDataMovement.class, dataMovementInterfaceId);
+ em.close();
+ GridftpDataMovement gridftpDataMovement;
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ if (existingGridftpDataMovement == null) {
+ gridftpDataMovement = new GridftpDataMovement();
+ gridftpDataMovement.setCreationTime(AiravataUtils.getCurrentTimestamp());
+ } else {
+ gridftpDataMovement = existingGridftpDataMovement;
+ gridftpDataMovement.setUpdateTime(AiravataUtils.getCurrentTimestamp());
+ }
+ gridftpDataMovement.setDataMovementInterfaceId(getDataMovementInterfaceId());
+ gridftpDataMovement.setSecurityProtocol(getSecurityProtocol());
+ if (existingGridftpDataMovement == null) {
+ em.persist(gridftpDataMovement);
+ } else {
+ em.merge(gridftpDataMovement);
+ }
+ 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 {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ GridftpDataMovement gridftpDataMovement = em.find(GridftpDataMovement.class, identifier);
+ em.close();
+ return gridftpDataMovement != null;
+ } 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();
+ }
+ }
+ }
+
+ public String getDataMovementInterfaceId() {
+ return dataMovementInterfaceId;
+ }
+
+ public String getSecurityProtocol() {
+ return securityProtocol;
+ }
+
+ public void setDataMovementInterfaceId(String dataMovementInterfaceId) {
+ this.dataMovementInterfaceId=dataMovementInterfaceId;
+ }
+
+ public void setSecurityProtocol(String securityProtocol) {
+ this.securityProtocol=securityProtocol;
+ }
+}
\ No newline at end of file
[49/52] [abbrv] [partial] airavata git commit: registry refactoring
Posted by sh...@apache.org.
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/impl/ApplicationInterfaceImpl.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/impl/ApplicationInterfaceImpl.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/impl/ApplicationInterfaceImpl.java
deleted file mode 100644
index 80a974c..0000000
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/impl/ApplicationInterfaceImpl.java
+++ /dev/null
@@ -1,450 +0,0 @@
-/*
- *
- * 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.aiaravata.application.catalog.data.impl;
-
-import org.airavata.appcatalog.cpi.AppCatalogException;
-import org.airavata.appcatalog.cpi.ApplicationInterface;
-import org.apache.aiaravata.application.catalog.data.resources.*;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogThriftConversion;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogUtils;
-import org.apache.airavata.model.appcatalog.appdeployment.ApplicationModule;
-import org.apache.airavata.model.appcatalog.appinterface.ApplicationInterfaceDescription;
-import org.apache.airavata.model.appcatalog.appinterface.InputDataObjectType;
-import org.apache.airavata.model.appcatalog.appinterface.OutputDataObjectType;
-import org.apache.airavata.model.appcatalog.appinterface.applicationInterfaceModelConstants;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-public class ApplicationInterfaceImpl implements ApplicationInterface {
- private final static Logger logger = LoggerFactory.getLogger(ApplicationInterfaceImpl.class);
-
- @Override
- public String addApplicationModule(ApplicationModule applicationModule, String gatewayId) throws AppCatalogException {
- try {
- AppModuleResource moduleResource = new AppModuleResource();
- moduleResource.setModuleName(applicationModule.getAppModuleName());
- moduleResource.setGatewayId(gatewayId);
- if (!applicationModule.getAppModuleId().equals("") && !applicationModule.getAppModuleId().equals(applicationInterfaceModelConstants.DEFAULT_ID)){
- moduleResource.setModuleId(applicationModule.getAppModuleId());
- }else {
- moduleResource.setModuleId(AppCatalogUtils.getID(applicationModule.getAppModuleName()));
- }
- moduleResource.setModuleDesc(applicationModule.getAppModuleDescription());
- moduleResource.setModuleVersion(applicationModule.getAppModuleVersion());
- moduleResource.save();
- applicationModule.setAppModuleId(moduleResource.getModuleId());
- return moduleResource.getModuleId();
- }catch (Exception e) {
- logger.error("Error while adding application module "+applicationModule.getAppModuleName()+" ["+applicationModule.getAppModuleVersion()+"]", e);
- throw new AppCatalogException(e);
- }
- }
-
- @Override
- public String addApplicationInterface(ApplicationInterfaceDescription applicationInterfaceDescription, String gatewayId) throws AppCatalogException {
- try {
- AppInterfaceResource resource = new AppInterfaceResource();
- resource.setAppName(applicationInterfaceDescription.getApplicationName());
- if (!applicationInterfaceDescription.getApplicationInterfaceId().equals("") && !applicationInterfaceDescription.getApplicationInterfaceId().equals(applicationInterfaceModelConstants.DEFAULT_ID)){
- resource.setInterfaceId(applicationInterfaceDescription.getApplicationInterfaceId());
- }else {
- resource.setInterfaceId(AppCatalogUtils.getID(applicationInterfaceDescription.getApplicationName()));
- }
- resource.setAppDescription(applicationInterfaceDescription.getApplicationDescription());
- resource.setGatewayId(gatewayId);
- resource.save();
- applicationInterfaceDescription.setApplicationInterfaceId(resource.getInterfaceId());
-
- List<String> applicationModules = applicationInterfaceDescription.getApplicationModules();
- if (applicationModules != null && !applicationModules.isEmpty()){
- for (String moduleId : applicationModules){
- AppModuleResource appModuleResource = new AppModuleResource();
- AppModuleMappingResource moduleMappingResource = new AppModuleMappingResource();
- moduleMappingResource.setInterfaceId(resource.getInterfaceId());
- moduleMappingResource.setModuleId(moduleId);
- moduleMappingResource.setModuleResource((AppModuleResource)appModuleResource.get(moduleId));
- moduleMappingResource.setAppInterfaceResource(resource);
- moduleMappingResource.save();
- }
- }
-
- List<InputDataObjectType> applicationInputs = applicationInterfaceDescription.getApplicationInputs();
- if (applicationInputs != null && !applicationInputs.isEmpty()){
- for (InputDataObjectType input : applicationInputs){
- ApplicationInputResource inputResource = new ApplicationInputResource();
- inputResource.setAppInterfaceResource(resource);
- inputResource.setInterfaceID(resource.getInterfaceId());
- inputResource.setUserFriendlyDesc(input.getUserFriendlyDescription());
- inputResource.setInputKey(input.getName());
- inputResource.setInputVal(input.getValue());
- inputResource.setDataType(input.getType().toString());
- inputResource.setMetadata(input.getMetaData());
- inputResource.setStandardInput(input.isStandardInput());
- inputResource.setAppArgument(input.getApplicationArgument());
- inputResource.setInputOrder(input.getInputOrder());
- inputResource.setRequired(input.isIsRequired());
- inputResource.setRequiredToCMD(input.isRequiredToAddedToCommandLine());
- inputResource.save();
- }
- }
-
- List<OutputDataObjectType> applicationOutputs = applicationInterfaceDescription.getApplicationOutputs();
- if (applicationOutputs != null && !applicationOutputs.isEmpty()) {
- for (OutputDataObjectType output : applicationOutputs) {
- ApplicationOutputResource outputResource = new ApplicationOutputResource();
- outputResource.setInterfaceID(resource.getInterfaceId());
- outputResource.setAppInterfaceResource(resource);
- outputResource.setOutputKey(output.getName());
- outputResource.setOutputVal(output.getValue());
- outputResource.setDataType(output.getType().toString());
- outputResource.setRequired(output.isIsRequired());
- outputResource.setRequiredToCMD(output.isRequiredToAddedToCommandLine());
- outputResource.setDataMovement(output.isDataMovement());
- outputResource.setDataNameLocation(output.getLocation());
- outputResource.setAppArgument(output.getApplicationArgument());
- outputResource.setSearchQuery(output.getSearchQuery());
- outputResource.save();
- }
- }
- return resource.getInterfaceId();
- }catch (Exception e) {
- logger.error("Error while adding application interface "+applicationInterfaceDescription.getApplicationName(), e);
- throw new AppCatalogException(e);
- }
- }
-
- @Override
- public void addApplicationModuleMapping(String moduleId, String interfaceId) throws AppCatalogException {
- try {
- AppModuleResource appModuleResource = new AppModuleResource();
- AppInterfaceResource interfaceResource = new AppInterfaceResource();
- AppModuleMappingResource moduleMappingResource = new AppModuleMappingResource();
- moduleMappingResource.setInterfaceId(interfaceId);
- moduleMappingResource.setModuleId(moduleId);
- moduleMappingResource.setModuleResource((AppModuleResource)appModuleResource.get(moduleId));
- moduleMappingResource.setAppInterfaceResource((AppInterfaceResource)interfaceResource.get(interfaceId));
- moduleMappingResource.save();
- }catch (Exception e) {
- logger.error("Error while saving application module mapping "+moduleId, e);
- throw new AppCatalogException(e);
- }
- }
-
- @Override
- public void updateApplicationModule(String moduleId, ApplicationModule updatedModule) throws AppCatalogException {
- try {
- AppModuleResource moduleResource = new AppModuleResource();
- AppModuleResource existingModule = (AppModuleResource)moduleResource.get(moduleId);
- existingModule.setModuleName(updatedModule.getAppModuleName());
- existingModule.setModuleDesc(updatedModule.getAppModuleDescription());
- existingModule.setModuleVersion(updatedModule.getAppModuleVersion());
- existingModule.save();
- }catch (Exception e) {
- logger.error("Error while updating application module "+moduleId, e);
- throw new AppCatalogException(e);
- }
- }
-
- @Override
- public void updateApplicationInterface(String interfaceId, ApplicationInterfaceDescription updatedInterface) throws AppCatalogException {
- try {
- AppInterfaceResource resource = new AppInterfaceResource();
- AppInterfaceResource existingInterface = (AppInterfaceResource) resource.get(interfaceId);
- existingInterface.setAppName(updatedInterface.getApplicationName());
- existingInterface.setAppDescription(updatedInterface.getApplicationDescription());
- existingInterface.save();
-
- // remove existing modules before adding
- Map<String, String> ids = new HashMap<String, String>();
- ids.put(AbstractResource.AppModuleMappingConstants.INTERFACE_ID, interfaceId);
- AppModuleMappingResource moduleMappingResource = new AppModuleMappingResource();
- moduleMappingResource.remove(ids);
- List<String> applicationModules = updatedInterface.getApplicationModules();
- if (applicationModules != null && !applicationModules.isEmpty()) {
- for (String moduleId : applicationModules) {
- AppModuleResource appModuleResource = new AppModuleResource();
- moduleMappingResource = new AppModuleMappingResource();
- ids = new HashMap<String, String>();
- ids.put(AbstractResource.AppModuleMappingConstants.MODULE_ID, moduleId);
- ids.put(AbstractResource.AppModuleMappingConstants.INTERFACE_ID, interfaceId);
- AppModuleMappingResource existingMapping;
- if (!moduleMappingResource.isExists(ids)) {
- existingMapping = new AppModuleMappingResource();
- } else {
- existingMapping = (AppModuleMappingResource) moduleMappingResource.get(ids);
- }
- existingMapping.setInterfaceId(interfaceId);
- existingMapping.setModuleId(moduleId);
- existingMapping.setModuleResource((AppModuleResource) appModuleResource.get(moduleId));
- existingMapping.setAppInterfaceResource(existingInterface);
- existingMapping.save();
- }
- }
-
- // remove existing application inputs
- ApplicationInputResource inputResource = new ApplicationInputResource();
- ids = new HashMap<String, String>();
- ids.put(AbstractResource.AppInputConstants.INTERFACE_ID, interfaceId);
- inputResource.remove(ids);
- List<InputDataObjectType> applicationInputs = updatedInterface.getApplicationInputs();
- if (applicationInputs != null && !applicationInputs.isEmpty()) {
- for (InputDataObjectType input : applicationInputs) {
- inputResource = new ApplicationInputResource();
- ids = new HashMap<String, String>();
- ids.put(AbstractResource.AppInputConstants.INTERFACE_ID, interfaceId);
- ids.put(AbstractResource.AppInputConstants.INPUT_KEY, input.getName());
- if (inputResource.isExists(ids)) {
- inputResource = (ApplicationInputResource) inputResource.get(ids);
- }
- inputResource.setAppInterfaceResource(existingInterface);
- inputResource.setInterfaceID(interfaceId);
- inputResource.setUserFriendlyDesc(input.getUserFriendlyDescription());
- inputResource.setInputKey(input.getName());
- inputResource.setInputVal(input.getValue());
- inputResource.setDataType(input.getType().toString());
- inputResource.setMetadata(input.getMetaData());
- inputResource.setStandardInput(input.isStandardInput());
- inputResource.setAppArgument(input.getApplicationArgument());
- inputResource.setInputOrder(input.getInputOrder());
- inputResource.setRequired(input.isIsRequired());
- inputResource.setRequiredToCMD(input.isRequiredToAddedToCommandLine());
- inputResource.save();
- }
- }
-
- // remove existing app outputs before adding
- ApplicationOutputResource outputResource = new ApplicationOutputResource();
- ids = new HashMap<String, String>();
- ids.put(AbstractResource.AppOutputConstants.INTERFACE_ID, interfaceId);
- outputResource.remove(ids);
- List<OutputDataObjectType> applicationOutputs = updatedInterface.getApplicationOutputs();
- if (applicationOutputs != null && !applicationOutputs.isEmpty()) {
- for (OutputDataObjectType output : applicationOutputs) {
- outputResource = new ApplicationOutputResource();
- ids = new HashMap<String, String>();
- ids.put(AbstractResource.AppOutputConstants.INTERFACE_ID, interfaceId);
- ids.put(AbstractResource.AppOutputConstants.OUTPUT_KEY, output.getName());
- if (outputResource.isExists(ids)) {
- outputResource = (ApplicationOutputResource) outputResource.get(ids);
- }
- outputResource.setInterfaceID(interfaceId);
- outputResource.setAppInterfaceResource(existingInterface);
- outputResource.setOutputKey(output.getName());
- outputResource.setOutputVal(output.getValue());
- outputResource.setDataType(output.getType().toString());
- outputResource.setRequired(output.isIsRequired());
- outputResource.setRequiredToCMD(output.isRequiredToAddedToCommandLine());
- outputResource.setDataMovement(output.isDataMovement());
- outputResource.setDataNameLocation(output.getLocation());
- outputResource.setAppArgument(output.getApplicationArgument());
- outputResource.setSearchQuery(output.getSearchQuery());
- outputResource.save();
- }
- }
- } catch (Exception e) {
- logger.error("Error while updating application interface " + interfaceId, e);
- throw new AppCatalogException(e);
- }
- }
-
- @Override
- public ApplicationModule getApplicationModule(String moduleId) throws AppCatalogException {
- try {
- AppModuleResource appModuleResource = new AppModuleResource();
- return AppCatalogThriftConversion.getApplicationModuleDesc((AppModuleResource) appModuleResource.get(moduleId));
- }catch (Exception e) {
- logger.error("Error while retrieving application module "+moduleId, e);
- throw new AppCatalogException(e);
- }
- }
-
- @Override
- public ApplicationInterfaceDescription getApplicationInterface(String interfaceId) throws AppCatalogException {
- try {
- AppInterfaceResource interfaceResource = new AppInterfaceResource();
- return AppCatalogThriftConversion.getApplicationInterfaceDescription((AppInterfaceResource)interfaceResource.get(interfaceId));
- }catch (Exception e) {
- logger.error("Error while retrieving application interface '"+interfaceId, e);
- throw new AppCatalogException(e);
- }
- }
-
- @Override
- public List<ApplicationModule> getApplicationModules(Map<String, String> filters) throws AppCatalogException {
- List<ApplicationModule> modules = new ArrayList<ApplicationModule>();
- try {
- AppModuleResource resource = new AppModuleResource();
- for (String fieldName : filters.keySet() ){
- if (fieldName.equals(AbstractResource.ApplicationModuleConstants.MODULE_NAME)){
- List<Resource> resources = resource.get(AbstractResource.ApplicationModuleConstants.MODULE_NAME, filters.get(fieldName));
- if (resources != null && !resources.isEmpty()){
- modules = AppCatalogThriftConversion.getAppModules(resources);
- }
- }else {
- logger.error("Unsupported field name for app module.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported field name for app module.");
- }
- }
- }catch (Exception e){
- logger.error("Error while retrieving app module list...", e);
- throw new AppCatalogException(e);
- }
- return modules;
- }
-
- @Override
- public List<ApplicationModule> getAllApplicationModules(String gatewayId) throws AppCatalogException {
- List<ApplicationModule> applicationModules = new ArrayList<ApplicationModule>();
- try {
- AppModuleResource resource = new AppModuleResource();
- resource.setGatewayId(gatewayId);
- List<Resource> resources = resource.getAll();
- if (resources != null && !resources.isEmpty()){
- applicationModules = AppCatalogThriftConversion.getAppModules(resources);
- }
- }catch (Exception e){
- logger.error("Error while retrieving compute resource list...", e);
- throw new AppCatalogException(e);
- }
- return applicationModules;
- }
-
- @Override
- public List<ApplicationInterfaceDescription> getApplicationInterfaces(Map<String, String> filters) throws AppCatalogException {
- List<ApplicationInterfaceDescription> appInterfaces = new ArrayList<ApplicationInterfaceDescription>();
- try {
- AppInterfaceResource resource = new AppInterfaceResource();
- for (String fieldName : filters.keySet() ){
- if (fieldName.equals(AbstractResource.ApplicationInterfaceConstants.APPLICATION_NAME)){
- List<Resource> resources = resource.get(AbstractResource.ApplicationInterfaceConstants.APPLICATION_NAME, filters.get(fieldName));
- appInterfaces = AppCatalogThriftConversion.getAppInterfaceDescList(resources);
- }else {
- logger.error("Unsupported field name for app interface.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported field name '"+fieldName+"' for app interface.");
- }
- }
- }catch (Exception e){
- logger.error("Error while retrieving app interface list...", e);
- throw new AppCatalogException(e);
- }
- return appInterfaces;
- }
-
- @Override
- public List<ApplicationInterfaceDescription> getAllApplicationInterfaces(String gatewayId) throws AppCatalogException {
- try {
- AppInterfaceResource resource = new AppInterfaceResource();
- resource.setGatewayId(gatewayId);
- List<Resource> resources = resource.getAll();
- return AppCatalogThriftConversion.getAppInterfaceDescList(resources);
- }catch (Exception e){
- logger.error("Error while retrieving app interface list...", e);
- throw new AppCatalogException(e);
- }
- }
-
- @Override
- public List<String> getAllApplicationInterfaceIds() throws AppCatalogException {
- try {
- AppInterfaceResource resource = new AppInterfaceResource();
- return resource.getAllIds();
- }catch (Exception e){
- logger.error("Error while retrieving app interface list...", e);
- throw new AppCatalogException(e);
- }
- }
-
- @Override
- public boolean removeApplicationInterface(String interfaceId) throws AppCatalogException {
- try {
- AppInterfaceResource resource = new AppInterfaceResource();
- resource.remove(interfaceId);
- return true;
- }catch (Exception e){
- logger.error("Error while removing app interface "+interfaceId, e);
- throw new AppCatalogException(e);
- }
- }
-
- @Override
- public boolean removeApplicationModule(String moduleId) throws AppCatalogException {
- try {
- AppModuleResource resource = new AppModuleResource();
- resource.remove(moduleId);
- return true;
- }catch (Exception e){
- logger.error("Error while removing app module "+moduleId, e);
- throw new AppCatalogException(e);
- }
- }
-
- @Override
- public boolean isApplicationInterfaceExists(String interfaceId) throws AppCatalogException {
- try {
- AppInterfaceResource resource = new AppInterfaceResource();
- return resource.isExists(interfaceId);
- }catch (Exception e){
- logger.error("Error while checking app interface existence "+interfaceId, e);
- throw new AppCatalogException(e);
- }
- }
-
- @Override
- public boolean isApplicationModuleExists(String moduleId) throws AppCatalogException {
- try {
- AppModuleResource resource = new AppModuleResource();
- return resource.isExists(moduleId);
- }catch (Exception e){
- logger.error("Error while checking app module existence "+moduleId, e);
- throw new AppCatalogException(e);
- }
- }
-
- @Override
- public List<InputDataObjectType> getApplicationInputs(String interfaceId) throws AppCatalogException {
- try {
- ApplicationInputResource resource = new ApplicationInputResource();
- List<Resource> resources = resource.get(AbstractResource.AppInputConstants.INTERFACE_ID, interfaceId);
- return AppCatalogThriftConversion.getAppInputs(resources);
- }catch (Exception e){
- logger.error("Error while retrieving app inputs for application "+interfaceId, e);
- throw new AppCatalogException(e);
- }
- }
-
- @Override
- public List<OutputDataObjectType> getApplicationOutputs(String interfaceId) throws AppCatalogException {
- try {
- ApplicationOutputResource resource = new ApplicationOutputResource();
- List<Resource> resources = resource.get(AbstractResource.AppOutputConstants.INTERFACE_ID, interfaceId);
- return AppCatalogThriftConversion.getAppOutputs(resources);
- }catch (Exception e){
- logger.error("Error while retrieving app outputs for application "+interfaceId, e);
- throw new AppCatalogException(e);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/impl/ComputeResourceImpl.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/impl/ComputeResourceImpl.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/impl/ComputeResourceImpl.java
deleted file mode 100644
index 11ba727..0000000
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/impl/ComputeResourceImpl.java
+++ /dev/null
@@ -1,888 +0,0 @@
-/*
- *
- * 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.aiaravata.application.catalog.data.impl;
-
-import java.util.*;
-
-import org.airavata.appcatalog.cpi.AppCatalogException;
-import org.airavata.appcatalog.cpi.ComputeResource;
-import org.apache.aiaravata.application.catalog.data.resources.*;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogThriftConversion;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogUtils;
-import org.apache.airavata.model.appcatalog.computeresource.*;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class ComputeResourceImpl implements ComputeResource {
- private final static Logger logger = LoggerFactory.getLogger(ComputeResourceImpl.class);
-
- @Override
- public String addComputeResource(ComputeResourceDescription description) throws AppCatalogException {
- try {
- if (description.getComputeResourceId().equals("") || description.getComputeResourceId().equals(computeResourceModelConstants.DEFAULT_ID)){
- description.setComputeResourceId(AppCatalogUtils.getID(description.getHostName()));
- }
- return saveComputeResourceDescriptorData(description);
- } catch (Exception e) {
- logger.error("Error while saving compute resource...", e);
- throw new AppCatalogException(e);
- }
- }
-
- protected String saveComputeResourceDescriptorData(
- ComputeResourceDescription description) throws AppCatalogException {
- //TODO remove existing one
- ComputeResourceResource computeHostResource = saveComputeResource(description);
- saveHostAliases(description, computeHostResource);
- saveIpAddresses(description, computeHostResource);
- saveBatchQueues(description, computeHostResource);
- saveFileSystems(description, computeHostResource);
- saveJobSubmissionInterfaces(description, computeHostResource);
- saveDataMovementInterfaces(description, computeHostResource);
- return computeHostResource.getResourceId();
- }
-
- protected ComputeResourceResource saveComputeResource(
- ComputeResourceDescription description) throws AppCatalogException {
- ComputeResourceResource computeHostResource = AppCatalogThriftConversion.getComputeHostResource(description);
- computeHostResource.save();
- return computeHostResource;
- }
-
- protected void saveDataMovementInterfaces(
- ComputeResourceDescription description,
- ComputeResourceResource computeHostResource)
- throws AppCatalogException {
- List<DataMovementInterface> dataMovemenetInterfaces = description.getDataMovementInterfaces();
- if (dataMovemenetInterfaces != null && !dataMovemenetInterfaces.isEmpty()) {
- for (DataMovementInterface dataMovementInterface : dataMovemenetInterfaces) {
- DataMovementInterfaceResource dmir = AppCatalogThriftConversion.getDataMovementInterface(dataMovementInterface);
- dmir.setComputeHostResource(computeHostResource);
- dmir.setComputeResourceId(computeHostResource.getResourceId());
- dmir.save();
- }
- }
- }
-
- protected void saveJobSubmissionInterfaces(
- ComputeResourceDescription description,
- ComputeResourceResource computeHostResource)
- throws AppCatalogException {
- List<JobSubmissionInterface> jobSubmissionInterfaces = description.getJobSubmissionInterfaces();
- if (jobSubmissionInterfaces != null && !jobSubmissionInterfaces.isEmpty()) {
- for (JobSubmissionInterface jobSubmissionInterface : jobSubmissionInterfaces) {
- JobSubmissionInterfaceResource jsir = AppCatalogThriftConversion.getJobSubmissionInterface(jobSubmissionInterface);
- jsir.setComputeHostResource(computeHostResource);
- jsir.setComputeResourceId(computeHostResource.getResourceId());
- jsir.save();
- }
- }
- }
-
- protected void saveFileSystems(ComputeResourceDescription description,
- ComputeResourceResource computeHostResource)
- throws AppCatalogException {
- Map<FileSystems, String> fileSystems = description.getFileSystems();
- if (fileSystems != null && !fileSystems.isEmpty()) {
- for (FileSystems key : fileSystems.keySet()) {
- ComputeResourceFileSystemResource computeResourceFileSystemResource = new ComputeResourceFileSystemResource();
- computeResourceFileSystemResource.setComputeHostResource(computeHostResource);
- computeResourceFileSystemResource.setComputeResourceId(computeHostResource.getResourceId());
- computeResourceFileSystemResource.setFileSystem(key.toString());
- computeResourceFileSystemResource.setPath(fileSystems.get(key));
- computeResourceFileSystemResource.save();
- }
- }
- }
-
- protected void saveBatchQueues(ComputeResourceDescription description,
- ComputeResourceResource computeHostResource)
- throws AppCatalogException {
- List<BatchQueue> batchQueueList = description.getBatchQueues();
- if (batchQueueList != null && !batchQueueList.isEmpty()) {
- for (BatchQueue batchQueue : batchQueueList) {
- BatchQueueResource bq = AppCatalogThriftConversion.getBatchQueue(batchQueue);
- bq.setComputeResourceId(computeHostResource.getResourceId());
- bq.setComputeHostResource(computeHostResource);
- bq.save();
- }
- }
- }
-
- protected void saveIpAddresses(ComputeResourceDescription description,
- ComputeResourceResource computeHostResource)
- throws AppCatalogException {
- List<String> ipAddresses = description.getIpAddresses();
- HostIPAddressResource resource = new HostIPAddressResource();
- resource.remove(description.getComputeResourceId());
- if (ipAddresses != null && !ipAddresses.isEmpty()) {
- for (String ipAddress : ipAddresses) {
- HostIPAddressResource ipAddressResource = new HostIPAddressResource();
- ipAddressResource.setComputeHostResource(computeHostResource);
- ipAddressResource.setResourceID(computeHostResource.getResourceId());
- ipAddressResource.setIpaddress(ipAddress);
- ipAddressResource.save();
- }
- }
- }
-
- protected void saveHostAliases(ComputeResourceDescription description,
- ComputeResourceResource computeHostResource)
- throws AppCatalogException {
- List<String> hostAliases = description.getHostAliases();
- // delete previous host aliases
- HostAliasResource resource = new HostAliasResource();
- resource.remove(description.getComputeResourceId());
- if (hostAliases != null && !hostAliases.isEmpty()) {
- for (String alias : hostAliases) {
- HostAliasResource aliasResource = new HostAliasResource();
- aliasResource.setComputeHostResource(computeHostResource);
- aliasResource.setResourceID(computeHostResource.getResourceId());
- aliasResource.setAlias(alias);
- aliasResource.save();
- }
- }
- }
-
- @Override
- public void updateComputeResource(String computeResourceId, ComputeResourceDescription updatedComputeResource) throws AppCatalogException{
- try {
- saveComputeResourceDescriptorData(updatedComputeResource);
- } catch (Exception e) {
- logger.error("Error while updating compute resource...", e);
- throw new AppCatalogException(e);
- }
- }
-
- @Override
- public String addSSHJobSubmission(SSHJobSubmission sshJobSubmission) throws AppCatalogException {
- try {
- String submissionId = AppCatalogUtils.getID("SSH");
- sshJobSubmission.setJobSubmissionInterfaceId(submissionId);
- String resourceJobManagerId = addResourceJobManager(sshJobSubmission.getResourceJobManager());
- SshJobSubmissionResource resource = AppCatalogThriftConversion.getSSHJobSubmission(sshJobSubmission);
- resource.setResourceJobManagerId(resourceJobManagerId);
- resource.getResourceJobManagerResource().setResourceJobManagerId(resourceJobManagerId);
- if (sshJobSubmission.getMonitorMode() != null){
- resource.setMonitorMode(sshJobSubmission.getMonitorMode().toString());
- }
- resource.save();
- return submissionId;
- }catch (Exception e) {
- logger.error("Error while saving SSH Job Submission...", e);
- throw new AppCatalogException(e);
- }
- }
-
- @Override
- public String addCloudJobSubmission(CloudJobSubmission sshJobSubmission) throws AppCatalogException {
- try {
- sshJobSubmission.setJobSubmissionInterfaceId(AppCatalogUtils.getID("Cloud"));
- CloudSubmissionResource resource = AppCatalogThriftConversion.getCloudJobSubmission(sshJobSubmission);
- resource.save();
- return resource.getJobSubmissionInterfaceId();
- }catch (Exception e) {
- logger.error("Error while saving SSH Job Submission...", e);
- throw new AppCatalogException(e);
- }
- }
-
- @Override
- public String addUNICOREJobSubmission(UnicoreJobSubmission unicoreJobSubmission)
- throws AppCatalogException {
- try {
- unicoreJobSubmission.setJobSubmissionInterfaceId(AppCatalogUtils.getID("UNICORE"));
- UnicoreJobSubmissionResource resource = AppCatalogThriftConversion.getUnicoreJobSubmission(unicoreJobSubmission);
- resource.setUnicoreEndpointUrl(unicoreJobSubmission.getUnicoreEndPointURL());
- if (unicoreJobSubmission.getSecurityProtocol() != null){
- resource.setSecurityProtocol(unicoreJobSubmission.getSecurityProtocol().toString());
- }
- resource.save();
- return resource.getjobSubmissionInterfaceId();
- }catch (Exception e){
- logger.error("Error while retrieving SSH Job Submission...", e);
- throw new AppCatalogException(e);
- }
-
- }
-
- @Override
- public String addJobSubmissionProtocol(String computeResourceId, JobSubmissionInterface jobSubmissionInterface) throws AppCatalogException {
- try {
- JobSubmissionInterfaceResource jsi = AppCatalogThriftConversion.getJobSubmissionInterface(jobSubmissionInterface);
- jsi.setComputeResourceId(computeResourceId);
- ComputeResourceResource computeResourceResource = new ComputeResourceResource();
- computeResourceResource=(ComputeResourceResource)computeResourceResource.get(computeResourceId);
- jsi.setComputeHostResource(computeResourceResource);
- jsi.save();
- return jsi.getJobSubmissionInterfaceId();
- }catch (Exception e){
- logger.error("Error while saving "+jobSubmissionInterface.getJobSubmissionProtocol().toString()+" Job Submission Protocol...", e);
- throw new AppCatalogException(e);
- }
- }
-
-// @Override
-// public String addGSISSHJobSubmission(GSISSHJobSubmission gsisshJobSubmission) throws AppCatalogException {
-// try {
-// GSISSHSubmissionResource resource = new GSISSHSubmissionResource();
-// String hostName = "GSISSH";
-// resource.setDeploymentId(AppCatalogUtils.getID(hostName));
-// resource.setSshPort(resource.getSshPort());
-// resource.setResourceJobManager(gsisshJobSubmission.getResourceJobManager().toString());
-// resource.setInstalledPath(gsisshJobSubmission.getInstalledPath());
-// resource.setMonitorMode(gsisshJobSubmission.getMonitorMode());
-// resource.save();
-// gsisshJobSubmission.setJobSubmissionDataID(resource.getDeploymentId());
-//
-// Set<String> exports = gsisshJobSubmission.getExports();
-// if (exports != null && !exports.isEmpty()){
-// for (String export : exports){
-// GSISSHExportResource exportResource = new GSISSHExportResource();
-// exportResource.setDeploymentId(resource.getDeploymentId());
-// exportResource.setExport(export);
-// exportResource.setAppDeploymentResource(resource);
-// exportResource.save();
-// }
-// }
-//
-// List<String> preJobCommands = gsisshJobSubmission.getPreJobCommands();
-// if (preJobCommands != null && !preJobCommands.isEmpty()){
-// for (String command : preJobCommands){
-// GSISSHPreJobCommandResource commandResource = new GSISSHPreJobCommandResource();
-// commandResource.setDeploymentId(resource.getDeploymentId());
-// commandResource.setCommand(command);
-// commandResource.setAppDeploymentResource(resource);
-// commandResource.save();
-// }
-// }
-//
-// List<String> postJobCommands = gsisshJobSubmission.getPostJobCommands();
-// if (postJobCommands != null && !postJobCommands.isEmpty()){
-// for (String command : postJobCommands){
-// GSISSHPostJobCommandResource commandResource = new GSISSHPostJobCommandResource();
-// commandResource.setDeploymentId(resource.getDeploymentId());
-// commandResource.setCommand(command);
-// commandResource.setAppDeploymentResource(resource);
-// commandResource.save();
-// }
-// }
-// return resource.getDeploymentId();
-// }catch (Exception e) {
-// logger.error("Error while saving GSISSH Job Submission...", e);
-// throw new AppCatalogException(e);
-// }
-// }
-//
-// @Override
-// public void addGSISSHJobSubmissionProtocol(String computeResourceId, String jobSubmissionId) throws AppCatalogException {
-// try {
-// JobSubmissionProtocolResource resource = new JobSubmissionProtocolResource();
-// resource.setResourceID(computeResourceId);
-// resource.setDeploymentId(jobSubmissionId);
-// ComputeResourceDescription computeResource = getComputeResource(computeResourceId);
-// resource.setComputeHostResource(AppCatalogThriftConversion.getComputeHostResource(computeResource));
-// resource.setJobType(JobSubmissionProtocol.GSISSH.toString());
-// resource.save();
-// }catch (Exception e){
-// logger.error("Error while saving GSISSH Job Submission Protocol...", e);
-// throw new AppCatalogException(e);
-// }
-// }
-
- @Override
- public String addGlobusJobSubmission(GlobusJobSubmission globusJobSubmission) throws AppCatalogException {
-// try {
-// GlobusJobSubmissionResource resource = new GlobusJobSubmissionResource();
-// String hostName = "GLOBUS";
-// resource.setDeploymentId(AppCatalogUtils.getID(hostName));
-// resource.setSecurityProtocol(globusJobSubmission.getSecurityProtocol().toString());
-// resource.setResourceJobManager(globusJobSubmission.getResourceJobManager().toString());
-// resource.save();
-// globusJobSubmission.setJobSubmissionDataID(resource.getDeploymentId());
-// List<String> globusGateKeeperEndPoint = globusJobSubmission.getGlobusGateKeeperEndPoint();
-// if (globusGateKeeperEndPoint != null && !globusGateKeeperEndPoint.isEmpty()) {
-// for (String endpoint : globusGateKeeperEndPoint) {
-// GlobusGKEndpointResource endpointResource = new GlobusGKEndpointResource();
-// endpointResource.setDeploymentId(resource.getDeploymentId());
-// endpointResource.setEndpoint(endpoint);
-// endpointResource.setGlobusJobSubmissionResource(resource);
-// endpointResource.save();
-// }
-// }
-// return resource.getDeploymentId();
-// } catch (Exception e) {
-// logger.error("Error while saving Globus Job Submission...", e);
-// throw new AppCatalogException(e);
-// }
- return null;
- }
-
- @Override
- public String addScpDataMovement(SCPDataMovement scpDataMovement) throws AppCatalogException {
- try {
- scpDataMovement.setDataMovementInterfaceId(AppCatalogUtils.getID("SCP"));
- ScpDataMovementResource resource = AppCatalogThriftConversion.getSCPDataMovementDescription(scpDataMovement);
- resource.save();
- return resource.getDataMovementInterfaceId();
- }catch (Exception e){
- logger.error("Error while saving SCP Data Movement...", e);
- throw new AppCatalogException(e);
- }
- }
-
- @Override
- public String addUnicoreDataMovement(UnicoreDataMovement unicoreDataMovement) throws AppCatalogException {
- try {
- unicoreDataMovement.setDataMovementInterfaceId(AppCatalogUtils.getID("UNICORE"));
- UnicoreDataMovementResource resource = AppCatalogThriftConversion.getUnicoreDMResource(unicoreDataMovement);
- resource.save();
- return resource.getDataMovementId();
- }catch (Exception e){
- logger.error("Error while saving UNICORE Data Movement...", e);
- throw new AppCatalogException(e);
- }
- }
-
- @Override
- public String addDataMovementProtocol(String computeResourceId, DataMovementInterface dataMovementInterface) throws AppCatalogException {
- try {
- DataMovementInterfaceResource dmi = AppCatalogThriftConversion.getDataMovementInterface(dataMovementInterface);
- dmi.setComputeResourceId(computeResourceId);
- ComputeResourceResource computeResourceResource = new ComputeResourceResource();
- computeResourceResource=(ComputeResourceResource)computeResourceResource.get(computeResourceId);
- dmi.setComputeHostResource(computeResourceResource);
- dmi.save();
- return dmi.getDataMovementInterfaceId();
- }catch (Exception e){
- logger.error("Error while saving "+dataMovementInterface.getDataMovementProtocol().toString()+" data movement Protocol...", e);
- throw new AppCatalogException(e);
- }
- }
-
- @Override
- public String addGridFTPDataMovement(GridFTPDataMovement gridFTPDataMovement) throws AppCatalogException {
- try {
- gridFTPDataMovement.setDataMovementInterfaceId(AppCatalogUtils.getID("GRIDFTP"));
- GridftpDataMovementResource resource = AppCatalogThriftConversion.getGridFTPDataMovementDescription(gridFTPDataMovement);
- resource.save();
- List<String> gridFTPEndPoint = gridFTPDataMovement.getGridFTPEndPoints();
- if (gridFTPEndPoint != null && !gridFTPEndPoint.isEmpty()) {
- for (String endpoint : gridFTPEndPoint) {
- GridftpEndpointResource endpointResource = new GridftpEndpointResource();
- endpointResource.setDataMovementInterfaceId(resource.getDataMovementInterfaceId());
- endpointResource.setEndpoint(endpoint);
- endpointResource.setGridftpDataMovementResource(resource);
- endpointResource.save();
- }
- }
- return resource.getDataMovementInterfaceId();
- }catch (Exception e){
- logger.error("Error while saving GridFTP Data Movement...", e);
- throw new AppCatalogException(e);
- }
- }
-
- @Override
- public ComputeResourceDescription getComputeResource(String resourceId) throws AppCatalogException {
- try {
- ComputeResourceResource resource = new ComputeResourceResource();
- ComputeResourceResource computeResource = (ComputeResourceResource)resource.get(resourceId);
- return AppCatalogThriftConversion.getComputeHostDescription(computeResource);
- }catch (Exception e){
- logger.error("Error while retrieving compute resource...", e);
- throw new AppCatalogException(e);
- }
- }
-
- @Override
- public List<ComputeResourceDescription> getComputeResourceList(Map<String, String> filters) throws AppCatalogException {
- List<ComputeResourceDescription> computeResourceDescriptions = new ArrayList<ComputeResourceDescription>();
- try {
- //TODO check if this is correct way to do this
- ComputeResourceResource resource = new ComputeResourceResource();
- for (String fieldName : filters.keySet() ){
- if (fieldName.equals(AbstractResource.ComputeResourceConstants.HOST_NAME)){
- List<Resource> resources = resource.get(AbstractResource.ComputeResourceConstants.HOST_NAME, filters.get(fieldName));
- if (resources != null && !resources.isEmpty()){
- computeResourceDescriptions = AppCatalogThriftConversion.getComputeDescriptionList(resources);
- }
- }else {
- logger.error("Unsupported field name for compute resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported field name for compute resource.");
- }
- }
- }catch (Exception e){
- logger.error("Error while retrieving compute resource list...", e);
- throw new AppCatalogException(e);
- }
- return computeResourceDescriptions;
- }
-
- @Override
- public List<ComputeResourceDescription> getAllComputeResourceList() throws AppCatalogException {
- List<ComputeResourceDescription> computeResourceDescriptions = new ArrayList<ComputeResourceDescription>();
- try {
- ComputeResourceResource resource = new ComputeResourceResource();
- List<Resource> resources = resource.getAll();
- if (resources != null && !resources.isEmpty()){
- computeResourceDescriptions = AppCatalogThriftConversion.getComputeDescriptionList(resources);
- }
- }catch (Exception e){
- logger.error("Error while retrieving compute resource list...", e);
- throw new AppCatalogException(e);
- }
- return computeResourceDescriptions;
- }
-
- @Override
- public Map<String, String> getAllComputeResourceIdList() throws AppCatalogException {
- try {
- Map<String, String> computeResourceMap = new HashMap<String, String>();
- ComputeResourceResource resource = new ComputeResourceResource();
- List<Resource> allComputeResources = resource.getAll();
- if (allComputeResources != null && !allComputeResources.isEmpty()){
- for (Resource cm : allComputeResources){
- ComputeResourceResource cmr = (ComputeResourceResource)cm;
- computeResourceMap.put(cmr.getResourceId(), cmr.getHostName());
- }
- }
- return computeResourceMap;
- }catch (Exception e){
- logger.error("Error while retrieving compute resource list...", e);
- throw new AppCatalogException(e);
- }
- }
-
-// @Override
-// public GSISSHJobSubmission getGSISSHJobSubmission(String submissionId) throws AppCatalogException {
-// try {
-// GSISSHSubmissionResource resource = new GSISSHSubmissionResource();
-// GSISSHSubmissionResource submissionResource = (GSISSHSubmissionResource)resource.get(submissionId);
-// return AppCatalogThriftConversion.getGSISSHSubmissionDescription(submissionResource);
-// }catch (Exception e){
-// logger.error("Error while retrieving GSISSH Job Submission...", e);
-// throw new AppCatalogException(e);
-// }
-// }
-//
-// @Override
-// public List<GSISSHJobSubmission> getGSISSHJobSubmissionList(Map<String, String> filters) throws AppCatalogException {
-// try {
-// GSISSHSubmissionResource resource = new GSISSHSubmissionResource();
-// for (String fieldName : filters.keySet() ){
-// if (fieldName.equals(AbstractResource.GSISSHSubmissionConstants.RESOURCE_JOB_MANAGER)){
-// List<Resource> resources = resource.get(AbstractResource.GSISSHSubmissionConstants.RESOURCE_JOB_MANAGER, filters.get(fieldName));
-// if (resources != null && !resources.isEmpty()){
-// return AppCatalogThriftConversion.getGSISSHSubmissionList(resources);
-// }
-// }else {
-// logger.error("Unsupported field name for GSISSH Submission.", new IllegalArgumentException());
-// throw new IllegalArgumentException("Unsupported field name for GSISSH Submission.");
-// }
-// }
-// }catch (Exception e){
-// logger.error("Error while retrieving GSISSH Submission list...", e);
-// throw new AppCatalogException(e);
-// }
-// return null;
-// }
-//
-// @Override
-// public GlobusJobSubmission getGlobusJobSubmission(String submissionId) throws AppCatalogException {
-// try {
-// GlobusJobSubmissionResource globusJobSubmissionResource = new GlobusJobSubmissionResource();
-// globusJobSubmissionResource=(GlobusJobSubmissionResource)globusJobSubmissionResource.get(submissionId);
-// AppCatalogThriftConversion.getglo
-// GlobusJobSubmissionResource resource = globusJobSubmissionResource;
-// GlobusJobSubmissionResource submissionResource = (GlobusJobSubmissionResource)resource.get(submissionId);
-// return AppCatalogThriftConversion.getGlobusJobSubmissionDescription(submissionResource);
-// }catch (Exception e){
-// logger.error("Error while retrieving Globus Job Submission...", e);
-// throw new AppCatalogException(e);
-// }
-// }
-//
-// @Override
-// public List<GlobusJobSubmission> getGlobusJobSubmissionList(Map<String, String> filters) throws AppCatalogException {
-// try {
-// GlobusJobSubmissionResource resource = new GlobusJobSubmissionResource();
-// for (String fieldName : filters.keySet() ){
-// if (fieldName.equals(AbstractResource.GlobusJobSubmissionConstants.RESOURCE_JOB_MANAGER)){
-// List<Resource> resources = resource.get(AbstractResource.GlobusJobSubmissionConstants.RESOURCE_JOB_MANAGER, filters.get(fieldName));
-// if (resources != null && !resources.isEmpty()){
-// return AppCatalogThriftConversion.getGlobusSubmissionList(resources);
-// }
-// }else if (fieldName.equals(AbstractResource.GlobusJobSubmissionConstants.SECURITY_PROTOCAL)){
-// List<Resource> resources = resource.get(AbstractResource.GlobusJobSubmissionConstants.SECURITY_PROTOCAL, filters.get(fieldName));
-// if (resources != null && !resources.isEmpty()){
-// return AppCatalogThriftConversion.getGlobusSubmissionList(resources);
-// }
-// }else {
-// logger.error("Unsupported field name for Globus Submission.", new IllegalArgumentException());
-// throw new IllegalArgumentException("Unsupported field name for Globus Submission.");
-// }
-// }
-// }catch (Exception e){
-// logger.error("Error while retrieving Globus Submission list...", e);
-// throw new AppCatalogException(e);
-// }
-// return null;
-// }
-
- @Override
- public SSHJobSubmission getSSHJobSubmission(String submissionId) throws AppCatalogException {
- try {
- SshJobSubmissionResource resource = new SshJobSubmissionResource();
- resource = (SshJobSubmissionResource)resource.get(submissionId);
- return AppCatalogThriftConversion.getSSHJobSubmissionDescription(resource);
- }catch (Exception e){
- logger.error("Error while retrieving SSH Job Submission...", e);
- throw new AppCatalogException(e);
- }
- }
-
- // @Override
- // public List<GridFTPDataMovement> getGridFTPDataMovementList(Map<String, String> filters) throws AppCatalogException {
- // try {
- // GridftpDataMovementResource resource = new GridftpDataMovementResource();
- // for (String fieldName : filters.keySet() ){
- // if (fieldName.equals(AbstractResource.GridFTPDataMovementConstants.SECURITY_PROTOCOL)){
- // List<Resource> resources = resource.get(AbstractResource.GridFTPDataMovementConstants.SECURITY_PROTOCOL, filters.get(fieldName));
- // if (resources != null && !resources.isEmpty()){
- // return AppCatalogThriftConversion.getGridFTPDataMovementList(resources);
- // }
- // }else {
- // logger.error("Unsupported field name for GridFTP Data movement.", new IllegalArgumentException());
- // throw new IllegalArgumentException("Unsupported field name for GridFTP Data movement.");
- // }
- // }
- // }catch (Exception e){
- // logger.error("Error while retrieving GridFTP Data movement list...", e);
- // throw new AppCatalogException(e);
- // }
- // return null;
- // }
-
- @Override
- public UnicoreJobSubmission getUNICOREJobSubmission(String submissionId)
- throws AppCatalogException {
- try {
- UnicoreJobSubmissionResource resource = new UnicoreJobSubmissionResource();
- resource = (UnicoreJobSubmissionResource)resource.get(submissionId);
- return AppCatalogThriftConversion.getUnicoreJobSubmissionDescription(resource);
- }catch (Exception e){
- logger.error("Error while retrieving UNICORE Job Submission model instance...", e);
- throw new AppCatalogException(e);
- }
- }
-
- @Override
- public UnicoreDataMovement getUNICOREDataMovement(String dataMovementId)
- throws AppCatalogException {
- try {
- UnicoreDataMovementResource resource = new UnicoreDataMovementResource();
- resource = (UnicoreDataMovementResource)resource.get(dataMovementId);
- return AppCatalogThriftConversion.getUnicoreDMDescription(resource);
- }catch (Exception e){
- logger.error("Error while retrieving UNICORE data movement...", e);
- throw new AppCatalogException(e);
- }
- }
-
- @Override
- public CloudJobSubmission getCloudJobSubmission(String submissionId) throws AppCatalogException {
- try {
- CloudSubmissionResource resource = new CloudSubmissionResource();
- resource = (CloudSubmissionResource)resource.get(submissionId);
- return AppCatalogThriftConversion.getCloudJobSubmissionDescription(resource);
- }catch (Exception e){
- logger.error("Error while retrieving SSH Job Submission...", e);
- throw new AppCatalogException(e);
- }
- }
-//
-// @Override
-// public List<SSHJobSubmission> getSSHJobSubmissionList(Map<String, String> filters) throws AppCatalogException {
-// try {
-// SshJobSubmissionResource resource = new SshJobSubmissionResource();
-// for (String fieldName : filters.keySet() ){
-// if (fieldName.equals(AbstractResource.SSHSubmissionConstants.RESOURCE_JOB_MANAGER)){
-// List<Resource> resources = resource.get(AbstractResource.SSHSubmissionConstants.RESOURCE_JOB_MANAGER, filters.get(fieldName));
-// if (resources != null && !resources.isEmpty()){
-// return AppCatalogThriftConversion.getSSHSubmissionList(resources);
-// }
-// }else {
-// logger.error("Unsupported field name for SSH Submission.", new IllegalArgumentException());
-// throw new IllegalArgumentException("Unsupported field name for SSH Submission.");
-// }
-// }
-// }catch (Exception e){
-// logger.error("Error while retrieving SSH Submission list...", e);
-// throw new AppCatalogException(e);
-// }
-// return null;
-// }
-
- @Override
- public SCPDataMovement getSCPDataMovement(String dataMoveId) throws AppCatalogException {
- try {
- ScpDataMovementResource resource = new ScpDataMovementResource();
- ScpDataMovementResource dataMovementResource = (ScpDataMovementResource)resource.get(dataMoveId);
- return AppCatalogThriftConversion.getSCPDataMovementDescription(dataMovementResource);
- }catch (Exception e){
- logger.error("Error while retrieving SCP Data Movement...", e);
- throw new AppCatalogException(e);
- }
- }
-
-// @Override
-// public List<SCPDataMovement> getSCPDataMovementList(Map<String, String> filters) throws AppCatalogException {
-// try {
-// ScpDataMovementResource resource = new ScpDataMovementResource();
-// for (String fieldName : filters.keySet() ){
-// if (fieldName.equals(AbstractResource.SCPDataMovementConstants.SECURITY_PROTOCOL)){
-// List<Resource> resources = resource.get(AbstractResource.SCPDataMovementConstants.SECURITY_PROTOCOL, filters.get(fieldName));
-// if (resources != null && !resources.isEmpty()){
-// return AppCatalogThriftConversion.getSCPDataMovementList(resources);
-// }
-// }else {
-// logger.error("Unsupported field name for SCP Data movement.", new IllegalArgumentException());
-// throw new IllegalArgumentException("Unsupported field name for SCP Data movement.");
-// }
-// }
-// }catch (Exception e){
-// logger.error("Error while retrieving SCP Data movement list...", e);
-// throw new AppCatalogException(e);
-// }
-// return null;
-// }
-
- @Override
- public GridFTPDataMovement getGridFTPDataMovement(String dataMoveId) throws AppCatalogException {
- try {
- GridftpDataMovementResource resource = new GridftpDataMovementResource();
- GridftpDataMovementResource dataMovementResource = (GridftpDataMovementResource)resource.get(dataMoveId);
- return AppCatalogThriftConversion.getGridFTPDataMovementDescription(dataMovementResource);
- }catch (Exception e){
- logger.error("Error while retrieving Grid FTP Data Movement...", e);
- throw new AppCatalogException(e);
- }
- }
-
-// @Override
-// public List<GridFTPDataMovement> getGridFTPDataMovementList(Map<String, String> filters) throws AppCatalogException {
-// try {
-// GridftpDataMovementResource resource = new GridftpDataMovementResource();
-// for (String fieldName : filters.keySet() ){
-// if (fieldName.equals(AbstractResource.GridFTPDataMovementConstants.SECURITY_PROTOCOL)){
-// List<Resource> resources = resource.get(AbstractResource.GridFTPDataMovementConstants.SECURITY_PROTOCOL, filters.get(fieldName));
-// if (resources != null && !resources.isEmpty()){
-// return AppCatalogThriftConversion.getGridFTPDataMovementList(resources);
-// }
-// }else {
-// logger.error("Unsupported field name for GridFTP Data movement.", new IllegalArgumentException());
-// throw new IllegalArgumentException("Unsupported field name for GridFTP Data movement.");
-// }
-// }
-// }catch (Exception e){
-// logger.error("Error while retrieving GridFTP Data movement list...", e);
-// throw new AppCatalogException(e);
-// }
-// return null;
-// }
-
- @Override
- public boolean isComputeResourceExists(String resourceId) throws AppCatalogException {
- try {
- ComputeResourceResource resource = new ComputeResourceResource();
- return resource.isExists(resourceId);
- }catch (Exception e){
- logger.error("Error while retrieving compute resource...", e);
- throw new AppCatalogException(e);
- }
- }
-
- @Override
- public void removeComputeResource(String resourceId) throws AppCatalogException {
- try {
- ComputeResourceResource resource = new ComputeResourceResource();
- resource.remove(resourceId);
- }catch (Exception e){
- logger.error("Error while removing compute resource...", e);
- throw new AppCatalogException(e);
- }
- }
-
- @Override
- public void removeJobSubmissionInterface(String computeResourceId, String jobSubmissionInterfaceId) throws AppCatalogException {
- try {
- JobSubmissionInterfaceResource resource = new JobSubmissionInterfaceResource();
- Map<String, String> ids = new HashMap<String, String>();
- ids.put(AbstractResource.JobSubmissionInterfaceConstants.COMPUTE_RESOURCE_ID, computeResourceId);
- ids.put(AbstractResource.JobSubmissionInterfaceConstants.JOB_SUBMISSION_INTERFACE_ID, jobSubmissionInterfaceId);
- resource.remove(ids);
- }catch (Exception e){
- logger.error("Error while removing job submission interface..", e);
- throw new AppCatalogException(e);
- }
- }
-
- @Override
- public void removeDataMovementInterface(String computeResourceId, String dataMovementInterfaceId) throws AppCatalogException {
- try {
- DataMovementInterfaceResource resource = new DataMovementInterfaceResource();
- Map<String, String> ids = new HashMap<String, String>();
- ids.put(AbstractResource.DataMovementInterfaceConstants.COMPUTE_RESOURCE_ID, computeResourceId);
- ids.put(AbstractResource.DataMovementInterfaceConstants.DATA_MOVEMENT_INTERFACE_ID, dataMovementInterfaceId);
- resource.remove(ids);
- }catch (Exception e){
- logger.error("Error while removing data movement interface..", e);
- throw new AppCatalogException(e);
- }
- }
-
- @Override
- public void removeBatchQueue(String computeResourceId, String queueName) throws AppCatalogException {
- try {
- BatchQueueResource resource = new BatchQueueResource();
- Map<String, String> ids = new HashMap<String, String>();
- ids.put(AbstractResource.BatchQueueConstants.COMPUTE_RESOURCE_ID, computeResourceId);
- ids.put(AbstractResource.BatchQueueConstants.QUEUE_NAME, queueName);
- resource.remove(ids);
- }catch (Exception e){
- logger.error("Error while removing batch queue..", e);
- throw new AppCatalogException(e);
- }
- }
-
- @Override
- public String addResourceJobManager(ResourceJobManager resourceJobManager)
- throws AppCatalogException {
- resourceJobManager.setResourceJobManagerId(AppCatalogUtils.getID("RJM"));
- ResourceJobManagerResource resource = AppCatalogThriftConversion.getResourceJobManager(resourceJobManager);
- resource.save();
- Map<JobManagerCommand, String> jobManagerCommands = resourceJobManager.getJobManagerCommands();
- if (jobManagerCommands!=null && jobManagerCommands.size() != 0) {
- for (JobManagerCommand commandType : jobManagerCommands.keySet()) {
- JobManagerCommandResource r = new JobManagerCommandResource();
- r.setCommandType(commandType.toString());
- r.setCommand(jobManagerCommands.get(commandType));
- r.setResourceJobManagerId(resource.getResourceJobManagerId());
- r.save();
- }
- }
- return resource.getResourceJobManagerId();
- }
-
- @Override
- public void updateResourceJobManager(String resourceJobManagerId, ResourceJobManager updatedResourceJobManager) throws AppCatalogException {
- try {
- ResourceJobManagerResource resource = AppCatalogThriftConversion.getResourceJobManager(updatedResourceJobManager);
- resource.setResourceJobManagerId(resourceJobManagerId);
- resource.save();
- Map<JobManagerCommand, String> jobManagerCommands = updatedResourceJobManager.getJobManagerCommands();
- if (jobManagerCommands!=null && jobManagerCommands.size() != 0) {
- for (JobManagerCommand commandType : jobManagerCommands.keySet()) {
- JobManagerCommandResource r = new JobManagerCommandResource();
- Map<String, String> ids = new HashMap<String, String>();
- ids.put(AbstractResource.JobManagerCommandConstants.RESOURCE_JOB_MANAGER_ID, resourceJobManagerId);
- ids.put(AbstractResource.JobManagerCommandConstants.COMMAND_TYPE, commandType.toString());
- JobManagerCommandResource existingCommand;
- if (r.isExists(ids)){
- existingCommand = (JobManagerCommandResource)r.get(ids);
- }else {
- existingCommand = new JobManagerCommandResource();
- }
- existingCommand.setCommandType(commandType.toString());
- existingCommand.setCommand(jobManagerCommands.get(commandType));
- existingCommand.setResourceJobManagerId(resource.getResourceJobManagerId());
- existingCommand.save();
- }
- }
- }catch (Exception e){
- logger.error("Error while updating resource job manager..", e);
- throw new AppCatalogException(e);
- }
- }
-
- @Override
- public ResourceJobManager getResourceJobManager(String resourceJobManagerId) throws AppCatalogException {
- try {
- ResourceJobManagerResource resource = new ResourceJobManagerResource();
- ResourceJobManagerResource jobManagerResource = (ResourceJobManagerResource)resource.get(resourceJobManagerId);
- return AppCatalogThriftConversion.getResourceJobManager(jobManagerResource);
- }catch (Exception e){
- logger.error("Error while retrieving resource job manager..", e);
- throw new AppCatalogException(e);
- }
- }
-
- @Override
- public void deleteResourceJobManager(String resourceJobManagerId) throws AppCatalogException {
- try {
- ResourceJobManagerResource resource = new ResourceJobManagerResource();
- resource.remove(resourceJobManagerId);
- }catch (Exception e){
- logger.error("Error while deleting resource job manager..", e);
- throw new AppCatalogException(e);
- }
- }
-
- @Override
- public String addLocalJobSubmission(LOCALSubmission localSubmission)
- throws AppCatalogException {
- localSubmission.setJobSubmissionInterfaceId(AppCatalogUtils.getID("LOCAL"));
- String resourceJobManagerId = addResourceJobManager(localSubmission.getResourceJobManager());
- LocalSubmissionResource localJobSubmission = AppCatalogThriftConversion.getLocalJobSubmission(localSubmission);
- localJobSubmission.setResourceJobManagerId(resourceJobManagerId);
- localJobSubmission.getResourceJobManagerResource().setResourceJobManagerId(resourceJobManagerId);
- localJobSubmission.save();
- return localJobSubmission.getJobSubmissionInterfaceId();
- }
-
- @Override
- public String addLocalDataMovement(LOCALDataMovement localDataMovement)
- throws AppCatalogException {
- localDataMovement.setDataMovementInterfaceId(AppCatalogUtils.getID("LOCAL"));
- LocalDataMovementResource ldm = AppCatalogThriftConversion.getLocalDataMovement(localDataMovement);
- ldm.save();
- return ldm.getDataMovementInterfaceId();
- }
-
- @Override
- public LOCALSubmission getLocalJobSubmission(String submissionId)
- throws AppCatalogException {
- LocalSubmissionResource localSubmissionResource = new LocalSubmissionResource();
- localSubmissionResource= (LocalSubmissionResource)localSubmissionResource.get(submissionId);
- return AppCatalogThriftConversion.getLocalJobSubmission(localSubmissionResource);
- }
-
- @Override
- public LOCALDataMovement getLocalDataMovement(String datamovementId)
- throws AppCatalogException {
- LocalDataMovementResource localDataMovementResource = new LocalDataMovementResource();
- localDataMovementResource = (LocalDataMovementResource) localDataMovementResource.get(datamovementId);
- return AppCatalogThriftConversion.getLocalDataMovement(localDataMovementResource);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/impl/GwyResourceProfileImpl.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/impl/GwyResourceProfileImpl.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/impl/GwyResourceProfileImpl.java
deleted file mode 100644
index 4537efd..0000000
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/impl/GwyResourceProfileImpl.java
+++ /dev/null
@@ -1,252 +0,0 @@
-/*
- *
- * 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.aiaravata.application.catalog.data.impl;
-
-import org.airavata.appcatalog.cpi.AppCatalogException;
-import org.airavata.appcatalog.cpi.GwyResourceProfile;
-import org.apache.aiaravata.application.catalog.data.resources.*;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogThriftConversion;
-import org.apache.airavata.model.appcatalog.gatewayprofile.ComputeResourcePreference;
-import org.apache.airavata.model.appcatalog.gatewayprofile.GatewayResourceProfile;
-import org.apache.airavata.model.appcatalog.gatewayprofile.gatewayResourceProfileModelConstants;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-public class GwyResourceProfileImpl implements GwyResourceProfile {
- private final static Logger logger = LoggerFactory.getLogger(GwyResourceProfileImpl.class);
-
- @Override
- public String addGatewayResourceProfile(org.apache.airavata.model.appcatalog.gatewayprofile.GatewayResourceProfile gatewayProfile) throws AppCatalogException {
- try {
- GatewayProfileResource profileResource = new GatewayProfileResource();
- if (!gatewayProfile.getGatewayID().equals("") && !gatewayProfile.getGatewayID().equals(gatewayResourceProfileModelConstants.DEFAULT_ID)){
- profileResource.setGatewayID(gatewayProfile.getGatewayID());
- }
-// profileResource.setGatewayID(gatewayProfile.getGatewayID());
- profileResource.save();
- List<ComputeResourcePreference> computeResourcePreferences = gatewayProfile.getComputeResourcePreferences();
- if (computeResourcePreferences != null && !computeResourcePreferences.isEmpty()){
- for (ComputeResourcePreference preference : computeResourcePreferences ){
- ComputeHostPreferenceResource resource = new ComputeHostPreferenceResource();
- resource.setGatewayProfile(profileResource);
- resource.setResourceId(preference.getComputeResourceId());
- ComputeResourceResource computeHostResource = new ComputeResourceResource();
- resource.setComputeHostResource((ComputeResourceResource)computeHostResource.get(preference.getComputeResourceId()));
- resource.setGatewayId(profileResource.getGatewayID());
- resource.setOverrideByAiravata(preference.isOverridebyAiravata());
- resource.setLoginUserName(preference.getLoginUserName());
- if (preference.getPreferredJobSubmissionProtocol() != null){
- resource.setPreferredJobProtocol(preference.getPreferredJobSubmissionProtocol().toString());
- }
-
- if (preference.getPreferredDataMovementProtocol() != null){
- resource.setPreferedDMProtocol(preference.getPreferredDataMovementProtocol().toString());
- }
-
- resource.setBatchQueue(preference.getPreferredBatchQueue());
- resource.setProjectNumber(preference.getAllocationProjectNumber());
- resource.setScratchLocation(preference.getScratchLocation());
- resource.save();
- }
- }
- return profileResource.getGatewayID();
- }catch (Exception e) {
- logger.error("Error while saving gateway profile...", e);
- throw new AppCatalogException(e);
- }
- }
-
- @Override
- public void updateGatewayResourceProfile(String gatewayId, org.apache.airavata.model.appcatalog.gatewayprofile.GatewayResourceProfile updatedProfile) throws AppCatalogException {
- try {
- GatewayProfileResource profileResource = new GatewayProfileResource();
- GatewayProfileResource existingGP = (GatewayProfileResource)profileResource.get(gatewayId);
- existingGP.save();
-
- List<ComputeResourcePreference> computeResourcePreferences = updatedProfile.getComputeResourcePreferences();
- if (computeResourcePreferences != null && !computeResourcePreferences.isEmpty()){
- for (ComputeResourcePreference preference : computeResourcePreferences ){
- ComputeHostPreferenceResource resource = new ComputeHostPreferenceResource();
- resource.setGatewayProfile(existingGP);
- resource.setResourceId(preference.getComputeResourceId());
- ComputeResourceResource computeHostResource = new ComputeResourceResource();
- resource.setComputeHostResource((ComputeResourceResource)computeHostResource.get(preference.getComputeResourceId()));
- resource.setGatewayId(gatewayId);
- resource.setLoginUserName(preference.getLoginUserName());
- resource.setOverrideByAiravata(preference.isOverridebyAiravata());
- if (preference.getPreferredJobSubmissionProtocol() != null){
- resource.setPreferredJobProtocol(preference.getPreferredJobSubmissionProtocol().toString());
- }
-
- if (preference.getPreferredDataMovementProtocol() != null){
- resource.setPreferedDMProtocol(preference.getPreferredDataMovementProtocol().toString());
- }
- resource.setBatchQueue(preference.getPreferredBatchQueue());
- resource.setProjectNumber(preference.getAllocationProjectNumber());
- resource.setScratchLocation(preference.getScratchLocation());
- resource.save();
- }
- }
- }catch (Exception e) {
- logger.error("Error while updating gateway profile...", e);
- throw new AppCatalogException(e);
- }
- }
-
- @Override
- public GatewayResourceProfile getGatewayProfile(String gatewayId) throws AppCatalogException {
- try {
- GatewayProfileResource resource = new GatewayProfileResource();
- GatewayProfileResource gwresource = (GatewayProfileResource)resource.get(gatewayId);
- ComputeHostPreferenceResource prefResource = new ComputeHostPreferenceResource();
- List<Resource> computePrefList = prefResource.get(AbstractResource.ComputeResourcePreferenceConstants.GATEWAY_ID, gatewayId);
- List<ComputeResourcePreference> computeResourcePreferences = AppCatalogThriftConversion.getComputeResourcePreferences(computePrefList);
- return AppCatalogThriftConversion.getGatewayResourceProfile(gwresource, computeResourcePreferences);
- }catch (Exception e) {
- logger.error("Error while retrieving gateway profile...", e);
- throw new AppCatalogException(e);
- }
- }
-
- @Override
- public boolean removeGatewayResourceProfile(String gatewayId) throws AppCatalogException {
- try {
- GatewayProfileResource resource = new GatewayProfileResource();
- resource.remove(gatewayId);
- return true;
- }catch (Exception e) {
- logger.error("Error while deleting gateway profile...", e);
- throw new AppCatalogException(e);
- }
- }
-
- @Override
- public boolean removeComputeResourcePreferenceFromGateway(String gatewayId, String preferenceId) throws AppCatalogException {
- try {
- ComputeHostPreferenceResource resource = new ComputeHostPreferenceResource();
- Map<String, String> ids = new HashMap<String, String>();
- ids.put(AbstractResource.ComputeResourcePreferenceConstants.GATEWAY_ID, gatewayId);
- ids.put(AbstractResource.ComputeResourcePreferenceConstants.RESOURCE_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();
- return resource.isExists(gatewayId);
- }catch (Exception e) {
- logger.error("Error while retrieving gateway profile...", e);
- throw new AppCatalogException(e);
- }
- }
-
- /**
- * @param gatewayId
- * @param hostId
- * @return ComputeResourcePreference
- */
- @Override
- public ComputeResourcePreference getComputeResourcePreference(String gatewayId, String hostId) throws AppCatalogException {
- try {
- ComputeHostPreferenceResource prefResource = new ComputeHostPreferenceResource();
- List<Resource> computePrefList = prefResource.get(AbstractResource.ComputeResourcePreferenceConstants.GATEWAY_ID, gatewayId);
- for (Resource resource : computePrefList){
- ComputeHostPreferenceResource cmP = (ComputeHostPreferenceResource) resource;
- if (cmP.getResourceId() != null && !cmP.getResourceId().equals("")){
- if (cmP.getResourceId().equals(hostId)){
- return AppCatalogThriftConversion.getComputeResourcePreference(cmP);
- }
- }
- }
- }catch (Exception e) {
- logger.error("Error while retrieving compute resource preference...", e);
- throw new AppCatalogException(e);
- }
- return null;
- }
-
- /**
- * @param gatewayId
- * @return
- */
- @Override
- public List<ComputeResourcePreference> getAllComputeResourcePreferences(String gatewayId) throws AppCatalogException {
- try {
- ComputeHostPreferenceResource prefResource = new ComputeHostPreferenceResource();
- List<Resource> computePrefList = prefResource.get(AbstractResource.ComputeResourcePreferenceConstants.GATEWAY_ID, gatewayId);
- return AppCatalogThriftConversion.getComputeResourcePreferences(computePrefList);
- }catch (Exception e) {
- logger.error("Error while retrieving compute resource preference...", e);
- throw new AppCatalogException(e);
- }
- }
-
- @Override
- public List<String> getGatewayProfileIds(String gatewayName) throws AppCatalogException {
- try {
- GatewayProfileResource profileResource = new GatewayProfileResource();
- List<Resource> resourceList = profileResource.get(AbstractResource.GatewayProfileConstants.GATEWAY_ID, gatewayName);
- List<String> gatewayIds = new ArrayList<String>();
- if (resourceList != null && !resourceList.isEmpty()){
- for (Resource resource : resourceList){
- gatewayIds.add(((GatewayProfileResource)resource).getGatewayID());
- }
- }
- return gatewayIds;
- }catch (Exception e) {
- logger.error("Error while retrieving gateway ids...", e);
- throw new AppCatalogException(e);
- }
- }
-
- @Override
- public List<GatewayResourceProfile> getAllGatewayProfiles() throws AppCatalogException {
- try {
- List<GatewayResourceProfile> gatewayResourceProfileList = new ArrayList<GatewayResourceProfile>();
- GatewayProfileResource profileResource = new GatewayProfileResource();
- List<Resource> resourceList = profileResource.getAll();
- if (resourceList != null && !resourceList.isEmpty()){
- for (Resource resource : resourceList){
- GatewayProfileResource gatewayProfileResource = (GatewayProfileResource)resource;
- List<ComputeResourcePreference> computeResourcePreferences = getAllComputeResourcePreferences(gatewayProfileResource.getGatewayID());
- GatewayResourceProfile gatewayResourceProfile = AppCatalogThriftConversion.getGatewayResourceProfile(gatewayProfileResource, computeResourcePreferences);
- gatewayResourceProfileList.add(gatewayResourceProfile);
- }
- }
- return gatewayResourceProfileList;
- }catch (Exception e) {
- logger.error("Error while retrieving gateway ids...", e);
- throw new AppCatalogException(e);
- }
- }
-}
[41/52] [abbrv] [partial] airavata git commit: registry refactoring
Posted by sh...@apache.org.
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/HostIPAddressResource.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/HostIPAddressResource.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/HostIPAddressResource.java
deleted file mode 100644
index 683efec..0000000
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/HostIPAddressResource.java
+++ /dev/null
@@ -1,318 +0,0 @@
-/**
- * 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.aiaravata.application.catalog.data.resources;
-
-import org.airavata.appcatalog.cpi.AppCatalogException;
-import org.apache.aiaravata.application.catalog.data.model.ComputeResource;
-import org.apache.aiaravata.application.catalog.data.model.HostIPAddress;
-import org.apache.aiaravata.application.catalog.data.model.HostIPAddressPK;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogJPAUtils;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogQueryGenerator;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogResourceType;
-import org.apache.airavata.common.exception.ApplicationSettingsException;
-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 HostIPAddressResource extends AbstractResource{
-
- private final static Logger logger = LoggerFactory.getLogger(HostIPAddressResource.class);
-
- private String resourceID;
- private String ipaddress;
- private ComputeResourceResource computeHostResource;
-
- public void remove(Object identifier) throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator= new AppCatalogQueryGenerator(HOST_IPADDRESS);
- generator.setParameter(HostIPAddressConstants.RESOURCE_ID, identifier);
- 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();
- }
- }
-
- }
-
- public Resource 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(HOST_IPADDRESS);
- generator.setParameter(HostIPAddressConstants.RESOURCE_ID, ids.get(HostIPAddressConstants.RESOURCE_ID));
- generator.setParameter(HostIPAddressConstants.IP_ADDRESS, ids.get(HostIPAddressConstants.IP_ADDRESS));
- Query q = generator.selectQuery(em);
- HostIPAddress hostIPAddress = (HostIPAddress) q.getSingleResult();
- HostIPAddressResource hostIPAddressResource =
- (HostIPAddressResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.HOST_IPADDRESS, hostIPAddress);
- em.getTransaction().commit();
- em.close();
- return hostIPAddressResource;
- } 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();
- }
- }
- }
-
- public List<Resource> get(String fieldName, Object value) throws AppCatalogException {
-
- List<Resource> hostIPAddressResources = new ArrayList<Resource>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- Query q;
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(HOST_IPADDRESS);
- List results;
- if (fieldName.equals(HostIPAddressConstants.IP_ADDRESS)) {
- generator.setParameter(HostIPAddressConstants.IP_ADDRESS, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- HostIPAddress hostIPAddress = (HostIPAddress) result;
- HostIPAddressResource hostIPAddressResource =
- (HostIPAddressResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.HOST_IPADDRESS, hostIPAddress);
- hostIPAddressResources.add(hostIPAddressResource);
- }
- }
- } else if (fieldName.equals(HostIPAddressConstants.RESOURCE_ID)) {
- generator.setParameter(HostIPAddressConstants.RESOURCE_ID, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- HostIPAddress hostIPAddress = (HostIPAddress) result;
- HostIPAddressResource hostIPAddressResource =
- (HostIPAddressResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.HOST_IPADDRESS, hostIPAddress);
- hostIPAddressResources.add(hostIPAddressResource);
- }
- }
- } else {
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported field name for Host IPAddress Resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported field name for Host IPAddress 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 hostIPAddressResources;
- }
-
- @Override
- public List<Resource> getAll() throws AppCatalogException {
- return null;
- }
-
- @Override
- public List<String> getAllIds() throws AppCatalogException {
- return null;
- }
-
- public List<String> getIds(String fieldName, Object value) throws AppCatalogException {
-
- List<String> hostIPAddressResourceIDs = new ArrayList<String>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- Query q;
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(HOST_IPADDRESS);
- List results;
- if (fieldName.equals(HostIPAddressConstants.IP_ADDRESS)) {
- generator.setParameter(HostIPAddressConstants.IP_ADDRESS, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- HostIPAddress hostIPAddress = (HostIPAddress) result;
- hostIPAddressResourceIDs.add(hostIPAddress.getResourceID());
- }
- }
- } else if (fieldName.equals(HostIPAddressConstants.RESOURCE_ID)) {
- generator.setParameter(HostIPAddressConstants.RESOURCE_ID, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- HostIPAddress hostIPAddress = (HostIPAddress) result;
- hostIPAddressResourceIDs.add(hostIPAddress.getResourceID());
- }
- }
- } else {
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported field name for Host IP Address resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported field name for Host IPAddress 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 hostIPAddressResourceIDs;
- }
-
- public void save() throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- HostIPAddress existingHostIP = em.find(HostIPAddress.class, new HostIPAddressPK(resourceID,ipaddress));
- em.close();
-
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- ComputeResource computeResource = em.find(ComputeResource.class, resourceID);
- if (existingHostIP != null){
- existingHostIP.setIpaddress(ipaddress);
- existingHostIP.setResourceID(resourceID);
- existingHostIP.setComputeResource(computeResource);
- em.merge(existingHostIP);
- }else {
- HostIPAddress hostIPAddress = new HostIPAddress();
- hostIPAddress.setIpaddress(ipaddress);
- hostIPAddress.setResourceID(resourceID);
- hostIPAddress.setComputeResource(computeResource);
- em.persist(hostIPAddress);
- }
- 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();
- }
- }
-
- }
-
- 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();
- HostIPAddress hostIPAddress = em.find(HostIPAddress.class, new HostIPAddressPK(ids.get(HostIPAddressConstants.RESOURCE_ID),
- ids.get(HostIPAddressConstants.IP_ADDRESS)));
-
- em.close();
- return hostIPAddress != null;
- } 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();
- }
- }
- }
-
- public String getResourceID() {
- return resourceID;
- }
-
- public void setResourceID(String resourceID) {
- this.resourceID = resourceID;
- }
-
- public String getIpaddress() {
- return ipaddress;
- }
-
- public void setIpaddress(String ipaddress) {
- this.ipaddress = ipaddress;
- }
-
- public ComputeResourceResource getComputeHostResource() {
- return computeHostResource;
- }
-
- public void setComputeHostResource(ComputeResourceResource computeHostResource) {
- this.computeHostResource = computeHostResource;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/JobManagerCommandResource.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/JobManagerCommandResource.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/JobManagerCommandResource.java
deleted file mode 100644
index e177cd3..0000000
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/JobManagerCommandResource.java
+++ /dev/null
@@ -1,307 +0,0 @@
-/*
- *
- * 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.aiaravata.application.catalog.data.resources;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.persistence.EntityManager;
-import javax.persistence.Query;
-
-import org.airavata.appcatalog.cpi.AppCatalogException;
-import org.apache.aiaravata.application.catalog.data.model.JobManagerCommand;
-import org.apache.aiaravata.application.catalog.data.model.JobManagerCommand_PK;
-import org.apache.aiaravata.application.catalog.data.model.ResourceJobManager;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogJPAUtils;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogQueryGenerator;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogResourceType;
-import org.apache.airavata.common.exception.ApplicationSettingsException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class JobManagerCommandResource extends AbstractResource {
- private final static Logger logger = LoggerFactory.getLogger(JobManagerCommandResource.class);
- private String resourceJobManagerId;
- private ResourceJobManagerResource resourceJobManagerResource;
- private String commandType;
- private String command;
-
- @Override
- public void remove(Object identifier) throws AppCatalogException {
- HashMap<String, String> ids;
- if (identifier instanceof Map) {
- ids = (HashMap<String, String>) 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(JOB_MANAGER_COMMAND);
- generator.setParameter(JobManagerCommandConstants.RESOURCE_JOB_MANAGER_ID, ids.get(JobManagerCommandConstants.RESOURCE_JOB_MANAGER_ID));
- generator.setParameter(JobManagerCommandConstants.COMMAND_TYPE, ids.get(JobManagerCommandConstants.COMMAND_TYPE));
- 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 Resource get(Object identifier) throws AppCatalogException {
- HashMap<String, String> ids;
- if (identifier instanceof Map) {
- ids = (HashMap<String, String>) 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(JOB_MANAGER_COMMAND);
- generator.setParameter(JobManagerCommandConstants.RESOURCE_JOB_MANAGER_ID, ids.get(JobManagerCommandConstants.RESOURCE_JOB_MANAGER_ID));
- generator.setParameter(JobManagerCommandConstants.COMMAND_TYPE, ids.get(JobManagerCommandConstants.COMMAND_TYPE));
- Query q = generator.selectQuery(em);
- JobManagerCommand jobManagerCommand = (JobManagerCommand) q.getSingleResult();
- JobManagerCommandResource jobManagerCommandResource = (JobManagerCommandResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.JOB_MANAGER_COMMAND, jobManagerCommand);
- em.getTransaction().commit();
- em.close();
- return jobManagerCommandResource;
- } 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<Resource> get(String fieldName, Object value) throws AppCatalogException {
- List<Resource> jobManagerCommandResources = new ArrayList<Resource>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(JOB_MANAGER_COMMAND);
- Query q;
- if ((fieldName.equals(JobManagerCommandConstants.RESOURCE_JOB_MANAGER_ID)) || (fieldName.equals(JobManagerCommandConstants.COMMAND_TYPE)) || (fieldName.equals(JobManagerCommandConstants.COMMAND))) {
- generator.setParameter(fieldName, value);
- q = generator.selectQuery(em);
- List<?> results = q.getResultList();
- for (Object result : results) {
- JobManagerCommand jobManagerCommand = (JobManagerCommand) result;
- JobManagerCommandResource jobManagerCommandResource = (JobManagerCommandResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.JOB_MANAGER_COMMAND, jobManagerCommand);
- jobManagerCommandResources.add(jobManagerCommandResource);
- }
- } else {
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported field name for Job Manager Command Resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported field name for Job Manager Command Resource.");
- }
- 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();
- }
- }
- return jobManagerCommandResources;
- }
-
- @Override
- public List<Resource> 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 {
- List<String> jobManagerCommandResourceIDs = new ArrayList<String>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(JOB_MANAGER_COMMAND);
- Query q;
- if ((fieldName.equals(JobManagerCommandConstants.RESOURCE_JOB_MANAGER_ID)) || (fieldName.equals(JobManagerCommandConstants.COMMAND_TYPE)) || (fieldName.equals(JobManagerCommandConstants.COMMAND))) {
- generator.setParameter(fieldName, value);
- q = generator.selectQuery(em);
- List<?> results = q.getResultList();
- for (Object result : results) {
- JobManagerCommand jobManagerCommand = (JobManagerCommand) result;
- JobManagerCommandResource jobManagerCommandResource = (JobManagerCommandResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.JOB_MANAGER_COMMAND, jobManagerCommand);
- jobManagerCommandResourceIDs.add(jobManagerCommandResource.getResourceJobManagerId());
- }
- } else {
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported field name for Job Manager Command Resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported field name for Job Manager Command Resource.");
- }
- 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();
- }
- }
- return jobManagerCommandResourceIDs;
- }
-
- @Override
- public void save() throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- JobManagerCommand existingJobManagerCommand = em.find(JobManagerCommand.class, new JobManagerCommand_PK(resourceJobManagerId, commandType));
- em.close();
- JobManagerCommand jobManagerCommand;
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- if (existingJobManagerCommand == null) {
- jobManagerCommand = new JobManagerCommand();
- } else {
- jobManagerCommand = existingJobManagerCommand;
- }
- jobManagerCommand.setResourceJobManagerId(getResourceJobManagerId());
- ResourceJobManager resourceJobManager = em.find(ResourceJobManager.class, getResourceJobManagerId());
- jobManagerCommand.setResourceJobManager(resourceJobManager);
- jobManagerCommand.setCommandType(getCommandType());
- jobManagerCommand.setCommand(getCommand());
- if (existingJobManagerCommand == null) {
- em.persist(jobManagerCommand);
- } else {
- em.merge(jobManagerCommand);
- }
- 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<String, String>) 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();
- JobManagerCommand jobManagerCommand = em.find(JobManagerCommand.class, new JobManagerCommand_PK(ids.get(JobManagerCommandConstants.RESOURCE_JOB_MANAGER_ID), ids.get(JobManagerCommandConstants.COMMAND_TYPE)));
- em.close();
- return jobManagerCommand != null;
- } 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();
- }
- }
- }
-
- public String getResourceJobManagerId() {
- return resourceJobManagerId;
- }
-
- public ResourceJobManagerResource getResourceJobManagerResource() {
- return resourceJobManagerResource;
- }
-
- public String getCommandType() {
- return commandType;
- }
-
- public String getCommand() {
- return command;
- }
-
- public void setResourceJobManagerId(String resourceJobManagerId) {
- this.resourceJobManagerId=resourceJobManagerId;
- }
-
- public void setResourceJobManagerResource(ResourceJobManagerResource resourceJobManagerResource) {
- this.resourceJobManagerResource=resourceJobManagerResource;
- }
-
- public void setCommandType(String commandType) {
- this.commandType=commandType;
- }
-
- public void setCommand(String command) {
- this.command=command;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/JobSubmissionInterfaceResource.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/JobSubmissionInterfaceResource.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/JobSubmissionInterfaceResource.java
deleted file mode 100644
index a5acbef..0000000
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/JobSubmissionInterfaceResource.java
+++ /dev/null
@@ -1,339 +0,0 @@
-/*
- *
- * 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.aiaravata.application.catalog.data.resources;
-
-import java.sql.Timestamp;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.persistence.EntityManager;
-import javax.persistence.Query;
-
-import org.airavata.appcatalog.cpi.AppCatalogException;
-import org.apache.aiaravata.application.catalog.data.model.ComputeResource;
-import org.apache.aiaravata.application.catalog.data.model.JobSubmissionInterface;
-import org.apache.aiaravata.application.catalog.data.model.JobSubmissionInterface_PK;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogJPAUtils;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogQueryGenerator;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogResourceType;
-import org.apache.airavata.common.exception.ApplicationSettingsException;
-import org.apache.airavata.common.utils.AiravataUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class JobSubmissionInterfaceResource extends AbstractResource {
- private final static Logger logger = LoggerFactory.getLogger(JobSubmissionInterfaceResource.class);
- private String jobSubmissionInterfaceId;
- private String computeResourceId;
- private ComputeResourceResource computeHostResource;
- private String jobSubmissionProtocol;
- private int priorityOrder;
- private Timestamp createdTime;
- private Timestamp updatedTime;
-
- public Timestamp getCreatedTime() {
- return createdTime;
- }
-
- public void setCreatedTime(Timestamp createdTime) {
- this.createdTime = createdTime;
- }
-
- public Timestamp getUpdatedTime() {
- return updatedTime;
- }
-
- public void setUpdatedTime(Timestamp updatedTime) {
- this.updatedTime = updatedTime;
- }
-
- @Override
- public void remove(Object identifier) throws AppCatalogException {
- HashMap<String, String> ids;
- if (identifier instanceof Map) {
- ids = (HashMap<String, String>) 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(JOB_SUBMISSION_INTERFACE);
- generator.setParameter(JobSubmissionInterfaceConstants.JOB_SUBMISSION_INTERFACE_ID, ids.get(JobSubmissionInterfaceConstants.JOB_SUBMISSION_INTERFACE_ID));
- generator.setParameter(JobSubmissionInterfaceConstants.COMPUTE_RESOURCE_ID, ids.get(JobSubmissionInterfaceConstants.COMPUTE_RESOURCE_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 Resource get(Object identifier) throws AppCatalogException {
- HashMap<String, String> ids;
- if (identifier instanceof Map) {
- ids = (HashMap<String, String>) 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(JOB_SUBMISSION_INTERFACE);
- generator.setParameter(JobSubmissionInterfaceConstants.JOB_SUBMISSION_INTERFACE_ID, ids.get(JobSubmissionInterfaceConstants.JOB_SUBMISSION_INTERFACE_ID));
- generator.setParameter(JobSubmissionInterfaceConstants.COMPUTE_RESOURCE_ID, ids.get(JobSubmissionInterfaceConstants.COMPUTE_RESOURCE_ID));
- Query q = generator.selectQuery(em);
- JobSubmissionInterface jobSubmissionInterface = (JobSubmissionInterface) q.getSingleResult();
- JobSubmissionInterfaceResource jobSubmissionInterfaceResource = (JobSubmissionInterfaceResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.JOB_SUBMISSION_INTERFACE, jobSubmissionInterface);
- em.getTransaction().commit();
- em.close();
- return jobSubmissionInterfaceResource;
- } 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<Resource> get(String fieldName, Object value) throws AppCatalogException {
- List<Resource> jobSubmissionInterfaceResources = new ArrayList<Resource>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(JOB_SUBMISSION_INTERFACE);
- Query q;
- if ((fieldName.equals(JobSubmissionInterfaceConstants.JOB_SUBMISSION_INTERFACE_ID)) || (fieldName.equals(JobSubmissionInterfaceConstants.COMPUTE_RESOURCE_ID)) || (fieldName.equals(JobSubmissionInterfaceConstants.JOB_SUBMISSION_PROTOCOL)) || (fieldName.equals(JobSubmissionInterfaceConstants.PRIORITY_ORDER))) {
- generator.setParameter(fieldName, value);
- q = generator.selectQuery(em);
- List<?> results = q.getResultList();
- for (Object result : results) {
- JobSubmissionInterface jobSubmissionInterface = (JobSubmissionInterface) result;
- JobSubmissionInterfaceResource jobSubmissionInterfaceResource = (JobSubmissionInterfaceResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.JOB_SUBMISSION_INTERFACE, jobSubmissionInterface);
- jobSubmissionInterfaceResources.add(jobSubmissionInterfaceResource);
- }
- } else {
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported field name for Job Submission Interface Resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported field name for Job Submission Interface Resource.");
- }
- 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();
- }
- }
- return jobSubmissionInterfaceResources;
- }
-
- @Override
- public List<Resource> 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 {
- List<String> jobSubmissionInterfaceResourceIDs = new ArrayList<String>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(JOB_SUBMISSION_INTERFACE);
- Query q;
- if ((fieldName.equals(JobSubmissionInterfaceConstants.JOB_SUBMISSION_INTERFACE_ID)) || (fieldName.equals(JobSubmissionInterfaceConstants.COMPUTE_RESOURCE_ID)) || (fieldName.equals(JobSubmissionInterfaceConstants.JOB_SUBMISSION_PROTOCOL)) || (fieldName.equals(JobSubmissionInterfaceConstants.PRIORITY_ORDER))) {
- generator.setParameter(fieldName, value);
- q = generator.selectQuery(em);
- List<?> results = q.getResultList();
- for (Object result : results) {
- JobSubmissionInterface jobSubmissionInterface = (JobSubmissionInterface) result;
- JobSubmissionInterfaceResource jobSubmissionInterfaceResource = (JobSubmissionInterfaceResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.JOB_SUBMISSION_INTERFACE, jobSubmissionInterface);
- jobSubmissionInterfaceResourceIDs.add(jobSubmissionInterfaceResource.getComputeResourceId());
- }
- } else {
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported field name for Job Submission Interface Resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported field name for Job Submission Interface Resource.");
- }
- 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();
- }
- }
- return jobSubmissionInterfaceResourceIDs;
- }
-
- @Override
- public void save() throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- JobSubmissionInterface existingJobSubmissionInterface = em.find(JobSubmissionInterface.class, new JobSubmissionInterface_PK(jobSubmissionInterfaceId, computeResourceId));
- em.close();
- JobSubmissionInterface jobSubmissionInterface;
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- if (existingJobSubmissionInterface == null) {
- jobSubmissionInterface = new JobSubmissionInterface();
- jobSubmissionInterface.setCreationTime(AiravataUtils.getCurrentTimestamp());
- } else {
- jobSubmissionInterface = existingJobSubmissionInterface;
- jobSubmissionInterface.setUpdateTime(AiravataUtils.getCurrentTimestamp());
- }
- jobSubmissionInterface.setJobSubmissionInterfaceId(getJobSubmissionInterfaceId());
- jobSubmissionInterface.setComputeResourceId(getComputeResourceId());
- ComputeResource computeResource = em.find(ComputeResource.class, getComputeResourceId());
- jobSubmissionInterface.setComputeResource(computeResource);
- jobSubmissionInterface.setJobSubmissionProtocol(getJobSubmissionProtocol());
- jobSubmissionInterface.setPriorityOrder(getPriorityOrder());
- if (existingJobSubmissionInterface == null) {
- em.persist(jobSubmissionInterface);
- } else {
- em.merge(jobSubmissionInterface);
- }
- 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<String, String>) 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();
- JobSubmissionInterface jobSubmissionInterface = em.find(JobSubmissionInterface.class, new JobSubmissionInterface_PK(ids.get(JobSubmissionInterfaceConstants.JOB_SUBMISSION_INTERFACE_ID), ids.get(JobSubmissionInterfaceConstants.COMPUTE_RESOURCE_ID)));
- em.close();
- return jobSubmissionInterface != null;
- } 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();
- }
- }
- }
-
- public String getJobSubmissionInterfaceId() {
- return jobSubmissionInterfaceId;
- }
-
- public String getComputeResourceId() {
- return computeResourceId;
- }
-
- public ComputeResourceResource getComputeHostResource() {
- return computeHostResource;
- }
-
- public String getJobSubmissionProtocol() {
- return jobSubmissionProtocol;
- }
-
- public int getPriorityOrder() {
- return priorityOrder;
- }
-
- public void setJobSubmissionInterfaceId(String jobSubmissionInterfaceId) {
- this.jobSubmissionInterfaceId=jobSubmissionInterfaceId;
- }
-
- public void setComputeResourceId(String computeResourceId) {
- this.computeResourceId=computeResourceId;
- }
-
- public void setComputeHostResource(ComputeResourceResource computeHostResource) {
- this.computeHostResource=computeHostResource;
- }
-
- public void setJobSubmissionProtocol(String jobSubmissionProtocol) {
- this.jobSubmissionProtocol=jobSubmissionProtocol;
- }
-
- public void setPriorityOrder(int priorityOrder) {
- this.priorityOrder=priorityOrder;
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/JobSubmissionProtocolResource.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/JobSubmissionProtocolResource.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/JobSubmissionProtocolResource.java
deleted file mode 100644
index d6134af..0000000
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/JobSubmissionProtocolResource.java
+++ /dev/null
@@ -1,359 +0,0 @@
-///**
-// * 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.aiaravata.application.catalog.data.resources;
-//
-//import org.airavata.appcatalog.cpi.AppCatalogException;
-//import org.apache.aiaravata.application.catalog.data.model.ComputeResource;
-//import org.apache.aiaravata.application.catalog.data.model.JobSubmissionProtocol;
-//import org.apache.aiaravata.application.catalog.data.model.JobSubmissionProtocolPK;
-//import org.apache.aiaravata.application.catalog.data.util.AppCatalogJPAUtils;
-//import org.apache.aiaravata.application.catalog.data.util.AppCatalogQueryGenerator;
-//import org.apache.aiaravata.application.catalog.data.util.AppCatalogResourceType;
-//import org.apache.airavata.common.exception.ApplicationSettingsException;
-//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 JobSubmissionProtocolResource extends AbstractResource {
-//
-// private final static Logger logger = LoggerFactory.getLogger(JobSubmissionProtocolResource.class);
-//
-// private String resourceID;
-// private String submissionID;
-// private String jobType;
-// private ComputeResourceResource computeHostResource;
-//
-// 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(JOB_SUBMISSION_PROTOCOL);
-// generator.setParameter(JobSubmissionProtocolConstants.RESOURCE_ID, ids.get(JobSubmissionProtocolConstants.RESOURCE_ID));
-// generator.setParameter(JobSubmissionProtocolConstants.SUBMISSION_ID, ids.get(JobSubmissionProtocolConstants.SUBMISSION_ID));
-// generator.setParameter(JobSubmissionProtocolConstants.JOB_TYPE, ids.get(JobSubmissionProtocolConstants.JOB_TYPE));
-// 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();
-// }
-// }
-// }
-//
-// public Resource 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(JOB_SUBMISSION_PROTOCOL);
-// generator.setParameter(JobSubmissionProtocolConstants.RESOURCE_ID, ids.get(JobSubmissionProtocolConstants.RESOURCE_ID));
-// generator.setParameter(JobSubmissionProtocolConstants.SUBMISSION_ID, ids.get(JobSubmissionProtocolConstants.SUBMISSION_ID));
-// generator.setParameter(JobSubmissionProtocolConstants.JOB_TYPE, ids.get(JobSubmissionProtocolConstants.JOB_TYPE));
-// Query q = generator.selectQuery(em);
-// JobSubmissionProtocol jobSubmissionProtocol = (JobSubmissionProtocol) q.getSingleResult();
-// JobSubmissionProtocolResource jobSubmissionProtocolResource =
-// (JobSubmissionProtocolResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.JOB_SUBMISSION_PROTOCOL, jobSubmissionProtocol);
-// em.getTransaction().commit();
-// em.close();
-// return jobSubmissionProtocolResource;
-// } 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();
-// }
-// }
-// }
-//
-// public List<Resource> get(String fieldName, Object value) throws AppCatalogException {
-// List<Resource> jobSubmissionProtocolResourceList = new ArrayList<Resource>();
-// EntityManager em = null;
-// try {
-// em = AppCatalogJPAUtils.getEntityManager();
-// em.getTransaction().begin();
-// Query q;
-// AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(JOB_SUBMISSION_PROTOCOL);
-// List results;
-// if (fieldName.equals(JobSubmissionProtocolConstants.SUBMISSION_ID)) {
-// generator.setParameter(JobSubmissionProtocolConstants.SUBMISSION_ID, value);
-// q = generator.selectQuery(em);
-// results = q.getResultList();
-// if (results.size() != 0) {
-// for (Object result : results) {
-// JobSubmissionProtocol jobSubmissionProtocol = (JobSubmissionProtocol) result;
-// JobSubmissionProtocolResource jobSubmissionProtocolResource =
-// (JobSubmissionProtocolResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.JOB_SUBMISSION_PROTOCOL, jobSubmissionProtocol);
-// jobSubmissionProtocolResourceList.add(jobSubmissionProtocolResource);
-// }
-// }
-// } else if (fieldName.equals(JobSubmissionProtocolConstants.JOB_TYPE)) {
-// generator.setParameter(JobSubmissionProtocolConstants.JOB_TYPE, value);
-// q = generator.selectQuery(em);
-// results = q.getResultList();
-// if (results.size() != 0) {
-// for (Object result : results) {
-// JobSubmissionProtocol jobSubmissionProtocol = (JobSubmissionProtocol) result;
-// JobSubmissionProtocolResource jobSubmissionProtocolResource =
-// (JobSubmissionProtocolResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.JOB_SUBMISSION_PROTOCOL, jobSubmissionProtocol);
-// jobSubmissionProtocolResourceList.add(jobSubmissionProtocolResource);
-// }
-// }
-// } else if (fieldName.equals(HostIPAddressConstants.RESOURCE_ID)) {
-// generator.setParameter(HostIPAddressConstants.RESOURCE_ID, value);
-// q = generator.selectQuery(em);
-// results = q.getResultList();
-// if (results.size() != 0) {
-// for (Object result : results) {
-// JobSubmissionProtocol jobSubmissionProtocol = (JobSubmissionProtocol) result;
-// JobSubmissionProtocolResource jobSubmissionProtocolResource =
-// (JobSubmissionProtocolResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.JOB_SUBMISSION_PROTOCOL, jobSubmissionProtocol);
-// jobSubmissionProtocolResourceList.add(jobSubmissionProtocolResource);
-// }
-// }
-// } else {
-// em.getTransaction().commit();
-// em.close();
-// logger.error("Unsupported field name for Job Submission Protocol Resource.", new IllegalArgumentException());
-// throw new IllegalArgumentException("Unsupported field name for Job Submission Protocol 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 jobSubmissionProtocolResourceList;
-// }
-//
-// @Override
-// public List<Resource> getAll() throws AppCatalogException {
-// return null;
-// }
-//
-// @Override
-// public List<String> getAllIds() throws AppCatalogException {
-// return null;
-// }
-//
-// public List<String> getIds(String fieldName, Object value) throws AppCatalogException {
-// List<String> jobSubmissionProtocolIDs = new ArrayList<String>();
-// EntityManager em = null;
-// try {
-// em = AppCatalogJPAUtils.getEntityManager();
-// em.getTransaction().begin();
-// Query q;
-// AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(JOB_SUBMISSION_PROTOCOL);
-// List results;
-// if (fieldName.equals(JobSubmissionProtocolConstants.SUBMISSION_ID)) {
-// generator.setParameter(JobSubmissionProtocolConstants.SUBMISSION_ID, value);
-// q = generator.selectQuery(em);
-// results = q.getResultList();
-// if (results.size() != 0) {
-// for (Object result : results) {
-// JobSubmissionProtocol jobSubmissionProtocol = (JobSubmissionProtocol) result;
-// jobSubmissionProtocolIDs.add(jobSubmissionProtocol.getSubmissionID());
-// }
-// }
-// } else if (fieldName.equals(JobSubmissionProtocolConstants.RESOURCE_ID)) {
-// generator.setParameter(JobSubmissionProtocolConstants.RESOURCE_ID, value);
-// q = generator.selectQuery(em);
-// results = q.getResultList();
-// if (results.size() != 0) {
-// for (Object result : results) {
-// JobSubmissionProtocol jobSubmissionProtocol = (JobSubmissionProtocol) result;
-// jobSubmissionProtocolIDs.add(jobSubmissionProtocol.getSubmissionID());
-// }
-// }
-// } else if (fieldName.equals(JobSubmissionProtocolConstants.JOB_TYPE)) {
-// generator.setParameter(JobSubmissionProtocolConstants.JOB_TYPE, value);
-// q = generator.selectQuery(em);
-// results = q.getResultList();
-// if (results.size() != 0) {
-// for (Object result : results) {
-// JobSubmissionProtocol jobSubmissionProtocol = (JobSubmissionProtocol) result;
-// jobSubmissionProtocolIDs.add(jobSubmissionProtocol.getSubmissionID());
-// }
-// }
-// } else {
-// em.getTransaction().commit();
-// em.close();
-// logger.error("Unsupported field name for Job Submission Protocol resource.", new IllegalArgumentException());
-// throw new IllegalArgumentException("Unsupported field name for Job Submission Protocol 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 jobSubmissionProtocolIDs;
-// }
-//
-// public void save() throws AppCatalogException {
-// EntityManager em = null;
-// try {
-// em = AppCatalogJPAUtils.getEntityManager();
-// JobSubmissionProtocol existingJobSubProtocol = em.find(JobSubmissionProtocol.class, new JobSubmissionProtocolPK(resourceID, submissionID, jobType));
-// em.close();
-//
-// em = AppCatalogJPAUtils.getEntityManager();
-// em.getTransaction().begin();
-// ComputeResource computeResource = em.find(ComputeResource.class, resourceID);
-// if (existingJobSubProtocol != null) {
-// existingJobSubProtocol.setJobType(jobType);
-// existingJobSubProtocol.setSubmissionID(submissionID);
-// existingJobSubProtocol.setComputeResource(computeResource);
-// existingJobSubProtocol.setResourceID(resourceID);
-// em.merge(existingJobSubProtocol);
-// } else {
-// JobSubmissionProtocol jobSubmissionProtocol = new JobSubmissionProtocol();
-// jobSubmissionProtocol.setJobType(jobType);
-// jobSubmissionProtocol.setSubmissionID(submissionID);
-// jobSubmissionProtocol.setResourceID(resourceID);
-// jobSubmissionProtocol.setComputeResource(computeResource);
-// em.persist(jobSubmissionProtocol);
-// }
-// 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();
-// }
-// }
-//
-// }
-//
-// 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();
-// JobSubmissionProtocol jobSubmissionProtocol = em.find(JobSubmissionProtocol.class, new JobSubmissionProtocolPK(ids.get(JobSubmissionProtocolConstants.RESOURCE_ID),
-// ids.get(JobSubmissionProtocolConstants.SUBMISSION_ID), ids.get(JobSubmissionProtocolConstants.JOB_TYPE)));
-//
-// em.close();
-// return jobSubmissionProtocol != null;
-// } 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();
-// }
-// }
-// }
-//
-// public String getResourceID() {
-// return resourceID;
-// }
-//
-// public void setResourceID(String resourceID) {
-// this.resourceID = resourceID;
-// }
-//
-// public String getSubmissionID() {
-// return submissionID;
-// }
-//
-// public void setSubmissionID(String submissionID) {
-// this.submissionID = submissionID;
-// }
-//
-// public String getJobType() {
-// return jobType;
-// }
-//
-// public void setJobType(String jobType) {
-// this.jobType = jobType;
-// }
-//
-// public ComputeResourceResource getComputeHostResource() {
-// return computeHostResource;
-// }
-//
-// public void setComputeHostResource(ComputeResourceResource computeHostResource) {
-// this.computeHostResource = computeHostResource;
-// }
-//}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/LibraryApendPathResource.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/LibraryApendPathResource.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/LibraryApendPathResource.java
deleted file mode 100644
index 1f2286d..0000000
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/LibraryApendPathResource.java
+++ /dev/null
@@ -1,292 +0,0 @@
-/*
- *
- * 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.aiaravata.application.catalog.data.resources;
-
-import org.airavata.appcatalog.cpi.AppCatalogException;
-import org.apache.aiaravata.application.catalog.data.model.ApplicationDeployment;
-import org.apache.aiaravata.application.catalog.data.model.LibraryApendPath;
-import org.apache.aiaravata.application.catalog.data.model.LibraryApendPath_PK;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogJPAUtils;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogQueryGenerator;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogResourceType;
-import org.apache.airavata.common.exception.ApplicationSettingsException;
-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 LibraryApendPathResource extends AbstractResource {
- private final static Logger logger = LoggerFactory.getLogger(LibraryApendPathResource.class);
- private String deploymentId;
- private String name;
- private String value;
- private AppDeploymentResource appDeploymentResource;
-
- public String getDeploymentId() {
- return deploymentId;
- }
-
- public void setDeploymentId(String deploymentId) {
- this.deploymentId = deploymentId;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public String getValue() {
- return value;
- }
-
- public void setValue(String value) {
- this.value = value;
- }
-
- public AppDeploymentResource getAppDeploymentResource() {
- return appDeploymentResource;
- }
-
- public void setAppDeploymentResource(AppDeploymentResource appDeploymentResource) {
- this.appDeploymentResource = appDeploymentResource;
- }
-
- @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(LIBRARY_APEND_PATH);
- generator.setParameter(LibraryApendPathConstants.DEPLOYMENT_ID, ids.get(LibraryApendPathConstants.DEPLOYMENT_ID));
- if (ids.get(LibraryApendPathConstants.NAME) != null){
- generator.setParameter(LibraryApendPathConstants.NAME, ids.get(LibraryApendPathConstants.NAME));
- }
- 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 Resource 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(LIBRARY_APEND_PATH);
- generator.setParameter(LibraryApendPathConstants.DEPLOYMENT_ID, ids.get(LibraryApendPathConstants.DEPLOYMENT_ID));
- generator.setParameter(LibraryApendPathConstants.NAME, ids.get(LibraryApendPathConstants.NAME));
- Query q = generator.selectQuery(em);
- LibraryApendPath libraryApendPath = (LibraryApendPath) q.getSingleResult();
- LibraryApendPathResource resource =
- (LibraryApendPathResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.LIBRARY_APEND_PATH, libraryApendPath);
- em.getTransaction().commit();
- em.close();
- return resource;
- } 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<Resource> get(String fieldName, Object value) throws AppCatalogException {
- List<Resource> libApPathList = new ArrayList<Resource>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- Query q;
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(LIBRARY_APEND_PATH);
- List results;
- if (fieldName.equals(LibraryApendPathConstants.DEPLOYMENT_ID)) {
- generator.setParameter(LibraryApendPathConstants.DEPLOYMENT_ID, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- LibraryApendPath prepandPath = (LibraryApendPath) result;
- LibraryApendPathResource resource =
- (LibraryApendPathResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.LIBRARY_APEND_PATH, prepandPath);
- libApPathList.add(resource);
- }
- }
- } else if (fieldName.equals(LibraryApendPathConstants.NAME)) {
- generator.setParameter(LibraryApendPathConstants.NAME, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- LibraryApendPath prepandPath = (LibraryApendPath) result;
- LibraryApendPathResource resource =
- (LibraryApendPathResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.LIBRARY_APEND_PATH, prepandPath);
- libApPathList.add(resource);
- }
- }
- }else {
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported field name for libraryApendPath resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported field name for libraryApendPath 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 libApPathList;
- }
-
- @Override
- public List<Resource> 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();
- LibraryApendPath existigApendPath = em.find(LibraryApendPath.class, new LibraryApendPath_PK(deploymentId, name));
- em.close();
-
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
-
- ApplicationDeployment deployment = em.find(ApplicationDeployment.class, deploymentId);
- if (existigApendPath != null){
- existigApendPath.setValue(value);
- existigApendPath.setApplicationDeployment(deployment);
- em.merge(existigApendPath);
- }else {
- LibraryApendPath apendPath = new LibraryApendPath();
- apendPath.setDeploymentID(deploymentId);
- apendPath.setName(name);
- apendPath.setValue(value);
- apendPath.setApplicationDeployment(deployment);
- em.persist(apendPath);
- }
- 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();
- LibraryApendPath apendPath = em.find(LibraryApendPath.class,
- new LibraryApendPath_PK(ids.get(LibraryApendPathConstants.DEPLOYMENT_ID),
- ids.get(LibraryApendPathConstants.NAME)));
- em.close();
- return apendPath != null;
- } 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();
- }
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/LibraryPrepandPathResource.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/LibraryPrepandPathResource.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/LibraryPrepandPathResource.java
deleted file mode 100644
index e4a9b33..0000000
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/LibraryPrepandPathResource.java
+++ /dev/null
@@ -1,291 +0,0 @@
-/*
- *
- * 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.aiaravata.application.catalog.data.resources;
-
-import org.airavata.appcatalog.cpi.AppCatalogException;
-import org.apache.aiaravata.application.catalog.data.model.ApplicationDeployment;
-import org.apache.aiaravata.application.catalog.data.model.LibraryPrepandPath;
-import org.apache.aiaravata.application.catalog.data.model.LibraryPrepandPath_PK;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogJPAUtils;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogQueryGenerator;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogResourceType;
-import org.apache.airavata.common.exception.ApplicationSettingsException;
-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 LibraryPrepandPathResource extends AbstractResource {
- private final static Logger logger = LoggerFactory.getLogger(LibraryPrepandPathResource.class);
- private String deploymentId;
- private String name;
- private String value;
- private AppDeploymentResource appDeploymentResource;
-
- public String getDeploymentId() {
- return deploymentId;
- }
-
- public void setDeploymentId(String deploymentId) {
- this.deploymentId = deploymentId;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public String getValue() {
- return value;
- }
-
- public void setValue(String value) {
- this.value = value;
- }
-
- public AppDeploymentResource getAppDeploymentResource() {
- return appDeploymentResource;
- }
-
- public void setAppDeploymentResource(AppDeploymentResource appDeploymentResource) {
- this.appDeploymentResource = appDeploymentResource;
- }
-
- @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(LIBRARY_PREPAND_PATH);
- generator.setParameter(LibraryPrepandPathConstants.DEPLOYMENT_ID, ids.get(LibraryPrepandPathConstants.DEPLOYMENT_ID));
- if (ids.get(LibraryPrepandPathConstants.NAME) != null){
- generator.setParameter(LibraryPrepandPathConstants.NAME, ids.get(LibraryPrepandPathConstants.NAME));
- }
- 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 Resource 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(LIBRARY_PREPAND_PATH);
- generator.setParameter(LibraryPrepandPathConstants.DEPLOYMENT_ID, ids.get(LibraryPrepandPathConstants.DEPLOYMENT_ID));
- generator.setParameter(LibraryPrepandPathConstants.NAME, ids.get(LibraryPrepandPathConstants.NAME));
- Query q = generator.selectQuery(em);
- LibraryPrepandPath libraryPrepandPath = (LibraryPrepandPath) q.getSingleResult();
- LibraryPrepandPathResource resource =
- (LibraryPrepandPathResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.LIBRARY_PREPAND_PATH, libraryPrepandPath);
- em.getTransaction().commit();
- em.close();
- return resource;
- } 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<Resource> get(String fieldName, Object value) throws AppCatalogException {
- List<Resource> libPrepPathList = new ArrayList<Resource>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- Query q;
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(LIBRARY_PREPAND_PATH);
- List results;
- if (fieldName.equals(LibraryPrepandPathConstants.DEPLOYMENT_ID)) {
- generator.setParameter(LibraryPrepandPathConstants.DEPLOYMENT_ID, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- LibraryPrepandPath prepandPath = (LibraryPrepandPath) result;
- LibraryPrepandPathResource resource =
- (LibraryPrepandPathResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.LIBRARY_PREPAND_PATH, prepandPath);
- libPrepPathList.add(resource);
- }
- }
- } else if (fieldName.equals(LibraryPrepandPathConstants.NAME)) {
- generator.setParameter(LibraryPrepandPathConstants.NAME, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- LibraryPrepandPath prepandPath = (LibraryPrepandPath) result;
- LibraryPrepandPathResource resource =
- (LibraryPrepandPathResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.LIBRARY_PREPAND_PATH, prepandPath);
- libPrepPathList.add(resource);
- }
- }
- }else {
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported field name for libraryPrepandPath resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported field name for libraryPrepandPath 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 libPrepPathList;
- }
-
- @Override
- public List<Resource> 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();
- LibraryPrepandPath existigPrepPath = em.find(LibraryPrepandPath.class, new LibraryPrepandPath_PK(deploymentId, name));
- em.close();
-
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- ApplicationDeployment deployment = em.find(ApplicationDeployment.class, deploymentId);
- if (existigPrepPath != null){
- existigPrepPath.setValue(value);
- existigPrepPath.setApplicationDeployment(deployment);
- em.merge(existigPrepPath);
- }else {
- LibraryPrepandPath prepandPath = new LibraryPrepandPath();
- prepandPath.setDeploymentID(deploymentId);
- prepandPath.setName(name);
- prepandPath.setValue(value);
- prepandPath.setApplicationDeployment(deployment);
- em.persist(prepandPath);
- }
- 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();
- LibraryPrepandPath prepandPath = em.find(LibraryPrepandPath.class,
- new LibraryPrepandPath_PK(ids.get(LibraryPrepandPathConstants.DEPLOYMENT_ID),
- ids.get(LibraryPrepandPathConstants.NAME)));
- em.close();
- return prepandPath != null;
- } 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();
- }
- }
- }
-}
[13/52] [abbrv] [partial] airavata git commit: registry refactoring
Posted by sh...@apache.org.
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/ComputeResourceFileSystemAppCatalogResourceAppCat.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/ComputeResourceFileSystemAppCatalogResourceAppCat.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/ComputeResourceFileSystemAppCatalogResourceAppCat.java
new file mode 100644
index 0000000..5bf98e4
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/ComputeResourceFileSystemAppCatalogResourceAppCat.java
@@ -0,0 +1,307 @@
+/*
+ *
+ * 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 java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.persistence.EntityManager;
+import javax.persistence.Query;
+
+import org.apache.airavata.common.exception.ApplicationSettingsException;
+import org.apache.airavata.registry.core.app.catalog.model.ComputeResource;
+import org.apache.airavata.registry.core.app.catalog.model.ComputeResourceFileSystem;
+import org.apache.airavata.registry.core.app.catalog.model.ComputeResourceFileSystem_PK;
+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;
+
+public class ComputeResourceFileSystemAppCatalogResourceAppCat extends AppCatAbstractResource {
+ private final static Logger logger = LoggerFactory.getLogger(ComputeResourceFileSystemAppCatalogResourceAppCat.class);
+ private String computeResourceId;
+ private ComputeResourceAppCatalogResourceAppCat computeHostResource;
+ private String path;
+ private String fileSystem;
+
+ @Override
+ public void remove(Object identifier) throws AppCatalogException {
+ HashMap<String, String> ids;
+ if (identifier instanceof Map) {
+ ids = (HashMap<String, String>) 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(COMPUTE_RESOURCE_FILE_SYSTEM);
+ generator.setParameter(ComputeResourceFileSystemConstants.COMPUTE_RESOURCE_ID, ids.get(ComputeResourceFileSystemConstants.COMPUTE_RESOURCE_ID));
+ generator.setParameter(ComputeResourceFileSystemConstants.FILE_SYSTEM, ids.get(ComputeResourceFileSystemConstants.FILE_SYSTEM));
+ 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<String, String>) 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(COMPUTE_RESOURCE_FILE_SYSTEM);
+ generator.setParameter(ComputeResourceFileSystemConstants.COMPUTE_RESOURCE_ID, ids.get(ComputeResourceFileSystemConstants.COMPUTE_RESOURCE_ID));
+ generator.setParameter(ComputeResourceFileSystemConstants.FILE_SYSTEM, ids.get(ComputeResourceFileSystemConstants.FILE_SYSTEM));
+ Query q = generator.selectQuery(em);
+ ComputeResourceFileSystem computeResourceFileSystem = (ComputeResourceFileSystem) q.getSingleResult();
+ ComputeResourceFileSystemAppCatalogResourceAppCat computeResourceFileSystemResource = (ComputeResourceFileSystemAppCatalogResourceAppCat) AppCatalogJPAUtils.getResource(AppCatalogResourceType.COMPUTE_RESOURCE_FILE_SYSTEM, computeResourceFileSystem);
+ em.getTransaction().commit();
+ em.close();
+ return computeResourceFileSystemResource;
+ } 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> computeResourceFileSystemResources = new ArrayList<AppCatalogResource>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(COMPUTE_RESOURCE_FILE_SYSTEM);
+ Query q;
+ if ((fieldName.equals(ComputeResourceFileSystemConstants.COMPUTE_RESOURCE_ID)) || (fieldName.equals(ComputeResourceFileSystemConstants.PATH)) || (fieldName.equals(ComputeResourceFileSystemConstants.FILE_SYSTEM))) {
+ generator.setParameter(fieldName, value);
+ q = generator.selectQuery(em);
+ List<?> results = q.getResultList();
+ for (Object result : results) {
+ ComputeResourceFileSystem computeResourceFileSystem = (ComputeResourceFileSystem) result;
+ ComputeResourceFileSystemAppCatalogResourceAppCat computeResourceFileSystemResource = (ComputeResourceFileSystemAppCatalogResourceAppCat) AppCatalogJPAUtils.getResource(AppCatalogResourceType.COMPUTE_RESOURCE_FILE_SYSTEM, computeResourceFileSystem);
+ computeResourceFileSystemResources.add(computeResourceFileSystemResource);
+ }
+ } else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for Compute Resource File System Resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for Compute Resource File System Resource.");
+ }
+ 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();
+ }
+ }
+ return computeResourceFileSystemResources;
+ }
+
+ @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 {
+ List<String> computeResourceFileSystemResourceIDs = new ArrayList<String>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(COMPUTE_RESOURCE_FILE_SYSTEM);
+ Query q;
+ if ((fieldName.equals(ComputeResourceFileSystemConstants.COMPUTE_RESOURCE_ID)) || (fieldName.equals(ComputeResourceFileSystemConstants.PATH)) || (fieldName.equals(ComputeResourceFileSystemConstants.FILE_SYSTEM))) {
+ generator.setParameter(fieldName, value);
+ q = generator.selectQuery(em);
+ List<?> results = q.getResultList();
+ for (Object result : results) {
+ ComputeResourceFileSystem computeResourceFileSystem = (ComputeResourceFileSystem) result;
+ ComputeResourceFileSystemAppCatalogResourceAppCat computeResourceFileSystemResource = (ComputeResourceFileSystemAppCatalogResourceAppCat) AppCatalogJPAUtils.getResource(AppCatalogResourceType.COMPUTE_RESOURCE_FILE_SYSTEM, computeResourceFileSystem);
+ computeResourceFileSystemResourceIDs.add(computeResourceFileSystemResource.getComputeResourceId());
+ }
+ } else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for Compute Resource File System Resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for Compute Resource File System Resource.");
+ }
+ 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();
+ }
+ }
+ return computeResourceFileSystemResourceIDs;
+ }
+
+ @Override
+ public void save() throws AppCatalogException {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ ComputeResourceFileSystem existingComputeResourceFileSystem = em.find(ComputeResourceFileSystem.class, new ComputeResourceFileSystem_PK(computeResourceId, fileSystem));
+ em.close();
+ ComputeResourceFileSystem computeResourceFileSystem;
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ if (existingComputeResourceFileSystem == null) {
+ computeResourceFileSystem = new ComputeResourceFileSystem();
+ } else {
+ computeResourceFileSystem = existingComputeResourceFileSystem;
+ }
+ computeResourceFileSystem.setComputeResourceId(getComputeResourceId());
+ ComputeResource computeResource = em.find(ComputeResource.class, getComputeResourceId());
+ computeResourceFileSystem.setComputeResource(computeResource);
+ computeResourceFileSystem.setPath(getPath());
+ computeResourceFileSystem.setFileSystem(getFileSystem());
+ if (existingComputeResourceFileSystem == null) {
+ em.persist(computeResourceFileSystem);
+ } else {
+ em.merge(computeResourceFileSystem);
+ }
+ 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<String, String>) 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();
+ ComputeResourceFileSystem computeResourceFileSystem = em.find(ComputeResourceFileSystem.class, new ComputeResourceFileSystem_PK(ids.get(ComputeResourceFileSystemConstants.COMPUTE_RESOURCE_ID), ids.get(ComputeResourceFileSystemConstants.FILE_SYSTEM)));
+ em.close();
+ return computeResourceFileSystem != null;
+ } 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();
+ }
+ }
+ }
+
+ public String getComputeResourceId() {
+ return computeResourceId;
+ }
+
+ public ComputeResourceAppCatalogResourceAppCat getComputeHostResource() {
+ return computeHostResource;
+ }
+
+ public String getPath() {
+ return path;
+ }
+
+ public String getFileSystem() {
+ return fileSystem;
+ }
+
+ public void setComputeResourceId(String computeResourceId) {
+ this.computeResourceId=computeResourceId;
+ }
+
+ public void setComputeHostResource(ComputeResourceAppCatalogResourceAppCat computeHostResource) {
+ this.computeHostResource=computeHostResource;
+ }
+
+ public void setPath(String path) {
+ this.path=path;
+ }
+
+ public void setFileSystem(String fileSystem) {
+ this.fileSystem=fileSystem;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/ComputeResourceFileSystemResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/ComputeResourceFileSystemResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/ComputeResourceFileSystemResource.java
new file mode 100644
index 0000000..7cbaac2
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/ComputeResourceFileSystemResource.java
@@ -0,0 +1,307 @@
+/*
+ *
+ * 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.aiaravata.application.catalog.data.resources;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.persistence.EntityManager;
+import javax.persistence.Query;
+
+import org.airavata.appcatalog.cpi.AppCatalogException;
+import org.apache.aiaravata.application.catalog.data.model.ComputeResource;
+import org.apache.aiaravata.application.catalog.data.model.ComputeResourceFileSystem;
+import org.apache.aiaravata.application.catalog.data.model.ComputeResourceFileSystem_PK;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogJPAUtils;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogQueryGenerator;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogResourceType;
+import org.apache.airavata.common.exception.ApplicationSettingsException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class ComputeResourceFileSystemResource extends AbstractResource {
+ private final static Logger logger = LoggerFactory.getLogger(ComputeResourceFileSystemResource.class);
+ private String computeResourceId;
+ private ComputeResourceResource computeHostResource;
+ private String path;
+ private String fileSystem;
+
+ @Override
+ public void remove(Object identifier) throws AppCatalogException {
+ HashMap<String, String> ids;
+ if (identifier instanceof Map) {
+ ids = (HashMap<String, String>) 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(COMPUTE_RESOURCE_FILE_SYSTEM);
+ generator.setParameter(ComputeResourceFileSystemConstants.COMPUTE_RESOURCE_ID, ids.get(ComputeResourceFileSystemConstants.COMPUTE_RESOURCE_ID));
+ generator.setParameter(ComputeResourceFileSystemConstants.FILE_SYSTEM, ids.get(ComputeResourceFileSystemConstants.FILE_SYSTEM));
+ 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 Resource get(Object identifier) throws AppCatalogException {
+ HashMap<String, String> ids;
+ if (identifier instanceof Map) {
+ ids = (HashMap<String, String>) 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(COMPUTE_RESOURCE_FILE_SYSTEM);
+ generator.setParameter(ComputeResourceFileSystemConstants.COMPUTE_RESOURCE_ID, ids.get(ComputeResourceFileSystemConstants.COMPUTE_RESOURCE_ID));
+ generator.setParameter(ComputeResourceFileSystemConstants.FILE_SYSTEM, ids.get(ComputeResourceFileSystemConstants.FILE_SYSTEM));
+ Query q = generator.selectQuery(em);
+ ComputeResourceFileSystem computeResourceFileSystem = (ComputeResourceFileSystem) q.getSingleResult();
+ ComputeResourceFileSystemResource computeResourceFileSystemResource = (ComputeResourceFileSystemResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.COMPUTE_RESOURCE_FILE_SYSTEM, computeResourceFileSystem);
+ em.getTransaction().commit();
+ em.close();
+ return computeResourceFileSystemResource;
+ } 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<Resource> get(String fieldName, Object value) throws AppCatalogException {
+ List<Resource> computeResourceFileSystemResources = new ArrayList<Resource>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(COMPUTE_RESOURCE_FILE_SYSTEM);
+ Query q;
+ if ((fieldName.equals(ComputeResourceFileSystemConstants.COMPUTE_RESOURCE_ID)) || (fieldName.equals(ComputeResourceFileSystemConstants.PATH)) || (fieldName.equals(ComputeResourceFileSystemConstants.FILE_SYSTEM))) {
+ generator.setParameter(fieldName, value);
+ q = generator.selectQuery(em);
+ List<?> results = q.getResultList();
+ for (Object result : results) {
+ ComputeResourceFileSystem computeResourceFileSystem = (ComputeResourceFileSystem) result;
+ ComputeResourceFileSystemResource computeResourceFileSystemResource = (ComputeResourceFileSystemResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.COMPUTE_RESOURCE_FILE_SYSTEM, computeResourceFileSystem);
+ computeResourceFileSystemResources.add(computeResourceFileSystemResource);
+ }
+ } else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for Compute Resource File System Resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for Compute Resource File System Resource.");
+ }
+ 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();
+ }
+ }
+ return computeResourceFileSystemResources;
+ }
+
+ @Override
+ public List<Resource> 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 {
+ List<String> computeResourceFileSystemResourceIDs = new ArrayList<String>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(COMPUTE_RESOURCE_FILE_SYSTEM);
+ Query q;
+ if ((fieldName.equals(ComputeResourceFileSystemConstants.COMPUTE_RESOURCE_ID)) || (fieldName.equals(ComputeResourceFileSystemConstants.PATH)) || (fieldName.equals(ComputeResourceFileSystemConstants.FILE_SYSTEM))) {
+ generator.setParameter(fieldName, value);
+ q = generator.selectQuery(em);
+ List<?> results = q.getResultList();
+ for (Object result : results) {
+ ComputeResourceFileSystem computeResourceFileSystem = (ComputeResourceFileSystem) result;
+ ComputeResourceFileSystemResource computeResourceFileSystemResource = (ComputeResourceFileSystemResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.COMPUTE_RESOURCE_FILE_SYSTEM, computeResourceFileSystem);
+ computeResourceFileSystemResourceIDs.add(computeResourceFileSystemResource.getComputeResourceId());
+ }
+ } else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for Compute Resource File System Resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for Compute Resource File System Resource.");
+ }
+ 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();
+ }
+ }
+ return computeResourceFileSystemResourceIDs;
+ }
+
+ @Override
+ public void save() throws AppCatalogException {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ ComputeResourceFileSystem existingComputeResourceFileSystem = em.find(ComputeResourceFileSystem.class, new ComputeResourceFileSystem_PK(computeResourceId, fileSystem));
+ em.close();
+ ComputeResourceFileSystem computeResourceFileSystem;
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ if (existingComputeResourceFileSystem == null) {
+ computeResourceFileSystem = new ComputeResourceFileSystem();
+ } else {
+ computeResourceFileSystem = existingComputeResourceFileSystem;
+ }
+ computeResourceFileSystem.setComputeResourceId(getComputeResourceId());
+ ComputeResource computeResource = em.find(ComputeResource.class, getComputeResourceId());
+ computeResourceFileSystem.setComputeResource(computeResource);
+ computeResourceFileSystem.setPath(getPath());
+ computeResourceFileSystem.setFileSystem(getFileSystem());
+ if (existingComputeResourceFileSystem == null) {
+ em.persist(computeResourceFileSystem);
+ } else {
+ em.merge(computeResourceFileSystem);
+ }
+ 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<String, String>) 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();
+ ComputeResourceFileSystem computeResourceFileSystem = em.find(ComputeResourceFileSystem.class, new ComputeResourceFileSystem_PK(ids.get(ComputeResourceFileSystemConstants.COMPUTE_RESOURCE_ID), ids.get(ComputeResourceFileSystemConstants.FILE_SYSTEM)));
+ em.close();
+ return computeResourceFileSystem != null;
+ } 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();
+ }
+ }
+ }
+
+ public String getComputeResourceId() {
+ return computeResourceId;
+ }
+
+ public ComputeResourceResource getComputeHostResource() {
+ return computeHostResource;
+ }
+
+ public String getPath() {
+ return path;
+ }
+
+ public String getFileSystem() {
+ return fileSystem;
+ }
+
+ public void setComputeResourceId(String computeResourceId) {
+ this.computeResourceId=computeResourceId;
+ }
+
+ public void setComputeHostResource(ComputeResourceResource computeHostResource) {
+ this.computeHostResource=computeHostResource;
+ }
+
+ public void setPath(String path) {
+ this.path=path;
+ }
+
+ public void setFileSystem(String fileSystem) {
+ this.fileSystem=fileSystem;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/ComputeResourceResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/ComputeResourceResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/ComputeResourceResource.java
new file mode 100644
index 0000000..932713b
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/ComputeResourceResource.java
@@ -0,0 +1,351 @@
+/*
+ *
+ * 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.aiaravata.application.catalog.data.resources;
+
+import org.airavata.appcatalog.cpi.AppCatalogException;
+import org.apache.aiaravata.application.catalog.data.model.ComputeResource;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogJPAUtils;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogQueryGenerator;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogResourceType;
+import org.apache.airavata.common.exception.ApplicationSettingsException;
+import org.apache.airavata.common.utils.AiravataUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.persistence.EntityManager;
+import javax.persistence.Query;
+import java.sql.Timestamp;
+import java.util.ArrayList;
+import java.util.List;
+
+public class ComputeResourceResource extends AbstractResource {
+ private final static Logger logger = LoggerFactory.getLogger(ComputeResourceResource.class);
+ private String resourceDescription;
+ private String resourceId;
+ private String hostName;
+ private Timestamp createdTime;
+ private Timestamp updatedTime;
+ private int maxMemoryPerNode;
+
+ public int getMaxMemoryPerNode() {
+ return maxMemoryPerNode;
+ }
+
+ public void setMaxMemoryPerNode(int maxMemoryPerNode) {
+ this.maxMemoryPerNode = maxMemoryPerNode;
+ }
+
+ public Timestamp getCreatedTime() {
+ return createdTime;
+ }
+
+ public void setCreatedTime(Timestamp createdTime) {
+ this.createdTime = createdTime;
+ }
+
+ public Timestamp getUpdatedTime() {
+ return updatedTime;
+ }
+
+ public void setUpdatedTime(Timestamp updatedTime) {
+ this.updatedTime = updatedTime;
+ }
+
+ @Override
+ public void remove(Object identifier) throws AppCatalogException {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(COMPUTE_RESOURCE);
+ generator.setParameter(ComputeResourceConstants.RESOURCE_ID, identifier);
+ 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 Resource get(Object identifier) throws AppCatalogException {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(COMPUTE_RESOURCE);
+ generator.setParameter(ComputeResourceConstants.RESOURCE_ID, identifier);
+ Query q = generator.selectQuery(em);
+ ComputeResource computeResource = (ComputeResource) q.getSingleResult();
+ ComputeResourceResource computeResourceResource = (ComputeResourceResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.COMPUTE_RESOURCE, computeResource);
+ em.getTransaction().commit();
+ em.close();
+ return computeResourceResource;
+ } 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<Resource> get(String fieldName, Object value) throws AppCatalogException {
+ List<Resource> computeResourceResources = new ArrayList<Resource>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(COMPUTE_RESOURCE);
+ Query q;
+ if ((fieldName.equals(ComputeResourceConstants.RESOURCE_DESCRIPTION)) || (fieldName.equals(ComputeResourceConstants.RESOURCE_ID)) || (fieldName.equals(ComputeResourceConstants.HOST_NAME))) {
+ generator.setParameter(fieldName, value);
+ q = generator.selectQuery(em);
+ List<?> results = q.getResultList();
+ for (Object result : results) {
+ ComputeResource computeResource = (ComputeResource) result;
+ ComputeResourceResource computeResourceResource = (ComputeResourceResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.COMPUTE_RESOURCE, computeResource);
+ computeResourceResources.add(computeResourceResource);
+ }
+ } else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for Compute Resource Resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for Compute Resource Resource.");
+ }
+ 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();
+ }
+ }
+ return computeResourceResources;
+ }
+
+ @Override
+ public List<Resource> getAll() throws AppCatalogException {
+ List<Resource> computeResourceResources = new ArrayList<Resource>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(COMPUTE_RESOURCE);
+ Query q = generator.selectQuery(em);
+ List<?> results = q.getResultList();
+ for (Object result : results) {
+ ComputeResource computeResource = (ComputeResource) result;
+ ComputeResourceResource computeResourceResource = (ComputeResourceResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.COMPUTE_RESOURCE, computeResource);
+ computeResourceResources.add(computeResourceResource);
+ }
+ 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();
+ }
+ }
+ return computeResourceResources;
+ }
+
+ @Override
+ public List<String> getAllIds() throws AppCatalogException {
+ List<String> computeResourceResources = new ArrayList<String>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(COMPUTE_RESOURCE);
+ Query q = generator.selectQuery(em);
+ List<?> results = q.getResultList();
+ for (Object result : results) {
+ ComputeResource computeResource = (ComputeResource) result;
+ computeResourceResources.add(computeResource.getResourceId());
+ }
+ 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();
+ }
+ }
+ return computeResourceResources;
+ }
+
+ @Override
+ public List<String> getIds(String fieldName, Object value) throws AppCatalogException {
+ List<String> computeResourceResourceIDs = new ArrayList<String>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(COMPUTE_RESOURCE);
+ Query q;
+ if ((fieldName.equals(ComputeResourceConstants.RESOURCE_DESCRIPTION)) || (fieldName.equals(ComputeResourceConstants.RESOURCE_ID)) || (fieldName.equals(ComputeResourceConstants.HOST_NAME))) {
+ generator.setParameter(fieldName, value);
+ q = generator.selectQuery(em);
+ List<?> results = q.getResultList();
+ for (Object result : results) {
+ ComputeResource computeResource = (ComputeResource) result;
+ ComputeResourceResource computeResourceResource = (ComputeResourceResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.COMPUTE_RESOURCE, computeResource);
+ computeResourceResourceIDs.add(computeResourceResource.getResourceId());
+ }
+ } else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for Compute Resource Resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for Compute Resource Resource.");
+ }
+ 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();
+ }
+ }
+ return computeResourceResourceIDs;
+ }
+
+ @Override
+ public void save() throws AppCatalogException {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ ComputeResource existingComputeResource = em.find(ComputeResource.class, resourceId);
+ em.close();
+ ComputeResource computeResource;
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ if (existingComputeResource == null) {
+ computeResource = new ComputeResource();
+ computeResource.setCreationTime(AiravataUtils.getCurrentTimestamp());
+ } else {
+ computeResource = existingComputeResource;
+ computeResource.setUpdateTime(AiravataUtils.getCurrentTimestamp());
+ }
+ computeResource.setResourceDescription(getResourceDescription());
+ computeResource.setResourceId(getResourceId());
+ computeResource.setHostName(getHostName());
+ computeResource.setMaxMemoryPerNode(getMaxMemoryPerNode());
+ if (existingComputeResource == null) {
+ em.persist(computeResource);
+ } else {
+ em.merge(computeResource);
+ }
+ 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 {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ ComputeResource computeResource = em.find(ComputeResource.class, identifier);
+ em.close();
+ return computeResource != null;
+ } 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();
+ }
+ }
+ }
+
+ public String getResourceDescription() {
+ return resourceDescription;
+ }
+
+ public String getResourceId() {
+ return resourceId;
+ }
+
+ public String getHostName() {
+ return hostName;
+ }
+
+ public void setResourceDescription(String resourceDescription) {
+ this.resourceDescription=resourceDescription;
+ }
+
+ public void setResourceId(String resourceId) {
+ this.resourceId=resourceId;
+ }
+
+ public void setHostName(String hostName) {
+ this.hostName=hostName;
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/DataMovementInterfaceAppCatalogResourceAppCat.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/DataMovementInterfaceAppCatalogResourceAppCat.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/DataMovementInterfaceAppCatalogResourceAppCat.java
new file mode 100644
index 0000000..3d24829
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/DataMovementInterfaceAppCatalogResourceAppCat.java
@@ -0,0 +1,339 @@
+/*
+ *
+ * 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 java.sql.Timestamp;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.persistence.EntityManager;
+import javax.persistence.Query;
+
+import org.apache.airavata.common.exception.ApplicationSettingsException;
+import org.apache.airavata.common.utils.AiravataUtils;
+import org.apache.airavata.registry.core.app.catalog.model.ComputeResource;
+import org.apache.airavata.registry.core.app.catalog.model.DataMovementInterface;
+import org.apache.airavata.registry.core.app.catalog.model.DataMovementInterface_PK;
+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;
+
+public class DataMovementInterfaceAppCatalogResourceAppCat extends AppCatAbstractResource {
+ private final static Logger logger = LoggerFactory.getLogger(DataMovementInterfaceAppCatalogResourceAppCat.class);
+ private String computeResourceId;
+ private ComputeResourceAppCatalogResourceAppCat computeHostResource;
+ private String dataMovementProtocol;
+ private String dataMovementInterfaceId;
+ private int priorityOrder;
+ private Timestamp createdTime;
+ private Timestamp updatedTime;
+
+ public Timestamp getCreatedTime() {
+ return createdTime;
+ }
+
+ public void setCreatedTime(Timestamp createdTime) {
+ this.createdTime = createdTime;
+ }
+
+ public Timestamp getUpdatedTime() {
+ return updatedTime;
+ }
+
+ public void setUpdatedTime(Timestamp updatedTime) {
+ this.updatedTime = updatedTime;
+ }
+
+ @Override
+ public void remove(Object identifier) throws AppCatalogException {
+ HashMap<String, String> ids;
+ if (identifier instanceof Map) {
+ ids = (HashMap<String, String>) 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_MOVEMENT_INTERFACE);
+ generator.setParameter(DataMovementInterfaceConstants.COMPUTE_RESOURCE_ID, ids.get(DataMovementInterfaceConstants.COMPUTE_RESOURCE_ID));
+ generator.setParameter(DataMovementInterfaceConstants.DATA_MOVEMENT_INTERFACE_ID, ids.get(DataMovementInterfaceConstants.DATA_MOVEMENT_INTERFACE_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<String, String>) 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_MOVEMENT_INTERFACE);
+ generator.setParameter(DataMovementInterfaceConstants.COMPUTE_RESOURCE_ID, ids.get(DataMovementInterfaceConstants.COMPUTE_RESOURCE_ID));
+ generator.setParameter(DataMovementInterfaceConstants.DATA_MOVEMENT_INTERFACE_ID, ids.get(DataMovementInterfaceConstants.DATA_MOVEMENT_INTERFACE_ID));
+ Query q = generator.selectQuery(em);
+ DataMovementInterface dataMovementInterface = (DataMovementInterface) q.getSingleResult();
+ DataMovementInterfaceAppCatalogResourceAppCat dataMovementInterfaceResource = (DataMovementInterfaceAppCatalogResourceAppCat) AppCatalogJPAUtils.getResource(AppCatalogResourceType.DATA_MOVEMENT_INTERFACE, dataMovementInterface);
+ em.getTransaction().commit();
+ em.close();
+ return dataMovementInterfaceResource;
+ } 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> dataMovementInterfaceResources = new ArrayList<AppCatalogResource>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(DATA_MOVEMENT_INTERFACE);
+ Query q;
+ if ((fieldName.equals(DataMovementInterfaceConstants.COMPUTE_RESOURCE_ID)) || (fieldName.equals(DataMovementInterfaceConstants.DATA_MOVEMENT_PROTOCOL)) || (fieldName.equals(DataMovementInterfaceConstants.DATA_MOVEMENT_INTERFACE_ID)) || (fieldName.equals(DataMovementInterfaceConstants.PRIORITY_ORDER))) {
+ generator.setParameter(fieldName, value);
+ q = generator.selectQuery(em);
+ List<?> results = q.getResultList();
+ for (Object result : results) {
+ DataMovementInterface dataMovementInterface = (DataMovementInterface) result;
+ DataMovementInterfaceAppCatalogResourceAppCat dataMovementInterfaceResource = (DataMovementInterfaceAppCatalogResourceAppCat) AppCatalogJPAUtils.getResource(AppCatalogResourceType.DATA_MOVEMENT_INTERFACE, dataMovementInterface);
+ dataMovementInterfaceResources.add(dataMovementInterfaceResource);
+ }
+ } else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for Data Movement Interface Resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for Data Movement Interface Resource.");
+ }
+ 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();
+ }
+ }
+ return dataMovementInterfaceResources;
+ }
+
+ @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 {
+ List<String> dataMovementInterfaceResourceIDs = new ArrayList<String>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(DATA_MOVEMENT_INTERFACE);
+ Query q;
+ if ((fieldName.equals(DataMovementInterfaceConstants.COMPUTE_RESOURCE_ID)) || (fieldName.equals(DataMovementInterfaceConstants.DATA_MOVEMENT_PROTOCOL)) || (fieldName.equals(DataMovementInterfaceConstants.DATA_MOVEMENT_INTERFACE_ID)) || (fieldName.equals(DataMovementInterfaceConstants.PRIORITY_ORDER))) {
+ generator.setParameter(fieldName, value);
+ q = generator.selectQuery(em);
+ List<?> results = q.getResultList();
+ for (Object result : results) {
+ DataMovementInterface dataMovementInterface = (DataMovementInterface) result;
+ DataMovementInterfaceAppCatalogResourceAppCat dataMovementInterfaceResource = (DataMovementInterfaceAppCatalogResourceAppCat) AppCatalogJPAUtils.getResource(AppCatalogResourceType.DATA_MOVEMENT_INTERFACE, dataMovementInterface);
+ dataMovementInterfaceResourceIDs.add(dataMovementInterfaceResource.getComputeResourceId());
+ }
+ } else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for Data Movement Interface Resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for Data Movement Interface Resource.");
+ }
+ 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();
+ }
+ }
+ return dataMovementInterfaceResourceIDs;
+ }
+
+ @Override
+ public void save() throws AppCatalogException {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ DataMovementInterface existingDataMovementInterface = em.find(DataMovementInterface.class, new DataMovementInterface_PK(computeResourceId, dataMovementInterfaceId));
+ em.close();
+ DataMovementInterface dataMovementInterface;
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ if (existingDataMovementInterface == null) {
+ dataMovementInterface = new DataMovementInterface();
+ dataMovementInterface.setCreationTime(AiravataUtils.getCurrentTimestamp());
+ } else {
+ dataMovementInterface = existingDataMovementInterface;
+ dataMovementInterface.setUpdateTime(AiravataUtils.getCurrentTimestamp());
+ }
+ dataMovementInterface.setComputeResourceId(getComputeResourceId());
+ ComputeResource computeResource = em.find(ComputeResource.class, getComputeResourceId());
+ dataMovementInterface.setComputeResource(computeResource);
+ dataMovementInterface.setDataMovementProtocol(getDataMovementProtocol());
+ dataMovementInterface.setDataMovementInterfaceId(getDataMovementInterfaceId());
+ dataMovementInterface.setPriorityOrder(getPriorityOrder());
+ if (existingDataMovementInterface == null) {
+ em.persist(dataMovementInterface);
+ } else {
+ em.merge(dataMovementInterface);
+ }
+ 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<String, String>) 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();
+ DataMovementInterface dataMovementInterface = em.find(DataMovementInterface.class, new DataMovementInterface_PK(ids.get(DataMovementInterfaceConstants.COMPUTE_RESOURCE_ID), ids.get(DataMovementInterfaceConstants.DATA_MOVEMENT_INTERFACE_ID)));
+ em.close();
+ return dataMovementInterface != null;
+ } 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();
+ }
+ }
+ }
+
+ public String getComputeResourceId() {
+ return computeResourceId;
+ }
+
+ public ComputeResourceAppCatalogResourceAppCat getComputeHostResource() {
+ return computeHostResource;
+ }
+
+ public String getDataMovementProtocol() {
+ return dataMovementProtocol;
+ }
+
+ public String getDataMovementInterfaceId() {
+ return dataMovementInterfaceId;
+ }
+
+ public int getPriorityOrder() {
+ return priorityOrder;
+ }
+
+ public void setComputeResourceId(String computeResourceId) {
+ this.computeResourceId=computeResourceId;
+ }
+
+ public void setComputeHostResource(ComputeResourceAppCatalogResourceAppCat computeHostResource) {
+ this.computeHostResource=computeHostResource;
+ }
+
+ public void setDataMovementProtocol(String dataMovementProtocol) {
+ this.dataMovementProtocol=dataMovementProtocol;
+ }
+
+ public void setDataMovementInterfaceId(String dataMovementInterfaceId) {
+ this.dataMovementInterfaceId=dataMovementInterfaceId;
+ }
+
+ public void setPriorityOrder(int priorityOrder) {
+ this.priorityOrder=priorityOrder;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/DataMovementInterfaceResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/DataMovementInterfaceResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/DataMovementInterfaceResource.java
new file mode 100644
index 0000000..267cd23
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/DataMovementInterfaceResource.java
@@ -0,0 +1,339 @@
+/*
+ *
+ * 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.aiaravata.application.catalog.data.resources;
+
+import java.sql.Timestamp;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.persistence.EntityManager;
+import javax.persistence.Query;
+
+import org.airavata.appcatalog.cpi.AppCatalogException;
+import org.apache.aiaravata.application.catalog.data.model.ComputeResource;
+import org.apache.aiaravata.application.catalog.data.model.DataMovementInterface;
+import org.apache.aiaravata.application.catalog.data.model.DataMovementInterface_PK;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogJPAUtils;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogQueryGenerator;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogResourceType;
+import org.apache.airavata.common.exception.ApplicationSettingsException;
+import org.apache.airavata.common.utils.AiravataUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class DataMovementInterfaceResource extends AbstractResource {
+ private final static Logger logger = LoggerFactory.getLogger(DataMovementInterfaceResource.class);
+ private String computeResourceId;
+ private ComputeResourceResource computeHostResource;
+ private String dataMovementProtocol;
+ private String dataMovementInterfaceId;
+ private int priorityOrder;
+ private Timestamp createdTime;
+ private Timestamp updatedTime;
+
+ public Timestamp getCreatedTime() {
+ return createdTime;
+ }
+
+ public void setCreatedTime(Timestamp createdTime) {
+ this.createdTime = createdTime;
+ }
+
+ public Timestamp getUpdatedTime() {
+ return updatedTime;
+ }
+
+ public void setUpdatedTime(Timestamp updatedTime) {
+ this.updatedTime = updatedTime;
+ }
+
+ @Override
+ public void remove(Object identifier) throws AppCatalogException {
+ HashMap<String, String> ids;
+ if (identifier instanceof Map) {
+ ids = (HashMap<String, String>) 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_MOVEMENT_INTERFACE);
+ generator.setParameter(DataMovementInterfaceConstants.COMPUTE_RESOURCE_ID, ids.get(DataMovementInterfaceConstants.COMPUTE_RESOURCE_ID));
+ generator.setParameter(DataMovementInterfaceConstants.DATA_MOVEMENT_INTERFACE_ID, ids.get(DataMovementInterfaceConstants.DATA_MOVEMENT_INTERFACE_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 Resource get(Object identifier) throws AppCatalogException {
+ HashMap<String, String> ids;
+ if (identifier instanceof Map) {
+ ids = (HashMap<String, String>) 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_MOVEMENT_INTERFACE);
+ generator.setParameter(DataMovementInterfaceConstants.COMPUTE_RESOURCE_ID, ids.get(DataMovementInterfaceConstants.COMPUTE_RESOURCE_ID));
+ generator.setParameter(DataMovementInterfaceConstants.DATA_MOVEMENT_INTERFACE_ID, ids.get(DataMovementInterfaceConstants.DATA_MOVEMENT_INTERFACE_ID));
+ Query q = generator.selectQuery(em);
+ DataMovementInterface dataMovementInterface = (DataMovementInterface) q.getSingleResult();
+ DataMovementInterfaceResource dataMovementInterfaceResource = (DataMovementInterfaceResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.DATA_MOVEMENT_INTERFACE, dataMovementInterface);
+ em.getTransaction().commit();
+ em.close();
+ return dataMovementInterfaceResource;
+ } 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<Resource> get(String fieldName, Object value) throws AppCatalogException {
+ List<Resource> dataMovementInterfaceResources = new ArrayList<Resource>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(DATA_MOVEMENT_INTERFACE);
+ Query q;
+ if ((fieldName.equals(DataMovementInterfaceConstants.COMPUTE_RESOURCE_ID)) || (fieldName.equals(DataMovementInterfaceConstants.DATA_MOVEMENT_PROTOCOL)) || (fieldName.equals(DataMovementInterfaceConstants.DATA_MOVEMENT_INTERFACE_ID)) || (fieldName.equals(DataMovementInterfaceConstants.PRIORITY_ORDER))) {
+ generator.setParameter(fieldName, value);
+ q = generator.selectQuery(em);
+ List<?> results = q.getResultList();
+ for (Object result : results) {
+ DataMovementInterface dataMovementInterface = (DataMovementInterface) result;
+ DataMovementInterfaceResource dataMovementInterfaceResource = (DataMovementInterfaceResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.DATA_MOVEMENT_INTERFACE, dataMovementInterface);
+ dataMovementInterfaceResources.add(dataMovementInterfaceResource);
+ }
+ } else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for Data Movement Interface Resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for Data Movement Interface Resource.");
+ }
+ 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();
+ }
+ }
+ return dataMovementInterfaceResources;
+ }
+
+ @Override
+ public List<Resource> 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 {
+ List<String> dataMovementInterfaceResourceIDs = new ArrayList<String>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(DATA_MOVEMENT_INTERFACE);
+ Query q;
+ if ((fieldName.equals(DataMovementInterfaceConstants.COMPUTE_RESOURCE_ID)) || (fieldName.equals(DataMovementInterfaceConstants.DATA_MOVEMENT_PROTOCOL)) || (fieldName.equals(DataMovementInterfaceConstants.DATA_MOVEMENT_INTERFACE_ID)) || (fieldName.equals(DataMovementInterfaceConstants.PRIORITY_ORDER))) {
+ generator.setParameter(fieldName, value);
+ q = generator.selectQuery(em);
+ List<?> results = q.getResultList();
+ for (Object result : results) {
+ DataMovementInterface dataMovementInterface = (DataMovementInterface) result;
+ DataMovementInterfaceResource dataMovementInterfaceResource = (DataMovementInterfaceResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.DATA_MOVEMENT_INTERFACE, dataMovementInterface);
+ dataMovementInterfaceResourceIDs.add(dataMovementInterfaceResource.getComputeResourceId());
+ }
+ } else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for Data Movement Interface Resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for Data Movement Interface Resource.");
+ }
+ 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();
+ }
+ }
+ return dataMovementInterfaceResourceIDs;
+ }
+
+ @Override
+ public void save() throws AppCatalogException {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ DataMovementInterface existingDataMovementInterface = em.find(DataMovementInterface.class, new DataMovementInterface_PK(computeResourceId, dataMovementInterfaceId));
+ em.close();
+ DataMovementInterface dataMovementInterface;
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ if (existingDataMovementInterface == null) {
+ dataMovementInterface = new DataMovementInterface();
+ dataMovementInterface.setCreationTime(AiravataUtils.getCurrentTimestamp());
+ } else {
+ dataMovementInterface = existingDataMovementInterface;
+ dataMovementInterface.setUpdateTime(AiravataUtils.getCurrentTimestamp());
+ }
+ dataMovementInterface.setComputeResourceId(getComputeResourceId());
+ ComputeResource computeResource = em.find(ComputeResource.class, getComputeResourceId());
+ dataMovementInterface.setComputeResource(computeResource);
+ dataMovementInterface.setDataMovementProtocol(getDataMovementProtocol());
+ dataMovementInterface.setDataMovementInterfaceId(getDataMovementInterfaceId());
+ dataMovementInterface.setPriorityOrder(getPriorityOrder());
+ if (existingDataMovementInterface == null) {
+ em.persist(dataMovementInterface);
+ } else {
+ em.merge(dataMovementInterface);
+ }
+ 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<String, String>) 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();
+ DataMovementInterface dataMovementInterface = em.find(DataMovementInterface.class, new DataMovementInterface_PK(ids.get(DataMovementInterfaceConstants.COMPUTE_RESOURCE_ID), ids.get(DataMovementInterfaceConstants.DATA_MOVEMENT_INTERFACE_ID)));
+ em.close();
+ return dataMovementInterface != null;
+ } 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();
+ }
+ }
+ }
+
+ public String getComputeResourceId() {
+ return computeResourceId;
+ }
+
+ public ComputeResourceResource getComputeHostResource() {
+ return computeHostResource;
+ }
+
+ public String getDataMovementProtocol() {
+ return dataMovementProtocol;
+ }
+
+ public String getDataMovementInterfaceId() {
+ return dataMovementInterfaceId;
+ }
+
+ public int getPriorityOrder() {
+ return priorityOrder;
+ }
+
+ public void setComputeResourceId(String computeResourceId) {
+ this.computeResourceId=computeResourceId;
+ }
+
+ public void setComputeHostResource(ComputeResourceResource computeHostResource) {
+ this.computeHostResource=computeHostResource;
+ }
+
+ public void setDataMovementProtocol(String dataMovementProtocol) {
+ this.dataMovementProtocol=dataMovementProtocol;
+ }
+
+ public void setDataMovementInterfaceId(String dataMovementInterfaceId) {
+ this.dataMovementInterfaceId=dataMovementInterfaceId;
+ }
+
+ public void setPriorityOrder(int priorityOrder) {
+ this.priorityOrder=priorityOrder;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/DataMovementProtocolResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/DataMovementProtocolResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/DataMovementProtocolResource.java
new file mode 100644
index 0000000..441b56c
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/DataMovementProtocolResource.java
@@ -0,0 +1,360 @@
+///**
+// * 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.aiaravata.application.catalog.data.resources;
+//
+//import org.apache.airavata.registry.cpi.AppCatalogException;
+//import org.apache.aiaravata.application.catalog.data.model.ComputeResource;
+//import org.apache.aiaravata.application.catalog.data.model.DataMovementProtocol;
+//import org.apache.aiaravata.application.catalog.data.model.DataMovementProtocolPK;
+//import org.apache.aiaravata.application.catalog.data.util.AppCatalogJPAUtils;
+//import org.apache.aiaravata.application.catalog.data.util.AppCatalogQueryGenerator;
+//import org.apache.aiaravata.application.catalog.data.util.AppCatalogResourceType;
+//import org.apache.airavata.common.exception.ApplicationSettingsException;
+//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 DataMovementProtocolResource extends AbstractResource {
+//
+// private final static Logger logger = LoggerFactory.getLogger(DataMovementProtocolResource.class);
+//
+// private String resourceID;
+// private String dataMoveID;
+// private String dataMoveType;
+// private ComputeResourceResource computeHostResource;
+//
+// 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_MOVEMENT_PROTOCOL);
+// generator.setParameter(DataMoveProtocolConstants.DATA_MOVE_TYPE, ids.get(DataMoveProtocolConstants.DATA_MOVE_TYPE));
+// generator.setParameter(DataMoveProtocolConstants.RESOURCE_ID, ids.get(DataMoveProtocolConstants.RESOURCE_ID));
+// generator.setParameter(DataMoveProtocolConstants.DATA_MOVE_ID, ids.get(DataMoveProtocolConstants.DATA_MOVE_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();
+// }
+// }
+// }
+//
+// public Resource 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_MOVEMENT_PROTOCOL);
+// generator.setParameter(DataMoveProtocolConstants.DATA_MOVE_TYPE, ids.get(DataMoveProtocolConstants.DATA_MOVE_TYPE));
+// generator.setParameter(DataMoveProtocolConstants.RESOURCE_ID, ids.get(DataMoveProtocolConstants.RESOURCE_ID));
+// generator.setParameter(DataMoveProtocolConstants.DATA_MOVE_ID, ids.get(DataMoveProtocolConstants.DATA_MOVE_ID));
+// Query q = generator.selectQuery(em);
+// DataMovementProtocol dataMovementProtocol = (DataMovementProtocol) q.getSingleResult();
+// DataMovementProtocolResource dataMovementProtocolResource =
+// (DataMovementProtocolResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.DATA_MOVEMENT_PROTOCOL, dataMovementProtocol);
+// em.getTransaction().commit();
+// em.close();
+// return dataMovementProtocolResource;
+// } 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();
+// }
+// }
+// }
+//
+// public List<Resource> get(String fieldName, Object value) throws AppCatalogException {
+// List<Resource> dataMoveProtocolResourcesList = new ArrayList<Resource>();
+// EntityManager em = null;
+// try {
+// em = AppCatalogJPAUtils.getEntityManager();
+// em.getTransaction().begin();
+// Query q;
+// AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(DATA_MOVEMENT_PROTOCOL);
+// List results;
+// if (fieldName.equals(DataMoveProtocolConstants.RESOURCE_ID)) {
+// generator.setParameter(DataMoveProtocolConstants.RESOURCE_ID, value);
+// q = generator.selectQuery(em);
+// results = q.getResultList();
+// if (results.size() != 0) {
+// for (Object result : results) {
+// DataMovementProtocol dataMovementProtocol = (DataMovementProtocol) result;
+// DataMovementProtocolResource dataMovementProtocolResource =
+// (DataMovementProtocolResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.DATA_MOVEMENT_PROTOCOL, dataMovementProtocol);
+// dataMoveProtocolResourcesList.add(dataMovementProtocolResource);
+// }
+// }
+// } else if (fieldName.equals(DataMoveProtocolConstants.DATA_MOVE_TYPE)) {
+// generator.setParameter(DataMoveProtocolConstants.DATA_MOVE_TYPE, value);
+// q = generator.selectQuery(em);
+// results = q.getResultList();
+// if (results.size() != 0) {
+// for (Object result : results) {
+// DataMovementProtocol dataMovementProtocol = (DataMovementProtocol) result;
+// DataMovementProtocolResource dataMovementProtocolResource =
+// (DataMovementProtocolResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.DATA_MOVEMENT_PROTOCOL, dataMovementProtocol);
+// dataMoveProtocolResourcesList.add(dataMovementProtocolResource);
+// }
+// }
+// } else if (fieldName.equals(DataMoveProtocolConstants.DATA_MOVE_ID)) {
+// generator.setParameter(DataMoveProtocolConstants.DATA_MOVE_ID, value);
+// q = generator.selectQuery(em);
+// results = q.getResultList();
+// if (results.size() != 0) {
+// for (Object result : results) {
+// DataMovementProtocol dataMovementProtocol = (DataMovementProtocol) result;
+// DataMovementProtocolResource dataMovementProtocolResource =
+// (DataMovementProtocolResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.DATA_MOVEMENT_PROTOCOL, dataMovementProtocol);
+// dataMoveProtocolResourcesList.add(dataMovementProtocolResource);
+// }
+// }
+// } else {
+// em.getTransaction().commit();
+// em.close();
+// logger.error("Unsupported field name for Data Movement Protocol Resource.", new IllegalArgumentException());
+// throw new IllegalArgumentException("Unsupported field name for Data Movement Protocol 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 dataMoveProtocolResourcesList;
+// }
+//
+// @Override
+// public List<Resource> getAll() throws AppCatalogException {
+// return null;
+// }
+//
+// @Override
+// public List<String> getAllIds() throws AppCatalogException {
+// return null;
+// }
+//
+// public List<String> getIds(String fieldName, Object value) throws AppCatalogException {
+// List<String> dataMovementProtocolIDs = new ArrayList<String>();
+// EntityManager em = null;
+// try {
+// em = AppCatalogJPAUtils.getEntityManager();
+// em.getTransaction().begin();
+// Query q;
+// AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(DATA_MOVEMENT_PROTOCOL);
+// List results;
+// if (fieldName.equals(DataMoveProtocolConstants.DATA_MOVE_ID)) {
+// generator.setParameter(DataMoveProtocolConstants.DATA_MOVE_ID, value);
+// q = generator.selectQuery(em);
+// results = q.getResultList();
+// if (results.size() != 0) {
+// for (Object result : results) {
+// DataMovementProtocol dataMovementProtocol = (DataMovementProtocol) result;
+// dataMovementProtocolIDs.add(dataMovementProtocol.getDataMoveID());
+// }
+// }
+// } else if (fieldName.equals(DataMoveProtocolConstants.RESOURCE_ID)) {
+// generator.setParameter(DataMoveProtocolConstants.RESOURCE_ID, value);
+// q = generator.selectQuery(em);
+// results = q.getResultList();
+// if (results.size() != 0) {
+// for (Object result : results) {
+// DataMovementProtocol dataMovementProtocol = (DataMovementProtocol) result;
+// dataMovementProtocolIDs.add(dataMovementProtocol.getDataMoveID());
+// }
+// }
+// } else if (fieldName.equals(DataMoveProtocolConstants.DATA_MOVE_TYPE)) {
+// generator.setParameter(DataMoveProtocolConstants.DATA_MOVE_TYPE, value);
+// q = generator.selectQuery(em);
+// results = q.getResultList();
+// if (results.size() != 0) {
+// for (Object result : results) {
+// DataMovementProtocol dataMovementProtocol = (DataMovementProtocol) result;
+// dataMovementProtocolIDs.add(dataMovementProtocol.getDataMoveID());
+// }
+// }
+// } else {
+// em.getTransaction().commit();
+// em.close();
+// logger.error("Unsupported field name for Data Move Protocol resource.", new IllegalArgumentException());
+// throw new IllegalArgumentException("Unsupported field name for Data Move Protocol 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 dataMovementProtocolIDs;
+// }
+//
+// public void save() throws AppCatalogException {
+// EntityManager em = null;
+// try {
+// em = AppCatalogJPAUtils.getEntityManager();
+// DataMovementProtocol existingDataMovementProtocol = em.find(DataMovementProtocol.class, new DataMovementProtocolPK(resourceID, dataMoveID, dataMoveType));
+// em.close();
+//
+// em = AppCatalogJPAUtils.getEntityManager();
+// em.getTransaction().begin();
+// if (existingDataMovementProtocol != null) {
+// existingDataMovementProtocol.setDataMoveID(dataMoveType);
+// existingDataMovementProtocol.setDataMoveID(dataMoveID);
+// ComputeResource computeResource = em.find(ComputeResource.class, resourceID);
+// existingDataMovementProtocol.setComputeResource(computeResource);
+// existingDataMovementProtocol.setResourceID(resourceID);
+// em.merge(existingDataMovementProtocol);
+// } else {
+// DataMovementProtocol dataMovementProtocol = new DataMovementProtocol();
+// dataMovementProtocol.setDataMoveType(dataMoveType);
+// dataMovementProtocol.setDataMoveID(dataMoveID);
+// dataMovementProtocol.setResourceID(resourceID);
+// ComputeResource computeResource = em.find(ComputeResource.class, resourceID);
+// dataMovementProtocol.setComputeResource(computeResource);
+// em.persist(dataMovementProtocol);
+// }
+// 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();
+// }
+// }
+// }
+//
+// 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();
+// DataMovementProtocol dataMovementProtocol = em.find(DataMovementProtocol.class, new DataMovementProtocolPK(
+// ids.get(DataMoveProtocolConstants.RESOURCE_ID),
+// ids.get(DataMoveProtocolConstants.DATA_MOVE_ID), ids.get(DataMoveProtocolConstants.DATA_MOVE_TYPE)));
+//
+// em.close();
+// return dataMovementProtocol != null;
+// } 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();
+// }
+// }
+// }
+//
+// public String getResourceID() {
+// return resourceID;
+// }
+//
+// public void setResourceID(String resourceID) {
+// this.resourceID = resourceID;
+// }
+//
+// public String getDataMoveID() {
+// return dataMoveID;
+// }
+//
+// public void setDataMoveID(String dataMoveID) {
+// this.dataMoveID = dataMoveID;
+// }
+//
+// public String getDataMoveType() {
+// return dataMoveType;
+// }
+//
+// public void setDataMoveType(String dataMoveType) {
+// this.dataMoveType = dataMoveType;
+// }
+//
+// public ComputeResourceResource getComputeHostResource() {
+// return computeHostResource;
+// }
+//
+// public void setComputeHostResource(ComputeResourceResource computeHostResource) {
+// this.computeHostResource = computeHostResource;
+// }
+//}
[35/52] [abbrv] [partial] airavata git commit: registry refactoring
Posted by sh...@apache.org.
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/AiravataJobStatusUpdator.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/AiravataJobStatusUpdator.java b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/AiravataJobStatusUpdator.java
index e7c6572..46659ff 100644
--- a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/AiravataJobStatusUpdator.java
+++ b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/AiravataJobStatusUpdator.java
@@ -32,8 +32,8 @@ import org.apache.airavata.model.messaging.event.MessageType;
import org.apache.airavata.model.workspace.experiment.JobDetails;
import org.apache.airavata.model.workspace.experiment.JobState;
import org.apache.airavata.registry.cpi.CompositeIdentifier;
-import org.apache.airavata.registry.cpi.Registry;
-import org.apache.airavata.registry.cpi.RegistryModelType;
+import org.apache.airavata.registry.cpi.ExperimentCatalog;
+import org.apache.airavata.registry.cpi.ExperimentCatalogModelType;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -41,18 +41,18 @@ import java.util.Calendar;
public class AiravataJobStatusUpdator implements AbstractActivityListener {
private final static Logger logger = LoggerFactory.getLogger(AiravataJobStatusUpdator.class);
- private Registry airavataRegistry;
+ private ExperimentCatalog airavataExperimentCatalog;
private MonitorPublisher monitorPublisher;
private Publisher publisher;
- public Registry getAiravataRegistry() {
- return airavataRegistry;
+ public ExperimentCatalog getAiravataExperimentCatalog() {
+ return airavataExperimentCatalog;
}
- public void setAiravataRegistry(Registry airavataRegistry) {
- this.airavataRegistry = airavataRegistry;
+ public void setAiravataExperimentCatalog(ExperimentCatalog airavataExperimentCatalog) {
+ this.airavataExperimentCatalog = airavataExperimentCatalog;
}
@@ -87,7 +87,7 @@ public class AiravataJobStatusUpdator implements AbstractActivityListener {
public void updateJobStatus(String expId, String taskId, String jobID, JobState state) throws Exception {
logger.info("expId - {}: Updating job status for " + jobID + ":" + state.toString(), expId);
CompositeIdentifier ids = new CompositeIdentifier(taskId, jobID);
- JobDetails details = (JobDetails) airavataRegistry.get(RegistryModelType.JOB_DETAIL, ids);
+ JobDetails details = (JobDetails) airavataExperimentCatalog.get(ExperimentCatalogModelType.JOB_DETAIL, ids);
if (details == null) {
details = new JobDetails();
}
@@ -102,14 +102,14 @@ public class AiravataJobStatusUpdator implements AbstractActivityListener {
details.setJobStatus(status);
details.setJobID(jobID);
logger.debug("expId - {}: Updated job status for " + jobID + ":" + details.getJobStatus().toString(), expId);
- airavataRegistry.update(RegistryModelType.JOB_STATUS, status, ids);
+ airavataExperimentCatalog.update(ExperimentCatalogModelType.JOB_STATUS, status, ids);
}
@SuppressWarnings("unchecked")
public void setup(Object... configurations) {
for (Object configuration : configurations) {
- if (configuration instanceof Registry){
- this.airavataRegistry=(Registry)configuration;
+ if (configuration instanceof ExperimentCatalog){
+ this.airavataExperimentCatalog =(ExperimentCatalog)configuration;
} else if (configuration instanceof MonitorPublisher){
this.monitorPublisher=(MonitorPublisher) configuration;
} else if (configuration instanceof Publisher){
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/AiravataTaskStatusUpdator.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/AiravataTaskStatusUpdator.java b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/AiravataTaskStatusUpdator.java
index 94029be..7cfa7ca 100644
--- a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/AiravataTaskStatusUpdator.java
+++ b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/AiravataTaskStatusUpdator.java
@@ -35,8 +35,8 @@ import org.apache.airavata.model.messaging.event.TaskStatusChangeEvent;
import org.apache.airavata.model.messaging.event.TaskStatusChangeRequestEvent;
import org.apache.airavata.model.workspace.experiment.TaskDetails;
import org.apache.airavata.model.workspace.experiment.TaskState;
-import org.apache.airavata.registry.cpi.Registry;
-import org.apache.airavata.registry.cpi.RegistryModelType;
+import org.apache.airavata.registry.cpi.ExperimentCatalog;
+import org.apache.airavata.registry.cpi.ExperimentCatalogModelType;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -44,16 +44,16 @@ import java.util.Calendar;
public class AiravataTaskStatusUpdator implements AbstractActivityListener {
private final static Logger logger = LoggerFactory.getLogger(AiravataTaskStatusUpdator.class);
- private Registry airavataRegistry;
+ private ExperimentCatalog airavataExperimentCatalog;
private MonitorPublisher monitorPublisher;
private Publisher publisher;
- public Registry getAiravataRegistry() {
- return airavataRegistry;
+ public ExperimentCatalog getAiravataExperimentCatalog() {
+ return airavataExperimentCatalog;
}
- public void setAiravataRegistry(Registry airavataRegistry) {
- this.airavataRegistry = airavataRegistry;
+ public void setAiravataExperimentCatalog(ExperimentCatalog airavataExperimentCatalog) {
+ this.airavataExperimentCatalog = airavataExperimentCatalog;
}
@Subscribe
@@ -120,7 +120,7 @@ public class AiravataTaskStatusUpdator implements AbstractActivityListener {
}
public TaskState updateTaskStatus(String taskId, TaskState state) throws Exception {
- TaskDetails details = (TaskDetails)airavataRegistry.get(RegistryModelType.TASK_DETAIL, taskId);
+ TaskDetails details = (TaskDetails) airavataExperimentCatalog.get(ExperimentCatalogModelType.TASK_DETAIL, taskId);
if(details == null) {
logger.error("Task details cannot be null at this point");
throw new Exception("Task details cannot be null at this point");
@@ -136,14 +136,14 @@ public class AiravataTaskStatusUpdator implements AbstractActivityListener {
details.setTaskStatus(status);
logger.debug("Updating task status for "+taskId+":"+details.getTaskStatus().toString());
- airavataRegistry.update(RegistryModelType.TASK_STATUS, status, taskId);
+ airavataExperimentCatalog.update(ExperimentCatalogModelType.TASK_STATUS, status, taskId);
return status.getExecutionState();
}
public void setup(Object... configurations) {
for (Object configuration : configurations) {
- if (configuration instanceof Registry){
- this.airavataRegistry=(Registry)configuration;
+ if (configuration instanceof ExperimentCatalog){
+ this.airavataExperimentCatalog =(ExperimentCatalog)configuration;
} else if (configuration instanceof MonitorPublisher){
this.monitorPublisher=(MonitorPublisher) configuration;
} else if (configuration instanceof Publisher){
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/AiravataWorkflowNodeStatusUpdator.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/AiravataWorkflowNodeStatusUpdator.java b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/AiravataWorkflowNodeStatusUpdator.java
index 092774b..ddec551 100644
--- a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/AiravataWorkflowNodeStatusUpdator.java
+++ b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/AiravataWorkflowNodeStatusUpdator.java
@@ -33,8 +33,8 @@ import org.apache.airavata.model.messaging.event.WorkflowNodeStatusChangeEvent;
import org.apache.airavata.model.workspace.experiment.WorkflowNodeDetails;
import org.apache.airavata.model.workspace.experiment.WorkflowNodeState;
import org.apache.airavata.model.workspace.experiment.WorkflowNodeStatus;
-import org.apache.airavata.registry.cpi.Registry;
-import org.apache.airavata.registry.cpi.RegistryModelType;
+import org.apache.airavata.registry.cpi.ExperimentCatalog;
+import org.apache.airavata.registry.cpi.ExperimentCatalogModelType;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -43,19 +43,19 @@ import java.util.Calendar;
public class AiravataWorkflowNodeStatusUpdator implements AbstractActivityListener {
private final static Logger logger = LoggerFactory.getLogger(AiravataWorkflowNodeStatusUpdator.class);
- private Registry airavataRegistry;
+ private ExperimentCatalog airavataExperimentCatalog;
private MonitorPublisher monitorPublisher;
private Publisher publisher;
- public Registry getAiravataRegistry() {
- return airavataRegistry;
+ public ExperimentCatalog getAiravataExperimentCatalog() {
+ return airavataExperimentCatalog;
}
- public void setAiravataRegistry(Registry airavataRegistry) {
- this.airavataRegistry = airavataRegistry;
+ public void setAiravataExperimentCatalog(ExperimentCatalog airavataExperimentCatalog) {
+ this.airavataExperimentCatalog = airavataExperimentCatalog;
}
@Subscribe
@@ -103,7 +103,7 @@ public class AiravataWorkflowNodeStatusUpdator implements AbstractActivityListen
public void updateWorkflowNodeStatus(String experimentId, String workflowNodeId, WorkflowNodeState state) throws Exception {
logger.info("expId - {}: Updating workflow node status for "+workflowNodeId+":"+state.toString(), experimentId);
- WorkflowNodeDetails details = (WorkflowNodeDetails)airavataRegistry.get(RegistryModelType.WORKFLOW_NODE_DETAIL, workflowNodeId);
+ WorkflowNodeDetails details = (WorkflowNodeDetails) airavataExperimentCatalog.get(ExperimentCatalogModelType.WORKFLOW_NODE_DETAIL, workflowNodeId);
if(details == null) {
details = new WorkflowNodeDetails();
details.setNodeInstanceId(workflowNodeId);
@@ -112,13 +112,13 @@ public class AiravataWorkflowNodeStatusUpdator implements AbstractActivityListen
status.setWorkflowNodeState(state);
status.setTimeOfStateChange(Calendar.getInstance().getTimeInMillis());
details.setWorkflowNodeStatus(status);
- airavataRegistry.update(RegistryModelType.WORKFLOW_NODE_STATUS, status, workflowNodeId);
+ airavataExperimentCatalog.update(ExperimentCatalogModelType.WORKFLOW_NODE_STATUS, status, workflowNodeId);
}
public void setup(Object... configurations) {
for (Object configuration : configurations) {
- if (configuration instanceof Registry){
- this.airavataRegistry=(Registry)configuration;
+ if (configuration instanceof ExperimentCatalog){
+ this.airavataExperimentCatalog =(ExperimentCatalog)configuration;
} else if (configuration instanceof MonitorPublisher){
this.monitorPublisher=(MonitorPublisher) configuration;
} else if (configuration instanceof Publisher){
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/BetterGfacImpl.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/BetterGfacImpl.java b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/BetterGfacImpl.java
index f4c627f..564fcb2 100644
--- a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/BetterGfacImpl.java
+++ b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/BetterGfacImpl.java
@@ -20,8 +20,8 @@
*/
package org.apache.airavata.gfac.impl;
-import org.airavata.appcatalog.cpi.AppCatalog;
-import org.airavata.appcatalog.cpi.AppCatalogException;
+import org.apache.airavata.registry.cpi.AppCatalog;
+import org.apache.airavata.registry.cpi.AppCatalogException;
import org.apache.aiaravata.application.catalog.data.impl.AppCatalogFactory;
import org.apache.airavata.common.utils.AiravataZKUtils;
import org.apache.airavata.common.utils.MonitorPublisher;
@@ -71,9 +71,9 @@ import org.apache.airavata.model.workspace.experiment.JobDetails;
import org.apache.airavata.model.workspace.experiment.JobState;
import org.apache.airavata.model.workspace.experiment.TaskDetails;
import org.apache.airavata.model.workspace.experiment.TaskState;
-import org.apache.airavata.registry.cpi.Registry;
+import org.apache.airavata.registry.cpi.ExperimentCatalog;
+import org.apache.airavata.registry.cpi.ExperimentCatalogModelType;
import org.apache.airavata.registry.cpi.RegistryException;
-import org.apache.airavata.registry.cpi.RegistryModelType;
import org.apache.curator.framework.CuratorFramework;
import org.apache.curator.utils.ZKPaths;
import org.slf4j.Logger;
@@ -96,7 +96,7 @@ import java.util.Properties;
public class BetterGfacImpl implements GFac {
private static final Logger log = LoggerFactory.getLogger(BetterGfacImpl.class);
private static String ERROR_SENT = "ErrorSent";
- private Registry registry;
+ private ExperimentCatalog experimentCatalog;
private CuratorFramework curatorClient;
private MonitorPublisher monitorPublisher;
private static GFac gfacInstance;
@@ -118,9 +118,9 @@ public class BetterGfacImpl implements GFac {
}
@Override
- public boolean init(Registry registry, AppCatalog appCatalog, CuratorFramework curatorClient,
+ public boolean init(ExperimentCatalog experimentCatalog, AppCatalog appCatalog, CuratorFramework curatorClient,
MonitorPublisher publisher) {
- this.registry = registry;
+ this.experimentCatalog = experimentCatalog;
monitorPublisher = publisher; // This is a EventBus common for gfac
this.curatorClient = curatorClient;
return initialized = true;
@@ -177,7 +177,7 @@ public class BetterGfacImpl implements GFac {
*/
//Fetch the Task details for the requested experimentID from the registry. Extract required pointers from the Task object.
- TaskDetails taskData = (TaskDetails) registry.get(RegistryModelType.TASK_DETAIL, taskID);
+ TaskDetails taskData = (TaskDetails) experimentCatalog.get(ExperimentCatalogModelType.TASK_DETAIL, taskID);
String applicationInterfaceId = taskData.getApplicationId();
String applicationDeploymentId = taskData.getApplicationDeploymentId();
@@ -220,7 +220,7 @@ public class BetterGfacImpl implements GFac {
jobExecutionContext = new JobExecutionContext(gFacConfiguration, applicationInterface.getApplicationName());
// setting experiment/task/workflownode related information
- Experiment experiment = (Experiment) registry.get(RegistryModelType.EXPERIMENT, experimentID);
+ Experiment experiment = (Experiment) experimentCatalog.get(ExperimentCatalogModelType.EXPERIMENT, experimentID);
jobExecutionContext.setExperiment(experiment);
jobExecutionContext.setExperimentID(experimentID);
jobExecutionContext.setWorkflowNodeDetails(experiment.getWorkflowNodeDetailsList().get(0));
@@ -235,7 +235,7 @@ public class BetterGfacImpl implements GFac {
jobExecutionContext.setJobDetails(jDetails);
}
// setting the registry
- jobExecutionContext.setRegistry(registry);
+ jobExecutionContext.setExperimentCatalog(experimentCatalog);
ApplicationContext applicationContext = new ApplicationContext();
applicationContext.setComputeResourceDescription(computeResource);
@@ -1096,7 +1096,7 @@ public class BetterGfacImpl implements GFac {
private boolean isCancelled(JobExecutionContext executionContext) {
// we should check whether experiment is cancelled using registry
try {
- ExperimentStatus status = (ExperimentStatus) registry.get(RegistryModelType.EXPERIMENT_STATUS, executionContext.getExperimentID());
+ ExperimentStatus status = (ExperimentStatus) experimentCatalog.get(ExperimentCatalogModelType.EXPERIMENT_STATUS, executionContext.getExperimentID());
if (status != null) {
ExperimentState experimentState = status.getExperimentState();
if (experimentState != null) {
@@ -1114,7 +1114,7 @@ public class BetterGfacImpl implements GFac {
private boolean isCancelling(JobExecutionContext executionContext) {
// check whether cancelling request came
try {
- ExperimentStatus status = (ExperimentStatus) registry.get(RegistryModelType.EXPERIMENT_STATUS, executionContext.getExperimentID());
+ ExperimentStatus status = (ExperimentStatus) experimentCatalog.get(ExperimentCatalogModelType.EXPERIMENT_STATUS, executionContext.getExperimentID());
if (status != null) {
ExperimentState experimentState = status.getExperimentState();
if (experimentState != null) {
@@ -1131,7 +1131,7 @@ public class BetterGfacImpl implements GFac {
private boolean isCancel(JobExecutionContext jobExecutionContext) {
try {
- ExperimentStatus status = (ExperimentStatus) registry.get(RegistryModelType.EXPERIMENT_STATUS, jobExecutionContext.getExperimentID());
+ ExperimentStatus status = (ExperimentStatus) experimentCatalog.get(ExperimentCatalogModelType.EXPERIMENT_STATUS, jobExecutionContext.getExperimentID());
if (status != null) {
ExperimentState experimentState = status.getExperimentState();
if (experimentState != null) {
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/local/provider/impl/LocalProvider.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/local/provider/impl/LocalProvider.java b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/local/provider/impl/LocalProvider.java
index f00e62a..1bc5244 100644
--- a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/local/provider/impl/LocalProvider.java
+++ b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/local/provider/impl/LocalProvider.java
@@ -49,8 +49,8 @@ import org.apache.airavata.model.messaging.event.TaskOutputChangeEvent;
import org.apache.airavata.model.workspace.experiment.JobDetails;
import org.apache.airavata.model.workspace.experiment.JobState;
import org.apache.airavata.model.workspace.experiment.TaskDetails;
-import org.apache.airavata.registry.cpi.ChildDataType;
-import org.apache.airavata.registry.cpi.RegistryModelType;
+import org.apache.airavata.registry.cpi.ExpCatChildDataType;
+import org.apache.airavata.registry.cpi.ExperimentCatalogModelType;
import org.apache.xmlbeans.XmlException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -224,12 +224,12 @@ public class LocalProvider extends AbstractProvider {
String stdErrStr = GFacUtils.readFileToString(jobExecutionContext.getStandardError());
Map<String, Object> output = jobExecutionContext.getOutMessageContext().getParameters();
OutputUtils.fillOutputFromStdout(output, stdOutStr, stdErrStr, outputArray);
- TaskDetails taskDetails = (TaskDetails)registry.get(RegistryModelType.TASK_DETAIL, jobExecutionContext.getTaskData().getTaskID());
+ TaskDetails taskDetails = (TaskDetails) experimentCatalog.get(ExperimentCatalogModelType.TASK_DETAIL, jobExecutionContext.getTaskData().getTaskID());
if (taskDetails != null){
taskDetails.setApplicationOutputs(outputArray);
- registry.update(RegistryModelType.TASK_DETAIL, taskDetails, taskDetails.getTaskID());
+ experimentCatalog.update(ExperimentCatalogModelType.TASK_DETAIL, taskDetails, taskDetails.getTaskID());
}
- registry.add(ChildDataType.EXPERIMENT_OUTPUT, outputArray, jobExecutionContext.getExperimentID());
+ experimentCatalog.add(ExpCatChildDataType.EXPERIMENT_OUTPUT, outputArray, jobExecutionContext.getExperimentID());
TaskIdentifier taskIdentity = new TaskIdentifier(jobExecutionContext.getTaskData().getTaskID(),
jobExecutionContext.getWorkflowNodeDetails().getNodeInstanceId(),
jobExecutionContext.getExperimentID(),
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/ssh/handler/AdvancedSCPInputHandler.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/ssh/handler/AdvancedSCPInputHandler.java b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/ssh/handler/AdvancedSCPInputHandler.java
index db9522e..712678c 100644
--- a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/ssh/handler/AdvancedSCPInputHandler.java
+++ b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/ssh/handler/AdvancedSCPInputHandler.java
@@ -36,7 +36,7 @@ import org.apache.airavata.gfac.core.authentication.AuthenticationInfo;
import org.apache.airavata.model.appcatalog.appinterface.DataType;
import org.apache.airavata.model.appcatalog.appinterface.InputDataObjectType;
import org.apache.airavata.model.workspace.experiment.*;
-import org.apache.airavata.registry.cpi.ChildDataType;
+import org.apache.airavata.registry.cpi.ExpCatChildDataType;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -166,7 +166,7 @@ public class AdvancedSCPInputHandler extends AbstractHandler {
status.setTransferState(TransferState.UPLOAD);
detail.setTransferStatus(status);
detail.setTransferDescription("Input Data Staged: " + stageInputFile);
- registry.add(ChildDataType.DATA_TRANSFER_DETAIL, detail, jobExecutionContext.getTaskData().getTaskID());
+ experimentCatalog.add(ExpCatChildDataType.DATA_TRANSFER_DETAIL, detail, jobExecutionContext.getTaskData().getTaskID());
GFacUtils.saveHandlerData(jobExecutionContext, temp.insert(0, ++index), this.getClass().getName());
}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/ssh/handler/AdvancedSCPOutputHandler.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/ssh/handler/AdvancedSCPOutputHandler.java b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/ssh/handler/AdvancedSCPOutputHandler.java
index ad7df41..ddfff15 100644
--- a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/ssh/handler/AdvancedSCPOutputHandler.java
+++ b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/ssh/handler/AdvancedSCPOutputHandler.java
@@ -37,7 +37,7 @@ import org.apache.airavata.model.appcatalog.appinterface.DataType;
import org.apache.airavata.model.appcatalog.appinterface.OutputDataObjectType;
import org.apache.airavata.model.workspace.experiment.CorrectiveAction;
import org.apache.airavata.model.workspace.experiment.ErrorCategory;
-import org.apache.airavata.registry.cpi.ChildDataType;
+import org.apache.airavata.registry.cpi.ExpCatChildDataType;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -194,7 +194,7 @@ public class AdvancedSCPOutputHandler extends AbstractHandler {
outputArray.add(dataObjectType);
}
}
- registry.add(ChildDataType.EXPERIMENT_OUTPUT, outputArray, jobExecutionContext.getExperimentID());
+ experimentCatalog.add(ExpCatChildDataType.EXPERIMENT_OUTPUT, outputArray, jobExecutionContext.getExperimentID());
} catch (SSHApiException e) {
try {
StringWriter errors = new StringWriter();
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/ssh/handler/NewSSHOutputHandler.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/ssh/handler/NewSSHOutputHandler.java b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/ssh/handler/NewSSHOutputHandler.java
index 0df9eab..0758a59 100644
--- a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/ssh/handler/NewSSHOutputHandler.java
+++ b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/ssh/handler/NewSSHOutputHandler.java
@@ -18,7 +18,7 @@ import org.apache.airavata.gfac.ssh.util.HandleOutputs;
import org.apache.airavata.model.appcatalog.appinterface.OutputDataObjectType;
import org.apache.airavata.model.workspace.experiment.CorrectiveAction;
import org.apache.airavata.model.workspace.experiment.ErrorCategory;
-import org.apache.airavata.registry.cpi.ChildDataType;
+import org.apache.airavata.registry.cpi.ExpCatChildDataType;
import org.apache.airavata.registry.cpi.RegistryException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -56,7 +56,7 @@ public class NewSSHOutputHandler extends AbstractHandler{
super.invoke(jobExecutionContext);
List<OutputDataObjectType> outputArray = HandleOutputs.handleOutputs(jobExecutionContext, cluster);
try {
- registry.add(ChildDataType.EXPERIMENT_OUTPUT, outputArray, jobExecutionContext.getExperimentID());
+ experimentCatalog.add(ExpCatChildDataType.EXPERIMENT_OUTPUT, outputArray, jobExecutionContext.getExperimentID());
} catch (RegistryException e) {
throw new GFacHandlerException(e);
}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/ssh/handler/SSHDirectorySetupHandler.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/ssh/handler/SSHDirectorySetupHandler.java b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/ssh/handler/SSHDirectorySetupHandler.java
index c96e5d9..e675680 100644
--- a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/ssh/handler/SSHDirectorySetupHandler.java
+++ b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/ssh/handler/SSHDirectorySetupHandler.java
@@ -29,7 +29,7 @@ import org.apache.airavata.gfac.core.GFacUtils;
import org.apache.airavata.gfac.ssh.security.SSHSecurityContext;
import org.apache.airavata.gfac.ssh.util.GFACSSHUtils;
import org.apache.airavata.model.workspace.experiment.*;
-import org.apache.airavata.registry.cpi.ChildDataType;
+import org.apache.airavata.registry.cpi.ExpCatChildDataType;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -92,7 +92,7 @@ public class SSHDirectorySetupHandler extends AbstractHandler {
detail.setTransferStatus(status);
detail.setTransferDescription("Working directory = " + workingDirectory);
- registry.add(ChildDataType.DATA_TRANSFER_DETAIL, detail, jobExecutionContext.getTaskData().getTaskID());
+ experimentCatalog.add(ExpCatChildDataType.DATA_TRANSFER_DETAIL, detail, jobExecutionContext.getTaskData().getTaskID());
} catch (Exception e) {
DataTransferDetails detail = new DataTransferDetails();
@@ -101,7 +101,7 @@ public class SSHDirectorySetupHandler extends AbstractHandler {
detail.setTransferStatus(status);
detail.setTransferDescription("Working directory = " + jobExecutionContext.getWorkingDir());
try {
- registry.add(ChildDataType.DATA_TRANSFER_DETAIL, detail, jobExecutionContext.getTaskData().getTaskID());
+ experimentCatalog.add(ExpCatChildDataType.DATA_TRANSFER_DETAIL, detail, jobExecutionContext.getTaskData().getTaskID());
StringWriter errors = new StringWriter();
e.printStackTrace(new PrintWriter(errors));
GFacUtils.saveErrorDetails(jobExecutionContext, errors.toString(), CorrectiveAction.CONTACT_SUPPORT, ErrorCategory.FILE_SYSTEM_FAILURE);
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/ssh/handler/SSHInputHandler.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/ssh/handler/SSHInputHandler.java b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/ssh/handler/SSHInputHandler.java
index 1c83e88..4940c3f 100644
--- a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/ssh/handler/SSHInputHandler.java
+++ b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/ssh/handler/SSHInputHandler.java
@@ -33,7 +33,7 @@ import org.apache.airavata.gfac.ssh.util.GFACSSHUtils;
import org.apache.airavata.model.appcatalog.appinterface.DataType;
import org.apache.airavata.model.appcatalog.appinterface.InputDataObjectType;
import org.apache.airavata.model.workspace.experiment.*;
-import org.apache.airavata.registry.cpi.ChildDataType;
+import org.apache.airavata.registry.cpi.ExpCatChildDataType;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -108,7 +108,7 @@ public class SSHInputHandler extends AbstractHandler {
status.setTransferState(TransferState.UPLOAD);
detail.setTransferStatus(status);
detail.setTransferDescription("Input Data Staged: " + stageInputFile);
- registry.add(ChildDataType.DATA_TRANSFER_DETAIL, detail, jobExecutionContext.getTaskData().getTaskID());
+ experimentCatalog.add(ExpCatChildDataType.DATA_TRANSFER_DETAIL, detail, jobExecutionContext.getTaskData().getTaskID());
GFacUtils.saveHandlerData(jobExecutionContext, temp.insert(0, ++index), this.getClass().getName());
}
@@ -144,7 +144,7 @@ public class SSHInputHandler extends AbstractHandler {
StringWriter errors = new StringWriter();
e.printStackTrace(new PrintWriter(errors));
GFacUtils.saveErrorDetails(jobExecutionContext, errors.toString(), CorrectiveAction.CONTACT_SUPPORT, ErrorCategory.FILE_SYSTEM_FAILURE);
- registry.add(ChildDataType.DATA_TRANSFER_DETAIL, detail, jobExecutionContext.getTaskData().getTaskID());
+ experimentCatalog.add(ExpCatChildDataType.DATA_TRANSFER_DETAIL, detail, jobExecutionContext.getTaskData().getTaskID());
} catch (Exception e1) {
throw new GFacHandlerException("Error persisting status", e1, e1.getLocalizedMessage());
}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/ssh/handler/SSHOutputHandler.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/ssh/handler/SSHOutputHandler.java b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/ssh/handler/SSHOutputHandler.java
index 17a48e7..80b8069 100644
--- a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/ssh/handler/SSHOutputHandler.java
+++ b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/ssh/handler/SSHOutputHandler.java
@@ -40,7 +40,7 @@ import org.apache.airavata.model.workspace.experiment.ErrorCategory;
import org.apache.airavata.model.workspace.experiment.TaskDetails;
import org.apache.airavata.model.workspace.experiment.TransferState;
import org.apache.airavata.model.workspace.experiment.TransferStatus;
-import org.apache.airavata.registry.cpi.ChildDataType;
+import org.apache.airavata.registry.cpi.ExpCatChildDataType;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -130,12 +130,12 @@ public class SSHOutputHandler extends AbstractHandler {
status.setTransferState(TransferState.STDOUT_DOWNLOAD);
detail.setTransferStatus(status);
detail.setTransferDescription("STDOUT:" + localStdOutFile.getAbsolutePath());
- registry.add(ChildDataType.DATA_TRANSFER_DETAIL, detail, jobExecutionContext.getTaskData().getTaskID());
+ experimentCatalog.add(ExpCatChildDataType.DATA_TRANSFER_DETAIL, detail, jobExecutionContext.getTaskData().getTaskID());
status.setTransferState(TransferState.STDERROR_DOWNLOAD);
detail.setTransferStatus(status);
detail.setTransferDescription("STDERR:" + localStdErrFile.getAbsolutePath());
- registry.add(ChildDataType.DATA_TRANSFER_DETAIL, detail, jobExecutionContext.getTaskData().getTaskID());
+ experimentCatalog.add(ExpCatChildDataType.DATA_TRANSFER_DETAIL, detail, jobExecutionContext.getTaskData().getTaskID());
List<OutputDataObjectType> outputArray = new ArrayList<OutputDataObjectType>();
@@ -226,14 +226,14 @@ public class SSHOutputHandler extends AbstractHandler {
status.setTransferState(TransferState.DOWNLOAD);
detail.setTransferStatus(status);
detail.setTransferDescription(outputDataDir);
- registry.add(ChildDataType.DATA_TRANSFER_DETAIL, detail, jobExecutionContext.getTaskData().getTaskID());
- registry.add(ChildDataType.EXPERIMENT_OUTPUT, outputArray, jobExecutionContext.getExperimentID());
+ experimentCatalog.add(ExpCatChildDataType.DATA_TRANSFER_DETAIL, detail, jobExecutionContext.getTaskData().getTaskID());
+ experimentCatalog.add(ExpCatChildDataType.EXPERIMENT_OUTPUT, outputArray, jobExecutionContext.getExperimentID());
} catch (Exception e) {
try {
status.setTransferState(TransferState.FAILED);
detail.setTransferStatus(status);
- registry.add(ChildDataType.DATA_TRANSFER_DETAIL, detail, jobExecutionContext.getTaskData().getTaskID());
+ experimentCatalog.add(ExpCatChildDataType.DATA_TRANSFER_DETAIL, detail, jobExecutionContext.getTaskData().getTaskID());
StringWriter errors = new StringWriter();
e.printStackTrace(new PrintWriter(errors));
GFacUtils.saveErrorDetails(jobExecutionContext, errors.toString(), CorrectiveAction.CONTACT_SUPPORT, ErrorCategory.FILE_SYSTEM_FAILURE);
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/ssh/provider/impl/SSHProvider.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/ssh/provider/impl/SSHProvider.java b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/ssh/provider/impl/SSHProvider.java
index 44f24fa..58fe0e3 100644
--- a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/ssh/provider/impl/SSHProvider.java
+++ b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/ssh/provider/impl/SSHProvider.java
@@ -21,7 +21,7 @@
package org.apache.airavata.gfac.ssh.provider.impl;
-import org.airavata.appcatalog.cpi.AppCatalogException;
+import org.apache.airavata.registry.cpi.AppCatalogException;
import org.apache.airavata.common.exception.AiravataException;
import org.apache.airavata.common.exception.ApplicationSettingsException;
import org.apache.airavata.common.utils.MonitorPublisher;
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/ssh/util/GFACSSHUtils.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/ssh/util/GFACSSHUtils.java b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/ssh/util/GFACSSHUtils.java
index 307d8c3..ae4eaa5 100644
--- a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/ssh/util/GFACSSHUtils.java
+++ b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/ssh/util/GFACSSHUtils.java
@@ -20,8 +20,8 @@
*/
package org.apache.airavata.gfac.ssh.util;
-import org.airavata.appcatalog.cpi.AppCatalog;
-import org.airavata.appcatalog.cpi.AppCatalogException;
+import org.apache.airavata.registry.cpi.AppCatalog;
+import org.apache.airavata.registry.cpi.AppCatalogException;
import org.apache.airavata.common.exception.ApplicationSettingsException;
import org.apache.airavata.common.utils.ServerSettings;
import org.apache.airavata.credential.store.credential.impl.ssh.SSHCredential;
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/gfac/gfac-impl/src/test/java/org/apache/airavata/job/AMQPMonitorTest.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-impl/src/test/java/org/apache/airavata/job/AMQPMonitorTest.java b/modules/gfac/gfac-impl/src/test/java/org/apache/airavata/job/AMQPMonitorTest.java
index aecc8c2..fc0ea30 100644
--- a/modules/gfac/gfac-impl/src/test/java/org/apache/airavata/job/AMQPMonitorTest.java
+++ b/modules/gfac/gfac-impl/src/test/java/org/apache/airavata/job/AMQPMonitorTest.java
@@ -22,7 +22,7 @@ package org.apache.airavata.job;
import com.google.common.eventbus.EventBus;
import com.google.common.eventbus.Subscribe;
-import org.airavata.appcatalog.cpi.AppCatalog;
+import org.apache.airavata.registry.cpi.AppCatalog;
import org.apache.aiaravata.application.catalog.data.impl.AppCatalogFactory;
import org.apache.airavata.common.utils.MonitorPublisher;
import org.apache.airavata.gfac.core.JobDescriptor;
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/gfac/gfac-service/src/main/java/org/apache/airavata/gfac/server/GfacServerHandler.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-service/src/main/java/org/apache/airavata/gfac/server/GfacServerHandler.java b/modules/gfac/gfac-service/src/main/java/org/apache/airavata/gfac/server/GfacServerHandler.java
index 64c06e4..c3abe78 100644
--- a/modules/gfac/gfac-service/src/main/java/org/apache/airavata/gfac/server/GfacServerHandler.java
+++ b/modules/gfac/gfac-service/src/main/java/org/apache/airavata/gfac/server/GfacServerHandler.java
@@ -21,7 +21,7 @@
package org.apache.airavata.gfac.server;
import com.google.common.eventbus.EventBus;
-import org.airavata.appcatalog.cpi.AppCatalog;
+import org.apache.airavata.registry.cpi.AppCatalog;
import org.apache.aiaravata.application.catalog.data.impl.AppCatalogFactory;
import org.apache.airavata.common.exception.AiravataException;
import org.apache.airavata.common.exception.ApplicationSettingsException;
@@ -33,6 +33,7 @@ import org.apache.airavata.common.utils.MonitorPublisher;
import org.apache.airavata.common.utils.ServerSettings;
import org.apache.airavata.common.utils.ThriftUtils;
import org.apache.airavata.common.utils.listener.AbstractActivityListener;
+import org.apache.airavata.registry.core.experiment.catalog.impl.RegistryFactory;
import org.apache.airavata.gfac.GFacConfiguration;
import org.apache.airavata.gfac.GFacException;
import org.apache.airavata.gfac.core.GFac;
@@ -56,10 +57,9 @@ import org.apache.airavata.model.messaging.event.TaskSubmitEvent;
import org.apache.airavata.model.messaging.event.TaskTerminateEvent;
import org.apache.airavata.model.workspace.experiment.ExperimentState;
import org.apache.airavata.model.workspace.experiment.ExperimentStatus;
-import org.apache.airavata.persistance.registry.jpa.impl.RegistryFactory;
-import org.apache.airavata.registry.cpi.Registry;
+import org.apache.airavata.registry.cpi.ExperimentCatalog;
+import org.apache.airavata.registry.cpi.ExperimentCatalogModelType;
import org.apache.airavata.registry.cpi.RegistryException;
-import org.apache.airavata.registry.cpi.RegistryModelType;
import org.apache.curator.RetryPolicy;
import org.apache.curator.framework.CuratorFramework;
import org.apache.curator.framework.CuratorFrameworkFactory;
@@ -87,7 +87,7 @@ public class GfacServerHandler implements GfacService.Iface {
private final static AiravataLogger logger = AiravataLoggerFactory.getLogger(GfacServerHandler.class);
private static RabbitMQTaskLaunchConsumer rabbitMQTaskLaunchConsumer;
private static int requestCount=0;
- private Registry registry;
+ private ExperimentCatalog experimentCatalog;
private AppCatalog appCatalog;
private String gatewayName;
private String airavataUserName;
@@ -114,17 +114,17 @@ public class GfacServerHandler implements GfacService.Iface {
+ ":" + ServerSettings.getSetting(Constants.GFAC_SERVER_PORT);
storeServerConfig();
publisher = new MonitorPublisher(new EventBus());
- registry = RegistryFactory.getDefaultRegistry();
+ experimentCatalog = RegistryFactory.getDefaultRegistry();
appCatalog = AppCatalogFactory.getAppCatalog();
setGatewayProperties();
startDaemonHandlers();
// initializing Better Gfac Instance
- BetterGfacImpl.getInstance().init(registry, appCatalog, curatorClient, publisher);
+ BetterGfacImpl.getInstance().init(experimentCatalog, appCatalog, curatorClient, publisher);
if (ServerSettings.isGFacPassiveMode()) {
rabbitMQTaskLaunchConsumer = new RabbitMQTaskLaunchConsumer();
rabbitMQTaskLaunchConsumer.listen(new TaskLaunchMessageHandler());
}
- startStatusUpdators(registry, curatorClient, publisher, rabbitMQTaskLaunchConsumer);
+ startStatusUpdators(experimentCatalog, curatorClient, publisher, rabbitMQTaskLaunchConsumer);
} catch (Exception e) {
throw new Exception("Error initialising GFAC", e);
@@ -227,12 +227,12 @@ public class GfacServerHandler implements GfacService.Iface {
}
}
- public Registry getRegistry() {
- return registry;
+ public ExperimentCatalog getExperimentCatalog() {
+ return experimentCatalog;
}
- public void setRegistry(Registry registry) {
- this.registry = registry;
+ public void setExperimentCatalog(ExperimentCatalog experimentCatalog) {
+ this.experimentCatalog = experimentCatalog;
}
public String getGatewayName() {
@@ -258,7 +258,7 @@ public class GfacServerHandler implements GfacService.Iface {
private GFac getGfac() throws TException {
GFac gFac = BetterGfacImpl.getInstance();
- gFac.init(registry, appCatalog, curatorClient, publisher);
+ gFac.init(experimentCatalog, appCatalog, curatorClient, publisher);
return gFac;
}
@@ -288,7 +288,7 @@ public class GfacServerHandler implements GfacService.Iface {
}
- public static void startStatusUpdators(Registry registry, CuratorFramework curatorClient, MonitorPublisher publisher,
+ public static void startStatusUpdators(ExperimentCatalog experimentCatalog, CuratorFramework curatorClient, MonitorPublisher publisher,
RabbitMQTaskLaunchConsumer rabbitMQTaskLaunchConsumer) {
try {
@@ -298,7 +298,7 @@ public class GfacServerHandler implements GfacService.Iface {
Class<? extends AbstractActivityListener> aClass = Class.forName(listenerClass).asSubclass(AbstractActivityListener.class);
AbstractActivityListener abstractActivityListener = aClass.newInstance();
activityListeners.add(abstractActivityListener);
- abstractActivityListener.setup(publisher, registry, curatorClient, rabbitMQPublisher, rabbitMQTaskLaunchConsumer);
+ abstractActivityListener.setup(publisher, experimentCatalog, curatorClient, rabbitMQPublisher, rabbitMQTaskLaunchConsumer);
logger.info("Registering listener: " + listenerClass);
publisher.registerListener(abstractActivityListener);
}
@@ -365,7 +365,7 @@ public class GfacServerHandler implements GfacService.Iface {
ExperimentStatus status = new ExperimentStatus();
status.setExperimentState(ExperimentState.EXECUTING);
status.setTimeOfStateChange(Calendar.getInstance().getTimeInMillis());
- registry.update(RegistryModelType.EXPERIMENT_STATUS, status, event.getExperimentId());
+ experimentCatalog.update(ExperimentCatalogModelType.EXPERIMENT_STATUS, status, event.getExperimentId());
experimentNode = ServerSettings.getSetting(Constants.ZOOKEEPER_GFAC_EXPERIMENT_NODE, "/gfac-experiments");
try {
GFacUtils.createExperimentEntryForPassive(event.getExperimentId(), event.getTaskId(), curatorClient,
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/gfac/gfac-service/src/test/java/org/apache/airavata/gfac/client/GfacClientFactoryTest.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-service/src/test/java/org/apache/airavata/gfac/client/GfacClientFactoryTest.java b/modules/gfac/gfac-service/src/test/java/org/apache/airavata/gfac/client/GfacClientFactoryTest.java
index b01c8a5..ce88c18 100644
--- a/modules/gfac/gfac-service/src/test/java/org/apache/airavata/gfac/client/GfacClientFactoryTest.java
+++ b/modules/gfac/gfac-service/src/test/java/org/apache/airavata/gfac/client/GfacClientFactoryTest.java
@@ -24,7 +24,7 @@ package org.apache.airavata.gfac.client;
import org.apache.airavata.gfac.client.util.Initialize;
import org.apache.airavata.gfac.cpi.GfacService;
import org.apache.airavata.gfac.server.GfacServer;
-import org.apache.airavata.registry.cpi.Registry;
+import org.apache.airavata.registry.cpi.ExperimentCatalog;
import org.apache.zookeeper.server.ServerCnxnFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -33,7 +33,7 @@ public class GfacClientFactoryTest {
private final static Logger logger = LoggerFactory.getLogger(GfacClientFactoryTest.class);
// private DocumentCreator documentCreator;
private GfacService.Client gfacClient;
- private Registry registry;
+ private ExperimentCatalog experimentCatalog;
private int NUM_CONCURRENT_REQUESTS = 1;
Initialize initialize;
GfacServer service;
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/gfac/gfac-service/src/test/java/org/apache/airavata/gfac/client/util/Initialize.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-service/src/test/java/org/apache/airavata/gfac/client/util/Initialize.java b/modules/gfac/gfac-service/src/test/java/org/apache/airavata/gfac/client/util/Initialize.java
index 15d384c..548d4b5 100644
--- a/modules/gfac/gfac-service/src/test/java/org/apache/airavata/gfac/client/util/Initialize.java
+++ b/modules/gfac/gfac-service/src/test/java/org/apache/airavata/gfac/client/util/Initialize.java
@@ -23,8 +23,8 @@ package org.apache.airavata.gfac.client.util;
import org.apache.airavata.common.exception.ApplicationSettingsException;
import org.apache.airavata.common.utils.ServerSettings;
-import org.apache.airavata.experiment.catalog.ResourceType;
-import org.apache.airavata.experiment.catalog.resources.*;
+import org.apache.airavata.registry.core.experiment.catalog.ResourceType;
+import org.apache.airavata.registry.core.experiment.catalog.resources.*;
import org.apache.airavata.registry.cpi.RegistryException;
import org.apache.derby.drda.NetworkServerControl;
import org.slf4j.Logger;
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/integration-tests/src/test/java/org/apache/airavata/integration/DataRetrievalIT.java
----------------------------------------------------------------------
diff --git a/modules/integration-tests/src/test/java/org/apache/airavata/integration/DataRetrievalIT.java b/modules/integration-tests/src/test/java/org/apache/airavata/integration/DataRetrievalIT.java
index a23fff0..a9e743a 100644
--- a/modules/integration-tests/src/test/java/org/apache/airavata/integration/DataRetrievalIT.java
+++ b/modules/integration-tests/src/test/java/org/apache/airavata/integration/DataRetrievalIT.java
@@ -21,7 +21,7 @@
package org.apache.airavata.integration;
-import org.airavata.appcatalog.cpi.AppCatalogException;
+import org.apache.airavata.registry.cpi.AppCatalogException;
import org.apache.airavata.api.Airavata.Client;
import org.apache.airavata.common.exception.ApplicationSettingsException;
import org.apache.airavata.integration.tools.DocumentCreatorNew;
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/integration-tests/src/test/java/org/apache/airavata/integration/tools/DocumentCreatorNew.java
----------------------------------------------------------------------
diff --git a/modules/integration-tests/src/test/java/org/apache/airavata/integration/tools/DocumentCreatorNew.java b/modules/integration-tests/src/test/java/org/apache/airavata/integration/tools/DocumentCreatorNew.java
index 34786fe..ff0dd1c 100644
--- a/modules/integration-tests/src/test/java/org/apache/airavata/integration/tools/DocumentCreatorNew.java
+++ b/modules/integration-tests/src/test/java/org/apache/airavata/integration/tools/DocumentCreatorNew.java
@@ -20,10 +20,9 @@
*/
package org.apache.airavata.integration.tools;
-import org.airavata.appcatalog.cpi.AppCatalog;
-import org.airavata.appcatalog.cpi.AppCatalogException;
+import org.apache.airavata.registry.cpi.AppCatalog;
+import org.apache.airavata.registry.cpi.AppCatalogException;
import org.apache.airavata.api.Airavata;
-import org.apache.airavata.common.utils.ClientSettings;
import org.apache.airavata.model.appcatalog.appdeployment.ApplicationDeploymentDescription;
import org.apache.airavata.model.appcatalog.appdeployment.ApplicationModule;
import org.apache.airavata.model.appcatalog.appdeployment.ApplicationParallelismType;
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/integration-tests/src/test/java/org/apache/airavata/integration/tools/DocumentCreatorUtils.java
----------------------------------------------------------------------
diff --git a/modules/integration-tests/src/test/java/org/apache/airavata/integration/tools/DocumentCreatorUtils.java b/modules/integration-tests/src/test/java/org/apache/airavata/integration/tools/DocumentCreatorUtils.java
index a49d22f..caad455 100644
--- a/modules/integration-tests/src/test/java/org/apache/airavata/integration/tools/DocumentCreatorUtils.java
+++ b/modules/integration-tests/src/test/java/org/apache/airavata/integration/tools/DocumentCreatorUtils.java
@@ -21,7 +21,7 @@
package org.apache.airavata.integration.tools;
-import org.airavata.appcatalog.cpi.AppCatalogException;
+import org.apache.airavata.registry.cpi.AppCatalogException;
import org.apache.airavata.model.appcatalog.appdeployment.ApplicationDeploymentDescription;
import org.apache.airavata.model.appcatalog.appdeployment.ApplicationModule;
import org.apache.airavata.model.appcatalog.appdeployment.ApplicationParallelismType;
@@ -39,7 +39,6 @@ import org.apache.airavata.model.appcatalog.gatewayprofile.ComputeResourcePrefer
import java.util.List;
import java.util.Map;
-import java.util.Set;
public class DocumentCreatorUtils {
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/validator/impl/BatchQueueValidator.java
----------------------------------------------------------------------
diff --git a/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/validator/impl/BatchQueueValidator.java b/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/validator/impl/BatchQueueValidator.java
index a0d6ce5..e3b2cdc 100644
--- a/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/validator/impl/BatchQueueValidator.java
+++ b/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/validator/impl/BatchQueueValidator.java
@@ -29,7 +29,7 @@ import org.apache.airavata.model.error.ValidationResults;
import org.apache.airavata.model.error.ValidatorResult;
import org.apache.airavata.model.workspace.experiment.*;
import org.apache.airavata.orchestrator.core.validator.JobMetadataValidator;
-import org.apache.airavata.experiment.catalog.impl.RegistryFactory;
+import org.apache.airavata.registry.core.experiment.catalog.impl.RegistryFactory;
import org.apache.airavata.registry.cpi.Registry;
import org.apache.airavata.registry.cpi.RegistryException;
import org.slf4j.Logger;
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/cpi/impl/AbstractOrchestrator.java
----------------------------------------------------------------------
diff --git a/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/cpi/impl/AbstractOrchestrator.java b/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/cpi/impl/AbstractOrchestrator.java
index 87e862b..9835fc5 100644
--- a/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/cpi/impl/AbstractOrchestrator.java
+++ b/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/cpi/impl/AbstractOrchestrator.java
@@ -27,7 +27,7 @@ import org.apache.airavata.orchestrator.core.context.OrchestratorContext;
import org.apache.airavata.orchestrator.core.exception.OrchestratorException;
import org.apache.airavata.orchestrator.core.utils.OrchestratorUtils;
import org.apache.airavata.orchestrator.cpi.Orchestrator;
-import org.apache.airavata.experiment.catalog.impl.RegistryImpl;
+import org.apache.airavata.registry.core.experiment.catalog.impl.RegistryImpl;
import org.apache.airavata.registry.cpi.RegistryException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/orchestrator/orchestrator-core/src/test/java/org/apache/airavata/orchestrator/core/util/Initialize.java
----------------------------------------------------------------------
diff --git a/modules/orchestrator/orchestrator-core/src/test/java/org/apache/airavata/orchestrator/core/util/Initialize.java b/modules/orchestrator/orchestrator-core/src/test/java/org/apache/airavata/orchestrator/core/util/Initialize.java
index ff2b0c6..5b0247f 100644
--- a/modules/orchestrator/orchestrator-core/src/test/java/org/apache/airavata/orchestrator/core/util/Initialize.java
+++ b/modules/orchestrator/orchestrator-core/src/test/java/org/apache/airavata/orchestrator/core/util/Initialize.java
@@ -23,8 +23,8 @@ package org.apache.airavata.orchestrator.core.util;
import org.apache.airavata.common.exception.ApplicationSettingsException;
import org.apache.airavata.common.utils.ServerSettings;
-import org.apache.airavata.experiment.catalog.ResourceType;
-import org.apache.airavata.experiment.catalog.resources.*;
+import org.apache.airavata.registry.core.experiment.catalog.ResourceType;
+import org.apache.airavata.registry.core.experiment.catalog.resources.*;
import org.apache.airavata.registry.cpi.RegistryException;
import org.apache.derby.drda.NetworkServerControl;
import org.slf4j.Logger;
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/orchestrator/orchestrator-service/src/main/java/org/apache/airavata/orchestrator/server/OrchestratorServerHandler.java
----------------------------------------------------------------------
diff --git a/modules/orchestrator/orchestrator-service/src/main/java/org/apache/airavata/orchestrator/server/OrchestratorServerHandler.java b/modules/orchestrator/orchestrator-service/src/main/java/org/apache/airavata/orchestrator/server/OrchestratorServerHandler.java
index 8f94633..694f783 100644
--- a/modules/orchestrator/orchestrator-service/src/main/java/org/apache/airavata/orchestrator/server/OrchestratorServerHandler.java
+++ b/modules/orchestrator/orchestrator-service/src/main/java/org/apache/airavata/orchestrator/server/OrchestratorServerHandler.java
@@ -21,9 +21,9 @@
package org.apache.airavata.orchestrator.server;
-import org.airavata.appcatalog.cpi.AppCatalog;
-import org.airavata.appcatalog.cpi.AppCatalogException;
-import org.airavata.appcatalog.cpi.ComputeResource;
+import org.apache.airavata.registry.cpi.AppCatalog;
+import org.apache.airavata.registry.cpi.AppCatalogException;
+import org.apache.airavata.registry.cpi.ComputeResource;
import org.apache.aiaravata.application.catalog.data.impl.AppCatalogFactory;
import org.apache.aiaravata.application.catalog.data.resources.AbstractResource;
import org.apache.airavata.common.exception.AiravataException;
@@ -67,10 +67,10 @@ import org.apache.airavata.orchestrator.cpi.impl.SimpleOrchestratorImpl;
import org.apache.airavata.orchestrator.cpi.orchestrator_cpi_serviceConstants;
import org.apache.airavata.orchestrator.util.DataModelUtils;
import org.apache.airavata.orchestrator.util.OrchestratorServerThreadPoolExecutor;
-import org.apache.airavata.experiment.catalog.impl.RegistryFactory;
-import org.apache.airavata.registry.cpi.Registry;
+import org.apache.airavata.registry.core.experiment.catalog.impl.RegistryFactory;
+import org.apache.airavata.registry.cpi.ExperimentCatalog;
+import org.apache.airavata.registry.cpi.ExperimentCatalogModelType;
import org.apache.airavata.registry.cpi.RegistryException;
-import org.apache.airavata.registry.cpi.RegistryModelType;
import org.apache.airavata.registry.cpi.utils.Constants.FieldConstants.TaskDetailConstants;
import org.apache.airavata.registry.cpi.utils.Constants.FieldConstants.WorkflowNodeConstants;
import org.apache.airavata.workflow.core.WorkflowEnactmentService;
@@ -86,7 +86,7 @@ import java.util.Map;
public class OrchestratorServerHandler implements OrchestratorService.Iface {
private static AiravataLogger log = AiravataLoggerFactory .getLogger(OrchestratorServerHandler.class);
private SimpleOrchestratorImpl orchestrator = null;
- private Registry registry;
+ private ExperimentCatalog experimentCatalog;
private static Integer mutex = new Integer(-1);
private String airavataUserName;
private String gatewayName;
@@ -123,7 +123,7 @@ public class OrchestratorServerHandler implements OrchestratorService.Iface {
// first constructing the monitorManager and orchestrator, then fill
// the required properties
orchestrator = new SimpleOrchestratorImpl();
- registry = RegistryFactory.getDefaultRegistry();
+ experimentCatalog = RegistryFactory.getDefaultRegistry();
orchestrator.initialize();
orchestrator.getOrchestratorContext().setPublisher(this.publisher);
startProcessConsumer();
@@ -160,8 +160,8 @@ public class OrchestratorServerHandler implements OrchestratorService.Iface {
public boolean launchExperiment(String experimentId, String token) throws TException {
Experiment experiment = null; // this will inside the bottom catch statement
try {
- experiment = (Experiment) registry.get(
- RegistryModelType.EXPERIMENT, experimentId);
+ experiment = (Experiment) experimentCatalog.get(
+ ExperimentCatalogModelType.EXPERIMENT, experimentId);
if (experiment == null) {
log.errorId(experimentId, "Error retrieving the Experiment by the given experimentID: {} ", experimentId);
return false;
@@ -216,22 +216,22 @@ public class OrchestratorServerHandler implements OrchestratorService.Iface {
if (tasks.size() > 1) {
log.info("There are multiple tasks for this experiment, So Orchestrator will launch multiple Jobs");
}
- List<String> ids = registry.getIds(
- RegistryModelType.WORKFLOW_NODE_DETAIL,
+ List<String> ids = experimentCatalog.getIds(
+ ExperimentCatalogModelType.WORKFLOW_NODE_DETAIL,
WorkflowNodeConstants.EXPERIMENT_ID, experimentId);
for (String workflowNodeId : ids) {
- WorkflowNodeDetails workflowNodeDetail = (WorkflowNodeDetails) registry
- .get(RegistryModelType.WORKFLOW_NODE_DETAIL,
+ WorkflowNodeDetails workflowNodeDetail = (WorkflowNodeDetails) experimentCatalog
+ .get(ExperimentCatalogModelType.WORKFLOW_NODE_DETAIL,
workflowNodeId);
- List<Object> taskDetailList = registry.get(
- RegistryModelType.TASK_DETAIL,
+ List<Object> taskDetailList = experimentCatalog.get(
+ ExperimentCatalogModelType.TASK_DETAIL,
TaskDetailConstants.NODE_ID, workflowNodeId);
for (Object o : taskDetailList) {
TaskDetails taskID = (TaskDetails) o;
// iterate through all the generated tasks and performs the
// job submisssion+monitoring
- Experiment experiment = (Experiment) registry.get(
- RegistryModelType.EXPERIMENT, experimentId);
+ Experiment experiment = (Experiment) experimentCatalog.get(
+ ExperimentCatalogModelType.EXPERIMENT, experimentId);
if (experiment == null) {
log.errorId(experimentId, "Error retrieving the Experiment by the given experimentID: {}.",
experimentId);
@@ -284,8 +284,8 @@ public class OrchestratorServerHandler implements OrchestratorService.Iface {
@Override
public boolean launchTask(String taskId, String airavataCredStoreToken) throws TException {
try {
- TaskDetails taskData = (TaskDetails) registry.get(
- RegistryModelType.TASK_DETAIL, taskId);
+ TaskDetails taskData = (TaskDetails) experimentCatalog.get(
+ ExperimentCatalogModelType.TASK_DETAIL, taskId);
String applicationId = taskData.getApplicationId();
if (applicationId == null) {
log.errorId(taskId, "Application id shouldn't be null.");
@@ -293,12 +293,12 @@ public class OrchestratorServerHandler implements OrchestratorService.Iface {
}
ApplicationDeploymentDescription applicationDeploymentDescription = getAppDeployment(taskData, applicationId);
taskData.setApplicationDeploymentId(applicationDeploymentDescription.getAppDeploymentId());
- registry.update(RegistryModelType.TASK_DETAIL, taskData,taskData.getTaskID());
- List<Object> workflowNodeDetailList = registry.get(RegistryModelType.WORKFLOW_NODE_DETAIL,
+ experimentCatalog.update(ExperimentCatalogModelType.TASK_DETAIL, taskData,taskData.getTaskID());
+ List<Object> workflowNodeDetailList = experimentCatalog.get(ExperimentCatalogModelType.WORKFLOW_NODE_DETAIL,
org.apache.airavata.registry.cpi.utils.Constants.FieldConstants.WorkflowNodeConstants.TASK_LIST, taskData);
if (workflowNodeDetailList != null
&& workflowNodeDetailList.size() > 0) {
- List<Object> experimentList = registry.get(RegistryModelType.EXPERIMENT,
+ List<Object> experimentList = experimentCatalog.get(ExperimentCatalogModelType.EXPERIMENT,
org.apache.airavata.registry.cpi.utils.Constants.FieldConstants.ExperimentConstants.WORKFLOW_NODE_LIST,
(WorkflowNodeDetails) workflowNodeDetailList.get(0));
if (experimentList != null && experimentList.size() > 0) {
@@ -371,8 +371,8 @@ public class OrchestratorServerHandler implements OrchestratorService.Iface {
private boolean validateStatesAndCancel(String experimentId, String tokenId)throws TException{
try {
- Experiment experiment = (Experiment) registry.get(
- RegistryModelType.EXPERIMENT, experimentId);
+ Experiment experiment = (Experiment) experimentCatalog.get(
+ ExperimentCatalogModelType.EXPERIMENT, experimentId);
log.info("Waiting for zookeeper to connect to the server");
synchronized (mutex){
mutex.wait(5000);
@@ -388,15 +388,15 @@ public class OrchestratorServerHandler implements OrchestratorService.Iface {
status.setTimeOfStateChange(Calendar.getInstance()
.getTimeInMillis());
experiment.setExperimentStatus(status);
- registry.update(RegistryModelType.EXPERIMENT, experiment,
+ experimentCatalog.update(ExperimentCatalogModelType.EXPERIMENT, experiment,
experimentId);
- List<String> ids = registry.getIds(
- RegistryModelType.WORKFLOW_NODE_DETAIL,
+ List<String> ids = experimentCatalog.getIds(
+ ExperimentCatalogModelType.WORKFLOW_NODE_DETAIL,
WorkflowNodeConstants.EXPERIMENT_ID, experimentId);
for (String workflowNodeId : ids) {
- WorkflowNodeDetails workflowNodeDetail = (WorkflowNodeDetails) registry
- .get(RegistryModelType.WORKFLOW_NODE_DETAIL,
+ WorkflowNodeDetails workflowNodeDetail = (WorkflowNodeDetails) experimentCatalog
+ .get(ExperimentCatalogModelType.WORKFLOW_NODE_DETAIL,
workflowNodeId);
int value = workflowNodeDetail.getWorkflowNodeStatus().getWorkflowNodeState().getValue();
if ( value> 1 && value < 7) { // we skip the unknown state
@@ -409,11 +409,11 @@ public class OrchestratorServerHandler implements OrchestratorService.Iface {
workflowNodeStatus.setTimeOfStateChange(Calendar.getInstance()
.getTimeInMillis());
workflowNodeDetail.setWorkflowNodeStatus(workflowNodeStatus);
- registry.update(RegistryModelType.WORKFLOW_NODE_DETAIL, workflowNodeDetail,
+ experimentCatalog.update(ExperimentCatalogModelType.WORKFLOW_NODE_DETAIL, workflowNodeDetail,
workflowNodeId);
}
- List<Object> taskDetailList = registry.get(
- RegistryModelType.TASK_DETAIL,
+ List<Object> taskDetailList = experimentCatalog.get(
+ ExperimentCatalogModelType.TASK_DETAIL,
TaskDetailConstants.NODE_ID, workflowNodeId);
for (Object o : taskDetailList) {
TaskDetails taskDetails = (TaskDetails) o;
@@ -427,7 +427,7 @@ public class OrchestratorServerHandler implements OrchestratorService.Iface {
taskStatus.setTimeOfStateChange(Calendar.getInstance()
.getTimeInMillis());
taskDetails.setTaskStatus(taskStatus);
- registry.update(RegistryModelType.TASK_DETAIL, o,
+ experimentCatalog.update(ExperimentCatalogModelType.TASK_DETAIL, o,
taskDetails.getTaskID());
}
orchestrator.cancelExperiment(experiment,
@@ -444,24 +444,24 @@ public class OrchestratorServerHandler implements OrchestratorService.Iface {
status.setTimeOfStateChange(Calendar.getInstance()
.getTimeInMillis());
experiment.setExperimentStatus(status);
- registry.update(RegistryModelType.EXPERIMENT, experiment,
+ experimentCatalog.update(ExperimentCatalogModelType.EXPERIMENT, experiment,
experimentId);
- List<String> ids = registry.getIds(
- RegistryModelType.WORKFLOW_NODE_DETAIL,
+ List<String> ids = experimentCatalog.getIds(
+ ExperimentCatalogModelType.WORKFLOW_NODE_DETAIL,
WorkflowNodeConstants.EXPERIMENT_ID, experimentId);
for (String workflowNodeId : ids) {
- WorkflowNodeDetails workflowNodeDetail = (WorkflowNodeDetails) registry
- .get(RegistryModelType.WORKFLOW_NODE_DETAIL,
+ WorkflowNodeDetails workflowNodeDetail = (WorkflowNodeDetails) experimentCatalog
+ .get(ExperimentCatalogModelType.WORKFLOW_NODE_DETAIL,
workflowNodeId);
WorkflowNodeStatus workflowNodeStatus = new WorkflowNodeStatus();
workflowNodeStatus.setWorkflowNodeState(WorkflowNodeState.CANCELED);
workflowNodeStatus.setTimeOfStateChange(Calendar.getInstance()
.getTimeInMillis());
workflowNodeDetail.setWorkflowNodeStatus(workflowNodeStatus);
- registry.update(RegistryModelType.WORKFLOW_NODE_DETAIL, workflowNodeDetail,
+ experimentCatalog.update(ExperimentCatalogModelType.WORKFLOW_NODE_DETAIL, workflowNodeDetail,
workflowNodeId);
- List<Object> taskDetailList = registry.get(
- RegistryModelType.TASK_DETAIL,
+ List<Object> taskDetailList = experimentCatalog.get(
+ ExperimentCatalogModelType.TASK_DETAIL,
TaskDetailConstants.NODE_ID, workflowNodeId);
for (Object o : taskDetailList) {
TaskDetails taskDetails = (TaskDetails) o;
@@ -470,7 +470,7 @@ public class OrchestratorServerHandler implements OrchestratorService.Iface {
taskStatus.setTimeOfStateChange(Calendar.getInstance()
.getTimeInMillis());
taskDetails.setTaskStatus(taskStatus);
- registry.update(RegistryModelType.TASK_DETAIL, o,
+ experimentCatalog.update(ExperimentCatalogModelType.TASK_DETAIL, o,
taskDetails);
}
}
@@ -547,14 +547,14 @@ public class OrchestratorServerHandler implements OrchestratorService.Iface {
private boolean launchSingleAppExperiment() throws TException {
Experiment experiment = null;
try {
- List<String> ids = registry.getIds(RegistryModelType.WORKFLOW_NODE_DETAIL, WorkflowNodeConstants.EXPERIMENT_ID, experimentId);
+ List<String> ids = experimentCatalog.getIds(ExperimentCatalogModelType.WORKFLOW_NODE_DETAIL, WorkflowNodeConstants.EXPERIMENT_ID, experimentId);
for (String workflowNodeId : ids) {
// WorkflowNodeDetails workflowNodeDetail = (WorkflowNodeDetails) registry.get(RegistryModelType.WORKFLOW_NODE_DETAIL, workflowNodeId);
- List<Object> taskDetailList = registry.get(RegistryModelType.TASK_DETAIL, TaskDetailConstants.NODE_ID, workflowNodeId);
+ List<Object> taskDetailList = experimentCatalog.get(ExperimentCatalogModelType.TASK_DETAIL, TaskDetailConstants.NODE_ID, workflowNodeId);
for (Object o : taskDetailList) {
TaskDetails taskData = (TaskDetails) o;
//iterate through all the generated tasks and performs the job submisssion+monitoring
- experiment = (Experiment) registry.get(RegistryModelType.EXPERIMENT, experimentId);
+ experiment = (Experiment) experimentCatalog.get(ExperimentCatalogModelType.EXPERIMENT, experimentId);
if (experiment == null) {
log.errorId(experimentId, "Error retrieving the Experiment by the given experimentID: {}", experimentId);
return false;
@@ -578,7 +578,7 @@ public class OrchestratorServerHandler implements OrchestratorService.Iface {
MessageContext messageContext = new MessageContext(event, MessageType.EXPERIMENT, messageId, gatewayId);
messageContext.setUpdatedTime(AiravataUtils.getCurrentTimestamp());
publisher.publish(messageContext);
- registry.update(RegistryModelType.TASK_DETAIL, taskData, taskData.getTaskID());
+ experimentCatalog.update(ExperimentCatalogModelType.TASK_DETAIL, taskData, taskData.getTaskID());
//launching the experiment
launchTask(taskData.getTaskID(), airavataCredStoreToken);
}
@@ -594,7 +594,7 @@ public class OrchestratorServerHandler implements OrchestratorService.Iface {
status.setTimeOfStateChange(Calendar.getInstance().getTimeInMillis());
experiment.setExperimentStatus(status);
try {
- registry.update(RegistryModelType.EXPERIMENT_STATUS, status, experimentId);
+ experimentCatalog.update(ExperimentCatalogModelType.EXPERIMENT_STATUS, status, experimentId);
} catch (RegistryException e1) {
log.errorId(experimentId, "Error while updating experiment status to " + status.toString(), e);
throw new TException(e);
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/orchestrator/orchestrator-service/src/main/java/org/apache/airavata/orchestrator/util/DataModelUtils.java
----------------------------------------------------------------------
diff --git a/modules/orchestrator/orchestrator-service/src/main/java/org/apache/airavata/orchestrator/util/DataModelUtils.java b/modules/orchestrator/orchestrator-service/src/main/java/org/apache/airavata/orchestrator/util/DataModelUtils.java
index da11a59..86ec301 100644
--- a/modules/orchestrator/orchestrator-service/src/main/java/org/apache/airavata/orchestrator/util/DataModelUtils.java
+++ b/modules/orchestrator/orchestrator-service/src/main/java/org/apache/airavata/orchestrator/util/DataModelUtils.java
@@ -23,8 +23,8 @@ package org.apache.airavata.orchestrator.util;
import java.util.List;
-import org.airavata.appcatalog.cpi.AppCatalogException;
-import org.airavata.appcatalog.cpi.ApplicationInterface;
+import org.apache.airavata.registry.cpi.AppCatalogException;
+import org.apache.airavata.registry.cpi.ApplicationInterface;
import org.apache.aiaravata.application.catalog.data.impl.AppCatalogFactory;
import org.apache.airavata.model.util.ExecutionType;
import org.apache.airavata.model.workspace.experiment.Experiment;
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/orchestrator/orchestrator-service/src/test/java/org/apache/airavata/orchestrator/client/util/Initialize.java
----------------------------------------------------------------------
diff --git a/modules/orchestrator/orchestrator-service/src/test/java/org/apache/airavata/orchestrator/client/util/Initialize.java b/modules/orchestrator/orchestrator-service/src/test/java/org/apache/airavata/orchestrator/client/util/Initialize.java
index 7fe8ff3..c5197a8 100644
--- a/modules/orchestrator/orchestrator-service/src/test/java/org/apache/airavata/orchestrator/client/util/Initialize.java
+++ b/modules/orchestrator/orchestrator-service/src/test/java/org/apache/airavata/orchestrator/client/util/Initialize.java
@@ -23,8 +23,8 @@ package org.apache.airavata.orchestrator.client.util;
import org.apache.airavata.common.exception.ApplicationSettingsException;
import org.apache.airavata.common.utils.ServerSettings;
-import org.apache.airavata.experiment.catalog.ResourceType;
-import org.apache.airavata.experiment.catalog.resources.*;
+import org.apache.airavata.registry.core.experiment.catalog.ResourceType;
+import org.apache.airavata.registry.core.experiment.catalog.resources.*;
import org.apache.airavata.registry.cpi.RegistryException;
import org.apache.derby.drda.NetworkServerControl;
import org.slf4j.Logger;
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/experiment-catalog/pom.xml
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/pom.xml b/modules/registry/experiment-catalog/pom.xml
deleted file mode 100644
index c624e2e..0000000
--- a/modules/registry/experiment-catalog/pom.xml
+++ /dev/null
@@ -1,151 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--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. -->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-
- <parent>
- <groupId>org.apache.airavata</groupId>
- <artifactId>registry</artifactId>
- <version>0.16-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
-
- <modelVersion>4.0.0</modelVersion>
- <artifactId>airavata-experiment-catalog</artifactId>
- <packaging>jar</packaging>
- <name>Airavata Experiment Catalog</name>
- <url>http://airavata.apache.org/</url>
-
- <dependencies>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- </dependency>
- <!--dependency>
- <groupId>org.apache.airavata</groupId>
- <artifactId>airavata-common-utils</artifactId>
- <version>${project.version}</version>
- </dependency-->
- <!-- Test -->
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>jcl-over-slf4j</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.openjpa</groupId>
- <artifactId>openjpa-all</artifactId>
- <version>2.2.0</version>
- </dependency>
- <dependency>
- <groupId>org.apache.airavata</groupId>
- <artifactId>airavata-credential-store</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.airavata</groupId>
- <artifactId>airavata-data-models</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.airavata</groupId>
- <artifactId>airavata-registry-cpi</artifactId>
- <version>${project.version}</version>
- </dependency>
- <!--dependency>
- <groupId>mysql</groupId>
- <artifactId>mysql-connector-java</artifactId>
- <version>${mysql.connector.version}</version>
- </dependency-->
- <dependency>
- <groupId>org.apache.derby</groupId>
- <artifactId>derby</artifactId>
- <version>${derby.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.derby</groupId>
- <artifactId>derbyclient</artifactId>
- <version>${derby.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.derby</groupId>
- <artifactId>derbynet</artifactId>
- <version>${derby.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.derby</groupId>
- <artifactId>derbytools</artifactId>
- <version>${derby.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.airavata</groupId>
- <artifactId>airavata-server-configuration</artifactId>
- <scope>test</scope>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-antrun-plugin</artifactId>
- <version>${antrun.version}</version>
- <executions>
- <execution>
- <phase>process-classes</phase>
- <configuration>
- <tasks>
- <taskdef name="openjpac" classname="org.apache.openjpa.ant.PCEnhancerTask" classpathref="maven.compile.classpath" />
- <openjpac>
- <classpath refid="maven.compile.classpath" />
- </openjpac>
- </tasks>
- </configuration>
- <goals>
- <goal>run</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <version>${surefire.version}</version>
- <inherited>true</inherited>
- <configuration>
- <failIfNoTests>false</failIfNoTests>
- <skipTests>${skipTests}</skipTests>
- <workingDirectory>${project.build.testOutputDirectory}</workingDirectory>
- <!-- making sure that the sure-fire plugin doesn't run the integration tests-->
- <!-- Integration tests are run using the fail-safe plugin in the module pom-->
- <excludes>
- <exclude>**/TaskDetailResourceTest.java</exclude>
- <exclude>**/WorkflowNodeDetailResourceTest.java</exclude>
- </excludes>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/JPAConstants.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/JPAConstants.java b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/JPAConstants.java
deleted file mode 100644
index b558d03..0000000
--- a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/JPAConstants.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- *
- * 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.experiment.catalog;
-
-public class JPAConstants {
- public static final String KEY_JDBC_URL = "registry.jdbc.url";
- public static final String KEY_JDBC_USER = "registry.jdbc.user";
- public static final String KEY_JDBC_PASSWORD = "registry.jdbc.password";
- public static final String KEY_JDBC_DRIVER = "registry.jdbc.driver";
- public static final String KEY_DERBY_START_ENABLE = "start.derby.server.mode";
- public static final String VALIDATION_QUERY = "validationQuery";
- public static final String JPA_CACHE_SIZE = "jpa.cache.size";
- public static final String ENABLE_CACHING = "cache.enable";
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/Resource.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/Resource.java b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/Resource.java
deleted file mode 100644
index bdfd948..0000000
--- a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/Resource.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- *
- * 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.experiment.catalog;
-
-import org.apache.airavata.registry.cpi.RegistryException;
-
-import java.util.List;
-
-public interface Resource {
- /**
- * This method will create associate resource objects for the given resource type.
- * @param type child resource type
- * @return associate child resource
- */
- Resource create(ResourceType type) throws RegistryException, RegistryException;
-
- /**
- * This method will remove the given child resource from the database
- * @param type child resource type
- * @param name child resource name
- */
- void remove(ResourceType type, Object name) throws RegistryException;
-
- /**
- * This method will return the given child resource from the database
- * @param type child resource type
- * @param name child resource name
- * @return associate child resource
- */
- Resource get(ResourceType type, Object name) throws RegistryException;
-
- /**
- * This method will list all the child resources for the given resource type
- * @param type child resource type
- * @return list of child resources of the given child resource type
- */
- List<Resource> get(ResourceType type) throws RegistryException;
-
- /**
- * This method will save the resource to the database.
- */
- void save() throws RegistryException;
-
- /**
- * This method will check whether an entry from the given resource type and resource name
- * exists in the database
- * @param type child resource type
- * @param name child resource name
- * @return whether the entry exists in the database or not
- */
- boolean isExists(ResourceType type, Object name) throws RegistryException;
-
-}
[07/52] [abbrv] [partial] airavata git commit: registry refactoring
Posted by sh...@apache.org.
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/LocalSubmissionResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/LocalSubmissionResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/LocalSubmissionResource.java
new file mode 100644
index 0000000..487e5dc
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/LocalSubmissionResource.java
@@ -0,0 +1,293 @@
+/*
+ *
+ * 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.aiaravata.application.catalog.data.resources;
+
+import java.sql.Timestamp;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.persistence.EntityManager;
+import javax.persistence.Query;
+
+import org.airavata.appcatalog.cpi.AppCatalogException;
+import org.apache.aiaravata.application.catalog.data.model.LocalSubmission;
+import org.apache.aiaravata.application.catalog.data.model.ResourceJobManager;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogJPAUtils;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogQueryGenerator;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogResourceType;
+import org.apache.airavata.common.exception.ApplicationSettingsException;
+import org.apache.airavata.common.utils.AiravataUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class LocalSubmissionResource extends AbstractResource {
+ private final static Logger logger = LoggerFactory.getLogger(LocalSubmissionResource.class);
+ private String resourceJobManagerId;
+ private ResourceJobManagerResource resourceJobManagerResource;
+ private String jobSubmissionInterfaceId;
+ private Timestamp createdTime;
+ private Timestamp updatedTime;
+
+ public Timestamp getCreatedTime() {
+ return createdTime;
+ }
+
+ public void setCreatedTime(Timestamp createdTime) {
+ this.createdTime = createdTime;
+ }
+
+ public Timestamp getUpdatedTime() {
+ return updatedTime;
+ }
+
+ public void setUpdatedTime(Timestamp updatedTime) {
+ this.updatedTime = updatedTime;
+ }
+
+ @Override
+ public void remove(Object identifier) throws AppCatalogException {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(LOCAL_SUBMISSION);
+ generator.setParameter(LocalSubmissionConstants.JOB_SUBMISSION_INTERFACE_ID, identifier);
+ 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 Resource get(Object identifier) throws AppCatalogException {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(LOCAL_SUBMISSION);
+ generator.setParameter(LocalSubmissionConstants.JOB_SUBMISSION_INTERFACE_ID, identifier);
+ Query q = generator.selectQuery(em);
+ LocalSubmission localSubmission = (LocalSubmission) q.getSingleResult();
+ LocalSubmissionResource localSubmissionResource = (LocalSubmissionResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.LOCAL_SUBMISSION, localSubmission);
+ em.getTransaction().commit();
+ em.close();
+ return localSubmissionResource;
+ } 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<Resource> get(String fieldName, Object value) throws AppCatalogException {
+ List<Resource> localSubmissionResources = new ArrayList<Resource>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(LOCAL_SUBMISSION);
+ Query q;
+ if ((fieldName.equals(LocalSubmissionConstants.RESOURCE_JOB_MANAGER_ID)) || (fieldName.equals(LocalSubmissionConstants.JOB_SUBMISSION_INTERFACE_ID))) {
+ generator.setParameter(fieldName, value);
+ q = generator.selectQuery(em);
+ List<?> results = q.getResultList();
+ for (Object result : results) {
+ LocalSubmission localSubmission = (LocalSubmission) result;
+ LocalSubmissionResource localSubmissionResource = (LocalSubmissionResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.LOCAL_SUBMISSION, localSubmission);
+ localSubmissionResources.add(localSubmissionResource);
+ }
+ } else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for Local Submission Resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for Local Submission Resource.");
+ }
+ 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();
+ }
+ }
+ return localSubmissionResources;
+ }
+
+ @Override
+ public List<Resource> 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 {
+ List<String> localSubmissionResourceIDs = new ArrayList<String>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(LOCAL_SUBMISSION);
+ Query q;
+ if ((fieldName.equals(LocalSubmissionConstants.RESOURCE_JOB_MANAGER_ID)) || (fieldName.equals(LocalSubmissionConstants.JOB_SUBMISSION_INTERFACE_ID))) {
+ generator.setParameter(fieldName, value);
+ q = generator.selectQuery(em);
+ List<?> results = q.getResultList();
+ for (Object result : results) {
+ LocalSubmission localSubmission = (LocalSubmission) result;
+ LocalSubmissionResource localSubmissionResource = (LocalSubmissionResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.LOCAL_SUBMISSION, localSubmission);
+ localSubmissionResourceIDs.add(localSubmissionResource.getJobSubmissionInterfaceId());
+ }
+ } else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for Local Submission Resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for Local Submission Resource.");
+ }
+ 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();
+ }
+ }
+ return localSubmissionResourceIDs;
+ }
+
+ @Override
+ public void save() throws AppCatalogException {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ LocalSubmission existingLocalSubmission = em.find(LocalSubmission.class, jobSubmissionInterfaceId);
+ em.close();
+ LocalSubmission localSubmission;
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ if (existingLocalSubmission == null) {
+ localSubmission = new LocalSubmission();
+ localSubmission.setCreationTime(AiravataUtils.getCurrentTimestamp());
+ } else {
+ localSubmission = existingLocalSubmission;
+ localSubmission.setUpdateTime(AiravataUtils.getCurrentTimestamp());
+ }
+ localSubmission.setResourceJobManagerId(getResourceJobManagerId());
+ ResourceJobManager resourceJobManager = em.find(ResourceJobManager.class, getResourceJobManagerId());
+ localSubmission.setResourceJobManager(resourceJobManager);
+ localSubmission.setJobSubmissionInterfaceId(getJobSubmissionInterfaceId());
+ if (existingLocalSubmission == null) {
+ em.persist(localSubmission);
+ } else {
+ em.merge(localSubmission);
+ }
+ 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 {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ LocalSubmission localSubmission = em.find(LocalSubmission.class, identifier);
+ em.close();
+ return localSubmission != null;
+ } 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();
+ }
+ }
+ }
+
+ public String getResourceJobManagerId() {
+ return resourceJobManagerId;
+ }
+
+ public ResourceJobManagerResource getResourceJobManagerResource() {
+ return resourceJobManagerResource;
+ }
+
+ public String getJobSubmissionInterfaceId() {
+ return jobSubmissionInterfaceId;
+ }
+
+ public void setResourceJobManagerId(String resourceJobManagerId) {
+ this.resourceJobManagerId=resourceJobManagerId;
+ }
+
+ public void setResourceJobManagerResource(ResourceJobManagerResource resourceJobManagerResource) {
+ this.resourceJobManagerResource=resourceJobManagerResource;
+ }
+
+ public void setJobSubmissionInterfaceId(String jobSubmissionInterfaceId) {
+ this.jobSubmissionInterfaceId=jobSubmissionInterfaceId;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/ModuleLoadCmdAppCatalogResourceAppCat.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/ModuleLoadCmdAppCatalogResourceAppCat.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/ModuleLoadCmdAppCatalogResourceAppCat.java
new file mode 100644
index 0000000..0cc2bde
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/ModuleLoadCmdAppCatalogResourceAppCat.java
@@ -0,0 +1,300 @@
+/*
+ *
+ * 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.ApplicationDeployment;
+import org.apache.airavata.registry.core.app.catalog.model.ModuleLoadCmd;
+import org.apache.airavata.registry.core.app.catalog.model.ModuleLoadCmd_PK;
+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 ModuleLoadCmdAppCatalogResourceAppCat extends AppCatAbstractResource {
+ private final static Logger logger = LoggerFactory.getLogger(ModuleLoadCmdAppCatalogResourceAppCat.class);
+ private String cmd;
+ private String appDeploymentId;
+ private AppDeploymentAppCatalogResourceAppCat appDeploymentResource;
+
+ @Override
+ public void remove(Object identifier) throws AppCatalogException {
+ HashMap<String, String> ids;
+ if (identifier instanceof Map) {
+ ids = (HashMap<String, String>) 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(MODULE_LOAD_CMD);
+ generator.setParameter(ModuleLoadCmdConstants.APP_DEPLOYMENT_ID, ids.get(ModuleLoadCmdConstants.APP_DEPLOYMENT_ID));
+ if (ids.get(ModuleLoadCmdConstants.CMD) != null){
+ generator.setParameter(ModuleLoadCmdConstants.CMD, ids.get(ModuleLoadCmdConstants.CMD));
+ }
+ 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<String, String>) 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(MODULE_LOAD_CMD);
+ generator.setParameter(ModuleLoadCmdConstants.CMD, ids.get(ModuleLoadCmdConstants.CMD));
+ generator.setParameter(ModuleLoadCmdConstants.APP_DEPLOYMENT_ID, ids.get(ModuleLoadCmdConstants.APP_DEPLOYMENT_ID));
+ Query q = generator.selectQuery(em);
+ ModuleLoadCmd moduleLoadCmd = (ModuleLoadCmd) q.getSingleResult();
+ ModuleLoadCmdAppCatalogResourceAppCat moduleLoadCmdResource = (ModuleLoadCmdAppCatalogResourceAppCat) AppCatalogJPAUtils.getResource(AppCatalogResourceType.MODULE_LOAD_CMD, moduleLoadCmd);
+ em.getTransaction().commit();
+ em.close();
+ return moduleLoadCmdResource;
+ } 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> moduleLoadCmdResources = new ArrayList<AppCatalogResource>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(MODULE_LOAD_CMD);
+ Query q;
+ if ((fieldName.equals(ModuleLoadCmdConstants.CMD)) || (fieldName.equals(ModuleLoadCmdConstants.APP_DEPLOYMENT_ID))) {
+ generator.setParameter(fieldName, value);
+ q = generator.selectQuery(em);
+ List<?> results = q.getResultList();
+ for (Object result : results) {
+ ModuleLoadCmd moduleLoadCmd = (ModuleLoadCmd) result;
+ ModuleLoadCmdAppCatalogResourceAppCat moduleLoadCmdResource = (ModuleLoadCmdAppCatalogResourceAppCat) AppCatalogJPAUtils.getResource(AppCatalogResourceType.MODULE_LOAD_CMD, moduleLoadCmd);
+ moduleLoadCmdResources.add(moduleLoadCmdResource);
+ }
+ } else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for Module Load Cmd Resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for Module Load Cmd Resource.");
+ }
+ 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();
+ }
+ }
+ return moduleLoadCmdResources;
+ }
+
+ @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 {
+ List<String> moduleLoadCmdResourceIDs = new ArrayList<String>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(MODULE_LOAD_CMD);
+ Query q;
+ if ((fieldName.equals(ModuleLoadCmdConstants.CMD)) || (fieldName.equals(ModuleLoadCmdConstants.APP_DEPLOYMENT_ID))) {
+ generator.setParameter(fieldName, value);
+ q = generator.selectQuery(em);
+ List<?> results = q.getResultList();
+ for (Object result : results) {
+ ModuleLoadCmd moduleLoadCmd = (ModuleLoadCmd) result;
+ ModuleLoadCmdAppCatalogResourceAppCat moduleLoadCmdResource = (ModuleLoadCmdAppCatalogResourceAppCat) AppCatalogJPAUtils.getResource(AppCatalogResourceType.MODULE_LOAD_CMD, moduleLoadCmd);
+ moduleLoadCmdResourceIDs.add(moduleLoadCmdResource.getAppDeploymentId());
+ }
+ } else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for Module Load Cmd Resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for Module Load Cmd Resource.");
+ }
+ 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();
+ }
+ }
+ return moduleLoadCmdResourceIDs;
+ }
+
+ @Override
+ public void save() throws AppCatalogException {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ ModuleLoadCmd existingModuleLoadCmd = em.find(ModuleLoadCmd.class, new ModuleLoadCmd_PK(cmd, appDeploymentId));
+ em.close();
+ ModuleLoadCmd moduleLoadCmd;
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ if (existingModuleLoadCmd == null) {
+ moduleLoadCmd = new ModuleLoadCmd();
+ } else {
+ moduleLoadCmd = existingModuleLoadCmd;
+ }
+ moduleLoadCmd.setCmd(getCmd());
+ moduleLoadCmd.setAppDeploymentId(getAppDeploymentId());
+ ApplicationDeployment applicationDeployment = em.find(ApplicationDeployment.class, getAppDeploymentId());
+ moduleLoadCmd.setApplicationDeployment(applicationDeployment);
+ if (existingModuleLoadCmd == null) {
+ em.persist(moduleLoadCmd);
+ } else {
+ em.merge(moduleLoadCmd);
+ }
+ 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<String, String>) 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();
+ ModuleLoadCmd moduleLoadCmd = em.find(ModuleLoadCmd.class, new ModuleLoadCmd_PK(ids.get(ModuleLoadCmdConstants.CMD), ids.get(ModuleLoadCmdConstants.APP_DEPLOYMENT_ID)));
+ em.close();
+ return moduleLoadCmd != null;
+ } 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();
+ }
+ }
+ }
+
+ public String getCmd() {
+ return cmd;
+ }
+
+ public String getAppDeploymentId() {
+ return appDeploymentId;
+ }
+
+ public AppDeploymentAppCatalogResourceAppCat getAppDeploymentResource() {
+ return appDeploymentResource;
+ }
+
+ public void setCmd(String cmd) {
+ this.cmd=cmd;
+ }
+
+ public void setAppDeploymentId(String appDeploymentId) {
+ this.appDeploymentId=appDeploymentId;
+ }
+
+ public void setAppDeploymentResource(AppDeploymentAppCatalogResourceAppCat appDeploymentResource) {
+ this.appDeploymentResource=appDeploymentResource;
+ }
+}
+
+
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/ModuleLoadCmdResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/ModuleLoadCmdResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/ModuleLoadCmdResource.java
new file mode 100644
index 0000000..99faacf
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/ModuleLoadCmdResource.java
@@ -0,0 +1,300 @@
+/*
+ *
+ * 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.aiaravata.application.catalog.data.resources;
+
+import org.airavata.appcatalog.cpi.AppCatalogException;
+import org.apache.aiaravata.application.catalog.data.model.ApplicationDeployment;
+import org.apache.aiaravata.application.catalog.data.model.ModuleLoadCmd;
+import org.apache.aiaravata.application.catalog.data.model.ModuleLoadCmd_PK;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogJPAUtils;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogQueryGenerator;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogResourceType;
+import org.apache.airavata.common.exception.ApplicationSettingsException;
+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 ModuleLoadCmdResource extends AbstractResource {
+ private final static Logger logger = LoggerFactory.getLogger(ModuleLoadCmdResource.class);
+ private String cmd;
+ private String appDeploymentId;
+ private AppDeploymentResource appDeploymentResource;
+
+ @Override
+ public void remove(Object identifier) throws AppCatalogException {
+ HashMap<String, String> ids;
+ if (identifier instanceof Map) {
+ ids = (HashMap<String, String>) 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(MODULE_LOAD_CMD);
+ generator.setParameter(ModuleLoadCmdConstants.APP_DEPLOYMENT_ID, ids.get(ModuleLoadCmdConstants.APP_DEPLOYMENT_ID));
+ if (ids.get(ModuleLoadCmdConstants.CMD) != null){
+ generator.setParameter(ModuleLoadCmdConstants.CMD, ids.get(ModuleLoadCmdConstants.CMD));
+ }
+ 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 Resource get(Object identifier) throws AppCatalogException {
+ HashMap<String, String> ids;
+ if (identifier instanceof Map) {
+ ids = (HashMap<String, String>) 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(MODULE_LOAD_CMD);
+ generator.setParameter(ModuleLoadCmdConstants.CMD, ids.get(ModuleLoadCmdConstants.CMD));
+ generator.setParameter(ModuleLoadCmdConstants.APP_DEPLOYMENT_ID, ids.get(ModuleLoadCmdConstants.APP_DEPLOYMENT_ID));
+ Query q = generator.selectQuery(em);
+ ModuleLoadCmd moduleLoadCmd = (ModuleLoadCmd) q.getSingleResult();
+ ModuleLoadCmdResource moduleLoadCmdResource = (ModuleLoadCmdResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.MODULE_LOAD_CMD, moduleLoadCmd);
+ em.getTransaction().commit();
+ em.close();
+ return moduleLoadCmdResource;
+ } 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<Resource> get(String fieldName, Object value) throws AppCatalogException {
+ List<Resource> moduleLoadCmdResources = new ArrayList<Resource>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(MODULE_LOAD_CMD);
+ Query q;
+ if ((fieldName.equals(ModuleLoadCmdConstants.CMD)) || (fieldName.equals(ModuleLoadCmdConstants.APP_DEPLOYMENT_ID))) {
+ generator.setParameter(fieldName, value);
+ q = generator.selectQuery(em);
+ List<?> results = q.getResultList();
+ for (Object result : results) {
+ ModuleLoadCmd moduleLoadCmd = (ModuleLoadCmd) result;
+ ModuleLoadCmdResource moduleLoadCmdResource = (ModuleLoadCmdResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.MODULE_LOAD_CMD, moduleLoadCmd);
+ moduleLoadCmdResources.add(moduleLoadCmdResource);
+ }
+ } else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for Module Load Cmd Resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for Module Load Cmd Resource.");
+ }
+ 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();
+ }
+ }
+ return moduleLoadCmdResources;
+ }
+
+ @Override
+ public List<Resource> 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 {
+ List<String> moduleLoadCmdResourceIDs = new ArrayList<String>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(MODULE_LOAD_CMD);
+ Query q;
+ if ((fieldName.equals(ModuleLoadCmdConstants.CMD)) || (fieldName.equals(ModuleLoadCmdConstants.APP_DEPLOYMENT_ID))) {
+ generator.setParameter(fieldName, value);
+ q = generator.selectQuery(em);
+ List<?> results = q.getResultList();
+ for (Object result : results) {
+ ModuleLoadCmd moduleLoadCmd = (ModuleLoadCmd) result;
+ ModuleLoadCmdResource moduleLoadCmdResource = (ModuleLoadCmdResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.MODULE_LOAD_CMD, moduleLoadCmd);
+ moduleLoadCmdResourceIDs.add(moduleLoadCmdResource.getAppDeploymentId());
+ }
+ } else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for Module Load Cmd Resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for Module Load Cmd Resource.");
+ }
+ 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();
+ }
+ }
+ return moduleLoadCmdResourceIDs;
+ }
+
+ @Override
+ public void save() throws AppCatalogException {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ ModuleLoadCmd existingModuleLoadCmd = em.find(ModuleLoadCmd.class, new ModuleLoadCmd_PK(cmd, appDeploymentId));
+ em.close();
+ ModuleLoadCmd moduleLoadCmd;
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ if (existingModuleLoadCmd == null) {
+ moduleLoadCmd = new ModuleLoadCmd();
+ } else {
+ moduleLoadCmd = existingModuleLoadCmd;
+ }
+ moduleLoadCmd.setCmd(getCmd());
+ moduleLoadCmd.setAppDeploymentId(getAppDeploymentId());
+ ApplicationDeployment applicationDeployment = em.find(ApplicationDeployment.class, getAppDeploymentId());
+ moduleLoadCmd.setApplicationDeployment(applicationDeployment);
+ if (existingModuleLoadCmd == null) {
+ em.persist(moduleLoadCmd);
+ } else {
+ em.merge(moduleLoadCmd);
+ }
+ 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<String, String>) 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();
+ ModuleLoadCmd moduleLoadCmd = em.find(ModuleLoadCmd.class, new ModuleLoadCmd_PK(ids.get(ModuleLoadCmdConstants.CMD), ids.get(ModuleLoadCmdConstants.APP_DEPLOYMENT_ID)));
+ em.close();
+ return moduleLoadCmd != null;
+ } 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();
+ }
+ }
+ }
+
+ public String getCmd() {
+ return cmd;
+ }
+
+ public String getAppDeploymentId() {
+ return appDeploymentId;
+ }
+
+ public AppDeploymentResource getAppDeploymentResource() {
+ return appDeploymentResource;
+ }
+
+ public void setCmd(String cmd) {
+ this.cmd=cmd;
+ }
+
+ public void setAppDeploymentId(String appDeploymentId) {
+ this.appDeploymentId=appDeploymentId;
+ }
+
+ public void setAppDeploymentResource(AppDeploymentResource appDeploymentResource) {
+ this.appDeploymentResource=appDeploymentResource;
+ }
+}
+
+
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/PostJobCommandAppCatalogResourceAppCat.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/PostJobCommandAppCatalogResourceAppCat.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/PostJobCommandAppCatalogResourceAppCat.java
new file mode 100644
index 0000000..201b45b
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/PostJobCommandAppCatalogResourceAppCat.java
@@ -0,0 +1,333 @@
+/**
+ * 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.ApplicationDeployment;
+import org.apache.airavata.registry.core.app.catalog.model.PostJobCommand;
+import org.apache.airavata.registry.core.app.catalog.model.PostJobCommandPK;
+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 PostJobCommandAppCatalogResourceAppCat extends AppCatAbstractResource {
+ private final static Logger logger = LoggerFactory.getLogger(PostJobCommandAppCatalogResourceAppCat.class);
+
+ private String appDeploymentId;
+ private String command;
+
+ private AppDeploymentAppCatalogResourceAppCat appDeploymentResource;
+
+
+ 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(POST_JOBCOMMAND);
+ generator.setParameter(PostJobCommandConstants.DEPLOYMENT_ID,
+ ids.get(PostJobCommandConstants.DEPLOYMENT_ID));
+ if (ids.get(PostJobCommandConstants.COMMAND) != null){
+ generator.setParameter(PostJobCommandConstants.COMMAND, ids.get(PostJobCommandConstants.COMMAND));
+ }
+ 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();
+ }
+ }
+ }
+
+ 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(POST_JOBCOMMAND);
+ generator.setParameter(PostJobCommandConstants.DEPLOYMENT_ID,
+ ids.get(PostJobCommandConstants.DEPLOYMENT_ID));
+ generator.setParameter(PostJobCommandConstants.COMMAND, ids.get(PostJobCommandConstants.COMMAND));
+ Query q = generator.selectQuery(em);
+ PostJobCommand postJobCommand = (PostJobCommand) q.getSingleResult();
+ PostJobCommandAppCatalogResourceAppCat postJobCommandResource =
+ (PostJobCommandAppCatalogResourceAppCat) AppCatalogJPAUtils.getResource(
+ AppCatalogResourceType.POST_JOBCOMMAND, postJobCommand);
+ em.getTransaction().commit();
+ em.close();
+ return postJobCommandResource;
+ } 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();
+ }
+ }
+ }
+
+ public List<AppCatalogResource> get(String fieldName, Object value) throws AppCatalogException {
+ List<AppCatalogResource> gsiSSHPostJobCommandResources = new ArrayList<AppCatalogResource>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ Query q;
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(POST_JOBCOMMAND);
+ List results;
+ if (fieldName.equals(PostJobCommandConstants.DEPLOYMENT_ID)) {
+ generator.setParameter(PostJobCommandConstants.DEPLOYMENT_ID, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ PostJobCommand postJobCommand = (PostJobCommand) result;
+ PostJobCommandAppCatalogResourceAppCat postJobCommandResource =
+ (PostJobCommandAppCatalogResourceAppCat) AppCatalogJPAUtils.getResource(
+ AppCatalogResourceType.POST_JOBCOMMAND, postJobCommand);
+ gsiSSHPostJobCommandResources.add(postJobCommandResource);
+ }
+ }
+ } else if (fieldName.equals(PostJobCommandConstants.COMMAND)) {
+ generator.setParameter(PostJobCommandConstants.COMMAND, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ PostJobCommand postJobCommand = (PostJobCommand) result;
+ PostJobCommandAppCatalogResourceAppCat postJobCommandResource =
+ (PostJobCommandAppCatalogResourceAppCat) AppCatalogJPAUtils.getResource(
+ AppCatalogResourceType.POST_JOBCOMMAND, postJobCommand);
+ gsiSSHPostJobCommandResources.add(postJobCommandResource);
+ }
+ }
+ } else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for GSISSH Post Job Command Resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for GSISSH Post Job Command 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 gsiSSHPostJobCommandResources;
+ }
+
+ @Override
+ public List<AppCatalogResource> getAll() throws AppCatalogException {
+ return null;
+ }
+
+ @Override
+ public List<String> getAllIds() throws AppCatalogException {
+ return null;
+ }
+
+ public List<String> getIds(String fieldName, Object value) throws AppCatalogException {
+ List<String> gsiSSHPostJobResourceIDs = new ArrayList<String>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ Query q;
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(POST_JOBCOMMAND);
+ List results;
+ if (fieldName.equals(PostJobCommandConstants.DEPLOYMENT_ID)) {
+ generator.setParameter(PostJobCommandConstants.DEPLOYMENT_ID, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ PostJobCommand postJobCommand = (PostJobCommand) result;
+ gsiSSHPostJobResourceIDs.add(postJobCommand.getDeploymentId());
+ }
+ }
+ } else if (fieldName.equals(PostJobCommandConstants.COMMAND)) {
+ generator.setParameter(PostJobCommandConstants.COMMAND, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ PostJobCommand postJobCommand = (PostJobCommand) result;
+ gsiSSHPostJobResourceIDs.add(postJobCommand.getDeploymentId());
+ }
+ }
+ } else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for GSISSH Post Job resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for GSISSH Post JOb 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 gsiSSHPostJobResourceIDs;
+ }
+
+ public void save() throws AppCatalogException {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ PostJobCommand existingPostJobCommand = em.find(PostJobCommand.class,
+ new PostJobCommandPK(appDeploymentId, command));
+ em.close();
+
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ ApplicationDeployment deployment = em.find(ApplicationDeployment.class, appDeploymentId);
+ if (existingPostJobCommand != null){
+ existingPostJobCommand.setDeploymentId(appDeploymentId);
+ existingPostJobCommand.setCommand(command);
+ existingPostJobCommand.setDeployment(deployment);
+ em.merge(existingPostJobCommand);
+ }else {
+ PostJobCommand postJobCommand = new PostJobCommand();
+ postJobCommand.setDeploymentId(appDeploymentId);
+ postJobCommand.setCommand(command);
+ postJobCommand.setDeployment(deployment);
+ em.persist(postJobCommand);
+ }
+ 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();
+ }
+ }
+ }
+
+ 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();
+ PostJobCommand postJobCommand = em.find(PostJobCommand.class, new PostJobCommandPK(
+ ids.get(PostJobCommandConstants.DEPLOYMENT_ID),
+ ids.get(PostJobCommandConstants.COMMAND)));
+
+ em.close();
+ return postJobCommand != null;
+ } 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();
+ }
+ }
+ }
+
+ public String getAppDeploymentId() {
+ return appDeploymentId;
+ }
+
+ public void setAppDeploymentId(String appDeploymentId) {
+ this.appDeploymentId = appDeploymentId;
+ }
+
+ public String getCommand() {
+ return command;
+ }
+
+ public void setCommand(String command) {
+ this.command = command;
+ }
+
+ public AppDeploymentAppCatalogResourceAppCat getAppDeploymentResource() {
+ return appDeploymentResource;
+ }
+
+ public void setAppDeploymentResource(AppDeploymentAppCatalogResourceAppCat appDeploymentResource) {
+ this.appDeploymentResource = appDeploymentResource;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/PostJobCommandResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/PostJobCommandResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/PostJobCommandResource.java
new file mode 100644
index 0000000..7cde166
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/PostJobCommandResource.java
@@ -0,0 +1,333 @@
+/**
+ * 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.aiaravata.application.catalog.data.resources;
+
+import org.airavata.appcatalog.cpi.AppCatalogException;
+import org.apache.aiaravata.application.catalog.data.model.ApplicationDeployment;
+import org.apache.aiaravata.application.catalog.data.model.PostJobCommand;
+import org.apache.aiaravata.application.catalog.data.model.PostJobCommandPK;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogJPAUtils;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogQueryGenerator;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogResourceType;
+import org.apache.airavata.common.exception.ApplicationSettingsException;
+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 PostJobCommandResource extends AbstractResource {
+ private final static Logger logger = LoggerFactory.getLogger(PostJobCommandResource.class);
+
+ private String appDeploymentId;
+ private String command;
+
+ private AppDeploymentResource appDeploymentResource;
+
+
+ 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(POST_JOBCOMMAND);
+ generator.setParameter(PostJobCommandConstants.DEPLOYMENT_ID,
+ ids.get(PostJobCommandConstants.DEPLOYMENT_ID));
+ if (ids.get(PostJobCommandConstants.COMMAND) != null){
+ generator.setParameter(PostJobCommandConstants.COMMAND, ids.get(PostJobCommandConstants.COMMAND));
+ }
+ 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();
+ }
+ }
+ }
+
+ public Resource 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(POST_JOBCOMMAND);
+ generator.setParameter(PostJobCommandConstants.DEPLOYMENT_ID,
+ ids.get(PostJobCommandConstants.DEPLOYMENT_ID));
+ generator.setParameter(PostJobCommandConstants.COMMAND, ids.get(PostJobCommandConstants.COMMAND));
+ Query q = generator.selectQuery(em);
+ PostJobCommand postJobCommand = (PostJobCommand) q.getSingleResult();
+ PostJobCommandResource postJobCommandResource =
+ (PostJobCommandResource) AppCatalogJPAUtils.getResource(
+ AppCatalogResourceType.POST_JOBCOMMAND, postJobCommand);
+ em.getTransaction().commit();
+ em.close();
+ return postJobCommandResource;
+ } 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();
+ }
+ }
+ }
+
+ public List<Resource> get(String fieldName, Object value) throws AppCatalogException {
+ List<Resource> gsiSSHPostJobCommandResources = new ArrayList<Resource>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ Query q;
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(POST_JOBCOMMAND);
+ List results;
+ if (fieldName.equals(PostJobCommandConstants.DEPLOYMENT_ID)) {
+ generator.setParameter(PostJobCommandConstants.DEPLOYMENT_ID, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ PostJobCommand postJobCommand = (PostJobCommand) result;
+ PostJobCommandResource postJobCommandResource =
+ (PostJobCommandResource) AppCatalogJPAUtils.getResource(
+ AppCatalogResourceType.POST_JOBCOMMAND, postJobCommand);
+ gsiSSHPostJobCommandResources.add(postJobCommandResource);
+ }
+ }
+ } else if (fieldName.equals(PostJobCommandConstants.COMMAND)) {
+ generator.setParameter(PostJobCommandConstants.COMMAND, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ PostJobCommand postJobCommand = (PostJobCommand) result;
+ PostJobCommandResource postJobCommandResource =
+ (PostJobCommandResource) AppCatalogJPAUtils.getResource(
+ AppCatalogResourceType.POST_JOBCOMMAND, postJobCommand);
+ gsiSSHPostJobCommandResources.add(postJobCommandResource);
+ }
+ }
+ } else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for GSISSH Post Job Command Resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for GSISSH Post Job Command 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 gsiSSHPostJobCommandResources;
+ }
+
+ @Override
+ public List<Resource> getAll() throws AppCatalogException {
+ return null;
+ }
+
+ @Override
+ public List<String> getAllIds() throws AppCatalogException {
+ return null;
+ }
+
+ public List<String> getIds(String fieldName, Object value) throws AppCatalogException {
+ List<String> gsiSSHPostJobResourceIDs = new ArrayList<String>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ Query q;
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(POST_JOBCOMMAND);
+ List results;
+ if (fieldName.equals(PostJobCommandConstants.DEPLOYMENT_ID)) {
+ generator.setParameter(PostJobCommandConstants.DEPLOYMENT_ID, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ PostJobCommand postJobCommand = (PostJobCommand) result;
+ gsiSSHPostJobResourceIDs.add(postJobCommand.getDeploymentId());
+ }
+ }
+ } else if (fieldName.equals(PostJobCommandConstants.COMMAND)) {
+ generator.setParameter(PostJobCommandConstants.COMMAND, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ PostJobCommand postJobCommand = (PostJobCommand) result;
+ gsiSSHPostJobResourceIDs.add(postJobCommand.getDeploymentId());
+ }
+ }
+ } else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for GSISSH Post Job resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for GSISSH Post JOb 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 gsiSSHPostJobResourceIDs;
+ }
+
+ public void save() throws AppCatalogException {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ PostJobCommand existingPostJobCommand = em.find(PostJobCommand.class,
+ new PostJobCommandPK(appDeploymentId, command));
+ em.close();
+
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ ApplicationDeployment deployment = em.find(ApplicationDeployment.class, appDeploymentId);
+ if (existingPostJobCommand != null){
+ existingPostJobCommand.setDeploymentId(appDeploymentId);
+ existingPostJobCommand.setCommand(command);
+ existingPostJobCommand.setDeployment(deployment);
+ em.merge(existingPostJobCommand);
+ }else {
+ PostJobCommand postJobCommand = new PostJobCommand();
+ postJobCommand.setDeploymentId(appDeploymentId);
+ postJobCommand.setCommand(command);
+ postJobCommand.setDeployment(deployment);
+ em.persist(postJobCommand);
+ }
+ 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();
+ }
+ }
+ }
+
+ 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();
+ PostJobCommand postJobCommand = em.find(PostJobCommand.class, new PostJobCommandPK(
+ ids.get(PostJobCommandConstants.DEPLOYMENT_ID),
+ ids.get(PostJobCommandConstants.COMMAND)));
+
+ em.close();
+ return postJobCommand != null;
+ } 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();
+ }
+ }
+ }
+
+ public String getAppDeploymentId() {
+ return appDeploymentId;
+ }
+
+ public void setAppDeploymentId(String appDeploymentId) {
+ this.appDeploymentId = appDeploymentId;
+ }
+
+ public String getCommand() {
+ return command;
+ }
+
+ public void setCommand(String command) {
+ this.command = command;
+ }
+
+ public AppDeploymentResource getAppDeploymentResource() {
+ return appDeploymentResource;
+ }
+
+ public void setAppDeploymentResource(AppDeploymentResource appDeploymentResource) {
+ this.appDeploymentResource = appDeploymentResource;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/PreJobCommandAppCatalogResourceAppCat.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/PreJobCommandAppCatalogResourceAppCat.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/PreJobCommandAppCatalogResourceAppCat.java
new file mode 100644
index 0000000..6fe515e
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/PreJobCommandAppCatalogResourceAppCat.java
@@ -0,0 +1,333 @@
+/**
+ * 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.ApplicationDeployment;
+import org.apache.airavata.registry.core.app.catalog.model.PreJobCommand;
+import org.apache.airavata.registry.core.app.catalog.model.PreJobCommandPK;
+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 PreJobCommandAppCatalogResourceAppCat extends AppCatAbstractResource {
+ private final static Logger logger = LoggerFactory.getLogger(PreJobCommandAppCatalogResourceAppCat.class);
+
+ private String appDeploymentId;
+ private String command;
+
+ private AppDeploymentAppCatalogResourceAppCat appDeploymentResource;
+
+
+ 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(PRE_JOBCOMMAND);
+ generator.setParameter(PreJobCommandConstants.DEPLOYMENT_ID,
+ ids.get(PreJobCommandConstants.DEPLOYMENT_ID));
+ if (ids.get(PreJobCommandConstants.COMMAND) != null){
+ generator.setParameter(PreJobCommandConstants.COMMAND, ids.get(PreJobCommandConstants.COMMAND));
+ }
+ 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();
+ }
+ }
+ }
+
+ 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(PRE_JOBCOMMAND);
+ generator.setParameter(PreJobCommandConstants.DEPLOYMENT_ID,
+ ids.get(PreJobCommandConstants.DEPLOYMENT_ID));
+ generator.setParameter(PreJobCommandConstants.COMMAND, ids.get(PreJobCommandConstants.COMMAND));
+ Query q = generator.selectQuery(em);
+ PreJobCommand preJobCommand = (PreJobCommand) q.getSingleResult();
+ PreJobCommandAppCatalogResourceAppCat preJobCommandResource =
+ (PreJobCommandAppCatalogResourceAppCat) AppCatalogJPAUtils.getResource(
+ AppCatalogResourceType.PRE_JOBCOMMAND, preJobCommand);
+ em.getTransaction().commit();
+ em.close();
+ return preJobCommandResource;
+ } 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();
+ }
+ }
+ }
+
+ public List<AppCatalogResource> get(String fieldName, Object value) throws AppCatalogException {
+ List<AppCatalogResource> gsiSSHPreJobResources = new ArrayList<AppCatalogResource>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ Query q;
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(PRE_JOBCOMMAND);
+ List results;
+ if (fieldName.equals(PreJobCommandConstants.DEPLOYMENT_ID)) {
+ generator.setParameter(PreJobCommandConstants.DEPLOYMENT_ID, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ PreJobCommand preJobCommand = (PreJobCommand) result;
+ PreJobCommandAppCatalogResourceAppCat preJobCommandResource =
+ (PreJobCommandAppCatalogResourceAppCat) AppCatalogJPAUtils.getResource(
+ AppCatalogResourceType.PRE_JOBCOMMAND, preJobCommand);
+ gsiSSHPreJobResources.add(preJobCommandResource);
+ }
+ }
+ } else if (fieldName.equals(PreJobCommandConstants.COMMAND)) {
+ generator.setParameter(PreJobCommandConstants.COMMAND, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ PreJobCommand preJobCommand = (PreJobCommand) result;
+ PreJobCommandAppCatalogResourceAppCat preJobCommandResource =
+ (PreJobCommandAppCatalogResourceAppCat) AppCatalogJPAUtils.getResource(
+ AppCatalogResourceType.PRE_JOBCOMMAND, preJobCommand);
+ gsiSSHPreJobResources.add(preJobCommandResource);
+ }
+ }
+ } else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for GSISSH Pre Job Command Resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for GSISSH Pre Job Command 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 gsiSSHPreJobResources;
+ }
+
+ @Override
+ public List<AppCatalogResource> getAll() throws AppCatalogException {
+ return null;
+ }
+
+ @Override
+ public List<String> getAllIds() throws AppCatalogException {
+ return null;
+ }
+
+ public List<String> getIds(String fieldName, Object value) throws AppCatalogException {
+ List<String> gsiSSHPreJobResourceIDs = new ArrayList<String>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ Query q;
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(PRE_JOBCOMMAND);
+ List results;
+ if (fieldName.equals(PreJobCommandConstants.DEPLOYMENT_ID)) {
+ generator.setParameter(PreJobCommandConstants.DEPLOYMENT_ID, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ PreJobCommand preJobCommand = (PreJobCommand) result;
+ gsiSSHPreJobResourceIDs.add(preJobCommand.getDeploymentId());
+ }
+ }
+ } else if (fieldName.equals(PreJobCommandConstants.COMMAND)) {
+ generator.setParameter(PreJobCommandConstants.COMMAND, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ PreJobCommand preJobCommand = (PreJobCommand) result;
+ gsiSSHPreJobResourceIDs.add(preJobCommand.getDeploymentId());
+ }
+ }
+ } else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for GSISSH Pre Job resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for GSISSH Pre JOb 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 gsiSSHPreJobResourceIDs;
+ }
+
+ public void save() throws AppCatalogException {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ PreJobCommand existingGSIsshPreJobCommand = em.find(PreJobCommand.class,
+ new PreJobCommandPK(appDeploymentId, command));
+ em.close();
+
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ ApplicationDeployment deployment = em.find(ApplicationDeployment.class, appDeploymentId);
+ if (existingGSIsshPreJobCommand != null){
+ existingGSIsshPreJobCommand.setDeploymentId(appDeploymentId);
+ existingGSIsshPreJobCommand.setCommand(command);
+ existingGSIsshPreJobCommand.setApplicationDeployment(deployment);
+ em.merge(existingGSIsshPreJobCommand);
+ }else {
+ PreJobCommand preJobCommand = new PreJobCommand();
+ preJobCommand.setDeploymentId(appDeploymentId);
+ preJobCommand.setCommand(command);
+ preJobCommand.setApplicationDeployment(deployment);
+ em.persist(preJobCommand);
+ }
+ 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();
+ }
+ }
+ }
+
+ 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();
+ PreJobCommand preJobCommand = em.find(PreJobCommand.class, new PreJobCommandPK(
+ ids.get(PreJobCommandConstants.DEPLOYMENT_ID),
+ ids.get(PreJobCommandConstants.COMMAND)));
+
+ em.close();
+ return preJobCommand != null;
+ } 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();
+ }
+ }
+ }
+
+ public String getAppDeploymentId() {
+ return appDeploymentId;
+ }
+
+ public void setAppDeploymentId(String appDeploymentId) {
+ this.appDeploymentId = appDeploymentId;
+ }
+
+ public String getCommand() {
+ return command;
+ }
+
+ public void setCommand(String command) {
+ this.command = command;
+ }
+
+ public AppDeploymentAppCatalogResourceAppCat getAppDeploymentResource() {
+ return appDeploymentResource;
+ }
+
+ public void setAppDeploymentResource(AppDeploymentAppCatalogResourceAppCat appDeploymentResource) {
+ this.appDeploymentResource = appDeploymentResource;
+ }
+}
[39/52] [abbrv] [partial] airavata git commit: registry refactoring
Posted by sh...@apache.org.
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/ScpDataMovementResource.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/ScpDataMovementResource.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/ScpDataMovementResource.java
deleted file mode 100644
index 8c593f3..0000000
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/ScpDataMovementResource.java
+++ /dev/null
@@ -1,308 +0,0 @@
-/**
- * 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.aiaravata.application.catalog.data.resources;
-
-import org.airavata.appcatalog.cpi.AppCatalogException;
-import org.apache.aiaravata.application.catalog.data.model.ScpDataMovement;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogJPAUtils;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogQueryGenerator;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogResourceType;
-import org.apache.airavata.common.exception.ApplicationSettingsException;
-import org.apache.airavata.common.utils.AiravataUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.persistence.EntityManager;
-import javax.persistence.Query;
-import java.sql.Timestamp;
-import java.util.ArrayList;
-import java.util.List;
-
-public class ScpDataMovementResource extends AbstractResource {
- private final static Logger logger = LoggerFactory.getLogger(ScpDataMovementResource.class);
- private String queueDescription;
- private String dataMovementInterfaceId;
- private String securityProtocol;
- private String alternativeScpHostname;
- private int sshPort;
- private Timestamp createdTime;
- private Timestamp updatedTime;
-
- public Timestamp getCreatedTime() {
- return createdTime;
- }
-
- public void setCreatedTime(Timestamp createdTime) {
- this.createdTime = createdTime;
- }
-
- public Timestamp getUpdatedTime() {
- return updatedTime;
- }
-
- public void setUpdatedTime(Timestamp updatedTime) {
- this.updatedTime = updatedTime;
- }
-
- @Override
- public void remove(Object identifier) throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(SCP_DATA_MOVEMENT);
- generator.setParameter(ScpDataMovementConstants.DATA_MOVEMENT_INTERFACE_ID, identifier);
- 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 Resource get(Object identifier) throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(SCP_DATA_MOVEMENT);
- generator.setParameter(ScpDataMovementConstants.DATA_MOVEMENT_INTERFACE_ID, identifier);
- Query q = generator.selectQuery(em);
- ScpDataMovement scpDataMovement = (ScpDataMovement) q.getSingleResult();
- ScpDataMovementResource scpDataMovementResource = (ScpDataMovementResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.SCP_DATA_MOVEMENT, scpDataMovement);
- em.getTransaction().commit();
- em.close();
- return scpDataMovementResource;
- } 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<Resource> get(String fieldName, Object value) throws AppCatalogException {
- List<Resource> scpDataMovementResources = new ArrayList<Resource>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(SCP_DATA_MOVEMENT);
- Query q;
- if ((fieldName.equals(ScpDataMovementConstants.QUEUE_DESCRIPTION)) || (fieldName.equals(ScpDataMovementConstants.DATA_MOVEMENT_INTERFACE_ID)) || (fieldName.equals(ScpDataMovementConstants.SECURITY_PROTOCOL)) || (fieldName.equals(ScpDataMovementConstants.ALTERNATIVE_SCP_HOSTNAME)) || (fieldName.equals(ScpDataMovementConstants.SSH_PORT))) {
- generator.setParameter(fieldName, value);
- q = generator.selectQuery(em);
- List<?> results = q.getResultList();
- for (Object result : results) {
- ScpDataMovement scpDataMovement = (ScpDataMovement) result;
- ScpDataMovementResource scpDataMovementResource = (ScpDataMovementResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.SCP_DATA_MOVEMENT, scpDataMovement);
- scpDataMovementResources.add(scpDataMovementResource);
- }
- } else {
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported field name for Scp Data Movement Resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported field name for Scp Data Movement Resource.");
- }
- 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();
- }
- }
- return scpDataMovementResources;
- }
-
- @Override
- public List<Resource> 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 {
- List<String> scpDataMovementResourceIDs = new ArrayList<String>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(SCP_DATA_MOVEMENT);
- Query q;
- if ((fieldName.equals(ScpDataMovementConstants.QUEUE_DESCRIPTION)) || (fieldName.equals(ScpDataMovementConstants.DATA_MOVEMENT_INTERFACE_ID)) || (fieldName.equals(ScpDataMovementConstants.SECURITY_PROTOCOL)) || (fieldName.equals(ScpDataMovementConstants.ALTERNATIVE_SCP_HOSTNAME)) || (fieldName.equals(ScpDataMovementConstants.SSH_PORT))) {
- generator.setParameter(fieldName, value);
- q = generator.selectQuery(em);
- List<?> results = q.getResultList();
- for (Object result : results) {
- ScpDataMovement scpDataMovement = (ScpDataMovement) result;
- ScpDataMovementResource scpDataMovementResource = (ScpDataMovementResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.SCP_DATA_MOVEMENT, scpDataMovement);
- scpDataMovementResourceIDs.add(scpDataMovementResource.getDataMovementInterfaceId());
- }
- } else {
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported field name for Scp Data Movement Resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported field name for Scp Data Movement Resource.");
- }
- 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();
- }
- }
- return scpDataMovementResourceIDs;
- }
-
- @Override
- public void save() throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- ScpDataMovement existingScpDataMovement = em.find(ScpDataMovement.class, dataMovementInterfaceId);
- em.close();
- ScpDataMovement scpDataMovement;
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- if (existingScpDataMovement == null) {
- scpDataMovement = new ScpDataMovement();
- scpDataMovement.setCreationTime(AiravataUtils.getCurrentTimestamp());
- } else {
- scpDataMovement = existingScpDataMovement;
- scpDataMovement.setUpdateTime(AiravataUtils.getCurrentTimestamp());
- }
- scpDataMovement.setQueueDescription(getQueueDescription());
- scpDataMovement.setDataMovementInterfaceId(getDataMovementInterfaceId());
- scpDataMovement.setSecurityProtocol(getSecurityProtocol());
- scpDataMovement.setAlternativeScpHostname(getAlternativeScpHostname());
- scpDataMovement.setSshPort(getSshPort());
- if (existingScpDataMovement == null) {
- em.persist(scpDataMovement);
- } else {
- em.merge(scpDataMovement);
- }
- 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 {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- ScpDataMovement scpDataMovement = em.find(ScpDataMovement.class, identifier);
- em.close();
- return scpDataMovement != null;
- } 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();
- }
- }
- }
-
- public String getQueueDescription() {
- return queueDescription;
- }
-
- public String getDataMovementInterfaceId() {
- return dataMovementInterfaceId;
- }
-
- public String getSecurityProtocol() {
- return securityProtocol;
- }
-
- public String getAlternativeScpHostname() {
- return alternativeScpHostname;
- }
-
- public int getSshPort() {
- return sshPort;
- }
-
- public void setQueueDescription(String queueDescription) {
- this.queueDescription=queueDescription;
- }
-
- public void setDataMovementInterfaceId(String dataMovementInterfaceId) {
- this.dataMovementInterfaceId=dataMovementInterfaceId;
- }
-
- public void setSecurityProtocol(String securityProtocol) {
- this.securityProtocol=securityProtocol;
- }
-
- public void setAlternativeScpHostname(String alternativeScpHostname) {
- this.alternativeScpHostname=alternativeScpHostname;
- }
-
- public void setSshPort(int sshPort) {
- this.sshPort=sshPort;
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/SshJobSubmissionResource.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/SshJobSubmissionResource.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/SshJobSubmissionResource.java
deleted file mode 100644
index ee14d76..0000000
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/SshJobSubmissionResource.java
+++ /dev/null
@@ -1,332 +0,0 @@
-/**
- * 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.aiaravata.application.catalog.data.resources;
-
-import java.sql.Timestamp;
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.persistence.EntityManager;
-import javax.persistence.Query;
-
-import org.airavata.appcatalog.cpi.AppCatalogException;
-import org.apache.aiaravata.application.catalog.data.model.ResourceJobManager;
-import org.apache.aiaravata.application.catalog.data.model.SshJobSubmission;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogJPAUtils;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogQueryGenerator;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogResourceType;
-import org.apache.airavata.common.exception.ApplicationSettingsException;
-import org.apache.airavata.common.utils.AiravataUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class SshJobSubmissionResource extends AbstractResource {
- private final static Logger logger = LoggerFactory.getLogger(SshJobSubmissionResource.class);
- private String resourceJobManagerId;
- private ResourceJobManagerResource resourceJobManagerResource;
- private String jobSubmissionInterfaceId;
- private String alternativeSshHostname;
- private String securityProtocol;
- private int sshPort;
- private String monitorMode;
- private Timestamp createdTime;
- private Timestamp updatedTime;
-
- public Timestamp getCreatedTime() {
- return createdTime;
- }
-
- public void setCreatedTime(Timestamp createdTime) {
- this.createdTime = createdTime;
- }
-
- public Timestamp getUpdatedTime() {
- return updatedTime;
- }
-
- public void setUpdatedTime(Timestamp updatedTime) {
- this.updatedTime = updatedTime;
- }
-
- @Override
- public void remove(Object identifier) throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(SSH_JOB_SUBMISSION);
- generator.setParameter(SshJobSubmissionConstants.JOB_SUBMISSION_INTERFACE_ID, identifier);
- 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 Resource get(Object identifier) throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(SSH_JOB_SUBMISSION);
- generator.setParameter(SshJobSubmissionConstants.JOB_SUBMISSION_INTERFACE_ID, identifier);
- Query q = generator.selectQuery(em);
- SshJobSubmission sshJobSubmission = (SshJobSubmission) q.getSingleResult();
- SshJobSubmissionResource sshJobSubmissionResource = (SshJobSubmissionResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.SSH_JOB_SUBMISSION, sshJobSubmission);
- em.getTransaction().commit();
- em.close();
- return sshJobSubmissionResource;
- } 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<Resource> get(String fieldName, Object value) throws AppCatalogException {
- List<Resource> sshJobSubmissionResources = new ArrayList<Resource>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(SSH_JOB_SUBMISSION);
- Query q;
- if ((fieldName.equals(SshJobSubmissionConstants.RESOURCE_JOB_MANAGER_ID)) || (fieldName.equals(SshJobSubmissionConstants.JOB_SUBMISSION_INTERFACE_ID)) || (fieldName.equals(SshJobSubmissionConstants.ALTERNATIVE_SSH_HOSTNAME)) || (fieldName.equals(SshJobSubmissionConstants.SECURITY_PROTOCOL)) || (fieldName.equals(SshJobSubmissionConstants.SSH_PORT))) {
- generator.setParameter(fieldName, value);
- q = generator.selectQuery(em);
- List<?> results = q.getResultList();
- for (Object result : results) {
- SshJobSubmission sshJobSubmission = (SshJobSubmission) result;
- SshJobSubmissionResource sshJobSubmissionResource = (SshJobSubmissionResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.SSH_JOB_SUBMISSION, sshJobSubmission);
- sshJobSubmissionResources.add(sshJobSubmissionResource);
- }
- } else {
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported field name for Ssh Job Submission Resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported field name for Ssh Job Submission Resource.");
- }
- 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();
- }
- }
- return sshJobSubmissionResources;
- }
-
- @Override
- public List<Resource> 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 {
- List<String> sshJobSubmissionResourceIDs = new ArrayList<String>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(SSH_JOB_SUBMISSION);
- Query q;
- if ((fieldName.equals(SshJobSubmissionConstants.RESOURCE_JOB_MANAGER_ID)) || (fieldName.equals(SshJobSubmissionConstants.JOB_SUBMISSION_INTERFACE_ID)) || (fieldName.equals(SshJobSubmissionConstants.ALTERNATIVE_SSH_HOSTNAME)) || (fieldName.equals(SshJobSubmissionConstants.SECURITY_PROTOCOL)) || (fieldName.equals(SshJobSubmissionConstants.SSH_PORT))) {
- generator.setParameter(fieldName, value);
- q = generator.selectQuery(em);
- List<?> results = q.getResultList();
- for (Object result : results) {
- SshJobSubmission sshJobSubmission = (SshJobSubmission) result;
- SshJobSubmissionResource sshJobSubmissionResource = (SshJobSubmissionResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.SSH_JOB_SUBMISSION, sshJobSubmission);
- sshJobSubmissionResourceIDs.add(sshJobSubmissionResource.getJobSubmissionInterfaceId());
- }
- } else {
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported field name for Ssh Job Submission Resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported field name for Ssh Job Submission Resource.");
- }
- 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();
- }
- }
- return sshJobSubmissionResourceIDs;
- }
-
- @Override
- public void save() throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- SshJobSubmission existingSshJobSubmission = em.find(SshJobSubmission.class, jobSubmissionInterfaceId);
- em.close();
- SshJobSubmission sshJobSubmission;
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- if (existingSshJobSubmission == null) {
- sshJobSubmission = new SshJobSubmission();
- sshJobSubmission.setCreationTime(AiravataUtils.getCurrentTimestamp());
- } else {
- sshJobSubmission = existingSshJobSubmission;
- sshJobSubmission.setUpdateTime(AiravataUtils.getCurrentTimestamp());
- }
- sshJobSubmission.setResourceJobManagerId(getResourceJobManagerId());
- ResourceJobManager resourceJobManager = em.find(ResourceJobManager.class, getResourceJobManagerId());
- sshJobSubmission.setResourceJobManager(resourceJobManager);
- sshJobSubmission.setJobSubmissionInterfaceId(getJobSubmissionInterfaceId());
- sshJobSubmission.setAlternativeSshHostname(getAlternativeSshHostname());
- sshJobSubmission.setSecurityProtocol(getSecurityProtocol());
- sshJobSubmission.setSshPort(getSshPort());
- sshJobSubmission.setMonitorMode(getMonitorMode());
- if (existingSshJobSubmission == null) {
- em.persist(sshJobSubmission);
- } else {
- em.merge(sshJobSubmission);
- }
- 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 {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- SshJobSubmission sshJobSubmission = em.find(SshJobSubmission.class, identifier);
- em.close();
- return sshJobSubmission != null;
- } 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();
- }
- }
- }
-
- public String getResourceJobManagerId() {
- return resourceJobManagerId;
- }
-
- public ResourceJobManagerResource getResourceJobManagerResource() {
- return resourceJobManagerResource;
- }
-
- public String getJobSubmissionInterfaceId() {
- return jobSubmissionInterfaceId;
- }
-
- public String getAlternativeSshHostname() {
- return alternativeSshHostname;
- }
-
- public String getSecurityProtocol() {
- return securityProtocol;
- }
-
- public int getSshPort() {
- return sshPort;
- }
-
- public void setResourceJobManagerId(String resourceJobManagerId) {
- this.resourceJobManagerId=resourceJobManagerId;
- }
-
- public void setResourceJobManagerResource(ResourceJobManagerResource resourceJobManagerResource) {
- this.resourceJobManagerResource=resourceJobManagerResource;
- }
-
- public void setJobSubmissionInterfaceId(String jobSubmissionInterfaceId) {
- this.jobSubmissionInterfaceId=jobSubmissionInterfaceId;
- }
-
- public void setAlternativeSshHostname(String alternativeSshHostname) {
- this.alternativeSshHostname=alternativeSshHostname;
- }
-
- public void setSecurityProtocol(String securityProtocol) {
- this.securityProtocol=securityProtocol;
- }
-
- public void setSshPort(int sshPort) {
- this.sshPort=sshPort;
- }
-
- public String getMonitorMode() {
- return monitorMode;
- }
-
- public void setMonitorMode(String monitorMode) {
- this.monitorMode = monitorMode;
- }
-
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/UnicoreDataMovementResource.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/UnicoreDataMovementResource.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/UnicoreDataMovementResource.java
deleted file mode 100644
index 63f2b70..0000000
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/UnicoreDataMovementResource.java
+++ /dev/null
@@ -1,255 +0,0 @@
-/*
- *
- * 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.aiaravata.application.catalog.data.resources;
-
-import org.airavata.appcatalog.cpi.AppCatalogException;
-import org.apache.aiaravata.application.catalog.data.model.UnicoreDataMovement;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogJPAUtils;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogQueryGenerator;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogResourceType;
-import org.apache.airavata.common.exception.ApplicationSettingsException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.persistence.EntityManager;
-import javax.persistence.Query;
-import java.util.ArrayList;
-import java.util.List;
-
-public class UnicoreDataMovementResource extends AbstractResource {
-
- private final static Logger logger = LoggerFactory.getLogger(UnicoreDataMovementResource.class);
-
- private String dataMovementId;
- private String securityProtocol;
- private String unicoreEndpointUrl;
-
- public void remove(Object identifier) throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(UNICORE_DATA_MOVEMENT);
- generator.setParameter(UnicoreDataMovementConstants.DATAMOVEMENT_ID, identifier);
- 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();
- }
- }
- }
-
- public Resource get(Object identifier) throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(UNICORE_DATA_MOVEMENT);
- generator.setParameter(UnicoreDataMovementConstants.DATAMOVEMENT_ID, identifier);
- Query q = generator.selectQuery(em);
- UnicoreDataMovement unicoreDataMovement = (UnicoreDataMovement) q.getSingleResult();
- UnicoreDataMovementResource dataMovementResource =
- (UnicoreDataMovementResource) AppCatalogJPAUtils
- .getResource(AppCatalogResourceType.UNICORE_DATA_MOVEMENT,
- unicoreDataMovement);
- em.getTransaction().commit();
- em.close();
- return dataMovementResource;
- } 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();
- }
- }
- }
-
-
- public List<Resource> get(String fieldName, Object value) throws AppCatalogException {
- List<Resource> unicoreDMResourceList = new ArrayList<Resource>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- Query q;
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(UNICORE_DATA_MOVEMENT);
- List results;
- if (fieldName.equals(UnicoreDataMovementConstants.UNICORE_ENDPOINT_URL)) {
- generator.setParameter(UnicoreDataMovementConstants.UNICORE_ENDPOINT_URL, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- UnicoreDataMovement dataMovement = (UnicoreDataMovement) result;
- UnicoreDataMovementResource unicoreJobSubmissionResource =
- (UnicoreDataMovementResource) AppCatalogJPAUtils.getResource(
- AppCatalogResourceType.UNICORE_DATA_MOVEMENT, dataMovement);
- unicoreDMResourceList.add(unicoreJobSubmissionResource);
- }
- }
- } else if (fieldName.equals(UnicoreDataMovementConstants.SECURITY_PROTOCAL)) {
- generator.setParameter(UnicoreDataMovementConstants.SECURITY_PROTOCAL, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- UnicoreDataMovement dataMovement = (UnicoreDataMovement) result;
- UnicoreDataMovementResource dataMovementResource =
- (UnicoreDataMovementResource) AppCatalogJPAUtils.getResource(
- AppCatalogResourceType.UNICORE_DATA_MOVEMENT, dataMovement);
- unicoreDMResourceList.add(dataMovementResource);
- }
- }
- } else {
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported field name for Unicore data movement resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported field name for Unicore data movement 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 unicoreDMResourceList;
- }
-
- @Override
- public List<Resource> getAll() throws AppCatalogException {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public List<String> getAllIds() throws AppCatalogException {
- // TODO Auto-generated method stub
- return null;
- }
-
- public List<String> getIds(String fieldName, Object value) throws AppCatalogException {
- return null;
- }
-
- public void save() throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- UnicoreDataMovement existingDataMovement = em.find(UnicoreDataMovement.class, dataMovementId);
- em.close();
-
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- if (existingDataMovement != null) {
- existingDataMovement.setDataMovementId(dataMovementId);;
- existingDataMovement.setUnicoreEndpointUrl(unicoreEndpointUrl);
- existingDataMovement.setSecurityProtocol(securityProtocol);
- em.merge(existingDataMovement);
- } else {
- UnicoreDataMovement unicoreJobSubmission = new UnicoreDataMovement();
- unicoreJobSubmission.setDataMovementId(dataMovementId);
- unicoreJobSubmission.setUnicoreEndpointUrl(unicoreEndpointUrl);
- unicoreJobSubmission.setSecurityProtocol(securityProtocol);
- em.persist(unicoreJobSubmission);
- }
- 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();
- }
- }
- }
-
- public boolean isExists(Object identifier) throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- UnicoreDataMovement dataMovement = em.find(UnicoreDataMovement.class, identifier);
- em.close();
- return dataMovement != null;
- } 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();
- }
- }
- }
-
-
- public String getDataMovementId() {
- return dataMovementId;
- }
-
- public void setDataMovementId(String dataMovementId) {
- this.dataMovementId = dataMovementId;
- }
-
- public String getSecurityProtocol() {
- return securityProtocol;
- }
-
- public void setSecurityProtocol(String securityProtocol) {
- this.securityProtocol = securityProtocol;
- }
-
- public String getUnicoreEndpointUrl() {
- return unicoreEndpointUrl;
- }
-
- public void setUnicoreEndpointUrl(String unicoreEndpointUrl) {
- this.unicoreEndpointUrl = unicoreEndpointUrl;
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/UnicoreJobSubmissionResource.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/UnicoreJobSubmissionResource.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/UnicoreJobSubmissionResource.java
deleted file mode 100644
index 4c772e1..0000000
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/UnicoreJobSubmissionResource.java
+++ /dev/null
@@ -1,328 +0,0 @@
-/*
- *
- * 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.aiaravata.application.catalog.data.resources;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-
-import javax.persistence.EntityManager;
-import javax.persistence.Query;
-
-import org.airavata.appcatalog.cpi.AppCatalogException;
-import org.apache.aiaravata.application.catalog.data.model.GlobusJobSubmission;
-import org.apache.aiaravata.application.catalog.data.model.UnicoreJobSubmission;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogJPAUtils;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogQueryGenerator;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogResourceType;
-import org.apache.airavata.common.exception.ApplicationSettingsException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class UnicoreJobSubmissionResource extends AbstractResource {
-
- private final static Logger logger = LoggerFactory.getLogger(UnicoreJobSubmissionResource.class);
-
- private String jobSubmissionInterfaceId;
- private String securityProtocol;
- private String unicoreEndpointUrl;
-
- public void remove(Object identifier) throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(UNICORE_JOB_SUBMISSION);
- generator.setParameter(UnicoreJobSubmissionConstants.SUBMISSION_ID, identifier);
- 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();
- }
- }
- }
-
- public Resource get(Object identifier) throws AppCatalogException {
- HashMap<String, String> ids;
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(UNICORE_JOB_SUBMISSION);
- generator.setParameter(UnicoreJobSubmissionConstants.SUBMISSION_ID, identifier);
- Query q = generator.selectQuery(em);
- UnicoreJobSubmission unicoreJobSubmission = (UnicoreJobSubmission) q.getSingleResult();
- UnicoreJobSubmissionResource unicoreSubmissionResource =
- (UnicoreJobSubmissionResource) AppCatalogJPAUtils
- .getResource(AppCatalogResourceType.UNICORE_JOB_SUBMISSION,
- unicoreJobSubmission);
- em.getTransaction().commit();
- em.close();
- return unicoreSubmissionResource;
- } 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();
- }
- }
- }
-
-
- public List<Resource> get(String fieldName, Object value) throws AppCatalogException {
- List<Resource> unicoreSubmissionResourceList = new ArrayList<Resource>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- Query q;
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(UNICORE_JOB_SUBMISSION);
- List results;
- if (fieldName.equals(UnicoreJobSubmissionConstants.UNICORE_ENDPOINT_URL)) {
- generator.setParameter(UnicoreJobSubmissionConstants.UNICORE_ENDPOINT_URL, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- UnicoreJobSubmission unicoreJobSubmission = (UnicoreJobSubmission) result;
- UnicoreJobSubmissionResource unicoreJobSubmissionResource =
- (UnicoreJobSubmissionResource) AppCatalogJPAUtils.getResource(
- AppCatalogResourceType.UNICORE_JOB_SUBMISSION, unicoreJobSubmission);
- unicoreSubmissionResourceList.add(unicoreJobSubmissionResource);
- }
- }
- } else if (fieldName.equals(UnicoreJobSubmissionConstants.SECURITY_PROTOCAL)) {
- generator.setParameter(UnicoreJobSubmissionConstants.SECURITY_PROTOCAL, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- UnicoreJobSubmission unicoreJobSubmission = (UnicoreJobSubmission) result;
- UnicoreJobSubmissionResource unicoreJobSubmissionResource =
- (UnicoreJobSubmissionResource) AppCatalogJPAUtils.getResource(
- AppCatalogResourceType.UNICORE_JOB_SUBMISSION, unicoreJobSubmission);
- unicoreSubmissionResourceList.add(unicoreJobSubmissionResource);
- }
- }
- }
- else {
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported field name for Unicore submission resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported field name for Unicore Submission 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 unicoreSubmissionResourceList;
- }
-
- @Override
- public List<Resource> getAll() throws AppCatalogException {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public List<String> getAllIds() throws AppCatalogException {
- // TODO Auto-generated method stub
- return null;
- }
-
- public List<String> getIds(String fieldName, Object value) throws AppCatalogException {
- List<String> globusSubmissionResourceIDs = new ArrayList<String>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- Query q;
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(GLOBUS_SUBMISSION);
- List results;
- if (fieldName.equals(GlobusJobSubmissionConstants.SUBMISSION_ID)) {
- generator.setParameter(GlobusJobSubmissionConstants.SUBMISSION_ID, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- GlobusJobSubmission globusJobSubmission = (GlobusJobSubmission) result;
- globusSubmissionResourceIDs.add(globusJobSubmission.getSubmissionID());
- }
- }
- } else if (fieldName.equals(GlobusJobSubmissionConstants.GLOBUS_GATEKEEPER_EP)) {
- generator.setParameter(GlobusJobSubmissionConstants.GLOBUS_GATEKEEPER_EP, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- GlobusJobSubmission globusJobSubmission = (GlobusJobSubmission) result;
- globusSubmissionResourceIDs.add(globusJobSubmission.getSubmissionID());
- }
- }
- }
- else if (fieldName.equals(GlobusJobSubmissionConstants.SECURITY_PROTOCAL)) {
- generator.setParameter(GlobusJobSubmissionConstants.SECURITY_PROTOCAL, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- GlobusJobSubmission globusJobSubmission = (GlobusJobSubmission) result;
- globusSubmissionResourceIDs.add(globusJobSubmission.getSubmissionID());
- }
- }
- } else if (fieldName.equals(GlobusJobSubmissionConstants.RESOURCE_JOB_MANAGER)) {
- generator.setParameter(GlobusJobSubmissionConstants.RESOURCE_JOB_MANAGER, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- GlobusJobSubmission globusJobSubmission = (GlobusJobSubmission) result;
- globusSubmissionResourceIDs.add(globusJobSubmission.getSubmissionID());
- }
- }
- } else {
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported field name for Globus Submission resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported field name for Globus Submission 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 globusSubmissionResourceIDs;
- }
-
- public void save() throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- UnicoreJobSubmission existingUnicoreSubmission = em.find(UnicoreJobSubmission.class, jobSubmissionInterfaceId);
- em.close();
-
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- if (existingUnicoreSubmission != null) {
- existingUnicoreSubmission.setSubmissionID(jobSubmissionInterfaceId);;
- existingUnicoreSubmission.setUnicoreEndpointUrl(unicoreEndpointUrl);
- existingUnicoreSubmission.setSecurityProtocol(securityProtocol);
-
- em.merge(existingUnicoreSubmission);
- } else {
- UnicoreJobSubmission unicoreJobSubmission = new UnicoreJobSubmission();
- unicoreJobSubmission.setSubmissionID(jobSubmissionInterfaceId);
- unicoreJobSubmission.setUnicoreEndpointUrl(unicoreEndpointUrl);
- unicoreJobSubmission.setSecurityProtocol(securityProtocol);
- em.persist(unicoreJobSubmission);
- }
- 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();
- }
- }
- }
-
- public boolean isExists(Object identifier) throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- UnicoreJobSubmission unicoreJobSubmission = em.find(UnicoreJobSubmission.class, identifier);
- em.close();
- return unicoreJobSubmission != null;
- } 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();
- }
- }
- }
-
-
- public String getjobSubmissionInterfaceId() {
- return jobSubmissionInterfaceId;
- }
-
- public void setjobSubmissionInterfaceId(String jobSubmissionInterfaceId) {
- this.jobSubmissionInterfaceId = jobSubmissionInterfaceId;
- }
-
- public String getSecurityProtocol() {
- return securityProtocol;
- }
-
- public void setSecurityProtocol(String securityProtocol) {
- this.securityProtocol = securityProtocol;
- }
-
- public String getUnicoreEndpointUrl() {
- return unicoreEndpointUrl;
- }
-
- public void setUnicoreEndpointUrl(String unicoreEndpointUrl) {
- this.unicoreEndpointUrl = unicoreEndpointUrl;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/WorkflowInputResource.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/WorkflowInputResource.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/WorkflowInputResource.java
deleted file mode 100644
index ac22744..0000000
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/WorkflowInputResource.java
+++ /dev/null
@@ -1,451 +0,0 @@
-/**
- * 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.aiaravata.application.catalog.data.resources;
-
-import org.airavata.appcatalog.cpi.AppCatalogException;
-import org.apache.aiaravata.application.catalog.data.model.Workflow;
-import org.apache.aiaravata.application.catalog.data.model.WorkflowInput;
-import org.apache.aiaravata.application.catalog.data.model.WorkflowInput_PK;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogJPAUtils;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogQueryGenerator;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogResourceType;
-import org.apache.airavata.common.exception.ApplicationSettingsException;
-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 WorkflowInputResource extends AbstractResource {
-
- private final static Logger logger = LoggerFactory.getLogger(WorkflowInputResource.class);
-
- private String wfTemplateId;
- private String inputKey;
- private String dataType;
- private String inputVal;
- private String metadata;
- private String appArgument;
- private String userFriendlyDesc;
- private boolean standardInput;
- private int inputOrder;
- private boolean isRequired;
- private boolean requiredToCMD;
- private boolean dataStaged;
-
- private WorkflowResource workflowResource;
-
- 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(WORKFLOW_INPUT);
- generator.setParameter(WFInputConstants.WF_TEMPLATE_ID, ids.get(WFInputConstants.WF_TEMPLATE_ID));
- generator.setParameter(WFInputConstants.INPUT_KEY, ids.get(WFInputConstants.INPUT_KEY));
- 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();
- }
- }
- }
-
- public Resource get(Object identifier) throws AppCatalogException {
- HashMap<String, String> ids;
- if (identifier instanceof Map) {
- ids = (HashMap<String, String>) 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(WORKFLOW_INPUT);
- generator.setParameter(WFInputConstants.WF_TEMPLATE_ID, ids.get(WFInputConstants.WF_TEMPLATE_ID));
- generator.setParameter(WFInputConstants.INPUT_KEY, ids.get(WFInputConstants.INPUT_KEY));
- Query q = generator.selectQuery(em);
- WorkflowInput workflowInput = (WorkflowInput) q.getSingleResult();
- WorkflowInputResource workflowInputResource =
- (WorkflowInputResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.WORKFLOW_INPUT
- , workflowInput);
- em.getTransaction().commit();
- em.close();
- return workflowInputResource;
- } 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();
- }
- }
- }
-
- public List<Resource> get(String fieldName, Object value) throws AppCatalogException {
- List<Resource> wfInputResources = new ArrayList<Resource>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- Query q;
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(WORKFLOW_INPUT);
- List results;
- if (fieldName.equals(WFInputConstants.WF_TEMPLATE_ID)) {
- generator.setParameter(WFInputConstants.WF_TEMPLATE_ID, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- WorkflowInput workflowInput = (WorkflowInput) result;
- WorkflowInputResource workflowInputResource =
- (WorkflowInputResource) AppCatalogJPAUtils.getResource(
- AppCatalogResourceType.WORKFLOW_INPUT, workflowInput);
- wfInputResources.add(workflowInputResource);
- }
- }
- } else if (fieldName.equals(WFInputConstants.INPUT_KEY)) {
- generator.setParameter(WFInputConstants.INPUT_KEY, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- WorkflowInput workflowInput = (WorkflowInput) result;
- WorkflowInputResource workflowInputResource =
- (WorkflowInputResource) AppCatalogJPAUtils.getResource(
- AppCatalogResourceType.WORKFLOW_INPUT, workflowInput);
- wfInputResources.add(workflowInputResource);
- }
- }
- } else if (fieldName.equals(WFInputConstants.DATA_TYPE)) {
- generator.setParameter(WFInputConstants.DATA_TYPE, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- WorkflowInput workflowInput = (WorkflowInput) result;
- WorkflowInputResource workflowInputResource =
- (WorkflowInputResource) AppCatalogJPAUtils.getResource(
- AppCatalogResourceType.WORKFLOW_INPUT, workflowInput);
- wfInputResources.add(workflowInputResource);
- }
- }
- } else {
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported field name for WFInput Resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported field name for WFInput 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 wfInputResources;
- }
-
- public List<Resource> getAll() throws AppCatalogException {
- return null;
- }
-
- public List<String> getAllIds() throws AppCatalogException {
- return null;
- }
-
- public List<String> getIds(String fieldName, Object value) throws AppCatalogException {
- List<String> wfInputResourceIDs = new ArrayList<String>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- Query q;
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(WORKFLOW_INPUT);
- List results;
- if (fieldName.equals(WFInputConstants.WF_TEMPLATE_ID)) {
- generator.setParameter(WFInputConstants.WF_TEMPLATE_ID, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- WorkflowInput workflowInput = (WorkflowInput) result;
- wfInputResourceIDs.add(workflowInput.getWfTemplateId());
- }
- }
- } else if (fieldName.equals(WFInputConstants.INPUT_KEY)) {
- generator.setParameter(WFInputConstants.INPUT_KEY, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- WorkflowInput workflowInput = (WorkflowInput) result;
- wfInputResourceIDs.add(workflowInput.getWfTemplateId());
- }
- }
- } else if (fieldName.equals(WFInputConstants.DATA_TYPE)) {
- generator.setParameter(WFInputConstants.DATA_TYPE, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- WorkflowInput workflowInput = (WorkflowInput) result;
- wfInputResourceIDs.add(workflowInput.getWfTemplateId());
- }
- }
- } else {
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported field name for WFInput resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported field name for WFInput 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 wfInputResourceIDs;
- }
-
- public void save() throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- WorkflowInput existingWFInput = em.find(WorkflowInput.class, new WorkflowInput_PK(wfTemplateId, inputKey));
- em.close();
- WorkflowInput workflowInput;
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- if (existingWFInput == null) {
- workflowInput = new WorkflowInput();
- } else {
- workflowInput=existingWFInput;
- }
- workflowInput.setWfTemplateId(wfTemplateId);
- Workflow workflow = em.find(Workflow.class, wfTemplateId);
- workflowInput.setWorkflow(workflow);
- workflowInput.setDataType(dataType);
- workflowInput.setInputKey(inputKey);
- if (inputVal != null){
- workflowInput.setInputVal(inputVal.toCharArray());
- }
- workflowInput.setMetadata(metadata);
- workflowInput.setAppArgument(appArgument);
- workflowInput.setUserFriendlyDesc(userFriendlyDesc);
- workflowInput.setStandardInput(standardInput);
- workflowInput.setRequiredToCMD(requiredToCMD);
- workflowInput.setRequired(isRequired);
- workflowInput.setDataStaged(dataStaged);
- if (existingWFInput == null) {
- em.persist(workflowInput);
- } else {
- em.merge(workflowInput);
- }
- 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();
- }
- }
- }
-
- public boolean isExists(Object identifier) throws AppCatalogException {
- HashMap<String, String> ids;
- if (identifier instanceof Map) {
- ids = (HashMap<String, String>) 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();
- WorkflowInput workflowInput = em.find(WorkflowInput.class, new WorkflowInput_PK(
- ids.get(WFInputConstants.WF_TEMPLATE_ID),
- ids.get(WFInputConstants.INPUT_KEY)));
-
- em.close();
- return workflowInput != null;
- } 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();
- }
- }
- }
-
- public String getWfTemplateId() {
- return wfTemplateId;
- }
-
- public void setWfTemplateId(String wfTemplateId) {
- this.wfTemplateId = wfTemplateId;
- }
-
- public String getInputKey() {
- return inputKey;
- }
-
- public void setInputKey(String inputKey) {
- this.inputKey = inputKey;
- }
-
- public String getDataType() {
- return dataType;
- }
-
- public void setDataType(String dataType) {
- this.dataType = dataType;
- }
-
- public String getInputVal() {
- return inputVal;
- }
-
- public void setInputVal(String inputVal) {
- this.inputVal = inputVal;
- }
-
- public String getMetadata() {
- return metadata;
- }
-
- public void setMetadata(String metadata) {
- this.metadata = metadata;
- }
-
- public String getAppArgument() {
- return appArgument;
- }
-
- public void setAppArgument(String appArgument) {
- this.appArgument = appArgument;
- }
-
- public String getUserFriendlyDesc() {
- return userFriendlyDesc;
- }
-
- public void setUserFriendlyDesc(String userFriendlyDesc) {
- this.userFriendlyDesc = userFriendlyDesc;
- }
-
- public WorkflowResource getWorkflowResource() {
- return workflowResource;
- }
-
- public void setWorkflowResource(WorkflowResource workflowResource) {
- this.workflowResource = workflowResource;
- }
-
- public boolean isStandardInput() {
- return standardInput;
- }
-
- public void setStandardInput(boolean standardInput) {
- this.standardInput = standardInput;
- }
-
- public int getInputOrder() {
- return inputOrder;
- }
-
- public void setInputOrder(int inputOrder) {
- this.inputOrder = inputOrder;
- }
-
- public boolean getRequired() {
- return isRequired;
- }
-
- public void setRequired(boolean required) {
- this.isRequired = required;
- }
-
- public boolean getRequiredToCMD() {
- return requiredToCMD;
- }
-
- public void setRequiredToCMD(boolean requiredToCMD) {
- this.requiredToCMD = requiredToCMD;
- }
-
- public boolean isDataStaged() {
- return dataStaged;
- }
-
- public void setDataStaged(boolean dataStaged) {
- this.dataStaged = dataStaged;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/WorkflowOutputResource.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/WorkflowOutputResource.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/WorkflowOutputResource.java
deleted file mode 100644
index 7f180bd..0000000
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/WorkflowOutputResource.java
+++ /dev/null
@@ -1,410 +0,0 @@
-/**
- * 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.aiaravata.application.catalog.data.resources;
-
-import org.airavata.appcatalog.cpi.AppCatalogException;
-import org.apache.aiaravata.application.catalog.data.model.Workflow;
-import org.apache.aiaravata.application.catalog.data.model.WorkflowOutput;
-import org.apache.aiaravata.application.catalog.data.model.WorkflowOutput_PK;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogJPAUtils;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogQueryGenerator;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogResourceType;
-import org.apache.airavata.common.exception.ApplicationSettingsException;
-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 WorkflowOutputResource extends AbstractResource {
- private final static Logger logger = LoggerFactory.getLogger(WorkflowOutputResource.class);
-
- private String wfTemplateId;
- private String outputKey;
- private String outputVal;
- private String dataType;
- private String validityType;
- private boolean dataMovement;
- private String dataNameLocation;
-
- private WorkflowResource workflowResource;
-
- 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(WORKFLOW_OUTPUT);
- generator.setParameter(WFOutputConstants.WF_TEMPLATE_ID, ids.get(WFOutputConstants.WF_TEMPLATE_ID));
- generator.setParameter(WFOutputConstants.OUTPUT_KEY, ids.get(WFOutputConstants.OUTPUT_KEY));
- 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();
- }
- }
- }
-
- public Resource 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(WORKFLOW_OUTPUT);
- generator.setParameter(WFOutputConstants.WF_TEMPLATE_ID, ids.get(WFOutputConstants.WF_TEMPLATE_ID));
- generator.setParameter(WFOutputConstants.OUTPUT_KEY, ids.get(WFOutputConstants.OUTPUT_KEY));
- Query q = generator.selectQuery(em);
- WorkflowOutput wfOutput = (WorkflowOutput) q.getSingleResult();
- WorkflowOutputResource workflowOutputResource =
- (WorkflowOutputResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.WORKFLOW_OUTPUT
- , wfOutput);
- em.getTransaction().commit();
- em.close();
- return workflowOutputResource;
- } 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();
- }
- }
- }
-
- public List<Resource> get(String fieldName, Object value) throws AppCatalogException {
- List<Resource> wfOutputResources = new ArrayList<Resource>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- Query q;
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(WORKFLOW_OUTPUT);
- List results;
- if (fieldName.equals(WFOutputConstants.WF_TEMPLATE_ID)) {
- generator.setParameter(WFOutputConstants.WF_TEMPLATE_ID, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- WorkflowOutput wfOutput = (WorkflowOutput) result;
- WorkflowOutputResource workflowOutputResource =
- (WorkflowOutputResource) AppCatalogJPAUtils.getResource(
- AppCatalogResourceType.WORKFLOW_OUTPUT, wfOutput);
- wfOutputResources.add(workflowOutputResource);
- }
- }
- } else if (fieldName.equals(WFOutputConstants.OUTPUT_KEY)) {
- generator.setParameter(WFOutputConstants.OUTPUT_KEY, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- WorkflowOutput workflowOutput = (WorkflowOutput) result;
- WorkflowOutputResource workflowOutputResource =
- (WorkflowOutputResource) AppCatalogJPAUtils.getResource(
- AppCatalogResourceType.WORKFLOW_OUTPUT, workflowOutput);
- wfOutputResources.add(workflowOutputResource);
- }
- }
- } else if (fieldName.equals(WFOutputConstants.DATA_TYPE)) {
- generator.setParameter(WFOutputConstants.DATA_TYPE, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- WorkflowOutput workflowOutput = (WorkflowOutput) result;
- WorkflowOutputResource workflowOutputResource =
- (WorkflowOutputResource) AppCatalogJPAUtils.getResource(
- AppCatalogResourceType.WORKFLOW_OUTPUT, workflowOutput);
- wfOutputResources.add(workflowOutputResource);
- }
- }
- } else {
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported field name for WF Output Resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported field name for WF Output 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 wfOutputResources;
- }
-
- public List<Resource> getAll() throws AppCatalogException {
- return null;
- }
-
- public List<String> getAllIds() throws AppCatalogException {
- return null;
- }
-
- public List<String> getIds(String fieldName, Object value) throws AppCatalogException {
- List<String> wfOutputResourceIDs = new ArrayList<String>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- Query q;
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(WORKFLOW_OUTPUT);
- List results;
- if (fieldName.equals(WFOutputConstants.WF_TEMPLATE_ID)) {
- generator.setParameter(WFOutputConstants.WF_TEMPLATE_ID, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- WorkflowOutput workflowOutput = (WorkflowOutput) result;
- wfOutputResourceIDs.add(workflowOutput.getWfTemplateId());
- }
- }
- }
- if (fieldName.equals(WFOutputConstants.OUTPUT_KEY)) {
- generator.setParameter(WFOutputConstants.OUTPUT_KEY, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- WorkflowOutput workflowOutput = (WorkflowOutput) result;
- wfOutputResourceIDs.add(workflowOutput.getWfTemplateId());
- }
- }
- } else if (fieldName.equals(WFOutputConstants.DATA_TYPE)) {
- generator.setParameter(WFOutputConstants.DATA_TYPE, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- WorkflowOutput workflowOutput = (WorkflowOutput) result;
- wfOutputResourceIDs.add(workflowOutput.getWfTemplateId());
- }
- }
- } else {
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported field name for WF Output resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported field name for WF Output 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 wfOutputResourceIDs;
- }
-
- public void save() throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- WorkflowOutput existingWorkflowOutput = em.find(WorkflowOutput.class,
- new WorkflowOutput_PK(wfTemplateId, outputKey));
- em.close();
-
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- if (existingWorkflowOutput != null) {
- existingWorkflowOutput.setWfTemplateId(wfTemplateId);
- Workflow workflow = em.find(Workflow.class, wfTemplateId);
- existingWorkflowOutput.setWorkflow(workflow);
- existingWorkflowOutput.setDataType(dataType);
- existingWorkflowOutput.setOutputKey(outputKey);
- if (outputVal != null){
- existingWorkflowOutput.setOutputVal(outputVal.toCharArray());
- }
- existingWorkflowOutput.setValidityType(validityType);
- existingWorkflowOutput.setDataMovement(dataMovement);
- existingWorkflowOutput.setDataNameLocation(dataNameLocation);
- em.merge(existingWorkflowOutput);
- } else {
- WorkflowOutput workflowOutput = new WorkflowOutput();
- workflowOutput.setWfTemplateId(wfTemplateId);
- Workflow workflow = em.find(Workflow.class, wfTemplateId);
- workflowOutput.setWorkflow(workflow);
- workflowOutput.setDataType(dataType);
- workflowOutput.setOutputKey(outputKey);
- if (outputVal != null){
- workflowOutput.setOutputVal(outputVal.toCharArray());
- }
- workflowOutput.setValidityType(validityType);
- workflowOutput.setDataMovement(dataMovement);
- workflowOutput.setDataNameLocation(dataNameLocation);
- em.persist(workflowOutput);
- }
- 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();
- }
- }
- }
-
- 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();
- WorkflowOutput workflowOutput = em.find(WorkflowOutput.class, new WorkflowOutput_PK(
- ids.get(WFOutputConstants.WF_TEMPLATE_ID),
- ids.get(WFOutputConstants.OUTPUT_KEY)));
-
- em.close();
- return workflowOutput != null;
- } 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();
- }
- }
- }
-
- public String getWfTemplateId() {
- return wfTemplateId;
- }
-
- public void setWfTemplateId(String wfTemplateId) {
- this.wfTemplateId = wfTemplateId;
- }
-
- public String getOutputKey() {
- return outputKey;
- }
-
- public void setOutputKey(String outputKey) {
- this.outputKey = outputKey;
- }
-
- public String getOutputVal() {
- return outputVal;
- }
-
- public void setOutputVal(String outputVal) {
- this.outputVal = outputVal;
- }
-
- public String getDataType() {
- return dataType;
- }
-
- public void setDataType(String dataType) {
- this.dataType = dataType;
- }
-
- public WorkflowResource getWorkflowResource() {
- return workflowResource;
- }
-
- public void setWorkflowResource(WorkflowResource workflowResource) {
- this.workflowResource = workflowResource;
- }
-
- public String getValidityType() {
- return validityType;
- }
-
- public void setValidityType(String validityType) {
- this.validityType = validityType;
- }
-
- public boolean isDataMovement() {
- return dataMovement;
- }
-
- public void setDataMovement(boolean dataMovement) {
- this.dataMovement = dataMovement;
- }
-
- public String getDataNameLocation() {
- return dataNameLocation;
- }
-
- public void setDataNameLocation(String dataNameLocation) {
- this.dataNameLocation = dataNameLocation;
- }
-}
[26/52] [abbrv] [partial] airavata git commit: registry refactoring
Posted by sh...@apache.org.
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/UserResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/UserResource.java b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/UserResource.java
deleted file mode 100644
index 5fc7f71..0000000
--- a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/UserResource.java
+++ /dev/null
@@ -1,186 +0,0 @@
-/*
- *
- * 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.experiment.catalog.resources;
-
-import org.apache.airavata.common.exception.ApplicationSettingsException;
-import org.apache.airavata.common.utils.SecurityUtil;
-import org.apache.airavata.common.utils.ServerSettings;
-import org.apache.airavata.experiment.catalog.Resource;
-import org.apache.airavata.experiment.catalog.ResourceType;
-import org.apache.airavata.experiment.catalog.ResourceUtils;
-import org.apache.airavata.experiment.catalog.model.Users;
-import org.apache.airavata.registry.cpi.RegistryException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.persistence.EntityManager;
-import java.security.NoSuchAlgorithmException;
-import java.util.List;
-
-public class UserResource extends AbstractResource {
- private final static Logger logger = LoggerFactory.getLogger(UserResource.class);
- private String userName;
- private String password;
- /**
- *
- */
- public UserResource() {
- }
-
- /**
- *
- * @param userName user name
- */
- public void setUserName(String userName) {
- this.userName = userName;
- }
-
- /**
- *
- * @return user name
- */
- public String getUserName() {
- return userName;
- }
-
-
- /**
- * User is a hypothical data structure.
- * @param type child resource type
- * @return child resource
- */
- public Resource create(ResourceType type) throws RegistryException {
- logger.error("Unsupported resource type for user resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
- /**
- *
- * @param type child resource type
- * @param name child resource name
- */
- public void remove(ResourceType type, Object name) throws RegistryException{
- logger.error("Unsupported resource type for user resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
- /**
- *
- * @param type child resource type
- * @param name child resource name
- * @return UnsupportedOperationException
- */
- public Resource get(ResourceType type, Object name) throws RegistryException {
- logger.error("Unsupported resource type for user resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
- /**
- *
- * @param type child resource type
- * @return UnsupportedOperationException
- */
- public List<Resource> get(ResourceType type) throws RegistryException{
- logger.error("Unsupported resource type for user resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
- /**
- * save user to the database
- */
- public void save() throws RegistryException {
- EntityManager em = null;
- try {
- em = ResourceUtils.getEntityManager();
- Users existingUser = em.find(Users.class, userName);
- em.close();
-
- em = ResourceUtils.getEntityManager();
- em.getTransaction().begin();
- Users user = new Users();
- user.setUser_name(userName);
- if (password != null && !password.equals("")) {
- try {
- user.setPassword(SecurityUtil.digestString(password,
- ServerSettings.getSetting("default.registry.password.hash.method")));
- } catch (NoSuchAlgorithmException e) {
- throw new RuntimeException("Error hashing default admin password. Invalid hash algorithm.", e);
- } catch (ApplicationSettingsException e) {
- throw new RuntimeException("Error reading hash algorithm from configurations", e);
- }
- }
- if (existingUser != null) {
- if (password != null && !password.equals("")) {
- try {
- existingUser.setPassword(SecurityUtil.digestString(password,
- ServerSettings.getSetting("default.registry.password.hash.method")));
- } catch (NoSuchAlgorithmException e) {
- throw new RuntimeException("Error hashing default admin password. Invalid hash algorithm.", e);
- } catch (ApplicationSettingsException e) {
- throw new RuntimeException("Error reading hash algorithm from configurations", e);
- }
- }
- user = em.merge(existingUser);
- } else {
- em.persist(user);
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new RegistryException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- /**
- *
- * @param type child resource type
- * @param name child resource name
- * @return UnsupportedOperationException
- */
- public boolean isExists(ResourceType type, Object name) throws RegistryException{
- logger.error("Unsupported resource type for user resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
- /**
- *
- * @return password
- */
- public String getPassword() {
- return password;
- }
-
- /**
- *
- * @param password password
- */
- public void setPassword(String password) {
- this.password = password;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/Utils.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/Utils.java b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/Utils.java
deleted file mode 100644
index 451fc5c..0000000
--- a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/Utils.java
+++ /dev/null
@@ -1,1011 +0,0 @@
-/*
- *
- * 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.experiment.catalog.resources;
-
-import org.apache.airavata.common.exception.ApplicationSettingsException;
-import org.apache.airavata.common.utils.ServerSettings;
-import org.apache.airavata.experiment.catalog.JPAConstants;
-import org.apache.airavata.experiment.catalog.Resource;
-import org.apache.airavata.experiment.catalog.ResourceType;
-import org.apache.airavata.experiment.catalog.model.*;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.net.URI;
-import java.util.ArrayList;
-import java.util.List;
-
-
-public class Utils {
- private final static Logger logger = LoggerFactory.getLogger(Utils.class);
-
- public static String getJDBCFullURL(){
- String jdbcUrl = getJDBCURL();
- String jdbcUser = getJDBCUser();
- String jdbcPassword = getJDBCPassword();
- jdbcUrl = jdbcUrl + "?" + "user=" + jdbcUser + "&" + "password=" + jdbcPassword;
- return jdbcUrl;
- }
-
- public static String getJDBCURL(){
- try {
- return ServerSettings.getSetting(JPAConstants.KEY_JDBC_URL);
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- return null;
- }
- }
-
- public static String getHost(){
- try{
- String jdbcURL = getJDBCURL();
- String cleanURI = jdbcURL.substring(5);
- URI uri = URI.create(cleanURI);
- return uri.getHost();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- return null;
- }
- }
-
- public static int getPort(){
- try{
- String jdbcURL = getJDBCURL();
- String cleanURI = jdbcURL.substring(5);
- URI uri = URI.create(cleanURI);
- return uri.getPort();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- return -1;
- }
- }
-
- public static int getJPACacheSize (){
- try {
- String cache = ServerSettings.getSetting(JPAConstants.JPA_CACHE_SIZE, "5000");
- return Integer.parseInt(cache);
- }catch (Exception e){
- logger.error(e.getMessage(), e);
- return -1;
- }
- }
-
- public static String isCachingEnabled (){
- try {
- return ServerSettings.getSetting(JPAConstants.ENABLE_CACHING, "true");
- }catch (Exception e){
- logger.error(e.getMessage(), e);
- return "true";
- }
- }
-
- public static String getDBType(){
- try{
- String jdbcURL = getJDBCURL();
- String cleanURI = jdbcURL.substring(5);
- URI uri = URI.create(cleanURI);
- return uri.getScheme();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- return null;
- }
- }
-
- public static boolean isDerbyStartEnabled(){
- try {
- String s = ServerSettings.getSetting(JPAConstants.KEY_DERBY_START_ENABLE);
- if("true".equals(s)){
- return true;
- }
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- return false;
- }
- return false;
- }
-
- public static String getJDBCUser(){
- try {
- return ServerSettings.getSetting(JPAConstants.KEY_JDBC_USER);
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- return null;
- }
- }
-
- public static String getValidationQuery(){
- try {
- return ServerSettings.getSetting(JPAConstants.VALIDATION_QUERY);
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- return null;
- }
- }
-
- public static String getJDBCPassword(){
- try {
- return ServerSettings.getSetting(JPAConstants.KEY_JDBC_PASSWORD);
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- return null;
- }
-
- }
-
- public static String getJDBCDriver(){
- try {
- return ServerSettings.getSetting(JPAConstants.KEY_JDBC_DRIVER);
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- return null;
- }
- }
-
- /**
- *
- * @param type model type
- * @param o model type instance
- * @return corresponding resource object
- */
- public static Resource getResource(ResourceType type, Object o) {
- switch (type){
- case GATEWAY:
- if (o instanceof Gateway) {
- return createGateway((Gateway) o);
- } else {
- logger.error("Object should be a Gateway.", new IllegalArgumentException());
- throw new IllegalArgumentException("Object should be a Gateway.");
- }
- case PROJECT:
- if (o instanceof Project){
- return createProject((Project) o);
- } else {
- logger.error("Object should be a Project.", new IllegalArgumentException());
- throw new IllegalArgumentException("Object should be a Project.");
- }
- case PROJECT_USER:
- if (o instanceof ProjectUser){
- return createProjectUser((ProjectUser)o);
- }else {
- logger.error("Object should be a ProjectUser.", new IllegalArgumentException());
- throw new IllegalArgumentException("Object should be a ProjectUser.");
- }
- case CONFIGURATION:
- if(o instanceof Configuration){
- return createConfiguration((Configuration) o);
- }else {
- logger.error("Object should be a Configuration.", new IllegalArgumentException());
- throw new IllegalArgumentException("Object should be a Configuration.");
- }
- case USER:
- if(o instanceof Users) {
- return createUser((Users) o);
- }else {
- logger.error("Object should be a User.", new IllegalArgumentException());
- throw new IllegalArgumentException("Object should be a User.");
- }
- case GATEWAY_WORKER:
- if (o instanceof Gateway_Worker){
- return createGatewayWorker((Gateway_Worker)o);
- } else {
- logger.error("Object should be a Gateway Worker.", new IllegalArgumentException());
- throw new IllegalArgumentException("Object should be a Gateway Worker.");
- }
- case EXPERIMENT:
- if (o instanceof Experiment){
- return createExperiment((Experiment)o);
- }else {
- logger.error("Object should be a Experiment.", new IllegalArgumentException());
- throw new IllegalArgumentException("Object should be a Experiment.");
- }
- case EXPERIMENT_SUMMARY:
- if (o instanceof Experiment){
- return createExperimentSummary((Experiment)o);
- }else {
- logger.error("Object should be a ExperimentSummary.", new IllegalArgumentException());
- throw new IllegalArgumentException("Object should be a ExperimentSummary.");
- }
- case NOTIFICATION_EMAIL:
- if (o instanceof Notification_Email){
- return createNotificationEmail((Notification_Email)o);
- }else {
- logger.error("Object should be a Experiment.", new IllegalArgumentException());
- throw new IllegalArgumentException("Object should be a Experiment.");
- }
- case EXPERIMENT_INPUT:
- if (o instanceof Experiment_Input){
- return createExperimentInput((Experiment_Input)o);
- }else {
- logger.error("Object should be a Experiment input data.", new IllegalArgumentException());
- throw new IllegalArgumentException("Object should be a Experiment input data.");
- }
- case EXPERIMENT_OUTPUT:
- if (o instanceof Experiment_Output){
- return createExperimentOutput((Experiment_Output)o);
- }else {
- logger.error("Object should be a Experiment output data.", new IllegalArgumentException());
- throw new IllegalArgumentException("Object should be a Experiment output data.");
- }
- case WORKFLOW_NODE_DETAIL:
- if (o instanceof WorkflowNodeDetail){
- return createWorkflowNodeDetail((WorkflowNodeDetail)o);
- }else {
- logger.error("Object should be a Workflow node data.", new IllegalArgumentException());
- throw new IllegalArgumentException("Object should be a Workflow node data.");
- }
- case TASK_DETAIL:
- if (o instanceof TaskDetail){
- return createTaskDetail((TaskDetail)o);
- }else {
- logger.error("Object should be a task detail data.", new IllegalArgumentException());
- throw new IllegalArgumentException("Object should be a task detail data.");
- }
- case ERROR_DETAIL:
- if (o instanceof ErrorDetail){
- return createErrorDetail((ErrorDetail)o);
- }else {
- logger.error("Object should be a error detail data.", new IllegalArgumentException());
- throw new IllegalArgumentException("Object should be a error detail data.");
- }
- case APPLICATION_INPUT:
- if (o instanceof ApplicationInput){
- return createApplicationInput((ApplicationInput)o);
- }else {
- logger.error("Object should be a application input data.", new IllegalArgumentException());
- throw new IllegalArgumentException("Object should be a application input data.");
- }
- case APPLICATION_OUTPUT:
- if (o instanceof ApplicationOutput){
- return createApplicationOutput((ApplicationOutput)o);
- }else {
- logger.error("Object should be a application output data.", new IllegalArgumentException());
- throw new IllegalArgumentException("Object should be a application output data.");
- }
- case NODE_INPUT:
- if (o instanceof NodeInput){
- return createNodeInput((NodeInput)o);
- }else {
- logger.error("Object should be a node input data.", new IllegalArgumentException());
- throw new IllegalArgumentException("Object should be a node input data.");
- }
- case NODE_OUTPUT:
- if (o instanceof NodeOutput){
- return createNodeOutput((NodeOutput)o);
- }else {
- logger.error("Object should be a node output data.", new IllegalArgumentException());
- throw new IllegalArgumentException("Object should be a node output data.");
- }
- case JOB_DETAIL:
- if (o instanceof JobDetail){
- return createJobDetail((JobDetail)o);
- }else {
- logger.error("Object should be a job detail data.", new IllegalArgumentException());
- throw new IllegalArgumentException("Object should be a job detail data.");
- }
- case DATA_TRANSFER_DETAIL:
- if (o instanceof DataTransferDetail){
- return createDataTransferResource((DataTransferDetail)o);
- }else {
- logger.error("Object should be a data transfer detail data.", new IllegalArgumentException());
- throw new IllegalArgumentException("Object should be a data transfer detail data.");
- }
- case STATUS:
- if (o instanceof Status){
- return createStatusResource((Status)o);
- }else {
- logger.error("Object should be a status data.", new IllegalArgumentException());
- throw new IllegalArgumentException("Object should be a status data.");
- }
- case CONFIG_DATA:
- if (o instanceof ExperimentConfigData){
- return createExConfigDataResource((ExperimentConfigData)o);
- }else {
- logger.error("Object should be a experiment config data.", new IllegalArgumentException());
- throw new IllegalArgumentException("Object should be experiment config data.");
- }
- case COMPUTATIONAL_RESOURCE_SCHEDULING:
- if (o instanceof Computational_Resource_Scheduling){
- return createComputationalScheduling((Computational_Resource_Scheduling)o);
- }else {
- logger.error("Object should be a scheduling resource data.", new IllegalArgumentException());
- throw new IllegalArgumentException("Object should be scheduling resource data.");
- }
- case ADVANCE_INPUT_DATA_HANDLING:
- if (o instanceof AdvancedInputDataHandling){
- return createAdvancedInputDataResource((AdvancedInputDataHandling)o);
- }else {
- logger.error("Object should be a advanced input data handling data.", new IllegalArgumentException());
- throw new IllegalArgumentException("Object should be advanced input data handling data.");
- }
- case ADVANCE_OUTPUT_DATA_HANDLING:
- if (o instanceof AdvancedOutputDataHandling){
- return createAdvancedOutputDataResource((AdvancedOutputDataHandling)o);
- }else {
- logger.error("Object should be a advanced output data handling data.", new IllegalArgumentException());
- throw new IllegalArgumentException("Object should be advanced output data handling data.");
- }
- case QOS_PARAM:
- if (o instanceof QosParam){
- return createQosParamResource((QosParam)o);
- }else {
- logger.error("Object should be a QOSparam data.", new IllegalArgumentException());
- throw new IllegalArgumentException("Object should be QOSparam data.");
- }
- default:
- logger.error("Illegal data type..", new IllegalArgumentException());
- throw new IllegalArgumentException("Illegal data type..");
- }
- }
-
- /**
- *
- * @param o Gateway model object
- * @return GatewayResource object
- */
- private static Resource createGateway(Gateway o) {
- GatewayResource gatewayResource = new GatewayResource();
- gatewayResource.setGatewayName(o.getGateway_name());
- gatewayResource.setGatewayId(o.getGateway_id());
- gatewayResource.setDomain(o.getDomain());
- gatewayResource.setEmailAddress(o.getEmailAddress());
- return gatewayResource;
- }
-
- /**
- *
- * @param o Project model object
- * @return ProjectResource object
- */
- private static Resource createProject(Project o) {
- ProjectResource projectResource = new ProjectResource();
- if (o != null){
- projectResource.setId(o.getProject_id());
- projectResource.setName(o.getProject_name());
- projectResource.setGatewayId(o.getGateway_id());
- Gateway_Worker gateway_worker = new Gateway_Worker();
- gateway_worker.setGateway(o.getGateway());
- gateway_worker.setUser(o.getUsers());
- gateway_worker.setUser_name(o.getUsers().getUser_name());
- WorkerResource workerResource = (WorkerResource) createGatewayWorker(gateway_worker);
- projectResource.setWorker(workerResource);
- projectResource.setDescription(o.getDescription());
- projectResource.setCreationTime(o.getCreationTime());
- }
-
- return projectResource;
- }
-
- private static Resource createProjectUser(ProjectUser o) {
- ProjectUserResource projectUserResource = new ProjectUserResource();
- if (o != null){
- projectUserResource.setUserName(o.getUser().getUser_name());
- projectUserResource.setProjectId(o.getProjectID());
- }
- return projectUserResource;
- }
-
- /**
- *
- * @param o configuration model object
- * @return configuration resource object
- */
- private static Resource createConfiguration (Configuration o){
- ConfigurationResource configurationResource = new ConfigurationResource();
- if (o != null){
- configurationResource.setConfigKey(o.getConfig_key());
- configurationResource.setConfigVal(o.getConfig_val());
- configurationResource.setExpireDate(o.getExpire_date());
- configurationResource.setCategoryID(o.getCategory_id());
- }
-
- return configurationResource;
- }
-
- /**
- *
- * @param o Gateway_Worker model object
- * @return Gateway_Worker resource object
- */
- private static Resource createGatewayWorker(Gateway_Worker o) {
- if (o != null){
- WorkerResource workerResource = new WorkerResource();
- workerResource.setGatewayId(o.getGateway_id());
- workerResource.setUser(o.getUser_name());
- return workerResource;
- }
- return null;
- }
-
- /**
- *
- * @param o Users model object
- * @return UserResource object
- */
- private static Resource createUser(Users o) {
- UserResource userResource = new UserResource();
- if (o != null){
- userResource.setUserName(o.getUser_name());
- userResource.setPassword(o.getPassword());
- }
-
- return userResource;
- }
-
- /**
- * @param o Experiment model object
- * @return Experiment resource object
- */
- private static Resource createExperiment(Experiment o) {
- ExperimentResource experimentResource = new ExperimentResource();
- if (o != null){
- experimentResource.setGatewayId(o.getGatewayId());
- experimentResource.setExecutionUser(o.getExecutionUser());
- experimentResource.setProjectId(o.getProjectID());
- experimentResource.setExpID(o.getExpId());
- experimentResource.setExpName(o.getExpName());
- experimentResource.setCreationTime(o.getCreationTime());
- experimentResource.setDescription(o.getExpDesc());
- experimentResource.setApplicationId(o.getApplicationId());
- experimentResource.setApplicationVersion(o.getAppVersion());
- experimentResource.setWorkflowTemplateId(o.getWorkflowTemplateId());
- experimentResource.setWorkflowTemplateVersion(o.getWorkflowTemplateVersion());
- experimentResource.setWorkflowExecutionId(o.getWorkflowExecutionId());
- experimentResource.setEnableEmailNotifications(o.isAllowNotification());
- experimentResource.setGatewayExecutionId(o.getGatewayExecutionId());
- if (o.getExperimentInputs() != null && !o.getExperimentInputs().isEmpty()){
- experimentResource.setExperimentInputResources(getExperimentInputs(o.getExperimentInputs()));
- }
- if (o.getExperimentOutputs() != null && !o.getExperimentOutputs().isEmpty()){
- experimentResource.setExperimentOutputputResources(getExperimentOutputs(o.getExperimentOutputs()));
- }
- if (o.getResourceScheduling() != null){
- experimentResource.setComputationSchedulingResource((ComputationSchedulingResource)createComputationalScheduling(o.getResourceScheduling()));
- }
- if (o.getUserConfigurationData() != null){
- experimentResource.setUserConfigDataResource((ConfigDataResource)createExConfigDataResource(o.getUserConfigurationData()));
- }
-
- if (o.getWorkflowNodeDetails() != null && !o.getWorkflowNodeDetails().isEmpty()){
- experimentResource.setWorkflowNodeDetailResourceList(getWorkflowNodeLit(o.getWorkflowNodeDetails()));
- }
-
- if (o.getStateChangeList() != null && !o.getStateChangeList().isEmpty()){
- experimentResource.setStateChangeList(getStateChangeList(o.getStateChangeList()));
- }
-
- if (o.getErrorDetails() != null && !o.getErrorDetails().isEmpty()){
- experimentResource.setErrorDetailList(getErrorList(o.getErrorDetails()));
- }
-
- if (o.getExperimentStatus() != null){
- experimentResource.setExperimentStatus((StatusResource)createStatusResource(o.getExperimentStatus()));
- }
-
- if (o.getNotificationEmails() != null && !o.getNotificationEmails().isEmpty()){
- experimentResource.setEmailResourceList(getEmailList(o.getNotificationEmails()));
- }
- }
- return experimentResource;
- }
-
- /**
- *
- * @param o ExperimentSummary model object
- * @return ExperimentSummary Resource object
- */
- private static Resource createExperimentSummary(Experiment o) {
- ExperimentSummaryResource experimentSummaryResource = new ExperimentSummaryResource();
- if (o != null){
- experimentSummaryResource.setExecutionUser(o.getExecutionUser());
- experimentSummaryResource.setExpID(o.getExpId());
- experimentSummaryResource.setExpName(o.getExpName());
- experimentSummaryResource.setProjectID(o.getProjectID());
- experimentSummaryResource.setCreationTime(o.getCreationTime());
- experimentSummaryResource.setDescription(o.getExpDesc());
- experimentSummaryResource.setApplicationId(o.getApplicationId());
-
- Status experimentStatus = o.getExperimentStatus();
- if(experimentStatus != null) {
- StatusResource statusResource = new StatusResource();
- statusResource.setStatusId(experimentStatus.getStatusId());
- statusResource.setJobId(experimentStatus.getJobId());
- statusResource.setState(experimentStatus.getState());
- statusResource.setStatusUpdateTime(experimentStatus.getStatusUpdateTime());
- statusResource.setStatusType(experimentStatus.getStatusType());
- experimentSummaryResource.setStatus(statusResource);
- }
- }
-
- return experimentSummaryResource;
- }
-
- private static List<ExperimentInputResource> getExperimentInputs(List<Experiment_Input> inputs){
- List<ExperimentInputResource> inputResources = new ArrayList<ExperimentInputResource>();
- for (Experiment_Input input : inputs){
- inputResources.add((ExperimentInputResource)createExperimentInput(input));
- }
- return inputResources;
- }
-
- private static List<ExperimentOutputResource> getExperimentOutputs(List<Experiment_Output> outputs){
- List<ExperimentOutputResource> outputResources = new ArrayList<>();
- for (Experiment_Output output : outputs){
- outputResources.add((ExperimentOutputResource) createExperimentOutput(output));
- }
- return outputResources;
- }
-
- private static List<NodeInputResource> getNodeInputs(List<NodeInput> inputs){
- List<NodeInputResource> inputResources = new ArrayList<NodeInputResource>();
- for (NodeInput input : inputs){
- inputResources.add((NodeInputResource)createNodeInput(input));
- }
- return inputResources;
- }
-
- private static List<NodeOutputResource> getNodeOutputs(List<NodeOutput> outputs){
- List<NodeOutputResource> outputResources = new ArrayList<>();
- for (NodeOutput output : outputs){
- outputResources.add((NodeOutputResource) createNodeOutput(output));
- }
- return outputResources;
- }
-
- private static List<ApplicationInputResource> getApplicationInputs(List<ApplicationInput> inputs){
- List<ApplicationInputResource> inputResources = new ArrayList<ApplicationInputResource>();
- for (ApplicationInput input : inputs){
- inputResources.add((ApplicationInputResource)createApplicationInput(input));
- }
- return inputResources;
- }
-
- private static List<ApplicationOutputResource> getApplicationOutputs(List<ApplicationOutput> outputs){
- List<ApplicationOutputResource> outputResources = new ArrayList<>();
- for (ApplicationOutput output : outputs){
- outputResources.add((ApplicationOutputResource) createApplicationOutput(output));
- }
- return outputResources;
- }
-
- private static List<WorkflowNodeDetailResource> getWorkflowNodeLit(List<WorkflowNodeDetail> nodes){
- List<WorkflowNodeDetailResource> nodeList = new ArrayList<>();
- for (WorkflowNodeDetail node : nodes){
- nodeList.add((WorkflowNodeDetailResource) createWorkflowNodeDetail(node));
- }
- return nodeList;
- }
-
- private static List<StatusResource> getStateChangeList(List<Status> statusList){
- List<StatusResource> changeList = new ArrayList<>();
- for (Status status : statusList){
- changeList.add((StatusResource) createStatusResource(status));
- }
- return changeList;
- }
-
- private static List<ErrorDetailResource> getErrorList(List<ErrorDetail> errorDetails){
- List<ErrorDetailResource> errors = new ArrayList<>();
- for (ErrorDetail error : errorDetails){
- errors.add((ErrorDetailResource) createErrorDetail(error));
- }
- return errors;
- }
-
- private static List<JobDetailResource> getJobDetails(List<JobDetail> jobDetails){
- List<JobDetailResource> resources = new ArrayList<>();
- for (JobDetail jobDetail : jobDetails){
- resources.add((JobDetailResource) createJobDetail(jobDetail));
- }
- return resources;
- }
-
- private static List<DataTransferDetailResource> getDTDetails(List<DataTransferDetail> dataTransferDetails){
- List<DataTransferDetailResource> resources = new ArrayList<>();
- for (DataTransferDetail detail : dataTransferDetails){
- resources.add((DataTransferDetailResource) createDataTransferResource(detail));
- }
- return resources;
- }
-
- private static List<NotificationEmailResource> getEmailList(List<Notification_Email> emails){
- List<NotificationEmailResource> emailResources = new ArrayList<>();
- for (Notification_Email email : emails){
- emailResources.add((NotificationEmailResource) createNotificationEmail(email));
- }
- return emailResources;
- }
-
- private static Resource createNotificationEmail (Notification_Email o){
- NotificationEmailResource emailResource = new NotificationEmailResource();
- if (o != null){
- emailResource.setExperimentId(o.getExperiment_id());
- emailResource.setTaskId(o.getTaskId());
- emailResource.setEmailAddress(o.getEmailAddress());
- }
- return emailResource;
- }
-
- private static Resource createExperimentInput (Experiment_Input o){
- ExperimentInputResource eInputResource = new ExperimentInputResource();
- if (o != null){
- eInputResource.setExperimentId(o.getExperiment_id());
- eInputResource.setDataType(o.getDataType());
- eInputResource.setMetadata(o.getMetadata());
- eInputResource.setExperimentKey(o.getEx_key());
- eInputResource.setAppArgument(o.getAppArgument());
- eInputResource.setInputOrder(o.getInputOrder());
- eInputResource.setStandardInput(o.isStandardInput());
- eInputResource.setUserFriendlyDesc(o.getUserFriendlyDesc());
- eInputResource.setRequired(o.isRequired());
- eInputResource.setRequiredToCMD(o.isRequiredToCMD());
- eInputResource.setDataStaged(o.isDataStaged());
- if (o.getValue() != null){
- eInputResource.setValue(new String(o.getValue()));
- }
- }
- return eInputResource;
- }
-
- private static Resource createExperimentOutput (Experiment_Output o){
- ExperimentOutputResource eOutputResource = new ExperimentOutputResource();
- if (o != null){
- eOutputResource.setExperimentId(o.getExperiment_id());
- eOutputResource.setExperimentKey(o.getEx_key());
- if (o.getValue() != null){
- eOutputResource.setValue(new String(o.getValue()));
- }
- eOutputResource.setDataType(o.getDataType());
- eOutputResource.setRequired(o.isRequired());
- eOutputResource.setRequiredToCMD(o.isRequiredToCMD());
- eOutputResource.setDataMovement(o.isDataMovement());
- eOutputResource.setDataNameLocation(o.getDataNameLocation());
- eOutputResource.setSearchQuery(o.getSearchQuery());
- eOutputResource.setAppArgument(o.getApplicationArgument());
- }
- return eOutputResource;
- }
-
- private static Resource createWorkflowNodeDetail (WorkflowNodeDetail o){
- WorkflowNodeDetailResource nodeDetailResource = new WorkflowNodeDetailResource();
- if (o != null){
- nodeDetailResource.setExperimentId(o.getExpId());
- nodeDetailResource.setCreationTime(o.getCreationTime());
- nodeDetailResource.setNodeInstanceId(o.getNodeId());
- nodeDetailResource.setNodeName(o.getNodeName());
- nodeDetailResource.setExecutionUnit(o.getExecutionUnit());
- nodeDetailResource.setExecutionUnitData(o.getExecutionUnitData());
- if (o.getTaskDetails() != null && !o.getErrorDetails().isEmpty()){
- nodeDetailResource.setTaskDetailResourceList(getTaskDetails(o.getTaskDetails()));
- }
-
- if (o.getNodeInputs() != null && !o.getNodeInputs().isEmpty()){
- nodeDetailResource.setNodeInputs(getNodeInputs(o.getNodeInputs()));
- }
-
- if (o.getNodeOutputs() != null && !o.getNodeOutputs().isEmpty()){
- nodeDetailResource.setNodeOutputs(getNodeOutputs(o.getNodeOutputs()));
- }
-
- if (o.getNodeStatus() != null){
- nodeDetailResource.setNodeStatus((StatusResource) createStatusResource(o.getNodeStatus()));
- }
-
- if (o.getErrorDetails() != null && !o.getErrorDetails().isEmpty()){
- nodeDetailResource.setErros(getErrorList(o.getErrorDetails()));
- }
- }
- return nodeDetailResource;
- }
-
- private static List<TaskDetailResource> getTaskDetails (List<TaskDetail> taskDetails){
- List<TaskDetailResource> tasks = new ArrayList<>();
- for (TaskDetail detail : taskDetails){
- tasks.add((TaskDetailResource) createTaskDetail(detail));
- }
- return tasks;
- }
-
- private static Resource createTaskDetail(TaskDetail o){
- TaskDetailResource taskDetailResource = new TaskDetailResource();
- if ( o != null){
- taskDetailResource.setNodeId(o.getNodeId());
- taskDetailResource.setCreationTime(o.getCreationTime());
- taskDetailResource.setTaskId(o.getTaskId());
- taskDetailResource.setApplicationId(o.getAppId());
- taskDetailResource.setApplicationVersion(o.getAppVersion());
- taskDetailResource.setApplicationDeploymentId(o.getApplicationDeploymentId());
- taskDetailResource.setEnableEmailNotifications(o.isAllowNotification());
- if (o.getApplicationInputs() != null && !o.getApplicationInputs().isEmpty()){
- taskDetailResource.setApplicationInputs(getApplicationInputs(o.getApplicationInputs()));
- }
- if (o.getApplicationOutputs() != null && !o.getApplicationOutputs().isEmpty()){
- taskDetailResource.setApplicationOutputs(getApplicationOutputs(o.getApplicationOutputs()));
- }
- if (o.getResourceScheduling() != null){
- taskDetailResource.setSchedulingResource((ComputationSchedulingResource) createComputationalScheduling(o.getResourceScheduling()));
-
- }
- if (o.getInputDataHandling() != null){
- taskDetailResource.setInputDataHandlingResource((AdvanceInputDataHandlingResource) createAdvancedInputDataResource(o.getInputDataHandling()));
- }
- if (o.getOutputDataHandling() != null){
- taskDetailResource.setOutputDataHandlingResource((AdvancedOutputDataHandlingResource) createAdvancedOutputDataResource(o.getOutputDataHandling()));
- }
- if (o.getErrorDetails() != null && !o.getErrorDetails().isEmpty()){
- taskDetailResource.setErrors(getErrorList(o.getErrorDetails()));
- }
- if (o.getTaskStatus() != null){
- taskDetailResource.setTaskStatus((StatusResource) createStatusResource(o.getTaskStatus()));
- }
- if (o.getNotificationEmails() != null && !o.getNotificationEmails().isEmpty()){
- taskDetailResource.setEmailResourceList(getEmailList(o.getNotificationEmails()));
- }
- if (o.getJobDetails() != null && !o.getJobDetails().isEmpty()){
- taskDetailResource.setJobDetailResources(getJobDetails(o.getJobDetails()));
- }
- if (o.getDataTransferDetails() != null && !o.getDataTransferDetails().isEmpty()){
- taskDetailResource.setTransferDetailResourceList(getDTDetails(o.getDataTransferDetails()));
- }
-
- }
- return taskDetailResource;
- }
-
- private static Resource createErrorDetail (ErrorDetail o){
- ErrorDetailResource errorDetailResource = new ErrorDetailResource();
- if (o != null){
- errorDetailResource.setExperimentId(o.getExpId());
- errorDetailResource.setTaskId(o.getTaskId());
- errorDetailResource.setNodeId(o.getNodeId());
- errorDetailResource.setErrorId(o.getErrorID());
- errorDetailResource.setJobId(o.getJobId());
- errorDetailResource.setCreationTime(o.getCreationTime());
- if (o.getActualErrorMsg() != null){
- errorDetailResource.setActualErrorMsg(new String(o.getActualErrorMsg()));
- }
- errorDetailResource.setUserFriendlyErrorMsg(o.getUserFriendlyErrorMsg());
- errorDetailResource.setTransientPersistent(o.isTransientPersistent());
- errorDetailResource.setErrorCategory(o.getErrorCategory());
- errorDetailResource.setCorrectiveAction(o.getCorrectiveAction());
- errorDetailResource.setActionableGroup(o.getActionableGroup());
- }
-
- return errorDetailResource;
- }
-
- private static Resource createApplicationInput (ApplicationInput o){
- ApplicationInputResource inputResource = new ApplicationInputResource();
- if (o != null){
- inputResource.setTaskId(o.getTaskId());
- inputResource.setInputKey(o.getInputKey());
- inputResource.setDataType(o.getDataType());
- inputResource.setAppArgument(o.getAppArgument());
- inputResource.setInputOrder(o.getInputOrder());
- inputResource.setStandardInput(o.isStandardInput());
- inputResource.setUserFriendlyDesc(o.getUserFriendlyDesc());
- inputResource.setRequired(o.isRequired());
- inputResource.setRequiredToCMD(o.isRequiredToCMD());
- inputResource.setDataStaged(o.isDataStaged());
- if (o.getValue() != null){
- inputResource.setValue(new String(o.getValue()));
- }
- inputResource.setMetadata(o.getMetadata());
- }
- return inputResource;
- }
-
- private static Resource createApplicationOutput (ApplicationOutput o){
- ApplicationOutputResource outputResource = new ApplicationOutputResource();
- if (o != null){
- outputResource.setTaskId(o.getTaskId());
- outputResource.setDataType(o.getDataType());
- outputResource.setOutputKey(o.getOutputKey());
- if (o.getValue() != null){
- outputResource.setValue(new String(o.getValue()));
- }
- outputResource.setRequired(o.isRequired());
- outputResource.setRequiredToCMD(o.isAddedToCmd());
- outputResource.setDataMovement(o.isDataMovement());
- outputResource.setDataNameLocation(o.getDataNameLocation());
- outputResource.setSearchQuery(o.getSearchQuery());
- outputResource.setAppArgument(o.getApplicationArgument());
- }
- return outputResource;
- }
-
- private static Resource createNodeInput (NodeInput o){
- NodeInputResource inputResource = new NodeInputResource();
- if (o != null){
- inputResource.setNodeId(o.getNodeId());
- inputResource.setInputKey(o.getInputKey());
- inputResource.setDataType(o.getDataType());
- inputResource.setValue(o.getValue());
- inputResource.setMetadata(o.getMetadata());
- inputResource.setAppArgument(o.getAppArgument());
- inputResource.setInputOrder(o.getInputOrder());
- inputResource.setStandardInput(o.isStandardInput());
- inputResource.setUserFriendlyDesc(o.getUserFriendlyDesc());
- inputResource.setRequired(o.getIsRequired());
- inputResource.setRequiredToCMD(o.getRequiredToCMD());
- inputResource.setDataStaged(o.isDataStaged());
- }
- return inputResource;
- }
-
- private static Resource createNodeOutput (NodeOutput o){
- NodeOutputResource outputResource = new NodeOutputResource();
- if (o != null){
- outputResource.setNodeId(o.getNodeId());
- outputResource.setDataType(o.getDataType());
- outputResource.setOutputKey(o.getOutputKey());
- outputResource.setValue(o.getValue());
- outputResource.setRequired(o.isRequired());
- outputResource.setRequiredToCMD(o.isRequiredToCMD());
- outputResource.setDataMovement(o.isDataMovement());
- outputResource.setDataNameLocation(o.getDataNameLocation());
- outputResource.setSearchQuery(o.getSearchQuery());
- outputResource.setAppArgument(o.getApplicationArgument());
- }
-
- return outputResource;
- }
-
- private static Resource createJobDetail (JobDetail o){
- JobDetailResource jobDetailResource = new JobDetailResource();
- if (o != null){
- jobDetailResource.setTaskId(o.getTaskId());
- if (o.getJobDescription() != null){
- jobDetailResource.setJobDescription(new String(o.getJobDescription()));
- }
- jobDetailResource.setJobId(o.getJobId());
- jobDetailResource.setCreationTime(o.getCreationTime());
- jobDetailResource.setComputeResourceConsumed(o.getComputeResourceConsumed());
- jobDetailResource.setJobName(o.getJobName());
- jobDetailResource.setWorkingDir(o.getWorkingDir());
- jobDetailResource.setJobStatus((StatusResource)createStatusResource(o.getJobStatus()));
- jobDetailResource.setErrors(getErrorList(o.getErrorDetails()));
- }
-
- return jobDetailResource;
- }
-
- private static Resource createDataTransferResource (DataTransferDetail o){
- DataTransferDetailResource transferDetailResource = new DataTransferDetailResource();
- if (o != null){
- transferDetailResource.setTaskId(o.getTaskId());
- transferDetailResource.setTransferId(o.getTransferId());
- transferDetailResource.setCreationTime(o.getCreationTime());
- if (o.getTransferDesc() != null){
- transferDetailResource.setTransferDescription(new String(o.getTransferDesc()));
- }
- if (o.getDataTransferStatus() != null){
- transferDetailResource.setDatatransferStatus((StatusResource)createStatusResource(o.getDataTransferStatus()));
- }
- }
- return transferDetailResource;
- }
-
- private static Resource createStatusResource (Status o){
- StatusResource statusResource = new StatusResource();
- if (o != null){
- statusResource.setExperimentId(o.getExpId());
- statusResource.setTaskId(o.getTaskId());
- statusResource.setNodeId(o.getNodeId());
- statusResource.setTransferId(o.getTransferId());
- statusResource.setStatusId(o.getStatusId());
- statusResource.setJobId(o.getJobId());
- statusResource.setState(o.getState());
- statusResource.setStatusUpdateTime(o.getStatusUpdateTime());
- statusResource.setStatusType(o.getStatusType());
- }
-
- return statusResource;
- }
-
- private static Resource createExConfigDataResource (ExperimentConfigData o){
- ConfigDataResource configDataResource = new ConfigDataResource();
- if (o != null){
- configDataResource.setExperimentId(o.getExpId());
- configDataResource.setAiravataAutoSchedule(o.isAiravataAutoSchedule());
- configDataResource.setOverrideManualParams(o.isOverrideManualParams());
- configDataResource.setShareExp(o.isShareExp());
- configDataResource.setUserDn(o.getUserDn());
- configDataResource.setGenerateCert(o.isGenerateCert());
- if (o.getOutputDataHandling() != null){
- configDataResource.setAdvancedOutputDataHandlingResource((AdvancedOutputDataHandlingResource) createAdvancedOutputDataResource(o.getOutputDataHandling()));
- }
- if (o.getInputDataHandling() != null){
- configDataResource.setAdvanceInputDataHandlingResource((AdvanceInputDataHandlingResource) createAdvancedInputDataResource(o.getInputDataHandling()));
- }
- if (o.getResourceScheduling() != null){
- configDataResource.setComputationSchedulingResource((ComputationSchedulingResource) createComputationalScheduling(o.getResourceScheduling()));
- }
- if (o.getQosParam() != null){
- configDataResource.setQosParamResource((QosParamResource) createQosParamResource(o.getQosParam()));
- }
-
- }
- return configDataResource;
- }
-
- private static Resource createComputationalScheduling (Computational_Resource_Scheduling o){
- ComputationSchedulingResource schedulingResource = new ComputationSchedulingResource();
- if (o != null){
- schedulingResource.setExperimentId(o.getExpId());
- schedulingResource.setTaskId(o.getTaskId());
- schedulingResource.setSchedulingId(o.getSchedulingId());
- schedulingResource.setResourceHostId(o.getResourceHostId());
- schedulingResource.setCpuCount(o.getCpuCount());
- schedulingResource.setNodeCount(o.getNodeCount());
- schedulingResource.setNumberOfThreads(o.getNumberOfThreads());
- schedulingResource.setQueueName(o.getQueueName());
- schedulingResource.setWalltimeLimit(o.getWallTimeLimit());
- schedulingResource.setJobStartTime(o.getJobStartTime());
- schedulingResource.setPhysicalMemory(o.getTotalPhysicalmemory());
- schedulingResource.setProjectName(o.getProjectName());
- schedulingResource.setChessisName(o.getChessisName());
- }
-
- return schedulingResource;
- }
-
- private static Resource createAdvancedInputDataResource (AdvancedInputDataHandling o){
- AdvanceInputDataHandlingResource dataHandlingResource = new AdvanceInputDataHandlingResource();
- if (o != null){
- dataHandlingResource.setExperimentId(o.getExpId());
- dataHandlingResource.setTaskId(o.getTaskId());
- dataHandlingResource.setDataHandlingId(o.getDataHandlingId());
- dataHandlingResource.setWorkingDirParent(o.getParentWorkingDir());
- dataHandlingResource.setWorkingDir(o.getWorkingDir());
- dataHandlingResource.setStageInputFiles(o.isStageInputsToWorkingDir());
- dataHandlingResource.setCleanAfterJob(o.isCleanAfterJob());
- }
-
- return dataHandlingResource;
- }
-
- private static Resource createAdvancedOutputDataResource (AdvancedOutputDataHandling o){
- AdvancedOutputDataHandlingResource dataHandlingResource = new AdvancedOutputDataHandlingResource();
- if (o != null){
- dataHandlingResource.setExperimentId(o.getExpId());
- dataHandlingResource.setTaskId(o.getTaskId());
- dataHandlingResource.setOutputDataHandlingId(o.getOutputDataHandlingId());
- dataHandlingResource.setOutputDataDir(o.getOutputDataDir());
- dataHandlingResource.setDataRegUrl(o.getDataRegUrl());
- dataHandlingResource.setPersistOutputData(o.isPersistOutputData());
- }
- return dataHandlingResource;
- }
-
- private static Resource createQosParamResource (QosParam o){
- QosParamResource qosParamResource = new QosParamResource();
- if (o != null){
- qosParamResource.setExperimentId(o.getExpId());
- qosParamResource.setTaskId(o.getTaskId());
- qosParamResource.setQosId(o.getQosId());
- qosParamResource.setExecuteBefore(o.getExecuteBefore());
- qosParamResource.setStartExecutionAt(o.getStartExecutionAt());
- qosParamResource.setNoOfRetries(o.getNoOfRetries());
- }
-
- return qosParamResource;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/WorkerResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/WorkerResource.java b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/WorkerResource.java
deleted file mode 100644
index 6b4a6a5..0000000
--- a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/WorkerResource.java
+++ /dev/null
@@ -1,725 +0,0 @@
-/*
- *
- * 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.experiment.catalog.resources;
-
-import org.apache.airavata.model.workspace.experiment.ExperimentState;
-import org.apache.airavata.experiment.catalog.Resource;
-import org.apache.airavata.experiment.catalog.ResourceType;
-import org.apache.airavata.experiment.catalog.ResourceUtils;
-import org.apache.airavata.experiment.catalog.model.*;
-import org.apache.airavata.experiment.catalog.utils.QueryGenerator;
-import org.apache.airavata.registry.cpi.RegistryException;
-import org.apache.airavata.registry.cpi.ResultOrderType;
-import org.apache.airavata.registry.cpi.utils.Constants;
-import org.apache.airavata.registry.cpi.utils.StatusType;
-import org.apache.openjpa.persistence.OpenJPAPersistence;
-import org.apache.openjpa.persistence.OpenJPAQuery;
-import org.apache.openjpa.persistence.jdbc.FetchMode;
-import org.apache.openjpa.persistence.jdbc.JDBCFetchPlan;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.persistence.EntityManager;
-import javax.persistence.Query;
-import java.sql.Timestamp;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import java.util.UUID;
-
-public class WorkerResource extends AbstractResource {
- private final static Logger logger = LoggerFactory.getLogger(WorkerResource.class);
- private String user;
- private String gatewayId;
-
- public WorkerResource() {
- }
-
- public WorkerResource(String user, String gatewayId) {
- this.user = user;
- this.gatewayId = gatewayId;
- }
-
- public String getGatewayId() {
- return gatewayId;
- }
-
- public void setGatewayId(String gatewayId) {
- this.gatewayId = gatewayId;
- }
-
- /**
- * Gateway worker can create child data structures such as projects and user workflows
- * @param type child resource type
- * @return child resource
- */
- public Resource create(ResourceType type) throws RegistryException{
- Resource result = null;
- switch (type) {
- case PROJECT:
- ProjectResource projectResource = new ProjectResource();
- projectResource.setWorker(this);
- projectResource.setGatewayId(gatewayId);
- result=projectResource;
- break;
- case EXPERIMENT:
- ExperimentResource experimentResource = new ExperimentResource();
- experimentResource.setExecutionUser(user);
- experimentResource.setGatewayId(gatewayId);
- result = experimentResource;
- break;
- default:
- logger.error("Unsupported resource type for worker resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported resource type for worker resource.");
-
- }
- return result;
- }
-
- /**
- *
- * @param type child resource type
- * @param name child resource name
- */
- public void remove(ResourceType type, Object name) throws RegistryException{
- EntityManager em = null;
- try {
- em = ResourceUtils.getEntityManager();
- em.getTransaction().begin();
- Query q;
- QueryGenerator generator;
- switch (type) {
- case PROJECT:
- generator = new QueryGenerator(PROJECT);
- generator.setParameter(ProjectConstants.PROJECT_ID, name);
- q = generator.deleteQuery(em);
- q.executeUpdate();
- break;
- case EXPERIMENT:
- generator = new QueryGenerator(EXPERIMENT);
- generator.setParameter(ExperimentConstants.EXPERIMENT_ID, name);
- q = generator.deleteQuery(em);
- q.executeUpdate();
- break;
- default:
- logger.error("Unsupported resource type for worker resource.", new IllegalArgumentException());
- break;
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new RegistryException(e.getMessage());
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- /**
- *
- * @param type child resource type
- * @param name child resource name
- * @return child resource
- */
- public Resource get(ResourceType type, Object name) throws RegistryException{
- Resource result = null;
- EntityManager em = null;
- try {
- em = ResourceUtils.getEntityManager();
- em.getTransaction().begin();
- QueryGenerator generator;
- Query q;
- switch (type) {
- case PROJECT:
- generator = new QueryGenerator(PROJECT);
- generator.setParameter(ProjectConstants.PROJECT_ID, name);
- q = generator.selectQuery(em);
- Project project = (Project) q.getSingleResult();
- result = Utils.getResource(ResourceType.PROJECT, project);
- break;
- case EXPERIMENT:
- generator = new QueryGenerator(EXPERIMENT);
- generator.setParameter(ExperimentConstants.EXPERIMENT_ID, name);
- q = generator.selectQuery(em);
- Experiment experiment = (Experiment) q.getSingleResult();
- result = Utils.getResource(ResourceType.EXPERIMENT, experiment);
- break;
- default:
- logger.error("Unsupported resource type for worker resource.", new IllegalArgumentException());
- break;
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- throw new RegistryException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- return result;
- }
-
-// public List<GFacJobDataResource> getGFacJobs(String serviceDescriptionId, String hostDescriptionId, String applicationDescriptionId){
-// List<GFacJobDataResource> result = new ArrayList<GFacJobDataResource>();
-// EntityManager em = ResourceUtils.getEntityManager();
-// em.getTransaction().begin();
-// QueryGenerator generator;
-// Query q;
-// generator = new QueryGenerator(GFAC_JOB_DATA);
-// generator.setParameter(GFacJobDataConstants.SERVICE_DESC_ID, serviceDescriptionId);
-// generator.setParameter(GFacJobDataConstants.HOST_DESC_ID, hostDescriptionId);
-// generator.setParameter(GFacJobDataConstants.APP_DESC_ID, applicationDescriptionId);
-// q = generator.selectQuery(em);
-// for (Object o : q.getResultList()) {
-// GFac_Job_Data gFacJobData = (GFac_Job_Data)o;
-// result.add((GFacJobDataResource)Utils.getResource(ResourceType.GFAC_JOB_DATA, gFacJobData));
-// }
-// em.getTransaction().commit();
-// em.close();
-// return result;
-// }
-//
-// public List<GFacJobStatusResource> getGFacJobStatuses(String jobId){
-// List<GFacJobStatusResource> resourceList = new ArrayList<GFacJobStatusResource>();
-// EntityManager em = ResourceUtils.getEntityManager();
-// em.getTransaction().begin();
-// QueryGenerator generator;
-// Query q;
-// generator = new QueryGenerator(GFAC_JOB_STATUS);
-// generator.setParameter(GFacJobStatusConstants.LOCAL_JOB_ID, jobId);
-// q = generator.selectQuery(em);
-// for (Object result : q.getResultList()) {
-// GFac_Job_Status gFacJobStatus = (GFac_Job_Status) result;
-// GFacJobStatusResource gFacJobStatusResource =
-// (GFacJobStatusResource)Utils.getResource(ResourceType.GFAC_JOB_STATUS, gFacJobStatus);
-// resourceList.add(gFacJobStatusResource);
-// }
-// return resourceList;
-// }
-
- /**
- * Method get all results of the given child resource type
- *
- * @param type child resource type
- * @return list of child resources
- */
- public List<Resource> get(ResourceType type) throws RegistryException{
- return get(type, -1, -1, null, null);
- }
-
- /**
- * Method get all results of the given child resource type with paginaltion and ordering
- *
- * @param type child resource type
- * @param limit
- * @param offset
- * @param orderByIdentifier
- * @param resultOrderType
- * @return list of child resources
- * @throws RegistryException
- */
- public List<Resource> get(ResourceType type, int limit, int offset, Object orderByIdentifier,
- ResultOrderType resultOrderType) throws RegistryException{
- List<Resource> result = new ArrayList<Resource>();
- EntityManager em = null;
- try {
- em = ResourceUtils.getEntityManager();
- em.getTransaction().begin();
- QueryGenerator generator;
- Query q;
- switch (type) {
- case PROJECT:
- generator = new QueryGenerator(PROJECT);
- Users users = em.find(Users.class, getUser());
- Gateway gatewayModel = em.find(Gateway.class, gatewayId);
- generator.setParameter("users", users);
- if (gatewayModel != null){
- generator.setParameter("gateway", gatewayModel);
- }
-
- //ordering - only supported only by CREATION_TIME
- if(orderByIdentifier != null && resultOrderType != null
- && orderByIdentifier.equals(Constants.FieldConstants.ProjectConstants.CREATION_TIME)) {
- q = generator.selectQuery(em, ProjectConstants.CREATION_TIME, resultOrderType);
- }else{
- q = generator.selectQuery(em);
- }
-
- //pagination
- if(limit>0 && offset>=0){
- q.setFirstResult(offset);
- q.setMaxResults(limit);
- }
-
- for (Object o : q.getResultList()) {
- Project project = (Project) o;
- ProjectResource projectResource = (ProjectResource) Utils.getResource(ResourceType.PROJECT, project);
- result.add(projectResource);
- }
- break;
- case EXPERIMENT:
- generator = new QueryGenerator(EXPERIMENT);
- generator.setParameter(ExperimentConstants.EXECUTION_USER, getUser());
-
- //ordering - only supported only by CREATION_TIME
- if(orderByIdentifier != null && resultOrderType != null
- && orderByIdentifier.equals(Constants.FieldConstants.ProjectConstants.CREATION_TIME)) {
- q = generator.selectQuery(em, ExperimentConstants.CREATION_TIME, resultOrderType);
- }else{
- q = generator.selectQuery(em);
- }
-
- //pagination
- if(limit>0 && offset>=0){
- q.setFirstResult(offset);
- q.setMaxResults(limit);
- }
- for (Object o : q.getResultList()) {
- Experiment experiment = (Experiment) o;
- ExperimentResource experimentResource = (ExperimentResource) Utils.getResource(ResourceType.EXPERIMENT, experiment);
- result.add(experimentResource);
- }
-
- break;
- default:
- logger.error("Unsupported resource type for worker resource.", new IllegalArgumentException());
- break;
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new RegistryException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- return result;
- }
-
- /**
- * save gateway worker to database
- */
- public void save() throws RegistryException{
- EntityManager em = null;
- try {
- em = ResourceUtils.getEntityManager();
- Gateway_Worker existingWorker = em.find(Gateway_Worker.class, new Gateway_Worker_PK(gatewayId, user));
- em.close();
-
- em = ResourceUtils.getEntityManager();
- em.getTransaction().begin();
- Gateway_Worker gatewayWorker = new Gateway_Worker();
- Users existingUser = em.find(Users.class, this.user);
- gatewayWorker.setUser(existingUser);
- gatewayWorker.setUser_name(existingUser.getUser_name());
- gatewayWorker.setGateway_id(gatewayId);
- if (existingWorker != null) {
- existingWorker.setUser_name(existingUser.getUser_name());
- existingWorker.setUser(existingUser);
- existingWorker.setGateway_id(gatewayId);
- gatewayWorker = em.merge(existingWorker);
- } else {
- em.persist(gatewayWorker);
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new RegistryException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- /**
- *
- * @return user name
- */
- public String getUser() {
- return user;
- }
-
- /**
- *
- * @param user user name
- */
- public void setUser(String user) {
- this.user = user;
- }
-
- /**
- *
- * @param id project id
- * @return whether the project is available under the user
- */
- public boolean isProjectExists(String id) throws RegistryException{
- return isExists(ResourceType.PROJECT, id);
- }
-
- /**
- *
- * @param projectId project id
- * @return project resource for the user
- */
- public ProjectResource createProject(String projectId) throws RegistryException{
- ProjectResource project=(ProjectResource)create(ResourceType.PROJECT);
- project.setId(projectId);
- return project;
- }
-
- public String getProjectID(String projectName) {
- String pro = projectName.replaceAll("\\s", "");
- return pro + "_" + UUID.randomUUID();
- }
-
- /**
- *
- * @param id project id
- * @return project resource
- */
- public ProjectResource getProject(String id) throws RegistryException{
- return (ProjectResource)get(ResourceType.PROJECT, id);
- }
-
- /**
- *
- * @param id project id
- */
- public void removeProject(String id) throws RegistryException{
- remove(ResourceType.PROJECT, id);
- }
-
- /**
- * Get projects list of user
- * @return list of projects for the user
- */
- public List<ProjectResource> getProjects() throws RegistryException{
- return getProjects(-1, -1, null, null);
- }
-
-
- /**
- * Get projects list of user with pagination and ordering
- *
- * @return list of projects for the user
- */
- public List<ProjectResource> getProjects(int limit, int offset, Object orderByIdentifier,
- ResultOrderType resultOrderType) throws RegistryException{
- List<ProjectResource> result=new ArrayList<ProjectResource>();
- List<Resource> list = get(ResourceType.PROJECT, limit, offset, orderByIdentifier, resultOrderType);
- for (Resource resource : list) {
- result.add((ProjectResource) resource);
- }
- return result;
- }
-
- /**
- *
- * @param name experiment name
- * @return whether experiment is already exist for the given user
- */
- public boolean isExperimentExists(String name) throws RegistryException{
- return isExists(ResourceType.EXPERIMENT, name);
- }
-
-
- /**
- *
- * @param name experiment name
- * @return experiment resource
- */
- public ExperimentResource getExperiment(String name) throws RegistryException{
- return (ExperimentResource)get(ResourceType.EXPERIMENT, name);
- }
-//
-// public GFacJobDataResource getGFacJob(String jobId){
-// return (GFacJobDataResource)get(ResourceType.GFAC_JOB_DATA,jobId);
-// }
-
- /**
- * Method to get list of expeirments of user
- * @return list of experiments for the user
- */
- public List<ExperimentResource> getExperiments() throws RegistryException{
- return getExperiments(-1, -1, null, null);
- }
-
- /**
- * Method to get list of experiments of user with pagination and ordering
- * @param limit
- * @param offset
- * @param orderByIdentifier
- * @param resultOrderType
- * @return
- * @throws RegistryException
- */
- public List<ExperimentResource> getExperiments(int limit, int offset, Object orderByIdentifier,
- ResultOrderType resultOrderType) throws RegistryException{
- List<ExperimentResource> result=new ArrayList<ExperimentResource>();
- List<Resource> list = get(ResourceType.EXPERIMENT, limit, offset, orderByIdentifier, resultOrderType);
- for (Resource resource : list) {
- result.add((ExperimentResource) resource);
- }
- return result;
- }
-
- /**
- *
- * @param experimentId experiment name
- */
- public void removeExperiment(String experimentId) throws RegistryException{
- remove(ResourceType.EXPERIMENT, experimentId);
- }
-
- /**
- * To search the projects of user with the given filter criteria and retrieve the results with
- * pagination support. Results can be ordered based on an identifier (i.e column) either ASC or
- * DESC. But in the current implementation ordering is only supported based on the project
- * creation time
- *
- * @param filters
- * @param limit
- * @param offset
- * @param orderByIdentifier
- * @param resultOrderType
- * @return
- * @throws RegistryException
- */
- public List<ProjectResource> searchProjects(Map<String, String> filters, int limit,
- int offset, Object orderByIdentifier, ResultOrderType resultOrderType) throws RegistryException {
- List<ProjectResource> result = new ArrayList<ProjectResource>();
- EntityManager em = null;
- try {
- String query = "SELECT p from Project p WHERE ";
- if (filters != null && filters.size() != 0) {
- for (String field : filters.keySet()) {
- String filterVal = filters.get(field);
- if (field.equals(ProjectConstants.USERNAME)) {
- query += "p." + field + "= '" + filterVal + "' AND ";
- }else if (field.equals(ProjectConstants.GATEWAY_ID)) {
- query += "p." + field + "= '" + filterVal + "' AND ";
- }else {
- if (filterVal.contains("*")){
- filterVal = filterVal.replaceAll("\\*", "");
- }
- query += "p." + field + " LIKE '%" + filterVal + "%' AND ";
- }
- }
- }
- query = query.substring(0, query.length() - 5);
-
- //ordering
- if( orderByIdentifier != null && resultOrderType != null
- && orderByIdentifier.equals(Constants.FieldConstants.ProjectConstants.CREATION_TIME)){
- String order = (resultOrderType == ResultOrderType.ASC) ? "ASC" : "DESC";
- query += " ORDER BY p." + ProjectConstants.CREATION_TIME + " " + order;
- }
-
- em = ResourceUtils.getEntityManager();
- em.getTransaction().begin();
- Query q;
-
- //pagination
- if(offset>=0 && limit >=0){
- q = em.createQuery(query).setFirstResult(offset).setMaxResults(limit);
- }else{
- q = em.createQuery(query);
- }
-
- List resultList = q.getResultList();
- for (Object o : resultList) {
- Project project = (Project) o;
- ProjectResource projectResource =
- (ProjectResource) Utils.getResource(ResourceType.PROJECT, project);
- result.add(projectResource);
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new RegistryException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- return result;
- }
-
- /**
- * To search the experiments of user with the given time period and filter criteria and retrieve the results with
- * pagination support. Results can be ordered based on an identifier (i.e column) either ASC or
- * DESC. But in the current implementation ordering is only supported based on creationTime. Also if
- * time period values i.e fromTime and toTime are null they will be ignored.
- *
- * @param fromTime
- * @param toTime
- * @param filters
- * @param limit
- * @param offset
- * @param orderByIdentifier
- * @param resultOrderType
- * @return
- * @throws RegistryException
- */
- public List<ExperimentSummaryResource> searchExperiments(Timestamp fromTime, Timestamp toTime, Map<String, String> filters, int limit,
- int offset, Object orderByIdentifier, ResultOrderType resultOrderType) throws RegistryException {
- List<ExperimentSummaryResource> result = new ArrayList();
- EntityManager em = null;
- try {
- String query = "SELECT e, s FROM Experiment e " +
- ",Status s WHERE e.expId=s.expId AND " +
- "s.statusType='" + StatusType.EXPERIMENT + "' AND ";
- if(filters.get(StatusConstants.STATE) != null) {
- String experimentState = ExperimentState.valueOf(filters.get(StatusConstants.STATE)).toString();
- query += "s.state='" + experimentState + "' AND ";
- }
-
- if(toTime != null && fromTime != null && toTime.after(fromTime)){
- query += "e.creationTime > '" + fromTime + "' " + "AND e.creationTime <'" + toTime + "' AND ";
- }
-
- filters.remove(StatusConstants.STATE);
- if (filters != null && filters.size() != 0) {
- for (String field : filters.keySet()) {
- String filterVal = filters.get(field);
- if (field.equals(ExperimentConstants.EXECUTION_USER)) {
- query += "e." + field + "= '" + filterVal + "' AND ";
- }else if (field.equals(ExperimentConstants.GATEWAY_ID)) {
- query += "e." + field + "= '" + filterVal + "' AND ";
- } else if (field.equals(ExperimentConstants.PROJECT_ID)) {
- query += "e." + field + "= '" + filterVal + "' AND ";
- } else {
- if (filterVal.contains("*")){
- filterVal = filterVal.replaceAll("\\*", "");
- }
- query += "e." + field + " LIKE '%" + filterVal + "%' AND ";
- }
- }
- }
- query = query.substring(0, query.length() - 5);
-
- //ordering
- if( orderByIdentifier != null && resultOrderType != null
- && orderByIdentifier.equals(Constants.FieldConstants.ExperimentConstants.CREATION_TIME)){
- String order = (resultOrderType == ResultOrderType.ASC) ? "ASC" : "DESC";
- query += " ORDER BY e." + ExperimentConstants.CREATION_TIME + " " + order;
- }
-
- em = ResourceUtils.getEntityManager();
- em.getTransaction().begin();
- Query q;
-
- //pagination
- if(offset>=0 && limit >=0){
- q = em.createQuery(query).setFirstResult(offset).setMaxResults(limit);
- }else{
- q = em.createQuery(query);
- }
- OpenJPAQuery kq = OpenJPAPersistence.cast(q);
- JDBCFetchPlan fetch = (JDBCFetchPlan) kq.getFetchPlan();
- fetch.setEagerFetchMode(FetchMode.JOIN);
-
- List resultList = q.getResultList();
- for (Object o : resultList) {
- Experiment experiment = (Experiment) ((Object[])o)[0];
- Status experimentStatus = (Status) ((Object[])o)[1];
- experiment.setExperimentStatus(experimentStatus);
- ExperimentSummaryResource experimentSummaryResource =
- (ExperimentSummaryResource) Utils.getResource(ResourceType.EXPERIMENT_SUMMARY, experiment);
- result.add(experimentSummaryResource);
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new RegistryException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- return result;
- }
-
- /**
- *
- * @return list of experiments for the user
- */
- public List<ExperimentResource> getExperimentsByCaching(String user) throws RegistryException{
- List<ExperimentResource> result = new ArrayList<ExperimentResource>();
- EntityManager em = null;
- try {
- String query = "SELECT e from Experiment e WHERE e.executionUser = '" + user + "'";
- em = ResourceUtils.getEntityManager();
-// OpenJPAEntityManagerFactory oemf = OpenJPAPersistence.cast(em.getEntityManagerFactory());
-// QueryResultCache qcache = oemf.getQueryResultCache();
- // qcache.evictAll(Experiment.class);
- em.getTransaction().begin();
- Query q = em.createQuery(query);
- List resultList = q.getResultList();
- for (Object o : resultList) {
- Experiment experiment = (Experiment) o;
- ExperimentResource experimentResource = (ExperimentResource) Utils.getResource(ResourceType.EXPERIMENT, experiment);
- result.add(experimentResource);
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new RegistryException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- return result;
- }
-}
[32/52] [abbrv] [partial] airavata git commit: registry refactoring
Posted by sh...@apache.org.
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/impl/GatewayRegistry.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/impl/GatewayRegistry.java b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/impl/GatewayRegistry.java
deleted file mode 100644
index a98de72..0000000
--- a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/impl/GatewayRegistry.java
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- *
- * 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.experiment.catalog.impl;
-
-import org.apache.airavata.common.exception.ApplicationSettingsException;
-import org.apache.airavata.common.utils.ServerSettings;
-import org.apache.airavata.model.workspace.Gateway;
-import org.apache.airavata.experiment.catalog.Resource;
-import org.apache.airavata.experiment.catalog.ResourceUtils;
-import org.apache.airavata.experiment.catalog.resources.GatewayResource;
-import org.apache.airavata.experiment.catalog.utils.ThriftDataModelConversion;
-import org.apache.airavata.registry.cpi.RegistryException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.ArrayList;
-import java.util.List;
-
-public class GatewayRegistry {
-
- private final static Logger logger = LoggerFactory.getLogger(GatewayRegistry.class);
- public GatewayResource getDefaultGateway () throws ApplicationSettingsException, RegistryException {
- return (GatewayResource)ResourceUtils.getGateway(ServerSettings.getDefaultUserGateway());
- }
-
- public GatewayResource getExistingGateway (String gatewayName) throws RegistryException {
- return (GatewayResource)ResourceUtils.getGateway(gatewayName);
- }
-
- public String addGateway (Gateway gateway) throws RegistryException{
- try {
- GatewayResource resource = (GatewayResource)ResourceUtils.createGateway(gateway.getGatewayId());
- resource.setGatewayName(gateway.getGatewayName());
- resource.setEmailAddress(gateway.getEmailAddress());
- resource.setDomain(gateway.getDomain());
- resource.save();
- return gateway.getGatewayId();
- }catch (RegistryException e){
- logger.error("Error while saving gateway to registry", e);
- throw new RegistryException(e);
- }
- }
-
- public void updateGateway (String gatewayId, Gateway updatedGateway) throws RegistryException{
- try {
- GatewayResource existingGateway = (GatewayResource)ResourceUtils.getGateway(gatewayId);
- existingGateway.setGatewayName(updatedGateway.getGatewayName());
- existingGateway.setEmailAddress(updatedGateway.getEmailAddress());
- existingGateway.setDomain(updatedGateway.getDomain());
- existingGateway.save();
- }catch (RegistryException e){
- logger.error("Error while updating gateway to registry", e);
- throw new RegistryException(e);
- }
- }
-
- public Gateway getGateway (String gatewayId) throws RegistryException{
- try {
- GatewayResource resource = (GatewayResource)ResourceUtils.getGateway(gatewayId);
- return ThriftDataModelConversion.getGateway(resource);
- }catch (RegistryException e){
- logger.error("Error while getting gateway", e);
- throw new RegistryException(e);
- }
- }
-
- public boolean isGatewayExist (String gatewayId) throws RegistryException{
- try {
- return ResourceUtils.isGatewayExist(gatewayId);
- }catch (RegistryException e){
- logger.error("Error while checking gateway exists", e);
- throw new RegistryException(e);
- }
- }
-
- public boolean removeGateway (String gatewayId) throws RegistryException{
- try {
- return ResourceUtils.removeGateway(gatewayId);
- }catch (Exception e){
- logger.error("Error while removing the gateway", e);
- throw new RegistryException(e);
- }
- }
-
- public List<Gateway> getAllGateways () throws RegistryException {
- List<Gateway> gatewayList = new ArrayList<Gateway>();
- try {
- List<Resource> allGateways = ResourceUtils.getAllGateways();
- return ThriftDataModelConversion.getAllGateways(allGateways);
- }catch (Exception e){
- logger.error("Error while getting all the gateways", e);
- throw new RegistryException(e);
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/impl/LoggingRegistryImpl.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/impl/LoggingRegistryImpl.java b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/impl/LoggingRegistryImpl.java
deleted file mode 100644
index d4b735a..0000000
--- a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/impl/LoggingRegistryImpl.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- *
- * 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.experiment.catalog.impl;
-
-import org.apache.airavata.registry.cpi.*;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.List;
-import java.util.Map;
-
-public class LoggingRegistryImpl implements Registry {
- private final static Logger logger = LoggerFactory.getLogger(LoggingRegistryImpl.class);
-
- @Override
- public Object add(ParentDataType dataType, Object newObjectToAdd, String gatewayId) throws RegistryException {
- return null;
- }
-
- @Override
- public Object add(ChildDataType dataType, Object newObjectToAdd, Object dependentIdentifiers) throws RegistryException {
- return null;
- }
-
- @Override
- public void update(RegistryModelType dataType, Object newObjectToUpdate, Object identifier) throws RegistryException {
-
- }
-
- @Override
- public void update(RegistryModelType dataType, Object identifier, String fieldName, Object value) throws RegistryException {
-
- }
-
- @Override
- public Object get(RegistryModelType dataType, Object identifier) throws RegistryException {
- return null;
- }
-
- @Override
- public List<Object> get(RegistryModelType dataType, String fieldName, Object value) throws RegistryException {
- return null;
- }
-
- @Override
- public List<Object> get(RegistryModelType dataType, String fieldName, Object value, int limit, int offset, Object orderByIdentifier, ResultOrderType resultOrderType) throws RegistryException {
- return null;
- }
-
- @Override
- public List<Object> search(RegistryModelType dataType, Map<String, String> filters) throws RegistryException {
- return null;
- }
-
- @Override
- public List<Object> search(RegistryModelType dataType, Map<String, String> filters, int limit, int offset, Object orderByIdentifier, ResultOrderType resultOrderType) throws RegistryException {
- return null;
- }
-
- @Override
- public Object getValue(RegistryModelType dataType, Object identifier, String field) throws RegistryException {
- return null;
- }
-
- @Override
- public List<String> getIds(RegistryModelType dataType, String fieldName, Object value) throws RegistryException {
- return null;
- }
-
- @Override
- public void remove(RegistryModelType dataType, Object identifier) throws RegistryException {
-
- }
-
- @Override
- public boolean isExist(RegistryModelType dataType, Object identifier) throws RegistryException {
- return false;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/impl/ProjectRegistry.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/impl/ProjectRegistry.java b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/impl/ProjectRegistry.java
deleted file mode 100644
index 52a9ee4..0000000
--- a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/impl/ProjectRegistry.java
+++ /dev/null
@@ -1,303 +0,0 @@
-/*
- *
- * 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.experiment.catalog.impl;
-
-import org.apache.airavata.common.utils.AiravataUtils;
-import org.apache.airavata.model.workspace.Project;
-import org.apache.airavata.experiment.catalog.ResourceType;
-import org.apache.airavata.experiment.catalog.ResourceUtils;
-import org.apache.airavata.experiment.catalog.resources.*;
-import org.apache.airavata.experiment.catalog.utils.ThriftDataModelConversion;
-import org.apache.airavata.registry.cpi.RegistryException;
-import org.apache.airavata.registry.cpi.ResultOrderType;
-import org.apache.airavata.registry.cpi.utils.Constants;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.*;
-
-public class ProjectRegistry {
- private GatewayResource gatewayResource;
- private WorkerResource workerResource;
- private final static Logger logger = LoggerFactory.getLogger(ProjectRegistry.class);
-
- public ProjectRegistry(GatewayResource gatewayResource, UserResource user) throws RegistryException {
- if (!ResourceUtils.isGatewayExist(gatewayResource.getGatewayId())){
- this.gatewayResource = gatewayResource;
- }else {
- this.gatewayResource = (GatewayResource)ResourceUtils.getGateway(gatewayResource.getGatewayId());
- }
- if (!gatewayResource.isExists(ResourceType.GATEWAY_WORKER, user.getUserName())){
- workerResource = ResourceUtils.addGatewayWorker(gatewayResource, user);
- }else {
- workerResource = (WorkerResource)ResourceUtils.getWorker(gatewayResource.getGatewayId(),
- user.getUserName());
- }
- }
-
- public String addProject (Project project, String gatewayId) throws RegistryException{
- String projectId;
- try {
- if (!ResourceUtils.isUserExist(project.getOwner())){
- ResourceUtils.addUser(project.getOwner(), null);
- }
- ProjectResource projectResource = new ProjectResource();
- projectId = getProjectId(project.getName());
- projectResource.setId(projectId);
- project.setProjectID(projectId);
- projectResource.setName(project.getName());
- projectResource.setDescription(project.getDescription());
- projectResource.setCreationTime(AiravataUtils.getTime(project.getCreationTime()));
- projectResource.setGatewayId(gatewayId);
- WorkerResource worker = new WorkerResource(project.getOwner(), gatewayId);
- projectResource.setWorker(worker);
- projectResource.save();
- ProjectUserResource resource = (ProjectUserResource)projectResource.create(
- ResourceType.PROJECT_USER);
- resource.setProjectId(project.getProjectID());
- resource.setUserName(project.getOwner());
- resource.save();
- List<String> sharedGroups = project.getSharedGroups();
- if (sharedGroups != null && !sharedGroups.isEmpty()){
- for (String group : sharedGroups){
- //TODO - add shared groups
- logger.info("Groups are not supported at the moment...");
- }
- }
-
- List<String> sharedUsers = project.getSharedUsers();
- if (sharedUsers != null && !sharedUsers.isEmpty()){
- for (String username : sharedUsers){
- ProjectUserResource pr = (ProjectUserResource)projectResource.
- create(ResourceType.PROJECT_USER);
- pr.setUserName(username);
- pr.save();
- }
- }
- }catch (Exception e){
- logger.error("Error while saving project to registry", e);
- throw new RegistryException(e);
- }
- return projectId;
- }
-
- private String getProjectId (String projectName){
- String pro = projectName.replaceAll("\\s", "");
- return pro + "_" + UUID.randomUUID();
- }
-
- public void updateProject (Project project, String projectId) throws RegistryException{
- try {
- ProjectResource existingProject = workerResource.getProject(projectId);
- existingProject.setDescription(project.getDescription());
- existingProject.setName(project.getName());
-// existingProject.setGateway(gatewayResource);
- UserResource user = (UserResource)ResourceUtils.getUser(project.getOwner());
- if (!gatewayResource.isExists(ResourceType.GATEWAY_WORKER, user.getUserName())){
- workerResource = ResourceUtils.addGatewayWorker(gatewayResource, user);
- }else {
- workerResource = (WorkerResource)ResourceUtils.getWorker(
- gatewayResource.getGatewayName(), user.getUserName());
- }
- WorkerResource worker = new WorkerResource(project.getOwner(), gatewayResource.getGatewayId());
- existingProject.setWorker(worker);
- existingProject.save();
- ProjectUserResource resource = (ProjectUserResource)existingProject.create(
- ResourceType.PROJECT_USER);
- resource.setProjectId(projectId);
- resource.setUserName(project.getOwner());
- resource.save();
- List<String> sharedGroups = project.getSharedGroups();
- if (sharedGroups != null && !sharedGroups.isEmpty()){
- for (String group : sharedGroups){
- //TODO - add shared groups
- logger.info("Groups are not supported at the moment...");
- }
- }
-
- List<String> sharedUsers = project.getSharedUsers();
- if (sharedUsers != null && !sharedUsers.isEmpty()){
- for (String username : sharedUsers){
- ProjectUserResource pr = (ProjectUserResource)existingProject.create(
- ResourceType.PROJECT_USER);
- pr.setUserName(username);
- pr.save();
- }
- }
- }catch (Exception e){
- logger.error("Error while saving project to registry", e);
- throw new RegistryException(e);
- }
- }
-
- public Project getProject (String projectId) throws RegistryException{
- try {
- ProjectResource project = workerResource.getProject(projectId);
- if (project != null){
- return ThriftDataModelConversion.getProject(project);
- }
- }catch (Exception e){
- logger.error("Error while retrieving project from registry", e);
- throw new RegistryException(e);
- }
- return null;
- }
-
- /**
- * Get list of projects of the user
- * @param fieldName
- * @param value
- * @return
- * @throws RegistryException
- */
- public List<Project> getProjectList (String fieldName, Object value) throws RegistryException{
- return getProjectList(fieldName, value, -1, -1, null, null);
- }
-
- /**
- * Get projects list with pagination and result ordering
- * @param fieldName
- * @param value
- * @param limit
- * @param offset
- * @param orderByIdentifier
- * @param resultOrderType
- * @return
- * @throws RegistryException
- */
- public List<Project> getProjectList (String fieldName, Object value, int limit, int offset,
- Object orderByIdentifier, ResultOrderType resultOrderType) throws RegistryException{
- List<Project> projects = new ArrayList<Project>();
- try {
- if (fieldName.equals(Constants.FieldConstants.ProjectConstants.OWNER)){
- workerResource.setUser((String)value);
- List<ProjectResource> projectList = workerResource.getProjects();
- if (projectList != null && !projectList.isEmpty()){
- for (ProjectResource pr : projectList){
- projects.add(ThriftDataModelConversion.getProject(pr));
- }
- }
- return projects;
- }
- }catch (Exception e){
- logger.error("Error while retrieving project from registry", e);
- throw new RegistryException(e);
- }
- return projects;
- }
-
- /**
- * To search projects of user with the given filter criteria. All the matching results will be sent.
- * Results are not ordered in any order
- * @param filters
- * @return
- * @throws RegistryException
- */
- public List<Project> searchProjects (Map<String, String> filters) throws RegistryException{
- return searchProjects(filters, -1, -1, null, null);
- }
-
- /**
- * To search the projects of user with the given filter criteria and retrieve the results with
- * pagination support. Results can be ordered based on an identifier (i.e column) either ASC or
- * DESC.
- *
- * @param filters
- * @param limit
- * @param offset
- * @param orderByIdentifier
- * @param resultOrderType
- * @return
- * @throws RegistryException
- */
- public List<Project> searchProjects(Map<String, String> filters, int limit,
- int offset, Object orderByIdentifier, ResultOrderType resultOrderType) throws RegistryException {
- Map<String, String> fil = new HashMap<String, String>();
- if (filters != null && filters.size() != 0){
- List<Project> projects = new ArrayList<Project>();
- try {
- for (String field : filters.keySet()){
- if (field.equals(Constants.FieldConstants.ProjectConstants.PROJECT_NAME)){
- fil.put(AbstractResource.ProjectConstants.PROJECT_NAME, filters.get(field));
- }else if (field.equals(Constants.FieldConstants.ProjectConstants.OWNER)){
- fil.put(AbstractResource.ProjectConstants.USERNAME, filters.get(field));
- }else if (field.equals(Constants.FieldConstants.ProjectConstants.DESCRIPTION)){
- fil.put(AbstractResource.ProjectConstants.DESCRIPTION, filters.get(field));
- }else if (field.equals(Constants.FieldConstants.ProjectConstants.GATEWAY_ID)){
- fil.put(AbstractResource.ProjectConstants.GATEWAY_ID, filters.get(field));
- }
- }
- List<ProjectResource> projectResources = workerResource
- .searchProjects(fil, limit, offset, orderByIdentifier, resultOrderType);
- if (projectResources != null && !projectResources.isEmpty()){
- for (ProjectResource pr : projectResources){
- projects.add(ThriftDataModelConversion.getProject(pr));
- }
- }
- return projects;
- }catch (Exception e){
- logger.error("Error while retrieving project from registry", e);
- throw new RegistryException(e);
- }
- }
- return null;
- }
-
- public List<String> getProjectIDs (String fieldName, Object value) throws RegistryException{
- List<String> projectIds = new ArrayList<String>();
- try {
- if (fieldName.equals(Constants.FieldConstants.ProjectConstants.OWNER)){
- workerResource.setUser((String)value);
- List<ProjectResource> projectList = workerResource.getProjects();
- if (projectList != null && !projectList.isEmpty()){
- for (ProjectResource pr : projectList){
- projectIds.add(pr.getName());
- }
- }
- return projectIds;
- }
- }catch (Exception e){
- logger.error("Error while retrieving projects from registry", e);
- throw new RegistryException(e);
- }
- return projectIds;
- }
-
- public void removeProject (String projectId) throws RegistryException {
- try {
- workerResource.removeProject(projectId);
- } catch (Exception e) {
- logger.error("Error while removing the project..", e);
- throw new RegistryException(e);
- }
- }
-
- public boolean isProjectExist(String projectId) throws RegistryException {
- try {
- return workerResource.isProjectExists(projectId);
- } catch (Exception e) {
- logger.error("Error while retrieving project...", e);
- throw new RegistryException(e);
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/impl/RegistryFactory.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/impl/RegistryFactory.java b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/impl/RegistryFactory.java
deleted file mode 100644
index 80eb09c..0000000
--- a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/impl/RegistryFactory.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- *
- * 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.experiment.catalog.impl;
-
-import org.apache.airavata.common.exception.ApplicationSettingsException;
-import org.apache.airavata.common.utils.ServerSettings;
-import org.apache.airavata.registry.cpi.Registry;
-import org.apache.airavata.registry.cpi.RegistryException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class RegistryFactory {
- private static Registry registry;
- private static Logger logger = LoggerFactory.getLogger(RegistryFactory.class);
-
- public static Registry getRegistry(String gateway, String username, String password) throws RegistryException {
- try {
- if (registry == null) {
- registry = new RegistryImpl(gateway, username, password);
- }
- } catch (RegistryException e) {
- logger.error("Unable to create registry instance", e);
- throw new RegistryException(e);
- }
- return registry;
- }
-
- public static Registry getRegistry(String gateway) throws RegistryException {
- try {
- if (registry == null) {
- registry = new RegistryImpl(gateway, ServerSettings.getDefaultUser(), ServerSettings.getDefaultUserPassword());
- }
- } catch (RegistryException e) {
- logger.error("Unable to create registry instance", e);
- throw new RegistryException(e);
- } catch (ApplicationSettingsException e) {
- logger.error("Unable to create registry instance", e);
- throw new RegistryException(e);
- }
- return registry;
- }
-
- public static Registry getDefaultRegistry () throws RegistryException {
- try {
- if (registry == null) {
- registry = new RegistryImpl();
- }
- } catch (RegistryException e) {
- logger.error("Unable to create registry instance", e);
- throw new RegistryException(e);
- }
- return registry;
- }
-
- public static Registry getLoggingRegistry() {
- if(registry == null) {
- registry = new LoggingRegistryImpl();
- }
- return registry;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/impl/RegistryImpl.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/impl/RegistryImpl.java b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/impl/RegistryImpl.java
deleted file mode 100644
index 3cee954..0000000
--- a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/impl/RegistryImpl.java
+++ /dev/null
@@ -1,735 +0,0 @@
-/*
- *
- * 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.experiment.catalog.impl;
-
-import org.apache.airavata.common.exception.ApplicationSettingsException;
-import org.apache.airavata.common.utils.ServerSettings;
-import org.apache.airavata.model.appcatalog.appinterface.OutputDataObjectType;
-import org.apache.airavata.model.workspace.Gateway;
-import org.apache.airavata.model.workspace.Project;
-import org.apache.airavata.model.workspace.experiment.*;
-import org.apache.airavata.experiment.catalog.ResourceUtils;
-import org.apache.airavata.experiment.catalog.resources.GatewayResource;
-import org.apache.airavata.experiment.catalog.resources.UserResource;
-import org.apache.airavata.registry.cpi.*;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
-public class RegistryImpl implements Registry {
- private GatewayResource gatewayResource;
- private UserResource user;
- private final static Logger logger = LoggerFactory.getLogger(RegistryImpl.class);
- private ExperimentRegistry experimentRegistry = null;
- private ProjectRegistry projectRegistry = null;
- private GatewayRegistry gatewayRegistry = null;
-
- public RegistryImpl() throws RegistryException{
- try {
- if (!ResourceUtils.isGatewayExist(ServerSettings.getDefaultUserGateway())){
- gatewayResource = (GatewayResource) ResourceUtils.createGateway(ServerSettings.getDefaultUserGateway());
- gatewayResource.setGatewayName(ServerSettings.getDefaultUserGateway());
- gatewayResource.save();
- }else {
- gatewayResource = (GatewayResource)ResourceUtils.getGateway(ServerSettings.getDefaultUserGateway());
- }
-
- if (!ResourceUtils.isUserExist(ServerSettings.getDefaultUser())){
- user = ResourceUtils.createUser(ServerSettings.getDefaultUser(), ServerSettings.getDefaultUserPassword());
- user.save();
- }else {
- user = (UserResource)ResourceUtils.getUser(ServerSettings.getDefaultUser());
- }
- experimentRegistry = new ExperimentRegistry(gatewayResource, user);
- projectRegistry = new ProjectRegistry(gatewayResource, user);
- gatewayRegistry = new GatewayRegistry();
- } catch (ApplicationSettingsException e) {
- logger.error("Unable to read airavata server properties..", e);
- throw new RegistryException("Unable to read airavata server properties..", e);
- }
- }
-
- public RegistryImpl(String gateway, String username, String password) throws RegistryException{
- if (!ResourceUtils.isGatewayExist(gateway)){
- gatewayResource = (GatewayResource) ResourceUtils.createGateway(gateway);
- gatewayResource.save();
- }else {
- gatewayResource = (GatewayResource)ResourceUtils.getGateway(gateway);
- }
-
- if (!ResourceUtils.isUserExist(username)){
- user = ResourceUtils.createUser(username, password);
- user.save();
- }else {
- user = (UserResource)ResourceUtils.getUser(username);
- }
- experimentRegistry = new ExperimentRegistry(gatewayResource, user);
- projectRegistry = new ProjectRegistry(gatewayResource, user);
- }
-
- /**
- * This method is to add an object in to the registry
- *
- * @param dataType Data type is a predefined type which the programmer should choose according to the object he
- * is going to save in to registry
- * @param newObjectToAdd Object which contains the fields that need to be saved in to registry. This object is a
- * thrift model object. In experiment case this object can be BasicMetadata, ConfigurationData
- * etc
- * @return return the identifier to identify the object
- */
- @Override
- public Object add(ParentDataType dataType, Object newObjectToAdd, String gatewayId) throws RegistryException {
- try {
- switch (dataType) {
- case PROJECT:
- return projectRegistry.addProject((Project)newObjectToAdd, gatewayId);
- case EXPERIMENT:
- return experimentRegistry.addExperiment((Experiment) newObjectToAdd, gatewayId);
- case GATEWAY:
- return gatewayRegistry.addGateway((Gateway)newObjectToAdd);
- default:
- logger.error("Unsupported top level type..", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
- } catch (Exception e) {
- logger.error("Error while adding the resource " + dataType.toString(), new RegistryException(e));
- throw new RegistryException("Error while adding the resource " + dataType.toString(), e);
- }
- }
-
- /**
- * This method is to add an object in to the registry
- *
- * @param dataType Data type is a predefined type which the programmer should choose according to the object he
- * is going to save in to registry
- * @param newObjectToAdd Object which contains the fields that need to be saved in to registry. This object is a
- * thrift model object. In experiment case this object can be BasicMetadata, ConfigurationData
- * etc
- * @param dependentIdentifier Object which contains the identifier if the object that is going to add is not a top
- * level object in the data model. If it is a top level object, programmer can pass it as
- * null
- */
- @Override
- public Object add(ChildDataType dataType, Object newObjectToAdd, Object dependentIdentifier) throws RegistryException {
- try {
- switch (dataType) {
- case EXPERIMENT_CONFIGURATION_DATA:
- return experimentRegistry.addUserConfigData((UserConfigurationData) newObjectToAdd, (String) dependentIdentifier);
- case EXPERIMENT_OUTPUT:
- return experimentRegistry.addExpOutputs((List<OutputDataObjectType>) newObjectToAdd, (String) dependentIdentifier);
- case EXPERIMENT_STATUS:
- return experimentRegistry.updateExperimentStatus((ExperimentStatus) newObjectToAdd, (String) dependentIdentifier);
- case WORKFLOW_NODE_DETAIL:
- return experimentRegistry.addWorkflowNodeDetails((WorkflowNodeDetails) newObjectToAdd, (String) dependentIdentifier);
- case WORKFLOW_NODE_STATUS:
- return experimentRegistry.addWorkflowNodeStatus((WorkflowNodeStatus) newObjectToAdd, (CompositeIdentifier) dependentIdentifier);
- case NODE_OUTPUT:
- return experimentRegistry.addNodeOutputs((List<OutputDataObjectType>) newObjectToAdd, (CompositeIdentifier) dependentIdentifier);
- case TASK_DETAIL:
- return experimentRegistry.addTaskDetails((TaskDetails) newObjectToAdd, (String) dependentIdentifier);
- case APPLICATION_OUTPUT:
- return experimentRegistry.addApplicationOutputs((List<OutputDataObjectType>) newObjectToAdd, (CompositeIdentifier) dependentIdentifier);
- case TASK_STATUS:
- return experimentRegistry.addTaskStatus((TaskStatus) newObjectToAdd, (CompositeIdentifier) dependentIdentifier);
- case JOB_DETAIL:
- return experimentRegistry.addJobDetails((JobDetails) newObjectToAdd, (CompositeIdentifier) dependentIdentifier);
- case JOB_STATUS:
- return experimentRegistry.addJobStatus((JobStatus) newObjectToAdd, (CompositeIdentifier) dependentIdentifier);
- case APPLICATION_STATUS:
- return experimentRegistry.addApplicationStatus((ApplicationStatus) newObjectToAdd, (CompositeIdentifier) dependentIdentifier);
- case DATA_TRANSFER_DETAIL:
- return experimentRegistry.addDataTransferDetails((DataTransferDetails) newObjectToAdd, (String) dependentIdentifier);
- case TRANSFER_STATUS:
- return experimentRegistry.addTransferStatus((TransferStatus) newObjectToAdd, (CompositeIdentifier) dependentIdentifier);
- case COMPUTATIONAL_RESOURCE_SCHEDULING:
- return experimentRegistry.addComputationalResourceScheduling((ComputationalResourceScheduling) newObjectToAdd, (CompositeIdentifier) dependentIdentifier);
- case ADVANCE_OUTPUT_DATA_HANDLING:
- return experimentRegistry.addOutputDataHandling((AdvancedOutputDataHandling) newObjectToAdd, (CompositeIdentifier) dependentIdentifier);
- case ADVANCE_INPUT_DATA_HANDLING:
- return experimentRegistry.addInputDataHandling((AdvancedInputDataHandling) newObjectToAdd, (CompositeIdentifier) dependentIdentifier);
- case QOS_PARAM:
- return experimentRegistry.addQosParams((QualityOfServiceParams) newObjectToAdd, (CompositeIdentifier) dependentIdentifier);
- case ERROR_DETAIL:
- return experimentRegistry.addErrorDetails((ErrorDetails) newObjectToAdd, dependentIdentifier);
- default:
- logger.error("Unsupported dependent data type...", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
- } catch (Exception e) {
- logger.error("Error while adding " + dataType.toString() , new RegistryException(e));
- throw new RegistryException("Error while adding " + dataType.toString(), e);
- }
-
- }
-
- /**
- * This method is to update the whole object in registry
- *
- * @param dataType Data type is a predefined type which the programmer should choose according to the object he
- * is going to save in to registry
- * @param newObjectToUpdate Object which contains the fields that need to be updated in to registry. This object is a
- * thrift model object. In experiment case this object can be BasicMetadata, ConfigurationData
- * etc. CPI programmer can only fill necessary fields that need to be updated. He does not
- * have to fill the whole object. He needs to only fill the mandatory fields and whatever the
- * other fields that need to be updated.
- */
- @Override
- public void update(RegistryModelType dataType, Object newObjectToUpdate, Object identifier) throws RegistryException {
- try {
- switch (dataType) {
- case PROJECT:
- projectRegistry.updateProject((Project)newObjectToUpdate, (String)identifier);
- break;
- case GATEWAY:
- gatewayRegistry.updateGateway((String)identifier, (Gateway)newObjectToUpdate);
- break;
- case EXPERIMENT:
- experimentRegistry.updateExperiment((Experiment) newObjectToUpdate, (String) identifier);
- break;
- case EXPERIMENT_CONFIGURATION_DATA:
- experimentRegistry.updateUserConfigData((UserConfigurationData) newObjectToUpdate, (String) identifier);
- break;
- case EXPERIMENT_OUTPUT:
- experimentRegistry.updateExpOutputs((List<OutputDataObjectType>) newObjectToUpdate, (String) identifier);
- break;
- case EXPERIMENT_STATUS:
- experimentRegistry.updateExperimentStatus((ExperimentStatus) newObjectToUpdate, (String) identifier);
- break;
- case WORKFLOW_NODE_DETAIL:
- experimentRegistry.updateWorkflowNodeDetails((WorkflowNodeDetails) newObjectToUpdate, (String) identifier);
- break;
- case WORKFLOW_NODE_STATUS:
- experimentRegistry.updateWorkflowNodeStatus((WorkflowNodeStatus) newObjectToUpdate, (String) identifier);
- break;
- case NODE_OUTPUT:
- experimentRegistry.updateNodeOutputs((List<OutputDataObjectType>) newObjectToUpdate, (String) identifier);
- break;
- case TASK_DETAIL:
- experimentRegistry.updateTaskDetails((TaskDetails) newObjectToUpdate, (String) identifier);
- break;
- case APPLICATION_OUTPUT:
- experimentRegistry.updateAppOutputs((List<OutputDataObjectType>) newObjectToUpdate, (String) identifier);
- break;
- case TASK_STATUS:
- experimentRegistry.updateTaskStatus((TaskStatus) newObjectToUpdate, (String) identifier);
- break;
- case JOB_DETAIL:
- experimentRegistry.updateJobDetails((JobDetails) newObjectToUpdate, (CompositeIdentifier) identifier);
- break;
- case JOB_STATUS:
- experimentRegistry.updateJobStatus((JobStatus) newObjectToUpdate, (CompositeIdentifier) identifier);
- break;
- case APPLICATION_STATUS:
- experimentRegistry.updateApplicationStatus((ApplicationStatus) newObjectToUpdate, (String) identifier);
- break;
- case DATA_TRANSFER_DETAIL:
- experimentRegistry.updateDataTransferDetails((DataTransferDetails) newObjectToUpdate, (String) identifier);
- break;
- case TRANSFER_STATUS:
- experimentRegistry.updateTransferStatus((TransferStatus) newObjectToUpdate, (String) identifier);
- break;
- case COMPUTATIONAL_RESOURCE_SCHEDULING:
- experimentRegistry.updateScheduling((ComputationalResourceScheduling) newObjectToUpdate, (String) identifier, dataType.toString());
- break;
- case ADVANCE_INPUT_DATA_HANDLING:
- experimentRegistry.updateInputDataHandling((AdvancedInputDataHandling) newObjectToUpdate, (String) identifier, dataType.toString());
- break;
- case ADVANCE_OUTPUT_DATA_HANDLING:
- experimentRegistry.updateOutputDataHandling((AdvancedOutputDataHandling) newObjectToUpdate, (String) identifier, dataType.toString());
- break;
- case QOS_PARAM:
- experimentRegistry.updateQOSParams((QualityOfServiceParams) newObjectToUpdate, (String) identifier, dataType.toString());
- break;
- default:
- logger.error("Unsupported data type...", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
- } catch (Exception e) {
- logger.error("Error while updating the resource " + dataType.toString(), new RegistryException(e));
- throw new RegistryException("Error while updating the resource.." + dataType.toString(), e);
- }
-
- }
-
- /**
- * This method is to update a specific field of the data model
- *
- * @param dataType Data type is a predefined type which the programmer should choose according to the object he
- * is going to save in to registry
- * @param identifier Identifier which will uniquely identify the data model. For example, in Experiment_Basic_Type,
- * identifier will be generated experimentID
- * @param fieldName Field which need to be updated in the registry. In Experiment_Basic_Type, if you want to update the
- * description, field will be "description". Field names are defined in
- * org.apache.airavata.registry.cpi.utils.Constants
- * @param value Value by which the given field need to be updated. If the field is "description", that field will be
- * updated by given value
- */
- @Override
- public void update(RegistryModelType dataType, Object identifier, String fieldName, Object value) throws RegistryException {
- try {
- switch (dataType) {
- case EXPERIMENT:
- experimentRegistry.updateExperimentField((String) identifier, fieldName, value);
- break;
- case EXPERIMENT_CONFIGURATION_DATA:
- experimentRegistry.updateExpConfigDataField((String) identifier, fieldName, value);
- break;
- default:
- logger.error("Unsupported data type...", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
- } catch (Exception e) {
- logger.error("Error while updating the resource " + dataType.toString(), new RegistryException(e));
- throw new RegistryException("Error while updating the resource " + dataType.toString(), e);
- }
-
- }
-
- /**
- * This method is to retrieve object according to the identifier. In the experiment basic data type, if you give the
- * experiment id, this method will return the BasicMetadata object
- *
- * @param dataType Data type is a predefined type which the programmer should choose according to the object he
- * is going to save in to registry
- * @param identifier Identifier which will uniquely identify the data model. For example, in Experiment_Basic_Type,
- * identifier will be generated experimentID
- * @return object according to the given identifier.
- */
- @Override
- public Object get(RegistryModelType dataType, Object identifier) throws RegistryException {
- try {
- switch (dataType) {
- case PROJECT:
- return projectRegistry.getProject((String)identifier);
- case GATEWAY:
- return gatewayRegistry.getGateway((String)identifier);
- case EXPERIMENT:
- return experimentRegistry.getExperiment((String) identifier, null);
- case EXPERIMENT_CONFIGURATION_DATA:
- return experimentRegistry.getConfigData((String) identifier, null);
- case EXPERIMENT_OUTPUT:
- return experimentRegistry.getExperimentOutputs((String) identifier);
- case EXPERIMENT_STATUS:
- return experimentRegistry.getExperimentStatus((String) identifier);
- case WORKFLOW_NODE_DETAIL:
- return experimentRegistry.getWorkflowNodeDetails((String) identifier);
- case WORKFLOW_NODE_STATUS:
- return experimentRegistry.getWorkflowNodeStatus((String) identifier);
- case NODE_OUTPUT:
- return experimentRegistry.getNodeOutputs((String) identifier);
- case TASK_DETAIL:
- return experimentRegistry.getTaskDetails((String) identifier);
- case APPLICATION_OUTPUT:
- return experimentRegistry.getApplicationOutputs((String) identifier);
- case TASK_STATUS:
- return experimentRegistry.getTaskStatus((String) identifier);
- case JOB_DETAIL:
- return experimentRegistry.getJobDetails((CompositeIdentifier) identifier);
- case JOB_STATUS:
- return experimentRegistry.getJobStatus((CompositeIdentifier) identifier);
- case APPLICATION_STATUS:
- return experimentRegistry.getApplicationStatus((CompositeIdentifier) identifier);
- case DATA_TRANSFER_DETAIL:
- return experimentRegistry.getDataTransferDetails((String) identifier);
- case TRANSFER_STATUS:
- return experimentRegistry.getDataTransferStatus((String) identifier);
- case COMPUTATIONAL_RESOURCE_SCHEDULING:
- return experimentRegistry.getComputationalScheduling(dataType, (String) identifier);
- case ADVANCE_INPUT_DATA_HANDLING:
- return experimentRegistry.getInputDataHandling(dataType, (String) identifier);
- case ADVANCE_OUTPUT_DATA_HANDLING:
- return experimentRegistry.getOutputDataHandling(dataType, (String) identifier);
- case QOS_PARAM:
- return experimentRegistry.getQosParams(dataType, (String) identifier);
- default:
- logger.error("Unsupported data type...", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
- } catch (Exception e) {
- logger.error("Error while retrieving the resource " + dataType.toString(), new RegistryException(e));
- throw new RegistryException("Error while retrieving the resource " + dataType.toString() , e);
- }
- }
-
- /**
- * This method is to retrieve list of objects according to a given criteria
- *
- * @param dataType Data type is a predefined type which the programmer should choose according to the object he
- * is going to save in to registry
- * @param fieldName FieldName is the field that filtering should be done. For example, if we want to retrieve all
- * the experiments for a given user, filterBy will be "userName"
- * @param value value for the filtering field. In the experiment case, value for "userName" can be "admin"
- * @return List of objects according to the given criteria
- */
- @Override
- public List<Object> get(RegistryModelType dataType, String fieldName, Object value) throws RegistryException {
- try {
- List<Object> result = new ArrayList<Object>();
- switch (dataType) {
- case PROJECT:
- List<Project> projectList = projectRegistry.getProjectList(fieldName, value);
- for (Project project : projectList ){
- result.add(project);
- }
- return result;
- case GATEWAY:
- List<Gateway> allGateways = gatewayRegistry.getAllGateways();
- for (Gateway gateway : allGateways){
- result.add(gateway);
- }
- return result;
- case EXPERIMENT:
- List<Experiment> experimentList = experimentRegistry.getExperimentList(fieldName, value);
- for (Experiment experiment : experimentList) {
- result.add(experiment);
- }
- return result;
- case WORKFLOW_NODE_DETAIL:
- List<WorkflowNodeDetails> wfNodeDetails = experimentRegistry.getWFNodeDetails(fieldName, value);
- for (WorkflowNodeDetails wf : wfNodeDetails) {
- result.add(wf);
- }
- return result;
- case WORKFLOW_NODE_STATUS:
- List<WorkflowNodeStatus> wfNodeStatusList = experimentRegistry.getWFNodeStatusList(fieldName, value);
- for (WorkflowNodeStatus wfs : wfNodeStatusList) {
- result.add(wfs);
- }
- return result;
- case TASK_DETAIL:
- List<TaskDetails> taskDetails = experimentRegistry.getTaskDetails(fieldName, value);
- for (TaskDetails task : taskDetails) {
- result.add(task);
- }
- return result;
- case JOB_DETAIL:
- List<JobDetails> jobDetails = experimentRegistry.getJobDetails(fieldName, value);
- for (JobDetails job : jobDetails) {
- result.add(job);
- }
- return result;
- case DATA_TRANSFER_DETAIL:
- List<DataTransferDetails> dataTransferDetails = experimentRegistry.getDataTransferDetails(fieldName, value);
- for (DataTransferDetails transferDetails : dataTransferDetails) {
- result.add(transferDetails);
- }
- return result;
- case ERROR_DETAIL:
- List<ErrorDetails> errorDetails = experimentRegistry.getErrorDetails(fieldName, value);
- for (ErrorDetails error : errorDetails) {
- result.add(error);
- }
- return result;
- default:
- logger.error("Unsupported data type...", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
- } catch (Exception e) {
- logger.error("Error while retrieving the resource " + dataType.toString(), new RegistryException(e));
- throw new RegistryException("Error while retrieving the resource " + dataType.toString(), e);
- }
-
- }
-
- /**
- * This method is to retrieve list of objects according to a given criteria with pagination and ordering
- *
- * @param dataType Data type is a predefined type which the programmer should choose according to the object he
- * is going to save in to registry
- * @param fieldName FieldName is the field that filtering should be done. For example, if we want to retrieve all
- * the experiments for a given user, filterBy will be "userName"
- * @param value value for the filtering field. In the experiment case, value for "userName" can be "admin"
- * @param limit Size of the results to be returned
- * @param offset Start position of the results to be retrieved
- * @param orderByIdentifier Named of the column in which the ordering is based
- * @param resultOrderType Type of ordering i.e ASC or DESC
- * @return
- * @throws RegistryException
- */
- @Override
- public List<Object> get(RegistryModelType dataType, String fieldName, Object value, int limit,
- int offset, Object orderByIdentifier, ResultOrderType resultOrderType) throws RegistryException {
- try {
- List<Object> result = new ArrayList<Object>();
- switch (dataType) {
- case PROJECT:
- List<Project> projectList = projectRegistry
- .getProjectList(fieldName, value, limit, offset, orderByIdentifier, resultOrderType);
- for (Project project : projectList ){
- result.add(project);
- }
- return result;
- case EXPERIMENT:
- List<Experiment> experimentList = experimentRegistry.getExperimentList(fieldName, value,
- limit, offset, orderByIdentifier, resultOrderType);
- for (Experiment experiment : experimentList) {
- result.add(experiment);
- }
- return result;
- default:
- logger.error("Unsupported data type...", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
- } catch (Exception e) {
- logger.error("Error while retrieving the resource " + dataType.toString(), new RegistryException(e));
- throw new RegistryException("Error while retrieving the resource " + dataType.toString(), e);
- }
- }
-
- /**
- * This method is to retrieve list of objects according to a given criteria
- * @param dataType Data type is a predefined type which the programmer should choose according to the object he
- * is going to save in to registry
- * @param filters filters is a map of field name and value that you need to use for search filtration
- * @return List of objects according to the given criteria
- */
- @Override
- public List<Object> search(RegistryModelType dataType, Map<String, String> filters) throws RegistryException {
- return search(dataType, filters, -1, -1, null, null);
- }
-
- /**
- * This method is to retrieve list of objects with pagination according to a given criteria sorted
- * according by the specified identified and specified ordering (i.e either ASC or DESC)
- * @param dataType Data type is a predefined type which the programmer should choose according to the object he
- * is going to save in to registry
- * @param filters filters is a map of field name and value that you need to use for search filtration
- * @param limit amount of the results to be returned
- * @param offset offset of the results from the sorted list to be fetched from
- * @param orderByIdentifier identifier (i.e the column) which will be used as the basis to sort the results
- * @param resultOrderType The type of ordering (i.e ASC or DESC) that has to be used when retrieving the results
- * @return List of objects according to the given criteria
- */
- @Override
- public List<Object> search(RegistryModelType dataType, Map<String, String> filters, int limit,
- int offset, Object orderByIdentifier, ResultOrderType resultOrderType) throws RegistryException {
- try {
- List<Object> result = new ArrayList<Object>();
- switch (dataType) {
- case PROJECT:
- List<Project> projectList
- = projectRegistry.searchProjects(filters, limit, offset,
- orderByIdentifier, resultOrderType);
- for (Project project : projectList ){
- result.add(project);
- }
- return result;
- case EXPERIMENT:
- List<ExperimentSummary> experimentSummaries = experimentRegistry
- .searchExperiments(filters, limit, offset, orderByIdentifier,
- resultOrderType);
- for (ExperimentSummary ex : experimentSummaries){
- result.add(ex);
- }
- return result;
- default:
- logger.error("Unsupported data type...", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
- } catch (Exception e) {
- logger.error("Error while retrieving the resource " + dataType.toString(), new RegistryException(e));
- throw new RegistryException("Error while retrieving the resource " + dataType.toString(), e);
- }
- }
-
- /**
- * This method is to retrieve a specific value for a given field.
- *
- * @param dataType Data type is a predefined type which the programmer should choose according to the object he
- * is going to save in to registry
- * @param identifier Identifier which will uniquely identify the data model. For example, in Experiment_Basic_Type,
- * identifier will be generated experimentID
- * @param field field that filtering should be done. For example, if we want to execution user for a given
- * experiment, field will be "userName"
- * @return return the value for the specific field where data model is identified by the unique identifier that has
- * given
- */
- @Override
- public Object getValue(RegistryModelType dataType, Object identifier, String field) throws RegistryException {
- try {
- switch (dataType) {
- case EXPERIMENT:
- return experimentRegistry.getExperiment((String) identifier, field);
- case EXPERIMENT_CONFIGURATION_DATA:
- return experimentRegistry.getConfigData((String) identifier, field);
- default:
- logger.error("Unsupported data type...", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
- } catch (Exception e) {
- logger.error("Error while retrieving the resource " + dataType.toString(), new RegistryException(e));
- throw new RegistryException("Error while retrieving the resource " + dataType.toString(), e);
- }
-
- }
-
- /**
- * This method is to retrieve all the identifiers according to given filtering criteria. For an example, if you want
- * to get all the experiment ids for a given gateway, your field name will be "gateway" and the value will be the
- * name of the gateway ("default"). Similar manner you can retrieve all the experiment ids for a given user.
- *
- * @param dataType Data type is a predefined type which the programmer should choose according to the object he
- * is going to save in to registry
- * @param fieldName FieldName is the field that filtering should be done. For example, if we want to retrieve all
- * the experiments for a given user, filterBy will be "userName"
- * @param value value for the filtering field. In the experiment case, value for "userName" can be "admin"
- * @return id list according to the filtering criteria
- */
- @Override
- public List<String> getIds(RegistryModelType dataType, String fieldName, Object value) throws RegistryException {
- try {
- switch (dataType) {
- case PROJECT:
- return projectRegistry.getProjectIDs(fieldName, value);
- case EXPERIMENT:
- return experimentRegistry.getExperimentIDs(fieldName, value);
- case EXPERIMENT_CONFIGURATION_DATA:
- return experimentRegistry.getExperimentIDs(fieldName, value);
- case WORKFLOW_NODE_DETAIL:
- return experimentRegistry.getWorkflowNodeIds(fieldName, value);
- case TASK_DETAIL:
- return experimentRegistry.getTaskDetailIds(fieldName, value);
- case JOB_DETAIL:
- return experimentRegistry.getJobDetailIds(fieldName, value);
- case DATA_TRANSFER_DETAIL:
- return experimentRegistry.getTransferDetailIds(fieldName, value);
- default:
- logger.error("Unsupported data type...", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
- } catch (Exception e) {
- logger.error("Error while retrieving the ids for" + dataType.toString(), new RegistryException(e));
- throw new RegistryException("Error while retrieving the ids for " + dataType.toString(), e);
- }
-
- }
-
- /**
- * This method is to remove a item from the registry
- *
- * @param dataType Data type is a predefined type which the programmer should choose according to the object he
- * is going to save in to registry
- * @param identifier Identifier which will uniquely identify the data model. For example, in Experiment_Basic_Type,
- * identifier will be generated experimentID
- */
- @Override
- public void remove(RegistryModelType dataType, Object identifier) throws RegistryException {
- try {
- switch (dataType) {
- case PROJECT:
- projectRegistry.removeProject((String)identifier);
- break;
- case GATEWAY:
- gatewayRegistry.removeGateway((String)identifier);
- break;
- case EXPERIMENT:
- experimentRegistry.removeExperiment((String) identifier);
- break;
- case EXPERIMENT_CONFIGURATION_DATA:
- experimentRegistry.removeExperimentConfigData((String) identifier);
- break;
- case WORKFLOW_NODE_DETAIL:
- experimentRegistry.removeWorkflowNode((String) identifier);
- break;
- case TASK_DETAIL:
- experimentRegistry.removeTaskDetails((String) identifier);
- break;
- case JOB_DETAIL:
- experimentRegistry.removeJobDetails((CompositeIdentifier) identifier);
- break;
- case DATA_TRANSFER_DETAIL:
- experimentRegistry.removeDataTransferDetails((String) identifier);
- break;
- case COMPUTATIONAL_RESOURCE_SCHEDULING:
- experimentRegistry.removeComputationalScheduling(dataType, (String) identifier);
- break;
- case ADVANCE_OUTPUT_DATA_HANDLING:
- experimentRegistry.removeOutputDataHandling(dataType, (String) identifier);
- break;
- case ADVANCE_INPUT_DATA_HANDLING:
- experimentRegistry.removeInputDataHandling(dataType, (String) identifier);
- break;
- case QOS_PARAM:
- experimentRegistry.removeQOSParams(dataType, (String) identifier);
- break;
- default:
- logger.error("Unsupported data type...", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
- } catch (Exception e) {
- logger.error("Error while removing the resource " + dataType.toString(), new RegistryException(e));
- throw new RegistryException("Error while removing the resource " + dataType.toString(), e);
- }
-
- }
-
- /**
- * This method will check whether a given data type which can be identified with the identifier exists or not
- *
- * @param dataType Data type is a predefined type which the programmer should choose according to the object he
- * is going to save in to registry
- * @param identifier Identifier which will uniquely identify the data model. For example, in Experiment_Basic_Type,
- * identifier will be generated experimentID
- * @return whether the given data type exists or not
- */
- @Override
- public boolean isExist(RegistryModelType dataType, Object identifier) throws RegistryException {
- try {
- switch (dataType) {
- case PROJECT:
- return projectRegistry.isProjectExist((String)identifier);
- case GATEWAY:
- return gatewayRegistry.isGatewayExist((String)identifier);
- case EXPERIMENT:
- return experimentRegistry.isExperimentExist((String) identifier);
- case EXPERIMENT_CONFIGURATION_DATA:
- return experimentRegistry.isExperimentConfigDataExist((String) identifier);
- case WORKFLOW_NODE_DETAIL:
- return experimentRegistry.isWFNodeExist((String) identifier);
- case TASK_DETAIL:
- return experimentRegistry.isTaskDetailExist((String) identifier);
- case JOB_DETAIL:
- return experimentRegistry.isJobDetailExist((CompositeIdentifier) identifier);
- case DATA_TRANSFER_DETAIL:
- return experimentRegistry.isTransferDetailExist((String) identifier);
- case COMPUTATIONAL_RESOURCE_SCHEDULING:
- return experimentRegistry.isComputationalSchedulingExist(dataType, (String) identifier);
- case ADVANCE_INPUT_DATA_HANDLING:
- return experimentRegistry.isInputDataHandlingExist(dataType, (String) identifier);
- case ADVANCE_OUTPUT_DATA_HANDLING:
- return experimentRegistry.isOutputDataHandlingExist(dataType, (String) identifier);
- case QOS_PARAM:
- return experimentRegistry.isQOSParamsExist(dataType, (String) identifier);
- default:
- logger.error("Unsupported data type...", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
- } catch (Exception e) {
- logger.error("Error while checking existence of the resource " + dataType.toString(), new RegistryException(e));
- throw new RegistryException("Error while checking existence of the resource " + dataType.toString(), e);
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/impl/UserReg.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/impl/UserReg.java b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/impl/UserReg.java
deleted file mode 100644
index 67166e2..0000000
--- a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/impl/UserReg.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- *
- * 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.experiment.catalog.impl;
-
-import org.apache.airavata.common.exception.ApplicationSettingsException;
-import org.apache.airavata.common.utils.ServerSettings;
-import org.apache.airavata.experiment.catalog.ResourceUtils;
-import org.apache.airavata.experiment.catalog.resources.WorkerResource;
-import org.apache.airavata.registry.cpi.RegistryException;
-
-public class UserReg {
- public WorkerResource getSystemUser() throws ApplicationSettingsException, RegistryException {
- return (WorkerResource)ResourceUtils.getWorker(ServerSettings.getDefaultUserGateway(), ServerSettings.getDefaultUser());
- }
-
- public WorkerResource getExistingUser (String gatewayName, String userName) throws RegistryException {
- return (WorkerResource)ResourceUtils.getWorker(gatewayName, userName);
- }
-
-
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/AdvancedInputDataHandling.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/AdvancedInputDataHandling.java b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/AdvancedInputDataHandling.java
deleted file mode 100644
index 87fb256..0000000
--- a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/AdvancedInputDataHandling.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- *
- * 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.experiment.catalog.model;
-
-import org.apache.openjpa.persistence.DataCache;
-
-import javax.persistence.*;
-import java.io.Serializable;
-
-@DataCache
-@Entity
-@Table(name = "ADVANCE_INPUT_DATA_HANDLING")
-public class AdvancedInputDataHandling implements Serializable {
- @Id
- @GeneratedValue
- @Column(name = "INPUT_DATA_HANDLING_ID")
- private int dataHandlingId;
- @Column(name = "EXPERIMENT_ID")
- private String expId;
- @Column(name = "TASK_ID")
- private String taskId;
- @Column(name = "WORKING_DIR_PARENT")
- private String parentWorkingDir;
- @Column(name = "UNIQUE_WORKING_DIR")
- private String workingDir;
- @Column(name = "STAGE_INPUT_FILES_TO_WORKING_DIR")
- private boolean stageInputsToWorkingDir;
- @Column(name = "CLEAN_AFTER_JOB")
- private boolean cleanAfterJob;
-
- @ManyToOne(cascade= CascadeType.MERGE)
- @JoinColumn(name = "EXPERIMENT_ID")
- private Experiment experiment;
-
- @ManyToOne(cascade= CascadeType.MERGE)
- @JoinColumn(name = "TASK_ID")
- private TaskDetail task;
-
- public int getDataHandlingId() {
- return dataHandlingId;
- }
-
- public void setDataHandlingId(int dataHandlingId) {
- this.dataHandlingId = dataHandlingId;
- }
-
- public String getExpId() {
- return expId;
- }
-
- public void setExpId(String expId) {
- this.expId = expId;
- }
-
- public String getTaskId() {
- return taskId;
- }
-
- public void setTaskId(String taskId) {
- this.taskId = taskId;
- }
-
- public String getParentWorkingDir() {
- return parentWorkingDir;
- }
-
- public void setParentWorkingDir(String parentWorkingDir) {
- this.parentWorkingDir = parentWorkingDir;
- }
-
- public String getWorkingDir() {
- return workingDir;
- }
-
- public void setWorkingDir(String workingDir) {
- this.workingDir = workingDir;
- }
-
- public boolean isStageInputsToWorkingDir() {
- return stageInputsToWorkingDir;
- }
-
- public void setStageInputsToWorkingDir(boolean stageInputsToWorkingDir) {
- this.stageInputsToWorkingDir = stageInputsToWorkingDir;
- }
-
- public boolean isCleanAfterJob() {
- return cleanAfterJob;
- }
-
- public void setCleanAfterJob(boolean cleanAfterJob) {
- this.cleanAfterJob = cleanAfterJob;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/AdvancedOutputDataHandling.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/AdvancedOutputDataHandling.java b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/AdvancedOutputDataHandling.java
deleted file mode 100644
index e3a35b4..0000000
--- a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/AdvancedOutputDataHandling.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- *
- * 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.experiment.catalog.model;
-
-import org.apache.openjpa.persistence.DataCache;
-
-import javax.persistence.*;
-import java.io.Serializable;
-
-@DataCache
-@Entity
-@Table(name = "ADVANCE_OUTPUT_DATA_HANDLING")
-public class AdvancedOutputDataHandling implements Serializable {
- @Id
- @GeneratedValue
- @Column(name = "OUTPUT_DATA_HANDLING_ID")
- private int outputDataHandlingId;
- @Column(name = "EXPERIMENT_ID")
- private String expId;
- @Column(name = "TASK_ID")
- private String taskId;
- @Column(name = "OUTPUT_DATA_DIR")
- private String outputDataDir;
- @Column(name = "DATA_REG_URL")
- private String dataRegUrl;
- @Column(name = "PERSIST_OUTPUT_DATA")
- private boolean persistOutputData;
-
- @ManyToOne(cascade= CascadeType.MERGE)
- @JoinColumn(name = "EXPERIMENT_ID")
- private Experiment experiment;
-
- @ManyToOne(cascade= CascadeType.MERGE)
- @JoinColumn(name = "TASK_ID")
- private TaskDetail task;
-
- public int getOutputDataHandlingId() {
- return outputDataHandlingId;
- }
-
- public void setOutputDataHandlingId(int outputDataHandlingId) {
- this.outputDataHandlingId = outputDataHandlingId;
- }
-
- public String getExpId() {
- return expId;
- }
-
- public void setExpId(String expId) {
- this.expId = expId;
- }
-
- public String getTaskId() {
- return taskId;
- }
-
- public void setTaskId(String taskId) {
- this.taskId = taskId;
- }
-
- public String getOutputDataDir() {
- return outputDataDir;
- }
-
- public void setOutputDataDir(String outputDataDir) {
- this.outputDataDir = outputDataDir;
- }
-
- public String getDataRegUrl() {
- return dataRegUrl;
- }
-
- public void setDataRegUrl(String dataRegUrl) {
- this.dataRegUrl = dataRegUrl;
- }
-
- public boolean isPersistOutputData() {
- return persistOutputData;
- }
-
- public void setPersistOutputData(boolean persistOutputData) {
- this.persistOutputData = persistOutputData;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/ApplicationInput.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/ApplicationInput.java b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/ApplicationInput.java
deleted file mode 100644
index 89cdf76..0000000
--- a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/ApplicationInput.java
+++ /dev/null
@@ -1,165 +0,0 @@
-/*
- *
- * 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.experiment.catalog.model;
-
-import org.apache.openjpa.persistence.DataCache;
-
-import javax.persistence.*;
-import java.io.Serializable;
-
-@DataCache
-@Entity
-@Table(name = "APPLICATION_INPUT")
-@IdClass(ApplicationInput_PK.class)
-public class ApplicationInput implements Serializable {
- @Id
- @Column(name = "TASK_ID")
- private String taskId;
- @Id
- @Column(name = "INPUT_KEY")
- private String inputKey;
- @Column(name = "DATA_TYPE")
- private String dataType;
- @Column(name = "METADATA")
- private String metadata;
- @Lob
- @Column(name = "VALUE")
- private char[] value;
- @Column(name = "APP_ARGUMENT")
- private String appArgument;
-
- @Column(name = "INPUT_ORDER")
- private int inputOrder;
-
- @Column(name = "STANDARD_INPUT")
- private boolean standardInput;
-
- @Column(name = "USER_FRIENDLY_DESC")
- private String userFriendlyDesc;
-
- @Column(name="IS_REQUIRED")
- private boolean isRequired;
- @Column(name="REQUIRED_TO_COMMANDLINE")
- private boolean requiredToCMD;
- @Column(name = "DATA_STAGED")
- private boolean dataStaged;
-
- @ManyToOne(cascade= CascadeType.MERGE)
- @JoinColumn(name = "TASK_ID")
- private TaskDetail task;
-
- public int getInputOrder() {
- return inputOrder;
- }
-
- public void setInputOrder(int inputOrder) {
- this.inputOrder = inputOrder;
- }
-
- public String getTaskId() {
- return taskId;
- }
-
- public void setTaskId(String taskId) {
- this.taskId = taskId;
- }
-
- public String getInputKey() {
- return inputKey;
- }
-
- public void setInputKey(String inputKey) {
- this.inputKey = inputKey;
- }
-
- public String getDataType() {
- return dataType;
- }
-
- public void setDataType(String dataType) {
- this.dataType = dataType;
- }
-
- public String getMetadata() {
- return metadata;
- }
-
- public void setMetadata(String metadata) {
- this.metadata = metadata;
- }
-
- public char[] getValue() {
- return value;
- }
-
- public void setValue(char[] value) {
- this.value = value;
- }
-
- public String getAppArgument() {
- return appArgument;
- }
-
- public void setAppArgument(String appArgument) {
- this.appArgument = appArgument;
- }
-
- public boolean isStandardInput() {
- return standardInput;
- }
-
- public void setStandardInput(boolean standardInput) {
- this.standardInput = standardInput;
- }
-
- public String getUserFriendlyDesc() {
- return userFriendlyDesc;
- }
-
- public void setUserFriendlyDesc(String userFriendlyDesc) {
- this.userFriendlyDesc = userFriendlyDesc;
- }
-
- public boolean isRequired() {
- return isRequired;
- }
-
- public void setRequired(boolean isRequired) {
- this.isRequired = isRequired;
- }
-
- public boolean isRequiredToCMD() {
- return requiredToCMD;
- }
-
- public void setRequiredToCMD(boolean requiredToCMD) {
- this.requiredToCMD = requiredToCMD;
- }
-
- public boolean isDataStaged() {
- return dataStaged;
- }
-
- public void setDataStaged(boolean dataStaged) {
- this.dataStaged = dataStaged;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/ApplicationInput_PK.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/ApplicationInput_PK.java b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/ApplicationInput_PK.java
deleted file mode 100644
index 84979b4..0000000
--- a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/ApplicationInput_PK.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- *
- * 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.experiment.catalog.model;
-
-import java.io.Serializable;
-
-public class ApplicationInput_PK implements Serializable {
- private String taskId;
- private String inputKey;
-
- public ApplicationInput_PK(String inputKey, String taskId) {
- this.inputKey = inputKey;
- this.taskId = taskId;
- }
-
- public ApplicationInput_PK() {
- ;
- }
-
- @Override
- public boolean equals(Object o) {
- return false;
- }
-
- @Override
- public int hashCode() {
- return 1;
- }
-
-
- public String getTaskId() {
- return taskId;
- }
-
- public void setTaskId(String taskId) {
- this.taskId = taskId;
- }
-
- public String getInputKey() {
- return inputKey;
- }
-
- public void setInputKey(String inputKey) {
- this.inputKey = inputKey;
- }
-}
[08/52] [abbrv] [partial] airavata git commit: registry refactoring
Posted by sh...@apache.org.
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/LibraryApendPathAppCatalogResourceAppCat.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/LibraryApendPathAppCatalogResourceAppCat.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/LibraryApendPathAppCatalogResourceAppCat.java
new file mode 100644
index 0000000..e7e83ce
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/LibraryApendPathAppCatalogResourceAppCat.java
@@ -0,0 +1,292 @@
+/*
+ *
+ * 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.ApplicationDeployment;
+import org.apache.airavata.registry.core.app.catalog.model.LibraryApendPath;
+import org.apache.airavata.registry.core.app.catalog.model.LibraryApendPath_PK;
+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 LibraryApendPathAppCatalogResourceAppCat extends AppCatAbstractResource {
+ private final static Logger logger = LoggerFactory.getLogger(LibraryApendPathAppCatalogResourceAppCat.class);
+ private String deploymentId;
+ private String name;
+ private String value;
+ private AppDeploymentAppCatalogResourceAppCat appDeploymentResource;
+
+ public String getDeploymentId() {
+ return deploymentId;
+ }
+
+ public void setDeploymentId(String deploymentId) {
+ this.deploymentId = deploymentId;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getValue() {
+ return value;
+ }
+
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+ public AppDeploymentAppCatalogResourceAppCat getAppDeploymentResource() {
+ return appDeploymentResource;
+ }
+
+ public void setAppDeploymentResource(AppDeploymentAppCatalogResourceAppCat appDeploymentResource) {
+ this.appDeploymentResource = appDeploymentResource;
+ }
+
+ @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(LIBRARY_APEND_PATH);
+ generator.setParameter(LibraryApendPathConstants.DEPLOYMENT_ID, ids.get(LibraryApendPathConstants.DEPLOYMENT_ID));
+ if (ids.get(LibraryApendPathConstants.NAME) != null){
+ generator.setParameter(LibraryApendPathConstants.NAME, ids.get(LibraryApendPathConstants.NAME));
+ }
+ 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(LIBRARY_APEND_PATH);
+ generator.setParameter(LibraryApendPathConstants.DEPLOYMENT_ID, ids.get(LibraryApendPathConstants.DEPLOYMENT_ID));
+ generator.setParameter(LibraryApendPathConstants.NAME, ids.get(LibraryApendPathConstants.NAME));
+ Query q = generator.selectQuery(em);
+ LibraryApendPath libraryApendPath = (LibraryApendPath) q.getSingleResult();
+ LibraryApendPathAppCatalogResourceAppCat resource =
+ (LibraryApendPathAppCatalogResourceAppCat) AppCatalogJPAUtils.getResource(AppCatalogResourceType.LIBRARY_APEND_PATH, libraryApendPath);
+ em.getTransaction().commit();
+ em.close();
+ return resource;
+ } 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> libApPathList = new ArrayList<AppCatalogResource>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ Query q;
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(LIBRARY_APEND_PATH);
+ List results;
+ if (fieldName.equals(LibraryApendPathConstants.DEPLOYMENT_ID)) {
+ generator.setParameter(LibraryApendPathConstants.DEPLOYMENT_ID, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ LibraryApendPath prepandPath = (LibraryApendPath) result;
+ LibraryApendPathAppCatalogResourceAppCat resource =
+ (LibraryApendPathAppCatalogResourceAppCat) AppCatalogJPAUtils.getResource(AppCatalogResourceType.LIBRARY_APEND_PATH, prepandPath);
+ libApPathList.add(resource);
+ }
+ }
+ } else if (fieldName.equals(LibraryApendPathConstants.NAME)) {
+ generator.setParameter(LibraryApendPathConstants.NAME, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ LibraryApendPath prepandPath = (LibraryApendPath) result;
+ LibraryApendPathAppCatalogResourceAppCat resource =
+ (LibraryApendPathAppCatalogResourceAppCat) AppCatalogJPAUtils.getResource(AppCatalogResourceType.LIBRARY_APEND_PATH, prepandPath);
+ libApPathList.add(resource);
+ }
+ }
+ }else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for libraryApendPath resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for libraryApendPath 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 libApPathList;
+ }
+
+ @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();
+ LibraryApendPath existigApendPath = em.find(LibraryApendPath.class, new LibraryApendPath_PK(deploymentId, name));
+ em.close();
+
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+
+ ApplicationDeployment deployment = em.find(ApplicationDeployment.class, deploymentId);
+ if (existigApendPath != null){
+ existigApendPath.setValue(value);
+ existigApendPath.setApplicationDeployment(deployment);
+ em.merge(existigApendPath);
+ }else {
+ LibraryApendPath apendPath = new LibraryApendPath();
+ apendPath.setDeploymentID(deploymentId);
+ apendPath.setName(name);
+ apendPath.setValue(value);
+ apendPath.setApplicationDeployment(deployment);
+ em.persist(apendPath);
+ }
+ 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();
+ LibraryApendPath apendPath = em.find(LibraryApendPath.class,
+ new LibraryApendPath_PK(ids.get(LibraryApendPathConstants.DEPLOYMENT_ID),
+ ids.get(LibraryApendPathConstants.NAME)));
+ em.close();
+ return apendPath != null;
+ } 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();
+ }
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/LibraryApendPathResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/LibraryApendPathResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/LibraryApendPathResource.java
new file mode 100644
index 0000000..1f2286d
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/LibraryApendPathResource.java
@@ -0,0 +1,292 @@
+/*
+ *
+ * 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.aiaravata.application.catalog.data.resources;
+
+import org.airavata.appcatalog.cpi.AppCatalogException;
+import org.apache.aiaravata.application.catalog.data.model.ApplicationDeployment;
+import org.apache.aiaravata.application.catalog.data.model.LibraryApendPath;
+import org.apache.aiaravata.application.catalog.data.model.LibraryApendPath_PK;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogJPAUtils;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogQueryGenerator;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogResourceType;
+import org.apache.airavata.common.exception.ApplicationSettingsException;
+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 LibraryApendPathResource extends AbstractResource {
+ private final static Logger logger = LoggerFactory.getLogger(LibraryApendPathResource.class);
+ private String deploymentId;
+ private String name;
+ private String value;
+ private AppDeploymentResource appDeploymentResource;
+
+ public String getDeploymentId() {
+ return deploymentId;
+ }
+
+ public void setDeploymentId(String deploymentId) {
+ this.deploymentId = deploymentId;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getValue() {
+ return value;
+ }
+
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+ public AppDeploymentResource getAppDeploymentResource() {
+ return appDeploymentResource;
+ }
+
+ public void setAppDeploymentResource(AppDeploymentResource appDeploymentResource) {
+ this.appDeploymentResource = appDeploymentResource;
+ }
+
+ @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(LIBRARY_APEND_PATH);
+ generator.setParameter(LibraryApendPathConstants.DEPLOYMENT_ID, ids.get(LibraryApendPathConstants.DEPLOYMENT_ID));
+ if (ids.get(LibraryApendPathConstants.NAME) != null){
+ generator.setParameter(LibraryApendPathConstants.NAME, ids.get(LibraryApendPathConstants.NAME));
+ }
+ 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 Resource 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(LIBRARY_APEND_PATH);
+ generator.setParameter(LibraryApendPathConstants.DEPLOYMENT_ID, ids.get(LibraryApendPathConstants.DEPLOYMENT_ID));
+ generator.setParameter(LibraryApendPathConstants.NAME, ids.get(LibraryApendPathConstants.NAME));
+ Query q = generator.selectQuery(em);
+ LibraryApendPath libraryApendPath = (LibraryApendPath) q.getSingleResult();
+ LibraryApendPathResource resource =
+ (LibraryApendPathResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.LIBRARY_APEND_PATH, libraryApendPath);
+ em.getTransaction().commit();
+ em.close();
+ return resource;
+ } 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<Resource> get(String fieldName, Object value) throws AppCatalogException {
+ List<Resource> libApPathList = new ArrayList<Resource>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ Query q;
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(LIBRARY_APEND_PATH);
+ List results;
+ if (fieldName.equals(LibraryApendPathConstants.DEPLOYMENT_ID)) {
+ generator.setParameter(LibraryApendPathConstants.DEPLOYMENT_ID, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ LibraryApendPath prepandPath = (LibraryApendPath) result;
+ LibraryApendPathResource resource =
+ (LibraryApendPathResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.LIBRARY_APEND_PATH, prepandPath);
+ libApPathList.add(resource);
+ }
+ }
+ } else if (fieldName.equals(LibraryApendPathConstants.NAME)) {
+ generator.setParameter(LibraryApendPathConstants.NAME, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ LibraryApendPath prepandPath = (LibraryApendPath) result;
+ LibraryApendPathResource resource =
+ (LibraryApendPathResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.LIBRARY_APEND_PATH, prepandPath);
+ libApPathList.add(resource);
+ }
+ }
+ }else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for libraryApendPath resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for libraryApendPath 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 libApPathList;
+ }
+
+ @Override
+ public List<Resource> 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();
+ LibraryApendPath existigApendPath = em.find(LibraryApendPath.class, new LibraryApendPath_PK(deploymentId, name));
+ em.close();
+
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+
+ ApplicationDeployment deployment = em.find(ApplicationDeployment.class, deploymentId);
+ if (existigApendPath != null){
+ existigApendPath.setValue(value);
+ existigApendPath.setApplicationDeployment(deployment);
+ em.merge(existigApendPath);
+ }else {
+ LibraryApendPath apendPath = new LibraryApendPath();
+ apendPath.setDeploymentID(deploymentId);
+ apendPath.setName(name);
+ apendPath.setValue(value);
+ apendPath.setApplicationDeployment(deployment);
+ em.persist(apendPath);
+ }
+ 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();
+ LibraryApendPath apendPath = em.find(LibraryApendPath.class,
+ new LibraryApendPath_PK(ids.get(LibraryApendPathConstants.DEPLOYMENT_ID),
+ ids.get(LibraryApendPathConstants.NAME)));
+ em.close();
+ return apendPath != null;
+ } 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();
+ }
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/LibraryPrepandPathAppCatalogResourceAppCat.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/LibraryPrepandPathAppCatalogResourceAppCat.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/LibraryPrepandPathAppCatalogResourceAppCat.java
new file mode 100644
index 0000000..799b0b3
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/LibraryPrepandPathAppCatalogResourceAppCat.java
@@ -0,0 +1,291 @@
+/*
+ *
+ * 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.ApplicationDeployment;
+import org.apache.airavata.registry.core.app.catalog.model.LibraryPrepandPath;
+import org.apache.airavata.registry.core.app.catalog.model.LibraryPrepandPath_PK;
+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 LibraryPrepandPathAppCatalogResourceAppCat extends AppCatAbstractResource {
+ private final static Logger logger = LoggerFactory.getLogger(LibraryPrepandPathAppCatalogResourceAppCat.class);
+ private String deploymentId;
+ private String name;
+ private String value;
+ private AppDeploymentAppCatalogResourceAppCat appDeploymentResource;
+
+ public String getDeploymentId() {
+ return deploymentId;
+ }
+
+ public void setDeploymentId(String deploymentId) {
+ this.deploymentId = deploymentId;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getValue() {
+ return value;
+ }
+
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+ public AppDeploymentAppCatalogResourceAppCat getAppDeploymentResource() {
+ return appDeploymentResource;
+ }
+
+ public void setAppDeploymentResource(AppDeploymentAppCatalogResourceAppCat appDeploymentResource) {
+ this.appDeploymentResource = appDeploymentResource;
+ }
+
+ @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(LIBRARY_PREPAND_PATH);
+ generator.setParameter(LibraryPrepandPathConstants.DEPLOYMENT_ID, ids.get(LibraryPrepandPathConstants.DEPLOYMENT_ID));
+ if (ids.get(LibraryPrepandPathConstants.NAME) != null){
+ generator.setParameter(LibraryPrepandPathConstants.NAME, ids.get(LibraryPrepandPathConstants.NAME));
+ }
+ 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(LIBRARY_PREPAND_PATH);
+ generator.setParameter(LibraryPrepandPathConstants.DEPLOYMENT_ID, ids.get(LibraryPrepandPathConstants.DEPLOYMENT_ID));
+ generator.setParameter(LibraryPrepandPathConstants.NAME, ids.get(LibraryPrepandPathConstants.NAME));
+ Query q = generator.selectQuery(em);
+ LibraryPrepandPath libraryPrepandPath = (LibraryPrepandPath) q.getSingleResult();
+ LibraryPrepandPathAppCatalogResourceAppCat resource =
+ (LibraryPrepandPathAppCatalogResourceAppCat) AppCatalogJPAUtils.getResource(AppCatalogResourceType.LIBRARY_PREPAND_PATH, libraryPrepandPath);
+ em.getTransaction().commit();
+ em.close();
+ return resource;
+ } 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> libPrepPathList = new ArrayList<AppCatalogResource>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ Query q;
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(LIBRARY_PREPAND_PATH);
+ List results;
+ if (fieldName.equals(LibraryPrepandPathConstants.DEPLOYMENT_ID)) {
+ generator.setParameter(LibraryPrepandPathConstants.DEPLOYMENT_ID, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ LibraryPrepandPath prepandPath = (LibraryPrepandPath) result;
+ LibraryPrepandPathAppCatalogResourceAppCat resource =
+ (LibraryPrepandPathAppCatalogResourceAppCat) AppCatalogJPAUtils.getResource(AppCatalogResourceType.LIBRARY_PREPAND_PATH, prepandPath);
+ libPrepPathList.add(resource);
+ }
+ }
+ } else if (fieldName.equals(LibraryPrepandPathConstants.NAME)) {
+ generator.setParameter(LibraryPrepandPathConstants.NAME, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ LibraryPrepandPath prepandPath = (LibraryPrepandPath) result;
+ LibraryPrepandPathAppCatalogResourceAppCat resource =
+ (LibraryPrepandPathAppCatalogResourceAppCat) AppCatalogJPAUtils.getResource(AppCatalogResourceType.LIBRARY_PREPAND_PATH, prepandPath);
+ libPrepPathList.add(resource);
+ }
+ }
+ }else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for libraryPrepandPath resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for libraryPrepandPath 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 libPrepPathList;
+ }
+
+ @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();
+ LibraryPrepandPath existigPrepPath = em.find(LibraryPrepandPath.class, new LibraryPrepandPath_PK(deploymentId, name));
+ em.close();
+
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ ApplicationDeployment deployment = em.find(ApplicationDeployment.class, deploymentId);
+ if (existigPrepPath != null){
+ existigPrepPath.setValue(value);
+ existigPrepPath.setApplicationDeployment(deployment);
+ em.merge(existigPrepPath);
+ }else {
+ LibraryPrepandPath prepandPath = new LibraryPrepandPath();
+ prepandPath.setDeploymentID(deploymentId);
+ prepandPath.setName(name);
+ prepandPath.setValue(value);
+ prepandPath.setApplicationDeployment(deployment);
+ em.persist(prepandPath);
+ }
+ 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();
+ LibraryPrepandPath prepandPath = em.find(LibraryPrepandPath.class,
+ new LibraryPrepandPath_PK(ids.get(LibraryPrepandPathConstants.DEPLOYMENT_ID),
+ ids.get(LibraryPrepandPathConstants.NAME)));
+ em.close();
+ return prepandPath != null;
+ } 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();
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/LibraryPrepandPathResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/LibraryPrepandPathResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/LibraryPrepandPathResource.java
new file mode 100644
index 0000000..e4a9b33
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/LibraryPrepandPathResource.java
@@ -0,0 +1,291 @@
+/*
+ *
+ * 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.aiaravata.application.catalog.data.resources;
+
+import org.airavata.appcatalog.cpi.AppCatalogException;
+import org.apache.aiaravata.application.catalog.data.model.ApplicationDeployment;
+import org.apache.aiaravata.application.catalog.data.model.LibraryPrepandPath;
+import org.apache.aiaravata.application.catalog.data.model.LibraryPrepandPath_PK;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogJPAUtils;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogQueryGenerator;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogResourceType;
+import org.apache.airavata.common.exception.ApplicationSettingsException;
+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 LibraryPrepandPathResource extends AbstractResource {
+ private final static Logger logger = LoggerFactory.getLogger(LibraryPrepandPathResource.class);
+ private String deploymentId;
+ private String name;
+ private String value;
+ private AppDeploymentResource appDeploymentResource;
+
+ public String getDeploymentId() {
+ return deploymentId;
+ }
+
+ public void setDeploymentId(String deploymentId) {
+ this.deploymentId = deploymentId;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getValue() {
+ return value;
+ }
+
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+ public AppDeploymentResource getAppDeploymentResource() {
+ return appDeploymentResource;
+ }
+
+ public void setAppDeploymentResource(AppDeploymentResource appDeploymentResource) {
+ this.appDeploymentResource = appDeploymentResource;
+ }
+
+ @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(LIBRARY_PREPAND_PATH);
+ generator.setParameter(LibraryPrepandPathConstants.DEPLOYMENT_ID, ids.get(LibraryPrepandPathConstants.DEPLOYMENT_ID));
+ if (ids.get(LibraryPrepandPathConstants.NAME) != null){
+ generator.setParameter(LibraryPrepandPathConstants.NAME, ids.get(LibraryPrepandPathConstants.NAME));
+ }
+ 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 Resource 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(LIBRARY_PREPAND_PATH);
+ generator.setParameter(LibraryPrepandPathConstants.DEPLOYMENT_ID, ids.get(LibraryPrepandPathConstants.DEPLOYMENT_ID));
+ generator.setParameter(LibraryPrepandPathConstants.NAME, ids.get(LibraryPrepandPathConstants.NAME));
+ Query q = generator.selectQuery(em);
+ LibraryPrepandPath libraryPrepandPath = (LibraryPrepandPath) q.getSingleResult();
+ LibraryPrepandPathResource resource =
+ (LibraryPrepandPathResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.LIBRARY_PREPAND_PATH, libraryPrepandPath);
+ em.getTransaction().commit();
+ em.close();
+ return resource;
+ } 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<Resource> get(String fieldName, Object value) throws AppCatalogException {
+ List<Resource> libPrepPathList = new ArrayList<Resource>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ Query q;
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(LIBRARY_PREPAND_PATH);
+ List results;
+ if (fieldName.equals(LibraryPrepandPathConstants.DEPLOYMENT_ID)) {
+ generator.setParameter(LibraryPrepandPathConstants.DEPLOYMENT_ID, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ LibraryPrepandPath prepandPath = (LibraryPrepandPath) result;
+ LibraryPrepandPathResource resource =
+ (LibraryPrepandPathResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.LIBRARY_PREPAND_PATH, prepandPath);
+ libPrepPathList.add(resource);
+ }
+ }
+ } else if (fieldName.equals(LibraryPrepandPathConstants.NAME)) {
+ generator.setParameter(LibraryPrepandPathConstants.NAME, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ LibraryPrepandPath prepandPath = (LibraryPrepandPath) result;
+ LibraryPrepandPathResource resource =
+ (LibraryPrepandPathResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.LIBRARY_PREPAND_PATH, prepandPath);
+ libPrepPathList.add(resource);
+ }
+ }
+ }else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for libraryPrepandPath resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for libraryPrepandPath 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 libPrepPathList;
+ }
+
+ @Override
+ public List<Resource> 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();
+ LibraryPrepandPath existigPrepPath = em.find(LibraryPrepandPath.class, new LibraryPrepandPath_PK(deploymentId, name));
+ em.close();
+
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ ApplicationDeployment deployment = em.find(ApplicationDeployment.class, deploymentId);
+ if (existigPrepPath != null){
+ existigPrepPath.setValue(value);
+ existigPrepPath.setApplicationDeployment(deployment);
+ em.merge(existigPrepPath);
+ }else {
+ LibraryPrepandPath prepandPath = new LibraryPrepandPath();
+ prepandPath.setDeploymentID(deploymentId);
+ prepandPath.setName(name);
+ prepandPath.setValue(value);
+ prepandPath.setApplicationDeployment(deployment);
+ em.persist(prepandPath);
+ }
+ 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();
+ LibraryPrepandPath prepandPath = em.find(LibraryPrepandPath.class,
+ new LibraryPrepandPath_PK(ids.get(LibraryPrepandPathConstants.DEPLOYMENT_ID),
+ ids.get(LibraryPrepandPathConstants.NAME)));
+ em.close();
+ return prepandPath != null;
+ } 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();
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/LocalDataMovementAppCatalogResourceAppCat.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/LocalDataMovementAppCatalogResourceAppCat.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/LocalDataMovementAppCatalogResourceAppCat.java
new file mode 100644
index 0000000..7d71abf
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/LocalDataMovementAppCatalogResourceAppCat.java
@@ -0,0 +1,249 @@
+/*
+ *
+ * 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 java.util.ArrayList;
+import java.util.List;
+
+import javax.persistence.EntityManager;
+import javax.persistence.Query;
+
+import org.apache.airavata.common.exception.ApplicationSettingsException;
+import org.apache.airavata.registry.core.app.catalog.model.LocalDataMovement;
+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;
+
+public class LocalDataMovementAppCatalogResourceAppCat extends AppCatAbstractResource {
+ private final static Logger logger = LoggerFactory.getLogger(LocalDataMovementAppCatalogResourceAppCat.class);
+ private String dataMovementInterfaceId;
+
+ @Override
+ public void remove(Object identifier) throws AppCatalogException {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(LOCAL_DATA_MOVEMENT);
+ generator.setParameter(LocalDataMovementConstants.DATA_MOVEMENT_INTERFACE_ID, identifier);
+ 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 {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(LOCAL_DATA_MOVEMENT);
+ generator.setParameter(LocalDataMovementConstants.DATA_MOVEMENT_INTERFACE_ID, identifier);
+ Query q = generator.selectQuery(em);
+ LocalDataMovement localDataMovement = (LocalDataMovement) q.getSingleResult();
+ LocalDataMovementAppCatalogResourceAppCat localDataMovementResource = (LocalDataMovementAppCatalogResourceAppCat) AppCatalogJPAUtils.getResource(AppCatalogResourceType.LOCAL_DATA_MOVEMENT, localDataMovement);
+ em.getTransaction().commit();
+ em.close();
+ return localDataMovementResource;
+ } 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> localDataMovementResources = new ArrayList<AppCatalogResource>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(LOCAL_DATA_MOVEMENT);
+ Query q;
+ if ((fieldName.equals(LocalDataMovementConstants.DATA_MOVEMENT_INTERFACE_ID))) {
+ generator.setParameter(fieldName, value);
+ q = generator.selectQuery(em);
+ List<?> results = q.getResultList();
+ for (Object result : results) {
+ LocalDataMovement localDataMovement = (LocalDataMovement) result;
+ LocalDataMovementAppCatalogResourceAppCat localDataMovementResource = (LocalDataMovementAppCatalogResourceAppCat) AppCatalogJPAUtils.getResource(AppCatalogResourceType.LOCAL_DATA_MOVEMENT, localDataMovement);
+ localDataMovementResources.add(localDataMovementResource);
+ }
+ } else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for Local Data Movement Resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for Local Data Movement Resource.");
+ }
+ 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();
+ }
+ }
+ return localDataMovementResources;
+ }
+
+ @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 {
+ List<String> localDataMovementResourceIDs = new ArrayList<String>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(LOCAL_DATA_MOVEMENT);
+ Query q;
+ if ((fieldName.equals(LocalDataMovementConstants.DATA_MOVEMENT_INTERFACE_ID))) {
+ generator.setParameter(fieldName, value);
+ q = generator.selectQuery(em);
+ List<?> results = q.getResultList();
+ for (Object result : results) {
+ LocalDataMovement localDataMovement = (LocalDataMovement) result;
+ LocalDataMovementAppCatalogResourceAppCat localDataMovementResource = (LocalDataMovementAppCatalogResourceAppCat) AppCatalogJPAUtils.getResource(AppCatalogResourceType.LOCAL_DATA_MOVEMENT, localDataMovement);
+ localDataMovementResourceIDs.add(localDataMovementResource.getDataMovementInterfaceId());
+ }
+ } else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for Local Data Movement Resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for Local Data Movement Resource.");
+ }
+ 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();
+ }
+ }
+ return localDataMovementResourceIDs;
+ }
+
+ @Override
+ public void save() throws AppCatalogException {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ LocalDataMovement existingLocalDataMovement = em.find(LocalDataMovement.class, dataMovementInterfaceId);
+ em.close();
+ LocalDataMovement localDataMovement;
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ if (existingLocalDataMovement == null) {
+ localDataMovement = new LocalDataMovement();
+ } else {
+ localDataMovement = existingLocalDataMovement;
+ }
+ localDataMovement.setDataMovementInterfaceId(getDataMovementInterfaceId());
+ if (existingLocalDataMovement == null) {
+ em.persist(localDataMovement);
+ } else {
+ em.merge(localDataMovement);
+ }
+ 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 {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ LocalDataMovement localDataMovement = em.find(LocalDataMovement.class, identifier);
+ em.close();
+ return localDataMovement != null;
+ } 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();
+ }
+ }
+ }
+
+ public String getDataMovementInterfaceId() {
+ return dataMovementInterfaceId;
+ }
+
+ public void setDataMovementInterfaceId(String dataMovementInterfaceId) {
+ this.dataMovementInterfaceId=dataMovementInterfaceId;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/LocalDataMovementResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/LocalDataMovementResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/LocalDataMovementResource.java
new file mode 100644
index 0000000..a909122
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/LocalDataMovementResource.java
@@ -0,0 +1,249 @@
+/*
+ *
+ * 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.aiaravata.application.catalog.data.resources;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.persistence.EntityManager;
+import javax.persistence.Query;
+
+import org.airavata.appcatalog.cpi.AppCatalogException;
+import org.apache.aiaravata.application.catalog.data.model.LocalDataMovement;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogJPAUtils;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogQueryGenerator;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogResourceType;
+import org.apache.airavata.common.exception.ApplicationSettingsException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class LocalDataMovementResource extends AbstractResource {
+ private final static Logger logger = LoggerFactory.getLogger(LocalDataMovementResource.class);
+ private String dataMovementInterfaceId;
+
+ @Override
+ public void remove(Object identifier) throws AppCatalogException {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(LOCAL_DATA_MOVEMENT);
+ generator.setParameter(LocalDataMovementConstants.DATA_MOVEMENT_INTERFACE_ID, identifier);
+ 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 Resource get(Object identifier) throws AppCatalogException {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(LOCAL_DATA_MOVEMENT);
+ generator.setParameter(LocalDataMovementConstants.DATA_MOVEMENT_INTERFACE_ID, identifier);
+ Query q = generator.selectQuery(em);
+ LocalDataMovement localDataMovement = (LocalDataMovement) q.getSingleResult();
+ LocalDataMovementResource localDataMovementResource = (LocalDataMovementResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.LOCAL_DATA_MOVEMENT, localDataMovement);
+ em.getTransaction().commit();
+ em.close();
+ return localDataMovementResource;
+ } 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<Resource> get(String fieldName, Object value) throws AppCatalogException {
+ List<Resource> localDataMovementResources = new ArrayList<Resource>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(LOCAL_DATA_MOVEMENT);
+ Query q;
+ if ((fieldName.equals(LocalDataMovementConstants.DATA_MOVEMENT_INTERFACE_ID))) {
+ generator.setParameter(fieldName, value);
+ q = generator.selectQuery(em);
+ List<?> results = q.getResultList();
+ for (Object result : results) {
+ LocalDataMovement localDataMovement = (LocalDataMovement) result;
+ LocalDataMovementResource localDataMovementResource = (LocalDataMovementResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.LOCAL_DATA_MOVEMENT, localDataMovement);
+ localDataMovementResources.add(localDataMovementResource);
+ }
+ } else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for Local Data Movement Resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for Local Data Movement Resource.");
+ }
+ 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();
+ }
+ }
+ return localDataMovementResources;
+ }
+
+ @Override
+ public List<Resource> 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 {
+ List<String> localDataMovementResourceIDs = new ArrayList<String>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(LOCAL_DATA_MOVEMENT);
+ Query q;
+ if ((fieldName.equals(LocalDataMovementConstants.DATA_MOVEMENT_INTERFACE_ID))) {
+ generator.setParameter(fieldName, value);
+ q = generator.selectQuery(em);
+ List<?> results = q.getResultList();
+ for (Object result : results) {
+ LocalDataMovement localDataMovement = (LocalDataMovement) result;
+ LocalDataMovementResource localDataMovementResource = (LocalDataMovementResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.LOCAL_DATA_MOVEMENT, localDataMovement);
+ localDataMovementResourceIDs.add(localDataMovementResource.getDataMovementInterfaceId());
+ }
+ } else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for Local Data Movement Resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for Local Data Movement Resource.");
+ }
+ 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();
+ }
+ }
+ return localDataMovementResourceIDs;
+ }
+
+ @Override
+ public void save() throws AppCatalogException {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ LocalDataMovement existingLocalDataMovement = em.find(LocalDataMovement.class, dataMovementInterfaceId);
+ em.close();
+ LocalDataMovement localDataMovement;
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ if (existingLocalDataMovement == null) {
+ localDataMovement = new LocalDataMovement();
+ } else {
+ localDataMovement = existingLocalDataMovement;
+ }
+ localDataMovement.setDataMovementInterfaceId(getDataMovementInterfaceId());
+ if (existingLocalDataMovement == null) {
+ em.persist(localDataMovement);
+ } else {
+ em.merge(localDataMovement);
+ }
+ 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 {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ LocalDataMovement localDataMovement = em.find(LocalDataMovement.class, identifier);
+ em.close();
+ return localDataMovement != null;
+ } 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();
+ }
+ }
+ }
+
+ public String getDataMovementInterfaceId() {
+ return dataMovementInterfaceId;
+ }
+
+ public void setDataMovementInterfaceId(String dataMovementInterfaceId) {
+ this.dataMovementInterfaceId=dataMovementInterfaceId;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/LocalSubmissionAppCatalogResourceAppCat.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/LocalSubmissionAppCatalogResourceAppCat.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/LocalSubmissionAppCatalogResourceAppCat.java
new file mode 100644
index 0000000..ec03223
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/LocalSubmissionAppCatalogResourceAppCat.java
@@ -0,0 +1,293 @@
+/*
+ *
+ * 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 java.sql.Timestamp;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.persistence.EntityManager;
+import javax.persistence.Query;
+
+import org.apache.airavata.common.exception.ApplicationSettingsException;
+import org.apache.airavata.common.utils.AiravataUtils;
+import org.apache.airavata.registry.core.app.catalog.model.LocalSubmission;
+import org.apache.airavata.registry.core.app.catalog.model.ResourceJobManager;
+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;
+
+public class LocalSubmissionAppCatalogResourceAppCat extends AppCatAbstractResource {
+ private final static Logger logger = LoggerFactory.getLogger(LocalSubmissionAppCatalogResourceAppCat.class);
+ private String resourceJobManagerId;
+ private ResourceJobManagerAppCatalogResourceAppCat resourceJobManagerResource;
+ private String jobSubmissionInterfaceId;
+ private Timestamp createdTime;
+ private Timestamp updatedTime;
+
+ public Timestamp getCreatedTime() {
+ return createdTime;
+ }
+
+ public void setCreatedTime(Timestamp createdTime) {
+ this.createdTime = createdTime;
+ }
+
+ public Timestamp getUpdatedTime() {
+ return updatedTime;
+ }
+
+ public void setUpdatedTime(Timestamp updatedTime) {
+ this.updatedTime = updatedTime;
+ }
+
+ @Override
+ public void remove(Object identifier) throws AppCatalogException {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(LOCAL_SUBMISSION);
+ generator.setParameter(LocalSubmissionConstants.JOB_SUBMISSION_INTERFACE_ID, identifier);
+ 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 {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(LOCAL_SUBMISSION);
+ generator.setParameter(LocalSubmissionConstants.JOB_SUBMISSION_INTERFACE_ID, identifier);
+ Query q = generator.selectQuery(em);
+ LocalSubmission localSubmission = (LocalSubmission) q.getSingleResult();
+ LocalSubmissionAppCatalogResourceAppCat localSubmissionResource = (LocalSubmissionAppCatalogResourceAppCat) AppCatalogJPAUtils.getResource(AppCatalogResourceType.LOCAL_SUBMISSION, localSubmission);
+ em.getTransaction().commit();
+ em.close();
+ return localSubmissionResource;
+ } 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> localSubmissionResources = new ArrayList<AppCatalogResource>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(LOCAL_SUBMISSION);
+ Query q;
+ if ((fieldName.equals(LocalSubmissionConstants.RESOURCE_JOB_MANAGER_ID)) || (fieldName.equals(LocalSubmissionConstants.JOB_SUBMISSION_INTERFACE_ID))) {
+ generator.setParameter(fieldName, value);
+ q = generator.selectQuery(em);
+ List<?> results = q.getResultList();
+ for (Object result : results) {
+ LocalSubmission localSubmission = (LocalSubmission) result;
+ LocalSubmissionAppCatalogResourceAppCat localSubmissionResource = (LocalSubmissionAppCatalogResourceAppCat) AppCatalogJPAUtils.getResource(AppCatalogResourceType.LOCAL_SUBMISSION, localSubmission);
+ localSubmissionResources.add(localSubmissionResource);
+ }
+ } else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for Local Submission Resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for Local Submission Resource.");
+ }
+ 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();
+ }
+ }
+ return localSubmissionResources;
+ }
+
+ @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 {
+ List<String> localSubmissionResourceIDs = new ArrayList<String>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(LOCAL_SUBMISSION);
+ Query q;
+ if ((fieldName.equals(LocalSubmissionConstants.RESOURCE_JOB_MANAGER_ID)) || (fieldName.equals(LocalSubmissionConstants.JOB_SUBMISSION_INTERFACE_ID))) {
+ generator.setParameter(fieldName, value);
+ q = generator.selectQuery(em);
+ List<?> results = q.getResultList();
+ for (Object result : results) {
+ LocalSubmission localSubmission = (LocalSubmission) result;
+ LocalSubmissionAppCatalogResourceAppCat localSubmissionResource = (LocalSubmissionAppCatalogResourceAppCat) AppCatalogJPAUtils.getResource(AppCatalogResourceType.LOCAL_SUBMISSION, localSubmission);
+ localSubmissionResourceIDs.add(localSubmissionResource.getJobSubmissionInterfaceId());
+ }
+ } else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for Local Submission Resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for Local Submission Resource.");
+ }
+ 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();
+ }
+ }
+ return localSubmissionResourceIDs;
+ }
+
+ @Override
+ public void save() throws AppCatalogException {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ LocalSubmission existingLocalSubmission = em.find(LocalSubmission.class, jobSubmissionInterfaceId);
+ em.close();
+ LocalSubmission localSubmission;
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ if (existingLocalSubmission == null) {
+ localSubmission = new LocalSubmission();
+ localSubmission.setCreationTime(AiravataUtils.getCurrentTimestamp());
+ } else {
+ localSubmission = existingLocalSubmission;
+ localSubmission.setUpdateTime(AiravataUtils.getCurrentTimestamp());
+ }
+ localSubmission.setResourceJobManagerId(getResourceJobManagerId());
+ ResourceJobManager resourceJobManager = em.find(ResourceJobManager.class, getResourceJobManagerId());
+ localSubmission.setResourceJobManager(resourceJobManager);
+ localSubmission.setJobSubmissionInterfaceId(getJobSubmissionInterfaceId());
+ if (existingLocalSubmission == null) {
+ em.persist(localSubmission);
+ } else {
+ em.merge(localSubmission);
+ }
+ 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 {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ LocalSubmission localSubmission = em.find(LocalSubmission.class, identifier);
+ em.close();
+ return localSubmission != null;
+ } 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();
+ }
+ }
+ }
+
+ public String getResourceJobManagerId() {
+ return resourceJobManagerId;
+ }
+
+ public ResourceJobManagerAppCatalogResourceAppCat getResourceJobManagerResource() {
+ return resourceJobManagerResource;
+ }
+
+ public String getJobSubmissionInterfaceId() {
+ return jobSubmissionInterfaceId;
+ }
+
+ public void setResourceJobManagerId(String resourceJobManagerId) {
+ this.resourceJobManagerId=resourceJobManagerId;
+ }
+
+ public void setResourceJobManagerResource(ResourceJobManagerAppCatalogResourceAppCat resourceJobManagerResource) {
+ this.resourceJobManagerResource=resourceJobManagerResource;
+ }
+
+ public void setJobSubmissionInterfaceId(String jobSubmissionInterfaceId) {
+ this.jobSubmissionInterfaceId=jobSubmissionInterfaceId;
+ }
+}
[43/52] [abbrv] [partial] airavata git commit: registry refactoring
Posted by sh...@apache.org.
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/ComputeResourceResource.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/ComputeResourceResource.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/ComputeResourceResource.java
deleted file mode 100644
index 932713b..0000000
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/ComputeResourceResource.java
+++ /dev/null
@@ -1,351 +0,0 @@
-/*
- *
- * 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.aiaravata.application.catalog.data.resources;
-
-import org.airavata.appcatalog.cpi.AppCatalogException;
-import org.apache.aiaravata.application.catalog.data.model.ComputeResource;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogJPAUtils;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogQueryGenerator;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogResourceType;
-import org.apache.airavata.common.exception.ApplicationSettingsException;
-import org.apache.airavata.common.utils.AiravataUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.persistence.EntityManager;
-import javax.persistence.Query;
-import java.sql.Timestamp;
-import java.util.ArrayList;
-import java.util.List;
-
-public class ComputeResourceResource extends AbstractResource {
- private final static Logger logger = LoggerFactory.getLogger(ComputeResourceResource.class);
- private String resourceDescription;
- private String resourceId;
- private String hostName;
- private Timestamp createdTime;
- private Timestamp updatedTime;
- private int maxMemoryPerNode;
-
- public int getMaxMemoryPerNode() {
- return maxMemoryPerNode;
- }
-
- public void setMaxMemoryPerNode(int maxMemoryPerNode) {
- this.maxMemoryPerNode = maxMemoryPerNode;
- }
-
- public Timestamp getCreatedTime() {
- return createdTime;
- }
-
- public void setCreatedTime(Timestamp createdTime) {
- this.createdTime = createdTime;
- }
-
- public Timestamp getUpdatedTime() {
- return updatedTime;
- }
-
- public void setUpdatedTime(Timestamp updatedTime) {
- this.updatedTime = updatedTime;
- }
-
- @Override
- public void remove(Object identifier) throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(COMPUTE_RESOURCE);
- generator.setParameter(ComputeResourceConstants.RESOURCE_ID, identifier);
- 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 Resource get(Object identifier) throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(COMPUTE_RESOURCE);
- generator.setParameter(ComputeResourceConstants.RESOURCE_ID, identifier);
- Query q = generator.selectQuery(em);
- ComputeResource computeResource = (ComputeResource) q.getSingleResult();
- ComputeResourceResource computeResourceResource = (ComputeResourceResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.COMPUTE_RESOURCE, computeResource);
- em.getTransaction().commit();
- em.close();
- return computeResourceResource;
- } 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<Resource> get(String fieldName, Object value) throws AppCatalogException {
- List<Resource> computeResourceResources = new ArrayList<Resource>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(COMPUTE_RESOURCE);
- Query q;
- if ((fieldName.equals(ComputeResourceConstants.RESOURCE_DESCRIPTION)) || (fieldName.equals(ComputeResourceConstants.RESOURCE_ID)) || (fieldName.equals(ComputeResourceConstants.HOST_NAME))) {
- generator.setParameter(fieldName, value);
- q = generator.selectQuery(em);
- List<?> results = q.getResultList();
- for (Object result : results) {
- ComputeResource computeResource = (ComputeResource) result;
- ComputeResourceResource computeResourceResource = (ComputeResourceResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.COMPUTE_RESOURCE, computeResource);
- computeResourceResources.add(computeResourceResource);
- }
- } else {
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported field name for Compute Resource Resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported field name for Compute Resource Resource.");
- }
- 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();
- }
- }
- return computeResourceResources;
- }
-
- @Override
- public List<Resource> getAll() throws AppCatalogException {
- List<Resource> computeResourceResources = new ArrayList<Resource>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(COMPUTE_RESOURCE);
- Query q = generator.selectQuery(em);
- List<?> results = q.getResultList();
- for (Object result : results) {
- ComputeResource computeResource = (ComputeResource) result;
- ComputeResourceResource computeResourceResource = (ComputeResourceResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.COMPUTE_RESOURCE, computeResource);
- computeResourceResources.add(computeResourceResource);
- }
- 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();
- }
- }
- return computeResourceResources;
- }
-
- @Override
- public List<String> getAllIds() throws AppCatalogException {
- List<String> computeResourceResources = new ArrayList<String>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(COMPUTE_RESOURCE);
- Query q = generator.selectQuery(em);
- List<?> results = q.getResultList();
- for (Object result : results) {
- ComputeResource computeResource = (ComputeResource) result;
- computeResourceResources.add(computeResource.getResourceId());
- }
- 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();
- }
- }
- return computeResourceResources;
- }
-
- @Override
- public List<String> getIds(String fieldName, Object value) throws AppCatalogException {
- List<String> computeResourceResourceIDs = new ArrayList<String>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(COMPUTE_RESOURCE);
- Query q;
- if ((fieldName.equals(ComputeResourceConstants.RESOURCE_DESCRIPTION)) || (fieldName.equals(ComputeResourceConstants.RESOURCE_ID)) || (fieldName.equals(ComputeResourceConstants.HOST_NAME))) {
- generator.setParameter(fieldName, value);
- q = generator.selectQuery(em);
- List<?> results = q.getResultList();
- for (Object result : results) {
- ComputeResource computeResource = (ComputeResource) result;
- ComputeResourceResource computeResourceResource = (ComputeResourceResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.COMPUTE_RESOURCE, computeResource);
- computeResourceResourceIDs.add(computeResourceResource.getResourceId());
- }
- } else {
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported field name for Compute Resource Resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported field name for Compute Resource Resource.");
- }
- 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();
- }
- }
- return computeResourceResourceIDs;
- }
-
- @Override
- public void save() throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- ComputeResource existingComputeResource = em.find(ComputeResource.class, resourceId);
- em.close();
- ComputeResource computeResource;
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- if (existingComputeResource == null) {
- computeResource = new ComputeResource();
- computeResource.setCreationTime(AiravataUtils.getCurrentTimestamp());
- } else {
- computeResource = existingComputeResource;
- computeResource.setUpdateTime(AiravataUtils.getCurrentTimestamp());
- }
- computeResource.setResourceDescription(getResourceDescription());
- computeResource.setResourceId(getResourceId());
- computeResource.setHostName(getHostName());
- computeResource.setMaxMemoryPerNode(getMaxMemoryPerNode());
- if (existingComputeResource == null) {
- em.persist(computeResource);
- } else {
- em.merge(computeResource);
- }
- 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 {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- ComputeResource computeResource = em.find(ComputeResource.class, identifier);
- em.close();
- return computeResource != null;
- } 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();
- }
- }
- }
-
- public String getResourceDescription() {
- return resourceDescription;
- }
-
- public String getResourceId() {
- return resourceId;
- }
-
- public String getHostName() {
- return hostName;
- }
-
- public void setResourceDescription(String resourceDescription) {
- this.resourceDescription=resourceDescription;
- }
-
- public void setResourceId(String resourceId) {
- this.resourceId=resourceId;
- }
-
- public void setHostName(String hostName) {
- this.hostName=hostName;
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/DataMovementInterfaceResource.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/DataMovementInterfaceResource.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/DataMovementInterfaceResource.java
deleted file mode 100644
index 267cd23..0000000
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/DataMovementInterfaceResource.java
+++ /dev/null
@@ -1,339 +0,0 @@
-/*
- *
- * 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.aiaravata.application.catalog.data.resources;
-
-import java.sql.Timestamp;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.persistence.EntityManager;
-import javax.persistence.Query;
-
-import org.airavata.appcatalog.cpi.AppCatalogException;
-import org.apache.aiaravata.application.catalog.data.model.ComputeResource;
-import org.apache.aiaravata.application.catalog.data.model.DataMovementInterface;
-import org.apache.aiaravata.application.catalog.data.model.DataMovementInterface_PK;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogJPAUtils;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogQueryGenerator;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogResourceType;
-import org.apache.airavata.common.exception.ApplicationSettingsException;
-import org.apache.airavata.common.utils.AiravataUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class DataMovementInterfaceResource extends AbstractResource {
- private final static Logger logger = LoggerFactory.getLogger(DataMovementInterfaceResource.class);
- private String computeResourceId;
- private ComputeResourceResource computeHostResource;
- private String dataMovementProtocol;
- private String dataMovementInterfaceId;
- private int priorityOrder;
- private Timestamp createdTime;
- private Timestamp updatedTime;
-
- public Timestamp getCreatedTime() {
- return createdTime;
- }
-
- public void setCreatedTime(Timestamp createdTime) {
- this.createdTime = createdTime;
- }
-
- public Timestamp getUpdatedTime() {
- return updatedTime;
- }
-
- public void setUpdatedTime(Timestamp updatedTime) {
- this.updatedTime = updatedTime;
- }
-
- @Override
- public void remove(Object identifier) throws AppCatalogException {
- HashMap<String, String> ids;
- if (identifier instanceof Map) {
- ids = (HashMap<String, String>) 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_MOVEMENT_INTERFACE);
- generator.setParameter(DataMovementInterfaceConstants.COMPUTE_RESOURCE_ID, ids.get(DataMovementInterfaceConstants.COMPUTE_RESOURCE_ID));
- generator.setParameter(DataMovementInterfaceConstants.DATA_MOVEMENT_INTERFACE_ID, ids.get(DataMovementInterfaceConstants.DATA_MOVEMENT_INTERFACE_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 Resource get(Object identifier) throws AppCatalogException {
- HashMap<String, String> ids;
- if (identifier instanceof Map) {
- ids = (HashMap<String, String>) 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_MOVEMENT_INTERFACE);
- generator.setParameter(DataMovementInterfaceConstants.COMPUTE_RESOURCE_ID, ids.get(DataMovementInterfaceConstants.COMPUTE_RESOURCE_ID));
- generator.setParameter(DataMovementInterfaceConstants.DATA_MOVEMENT_INTERFACE_ID, ids.get(DataMovementInterfaceConstants.DATA_MOVEMENT_INTERFACE_ID));
- Query q = generator.selectQuery(em);
- DataMovementInterface dataMovementInterface = (DataMovementInterface) q.getSingleResult();
- DataMovementInterfaceResource dataMovementInterfaceResource = (DataMovementInterfaceResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.DATA_MOVEMENT_INTERFACE, dataMovementInterface);
- em.getTransaction().commit();
- em.close();
- return dataMovementInterfaceResource;
- } 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<Resource> get(String fieldName, Object value) throws AppCatalogException {
- List<Resource> dataMovementInterfaceResources = new ArrayList<Resource>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(DATA_MOVEMENT_INTERFACE);
- Query q;
- if ((fieldName.equals(DataMovementInterfaceConstants.COMPUTE_RESOURCE_ID)) || (fieldName.equals(DataMovementInterfaceConstants.DATA_MOVEMENT_PROTOCOL)) || (fieldName.equals(DataMovementInterfaceConstants.DATA_MOVEMENT_INTERFACE_ID)) || (fieldName.equals(DataMovementInterfaceConstants.PRIORITY_ORDER))) {
- generator.setParameter(fieldName, value);
- q = generator.selectQuery(em);
- List<?> results = q.getResultList();
- for (Object result : results) {
- DataMovementInterface dataMovementInterface = (DataMovementInterface) result;
- DataMovementInterfaceResource dataMovementInterfaceResource = (DataMovementInterfaceResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.DATA_MOVEMENT_INTERFACE, dataMovementInterface);
- dataMovementInterfaceResources.add(dataMovementInterfaceResource);
- }
- } else {
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported field name for Data Movement Interface Resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported field name for Data Movement Interface Resource.");
- }
- 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();
- }
- }
- return dataMovementInterfaceResources;
- }
-
- @Override
- public List<Resource> 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 {
- List<String> dataMovementInterfaceResourceIDs = new ArrayList<String>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(DATA_MOVEMENT_INTERFACE);
- Query q;
- if ((fieldName.equals(DataMovementInterfaceConstants.COMPUTE_RESOURCE_ID)) || (fieldName.equals(DataMovementInterfaceConstants.DATA_MOVEMENT_PROTOCOL)) || (fieldName.equals(DataMovementInterfaceConstants.DATA_MOVEMENT_INTERFACE_ID)) || (fieldName.equals(DataMovementInterfaceConstants.PRIORITY_ORDER))) {
- generator.setParameter(fieldName, value);
- q = generator.selectQuery(em);
- List<?> results = q.getResultList();
- for (Object result : results) {
- DataMovementInterface dataMovementInterface = (DataMovementInterface) result;
- DataMovementInterfaceResource dataMovementInterfaceResource = (DataMovementInterfaceResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.DATA_MOVEMENT_INTERFACE, dataMovementInterface);
- dataMovementInterfaceResourceIDs.add(dataMovementInterfaceResource.getComputeResourceId());
- }
- } else {
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported field name for Data Movement Interface Resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported field name for Data Movement Interface Resource.");
- }
- 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();
- }
- }
- return dataMovementInterfaceResourceIDs;
- }
-
- @Override
- public void save() throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- DataMovementInterface existingDataMovementInterface = em.find(DataMovementInterface.class, new DataMovementInterface_PK(computeResourceId, dataMovementInterfaceId));
- em.close();
- DataMovementInterface dataMovementInterface;
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- if (existingDataMovementInterface == null) {
- dataMovementInterface = new DataMovementInterface();
- dataMovementInterface.setCreationTime(AiravataUtils.getCurrentTimestamp());
- } else {
- dataMovementInterface = existingDataMovementInterface;
- dataMovementInterface.setUpdateTime(AiravataUtils.getCurrentTimestamp());
- }
- dataMovementInterface.setComputeResourceId(getComputeResourceId());
- ComputeResource computeResource = em.find(ComputeResource.class, getComputeResourceId());
- dataMovementInterface.setComputeResource(computeResource);
- dataMovementInterface.setDataMovementProtocol(getDataMovementProtocol());
- dataMovementInterface.setDataMovementInterfaceId(getDataMovementInterfaceId());
- dataMovementInterface.setPriorityOrder(getPriorityOrder());
- if (existingDataMovementInterface == null) {
- em.persist(dataMovementInterface);
- } else {
- em.merge(dataMovementInterface);
- }
- 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<String, String>) 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();
- DataMovementInterface dataMovementInterface = em.find(DataMovementInterface.class, new DataMovementInterface_PK(ids.get(DataMovementInterfaceConstants.COMPUTE_RESOURCE_ID), ids.get(DataMovementInterfaceConstants.DATA_MOVEMENT_INTERFACE_ID)));
- em.close();
- return dataMovementInterface != null;
- } 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();
- }
- }
- }
-
- public String getComputeResourceId() {
- return computeResourceId;
- }
-
- public ComputeResourceResource getComputeHostResource() {
- return computeHostResource;
- }
-
- public String getDataMovementProtocol() {
- return dataMovementProtocol;
- }
-
- public String getDataMovementInterfaceId() {
- return dataMovementInterfaceId;
- }
-
- public int getPriorityOrder() {
- return priorityOrder;
- }
-
- public void setComputeResourceId(String computeResourceId) {
- this.computeResourceId=computeResourceId;
- }
-
- public void setComputeHostResource(ComputeResourceResource computeHostResource) {
- this.computeHostResource=computeHostResource;
- }
-
- public void setDataMovementProtocol(String dataMovementProtocol) {
- this.dataMovementProtocol=dataMovementProtocol;
- }
-
- public void setDataMovementInterfaceId(String dataMovementInterfaceId) {
- this.dataMovementInterfaceId=dataMovementInterfaceId;
- }
-
- public void setPriorityOrder(int priorityOrder) {
- this.priorityOrder=priorityOrder;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/DataMovementProtocolResource.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/DataMovementProtocolResource.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/DataMovementProtocolResource.java
deleted file mode 100644
index 6a5b88e..0000000
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/DataMovementProtocolResource.java
+++ /dev/null
@@ -1,360 +0,0 @@
-///**
-// * 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.aiaravata.application.catalog.data.resources;
-//
-//import org.airavata.appcatalog.cpi.AppCatalogException;
-//import org.apache.aiaravata.application.catalog.data.model.ComputeResource;
-//import org.apache.aiaravata.application.catalog.data.model.DataMovementProtocol;
-//import org.apache.aiaravata.application.catalog.data.model.DataMovementProtocolPK;
-//import org.apache.aiaravata.application.catalog.data.util.AppCatalogJPAUtils;
-//import org.apache.aiaravata.application.catalog.data.util.AppCatalogQueryGenerator;
-//import org.apache.aiaravata.application.catalog.data.util.AppCatalogResourceType;
-//import org.apache.airavata.common.exception.ApplicationSettingsException;
-//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 DataMovementProtocolResource extends AbstractResource {
-//
-// private final static Logger logger = LoggerFactory.getLogger(DataMovementProtocolResource.class);
-//
-// private String resourceID;
-// private String dataMoveID;
-// private String dataMoveType;
-// private ComputeResourceResource computeHostResource;
-//
-// 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_MOVEMENT_PROTOCOL);
-// generator.setParameter(DataMoveProtocolConstants.DATA_MOVE_TYPE, ids.get(DataMoveProtocolConstants.DATA_MOVE_TYPE));
-// generator.setParameter(DataMoveProtocolConstants.RESOURCE_ID, ids.get(DataMoveProtocolConstants.RESOURCE_ID));
-// generator.setParameter(DataMoveProtocolConstants.DATA_MOVE_ID, ids.get(DataMoveProtocolConstants.DATA_MOVE_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();
-// }
-// }
-// }
-//
-// public Resource 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_MOVEMENT_PROTOCOL);
-// generator.setParameter(DataMoveProtocolConstants.DATA_MOVE_TYPE, ids.get(DataMoveProtocolConstants.DATA_MOVE_TYPE));
-// generator.setParameter(DataMoveProtocolConstants.RESOURCE_ID, ids.get(DataMoveProtocolConstants.RESOURCE_ID));
-// generator.setParameter(DataMoveProtocolConstants.DATA_MOVE_ID, ids.get(DataMoveProtocolConstants.DATA_MOVE_ID));
-// Query q = generator.selectQuery(em);
-// DataMovementProtocol dataMovementProtocol = (DataMovementProtocol) q.getSingleResult();
-// DataMovementProtocolResource dataMovementProtocolResource =
-// (DataMovementProtocolResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.DATA_MOVEMENT_PROTOCOL, dataMovementProtocol);
-// em.getTransaction().commit();
-// em.close();
-// return dataMovementProtocolResource;
-// } 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();
-// }
-// }
-// }
-//
-// public List<Resource> get(String fieldName, Object value) throws AppCatalogException {
-// List<Resource> dataMoveProtocolResourcesList = new ArrayList<Resource>();
-// EntityManager em = null;
-// try {
-// em = AppCatalogJPAUtils.getEntityManager();
-// em.getTransaction().begin();
-// Query q;
-// AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(DATA_MOVEMENT_PROTOCOL);
-// List results;
-// if (fieldName.equals(DataMoveProtocolConstants.RESOURCE_ID)) {
-// generator.setParameter(DataMoveProtocolConstants.RESOURCE_ID, value);
-// q = generator.selectQuery(em);
-// results = q.getResultList();
-// if (results.size() != 0) {
-// for (Object result : results) {
-// DataMovementProtocol dataMovementProtocol = (DataMovementProtocol) result;
-// DataMovementProtocolResource dataMovementProtocolResource =
-// (DataMovementProtocolResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.DATA_MOVEMENT_PROTOCOL, dataMovementProtocol);
-// dataMoveProtocolResourcesList.add(dataMovementProtocolResource);
-// }
-// }
-// } else if (fieldName.equals(DataMoveProtocolConstants.DATA_MOVE_TYPE)) {
-// generator.setParameter(DataMoveProtocolConstants.DATA_MOVE_TYPE, value);
-// q = generator.selectQuery(em);
-// results = q.getResultList();
-// if (results.size() != 0) {
-// for (Object result : results) {
-// DataMovementProtocol dataMovementProtocol = (DataMovementProtocol) result;
-// DataMovementProtocolResource dataMovementProtocolResource =
-// (DataMovementProtocolResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.DATA_MOVEMENT_PROTOCOL, dataMovementProtocol);
-// dataMoveProtocolResourcesList.add(dataMovementProtocolResource);
-// }
-// }
-// } else if (fieldName.equals(DataMoveProtocolConstants.DATA_MOVE_ID)) {
-// generator.setParameter(DataMoveProtocolConstants.DATA_MOVE_ID, value);
-// q = generator.selectQuery(em);
-// results = q.getResultList();
-// if (results.size() != 0) {
-// for (Object result : results) {
-// DataMovementProtocol dataMovementProtocol = (DataMovementProtocol) result;
-// DataMovementProtocolResource dataMovementProtocolResource =
-// (DataMovementProtocolResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.DATA_MOVEMENT_PROTOCOL, dataMovementProtocol);
-// dataMoveProtocolResourcesList.add(dataMovementProtocolResource);
-// }
-// }
-// } else {
-// em.getTransaction().commit();
-// em.close();
-// logger.error("Unsupported field name for Data Movement Protocol Resource.", new IllegalArgumentException());
-// throw new IllegalArgumentException("Unsupported field name for Data Movement Protocol 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 dataMoveProtocolResourcesList;
-// }
-//
-// @Override
-// public List<Resource> getAll() throws AppCatalogException {
-// return null;
-// }
-//
-// @Override
-// public List<String> getAllIds() throws AppCatalogException {
-// return null;
-// }
-//
-// public List<String> getIds(String fieldName, Object value) throws AppCatalogException {
-// List<String> dataMovementProtocolIDs = new ArrayList<String>();
-// EntityManager em = null;
-// try {
-// em = AppCatalogJPAUtils.getEntityManager();
-// em.getTransaction().begin();
-// Query q;
-// AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(DATA_MOVEMENT_PROTOCOL);
-// List results;
-// if (fieldName.equals(DataMoveProtocolConstants.DATA_MOVE_ID)) {
-// generator.setParameter(DataMoveProtocolConstants.DATA_MOVE_ID, value);
-// q = generator.selectQuery(em);
-// results = q.getResultList();
-// if (results.size() != 0) {
-// for (Object result : results) {
-// DataMovementProtocol dataMovementProtocol = (DataMovementProtocol) result;
-// dataMovementProtocolIDs.add(dataMovementProtocol.getDataMoveID());
-// }
-// }
-// } else if (fieldName.equals(DataMoveProtocolConstants.RESOURCE_ID)) {
-// generator.setParameter(DataMoveProtocolConstants.RESOURCE_ID, value);
-// q = generator.selectQuery(em);
-// results = q.getResultList();
-// if (results.size() != 0) {
-// for (Object result : results) {
-// DataMovementProtocol dataMovementProtocol = (DataMovementProtocol) result;
-// dataMovementProtocolIDs.add(dataMovementProtocol.getDataMoveID());
-// }
-// }
-// } else if (fieldName.equals(DataMoveProtocolConstants.DATA_MOVE_TYPE)) {
-// generator.setParameter(DataMoveProtocolConstants.DATA_MOVE_TYPE, value);
-// q = generator.selectQuery(em);
-// results = q.getResultList();
-// if (results.size() != 0) {
-// for (Object result : results) {
-// DataMovementProtocol dataMovementProtocol = (DataMovementProtocol) result;
-// dataMovementProtocolIDs.add(dataMovementProtocol.getDataMoveID());
-// }
-// }
-// } else {
-// em.getTransaction().commit();
-// em.close();
-// logger.error("Unsupported field name for Data Move Protocol resource.", new IllegalArgumentException());
-// throw new IllegalArgumentException("Unsupported field name for Data Move Protocol 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 dataMovementProtocolIDs;
-// }
-//
-// public void save() throws AppCatalogException {
-// EntityManager em = null;
-// try {
-// em = AppCatalogJPAUtils.getEntityManager();
-// DataMovementProtocol existingDataMovementProtocol = em.find(DataMovementProtocol.class, new DataMovementProtocolPK(resourceID, dataMoveID, dataMoveType));
-// em.close();
-//
-// em = AppCatalogJPAUtils.getEntityManager();
-// em.getTransaction().begin();
-// if (existingDataMovementProtocol != null) {
-// existingDataMovementProtocol.setDataMoveID(dataMoveType);
-// existingDataMovementProtocol.setDataMoveID(dataMoveID);
-// ComputeResource computeResource = em.find(ComputeResource.class, resourceID);
-// existingDataMovementProtocol.setComputeResource(computeResource);
-// existingDataMovementProtocol.setResourceID(resourceID);
-// em.merge(existingDataMovementProtocol);
-// } else {
-// DataMovementProtocol dataMovementProtocol = new DataMovementProtocol();
-// dataMovementProtocol.setDataMoveType(dataMoveType);
-// dataMovementProtocol.setDataMoveID(dataMoveID);
-// dataMovementProtocol.setResourceID(resourceID);
-// ComputeResource computeResource = em.find(ComputeResource.class, resourceID);
-// dataMovementProtocol.setComputeResource(computeResource);
-// em.persist(dataMovementProtocol);
-// }
-// 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();
-// }
-// }
-// }
-//
-// 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();
-// DataMovementProtocol dataMovementProtocol = em.find(DataMovementProtocol.class, new DataMovementProtocolPK(
-// ids.get(DataMoveProtocolConstants.RESOURCE_ID),
-// ids.get(DataMoveProtocolConstants.DATA_MOVE_ID), ids.get(DataMoveProtocolConstants.DATA_MOVE_TYPE)));
-//
-// em.close();
-// return dataMovementProtocol != null;
-// } 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();
-// }
-// }
-// }
-//
-// public String getResourceID() {
-// return resourceID;
-// }
-//
-// public void setResourceID(String resourceID) {
-// this.resourceID = resourceID;
-// }
-//
-// public String getDataMoveID() {
-// return dataMoveID;
-// }
-//
-// public void setDataMoveID(String dataMoveID) {
-// this.dataMoveID = dataMoveID;
-// }
-//
-// public String getDataMoveType() {
-// return dataMoveType;
-// }
-//
-// public void setDataMoveType(String dataMoveType) {
-// this.dataMoveType = dataMoveType;
-// }
-//
-// public ComputeResourceResource getComputeHostResource() {
-// return computeHostResource;
-// }
-//
-// public void setComputeHostResource(ComputeResourceResource computeHostResource) {
-// this.computeHostResource = computeHostResource;
-// }
-//}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/GSISSHExportResource.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/GSISSHExportResource.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/GSISSHExportResource.java
deleted file mode 100644
index 92e2e43..0000000
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/GSISSHExportResource.java
+++ /dev/null
@@ -1,324 +0,0 @@
-/**
- * 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.aiaravata.application.catalog.data.resources;
-
-import org.airavata.appcatalog.cpi.AppCatalogException;
-import org.apache.aiaravata.application.catalog.data.model.GSISSHExport;
-import org.apache.aiaravata.application.catalog.data.model.GSISSHExportPK;
-import org.apache.aiaravata.application.catalog.data.model.GSISSHSubmission;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogJPAUtils;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogQueryGenerator;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogResourceType;
-import org.apache.airavata.common.exception.ApplicationSettingsException;
-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 GSISSHExportResource extends AbstractResource {
- private final static Logger logger = LoggerFactory.getLogger(GSISSHExportResource.class);
-
- private String submissionID;
- private String export;
-
- private GSISSHSubmissionResource gsisshSubmissionResource;
-
-
- 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(GSISSH_EXPORT);
- generator.setParameter(GSISSHExportConstants.EXPORT, ids.get(GSISSHExportConstants.EXPORT));
- generator.setParameter(GSISSHExportConstants.SUBMISSION_ID, ids.get(GSISSHExportConstants.SUBMISSION_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();
- }
- }
- }
-
- public Resource 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(GSISSH_EXPORT);
- generator.setParameter(GSISSHExportConstants.SUBMISSION_ID, ids.get(GSISSHExportConstants.SUBMISSION_ID));
- generator.setParameter(GSISSHExportConstants.EXPORT, ids.get(GSISSHExportConstants.EXPORT));
- Query q = generator.selectQuery(em);
- GSISSHExport gsisshExport = (GSISSHExport) q.getSingleResult();
- GSISSHExportResource gsisshExportResource =
- (GSISSHExportResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.GSISSH_EXPORT
- , gsisshExport);
- em.getTransaction().commit();
- em.close();
- return gsisshExportResource;
- } 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();
- }
- }
- }
-
- public List<Resource> get(String fieldName, Object value) throws AppCatalogException {
- List<Resource> gsiSSHExportResources = new ArrayList<Resource>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- Query q;
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(GSISSH_EXPORT);
- List results;
- if (fieldName.equals(GSISSHExportConstants.EXPORT)) {
- generator.setParameter(GSISSHExportConstants.EXPORT, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- GSISSHExport gsisshExport = (GSISSHExport) result;
- GSISSHExportResource gsisshExportResource =
- (GSISSHExportResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.GSISSH_EXPORT, gsisshExport);
- gsiSSHExportResources.add(gsisshExportResource);
- }
- }
- } else if (fieldName.equals(GSISSHExportConstants.SUBMISSION_ID)) {
- generator.setParameter(GSISSHExportConstants.SUBMISSION_ID, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- GSISSHExport gsisshExport = (GSISSHExport) result;
- GSISSHExportResource gsisshExportResource =
- (GSISSHExportResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.GSISSH_EXPORT, gsisshExport);
- gsiSSHExportResources.add(gsisshExportResource);
- }
- }
- } else {
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported field name for GSISSH Export Resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported field name for GSISSH Export 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 gsiSSHExportResources;
- }
-
- @Override
- public List<Resource> getAll() throws AppCatalogException {
- return null;
- }
-
- @Override
- public List<String> getAllIds() throws AppCatalogException {
- return null;
- }
-
- public List<String> getIds(String fieldName, Object value) throws AppCatalogException {
- List<String> gsiSSHExportIDs = new ArrayList<String>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- Query q;
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(GSISSH_EXPORT);
- List results;
- if (fieldName.equals(GSISSHExportConstants.SUBMISSION_ID)) {
- generator.setParameter(GSISSHExportConstants.SUBMISSION_ID, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- GSISSHExport gsisshExport = (GSISSHExport) result;
- gsiSSHExportIDs.add(gsisshExport.getSubmissionID());
- }
- }
- } else if (fieldName.equals(GSISSHExportConstants.EXPORT)) {
- generator.setParameter(GSISSHExportConstants.EXPORT, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- GSISSHExport gsisshExport = (GSISSHExport) result;
- gsiSSHExportIDs.add(gsisshExport.getSubmissionID());
- }
- }
- } else {
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported field name for GSISSH Export resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported field name for GSISSH Export 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 gsiSSHExportIDs;
- }
-
- public void save() throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- GSISSHExport existingGSIExport = em.find(GSISSHExport.class, new GSISSHExportPK(submissionID, export));
- em.close();
-
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- GSISSHSubmission gsisshSubmission = em.find(GSISSHSubmission.class, submissionID);
- if (existingGSIExport != null) {
- existingGSIExport.setSubmissionID(submissionID);
- existingGSIExport.setExport(export);
- existingGSIExport.setGsisshJobSubmission(gsisshSubmission);
- em.merge(existingGSIExport);
- } else {
- GSISSHExport gsisshExport = new GSISSHExport();
- gsisshExport.setSubmissionID(submissionID);
- gsisshExport.setExport(export);
- gsisshExport.setGsisshJobSubmission(gsisshSubmission);
- em.persist(gsisshExport);
- }
- 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();
- }
- }
- }
-
- 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();
- GSISSHExport gsisshExport = em.find(GSISSHExport.class, new GSISSHExportPK(ids.get(GSISSHExportConstants.SUBMISSION_ID),
- ids.get(GSISSHExportConstants.EXPORT)));
-
- em.close();
- return gsisshExport != null;
- } 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();
- }
- } }
-
- public String getSubmissionID() {
- return submissionID;
- }
-
- public void setSubmissionID(String submissionID) {
- this.submissionID = submissionID;
- }
-
- public String getExport() {
- return export;
- }
-
- public void setExport(String export) {
- this.export = export;
- }
-
- public GSISSHSubmissionResource getGsisshSubmissionResource() {
- return gsisshSubmissionResource;
- }
-
- public void setGsisshSubmissionResource(GSISSHSubmissionResource gsisshSubmissionResource) {
- this.gsisshSubmissionResource = gsisshSubmissionResource;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/GSISSHSubmissionResource.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/GSISSHSubmissionResource.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/GSISSHSubmissionResource.java
deleted file mode 100644
index 44cc971..0000000
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/GSISSHSubmissionResource.java
+++ /dev/null
@@ -1,374 +0,0 @@
-/**
- * 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.aiaravata.application.catalog.data.resources;
-
-import org.airavata.appcatalog.cpi.AppCatalogException;
-import org.apache.aiaravata.application.catalog.data.model.ComputeResource;
-import org.apache.aiaravata.application.catalog.data.model.GSISSHSubmission;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogJPAUtils;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogQueryGenerator;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogResourceType;
-import org.apache.airavata.common.exception.ApplicationSettingsException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.persistence.EntityManager;
-import javax.persistence.Query;
-import java.util.ArrayList;
-import java.util.List;
-
-public class GSISSHSubmissionResource extends AbstractResource {
-
- private final static Logger logger = LoggerFactory.getLogger(GSISSHSubmissionResource.class);
-
- private String submissionID;
- private String resourceJobManager;
- private int sshPort;
- private String installedPath;
- private String monitorMode;
-
- public void remove(Object identifier) throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(GSISSH_SUBMISSION);
- generator.setParameter(GSISSHSubmissionConstants.SUBMISSION_ID, identifier);
- 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();
- }
- }
- }
-
- public Resource get(Object identifier) throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(GSISSH_SUBMISSION);
- generator.setParameter(GSISSHSubmissionConstants.SUBMISSION_ID, identifier);
- Query q = generator.selectQuery(em);
- GSISSHSubmission gsisshSubmission = (GSISSHSubmission) q.getSingleResult();
- GSISSHSubmissionResource gsisshSubmissionResource =
- (GSISSHSubmissionResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.GSISSH_SUBMISSION
- , gsisshSubmission);
- em.getTransaction().commit();
- em.close();
- return gsisshSubmissionResource;
- } 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();
- }
- }
- }
-
- public List<Resource> get(String fieldName, Object value) throws AppCatalogException {
- List<Resource> gsiSSHSubmissionResourceList = new ArrayList<Resource>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- Query q;
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(GSISSH_SUBMISSION);
- List results;
- if (fieldName.equals(GSISSHSubmissionConstants.MONITOR_MODE)) {
- generator.setParameter(GSISSHSubmissionConstants.MONITOR_MODE, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- GSISSHSubmission gsisshSubmission = (GSISSHSubmission) result;
- GSISSHSubmissionResource gsisshSubmissionResource =
- (GSISSHSubmissionResource) AppCatalogJPAUtils.getResource(
- AppCatalogResourceType.GSISSH_SUBMISSION, gsisshSubmission);
- gsiSSHSubmissionResourceList.add(gsisshSubmissionResource);
- }
- }
- } else if (fieldName.equals(GSISSHSubmissionConstants.INSTALLED_PATH)) {
- generator.setParameter(GSISSHSubmissionConstants.INSTALLED_PATH, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- GSISSHSubmission gsisshSubmission = (GSISSHSubmission) result;
- GSISSHSubmissionResource gsisshSubmissionResource =
- (GSISSHSubmissionResource) AppCatalogJPAUtils.getResource(
- AppCatalogResourceType.GSISSH_SUBMISSION, gsisshSubmission);
- gsiSSHSubmissionResourceList.add(gsisshSubmissionResource);
- }
- }
- } else if (fieldName.equals(GSISSHSubmissionConstants.SSH_PORT)) {
- generator.setParameter(GSISSHSubmissionConstants.SSH_PORT, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- GSISSHSubmission gsisshSubmission = (GSISSHSubmission) result;
- GSISSHSubmissionResource gsisshSubmissionResource =
- (GSISSHSubmissionResource) AppCatalogJPAUtils.getResource(
- AppCatalogResourceType.GSISSH_SUBMISSION, gsisshSubmission);
- gsiSSHSubmissionResourceList.add(gsisshSubmissionResource);
- }
- }
- } else if (fieldName.equals(GSISSHSubmissionConstants.RESOURCE_JOB_MANAGER)) {
- generator.setParameter(GSISSHSubmissionConstants.RESOURCE_JOB_MANAGER, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- GSISSHSubmission gsisshSubmission = (GSISSHSubmission) result;
- GSISSHSubmissionResource gsisshSubmissionResource =
- (GSISSHSubmissionResource) AppCatalogJPAUtils.getResource(
- AppCatalogResourceType.GSISSH_SUBMISSION, gsisshSubmission);
- gsiSSHSubmissionResourceList.add(gsisshSubmissionResource);
- }
- }
- } else {
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported field name for GSISSH submission resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported field name for GSISSH Submission 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 gsiSSHSubmissionResourceList;
- }
-
- @Override
- public List<Resource> getAll() throws AppCatalogException {
- return null;
- }
-
- @Override
- public List<String> getAllIds() throws AppCatalogException {
- return null;
- }
-
- public List<String> getIds(String fieldName, Object value) throws AppCatalogException {
- List<String> gsiSSHSubmissionResourceIDs = new ArrayList<String>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- Query q;
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(GSISSH_SUBMISSION);
- List results;
- if (fieldName.equals(GSISSHSubmissionConstants.SUBMISSION_ID)) {
- generator.setParameter(GSISSHSubmissionConstants.SUBMISSION_ID, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- GSISSHSubmission gsisshSubmission = (GSISSHSubmission) result;
- gsiSSHSubmissionResourceIDs.add(gsisshSubmission.getSubmissionID());
- }
- }
- } else if (fieldName.equals(GSISSHSubmissionConstants.SSH_PORT)) {
- generator.setParameter(GSISSHSubmissionConstants.SSH_PORT, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- GSISSHSubmission gsisshSubmission = (GSISSHSubmission) result;
- gsiSSHSubmissionResourceIDs.add(gsisshSubmission.getSubmissionID());
- }
- }
- } else if (fieldName.equals(GSISSHSubmissionConstants.MONITOR_MODE)) {
- generator.setParameter(GSISSHSubmissionConstants.MONITOR_MODE, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- GSISSHSubmission gsisshSubmission = (GSISSHSubmission) result;
- gsiSSHSubmissionResourceIDs.add(gsisshSubmission.getSubmissionID());
- }
- }
- } else if (fieldName.equals(GSISSHSubmissionConstants.RESOURCE_JOB_MANAGER)) {
- generator.setParameter(GSISSHSubmissionConstants.RESOURCE_JOB_MANAGER, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- GSISSHSubmission gsisshSubmission = (GSISSHSubmission) result;
- gsiSSHSubmissionResourceIDs.add(gsisshSubmission.getSubmissionID());
- }
- }
- } else if (fieldName.equals(GSISSHSubmissionConstants.INSTALLED_PATH)) {
- generator.setParameter(GSISSHSubmissionConstants.INSTALLED_PATH, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- GSISSHSubmission gsisshSubmission = (GSISSHSubmission) result;
- gsiSSHSubmissionResourceIDs.add(gsisshSubmission.getSubmissionID());
- }
- }
- } else {
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported field name for GSISSH Submission resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported field name for GSISSH Submission 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 gsiSSHSubmissionResourceIDs;
- }
-
- public void save() throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- GSISSHSubmission existingGSISSHSubmission = em.find(GSISSHSubmission.class, submissionID);
- em.close();
-
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- if (existingGSISSHSubmission != null) {
- existingGSISSHSubmission.setSubmissionID(submissionID);
- existingGSISSHSubmission.setSshPort(sshPort);
- existingGSISSHSubmission.setResourceJobManager(resourceJobManager);
- existingGSISSHSubmission.setInstalledPath(installedPath);
- existingGSISSHSubmission.setMonitorMode(monitorMode);
- em.merge(existingGSISSHSubmission);
- } else {
- GSISSHSubmission gsisshSubmission = new GSISSHSubmission();
- gsisshSubmission.setSubmissionID(submissionID);
- gsisshSubmission.setSshPort(sshPort);
- gsisshSubmission.setResourceJobManager(resourceJobManager);
- gsisshSubmission.setInstalledPath(installedPath);
- gsisshSubmission.setMonitorMode(monitorMode);
- em.persist(gsisshSubmission);
- }
- 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();
- }
- }
-
- }
-
- public boolean isExists(Object identifier) throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- GSISSHSubmission gsisshSubmission = em.find(GSISSHSubmission.class, identifier);
- em.close();
- return gsisshSubmission != null;
- } 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();
- }
- }
- }
-
- public String getSubmissionID() {
- return submissionID;
- }
-
- public void setSubmissionID(String submissionID) {
- this.submissionID = submissionID;
- }
-
- public String getResourceJobManager() {
- return resourceJobManager;
- }
-
- public void setResourceJobManager(String resourceJobManager) {
- this.resourceJobManager = resourceJobManager;
- }
-
- public int getSshPort() {
- return sshPort;
- }
-
- public void setSshPort(int sshPort) {
- this.sshPort = sshPort;
- }
-
- public String getInstalledPath() {
- return installedPath;
- }
-
- public void setInstalledPath(String installedPath) {
- this.installedPath = installedPath;
- }
-
- public String getMonitorMode() {
- return monitorMode;
- }
-
- public void setMonitorMode(String monitorMode) {
- this.monitorMode = monitorMode;
- }
-
-}
[45/52] [abbrv] [partial] airavata git commit: registry refactoring
Posted by sh...@apache.org.
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/AppEnvironmentResource.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/AppEnvironmentResource.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/AppEnvironmentResource.java
deleted file mode 100644
index 98f753f..0000000
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/AppEnvironmentResource.java
+++ /dev/null
@@ -1,293 +0,0 @@
-/*
- *
- * 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.aiaravata.application.catalog.data.resources;
-
-import org.airavata.appcatalog.cpi.AppCatalogException;
-import org.apache.aiaravata.application.catalog.data.model.AppEnvironment;
-import org.apache.aiaravata.application.catalog.data.model.AppEnvironment_PK;
-import org.apache.aiaravata.application.catalog.data.model.ApplicationDeployment;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogJPAUtils;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogQueryGenerator;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogResourceType;
-import org.apache.airavata.common.exception.ApplicationSettingsException;
-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 AppEnvironmentResource extends AbstractResource {
- private final static Logger logger = LoggerFactory.getLogger(AppEnvironmentResource.class);
- private String deploymentId;
- private String name;
- private String value;
- private AppDeploymentResource appDeploymentResource;
-
- public String getDeploymentId() {
- return deploymentId;
- }
-
- public void setDeploymentId(String deploymentId) {
- this.deploymentId = deploymentId;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public String getValue() {
- return value;
- }
-
- public void setValue(String value) {
- this.value = value;
- }
-
- public AppDeploymentResource getAppDeploymentResource() {
- return appDeploymentResource;
- }
-
- public void setAppDeploymentResource(AppDeploymentResource appDeploymentResource) {
- this.appDeploymentResource = appDeploymentResource;
- }
-
- @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(APP_ENVIRONMENT);
- generator.setParameter(AppEnvironmentConstants.DEPLOYMENT_ID, ids.get(AppEnvironmentConstants.DEPLOYMENT_ID));
- if (ids.get(AppEnvironmentConstants.NAME) != null){
- generator.setParameter(AppEnvironmentConstants.NAME, ids.get(AppEnvironmentConstants.NAME));
- }
-
- 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 Resource 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(APP_ENVIRONMENT);
- generator.setParameter(AppEnvironmentConstants.DEPLOYMENT_ID, ids.get(AppEnvironmentConstants.DEPLOYMENT_ID));
- generator.setParameter(AppEnvironmentConstants.NAME, ids.get(AppEnvironmentConstants.NAME));
- Query q = generator.selectQuery(em);
- AppEnvironment appEnvironment = (AppEnvironment) q.getSingleResult();
- AppEnvironmentResource resource =
- (AppEnvironmentResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.APP_ENVIRONMENT, appEnvironment);
- em.getTransaction().commit();
- em.close();
- return resource;
- } 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<Resource> get(String fieldName, Object value) throws AppCatalogException {
- List<Resource> appEnvironmentList = new ArrayList<Resource>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- Query q;
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(APP_ENVIRONMENT);
- List results;
- if (fieldName.equals(AppEnvironmentConstants.DEPLOYMENT_ID)) {
- generator.setParameter(AppEnvironmentConstants.DEPLOYMENT_ID, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- AppEnvironment appEnvironment = (AppEnvironment) result;
- AppEnvironmentResource resource =
- (AppEnvironmentResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.APP_ENVIRONMENT, appEnvironment);
- appEnvironmentList.add(resource);
- }
- }
- } else if (fieldName.equals(AppEnvironmentConstants.NAME)) {
- generator.setParameter(AppEnvironmentConstants.NAME, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- AppEnvironment appEnvironment = (AppEnvironment) result;
- AppEnvironmentResource resource =
- (AppEnvironmentResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.APP_ENVIRONMENT, appEnvironment);
- appEnvironmentList.add(resource);
- }
- }
- }else {
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported field name for App Environment resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported field name for App Environment 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 appEnvironmentList;
- }
-
- @Override
- public List<Resource> 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();
- AppEnvironment existigAppEnv = em.find(AppEnvironment.class, new AppEnvironment_PK(deploymentId, name));
- em.close();
-
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
-
- ApplicationDeployment deployment = em.find(ApplicationDeployment.class, deploymentId);
- if (existigAppEnv != null){
- existigAppEnv.setValue(value);
- existigAppEnv.setApplicationDeployment(deployment);
- em.merge(existigAppEnv);
- }else {
- AppEnvironment appEnvironment = new AppEnvironment();
- appEnvironment.setDeploymentID(deploymentId);
- appEnvironment.setName(name);
- appEnvironment.setValue(value);
- appEnvironment.setApplicationDeployment(deployment);
- em.persist(appEnvironment);
- }
- 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();
- AppEnvironment appEnvironment = em.find(AppEnvironment.class,
- new AppEnvironment_PK(ids.get(AppEnvironmentConstants.DEPLOYMENT_ID),
- ids.get(AppEnvironmentConstants.NAME)));
- em.close();
- return appEnvironment != null;
- } 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();
- }
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/AppInterfaceResource.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/AppInterfaceResource.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/AppInterfaceResource.java
deleted file mode 100644
index 3f6b60d..0000000
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/AppInterfaceResource.java
+++ /dev/null
@@ -1,363 +0,0 @@
-/*
- *
- * 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.aiaravata.application.catalog.data.resources;
-
-import org.airavata.appcatalog.cpi.AppCatalogException;
-import org.apache.aiaravata.application.catalog.data.model.ApplicationInterface;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogJPAUtils;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogQueryGenerator;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogResourceType;
-import org.apache.airavata.common.exception.ApplicationSettingsException;
-import org.apache.airavata.common.utils.AiravataUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.persistence.EntityManager;
-import javax.persistence.Query;
-import java.sql.Timestamp;
-import java.util.ArrayList;
-import java.util.List;
-
-public class AppInterfaceResource extends AbstractResource {
- private final static Logger logger = LoggerFactory.getLogger(AppInterfaceResource.class);
- private String interfaceId;
- private String appName;
- private String appDescription;
- private Timestamp createdTime;
- private Timestamp updatedTime;
- private String gatewayId;
-
- public String getGatewayId() {
- return gatewayId;
- }
-
- public void setGatewayId(String gatewayId) {
- this.gatewayId = gatewayId;
- }
-
- public Timestamp getCreatedTime() {
- return createdTime;
- }
-
- public void setCreatedTime(Timestamp createdTime) {
- this.createdTime = createdTime;
- }
-
- public Timestamp getUpdatedTime() {
- return updatedTime;
- }
-
- public void setUpdatedTime(Timestamp updatedTime) {
- this.updatedTime = updatedTime;
- }
-
- public String getInterfaceId() {
- return interfaceId;
- }
-
- public void setInterfaceId(String interfaceId) {
- this.interfaceId = interfaceId;
- }
-
- public String getAppName() {
- return appName;
- }
-
- public void setAppName(String appName) {
- this.appName = appName;
- }
-
- public String getAppDescription() {
- return appDescription;
- }
-
- public void setAppDescription(String appDescription) {
- this.appDescription = appDescription;
- }
-
- @Override
- public void remove(Object identifier) throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator= new AppCatalogQueryGenerator(APPLICATION_INTERFACE);
- generator.setParameter(ApplicationInterfaceConstants.INTERFACE_ID, identifier);
- 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 Resource get(Object identifier) throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(APPLICATION_INTERFACE);
- generator.setParameter(ApplicationInterfaceConstants.INTERFACE_ID, identifier);
- Query q = generator.selectQuery(em);
- ApplicationInterface applicationInterface = (ApplicationInterface) q.getSingleResult();
- AppInterfaceResource resource =
- (AppInterfaceResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.APPLICATION_INTERFACE, applicationInterface);
- em.getTransaction().commit();
- em.close();
- return resource;
- } 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<Resource> get(String fieldName, Object value) throws AppCatalogException {
- List<Resource> resourceList = new ArrayList<Resource>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- Query q;
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(APPLICATION_INTERFACE);
- List results;
- if (fieldName.equals(ApplicationInterfaceConstants.APPLICATION_NAME)) {
- generator.setParameter(ApplicationInterfaceConstants.APPLICATION_NAME, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- ApplicationInterface appInterface = (ApplicationInterface) result;
- AppInterfaceResource resource =
- (AppInterfaceResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.APPLICATION_INTERFACE, appInterface);
- resourceList.add(resource);
- }
- }
- } else {
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported field name for application interface.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported field name for application interface.");
- }
- 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 resourceList;
- }
-
- @Override
- public List<Resource> getAll() throws AppCatalogException {
- List<Resource> resourceList = new ArrayList<Resource>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(APPLICATION_INTERFACE);
- generator.setParameter(ApplicationInterfaceConstants.GATEWAY_ID, gatewayId);
- Query q = generator.selectQuery(em);
- List results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- ApplicationInterface appInterface = (ApplicationInterface) result;
- AppInterfaceResource resource =
- (AppInterfaceResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.APPLICATION_INTERFACE, appInterface);
- resourceList.add(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 resourceList;
- }
-
- @Override
- public List<String> getAllIds() throws AppCatalogException {
- List<String> resourceList = new ArrayList<String>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(APPLICATION_INTERFACE);
- Query q = generator.selectQuery(em);
- List results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- ApplicationInterface appInterface = (ApplicationInterface) result;
- resourceList.add(appInterface.getInterfaceID());
- }
- }
- 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 resourceList;
- }
-
- @Override
- public List<String> getIds(String fieldName, Object value) throws AppCatalogException {
- List<String> resourceList = new ArrayList<String>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- Query q;
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(APPLICATION_INTERFACE);
- List results;
- if (fieldName.equals(ApplicationInterfaceConstants.APPLICATION_NAME)) {
- generator.setParameter(ApplicationInterfaceConstants.APPLICATION_NAME, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- ApplicationInterface appInterface = (ApplicationInterface) result;
- resourceList.add(appInterface.getInterfaceID());
- }
- }
- } else {
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported field name for application interface.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported field name for application interface.");
- }
- 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 resourceList;
- }
-
- @Override
- public void save() throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- ApplicationInterface existigAppInterface = em.find(ApplicationInterface.class, interfaceId);
- em.close();
-
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- if (existigAppInterface != null){
- existigAppInterface.setAppName(appName);
- existigAppInterface.setAppDescription(appDescription);
- existigAppInterface.setUpdateTime(AiravataUtils.getCurrentTimestamp());
- existigAppInterface.setGatewayId(gatewayId);
- em.merge(existigAppInterface);
- }else {
- ApplicationInterface applicationInterface = new ApplicationInterface();
- applicationInterface.setInterfaceID(interfaceId);
- applicationInterface.setAppName(appName);
- applicationInterface.setAppDescription(appDescription);
- applicationInterface.setCreationTime(AiravataUtils.getCurrentTimestamp());
- applicationInterface.setGatewayId(gatewayId);
- em.persist(applicationInterface);
- }
- 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 {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- ApplicationInterface existigAppInterface = em.find(ApplicationInterface.class, identifier);
- em.close();
- return existigAppInterface != 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/ec8c6202/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/AppModuleMappingResource.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/AppModuleMappingResource.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/AppModuleMappingResource.java
deleted file mode 100644
index a44229d..0000000
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/AppModuleMappingResource.java
+++ /dev/null
@@ -1,317 +0,0 @@
-/*
- *
- * 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.aiaravata.application.catalog.data.resources;
-
-import org.airavata.appcatalog.cpi.AppCatalogException;
-import org.apache.aiaravata.application.catalog.data.model.AppModuleMapping;
-import org.apache.aiaravata.application.catalog.data.model.AppModuleMapping_PK;
-import org.apache.aiaravata.application.catalog.data.model.ApplicationInterface;
-import org.apache.aiaravata.application.catalog.data.model.ApplicationModule;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogJPAUtils;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogQueryGenerator;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogResourceType;
-import org.apache.airavata.common.exception.ApplicationSettingsException;
-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 AppModuleMappingResource extends AbstractResource {
- private final static Logger logger = LoggerFactory.getLogger(AppModuleMappingResource.class);
- private String interfaceId;
- private String moduleId;
- private AppInterfaceResource appInterfaceResource;
- private AppModuleResource moduleResource;
-
-
- public String getModuleId() {
- return moduleId;
- }
-
- public void setModuleId(String moduleId) {
- this.moduleId = moduleId;
- }
-
- public String getInterfaceId() {
- return interfaceId;
- }
-
- public void setInterfaceId(String interfaceId) {
- this.interfaceId = interfaceId;
- }
-
- public AppInterfaceResource getAppInterfaceResource() {
- return appInterfaceResource;
- }
-
- public void setAppInterfaceResource(AppInterfaceResource appInterfaceResource) {
- this.appInterfaceResource = appInterfaceResource;
- }
-
- public AppModuleResource getModuleResource() {
- return moduleResource;
- }
-
- public void setModuleResource(AppModuleResource moduleResource) {
- this.moduleResource = moduleResource;
- }
-
- @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(APP_MODULE_MAPPING);
- generator.setParameter(AppModuleMappingConstants.INTERFACE_ID, ids.get(AppModuleMappingConstants.INTERFACE_ID));
- if (ids.get(AppModuleMappingConstants.MODULE_ID) != null){
- generator.setParameter(AppModuleMappingConstants.MODULE_ID, ids.get(AppModuleMappingConstants.MODULE_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();
- }
- }
- }
-
- public void removeAll() throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator= new AppCatalogQueryGenerator(APP_MODULE_MAPPING);
- 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 Resource 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(APP_MODULE_MAPPING);
- generator.setParameter(AppModuleMappingConstants.INTERFACE_ID, ids.get(AppModuleMappingConstants.INTERFACE_ID));
- generator.setParameter(AppModuleMappingConstants.MODULE_ID, ids.get(AppModuleMappingConstants.MODULE_ID));
- Query q = generator.selectQuery(em);
- AppModuleMapping result = (AppModuleMapping) q.getSingleResult();
- AppModuleMappingResource resource =
- (AppModuleMappingResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.APP_MODULE_MAPPING, result);
- em.getTransaction().commit();
- em.close();
- return resource;
- } 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<Resource> get(String fieldName, Object value) throws AppCatalogException {
- List<Resource> resourceList = new ArrayList<Resource>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- Query q;
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(APP_MODULE_MAPPING);
- List results;
- if (fieldName.equals(AppModuleMappingConstants.INTERFACE_ID)) {
- generator.setParameter(AppModuleMappingConstants.INTERFACE_ID, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- AppModuleMapping moduleMapping = (AppModuleMapping) result;
- AppModuleMappingResource resource =
- (AppModuleMappingResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.APP_MODULE_MAPPING, moduleMapping);
- resourceList.add(resource);
- }
- }
- } else if (fieldName.equals(AppModuleMappingConstants.MODULE_ID)) {
- generator.setParameter(AppModuleMappingConstants.MODULE_ID, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- AppModuleMapping moduleMapping = (AppModuleMapping) result;
- AppModuleMappingResource resource =
- (AppModuleMappingResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.APP_MODULE_MAPPING, moduleMapping);
- resourceList.add(resource);
- }
- }
- }else {
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported field name for app module mapping resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported field name for app module mapping 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 resourceList;
- }
-
- @Override
- public List<Resource> 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();
- AppModuleMapping existngModuleMap = em.find(AppModuleMapping.class, new AppModuleMapping_PK(interfaceId, moduleId));
- em.close();
-
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- ApplicationInterface applicationInterface = em.find(ApplicationInterface.class, interfaceId);
- ApplicationModule applicationModule = em.find(ApplicationModule.class, moduleId);
- if (existngModuleMap != null){
- existngModuleMap.setApplicationInterface(applicationInterface);
- existngModuleMap.setApplicationModule(applicationModule);
- em.merge(existngModuleMap);
- }else {
- AppModuleMapping appModuleMapping = new AppModuleMapping();
- appModuleMapping.setInterfaceID(interfaceId);
- appModuleMapping.setApplicationInterface(applicationInterface);
- appModuleMapping.setModuleID(moduleId);
- appModuleMapping.setApplicationModule(applicationModule);
- em.persist(appModuleMapping);
- }
- 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();
- AppModuleMapping moduleMapping = em.find(AppModuleMapping.class,
- new AppModuleMapping_PK(ids.get(AppModuleMappingConstants.INTERFACE_ID),
- ids.get(AppModuleMappingConstants.MODULE_ID)));
- em.close();
- return moduleMapping != null;
- } 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();
- }
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/AppModuleResource.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/AppModuleResource.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/AppModuleResource.java
deleted file mode 100644
index 79803af..0000000
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/AppModuleResource.java
+++ /dev/null
@@ -1,344 +0,0 @@
-/*
- *
- * 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.aiaravata.application.catalog.data.resources;
-
-import org.airavata.appcatalog.cpi.AppCatalogException;
-import org.apache.aiaravata.application.catalog.data.model.ApplicationModule;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogJPAUtils;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogQueryGenerator;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogResourceType;
-import org.apache.airavata.common.exception.ApplicationSettingsException;
-import org.apache.airavata.common.utils.AiravataUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.persistence.EntityManager;
-import javax.persistence.Query;
-import java.sql.Timestamp;
-import java.util.ArrayList;
-import java.util.List;
-
-public class AppModuleResource extends AbstractResource {
- private final static Logger logger = LoggerFactory.getLogger(AppModuleResource.class);
- private String moduleId;
- private String moduleName;
- private String moduleVersion;
- private String moduleDesc;
- private Timestamp createdTime;
- private Timestamp updatedTime;
- private String gatewayId;
-
- public String getGatewayId() {
- return gatewayId;
- }
-
- public void setGatewayId(String gatewayId) {
- this.gatewayId = gatewayId;
- }
-
- public Timestamp getCreatedTime() {
- return createdTime;
- }
-
- public void setCreatedTime(Timestamp createdTime) {
- this.createdTime = createdTime;
- }
-
- public Timestamp getUpdatedTime() {
- return updatedTime;
- }
-
- public void setUpdatedTime(Timestamp updatedTime) {
- this.updatedTime = updatedTime;
- }
-
- public String getModuleId() {
- return moduleId;
- }
-
- public void setModuleId(String moduleId) {
- this.moduleId = moduleId;
- }
-
- public String getModuleName() {
- return moduleName;
- }
-
- public void setModuleName(String moduleName) {
- this.moduleName = moduleName;
- }
-
- public String getModuleVersion() {
- return moduleVersion;
- }
-
- public void setModuleVersion(String moduleVersion) {
- this.moduleVersion = moduleVersion;
- }
-
- public String getModuleDesc() {
- return moduleDesc;
- }
-
- public void setModuleDesc(String moduleDesc) {
- this.moduleDesc = moduleDesc;
- }
-
- @Override
- public void remove(Object identifier) throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator= new AppCatalogQueryGenerator(APPLICATION_MODULE);
- generator.setParameter(ApplicationModuleConstants.MODULE_ID, identifier);
- 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 Resource get(Object identifier) throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(APPLICATION_MODULE);
- generator.setParameter(ApplicationModuleConstants.MODULE_ID, identifier);
- Query q = generator.selectQuery(em);
- ApplicationModule applicationModule = (ApplicationModule) q.getSingleResult();
- AppModuleResource appModuleResource =
- (AppModuleResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.APPLICATION_MODULE, applicationModule);
- em.getTransaction().commit();
- em.close();
- return appModuleResource;
- } 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<Resource> get(String fieldName, Object value) throws AppCatalogException {
- List<Resource> moduleResources = new ArrayList<Resource>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- Query q;
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(APPLICATION_MODULE);
- List results;
- if (fieldName.equals(ApplicationModuleConstants.MODULE_NAME)) {
- generator.setParameter(ApplicationModuleConstants.MODULE_NAME, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- ApplicationModule applicationModule = (ApplicationModule) result;
- AppModuleResource moduleResource =
- (AppModuleResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.APPLICATION_MODULE, applicationModule);
- moduleResources.add(moduleResource);
- }
- }
- } else {
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported field name for app module resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported field name for app module 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 moduleResources;
- }
-
- @Override
- public List<Resource> getAll() throws AppCatalogException {
- List<Resource> appModuleResources = new ArrayList<Resource>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(APPLICATION_MODULE);
- generator.setParameter(ApplicationModuleConstants.GATEWAY_ID, gatewayId);
- Query q = generator.selectQuery(em);
- List<?> results = q.getResultList();
- for (Object result : results) {
- ApplicationModule module = (ApplicationModule) result;
- AppModuleResource appModuleResource = (AppModuleResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.APPLICATION_MODULE, module);
- appModuleResources.add(appModuleResource);
- }
- 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();
- }
- }
- return appModuleResources;
- }
-
- @Override
- public List<String> getAllIds() throws AppCatalogException {
- return null;
- }
-
- @Override
- public List<String> getIds(String fieldName, Object value) throws AppCatalogException {
- List<String> moduleResources = new ArrayList<String>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- Query q;
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(APPLICATION_MODULE);
- List results;
- if (fieldName.equals(ApplicationModuleConstants.MODULE_NAME)) {
- generator.setParameter(ApplicationModuleConstants.MODULE_NAME, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- ApplicationModule applicationModule = (ApplicationModule) result;
- moduleResources.add(applicationModule.getModuleID());
- }
- }
- } else {
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported field name for app module resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported field name for app module 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 moduleResources;
- }
-
- @Override
- public void save() throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- ApplicationModule existingModule = em.find(ApplicationModule.class, moduleId);
- em.close();
-
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- if (existingModule != null){
- existingModule.setModuleName(moduleName);
- existingModule.setModuleVersion(moduleVersion);
- existingModule.setModuleDesc(moduleDesc);
- existingModule.setGatewayId(gatewayId);
- existingModule.setUpdateTime(AiravataUtils.getCurrentTimestamp());
- em.merge(existingModule);
- }else {
- ApplicationModule applicationModule = new ApplicationModule();
- applicationModule.setModuleID(moduleId);
- applicationModule.setModuleName(moduleName);
- applicationModule.setModuleVersion(moduleVersion);
- applicationModule.setModuleDesc(moduleDesc);
- applicationModule.setGatewayId(gatewayId);
- applicationModule.setCreationTime(AiravataUtils.getCurrentTimestamp());
- em.persist(applicationModule);
- }
- 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 {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- ApplicationModule applicationModule = em.find(ApplicationModule.class, identifier);
- em.close();
- return applicationModule != null;
- } 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();
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/ApplicationInputResource.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/ApplicationInputResource.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/ApplicationInputResource.java
deleted file mode 100644
index 3dcb6b4..0000000
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/ApplicationInputResource.java
+++ /dev/null
@@ -1,454 +0,0 @@
-/**
- * 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.aiaravata.application.catalog.data.resources;
-
-import org.airavata.appcatalog.cpi.AppCatalogException;
-import org.apache.aiaravata.application.catalog.data.model.AppInput_PK;
-import org.apache.aiaravata.application.catalog.data.model.ApplicationInput;
-import org.apache.aiaravata.application.catalog.data.model.ApplicationInterface;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogJPAUtils;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogQueryGenerator;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogResourceType;
-import org.apache.airavata.common.exception.ApplicationSettingsException;
-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 ApplicationInputResource extends AbstractResource {
-
- private final static Logger logger = LoggerFactory.getLogger(ApplicationInputResource.class);
-
- private String interfaceID;
- private String inputKey;
- private String dataType;
- private String inputVal;
- private String metadata;
- private String appArgument;
- private String userFriendlyDesc;
- private int inputOrder;
- private boolean standardInput;
- private boolean isRequired;
- private boolean requiredToCMD;
- private boolean dataStaged;
-
- private AppInterfaceResource appInterfaceResource;
-
- 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(APPLICATION_INPUT);
- generator.setParameter(AppInputConstants.INTERFACE_ID, ids.get(AppInputConstants.INTERFACE_ID));
- if (ids.get(AppInputConstants.INPUT_KEY) != null){
- generator.setParameter(AppInputConstants.INPUT_KEY, ids.get(AppInputConstants.INPUT_KEY));
- }
- 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();
- }
- }
- }
-
- public Resource get(Object identifier) throws AppCatalogException {
- HashMap<String, String> ids;
- if (identifier instanceof Map) {
- ids = (HashMap<String, String>) 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(APPLICATION_INPUT);
- generator.setParameter(AppInputConstants.INTERFACE_ID, ids.get(AppInputConstants.INTERFACE_ID));
- generator.setParameter(AppInputConstants.INPUT_KEY, ids.get(AppInputConstants.INPUT_KEY));
- Query q = generator.selectQuery(em);
- ApplicationInput applicationInput = (ApplicationInput) q.getSingleResult();
- ApplicationInputResource applicationInputResource =
- (ApplicationInputResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.APPLICATION_INPUT
- , applicationInput);
- em.getTransaction().commit();
- em.close();
- return applicationInputResource;
- } 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();
- }
- }
- }
-
- public List<Resource> get(String fieldName, Object value) throws AppCatalogException {
- List<Resource> appInputResources = new ArrayList<Resource>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- Query q;
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(APPLICATION_INPUT);
- List results;
- if (fieldName.equals(AppInputConstants.INTERFACE_ID)) {
- generator.setParameter(AppInputConstants.INTERFACE_ID, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- ApplicationInput applicationInput = (ApplicationInput) result;
- ApplicationInputResource applicationInputResource =
- (ApplicationInputResource) AppCatalogJPAUtils.getResource(
- AppCatalogResourceType.APPLICATION_INPUT, applicationInput);
- appInputResources.add(applicationInputResource);
- }
- }
- } else if (fieldName.equals(AppInputConstants.INPUT_KEY)) {
- generator.setParameter(AppInputConstants.INPUT_KEY, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- ApplicationInput applicationInput = (ApplicationInput) result;
- ApplicationInputResource applicationInputResource =
- (ApplicationInputResource) AppCatalogJPAUtils.getResource(
- AppCatalogResourceType.APPLICATION_INPUT, applicationInput);
- appInputResources.add(applicationInputResource);
- }
- }
- } else if (fieldName.equals(AppInputConstants.DATA_TYPE)) {
- generator.setParameter(AppInputConstants.DATA_TYPE, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- ApplicationInput applicationInput = (ApplicationInput) result;
- ApplicationInputResource applicationInputResource =
- (ApplicationInputResource) AppCatalogJPAUtils.getResource(
- AppCatalogResourceType.APPLICATION_INPUT, applicationInput);
- appInputResources.add(applicationInputResource);
- }
- }
- } else {
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported field name for AppInput Resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported field name for AppInput 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 appInputResources;
- }
-
- @Override
- public List<Resource> getAll() throws AppCatalogException {
- return null;
- }
-
- @Override
- public List<String> getAllIds() throws AppCatalogException {
- return null;
- }
-
- public List<String> getIds(String fieldName, Object value) throws AppCatalogException {
- List<String> appInputResourceIDs = new ArrayList<String>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- Query q;
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(APPLICATION_INPUT);
- List results;
- if (fieldName.equals(AppInputConstants.INTERFACE_ID)) {
- generator.setParameter(AppInputConstants.INTERFACE_ID, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- ApplicationInput applicationInput = (ApplicationInput) result;
- appInputResourceIDs.add(applicationInput.getInterfaceID());
- }
- }
- } else if (fieldName.equals(AppInputConstants.INPUT_KEY)) {
- generator.setParameter(AppInputConstants.INPUT_KEY, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- ApplicationInput applicationInput = (ApplicationInput) result;
- appInputResourceIDs.add(applicationInput.getInterfaceID());
- }
- }
- } else if (fieldName.equals(AppInputConstants.DATA_TYPE)) {
- generator.setParameter(AppInputConstants.DATA_TYPE, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- ApplicationInput applicationInput = (ApplicationInput) result;
- appInputResourceIDs.add(applicationInput.getInterfaceID());
- }
- }
- } else {
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported field name for AppInput resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported field name for AppInput 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 appInputResourceIDs;
- }
-
- public void save() throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- ApplicationInput existingApplicationInput = em.find(ApplicationInput.class, new AppInput_PK(interfaceID, inputKey));
- em.close();
- ApplicationInput applicationInput;
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- if (existingApplicationInput == null) {
- applicationInput = new ApplicationInput();
- } else {
- applicationInput=existingApplicationInput;
- }
- ApplicationInterface applicationInterface = em.find(ApplicationInterface.class, interfaceID);
- applicationInput.setApplicationInterface(applicationInterface);
- applicationInput.setInterfaceID(applicationInterface.getInterfaceID());
- applicationInput.setDataType(dataType);
- applicationInput.setInputKey(inputKey);
- applicationInput.setInputVal(inputVal);
- applicationInput.setMetadata(metadata);
- applicationInput.setAppArgument(appArgument);
- applicationInput.setUserFriendlyDesc(userFriendlyDesc);
- applicationInput.setStandardInput(standardInput);
- applicationInput.setInputOrder(inputOrder);
- applicationInput.setRequiredToCMD(requiredToCMD);
- applicationInput.setRequired(isRequired);
- applicationInput.setDataStaged(dataStaged);
- if (existingApplicationInput == null) {
- em.persist(applicationInput);
- } else {
- em.merge(applicationInput);
- }
- 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();
- }
- }
- }
-
- public boolean isExists(Object identifier) throws AppCatalogException {
- HashMap<String, String> ids;
- if (identifier instanceof Map) {
- ids = (HashMap<String, String>) 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();
- ApplicationInput applicationInput = em.find(ApplicationInput.class, new AppInput_PK(
- ids.get(AppInputConstants.INTERFACE_ID),
- ids.get(AppInputConstants.INPUT_KEY)));
-
- em.close();
- return applicationInput != null;
- } 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();
- }
- }
- }
-
- public String getInterfaceID() {
- return interfaceID;
- }
-
- public void setInterfaceID(String interfaceID) {
- this.interfaceID = interfaceID;
- }
-
- public String getInputKey() {
- return inputKey;
- }
-
- public void setInputKey(String inputKey) {
- this.inputKey = inputKey;
- }
-
- public String getDataType() {
- return dataType;
- }
-
- public void setDataType(String dataType) {
- this.dataType = dataType;
- }
-
- public String getInputVal() {
- return inputVal;
- }
-
- public void setInputVal(String inputVal) {
- this.inputVal = inputVal;
- }
-
- public String getMetadata() {
- return metadata;
- }
-
- public void setMetadata(String metadata) {
- this.metadata = metadata;
- }
-
- public String getAppArgument() {
- return appArgument;
- }
-
- public void setAppArgument(String appArgument) {
- this.appArgument = appArgument;
- }
-
- public String getUserFriendlyDesc() {
- return userFriendlyDesc;
- }
-
- public void setUserFriendlyDesc(String userFriendlyDesc) {
- this.userFriendlyDesc = userFriendlyDesc;
- }
-
- public AppInterfaceResource getAppInterfaceResource() {
- return appInterfaceResource;
- }
-
- public void setAppInterfaceResource(AppInterfaceResource appInterfaceResource) {
- this.appInterfaceResource = appInterfaceResource;
- }
-
- public boolean isStandardInput() {
- return standardInput;
- }
-
- public void setStandardInput(boolean standardInput) {
- this.standardInput = standardInput;
- }
-
- public int getInputOrder() {
- return inputOrder;
- }
-
- public void setInputOrder(int inputOrder) {
- this.inputOrder = inputOrder;
- }
-
- public boolean getRequired() {
- return isRequired;
- }
-
- public void setRequired(boolean required) {
- this.isRequired = required;
- }
-
- public boolean getRequiredToCMD() {
- return requiredToCMD;
- }
-
- public void setRequiredToCMD(boolean requiredToCMD) {
- this.requiredToCMD = requiredToCMD;
- }
-
- public boolean isDataStaged() {
- return dataStaged;
- }
-
- public void setDataStaged(boolean dataStaged) {
- this.dataStaged = dataStaged;
- }
-}
[37/52] [abbrv] [partial] airavata git commit: registry refactoring
Posted by sh...@apache.org.
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/util/AppCatalogThriftConversion.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/util/AppCatalogThriftConversion.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/util/AppCatalogThriftConversion.java
deleted file mode 100644
index 123ae96..0000000
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/util/AppCatalogThriftConversion.java
+++ /dev/null
@@ -1,800 +0,0 @@
-/*
- *
- * 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.aiaravata.application.catalog.data.util;
-
-import org.airavata.appcatalog.cpi.AppCatalogException;
-import org.apache.aiaravata.application.catalog.data.resources.*;
-import org.apache.airavata.model.Workflow;
-import org.apache.airavata.model.appcatalog.appdeployment.ApplicationDeploymentDescription;
-import org.apache.airavata.model.appcatalog.appdeployment.ApplicationModule;
-import org.apache.airavata.model.appcatalog.appdeployment.ApplicationParallelismType;
-import org.apache.airavata.model.appcatalog.appdeployment.SetEnvPaths;
-import org.apache.airavata.model.appcatalog.appinterface.*;
-import org.apache.airavata.model.appcatalog.computeresource.*;
-import org.apache.airavata.model.appcatalog.computeresource.BatchQueue;
-import org.apache.airavata.model.appcatalog.computeresource.CloudJobSubmission;
-import org.apache.airavata.model.appcatalog.computeresource.DataMovementInterface;
-import org.apache.airavata.model.appcatalog.computeresource.JobManagerCommand;
-import org.apache.airavata.model.appcatalog.computeresource.JobSubmissionInterface;
-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.GatewayResourceProfile;
-
-import java.util.*;
-
-public class AppCatalogThriftConversion {
- public static ComputeResourceResource getComputeHostResource (ComputeResourceDescription description){
- ComputeResourceResource resource = new ComputeResourceResource();
- resource.setHostName(description.getHostName());
- resource.setResourceDescription(description.getResourceDescription());
- resource.setResourceId(description.getComputeResourceId());
- resource.setMaxMemoryPerNode(description.getMaxMemoryPerNode());
- return resource;
- }
-
- public static ComputeResourceDescription getComputeHostDescription (ComputeResourceResource resource) throws AppCatalogException {
- ComputeResourceDescription description = new ComputeResourceDescription();
- description.setComputeResourceId(resource.getResourceId());
- description.setHostName(resource.getHostName());
- description.setResourceDescription(resource.getResourceDescription());
- description.setMaxMemoryPerNode(resource.getMaxMemoryPerNode());
- HostAliasResource aliasResource = new HostAliasResource();
- List<Resource> resources = aliasResource.get(AbstractResource.HostAliasConstants.RESOURCE_ID, resource.getResourceId());
- if (resources != null && !resources.isEmpty()){
- description.setHostAliases(getHostAliases(resources));
- }
- HostIPAddressResource ipAddressResource = new HostIPAddressResource();
- List<Resource> ipAddresses = ipAddressResource.get(AbstractResource.HostIPAddressConstants.RESOURCE_ID, resource.getResourceId());
- if (ipAddresses != null && !ipAddresses.isEmpty()){
- description.setIpAddresses(getIpAddresses(ipAddresses));
- }
-
- BatchQueueResource bqResource = new BatchQueueResource();
- List<Resource> batchQueues = bqResource.get(AbstractResource.BatchQueueConstants.COMPUTE_RESOURCE_ID, resource.getResourceId());
- if (batchQueues != null && !batchQueues.isEmpty()){
- description.setBatchQueues(getBatchQueues(batchQueues));
- }
-
- ComputeResourceFileSystemResource fsResource = new ComputeResourceFileSystemResource();
- List<Resource> fsList = fsResource.get(AbstractResource.ComputeResourceFileSystemConstants.COMPUTE_RESOURCE_ID, resource.getResourceId());
- description.setFileSystems(new HashMap<FileSystems,String>());
- if (fsList != null && !fsList.isEmpty()){
- for (Resource r : fsList) {
- ComputeResourceFileSystemResource rr=(ComputeResourceFileSystemResource)r;
- description.getFileSystems().put(FileSystems.valueOf(rr.getFileSystem()), rr.getPath());
- }
- }
-
- JobSubmissionInterfaceResource jsiResource = new JobSubmissionInterfaceResource();
- List<Resource> hsiList = jsiResource.get(AbstractResource.JobSubmissionInterfaceConstants.COMPUTE_RESOURCE_ID, resource.getResourceId());
- if (hsiList != null && !hsiList.isEmpty()){
- description.setJobSubmissionInterfaces(getJobSubmissionInterfaces(hsiList));
- }
-
- DataMovementInterfaceResource dmiResource = new DataMovementInterfaceResource();
- List<Resource> dmiList = dmiResource.get(AbstractResource.DataMovementInterfaceConstants.COMPUTE_RESOURCE_ID, resource.getResourceId());
- if (dmiList != null && !dmiList.isEmpty()){
- description.setDataMovementInterfaces(getDataMovementInterfaces(dmiList));
- }
- return description;
- }
-
- public static List<ComputeResourceDescription> getComputeDescriptionList (List<Resource> resources) throws AppCatalogException {
- List<ComputeResourceDescription> list = new ArrayList<ComputeResourceDescription>();
- for (Resource resource : resources){
- list.add(getComputeHostDescription((ComputeResourceResource)resource));
- }
- return list;
- }
-
- public static List<String> getHostAliases (List<Resource> resources){
- List<String> hostAliases = new ArrayList<String>();
- for (Resource alias : resources){
- hostAliases.add(((HostAliasResource)alias).getAlias());
- }
- return hostAliases;
- }
-
- public static List<String> getIpAddresses (List<Resource> resources){
- List<String> hostIpAddresses = new ArrayList<String>();
- for (Resource resource : resources){
- hostIpAddresses.add(((HostIPAddressResource)resource).getIpaddress());
- }
- return hostIpAddresses;
- }
-
- public static List<BatchQueue> getBatchQueues (List<Resource> resources){
- List<BatchQueue> batchQueues = new ArrayList<BatchQueue>();
- for (Resource resource : resources){
- batchQueues.add(getBatchQueue((BatchQueueResource)resource));
- }
- return batchQueues;
- }
-
- public static List<DataMovementInterface> getDataMovementInterfaces(List<Resource> resources){
- List<DataMovementInterface> dataMovementInterfaces = new ArrayList<DataMovementInterface>();
- for (Resource resource : resources){
- dataMovementInterfaces.add(getDataMovementInterface((DataMovementInterfaceResource)resource));
- }
- return dataMovementInterfaces;
- }
-
- public static DataMovementInterface getDataMovementInterface(DataMovementInterfaceResource resource){
- DataMovementInterface dmi = new DataMovementInterface();
- dmi.setDataMovementInterfaceId(resource.getDataMovementInterfaceId());
- dmi.setDataMovementProtocol(DataMovementProtocol.valueOf(resource.getDataMovementProtocol()));
- dmi.setPriorityOrder(resource.getPriorityOrder());
- return dmi;
- }
-
- public static DataMovementInterfaceResource getDataMovementInterface(DataMovementInterface resource){
- DataMovementInterfaceResource dmi = new DataMovementInterfaceResource();
- dmi.setDataMovementInterfaceId(resource.getDataMovementInterfaceId());
- dmi.setDataMovementProtocol(resource.getDataMovementProtocol().toString());
- dmi.setPriorityOrder(resource.getPriorityOrder());
- return dmi;
- }
-
- public static List<JobSubmissionInterface> getJobSubmissionInterfaces(List<Resource> resources){
- List<JobSubmissionInterface> jobSubmissionInterfaces = new ArrayList<JobSubmissionInterface>();
- for (Resource resource : resources){
- jobSubmissionInterfaces.add(getJobSubmissionInterface((JobSubmissionInterfaceResource)resource));
- }
- return jobSubmissionInterfaces;
- }
-
- public static JobSubmissionInterface getJobSubmissionInterface(JobSubmissionInterfaceResource resource){
- JobSubmissionInterface jsi = new JobSubmissionInterface();
- jsi.setJobSubmissionInterfaceId(resource.getJobSubmissionInterfaceId());
- jsi.setJobSubmissionProtocol(JobSubmissionProtocol.valueOf(resource.getJobSubmissionProtocol()));
- jsi.setPriorityOrder(resource.getPriorityOrder());
- return jsi;
- }
-
- public static JobSubmissionInterfaceResource getJobSubmissionInterface(JobSubmissionInterface resource){
- JobSubmissionInterfaceResource jsi = new JobSubmissionInterfaceResource();
- jsi.setJobSubmissionInterfaceId(resource.getJobSubmissionInterfaceId());
- jsi.setJobSubmissionProtocol(resource.getJobSubmissionProtocol().toString());
- jsi.setPriorityOrder(resource.getPriorityOrder());
- return jsi;
- }
-
- public static BatchQueue getBatchQueue(BatchQueueResource resource){
- BatchQueue batchQueue = new BatchQueue();
- batchQueue.setMaxJobsInQueue(resource.getMaxJobInQueue());
- batchQueue.setMaxNodes(resource.getMaxNodes());
- batchQueue.setMaxProcessors(resource.getMaxProcessors());
- batchQueue.setMaxRunTime(resource.getMaxRuntime());
- batchQueue.setMaxMemory(resource.getMaxMemory());
- batchQueue.setQueueDescription(resource.getQueueDescription());
- batchQueue.setQueueName(resource.getQueueName());
- return batchQueue;
- }
-
- public static BatchQueueResource getBatchQueue(BatchQueue resource){
- BatchQueueResource batchQueue = new BatchQueueResource();
- batchQueue.setMaxJobInQueue(resource.getMaxJobsInQueue());
- batchQueue.setMaxNodes(resource.getMaxNodes());
- batchQueue.setMaxProcessors(resource.getMaxProcessors());
- batchQueue.setMaxRuntime(resource.getMaxRunTime());
- batchQueue.setQueueDescription(resource.getQueueDescription());
- batchQueue.setQueueName(resource.getQueueName());
- batchQueue.setMaxMemory(resource.getMaxMemory());
- return batchQueue;
- }
-
-// public static Map<String, JobSubmissionProtocol> getJobSubmissionProtocolList(List<Resource> resources){
-// Map<String, JobSubmissionProtocol> protocols = new HashMap<String, JobSubmissionProtocol>();
-// for (Resource resource : resources){
-// JobSubmissionProtocolResource submission = (JobSubmissionProtocolResource) resource;
-// protocols.put(submission.getSubmissionID(), JobSubmissionProtocol.valueOf(submission.getJobType()));
-// }
-// return protocols;
-// }
-
-// public static Map<String, DataMovementProtocol> getDataMoveProtocolList(List<Resource> resources){
-// Map<String, DataMovementProtocol> protocols = new HashMap<String, DataMovementProtocol>();
-// for (Resource resource : resources){
-// DataMovementProtocolResource protocolResource = (DataMovementProtocolResource) resource;
-// protocols.put(protocolResource.getDataMoveID(), DataMovementProtocol.valueOf(protocolResource.getDataMoveType()));
-// }
-// return protocols;
-// }
-
- public static SshJobSubmissionResource getSSHJobSubmission (SSHJobSubmission submission){
- SshJobSubmissionResource resource = new SshJobSubmissionResource();
- resource.setAlternativeSshHostname(submission.getAlternativeSSHHostName());
- resource.setJobSubmissionInterfaceId(submission.getJobSubmissionInterfaceId());
- ResourceJobManagerResource resourceJobManager = getResourceJobManager(submission.getResourceJobManager());
-// resourceJobManager.setResourceJobManagerId(submission.getJobSubmissionInterfaceId());
- resource.setResourceJobManagerId(resourceJobManager.getResourceJobManagerId());
- if (submission.getMonitorMode() != null){
- resource.setMonitorMode(submission.getMonitorMode().toString());
- }
- resource.setResourceJobManagerResource(resourceJobManager);
- if (submission.getSecurityProtocol() != null){
- resource.setSecurityProtocol(submission.getSecurityProtocol().toString());
- }
- resource.setSshPort(submission.getSshPort());
- return resource;
- }
-
-
- public static UnicoreJobSubmissionResource getUnicoreJobSubmission (UnicoreJobSubmission submission){
- UnicoreJobSubmissionResource resource = new UnicoreJobSubmissionResource();
- resource.setjobSubmissionInterfaceId(submission.getJobSubmissionInterfaceId());
- if (submission.getSecurityProtocol() != null){
- resource.setSecurityProtocol(submission.getSecurityProtocol().toString());
- }
- resource.setUnicoreEndpointUrl(submission.getUnicoreEndPointURL());
- return resource;
- }
-
- public static UnicoreDataMovementResource getUnicoreDMResource (UnicoreDataMovement dataMovement){
- UnicoreDataMovementResource resource = new UnicoreDataMovementResource();
- resource.setDataMovementId(dataMovement.getDataMovementInterfaceId());
- if (dataMovement.getSecurityProtocol() != null){
- resource.setSecurityProtocol(dataMovement.getSecurityProtocol().toString());
- }
- resource.setUnicoreEndpointUrl(dataMovement.getUnicoreEndPointURL());
- return resource;
- }
-
-
- public static CloudSubmissionResource getCloudJobSubmission (CloudJobSubmission submission){
- CloudSubmissionResource resource = new CloudSubmissionResource();
- resource.setJobSubmissionInterfaceId(submission.getJobSubmissionInterfaceId());
- if (submission.getSecurityProtocol() != null){
- resource.setSecurityProtocol(submission.getSecurityProtocol().toString());
- }
- if(submission.getProviderName() != null){
- resource.setProviderName(submission.getProviderName().toString());
- }
- resource.setUserAccountName(submission.getUserAccountName());
- resource.setNodeId(submission.getNodeId());
- resource.setExecutableType(submission.getExecutableType());
- return resource;
- }
-
- public static LocalDataMovementResource getLocalDataMovement(LOCALDataMovement localSubmission)throws AppCatalogException {
- LocalDataMovementResource submission = new LocalDataMovementResource();
- submission.setDataMovementInterfaceId(localSubmission.getDataMovementInterfaceId());
- return submission;
- }
-
- public static LOCALDataMovement getLocalDataMovement(LocalDataMovementResource localSubmission)throws AppCatalogException {
- LOCALDataMovement submission = new LOCALDataMovement();
- submission.setDataMovementInterfaceId(localSubmission.getDataMovementInterfaceId());
- return submission;
- }
-
-
- public static LocalSubmissionResource getLocalJobSubmission(LOCALSubmission localSubmission)throws AppCatalogException {
- LocalSubmissionResource submission = new LocalSubmissionResource();
- submission.setJobSubmissionInterfaceId(localSubmission.getJobSubmissionInterfaceId());
- ResourceJobManagerResource resourceJobManager = getResourceJobManager(localSubmission.getResourceJobManager());
- submission.setResourceJobManagerId(resourceJobManager.getResourceJobManagerId());
- submission.setResourceJobManagerResource(resourceJobManager);
- return submission;
- }
-
- public static LOCALSubmission getLocalJobSubmission(LocalSubmissionResource localSubmission)throws AppCatalogException {
- LOCALSubmission submission = new LOCALSubmission();
- submission.setJobSubmissionInterfaceId(localSubmission.getJobSubmissionInterfaceId());
- submission.setResourceJobManager(getResourceJobManager(localSubmission.getResourceJobManagerResource()));
- return submission;
- }
-
- public static ResourceJobManagerResource getResourceJobManager(ResourceJobManager manager){
- ResourceJobManagerResource r = new ResourceJobManagerResource();
- r.setResourceJobManagerId(manager.getResourceJobManagerId());
- r.setJobManagerBinPath(manager.getJobManagerBinPath());
- r.setPushMonitoringEndpoint(manager.getPushMonitoringEndpoint());
- r.setResourceJobManagerType(manager.getResourceJobManagerType().toString());
- return r;
- }
-
- public static ResourceJobManager getResourceJobManager(ResourceJobManagerResource manager) throws AppCatalogException {
- ResourceJobManager r = new ResourceJobManager();
- r.setResourceJobManagerId(manager.getResourceJobManagerId());
- r.setJobManagerBinPath(manager.getJobManagerBinPath());
- r.setPushMonitoringEndpoint(manager.getPushMonitoringEndpoint());
- r.setResourceJobManagerType(ResourceJobManagerType.valueOf(manager.getResourceJobManagerType()));
- r.setJobManagerCommands(new HashMap<JobManagerCommand, String>());
- JobManagerCommandResource jmcr=new JobManagerCommandResource();
- List<Resource> jmcrList = jmcr.get(AbstractResource.JobManagerCommandConstants.RESOURCE_JOB_MANAGER_ID, manager.getResourceJobManagerId());
- if (jmcrList != null && !jmcrList.isEmpty()){
- for (Resource rrr : jmcrList) {
- JobManagerCommandResource rr=(JobManagerCommandResource)rrr;
- r.getJobManagerCommands().put(JobManagerCommand.valueOf(rr.getCommandType()), rr.getCommand());
- }
- }
- return r;
- }
-
-
- public static SSHJobSubmission getSSHJobSubmissionDescription (SshJobSubmissionResource submission) throws AppCatalogException {
- SSHJobSubmission sshJobSubmission = new SSHJobSubmission();
- sshJobSubmission.setAlternativeSSHHostName(submission.getAlternativeSshHostname());
- sshJobSubmission.setJobSubmissionInterfaceId(submission.getJobSubmissionInterfaceId());
- sshJobSubmission.setResourceJobManager(getResourceJobManager(submission.getResourceJobManagerResource()));
- sshJobSubmission.setSecurityProtocol(SecurityProtocol.valueOf(submission.getSecurityProtocol()));
- sshJobSubmission.setSshPort(submission.getSshPort());
- if (submission.getMonitorMode() != null){
- sshJobSubmission.setMonitorMode(MonitorMode.valueOf(submission.getMonitorMode()));
- }
- return sshJobSubmission;
- }
-
- public static UnicoreJobSubmission getUnicoreJobSubmissionDescription (UnicoreJobSubmissionResource submission) throws AppCatalogException {
- UnicoreJobSubmission unicoreJobSubmission = new UnicoreJobSubmission();
- unicoreJobSubmission.setUnicoreEndPointURL(submission.getUnicoreEndpointUrl());
- unicoreJobSubmission.setJobSubmissionInterfaceId(submission.getjobSubmissionInterfaceId());
- if (submission.getSecurityProtocol() != null){
- unicoreJobSubmission.setSecurityProtocol(SecurityProtocol.valueOf(submission.getSecurityProtocol()));
- }
- return unicoreJobSubmission;
- }
-
- public static UnicoreDataMovement getUnicoreDMDescription (UnicoreDataMovementResource resource) throws AppCatalogException {
- UnicoreDataMovement dataMovement = new UnicoreDataMovement();
- dataMovement.setUnicoreEndPointURL(resource.getUnicoreEndpointUrl());
- dataMovement.setDataMovementInterfaceId(resource.getDataMovementId());
- if (resource.getSecurityProtocol() != null){
- dataMovement.setSecurityProtocol(SecurityProtocol.valueOf(resource.getSecurityProtocol()));
- }
- return dataMovement;
- }
-
-
- public static CloudJobSubmission getCloudJobSubmissionDescription (CloudSubmissionResource submission) throws AppCatalogException {
- CloudJobSubmission cloudJobSubmission = new CloudJobSubmission();
- cloudJobSubmission.setJobSubmissionInterfaceId(submission.getJobSubmissionInterfaceId());
- cloudJobSubmission.setExecutableType(submission.getExecutableType());
- cloudJobSubmission.setSecurityProtocol(SecurityProtocol.valueOf(submission.getSecurityProtocol()));
- cloudJobSubmission.setNodeId(submission.getNodeId());
- cloudJobSubmission.setUserAccountName(submission.getUserAccountName());
- cloudJobSubmission.setProviderName(ProviderName.valueOf(submission.getProviderName()));
- return cloudJobSubmission;
- }
-
-// public static GlobusJobSubmission getGlobusJobSubmissionDescription (GlobusJobSubmissionResource submission) throws AppCatalogException {
-// GlobusJobSubmission globusJobSubmission = new GlobusJobSubmission();
-// globusJobSubmission.setJobSubmissionInterfaceId(submission.getSubmissionID());
-// globusJobSubmission.setResourceJobManager(ResourceJobManager.valueOf(submission.getResourceJobManager()));
-// globusJobSubmission.setSecurityProtocol(SecurityProtocol.valueOf(submission.getSecurityProtocol()));
-//
-// GlobusGKEndpointResource endpointResource = new GlobusGKEndpointResource();
-// List<Resource> endpoints = endpointResource.get(AbstractResource.GlobusEPConstants.SUBMISSION_ID, submission.getSubmissionID());
-// if (endpoints != null && !endpoints.isEmpty()){
-// globusJobSubmission.setGlobusGateKeeperEndPoint(getGlobusGateKeeperEndPointList(endpoints));
-// }
-//
-// return globusJobSubmission;
-// }
-
- public static SCPDataMovement getSCPDataMovementDescription (ScpDataMovementResource dataMovementResource) throws AppCatalogException {
- SCPDataMovement dataMovement = new SCPDataMovement();
- dataMovement.setDataMovementInterfaceId(dataMovementResource.getDataMovementInterfaceId());
- dataMovement.setAlternativeSCPHostName(dataMovementResource.getAlternativeScpHostname());
- dataMovement.setSecurityProtocol(SecurityProtocol.valueOf(dataMovementResource.getSecurityProtocol()));
- dataMovement.setSshPort(dataMovementResource.getSshPort());
- return dataMovement;
- }
-
- public static ScpDataMovementResource getSCPDataMovementDescription (SCPDataMovement dataMovementResource) throws AppCatalogException {
- ScpDataMovementResource dataMovement = new ScpDataMovementResource();
- dataMovement.setDataMovementInterfaceId(dataMovementResource.getDataMovementInterfaceId());
- dataMovement.setAlternativeScpHostname(dataMovementResource.getAlternativeSCPHostName());
- dataMovement.setSecurityProtocol(dataMovementResource.getSecurityProtocol().toString());
- dataMovement.setSshPort(dataMovementResource.getSshPort());
- return dataMovement;
- }
-
- public static GridFTPDataMovement getGridFTPDataMovementDescription (GridftpDataMovementResource dataMovementResource) throws AppCatalogException {
- GridFTPDataMovement dataMovement = new GridFTPDataMovement();
- dataMovement.setDataMovementInterfaceId(dataMovementResource.getDataMovementInterfaceId());
- dataMovement.setSecurityProtocol(SecurityProtocol.valueOf(dataMovementResource.getSecurityProtocol()));
- GridftpEndpointResource endpointResource = new GridftpEndpointResource();
- List<Resource> endpoints = endpointResource.get(AbstractResource.GridftpEndpointConstants.DATA_MOVEMENT_INTERFACE_ID, dataMovementResource.getDataMovementInterfaceId());
- if (endpoints != null && !endpoints.isEmpty()){
- dataMovement.setGridFTPEndPoints(getGridFTPDMEPList(endpoints));
- }
- return dataMovement;
- }
-
- public static GridftpDataMovementResource getGridFTPDataMovementDescription (GridFTPDataMovement dataMovementResource) throws AppCatalogException {
- GridftpDataMovementResource dataMovement = new GridftpDataMovementResource();
- dataMovement.setDataMovementInterfaceId(dataMovementResource.getDataMovementInterfaceId());
- dataMovement.setSecurityProtocol(dataMovementResource.getSecurityProtocol().toString());
- return dataMovement;
- }
-
- public static List<String> getGridFTPDMEPList (List<Resource> endpoints){
- List<String> list = new ArrayList<String>();
- for (Resource resource : endpoints){
- list.add(((GridftpEndpointResource) resource).getEndpoint());
- }
- return list;
- }
-
- public static List<String> getGlobusGateKeeperEndPointList (List<Resource> resources) throws AppCatalogException {
- List<String> list = new ArrayList<String>();
- for (Resource resource : resources){
- list.add(((GlobusGKEndpointResource) resource).getEndpoint());
- }
- return list;
- }
-//
-// public static List<GSISSHJobSubmission> getGSISSHSubmissionList (List<Resource> resources) throws AppCatalogException {
-// List<GSISSHJobSubmission> list = new ArrayList<GSISSHJobSubmission>();
-// for (Resource resource : resources){
-// list.add(getGSISSHSubmissionDescription((GSISSHSubmissionResource) resource));
-// }
-// return list;
-// }
-//
-// public static List<GlobusJobSubmission> getGlobusSubmissionList (List<Resource> resources) throws AppCatalogException {
-// List<GlobusJobSubmission> list = new ArrayList<GlobusJobSubmission>();
-// for (Resource resource : resources){
-// list.add(getGlobusJobSubmissionDescription((GlobusJobSubmissionResource) resource));
-// }
-// return list;
-// }
-//
-// public static List<SSHJobSubmission> getSSHSubmissionList (List<Resource> resources) throws AppCatalogException {
-// List<SSHJobSubmission> list = new ArrayList<SSHJobSubmission>();
-// for (Resource resource : resources){
-// list.add(getSSHJobSubmissionDescription((SshJobSubmissionResource) resource));
-// }
-// return list;
-// }
-//
-// public static List<GridFTPDataMovement> getGridFTPDataMovementList (List<Resource> resources) throws AppCatalogException {
-// List<GridFTPDataMovement> list = new ArrayList<GridFTPDataMovement>();
-// for (Resource resource : resources){
-// list.add(getGridFTPDataMovementDescription((GridftpDataMovementResource) resource));
-// }
-// return list;
-// }
-//
-// public static List<SCPDataMovement> getSCPDataMovementList (List<Resource> resources) throws AppCatalogException {
-// List<SCPDataMovement> list = new ArrayList<SCPDataMovement>();
-// for (Resource resource : resources){
-// list.add(getSCPDataMovementDescription((ScpDataMovementResource) resource));
-// }
-// return list;
-// }
-//
-// public static Set<String> getGSISSHExports (List<Resource> gsisshExportResources){
-// Set<String> exports = new HashSet<String>();
-// for (Resource resource : gsisshExportResources){
-// exports.add(((GSISSHExportResource) resource).getExport());
-// }
-// return exports;
-// }
-//
-// public static List<String> getGSISSHPreJobCommands (List<Resource> gsisshPreJobCommandResources){
-// List<String> list = new ArrayList<String>();
-// for (Resource resource : gsisshPreJobCommandResources){
-// list.add(((GSISSHPreJobCommandResource) resource).getCommand());
-// }
-// return list;
-// }
-//
-// public static List<String> getGSISSHPostJobCommands (List<Resource> gsisshPostJobCommandResources){
-// List<String> list = new ArrayList<String>();
-// for (Resource resource : gsisshPostJobCommandResources){
-// list.add(((GSISSHPostJobCommandResource) resource).getCommand());
-// }
-// return list;
-// }
-//
-// public static GlobusJobSubmissionResource getGlobusJobSubmission (GlobusJobSubmission submission){
-// GlobusJobSubmissionResource resource = new GlobusJobSubmissionResource();
-// resource.setSubmissionID(submission.getJobSubmissionDataID());
-// resource.setSecurityProtocol(submission.getSecurityProtocol().toString());
-// resource.setResourceJobManager(submission.getResourceJobManager().toString());
-// return resource;
-// }
-
- public static ApplicationModule getApplicationModuleDesc (AppModuleResource resource){
- ApplicationModule module = new ApplicationModule();
- module.setAppModuleId(resource.getModuleId());
- module.setAppModuleDescription(resource.getModuleDesc());
- module.setAppModuleName(resource.getModuleName());
- module.setAppModuleVersion(resource.getModuleVersion());
- return module;
- }
-
- public static ApplicationInterfaceDescription getApplicationInterfaceDescription (AppInterfaceResource resource) throws AppCatalogException {
- ApplicationInterfaceDescription description = new ApplicationInterfaceDescription();
- description.setApplicationInterfaceId(resource.getInterfaceId());
- description.setApplicationName(resource.getAppName());
- description.setApplicationDescription(resource.getAppDescription());
-
- AppModuleMappingResource appModuleMappingResource = new AppModuleMappingResource();
- List<Resource> appModules = appModuleMappingResource.get(AbstractResource.AppModuleMappingConstants.INTERFACE_ID, resource.getInterfaceId());
- if (appModules != null && !appModules.isEmpty()){
- description.setApplicationModules(getAppModuleIds(appModules));
- }
-
- ApplicationInputResource inputResource = new ApplicationInputResource();
- List<Resource> appInputs = inputResource.get(AbstractResource.AppInputConstants.INTERFACE_ID, resource.getInterfaceId());
- if (appInputs != null && !appInputs.isEmpty()){
- description.setApplicationInputs(getAppInputs(appInputs));
- }
-
- ApplicationOutputResource outputResource = new ApplicationOutputResource();
- List<Resource> appOutputs = outputResource.get(AbstractResource.AppOutputConstants.INTERFACE_ID, resource.getInterfaceId());
- if (appOutputs != null && !appOutputs.isEmpty()){
- description.setApplicationOutputs(getAppOutputs(appOutputs));
- }
- return description;
- }
-
- public static List<String> getAppModuleIds (List<Resource> appModuleMappings){
- List<String> modules = new ArrayList<String>();
- for (Resource resource : appModuleMappings){
- modules.add(((AppModuleMappingResource)resource).getModuleId());
- }
- return modules;
- }
-
- public static List<ApplicationModule> getAppModules (List<Resource> appModules){
- List<ApplicationModule> modules = new ArrayList<ApplicationModule>();
- for (Resource resource : appModules){
- modules.add(getApplicationModuleDesc((AppModuleResource) resource));
- }
- return modules;
- }
-
- public static List<ApplicationInterfaceDescription> getAppInterfaceDescList (List<Resource> appInterfaces) throws AppCatalogException {
- List<ApplicationInterfaceDescription> interfaceDescriptions = new ArrayList<ApplicationInterfaceDescription>();
- for (Resource resource : appInterfaces){
- interfaceDescriptions.add(getApplicationInterfaceDescription((AppInterfaceResource) resource));
- }
- return interfaceDescriptions;
- }
-
- public static List<InputDataObjectType> getAppInputs (List<Resource> resources){
- List<InputDataObjectType> inputs = new ArrayList<InputDataObjectType>();
- for (Resource resource : resources){
- inputs.add(getInputDataObjType((ApplicationInputResource) resource));
- }
- return inputs;
- }
-
- public static InputDataObjectType getInputDataObjType (ApplicationInputResource input){
- InputDataObjectType inputDataObjectType = new InputDataObjectType();
- inputDataObjectType.setName(input.getInputKey());
- inputDataObjectType.setValue(input.getInputVal());
- inputDataObjectType.setApplicationArgument(input.getAppArgument());
- inputDataObjectType.setInputOrder(input.getInputOrder());
- inputDataObjectType.setMetaData(input.getMetadata());
- inputDataObjectType.setType(DataType.valueOf(input.getDataType()));
- inputDataObjectType.setStandardInput(input.isStandardInput());
- inputDataObjectType.setUserFriendlyDescription(input.getUserFriendlyDesc());
- inputDataObjectType.setIsRequired(input.getRequired());
- inputDataObjectType.setRequiredToAddedToCommandLine(input.getRequiredToCMD());
- inputDataObjectType.setDataStaged(input.isDataStaged());
- return inputDataObjectType;
- }
-
- public static List<OutputDataObjectType> getAppOutputs (List<Resource> resources){
- List<OutputDataObjectType> outputs = new ArrayList<OutputDataObjectType>();
- for (Resource resource : resources){
- outputs.add(getOutputDataObjType((ApplicationOutputResource) resource));
- }
- return outputs;
- }
- public static OutputDataObjectType getOutputDataObjType (ApplicationOutputResource output){
- OutputDataObjectType outputDataObjectType = new OutputDataObjectType();
- outputDataObjectType.setName(output.getOutputKey());
- outputDataObjectType.setValue(output.getOutputVal());
- outputDataObjectType.setType(DataType.valueOf(output.getDataType()));
- outputDataObjectType.setIsRequired(output.getRequired());
- outputDataObjectType.setRequiredToAddedToCommandLine(output.getRequiredToCMD());
- outputDataObjectType.setDataMovement(output.isDataMovement());
- outputDataObjectType.setLocation(output.getDataNameLocation());
- outputDataObjectType.setSearchQuery(output.getSearchQuery());
- outputDataObjectType.setApplicationArgument(output.getAppArgument());
- return outputDataObjectType;
- }
-
- public static ApplicationDeploymentDescription getApplicationDeploymentDescription (AppDeploymentResource resource) throws AppCatalogException {
- ApplicationDeploymentDescription description = new ApplicationDeploymentDescription();
- description.setAppDeploymentId(resource.getDeploymentId());
- description.setAppModuleId(resource.getAppModuleId());
- description.setComputeHostId(resource.getHostId());
- description.setExecutablePath(resource.getExecutablePath());
- if (resource.getParallelism() != null){
- description.setParallelism(ApplicationParallelismType.valueOf(resource.getParallelism()));
- }
- description.setAppDeploymentDescription(resource.getAppDes());
- ModuleLoadCmdResource cmdResource = new ModuleLoadCmdResource();
- List<Resource> moduleLoadCmds = cmdResource.get(AbstractResource.ModuleLoadCmdConstants.APP_DEPLOYMENT_ID, resource.getDeploymentId());
- if (moduleLoadCmds != null && !moduleLoadCmds.isEmpty()){
- for (Resource moduleLoadCmd : moduleLoadCmds){
- description.addToModuleLoadCmds(((ModuleLoadCmdResource) moduleLoadCmd).getCmd());
- }
- }
- LibraryPrepandPathResource prepandPathResource = new LibraryPrepandPathResource();
- List<Resource> libPrepandPaths = prepandPathResource.get(AbstractResource.LibraryPrepandPathConstants.DEPLOYMENT_ID, resource.getDeploymentId());
- if (libPrepandPaths != null && !libPrepandPaths.isEmpty()){
- description.setLibPrependPaths(getLibPrepandPaths(libPrepandPaths));
- }
-
- LibraryApendPathResource apendPathResource = new LibraryApendPathResource();
- List<Resource> libApendPaths = apendPathResource.get(AbstractResource.LibraryPrepandPathConstants.DEPLOYMENT_ID, resource.getDeploymentId());
- if (libApendPaths != null && !libApendPaths.isEmpty()){
- description.setLibAppendPaths(getLibApendPaths(libApendPaths));
- }
-
- AppEnvironmentResource appEnvironmentResource = new AppEnvironmentResource();
- List<Resource> appEnvList = appEnvironmentResource.get(AbstractResource.LibraryPrepandPathConstants.DEPLOYMENT_ID, resource.getDeploymentId());
- if (appEnvList != null && !appEnvList.isEmpty()){
- description.setSetEnvironment(getAppEnvPaths(appEnvList));
- }
- PreJobCommandResource preJobCommandResource = new PreJobCommandResource();
- List<Resource> preJobCommands = preJobCommandResource.get(AbstractResource.PreJobCommandConstants.DEPLOYMENT_ID, resource.getDeploymentId());
- if (preJobCommands != null && !preJobCommands.isEmpty()){
- for (Resource prejobCommand : preJobCommands){
- description.addToPreJobCommands(((PreJobCommandResource) prejobCommand).getCommand());
- }
- }
- PostJobCommandResource postJobCommandResource = new PostJobCommandResource();
- List<Resource> postJobCommands = postJobCommandResource.get(AbstractResource.PostJobCommandConstants.DEPLOYMENT_ID, resource.getDeploymentId());
- if (postJobCommands != null && !postJobCommands.isEmpty()){
- for (Resource postjobCommand : postJobCommands){
- description.addToPostJobCommands(((PostJobCommandResource) postjobCommand).getCommand());
- }
- }
- return description;
- }
-
- public static List<ApplicationDeploymentDescription> getAppDepDescList (List<Resource> resources) throws AppCatalogException {
- List<ApplicationDeploymentDescription> appList = new ArrayList<ApplicationDeploymentDescription>();
- for (Resource resource : resources){
- appList.add(getApplicationDeploymentDescription((AppDeploymentResource)resource));
- }
- return appList;
- }
-
- public static SetEnvPaths getSetEnvPath(Resource resource){
- SetEnvPaths envPaths = new SetEnvPaths();
- if (resource instanceof LibraryPrepandPathResource){
- envPaths.setName(((LibraryPrepandPathResource) resource).getName());
- envPaths.setValue(((LibraryPrepandPathResource) resource).getValue());
- return envPaths;
- }else if (resource instanceof LibraryApendPathResource){
- envPaths.setName(((LibraryApendPathResource) resource).getName());
- envPaths.setValue(((LibraryApendPathResource) resource).getValue());
- return envPaths;
- }else if (resource instanceof AppEnvironmentResource){
- envPaths.setName(((AppEnvironmentResource) resource).getName());
- envPaths.setValue(((AppEnvironmentResource) resource).getValue());
- return envPaths;
- }else {
- return null;
- }
- }
-
- public static List<SetEnvPaths> getLibPrepandPaths (List<Resource> prepandPaths){
- List<SetEnvPaths> pathList = new ArrayList<SetEnvPaths>();
- for (Resource resource : prepandPaths){
- pathList.add(getSetEnvPath(resource));
- }
- return pathList;
- }
-
- public static List<SetEnvPaths> getLibApendPaths (List<Resource> appendPaths){
- List<SetEnvPaths> pathList = new ArrayList<SetEnvPaths>();
- for (Resource resource : appendPaths){
- pathList.add(getSetEnvPath(resource));
- }
- return pathList;
- }
-
- public static List<SetEnvPaths> getAppEnvPaths (List<Resource> appEnvPaths){
- List<SetEnvPaths> pathList = new ArrayList<SetEnvPaths>();
- for (Resource resource : appEnvPaths){
- pathList.add(getSetEnvPath(resource));
- }
- return pathList;
- }
-
- public static ComputeResourcePreference getComputeResourcePreference (ComputeHostPreferenceResource resource){
- ComputeResourcePreference preference = new ComputeResourcePreference();
- preference.setComputeResourceId(resource.getResourceId());
- preference.setOverridebyAiravata(resource.getOverrideByAiravata());
- if (resource.getPreferredJobProtocol() != null){
- preference.setPreferredJobSubmissionProtocol(JobSubmissionProtocol.valueOf(resource.getPreferredJobProtocol()));
- }
- if (resource.getPreferedDMProtocol() != null){
- preference.setPreferredDataMovementProtocol(DataMovementProtocol.valueOf(resource.getPreferedDMProtocol()));
- }
- preference.setPreferredBatchQueue(resource.getBatchQueue());
- preference.setScratchLocation(resource.getScratchLocation());
- preference.setAllocationProjectNumber(resource.getProjectNumber());
- preference.setLoginUserName(resource.getLoginUserName());
- return preference;
- }
-
- public static List<ComputeResourcePreference> getComputeResourcePreferences (List<Resource> resources){
- List<ComputeResourcePreference> preferences = new ArrayList<ComputeResourcePreference>();
- if (resources != null && !resources.isEmpty()){
- for (Resource resource : resources){
- preferences.add(getComputeResourcePreference((ComputeHostPreferenceResource)resource));
- }
- }
- return preferences;
- }
-
- public static InputDataObjectType getWorkflowInput (WorkflowInputResource resource){
- InputDataObjectType input = new InputDataObjectType();
- input.setName(resource.getInputKey());
- input.setApplicationArgument(resource.getAppArgument());
- input.setInputOrder(resource.getInputOrder());
- input.setType(DataType.valueOf(resource.getDataType()));
- input.setMetaData(resource.getMetadata());
- input.setUserFriendlyDescription(resource.getUserFriendlyDesc());
- input.setIsRequired(resource.getRequired());
- input.setRequiredToAddedToCommandLine(resource.getRequiredToCMD());
- input.setDataStaged(resource.isDataStaged());
- return input;
- }
-
- public static List<InputDataObjectType> getWFInputs(List<Resource> resources){
- List<InputDataObjectType> inputResources = new ArrayList<InputDataObjectType>();
- if (resources != null && !resources.isEmpty()){
- for (Resource resource : resources){
- inputResources.add(getWorkflowInput((WorkflowInputResource) resource));
- }
- }
- return inputResources;
- }
-
- public static GatewayResourceProfile getGatewayResourceProfile(GatewayProfileResource gw, List<ComputeResourcePreference> preferences){
- GatewayResourceProfile gatewayProfile = new GatewayResourceProfile();
- gatewayProfile.setGatewayID(gw.getGatewayID());
- gatewayProfile.setComputeResourcePreferences(preferences);
- return gatewayProfile;
- }
-
- public static Workflow getWorkflow (WorkflowResource resource) throws AppCatalogException {
- Workflow workflow = new Workflow();
- workflow.setTemplateId(resource.getWfTemplateId());
- workflow.setGraph(resource.getGraph());
- workflow.setName(resource.getWfName());
- if (resource.getImage() != null){
- workflow.setImage(resource.getImage().getBytes());
- }
- WorkflowInputResource inputResource = new WorkflowInputResource();
- List<Resource> resources = inputResource.get(AbstractResource.WFInputConstants.WF_TEMPLATE_ID, resource.getWfTemplateId());
- workflow.setWorkflowInputs(getWFInputs(resources));
-
- return workflow;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/util/AppCatalogUtils.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/util/AppCatalogUtils.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/util/AppCatalogUtils.java
deleted file mode 100644
index 4b173be..0000000
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/util/AppCatalogUtils.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- *
- * 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.aiaravata.application.catalog.data.util;
-
-import java.util.UUID;
-
-public class AppCatalogUtils {
- public static String getID (String name){
- String pro = name.replaceAll("\\s", "");
- return pro + "_" + UUID.randomUUID();
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/app-catalog/app-catalog-data/src/main/resources/META-INF/persistence.xml
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/resources/META-INF/persistence.xml b/modules/app-catalog/app-catalog-data/src/main/resources/META-INF/persistence.xml
deleted file mode 100644
index 5fa184d..0000000
--- a/modules/app-catalog/app-catalog-data/src/main/resources/META-INF/persistence.xml
+++ /dev/null
@@ -1,67 +0,0 @@
-<?xml version="1.0"?>
-<!--*
- *
- * 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.
- *
-* -->
-<persistence xmlns="http://java.sun.com/xml/ns/persistence"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.0">
- <persistence-unit name="appcatalog_data">
- <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
- <class>org.apache.aiaravata.application.catalog.data.model.ComputeResource</class>
- <class>org.apache.aiaravata.application.catalog.data.model.GlobusJobSubmission</class>
- <class>org.apache.aiaravata.application.catalog.data.model.GlobusGKEndpoint</class>
- <class>org.apache.aiaravata.application.catalog.data.model.GSISSHSubmission</class>
- <class>org.apache.aiaravata.application.catalog.data.model.GSISSHExport</class>
- <class>org.apache.aiaravata.application.catalog.data.model.PreJobCommand</class>
- <class>org.apache.aiaravata.application.catalog.data.model.PostJobCommand</class>
- <class>org.apache.aiaravata.application.catalog.data.model.UnicoreJobSubmission</class>
- <class>org.apache.aiaravata.application.catalog.data.model.UnicoreDataMovement</class>
- <class>org.apache.aiaravata.application.catalog.data.model.HostAlias</class>
- <class>org.apache.aiaravata.application.catalog.data.model.HostIPAddress</class>
- <class>org.apache.aiaravata.application.catalog.data.model.ScpDataMovement</class>
- <class>org.apache.aiaravata.application.catalog.data.model.GridftpDataMovement</class>
- <class>org.apache.aiaravata.application.catalog.data.model.GridftpEndpoint</class>
- <class>org.apache.aiaravata.application.catalog.data.model.SshJobSubmission</class>
- <class>org.apache.aiaravata.application.catalog.data.model.ApplicationModule</class>
- <class>org.apache.aiaravata.application.catalog.data.model.ApplicationDeployment</class>
- <class>org.apache.aiaravata.application.catalog.data.model.ModuleLoadCmd</class>
- <class>org.apache.aiaravata.application.catalog.data.model.LibraryPrepandPath</class>
- <class>org.apache.aiaravata.application.catalog.data.model.LibraryApendPath</class>
- <class>org.apache.aiaravata.application.catalog.data.model.AppEnvironment</class>
- <class>org.apache.aiaravata.application.catalog.data.model.ApplicationInterface</class>
- <class>org.apache.aiaravata.application.catalog.data.model.AppModuleMapping</class>
- <class>org.apache.aiaravata.application.catalog.data.model.ApplicationInput</class>
- <class>org.apache.aiaravata.application.catalog.data.model.ApplicationOutput</class>
- <class>org.apache.aiaravata.application.catalog.data.model.GatewayProfile</class>
- <class>org.apache.aiaravata.application.catalog.data.model.ComputeResourcePreference</class>
- <class>org.apache.aiaravata.application.catalog.data.model.BatchQueue</class>
- <class>org.apache.aiaravata.application.catalog.data.model.ComputeResourceFileSystem</class>
- <class>org.apache.aiaravata.application.catalog.data.model.JobSubmissionInterface</class>
- <class>org.apache.aiaravata.application.catalog.data.model.DataMovementInterface</class>
- <class>org.apache.aiaravata.application.catalog.data.model.ResourceJobManager</class>
- <class>org.apache.aiaravata.application.catalog.data.model.JobManagerCommand</class>
- <class>org.apache.aiaravata.application.catalog.data.model.LocalSubmission</class>
- <class>org.apache.aiaravata.application.catalog.data.model.LocalDataMovement</class>
- <class>org.apache.aiaravata.application.catalog.data.model.Workflow</class>
- <class>org.apache.aiaravata.application.catalog.data.model.WorkflowInput</class>
- <class>org.apache.aiaravata.application.catalog.data.model.WorkflowOutput</class>
- <class>org.apache.aiaravata.application.catalog.data.model.Configuration</class>
- <exclude-unlisted-classes>true</exclude-unlisted-classes>
- </persistence-unit>
-</persistence>
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/app-catalog/app-catalog-data/src/main/resources/appcatalog-derby.sql
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/resources/appcatalog-derby.sql b/modules/app-catalog/app-catalog-data/src/main/resources/appcatalog-derby.sql
deleted file mode 100644
index fc24d83..0000000
--- a/modules/app-catalog/app-catalog-data/src/main/resources/appcatalog-derby.sql
+++ /dev/null
@@ -1,460 +0,0 @@
-/*
- *
- * 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.
- *
- */
-
-CREATE TABLE COMPUTE_RESOURCE
-(
- RESOURCE_ID VARCHAR (255) NOT NULL,
- HOST_NAME VARCHAR (255) NOT NULL,
- RESOURCE_DESCRIPTION VARCHAR (255),
- CREATION_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
- UPDATE_TIME TIMESTAMP DEFAULT '0000-00-00 00:00:00',
- MAX_MEMORY_NODE INTEGER,
- PRIMARY KEY (RESOURCE_ID)
-);
-
-CREATE TABLE HOST_ALIAS
-(
- RESOURCE_ID VARCHAR(255),
- ALIAS VARCHAR(255),
- PRIMARY KEY(RESOURCE_ID,ALIAS),
- FOREIGN KEY (RESOURCE_ID) REFERENCES COMPUTE_RESOURCE(RESOURCE_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE HOST_IPADDRESS
-(
- RESOURCE_ID VARCHAR(255),
- IP_ADDRESS VARCHAR(255),
- PRIMARY KEY(RESOURCE_ID,IP_ADDRESS),
- FOREIGN KEY (RESOURCE_ID) REFERENCES COMPUTE_RESOURCE(RESOURCE_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE GSISSH_SUBMISSION
-(
- SUBMISSION_ID VARCHAR(255),
- RESOURCE_JOB_MANAGER VARCHAR(255),
- SSH_PORT INTEGER,
- INSTALLED_PATH VARCHAR(255),
- MONITOR_MODE VARCHAR(255),
- PRIMARY KEY(SUBMISSION_ID)
-);
-
-CREATE TABLE GSISSH_EXPORT
-(
- SUBMISSION_ID VARCHAR(255),
- EXPORT VARCHAR(255),
- PRIMARY KEY(SUBMISSION_ID, EXPORT),
- FOREIGN KEY (SUBMISSION_ID) REFERENCES GSISSH_SUBMISSION(SUBMISSION_ID) ON DELETE CASCADE
-);
-
-
-
-CREATE TABLE GLOBUS_SUBMISSION
-(
- SUBMISSION_ID VARCHAR(255),
- RESOURCE_JOB_MANAGER VARCHAR(255),
- SECURITY_PROTOCAL VARCHAR(255),
- PRIMARY KEY(SUBMISSION_ID)
-);
-
-CREATE TABLE UNICORE_SUBMISSION
-(
- SUBMISSION_ID VARCHAR(255),
- SECURITY_PROTOCAL VARCHAR(255),
- UNICORE_ENDPOINT_URL VARCHAR(255),
- PRIMARY KEY(SUBMISSION_ID)
-);
-
-CREATE TABLE UNICORE_DATAMOVEMENT
-(
- DATAMOVEMENT_ID VARCHAR(255),
- SECURITY_PROTOCAL VARCHAR(255),
- UNICORE_ENDPOINT_URL VARCHAR(255),
- PRIMARY KEY(DATAMOVEMENT_ID)
-);
-
-
-CREATE TABLE GLOBUS_GK_ENDPOINT
-(
- SUBMISSION_ID VARCHAR(255),
- ENDPOINT VARCHAR(255),
- PRIMARY KEY(SUBMISSION_ID, ENDPOINT),
- FOREIGN KEY (SUBMISSION_ID) REFERENCES GLOBUS_SUBMISSION(SUBMISSION_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE RESOURCE_JOB_MANAGER
-(
- RESOURCE_JOB_MANAGER_ID VARCHAR (255) NOT NULL,
- PUSH_MONITORING_ENDPOINT VARCHAR (255),
- JOB_MANAGER_BIN_PATH VARCHAR (255),
- RESOURCE_JOB_MANAGER_TYPE VARCHAR (255) NOT NULL,
- CREATION_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
- UPDATE_TIME TIMESTAMP DEFAULT '0000-00-00 00:00:00',
- PRIMARY KEY (RESOURCE_JOB_MANAGER_ID)
-);
-
-
-
-CREATE TABLE SSH_JOB_SUBMISSION
-(
- RESOURCE_JOB_MANAGER_ID VARCHAR (255) NOT NULL,
- JOB_SUBMISSION_INTERFACE_ID VARCHAR (255) NOT NULL,
- ALTERNATIVE_SSH_HOSTNAME VARCHAR (255),
- SECURITY_PROTOCOL VARCHAR (255) NOT NULL,
- SSH_PORT INTEGER,
- MONITOR_MODE VARCHAR (255),
- CREATION_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
- 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 SCP_DATA_MOVEMENT
-(
- QUEUE_DESCRIPTION VARCHAR (255),
- DATA_MOVEMENT_INTERFACE_ID VARCHAR (255) NOT NULL,
- SECURITY_PROTOCOL VARCHAR (255) NOT NULL,
- ALTERNATIVE_SCP_HOSTNAME VARCHAR (255),
- SSH_PORT INTEGER,
- CREATION_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
- UPDATE_TIME TIMESTAMP DEFAULT '0000-00-00 00:00:00',
- PRIMARY KEY (DATA_MOVEMENT_INTERFACE_ID)
-);
-
-CREATE TABLE GRIDFTP_DATA_MOVEMENT
-(
- DATA_MOVEMENT_INTERFACE_ID VARCHAR (255) NOT NULL,
- SECURITY_PROTOCOL VARCHAR (255) NOT NULL,
- CREATION_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
- UPDATE_TIME TIMESTAMP DEFAULT '0000-00-00 00:00:00',
- PRIMARY KEY (DATA_MOVEMENT_INTERFACE_ID)
-);
-
-CREATE TABLE GRIDFTP_ENDPOINT
-(
- ENDPOINT VARCHAR (255) NOT NULL,
- DATA_MOVEMENT_INTERFACE_ID VARCHAR (255) NOT NULL,
- PRIMARY KEY (DATA_MOVEMENT_INTERFACE_ID,ENDPOINT),
- CREATION_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
- UPDATE_TIME TIMESTAMP DEFAULT '0000-00-00 00:00:00',
- FOREIGN KEY (DATA_MOVEMENT_INTERFACE_ID) REFERENCES GRIDFTP_DATA_MOVEMENT(DATA_MOVEMENT_INTERFACE_ID) ON DELETE CASCADE
-);
-
---CREATE TABLE JOB_SUBMISSION_PROTOCOL
---(
--- RESOURCE_ID VARCHAR(255),
--- SUBMISSION_ID VARCHAR(255),
--- JOB_TYPE VARCHAR(255),
--- CREATION_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
--- UPDATE_TIME TIMESTAMP DEFAULT '0000-00-00 00:00:00',
--- PRIMARY KEY(RESOURCE_ID,SUBMISSION_ID,JOB_TYPE),
--- FOREIGN KEY (RESOURCE_ID) REFERENCES COMPUTE_RESOURCE(RESOURCE_ID) ON DELETE CASCADE
---);
---
---CREATE TABLE DATA_MOVEMENT_PROTOCOL
---(
--- RESOURCE_ID VARCHAR(255),
--- DATA_MOVE_ID VARCHAR(255),
--- DATA_MOVE_TYPE VARCHAR(255),
--- CREATION_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
--- UPDATE_TIME TIMESTAMP DEFAULT '0000-00-00 00:00:00',
--- PRIMARY KEY(RESOURCE_ID,DATA_MOVE_ID,DATA_MOVE_TYPE),
--- FOREIGN KEY (RESOURCE_ID) REFERENCES COMPUTE_RESOURCE(RESOURCE_ID) ON DELETE CASCADE
---);
-
-CREATE TABLE APPLICATION_MODULE
-(
- MODULE_ID VARCHAR(255),
- MODULE_NAME VARCHAR(255),
- MODULE_VERSION VARCHAR(255),
- MODULE_DESC VARCHAR(255),
- GATEWAY_ID VARCHAR (255),
- CREATION_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
- UPDATE_TIME TIMESTAMP DEFAULT '0000-00-00 00:00:00',
- PRIMARY KEY(MODULE_ID)
-);
-
-CREATE TABLE APPLICATION_DEPLOYMENT
-(
- DEPLOYMENT_ID VARCHAR(255),
- APP_MODULE_ID VARCHAR(255),
- COMPUTE_HOSTID VARCHAR(255),
- EXECUTABLE_PATH VARCHAR(255),
- PARALLELISM VARCHAR(255),
- APPLICATION_DESC VARCHAR(255),
- CREATION_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
- UPDATE_TIME TIMESTAMP DEFAULT '0000-00-00 00:00:00',
- GATEWAY_ID VARCHAR(255),
- PRIMARY KEY(DEPLOYMENT_ID),
- FOREIGN KEY (COMPUTE_HOSTID) REFERENCES COMPUTE_RESOURCE(RESOURCE_ID) ON DELETE CASCADE,
- FOREIGN KEY (APP_MODULE_ID) REFERENCES APPLICATION_MODULE(MODULE_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE MODULE_LOAD_CMD
-(
- CMD VARCHAR (255) NOT NULL,
- APP_DEPLOYMENT_ID VARCHAR (255) NOT NULL,
- PRIMARY KEY (APP_DEPLOYMENT_ID,CMD),
- FOREIGN KEY (APP_DEPLOYMENT_ID) REFERENCES APPLICATION_DEPLOYMENT(DEPLOYMENT_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE PREJOB_COMMAND
-(
- APPDEPLOYMENT_ID VARCHAR(255),
- COMMAND VARCHAR(255),
- PRIMARY KEY(APPDEPLOYMENT_ID, COMMAND),
- FOREIGN KEY (APPDEPLOYMENT_ID) REFERENCES APPLICATION_DEPLOYMENT(DEPLOYMENT_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE POSTJOB_COMMAND
-(
- APPDEPLOYMENT_ID VARCHAR(255),
- COMMAND VARCHAR(255),
- PRIMARY KEY(APPDEPLOYMENT_ID, COMMAND),
- FOREIGN KEY (APPDEPLOYMENT_ID) REFERENCES APPLICATION_DEPLOYMENT(DEPLOYMENT_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE LIBRARY_PREPAND_PATH
-(
- DEPLOYMENT_ID VARCHAR(255),
- NAME VARCHAR(255),
- VALUE VARCHAR(255),
- PRIMARY KEY(DEPLOYMENT_ID, NAME),
- FOREIGN KEY (DEPLOYMENT_ID) REFERENCES APPLICATION_DEPLOYMENT(DEPLOYMENT_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE LIBRARY_APEND_PATH
-(
- DEPLOYMENT_ID VARCHAR(255),
- NAME VARCHAR(255),
- VALUE VARCHAR(255),
- PRIMARY KEY(DEPLOYMENT_ID, NAME),
- FOREIGN KEY (DEPLOYMENT_ID) REFERENCES APPLICATION_DEPLOYMENT(DEPLOYMENT_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE APP_ENVIRONMENT
-(
- DEPLOYMENT_ID VARCHAR(255),
- NAME VARCHAR(255),
- VALUE VARCHAR(255),
- PRIMARY KEY(DEPLOYMENT_ID, NAME),
- FOREIGN KEY (DEPLOYMENT_ID) REFERENCES APPLICATION_DEPLOYMENT(DEPLOYMENT_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE APPLICATION_INTERFACE
-(
- INTERFACE_ID VARCHAR(255),
- APPLICATION_NAME VARCHAR(255),
- APPLICATION_DESCRIPTION VARCHAR(255),
- GATEWAY_ID VARCHAR(255),
- CREATION_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
- UPDATE_TIME TIMESTAMP DEFAULT '0000-00-00 00:00:00',
- PRIMARY KEY(INTERFACE_ID)
-);
-
-CREATE TABLE APP_MODULE_MAPPING
-(
- INTERFACE_ID VARCHAR(255),
- MODULE_ID VARCHAR(255),
- PRIMARY KEY(INTERFACE_ID, MODULE_ID),
- FOREIGN KEY (INTERFACE_ID) REFERENCES APPLICATION_INTERFACE(INTERFACE_ID) ON DELETE CASCADE,
- FOREIGN KEY (MODULE_ID) REFERENCES APPLICATION_MODULE(MODULE_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE APPLICATION_INPUT
-(
- INTERFACE_ID VARCHAR(255),
- INPUT_KEY VARCHAR(255),
- INPUT_VALUE VARCHAR(255),
- DATA_TYPE VARCHAR(255),
- METADATA VARCHAR(255),
- APP_ARGUMENT VARCHAR(255),
- STANDARD_INPUT SMALLINT,
- INPUT_ORDER INTEGER,
- IS_REQUIRED SMALLINT,
- REQUIRED_TO_COMMANDLINE SMALLINT,
- DATA_STAGED SMALLINT,
- USER_FRIENDLY_DESC VARCHAR(255),
- PRIMARY KEY(INTERFACE_ID,INPUT_KEY),
- FOREIGN KEY (INTERFACE_ID) REFERENCES APPLICATION_INTERFACE(INTERFACE_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE APPLICATION_OUTPUT
-(
- INTERFACE_ID VARCHAR(255),
- OUTPUT_KEY VARCHAR(255),
- OUTPUT_VALUE VARCHAR(255),
- DATA_TYPE VARCHAR(255),
- IS_REQUIRED SMALLINT,
- REQUIRED_TO_COMMANDLINE SMALLINT,
- DATA_MOVEMENT SMALLINT,
- DATA_NAME_LOCATION VARCHAR(255),
- SEARCH_QUERY VARCHAR(255),
- APP_ARGUMENT VARCHAR(255),
- PRIMARY KEY(INTERFACE_ID,OUTPUT_KEY),
- FOREIGN KEY (INTERFACE_ID) REFERENCES APPLICATION_INTERFACE(INTERFACE_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE GATEWAY_PROFILE
-(
- GATEWAY_ID VARCHAR(255),
- CREATION_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
- UPDATE_TIME TIMESTAMP DEFAULT '0000-00-00 00:00:00',
- PRIMARY KEY(GATEWAY_ID)
-);
-
-CREATE TABLE COMPUTE_RESOURCE_PREFERENCE
-(
- GATEWAY_ID VARCHAR(255),
- RESOURCE_ID VARCHAR(255),
- OVERRIDE_BY_AIRAVATA SMALLINT,
- PREFERED_JOB_SUB_PROTOCOL VARCHAR(255),
- PREFERED_DATA_MOVE_PROTOCOL VARCHAR(255),
- PREFERED_BATCH_QUEUE VARCHAR(255),
- SCRATCH_LOCATION VARCHAR(255),
- ALLOCATION_PROJECT_NUMBER VARCHAR(255),
- LOGIN_USERNAME 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
-);
-
-CREATE TABLE BATCH_QUEUE
-(
- COMPUTE_RESOURCE_ID VARCHAR(255) NOT NULL,
- MAX_RUNTIME INTEGER,
- MAX_JOB_IN_QUEUE INTEGER,
- QUEUE_DESCRIPTION VARCHAR(255),
- QUEUE_NAME VARCHAR(255) NOT NULL,
- MAX_PROCESSORS INTEGER,
- MAX_NODES INTEGER,
- MAX_MEMORY INTEGER,
- PRIMARY KEY (COMPUTE_RESOURCE_ID,QUEUE_NAME),
- FOREIGN KEY (COMPUTE_RESOURCE_ID) REFERENCES COMPUTE_RESOURCE(RESOURCE_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE COMPUTE_RESOURCE_FILE_SYSTEM
-(
- COMPUTE_RESOURCE_ID VARCHAR (255) NOT NULL,
- PATH VARCHAR (255),
- FILE_SYSTEM VARCHAR (255) NOT NULL,
- PRIMARY KEY (COMPUTE_RESOURCE_ID,FILE_SYSTEM),
- FOREIGN KEY (COMPUTE_RESOURCE_ID) REFERENCES COMPUTE_RESOURCE(RESOURCE_ID) ON DELETE CASCADE
- );
-
-CREATE TABLE JOB_SUBMISSION_INTERFACE
-(
- JOB_SUBMISSION_INTERFACE_ID VARCHAR (255) NOT NULL,
- COMPUTE_RESOURCE_ID VARCHAR (255) NOT NULL,
- JOB_SUBMISSION_PROTOCOL VARCHAR (255) NOT NULL,
- PRIORITY_ORDER INTEGER,
- CREATION_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
- UPDATE_TIME TIMESTAMP DEFAULT '0000-00-00 00:00:00',
- PRIMARY KEY (COMPUTE_RESOURCE_ID,JOB_SUBMISSION_INTERFACE_ID),
- FOREIGN KEY (COMPUTE_RESOURCE_ID) REFERENCES COMPUTE_RESOURCE(RESOURCE_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE DATA_MOVEMENT_INTERFACE
-(
- COMPUTE_RESOURCE_ID VARCHAR (255) NOT NULL,
- DATA_MOVEMENT_PROTOCOL VARCHAR (255) NOT NULL,
- DATA_MOVEMENT_INTERFACE_ID VARCHAR (255) NOT NULL,
- PRIORITY_ORDER INTEGER,
- CREATION_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
- UPDATE_TIME TIMESTAMP DEFAULT '0000-00-00 00:00:00',
- PRIMARY KEY (COMPUTE_RESOURCE_ID,DATA_MOVEMENT_INTERFACE_ID),
- FOREIGN KEY (COMPUTE_RESOURCE_ID) REFERENCES COMPUTE_RESOURCE(RESOURCE_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE JOB_MANAGER_COMMAND
-(
- RESOURCE_JOB_MANAGER_ID VARCHAR (255) NOT NULL,
- COMMAND_TYPE VARCHAR (255) NOT NULL,
- COMMAND VARCHAR (255),
- PRIMARY KEY (RESOURCE_JOB_MANAGER_ID,COMMAND_TYPE),
- FOREIGN KEY (RESOURCE_JOB_MANAGER_ID) REFERENCES RESOURCE_JOB_MANAGER(RESOURCE_JOB_MANAGER_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE LOCAL_SUBMISSION
-(
- RESOURCE_JOB_MANAGER_ID VARCHAR (255) NOT NULL,
- JOB_SUBMISSION_INTERFACE_ID VARCHAR (255) NOT NULL,
- CREATION_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
- 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 LOCAL_DATA_MOVEMENT
-(
- DATA_MOVEMENT_INTERFACE_ID VARCHAR (255) NOT NULL,
- PRIMARY KEY (DATA_MOVEMENT_INTERFACE_ID)
-);
-
-CREATE TABLE WORKFLOW
-(
- WF_TEMPLATE_ID VARCHAR (255) NOT NULL,
- WF_NAME VARCHAR (255) NOT NULL,
- GRAPH CLOB,
- OWNER VARCHAR(255),
- GATEWAY_ID VARCHAR(255),
- CREATION_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
- UPDATE_TIME TIMESTAMP DEFAULT '0000-00-00 00:00:00',
- IMAGE BLOB,
- PRIMARY KEY (WF_TEMPLATE_ID)
-);
-
-CREATE TABLE WORKFLOW_INPUT
-(
- WF_TEMPLATE_ID VARCHAR(255),
- INPUT_KEY VARCHAR(255),
- INPUT_VALUE CLOB,
- DATA_TYPE VARCHAR(255),
- METADATA VARCHAR(255),
- APP_ARGUMENT VARCHAR(255),
- STANDARD_INPUT SMALLINT,
- USER_FRIENDLY_DESC VARCHAR(255),
- PRIMARY KEY(WF_TEMPLATE_ID,INPUT_KEY),
- FOREIGN KEY (WF_TEMPLATE_ID) REFERENCES WORKFLOW(WF_TEMPLATE_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE WORKFLOW_OUTPUT
-(
- WF_TEMPLATE_ID VARCHAR(255),
- OUTPUT_KEY VARCHAR(255),
- OUTPUT_VALUE CLOB,
- DATA_TYPE VARCHAR(255),
- PRIMARY KEY(WF_TEMPLATE_ID,OUTPUT_KEY),
- FOREIGN KEY (WF_TEMPLATE_ID) REFERENCES WORKFLOW(WF_TEMPLATE_ID) ON DELETE CASCADE
-);
-
-
-
-CREATE TABLE CONFIGURATION
-(
- CONFIG_KEY VARCHAR(255),
- CONFIG_VAL VARCHAR(255),
- PRIMARY KEY(CONFIG_KEY, CONFIG_VAL)
-);
-
-INSERT INTO CONFIGURATION (CONFIG_KEY, CONFIG_VAL) VALUES('app_catalog_version', '0.15');
-
-
-
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/app-catalog/app-catalog-data/src/main/resources/appcatalog-mysql.sql
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/resources/appcatalog-mysql.sql b/modules/app-catalog/app-catalog-data/src/main/resources/appcatalog-mysql.sql
deleted file mode 100644
index 234a26a..0000000
--- a/modules/app-catalog/app-catalog-data/src/main/resources/appcatalog-mysql.sql
+++ /dev/null
@@ -1,453 +0,0 @@
-/*
- *
- * 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.
- *
- */
-CREATE TABLE COMPUTE_RESOURCE
-(
- RESOURCE_ID VARCHAR (255) NOT NULL,
- HOST_NAME VARCHAR (255) NOT NULL,
- RESOURCE_DESCRIPTION VARCHAR (255),
- CREATION_TIME TIMESTAMP DEFAULT NOW(),
- UPDATE_TIME TIMESTAMP DEFAULT '0000-00-00 00:00:00',
- MAX_MEMORY_NODE INTEGER,
- PRIMARY KEY (RESOURCE_ID)
-);
-
-CREATE TABLE HOST_ALIAS
-(
- RESOURCE_ID VARCHAR(255),
- ALIAS VARCHAR(255),
- PRIMARY KEY(RESOURCE_ID,ALIAS),
- FOREIGN KEY (RESOURCE_ID) REFERENCES COMPUTE_RESOURCE(RESOURCE_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE HOST_IPADDRESS
-(
- RESOURCE_ID VARCHAR(255),
- IP_ADDRESS VARCHAR(255),
- PRIMARY KEY(RESOURCE_ID,IP_ADDRESS),
- FOREIGN KEY (RESOURCE_ID) REFERENCES COMPUTE_RESOURCE(RESOURCE_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE GSISSH_SUBMISSION
-(
- SUBMISSION_ID VARCHAR(255),
- RESOURCE_JOB_MANAGER VARCHAR(255),
- SSH_PORT INTEGER,
- INSTALLED_PATH VARCHAR(255),
- MONITOR_MODE VARCHAR(255),
- PRIMARY KEY(SUBMISSION_ID)
-);
-
-CREATE TABLE GSISSH_EXPORT
-(
- SUBMISSION_ID VARCHAR(255),
- EXPORT VARCHAR(255),
- PRIMARY KEY(SUBMISSION_ID, EXPORT),
- FOREIGN KEY (SUBMISSION_ID) REFERENCES GSISSH_SUBMISSION(SUBMISSION_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE GSISSH_PREJOBCOMMAND
-(
- SUBMISSION_ID VARCHAR(255),
- COMMAND VARCHAR(255),
- PRIMARY KEY(SUBMISSION_ID, COMMAND),
- FOREIGN KEY (SUBMISSION_ID) REFERENCES GSISSH_SUBMISSION(SUBMISSION_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE GSISSH_POSTJOBCOMMAND
-(
- SUBMISSION_ID VARCHAR(255),
- COMMAND VARCHAR(255),
- PRIMARY KEY(SUBMISSION_ID, COMMAND),
- FOREIGN KEY (SUBMISSION_ID) REFERENCES GSISSH_SUBMISSION(SUBMISSION_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE GLOBUS_SUBMISSION
-(
- SUBMISSION_ID VARCHAR(255),
- RESOURCE_JOB_MANAGER VARCHAR(255),
- SECURITY_PROTOCAL VARCHAR(255),
- PRIMARY KEY(SUBMISSION_ID)
-);
-CREATE TABLE UNICORE_SUBMISSION
-(
- SUBMISSION_ID VARCHAR(255),
- SECURITY_PROTOCAL VARCHAR(255),
- UNICORE_ENDPOINT_URL VARCHAR(255),
- PRIMARY KEY(SUBMISSION_ID)
-);
-
-CREATE TABLE UNICORE_DATAMOVEMENT
-(
- DATAMOVEMENT_ID VARCHAR(255),
- SECURITY_PROTOCAL VARCHAR(255),
- UNICORE_ENDPOINT_URL VARCHAR(255),
- PRIMARY KEY(DATAMOVEMENT_ID)
-);
-
-CREATE TABLE GLOBUS_GK_ENDPOINT
-(
- SUBMISSION_ID VARCHAR(255),
- ENDPOINT VARCHAR(255),
- PRIMARY KEY(SUBMISSION_ID, ENDPOINT),
- FOREIGN KEY (SUBMISSION_ID) REFERENCES GLOBUS_SUBMISSION(SUBMISSION_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE RESOURCE_JOB_MANAGER
-(
- RESOURCE_JOB_MANAGER_ID VARCHAR (255) NOT NULL,
- PUSH_MONITORING_ENDPOINT VARCHAR (255),
- JOB_MANAGER_BIN_PATH VARCHAR (255),
- RESOURCE_JOB_MANAGER_TYPE VARCHAR (255) NOT NULL,
- CREATION_TIME TIMESTAMP DEFAULT NOW(),
- UPDATE_TIME TIMESTAMP DEFAULT '0000-00-00 00:00:00',
- PRIMARY KEY (RESOURCE_JOB_MANAGER_ID)
-);
-
-CREATE TABLE SSH_JOB_SUBMISSION
-(
- RESOURCE_JOB_MANAGER_ID VARCHAR (255) NOT NULL,
- JOB_SUBMISSION_INTERFACE_ID VARCHAR (255) NOT NULL,
- ALTERNATIVE_SSH_HOSTNAME VARCHAR (255),
- SECURITY_PROTOCOL VARCHAR (255) NOT NULL,
- SSH_PORT INTEGER,
- MONITOR_MODE VARCHAR (255),
- CREATION_TIME TIMESTAMP DEFAULT NOW(),
- 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 SCP_DATA_MOVEMENT
-(
- QUEUE_DESCRIPTION VARCHAR (255),
- DATA_MOVEMENT_INTERFACE_ID VARCHAR (255) NOT NULL,
- SECURITY_PROTOCOL VARCHAR (255) NOT NULL,
- ALTERNATIVE_SCP_HOSTNAME VARCHAR (255),
- SSH_PORT INTEGER,
- CREATION_TIME TIMESTAMP DEFAULT NOW(),
- UPDATE_TIME TIMESTAMP DEFAULT '0000-00-00 00:00:00' ,
- PRIMARY KEY (DATA_MOVEMENT_INTERFACE_ID)
-);
-
-CREATE TABLE GRIDFTP_DATA_MOVEMENT
-(
- DATA_MOVEMENT_INTERFACE_ID VARCHAR (255) NOT NULL,
- SECURITY_PROTOCOL VARCHAR (255) NOT NULL,
- CREATION_TIME TIMESTAMP DEFAULT NOW(),
- UPDATE_TIME TIMESTAMP DEFAULT '0000-00-00 00:00:00' ,
- PRIMARY KEY (DATA_MOVEMENT_INTERFACE_ID)
-);
-
-CREATE TABLE GRIDFTP_ENDPOINT
-(
- ENDPOINT VARCHAR (255) NOT NULL,
- DATA_MOVEMENT_INTERFACE_ID VARCHAR (255) NOT NULL,
- PRIMARY KEY (DATA_MOVEMENT_INTERFACE_ID,ENDPOINT),
- CREATION_TIME TIMESTAMP DEFAULT NOW(),
- UPDATE_TIME TIMESTAMP DEFAULT '0000-00-00 00:00:00' ,
- FOREIGN KEY (DATA_MOVEMENT_INTERFACE_ID) REFERENCES GRIDFTP_DATA_MOVEMENT(DATA_MOVEMENT_INTERFACE_ID) ON DELETE CASCADE
-);
-
---CREATE TABLE JOB_SUBMISSION_PROTOCOL
---(
--- RESOURCE_ID VARCHAR(255),
--- SUBMISSION_ID VARCHAR(255),
--- JOB_TYPE VARCHAR(255),
--- PRIMARY KEY(RESOURCE_ID,SUBMISSION_ID,JOB_TYPE),
--- FOREIGN KEY (RESOURCE_ID) REFERENCES COMPUTE_RESOURCE(RESOURCE_ID) ON DELETE CASCADE
---);
---
---CREATE TABLE DATA_MOVEMENT_PROTOCOL
---(
--- RESOURCE_ID VARCHAR(255),
--- DATA_MOVE_ID VARCHAR(255),
--- DATA_MOVE_TYPE VARCHAR(255),
--- PRIMARY KEY(RESOURCE_ID,DATA_MOVE_ID,DATA_MOVE_TYPE),
--- FOREIGN KEY (RESOURCE_ID) REFERENCES COMPUTE_RESOURCE(RESOURCE_ID) ON DELETE CASCADE
---);
-
-CREATE TABLE APPLICATION_MODULE
-(
- MODULE_ID VARCHAR(255),
- MODULE_NAME VARCHAR(255),
- MODULE_VERSION VARCHAR(255),
- MODULE_DESC VARCHAR(255),
- GATEWAY_ID VARCHAR (255),
- CREATION_TIME TIMESTAMP DEFAULT NOW(),
- UPDATE_TIME TIMESTAMP DEFAULT '0000-00-00 00:00:00' ,
- PRIMARY KEY(MODULE_ID)
-);
-
-CREATE TABLE APPLICATION_DEPLOYMENT
-(
- DEPLOYMENT_ID VARCHAR(255),
- APP_MODULE_ID VARCHAR(255),
- COMPUTE_HOSTID VARCHAR(255),
- EXECUTABLE_PATH VARCHAR(255),
- PARALLELISM VARCHAR(255),
- APPLICATION_DESC VARCHAR(255),
- ENV_MODULE_LOAD_CMD VARCHAR(255),
- CREATION_TIME TIMESTAMP DEFAULT NOW(),
- UPDATE_TIME TIMESTAMP DEFAULT '0000-00-00 00:00:00' ,
- GATEWAY_ID VARCHAR(255),
- PRIMARY KEY(DEPLOYMENT_ID),
- FOREIGN KEY (COMPUTE_HOSTID) REFERENCES COMPUTE_RESOURCE(RESOURCE_ID) ON DELETE CASCADE,
- FOREIGN KEY (APP_MODULE_ID) REFERENCES APPLICATION_MODULE(MODULE_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE LIBRARY_PREPAND_PATH
-(
- DEPLOYMENT_ID VARCHAR(255),
- NAME VARCHAR(255),
- VALUE VARCHAR(255),
- PRIMARY KEY(DEPLOYMENT_ID, NAME),
- FOREIGN KEY (DEPLOYMENT_ID) REFERENCES APPLICATION_DEPLOYMENT(DEPLOYMENT_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE LIBRARY_APEND_PATH
-(
- DEPLOYMENT_ID VARCHAR(255),
- NAME VARCHAR(255),
- VALUE VARCHAR(255),
- PRIMARY KEY(DEPLOYMENT_ID, NAME),
- FOREIGN KEY (DEPLOYMENT_ID) REFERENCES APPLICATION_DEPLOYMENT(DEPLOYMENT_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE APP_ENVIRONMENT
-(
- DEPLOYMENT_ID VARCHAR(255),
- NAME VARCHAR(255),
- VALUE VARCHAR(255),
- PRIMARY KEY(DEPLOYMENT_ID, NAME),
- FOREIGN KEY (DEPLOYMENT_ID) REFERENCES APPLICATION_DEPLOYMENT(DEPLOYMENT_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE PREJOB_COMMAND
-(
- APPDEPLOYMENT_ID VARCHAR(255),
- COMMAND VARCHAR(255),
- PRIMARY KEY(APPDEPLOYMENT_ID, COMMAND),
- FOREIGN KEY (APPDEPLOYMENT_ID) REFERENCES APPLICATION_DEPLOYMENT(DEPLOYMENT_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE POSTJOB_COMMAND
-(
- APPLICATION_DEPLOYMENT VARCHAR(255),
- COMMAND VARCHAR(255),
- PRIMARY KEY(APPLICATION_DEPLOYMENT, COMMAND),
- FOREIGN KEY (APPLICATION_DEPLOYMENT) REFERENCES APPLICATION_DEPLOYMENT(DEPLOYMENT_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE APPLICATION_INTERFACE
-(
- INTERFACE_ID VARCHAR(255),
- APPLICATION_NAME VARCHAR(255),
- APPLICATION_DESCRIPTION VARCHAR(255),
- CREATION_TIME TIMESTAMP DEFAULT NOW(),
- UPDATE_TIME TIMESTAMP DEFAULT '0000-00-00 00:00:00' ,
- PRIMARY KEY(INTERFACE_ID)
-);
-
-CREATE TABLE APP_MODULE_MAPPING
-(
- INTERFACE_ID VARCHAR(255),
- MODULE_ID VARCHAR(255),
- PRIMARY KEY(INTERFACE_ID, MODULE_ID),
- FOREIGN KEY (INTERFACE_ID) REFERENCES APPLICATION_INTERFACE(INTERFACE_ID) ON DELETE CASCADE,
- FOREIGN KEY (MODULE_ID) REFERENCES APPLICATION_MODULE(MODULE_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE APPLICATION_INPUT
-(
- INTERFACE_ID VARCHAR(255),
- INPUT_KEY VARCHAR(255),
- INPUT_VALUE VARCHAR(255),
- DATA_TYPE VARCHAR(255),
- METADATA VARCHAR(255),
- APP_ARGUMENT VARCHAR(255),
- STANDARD_INPUT SMALLINT,
- USER_FRIENDLY_DESC VARCHAR(255),
- INPUT_ORDER INTEGER,
- IS_REQUIRED SMALLINT,
- REQUIRED_TO_COMMANDLINE SMALLINT,
- DATA_STAGED SMALLINT,
- PRIMARY KEY(INTERFACE_ID,INPUT_KEY),
- FOREIGN KEY (INTERFACE_ID) REFERENCES APPLICATION_INTERFACE(INTERFACE_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE APPLICATION_OUTPUT
-(
- INTERFACE_ID VARCHAR(255),
- OUTPUT_KEY VARCHAR(255),
- OUTPUT_VALUE VARCHAR(255),
- DATA_TYPE VARCHAR(255),
- IS_REQUIRED SMALLINT,
- REQUIRED_TO_COMMANDLINE SMALLINT,
- DATA_MOVEMENT SMALLINT,
- DATA_NAME_LOCATION VARCHAR(255),
- SEARCH_QUERY VARCHAR(255),
- APP_ARGUMENT VARCHAR(255),
- PRIMARY KEY(INTERFACE_ID,OUTPUT_KEY),
- FOREIGN KEY (INTERFACE_ID) REFERENCES APPLICATION_INTERFACE(INTERFACE_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE GATEWAY_PROFILE
-(
- GATEWAY_ID VARCHAR(255),
- CREATION_TIME TIMESTAMP DEFAULT NOW(),
- UPDATE_TIME TIMESTAMP DEFAULT '0000-00-00 00:00:00' ,
- PRIMARY KEY(GATEWAY_ID)
-);
-
-CREATE TABLE COMPUTE_RESOURCE_PREFERENCE
-(
- GATEWAY_ID VARCHAR(255),
- RESOURCE_ID VARCHAR(255),
- OVERRIDE_BY_AIRAVATA SMALLINT,
- PREFERED_JOB_SUB_PROTOCOL VARCHAR(255),
- PREFERED_DATA_MOVE_PROTOCOL VARCHAR(255),
- PREFERED_BATCH_QUEUE VARCHAR(255),
- SCRATCH_LOCATION VARCHAR(255),
- ALLOCATION_PROJECT_NUMBER VARCHAR(255),
- LOGIN_USERNAME 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
-);
-
-CREATE TABLE BATCH_QUEUE
-(
- COMPUTE_RESOURCE_ID VARCHAR(255) NOT NULL,
- MAX_RUNTIME INTEGER,
- MAX_JOB_IN_QUEUE INTEGER,
- QUEUE_DESCRIPTION VARCHAR(255),
- QUEUE_NAME VARCHAR(255) NOT NULL,
- MAX_PROCESSORS INTEGER,
- MAX_NODES INTEGER,
- MAX_MEMORY INTEGER,
- PRIMARY KEY (COMPUTE_RESOURCE_ID,QUEUE_NAME),
- FOREIGN KEY (COMPUTE_RESOURCE_ID) REFERENCES COMPUTE_RESOURCE(RESOURCE_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE COMPUTE_RESOURCE_FILE_SYSTEM
-(
- COMPUTE_RESOURCE_ID VARCHAR (255) NOT NULL,
- PATH VARCHAR (255),
- FILE_SYSTEM VARCHAR (255) NOT NULL,
- PRIMARY KEY (COMPUTE_RESOURCE_ID,FILE_SYSTEM),
- FOREIGN KEY (COMPUTE_RESOURCE_ID) REFERENCES COMPUTE_RESOURCE(RESOURCE_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE JOB_SUBMISSION_INTERFACE
-(
- JOB_SUBMISSION_INTERFACE_ID VARCHAR (255) NOT NULL,
- COMPUTE_RESOURCE_ID VARCHAR (255) NOT NULL,
- JOB_SUBMISSION_PROTOCOL VARCHAR (255) NOT NULL,
- PRIORITY_ORDER INTEGER,
- CREATION_TIME TIMESTAMP DEFAULT NOW(),
- UPDATE_TIME TIMESTAMP DEFAULT '0000-00-00 00:00:00',
- PRIMARY KEY (COMPUTE_RESOURCE_ID,JOB_SUBMISSION_INTERFACE_ID),
- FOREIGN KEY (COMPUTE_RESOURCE_ID) REFERENCES COMPUTE_RESOURCE(RESOURCE_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE DATA_MOVEMENT_INTERFACE
-(
- COMPUTE_RESOURCE_ID VARCHAR (255) NOT NULL,
- DATA_MOVEMENT_PROTOCOL VARCHAR (255) NOT NULL,
- DATA_MOVEMENT_INTERFACE_ID VARCHAR (255) NOT NULL,
- PRIORITY_ORDER INTEGER,
- CREATION_TIME TIMESTAMP DEFAULT NOW(),
- UPDATE_TIME TIMESTAMP DEFAULT '0000-00-00 00:00:00',
- PRIMARY KEY (COMPUTE_RESOURCE_ID,DATA_MOVEMENT_INTERFACE_ID),
- FOREIGN KEY (COMPUTE_RESOURCE_ID) REFERENCES COMPUTE_RESOURCE(RESOURCE_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE JOB_MANAGER_COMMAND
-(
- RESOURCE_JOB_MANAGER_ID VARCHAR (255) NOT NULL,
- COMMAND_TYPE VARCHAR (255) NOT NULL,
- COMMAND VARCHAR (255),
- PRIMARY KEY (RESOURCE_JOB_MANAGER_ID,COMMAND_TYPE),
- FOREIGN KEY (RESOURCE_JOB_MANAGER_ID) REFERENCES RESOURCE_JOB_MANAGER(RESOURCE_JOB_MANAGER_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE LOCAL_SUBMISSION
-(
- RESOURCE_JOB_MANAGER_ID VARCHAR (255) NOT NULL,
- JOB_SUBMISSION_INTERFACE_ID VARCHAR (255) NOT NULL,
- CREATION_TIME TIMESTAMP DEFAULT NOW(),
- 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 LOCAL_DATA_MOVEMENT
-(
- DATA_MOVEMENT_INTERFACE_ID VARCHAR (255) NOT NULL,
- PRIMARY KEY (DATA_MOVEMENT_INTERFACE_ID)
-);
-
-CREATE TABLE WORKFLOW
-(
- WF_TEMPLATE_ID VARCHAR (255) NOT NULL,
- WF_NAME VARCHAR (255) NOT NULL,
- GRAPH LONGTEXT,
- OWNER VARCHAR(255),
- CREATION_TIME TIMESTAMP DEFAULT NOW(),
- UPDATE_TIME TIMESTAMP DEFAULT '0000-00-00 00:00:00',
- IMAGE BLOB,
- PRIMARY KEY (WF_TEMPLATE_ID)
-);
-
-CREATE TABLE WORKFLOW_INPUT
-(
- WF_TEMPLATE_ID VARCHAR(255),
- INPUT_KEY VARCHAR(255),
- INPUT_VALUE LONGTEXT,
- DATA_TYPE VARCHAR(255),
- METADATA VARCHAR(255),
- APP_ARGUMENT VARCHAR(255),
- STANDARD_INPUT SMALLINT,
- USER_FRIENDLY_DESC VARCHAR(255),
- PRIMARY KEY(WF_TEMPLATE_ID,INPUT_KEY),
- FOREIGN KEY (WF_TEMPLATE_ID) REFERENCES WORKFLOW(WF_TEMPLATE_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE WORKFLOW_OUTPUT
-(
- WF_TEMPLATE_ID VARCHAR(255),
- OUTPUT_KEY VARCHAR(255),
- OUTPUT_VALUE LONGTEXT,
- DATA_TYPE VARCHAR(255),
- PRIMARY KEY(WF_TEMPLATE_ID,OUTPUT_KEY),
- FOREIGN KEY (WF_TEMPLATE_ID) REFERENCES WORKFLOW(WF_TEMPLATE_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE CONFIGURATION
-(
- CONFIG_KEY VARCHAR(255),
- CONFIG_VAL VARCHAR(255),
- PRIMARY KEY(CONFIG_KEY, CONFIG_VAL)
-);
-
-INSERT INTO CONFIGURATION (CONFIG_KEY, CONFIG_VAL) VALUES('app_catalog_version', '0.15');
-
[17/52] [abbrv] [partial] airavata git commit: registry refactoring
Posted by sh...@apache.org.
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/AppDeploymentResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/AppDeploymentResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/AppDeploymentResource.java
new file mode 100644
index 0000000..a635666
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/AppDeploymentResource.java
@@ -0,0 +1,446 @@
+/*
+ *
+ * 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.aiaravata.application.catalog.data.resources;
+
+import org.airavata.appcatalog.cpi.AppCatalogException;
+import org.apache.aiaravata.application.catalog.data.model.ApplicationDeployment;
+import org.apache.aiaravata.application.catalog.data.model.ApplicationModule;
+import org.apache.aiaravata.application.catalog.data.model.ComputeResource;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogJPAUtils;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogQueryGenerator;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogResourceType;
+import org.apache.airavata.common.exception.ApplicationSettingsException;
+import org.apache.airavata.common.utils.AiravataUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.persistence.EntityManager;
+import javax.persistence.Query;
+import java.sql.Timestamp;
+import java.util.ArrayList;
+import java.util.List;
+
+public class AppDeploymentResource extends AbstractResource {
+ private final static Logger logger = LoggerFactory.getLogger(AppDeploymentResource.class);
+ private String deploymentId;
+ private String appModuleId;
+ private String hostId;
+ private String executablePath;
+ private String parallelism;
+ private String appDes;
+ private String gatewayId;
+ private ComputeResourceResource hostResource;
+ private AppModuleResource moduleResource;
+ private Timestamp createdTime;
+ private Timestamp updatedTime;
+
+ public String getGatewayId() {
+ return gatewayId;
+ }
+
+ public void setGatewayId(String gatewayId) {
+ this.gatewayId = gatewayId;
+ }
+
+ public Timestamp getCreatedTime() {
+ return createdTime;
+ }
+
+ public void setCreatedTime(Timestamp createdTime) {
+ this.createdTime = createdTime;
+ }
+
+ public Timestamp getUpdatedTime() {
+ return updatedTime;
+ }
+
+ public void setUpdatedTime(Timestamp updatedTime) {
+ this.updatedTime = updatedTime;
+ }
+
+ public String getDeploymentId() {
+ return deploymentId;
+ }
+
+ public void setDeploymentId(String deploymentId) {
+ this.deploymentId = deploymentId;
+ }
+
+ public String getAppModuleId() {
+ return appModuleId;
+ }
+
+ public void setAppModuleId(String appModuleId) {
+ this.appModuleId = appModuleId;
+ }
+
+ public String getHostId() {
+ return hostId;
+ }
+
+ public void setHostId(String hostId) {
+ this.hostId = hostId;
+ }
+
+ public String getExecutablePath() {
+ return executablePath;
+ }
+
+ public void setExecutablePath(String executablePath) {
+ this.executablePath = executablePath;
+ }
+
+ public String getAppDes() {
+ return appDes;
+ }
+
+ public void setAppDes(String appDes) {
+ this.appDes = appDes;
+ }
+
+ public ComputeResourceResource getHostResource() {
+ return hostResource;
+ }
+
+ public void setHostResource(ComputeResourceResource hostResource) {
+ this.hostResource = hostResource;
+ }
+
+ public AppModuleResource getModuleResource() {
+ return moduleResource;
+ }
+
+ public void setModuleResource(AppModuleResource moduleResource) {
+ this.moduleResource = moduleResource;
+ }
+
+ @Override
+ public void remove(Object identifier) throws AppCatalogException {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator= new AppCatalogQueryGenerator(APPLICATION_DEPLOYMENT);
+ generator.setParameter(ApplicationDeploymentConstants.DEPLOYMENT_ID, identifier);
+ 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 Resource get(Object identifier) throws AppCatalogException {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(APPLICATION_DEPLOYMENT);
+ generator.setParameter(ApplicationDeploymentConstants.DEPLOYMENT_ID, identifier);
+ Query q = generator.selectQuery(em);
+ ApplicationDeployment deployment = (ApplicationDeployment) q.getSingleResult();
+ AppDeploymentResource deploymentResource =
+ (AppDeploymentResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.APPLICATION_DEPLOYMENT, deployment);
+ em.getTransaction().commit();
+ em.close();
+ return deploymentResource;
+ } 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<Resource> get(String fieldName, Object value) throws AppCatalogException {
+ List<Resource> appDeployments = new ArrayList<Resource>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ Query q;
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(APPLICATION_DEPLOYMENT);
+ List results;
+ if (fieldName.equals(ApplicationDeploymentConstants.APP_MODULE_ID)) {
+ generator.setParameter(ApplicationDeploymentConstants.APP_MODULE_ID, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ ApplicationDeployment deployment = (ApplicationDeployment) result;
+ AppDeploymentResource deploymentResource =
+ (AppDeploymentResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.APPLICATION_DEPLOYMENT, deployment);
+ appDeployments.add(deploymentResource);
+ }
+ }
+ } else if (fieldName.equals(ApplicationDeploymentConstants.COMPUTE_HOST_ID)) {
+ generator.setParameter(ApplicationDeploymentConstants.COMPUTE_HOST_ID, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ ApplicationDeployment deployment = (ApplicationDeployment) result;
+ AppDeploymentResource deploymentResource =
+ (AppDeploymentResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.APPLICATION_DEPLOYMENT, deployment);
+ appDeployments.add(deploymentResource);
+ }
+ }
+ }else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for app deployment resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for app deployment 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 appDeployments;
+ }
+
+ @Override
+ public List<Resource> getAll() throws AppCatalogException {
+ List<Resource> appDeployments = new ArrayList<Resource>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(APPLICATION_DEPLOYMENT);
+ generator.setParameter(ApplicationDeploymentConstants.GATEWAY_ID, gatewayId);
+ Query q = generator.selectQuery(em);
+ List results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ ApplicationDeployment deployment = (ApplicationDeployment) result;
+ AppDeploymentResource deploymentResource =
+ (AppDeploymentResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.APPLICATION_DEPLOYMENT, deployment);
+ appDeployments.add(deploymentResource);
+ }
+ }
+ 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 appDeployments;
+ }
+
+ @Override
+ public List<String> getAllIds() throws AppCatalogException {
+ List<String> appDeployments = new ArrayList<String>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(APPLICATION_DEPLOYMENT);
+ Query q = generator.selectQuery(em);
+ List results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ ApplicationDeployment deployment = (ApplicationDeployment) result;
+ appDeployments.add(deployment.getDeploymentID());
+ }
+ }
+ 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 appDeployments;
+ }
+
+ @Override
+ public List<String> getIds(String fieldName, Object value) throws AppCatalogException {
+ List<String> appDeployments = new ArrayList<String>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ Query q;
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(APPLICATION_DEPLOYMENT);
+ List results;
+ if (fieldName.equals(ApplicationDeploymentConstants.APP_MODULE_ID)) {
+ generator.setParameter(ApplicationDeploymentConstants.APP_MODULE_ID, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ ApplicationDeployment deployment = (ApplicationDeployment) result;
+ appDeployments.add(deployment.getDeploymentID());
+ }
+ }
+ } else if (fieldName.equals(ApplicationDeploymentConstants.COMPUTE_HOST_ID)) {
+ generator.setParameter(ApplicationDeploymentConstants.COMPUTE_HOST_ID, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ ApplicationDeployment deployment = (ApplicationDeployment) result;
+ appDeployments.add(deployment.getDeploymentID());
+ }
+ }
+ }else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for app deployment resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for app deployment 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 appDeployments;
+ }
+
+ @Override
+ public void save() throws AppCatalogException {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ ApplicationDeployment existingDeployment = em.find(ApplicationDeployment.class, deploymentId);
+ em.close();
+
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ ApplicationModule applicationModule = em.find(ApplicationModule.class, appModuleId);
+ ComputeResource computeHost = em.find(ComputeResource.class, hostId);
+ if (existingDeployment != null){
+ existingDeployment.setDeploymentID(deploymentId);
+ existingDeployment.setApplicationDesc(appDes);
+ existingDeployment.setAppModuleID(appModuleId);
+ existingDeployment.setApplicationModule(applicationModule);
+ existingDeployment.setComputeResource(computeHost);
+ existingDeployment.setHostID(hostId);
+ existingDeployment.setExecutablePath(executablePath);
+ existingDeployment.setParallelism(parallelism);
+ existingDeployment.setGatewayId(gatewayId);
+ existingDeployment.setUpdateTime(AiravataUtils.getCurrentTimestamp());
+ em.merge(existingDeployment);
+ }else {
+ ApplicationDeployment deployment = new ApplicationDeployment();
+ deployment.setApplicationDesc(appDes);
+ deployment.setDeploymentID(deploymentId);
+ deployment.setAppModuleID(appModuleId);
+ deployment.setHostID(hostId);
+ deployment.setApplicationModule(applicationModule);
+ deployment.setComputeResource(computeHost);
+ deployment.setExecutablePath(executablePath);
+ deployment.setParallelism(parallelism);
+ deployment.setGatewayId(gatewayId);
+ deployment.setCreationTime(AiravataUtils.getCurrentTimestamp());
+ em.persist(deployment);
+ }
+ 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 {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ ApplicationDeployment deployment = em.find(ApplicationDeployment.class, identifier);
+ em.close();
+ return deployment != null;
+ } 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();
+ }
+ }
+ }
+
+ public String getParallelism() {
+ return parallelism;
+ }
+
+ public void setParallelism(String parallelism) {
+ this.parallelism = parallelism;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/AppEnvironmentAppCatalogResourceAppCat.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/AppEnvironmentAppCatalogResourceAppCat.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/AppEnvironmentAppCatalogResourceAppCat.java
new file mode 100644
index 0000000..c81cd8a
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/AppEnvironmentAppCatalogResourceAppCat.java
@@ -0,0 +1,293 @@
+/*
+ *
+ * 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.AppEnvironment;
+import org.apache.airavata.registry.core.app.catalog.model.AppEnvironment_PK;
+import org.apache.airavata.registry.core.app.catalog.model.ApplicationDeployment;
+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 AppEnvironmentAppCatalogResourceAppCat extends AppCatAbstractResource {
+ private final static Logger logger = LoggerFactory.getLogger(AppEnvironmentAppCatalogResourceAppCat.class);
+ private String deploymentId;
+ private String name;
+ private String value;
+ private AppDeploymentAppCatalogResourceAppCat appDeploymentResource;
+
+ public String getDeploymentId() {
+ return deploymentId;
+ }
+
+ public void setDeploymentId(String deploymentId) {
+ this.deploymentId = deploymentId;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getValue() {
+ return value;
+ }
+
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+ public AppDeploymentAppCatalogResourceAppCat getAppDeploymentResource() {
+ return appDeploymentResource;
+ }
+
+ public void setAppDeploymentResource(AppDeploymentAppCatalogResourceAppCat appDeploymentResource) {
+ this.appDeploymentResource = appDeploymentResource;
+ }
+
+ @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(APP_ENVIRONMENT);
+ generator.setParameter(AppEnvironmentConstants.DEPLOYMENT_ID, ids.get(AppEnvironmentConstants.DEPLOYMENT_ID));
+ if (ids.get(AppEnvironmentConstants.NAME) != null){
+ generator.setParameter(AppEnvironmentConstants.NAME, ids.get(AppEnvironmentConstants.NAME));
+ }
+
+ 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(APP_ENVIRONMENT);
+ generator.setParameter(AppEnvironmentConstants.DEPLOYMENT_ID, ids.get(AppEnvironmentConstants.DEPLOYMENT_ID));
+ generator.setParameter(AppEnvironmentConstants.NAME, ids.get(AppEnvironmentConstants.NAME));
+ Query q = generator.selectQuery(em);
+ AppEnvironment appEnvironment = (AppEnvironment) q.getSingleResult();
+ AppEnvironmentAppCatalogResourceAppCat resource =
+ (AppEnvironmentAppCatalogResourceAppCat) AppCatalogJPAUtils.getResource(AppCatalogResourceType.APP_ENVIRONMENT, appEnvironment);
+ em.getTransaction().commit();
+ em.close();
+ return resource;
+ } 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> appEnvironmentList = new ArrayList<AppCatalogResource>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ Query q;
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(APP_ENVIRONMENT);
+ List results;
+ if (fieldName.equals(AppEnvironmentConstants.DEPLOYMENT_ID)) {
+ generator.setParameter(AppEnvironmentConstants.DEPLOYMENT_ID, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ AppEnvironment appEnvironment = (AppEnvironment) result;
+ AppEnvironmentAppCatalogResourceAppCat resource =
+ (AppEnvironmentAppCatalogResourceAppCat) AppCatalogJPAUtils.getResource(AppCatalogResourceType.APP_ENVIRONMENT, appEnvironment);
+ appEnvironmentList.add(resource);
+ }
+ }
+ } else if (fieldName.equals(AppEnvironmentConstants.NAME)) {
+ generator.setParameter(AppEnvironmentConstants.NAME, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ AppEnvironment appEnvironment = (AppEnvironment) result;
+ AppEnvironmentAppCatalogResourceAppCat resource =
+ (AppEnvironmentAppCatalogResourceAppCat) AppCatalogJPAUtils.getResource(AppCatalogResourceType.APP_ENVIRONMENT, appEnvironment);
+ appEnvironmentList.add(resource);
+ }
+ }
+ }else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for App Environment resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for App Environment 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 appEnvironmentList;
+ }
+
+ @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();
+ AppEnvironment existigAppEnv = em.find(AppEnvironment.class, new AppEnvironment_PK(deploymentId, name));
+ em.close();
+
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+
+ ApplicationDeployment deployment = em.find(ApplicationDeployment.class, deploymentId);
+ if (existigAppEnv != null){
+ existigAppEnv.setValue(value);
+ existigAppEnv.setApplicationDeployment(deployment);
+ em.merge(existigAppEnv);
+ }else {
+ AppEnvironment appEnvironment = new AppEnvironment();
+ appEnvironment.setDeploymentID(deploymentId);
+ appEnvironment.setName(name);
+ appEnvironment.setValue(value);
+ appEnvironment.setApplicationDeployment(deployment);
+ em.persist(appEnvironment);
+ }
+ 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();
+ AppEnvironment appEnvironment = em.find(AppEnvironment.class,
+ new AppEnvironment_PK(ids.get(AppEnvironmentConstants.DEPLOYMENT_ID),
+ ids.get(AppEnvironmentConstants.NAME)));
+ em.close();
+ return appEnvironment != null;
+ } 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();
+ }
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/AppEnvironmentResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/AppEnvironmentResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/AppEnvironmentResource.java
new file mode 100644
index 0000000..98f753f
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/AppEnvironmentResource.java
@@ -0,0 +1,293 @@
+/*
+ *
+ * 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.aiaravata.application.catalog.data.resources;
+
+import org.airavata.appcatalog.cpi.AppCatalogException;
+import org.apache.aiaravata.application.catalog.data.model.AppEnvironment;
+import org.apache.aiaravata.application.catalog.data.model.AppEnvironment_PK;
+import org.apache.aiaravata.application.catalog.data.model.ApplicationDeployment;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogJPAUtils;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogQueryGenerator;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogResourceType;
+import org.apache.airavata.common.exception.ApplicationSettingsException;
+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 AppEnvironmentResource extends AbstractResource {
+ private final static Logger logger = LoggerFactory.getLogger(AppEnvironmentResource.class);
+ private String deploymentId;
+ private String name;
+ private String value;
+ private AppDeploymentResource appDeploymentResource;
+
+ public String getDeploymentId() {
+ return deploymentId;
+ }
+
+ public void setDeploymentId(String deploymentId) {
+ this.deploymentId = deploymentId;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getValue() {
+ return value;
+ }
+
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+ public AppDeploymentResource getAppDeploymentResource() {
+ return appDeploymentResource;
+ }
+
+ public void setAppDeploymentResource(AppDeploymentResource appDeploymentResource) {
+ this.appDeploymentResource = appDeploymentResource;
+ }
+
+ @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(APP_ENVIRONMENT);
+ generator.setParameter(AppEnvironmentConstants.DEPLOYMENT_ID, ids.get(AppEnvironmentConstants.DEPLOYMENT_ID));
+ if (ids.get(AppEnvironmentConstants.NAME) != null){
+ generator.setParameter(AppEnvironmentConstants.NAME, ids.get(AppEnvironmentConstants.NAME));
+ }
+
+ 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 Resource 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(APP_ENVIRONMENT);
+ generator.setParameter(AppEnvironmentConstants.DEPLOYMENT_ID, ids.get(AppEnvironmentConstants.DEPLOYMENT_ID));
+ generator.setParameter(AppEnvironmentConstants.NAME, ids.get(AppEnvironmentConstants.NAME));
+ Query q = generator.selectQuery(em);
+ AppEnvironment appEnvironment = (AppEnvironment) q.getSingleResult();
+ AppEnvironmentResource resource =
+ (AppEnvironmentResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.APP_ENVIRONMENT, appEnvironment);
+ em.getTransaction().commit();
+ em.close();
+ return resource;
+ } 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<Resource> get(String fieldName, Object value) throws AppCatalogException {
+ List<Resource> appEnvironmentList = new ArrayList<Resource>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ Query q;
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(APP_ENVIRONMENT);
+ List results;
+ if (fieldName.equals(AppEnvironmentConstants.DEPLOYMENT_ID)) {
+ generator.setParameter(AppEnvironmentConstants.DEPLOYMENT_ID, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ AppEnvironment appEnvironment = (AppEnvironment) result;
+ AppEnvironmentResource resource =
+ (AppEnvironmentResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.APP_ENVIRONMENT, appEnvironment);
+ appEnvironmentList.add(resource);
+ }
+ }
+ } else if (fieldName.equals(AppEnvironmentConstants.NAME)) {
+ generator.setParameter(AppEnvironmentConstants.NAME, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ AppEnvironment appEnvironment = (AppEnvironment) result;
+ AppEnvironmentResource resource =
+ (AppEnvironmentResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.APP_ENVIRONMENT, appEnvironment);
+ appEnvironmentList.add(resource);
+ }
+ }
+ }else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for App Environment resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for App Environment 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 appEnvironmentList;
+ }
+
+ @Override
+ public List<Resource> 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();
+ AppEnvironment existigAppEnv = em.find(AppEnvironment.class, new AppEnvironment_PK(deploymentId, name));
+ em.close();
+
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+
+ ApplicationDeployment deployment = em.find(ApplicationDeployment.class, deploymentId);
+ if (existigAppEnv != null){
+ existigAppEnv.setValue(value);
+ existigAppEnv.setApplicationDeployment(deployment);
+ em.merge(existigAppEnv);
+ }else {
+ AppEnvironment appEnvironment = new AppEnvironment();
+ appEnvironment.setDeploymentID(deploymentId);
+ appEnvironment.setName(name);
+ appEnvironment.setValue(value);
+ appEnvironment.setApplicationDeployment(deployment);
+ em.persist(appEnvironment);
+ }
+ 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();
+ AppEnvironment appEnvironment = em.find(AppEnvironment.class,
+ new AppEnvironment_PK(ids.get(AppEnvironmentConstants.DEPLOYMENT_ID),
+ ids.get(AppEnvironmentConstants.NAME)));
+ em.close();
+ return appEnvironment != null;
+ } 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();
+ }
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/AppInterfaceAppCatalogResourceAppCat.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/AppInterfaceAppCatalogResourceAppCat.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/AppInterfaceAppCatalogResourceAppCat.java
new file mode 100644
index 0000000..6e972e8
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/AppInterfaceAppCatalogResourceAppCat.java
@@ -0,0 +1,363 @@
+/*
+ *
+ * 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.common.utils.AiravataUtils;
+import org.apache.airavata.registry.core.app.catalog.model.ApplicationInterface;
+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.sql.Timestamp;
+import java.util.ArrayList;
+import java.util.List;
+
+public class AppInterfaceAppCatalogResourceAppCat extends AppCatAbstractResource {
+ private final static Logger logger = LoggerFactory.getLogger(AppInterfaceAppCatalogResourceAppCat.class);
+ private String interfaceId;
+ private String appName;
+ private String appDescription;
+ private Timestamp createdTime;
+ private Timestamp updatedTime;
+ private String gatewayId;
+
+ public String getGatewayId() {
+ return gatewayId;
+ }
+
+ public void setGatewayId(String gatewayId) {
+ this.gatewayId = gatewayId;
+ }
+
+ public Timestamp getCreatedTime() {
+ return createdTime;
+ }
+
+ public void setCreatedTime(Timestamp createdTime) {
+ this.createdTime = createdTime;
+ }
+
+ public Timestamp getUpdatedTime() {
+ return updatedTime;
+ }
+
+ public void setUpdatedTime(Timestamp updatedTime) {
+ this.updatedTime = updatedTime;
+ }
+
+ public String getInterfaceId() {
+ return interfaceId;
+ }
+
+ public void setInterfaceId(String interfaceId) {
+ this.interfaceId = interfaceId;
+ }
+
+ public String getAppName() {
+ return appName;
+ }
+
+ public void setAppName(String appName) {
+ this.appName = appName;
+ }
+
+ public String getAppDescription() {
+ return appDescription;
+ }
+
+ public void setAppDescription(String appDescription) {
+ this.appDescription = appDescription;
+ }
+
+ @Override
+ public void remove(Object identifier) throws AppCatalogException {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator= new AppCatalogQueryGenerator(APPLICATION_INTERFACE);
+ generator.setParameter(ApplicationInterfaceConstants.INTERFACE_ID, identifier);
+ 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 {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(APPLICATION_INTERFACE);
+ generator.setParameter(ApplicationInterfaceConstants.INTERFACE_ID, identifier);
+ Query q = generator.selectQuery(em);
+ ApplicationInterface applicationInterface = (ApplicationInterface) q.getSingleResult();
+ AppInterfaceAppCatalogResourceAppCat resource =
+ (AppInterfaceAppCatalogResourceAppCat) AppCatalogJPAUtils.getResource(AppCatalogResourceType.APPLICATION_INTERFACE, applicationInterface);
+ em.getTransaction().commit();
+ em.close();
+ return resource;
+ } 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> resourceList = new ArrayList<AppCatalogResource>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ Query q;
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(APPLICATION_INTERFACE);
+ List results;
+ if (fieldName.equals(ApplicationInterfaceConstants.APPLICATION_NAME)) {
+ generator.setParameter(ApplicationInterfaceConstants.APPLICATION_NAME, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ ApplicationInterface appInterface = (ApplicationInterface) result;
+ AppInterfaceAppCatalogResourceAppCat resource =
+ (AppInterfaceAppCatalogResourceAppCat) AppCatalogJPAUtils.getResource(AppCatalogResourceType.APPLICATION_INTERFACE, appInterface);
+ resourceList.add(resource);
+ }
+ }
+ } else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for application interface.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for application interface.");
+ }
+ 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 resourceList;
+ }
+
+ @Override
+ public List<AppCatalogResource> getAll() throws AppCatalogException {
+ List<AppCatalogResource> resourceList = new ArrayList<AppCatalogResource>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(APPLICATION_INTERFACE);
+ generator.setParameter(ApplicationInterfaceConstants.GATEWAY_ID, gatewayId);
+ Query q = generator.selectQuery(em);
+ List results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ ApplicationInterface appInterface = (ApplicationInterface) result;
+ AppInterfaceAppCatalogResourceAppCat resource =
+ (AppInterfaceAppCatalogResourceAppCat) AppCatalogJPAUtils.getResource(AppCatalogResourceType.APPLICATION_INTERFACE, appInterface);
+ resourceList.add(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 resourceList;
+ }
+
+ @Override
+ public List<String> getAllIds() throws AppCatalogException {
+ List<String> resourceList = new ArrayList<String>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(APPLICATION_INTERFACE);
+ Query q = generator.selectQuery(em);
+ List results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ ApplicationInterface appInterface = (ApplicationInterface) result;
+ resourceList.add(appInterface.getInterfaceID());
+ }
+ }
+ 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 resourceList;
+ }
+
+ @Override
+ public List<String> getIds(String fieldName, Object value) throws AppCatalogException {
+ List<String> resourceList = new ArrayList<String>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ Query q;
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(APPLICATION_INTERFACE);
+ List results;
+ if (fieldName.equals(ApplicationInterfaceConstants.APPLICATION_NAME)) {
+ generator.setParameter(ApplicationInterfaceConstants.APPLICATION_NAME, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ ApplicationInterface appInterface = (ApplicationInterface) result;
+ resourceList.add(appInterface.getInterfaceID());
+ }
+ }
+ } else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for application interface.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for application interface.");
+ }
+ 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 resourceList;
+ }
+
+ @Override
+ public void save() throws AppCatalogException {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ ApplicationInterface existigAppInterface = em.find(ApplicationInterface.class, interfaceId);
+ em.close();
+
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ if (existigAppInterface != null){
+ existigAppInterface.setAppName(appName);
+ existigAppInterface.setAppDescription(appDescription);
+ existigAppInterface.setUpdateTime(AiravataUtils.getCurrentTimestamp());
+ existigAppInterface.setGatewayId(gatewayId);
+ em.merge(existigAppInterface);
+ }else {
+ ApplicationInterface applicationInterface = new ApplicationInterface();
+ applicationInterface.setInterfaceID(interfaceId);
+ applicationInterface.setAppName(appName);
+ applicationInterface.setAppDescription(appDescription);
+ applicationInterface.setCreationTime(AiravataUtils.getCurrentTimestamp());
+ applicationInterface.setGatewayId(gatewayId);
+ em.persist(applicationInterface);
+ }
+ 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 {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ ApplicationInterface existigAppInterface = em.find(ApplicationInterface.class, identifier);
+ em.close();
+ return existigAppInterface != 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/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/AppInterfaceResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/AppInterfaceResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/AppInterfaceResource.java
new file mode 100644
index 0000000..3f6b60d
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/AppInterfaceResource.java
@@ -0,0 +1,363 @@
+/*
+ *
+ * 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.aiaravata.application.catalog.data.resources;
+
+import org.airavata.appcatalog.cpi.AppCatalogException;
+import org.apache.aiaravata.application.catalog.data.model.ApplicationInterface;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogJPAUtils;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogQueryGenerator;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogResourceType;
+import org.apache.airavata.common.exception.ApplicationSettingsException;
+import org.apache.airavata.common.utils.AiravataUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.persistence.EntityManager;
+import javax.persistence.Query;
+import java.sql.Timestamp;
+import java.util.ArrayList;
+import java.util.List;
+
+public class AppInterfaceResource extends AbstractResource {
+ private final static Logger logger = LoggerFactory.getLogger(AppInterfaceResource.class);
+ private String interfaceId;
+ private String appName;
+ private String appDescription;
+ private Timestamp createdTime;
+ private Timestamp updatedTime;
+ private String gatewayId;
+
+ public String getGatewayId() {
+ return gatewayId;
+ }
+
+ public void setGatewayId(String gatewayId) {
+ this.gatewayId = gatewayId;
+ }
+
+ public Timestamp getCreatedTime() {
+ return createdTime;
+ }
+
+ public void setCreatedTime(Timestamp createdTime) {
+ this.createdTime = createdTime;
+ }
+
+ public Timestamp getUpdatedTime() {
+ return updatedTime;
+ }
+
+ public void setUpdatedTime(Timestamp updatedTime) {
+ this.updatedTime = updatedTime;
+ }
+
+ public String getInterfaceId() {
+ return interfaceId;
+ }
+
+ public void setInterfaceId(String interfaceId) {
+ this.interfaceId = interfaceId;
+ }
+
+ public String getAppName() {
+ return appName;
+ }
+
+ public void setAppName(String appName) {
+ this.appName = appName;
+ }
+
+ public String getAppDescription() {
+ return appDescription;
+ }
+
+ public void setAppDescription(String appDescription) {
+ this.appDescription = appDescription;
+ }
+
+ @Override
+ public void remove(Object identifier) throws AppCatalogException {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator= new AppCatalogQueryGenerator(APPLICATION_INTERFACE);
+ generator.setParameter(ApplicationInterfaceConstants.INTERFACE_ID, identifier);
+ 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 Resource get(Object identifier) throws AppCatalogException {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(APPLICATION_INTERFACE);
+ generator.setParameter(ApplicationInterfaceConstants.INTERFACE_ID, identifier);
+ Query q = generator.selectQuery(em);
+ ApplicationInterface applicationInterface = (ApplicationInterface) q.getSingleResult();
+ AppInterfaceResource resource =
+ (AppInterfaceResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.APPLICATION_INTERFACE, applicationInterface);
+ em.getTransaction().commit();
+ em.close();
+ return resource;
+ } 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<Resource> get(String fieldName, Object value) throws AppCatalogException {
+ List<Resource> resourceList = new ArrayList<Resource>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ Query q;
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(APPLICATION_INTERFACE);
+ List results;
+ if (fieldName.equals(ApplicationInterfaceConstants.APPLICATION_NAME)) {
+ generator.setParameter(ApplicationInterfaceConstants.APPLICATION_NAME, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ ApplicationInterface appInterface = (ApplicationInterface) result;
+ AppInterfaceResource resource =
+ (AppInterfaceResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.APPLICATION_INTERFACE, appInterface);
+ resourceList.add(resource);
+ }
+ }
+ } else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for application interface.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for application interface.");
+ }
+ 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 resourceList;
+ }
+
+ @Override
+ public List<Resource> getAll() throws AppCatalogException {
+ List<Resource> resourceList = new ArrayList<Resource>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(APPLICATION_INTERFACE);
+ generator.setParameter(ApplicationInterfaceConstants.GATEWAY_ID, gatewayId);
+ Query q = generator.selectQuery(em);
+ List results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ ApplicationInterface appInterface = (ApplicationInterface) result;
+ AppInterfaceResource resource =
+ (AppInterfaceResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.APPLICATION_INTERFACE, appInterface);
+ resourceList.add(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 resourceList;
+ }
+
+ @Override
+ public List<String> getAllIds() throws AppCatalogException {
+ List<String> resourceList = new ArrayList<String>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(APPLICATION_INTERFACE);
+ Query q = generator.selectQuery(em);
+ List results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ ApplicationInterface appInterface = (ApplicationInterface) result;
+ resourceList.add(appInterface.getInterfaceID());
+ }
+ }
+ 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 resourceList;
+ }
+
+ @Override
+ public List<String> getIds(String fieldName, Object value) throws AppCatalogException {
+ List<String> resourceList = new ArrayList<String>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ Query q;
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(APPLICATION_INTERFACE);
+ List results;
+ if (fieldName.equals(ApplicationInterfaceConstants.APPLICATION_NAME)) {
+ generator.setParameter(ApplicationInterfaceConstants.APPLICATION_NAME, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ ApplicationInterface appInterface = (ApplicationInterface) result;
+ resourceList.add(appInterface.getInterfaceID());
+ }
+ }
+ } else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for application interface.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for application interface.");
+ }
+ 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 resourceList;
+ }
+
+ @Override
+ public void save() throws AppCatalogException {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ ApplicationInterface existigAppInterface = em.find(ApplicationInterface.class, interfaceId);
+ em.close();
+
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ if (existigAppInterface != null){
+ existigAppInterface.setAppName(appName);
+ existigAppInterface.setAppDescription(appDescription);
+ existigAppInterface.setUpdateTime(AiravataUtils.getCurrentTimestamp());
+ existigAppInterface.setGatewayId(gatewayId);
+ em.merge(existigAppInterface);
+ }else {
+ ApplicationInterface applicationInterface = new ApplicationInterface();
+ applicationInterface.setInterfaceID(interfaceId);
+ applicationInterface.setAppName(appName);
+ applicationInterface.setAppDescription(appDescription);
+ applicationInterface.setCreationTime(AiravataUtils.getCurrentTimestamp());
+ applicationInterface.setGatewayId(gatewayId);
+ em.persist(applicationInterface);
+ }
+ 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 {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ ApplicationInterface existigAppInterface = em.find(ApplicationInterface.class, identifier);
+ em.close();
+ return existigAppInterface != 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();
+ }
+ }
+ }
+}
[33/52] [abbrv] [partial] airavata git commit: registry refactoring
Posted by sh...@apache.org.
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/impl/ExperimentRegistry.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/impl/ExperimentRegistry.java b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/impl/ExperimentRegistry.java
deleted file mode 100644
index bd00a1e..0000000
--- a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/impl/ExperimentRegistry.java
+++ /dev/null
@@ -1,2983 +0,0 @@
-/*
- *
- * 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.experiment.catalog.impl;
-
-import org.apache.airavata.common.logger.AiravataLogger;
-import org.apache.airavata.common.logger.AiravataLoggerFactory;
-import org.apache.airavata.common.utils.AiravataUtils;
-import org.apache.airavata.model.appcatalog.appinterface.InputDataObjectType;
-import org.apache.airavata.model.appcatalog.appinterface.OutputDataObjectType;
-import org.apache.airavata.model.workspace.experiment.*;
-import org.apache.airavata.experiment.catalog.Resource;
-import org.apache.airavata.experiment.catalog.ResourceType;
-import org.apache.airavata.experiment.catalog.ResourceUtils;
-import org.apache.airavata.experiment.catalog.resources.*;
-import org.apache.airavata.experiment.catalog.utils.ThriftDataModelConversion;
-import org.apache.airavata.registry.cpi.CompositeIdentifier;
-import org.apache.airavata.registry.cpi.RegistryException;
-import org.apache.airavata.registry.cpi.RegistryModelType;
-import org.apache.airavata.registry.cpi.ResultOrderType;
-import org.apache.airavata.registry.cpi.utils.Constants;
-import org.apache.airavata.registry.cpi.utils.StatusType;
-
-import java.sql.Timestamp;
-import java.util.*;
-
-public class ExperimentRegistry {
- private GatewayResource gatewayResource;
- private WorkerResource workerResource;
- private final static AiravataLogger logger = AiravataLoggerFactory.getLogger(ExperimentRegistry.class);
-
- public ExperimentRegistry(GatewayResource gateway, UserResource user) throws RegistryException {
- gatewayResource = gateway;
- if (!gatewayResource.isExists(ResourceType.GATEWAY_WORKER, user.getUserName())) {
- workerResource = ResourceUtils.addGatewayWorker(gateway, user);
- } else {
- workerResource = (WorkerResource) ResourceUtils.getWorker(gateway.getGatewayId(), user.getUserName());
- }
-
- }
-
- public String addExperiment(Experiment experiment, String gatewayId) throws RegistryException {
- String experimentID;
- try {
- if (!ResourceUtils.isUserExist(experiment.getUserName())) {
- ResourceUtils.addUser(experiment.getUserName(), null);
- }
-
- experimentID = getExperimentID(experiment.getName());
- experiment.setExperimentID(experimentID);
- ExperimentResource experimentResource = new ExperimentResource();
- experimentResource.setExpID(experimentID);
- experimentResource.setExpName(experiment.getName());
- experimentResource.setExecutionUser(experiment.getUserName());
- experimentResource.setGatewayId(gatewayId);
- experimentResource.setGatewayExecutionId(experiment.getGatewayExecutionId());
- experimentResource.setEnableEmailNotifications(experiment.isEnableEmailNotification());
- if (!workerResource.isProjectExists(experiment.getProjectID())) {
- logger.error("Project does not exist in the system..");
- throw new Exception("Project does not exist in the system, Please create the project first...");
- }
- experimentResource.setProjectId(experiment.getProjectID());
- experimentResource.setCreationTime(AiravataUtils.getTime(experiment.getCreationTime()));
- experimentResource.setDescription(experiment.getDescription());
- experimentResource.setApplicationId(experiment.getApplicationId());
- experimentResource.setApplicationVersion(experiment.getApplicationVersion());
- experimentResource.setWorkflowTemplateId(experiment.getWorkflowTemplateId());
- experimentResource.setWorkflowTemplateVersion(experiment.getWorkflowTemplateVersion());
- experimentResource.setWorkflowExecutionId(experiment.getWorkflowExecutionInstanceId());
- experimentResource.save();
-
- List<String> emailAddresses = experiment.getEmailAddresses();
- if (emailAddresses != null && !emailAddresses.isEmpty()){
- for (String email : emailAddresses){
- NotificationEmailResource emailResource = new NotificationEmailResource();
- emailResource.setExperimentId(experimentID);
- emailResource.setEmailAddress(email);
- emailResource.save();
- }
- }
-
- List<InputDataObjectType> experimentInputs = experiment.getExperimentInputs();
- if (experimentInputs != null) {
- addExpInputs(experimentInputs, experimentResource);
- }
-
- UserConfigurationData userConfigurationData = experiment.getUserConfigurationData();
- if (userConfigurationData != null) {
- addUserConfigData(userConfigurationData, experimentID);
- }
-
- List<OutputDataObjectType> experimentOutputs = experiment.getExperimentOutputs();
- if (experimentOutputs != null && !experimentOutputs.isEmpty()) {
- //TODO: short change.
-// for (DataObjectType output : experimentOutputs){
-// output.setValue("");
-// }
- addExpOutputs(experimentOutputs, experimentID);
- }
-
-// ExperimentStatus experimentStatus = experiment.getExperimentStatus();
-// if (experimentStatus != null){
-// updateExperimentStatus(experimentStatus, experimentID);
-// }else {
- ExperimentStatus experimentStatus = new ExperimentStatus();
- experimentStatus.setExperimentState(ExperimentState.CREATED);
- updateExperimentStatus(experimentStatus, experimentID);
-// }
-
- List<WorkflowNodeDetails> workflowNodeDetailsList = experiment.getWorkflowNodeDetailsList();
- if (workflowNodeDetailsList != null && !workflowNodeDetailsList.isEmpty()) {
- for (WorkflowNodeDetails wf : workflowNodeDetailsList) {
- addWorkflowNodeDetails(wf, experimentID);
- }
- }
- List<ErrorDetails> errors = experiment.getErrors();
- if (errors != null && !errors.isEmpty()) {
- for (ErrorDetails errror : errors) {
- addErrorDetails(errror, experimentID);
- }
- }
- } catch (Exception e) {
- logger.error("Error while saving experiment to registry", e);
- throw new RegistryException(e);
- }
- return experimentID;
- }
-
- public String addUserConfigData(UserConfigurationData configurationData, String experimentID) throws RegistryException {
- try {
- ExperimentResource experiment = gatewayResource.getExperiment(experimentID);
- ConfigDataResource configData = (ConfigDataResource) experiment.create(ResourceType.CONFIG_DATA);
- configData.setExperimentId(experimentID);
- configData.setAiravataAutoSchedule(configurationData.isAiravataAutoSchedule());
- configData.setOverrideManualParams(configurationData.isOverrideManualScheduledParams());
- configData.setShareExp(configurationData.isShareExperimentPublicly());
- configData.setUserDn(configurationData.getUserDN());
- configData.setGenerateCert(configurationData.isGenerateCert());
- configData.save();
- ComputationalResourceScheduling resourceScheduling = configurationData.getComputationalResourceScheduling();
- if (resourceScheduling != null) {
- addComputationScheduling(resourceScheduling, experiment);
- }
- AdvancedInputDataHandling inputDataHandling = configurationData.getAdvanceInputDataHandling();
- if (inputDataHandling != null) {
- addInputDataHandling(inputDataHandling, experiment);
- }
-
- AdvancedOutputDataHandling outputDataHandling = configurationData.getAdvanceOutputDataHandling();
- if (outputDataHandling != null) {
- addOutputDataHandling(outputDataHandling, experiment);
- }
-
- QualityOfServiceParams qosParams = configurationData.getQosParams();
- if (qosParams != null) {
- addQosParams(qosParams, experiment);
- }
- } catch (Exception e) {
- logger.error("Unable to save user config data", e);
- throw new RegistryException(e);
- }
- return experimentID;
- }
-
- public void addQosParams(QualityOfServiceParams qosParams, Resource resource) throws RegistryException {
- try {
- QosParamResource qosr = new QosParamResource();
- if (resource instanceof ExperimentResource) {
- ExperimentResource experiment = (ExperimentResource) resource;
- qosr.setExperimentId(experiment.getExpID());
- }
- if (resource instanceof TaskDetailResource) {
- TaskDetailResource taskDetailResource = (TaskDetailResource) resource;
- qosr.setTaskId(taskDetailResource.getTaskId());
- String nodeId = taskDetailResource.getNodeId();
- ExperimentResource experimentResource = new ExperimentResource();
- WorkflowNodeDetailResource workflowNode = experimentResource.getWorkflowNode(nodeId);
- qosr.setExperimentId(workflowNode.getExperimentId());
- }
- qosr.setStartExecutionAt(qosParams.getStartExecutionAt());
- qosr.setExecuteBefore(qosParams.getExecuteBefore());
- qosr.setNoOfRetries(qosParams.getNumberofRetries());
- qosr.save();
- } catch (Exception e) {
- logger.error("Unable to save QOS params", e);
- throw new RegistryException(e);
- }
-
- }
-
- public void addOutputDataHandling(AdvancedOutputDataHandling outputDataHandling, Resource resource) throws RegistryException {
- AdvancedOutputDataHandlingResource adodh = new AdvancedOutputDataHandlingResource();
- try {
- if (resource instanceof ExperimentResource) {
- ExperimentResource experiment = (ExperimentResource) resource;
- adodh.setExperimentId(experiment.getExpID());
- }
- if (resource instanceof TaskDetailResource) {
- TaskDetailResource taskDetailResource = (TaskDetailResource) resource;
- String nodeId = taskDetailResource.getNodeId();
- ExperimentResource experimentResource = new ExperimentResource();
- WorkflowNodeDetailResource workflowNode = experimentResource.getWorkflowNode(nodeId);
- adodh.setExperimentId(workflowNode.getExperimentId());
- adodh.setTaskId(taskDetailResource.getTaskId());
- }
- adodh.setOutputDataDir(outputDataHandling.getOutputDataDir());
- adodh.setDataRegUrl(outputDataHandling.getDataRegistryURL());
- adodh.setPersistOutputData(outputDataHandling.isPersistOutputData());
- adodh.save();
- } catch (Exception e) {
- logger.error("Unable to save output data handling data", e);
- throw new RegistryException(e);
- }
-
- }
-
- public void addInputDataHandling(AdvancedInputDataHandling inputDataHandling, Resource resource) throws RegistryException {
- AdvanceInputDataHandlingResource adidh = new AdvanceInputDataHandlingResource();
- try {
- if (resource instanceof ExperimentResource) {
- ExperimentResource experiment = (ExperimentResource) resource;
- adidh.setExperimentId(experiment.getExpID());
- }
- if (resource instanceof TaskDetailResource) {
- TaskDetailResource taskDetailResource = (TaskDetailResource) resource;
- String nodeId = taskDetailResource.getNodeId();
- ExperimentResource experimentResource = new ExperimentResource();
- WorkflowNodeDetailResource workflowNode = experimentResource.getWorkflowNode(nodeId);
- adidh.setExperimentId(workflowNode.getExperimentId());
- adidh.setTaskId(taskDetailResource.getTaskId());
- }
- adidh.setWorkingDir(inputDataHandling.getUniqueWorkingDirectory());
- adidh.setWorkingDirParent(inputDataHandling.getParentWorkingDirectory());
- adidh.setStageInputFiles(inputDataHandling.isSetStageInputFilesToWorkingDir());
- adidh.setCleanAfterJob(inputDataHandling.isCleanUpWorkingDirAfterJob());
- adidh.save();
- } catch (Exception e) {
- logger.error("Unable to save input data handling data", e);
- throw new RegistryException(e);
- }
-
- }
-
- public void addComputationScheduling(ComputationalResourceScheduling resourceScheduling, Resource resource) throws RegistryException {
- ComputationSchedulingResource cmsr = new ComputationSchedulingResource();
- try {
- if (resource instanceof ExperimentResource) {
- ExperimentResource experiment = (ExperimentResource) resource;
- cmsr.setExperimentId(experiment.getExpID());
- }
- if (resource instanceof TaskDetailResource) {
- TaskDetailResource taskDetailResource = (TaskDetailResource) resource;
- String nodeId = taskDetailResource.getNodeId();
- ExperimentResource experimentResource = new ExperimentResource();
- WorkflowNodeDetailResource workflowNode = experimentResource.getWorkflowNode(nodeId);
- cmsr.setExperimentId(workflowNode.getExperimentId());
- cmsr.setTaskId(taskDetailResource.getTaskId());
- }
- cmsr.setResourceHostId(resourceScheduling.getResourceHostId());
- cmsr.setCpuCount(resourceScheduling.getTotalCPUCount());
- cmsr.setNodeCount(resourceScheduling.getNodeCount());
- cmsr.setNumberOfThreads(resourceScheduling.getNumberOfThreads());
- cmsr.setQueueName(resourceScheduling.getQueueName());
- cmsr.setWalltimeLimit(resourceScheduling.getWallTimeLimit());
- cmsr.setJobStartTime(AiravataUtils.getTime(resourceScheduling.getJobStartTime()));
- cmsr.setPhysicalMemory(resourceScheduling.getTotalPhysicalMemory());
- cmsr.setProjectName(resourceScheduling.getComputationalProjectAccount());
- cmsr.save();
- } catch (Exception e) {
- logger.error("Unable to save computational scheduling data", e);
- throw new RegistryException(e);
- }
-
- }
-
- public void addExpInputs(List<InputDataObjectType> exInputs, ExperimentResource experimentResource) throws RegistryException {
- try {
- for (InputDataObjectType input : exInputs) {
- ExperimentInputResource resource = (ExperimentInputResource) experimentResource.create(ResourceType.EXPERIMENT_INPUT);
- resource.setExperimentId(experimentResource.getExpID());
- resource.setExperimentKey(input.getName());
- resource.setValue(input.getValue());
- if (input.getType() != null) {
- resource.setDataType(input.getType().toString());
- }
- resource.setMetadata(input.getMetaData());
- resource.setAppArgument(input.getApplicationArgument());
- resource.setInputOrder(input.getInputOrder());
- resource.setRequired(input.isIsRequired());
- resource.setRequiredToCMD(input.isRequiredToAddedToCommandLine());
- resource.save();
- }
- } catch (Exception e) {
- logger.error("Unable to save experiment inputs", e);
- throw new RegistryException(e);
- }
- }
-
- public void updateExpInputs(List<InputDataObjectType> exInputs, ExperimentResource experimentResource) throws RegistryException {
- try {
- List<ExperimentInputResource> experimentInputs = experimentResource.getExperimentInputs();
- for (InputDataObjectType input : exInputs) {
- for (ExperimentInputResource exinput : experimentInputs) {
- if (exinput.getExperimentKey().equals(input.getName())) {
- exinput.setValue(input.getValue());
- if (input.getType() != null) {
- exinput.setDataType(input.getType().toString());
- }
- exinput.setMetadata(input.getMetaData());
- exinput.setAppArgument(input.getApplicationArgument());
- exinput.setInputOrder(input.getInputOrder());
- exinput.setRequired(input.isIsRequired());
- exinput.setRequiredToCMD(input.isRequiredToAddedToCommandLine());
- exinput.save();
- }
- }
- }
- } catch (Exception e) {
- logger.error("Unable to update experiment inputs", e);
- throw new RegistryException(e);
- }
-
- }
-
- public String addExpOutputs(List<OutputDataObjectType> exOutput, String expId) throws RegistryException {
- try {
- ExperimentResource experiment = gatewayResource.getExperiment(expId);
- for (OutputDataObjectType output : exOutput) {
- ExperimentOutputResource resource = (ExperimentOutputResource) experiment.create(ResourceType.EXPERIMENT_OUTPUT);
- resource.setExperimentId(expId);
- resource.setExperimentKey(output.getName());
- resource.setValue(output.getValue());
- if (output.getType() != null) {
- resource.setDataType(output.getType().toString());
- }
- resource.setRequired(output.isIsRequired());
- resource.setRequiredToCMD(output.isRequiredToAddedToCommandLine());
- resource.setDataMovement(output.isDataMovement());
- resource.setDataNameLocation(output.getLocation());
- resource.setAppArgument(output.getApplicationArgument());
- resource.setSearchQuery(output.getSearchQuery());
-// resource.setMetadata(output.get());
- resource.save();
- }
- } catch (Exception e) {
- logger.error("Error while adding experiment outputs...", e);
- throw new RegistryException(e);
- }
- return expId;
- }
-
- public void updateExpOutputs(List<OutputDataObjectType> exOutput, String expId) throws RegistryException {
- try {
- ExperimentResource experiment = gatewayResource.getExperiment(expId);
- List<ExperimentOutputResource> existingExpOutputs = experiment.getExperimentOutputs();
- for (OutputDataObjectType output : exOutput) {
- for (ExperimentOutputResource resource : existingExpOutputs) {
- if (resource.getExperimentKey().equals(output.getName())) {
- resource.setExperimentId(expId);
- resource.setExperimentKey(output.getName());
- resource.setValue(output.getValue());
- if (output.getType() != null) {
- resource.setDataType(output.getType().toString());
- }
- resource.setRequired(output.isIsRequired());
- resource.setRequiredToCMD(output.isRequiredToAddedToCommandLine());
- resource.setDataMovement(output.isDataMovement());
- resource.setDataNameLocation(output.getLocation());
- resource.setAppArgument(output.getApplicationArgument());
- resource.setSearchQuery(output.getSearchQuery());
-// resource.setMetadata(output.getMetaData());
- resource.save();
- }
- }
- }
- } catch (Exception e) {
- logger.error("Error while updating experiment outputs", e);
- throw new RegistryException(e);
- }
- }
-
- public String addNodeOutputs(List<OutputDataObjectType> wfOutputs, CompositeIdentifier ids) throws RegistryException {
- try {
- ExperimentResource experiment = gatewayResource.getExperiment((String) ids.getTopLevelIdentifier());
- WorkflowNodeDetailResource workflowNode = experiment.getWorkflowNode((String) ids.getSecondLevelIdentifier());
- for (OutputDataObjectType output : wfOutputs) {
- NodeOutputResource resource = (NodeOutputResource) workflowNode.create(ResourceType.NODE_OUTPUT);
- resource.setNodeId(workflowNode.getNodeInstanceId());
- resource.setOutputKey(output.getName());
- resource.setValue(output.getValue());
- if (output.getType() != null) {
- resource.setDataType(output.getType().toString());
- }
- resource.setRequired(output.isIsRequired());
- resource.setRequiredToCMD(output.isRequiredToAddedToCommandLine());
- resource.setDataMovement(output.isDataMovement());
- resource.setDataNameLocation(output.getLocation());
- resource.setAppArgument(output.getApplicationArgument());
- resource.setSearchQuery(output.getSearchQuery());
-// resource.setMetadata(output.getMetaData());
- resource.save();
- }
- } catch (Exception e) {
- logger.error("Error while adding node outputs...", e);
- throw new RegistryException(e);
- }
- return (String) ids.getSecondLevelIdentifier();
- }
-
- public void updateNodeOutputs(List<OutputDataObjectType> wfOutputs, String nodeId) throws RegistryException {
- try {
- ExperimentResource experiment = (ExperimentResource) gatewayResource.create(ResourceType.EXPERIMENT);
- WorkflowNodeDetailResource workflowNode = experiment.getWorkflowNode(nodeId);
- List<NodeOutputResource> nodeOutputs = workflowNode.getNodeOutputs();
- for (OutputDataObjectType output : wfOutputs) {
- for (NodeOutputResource resource : nodeOutputs) {
- resource.setNodeId(workflowNode.getNodeInstanceId());
- resource.setOutputKey(output.getName());
- resource.setValue(output.getValue());
- if (output.getType() != null) {
- resource.setDataType(output.getType().toString());
- }
- resource.setRequired(output.isIsRequired());
- resource.setRequiredToCMD(output.isRequiredToAddedToCommandLine());
- resource.setDataMovement(output.isDataMovement());
- resource.setDataNameLocation(output.getLocation());
- resource.setAppArgument(output.getApplicationArgument());
- resource.setSearchQuery(output.getSearchQuery());
-// resource.setMetadata(output.getMetaData());
- resource.save();
- }
- }
- } catch (Exception e) {
- logger.error("Error while updating node outputs...", e);
- throw new RegistryException(e);
- }
- }
-
- public String addApplicationOutputs(List<OutputDataObjectType> appOutputs, CompositeIdentifier ids) throws RegistryException {
- try {
- ExperimentResource experiment = (ExperimentResource) gatewayResource.create(ResourceType.EXPERIMENT);
- WorkflowNodeDetailResource workflowNode = experiment.getWorkflowNode((String) ids.getTopLevelIdentifier());
- TaskDetailResource taskDetail = workflowNode.getTaskDetail((String) ids.getSecondLevelIdentifier());
- for (OutputDataObjectType output : appOutputs) {
- ApplicationOutputResource resource = (ApplicationOutputResource) taskDetail.create(ResourceType.APPLICATION_OUTPUT);
- resource.setTaskId(taskDetail.getTaskId());
- resource.setOutputKey(output.getName());
- resource.setValue(output.getValue());
- if (output.getType() != null) {
- resource.setDataType(output.getType().toString());
- }
- resource.setRequired(output.isIsRequired());
- resource.setRequiredToCMD(output.isRequiredToAddedToCommandLine());
- resource.setDataMovement(output.isDataMovement());
- resource.setDataNameLocation(output.getLocation());
- resource.setAppArgument(output.getApplicationArgument());
- resource.setSearchQuery(output.getSearchQuery());
-// resource.setMetadata(output.getMetaData());
- resource.save();
- }
- } catch (Exception e) {
- logger.error("Error while adding application outputs...", e);
- throw new RegistryException(e);
- }
- return (String) ids.getSecondLevelIdentifier();
- }
-
- public String updateExperimentStatus(ExperimentStatus experimentStatus, String expId) throws RegistryException {
- try {
- ExperimentResource experiment = gatewayResource.getExperiment(expId);
- StatusResource status = experiment.getExperimentStatus();
- if (status == null) {
- status = (StatusResource) experiment.create(ResourceType.STATUS);
- }
- status.setExperimentId(expId);
- status.setStatusUpdateTime(AiravataUtils.getTime(experimentStatus.getTimeOfStateChange()));
- if (status.getState() == null) {
- status.setState(ExperimentState.UNKNOWN.name());
- }
- if (isValidStatusTransition(ExperimentState.valueOf(status.getState()), experimentStatus.getExperimentState())) {
- status.setState(experimentStatus.getExperimentState().toString());
- status.setStatusType(StatusType.EXPERIMENT.toString());
- status.save();
- logger.debugId(expId, "Updated experiment {} status to {}.", expId, experimentStatus.toString());
- }
- } catch (Exception e) {
- logger.errorId(expId, "Error while updating experiment status...", e);
- throw new RegistryException(e);
- }
- return expId;
- }
-
- public String addWorkflowNodeStatus(WorkflowNodeStatus status, CompositeIdentifier ids) throws RegistryException {
- try {
- ExperimentResource experiment = gatewayResource.getExperiment((String) ids.getTopLevelIdentifier());
- WorkflowNodeDetailResource workflowNode = experiment.getWorkflowNode((String) ids.getSecondLevelIdentifier());
- StatusResource statusResource = (StatusResource) experiment.create(ResourceType.STATUS);
- statusResource.setExperimentId(experiment.getExpID());
- statusResource.setNodeId(workflowNode.getNodeInstanceId());
- statusResource.setStatusType(StatusType.WORKFLOW_NODE.toString());
- statusResource.setStatusUpdateTime(AiravataUtils.getTime(status.getTimeOfStateChange()));
- if (status.getWorkflowNodeState() == null) {
- statusResource.setState(WorkflowNodeState.UNKNOWN.toString());
- } else {
- statusResource.setState(status.getWorkflowNodeState().toString());
- }
- statusResource.save();
- return String.valueOf(statusResource.getStatusId());
- } catch (Exception e) {
- logger.error("Error while adding workflow node status...", e);
- throw new RegistryException(e);
- }
- }
-
- public String updateWorkflowNodeStatus(WorkflowNodeStatus status, String nodeId) throws RegistryException {
- try {
- ExperimentResource experiment = (ExperimentResource) gatewayResource.create(ResourceType.EXPERIMENT);
- WorkflowNodeDetailResource workflowNode = experiment.getWorkflowNode(nodeId);
- StatusResource statusResource = workflowNode.getWorkflowNodeStatus();
- if (statusResource == null) {
- statusResource = (StatusResource) workflowNode.create(ResourceType.STATUS);
- }
- statusResource.setExperimentId(workflowNode.getExperimentId());
- statusResource.setNodeId(nodeId);
- statusResource.setStatusType(StatusType.WORKFLOW_NODE.toString());
- statusResource.setStatusUpdateTime(AiravataUtils.getTime(status.getTimeOfStateChange()));
- statusResource.setState(status.getWorkflowNodeState().toString());
- statusResource.save();
- logger.debugId(nodeId, "Updated workflow node {} status to {}.", nodeId, status.toString());
- return String.valueOf(statusResource.getStatusId());
- } catch (Exception e) {
- logger.errorId(nodeId, "Error while updating workflow node status to " + status.toString() + "...", e);
- throw new RegistryException(e);
- }
- }
-
- public String addTaskStatus(TaskStatus status, CompositeIdentifier ids) throws RegistryException {
- try {
- ExperimentResource experiment = (ExperimentResource) gatewayResource.create(ResourceType.EXPERIMENT);
- WorkflowNodeDetailResource workflowNode = experiment.getWorkflowNode((String) ids.getTopLevelIdentifier());
- TaskDetailResource taskDetail = workflowNode.getTaskDetail((String) ids.getSecondLevelIdentifier());
- StatusResource statusResource = (StatusResource) workflowNode.create(ResourceType.STATUS);
- statusResource.setExperimentId(workflowNode.getExperimentId());
- statusResource.setNodeId(workflowNode.getNodeInstanceId());
- statusResource.setTaskId(taskDetail.getTaskId());
- statusResource.setStatusType(StatusType.TASK.toString());
- statusResource.setStatusUpdateTime(AiravataUtils.getTime(status.getTimeOfStateChange()));
- if (status.getExecutionState() == null) {
- statusResource.setState(TaskState.UNKNOWN.toString());
- } else {
- statusResource.setState(status.getExecutionState().toString());
- }
- statusResource.save();
- return String.valueOf(statusResource.getStatusId());
- } catch (Exception e) {
- logger.error("Error while adding task status...", e);
- throw new RegistryException(e);
- }
- }
-
- public void updateTaskStatus(TaskStatus status, String taskId) throws RegistryException {
- try {
- ExperimentResource experiment = (ExperimentResource) gatewayResource.create(ResourceType.EXPERIMENT);
- WorkflowNodeDetailResource workflowNode = (WorkflowNodeDetailResource) experiment.create(ResourceType.WORKFLOW_NODE_DETAIL);
- TaskDetailResource taskDetail = workflowNode.getTaskDetail(taskId);
- StatusResource statusResource;
- if (taskDetail.isTaskStatusExist(taskId)) {
- workflowNode = experiment.getWorkflowNode(taskDetail.getNodeId());
- statusResource = workflowNode.getTaskStatus(taskId);
- } else {
- statusResource = (StatusResource) taskDetail.create(ResourceType.STATUS);
- }
- statusResource.setExperimentId(workflowNode.getExperimentId());
- statusResource.setNodeId(workflowNode.getNodeInstanceId());
- statusResource.setTaskId(taskId);
- statusResource.setStatusType(StatusType.TASK.toString());
- statusResource.setStatusUpdateTime(AiravataUtils.getTime(status.getTimeOfStateChange()));
- statusResource.setState(status.getExecutionState().toString());
- statusResource.save();
- logger.infoId(taskId, "Updated task {} status to {}.", taskId, status.toString());
- } catch (Exception e) {
- logger.errorId(taskId, "Error while updating task status to " + status.toString() + "...", e);
- throw new RegistryException(e);
- }
- }
-
- /**
- * @param status job status
- * @param ids composite id will contain taskid and jobid
- * @return status id
- */
- public String addJobStatus(JobStatus status, CompositeIdentifier ids) throws RegistryException {
- try {
- ExperimentResource experiment = (ExperimentResource) gatewayResource.create(ResourceType.EXPERIMENT);
- WorkflowNodeDetailResource workflowNode = (WorkflowNodeDetailResource) experiment.create(ResourceType.WORKFLOW_NODE_DETAIL);
- TaskDetailResource taskDetail = workflowNode.getTaskDetail((String) ids.getTopLevelIdentifier());
- workflowNode = experiment.getWorkflowNode(taskDetail.getNodeId());
- JobDetailResource jobDetail = taskDetail.getJobDetail((String) ids.getSecondLevelIdentifier());
- StatusResource statusResource = (StatusResource) jobDetail.create(ResourceType.STATUS);
- statusResource.setExperimentId(workflowNode.getExperimentId());
- statusResource.setNodeId(workflowNode.getNodeInstanceId());
- statusResource.setTaskId(taskDetail.getTaskId());
- statusResource.setStatusType(StatusType.JOB.toString());
- statusResource.setStatusUpdateTime(AiravataUtils.getTime(status.getTimeOfStateChange()));
- if (status.getJobState() == null) {
- statusResource.setState(JobState.UNKNOWN.toString());
- } else {
- statusResource.setState(status.getJobState().toString());
- }
- statusResource.save();
- return String.valueOf(statusResource.getStatusId());
- } catch (Exception e) {
- logger.error("Error while adding job status...", e);
- throw new RegistryException(e);
- }
- }
-
- public String updateJobStatus(JobStatus status, CompositeIdentifier ids) throws RegistryException {
- try {
- ExperimentResource experiment = (ExperimentResource) gatewayResource.create(ResourceType.EXPERIMENT);
- WorkflowNodeDetailResource workflowNode = (WorkflowNodeDetailResource) experiment.create(ResourceType.WORKFLOW_NODE_DETAIL);
- TaskDetailResource taskDetail = workflowNode.getTaskDetail((String) ids.getTopLevelIdentifier());
- JobDetailResource jobDetail = taskDetail.getJobDetail((String) ids.getSecondLevelIdentifier());
- StatusResource statusResource = jobDetail.getJobStatus();
- workflowNode = experiment.getWorkflowNode(taskDetail.getNodeId());
- statusResource.setExperimentId(workflowNode.getExperimentId());
- statusResource.setNodeId(workflowNode.getNodeInstanceId());
- statusResource.setTaskId(taskDetail.getTaskId());
- statusResource.setStatusType(StatusType.JOB.toString());
- statusResource.setStatusUpdateTime(AiravataUtils.getTime(status.getTimeOfStateChange()));
- statusResource.setState(status.getJobState().toString());
- statusResource.save();
- logger.infoId(ids.toString(), "Updated job status to {}", status.toString());
- return String.valueOf(statusResource.getStatusId());
- } catch (Exception e) {
- logger.errorId(ids.toString(), "Error while updating job status to " + status.toString() + " ...", e);
- throw new RegistryException(e);
- }
- }
-
- /**
- * @param status application status
- * @param ids composite id will contain taskid and jobid
- * @return status id
- */
- public String addApplicationStatus(ApplicationStatus status, CompositeIdentifier ids) throws RegistryException {
- try {
- ExperimentResource experiment = (ExperimentResource) gatewayResource.create(ResourceType.EXPERIMENT);
- WorkflowNodeDetailResource workflowNode = (WorkflowNodeDetailResource) experiment.create(ResourceType.WORKFLOW_NODE_DETAIL);
- TaskDetailResource taskDetail = workflowNode.getTaskDetail((String) ids.getTopLevelIdentifier());
- JobDetailResource jobDetail = taskDetail.getJobDetail((String) ids.getSecondLevelIdentifier());
- StatusResource statusResource = (StatusResource) jobDetail.create(ResourceType.STATUS);
- workflowNode = experiment.getWorkflowNode(taskDetail.getNodeId());
- statusResource.setExperimentId(workflowNode.getExperimentId());
- statusResource.setNodeId(workflowNode.getNodeInstanceId());
- statusResource.setTaskId(taskDetail.getTaskId());
- statusResource.setStatusType(StatusType.APPLICATION.toString());
- statusResource.setStatusUpdateTime(AiravataUtils.getTime(status.getTimeOfStateChange()));
- if (status.getApplicationState() == null) {
- statusResource.setState("UNKNOWN");
- } else {
- statusResource.setState(status.getApplicationState());
- }
- statusResource.save();
- return String.valueOf(statusResource.getStatusId());
- } catch (Exception e) {
- logger.error("Unable to read airavata-server properties", e);
- throw new RegistryException(e);
- }
- }
-
- public void updateApplicationStatus(ApplicationStatus status, String jobId) throws RegistryException {
- try {
- ExperimentResource experiment = (ExperimentResource) gatewayResource.create(ResourceType.EXPERIMENT);
- WorkflowNodeDetailResource workflowNode = (WorkflowNodeDetailResource) experiment.create(ResourceType.WORKFLOW_NODE_DETAIL);
- TaskDetailResource taskDetail = (TaskDetailResource) workflowNode.create(ResourceType.TASK_DETAIL);
- JobDetailResource jobDetail = taskDetail.getJobDetail(jobId);
- StatusResource statusResource = jobDetail.getApplicationStatus();
- workflowNode = experiment.getWorkflowNode(taskDetail.getNodeId());
- statusResource.setExperimentId(workflowNode.getExperimentId());
- statusResource.setNodeId(workflowNode.getNodeInstanceId());
- statusResource.setTaskId(taskDetail.getTaskId());
- statusResource.setStatusType(StatusType.APPLICATION.toString());
- statusResource.setStatusUpdateTime(AiravataUtils.getTime(status.getTimeOfStateChange()));
- statusResource.setState(status.getApplicationState());
- statusResource.save();
- } catch (Exception e) {
- logger.error("Error while updating application status...", e);
- throw new RegistryException(e);
- }
- }
-
-
- /**
- * @param status data transfer status
- * @param ids contains taskId and transfer id
- * @return status id
- */
- public String addTransferStatus(TransferStatus status, CompositeIdentifier ids) throws RegistryException {
- try {
- ExperimentResource experiment = (ExperimentResource) gatewayResource.create(ResourceType.EXPERIMENT);
- WorkflowNodeDetailResource workflowNode = (WorkflowNodeDetailResource) experiment.create(ResourceType.WORKFLOW_NODE_DETAIL);
- TaskDetailResource taskDetail = workflowNode.getTaskDetail((String) ids.getTopLevelIdentifier());
- DataTransferDetailResource dataTransferDetail = taskDetail.getDataTransferDetail((String) ids.getSecondLevelIdentifier());
- StatusResource statusResource = (StatusResource) dataTransferDetail.create(ResourceType.STATUS);
- workflowNode = experiment.getWorkflowNode(taskDetail.getNodeId());
- statusResource.setExperimentId(workflowNode.getExperimentId());
- statusResource.setNodeId(workflowNode.getNodeInstanceId());
- statusResource.setTaskId(taskDetail.getTaskId());
- statusResource.setTransferId(dataTransferDetail.getTransferId());
- statusResource.setStatusType(StatusType.DATA_TRANSFER.toString());
- statusResource.setStatusUpdateTime(AiravataUtils.getTime(status.getTimeOfStateChange()));
- if (status.getTransferState() == null) {
- statusResource.setState(TransferState.UNKNOWN.toString());
- } else {
- statusResource.setState(status.getTransferState().toString());
- }
- statusResource.save();
- return String.valueOf(statusResource.getStatusId());
- } catch (Exception e) {
- logger.error("Error while adding transfer status...", e);
- throw new RegistryException(e);
- }
- }
-
- public void updateTransferStatus(TransferStatus status, String transferId) throws RegistryException {
- try {
- ExperimentResource experiment = (ExperimentResource) gatewayResource.create(ResourceType.EXPERIMENT);
- WorkflowNodeDetailResource workflowNode = (WorkflowNodeDetailResource) experiment.create(ResourceType.WORKFLOW_NODE_DETAIL);
- TaskDetailResource taskDetail = (TaskDetailResource) workflowNode.create(ResourceType.TASK_DETAIL);
- DataTransferDetailResource dataTransferDetail = taskDetail.getDataTransferDetail(transferId);
- StatusResource statusResource = dataTransferDetail.getDataTransferStatus();
-
- String taskId = dataTransferDetail.getTaskId();
- taskDetail = workflowNode.getTaskDetail(taskId);
- workflowNode = experiment.getWorkflowNode(taskDetail.getNodeId());
- if (workflowNode != null) {
- statusResource.setExperimentId(workflowNode.getExperimentId());
- statusResource.setNodeId(workflowNode.getNodeInstanceId());
- }
- statusResource.setTaskId(taskId);
- statusResource.setTransferId(transferId);
- statusResource.setStatusType(StatusType.DATA_TRANSFER.toString());
- statusResource.setStatusUpdateTime(AiravataUtils.getTime(status.getTimeOfStateChange()));
- statusResource.setState(status.getTransferState().toString());
- statusResource.save();
- } catch (Exception e) {
- logger.error("Error while updating transfer status...", e);
- throw new RegistryException(e);
- }
- }
-
- public String addWorkflowNodeDetails(WorkflowNodeDetails nodeDetails, String expId) throws RegistryException {
- try {
- ExperimentResource experiment = gatewayResource.getExperiment(expId);
- WorkflowNodeDetailResource resource = (WorkflowNodeDetailResource) experiment.create(ResourceType.WORKFLOW_NODE_DETAIL);
- resource.setExperimentId(expId);
- resource.setNodeName(nodeDetails.getNodeName());
- resource.setExecutionUnit(nodeDetails.getExecutionUnit().toString());
- resource.setExecutionUnitData(nodeDetails.getExecutionUnitData());
- resource.setCreationTime(AiravataUtils.getTime(nodeDetails.getCreationTime()));
- resource.setNodeInstanceId(getNodeInstanceID(nodeDetails.getNodeName()));
- resource.save();
- String nodeId = resource.getNodeInstanceId();
- List<InputDataObjectType> nodeInputs = nodeDetails.getNodeInputs();
- if (nodeInputs != null) {
- addWorkflowInputs(nodeDetails.getNodeInputs(), resource);
- }
- List<OutputDataObjectType> nodeOutputs = nodeDetails.getNodeOutputs();
- if (nodeOutputs != null && !nodeOutputs.isEmpty()) {
- CompositeIdentifier ids = new CompositeIdentifier(expId, nodeId);
- addNodeOutputs(nodeOutputs, ids);
- }
- WorkflowNodeStatus workflowNodeStatus = nodeDetails.getWorkflowNodeStatus();
- CompositeIdentifier ids = new CompositeIdentifier(expId, nodeId);
- if (workflowNodeStatus == null) {
- workflowNodeStatus = new WorkflowNodeStatus();
- }
-// if (workflowNodeStatus.getWorkflowNodeState() != null){
-// WorkflowNodeStatus status = getWorkflowNodeStatus(nodeId);
-// if (status != null){
-// updateWorkflowNodeStatus(workflowNodeStatus, nodeId);
-// }else {
-// addWorkflowNodeStatus(workflowNodeStatus,ids);
-// }
-// }else {
-// workflowNodeStatus.setWorkflowNodeState(WorkflowNodeState.UNKNOWN);
-// addWorkflowNodeStatus(workflowNodeStatus, ids);
-// }
- workflowNodeStatus.setWorkflowNodeState(WorkflowNodeState.UNKNOWN);
- addWorkflowNodeStatus(workflowNodeStatus, ids);
- List<TaskDetails> taskDetails = nodeDetails.getTaskDetailsList();
- if (taskDetails != null && !taskDetails.isEmpty()) {
- for (TaskDetails task : taskDetails) {
- addTaskDetails(task, nodeId);
- }
- }
- List<ErrorDetails> errors = nodeDetails.getErrors();
- if (errors != null && !errors.isEmpty()) {
- for (ErrorDetails error : errors) {
- addErrorDetails(error, nodeId);
- }
- }
- return nodeId;
- } catch (Exception e) {
- logger.error("Error while adding workflow node details...", e);
- throw new RegistryException(e);
- }
- }
-
- public void updateWorkflowNodeDetails(WorkflowNodeDetails nodeDetails, String nodeId) throws RegistryException {
- try {
- ExperimentResource experiment = (ExperimentResource) gatewayResource.create(ResourceType.EXPERIMENT);
- WorkflowNodeDetailResource workflowNode = experiment.getWorkflowNode(nodeId);
- workflowNode.setNodeName(nodeDetails.getNodeName());
- workflowNode.setExecutionUnit(nodeDetails.getExecutionUnit().toString());
- workflowNode.setExecutionUnitData(nodeDetails.getExecutionUnitData());
- workflowNode.setCreationTime(AiravataUtils.getTime(nodeDetails.getCreationTime()));
- workflowNode.setNodeInstanceId(nodeId);
- workflowNode.save();
- String expID = workflowNode.getExperimentId();
- List<InputDataObjectType> nodeInputs = nodeDetails.getNodeInputs();
- if (nodeInputs != null) {
- updateWorkflowInputs(nodeDetails.getNodeInputs(), workflowNode);
- }
- List<OutputDataObjectType> nodeOutputs = nodeDetails.getNodeOutputs();
- if (nodeOutputs != null && !nodeOutputs.isEmpty()) {
- updateNodeOutputs(nodeOutputs, nodeId);
- }
- WorkflowNodeStatus workflowNodeStatus = nodeDetails.getWorkflowNodeStatus();
- if (workflowNodeStatus != null) {
- if (isWFNodeExist(nodeId)) {
- updateWorkflowNodeStatus(workflowNodeStatus, nodeId);
- } else {
- CompositeIdentifier ids = new CompositeIdentifier(expID, nodeId);
- addWorkflowNodeStatus(workflowNodeStatus, ids);
- }
- }
- List<TaskDetails> taskDetails = nodeDetails.getTaskDetailsList();
- if (taskDetails != null && !taskDetails.isEmpty()) {
- for (TaskDetails task : taskDetails) {
- String taskID = task.getTaskID();
- if (isTaskDetailExist(taskID)) {
- updateTaskDetails(task, taskID);
- } else {
- addTaskDetails(task, nodeId);
- }
- }
- }
- List<ErrorDetails> errors = nodeDetails.getErrors();
- if (errors != null && !errors.isEmpty()) {
- for (ErrorDetails error : errors) {
- addErrorDetails(error, nodeId);
- }
- }
- } catch (Exception e) {
- logger.error("Error while updating workflow node details...", e);
- throw new RegistryException(e);
- }
- }
-
-
- public void addWorkflowInputs(List<InputDataObjectType> wfInputs, WorkflowNodeDetailResource nodeDetailResource) throws RegistryException {
- try {
- for (InputDataObjectType input : wfInputs) {
- NodeInputResource resource = (NodeInputResource) nodeDetailResource.create(ResourceType.NODE_INPUT);
- resource.setNodeId(nodeDetailResource.getNodeInstanceId());
- resource.setInputKey(input.getName());
- resource.setValue(input.getValue());
- if (input.getType() != null) {
- resource.setDataType(input.getType().toString());
- }
- resource.setMetadata(input.getMetaData());
- resource.setAppArgument(input.getApplicationArgument());
- resource.setInputOrder(input.getInputOrder());
- resource.setRequired(input.isIsRequired());
- resource.setRequiredToCMD(input.isRequiredToAddedToCommandLine());
- resource.save();
- }
- } catch (Exception e) {
- logger.error("Error while adding workflow inputs...", e);
- throw new RegistryException(e);
- }
-
- }
-
- public void updateWorkflowInputs(List<InputDataObjectType> wfInputs, WorkflowNodeDetailResource nodeDetailResource) throws RegistryException {
- try {
- List<NodeInputResource> nodeInputs = nodeDetailResource.getNodeInputs();
- for (InputDataObjectType input : wfInputs) {
- for (NodeInputResource resource : nodeInputs) {
- resource.setNodeId(nodeDetailResource.getNodeInstanceId());
- resource.setInputKey(input.getName());
- resource.setValue(input.getValue());
- if (input.getType() != null) {
- resource.setDataType(input.getType().toString());
- }
- resource.setMetadata(input.getMetaData());
- resource.setAppArgument(input.getApplicationArgument());
- resource.setInputOrder(input.getInputOrder());
- resource.setRequired(input.isIsRequired());
- resource.setRequiredToCMD(input.isRequiredToAddedToCommandLine());
- resource.save();
- }
- }
- } catch (Exception e) {
- logger.error("Error while updating workflow inputs...", e);
- throw new RegistryException(e);
- }
-
- }
-
- public String addTaskDetails(TaskDetails taskDetails, String nodeId) throws RegistryException {
- try {
- ExperimentResource experiment = (ExperimentResource) gatewayResource.create(ResourceType.EXPERIMENT);
- WorkflowNodeDetailResource workflowNode = experiment.getWorkflowNode(nodeId);
- TaskDetailResource taskDetail = (TaskDetailResource) workflowNode.create(ResourceType.TASK_DETAIL);
- taskDetail.setNodeId(nodeId);
- taskDetail.setTaskId(getTaskID(workflowNode.getNodeName()));
- taskDetail.setApplicationId(taskDetails.getApplicationId());
- taskDetail.setApplicationVersion(taskDetails.getApplicationVersion());
- taskDetail.setCreationTime(AiravataUtils.getTime(taskDetails.getCreationTime()));
- taskDetail.setEnableEmailNotifications(taskDetails.isEnableEmailNotification());
- taskDetail.save();
-
- List<String> emailAddresses = taskDetails.getEmailAddresses();
- if (emailAddresses != null && !emailAddresses.isEmpty()){
- for (String email : emailAddresses){
- NotificationEmailResource emailResource = new NotificationEmailResource();
- emailResource.setExperimentId(workflowNode.getExperimentId());
- emailResource.setTaskId(taskDetail.getTaskId());
- emailResource.setEmailAddress(email);
- emailResource.save();
- }
- }
-
- List<InputDataObjectType> applicationInputs = taskDetails.getApplicationInputs();
- if (applicationInputs != null) {
- addAppInputs(applicationInputs, taskDetail);
- }
- List<OutputDataObjectType> applicationOutput = taskDetails.getApplicationOutputs();
- if (applicationOutput != null) {
- addAppOutputs(applicationOutput, taskDetail);
- }
- ComputationalResourceScheduling taskScheduling = taskDetails.getTaskScheduling();
- if (taskScheduling != null) {
- addComputationScheduling(taskScheduling, taskDetail);
- }
- AdvancedInputDataHandling inputDataHandling = taskDetails.getAdvancedInputDataHandling();
- if (inputDataHandling != null) {
- addInputDataHandling(inputDataHandling, taskDetail);
- }
- AdvancedOutputDataHandling outputDataHandling = taskDetails.getAdvancedOutputDataHandling();
- if (outputDataHandling != null) {
- addOutputDataHandling(outputDataHandling, taskDetail);
- }
-
- List<JobDetails> jobDetailsList = taskDetails.getJobDetailsList();
- if (jobDetailsList != null && !jobDetailsList.isEmpty()) {
- for (JobDetails job : jobDetailsList) {
- CompositeIdentifier ids = new CompositeIdentifier(taskDetail.getTaskId(), job.getJobID());
- addJobDetails(job, ids);
- }
- }
-
- List<DataTransferDetails> dataTransferDetailsList = taskDetails.getDataTransferDetailsList();
- if (dataTransferDetailsList != null && !dataTransferDetailsList.isEmpty()) {
- for (DataTransferDetails transferDetails : dataTransferDetailsList) {
- addDataTransferDetails(transferDetails, taskDetail.getTaskId());
- }
- }
-
- List<ErrorDetails> errors = taskDetails.getErrors();
- if (errors != null && !errors.isEmpty()) {
- for (ErrorDetails error : errors) {
- addErrorDetails(error, taskDetail.getTaskId());
- }
- }
-
- TaskStatus taskStatus = taskDetails.getTaskStatus();
- CompositeIdentifier ids = new CompositeIdentifier(nodeId, taskDetail.getTaskId());
- if (taskStatus != null) {
- if (taskStatus.getExecutionState() != null) {
- addTaskStatus(taskStatus, ids);
- } else {
- taskStatus.setExecutionState(TaskState.UNKNOWN);
- addTaskStatus(taskStatus, ids);
- }
- } else {
- TaskStatus status = new TaskStatus();
- status.setExecutionState(TaskState.UNKNOWN);
- addTaskStatus(status, ids);
- }
- return taskDetail.getTaskId();
- } catch (Exception e) {
- logger.error("Error while adding task details...", e);
- throw new RegistryException(e);
- }
- }
-
- public String updateTaskDetails(TaskDetails taskDetails, String taskId) throws RegistryException {
- try {
- ExperimentResource experiment = (ExperimentResource) gatewayResource.create(ResourceType.EXPERIMENT);
- WorkflowNodeDetailResource workflowNode = (WorkflowNodeDetailResource) experiment.create(ResourceType.WORKFLOW_NODE_DETAIL);
- TaskDetailResource taskDetail = workflowNode.getTaskDetail(taskId);
-// taskDetail.setWorkflowNodeDetailResource(workflowNode);
- taskDetail.setApplicationId(taskDetails.getApplicationId());
- taskDetail.setApplicationVersion(taskDetails.getApplicationVersion());
- taskDetail.setCreationTime(AiravataUtils.getTime(taskDetails.getCreationTime()));
- taskDetail.setApplicationDeploymentId(taskDetails.getApplicationDeploymentId());
- taskDetail.setEnableEmailNotifications(taskDetails.isEnableEmailNotification());
- taskDetail.save();
-
- workflowNode = experiment.getWorkflowNode(taskDetail.getNodeId());
-
- List<String> emailAddresses = taskDetails.getEmailAddresses();
- // remove existing emails
- taskDetail.remove(ResourceType.NOTIFICATION_EMAIL, taskId);
- if (emailAddresses != null && !emailAddresses.isEmpty()){
- for (String email : emailAddresses){
- NotificationEmailResource emailResource = new NotificationEmailResource();
- emailResource.setExperimentId(workflowNode.getExperimentId());
- emailResource.setTaskId(taskId);
- emailResource.setEmailAddress(email);
- emailResource.save();
- }
- }
- List<InputDataObjectType> applicationInputs = taskDetails.getApplicationInputs();
- if (applicationInputs != null) {
- updateAppInputs(applicationInputs, taskDetail);
- }
- ComputationalResourceScheduling taskScheduling = taskDetails.getTaskScheduling();
- if (taskScheduling != null) {
- updateSchedulingData(taskScheduling, taskDetail);
- }
- AdvancedInputDataHandling inputDataHandling = taskDetails.getAdvancedInputDataHandling();
- if (inputDataHandling != null) {
- updateInputDataHandling(inputDataHandling, taskDetail);
- }
- AdvancedOutputDataHandling outputDataHandling = taskDetails.getAdvancedOutputDataHandling();
- if (outputDataHandling != null) {
- updateOutputDataHandling(outputDataHandling, taskDetail);
- }
- List<JobDetails> jobDetailsList = taskDetails.getJobDetailsList();
- if (jobDetailsList != null && !jobDetailsList.isEmpty()) {
- for (JobDetails job : jobDetailsList) {
- CompositeIdentifier ids = new CompositeIdentifier(taskId, job.getJobID());
- updateJobDetails(job, ids);
- }
- }
-
- List<DataTransferDetails> dataTransferDetailsList = taskDetails.getDataTransferDetailsList();
- if (dataTransferDetailsList != null && !dataTransferDetailsList.isEmpty()) {
- for (DataTransferDetails transferDetails : dataTransferDetailsList) {
- updateDataTransferDetails(transferDetails, transferDetails.getTransferID());
- }
- }
-
- List<ErrorDetails> errors = taskDetails.getErrors();
- if (errors != null && !errors.isEmpty()) {
- for (ErrorDetails error : errors) {
- addErrorDetails(error, taskDetail.getTaskId());
- }
- }
-
- TaskStatus taskStatus = taskDetails.getTaskStatus();
- if (taskStatus != null) {
- updateTaskStatus(taskStatus, taskId);
- }
- return taskDetail.getTaskId();
- } catch (Exception e) {
- logger.error("Error while updating task details...", e);
- throw new RegistryException(e);
- }
- }
-
- public void addAppInputs(List<InputDataObjectType> appInputs, TaskDetailResource taskDetailResource) throws RegistryException {
- try {
- for (InputDataObjectType input : appInputs) {
- ApplicationInputResource resource = (ApplicationInputResource) taskDetailResource.create(ResourceType.APPLICATION_INPUT);
- resource.setTaskId(taskDetailResource.getTaskId());
- resource.setInputKey(input.getName());
- resource.setValue(input.getValue());
- if (input.getType() != null) {
- resource.setDataType(input.getType().toString());
- }
- resource.setMetadata(input.getMetaData());
- resource.setAppArgument(input.getApplicationArgument());
- resource.setInputOrder(input.getInputOrder());
- resource.setRequired(input.isIsRequired());
- resource.setRequiredToCMD(input.isRequiredToAddedToCommandLine());
- resource.save();
- }
- } catch (Exception e) {
- logger.error("Error while adding application inputs...", e);
- throw new RegistryException(e);
- }
-
- }
-
- public void addAppOutputs(List<OutputDataObjectType> appOytputs, TaskDetailResource taskDetailResource) throws RegistryException {
- try {
- for (OutputDataObjectType output : appOytputs) {
- ApplicationOutputResource resource = (ApplicationOutputResource) taskDetailResource.create(ResourceType.APPLICATION_OUTPUT);
- resource.setTaskId(taskDetailResource.getTaskId());
- resource.setOutputKey(output.getName());
- resource.setValue(output.getValue());
- if (output.getType() != null) {
- resource.setDataType(output.getType().toString());
- }
- resource.setRequired(output.isIsRequired());
- resource.setRequiredToCMD(output.isRequiredToAddedToCommandLine());
- resource.setDataMovement(output.isDataMovement());
- resource.setDataNameLocation(output.getLocation());
- resource.setAppArgument(output.getApplicationArgument());
- resource.setSearchQuery(output.getSearchQuery());
- resource.save();
- }
- } catch (Exception e) {
- logger.error("Error while adding application outputs...", e);
- throw new RegistryException(e);
- }
-
- }
-
- public void updateAppOutputs(List<OutputDataObjectType> appOutputs, String taskId) throws RegistryException {
- try {
- ExperimentResource experiment = (ExperimentResource) gatewayResource.create(ResourceType.EXPERIMENT);
- WorkflowNodeDetailResource workflowNode = (WorkflowNodeDetailResource) experiment.create(ResourceType.WORKFLOW_NODE_DETAIL);
- TaskDetailResource taskDetail = workflowNode.getTaskDetail(taskId);
- List<ApplicationOutputResource> outputs = taskDetail.getApplicationOutputs();
- for (OutputDataObjectType output : appOutputs) {
- for (ApplicationOutputResource resource : outputs) {
- resource.setTaskId(taskId);
- resource.setOutputKey(output.getName());
- resource.setValue(output.getValue());
- if (output.getType() != null) {
- resource.setDataType(output.getType().toString());
- }
- resource.setRequired(output.isIsRequired());
- resource.setRequiredToCMD(output.isRequiredToAddedToCommandLine());
- resource.setDataMovement(output.isDataMovement());
- resource.setDataNameLocation(output.getLocation());
- resource.setAppArgument(output.getApplicationArgument());
- resource.setSearchQuery(output.getSearchQuery());
-// resource.setMetadata(output.getMetaData());
- resource.save();
- }
- }
- } catch (Exception e) {
- logger.error("Error while updating application outputs...", e);
- throw new RegistryException(e);
- }
- }
-
- public void updateAppInputs(List<InputDataObjectType> appInputs, TaskDetailResource taskDetailResource) throws RegistryException {
- try {
- List<ApplicationInputResource> inputs = taskDetailResource.getApplicationInputs();
- for (InputDataObjectType input : appInputs) {
- for (ApplicationInputResource resource : inputs) {
- resource.setTaskId(taskDetailResource.getTaskId());
- resource.setInputKey(input.getName());
- resource.setValue(input.getValue());
- if (input.getType() != null) {
- resource.setDataType(input.getType().toString());
- }
- resource.setMetadata(input.getMetaData());
- resource.setAppArgument(input.getApplicationArgument());
- resource.setInputOrder(input.getInputOrder());
- resource.setRequired(input.isIsRequired());
- resource.setRequiredToCMD(input.isRequiredToAddedToCommandLine());
- resource.save();
- }
-
- }
- } catch (Exception e) {
- logger.error("Error while updating application inputs...", e);
- throw new RegistryException(e);
- }
-
- }
-
- public String addJobDetails(JobDetails jobDetails, CompositeIdentifier ids) throws RegistryException {
- try {
- ExperimentResource experiment = (ExperimentResource) gatewayResource.create(ResourceType.EXPERIMENT);
- WorkflowNodeDetailResource workflowNode = (WorkflowNodeDetailResource) experiment.create(ResourceType.WORKFLOW_NODE_DETAIL);
- TaskDetailResource taskDetail = workflowNode.getTaskDetail((String) ids.getTopLevelIdentifier());
- JobDetailResource jobDetail = taskDetail.createJobDetail((String) ids.getSecondLevelIdentifier());
- jobDetail.setTaskId(taskDetail.getTaskId());
- jobDetail.setJobDescription(jobDetails.getJobDescription());
- jobDetail.setCreationTime(AiravataUtils.getTime(jobDetails.getCreationTime()));
- jobDetail.setComputeResourceConsumed(jobDetails.getComputeResourceConsumed());
- jobDetail.setWorkingDir(jobDetails.getWorkingDir());
- jobDetail.setJobName(jobDetails.getJobName());
- jobDetail.save();
- JobStatus jobStatus = jobDetails.getJobStatus();
- if (jobStatus != null) {
- JobStatus status = getJobStatus(ids);
- if (status != null) {
- updateJobStatus(jobStatus, ids);
- } else {
- addJobStatus(jobStatus, ids);
- }
- }
- ApplicationStatus applicationStatus = jobDetails.getApplicationStatus();
- if (applicationStatus != null) {
- ApplicationStatus appStatus = getApplicationStatus(ids);
- if (appStatus != null) {
- updateApplicationStatus(applicationStatus, (String) ids.getSecondLevelIdentifier());
- } else {
- addApplicationStatus(applicationStatus, ids);
- }
- }
- List<ErrorDetails> errors = jobDetails.getErrors();
- if (errors != null && !errors.isEmpty()) {
- for (ErrorDetails error : errors) {
- addErrorDetails(error, ids.getSecondLevelIdentifier());
- }
- }
- return jobDetail.getJobId();
- } catch (Exception e) {
- logger.error("Error while adding job details...", e);
- throw new RegistryException(e);
- }
- }
-
- // ids - taskId + jobid
- public void updateJobDetails(JobDetails jobDetails, CompositeIdentifier ids) throws RegistryException {
- try {
- ExperimentResource experiment = (ExperimentResource) gatewayResource.create(ResourceType.EXPERIMENT);
- WorkflowNodeDetailResource workflowNode = (WorkflowNodeDetailResource) experiment.create(ResourceType.WORKFLOW_NODE_DETAIL);
- String taskId = (String) ids.getTopLevelIdentifier();
- TaskDetailResource taskDetail = workflowNode.getTaskDetail(taskId);
- String jobId = (String) ids.getSecondLevelIdentifier();
- JobDetailResource jobDetail = taskDetail.getJobDetail(jobId);
- jobDetail.setTaskId(taskDetail.getTaskId());
- jobDetail.setJobDescription(jobDetails.getJobDescription());
- jobDetail.setCreationTime(AiravataUtils.getTime(jobDetails.getCreationTime()));
- jobDetail.setComputeResourceConsumed(jobDetails.getComputeResourceConsumed());
- jobDetail.setJobName(jobDetails.getJobName());
- jobDetail.setWorkingDir(jobDetails.getWorkingDir());
- jobDetail.save();
- JobStatus jobStatus = jobDetails.getJobStatus();
- if (jobStatus != null) {
- JobStatus status = getJobStatus(ids);
- if (status != null) {
- updateJobStatus(jobStatus, ids);
- } else {
- addJobStatus(jobStatus, ids);
- }
- }
- ApplicationStatus applicationStatus = jobDetails.getApplicationStatus();
- if (applicationStatus != null) {
- ApplicationStatus appStatus = getApplicationStatus(ids);
- if (appStatus != null) {
- updateApplicationStatus(applicationStatus, jobId);
- } else {
- addApplicationStatus(applicationStatus, ids);
- }
- }
- List<ErrorDetails> errors = jobDetails.getErrors();
- if (errors != null && !errors.isEmpty()) {
- for (ErrorDetails error : errors) {
- addErrorDetails(error, jobId);
- }
- }
- } catch (Exception e) {
- logger.error("Error while updating job details...", e);
- throw new RegistryException(e);
- }
- }
-
- public String addDataTransferDetails(DataTransferDetails transferDetails, String taskId) throws RegistryException {
- try {
- if (transferDetails.getTransferDescription() == null){
- throw new RegistryException("Data transfer description cannot be empty");
- }
- ExperimentResource experiment = (ExperimentResource) gatewayResource.create(ResourceType.EXPERIMENT);
- WorkflowNodeDetailResource workflowNode = (WorkflowNodeDetailResource) experiment.create(ResourceType.WORKFLOW_NODE_DETAIL);
- TaskDetailResource taskDetail = workflowNode.getTaskDetail(taskId);
- DataTransferDetailResource resource = (DataTransferDetailResource) taskDetail.create(ResourceType.DATA_TRANSFER_DETAIL);
- resource.setTaskId(taskId);
- resource.setTransferId(getDataTransferID(taskId));
-
- resource.setTransferDescription(transferDetails.getTransferDescription());
- resource.setCreationTime(AiravataUtils.getTime(transferDetails.getCreationTime()));
- resource.save();
- String transferId = resource.getTransferId();
- TransferStatus transferStatus = transferDetails.getTransferStatus();
- if (transferStatus != null) {
- TransferStatus status = getDataTransferStatus(transferId);
- if (status != null) {
- updateTransferStatus(transferStatus, transferId);
- } else {
- CompositeIdentifier ids = new CompositeIdentifier(taskId, transferId);
- addTransferStatus(transferStatus, ids);
- }
- }
- return resource.getTransferId();
- } catch (Exception e) {
- logger.error("Error while adding transfer details...", e);
- throw new RegistryException(e);
- }
- }
-
- public String updateDataTransferDetails(DataTransferDetails transferDetails, String transferId) throws RegistryException {
- try {
- ExperimentResource experiment = (ExperimentResource) gatewayResource.create(ResourceType.EXPERIMENT);
- WorkflowNodeDetailResource workflowNode = (WorkflowNodeDetailResource) experiment.create(ResourceType.WORKFLOW_NODE_DETAIL);
- TaskDetailResource taskDetail = (TaskDetailResource) workflowNode.create(ResourceType.TASK_DETAIL);
- DataTransferDetailResource resource = taskDetail.getDataTransferDetail(transferId);
-// resource.setTaskDetailResource(taskDetail);
- resource.setTransferDescription(transferDetails.getTransferDescription());
- resource.setCreationTime(AiravataUtils.getTime(transferDetails.getCreationTime()));
- resource.save();
- String taskId = resource.getTaskId();
- TransferStatus transferStatus = transferDetails.getTransferStatus();
- if (transferStatus != null) {
- TransferStatus status = getDataTransferStatus(transferId);
- if (status != null) {
- updateTransferStatus(transferStatus, transferId);
- } else {
- CompositeIdentifier ids = new CompositeIdentifier(taskId, transferId);
- addTransferStatus(transferStatus, ids);
- }
- }
- return resource.getTransferId();
- } catch (Exception e) {
- logger.error("Error while updating transfer details...", e);
- throw new RegistryException(e);
- }
- }
-
- /**
- * @param scheduling computational resource object
- * @param ids contains expId and taskId, if it is an experiment, task id can be null
- * @return scheduling id
- */
- public String addComputationalResourceScheduling(ComputationalResourceScheduling scheduling, CompositeIdentifier ids) throws RegistryException {
- try {
- ExperimentResource experiment = gatewayResource.getExperiment((String) ids.getTopLevelIdentifier());
- ComputationSchedulingResource schedulingResource = (ComputationSchedulingResource) experiment.create(ResourceType.COMPUTATIONAL_RESOURCE_SCHEDULING);
- if (ids.getSecondLevelIdentifier() != null) {
- WorkflowNodeDetailResource nodeDetailResource = (WorkflowNodeDetailResource) experiment.create(ResourceType.WORKFLOW_NODE_DETAIL);
- TaskDetailResource taskDetail = nodeDetailResource.getTaskDetail((String) ids.getSecondLevelIdentifier());
- schedulingResource.setTaskId(taskDetail.getTaskId());
- }
- schedulingResource.setExperimentId(experiment.getExpID());
- schedulingResource.setResourceHostId(scheduling.getResourceHostId());
- schedulingResource.setCpuCount(scheduling.getTotalCPUCount());
- schedulingResource.setNodeCount(scheduling.getNodeCount());
- schedulingResource.setNumberOfThreads(scheduling.getNumberOfThreads());
- schedulingResource.setQueueName(scheduling.getQueueName());
- schedulingResource.setWalltimeLimit(scheduling.getWallTimeLimit());
- schedulingResource.setJobStartTime(AiravataUtils.getTime(scheduling.getJobStartTime()));
- schedulingResource.setPhysicalMemory(scheduling.getTotalPhysicalMemory());
- schedulingResource.setProjectName(scheduling.getComputationalProjectAccount());
- schedulingResource.save();
- return String.valueOf(schedulingResource.getSchedulingId());
- } catch (Exception e) {
- logger.error("Error while adding scheduling parameters...", e);
- throw new RegistryException(e);
- }
- }
-
- /**
- * @param dataHandling advanced input data handling object
- * @param ids contains expId and taskId
- * @return data handling id
- */
- public String addInputDataHandling(AdvancedInputDataHandling dataHandling, CompositeIdentifier ids) throws RegistryException {
- try {
- ExperimentResource experiment = gatewayResource.getExperiment((String) ids.getTopLevelIdentifier());
- AdvanceInputDataHandlingResource dataHandlingResource = (AdvanceInputDataHandlingResource) experiment.create(ResourceType.ADVANCE_INPUT_DATA_HANDLING);
- if (ids.getSecondLevelIdentifier() != null) {
- WorkflowNodeDetailResource nodeDetailResource = (WorkflowNodeDetailResource) experiment.create(ResourceType.WORKFLOW_NODE_DETAIL);
- TaskDetailResource taskDetail = nodeDetailResource.getTaskDetail((String) ids.getSecondLevelIdentifier());
- dataHandlingResource.setTaskId(taskDetail.getTaskId());
- }
- dataHandlingResource.setExperimentId(experiment.getExpID());
- dataHandlingResource.setWorkingDir(dataHandling.getUniqueWorkingDirectory());
- dataHandlingResource.setWorkingDirParent(dataHandling.getParentWorkingDirectory());
- dataHandlingResource.setStageInputFiles(dataHandling.isStageInputFilesToWorkingDir());
- dataHandlingResource.setCleanAfterJob(dataHandling.isCleanUpWorkingDirAfterJob());
- dataHandlingResource.save();
- return String.valueOf(dataHandlingResource.getDataHandlingId());
- } catch (Exception e) {
- logger.error("Error while adding input data handling...", e);
- throw new RegistryException(e);
- }
- }
-
- /**
- * @param dataHandling advanced output data handling object
- * @param ids contains expId and taskId
- * @return data handling id
- */
- public String addOutputDataHandling(AdvancedOutputDataHandling dataHandling, CompositeIdentifier ids) throws RegistryException {
- try {
- ExperimentResource experiment = gatewayResource.getExperiment((String) ids.getTopLevelIdentifier());
- AdvancedOutputDataHandlingResource dataHandlingResource = (AdvancedOutputDataHandlingResource) experiment.create(ResourceType.ADVANCE_OUTPUT_DATA_HANDLING);
- if (ids.getSecondLevelIdentifier() != null) {
- WorkflowNodeDetailResource nodeDetailResource = (WorkflowNodeDetailResource) experiment.create(ResourceType.WORKFLOW_NODE_DETAIL);
- TaskDetailResource taskDetail = nodeDetailResource.getTaskDetail((String) ids.getSecondLevelIdentifier());
- dataHandlingResource.setTaskId(taskDetail.getTaskId());
- }
- dataHandlingResource.setExperimentId(experiment.getExpID());
- dataHandlingResource.setOutputDataDir(dataHandling.getOutputDataDir());
- dataHandlingResource.setDataRegUrl(dataHandling.getDataRegistryURL());
- dataHandlingResource.setPersistOutputData(dataHandling.isPersistOutputData());
- dataHandlingResource.save();
- return String.valueOf(dataHandlingResource.getOutputDataHandlingId());
- } catch (Exception e) {
- logger.error("Error while adding output data handling...", e);
- throw new RegistryException(e);
- }
- }
-
- public String addQosParams(QualityOfServiceParams qosParams, CompositeIdentifier ids) throws RegistryException {
- try {
- ExperimentResource experiment = gatewayResource.getExperiment((String) ids.getTopLevelIdentifier());
- QosParamResource qosParamResource = (QosParamResource) experiment.create(ResourceType.QOS_PARAM);
- if (ids.getSecondLevelIdentifier() != null) {
- WorkflowNodeDetailResource nodeDetailResource = (WorkflowNodeDetailResource) experiment.create(ResourceType.WORKFLOW_NODE_DETAIL);
- TaskDetailResource taskDetail = nodeDetailResource.getTaskDetail((String) ids.getSecondLevelIdentifier());
- qosParamResource.setTaskId(taskDetail.getTaskId());
- }
- qosParamResource.setExperimentId(experiment.getExpID());
- qosParamResource.setStartExecutionAt(qosParams.getStartExecutionAt());
- qosParamResource.setExecuteBefore(qosParams.getExecuteBefore());
- qosParamResource.setNoOfRetries(qosParams.getNumberofRetries());
- qosParamResource.save();
- return String.valueOf(qosParamResource.getQosId());
- } catch (Exception e) {
- logger.error("Error while adding QOS params...", e);
- throw new RegistryException(e);
- }
- }
-
- public String addErrorDetails(ErrorDetails error, Object id) throws RegistryException {
- try {
-
- ErrorDetailResource errorResource = null;
- ExperimentResource experiment;
- TaskDetailResource taskDetail;
- WorkflowNodeDetailResource workflowNode;
- // figure out the id is an experiment, node task or job
- if (id instanceof String) {
- // FIXME : for .12 we only save task related errors
-// if (isExperimentExist((String) id)) {
-// experiment = gatewayResource.getExperiment((String) id);
-// errorResource = (ErrorDetailResource) experiment.create(ResourceType.ERROR_DETAIL);
-// } else if (isWFNodeExist((String) id)) {
-// experiment = (ExperimentResource) gatewayResource.create(ResourceType.EXPERIMENT);
-// workflowNode = experiment.getWorkflowNode((String) id);
-// errorResource = (ErrorDetailResource) workflowNode.create(ResourceType.ERROR_DETAIL);
-// errorResource.setExperimentResource(workflowNode.getExperimentResource());
-// } else
- if (isTaskDetailExist((String) id)) {
- experiment = (ExperimentResource) gatewayResource.create(ResourceType.EXPERIMENT);
- workflowNode = (WorkflowNodeDetailResource) experiment.create(ResourceType.WORKFLOW_NODE_DETAIL);
- taskDetail = workflowNode.getTaskDetail((String) id);
- errorResource = (ErrorDetailResource) taskDetail.create(ResourceType.ERROR_DETAIL);
- if (error.getErrorID() != null && !error.getErrorID().equals(experimentModelConstants.DEFAULT_ID)) {
- List<ErrorDetailResource> errorDetailList = taskDetail.getErrorDetailList();
- if (errorDetailList != null && !errorDetailList.isEmpty()) {
- for (ErrorDetailResource errorDetailResource : errorDetailList) {
- if (errorDetailResource.getErrorId() == Integer.parseInt(error.getErrorID())) {
- errorResource = errorDetailResource;
- }
- }
- }
- }
- errorResource.setTaskId(taskDetail.getTaskId());
- errorResource.setNodeId(taskDetail.getNodeId());
- workflowNode = experiment.getWorkflowNode(taskDetail.getNodeId());
- errorResource.setExperimentId(workflowNode.getExperimentId());
- } else {
-// logger.error("The id provided is not an experiment id or a workflow id or a task id..");
- }
- } else if (id instanceof CompositeIdentifier) {
- CompositeIdentifier cid = (CompositeIdentifier) id;
- if (isJobDetailExist(cid)) {
- experiment = (ExperimentResource) gatewayResource.create(ResourceType.EXPERIMENT);
- workflowNode = (WorkflowNodeDetailResource) experiment.create(ResourceType.WORKFLOW_NODE_DETAIL);
- taskDetail = workflowNode.getTaskDetail((String) cid.getTopLevelIdentifier());
- JobDetailResource jobDetail = taskDetail.getJobDetail((String) cid.getSecondLevelIdentifier());
- errorResource = (ErrorDetailResource) jobDetail.create(ResourceType.ERROR_DETAIL);
- if (error.getErrorID() != null && !error.getErrorID().equals(experimentModelConstants.DEFAULT_ID)) {
- List<ErrorDetailResource> errorDetailList = taskDetail.getErrorDetailList();
- if (errorDetailList != null && !errorDetailList.isEmpty()) {
- for (ErrorDetailResource errorDetailResource : errorDetailList) {
- if (errorDetailResource.getErrorId() == Integer.parseInt(error.getErrorID())) {
- errorResource = errorDetailResource;
- }
- }
- }
- }
- errorResource.setTaskId(taskDetail.getTaskId());
- errorResource.setNodeId(taskDetail.getNodeId());
- workflowNode = experiment.getWorkflowNode(taskDetail.getNodeId());
- errorResource.setExperimentId(workflowNode.getExperimentId());
- } else {
- logger.error("The id provided is not a job in the system..");
- }
- } else {
-// logger.error("The id provided is not an experiment id or a workflow id or a task id or a composite " +
-// "identifier for job..");
- }
- if (errorResource != null) {
- errorResource.setCreationTime(AiravataUtils.getTime(error.getCreationTime()));
- errorResource.setActualErrorMsg(error.getActualErrorMessage());
- errorResource.setUserFriendlyErrorMsg(error.getUserFriendlyMessage());
- if (error.getErrorCategory() != null) {
- errorResource.setErrorCategory(error.getErrorCategory().toString());
- }
- errorResource.setTransientPersistent(error.isTransientOrPersistent());
- if (error.getCorrectiveAction() != null) {
- errorResource.setCorrectiveAction(error.getCorrectiveAction().toString());
- } else {
- errorResource.setCorrectiveAction(CorrectiveAction.CONTACT_SUPPORT.toString());
- }
- if (error.getActionableGroup() != null) {
- errorResource.setActionableGroup(error.getActionableGroup().toString());
- } else {
- errorResource.setActionableGroup(ActionableGroup.GATEWAYS_ADMINS.toString());
- }
- errorResource.save();
- return String.valueOf(errorResource.getErrorId());
- }
- } catch (Exception e) {
- logger.error("Unable to add error details...", e);
- throw new RegistryException(e);
- }
- return null;
- }
-
- public String getNodeInstanceID(String nodeName) {
- String node = nodeName.replaceAll("\\s", "");
- return node + "_" + UUID.randomUUID();
- }
-
- public String getExperimentID(String experimentName) {
- String exp = experimentName.replaceAll("\\s", "");
- return exp + "_" + UUID.randomUUID();
- }
-
- public String getTaskID(String nodeNam
<TRUNCATED>
[06/52] [abbrv] [partial] airavata git commit: registry refactoring
Posted by sh...@apache.org.
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/PreJobCommandResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/PreJobCommandResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/PreJobCommandResource.java
new file mode 100644
index 0000000..09a8fa1
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/PreJobCommandResource.java
@@ -0,0 +1,333 @@
+/**
+ * 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.aiaravata.application.catalog.data.resources;
+
+import org.airavata.appcatalog.cpi.AppCatalogException;
+import org.apache.aiaravata.application.catalog.data.model.ApplicationDeployment;
+import org.apache.aiaravata.application.catalog.data.model.PreJobCommand;
+import org.apache.aiaravata.application.catalog.data.model.PreJobCommandPK;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogJPAUtils;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogQueryGenerator;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogResourceType;
+import org.apache.airavata.common.exception.ApplicationSettingsException;
+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 PreJobCommandResource extends AbstractResource {
+ private final static Logger logger = LoggerFactory.getLogger(PreJobCommandResource.class);
+
+ private String appDeploymentId;
+ private String command;
+
+ private AppDeploymentResource appDeploymentResource;
+
+
+ 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(PRE_JOBCOMMAND);
+ generator.setParameter(PreJobCommandConstants.DEPLOYMENT_ID,
+ ids.get(PreJobCommandConstants.DEPLOYMENT_ID));
+ if (ids.get(PreJobCommandConstants.COMMAND) != null){
+ generator.setParameter(PreJobCommandConstants.COMMAND, ids.get(PreJobCommandConstants.COMMAND));
+ }
+ 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();
+ }
+ }
+ }
+
+ public Resource 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(PRE_JOBCOMMAND);
+ generator.setParameter(PreJobCommandConstants.DEPLOYMENT_ID,
+ ids.get(PreJobCommandConstants.DEPLOYMENT_ID));
+ generator.setParameter(PreJobCommandConstants.COMMAND, ids.get(PreJobCommandConstants.COMMAND));
+ Query q = generator.selectQuery(em);
+ PreJobCommand preJobCommand = (PreJobCommand) q.getSingleResult();
+ PreJobCommandResource preJobCommandResource =
+ (PreJobCommandResource) AppCatalogJPAUtils.getResource(
+ AppCatalogResourceType.PRE_JOBCOMMAND, preJobCommand);
+ em.getTransaction().commit();
+ em.close();
+ return preJobCommandResource;
+ } 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();
+ }
+ }
+ }
+
+ public List<Resource> get(String fieldName, Object value) throws AppCatalogException {
+ List<Resource> gsiSSHPreJobResources = new ArrayList<Resource>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ Query q;
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(PRE_JOBCOMMAND);
+ List results;
+ if (fieldName.equals(PreJobCommandConstants.DEPLOYMENT_ID)) {
+ generator.setParameter(PreJobCommandConstants.DEPLOYMENT_ID, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ PreJobCommand preJobCommand = (PreJobCommand) result;
+ PreJobCommandResource preJobCommandResource =
+ (PreJobCommandResource) AppCatalogJPAUtils.getResource(
+ AppCatalogResourceType.PRE_JOBCOMMAND, preJobCommand);
+ gsiSSHPreJobResources.add(preJobCommandResource);
+ }
+ }
+ } else if (fieldName.equals(PreJobCommandConstants.COMMAND)) {
+ generator.setParameter(PreJobCommandConstants.COMMAND, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ PreJobCommand preJobCommand = (PreJobCommand) result;
+ PreJobCommandResource preJobCommandResource =
+ (PreJobCommandResource) AppCatalogJPAUtils.getResource(
+ AppCatalogResourceType.PRE_JOBCOMMAND, preJobCommand);
+ gsiSSHPreJobResources.add(preJobCommandResource);
+ }
+ }
+ } else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for GSISSH Pre Job Command Resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for GSISSH Pre Job Command 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 gsiSSHPreJobResources;
+ }
+
+ @Override
+ public List<Resource> getAll() throws AppCatalogException {
+ return null;
+ }
+
+ @Override
+ public List<String> getAllIds() throws AppCatalogException {
+ return null;
+ }
+
+ public List<String> getIds(String fieldName, Object value) throws AppCatalogException {
+ List<String> gsiSSHPreJobResourceIDs = new ArrayList<String>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ Query q;
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(PRE_JOBCOMMAND);
+ List results;
+ if (fieldName.equals(PreJobCommandConstants.DEPLOYMENT_ID)) {
+ generator.setParameter(PreJobCommandConstants.DEPLOYMENT_ID, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ PreJobCommand preJobCommand = (PreJobCommand) result;
+ gsiSSHPreJobResourceIDs.add(preJobCommand.getDeploymentId());
+ }
+ }
+ } else if (fieldName.equals(PreJobCommandConstants.COMMAND)) {
+ generator.setParameter(PreJobCommandConstants.COMMAND, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ PreJobCommand preJobCommand = (PreJobCommand) result;
+ gsiSSHPreJobResourceIDs.add(preJobCommand.getDeploymentId());
+ }
+ }
+ } else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for GSISSH Pre Job resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for GSISSH Pre JOb 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 gsiSSHPreJobResourceIDs;
+ }
+
+ public void save() throws AppCatalogException {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ PreJobCommand existingGSIsshPreJobCommand = em.find(PreJobCommand.class,
+ new PreJobCommandPK(appDeploymentId, command));
+ em.close();
+
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ ApplicationDeployment deployment = em.find(ApplicationDeployment.class, appDeploymentId);
+ if (existingGSIsshPreJobCommand != null){
+ existingGSIsshPreJobCommand.setDeploymentId(appDeploymentId);
+ existingGSIsshPreJobCommand.setCommand(command);
+ existingGSIsshPreJobCommand.setApplicationDeployment(deployment);
+ em.merge(existingGSIsshPreJobCommand);
+ }else {
+ PreJobCommand preJobCommand = new PreJobCommand();
+ preJobCommand.setDeploymentId(appDeploymentId);
+ preJobCommand.setCommand(command);
+ preJobCommand.setApplicationDeployment(deployment);
+ em.persist(preJobCommand);
+ }
+ 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();
+ }
+ }
+ }
+
+ 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();
+ PreJobCommand preJobCommand = em.find(PreJobCommand.class, new PreJobCommandPK(
+ ids.get(PreJobCommandConstants.DEPLOYMENT_ID),
+ ids.get(PreJobCommandConstants.COMMAND)));
+
+ em.close();
+ return preJobCommand != null;
+ } 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();
+ }
+ }
+ }
+
+ public String getAppDeploymentId() {
+ return appDeploymentId;
+ }
+
+ public void setAppDeploymentId(String appDeploymentId) {
+ this.appDeploymentId = appDeploymentId;
+ }
+
+ public String getCommand() {
+ return command;
+ }
+
+ public void setCommand(String command) {
+ this.command = command;
+ }
+
+ public AppDeploymentResource getAppDeploymentResource() {
+ return appDeploymentResource;
+ }
+
+ public void setAppDeploymentResource(AppDeploymentResource appDeploymentResource) {
+ this.appDeploymentResource = appDeploymentResource;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/Resource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/Resource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/Resource.java
new file mode 100644
index 0000000..d4ad2fd
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/Resource.java
@@ -0,0 +1,89 @@
+/*
+*
+* 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.aiaravata.application.catalog.data.resources;
+
+import org.airavata.appcatalog.cpi.AppCatalogException;
+
+import java.util.List;
+
+public interface Resource {
+
+ /**
+ * This method will remove the given resource from the database
+ *
+ * @param identifier identifier that can uniquely identify a single instance of the resource
+ */
+ void remove(Object identifier) throws AppCatalogException;
+
+ /**
+ * This method will return the given resource from the database
+ *
+ * @param identifier identifier that can uniquely identify a single instance of the resource
+ * @return associate resource
+ */
+ Resource get(Object identifier) throws AppCatalogException;
+
+ /**
+ * This method will list all the resources according to the filtering criteria
+ * @param fieldName field name
+ * @param value value of the field
+ * @return list of resources
+ */
+ List<Resource> get(String fieldName, Object value) throws AppCatalogException;
+
+ /**
+ *
+ * @return
+ * @throws AppCatalogException
+ */
+ List<Resource> getAll() throws AppCatalogException;
+
+ /**
+ *
+ * @return
+ * @throws AppCatalogException
+ */
+ List<String> getAllIds() throws AppCatalogException;
+
+ /** This method will return list of resource ids according to given criteria
+ * @param fieldName field name
+ * @param value value of the field
+ * @return list of resource Ids
+ * @throws AppCatalogException
+ */
+ List<String> getIds(String fieldName, Object value) throws AppCatalogException;
+
+ /**
+ * This method will save the resource to the database.
+ */
+ void save() throws AppCatalogException;
+
+ /**
+ * This method will check whether an entry from the given resource and resource name
+ * exists in the database
+ *
+ * @param identifier identifier that can uniquely identify a single instance of the resource
+ * @return whether the entry exists in the database or not
+ */
+ boolean isExists(Object identifier) throws AppCatalogException;
+
+
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/ResourceJobManagerAppCatalogResourceAppCat.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/ResourceJobManagerAppCatalogResourceAppCat.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/ResourceJobManagerAppCatalogResourceAppCat.java
new file mode 100644
index 0000000..19e65a3
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/ResourceJobManagerAppCatalogResourceAppCat.java
@@ -0,0 +1,301 @@
+/*
+ *
+ * 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 java.sql.Timestamp;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.persistence.EntityManager;
+import javax.persistence.Query;
+
+import org.apache.airavata.common.exception.ApplicationSettingsException;
+import org.apache.airavata.common.utils.AiravataUtils;
+import org.apache.airavata.registry.core.app.catalog.model.ResourceJobManager;
+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;
+
+public class ResourceJobManagerAppCatalogResourceAppCat extends AppCatAbstractResource {
+ private final static Logger logger = LoggerFactory.getLogger(ResourceJobManagerAppCatalogResourceAppCat.class);
+ private String resourceJobManagerId;
+ private String pushMonitoringEndpoint;
+ private String jobManagerBinPath;
+ private String resourceJobManagerType;
+ private Timestamp createdTime;
+ private Timestamp updatedTime;
+
+ public Timestamp getCreatedTime() {
+ return createdTime;
+ }
+
+ public void setCreatedTime(Timestamp createdTime) {
+ this.createdTime = createdTime;
+ }
+
+ public Timestamp getUpdatedTime() {
+ return updatedTime;
+ }
+
+ public void setUpdatedTime(Timestamp updatedTime) {
+ this.updatedTime = updatedTime;
+ }
+
+ @Override
+ public void remove(Object identifier) throws AppCatalogException {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(RESOURCE_JOB_MANAGER);
+ generator.setParameter(ResourceJobManagerConstants.RESOURCE_JOB_MANAGER_ID, identifier);
+ 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 {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(RESOURCE_JOB_MANAGER);
+ generator.setParameter(ResourceJobManagerConstants.RESOURCE_JOB_MANAGER_ID, identifier);
+ Query q = generator.selectQuery(em);
+ ResourceJobManager resourceJobManager = (ResourceJobManager) q.getSingleResult();
+ ResourceJobManagerAppCatalogResourceAppCat resourceJobManagerResource = (ResourceJobManagerAppCatalogResourceAppCat) AppCatalogJPAUtils.getResource(AppCatalogResourceType.RESOURCE_JOB_MANAGER, resourceJobManager);
+ em.getTransaction().commit();
+ em.close();
+ return resourceJobManagerResource;
+ } 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> resourceJobManagerResources = new ArrayList<AppCatalogResource>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(RESOURCE_JOB_MANAGER);
+ Query q;
+ if ((fieldName.equals(ResourceJobManagerConstants.RESOURCE_JOB_MANAGER_ID)) || (fieldName.equals(ResourceJobManagerConstants.PUSH_MONITORING_ENDPOINT)) || (fieldName.equals(ResourceJobManagerConstants.JOB_MANAGER_BIN_PATH)) || (fieldName.equals(ResourceJobManagerConstants.RESOURCE_JOB_MANAGER_TYPE))) {
+ generator.setParameter(fieldName, value);
+ q = generator.selectQuery(em);
+ List<?> results = q.getResultList();
+ for (Object result : results) {
+ ResourceJobManager resourceJobManager = (ResourceJobManager) result;
+ ResourceJobManagerAppCatalogResourceAppCat resourceJobManagerResource = (ResourceJobManagerAppCatalogResourceAppCat) AppCatalogJPAUtils.getResource(AppCatalogResourceType.RESOURCE_JOB_MANAGER, resourceJobManager);
+ resourceJobManagerResources.add(resourceJobManagerResource);
+ }
+ } else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for Resource Job Manager Resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for Resource Job Manager Resource.");
+ }
+ 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();
+ }
+ }
+ return resourceJobManagerResources;
+ }
+
+ @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 {
+ List<String> resourceJobManagerResourceIDs = new ArrayList<String>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(RESOURCE_JOB_MANAGER);
+ Query q;
+ if ((fieldName.equals(ResourceJobManagerConstants.RESOURCE_JOB_MANAGER_ID)) || (fieldName.equals(ResourceJobManagerConstants.PUSH_MONITORING_ENDPOINT)) || (fieldName.equals(ResourceJobManagerConstants.JOB_MANAGER_BIN_PATH)) || (fieldName.equals(ResourceJobManagerConstants.RESOURCE_JOB_MANAGER_TYPE))) {
+ generator.setParameter(fieldName, value);
+ q = generator.selectQuery(em);
+ List<?> results = q.getResultList();
+ for (Object result : results) {
+ ResourceJobManager resourceJobManager = (ResourceJobManager) result;
+ ResourceJobManagerAppCatalogResourceAppCat resourceJobManagerResource = (ResourceJobManagerAppCatalogResourceAppCat) AppCatalogJPAUtils.getResource(AppCatalogResourceType.RESOURCE_JOB_MANAGER, resourceJobManager);
+ resourceJobManagerResourceIDs.add(resourceJobManagerResource.getResourceJobManagerId());
+ }
+ } else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for Resource Job Manager Resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for Resource Job Manager Resource.");
+ }
+ 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();
+ }
+ }
+ return resourceJobManagerResourceIDs;
+ }
+
+ @Override
+ public void save() throws AppCatalogException {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ ResourceJobManager existingResourceJobManager = em.find(ResourceJobManager.class, resourceJobManagerId);
+ em.close();
+ ResourceJobManager resourceJobManager;
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ if (existingResourceJobManager == null) {
+ resourceJobManager = new ResourceJobManager();
+ resourceJobManager.setCreationTime(AiravataUtils.getCurrentTimestamp());
+ } else {
+ resourceJobManager = existingResourceJobManager;
+ resourceJobManager.setUpdateTime(AiravataUtils.getCurrentTimestamp());
+ }
+ resourceJobManager.setResourceJobManagerId(getResourceJobManagerId());
+ resourceJobManager.setPushMonitoringEndpoint(getPushMonitoringEndpoint());
+ resourceJobManager.setJobManagerBinPath(getJobManagerBinPath());
+ resourceJobManager.setResourceJobManagerType(getResourceJobManagerType());
+ if (existingResourceJobManager == null) {
+ em.persist(resourceJobManager);
+ } else {
+ em.merge(resourceJobManager);
+ }
+ 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 {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ ResourceJobManager resourceJobManager = em.find(ResourceJobManager.class, identifier);
+ em.close();
+ return resourceJobManager != null;
+ } 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();
+ }
+ }
+ }
+
+ public String getResourceJobManagerId() {
+ return resourceJobManagerId;
+ }
+
+ public String getPushMonitoringEndpoint() {
+ return pushMonitoringEndpoint;
+ }
+
+ public String getJobManagerBinPath() {
+ return jobManagerBinPath;
+ }
+
+ public String getResourceJobManagerType() {
+ return resourceJobManagerType;
+ }
+
+ public void setResourceJobManagerId(String resourceJobManagerId) {
+ this.resourceJobManagerId=resourceJobManagerId;
+ }
+
+ public void setPushMonitoringEndpoint(String pushMonitoringEndpoint) {
+ this.pushMonitoringEndpoint=pushMonitoringEndpoint;
+ }
+
+ public void setJobManagerBinPath(String jobManagerBinPath) {
+ this.jobManagerBinPath=jobManagerBinPath;
+ }
+
+ public void setResourceJobManagerType(String resourceJobManagerType) {
+ this.resourceJobManagerType=resourceJobManagerType;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/ResourceJobManagerResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/ResourceJobManagerResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/ResourceJobManagerResource.java
new file mode 100644
index 0000000..0cc5a18
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/ResourceJobManagerResource.java
@@ -0,0 +1,301 @@
+/*
+ *
+ * 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.aiaravata.application.catalog.data.resources;
+
+import java.sql.Timestamp;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.persistence.EntityManager;
+import javax.persistence.Query;
+
+import org.airavata.appcatalog.cpi.AppCatalogException;
+import org.apache.aiaravata.application.catalog.data.model.ResourceJobManager;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogJPAUtils;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogQueryGenerator;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogResourceType;
+import org.apache.airavata.common.exception.ApplicationSettingsException;
+import org.apache.airavata.common.utils.AiravataUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class ResourceJobManagerResource extends AbstractResource {
+ private final static Logger logger = LoggerFactory.getLogger(ResourceJobManagerResource.class);
+ private String resourceJobManagerId;
+ private String pushMonitoringEndpoint;
+ private String jobManagerBinPath;
+ private String resourceJobManagerType;
+ private Timestamp createdTime;
+ private Timestamp updatedTime;
+
+ public Timestamp getCreatedTime() {
+ return createdTime;
+ }
+
+ public void setCreatedTime(Timestamp createdTime) {
+ this.createdTime = createdTime;
+ }
+
+ public Timestamp getUpdatedTime() {
+ return updatedTime;
+ }
+
+ public void setUpdatedTime(Timestamp updatedTime) {
+ this.updatedTime = updatedTime;
+ }
+
+ @Override
+ public void remove(Object identifier) throws AppCatalogException {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(RESOURCE_JOB_MANAGER);
+ generator.setParameter(ResourceJobManagerConstants.RESOURCE_JOB_MANAGER_ID, identifier);
+ 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 Resource get(Object identifier) throws AppCatalogException {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(RESOURCE_JOB_MANAGER);
+ generator.setParameter(ResourceJobManagerConstants.RESOURCE_JOB_MANAGER_ID, identifier);
+ Query q = generator.selectQuery(em);
+ ResourceJobManager resourceJobManager = (ResourceJobManager) q.getSingleResult();
+ ResourceJobManagerResource resourceJobManagerResource = (ResourceJobManagerResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.RESOURCE_JOB_MANAGER, resourceJobManager);
+ em.getTransaction().commit();
+ em.close();
+ return resourceJobManagerResource;
+ } 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<Resource> get(String fieldName, Object value) throws AppCatalogException {
+ List<Resource> resourceJobManagerResources = new ArrayList<Resource>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(RESOURCE_JOB_MANAGER);
+ Query q;
+ if ((fieldName.equals(ResourceJobManagerConstants.RESOURCE_JOB_MANAGER_ID)) || (fieldName.equals(ResourceJobManagerConstants.PUSH_MONITORING_ENDPOINT)) || (fieldName.equals(ResourceJobManagerConstants.JOB_MANAGER_BIN_PATH)) || (fieldName.equals(ResourceJobManagerConstants.RESOURCE_JOB_MANAGER_TYPE))) {
+ generator.setParameter(fieldName, value);
+ q = generator.selectQuery(em);
+ List<?> results = q.getResultList();
+ for (Object result : results) {
+ ResourceJobManager resourceJobManager = (ResourceJobManager) result;
+ ResourceJobManagerResource resourceJobManagerResource = (ResourceJobManagerResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.RESOURCE_JOB_MANAGER, resourceJobManager);
+ resourceJobManagerResources.add(resourceJobManagerResource);
+ }
+ } else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for Resource Job Manager Resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for Resource Job Manager Resource.");
+ }
+ 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();
+ }
+ }
+ return resourceJobManagerResources;
+ }
+
+ @Override
+ public List<Resource> 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 {
+ List<String> resourceJobManagerResourceIDs = new ArrayList<String>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(RESOURCE_JOB_MANAGER);
+ Query q;
+ if ((fieldName.equals(ResourceJobManagerConstants.RESOURCE_JOB_MANAGER_ID)) || (fieldName.equals(ResourceJobManagerConstants.PUSH_MONITORING_ENDPOINT)) || (fieldName.equals(ResourceJobManagerConstants.JOB_MANAGER_BIN_PATH)) || (fieldName.equals(ResourceJobManagerConstants.RESOURCE_JOB_MANAGER_TYPE))) {
+ generator.setParameter(fieldName, value);
+ q = generator.selectQuery(em);
+ List<?> results = q.getResultList();
+ for (Object result : results) {
+ ResourceJobManager resourceJobManager = (ResourceJobManager) result;
+ ResourceJobManagerResource resourceJobManagerResource = (ResourceJobManagerResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.RESOURCE_JOB_MANAGER, resourceJobManager);
+ resourceJobManagerResourceIDs.add(resourceJobManagerResource.getResourceJobManagerId());
+ }
+ } else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for Resource Job Manager Resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for Resource Job Manager Resource.");
+ }
+ 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();
+ }
+ }
+ return resourceJobManagerResourceIDs;
+ }
+
+ @Override
+ public void save() throws AppCatalogException {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ ResourceJobManager existingResourceJobManager = em.find(ResourceJobManager.class, resourceJobManagerId);
+ em.close();
+ ResourceJobManager resourceJobManager;
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ if (existingResourceJobManager == null) {
+ resourceJobManager = new ResourceJobManager();
+ resourceJobManager.setCreationTime(AiravataUtils.getCurrentTimestamp());
+ } else {
+ resourceJobManager = existingResourceJobManager;
+ resourceJobManager.setUpdateTime(AiravataUtils.getCurrentTimestamp());
+ }
+ resourceJobManager.setResourceJobManagerId(getResourceJobManagerId());
+ resourceJobManager.setPushMonitoringEndpoint(getPushMonitoringEndpoint());
+ resourceJobManager.setJobManagerBinPath(getJobManagerBinPath());
+ resourceJobManager.setResourceJobManagerType(getResourceJobManagerType());
+ if (existingResourceJobManager == null) {
+ em.persist(resourceJobManager);
+ } else {
+ em.merge(resourceJobManager);
+ }
+ 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 {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ ResourceJobManager resourceJobManager = em.find(ResourceJobManager.class, identifier);
+ em.close();
+ return resourceJobManager != null;
+ } 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();
+ }
+ }
+ }
+
+ public String getResourceJobManagerId() {
+ return resourceJobManagerId;
+ }
+
+ public String getPushMonitoringEndpoint() {
+ return pushMonitoringEndpoint;
+ }
+
+ public String getJobManagerBinPath() {
+ return jobManagerBinPath;
+ }
+
+ public String getResourceJobManagerType() {
+ return resourceJobManagerType;
+ }
+
+ public void setResourceJobManagerId(String resourceJobManagerId) {
+ this.resourceJobManagerId=resourceJobManagerId;
+ }
+
+ public void setPushMonitoringEndpoint(String pushMonitoringEndpoint) {
+ this.pushMonitoringEndpoint=pushMonitoringEndpoint;
+ }
+
+ public void setJobManagerBinPath(String jobManagerBinPath) {
+ this.jobManagerBinPath=jobManagerBinPath;
+ }
+
+ public void setResourceJobManagerType(String resourceJobManagerType) {
+ this.resourceJobManagerType=resourceJobManagerType;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/ScpDataMovementAppCatalogResourceAppCat.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/ScpDataMovementAppCatalogResourceAppCat.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/ScpDataMovementAppCatalogResourceAppCat.java
new file mode 100644
index 0000000..59839ea
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/ScpDataMovementAppCatalogResourceAppCat.java
@@ -0,0 +1,308 @@
+/**
+ * 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.common.utils.AiravataUtils;
+import org.apache.airavata.registry.core.app.catalog.model.ScpDataMovement;
+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.sql.Timestamp;
+import java.util.ArrayList;
+import java.util.List;
+
+public class ScpDataMovementAppCatalogResourceAppCat extends AppCatAbstractResource {
+ private final static Logger logger = LoggerFactory.getLogger(ScpDataMovementAppCatalogResourceAppCat.class);
+ private String queueDescription;
+ private String dataMovementInterfaceId;
+ private String securityProtocol;
+ private String alternativeScpHostname;
+ private int sshPort;
+ private Timestamp createdTime;
+ private Timestamp updatedTime;
+
+ public Timestamp getCreatedTime() {
+ return createdTime;
+ }
+
+ public void setCreatedTime(Timestamp createdTime) {
+ this.createdTime = createdTime;
+ }
+
+ public Timestamp getUpdatedTime() {
+ return updatedTime;
+ }
+
+ public void setUpdatedTime(Timestamp updatedTime) {
+ this.updatedTime = updatedTime;
+ }
+
+ @Override
+ public void remove(Object identifier) throws AppCatalogException {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(SCP_DATA_MOVEMENT);
+ generator.setParameter(ScpDataMovementConstants.DATA_MOVEMENT_INTERFACE_ID, identifier);
+ 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 {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(SCP_DATA_MOVEMENT);
+ generator.setParameter(ScpDataMovementConstants.DATA_MOVEMENT_INTERFACE_ID, identifier);
+ Query q = generator.selectQuery(em);
+ ScpDataMovement scpDataMovement = (ScpDataMovement) q.getSingleResult();
+ ScpDataMovementAppCatalogResourceAppCat scpDataMovementResource = (ScpDataMovementAppCatalogResourceAppCat) AppCatalogJPAUtils.getResource(AppCatalogResourceType.SCP_DATA_MOVEMENT, scpDataMovement);
+ em.getTransaction().commit();
+ em.close();
+ return scpDataMovementResource;
+ } 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> scpDataMovementResources = new ArrayList<AppCatalogResource>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(SCP_DATA_MOVEMENT);
+ Query q;
+ if ((fieldName.equals(ScpDataMovementConstants.QUEUE_DESCRIPTION)) || (fieldName.equals(ScpDataMovementConstants.DATA_MOVEMENT_INTERFACE_ID)) || (fieldName.equals(ScpDataMovementConstants.SECURITY_PROTOCOL)) || (fieldName.equals(ScpDataMovementConstants.ALTERNATIVE_SCP_HOSTNAME)) || (fieldName.equals(ScpDataMovementConstants.SSH_PORT))) {
+ generator.setParameter(fieldName, value);
+ q = generator.selectQuery(em);
+ List<?> results = q.getResultList();
+ for (Object result : results) {
+ ScpDataMovement scpDataMovement = (ScpDataMovement) result;
+ ScpDataMovementAppCatalogResourceAppCat scpDataMovementResource = (ScpDataMovementAppCatalogResourceAppCat) AppCatalogJPAUtils.getResource(AppCatalogResourceType.SCP_DATA_MOVEMENT, scpDataMovement);
+ scpDataMovementResources.add(scpDataMovementResource);
+ }
+ } else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for Scp Data Movement Resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for Scp Data Movement Resource.");
+ }
+ 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();
+ }
+ }
+ return scpDataMovementResources;
+ }
+
+ @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 {
+ List<String> scpDataMovementResourceIDs = new ArrayList<String>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(SCP_DATA_MOVEMENT);
+ Query q;
+ if ((fieldName.equals(ScpDataMovementConstants.QUEUE_DESCRIPTION)) || (fieldName.equals(ScpDataMovementConstants.DATA_MOVEMENT_INTERFACE_ID)) || (fieldName.equals(ScpDataMovementConstants.SECURITY_PROTOCOL)) || (fieldName.equals(ScpDataMovementConstants.ALTERNATIVE_SCP_HOSTNAME)) || (fieldName.equals(ScpDataMovementConstants.SSH_PORT))) {
+ generator.setParameter(fieldName, value);
+ q = generator.selectQuery(em);
+ List<?> results = q.getResultList();
+ for (Object result : results) {
+ ScpDataMovement scpDataMovement = (ScpDataMovement) result;
+ ScpDataMovementAppCatalogResourceAppCat scpDataMovementResource = (ScpDataMovementAppCatalogResourceAppCat) AppCatalogJPAUtils.getResource(AppCatalogResourceType.SCP_DATA_MOVEMENT, scpDataMovement);
+ scpDataMovementResourceIDs.add(scpDataMovementResource.getDataMovementInterfaceId());
+ }
+ } else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for Scp Data Movement Resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for Scp Data Movement Resource.");
+ }
+ 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();
+ }
+ }
+ return scpDataMovementResourceIDs;
+ }
+
+ @Override
+ public void save() throws AppCatalogException {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ ScpDataMovement existingScpDataMovement = em.find(ScpDataMovement.class, dataMovementInterfaceId);
+ em.close();
+ ScpDataMovement scpDataMovement;
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ if (existingScpDataMovement == null) {
+ scpDataMovement = new ScpDataMovement();
+ scpDataMovement.setCreationTime(AiravataUtils.getCurrentTimestamp());
+ } else {
+ scpDataMovement = existingScpDataMovement;
+ scpDataMovement.setUpdateTime(AiravataUtils.getCurrentTimestamp());
+ }
+ scpDataMovement.setQueueDescription(getQueueDescription());
+ scpDataMovement.setDataMovementInterfaceId(getDataMovementInterfaceId());
+ scpDataMovement.setSecurityProtocol(getSecurityProtocol());
+ scpDataMovement.setAlternativeScpHostname(getAlternativeScpHostname());
+ scpDataMovement.setSshPort(getSshPort());
+ if (existingScpDataMovement == null) {
+ em.persist(scpDataMovement);
+ } else {
+ em.merge(scpDataMovement);
+ }
+ 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 {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ ScpDataMovement scpDataMovement = em.find(ScpDataMovement.class, identifier);
+ em.close();
+ return scpDataMovement != null;
+ } 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();
+ }
+ }
+ }
+
+ public String getQueueDescription() {
+ return queueDescription;
+ }
+
+ public String getDataMovementInterfaceId() {
+ return dataMovementInterfaceId;
+ }
+
+ public String getSecurityProtocol() {
+ return securityProtocol;
+ }
+
+ public String getAlternativeScpHostname() {
+ return alternativeScpHostname;
+ }
+
+ public int getSshPort() {
+ return sshPort;
+ }
+
+ public void setQueueDescription(String queueDescription) {
+ this.queueDescription=queueDescription;
+ }
+
+ public void setDataMovementInterfaceId(String dataMovementInterfaceId) {
+ this.dataMovementInterfaceId=dataMovementInterfaceId;
+ }
+
+ public void setSecurityProtocol(String securityProtocol) {
+ this.securityProtocol=securityProtocol;
+ }
+
+ public void setAlternativeScpHostname(String alternativeScpHostname) {
+ this.alternativeScpHostname=alternativeScpHostname;
+ }
+
+ public void setSshPort(int sshPort) {
+ this.sshPort=sshPort;
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/ScpDataMovementResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/ScpDataMovementResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/ScpDataMovementResource.java
new file mode 100644
index 0000000..8c593f3
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/ScpDataMovementResource.java
@@ -0,0 +1,308 @@
+/**
+ * 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.aiaravata.application.catalog.data.resources;
+
+import org.airavata.appcatalog.cpi.AppCatalogException;
+import org.apache.aiaravata.application.catalog.data.model.ScpDataMovement;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogJPAUtils;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogQueryGenerator;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogResourceType;
+import org.apache.airavata.common.exception.ApplicationSettingsException;
+import org.apache.airavata.common.utils.AiravataUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.persistence.EntityManager;
+import javax.persistence.Query;
+import java.sql.Timestamp;
+import java.util.ArrayList;
+import java.util.List;
+
+public class ScpDataMovementResource extends AbstractResource {
+ private final static Logger logger = LoggerFactory.getLogger(ScpDataMovementResource.class);
+ private String queueDescription;
+ private String dataMovementInterfaceId;
+ private String securityProtocol;
+ private String alternativeScpHostname;
+ private int sshPort;
+ private Timestamp createdTime;
+ private Timestamp updatedTime;
+
+ public Timestamp getCreatedTime() {
+ return createdTime;
+ }
+
+ public void setCreatedTime(Timestamp createdTime) {
+ this.createdTime = createdTime;
+ }
+
+ public Timestamp getUpdatedTime() {
+ return updatedTime;
+ }
+
+ public void setUpdatedTime(Timestamp updatedTime) {
+ this.updatedTime = updatedTime;
+ }
+
+ @Override
+ public void remove(Object identifier) throws AppCatalogException {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(SCP_DATA_MOVEMENT);
+ generator.setParameter(ScpDataMovementConstants.DATA_MOVEMENT_INTERFACE_ID, identifier);
+ 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 Resource get(Object identifier) throws AppCatalogException {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(SCP_DATA_MOVEMENT);
+ generator.setParameter(ScpDataMovementConstants.DATA_MOVEMENT_INTERFACE_ID, identifier);
+ Query q = generator.selectQuery(em);
+ ScpDataMovement scpDataMovement = (ScpDataMovement) q.getSingleResult();
+ ScpDataMovementResource scpDataMovementResource = (ScpDataMovementResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.SCP_DATA_MOVEMENT, scpDataMovement);
+ em.getTransaction().commit();
+ em.close();
+ return scpDataMovementResource;
+ } 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<Resource> get(String fieldName, Object value) throws AppCatalogException {
+ List<Resource> scpDataMovementResources = new ArrayList<Resource>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(SCP_DATA_MOVEMENT);
+ Query q;
+ if ((fieldName.equals(ScpDataMovementConstants.QUEUE_DESCRIPTION)) || (fieldName.equals(ScpDataMovementConstants.DATA_MOVEMENT_INTERFACE_ID)) || (fieldName.equals(ScpDataMovementConstants.SECURITY_PROTOCOL)) || (fieldName.equals(ScpDataMovementConstants.ALTERNATIVE_SCP_HOSTNAME)) || (fieldName.equals(ScpDataMovementConstants.SSH_PORT))) {
+ generator.setParameter(fieldName, value);
+ q = generator.selectQuery(em);
+ List<?> results = q.getResultList();
+ for (Object result : results) {
+ ScpDataMovement scpDataMovement = (ScpDataMovement) result;
+ ScpDataMovementResource scpDataMovementResource = (ScpDataMovementResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.SCP_DATA_MOVEMENT, scpDataMovement);
+ scpDataMovementResources.add(scpDataMovementResource);
+ }
+ } else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for Scp Data Movement Resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for Scp Data Movement Resource.");
+ }
+ 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();
+ }
+ }
+ return scpDataMovementResources;
+ }
+
+ @Override
+ public List<Resource> 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 {
+ List<String> scpDataMovementResourceIDs = new ArrayList<String>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(SCP_DATA_MOVEMENT);
+ Query q;
+ if ((fieldName.equals(ScpDataMovementConstants.QUEUE_DESCRIPTION)) || (fieldName.equals(ScpDataMovementConstants.DATA_MOVEMENT_INTERFACE_ID)) || (fieldName.equals(ScpDataMovementConstants.SECURITY_PROTOCOL)) || (fieldName.equals(ScpDataMovementConstants.ALTERNATIVE_SCP_HOSTNAME)) || (fieldName.equals(ScpDataMovementConstants.SSH_PORT))) {
+ generator.setParameter(fieldName, value);
+ q = generator.selectQuery(em);
+ List<?> results = q.getResultList();
+ for (Object result : results) {
+ ScpDataMovement scpDataMovement = (ScpDataMovement) result;
+ ScpDataMovementResource scpDataMovementResource = (ScpDataMovementResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.SCP_DATA_MOVEMENT, scpDataMovement);
+ scpDataMovementResourceIDs.add(scpDataMovementResource.getDataMovementInterfaceId());
+ }
+ } else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for Scp Data Movement Resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for Scp Data Movement Resource.");
+ }
+ 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();
+ }
+ }
+ return scpDataMovementResourceIDs;
+ }
+
+ @Override
+ public void save() throws AppCatalogException {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ ScpDataMovement existingScpDataMovement = em.find(ScpDataMovement.class, dataMovementInterfaceId);
+ em.close();
+ ScpDataMovement scpDataMovement;
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ if (existingScpDataMovement == null) {
+ scpDataMovement = new ScpDataMovement();
+ scpDataMovement.setCreationTime(AiravataUtils.getCurrentTimestamp());
+ } else {
+ scpDataMovement = existingScpDataMovement;
+ scpDataMovement.setUpdateTime(AiravataUtils.getCurrentTimestamp());
+ }
+ scpDataMovement.setQueueDescription(getQueueDescription());
+ scpDataMovement.setDataMovementInterfaceId(getDataMovementInterfaceId());
+ scpDataMovement.setSecurityProtocol(getSecurityProtocol());
+ scpDataMovement.setAlternativeScpHostname(getAlternativeScpHostname());
+ scpDataMovement.setSshPort(getSshPort());
+ if (existingScpDataMovement == null) {
+ em.persist(scpDataMovement);
+ } else {
+ em.merge(scpDataMovement);
+ }
+ 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 {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ ScpDataMovement scpDataMovement = em.find(ScpDataMovement.class, identifier);
+ em.close();
+ return scpDataMovement != null;
+ } 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();
+ }
+ }
+ }
+
+ public String getQueueDescription() {
+ return queueDescription;
+ }
+
+ public String getDataMovementInterfaceId() {
+ return dataMovementInterfaceId;
+ }
+
+ public String getSecurityProtocol() {
+ return securityProtocol;
+ }
+
+ public String getAlternativeScpHostname() {
+ return alternativeScpHostname;
+ }
+
+ public int getSshPort() {
+ return sshPort;
+ }
+
+ public void setQueueDescription(String queueDescription) {
+ this.queueDescription=queueDescription;
+ }
+
+ public void setDataMovementInterfaceId(String dataMovementInterfaceId) {
+ this.dataMovementInterfaceId=dataMovementInterfaceId;
+ }
+
+ public void setSecurityProtocol(String securityProtocol) {
+ this.securityProtocol=securityProtocol;
+ }
+
+ public void setAlternativeScpHostname(String alternativeScpHostname) {
+ this.alternativeScpHostname=alternativeScpHostname;
+ }
+
+ public void setSshPort(int sshPort) {
+ this.sshPort=sshPort;
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/SshJobSubmissionAppCatalogResourceAppCat.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/SshJobSubmissionAppCatalogResourceAppCat.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/SshJobSubmissionAppCatalogResourceAppCat.java
new file mode 100644
index 0000000..2bbd6f3
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/SshJobSubmissionAppCatalogResourceAppCat.java
@@ -0,0 +1,332 @@
+/**
+ * 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 java.sql.Timestamp;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.persistence.EntityManager;
+import javax.persistence.Query;
+
+import org.apache.airavata.common.exception.ApplicationSettingsException;
+import org.apache.airavata.common.utils.AiravataUtils;
+import org.apache.airavata.registry.core.app.catalog.model.ResourceJobManager;
+import org.apache.airavata.registry.core.app.catalog.model.SshJobSubmission;
+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;
+
+public class SshJobSubmissionAppCatalogResourceAppCat extends AppCatAbstractResource {
+ private final static Logger logger = LoggerFactory.getLogger(SshJobSubmissionAppCatalogResourceAppCat.class);
+ private String resourceJobManagerId;
+ private ResourceJobManagerAppCatalogResourceAppCat resourceJobManagerResource;
+ private String jobSubmissionInterfaceId;
+ private String alternativeSshHostname;
+ private String securityProtocol;
+ private int sshPort;
+ private String monitorMode;
+ private Timestamp createdTime;
+ private Timestamp updatedTime;
+
+ public Timestamp getCreatedTime() {
+ return createdTime;
+ }
+
+ public void setCreatedTime(Timestamp createdTime) {
+ this.createdTime = createdTime;
+ }
+
+ public Timestamp getUpdatedTime() {
+ return updatedTime;
+ }
+
+ public void setUpdatedTime(Timestamp updatedTime) {
+ this.updatedTime = updatedTime;
+ }
+
+ @Override
+ public void remove(Object identifier) throws AppCatalogException {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(SSH_JOB_SUBMISSION);
+ generator.setParameter(SshJobSubmissionConstants.JOB_SUBMISSION_INTERFACE_ID, identifier);
+ 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 {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(SSH_JOB_SUBMISSION);
+ generator.setParameter(SshJobSubmissionConstants.JOB_SUBMISSION_INTERFACE_ID, identifier);
+ Query q = generator.selectQuery(em);
+ SshJobSubmission sshJobSubmission = (SshJobSubmission) q.getSingleResult();
+ SshJobSubmissionAppCatalogResourceAppCat sshJobSubmissionResource = (SshJobSubmissionAppCatalogResourceAppCat) AppCatalogJPAUtils.getResource(AppCatalogResourceType.SSH_JOB_SUBMISSION, sshJobSubmission);
+ em.getTransaction().commit();
+ em.close();
+ return sshJobSubmissionResource;
+ } 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> sshJobSubmissionResources = new ArrayList<AppCatalogResource>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(SSH_JOB_SUBMISSION);
+ Query q;
+ if ((fieldName.equals(SshJobSubmissionConstants.RESOURCE_JOB_MANAGER_ID)) || (fieldName.equals(SshJobSubmissionConstants.JOB_SUBMISSION_INTERFACE_ID)) || (fieldName.equals(SshJobSubmissionConstants.ALTERNATIVE_SSH_HOSTNAME)) || (fieldName.equals(SshJobSubmissionConstants.SECURITY_PROTOCOL)) || (fieldName.equals(SshJobSubmissionConstants.SSH_PORT))) {
+ generator.setParameter(fieldName, value);
+ q = generator.selectQuery(em);
+ List<?> results = q.getResultList();
+ for (Object result : results) {
+ SshJobSubmission sshJobSubmission = (SshJobSubmission) result;
+ SshJobSubmissionAppCatalogResourceAppCat sshJobSubmissionResource = (SshJobSubmissionAppCatalogResourceAppCat) AppCatalogJPAUtils.getResource(AppCatalogResourceType.SSH_JOB_SUBMISSION, sshJobSubmission);
+ sshJobSubmissionResources.add(sshJobSubmissionResource);
+ }
+ } else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for Ssh Job Submission Resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for Ssh Job Submission Resource.");
+ }
+ 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();
+ }
+ }
+ return sshJobSubmissionResources;
+ }
+
+ @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 {
+ List<String> sshJobSubmissionResourceIDs = new ArrayList<String>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(SSH_JOB_SUBMISSION);
+ Query q;
+ if ((fieldName.equals(SshJobSubmissionConstants.RESOURCE_JOB_MANAGER_ID)) || (fieldName.equals(SshJobSubmissionConstants.JOB_SUBMISSION_INTERFACE_ID)) || (fieldName.equals(SshJobSubmissionConstants.ALTERNATIVE_SSH_HOSTNAME)) || (fieldName.equals(SshJobSubmissionConstants.SECURITY_PROTOCOL)) || (fieldName.equals(SshJobSubmissionConstants.SSH_PORT))) {
+ generator.setParameter(fieldName, value);
+ q = generator.selectQuery(em);
+ List<?> results = q.getResultList();
+ for (Object result : results) {
+ SshJobSubmission sshJobSubmission = (SshJobSubmission) result;
+ SshJobSubmissionAppCatalogResourceAppCat sshJobSubmissionResource = (SshJobSubmissionAppCatalogResourceAppCat) AppCatalogJPAUtils.getResource(AppCatalogResourceType.SSH_JOB_SUBMISSION, sshJobSubmission);
+ sshJobSubmissionResourceIDs.add(sshJobSubmissionResource.getJobSubmissionInterfaceId());
+ }
+ } else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for Ssh Job Submission Resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for Ssh Job Submission Resource.");
+ }
+ 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();
+ }
+ }
+ return sshJobSubmissionResourceIDs;
+ }
+
+ @Override
+ public void save() throws AppCatalogException {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ SshJobSubmission existingSshJobSubmission = em.find(SshJobSubmission.class, jobSubmissionInterfaceId);
+ em.close();
+ SshJobSubmission sshJobSubmission;
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ if (existingSshJobSubmission == null) {
+ sshJobSubmission = new SshJobSubmission();
+ sshJobSubmission.setCreationTime(AiravataUtils.getCurrentTimestamp());
+ } else {
+ sshJobSubmission = existingSshJobSubmission;
+ sshJobSubmission.setUpdateTime(AiravataUtils.getCurrentTimestamp());
+ }
+ sshJobSubmission.setResourceJobManagerId(getResourceJobManagerId());
+ ResourceJobManager resourceJobManager = em.find(ResourceJobManager.class, getResourceJobManagerId());
+ sshJobSubmission.setResourceJobManager(resourceJobManager);
+ sshJobSubmission.setJobSubmissionInterfaceId(getJobSubmissionInterfaceId());
+ sshJobSubmission.setAlternativeSshHostname(getAlternativeSshHostname());
+ sshJobSubmission.setSecurityProtocol(getSecurityProtocol());
+ sshJobSubmission.setSshPort(getSshPort());
+ sshJobSubmission.setMonitorMode(getMonitorMode());
+ if (existingSshJobSubmission == null) {
+ em.persist(sshJobSubmission);
+ } else {
+ em.merge(sshJobSubmission);
+ }
+ 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 {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ SshJobSubmission sshJobSubmission = em.find(SshJobSubmission.class, identifier);
+ em.close();
+ return sshJobSubmission != null;
+ } 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();
+ }
+ }
+ }
+
+ public String getResourceJobManagerId() {
+ return resourceJobManagerId;
+ }
+
+ public ResourceJobManagerAppCatalogResourceAppCat getResourceJobManagerResource() {
+ return resourceJobManagerResource;
+ }
+
+ public String getJobSubmissionInterfaceId() {
+ return jobSubmissionInterfaceId;
+ }
+
+ public String getAlternativeSshHostname() {
+ return alternativeSshHostname;
+ }
+
+ public String getSecurityProtocol() {
+ return securityProtocol;
+ }
+
+ public int getSshPort() {
+ return sshPort;
+ }
+
+ public void setResourceJobManagerId(String resourceJobManagerId) {
+ this.resourceJobManagerId=resourceJobManagerId;
+ }
+
+ public void setResourceJobManagerResource(ResourceJobManagerAppCatalogResourceAppCat resourceJobManagerResource) {
+ this.resourceJobManagerResource=resourceJobManagerResource;
+ }
+
+ public void setJobSubmissionInterfaceId(String jobSubmissionInterfaceId) {
+ this.jobSubmissionInterfaceId=jobSubmissionInterfaceId;
+ }
+
+ public void setAlternativeSshHostname(String alternativeSshHostname) {
+ this.alternativeSshHostname=alternativeSshHostname;
+ }
+
+ public void setSecurityProtocol(String securityProtocol) {
+ this.securityProtocol=securityProtocol;
+ }
+
+ public void setSshPort(int sshPort) {
+ this.sshPort=sshPort;
+ }
+
+ public String getMonitorMode() {
+ return monitorMode;
+ }
+
+ public void setMonitorMode(String monitorMode) {
+ this.monitorMode = monitorMode;
+ }
+
+}
\ No newline at end of file
[51/52] [abbrv] [partial] airavata git commit: registry refactoring
Posted by sh...@apache.org.
registry refactoring
Project: http://git-wip-us.apache.org/repos/asf/airavata/repo
Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/ec8c6202
Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/ec8c6202
Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/ec8c6202
Branch: refs/heads/master
Commit: ec8c6202a1f3e8f7f61ac8ae4dee3019a058169a
Parents: e34df6a
Author: Chathuri Wimalasena <ch...@apache.org>
Authored: Thu Jun 4 16:33:08 2015 -0400
Committer: Chathuri Wimalasena <ch...@apache.org>
Committed: Thu Jun 4 16:33:08 2015 -0400
----------------------------------------------------------------------
.../server/handler/AiravataServerHandler.java | 195 +-
.../AiravataExperimentStatusUpdator.java | 24 +-
.../api/server/util/DataModelUtils.java | 4 +-
.../api/server/util/DatabaseCreator.java | 4 +-
.../api/server/util/RegistryInitUtil.java | 12 +-
.../client/samples/CreateLaunchExperiment.java | 2 +-
.../org/airavata/appcatalog/cpi/AppCatalog.java | 54 -
.../appcatalog/cpi/AppCatalogException.java | 36 -
.../appcatalog/cpi/ApplicationDeployment.java | 72 -
.../appcatalog/cpi/ApplicationInterface.java | 148 -
.../appcatalog/cpi/ComputeResource.java | 249 --
.../appcatalog/cpi/GwyResourceProfile.java | 81 -
.../appcatalog/cpi/WorkflowCatalog.java | 45 -
.../catalog/data/impl/AppCatalogFactory.java | 46 -
.../catalog/data/impl/AppCatalogImpl.java | 52 -
.../data/impl/ApplicationDeploymentImpl.java | 414 ---
.../data/impl/ApplicationInterfaceImpl.java | 450 ---
.../catalog/data/impl/ComputeResourceImpl.java | 888 ------
.../data/impl/GwyResourceProfileImpl.java | 252 --
.../catalog/data/impl/WorkflowCatalogImpl.java | 232 --
.../catalog/data/model/AppEnvironment.java | 76 -
.../catalog/data/model/AppEnvironment_PK.java | 64 -
.../catalog/data/model/AppInput_PK.java | 64 -
.../catalog/data/model/AppModuleMapping.java | 77 -
.../catalog/data/model/AppModuleMapping_PK.java | 64 -
.../catalog/data/model/AppOutput_PK.java | 64 -
.../data/model/ApplicationDeployment.java | 148 -
.../catalog/data/model/ApplicationInput.java | 166 -
.../data/model/ApplicationInterface.java | 97 -
.../catalog/data/model/ApplicationModule.java | 107 -
.../catalog/data/model/ApplicationOutput.java | 146 -
.../catalog/data/model/BatchQueue.java | 144 -
.../catalog/data/model/BatchQueue_PK.java | 63 -
.../catalog/data/model/CloudJobSubmission.java | 102 -
.../catalog/data/model/ComputeResource.java | 105 -
.../data/model/ComputeResourceFileSystem.java | 89 -
.../model/ComputeResourceFileSystem_PK.java | 62 -
.../data/model/ComputeResourcePreference.java | 154 -
.../data/model/ComputeResourcePreferencePK.java | 64 -
.../catalog/data/model/Configuration.java | 57 -
.../catalog/data/model/Configuration_PK.java | 65 -
.../data/model/DataMovementInterface.java | 124 -
.../data/model/DataMovementInterface_PK.java | 62 -
.../data/model/DataMovementProtocol.java | 76 -
.../data/model/DataMovementProtocolPK.java | 74 -
.../catalog/data/model/GSISSHExport.java | 73 -
.../catalog/data/model/GSISSHExportPK.java | 64 -
.../catalog/data/model/GSISSHSubmission.java | 82 -
.../catalog/data/model/GatewayProfile.java | 68 -
.../catalog/data/model/GlobusGKEndPointPK.java | 64 -
.../catalog/data/model/GlobusGKEndpoint.java | 65 -
.../catalog/data/model/GlobusJobSubmission.java | 62 -
.../catalog/data/model/GridftpDataMovement.java | 83 -
.../catalog/data/model/GridftpEndpoint.java | 102 -
.../catalog/data/model/GridftpEndpoint_PK.java | 62 -
.../catalog/data/model/HostAlias.java | 65 -
.../catalog/data/model/HostAliasPK.java | 64 -
.../catalog/data/model/HostIPAddress.java | 65 -
.../catalog/data/model/HostIPAddressPK.java | 64 -
.../catalog/data/model/JobManagerCommand.java | 89 -
.../data/model/JobManagerCommand_PK.java | 62 -
.../data/model/JobSubmissionInterface.java | 124 -
.../data/model/JobSubmissionInterface_PK.java | 62 -
.../data/model/JobSubmissionProtocol.java | 77 -
.../data/model/JobSubmissionProtocolPK.java | 74 -
.../catalog/data/model/LibraryApendPath.java | 76 -
.../catalog/data/model/LibraryApendPath_PK.java | 64 -
.../catalog/data/model/LibraryPrepandPath.java | 76 -
.../data/model/LibraryPrepandPath_PK.java | 64 -
.../catalog/data/model/LocalDataMovement.java | 49 -
.../catalog/data/model/LocalSubmission.java | 98 -
.../catalog/data/model/ModuleLoadCmd.java | 70 -
.../catalog/data/model/ModuleLoadCmd_PK.java | 63 -
.../catalog/data/model/PostJobCommand.java | 73 -
.../catalog/data/model/PostJobCommandPK.java | 64 -
.../catalog/data/model/PreJobCommand.java | 73 -
.../catalog/data/model/PreJobCommandPK.java | 64 -
.../catalog/data/model/ResourceJobManager.java | 106 -
.../catalog/data/model/ScpDataMovement.java | 117 -
.../catalog/data/model/SshJobSubmission.java | 144 -
.../catalog/data/model/UnicoreDataMovement.java | 65 -
.../data/model/UnicoreJobSubmission.java | 66 -
.../catalog/data/model/Workflow.java | 126 -
.../catalog/data/model/WorkflowInput.java | 167 -
.../catalog/data/model/WorkflowInput_PK.java | 64 -
.../catalog/data/model/WorkflowOutput.java | 117 -
.../catalog/data/model/WorkflowOutput_PK.java | 64 -
.../data/resources/AbstractResource.java | 382 ---
.../data/resources/AppDeploymentResource.java | 446 ---
.../data/resources/AppEnvironmentResource.java | 293 --
.../data/resources/AppInterfaceResource.java | 363 ---
.../resources/AppModuleMappingResource.java | 317 --
.../data/resources/AppModuleResource.java | 344 --
.../resources/ApplicationInputResource.java | 454 ---
.../resources/ApplicationOutputResource.java | 432 ---
.../data/resources/BatchQueueResource.java | 357 ---
.../data/resources/CloudSubmissionResource.java | 299 --
.../ComputeHostPreferenceResource.java | 413 ---
.../ComputeResourceFileSystemResource.java | 307 --
.../data/resources/ComputeResourceResource.java | 351 ---
.../DataMovementInterfaceResource.java | 339 --
.../resources/DataMovementProtocolResource.java | 360 ---
.../data/resources/GSISSHExportResource.java | 324 --
.../resources/GSISSHSubmissionResource.java | 374 ---
.../data/resources/GatewayProfileResource.java | 318 --
.../resources/GlobusGKEndpointResource.java | 321 --
.../resources/GlobusJobSubmissionResource.java | 316 --
.../resources/GridftpDataMovementResource.java | 279 --
.../data/resources/GridftpEndpointResource.java | 317 --
.../data/resources/HostAliasResource.java | 317 --
.../data/resources/HostIPAddressResource.java | 318 --
.../resources/JobManagerCommandResource.java | 307 --
.../JobSubmissionInterfaceResource.java | 339 --
.../JobSubmissionProtocolResource.java | 359 ---
.../resources/LibraryApendPathResource.java | 292 --
.../resources/LibraryPrepandPathResource.java | 291 --
.../resources/LocalDataMovementResource.java | 249 --
.../data/resources/LocalSubmissionResource.java | 293 --
.../data/resources/ModuleLoadCmdResource.java | 300 --
.../data/resources/PostJobCommandResource.java | 333 --
.../data/resources/PreJobCommandResource.java | 333 --
.../catalog/data/resources/Resource.java | 89 -
.../resources/ResourceJobManagerResource.java | 301 --
.../data/resources/ScpDataMovementResource.java | 308 --
.../resources/SshJobSubmissionResource.java | 332 --
.../resources/UnicoreDataMovementResource.java | 255 --
.../resources/UnicoreJobSubmissionResource.java | 328 --
.../data/resources/WorkflowInputResource.java | 451 ---
.../data/resources/WorkflowOutputResource.java | 410 ---
.../data/resources/WorkflowResource.java | 382 ---
.../catalog/data/util/AppCatalogJPAUtils.java | 911 ------
.../data/util/AppCatalogQueryGenerator.java | 90 -
.../data/util/AppCatalogResourceType.java | 66 -
.../data/util/AppCatalogThriftConversion.java | 800 -----
.../catalog/data/util/AppCatalogUtils.java | 31 -
.../src/main/resources/META-INF/persistence.xml | 67 -
.../src/main/resources/appcatalog-derby.sql | 460 ---
.../src/main/resources/appcatalog-mysql.sql | 453 ---
.../app/catalog/test/AppDeploymentTest.java | 147 -
.../app/catalog/test/AppInterfaceTest.java | 192 --
.../app/catalog/test/ComputeResourceTest.java | 298 --
.../app/catalog/test/GatewayProfileTest.java | 128 -
.../app/catalog/test/util/Initialize.java | 320 --
.../gaussian/handler/GaussianHandler.java | 4 +-
.../gfac/bes/handlers/AbstractSMSHandler.java | 2 +-
.../gfac/bes/provider/impl/BESProvider.java | 2 +-
.../org/apache/airavata/gfac/Scheduler.java | 4 +-
.../org/apache/airavata/gfac/core/GFac.java | 8 +-
.../apache/airavata/gfac/core/GFacUtils.java | 33 +-
.../gfac/core/context/JobExecutionContext.java | 16 +-
.../gfac/core/handler/AbstractHandler.java | 20 +-
.../gfac/core/provider/AbstractProvider.java | 12 +-
.../handler/GSISSHDirectorySetupHandler.java | 6 +-
.../gfac/gsissh/handler/GSISSHInputHandler.java | 6 +-
.../gsissh/handler/GSISSHOutputHandler.java | 12 +-
.../gsissh/handler/NewGSISSHOutputHandler.java | 4 +-
.../gsissh/provider/impl/GSISSHProvider.java | 2 +-
.../gfac/gsissh/util/GFACGSISSHUtils.java | 2 +-
.../gfac/impl/AiravataJobStatusUpdator.java | 22 +-
.../gfac/impl/AiravataTaskStatusUpdator.java | 22 +-
.../impl/AiravataWorkflowNodeStatusUpdator.java | 22 +-
.../airavata/gfac/impl/BetterGfacImpl.java | 26 +-
.../gfac/local/provider/impl/LocalProvider.java | 10 +-
.../ssh/handler/AdvancedSCPInputHandler.java | 4 +-
.../ssh/handler/AdvancedSCPOutputHandler.java | 4 +-
.../gfac/ssh/handler/NewSSHOutputHandler.java | 4 +-
.../ssh/handler/SSHDirectorySetupHandler.java | 6 +-
.../gfac/ssh/handler/SSHInputHandler.java | 6 +-
.../gfac/ssh/handler/SSHOutputHandler.java | 12 +-
.../gfac/ssh/provider/impl/SSHProvider.java | 2 +-
.../airavata/gfac/ssh/util/GFACSSHUtils.java | 4 +-
.../apache/airavata/job/AMQPMonitorTest.java | 2 +-
.../airavata/gfac/server/GfacServerHandler.java | 32 +-
.../gfac/client/GfacClientFactoryTest.java | 4 +-
.../airavata/gfac/client/util/Initialize.java | 4 +-
.../airavata/integration/DataRetrievalIT.java | 2 +-
.../integration/tools/DocumentCreatorNew.java | 5 +-
.../integration/tools/DocumentCreatorUtils.java | 3 +-
.../validator/impl/BatchQueueValidator.java | 2 +-
.../cpi/impl/AbstractOrchestrator.java | 2 +-
.../orchestrator/core/util/Initialize.java | 4 +-
.../server/OrchestratorServerHandler.java | 96 +-
.../orchestrator/util/DataModelUtils.java | 4 +-
.../orchestrator/client/util/Initialize.java | 4 +-
modules/registry/experiment-catalog/pom.xml | 151 -
.../experiment/catalog/JPAConstants.java | 33 -
.../airavata/experiment/catalog/Resource.java | 71 -
.../experiment/catalog/ResourceType.java | 50 -
.../experiment/catalog/ResourceUtils.java | 525 ---
.../catalog/impl/ExperimentRegistry.java | 2983 ------------------
.../catalog/impl/GatewayRegistry.java | 115 -
.../catalog/impl/LoggingRegistryImpl.java | 97 -
.../catalog/impl/ProjectRegistry.java | 303 --
.../catalog/impl/RegistryFactory.java | 80 -
.../experiment/catalog/impl/RegistryImpl.java | 735 -----
.../experiment/catalog/impl/UserReg.java | 41 -
.../model/AdvancedInputDataHandling.java | 113 -
.../model/AdvancedOutputDataHandling.java | 104 -
.../catalog/model/ApplicationInput.java | 165 -
.../catalog/model/ApplicationInput_PK.java | 65 -
.../catalog/model/ApplicationOutput.java | 142 -
.../catalog/model/ApplicationOutput_PK.java | 64 -
.../Computational_Resource_Scheduling.java | 174 -
.../experiment/catalog/model/Configuration.java | 80 -
.../catalog/model/Configuration_PK.java | 74 -
.../catalog/model/DataTransferDetail.java | 91 -
.../experiment/catalog/model/ErrorDetail.java | 176 --
.../experiment/catalog/model/Experiment.java | 299 --
.../catalog/model/ExperimentConfigData.java | 142 -
.../catalog/model/Experiment_Input.java | 170 -
.../catalog/model/Experiment_Input_PK.java | 64 -
.../catalog/model/Experiment_Output.java | 143 -
.../catalog/model/Experiment_Output_PK.java | 64 -
.../experiment/catalog/model/Gateway.java | 76 -
.../catalog/model/Gateway_Worker.java | 82 -
.../catalog/model/Gateway_Worker_PK.java | 64 -
.../experiment/catalog/model/JobDetail.java | 135 -
.../experiment/catalog/model/JobDetails_PK.java | 64 -
.../experiment/catalog/model/NodeInput.java | 163 -
.../experiment/catalog/model/NodeInput_PK.java | 64 -
.../experiment/catalog/model/NodeOutput.java | 140 -
.../experiment/catalog/model/NodeOutput_PK.java | 64 -
.../catalog/model/Notification_Email.java | 81 -
.../experiment/catalog/model/Project.java | 125 -
.../experiment/catalog/model/ProjectUser.java | 81 -
.../catalog/model/ProjectUser_PK.java | 64 -
.../experiment/catalog/model/QosParam.java | 103 -
.../experiment/catalog/model/Status.java | 146 -
.../experiment/catalog/model/TaskDetail.java | 221 --
.../experiment/catalog/model/Users.java | 55 -
.../catalog/model/WorkflowNodeDetail.java | 155 -
.../catalog/resources/AbstractResource.java | 317 --
.../AdvanceInputDataHandlingResource.java | 160 -
.../AdvancedOutputDataHandlingResource.java | 150 -
.../resources/ApplicationInputResource.java | 230 --
.../resources/ApplicationOutputResource.java | 208 --
.../ComputationSchedulingResource.java | 221 --
.../catalog/resources/ConfigDataResource.java | 194 --
.../resources/ConfigurationResource.java | 204 --
.../resources/DataTransferDetailResource.java | 276 --
.../catalog/resources/ErrorDetailResource.java | 215 --
.../resources/ExperimentInputResource.java | 225 --
.../resources/ExperimentOutputResource.java | 204 --
.../catalog/resources/ExperimentResource.java | 831 -----
.../resources/ExperimentSummaryResource.java | 134 -
.../catalog/resources/GatewayResource.java | 437 ---
.../catalog/resources/JobDetailResource.java | 376 ---
.../catalog/resources/NodeInputResource.java | 227 --
.../catalog/resources/NodeOutputResource.java | 207 --
.../resources/NotificationEmailResource.java | 119 -
.../catalog/resources/ProjectResource.java | 508 ---
.../catalog/resources/ProjectUserResource.java | 123 -
.../catalog/resources/QosParamResource.java | 144 -
.../catalog/resources/StatusResource.java | 181 --
.../catalog/resources/TaskDetailResource.java | 748 -----
.../catalog/resources/UserResource.java | 186 --
.../experiment/catalog/resources/Utils.java | 1011 ------
.../catalog/resources/WorkerResource.java | 725 -----
.../resources/WorkflowNodeDetailResource.java | 515 ---
.../catalog/utils/QueryGenerator.java | 128 -
.../utils/ThriftDataModelConversion.java | 686 ----
.../src/main/resources/META-INF/persistence.xml | 65 -
.../src/main/resources/registry-derby.sql | 391 ---
.../src/main/resources/registry-mysql.sql | 392 ---
.../catalog/AbstractResourceTest.java | 91 -
.../catalog/ComputationalSchedulingTest.java | 84 -
.../catalog/ConfigurationResourceTest.java | 58 -
.../catalog/ExecutionErrorResourceTest.java | 95 -
.../catalog/ExperimentDataResourceTest.java | 107 -
.../catalog/ExperimentInputResourceTest.java | 75 -
.../catalog/ExperimentMetadataResourceTest.java | 87 -
.../catalog/ExperimentOutputResourceTest.java | 76 -
.../catalog/ExperimentResourceTest.java | 77 -
.../catalog/GFacJobDataResourceTest.java | 77 -
.../catalog/GFacJobStatusResourceTest.java | 87 -
.../experiment/catalog/GatewayResourceTest.java | 120 -
.../catalog/GramDataResourceTest.java | 72 -
.../catalog/NodeDataResourceTest.java | 72 -
.../catalog/OrchestratorDataResourceTest.java | 69 -
.../experiment/catalog/RegistryUseCaseTest.java | 296 --
.../catalog/TaskDetailResourceTest.java | 93 -
.../experiment/catalog/UserResourceTest.java | 54 -
.../experiment/catalog/WorkerResourceTest.java | 122 -
.../catalog/WorkflowDataResourceTest.java | 106 -
.../catalog/WorkflowNodeDetailResourceTest.java | 85 -
.../experiment/catalog/util/Initialize.java | 333 --
.../src/test/resources/registry-derby.sql | 391 ---
modules/registry/pom.xml | 2 +-
modules/registry/registry-core/pom.xml | 147 +
.../app/catalog/impl/AppCatalogFactory.java | 46 +
.../core/app/catalog/impl/AppCatalogImpl.java | 52 +
.../catalog/impl/ApplicationDeploymentImpl.java | 413 +++
.../catalog/impl/ApplicationInterfaceImpl.java | 450 +++
.../app/catalog/impl/ComputeResourceImpl.java | 888 ++++++
.../catalog/impl/GwyResourceProfileImpl.java | 252 ++
.../app/catalog/impl/WorkflowCatalogImpl.java | 232 ++
.../core/app/catalog/model/AppEnvironment.java | 76 +
.../app/catalog/model/AppEnvironment_PK.java | 64 +
.../core/app/catalog/model/AppInput_PK.java | 64 +
.../app/catalog/model/AppModuleMapping.java | 77 +
.../app/catalog/model/AppModuleMapping_PK.java | 64 +
.../core/app/catalog/model/AppOutput_PK.java | 64 +
.../catalog/model/ApplicationDeployment.java | 148 +
.../app/catalog/model/ApplicationInput.java | 166 +
.../app/catalog/model/ApplicationInterface.java | 97 +
.../app/catalog/model/ApplicationModule.java | 107 +
.../app/catalog/model/ApplicationOutput.java | 146 +
.../core/app/catalog/model/BatchQueue.java | 144 +
.../core/app/catalog/model/BatchQueue_PK.java | 63 +
.../app/catalog/model/CloudJobSubmission.java | 102 +
.../core/app/catalog/model/ComputeResource.java | 105 +
.../model/ComputeResourceFileSystem.java | 89 +
.../model/ComputeResourceFileSystem_PK.java | 62 +
.../model/ComputeResourcePreference.java | 154 +
.../model/ComputeResourcePreferencePK.java | 64 +
.../core/app/catalog/model/Configuration.java | 56 +
.../app/catalog/model/Configuration_PK.java | 65 +
.../catalog/model/DataMovementInterface.java | 124 +
.../catalog/model/DataMovementInterface_PK.java | 62 +
.../app/catalog/model/DataMovementProtocol.java | 76 +
.../catalog/model/DataMovementProtocolPK.java | 74 +
.../core/app/catalog/model/GSISSHExport.java | 73 +
.../core/app/catalog/model/GSISSHExportPK.java | 64 +
.../app/catalog/model/GSISSHSubmission.java | 82 +
.../core/app/catalog/model/GatewayProfile.java | 68 +
.../app/catalog/model/GlobusGKEndPointPK.java | 64 +
.../app/catalog/model/GlobusGKEndpoint.java | 65 +
.../app/catalog/model/GlobusJobSubmission.java | 62 +
.../app/catalog/model/GridftpDataMovement.java | 83 +
.../core/app/catalog/model/GridftpEndpoint.java | 102 +
.../app/catalog/model/GridftpEndpoint_PK.java | 62 +
.../core/app/catalog/model/HostAlias.java | 64 +
.../core/app/catalog/model/HostAliasPK.java | 64 +
.../core/app/catalog/model/HostIPAddress.java | 65 +
.../core/app/catalog/model/HostIPAddressPK.java | 64 +
.../app/catalog/model/JobManagerCommand.java | 89 +
.../app/catalog/model/JobManagerCommand_PK.java | 62 +
.../catalog/model/JobSubmissionInterface.java | 124 +
.../model/JobSubmissionInterface_PK.java | 62 +
.../catalog/model/JobSubmissionProtocol.java | 77 +
.../catalog/model/JobSubmissionProtocolPK.java | 74 +
.../app/catalog/model/LibraryApendPath.java | 76 +
.../app/catalog/model/LibraryApendPath_PK.java | 64 +
.../app/catalog/model/LibraryPrepandPath.java | 76 +
.../catalog/model/LibraryPrepandPath_PK.java | 64 +
.../app/catalog/model/LocalDataMovement.java | 49 +
.../core/app/catalog/model/LocalSubmission.java | 98 +
.../core/app/catalog/model/ModuleLoadCmd.java | 70 +
.../app/catalog/model/ModuleLoadCmd_PK.java | 63 +
.../core/app/catalog/model/PostJobCommand.java | 73 +
.../app/catalog/model/PostJobCommandPK.java | 64 +
.../core/app/catalog/model/PreJobCommand.java | 73 +
.../core/app/catalog/model/PreJobCommandPK.java | 64 +
.../app/catalog/model/ResourceJobManager.java | 106 +
.../core/app/catalog/model/ScpDataMovement.java | 117 +
.../app/catalog/model/SshJobSubmission.java | 144 +
.../app/catalog/model/UnicoreDataMovement.java | 65 +
.../app/catalog/model/UnicoreJobSubmission.java | 66 +
.../core/app/catalog/model/Workflow.java | 126 +
.../core/app/catalog/model/WorkflowInput.java | 167 +
.../app/catalog/model/WorkflowInput_PK.java | 64 +
.../core/app/catalog/model/WorkflowOutput.java | 117 +
.../app/catalog/model/WorkflowOutput_PK.java | 64 +
.../app/catalog/resources/AbstractResource.java | 382 +++
.../resources/AppCatAbstractResource.java | 382 +++
.../catalog/resources/AppCatalogResource.java | 90 +
.../AppDeploymentAppCatalogResourceAppCat.java | 446 +++
.../resources/AppDeploymentResource.java | 446 +++
.../AppEnvironmentAppCatalogResourceAppCat.java | 293 ++
.../resources/AppEnvironmentResource.java | 293 ++
.../AppInterfaceAppCatalogResourceAppCat.java | 363 +++
.../catalog/resources/AppInterfaceResource.java | 363 +++
.../AppModuleAppCatalogResourceAppCat.java | 344 ++
...ppModuleMappingAppCatalogResourceAppCat.java | 317 ++
.../resources/AppModuleMappingResource.java | 317 ++
.../catalog/resources/AppModuleResource.java | 344 ++
...pplicationInputAppCatalogResourceAppCat.java | 454 +++
.../resources/ApplicationInputResource.java | 454 +++
...plicationOutputAppCatalogResourceAppCat.java | 433 +++
.../resources/ApplicationOutputResource.java | 432 +++
.../BatchQueueAppCatalogResourceAppCat.java | 357 +++
.../catalog/resources/BatchQueueResource.java | 357 +++
...CloudSubmissionAppCatalogResourceAppCat.java | 298 ++
.../resources/CloudSubmissionResource.java | 298 ++
...eHostPreferenceAppCatalogResourceAppCat.java | 413 +++
.../ComputeHostPreferenceResource.java | 413 +++
...ComputeResourceAppCatalogResourceAppCat.java | 351 +++
...ourceFileSystemAppCatalogResourceAppCat.java | 307 ++
.../ComputeResourceFileSystemResource.java | 307 ++
.../resources/ComputeResourceResource.java | 351 +++
...vementInterfaceAppCatalogResourceAppCat.java | 339 ++
.../DataMovementInterfaceResource.java | 339 ++
.../resources/DataMovementProtocolResource.java | 360 +++
.../GSISSHExportAppCatalogResourceAppCat.java | 324 ++
.../catalog/resources/GSISSHExportResource.java | 324 ++
...SISSHSubmissionAppCatalogResourceAppCat.java | 373 +++
.../resources/GSISSHSubmissionResource.java | 373 +++
.../GatewayProfileAppCatalogResourceAppCat.java | 318 ++
.../resources/GatewayProfileResource.java | 318 ++
...lobusGKEndpointAppCatalogResourceAppCat.java | 323 ++
.../resources/GlobusGKEndpointResource.java | 321 ++
...usJobSubmissionAppCatalogResourceAppCat.java | 315 ++
.../resources/GlobusJobSubmissionResource.java | 315 ++
...ftpDataMovementAppCatalogResourceAppCat.java | 279 ++
.../resources/GridftpDataMovementResource.java | 279 ++
...GridftpEndpointAppCatalogResourceAppCat.java | 317 ++
.../resources/GridftpEndpointResource.java | 317 ++
.../HostAliasAppCatalogResourceAppCat.java | 317 ++
.../catalog/resources/HostAliasResource.java | 317 ++
.../HostIPAddressAppCatalogResourceAppCat.java | 318 ++
.../resources/HostIPAddressResource.java | 318 ++
...bManagerCommandAppCatalogResourceAppCat.java | 307 ++
.../resources/JobManagerCommandResource.java | 307 ++
...issionInterfaceAppCatalogResourceAppCat.java | 339 ++
.../JobSubmissionInterfaceResource.java | 339 ++
.../JobSubmissionProtocolResource.java | 359 +++
...ibraryApendPathAppCatalogResourceAppCat.java | 292 ++
.../resources/LibraryApendPathResource.java | 292 ++
...raryPrepandPathAppCatalogResourceAppCat.java | 291 ++
.../resources/LibraryPrepandPathResource.java | 291 ++
...calDataMovementAppCatalogResourceAppCat.java | 249 ++
.../resources/LocalDataMovementResource.java | 249 ++
...LocalSubmissionAppCatalogResourceAppCat.java | 293 ++
.../resources/LocalSubmissionResource.java | 293 ++
.../ModuleLoadCmdAppCatalogResourceAppCat.java | 300 ++
.../resources/ModuleLoadCmdResource.java | 300 ++
.../PostJobCommandAppCatalogResourceAppCat.java | 333 ++
.../resources/PostJobCommandResource.java | 333 ++
.../PreJobCommandAppCatalogResourceAppCat.java | 333 ++
.../resources/PreJobCommandResource.java | 333 ++
.../core/app/catalog/resources/Resource.java | 89 +
...ourceJobManagerAppCatalogResourceAppCat.java | 301 ++
.../resources/ResourceJobManagerResource.java | 301 ++
...ScpDataMovementAppCatalogResourceAppCat.java | 308 ++
.../resources/ScpDataMovementResource.java | 308 ++
...shJobSubmissionAppCatalogResourceAppCat.java | 332 ++
.../resources/SshJobSubmissionResource.java | 332 ++
...oreDataMovementAppCatalogResourceAppCat.java | 255 ++
.../resources/UnicoreDataMovementResource.java | 255 ++
...reJobSubmissionAppCatalogResourceAppCat.java | 328 ++
.../resources/UnicoreJobSubmissionResource.java | 328 ++
.../WorkflowAppCatalogResourceAppCat.java | 382 +++
.../WorkflowInputAppCatalogResourceAppCat.java | 451 +++
.../resources/WorkflowInputResource.java | 451 +++
.../WorkflowOutputAppCatalogResourceAppCat.java | 410 +++
.../resources/WorkflowOutputResource.java | 410 +++
.../app/catalog/resources/WorkflowResource.java | 382 +++
.../app/catalog/util/AppCatalogJPAUtils.java | 912 ++++++
.../catalog/util/AppCatalogQueryGenerator.java | 90 +
.../catalog/util/AppCatalogResourceType.java | 66 +
.../util/AppCatalogThriftConversion.java | 800 +++++
.../core/app/catalog/util/AppCatalogUtils.java | 31 +
.../experiment/catalog/ExpCatResourceUtils.java | 526 +++
.../catalog/ExperimentCatResource.java | 71 +
.../core/experiment/catalog/JPAConstants.java | 32 +
.../core/experiment/catalog/ResourceType.java | 49 +
.../catalog/impl/ExperimentCatalogImpl.java | 735 +++++
.../catalog/impl/ExperimentRegistry.java | 2983 ++++++++++++++++++
.../catalog/impl/GatewayRegistry.java | 115 +
.../impl/LoggingExperimentCatalogImpl.java | 97 +
.../catalog/impl/ProjectRegistry.java | 303 ++
.../catalog/impl/RegistryFactory.java | 80 +
.../core/experiment/catalog/impl/UserReg.java | 41 +
.../model/AdvancedInputDataHandling.java | 113 +
.../model/AdvancedOutputDataHandling.java | 105 +
.../catalog/model/ApplicationInput.java | 167 +
.../catalog/model/ApplicationInput_PK.java | 65 +
.../catalog/model/ApplicationOutput.java | 143 +
.../catalog/model/ApplicationOutput_PK.java | 64 +
.../Computational_Resource_Scheduling.java | 175 +
.../experiment/catalog/model/Configuration.java | 80 +
.../catalog/model/Configuration_PK.java | 74 +
.../catalog/model/DataTransferDetail.java | 93 +
.../experiment/catalog/model/ErrorDetail.java | 179 ++
.../experiment/catalog/model/Experiment.java | 299 ++
.../catalog/model/ExperimentConfigData.java | 142 +
.../catalog/model/Experiment_Input.java | 170 +
.../catalog/model/Experiment_Input_PK.java | 64 +
.../catalog/model/Experiment_Output.java | 143 +
.../catalog/model/Experiment_Output_PK.java | 64 +
.../core/experiment/catalog/model/Gateway.java | 76 +
.../catalog/model/Gateway_Worker.java | 82 +
.../catalog/model/Gateway_Worker_PK.java | 64 +
.../experiment/catalog/model/JobDetail.java | 135 +
.../experiment/catalog/model/JobDetails_PK.java | 64 +
.../experiment/catalog/model/NodeInput.java | 163 +
.../experiment/catalog/model/NodeInput_PK.java | 64 +
.../experiment/catalog/model/NodeOutput.java | 140 +
.../experiment/catalog/model/NodeOutput_PK.java | 64 +
.../catalog/model/Notification_Email.java | 81 +
.../core/experiment/catalog/model/Project.java | 125 +
.../experiment/catalog/model/ProjectUser.java | 81 +
.../catalog/model/ProjectUser_PK.java | 64 +
.../core/experiment/catalog/model/QosParam.java | 103 +
.../core/experiment/catalog/model/Status.java | 146 +
.../experiment/catalog/model/TaskDetail.java | 221 ++
.../core/experiment/catalog/model/Users.java | 55 +
.../catalog/model/WorkflowNodeDetail.java | 155 +
.../AbstractExperimentCatResource.java | 317 ++
...eInputDataHandlingExperimentCatResource.java | 160 +
...OutputDataHandlingExperimentCatResource.java | 150 +
.../ApplicationInputExperimentCatResource.java | 230 ++
.../ApplicationOutputExperimentCatResource.java | 208 ++
...putationSchedulingExperimentCatResource.java | 221 ++
.../ConfigDataExperimentCatResource.java | 194 ++
.../ConfigurationExperimentCatResource.java | 204 ++
...DataTransferDetailExperimentCatResource.java | 276 ++
.../ErrorDetailExperimentCatResource.java | 215 ++
.../ExperimentExperimentCatResource.java | 831 +++++
.../ExperimentInputExperimentCatResource.java | 225 ++
.../ExperimentOutputExperimentCatResource.java | 204 ++
.../ExperimentSummaryExperimentCatResource.java | 134 +
.../resources/GatewayExperimentCatResource.java | 437 +++
.../JobDetailExperimentCatResource.java | 376 +++
.../NodeInputExperimentCatResource.java | 227 ++
.../NodeOutputExperimentCatResource.java | 207 ++
.../NotificationEmailExperimentCatResource.java | 119 +
.../resources/ProjectExperimentCatResource.java | 508 +++
.../ProjectUserExperimentCatResource.java | 123 +
.../QosParamExperimentCatResource.java | 144 +
.../resources/StatusExperimentCatResource.java | 181 ++
.../TaskDetailExperimentCatResource.java | 748 +++++
.../resources/UserExperimentCatResource.java | 186 ++
.../experiment/catalog/resources/Utils.java | 1011 ++++++
.../resources/WorkerExperimentCatResource.java | 725 +++++
...WorkflowNodeDetailExperimentCatResource.java | 515 +++
.../catalog/utils/QueryGenerator.java | 128 +
.../utils/ThriftDataModelConversion.java | 686 ++++
.../core/experimet/catalog/JPAConstants.java | 33 +
.../core/experimet/catalog/Resource.java | 71 +
.../core/experimet/catalog/ResourceType.java | 50 +
.../core/experimet/catalog/ResourceUtils.java | 525 +++
.../catalog/impl/ExperimentCatalogImpl.java | 735 +++++
.../catalog/impl/ExperimentRegistry.java | 2983 ++++++++++++++++++
.../experimet/catalog/impl/GatewayRegistry.java | 115 +
.../impl/LoggingExperimentCatalogImpl.java | 97 +
.../experimet/catalog/impl/ProjectRegistry.java | 303 ++
.../experimet/catalog/impl/RegistryFactory.java | 80 +
.../core/experimet/catalog/impl/UserReg.java | 41 +
.../model/AdvancedInputDataHandling.java | 113 +
.../model/AdvancedOutputDataHandling.java | 104 +
.../catalog/model/ApplicationInput.java | 165 +
.../catalog/model/ApplicationInput_PK.java | 65 +
.../catalog/model/ApplicationOutput.java | 142 +
.../catalog/model/ApplicationOutput_PK.java | 64 +
.../Computational_Resource_Scheduling.java | 174 +
.../experimet/catalog/model/Configuration.java | 80 +
.../catalog/model/Configuration_PK.java | 74 +
.../catalog/model/DataTransferDetail.java | 91 +
.../experimet/catalog/model/ErrorDetail.java | 176 ++
.../experimet/catalog/model/Experiment.java | 299 ++
.../catalog/model/ExperimentConfigData.java | 142 +
.../catalog/model/Experiment_Input.java | 170 +
.../catalog/model/Experiment_Input_PK.java | 64 +
.../catalog/model/Experiment_Output.java | 143 +
.../catalog/model/Experiment_Output_PK.java | 64 +
.../core/experimet/catalog/model/Gateway.java | 76 +
.../experimet/catalog/model/Gateway_Worker.java | 82 +
.../catalog/model/Gateway_Worker_PK.java | 64 +
.../core/experimet/catalog/model/JobDetail.java | 135 +
.../experimet/catalog/model/JobDetails_PK.java | 64 +
.../core/experimet/catalog/model/NodeInput.java | 163 +
.../experimet/catalog/model/NodeInput_PK.java | 64 +
.../experimet/catalog/model/NodeOutput.java | 140 +
.../experimet/catalog/model/NodeOutput_PK.java | 64 +
.../catalog/model/Notification_Email.java | 81 +
.../core/experimet/catalog/model/Project.java | 125 +
.../experimet/catalog/model/ProjectUser.java | 81 +
.../experimet/catalog/model/ProjectUser_PK.java | 64 +
.../core/experimet/catalog/model/QosParam.java | 103 +
.../core/experimet/catalog/model/Status.java | 146 +
.../experimet/catalog/model/TaskDetail.java | 221 ++
.../core/experimet/catalog/model/Users.java | 55 +
.../catalog/model/WorkflowNodeDetail.java | 155 +
.../catalog/resources/AbstractResource.java | 317 ++
.../AdvanceInputDataHandlingResource.java | 160 +
.../AdvancedOutputDataHandlingResource.java | 150 +
.../resources/ApplicationInputResource.java | 230 ++
.../resources/ApplicationOutputResource.java | 208 ++
.../ComputationSchedulingResource.java | 221 ++
.../catalog/resources/ConfigDataResource.java | 194 ++
.../resources/ConfigurationResource.java | 204 ++
.../resources/DataTransferDetailResource.java | 276 ++
.../catalog/resources/ErrorDetailResource.java | 215 ++
.../resources/ExperimentInputResource.java | 225 ++
.../resources/ExperimentOutputResource.java | 204 ++
.../catalog/resources/ExperimentResource.java | 831 +++++
.../resources/ExperimentSummaryResource.java | 134 +
.../catalog/resources/GatewayResource.java | 437 +++
.../catalog/resources/JobDetailResource.java | 376 +++
.../catalog/resources/NodeInputResource.java | 227 ++
.../catalog/resources/NodeOutputResource.java | 207 ++
.../resources/NotificationEmailResource.java | 119 +
.../catalog/resources/ProjectResource.java | 508 +++
.../catalog/resources/ProjectUserResource.java | 123 +
.../catalog/resources/QosParamResource.java | 144 +
.../catalog/resources/StatusResource.java | 181 ++
.../catalog/resources/TaskDetailResource.java | 748 +++++
.../catalog/resources/UserResource.java | 186 ++
.../core/experimet/catalog/resources/Utils.java | 1011 ++++++
.../catalog/resources/WorkerResource.java | 725 +++++
.../resources/WorkflowNodeDetailResource.java | 515 +++
.../experimet/catalog/utils/QueryGenerator.java | 128 +
.../utils/ThriftDataModelConversion.java | 686 ++++
.../src/main/resources/META-INF/app-catalog.xml | 67 +
.../resources/META-INF/experiment-catalog.xml | 65 +
.../src/main/resources/META-INF/persistence.xml | 96 +
.../src/main/resources/appcatalog-derby.sql | 460 +++
.../src/main/resources/appcatalog-mysql.sql | 453 +++
.../src/main/resources/expcatalog-derby.sql | 391 +++
.../src/main/resources/expcatalog-mysql.sql | 392 +++
.../airavata/app/catalog/AppDeploymentTest.java | 146 +
.../airavata/app/catalog/AppInterfaceTest.java | 191 ++
...puteAppCatalogExperimentCatResourceTest.java | 297 ++
.../app/catalog/ComputeResourceTest.java | 297 ++
.../app/catalog/GatewayProfileTest.java | 127 +
.../airavata/app/catalog/util/Initialize.java | 320 ++
.../catalog/AbstractResourceTest.java | 91 +
.../catalog/ComputationalSchedulingTest.java | 85 +
.../ConfigurationExperimentCatResourceTest.java | 58 +
.../catalog/ConfigurationResourceTest.java | 58 +
.../catalog/ExecutionErrorResourceTest.java | 95 +
.../catalog/ExperimentCatalogUseCaseTest.java | 296 ++
.../catalog/ExperimentDataResourceTest.java | 107 +
.../ExperimentExperimentCatResourceTest.java | 78 +
...xperimentInputExperimentCatResourceTest.java | 77 +
.../catalog/ExperimentInputResourceTest.java | 75 +
.../catalog/ExperimentMetadataResourceTest.java | 87 +
...perimentOutputExperimentCatResourceTest.java | 77 +
.../catalog/ExperimentOutputResourceTest.java | 76 +
.../catalog/ExperimentResourceTest.java | 77 +
.../catalog/GFacJobDataResourceTest.java | 77 +
.../catalog/GFacJobStatusResourceTest.java | 87 +
.../GatewayExperimentCatResourceTest.java | 122 +
.../experiment/catalog/GatewayResourceTest.java | 120 +
.../catalog/GramDataResourceTest.java | 72 +
.../catalog/NodeDataResourceTest.java | 72 +
.../catalog/OrchestratorDataResourceTest.java | 69 +
.../TaskDetailExperimentCatResourceTest.java | 94 +
.../catalog/TaskDetailResourceTest.java | 93 +
.../catalog/UserExperimentCatResourceTest.java | 55 +
.../experiment/catalog/UserResourceTest.java | 54 +
.../experiment/catalog/WorkerResourceTest.java | 122 +
.../catalog/WorkflowDataResourceTest.java | 106 +
...flowNodeDetailExperimentCatResourceTest.java | 86 +
.../catalog/WorkflowNodeDetailResourceTest.java | 85 +
.../experiment/catalog/util/Initialize.java | 329 ++
.../src/test/resources/appcatalog-derby.sql | 460 +++
.../src/test/resources/expcatalog-derby.sql | 391 +++
modules/registry/registry-cpi/pom.xml | 5 +
.../airavata/registry/cpi/AppCatalog.java | 54 +
.../registry/cpi/AppCatalogException.java | 36 +
.../registry/cpi/ApplicationDeployment.java | 72 +
.../registry/cpi/ApplicationInterface.java | 148 +
.../airavata/registry/cpi/ChildDataType.java | 45 -
.../airavata/registry/cpi/ComputeResource.java | 249 ++
.../registry/cpi/ExpCatChildDataType.java | 45 +
.../registry/cpi/ExpCatParentDataType.java | 32 +
.../registry/cpi/ExperimentCatalog.java | 193 ++
.../cpi/ExperimentCatalogException.java | 38 +
.../cpi/ExperimentCatalogModelType.java | 51 +
.../registry/cpi/GwyResourceProfile.java | 81 +
.../airavata/registry/cpi/ParentDataType.java | 32 -
.../apache/airavata/registry/cpi/Registry.java | 178 +-
.../registry/cpi/RegistryModelType.java | 51 -
.../airavata/registry/cpi/WorkflowCatalog.java | 45 +
.../catalog/WorkflowCatalogFactory.java | 4 +-
.../workflow/engine/WorkflowEngineImpl.java | 10 +-
.../airavata/workflow/engine/WorkflowUtils.java | 4 +-
.../engine/interpretor/WorkflowInterpreter.java | 32 +-
pom.xml | 1 -
671 files changed, 84330 insertions(+), 50263 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/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 7953c1a..de29085 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
@@ -21,7 +21,6 @@
package org.apache.airavata.api.server.handler;
-import org.airavata.appcatalog.cpi.*;
import org.apache.aiaravata.application.catalog.data.impl.AppCatalogFactory;
import org.apache.aiaravata.application.catalog.data.resources.*;
import org.apache.aiaravata.application.catalog.data.util.AppCatalogThriftConversion;
@@ -56,8 +55,8 @@ import org.apache.airavata.model.workspace.experiment.*;
import org.apache.airavata.orchestrator.client.OrchestratorClientFactory;
import org.apache.airavata.orchestrator.cpi.OrchestratorService;
import org.apache.airavata.orchestrator.cpi.OrchestratorService.Client;
-import org.apache.airavata.experiment.catalog.ResourceUtils;
-import org.apache.airavata.experiment.catalog.impl.RegistryFactory;
+import org.apache.airavata.registry.core.experiment.catalog.ResourceUtils;
+import org.apache.airavata.registry.core.experiment.catalog.impl.RegistryFactory;
import org.apache.airavata.registry.cpi.*;
import org.apache.airavata.registry.cpi.utils.Constants;
import org.apache.thrift.TException;
@@ -69,7 +68,7 @@ import java.util.Map;
public class AiravataServerHandler implements Airavata.Iface {
private static final AiravataLogger logger = AiravataLoggerFactory.getLogger(AiravataServerHandler.class);
- private Registry registry;
+ private ExperimentCatalog experimentCatalog;
private AppCatalog appCatalog;
private Publisher publisher;
private WorkflowCatalog workflowCatalog;
@@ -97,12 +96,12 @@ public class AiravataServerHandler implements Airavata.Iface {
@Override
public String addGateway(Gateway gateway) throws InvalidRequestException, AiravataClientException, AiravataSystemException, TException {
try {
- registry = RegistryFactory.getDefaultRegistry();
+ experimentCatalog = RegistryFactory.getDefaultRegistry();
if (!validateString(gateway.getGatewayId())){
logger.error("Gateway id cannot be empty...");
throw new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
}
- return (String)registry.add(ParentDataType.GATEWAY, gateway, gateway.getGatewayId());
+ return (String) experimentCatalog.add(ExpCatParentDataType.GATEWAY, gateway, gateway.getGatewayId());
} catch (RegistryException e) {
logger.error("Error while adding gateway", e);
AiravataSystemException exception = new AiravataSystemException();
@@ -115,14 +114,14 @@ public class AiravataServerHandler implements Airavata.Iface {
@Override
public void updateGateway(String gatewayId, Gateway updatedGateway) throws InvalidRequestException, AiravataClientException, AiravataSystemException, TException {
try {
- registry = RegistryFactory.getRegistry(gatewayId);
- if (!registry.isExist(RegistryModelType.GATEWAY, gatewayId)){
+ experimentCatalog = RegistryFactory.getRegistry(gatewayId);
+ if (!experimentCatalog.isExist(ExperimentCatalogModelType.GATEWAY, gatewayId)){
logger.error("Gateway does not exist in the system. Please provide a valid gateway ID...");
AiravataSystemException exception = new AiravataSystemException();
exception.setMessage("Gateway does not exist in the system. Please provide a valid gateway ID...");
throw exception;
}
- registry.update(RegistryModelType.GATEWAY, updatedGateway, gatewayId);
+ experimentCatalog.update(ExperimentCatalogModelType.GATEWAY, updatedGateway, gatewayId);
} catch (RegistryException e) {
logger.error("Error while updating the gateway", e);
AiravataSystemException exception = new AiravataSystemException();
@@ -135,14 +134,14 @@ public class AiravataServerHandler implements Airavata.Iface {
@Override
public Gateway getGateway(String gatewayId) throws InvalidRequestException, AiravataClientException, AiravataSystemException, TException {
try {
- registry = RegistryFactory.getRegistry(gatewayId);
- if (!registry.isExist(RegistryModelType.GATEWAY, gatewayId)){
+ experimentCatalog = RegistryFactory.getRegistry(gatewayId);
+ if (!experimentCatalog.isExist(ExperimentCatalogModelType.GATEWAY, gatewayId)){
logger.error("Gateway does not exist in the system. Please provide a valid gateway ID...");
AiravataSystemException exception = new AiravataSystemException();
exception.setMessage("Gateway does not exist in the system. Please provide a valid gateway ID...");
throw exception;
}
- return (Gateway)registry.get(RegistryModelType.GATEWAY, gatewayId);
+ return (Gateway) experimentCatalog.get(ExperimentCatalogModelType.GATEWAY, gatewayId);
} catch (RegistryException e) {
logger.error("Error while getting the gateway", e);
AiravataSystemException exception = new AiravataSystemException();
@@ -155,14 +154,14 @@ public class AiravataServerHandler implements Airavata.Iface {
@Override
public boolean deleteGateway(String gatewayId) throws InvalidRequestException, AiravataClientException, AiravataSystemException, TException {
try {
- registry = RegistryFactory.getRegistry(gatewayId);
- if (!registry.isExist(RegistryModelType.GATEWAY, gatewayId)){
+ experimentCatalog = RegistryFactory.getRegistry(gatewayId);
+ if (!experimentCatalog.isExist(ExperimentCatalogModelType.GATEWAY, gatewayId)){
logger.error("Gateway does not exist in the system. Please provide a valid gateway ID...");
AiravataSystemException exception = new AiravataSystemException();
exception.setMessage("Gateway does not exist in the system. Please provide a valid gateway ID...");
throw exception;
}
- registry.remove(RegistryModelType.GATEWAY, gatewayId);
+ experimentCatalog.remove(ExperimentCatalogModelType.GATEWAY, gatewayId);
return true;
} catch (RegistryException e) {
logger.error("Error while deleting the gateway", e);
@@ -177,8 +176,8 @@ public class AiravataServerHandler implements Airavata.Iface {
public List<Gateway> getAllGateways() throws InvalidRequestException, AiravataClientException, AiravataSystemException, TException {
try {
List<Gateway> gateways = new ArrayList<Gateway>();
- registry = RegistryFactory.getDefaultRegistry();
- List<Object> list = registry.get(RegistryModelType.GATEWAY, null, null);
+ experimentCatalog = RegistryFactory.getDefaultRegistry();
+ List<Object> list = experimentCatalog.get(ExperimentCatalogModelType.GATEWAY, null, null);
for (Object gateway : list){
gateways.add((Gateway)gateway);
}
@@ -195,8 +194,8 @@ public class AiravataServerHandler implements Airavata.Iface {
@Override
public boolean isGatewayExist(String gatewayId) throws InvalidRequestException, AiravataClientException, AiravataSystemException, TException {
try {
- registry = RegistryFactory.getRegistry(gatewayId);
- return registry.isExist(RegistryModelType.GATEWAY, gatewayId);
+ experimentCatalog = RegistryFactory.getRegistry(gatewayId);
+ return experimentCatalog.isExist(ExperimentCatalogModelType.GATEWAY, gatewayId);
} catch (RegistryException e) {
logger.error("Error while getting gateway", e);
AiravataSystemException exception = new AiravataSystemException();
@@ -229,7 +228,7 @@ public class AiravataServerHandler implements Airavata.Iface {
@Override
public String createProject(String gatewayId, Project project) throws InvalidRequestException, AiravataClientException, AiravataSystemException, TException {
try {
- registry = RegistryFactory.getRegistry(gatewayId);
+ experimentCatalog = RegistryFactory.getRegistry(gatewayId);
if (!validateString(project.getName()) || !validateString(project.getOwner())){
logger.error("Project name and owner cannot be empty...");
throw new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
@@ -242,7 +241,7 @@ public class AiravataServerHandler implements Airavata.Iface {
logger.error("Gateway does not exist.Please provide a valid gateway id...");
throw new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
}
- return (String)registry.add(ParentDataType.PROJECT, project, gatewayId);
+ return (String) experimentCatalog.add(ExpCatParentDataType.PROJECT, project, gatewayId);
} catch (RegistryException e) {
logger.error("Error while creating the project", e);
AiravataSystemException exception = new AiravataSystemException();
@@ -265,14 +264,14 @@ public class AiravataServerHandler implements Airavata.Iface {
throw exception;
}
try {
- registry = RegistryFactory.getDefaultRegistry();
- if (!registry.isExist(RegistryModelType.PROJECT, projectId)){
+ experimentCatalog = RegistryFactory.getDefaultRegistry();
+ if (!experimentCatalog.isExist(ExperimentCatalogModelType.PROJECT, projectId)){
logger.error("Project does not exist in the system. Please provide a valid project ID...");
ProjectNotFoundException exception = new ProjectNotFoundException();
exception.setMessage("Project does not exist in the system. Please provide a valid project ID...");
throw exception;
}
- registry.update(RegistryModelType.PROJECT, updatedProject, projectId);
+ experimentCatalog.update(ExperimentCatalogModelType.PROJECT, updatedProject, projectId);
} catch (RegistryException e) {
logger.error("Error while updating the project", e);
AiravataSystemException exception = new AiravataSystemException();
@@ -303,14 +302,14 @@ public class AiravataServerHandler implements Airavata.Iface {
ProjectNotFoundException,
TException {
try {
- registry = RegistryFactory.getDefaultRegistry();
- if (!registry.isExist(RegistryModelType.PROJECT, projectId)){
+ experimentCatalog = RegistryFactory.getDefaultRegistry();
+ if (!experimentCatalog.isExist(ExperimentCatalogModelType.PROJECT, projectId)){
logger.error("Project does not exist in the system. Please provide a valid project ID...");
ProjectNotFoundException exception = new ProjectNotFoundException();
exception.setMessage("Project does not exist in the system. Please provide a valid project ID...");
throw exception;
}
- return (Project)registry.get(RegistryModelType.PROJECT, projectId);
+ return (Project) experimentCatalog.get(ExperimentCatalogModelType.PROJECT, projectId);
} catch (RegistryException e) {
logger.error("Error while retrieving the project", e);
ProjectNotFoundException exception = new ProjectNotFoundException();
@@ -370,11 +369,11 @@ public class AiravataServerHandler implements Airavata.Iface {
exception.setMessage("User does not exist in the system. Please provide a valid user..");
throw exception;
}
- registry = RegistryFactory.getRegistry(gatewayId);
+ experimentCatalog = RegistryFactory.getRegistry(gatewayId);
Map<String, String> filters = new HashMap<String, String>();
filters.put(Constants.FieldConstants.ProjectConstants.OWNER, userName);
filters.put(Constants.FieldConstants.ProjectConstants.GATEWAY_ID, gatewayId);
- List<Object> list = registry.search(RegistryModelType.PROJECT, filters, limit, offset,
+ List<Object> list = experimentCatalog.search(ExperimentCatalogModelType.PROJECT, filters, limit, offset,
Constants.FieldConstants.ProjectConstants.CREATION_TIME, ResultOrderType.DESC);
if (list != null && !list.isEmpty()){
for (Object o : list){
@@ -448,12 +447,12 @@ public class AiravataServerHandler implements Airavata.Iface {
throw exception;
}
List<Project> projects = new ArrayList<Project>();
- registry = RegistryFactory.getRegistry(gatewayId);
+ experimentCatalog = RegistryFactory.getRegistry(gatewayId);
Map<String, String> filters = new HashMap<String, String>();
filters.put(Constants.FieldConstants.ProjectConstants.OWNER, userName);
filters.put(Constants.FieldConstants.ProjectConstants.GATEWAY_ID, gatewayId);
filters.put(Constants.FieldConstants.ProjectConstants.PROJECT_NAME, projectName);
- List<Object> results = registry.search(RegistryModelType.PROJECT, filters, limit, offset,
+ List<Object> results = experimentCatalog.search(ExperimentCatalogModelType.PROJECT, filters, limit, offset,
Constants.FieldConstants.ProjectConstants.CREATION_TIME, ResultOrderType.DESC);
for (Object object : results) {
projects.add((Project)object);
@@ -524,12 +523,12 @@ public class AiravataServerHandler implements Airavata.Iface {
throw exception;
}
List<Project> projects = new ArrayList<Project>();
- registry = RegistryFactory.getRegistry(gatewayId);
+ experimentCatalog = RegistryFactory.getRegistry(gatewayId);
Map<String, String> filters = new HashMap<String, String>();
filters.put(Constants.FieldConstants.ProjectConstants.OWNER, userName);
filters.put(Constants.FieldConstants.ProjectConstants.GATEWAY_ID, gatewayId);
filters.put(Constants.FieldConstants.ProjectConstants.DESCRIPTION, description);
- List<Object> results = registry.search(RegistryModelType.PROJECT, filters, limit, offset,
+ List<Object> results = experimentCatalog.search(ExperimentCatalogModelType.PROJECT, filters, limit, offset,
Constants.FieldConstants.ProjectConstants.CREATION_TIME, ResultOrderType.DESC);
for (Object object : results) {
projects.add((Project)object);
@@ -603,12 +602,12 @@ public class AiravataServerHandler implements Airavata.Iface {
throw exception;
}
List<ExperimentSummary> summaries = new ArrayList<ExperimentSummary>();
- registry = RegistryFactory.getRegistry(gatewayId);
+ experimentCatalog = RegistryFactory.getRegistry(gatewayId);
Map<String, String> filters = new HashMap<String, String>();
filters.put(Constants.FieldConstants.ExperimentConstants.USER_NAME, userName);
filters.put(Constants.FieldConstants.ExperimentConstants.GATEWAY, gatewayId);
filters.put(Constants.FieldConstants.ExperimentConstants.EXPERIMENT_NAME, expName);
- List<Object> results = registry.search(RegistryModelType.EXPERIMENT, filters, limit,
+ List<Object> results = experimentCatalog.search(ExperimentCatalogModelType.EXPERIMENT, filters, limit,
offset, Constants.FieldConstants.ExperimentConstants.CREATION_TIME, ResultOrderType.DESC);
for (Object object : results) {
summaries.add((ExperimentSummary) object);
@@ -681,12 +680,12 @@ public class AiravataServerHandler implements Airavata.Iface {
throw exception;
}
List<ExperimentSummary> summaries = new ArrayList<ExperimentSummary>();
- registry = RegistryFactory.getRegistry(gatewayId);
+ experimentCatalog = RegistryFactory.getRegistry(gatewayId);
Map<String, String> filters = new HashMap<String, String>();
filters.put(Constants.FieldConstants.ExperimentConstants.USER_NAME, userName);
filters.put(Constants.FieldConstants.ExperimentConstants.GATEWAY, gatewayId);
filters.put(Constants.FieldConstants.ExperimentConstants.EXPERIMENT_DESC, description);
- List<Object> results = registry.search(RegistryModelType.EXPERIMENT, filters, limit,
+ List<Object> results = experimentCatalog.search(ExperimentCatalogModelType.EXPERIMENT, filters, limit,
offset, Constants.FieldConstants.ExperimentConstants.CREATION_TIME, ResultOrderType.DESC);
for (Object object : results) {
summaries.add((ExperimentSummary) object);
@@ -756,12 +755,12 @@ public class AiravataServerHandler implements Airavata.Iface {
throw exception;
}
List<ExperimentSummary> summaries = new ArrayList<ExperimentSummary>();
- registry = RegistryFactory.getRegistry(gatewayId);
+ experimentCatalog = RegistryFactory.getRegistry(gatewayId);
Map<String, String> filters = new HashMap<String, String>();
filters.put(Constants.FieldConstants.ExperimentConstants.USER_NAME, userName);
filters.put(Constants.FieldConstants.ExperimentConstants.APPLICATION_ID, applicationId);
filters.put(Constants.FieldConstants.ExperimentConstants.GATEWAY, gatewayId);
- List<Object> results = registry.search(RegistryModelType.EXPERIMENT, filters, limit,
+ List<Object> results = experimentCatalog.search(ExperimentCatalogModelType.EXPERIMENT, filters, limit,
offset, Constants.FieldConstants.ExperimentConstants.CREATION_TIME, ResultOrderType.DESC);
for (Object object : results) {
summaries.add((ExperimentSummary) object);
@@ -831,12 +830,12 @@ public class AiravataServerHandler implements Airavata.Iface {
throw exception;
}
List<ExperimentSummary> summaries = new ArrayList<ExperimentSummary>();
- registry = RegistryFactory.getRegistry(gatewayId);
+ experimentCatalog = RegistryFactory.getRegistry(gatewayId);
Map<String, String> filters = new HashMap<String, String>();
filters.put(Constants.FieldConstants.ExperimentConstants.USER_NAME, userName);
filters.put(Constants.FieldConstants.ExperimentConstants.EXPERIMENT_STATUS, experimentState.toString());
filters.put(Constants.FieldConstants.ExperimentConstants.GATEWAY, gatewayId);
- List<Object> results = registry.search(RegistryModelType.EXPERIMENT, filters, limit,
+ List<Object> results = experimentCatalog.search(ExperimentCatalogModelType.EXPERIMENT, filters, limit,
offset, Constants.FieldConstants.ExperimentConstants.CREATION_TIME, ResultOrderType.DESC);
for (Object object : results) {
summaries.add((ExperimentSummary) object);
@@ -910,13 +909,13 @@ public class AiravataServerHandler implements Airavata.Iface {
throw exception;
}
List<ExperimentSummary> summaries = new ArrayList<ExperimentSummary>();
- registry = RegistryFactory.getRegistry(gatewayId);
+ experimentCatalog = RegistryFactory.getRegistry(gatewayId);
Map<String, String> filters = new HashMap<String, String>();
filters.put(Constants.FieldConstants.ExperimentConstants.USER_NAME, userName);
filters.put(Constants.FieldConstants.ExperimentConstants.FROM_DATE, String.valueOf(fromTime));
filters.put(Constants.FieldConstants.ExperimentConstants.TO_DATE, String.valueOf(toTime));
filters.put(Constants.FieldConstants.ExperimentConstants.GATEWAY, gatewayId);
- List<Object> results = registry.search(RegistryModelType.EXPERIMENT, filters, limit,
+ List<Object> results = experimentCatalog.search(ExperimentCatalogModelType.EXPERIMENT, filters, limit,
offset, Constants.FieldConstants.ExperimentConstants.CREATION_TIME, ResultOrderType.DESC);
for (Object object : results) {
summaries.add((ExperimentSummary) object);
@@ -969,7 +968,7 @@ public class AiravataServerHandler implements Airavata.Iface {
throw exception;
}
List<ExperimentSummary> summaries = new ArrayList<ExperimentSummary>();
- registry = RegistryFactory.getRegistry(gatewayId);
+ experimentCatalog = RegistryFactory.getRegistry(gatewayId);
Map<String, String> regFilters = new HashMap();
regFilters.put(Constants.FieldConstants.ExperimentConstants.USER_NAME, userName);
regFilters.put(Constants.FieldConstants.ExperimentConstants.GATEWAY, gatewayId);
@@ -989,7 +988,7 @@ public class AiravataServerHandler implements Airavata.Iface {
regFilters.put(Constants.FieldConstants.ExperimentConstants.TO_DATE, entry.getValue());
}
}
- List<Object> results = registry.search(RegistryModelType.EXPERIMENT, regFilters, limit,
+ List<Object> results = experimentCatalog.search(ExperimentCatalogModelType.EXPERIMENT, regFilters, limit,
offset, Constants.FieldConstants.ExperimentConstants.CREATION_TIME, ResultOrderType.DESC);
for (Object object : results) {
summaries.add((ExperimentSummary) object);
@@ -1044,15 +1043,15 @@ public class AiravataServerHandler implements Airavata.Iface {
throw exception;
}
try {
- registry = RegistryFactory.getDefaultRegistry();
- if (!registry.isExist(RegistryModelType.PROJECT, projectId)){
+ experimentCatalog = RegistryFactory.getDefaultRegistry();
+ if (!experimentCatalog.isExist(ExperimentCatalogModelType.PROJECT, projectId)){
logger.error("Project does not exist in the system. Please provide a valid project ID...");
ProjectNotFoundException exception = new ProjectNotFoundException();
exception.setMessage("Project does not exist in the system. Please provide a valid project ID...");
throw exception;
}
List<Experiment> experiments = new ArrayList<Experiment>();
- List<Object> list = registry.get(RegistryModelType.EXPERIMENT,
+ List<Object> list = experimentCatalog.get(ExperimentCatalogModelType.EXPERIMENT,
Constants.FieldConstants.ExperimentConstants.PROJECT_ID, projectId, limit, offset,
Constants.FieldConstants.ExperimentConstants.CREATION_TIME, ResultOrderType.DESC);
if (list != null && !list.isEmpty()) {
@@ -1121,8 +1120,8 @@ public class AiravataServerHandler implements Airavata.Iface {
throw exception;
}
List<Experiment> experiments = new ArrayList<Experiment>();
- registry = RegistryFactory.getRegistry(gatewayId);
- List<Object> list = registry.get(RegistryModelType.EXPERIMENT,
+ experimentCatalog = RegistryFactory.getRegistry(gatewayId);
+ List<Object> list = experimentCatalog.get(ExperimentCatalogModelType.EXPERIMENT,
Constants.FieldConstants.ExperimentConstants.USER_NAME, userName, limit, offset,
Constants.FieldConstants.ExperimentConstants.CREATION_TIME, ResultOrderType.DESC);
if (list != null && !list.isEmpty()){
@@ -1165,7 +1164,7 @@ public class AiravataServerHandler implements Airavata.Iface {
@Override
public String createExperiment(String gatewayId, Experiment experiment) throws InvalidRequestException, AiravataClientException, AiravataSystemException, TException {
try {
- registry = RegistryFactory.getRegistry(gatewayId);
+ experimentCatalog = RegistryFactory.getRegistry(gatewayId);
if (!validateString(experiment.getName())){
logger.error("Cannot create experiments with empty experiment name");
AiravataSystemException exception = new AiravataSystemException();
@@ -1177,7 +1176,7 @@ public class AiravataServerHandler implements Airavata.Iface {
logger.error("Gateway does not exist.Please provide a valid gateway id...");
throw new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
}
- String experimentId = (String) registry.add(ParentDataType.EXPERIMENT, experiment, gatewayId);
+ String experimentId = (String) experimentCatalog.add(ExpCatParentDataType.EXPERIMENT, experiment, gatewayId);
ExperimentStatusChangeEvent event = new ExperimentStatusChangeEvent(ExperimentState.CREATED,
experimentId,
gatewayId);
@@ -1223,11 +1222,11 @@ public class AiravataServerHandler implements Airavata.Iface {
@Override
public Experiment getExperiment(String airavataExperimentId) throws InvalidRequestException, ExperimentNotFoundException, AiravataClientException, AiravataSystemException, TException {
try {
- registry = RegistryFactory.getDefaultRegistry();
- if (!registry.isExist(RegistryModelType.EXPERIMENT, airavataExperimentId)){
+ experimentCatalog = RegistryFactory.getDefaultRegistry();
+ if (!experimentCatalog.isExist(ExperimentCatalogModelType.EXPERIMENT, airavataExperimentId)){
throw new ExperimentNotFoundException("Requested experiment id " + airavataExperimentId + " does not exist in the system..");
}
- return (Experiment)registry.get(RegistryModelType.EXPERIMENT, airavataExperimentId);
+ return (Experiment) experimentCatalog.get(ExperimentCatalogModelType.EXPERIMENT, airavataExperimentId);
} catch (Exception e) {
logger.error("Error while retrieving the experiment", e);
AiravataSystemException exception = new AiravataSystemException();
@@ -1265,8 +1264,8 @@ public class AiravataServerHandler implements Airavata.Iface {
@Override
public void updateExperiment(String airavataExperimentId, Experiment experiment) throws InvalidRequestException, ExperimentNotFoundException, AiravataClientException, AiravataSystemException, TException {
try {
- registry = RegistryFactory.getDefaultRegistry();
- if (!registry.isExist(RegistryModelType.EXPERIMENT, airavataExperimentId)) {
+ experimentCatalog = RegistryFactory.getDefaultRegistry();
+ if (!experimentCatalog.isExist(ExperimentCatalogModelType.EXPERIMENT, airavataExperimentId)) {
logger.errorId(airavataExperimentId, "Update request failed, Experiment {} doesn't exist.", airavataExperimentId);
throw new ExperimentNotFoundException("Requested experiment id " + airavataExperimentId + " does not exist in the system..");
}
@@ -1275,7 +1274,7 @@ public class AiravataServerHandler implements Airavata.Iface {
ExperimentState experimentState = experimentStatus.getExperimentState();
switch (experimentState){
case CREATED: case VALIDATED:case UNKNOWN:
- registry.update(RegistryModelType.EXPERIMENT, experiment, airavataExperimentId);
+ experimentCatalog.update(ExperimentCatalogModelType.EXPERIMENT, experiment, airavataExperimentId);
logger.infoId(airavataExperimentId, "Successfully updated experiment {} ", experiment.getName());
break;
default:
@@ -1302,8 +1301,8 @@ public class AiravataServerHandler implements Airavata.Iface {
@Override
public void updateExperimentConfiguration(String airavataExperimentId, UserConfigurationData userConfiguration) throws TException {
try {
- registry = RegistryFactory.getDefaultRegistry();
- if (!registry.isExist(RegistryModelType.EXPERIMENT, airavataExperimentId)){
+ experimentCatalog = RegistryFactory.getDefaultRegistry();
+ if (!experimentCatalog.isExist(ExperimentCatalogModelType.EXPERIMENT, airavataExperimentId)){
logger.errorId(airavataExperimentId, "Update experiment configuration failed, experiment {} doesn't exist.", airavataExperimentId);
throw new ExperimentNotFoundException("Requested experiment id " + airavataExperimentId + " does not exist in the system..");
}
@@ -1312,7 +1311,7 @@ public class AiravataServerHandler implements Airavata.Iface {
ExperimentState experimentState = experimentStatus.getExperimentState();
switch (experimentState){
case CREATED: case VALIDATED: case CANCELED: case FAILED: case UNKNOWN:
- registry.add(ChildDataType.EXPERIMENT_CONFIGURATION_DATA, userConfiguration, airavataExperimentId);
+ experimentCatalog.add(ExpCatChildDataType.EXPERIMENT_CONFIGURATION_DATA, userConfiguration, airavataExperimentId);
logger.infoId(airavataExperimentId, "Successfully updated experiment configuration for experiment {}.", airavataExperimentId);
break;
default:
@@ -1342,8 +1341,8 @@ public class AiravataServerHandler implements Airavata.Iface {
@Override
public void updateResourceScheduleing(String airavataExperimentId, ComputationalResourceScheduling resourceScheduling) throws TException {
try {
- registry = RegistryFactory.getDefaultRegistry();
- if (!registry.isExist(RegistryModelType.EXPERIMENT, airavataExperimentId)){
+ experimentCatalog = RegistryFactory.getDefaultRegistry();
+ if (!experimentCatalog.isExist(ExperimentCatalogModelType.EXPERIMENT, airavataExperimentId)){
logger.infoId(airavataExperimentId, "Update resource scheduling failed, experiment {} doesn't exist.", airavataExperimentId);
throw new ExperimentNotFoundException("Requested experiment id " + airavataExperimentId + " does not exist in the system..");
}
@@ -1352,7 +1351,7 @@ public class AiravataServerHandler implements Airavata.Iface {
ExperimentState experimentState = experimentStatus.getExperimentState();
switch (experimentState){
case CREATED: case VALIDATED: case CANCELED: case FAILED: case UNKNOWN:
- registry.add(ChildDataType.COMPUTATIONAL_RESOURCE_SCHEDULING, resourceScheduling, airavataExperimentId);
+ experimentCatalog.add(ExpCatChildDataType.COMPUTATIONAL_RESOURCE_SCHEDULING, resourceScheduling, airavataExperimentId);
logger.infoId(airavataExperimentId, "Successfully updated resource scheduling for the experiment {}.", airavataExperimentId);
break;
default:
@@ -1393,8 +1392,8 @@ public class AiravataServerHandler implements Airavata.Iface {
@Override
public boolean validateExperiment(String airavataExperimentId) throws InvalidRequestException, ExperimentNotFoundException, AiravataClientException, AiravataSystemException, TException {
try {
- registry = RegistryFactory.getDefaultRegistry();
- if (!registry.isExist(RegistryModelType.EXPERIMENT, airavataExperimentId)) {
+ experimentCatalog = RegistryFactory.getDefaultRegistry();
+ if (!experimentCatalog.isExist(ExperimentCatalogModelType.EXPERIMENT, airavataExperimentId)) {
logger.errorId(airavataExperimentId, "Experiment validation failed , experiment {} doesn't exist.", airavataExperimentId);
throw new ExperimentNotFoundException("Requested experiment id " + airavataExperimentId + " does not exist in the system..");
}
@@ -1453,13 +1452,13 @@ public class AiravataServerHandler implements Airavata.Iface {
AiravataSystemException,
TException {
try {
- registry = RegistryFactory.getDefaultRegistry();
- if (!registry.isExist(RegistryModelType.EXPERIMENT, airavataExperimentId)){
+ experimentCatalog = RegistryFactory.getDefaultRegistry();
+ if (!experimentCatalog.isExist(ExperimentCatalogModelType.EXPERIMENT, airavataExperimentId)){
logger.errorId(airavataExperimentId, "Error while retrieving experiment status, experiment {} doesn't exist.", airavataExperimentId);
throw new ExperimentNotFoundException("Requested experiment id " + airavataExperimentId +
" does not exist in the system..");
}
- return (ExperimentStatus)registry.get(RegistryModelType.EXPERIMENT_STATUS, airavataExperimentId);
+ return (ExperimentStatus) experimentCatalog.get(ExperimentCatalogModelType.EXPERIMENT_STATUS, airavataExperimentId);
} catch (Exception e) {
logger.errorId(airavataExperimentId, "Error while retrieving the experiment status", e);
AiravataSystemException exception = new AiravataSystemException();
@@ -1472,12 +1471,12 @@ public class AiravataServerHandler implements Airavata.Iface {
@Override
public List<OutputDataObjectType> getExperimentOutputs(String airavataExperimentId) throws TException {
try {
- registry = RegistryFactory.getDefaultRegistry();
- if (!registry.isExist(RegistryModelType.EXPERIMENT, airavataExperimentId)){
+ experimentCatalog = RegistryFactory.getDefaultRegistry();
+ if (!experimentCatalog.isExist(ExperimentCatalogModelType.EXPERIMENT, airavataExperimentId)){
logger.errorId(airavataExperimentId, "Get experiment outputs failed, experiment {} doesn't exit.", airavataExperimentId);
throw new ExperimentNotFoundException("Requested experiment id " + airavataExperimentId + " does not exist in the system..");
}
- return (List<OutputDataObjectType>)registry.get(RegistryModelType.EXPERIMENT_OUTPUT, airavataExperimentId);
+ return (List<OutputDataObjectType>) experimentCatalog.get(ExperimentCatalogModelType.EXPERIMENT_OUTPUT, airavataExperimentId);
} catch (Exception e) {
logger.errorId(airavataExperimentId, "Error while retrieving the experiment outputs", e);
AiravataSystemException exception = new AiravataSystemException();
@@ -1495,20 +1494,20 @@ public class AiravataServerHandler implements Airavata.Iface {
public Map<String, JobStatus> getJobStatuses(String airavataExperimentId) throws TException {
Map<String, JobStatus> jobStatus = new HashMap<String, JobStatus>();
try {
- registry = RegistryFactory.getDefaultRegistry();
- if (!registry.isExist(RegistryModelType.EXPERIMENT, airavataExperimentId)){
+ experimentCatalog = RegistryFactory.getDefaultRegistry();
+ if (!experimentCatalog.isExist(ExperimentCatalogModelType.EXPERIMENT, airavataExperimentId)){
logger.errorId(airavataExperimentId, "Error while retrieving job status, the experiment {} doesn't exist.", airavataExperimentId);
throw new ExperimentNotFoundException("Requested experiment id " + airavataExperimentId + " does not exist in the system..");
}
- List<Object> workflowNodes = registry.get(RegistryModelType.WORKFLOW_NODE_DETAIL, Constants.FieldConstants.WorkflowNodeConstants.EXPERIMENT_ID, airavataExperimentId);
+ List<Object> workflowNodes = experimentCatalog.get(ExperimentCatalogModelType.WORKFLOW_NODE_DETAIL, Constants.FieldConstants.WorkflowNodeConstants.EXPERIMENT_ID, airavataExperimentId);
if (workflowNodes != null && !workflowNodes.isEmpty()){
for (Object wf : workflowNodes){
String nodeInstanceId = ((WorkflowNodeDetails) wf).getNodeInstanceId();
- List<Object> taskDetails = registry.get(RegistryModelType.TASK_DETAIL, Constants.FieldConstants.TaskDetailConstants.NODE_ID, nodeInstanceId);
+ List<Object> taskDetails = experimentCatalog.get(ExperimentCatalogModelType.TASK_DETAIL, Constants.FieldConstants.TaskDetailConstants.NODE_ID, nodeInstanceId);
if (taskDetails != null && !taskDetails.isEmpty()){
for (Object ts : taskDetails){
String taskID = ((TaskDetails) ts).getTaskID();
- List<Object> jobDetails = registry.get(RegistryModelType.JOB_DETAIL, Constants.FieldConstants.JobDetaisConstants.TASK_ID, taskID);
+ List<Object> jobDetails = experimentCatalog.get(ExperimentCatalogModelType.JOB_DETAIL, Constants.FieldConstants.JobDetaisConstants.TASK_ID, taskID);
if (jobDetails != null && !jobDetails.isEmpty()){
for (Object job : jobDetails){
String jobID = ((JobDetails) job).getJobID();
@@ -1533,20 +1532,20 @@ public class AiravataServerHandler implements Airavata.Iface {
public List<JobDetails> getJobDetails(String airavataExperimentId) throws InvalidRequestException, ExperimentNotFoundException, AiravataClientException, AiravataSystemException, TException {
List<JobDetails> jobDetailsList = new ArrayList<JobDetails>();
try {
- registry = RegistryFactory.getDefaultRegistry();
- if (!registry.isExist(RegistryModelType.EXPERIMENT, airavataExperimentId)){
+ experimentCatalog = RegistryFactory.getDefaultRegistry();
+ if (!experimentCatalog.isExist(ExperimentCatalogModelType.EXPERIMENT, airavataExperimentId)){
logger.errorId(airavataExperimentId, "Error while retrieving job details, experiment {} doesn't exist.", airavataExperimentId);
throw new ExperimentNotFoundException("Requested experiment id " + airavataExperimentId + " does not exist in the system..");
}
- List<Object> workflowNodes = registry.get(RegistryModelType.WORKFLOW_NODE_DETAIL, Constants.FieldConstants.WorkflowNodeConstants.EXPERIMENT_ID, airavataExperimentId);
+ List<Object> workflowNodes = experimentCatalog.get(ExperimentCatalogModelType.WORKFLOW_NODE_DETAIL, Constants.FieldConstants.WorkflowNodeConstants.EXPERIMENT_ID, airavataExperimentId);
if (workflowNodes != null && !workflowNodes.isEmpty()){
for (Object wf : workflowNodes){
String nodeInstanceId = ((WorkflowNodeDetails) wf).getNodeInstanceId();
- List<Object> taskDetails = registry.get(RegistryModelType.TASK_DETAIL, Constants.FieldConstants.TaskDetailConstants.NODE_ID, nodeInstanceId);
+ List<Object> taskDetails = experimentCatalog.get(ExperimentCatalogModelType.TASK_DETAIL, Constants.FieldConstants.TaskDetailConstants.NODE_ID, nodeInstanceId);
if (taskDetails != null && !taskDetails.isEmpty()){
for (Object ts : taskDetails){
String taskID = ((TaskDetails) ts).getTaskID();
- List<Object> jobDetails = registry.get(RegistryModelType.JOB_DETAIL, Constants.FieldConstants.JobDetaisConstants.TASK_ID, taskID);
+ List<Object> jobDetails = experimentCatalog.get(ExperimentCatalogModelType.JOB_DETAIL, Constants.FieldConstants.JobDetaisConstants.TASK_ID, taskID);
if (jobDetails != null && !jobDetails.isEmpty()){
for (Object job : jobDetails){
jobDetailsList.add((JobDetails) job);
@@ -1570,20 +1569,20 @@ public class AiravataServerHandler implements Airavata.Iface {
public List<DataTransferDetails> getDataTransferDetails(String airavataExperimentId) throws InvalidRequestException, ExperimentNotFoundException, AiravataClientException, AiravataSystemException, TException {
List<DataTransferDetails> dataTransferDetailList = new ArrayList<DataTransferDetails>();
try {
- registry = RegistryFactory.getDefaultRegistry();
- if (!registry.isExist(RegistryModelType.EXPERIMENT, airavataExperimentId)) {
+ experimentCatalog = RegistryFactory.getDefaultRegistry();
+ if (!experimentCatalog.isExist(ExperimentCatalogModelType.EXPERIMENT, airavataExperimentId)) {
logger.errorId(airavataExperimentId, "Error while retrieving data transfer details, experiment {} doesn't exit.", airavataExperimentId);
throw new ExperimentNotFoundException("Requested experiment id " + airavataExperimentId + " does not exist in the system..");
}
- List<Object> workflowNodes = registry.get(RegistryModelType.WORKFLOW_NODE_DETAIL, Constants.FieldConstants.WorkflowNodeConstants.EXPERIMENT_ID, airavataExperimentId);
+ List<Object> workflowNodes = experimentCatalog.get(ExperimentCatalogModelType.WORKFLOW_NODE_DETAIL, Constants.FieldConstants.WorkflowNodeConstants.EXPERIMENT_ID, airavataExperimentId);
if (workflowNodes != null && !workflowNodes.isEmpty()){
for (Object wf : workflowNodes){
String nodeInstanceId = ((WorkflowNodeDetails) wf).getNodeInstanceId();
- List<Object> taskDetails = registry.get(RegistryModelType.TASK_DETAIL, Constants.FieldConstants.TaskDetailConstants.NODE_ID, nodeInstanceId);
+ List<Object> taskDetails = experimentCatalog.get(ExperimentCatalogModelType.TASK_DETAIL, Constants.FieldConstants.TaskDetailConstants.NODE_ID, nodeInstanceId);
if (taskDetails != null && !taskDetails.isEmpty()){
for (Object ts : taskDetails){
String taskID = ((TaskDetails) ts).getTaskID();
- List<Object> dataTransferDetails = registry.get(RegistryModelType.DATA_TRANSFER_DETAIL, Constants.FieldConstants.JobDetaisConstants.TASK_ID, taskID);
+ List<Object> dataTransferDetails = experimentCatalog.get(ExperimentCatalogModelType.DATA_TRANSFER_DETAIL, Constants.FieldConstants.JobDetaisConstants.TASK_ID, taskID);
if (dataTransferDetails != null && !dataTransferDetails.isEmpty()){
for (Object dataTransfer : dataTransferDetails){
dataTransferDetailList.add((DataTransferDetails) dataTransfer);
@@ -1641,8 +1640,8 @@ public class AiravataServerHandler implements Airavata.Iface {
@Override
public void launchExperiment(final String airavataExperimentId, String airavataCredStoreToken) throws TException {
try {
- registry = RegistryFactory.getDefaultRegistry();
- if (!registry.isExist(RegistryModelType.EXPERIMENT, airavataExperimentId)) {
+ experimentCatalog = RegistryFactory.getDefaultRegistry();
+ if (!experimentCatalog.isExist(ExperimentCatalogModelType.EXPERIMENT, airavataExperimentId)) {
logger.errorId(airavataExperimentId, "Error while launching experiment, experiment {} doesn't exist.", airavataExperimentId);
throw new ExperimentNotFoundException("Requested experiment id " + airavataExperimentId + " does not exist in the system..");
}
@@ -1718,13 +1717,13 @@ public class AiravataServerHandler implements Airavata.Iface {
@Override
public String cloneExperiment(String existingExperimentID, String newExperiementName) throws InvalidRequestException, ExperimentNotFoundException, AiravataClientException, AiravataSystemException, TException {
try {
- registry = RegistryFactory.getDefaultRegistry();
- if (!registry.isExist(RegistryModelType.EXPERIMENT, existingExperimentID)){
+ experimentCatalog = RegistryFactory.getDefaultRegistry();
+ if (!experimentCatalog.isExist(ExperimentCatalogModelType.EXPERIMENT, existingExperimentID)){
logger.errorId(existingExperimentID, "Error while cloning experiment {}, experiment doesn't exist.", existingExperimentID);
throw new ExperimentNotFoundException("Requested experiment id " + existingExperimentID + " does not exist in the system..");
}
- Experiment existingExperiment = (Experiment)registry.get(RegistryModelType.EXPERIMENT, existingExperimentID);
- String gatewayId = (String)registry.getValue(RegistryModelType.EXPERIMENT, existingExperimentID, Constants.FieldConstants.ExperimentConstants.GATEWAY);
+ Experiment existingExperiment = (Experiment) experimentCatalog.get(ExperimentCatalogModelType.EXPERIMENT, existingExperimentID);
+ String gatewayId = (String) experimentCatalog.getValue(ExperimentCatalogModelType.EXPERIMENT, existingExperimentID, Constants.FieldConstants.ExperimentConstants.GATEWAY);
existingExperiment.setCreationTime(AiravataUtils.getCurrentTimestamp().getTime());
if (existingExperiment.getApplicationId() != null){
List<OutputDataObjectType> applicationOutputs = getApplicationOutputs(existingExperiment.getApplicationId());
@@ -1739,7 +1738,7 @@ public class AiravataServerHandler implements Airavata.Iface {
if (existingExperiment.getErrors() != null ){
existingExperiment.getErrors().clear();
}
- return (String)registry.add(ParentDataType.EXPERIMENT, existingExperiment, gatewayId);
+ return (String) experimentCatalog.add(ExpCatParentDataType.EXPERIMENT, existingExperiment, gatewayId);
} catch (Exception e) {
logger.errorId(existingExperimentID, "Error while cloning the experiment with existing configuration...", e);
AiravataSystemException exception = new AiravataSystemException();
@@ -1773,7 +1772,7 @@ public class AiravataServerHandler implements Airavata.Iface {
@Override
public void terminateExperiment(String airavataExperimentId, String tokenId) throws InvalidRequestException, ExperimentNotFoundException, AiravataClientException, AiravataSystemException, TException {
try {
- if (!(registry.isExist(RegistryModelType.EXPERIMENT, airavataExperimentId))){
+ if (!(experimentCatalog.isExist(ExperimentCatalogModelType.EXPERIMENT, airavataExperimentId))){
logger.error("Experiment does not exist.Please provide a valid experiment id...");
throw new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
}
@@ -3482,14 +3481,14 @@ public class AiravataServerHandler implements Airavata.Iface {
@Override
public boolean deleteProject(String projectId) throws InvalidRequestException, AiravataClientException, AiravataSystemException, ProjectNotFoundException, TException {
try {
- registry = RegistryFactory.getDefaultRegistry();
- if (!registry.isExist(RegistryModelType.PROJECT, projectId)){
+ experimentCatalog = RegistryFactory.getDefaultRegistry();
+ if (!experimentCatalog.isExist(ExperimentCatalogModelType.PROJECT, projectId)){
logger.error("Project does not exist in the system. Please provide a valid project ID...");
ProjectNotFoundException exception = new ProjectNotFoundException();
exception.setMessage("Project does not exist in the system. Please provide a valid project ID...");
throw exception;
}
- registry.remove(RegistryModelType.PROJECT, projectId);
+ experimentCatalog.remove(ExperimentCatalogModelType.PROJECT, projectId);
return true;
} catch (RegistryException e) {
logger.error("Error while removing the project", e);
[29/52] [abbrv] [partial] airavata git commit: registry refactoring
Posted by sh...@apache.org.
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/ConfigDataResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/ConfigDataResource.java b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/ConfigDataResource.java
deleted file mode 100644
index 7038ede..0000000
--- a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/ConfigDataResource.java
+++ /dev/null
@@ -1,194 +0,0 @@
-/*
- *
- * 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.experiment.catalog.resources;
-
-import org.apache.airavata.experiment.catalog.Resource;
-import org.apache.airavata.experiment.catalog.ResourceType;
-import org.apache.airavata.experiment.catalog.ResourceUtils;
-import org.apache.airavata.experiment.catalog.model.ExperimentConfigData;
-import org.apache.airavata.registry.cpi.RegistryException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.persistence.EntityManager;
-import java.util.List;
-
-public class ConfigDataResource extends AbstractResource {
- private static final Logger logger = LoggerFactory.getLogger(ConfigDataResource.class);
- private String experimentId;
- private boolean airavataAutoSchedule;
- private boolean overrideManualParams;
- private boolean shareExp;
- private String userDn;
- private boolean generateCert;
- private ComputationSchedulingResource computationSchedulingResource;
- private AdvanceInputDataHandlingResource advanceInputDataHandlingResource;
- private AdvancedOutputDataHandlingResource advancedOutputDataHandlingResource;
- private QosParamResource qosParamResource;
-
- public ComputationSchedulingResource getComputationSchedulingResource() {
- return computationSchedulingResource;
- }
-
- public void setComputationSchedulingResource(ComputationSchedulingResource computationSchedulingResource) {
- this.computationSchedulingResource = computationSchedulingResource;
- }
-
- public AdvanceInputDataHandlingResource getAdvanceInputDataHandlingResource() {
- return advanceInputDataHandlingResource;
- }
-
- public void setAdvanceInputDataHandlingResource(AdvanceInputDataHandlingResource advanceInputDataHandlingResource) {
- this.advanceInputDataHandlingResource = advanceInputDataHandlingResource;
- }
-
- public AdvancedOutputDataHandlingResource getAdvancedOutputDataHandlingResource() {
- return advancedOutputDataHandlingResource;
- }
-
- public void setAdvancedOutputDataHandlingResource(AdvancedOutputDataHandlingResource advancedOutputDataHandlingResource) {
- this.advancedOutputDataHandlingResource = advancedOutputDataHandlingResource;
- }
-
- public QosParamResource getQosParamResource() {
- return qosParamResource;
- }
-
- public void setQosParamResource(QosParamResource qosParamResource) {
- this.qosParamResource = qosParamResource;
- }
-
- public String getUserDn() {
- return userDn;
- }
-
- public void setUserDn(String userDn) {
- this.userDn = userDn;
- }
-
- public boolean isGenerateCert() {
- return generateCert;
- }
-
- public void setGenerateCert(boolean generateCert) {
- this.generateCert = generateCert;
- }
-
- public String getExperimentId() {
- return experimentId;
- }
-
- public void setExperimentId(String experimentId) {
- this.experimentId = experimentId;
- }
-
- public boolean isAiravataAutoSchedule() {
- return airavataAutoSchedule;
- }
-
- public void setAiravataAutoSchedule(boolean airavataAutoSchedule) {
- this.airavataAutoSchedule = airavataAutoSchedule;
- }
-
- public boolean isOverrideManualParams() {
- return overrideManualParams;
- }
-
- public void setOverrideManualParams(boolean overrideManualParams) {
- this.overrideManualParams = overrideManualParams;
- }
-
- public boolean isShareExp() {
- return shareExp;
- }
-
- public void setShareExp(boolean shareExp) {
- this.shareExp = shareExp;
- }
-
-
- public Resource create(ResourceType type) throws RegistryException {
- logger.error("Unsupported resource type for config data resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
-
- public void remove(ResourceType type, Object name) throws RegistryException{
- logger.error("Unsupported resource type for config data resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
-
- public Resource get(ResourceType type, Object name) throws RegistryException{
- logger.error("Unsupported resource type for config data resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
-
- public List<Resource> get(ResourceType type) throws RegistryException{
- logger.error("Unsupported resource type for config data resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
-
- public void save() throws RegistryException{
- EntityManager em = null;
- try {
- em = ResourceUtils.getEntityManager();
- ExperimentConfigData existingConfig = em.find(ExperimentConfigData.class, experimentId);
- em.close();
-
- em = ResourceUtils.getEntityManager();
- em.getTransaction().begin();
- ExperimentConfigData configData = new ExperimentConfigData();
- configData.setExpId(experimentId);
- configData.setAiravataAutoSchedule(airavataAutoSchedule);
- configData.setOverrideManualParams(overrideManualParams);
- configData.setShareExp(shareExp);
- configData.setUserDn(userDn);
- configData.setGenerateCert(generateCert);
- if (existingConfig != null) {
- existingConfig.setExpId(experimentId);
- existingConfig.setAiravataAutoSchedule(airavataAutoSchedule);
- existingConfig.setOverrideManualParams(overrideManualParams);
- existingConfig.setShareExp(shareExp);
- existingConfig.setUserDn(userDn);
- existingConfig.setGenerateCert(generateCert);
- configData = em.merge(existingConfig);
- } else {
- em.persist(configData);
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new RegistryException(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/ec8c6202/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/ConfigurationResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/ConfigurationResource.java b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/ConfigurationResource.java
deleted file mode 100644
index a6e9d5e..0000000
--- a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/ConfigurationResource.java
+++ /dev/null
@@ -1,204 +0,0 @@
-/*
- *
- * 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.experiment.catalog.resources;
-
-import java.sql.Timestamp;
-import java.util.List;
-
-import javax.persistence.EntityManager;
-
-import org.apache.airavata.experiment.catalog.Resource;
-import org.apache.airavata.experiment.catalog.ResourceType;
-import org.apache.airavata.experiment.catalog.ResourceUtils;
-import org.apache.airavata.experiment.catalog.model.Configuration;
-import org.apache.airavata.experiment.catalog.model.Configuration_PK;
-import org.apache.airavata.registry.cpi.RegistryException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class ConfigurationResource extends AbstractResource {
- private final static Logger logger = LoggerFactory.getLogger(ConfigurationResource.class);
- private String configKey;
- private String configVal;
- private Timestamp expireDate;
- private String categoryID = ConfigurationConstants.CATEGORY_ID_DEFAULT_VALUE;
-
- public ConfigurationResource() {
- }
-
- /**
- * @param configKey configuration key
- * @param configVal configuration value
- */
- public ConfigurationResource(String configKey, String configVal) {
- this.configKey = configKey;
- this.configVal = configVal;
- }
-
- /**
- * Since Configuration does not depend on any other data structures at the
- * system, this method is not valid
- *
- * @param type child resource types
- * @return UnsupportedOperationException
- */
- public Resource create(ResourceType type) throws RegistryException {
- logger.error("Unsupported operation for configuration resource " +
- "since there are no child resources generated by configuration resource.. ",
- new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
- /**
- * Since Configuration does not depend on any other data structures at the
- * system, this method is not valid
- *
- * @param type child resource types
- * @param name name of the child resource
- * throws UnsupportedOperationException
- */
- public void remove(ResourceType type, Object name) throws RegistryException {
- logger.error("Unsupported operation for configuration resource " +
- "since there are no child resources generated by configuration resource.. ",
- new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
-
- /**
- * Since Configuration does not depend on any other data structures at the
- * system, this method is not valid
- *
- * @param type child resource types
- * @param name name of the child resource
- * @return UnsupportedOperationException
- */
- public Resource get(ResourceType type, Object name) throws RegistryException {
- logger.error("Unsupported operation for configuration resource " +
- "since there are no child resources generated by configuration resource.. ",
- new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
- /**
- * Since Configuration does not depend on any other data structures at the
- * system, this method is not valid
- *
- * @param type child resource types
- * @return UnsupportedOperationException
- */
- public List<Resource> get(ResourceType type) throws RegistryException {
- logger.error("Unsupported operation for configuration resource " +
- "since there are no child resources generated by configuration resource.. ",
- new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
- /**
- * @param expireDate expire date of the configuration
- */
- public void setExpireDate(Timestamp expireDate) {
- this.expireDate = expireDate;
- }
-
- /**
- * save configuration to database
- */
- public synchronized void save() throws RegistryException {
- EntityManager em = null;
- try {
- em = ResourceUtils.getEntityManager();
- //whether existing
- Configuration existing = em.find(Configuration.class, new Configuration_PK(configKey, configVal, categoryID));
- em.close();
- em = ResourceUtils.getEntityManager();
- em.getTransaction().begin();
- Configuration configuration = new Configuration();
- configuration.setConfig_key(configKey);
- configuration.setConfig_val(configVal);
- configuration.setExpire_date(expireDate);
- configuration.setCategory_id(categoryID);
- if (existing != null) {
- existing.setExpire_date(expireDate);
- existing.setCategory_id(categoryID);
- configuration = em.merge(existing);
- } else {
- em.persist(configuration);
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new RegistryException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- /**
- * Since Configuration does not depend on any other data structures at the
- * system, this method is not valid
- *
- * @param type child resource types
- * @param name of the child resource
- * @return UnsupportedOperationException
- */
- public boolean isExists(ResourceType type, Object name) {
- logger.error("Unsupported operation for configuration resource " +
- "since there are no child resources generated by configuration resource.. ",
- new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
- /**
- * @return configuration value
- */
- public String getConfigVal() {
- return configVal;
- }
-
- /**
- * @param configKey configuration key
- */
- public void setConfigKey(String configKey) {
- this.configKey = configKey;
- }
-
- /**
- * @param configVal configuration value
- */
- public void setConfigVal(String configVal) {
- this.configVal = configVal;
- }
-
- public String getCategoryID() {
- return categoryID;
- }
-
- public void setCategoryID(String categoryID) {
- this.categoryID = categoryID;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/DataTransferDetailResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/DataTransferDetailResource.java b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/DataTransferDetailResource.java
deleted file mode 100644
index 5e48333..0000000
--- a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/DataTransferDetailResource.java
+++ /dev/null
@@ -1,276 +0,0 @@
-/*
- *
- * 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.experiment.catalog.resources;
-
-import org.apache.airavata.experiment.catalog.Resource;
-import org.apache.airavata.experiment.catalog.ResourceType;
-import org.apache.airavata.experiment.catalog.ResourceUtils;
-import org.apache.airavata.experiment.catalog.model.DataTransferDetail;
-import org.apache.airavata.experiment.catalog.model.Status;
-import org.apache.airavata.experiment.catalog.utils.QueryGenerator;
-import org.apache.airavata.registry.cpi.RegistryException;
-import org.apache.airavata.registry.cpi.utils.StatusType;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.persistence.EntityManager;
-import javax.persistence.Query;
-import java.sql.Timestamp;
-import java.util.ArrayList;
-import java.util.List;
-
-public class DataTransferDetailResource extends AbstractResource {
- private static final Logger logger = LoggerFactory.getLogger(DataTransferDetailResource.class);
- private String transferId;
- private String taskId;
- private Timestamp creationTime;
- private String transferDescription;
- private StatusResource datatransferStatus;
-
- public StatusResource getDatatransferStatus() {
- return datatransferStatus;
- }
-
- public void setDatatransferStatus(StatusResource datatransferStatus) {
- this.datatransferStatus = datatransferStatus;
- }
-
- public String getTransferId() {
- return transferId;
- }
-
- public void setTransferId(String transferId) {
- this.transferId = transferId;
- }
-
- public Timestamp getCreationTime() {
- return creationTime;
- }
-
- public void setCreationTime(Timestamp creationTime) {
- this.creationTime = creationTime;
- }
-
- public String getTransferDescription() {
- return transferDescription;
- }
-
- public void setTransferDescription(String transferDescription) {
- this.transferDescription = transferDescription;
- }
-
- public String getTaskId() {
- return taskId;
- }
-
- public void setTaskId(String taskId) {
- this.taskId = taskId;
- }
-
- public Resource create(ResourceType type) throws RegistryException {
- switch (type){
- case STATUS:
- StatusResource statusResource = new StatusResource();
- statusResource.setTransferId(transferId);
- return statusResource;
- default:
- logger.error("Unsupported resource type for data transfer details data resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
- }
-
-
- public void remove(ResourceType type, Object name) throws RegistryException {
- EntityManager em = null;
- try {
- em = ResourceUtils.getEntityManager();
- em.getTransaction().begin();
- Query q;
- QueryGenerator generator;
- switch (type) {
- case STATUS:
- generator = new QueryGenerator(STATUS);
- generator.setParameter(StatusConstants.TRANSFER_ID, name);
- generator.setParameter(StatusConstants.STATUS_TYPE, StatusType.DATA_TRANSFER);
- q = generator.deleteQuery(em);
- q.executeUpdate();
- break;
- default:
- logger.error("Unsupported resource type for data transfer details resource.", new IllegalArgumentException());
- break;
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new RegistryException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
-
- public Resource get(ResourceType type, Object name) throws RegistryException{
- EntityManager em = null;
- try {
- em = ResourceUtils.getEntityManager();
- em.getTransaction().begin();
- QueryGenerator generator;
- Query q;
- switch (type) {
- case STATUS:
- generator = new QueryGenerator(STATUS);
- generator.setParameter(StatusConstants.TRANSFER_ID, name);
- generator.setParameter(StatusConstants.STATUS_TYPE, StatusType.DATA_TRANSFER);
- q = generator.selectQuery(em);
- Status status = (Status) q.getSingleResult();
- StatusResource statusResource = (StatusResource) Utils.getResource(ResourceType.STATUS, status);
- em.getTransaction().commit();
- em.close();
- return statusResource;
- default:
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported resource type for data transfer details resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported resource type for data transfer details resource.");
- }
- } catch (Exception e) {
- throw new RegistryException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
-
- public List<Resource> get(ResourceType type) throws RegistryException{
- List<Resource> resourceList = new ArrayList<Resource>();
- EntityManager em = null;
- try {
- em = ResourceUtils.getEntityManager();
- em.getTransaction().begin();
- Query q;
- QueryGenerator generator;
- List results;
- switch (type) {
- case STATUS:
- generator = new QueryGenerator(STATUS);
- generator.setParameter(StatusConstants.TRANSFER_ID, transferId);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- Status status = (Status) result;
- StatusResource statusResource =
- (StatusResource) Utils.getResource(ResourceType.STATUS, status);
- resourceList.add(statusResource);
- }
- }
- break;
- default:
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported resource type for workflow node details resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new RegistryException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- return resourceList;
- }
-
-
- public void save() throws RegistryException{
- EntityManager em = null;
- try {
- em = ResourceUtils.getEntityManager();
- DataTransferDetail existingDF = em.find(DataTransferDetail.class, transferId);
- em.close();
-
- em = ResourceUtils.getEntityManager();
- em.getTransaction().begin();
- DataTransferDetail dataTransferDetail = new DataTransferDetail();
- dataTransferDetail.setTransferId(transferId);
- dataTransferDetail.setTaskId(taskId);
- dataTransferDetail.setCreationTime(creationTime);
- if (transferDescription != null) {
- dataTransferDetail.setTransferDesc(transferDescription.toCharArray());
- }
- if (existingDF != null) {
- existingDF.setTransferId(transferId);
- existingDF.setTaskId(taskId);
- existingDF.setCreationTime(creationTime);
- if (transferDescription != null) {
- existingDF.setTransferDesc(transferDescription.toCharArray());
- }
- dataTransferDetail = em.merge(existingDF);
- } else {
- em.persist(dataTransferDetail);
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new RegistryException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- public StatusResource getDataTransferStatus () throws RegistryException{
- List<Resource> resources = get(ResourceType.STATUS);
- for (Resource resource : resources) {
- StatusResource dataTransferStatus = (StatusResource) resource;
- if(dataTransferStatus.getStatusType().equals(StatusType.DATA_TRANSFER.toString())){
- if (dataTransferStatus.getState() == null || dataTransferStatus.getState().equals("") ){
- dataTransferStatus.setState("UNKNOWN");
- }
- return dataTransferStatus;
- }
- }
- return null;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/ErrorDetailResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/ErrorDetailResource.java b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/ErrorDetailResource.java
deleted file mode 100644
index f2426fc..0000000
--- a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/ErrorDetailResource.java
+++ /dev/null
@@ -1,215 +0,0 @@
-/*
- *
- * 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.experiment.catalog.resources;
-
-import org.apache.airavata.experiment.catalog.Resource;
-import org.apache.airavata.experiment.catalog.ResourceType;
-import org.apache.airavata.experiment.catalog.ResourceUtils;
-import org.apache.airavata.experiment.catalog.model.ErrorDetail;
-import org.apache.airavata.registry.cpi.RegistryException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.persistence.EntityManager;
-import java.sql.Timestamp;
-import java.util.List;
-
-public class ErrorDetailResource extends AbstractResource {
- private static final Logger logger = LoggerFactory.getLogger(ErrorDetailResource.class);
- private int errorId;
- private String experimentId;
- private String taskId;
- private String nodeId;
- private Timestamp creationTime;
- private String actualErrorMsg;
- private String userFriendlyErrorMsg;
- private boolean transientPersistent;
- private String errorCategory;
- private String correctiveAction;
- private String actionableGroup;
- private String jobId;
-
- public int getErrorId() {
- return errorId;
- }
-
- public void setErrorId(int errorId) {
- this.errorId = errorId;
- }
-
- public Timestamp getCreationTime() {
- return creationTime;
- }
-
- public void setCreationTime(Timestamp creationTime) {
- this.creationTime = creationTime;
- }
-
- public String getActualErrorMsg() {
- return actualErrorMsg;
- }
-
- public void setActualErrorMsg(String actualErrorMsg) {
- this.actualErrorMsg = actualErrorMsg;
- }
-
- public String getUserFriendlyErrorMsg() {
- return userFriendlyErrorMsg;
- }
-
- public String getExperimentId() {
- return experimentId;
- }
-
- public void setExperimentId(String experimentId) {
- this.experimentId = experimentId;
- }
-
- public String getTaskId() {
- return taskId;
- }
-
- public void setTaskId(String taskId) {
- this.taskId = taskId;
- }
-
- public String getNodeId() {
- return nodeId;
- }
-
- public void setNodeId(String nodeId) {
- this.nodeId = nodeId;
- }
-
- public void setUserFriendlyErrorMsg(String userFriendlyErrorMsg) {
- this.userFriendlyErrorMsg = userFriendlyErrorMsg;
- }
-
- public boolean isTransientPersistent() {
- return transientPersistent;
- }
-
- public void setTransientPersistent(boolean transientPersistent) {
- this.transientPersistent = transientPersistent;
- }
-
- public String getErrorCategory() {
- return errorCategory;
- }
-
- public void setErrorCategory(String errorCategory) {
- this.errorCategory = errorCategory;
- }
-
- public String getCorrectiveAction() {
- return correctiveAction;
- }
-
- public void setCorrectiveAction(String correctiveAction) {
- this.correctiveAction = correctiveAction;
- }
-
- public String getActionableGroup() {
- return actionableGroup;
- }
-
- public void setActionableGroup(String actionableGroup) {
- this.actionableGroup = actionableGroup;
- }
-
- public String getJobId() {
- return jobId;
- }
-
- public void setJobId(String jobId) {
- this.jobId = jobId;
- }
-
-
- public Resource create(ResourceType type) throws RegistryException {
- logger.error("Unsupported resource type for error details data resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
-
- public void remove(ResourceType type, Object name) throws RegistryException {
- logger.error("Unsupported resource type for error details data resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
-
- public Resource get(ResourceType type, Object name) throws RegistryException{
- logger.error("Unsupported resource type for error details data resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
-
- public List<Resource> get(ResourceType type) throws RegistryException{
- logger.error("Unsupported resource type for error details data resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
-
- public void save() throws RegistryException{
- EntityManager em = null;
- try {
- em = ResourceUtils.getEntityManager();
- em.getTransaction().begin();
- ErrorDetail errorDetail;
- if (errorId != 0) {
- errorDetail = em.find(ErrorDetail.class, errorId);
- errorDetail.setErrorID(errorId);
- } else {
- errorDetail = new ErrorDetail();
- }
- errorDetail.setErrorID(errorId);
- errorDetail.setExpId(experimentId);
- errorDetail.setTaskId(taskId);
- errorDetail.setNodeId(nodeId);
- errorDetail.setCreationTime(creationTime);
- if (actualErrorMsg != null){
- errorDetail.setActualErrorMsg(actualErrorMsg.toCharArray());
- }
-
- errorDetail.setUserFriendlyErrorMsg(userFriendlyErrorMsg);
- errorDetail.setTransientPersistent(transientPersistent);
- errorDetail.setErrorCategory(errorCategory);
- errorDetail.setCorrectiveAction(correctiveAction);
- errorDetail.setActionableGroup(actionableGroup);
- errorDetail.setJobId(jobId);
- em.persist(errorDetail);
- errorId = errorDetail.getErrorID();
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new RegistryException(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/ec8c6202/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/ExperimentInputResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/ExperimentInputResource.java b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/ExperimentInputResource.java
deleted file mode 100644
index edd487b..0000000
--- a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/ExperimentInputResource.java
+++ /dev/null
@@ -1,225 +0,0 @@
-/*
-*
-* 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.experiment.catalog.resources;
-
-import org.apache.airavata.experiment.catalog.Resource;
-import org.apache.airavata.experiment.catalog.ResourceType;
-import org.apache.airavata.experiment.catalog.ResourceUtils;
-import org.apache.airavata.experiment.catalog.model.Experiment_Input;
-import org.apache.airavata.experiment.catalog.model.Experiment_Input_PK;
-import org.apache.airavata.registry.cpi.RegistryException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.persistence.EntityManager;
-import java.util.List;
-
-public class ExperimentInputResource extends AbstractResource {
- private static final Logger logger = LoggerFactory.getLogger(ExperimentInputResource.class);
-
- private String experimentId;
- private String experimentKey;
- private String value;
- private String metadata;
- private String dataType;
- private String appArgument;
- private boolean standardInput;
- private String userFriendlyDesc;
- private int inputOrder;
- private boolean isRequired;
- private boolean requiredToCMD;
- private boolean dataStaged;
-
- public boolean getRequired() {
- return isRequired;
- }
-
- public void setRequired(boolean required) {
- this.isRequired = required;
- }
-
- public boolean getRequiredToCMD() {
- return requiredToCMD;
- }
-
- public void setRequiredToCMD(boolean requiredToCMD) {
- this.requiredToCMD = requiredToCMD;
- }
-
- public boolean isDataStaged() {
- return dataStaged;
- }
-
- public void setDataStaged(boolean dataStaged) {
- this.dataStaged = dataStaged;
- }
-
- public int getInputOrder() {
- return inputOrder;
- }
-
- public void setInputOrder(int inputOrder) {
- this.inputOrder = inputOrder;
- }
-
- public String getAppArgument() {
- return appArgument;
- }
-
- public void setAppArgument(String appArgument) {
- this.appArgument = appArgument;
- }
-
- public boolean isStandardInput() {
- return standardInput;
- }
-
- public void setStandardInput(boolean standardInput) {
- this.standardInput = standardInput;
- }
-
- public String getUserFriendlyDesc() {
- return userFriendlyDesc;
- }
-
- public void setUserFriendlyDesc(String userFriendlyDesc) {
- this.userFriendlyDesc = userFriendlyDesc;
- }
-
- public String getExperimentKey() {
- return experimentKey;
- }
-
- public void setExperimentKey(String experimentKey) {
- this.experimentKey = experimentKey;
- }
-
- public String getValue() {
- return value;
- }
-
- public void setValue(String value) {
- this.value = value;
- }
-
- public String getExperimentId() {
- return experimentId;
- }
-
- public void setExperimentId(String experimentId) {
- this.experimentId = experimentId;
- }
-
- public String getDataType() {
- return dataType;
- }
-
- public void setDataType(String dataType) {
- this.dataType = dataType;
- }
-
- public String getMetadata() {
- return metadata;
- }
-
- public void setMetadata(String metadata) {
- this.metadata = metadata;
- }
-
- public Resource create(ResourceType type) throws RegistryException {
- logger.error("Unsupported resource type for experiment input data resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
- public void remove(ResourceType type, Object name) throws RegistryException{
- logger.error("Unsupported resource type for experiment input data resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
- public Resource get(ResourceType type, Object name) throws RegistryException {
- logger.error("Unsupported resource type for experiment input data resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
- public List<Resource> get(ResourceType type) throws RegistryException {
- logger.error("Unsupported resource type for experiment input data resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
- public void save() throws RegistryException{
- EntityManager em = null;
- try {
- em = ResourceUtils.getEntityManager();
- Experiment_Input existingInput = em.find(Experiment_Input.class, new Experiment_Input_PK(experimentId, experimentKey));
- em.close();
-
- em = ResourceUtils.getEntityManager();
- em.getTransaction().begin();
- Experiment_Input exInput = new Experiment_Input();
- exInput.setEx_key(experimentKey);
- exInput.setExperiment_id(experimentId);
- if (value != null){
- exInput.setValue(value.toCharArray());
- }
- exInput.setDataType(dataType);
- exInput.setMetadata(metadata);
- exInput.setAppArgument(appArgument);
- exInput.setStandardInput(standardInput);
- exInput.setUserFriendlyDesc(userFriendlyDesc);
- exInput.setInputOrder(inputOrder);
- exInput.setRequiredToCMD(requiredToCMD);
- exInput.setRequired(isRequired);
- exInput.setDataStaged(dataStaged);
- if (existingInput != null) {
- existingInput.setEx_key(experimentKey);
- existingInput.setExperiment_id(experimentId);
- if (value != null){
- existingInput.setValue(value.toCharArray());
- }
- existingInput.setDataType(dataType);
- existingInput.setMetadata(metadata);
- existingInput.setAppArgument(appArgument);
- existingInput.setStandardInput(standardInput);
- existingInput.setUserFriendlyDesc(userFriendlyDesc);
- existingInput.setInputOrder(inputOrder);
- existingInput.setRequiredToCMD(requiredToCMD);
- existingInput.setRequired(isRequired);
- existingInput.setDataStaged(dataStaged);
- exInput = em.merge(existingInput);
- } else {
- em.persist(exInput);
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new RegistryException(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/ec8c6202/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/ExperimentOutputResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/ExperimentOutputResource.java b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/ExperimentOutputResource.java
deleted file mode 100644
index 6a11adc..0000000
--- a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/ExperimentOutputResource.java
+++ /dev/null
@@ -1,204 +0,0 @@
-/*
-*
-* 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.experiment.catalog.resources;
-
-import org.apache.airavata.experiment.catalog.Resource;
-import org.apache.airavata.experiment.catalog.ResourceType;
-import org.apache.airavata.experiment.catalog.ResourceUtils;
-import org.apache.airavata.experiment.catalog.model.Experiment_Output;
-import org.apache.airavata.experiment.catalog.model.Experiment_Output_PK;
-import org.apache.airavata.registry.cpi.RegistryException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.persistence.EntityManager;
-import java.util.List;
-
-public class ExperimentOutputResource extends AbstractResource {
- private static final Logger logger = LoggerFactory.getLogger(ExperimentOutputResource.class);
-
- private String experimentId;
- private String experimentKey;
- private String value;
- private String dataType;
- private boolean isRequired;
- private boolean dataMovement;
- private String dataNameLocation;
- private boolean requiredToCMD;
- private String searchQuery;
- private String appArgument;
-
- public String getSearchQuery() {
- return searchQuery;
- }
-
- public void setSearchQuery(String searchQuery) {
- this.searchQuery = searchQuery;
- }
-
- public String getAppArgument() {
- return appArgument;
- }
-
- public void setAppArgument(String appArgument) {
- this.appArgument = appArgument;
- }
-
- public boolean getRequiredToCMD() {
- return requiredToCMD;
- }
-
- public void setRequiredToCMD(boolean requiredToCMD) {
- this.requiredToCMD = requiredToCMD;
- }
-
- public boolean getRequired() {
- return isRequired;
- }
-
- public void setRequired(boolean required) {
- this.isRequired = required;
- }
-
- public boolean isDataMovement() {
- return dataMovement;
- }
-
- public void setDataMovement(boolean dataMovement) {
- this.dataMovement = dataMovement;
- }
-
- public String getDataNameLocation() {
- return dataNameLocation;
- }
-
- public void setDataNameLocation(String dataNameLocation) {
- this.dataNameLocation = dataNameLocation;
- }
-
- public String getExperimentKey() {
- return experimentKey;
- }
-
- public void setExperimentKey(String experimentKey) {
- this.experimentKey = experimentKey;
- }
-
- public String getValue() {
- return value;
- }
-
- public void setValue(String value) {
- this.value = value;
- }
-
- public String getExperimentId() {
- return experimentId;
- }
-
- public void setExperimentId(String experimentId) {
- this.experimentId = experimentId;
- }
-
- public String getDataType() {
- return dataType;
- }
-
- public void setDataType(String dataType) {
- this.dataType = dataType;
- }
-
- public Resource create(ResourceType type) throws RegistryException {
- logger.error("Unsupported resource type for experiment output data resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
- public void remove(ResourceType type, Object name) throws RegistryException{
- logger.error("Unsupported resource type for experiment output data resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
- public Resource get(ResourceType type, Object name) throws RegistryException{
- logger.error("Unsupported resource type for experiment output data resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
- public List<Resource> get(ResourceType type) throws RegistryException {
- logger.error("Unsupported resource type for experiment output data resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
- public void save() throws RegistryException {
- EntityManager em = null;
- try {
- em = ResourceUtils.getEntityManager();
- Experiment_Output existingOutput = em.find(Experiment_Output.class, new Experiment_Output_PK(experimentId, experimentKey));
- em.close();
-
- em = ResourceUtils.getEntityManager();
- em.getTransaction().begin();
- Experiment_Output exOutput = new Experiment_Output();
- exOutput.setEx_key(experimentKey);
- exOutput.setExperiment_id(experimentId);
- if (value != null){
- exOutput.setValue(value.toCharArray());
- }
- exOutput.setDataType(dataType);
- exOutput.setRequired(isRequired);
- exOutput.setRequiredToCMD(requiredToCMD);
- exOutput.setDataMovement(dataMovement);
- exOutput.setDataNameLocation(dataNameLocation);
- exOutput.setApplicationArgument(appArgument);
- exOutput.setSearchQuery(searchQuery);
-
- if (existingOutput != null) {
- existingOutput.setEx_key(experimentKey);
- existingOutput.setExperiment_id(experimentId);
- if (value != null){
- existingOutput.setValue(value.toCharArray());
- }
- existingOutput.setDataType(dataType);
- existingOutput.setRequired(isRequired);
- existingOutput.setRequiredToCMD(requiredToCMD);
- existingOutput.setDataMovement(dataMovement);
- existingOutput.setDataNameLocation(dataNameLocation);
- existingOutput.setApplicationArgument(appArgument);
- existingOutput.setSearchQuery(searchQuery);
- exOutput = em.merge(existingOutput);
- } else {
- em.persist(exOutput);
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new RegistryException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-}
[23/52] [abbrv] [partial] airavata git commit: registry refactoring
Posted by sh...@apache.org.
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/RegistryUseCaseTest.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/RegistryUseCaseTest.java b/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/RegistryUseCaseTest.java
deleted file mode 100644
index d1989bf..0000000
--- a/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/RegistryUseCaseTest.java
+++ /dev/null
@@ -1,296 +0,0 @@
-/*
- *
- * 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.experiment.catalog;
-
-import junit.framework.Assert;
-import org.apache.airavata.common.exception.ApplicationSettingsException;
-import org.apache.airavata.common.utils.ServerSettings;
-import org.apache.airavata.model.appcatalog.appinterface.InputDataObjectType;
-import org.apache.airavata.model.appcatalog.appinterface.OutputDataObjectType;
-import org.apache.airavata.model.workspace.Project;
-import org.apache.airavata.model.workspace.experiment.*;
-import org.apache.airavata.experiment.catalog.impl.RegistryFactory;
-import org.apache.airavata.experiment.catalog.util.Initialize;
-import org.apache.airavata.registry.cpi.*;
-import org.apache.airavata.registry.cpi.utils.Constants;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-import java.sql.SQLException;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.UUID;
-
-/**
- * This class contains test cases for the RegistryImpl class which is the default registry
- * implementation. These test cases are written from the perspective of the Airavata API
- * such as creating/updating/deleting/searching projects and experiments etc.
- */
-public class RegistryUseCaseTest {
-
- private static Registry registry;
- private static Initialize initialize;
-
- @BeforeClass
- public static void setupBeforeClass() throws RegistryException, SQLException {
- initialize = new Initialize("registry-derby.sql");
- initialize.initializeDB();
- registry = RegistryFactory.getDefaultRegistry();
- }
-
- @Test
- public void testProject(){
- try {
- String TAG = System.currentTimeMillis() + "";
-
- String gatewayId = ServerSettings.getDefaultUserGateway();
-
- //testing the creation of a project
- Project project = new Project();
- project.setOwner("TestUser"+TAG);
- project.setName("TestProject"+TAG);
- project.setDescription("This is a test project"+TAG);
- String projectId1 = (String)registry.add(ParentDataType.PROJECT, project, gatewayId);
- Assert.assertNotNull(projectId1);
-
- //testing the update of a project
- Project updatedProject = new Project();
- updatedProject.setProjectID(projectId1);
- updatedProject.setOwner("TestUser"+TAG);
- updatedProject.setName("UpdatedTestProject"+TAG);
- updatedProject.setDescription("This is an updated test project"+TAG);
- registry.update(RegistryModelType.PROJECT, updatedProject, projectId1);
-
- //testing project retrieval
- Project retrievedProject = (Project)registry.get(RegistryModelType.PROJECT, projectId1);
- Assert.assertEquals(updatedProject.getProjectID(), retrievedProject.getProjectID());
- Assert.assertEquals(updatedProject.getOwner(), retrievedProject.getOwner());
- Assert.assertEquals(updatedProject.getName(), retrievedProject.getName());
- Assert.assertEquals(updatedProject.getDescription(), retrievedProject.getDescription());
- Assert.assertNotNull(retrievedProject.getCreationTime());
- //created user should be in the shared users list
- Assert.assertTrue(retrievedProject.getSharedUsers().size()==1);
-
- //creating more projects for the same user
- project = new Project();
- project.setOwner("TestUser"+TAG);
- project.setName("Project Terrible"+TAG);
- project.setDescription("This is a test project_2"+TAG);
- String projectId2 = (String)registry.add(ParentDataType.PROJECT, project, gatewayId);
- Assert.assertNotNull(projectId2);
-
- project = new Project();
- project.setOwner("TestUser"+TAG);
- project.setName("Project Funny"+TAG);
- project.setDescription("This is a test project_3"+TAG);
- String projectId3 = (String)registry.add(ParentDataType.PROJECT, project, gatewayId);
- Assert.assertNotNull(projectId3);
-
- project = new Project();
- project.setOwner("TestUser"+TAG);
- project.setName("Project Stupid"+TAG);
- project.setDescription("This is a test project_4"+TAG);
- String projectId4 = (String)registry.add(ParentDataType.PROJECT, project, gatewayId);
- Assert.assertNotNull(projectId4);
-
- project = new Project();
- project.setOwner("TestUser"+TAG);
- project.setName("Project Boring"+TAG);
- project.setDescription("This is a test project_5"+TAG);
- String projectId5 = (String)registry.add(ParentDataType.PROJECT, project, gatewayId);
- Assert.assertNotNull(projectId5);
-
- //test get all projects created by the user
- List<Object> list = registry.get(RegistryModelType.PROJECT,
- Constants.FieldConstants.ProjectConstants.OWNER, "TestUser"+TAG);
- Assert.assertTrue(list.size()==5);
-
- //search project by project name
- Map<String, String> filters = new HashMap<String, String>();
- filters.put(Constants.FieldConstants.ProjectConstants.OWNER, "TestUser"+TAG);
- filters.put(Constants.FieldConstants.ProjectConstants.PROJECT_NAME, "Terrible"+TAG);
- list = registry.search(RegistryModelType.PROJECT, filters);
- Assert.assertTrue(list.size()==1);
-
- //search project by project description
- filters = new HashMap<String, String>();
- filters.put(Constants.FieldConstants.ProjectConstants.OWNER, "TestUser"+TAG);
- filters.put(Constants.FieldConstants.ProjectConstants.DESCRIPTION, "test project_2"+TAG);
- list = registry.search(RegistryModelType.PROJECT, filters);
- Assert.assertTrue(list.size()==1);
-
- //search project with only ownername
- filters = new HashMap<String, String>();
- filters.put(Constants.FieldConstants.ProjectConstants.OWNER, "TestUser"+TAG);
- list = registry.search(RegistryModelType.PROJECT, filters);
- Assert.assertTrue(list.size()==5);
-
- //search projects with pagination
- filters = new HashMap<String, String>();
- filters.put(Constants.FieldConstants.ProjectConstants.OWNER, "TestUser"+TAG);
- list = registry.search(RegistryModelType.PROJECT, filters, 2, 2,
- Constants.FieldConstants.ProjectConstants.CREATION_TIME, ResultOrderType.DESC);
- Assert.assertTrue(list.size()==2);
- Project project1 = (Project)list.get(0);
- Project project2 = (Project)list.get(1);
- Assert.assertTrue(project1.getCreationTime()-project2.getCreationTime() > 0);
- } catch (RegistryException e) {
- e.printStackTrace();
- Assert.fail();
- } catch (ApplicationSettingsException e) {
- e.printStackTrace();
- }
- }
-
- @Test
- public void testExperiment(){
- try {
- long time = System.currentTimeMillis();
- String TAG = time + "";
-
- String gatewayId = ServerSettings.getDefaultUserGateway();
-
- //creating project
- Project project = new Project();
- project.setOwner("TestUser"+TAG);
- project.setName("TestProject"+TAG);
- project.setDescription("This is a test project"+TAG);
- String projectId1 = (String)registry.add(ParentDataType.PROJECT, project, gatewayId);
- Assert.assertNotNull(projectId1);
-
- //creating sample echo experiment. assumes echo application is already defined
- InputDataObjectType inputDataObjectType = new InputDataObjectType();
- inputDataObjectType.setName("Input_to_Echo");
- inputDataObjectType.setValue("Hello World");
-
- ComputationalResourceScheduling scheduling = new ComputationalResourceScheduling();
- scheduling.setResourceHostId(UUID.randomUUID().toString());
- scheduling.setComputationalProjectAccount("TG-STA110014S");
- scheduling.setTotalCPUCount(1);
- scheduling.setNodeCount(1);
- scheduling.setWallTimeLimit(15);
- scheduling.setQueueName("normal");
-
- UserConfigurationData userConfigurationData = new UserConfigurationData();
- userConfigurationData.setAiravataAutoSchedule(false);
- userConfigurationData.setOverrideManualScheduledParams(false);
- userConfigurationData.setComputationalResourceScheduling(scheduling);
-
- Experiment experiment = new Experiment();
- experiment.setProjectID(projectId1);
- experiment.setUserName("TestUser" + TAG);
- experiment.setName("TestExperiment"+TAG);
- experiment.setDescription("Test 1 experiment");
- experiment.setApplicationId(UUID.randomUUID().toString());
- experiment.setUserConfigurationData(userConfigurationData);
- experiment.addToExperimentInputs(inputDataObjectType);
-
- String experimentId1 = (String)registry.add(ParentDataType.EXPERIMENT, experiment, gatewayId);
- Assert.assertNotNull(experimentId1);
-
- //retrieving the stored experiment
- Experiment retrievedExperiment = (Experiment)registry.get(RegistryModelType.EXPERIMENT,
- experimentId1);
- Assert.assertNotNull(retrievedExperiment);
- Assert.assertEquals(retrievedExperiment.getProjectID(), experiment.getProjectID());
- Assert.assertEquals(retrievedExperiment.getDescription(), experiment.getDescription());
- Assert.assertEquals(retrievedExperiment.getName(), experiment.getName());
- Assert.assertEquals(retrievedExperiment.getApplicationId(), experiment.getApplicationId());
- Assert.assertNotNull(retrievedExperiment.getUserConfigurationData());
- Assert.assertNotNull(retrievedExperiment.getExperimentInputs());
-
- //updating an existing experiment
- experiment.setName("NewExperimentName"+TAG);
- OutputDataObjectType outputDataObjectType = new OutputDataObjectType();
- outputDataObjectType.setName("Output_to_Echo");
- outputDataObjectType.setValue("Hello World");
- experiment.addToExperimentOutputs(outputDataObjectType);
- registry.update(RegistryModelType.EXPERIMENT, experiment, experimentId1);
-
- //creating more experiments
- experiment = new Experiment();
- experiment.setProjectID(projectId1);
- experiment.setUserName("TestUser" + TAG);
- experiment.setName("TestExperiment2" + TAG);
- experiment.setDescription("Test 2 experiment");
- experiment.setApplicationId(UUID.randomUUID().toString());
- experiment.setUserConfigurationData(userConfigurationData);
- experiment.addToExperimentInputs(inputDataObjectType);
-
- String experimentId2 = (String)registry.add(ParentDataType.EXPERIMENT, experiment, gatewayId);
- Assert.assertNotNull(experimentId2);
-
- experiment = new Experiment();
- experiment.setProjectID(projectId1);
- experiment.setUserName("TestUser" + TAG);
- experiment.setName("TestExperiment3"+TAG);
- experiment.setDescription("Test 3 experiment");
- experiment.setApplicationId(UUID.randomUUID().toString());
- experiment.setUserConfigurationData(userConfigurationData);
- experiment.addToExperimentInputs(inputDataObjectType);
-
- String experimentId3 = (String)registry.add(ParentDataType.EXPERIMENT, experiment, gatewayId);
- Assert.assertNotNull(experimentId3);
-
- //searching experiments by
- Map<String, String> filters = new HashMap<String, String>();
- filters.put(Constants.FieldConstants.ExperimentConstants.USER_NAME, "TestUser" + TAG);
- filters.put(Constants.FieldConstants.ExperimentConstants.GATEWAY, gatewayId);
- filters.put(Constants.FieldConstants.ExperimentConstants.EXPERIMENT_NAME, "Experiment2");
- filters.put(Constants.FieldConstants.ExperimentConstants.EXPERIMENT_STATUS, ExperimentState.CREATED.toString());
- filters.put(Constants.FieldConstants.ExperimentConstants.FROM_DATE, time - 999999999 + "");
- filters.put(Constants.FieldConstants.ExperimentConstants.TO_DATE, time + 999999999 + "");
- List<Object> results = registry.search(RegistryModelType.EXPERIMENT, filters);
- Assert.assertTrue(results.size()==1);
-
- //retrieving all experiments in project
- List<Object> list = registry.get(RegistryModelType.EXPERIMENT,
- Constants.FieldConstants.ExperimentConstants.PROJECT_ID, projectId1);
- Assert.assertTrue(list.size()==3);
-
- //searching all user experiments
- filters = new HashMap();
- filters.put(Constants.FieldConstants.ExperimentConstants.USER_NAME, "TestUser" + TAG);
- filters.put(Constants.FieldConstants.ExperimentConstants.GATEWAY, gatewayId);
- list = registry.search(RegistryModelType.EXPERIMENT, filters);
- Assert.assertTrue(list.size()==3);
-
- //searching user experiments with pagination
- filters = new HashMap();
- filters.put(Constants.FieldConstants.ExperimentConstants.USER_NAME, "TestUser" + TAG);
- filters.put(Constants.FieldConstants.ExperimentConstants.GATEWAY, gatewayId);
- list = registry.search(RegistryModelType.EXPERIMENT, filters, 2, 1,
- Constants.FieldConstants.ExperimentConstants.CREATION_TIME, ResultOrderType.DESC);
- Assert.assertTrue(list.size()==2);
- ExperimentSummary exp1 = (ExperimentSummary)list.get(0);
- ExperimentSummary exp2 = (ExperimentSummary)list.get(1);
- Assert.assertTrue(exp1.getCreationTime()-exp2.getCreationTime() > 0);
-
- } catch (RegistryException e) {
- e.printStackTrace();
- Assert.fail();
- } catch (ApplicationSettingsException e) {
- e.printStackTrace();
- }
- }
-
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/TaskDetailResourceTest.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/TaskDetailResourceTest.java b/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/TaskDetailResourceTest.java
deleted file mode 100644
index 916f03e..0000000
--- a/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/TaskDetailResourceTest.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/**
- * 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.experiment.catalog;
-
-import static org.junit.Assert.*;
-
-import java.sql.Timestamp;
-import java.util.Date;
-
-import org.apache.airavata.experiment.catalog.resources.ExperimentResource;
-import org.apache.airavata.experiment.catalog.resources.TaskDetailResource;
-import org.apache.airavata.experiment.catalog.resources.WorkflowNodeDetailResource;
-import org.junit.Before;
-import org.junit.Test;
-
-public class TaskDetailResourceTest extends AbstractResourceTest{
-
- private ExperimentResource experimentResource;
- private TaskDetailResource taskDetailResource;
- private WorkflowNodeDetailResource nodeDetailResource;
- private String experimentID = "testExpID";
- private String applicationID = "testAppID";
- private String taskID = "testTask";
- private String nodeID = "testNode";
-
-
- @Before
- public void setUp() throws Exception {
- super.setUp();
- Timestamp creationTime = new Timestamp(new Date().getTime());
-
- experimentResource = (ExperimentResource) getGatewayResource().create(ResourceType.EXPERIMENT);
- experimentResource.setExpID(experimentID);
- experimentResource.setExecutionUser(getWorkerResource().getUser());
- experimentResource.setProjectId(getProjectResource().getId());
- experimentResource.setCreationTime(creationTime);
- experimentResource.save();
-
- nodeDetailResource = (WorkflowNodeDetailResource) experimentResource.create(ResourceType.WORKFLOW_NODE_DETAIL);
- nodeDetailResource.setExperimentId(experimentResource.getExpID());
- nodeDetailResource.setNodeInstanceId(nodeID);
- nodeDetailResource.setNodeName(nodeID);
- nodeDetailResource.setCreationTime(creationTime);
- nodeDetailResource.save();
-
- taskDetailResource = (TaskDetailResource)nodeDetailResource.create(ResourceType.TASK_DETAIL);
- taskDetailResource.setNodeId(nodeDetailResource.getNodeInstanceId());
- taskDetailResource.setTaskId(taskID);
- taskDetailResource.setApplicationId(applicationID);
- taskDetailResource.setApplicationVersion("1.0");
- taskDetailResource.setCreationTime(creationTime);
- taskDetailResource.save();
- }
-
-
- @Test
- public void testCreate() throws Exception {
- assertNotNull("task data resource has being created ", taskDetailResource);
- }
-
- @Test
- public void testSave() throws Exception {
- assertTrue("task save successfully", nodeDetailResource.isExists(ResourceType.TASK_DETAIL, taskID));
- }
-
- @Test
- public void testGet() throws Exception {
- assertNotNull("task data retrieved successfully", nodeDetailResource.get(ResourceType.TASK_DETAIL, taskID));
- }
-
- @Test
- public void testRemove() throws Exception {
- nodeDetailResource.remove(ResourceType.TASK_DETAIL, taskID);
- assertFalse("task data removed successfully", nodeDetailResource.isExists(ResourceType.TASK_DETAIL, taskID));
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/UserResourceTest.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/UserResourceTest.java b/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/UserResourceTest.java
deleted file mode 100644
index dfd45b1..0000000
--- a/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/UserResourceTest.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
-*
-* 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.experiment.catalog;
-
-import static org.junit.Assert.*;
-
-import org.apache.airavata.experiment.catalog.resources.GatewayResource;
-import org.apache.airavata.experiment.catalog.resources.UserResource;
-import org.junit.After;
-import org.junit.Test;
-
-public class UserResourceTest extends AbstractResourceTest {
- private UserResource userResource;
- private GatewayResource gatewayResource;
- private String userName = "testUser";
-
- @Override
- public void setUp() throws Exception {
- super.setUp();
- gatewayResource = super.getGatewayResource();
- userResource = super.getUserResource();
- userResource.setUserName(userName);
- userResource.setPassword("testPassword");
- userResource.save();
- }
-
- @Test
- public void testSave() throws Exception {
- assertTrue("user resource saved successfully", gatewayResource.isExists(ResourceType.USER, "admin"));
- }
-
- @After
- public void tearDown() throws Exception {
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/WorkerResourceTest.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/WorkerResourceTest.java b/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/WorkerResourceTest.java
deleted file mode 100644
index 8a9caee..0000000
--- a/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/WorkerResourceTest.java
+++ /dev/null
@@ -1,122 +0,0 @@
-///*
-//*
-//* 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.experiment.registry.jpa;
-//
-//import org.apache.airavata.experiment.registry.jpa.resources.*;
-//
-//import java.sql.Timestamp;
-//import java.util.Calendar;
-//
-//public class WorkerResourceTest extends AbstractResourceTest {
-// private GatewayResource gatewayResource;
-// private WorkerResource workerResource;
-// private ProjectResource testProject;
-// private UserWorkflowResource userWorkflowResource;
-// private ExperimentMetadataResource experimentResource;
-//
-// @Override
-// public void setUp() throws Exception {
-// super.setUp();
-// gatewayResource = super.getGatewayResource();
-// workerResource = super.getWorkerResource();
-//
-// testProject = workerResource.createProject("testProject");
-// userWorkflowResource = workerResource.createWorkflowTemplate("workflow1");
-// experimentResource = (ExperimentMetadataResource) workerResource.create(ResourceType.EXPERIMENT_METADATA);
-//
-// testProject.setGateway(gatewayResource);
-// testProject.save();
-//
-// userWorkflowResource.setGateway(gatewayResource);
-// userWorkflowResource.setContent("testContent");
-// userWorkflowResource.save();
-//
-// experimentResource.setGateway(gatewayResource);
-// experimentResource.setExpID("testExpID");
-// experimentResource.setExperimentName("testExpID");
-// experimentResource.setProject(testProject);
-// experimentResource.setExecutionUser(workerResource.getUser());
-// experimentResource.setSubmittedDate(getCurrentTimestamp());
-// experimentResource.save();
-//
-//
-// }
-//
-// public void testCreate() throws Exception {
-// assertNotNull("project resource created successfully", testProject);
-// assertNotNull("user workflow created successfully", userWorkflowResource);
-// }
-//
-// public void testGet() throws Exception {
-// assertNotNull("project resource retrieved successfully", workerResource.get(ResourceType.PROJECT, "testProject"));
-// assertNotNull("user workflow retrieved successfully", workerResource.get(ResourceType.USER_WORKFLOW, "workflow1"));
-// assertNotNull("experiment retrieved successfully", workerResource.get(ResourceType.EXPERIMENT_METADATA, "testExpID"));
-// }
-//
-// public void testGetList() throws Exception {
-// assertNotNull("project resources retrieved successfully", workerResource.get(ResourceType.PROJECT));
-// assertNotNull("user workflows retrieved successfully", workerResource.get(ResourceType.USER_WORKFLOW));
-// assertNotNull("experiments retrieved successfully", workerResource.get(ResourceType.EXPERIMENT_METADATA));
-//
-// }
-//
-// public void testSave() throws Exception {
-// workerResource.save();
-// assertTrue("worker resource saved successfully", gatewayResource.isExists(ResourceType.USER, "admin"));
-// //remove
-//// ResourceUtils.removeGatewayWorker(gatewayResource, userResource);
-//// gatewayResource.remove(ResourceType.USER, "testUser");
-// }
-//
-// public void testRemove() throws Exception {
-// workerResource.removeWorkflowTemplate("workflow1");
-//// workerResource.removeExperiment("testExpID");
-//// workerResource.removeProject("testProject");
-//
-// assertTrue("user workflow has been removed successfully", !workerResource.isWorkflowTemplateExists("workflow1"));
-//// assertTrue("experiment has been removed successfully", !workerResource.isExperimentExists("testExpID"));
-//
-//// assertTrue("project has been removed successfully", !workerResource.isProjectExists("testProject"));
-//
-//
-//// testProject.setGateway(gatewayResource);
-//// testProject.save();
-////
-//// userWorkflowResource.setGateway(gatewayResource);
-//// userWorkflowResource.setContent("testContent");
-//// userWorkflowResource.save();
-////
-//// experimentResource.setGateway(gatewayResource);
-//// experimentResource.setExpID("testExpID");
-//// experimentResource.setProject(testProject);
-//// experimentResource.setSubmittedDate(getCurrentTimestamp());
-//// experimentResource.save();
-//
-// }
-//
-// @Override
-// public void tearDown() throws Exception {
-// super.tearDown();
-// }
-//
-//
-//}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/WorkflowDataResourceTest.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/WorkflowDataResourceTest.java b/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/WorkflowDataResourceTest.java
deleted file mode 100644
index 7aac186..0000000
--- a/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/WorkflowDataResourceTest.java
+++ /dev/null
@@ -1,106 +0,0 @@
-///*
-//*
-//* 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.experiment.registry.jpa;
-//
-//import org.apache.airavata.experiment.registry.jpa.resources.*;
-//
-//import java.sql.Timestamp;
-//import java.util.Calendar;
-//
-//public class WorkflowDataResourceTest extends AbstractResourceTest {
-// private ExperimentMetadataResource experimentResource;
-// private WorkflowDataResource workflowDataResource;
-// private NodeDataResource nodeDataResource;
-// private GramDataResource gramDataResource;
-//
-// @Override
-// public void setUp() throws Exception {
-// super.setUp();
-// GatewayResource gatewayResource = super.getGatewayResource();
-// WorkerResource workerResource = super.getWorkerResource();
-//
-// experimentResource = (ExperimentMetadataResource) gatewayResource.create(ResourceType.EXPERIMENT_METADATA);
-// experimentResource.setExpID("testExpID");
-// experimentResource.setExperimentName("testExpID");
-// experimentResource.setExecutionUser(workerResource.getUser());
-// experimentResource.setProject(new ProjectResource(workerResource, gatewayResource, "testProject"));
-// experimentResource.save();
-//
-// workflowDataResource = (WorkflowDataResource) experimentResource.create(ResourceType.WORKFLOW_DATA);
-// workflowDataResource.setWorkflowInstanceID("testWFInstance");
-// workflowDataResource.setTemplateName("testTemplate");
-// workflowDataResource.setExperimentID("testExpID");
-// Calendar calender = Calendar.getInstance();
-// java.util.Date d = calender.getTime();
-// Timestamp timestamp = new Timestamp(d.getTime());
-// workflowDataResource.setLastUpdatedTime(timestamp);
-// workflowDataResource.save();
-//
-// nodeDataResource = workflowDataResource.createNodeData("testNodeID");
-// gramDataResource = workflowDataResource.createGramData("testNodeID");
-//
-// nodeDataResource.setWorkflowDataResource(workflowDataResource);
-// nodeDataResource.setInputs("testInput");
-// nodeDataResource.setOutputs("testOutput");
-// nodeDataResource.setStatus("testStatus");
-// nodeDataResource.save();
-//
-// gramDataResource.setRsl("testRSL");
-// gramDataResource.setWorkflowDataResource(workflowDataResource);
-// gramDataResource.save();
-// }
-//
-// public void testCreate() throws Exception {
-// assertNotNull("node data resource created successfully", nodeDataResource);
-// assertNotNull("gram data resource created successfully", gramDataResource);
-// }
-//
-// public void testGet() throws Exception {
-// assertNotNull("Node data retrieved successfully", workflowDataResource.getNodeData("testNodeID"));
-// assertNotNull("Gram data retrieved successfully", workflowDataResource.getGramData("testNodeID"));
-// }
-//
-// public void testGetList() throws Exception {
-// assertNotNull("Node data retrieved successfully", workflowDataResource.getNodeData());
-// assertNotNull("Gram data retrieved successfully", workflowDataResource.getGramData());
-// }
-//
-// public void testRemove() throws Exception {
-// workflowDataResource.removeNodeData("testNodeID");
-// workflowDataResource.removeGramData("testNodeID");
-//
-// assertTrue("node date removed successfully", !workflowDataResource.isNodeExists("testNodeID"));
-// assertTrue("gram date removed successfully", !workflowDataResource.isGramDataExists("testNodeID"));
-//
-// }
-//
-// public void testSave() throws Exception {
-// assertTrue("workflow data saved successfully", experimentResource.isExists(ResourceType.WORKFLOW_DATA, "testWFInstance"));
-// }
-//
-// @Override
-// public void tearDown() throws Exception {
-// super.tearDown();
-// }
-//
-//
-//}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/WorkflowNodeDetailResourceTest.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/WorkflowNodeDetailResourceTest.java b/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/WorkflowNodeDetailResourceTest.java
deleted file mode 100644
index 37b98cb..0000000
--- a/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/WorkflowNodeDetailResourceTest.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/**
- * 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.experiment.catalog;
-
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-import java.sql.Timestamp;
-import java.util.Date;
-
-import org.apache.airavata.experiment.catalog.resources.ExperimentResource;
-import org.apache.airavata.experiment.catalog.resources.WorkflowNodeDetailResource;
-import org.junit.Before;
-import org.junit.Test;
-
-public class WorkflowNodeDetailResourceTest extends AbstractResourceTest {
-
- private ExperimentResource experimentResource;
- private WorkflowNodeDetailResource nodeDetailResource;
- private String experimentID = "testExpID";
- private String applicationID = "testAppID";
- private String nodeID = "testNode";
-
- @Before
- public void setUp() throws Exception {
- super.setUp();
- Timestamp creationTime = new Timestamp(new Date().getTime());
-
- experimentResource = (ExperimentResource) getGatewayResource().create(ResourceType.EXPERIMENT);
- experimentResource.setExpID(experimentID);
- experimentResource.setExecutionUser(getWorkerResource().getUser());
- experimentResource.setProjectId(getProjectResource().getId());
- experimentResource.setCreationTime(creationTime);
- experimentResource.setApplicationId(applicationID);
- experimentResource.save();
-
- nodeDetailResource = (WorkflowNodeDetailResource) experimentResource.create(ResourceType.WORKFLOW_NODE_DETAIL);
- nodeDetailResource.setExperimentId(experimentResource.getExpID());
- nodeDetailResource.setNodeInstanceId(nodeID);
- nodeDetailResource.setNodeName(nodeID);
- nodeDetailResource.setCreationTime(creationTime);
- nodeDetailResource.save();
-
- }
-
- @Test
- public void testCreate() throws Exception {
- assertNotNull("task data resource has being created ", nodeDetailResource);
- }
-
- @Test
- public void testSave() throws Exception {
- assertTrue("task save successfully", experimentResource.isExists(ResourceType.WORKFLOW_NODE_DETAIL, nodeID));
- }
-
- @Test
- public void testGet() throws Exception {
- assertNotNull("task data retrieved successfully", experimentResource.get(ResourceType.WORKFLOW_NODE_DETAIL, nodeID));
- }
-
- @Test
- public void testRemove() throws Exception {
- experimentResource.remove(ResourceType.WORKFLOW_NODE_DETAIL, nodeID);
- assertFalse("task data removed successfully", experimentResource.isExists(ResourceType.WORKFLOW_NODE_DETAIL, nodeID));
- }
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/util/Initialize.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/util/Initialize.java b/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/util/Initialize.java
deleted file mode 100644
index dfae817..0000000
--- a/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/util/Initialize.java
+++ /dev/null
@@ -1,333 +0,0 @@
-/*
- *
- * 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.experiment.catalog.util;
-
-import org.apache.airavata.common.exception.ApplicationSettingsException;
-import org.apache.airavata.common.utils.ServerSettings;
-import org.apache.airavata.experiment.catalog.ResourceType;
-import org.apache.airavata.experiment.catalog.resources.GatewayResource;
-import org.apache.airavata.experiment.catalog.resources.ProjectResource;
-import org.apache.airavata.experiment.catalog.resources.UserResource;
-import org.apache.airavata.experiment.catalog.resources.Utils;
-import org.apache.airavata.experiment.catalog.resources.WorkerResource;
-import org.apache.airavata.registry.cpi.RegistryException;
-import org.apache.derby.drda.NetworkServerControl;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.net.InetAddress;
-import java.sql.*;
-import java.util.StringTokenizer;
-
-public class Initialize {
- private static final Logger logger = LoggerFactory.getLogger(Initialize.class);
- public static final String DERBY_SERVER_MODE_SYS_PROPERTY = "derby.drda.startNetworkServer";
- public String scriptName = "registry-derby.sql";
- private NetworkServerControl server;
- private static final String delimiter = ";";
- public static final String PERSISTANT_DATA = "Configuration";
-
- public Initialize(String scriptName) {
- this.scriptName = scriptName;
- }
-
- public static boolean checkStringBufferEndsWith(StringBuffer buffer, String suffix) {
- if (suffix.length() > buffer.length()) {
- return false;
- }
- // this loop is done on purpose to avoid memory allocation performance
- // problems on various JDKs
- // StringBuffer.lastIndexOf() was introduced in jdk 1.4 and
- // implementation is ok though does allocation/copying
- // StringBuffer.toString().endsWith() does massive memory
- // allocation/copying on JDK 1.5
- // See http://issues.apache.org/bugzilla/show_bug.cgi?id=37169
- int endIndex = suffix.length() - 1;
- int bufferIndex = buffer.length() - 1;
- while (endIndex >= 0) {
- if (buffer.charAt(bufferIndex) != suffix.charAt(endIndex)) {
- return false;
- }
- bufferIndex--;
- endIndex--;
- }
- return true;
- }
-
- private static boolean isServerStarted(NetworkServerControl server, int ntries)
- {
- for (int i = 1; i <= ntries; i ++)
- {
- try {
- Thread.sleep(500);
- server.ping();
- return true;
- }
- catch (Exception e) {
- if (i == ntries)
- return false;
- }
- }
- return false;
- }
-
- public void initializeDB() throws SQLException{
- String jdbcUrl = null;
- String jdbcUser = null;
- String jdbcPassword = null;
- try{
- jdbcUrl = ServerSettings.getSetting("registry.jdbc.url");
- jdbcUser = ServerSettings.getSetting("registry.jdbc.user");
- jdbcPassword = ServerSettings.getSetting("registry.jdbc.password");
- jdbcUrl = jdbcUrl + "?" + "user=" + jdbcUser + "&" + "password=" + jdbcPassword;
- } catch (ApplicationSettingsException e) {
- logger.error("Unable to read properties", e);
- }
- startDerbyInServerMode();
- if(!isServerStarted(server, 20)){
- throw new RuntimeException("Derby server cound not started within five seconds...");
- }
-
- Connection conn = null;
- try {
- Class.forName(Utils.getJDBCDriver()).newInstance();
- conn = DriverManager.getConnection(jdbcUrl, jdbcUser, jdbcPassword);
- if (!isDatabaseStructureCreated(PERSISTANT_DATA, conn)) {
- executeSQLScript(conn);
- logger.info("New Database created for Registry");
- } else {
- logger.debug("Database already created for Registry!");
- }
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new RuntimeException("Database failure", e);
- } finally {
- try {
- if (conn != null){
- if (!conn.getAutoCommit()) {
- conn.commit();
- }
- conn.close();
- }
- } catch (SQLException e) {
- logger.error(e.getMessage(), e);
- }
- }
-
- try{
- GatewayResource gatewayResource = new GatewayResource();
- gatewayResource.setGatewayId(ServerSettings.getSetting("default.registry.gateway"));
- gatewayResource.setGatewayName(ServerSettings.getSetting("default.registry.gateway"));
- gatewayResource.setDomain("test-domain");
- gatewayResource.setEmailAddress("test-email");
- gatewayResource.save();
-
- UserResource userResource = new UserResource();
- userResource.setUserName(ServerSettings.getSetting("default.registry.user"));
- userResource.setPassword(ServerSettings.getSetting("default.registry.password"));
- userResource.save();
-
- WorkerResource workerResource = (WorkerResource) gatewayResource.create(ResourceType.GATEWAY_WORKER);
- workerResource.setUser(userResource.getUserName());
- workerResource.save();
-
- ProjectResource projectResource = (ProjectResource)workerResource.create(ResourceType.PROJECT);
- projectResource.setGatewayId(gatewayResource.getGatewayId());
- projectResource.setId("default");
- projectResource.setName("default");
- projectResource.setWorker(workerResource);
- projectResource.save();
-
-
- } catch (ApplicationSettingsException e) {
- logger.error("Unable to read properties", e);
- throw new SQLException(e.getMessage(), e);
- } catch (RegistryException e) {
- logger.error("Unable to save data to registry", e);
- throw new SQLException(e.getMessage(), e);
- }
- }
-
- public static boolean isDatabaseStructureCreated(String tableName, Connection conn) {
- try {
- System.out.println("Running a query to test the database tables existence.");
- // check whether the tables are already created with a query
- Statement statement = null;
- try {
- statement = conn.createStatement();
- ResultSet rs = statement.executeQuery("select * from " + tableName);
- if (rs != null) {
- rs.close();
- }
- } finally {
- try {
- if (statement != null) {
- statement.close();
- }
- } catch (SQLException e) {
- return false;
- }
- }
- } catch (SQLException e) {
- return false;
- }
-
- return true;
- }
-
- private void executeSQLScript(Connection conn) throws Exception {
- StringBuffer sql = new StringBuffer();
- BufferedReader reader = null;
- try{
-
- InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream(scriptName);
- reader = new BufferedReader(new InputStreamReader(inputStream));
- String line;
- while ((line = reader.readLine()) != null) {
- line = line.trim();
- if (line.startsWith("//")) {
- continue;
- }
- if (line.startsWith("--")) {
- continue;
- }
- StringTokenizer st = new StringTokenizer(line);
- if (st.hasMoreTokens()) {
- String token = st.nextToken();
- if ("REM".equalsIgnoreCase(token)) {
- continue;
- }
- }
- sql.append(" ").append(line);
-
- // SQL defines "--" as a comment to EOL
- // and in Oracle it may contain a hint
- // so we cannot just remove it, instead we must end it
- if (line.indexOf("--") >= 0) {
- sql.append("\n");
- }
- if ((checkStringBufferEndsWith(sql, delimiter))) {
- executeSQL(sql.substring(0, sql.length() - delimiter.length()), conn);
- sql.replace(0, sql.length(), "");
- }
- }
- // Catch any statements not followed by ;
- if (sql.length() > 0) {
- executeSQL(sql.toString(), conn);
- }
- }catch (IOException e){
- logger.error("Error occurred while executing SQL script for creating Airavata database", e);
- throw new Exception("Error occurred while executing SQL script for creating Airavata database", e);
- }finally {
- if (reader != null) {
- reader.close();
- }
-
- }
-
- }
-
- private static void executeSQL(String sql, Connection conn) throws Exception {
- // Check and ignore empty statements
- if ("".equals(sql.trim())) {
- return;
- }
-
- Statement statement = null;
- try {
- logger.debug("SQL : " + sql);
-
- boolean ret;
- int updateCount = 0, updateCountTotal = 0;
- statement = conn.createStatement();
- ret = statement.execute(sql);
- updateCount = statement.getUpdateCount();
- do {
- if (!ret) {
- if (updateCount != -1) {
- updateCountTotal += updateCount;
- }
- }
- ret = statement.getMoreResults();
- if (ret) {
- updateCount = statement.getUpdateCount();
- }
- } while (ret);
-
- logger.debug(sql + " : " + updateCountTotal + " rows affected");
-
- SQLWarning warning = conn.getWarnings();
- while (warning != null) {
- logger.warn(warning + " sql warning");
- warning = warning.getNextWarning();
- }
- conn.clearWarnings();
- } catch (SQLException e) {
- if (e.getSQLState().equals("X0Y32")) {
- // eliminating the table already exception for the derby
- // database
- logger.info("Table Already Exists", e);
- } else {
- throw new Exception("Error occurred while executing : " + sql, e);
- }
- } finally {
- if (statement != null) {
- try {
- statement.close();
- } catch (SQLException e) {
- logger.error("Error occurred while closing result set.", e);
- }
- }
- }
- }
-
- private void startDerbyInServerMode() {
- try {
- System.setProperty(DERBY_SERVER_MODE_SYS_PROPERTY, "true");
- server = new NetworkServerControl(InetAddress.getByName(Utils.getHost()),
- 20000,
- Utils.getJDBCUser(), Utils.getJDBCPassword());
- java.io.PrintWriter consoleWriter = new java.io.PrintWriter(System.out, true);
- server.start(consoleWriter);
- } catch (IOException e) {
- logger.error("Unable to start Apache derby in the server mode! Check whether " +
- "specified port is available");
- } catch (Exception e) {
- logger.error("Unable to start Apache derby in the server mode! Check whether " +
- "specified port is available");
- }
-
- }
-
- public void stopDerbyServer() throws SQLException{
- try {
- server.shutdown();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new SQLException("Error while stopping derby server", e);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/experiment-catalog/src/test/resources/registry-derby.sql
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/test/resources/registry-derby.sql b/modules/registry/experiment-catalog/src/test/resources/registry-derby.sql
deleted file mode 100644
index 7ab3755..0000000
--- a/modules/registry/experiment-catalog/src/test/resources/registry-derby.sql
+++ /dev/null
@@ -1,391 +0,0 @@
-/*
- *
- * 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.
- *
- */
-CREATE TABLE GATEWAY
-(
- GATEWAY_ID VARCHAR (255),
- GATEWAY_NAME VARCHAR(255),
- DOMAIN VARCHAR(255),
- EMAIL_ADDRESS VARCHAR(255),
- PRIMARY KEY (GATEWAY_ID)
-);
-
-CREATE TABLE CONFIGURATION
-(
- CONFIG_KEY VARCHAR(255),
- CONFIG_VAL VARCHAR(255),
- EXPIRE_DATE TIMESTAMP DEFAULT '0000-00-00 00:00:00',
- CATEGORY_ID VARCHAR (255),
- PRIMARY KEY(CONFIG_KEY, CONFIG_VAL, CATEGORY_ID)
-);
-
-INSERT INTO CONFIGURATION (CONFIG_KEY, CONFIG_VAL, EXPIRE_DATE, CATEGORY_ID) VALUES('registry.version', '0.15', CURRENT_TIMESTAMP ,'SYSTEM');
-
-CREATE TABLE USERS
-(
- USER_NAME VARCHAR(255),
- PASSWORD VARCHAR(255),
- PRIMARY KEY(USER_NAME)
-);
-
-CREATE TABLE GATEWAY_WORKER
-(
- GATEWAY_ID VARCHAR(255),
- USER_NAME VARCHAR(255),
- PRIMARY KEY (GATEWAY_ID, USER_NAME),
- FOREIGN KEY (GATEWAY_ID) REFERENCES GATEWAY(GATEWAY_ID) ON DELETE CASCADE,
- FOREIGN KEY (USER_NAME) REFERENCES USERS(USER_NAME) ON DELETE CASCADE
-);
-
-CREATE TABLE PROJECT
-(
- GATEWAY_ID VARCHAR(255),
- USER_NAME VARCHAR(255) NOT NULL,
- PROJECT_ID VARCHAR(255),
- PROJECT_NAME VARCHAR(255) NOT NULL,
- DESCRIPTION VARCHAR(255),
- CREATION_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
- PRIMARY KEY (PROJECT_ID),
- FOREIGN KEY (GATEWAY_ID) REFERENCES GATEWAY(GATEWAY_ID) ON DELETE CASCADE,
- FOREIGN KEY (USER_NAME) REFERENCES USERS(USER_NAME) ON DELETE CASCADE
-);
-
-CREATE TABLE PROJECT_USER
-(
- PROJECT_ID VARCHAR(255),
- USER_NAME VARCHAR(255),
- PRIMARY KEY (PROJECT_ID,USER_NAME),
- FOREIGN KEY (PROJECT_ID) REFERENCES PROJECT(PROJECT_ID) ON DELETE CASCADE,
- FOREIGN KEY (USER_NAME) REFERENCES USERS(USER_NAME) ON DELETE CASCADE
-);
-
-CREATE TABLE EXPERIMENT
-(
- EXPERIMENT_ID VARCHAR(255),
- GATEWAY_ID VARCHAR(255),
- EXECUTION_USER VARCHAR(255) NOT NULL,
- PROJECT_ID VARCHAR(255) NOT NULL,
- CREATION_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
- EXPERIMENT_NAME VARCHAR(255) NOT NULL,
- EXPERIMENT_DESCRIPTION VARCHAR(255),
- APPLICATION_ID VARCHAR(255),
- APPLICATION_VERSION VARCHAR(255),
- WORKFLOW_TEMPLATE_ID VARCHAR(255),
- WORKFLOW_TEMPLATE_VERSION VARCHAR(255),
- WORKFLOW_EXECUTION_ID VARCHAR(255),
- ALLOW_NOTIFICATION SMALLINT,
- GATEWAY_EXECUTION_ID VARCHAR(255),
- PRIMARY KEY(EXPERIMENT_ID),
- FOREIGN KEY (GATEWAY_ID) REFERENCES GATEWAY(GATEWAY_ID) ON DELETE CASCADE,
- FOREIGN KEY (EXECUTION_USER) REFERENCES USERS(USER_NAME) ON DELETE CASCADE,
- FOREIGN KEY (PROJECT_ID) REFERENCES PROJECT(PROJECT_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE EXPERIMENT_INPUT
-(
- EXPERIMENT_ID VARCHAR(255),
- INPUT_KEY VARCHAR(255) NOT NULL,
- DATA_TYPE VARCHAR(255),
- METADATA VARCHAR(255),
- APP_ARGUMENT VARCHAR(255),
- STANDARD_INPUT SMALLINT,
- USER_FRIENDLY_DESC VARCHAR(255),
- VALUE CLOB,
- INPUT_ORDER INTEGER,
- IS_REQUIRED SMALLINT,
- REQUIRED_TO_COMMANDLINE SMALLINT,
- DATA_STAGED SMALLINT,
- PRIMARY KEY(EXPERIMENT_ID,INPUT_KEY),
- FOREIGN KEY (EXPERIMENT_ID) REFERENCES EXPERIMENT(EXPERIMENT_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE EXPERIMENT_OUTPUT
-(
- EXPERIMENT_ID VARCHAR(255),
- OUTPUT_KEY VARCHAR(255) NOT NULL,
- DATA_TYPE VARCHAR(255),
- VALUE CLOB,
- IS_REQUIRED SMALLINT,
- REQUIRED_TO_COMMANDLINE SMALLINT,
- DATA_MOVEMENT SMALLINT,
- DATA_NAME_LOCATION VARCHAR(255),
- SEARCH_QUERY VARCHAR(255),
- APP_ARGUMENT VARCHAR(255),
- PRIMARY KEY(EXPERIMENT_ID,OUTPUT_KEY),
- FOREIGN KEY (EXPERIMENT_ID) REFERENCES EXPERIMENT(EXPERIMENT_ID) ON DELETE CASCADE
-);
-
-
-CREATE TABLE WORKFLOW_NODE_DETAIL
-(
- EXPERIMENT_ID VARCHAR(255) NOT NULL,
- NODE_INSTANCE_ID VARCHAR(255),
- CREATION_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
- NODE_NAME VARCHAR(255) NOT NULL,
- EXECUTION_UNIT VARCHAR(255) NOT NULL,
- EXECUTION_UNIT_DATA VARCHAR(255),
- PRIMARY KEY(NODE_INSTANCE_ID),
- FOREIGN KEY (EXPERIMENT_ID) REFERENCES EXPERIMENT(EXPERIMENT_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE TASK_DETAIL
-(
- TASK_ID VARCHAR(255),
- NODE_INSTANCE_ID VARCHAR(255),
- CREATION_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
- APPLICATION_ID VARCHAR(255),
- APPLICATION_VERSION VARCHAR(255),
- APPLICATION_DEPLOYMENT_ID VARCHAR(255),
- ALLOW_NOTIFICATION SMALLINT,
- PRIMARY KEY(TASK_ID),
- FOREIGN KEY (NODE_INSTANCE_ID) REFERENCES WORKFLOW_NODE_DETAIL(NODE_INSTANCE_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE NOTIFICATION_EMAIL
-(
- EMAIL_ID INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY,
- EXPERIMENT_ID VARCHAR(255),
- TASK_ID VARCHAR(255),
- EMAIL_ADDRESS VARCHAR(255),
- PRIMARY KEY(EMAIL_ID),
- FOREIGN KEY (EXPERIMENT_ID) REFERENCES EXPERIMENT(EXPERIMENT_ID) ON DELETE CASCADE,
- FOREIGN KEY (TASK_ID) REFERENCES TASK_DETAIL(TASK_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE ERROR_DETAIL
-(
- ERROR_ID INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY,
- EXPERIMENT_ID VARCHAR(255),
- TASK_ID VARCHAR(255),
- NODE_INSTANCE_ID VARCHAR(255),
- JOB_ID VARCHAR(255),
- CREATION_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
- ACTUAL_ERROR_MESSAGE CLOB,
- USER_FRIEDNLY_ERROR_MSG VARCHAR(255),
- TRANSIENT_OR_PERSISTENT SMALLINT,
- ERROR_CATEGORY VARCHAR(255),
- CORRECTIVE_ACTION VARCHAR(255),
- ACTIONABLE_GROUP VARCHAR(255),
- PRIMARY KEY(ERROR_ID),
- FOREIGN KEY (EXPERIMENT_ID) REFERENCES EXPERIMENT(EXPERIMENT_ID) ON DELETE CASCADE,
- FOREIGN KEY (TASK_ID) REFERENCES TASK_DETAIL(TASK_ID) ON DELETE CASCADE,
- FOREIGN KEY (NODE_INSTANCE_ID) REFERENCES WORKFLOW_NODE_DETAIL(NODE_INSTANCE_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE APPLICATION_INPUT
-(
- TASK_ID VARCHAR(255),
- INPUT_KEY VARCHAR(255) NOT NULL,
- DATA_TYPE VARCHAR(255),
- METADATA VARCHAR(255),
- APP_ARGUMENT VARCHAR(255),
- STANDARD_INPUT SMALLINT,
- USER_FRIENDLY_DESC VARCHAR(255),
- VALUE CLOB,
- INPUT_ORDER INTEGER,
- IS_REQUIRED SMALLINT,
- REQUIRED_TO_COMMANDLINE SMALLINT,
- DATA_STAGED SMALLINT,
- PRIMARY KEY(TASK_ID,INPUT_KEY),
- FOREIGN KEY (TASK_ID) REFERENCES TASK_DETAIL(TASK_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE APPLICATION_OUTPUT
-(
- TASK_ID VARCHAR(255),
- OUTPUT_KEY VARCHAR(255) NOT NULL,
- DATA_TYPE VARCHAR(255),
- VALUE CLOB,
- IS_REQUIRED SMALLINT,
- REQUIRED_TO_COMMANDLINE SMALLINT,
- DATA_MOVEMENT SMALLINT,
- DATA_NAME_LOCATION VARCHAR(255),
- SEARCH_QUERY VARCHAR(255),
- APP_ARGUMENT VARCHAR(255),
- PRIMARY KEY(TASK_ID,OUTPUT_KEY),
- FOREIGN KEY (TASK_ID) REFERENCES TASK_DETAIL(TASK_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE NODE_INPUT
-(
- NODE_INSTANCE_ID VARCHAR(255),
- INPUT_KEY VARCHAR(255) NOT NULL,
- DATA_TYPE VARCHAR(255),
- METADATA VARCHAR(255),
- APP_ARGUMENT VARCHAR(255),
- STANDARD_INPUT SMALLINT,
- USER_FRIENDLY_DESC VARCHAR(255),
- VALUE VARCHAR(255),
- INPUT_ORDER INTEGER,
- IS_REQUIRED SMALLINT,
- REQUIRED_TO_COMMANDLINE SMALLINT,
- DATA_STAGED SMALLINT,
- PRIMARY KEY(NODE_INSTANCE_ID,INPUT_KEY),
- FOREIGN KEY (NODE_INSTANCE_ID) REFERENCES WORKFLOW_NODE_DETAIL(NODE_INSTANCE_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE NODE_OUTPUT
-(
- NODE_INSTANCE_ID VARCHAR(255),
- OUTPUT_KEY VARCHAR(255) NOT NULL,
- DATA_TYPE VARCHAR(255),
- VALUE VARCHAR(255),
- IS_REQUIRED SMALLINT,
- REQUIRED_TO_COMMANDLINE SMALLINT,
- DATA_MOVEMENT SMALLINT,
- DATA_NAME_LOCATION VARCHAR(255),
- SEARCH_QUERY VARCHAR(255),
- APP_ARGUMENT VARCHAR(255),
- PRIMARY KEY(NODE_INSTANCE_ID,OUTPUT_KEY),
- FOREIGN KEY (NODE_INSTANCE_ID) REFERENCES WORKFLOW_NODE_DETAIL(NODE_INSTANCE_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE JOB_DETAIL
-(
- JOB_ID VARCHAR(255),
- TASK_ID VARCHAR(255),
- JOB_DESCRIPTION CLOB NOT NULL,
- CREATION_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
- COMPUTE_RESOURCE_CONSUMED VARCHAR(255),
- JOBNAME VARCHAR (255),
- WORKING_DIR VARCHAR(255),
- PRIMARY KEY (TASK_ID, JOB_ID),
- FOREIGN KEY (TASK_ID) REFERENCES TASK_DETAIL(TASK_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE DATA_TRANSFER_DETAIL
-(
- TRANSFER_ID VARCHAR(255),
- TASK_ID VARCHAR(255),
- CREATION_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
- TRANSFER_DESC VARCHAR(255) NOT NULL,
- PRIMARY KEY(TRANSFER_ID),
- FOREIGN KEY (TASK_ID) REFERENCES TASK_DETAIL(TASK_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE STATUS
-(
- STATUS_ID INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY,
- EXPERIMENT_ID VARCHAR(255),
- NODE_INSTANCE_ID VARCHAR(255),
- TRANSFER_ID VARCHAR(255),
- TASK_ID VARCHAR(255),
- JOB_ID VARCHAR(255),
- STATE VARCHAR(255),
- STATUS_UPDATE_TIME TIMESTAMP DEFAULT '0000-00-00 00:00:00',
- STATUS_TYPE VARCHAR(255),
- PRIMARY KEY(STATUS_ID),
- FOREIGN KEY (EXPERIMENT_ID) REFERENCES EXPERIMENT(EXPERIMENT_ID) ON DELETE CASCADE,
- FOREIGN KEY (TASK_ID) REFERENCES TASK_DETAIL(TASK_ID) ON DELETE CASCADE,
- FOREIGN KEY (NODE_INSTANCE_ID) REFERENCES WORKFLOW_NODE_DETAIL(NODE_INSTANCE_ID) ON DELETE CASCADE,
- FOREIGN KEY (TRANSFER_ID) REFERENCES DATA_TRANSFER_DETAIL(TRANSFER_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE CONFIG_DATA
-(
- EXPERIMENT_ID VARCHAR(255),
- AIRAVATA_AUTO_SCHEDULE SMALLINT NOT NULL,
- OVERRIDE_MANUAL_SCHEDULE_PARAMS SMALLINT NOT NULL,
- SHARE_EXPERIMENT SMALLINT,
- USER_DN VARCHAR(255),
- GENERATE_CERT SMALLINT,
- PRIMARY KEY(EXPERIMENT_ID)
-);
-
-CREATE TABLE COMPUTATIONAL_RESOURCE_SCHEDULING
-(
- RESOURCE_SCHEDULING_ID INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY,
- EXPERIMENT_ID VARCHAR(255),
- TASK_ID VARCHAR(255),
- RESOURCE_HOST_ID VARCHAR(255),
- CPU_COUNT INTEGER,
- NODE_COUNT INTEGER,
- NO_OF_THREADS INTEGER,
- QUEUE_NAME VARCHAR(255),
- WALLTIME_LIMIT INTEGER,
- JOB_START_TIME TIMESTAMP DEFAULT '0000-00-00 00:00:00',
- TOTAL_PHYSICAL_MEMORY INTEGER,
- COMPUTATIONAL_PROJECT_ACCOUNT VARCHAR(255),
- CHESSIS_NAME VARCHAR(255),
- PRIMARY KEY(RESOURCE_SCHEDULING_ID),
- FOREIGN KEY (EXPERIMENT_ID) REFERENCES EXPERIMENT(EXPERIMENT_ID) ON DELETE CASCADE,
- FOREIGN KEY (TASK_ID) REFERENCES TASK_DETAIL(TASK_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE ADVANCE_INPUT_DATA_HANDLING
-(
- INPUT_DATA_HANDLING_ID INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY,
- EXPERIMENT_ID VARCHAR(255),
- TASK_ID VARCHAR(255),
- WORKING_DIR_PARENT VARCHAR(255),
- UNIQUE_WORKING_DIR VARCHAR(255),
- STAGE_INPUT_FILES_TO_WORKING_DIR SMALLINT,
- CLEAN_AFTER_JOB SMALLINT,
- PRIMARY KEY(INPUT_DATA_HANDLING_ID),
- FOREIGN KEY (EXPERIMENT_ID) REFERENCES EXPERIMENT(EXPERIMENT_ID) ON DELETE CASCADE,
- FOREIGN KEY (TASK_ID) REFERENCES TASK_DETAIL(TASK_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE ADVANCE_OUTPUT_DATA_HANDLING
-(
- OUTPUT_DATA_HANDLING_ID INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY,
- EXPERIMENT_ID VARCHAR(255),
- TASK_ID VARCHAR(255),
- OUTPUT_DATA_DIR VARCHAR(255),
- DATA_REG_URL VARCHAR (255),
- PERSIST_OUTPUT_DATA SMALLINT,
- PRIMARY KEY(OUTPUT_DATA_HANDLING_ID),
- FOREIGN KEY (EXPERIMENT_ID) REFERENCES EXPERIMENT(EXPERIMENT_ID) ON DELETE CASCADE,
- FOREIGN KEY (TASK_ID) REFERENCES TASK_DETAIL(TASK_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE QOS_PARAM
-(
- QOS_ID INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY,
- EXPERIMENT_ID VARCHAR(255),
- TASK_ID VARCHAR(255),
- START_EXECUTION_AT VARCHAR(255),
- EXECUTE_BEFORE VARCHAR(255),
- NO_OF_RETRIES INTEGER,
- PRIMARY KEY(QOS_ID),
- FOREIGN KEY (EXPERIMENT_ID) REFERENCES EXPERIMENT(EXPERIMENT_ID) ON DELETE CASCADE,
- FOREIGN KEY (TASK_ID) REFERENCES TASK_DETAIL(TASK_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE COMMUNITY_USER
-(
- GATEWAY_ID VARCHAR(256) NOT NULL,
- COMMUNITY_USER_NAME VARCHAR(256) NOT NULL,
- TOKEN_ID VARCHAR(256) NOT NULL,
- COMMUNITY_USER_EMAIL VARCHAR(256) NOT NULL,
- PRIMARY KEY (GATEWAY_ID, COMMUNITY_USER_NAME, TOKEN_ID)
-);
-
-CREATE TABLE CREDENTIALS
-(
- GATEWAY_ID VARCHAR(256) NOT NULL,
- TOKEN_ID VARCHAR(256) NOT NULL,
- CREDENTIAL BLOB NOT NULL,
- PORTAL_USER_ID VARCHAR(256) NOT NULL,
- TIME_PERSISTED TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
- PRIMARY KEY (GATEWAY_ID, TOKEN_ID)
-);
-
-
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/pom.xml
----------------------------------------------------------------------
diff --git a/modules/registry/pom.xml b/modules/registry/pom.xml
index 055d9f4..0132411 100644
--- a/modules/registry/pom.xml
+++ b/modules/registry/pom.xml
@@ -31,7 +31,7 @@
</activation>
<modules>
<module>registry-cpi</module>
- <module>experiment-catalog</module>
+ <module>registry-core</module>
<!--<module>jpa-gen</module>-->
</modules>
</profile>
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/pom.xml
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/pom.xml b/modules/registry/registry-core/pom.xml
new file mode 100644
index 0000000..b18c93c
--- /dev/null
+++ b/modules/registry/registry-core/pom.xml
@@ -0,0 +1,147 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--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. -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+ <parent>
+ <groupId>org.apache.airavata</groupId>
+ <artifactId>registry</artifactId>
+ <version>0.16-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>airavata-registry-core</artifactId>
+ <packaging>jar</packaging>
+ <name>Airavata Registry Core</name>
+ <url>http://airavata.apache.org/</url>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ </dependency>
+ <!--dependency>
+ <groupId>org.apache.airavata</groupId>
+ <artifactId>airavata-common-utils</artifactId>
+ <version>${project.version}</version>
+ </dependency-->
+ <!-- Test -->
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>jcl-over-slf4j</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.openjpa</groupId>
+ <artifactId>openjpa-all</artifactId>
+ <version>2.2.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.airavata</groupId>
+ <artifactId>airavata-credential-store</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.airavata</groupId>
+ <artifactId>airavata-data-models</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.airavata</groupId>
+ <artifactId>airavata-registry-cpi</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <!--dependency>
+ <groupId>mysql</groupId>
+ <artifactId>mysql-connector-java</artifactId>
+ <version>${mysql.connector.version}</version>
+ </dependency-->
+ <dependency>
+ <groupId>org.apache.derby</groupId>
+ <artifactId>derby</artifactId>
+ <version>${derby.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.derby</groupId>
+ <artifactId>derbyclient</artifactId>
+ <version>${derby.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.derby</groupId>
+ <artifactId>derbynet</artifactId>
+ <version>${derby.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.derby</groupId>
+ <artifactId>derbytools</artifactId>
+ <version>${derby.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.airavata</groupId>
+ <artifactId>airavata-server-configuration</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <version>${antrun.version}</version>
+ <executions>
+ <execution>
+ <phase>process-classes</phase>
+ <configuration>
+ <tasks>
+ <taskdef name="openjpac" classname="org.apache.openjpa.ant.PCEnhancerTask" classpathref="maven.compile.classpath" />
+ <openjpac>
+ <classpath refid="maven.compile.classpath" />
+ </openjpac>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>${surefire.version}</version>
+ <inherited>true</inherited>
+ <configuration>
+ <failIfNoTests>false</failIfNoTests>
+ <skipTests>${skipTests}</skipTests>
+ <workingDirectory>${project.build.testOutputDirectory}</workingDirectory>
+ <!-- making sure that the sure-fire plugin doesn't run the integration tests-->
+ <!-- Integration tests are run using the fail-safe plugin in the module pom-->
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/impl/AppCatalogFactory.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/impl/AppCatalogFactory.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/impl/AppCatalogFactory.java
new file mode 100644
index 0000000..f5107d1
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/impl/AppCatalogFactory.java
@@ -0,0 +1,46 @@
+/*
+ *
+ * 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.impl;
+
+import org.apache.airavata.registry.cpi.AppCatalog;
+import org.apache.airavata.registry.cpi.AppCatalogException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class AppCatalogFactory {
+ private static AppCatalog appCatalog;
+
+ private static Logger logger = LoggerFactory.getLogger(AppCatalogFactory.class);
+
+ public static AppCatalog getAppCatalog() throws AppCatalogException {
+ try {
+ if (appCatalog == null){
+ appCatalog = new AppCatalogImpl();
+ }
+
+ }catch (Exception e){
+ logger.error("Unable to create app catalog instance", e);
+ throw new AppCatalogException(e);
+ }
+ return appCatalog;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/impl/AppCatalogImpl.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/impl/AppCatalogImpl.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/impl/AppCatalogImpl.java
new file mode 100644
index 0000000..1a4e9ce
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/impl/AppCatalogImpl.java
@@ -0,0 +1,52 @@
+/*
+ *
+ * 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.impl;
+
+
+import org.apache.airavata.registry.cpi.*;
+
+public class AppCatalogImpl implements AppCatalog {
+ @Override
+ public ComputeResource getComputeResource() {
+ return new ComputeResourceImpl();
+ }
+
+ @Override
+ public ApplicationInterface getApplicationInterface() {
+ return new ApplicationInterfaceImpl();
+ }
+
+ @Override
+ public ApplicationDeployment getApplicationDeployment() {
+ return new ApplicationDeploymentImpl();
+ }
+
+ @Override
+ public GwyResourceProfile getGatewayProfile() throws AppCatalogException {
+ return new GwyResourceProfileImpl();
+ }
+
+ @Override
+ public WorkflowCatalog getWorkflowCatalog() throws AppCatalogException {
+ return new WorkflowCatalogImpl();
+ }
+}
[16/52] [abbrv] [partial] airavata git commit: registry refactoring
Posted by sh...@apache.org.
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/AppModuleAppCatalogResourceAppCat.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/AppModuleAppCatalogResourceAppCat.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/AppModuleAppCatalogResourceAppCat.java
new file mode 100644
index 0000000..3021cee
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/AppModuleAppCatalogResourceAppCat.java
@@ -0,0 +1,344 @@
+/*
+ *
+ * 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.common.utils.AiravataUtils;
+import org.apache.airavata.registry.core.app.catalog.model.ApplicationModule;
+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.sql.Timestamp;
+import java.util.ArrayList;
+import java.util.List;
+
+public class AppModuleAppCatalogResourceAppCat extends AppCatAbstractResource {
+ private final static Logger logger = LoggerFactory.getLogger(AppModuleAppCatalogResourceAppCat.class);
+ private String moduleId;
+ private String moduleName;
+ private String moduleVersion;
+ private String moduleDesc;
+ private Timestamp createdTime;
+ private Timestamp updatedTime;
+ private String gatewayId;
+
+ public String getGatewayId() {
+ return gatewayId;
+ }
+
+ public void setGatewayId(String gatewayId) {
+ this.gatewayId = gatewayId;
+ }
+
+ public Timestamp getCreatedTime() {
+ return createdTime;
+ }
+
+ public void setCreatedTime(Timestamp createdTime) {
+ this.createdTime = createdTime;
+ }
+
+ public Timestamp getUpdatedTime() {
+ return updatedTime;
+ }
+
+ public void setUpdatedTime(Timestamp updatedTime) {
+ this.updatedTime = updatedTime;
+ }
+
+ public String getModuleId() {
+ return moduleId;
+ }
+
+ public void setModuleId(String moduleId) {
+ this.moduleId = moduleId;
+ }
+
+ public String getModuleName() {
+ return moduleName;
+ }
+
+ public void setModuleName(String moduleName) {
+ this.moduleName = moduleName;
+ }
+
+ public String getModuleVersion() {
+ return moduleVersion;
+ }
+
+ public void setModuleVersion(String moduleVersion) {
+ this.moduleVersion = moduleVersion;
+ }
+
+ public String getModuleDesc() {
+ return moduleDesc;
+ }
+
+ public void setModuleDesc(String moduleDesc) {
+ this.moduleDesc = moduleDesc;
+ }
+
+ @Override
+ public void remove(Object identifier) throws AppCatalogException {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator= new AppCatalogQueryGenerator(APPLICATION_MODULE);
+ generator.setParameter(ApplicationModuleConstants.MODULE_ID, identifier);
+ 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 {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(APPLICATION_MODULE);
+ generator.setParameter(ApplicationModuleConstants.MODULE_ID, identifier);
+ Query q = generator.selectQuery(em);
+ ApplicationModule applicationModule = (ApplicationModule) q.getSingleResult();
+ AppModuleAppCatalogResourceAppCat appModuleResource =
+ (AppModuleAppCatalogResourceAppCat) AppCatalogJPAUtils.getResource(AppCatalogResourceType.APPLICATION_MODULE, applicationModule);
+ em.getTransaction().commit();
+ em.close();
+ return appModuleResource;
+ } 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> moduleResources = new ArrayList<AppCatalogResource>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ Query q;
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(APPLICATION_MODULE);
+ List results;
+ if (fieldName.equals(ApplicationModuleConstants.MODULE_NAME)) {
+ generator.setParameter(ApplicationModuleConstants.MODULE_NAME, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ ApplicationModule applicationModule = (ApplicationModule) result;
+ AppModuleAppCatalogResourceAppCat moduleResource =
+ (AppModuleAppCatalogResourceAppCat) AppCatalogJPAUtils.getResource(AppCatalogResourceType.APPLICATION_MODULE, applicationModule);
+ moduleResources.add(moduleResource);
+ }
+ }
+ } else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for app module resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for app module 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 moduleResources;
+ }
+
+ @Override
+ public List<AppCatalogResource> getAll() throws AppCatalogException {
+ List<AppCatalogResource> appModuleResources = new ArrayList<AppCatalogResource>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(APPLICATION_MODULE);
+ generator.setParameter(ApplicationModuleConstants.GATEWAY_ID, gatewayId);
+ Query q = generator.selectQuery(em);
+ List<?> results = q.getResultList();
+ for (Object result : results) {
+ ApplicationModule module = (ApplicationModule) result;
+ AppModuleAppCatalogResourceAppCat appModuleResource = (AppModuleAppCatalogResourceAppCat) AppCatalogJPAUtils.getResource(AppCatalogResourceType.APPLICATION_MODULE, module);
+ appModuleResources.add(appModuleResource);
+ }
+ 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();
+ }
+ }
+ return appModuleResources;
+ }
+
+ @Override
+ public List<String> getAllIds() throws AppCatalogException {
+ return null;
+ }
+
+ @Override
+ public List<String> getIds(String fieldName, Object value) throws AppCatalogException {
+ List<String> moduleResources = new ArrayList<String>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ Query q;
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(APPLICATION_MODULE);
+ List results;
+ if (fieldName.equals(ApplicationModuleConstants.MODULE_NAME)) {
+ generator.setParameter(ApplicationModuleConstants.MODULE_NAME, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ ApplicationModule applicationModule = (ApplicationModule) result;
+ moduleResources.add(applicationModule.getModuleID());
+ }
+ }
+ } else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for app module resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for app module 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 moduleResources;
+ }
+
+ @Override
+ public void save() throws AppCatalogException {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ ApplicationModule existingModule = em.find(ApplicationModule.class, moduleId);
+ em.close();
+
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ if (existingModule != null){
+ existingModule.setModuleName(moduleName);
+ existingModule.setModuleVersion(moduleVersion);
+ existingModule.setModuleDesc(moduleDesc);
+ existingModule.setGatewayId(gatewayId);
+ existingModule.setUpdateTime(AiravataUtils.getCurrentTimestamp());
+ em.merge(existingModule);
+ }else {
+ ApplicationModule applicationModule = new ApplicationModule();
+ applicationModule.setModuleID(moduleId);
+ applicationModule.setModuleName(moduleName);
+ applicationModule.setModuleVersion(moduleVersion);
+ applicationModule.setModuleDesc(moduleDesc);
+ applicationModule.setGatewayId(gatewayId);
+ applicationModule.setCreationTime(AiravataUtils.getCurrentTimestamp());
+ em.persist(applicationModule);
+ }
+ 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 {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ ApplicationModule applicationModule = em.find(ApplicationModule.class, identifier);
+ em.close();
+ return applicationModule != null;
+ } 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();
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/AppModuleMappingAppCatalogResourceAppCat.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/AppModuleMappingAppCatalogResourceAppCat.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/AppModuleMappingAppCatalogResourceAppCat.java
new file mode 100644
index 0000000..12d32a0
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/AppModuleMappingAppCatalogResourceAppCat.java
@@ -0,0 +1,317 @@
+/*
+ *
+ * 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.AppModuleMapping;
+import org.apache.airavata.registry.core.app.catalog.model.AppModuleMapping_PK;
+import org.apache.airavata.registry.core.app.catalog.model.ApplicationInterface;
+import org.apache.airavata.registry.core.app.catalog.model.ApplicationModule;
+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 AppModuleMappingAppCatalogResourceAppCat extends AppCatAbstractResource {
+ private final static Logger logger = LoggerFactory.getLogger(AppModuleMappingAppCatalogResourceAppCat.class);
+ private String interfaceId;
+ private String moduleId;
+ private AppInterfaceAppCatalogResourceAppCat appInterfaceResource;
+ private AppModuleAppCatalogResourceAppCat moduleResource;
+
+
+ public String getModuleId() {
+ return moduleId;
+ }
+
+ public void setModuleId(String moduleId) {
+ this.moduleId = moduleId;
+ }
+
+ public String getInterfaceId() {
+ return interfaceId;
+ }
+
+ public void setInterfaceId(String interfaceId) {
+ this.interfaceId = interfaceId;
+ }
+
+ public AppInterfaceAppCatalogResourceAppCat getAppInterfaceResource() {
+ return appInterfaceResource;
+ }
+
+ public void setAppInterfaceResource(AppInterfaceAppCatalogResourceAppCat appInterfaceResource) {
+ this.appInterfaceResource = appInterfaceResource;
+ }
+
+ public AppModuleAppCatalogResourceAppCat getModuleResource() {
+ return moduleResource;
+ }
+
+ public void setModuleResource(AppModuleAppCatalogResourceAppCat moduleResource) {
+ this.moduleResource = moduleResource;
+ }
+
+ @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(APP_MODULE_MAPPING);
+ generator.setParameter(AppModuleMappingConstants.INTERFACE_ID, ids.get(AppModuleMappingConstants.INTERFACE_ID));
+ if (ids.get(AppModuleMappingConstants.MODULE_ID) != null){
+ generator.setParameter(AppModuleMappingConstants.MODULE_ID, ids.get(AppModuleMappingConstants.MODULE_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();
+ }
+ }
+ }
+
+ public void removeAll() throws AppCatalogException {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator= new AppCatalogQueryGenerator(APP_MODULE_MAPPING);
+ 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(APP_MODULE_MAPPING);
+ generator.setParameter(AppModuleMappingConstants.INTERFACE_ID, ids.get(AppModuleMappingConstants.INTERFACE_ID));
+ generator.setParameter(AppModuleMappingConstants.MODULE_ID, ids.get(AppModuleMappingConstants.MODULE_ID));
+ Query q = generator.selectQuery(em);
+ AppModuleMapping result = (AppModuleMapping) q.getSingleResult();
+ AppModuleMappingAppCatalogResourceAppCat resource =
+ (AppModuleMappingAppCatalogResourceAppCat) AppCatalogJPAUtils.getResource(AppCatalogResourceType.APP_MODULE_MAPPING, result);
+ em.getTransaction().commit();
+ em.close();
+ return resource;
+ } 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> resourceList = new ArrayList<AppCatalogResource>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ Query q;
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(APP_MODULE_MAPPING);
+ List results;
+ if (fieldName.equals(AppModuleMappingConstants.INTERFACE_ID)) {
+ generator.setParameter(AppModuleMappingConstants.INTERFACE_ID, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ AppModuleMapping moduleMapping = (AppModuleMapping) result;
+ AppModuleMappingAppCatalogResourceAppCat resource =
+ (AppModuleMappingAppCatalogResourceAppCat) AppCatalogJPAUtils.getResource(AppCatalogResourceType.APP_MODULE_MAPPING, moduleMapping);
+ resourceList.add(resource);
+ }
+ }
+ } else if (fieldName.equals(AppModuleMappingConstants.MODULE_ID)) {
+ generator.setParameter(AppModuleMappingConstants.MODULE_ID, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ AppModuleMapping moduleMapping = (AppModuleMapping) result;
+ AppModuleMappingAppCatalogResourceAppCat resource =
+ (AppModuleMappingAppCatalogResourceAppCat) AppCatalogJPAUtils.getResource(AppCatalogResourceType.APP_MODULE_MAPPING, moduleMapping);
+ resourceList.add(resource);
+ }
+ }
+ }else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for app module mapping resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for app module mapping 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 resourceList;
+ }
+
+ @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();
+ AppModuleMapping existngModuleMap = em.find(AppModuleMapping.class, new AppModuleMapping_PK(interfaceId, moduleId));
+ em.close();
+
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ ApplicationInterface applicationInterface = em.find(ApplicationInterface.class, interfaceId);
+ ApplicationModule applicationModule = em.find(ApplicationModule.class, moduleId);
+ if (existngModuleMap != null){
+ existngModuleMap.setApplicationInterface(applicationInterface);
+ existngModuleMap.setApplicationModule(applicationModule);
+ em.merge(existngModuleMap);
+ }else {
+ AppModuleMapping appModuleMapping = new AppModuleMapping();
+ appModuleMapping.setInterfaceID(interfaceId);
+ appModuleMapping.setApplicationInterface(applicationInterface);
+ appModuleMapping.setModuleID(moduleId);
+ appModuleMapping.setApplicationModule(applicationModule);
+ em.persist(appModuleMapping);
+ }
+ 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();
+ AppModuleMapping moduleMapping = em.find(AppModuleMapping.class,
+ new AppModuleMapping_PK(ids.get(AppModuleMappingConstants.INTERFACE_ID),
+ ids.get(AppModuleMappingConstants.MODULE_ID)));
+ em.close();
+ return moduleMapping != null;
+ } 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();
+ }
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/AppModuleMappingResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/AppModuleMappingResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/AppModuleMappingResource.java
new file mode 100644
index 0000000..a44229d
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/AppModuleMappingResource.java
@@ -0,0 +1,317 @@
+/*
+ *
+ * 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.aiaravata.application.catalog.data.resources;
+
+import org.airavata.appcatalog.cpi.AppCatalogException;
+import org.apache.aiaravata.application.catalog.data.model.AppModuleMapping;
+import org.apache.aiaravata.application.catalog.data.model.AppModuleMapping_PK;
+import org.apache.aiaravata.application.catalog.data.model.ApplicationInterface;
+import org.apache.aiaravata.application.catalog.data.model.ApplicationModule;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogJPAUtils;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogQueryGenerator;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogResourceType;
+import org.apache.airavata.common.exception.ApplicationSettingsException;
+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 AppModuleMappingResource extends AbstractResource {
+ private final static Logger logger = LoggerFactory.getLogger(AppModuleMappingResource.class);
+ private String interfaceId;
+ private String moduleId;
+ private AppInterfaceResource appInterfaceResource;
+ private AppModuleResource moduleResource;
+
+
+ public String getModuleId() {
+ return moduleId;
+ }
+
+ public void setModuleId(String moduleId) {
+ this.moduleId = moduleId;
+ }
+
+ public String getInterfaceId() {
+ return interfaceId;
+ }
+
+ public void setInterfaceId(String interfaceId) {
+ this.interfaceId = interfaceId;
+ }
+
+ public AppInterfaceResource getAppInterfaceResource() {
+ return appInterfaceResource;
+ }
+
+ public void setAppInterfaceResource(AppInterfaceResource appInterfaceResource) {
+ this.appInterfaceResource = appInterfaceResource;
+ }
+
+ public AppModuleResource getModuleResource() {
+ return moduleResource;
+ }
+
+ public void setModuleResource(AppModuleResource moduleResource) {
+ this.moduleResource = moduleResource;
+ }
+
+ @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(APP_MODULE_MAPPING);
+ generator.setParameter(AppModuleMappingConstants.INTERFACE_ID, ids.get(AppModuleMappingConstants.INTERFACE_ID));
+ if (ids.get(AppModuleMappingConstants.MODULE_ID) != null){
+ generator.setParameter(AppModuleMappingConstants.MODULE_ID, ids.get(AppModuleMappingConstants.MODULE_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();
+ }
+ }
+ }
+
+ public void removeAll() throws AppCatalogException {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator= new AppCatalogQueryGenerator(APP_MODULE_MAPPING);
+ 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 Resource 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(APP_MODULE_MAPPING);
+ generator.setParameter(AppModuleMappingConstants.INTERFACE_ID, ids.get(AppModuleMappingConstants.INTERFACE_ID));
+ generator.setParameter(AppModuleMappingConstants.MODULE_ID, ids.get(AppModuleMappingConstants.MODULE_ID));
+ Query q = generator.selectQuery(em);
+ AppModuleMapping result = (AppModuleMapping) q.getSingleResult();
+ AppModuleMappingResource resource =
+ (AppModuleMappingResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.APP_MODULE_MAPPING, result);
+ em.getTransaction().commit();
+ em.close();
+ return resource;
+ } 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<Resource> get(String fieldName, Object value) throws AppCatalogException {
+ List<Resource> resourceList = new ArrayList<Resource>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ Query q;
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(APP_MODULE_MAPPING);
+ List results;
+ if (fieldName.equals(AppModuleMappingConstants.INTERFACE_ID)) {
+ generator.setParameter(AppModuleMappingConstants.INTERFACE_ID, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ AppModuleMapping moduleMapping = (AppModuleMapping) result;
+ AppModuleMappingResource resource =
+ (AppModuleMappingResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.APP_MODULE_MAPPING, moduleMapping);
+ resourceList.add(resource);
+ }
+ }
+ } else if (fieldName.equals(AppModuleMappingConstants.MODULE_ID)) {
+ generator.setParameter(AppModuleMappingConstants.MODULE_ID, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ AppModuleMapping moduleMapping = (AppModuleMapping) result;
+ AppModuleMappingResource resource =
+ (AppModuleMappingResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.APP_MODULE_MAPPING, moduleMapping);
+ resourceList.add(resource);
+ }
+ }
+ }else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for app module mapping resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for app module mapping 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 resourceList;
+ }
+
+ @Override
+ public List<Resource> 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();
+ AppModuleMapping existngModuleMap = em.find(AppModuleMapping.class, new AppModuleMapping_PK(interfaceId, moduleId));
+ em.close();
+
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ ApplicationInterface applicationInterface = em.find(ApplicationInterface.class, interfaceId);
+ ApplicationModule applicationModule = em.find(ApplicationModule.class, moduleId);
+ if (existngModuleMap != null){
+ existngModuleMap.setApplicationInterface(applicationInterface);
+ existngModuleMap.setApplicationModule(applicationModule);
+ em.merge(existngModuleMap);
+ }else {
+ AppModuleMapping appModuleMapping = new AppModuleMapping();
+ appModuleMapping.setInterfaceID(interfaceId);
+ appModuleMapping.setApplicationInterface(applicationInterface);
+ appModuleMapping.setModuleID(moduleId);
+ appModuleMapping.setApplicationModule(applicationModule);
+ em.persist(appModuleMapping);
+ }
+ 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();
+ AppModuleMapping moduleMapping = em.find(AppModuleMapping.class,
+ new AppModuleMapping_PK(ids.get(AppModuleMappingConstants.INTERFACE_ID),
+ ids.get(AppModuleMappingConstants.MODULE_ID)));
+ em.close();
+ return moduleMapping != null;
+ } 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();
+ }
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/AppModuleResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/AppModuleResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/AppModuleResource.java
new file mode 100644
index 0000000..79803af
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/AppModuleResource.java
@@ -0,0 +1,344 @@
+/*
+ *
+ * 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.aiaravata.application.catalog.data.resources;
+
+import org.airavata.appcatalog.cpi.AppCatalogException;
+import org.apache.aiaravata.application.catalog.data.model.ApplicationModule;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogJPAUtils;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogQueryGenerator;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogResourceType;
+import org.apache.airavata.common.exception.ApplicationSettingsException;
+import org.apache.airavata.common.utils.AiravataUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.persistence.EntityManager;
+import javax.persistence.Query;
+import java.sql.Timestamp;
+import java.util.ArrayList;
+import java.util.List;
+
+public class AppModuleResource extends AbstractResource {
+ private final static Logger logger = LoggerFactory.getLogger(AppModuleResource.class);
+ private String moduleId;
+ private String moduleName;
+ private String moduleVersion;
+ private String moduleDesc;
+ private Timestamp createdTime;
+ private Timestamp updatedTime;
+ private String gatewayId;
+
+ public String getGatewayId() {
+ return gatewayId;
+ }
+
+ public void setGatewayId(String gatewayId) {
+ this.gatewayId = gatewayId;
+ }
+
+ public Timestamp getCreatedTime() {
+ return createdTime;
+ }
+
+ public void setCreatedTime(Timestamp createdTime) {
+ this.createdTime = createdTime;
+ }
+
+ public Timestamp getUpdatedTime() {
+ return updatedTime;
+ }
+
+ public void setUpdatedTime(Timestamp updatedTime) {
+ this.updatedTime = updatedTime;
+ }
+
+ public String getModuleId() {
+ return moduleId;
+ }
+
+ public void setModuleId(String moduleId) {
+ this.moduleId = moduleId;
+ }
+
+ public String getModuleName() {
+ return moduleName;
+ }
+
+ public void setModuleName(String moduleName) {
+ this.moduleName = moduleName;
+ }
+
+ public String getModuleVersion() {
+ return moduleVersion;
+ }
+
+ public void setModuleVersion(String moduleVersion) {
+ this.moduleVersion = moduleVersion;
+ }
+
+ public String getModuleDesc() {
+ return moduleDesc;
+ }
+
+ public void setModuleDesc(String moduleDesc) {
+ this.moduleDesc = moduleDesc;
+ }
+
+ @Override
+ public void remove(Object identifier) throws AppCatalogException {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator= new AppCatalogQueryGenerator(APPLICATION_MODULE);
+ generator.setParameter(ApplicationModuleConstants.MODULE_ID, identifier);
+ 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 Resource get(Object identifier) throws AppCatalogException {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(APPLICATION_MODULE);
+ generator.setParameter(ApplicationModuleConstants.MODULE_ID, identifier);
+ Query q = generator.selectQuery(em);
+ ApplicationModule applicationModule = (ApplicationModule) q.getSingleResult();
+ AppModuleResource appModuleResource =
+ (AppModuleResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.APPLICATION_MODULE, applicationModule);
+ em.getTransaction().commit();
+ em.close();
+ return appModuleResource;
+ } 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<Resource> get(String fieldName, Object value) throws AppCatalogException {
+ List<Resource> moduleResources = new ArrayList<Resource>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ Query q;
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(APPLICATION_MODULE);
+ List results;
+ if (fieldName.equals(ApplicationModuleConstants.MODULE_NAME)) {
+ generator.setParameter(ApplicationModuleConstants.MODULE_NAME, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ ApplicationModule applicationModule = (ApplicationModule) result;
+ AppModuleResource moduleResource =
+ (AppModuleResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.APPLICATION_MODULE, applicationModule);
+ moduleResources.add(moduleResource);
+ }
+ }
+ } else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for app module resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for app module 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 moduleResources;
+ }
+
+ @Override
+ public List<Resource> getAll() throws AppCatalogException {
+ List<Resource> appModuleResources = new ArrayList<Resource>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(APPLICATION_MODULE);
+ generator.setParameter(ApplicationModuleConstants.GATEWAY_ID, gatewayId);
+ Query q = generator.selectQuery(em);
+ List<?> results = q.getResultList();
+ for (Object result : results) {
+ ApplicationModule module = (ApplicationModule) result;
+ AppModuleResource appModuleResource = (AppModuleResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.APPLICATION_MODULE, module);
+ appModuleResources.add(appModuleResource);
+ }
+ 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();
+ }
+ }
+ return appModuleResources;
+ }
+
+ @Override
+ public List<String> getAllIds() throws AppCatalogException {
+ return null;
+ }
+
+ @Override
+ public List<String> getIds(String fieldName, Object value) throws AppCatalogException {
+ List<String> moduleResources = new ArrayList<String>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ Query q;
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(APPLICATION_MODULE);
+ List results;
+ if (fieldName.equals(ApplicationModuleConstants.MODULE_NAME)) {
+ generator.setParameter(ApplicationModuleConstants.MODULE_NAME, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ ApplicationModule applicationModule = (ApplicationModule) result;
+ moduleResources.add(applicationModule.getModuleID());
+ }
+ }
+ } else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for app module resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for app module 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 moduleResources;
+ }
+
+ @Override
+ public void save() throws AppCatalogException {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ ApplicationModule existingModule = em.find(ApplicationModule.class, moduleId);
+ em.close();
+
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ if (existingModule != null){
+ existingModule.setModuleName(moduleName);
+ existingModule.setModuleVersion(moduleVersion);
+ existingModule.setModuleDesc(moduleDesc);
+ existingModule.setGatewayId(gatewayId);
+ existingModule.setUpdateTime(AiravataUtils.getCurrentTimestamp());
+ em.merge(existingModule);
+ }else {
+ ApplicationModule applicationModule = new ApplicationModule();
+ applicationModule.setModuleID(moduleId);
+ applicationModule.setModuleName(moduleName);
+ applicationModule.setModuleVersion(moduleVersion);
+ applicationModule.setModuleDesc(moduleDesc);
+ applicationModule.setGatewayId(gatewayId);
+ applicationModule.setCreationTime(AiravataUtils.getCurrentTimestamp());
+ em.persist(applicationModule);
+ }
+ 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 {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ ApplicationModule applicationModule = em.find(ApplicationModule.class, identifier);
+ em.close();
+ return applicationModule != null;
+ } 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();
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/ApplicationInputAppCatalogResourceAppCat.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/ApplicationInputAppCatalogResourceAppCat.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/ApplicationInputAppCatalogResourceAppCat.java
new file mode 100644
index 0000000..412b2c1
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/ApplicationInputAppCatalogResourceAppCat.java
@@ -0,0 +1,454 @@
+/**
+ * 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.AppInput_PK;
+import org.apache.airavata.registry.core.app.catalog.model.ApplicationInput;
+import org.apache.airavata.registry.core.app.catalog.model.ApplicationInterface;
+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 ApplicationInputAppCatalogResourceAppCat extends AppCatAbstractResource {
+
+ private final static Logger logger = LoggerFactory.getLogger(ApplicationInputAppCatalogResourceAppCat.class);
+
+ private String interfaceID;
+ private String inputKey;
+ private String dataType;
+ private String inputVal;
+ private String metadata;
+ private String appArgument;
+ private String userFriendlyDesc;
+ private int inputOrder;
+ private boolean standardInput;
+ private boolean isRequired;
+ private boolean requiredToCMD;
+ private boolean dataStaged;
+
+ private AppInterfaceAppCatalogResourceAppCat appInterfaceResource;
+
+ 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(APPLICATION_INPUT);
+ generator.setParameter(AppInputConstants.INTERFACE_ID, ids.get(AppInputConstants.INTERFACE_ID));
+ if (ids.get(AppInputConstants.INPUT_KEY) != null){
+ generator.setParameter(AppInputConstants.INPUT_KEY, ids.get(AppInputConstants.INPUT_KEY));
+ }
+ 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();
+ }
+ }
+ }
+
+ public AppCatalogResource get(Object identifier) throws AppCatalogException {
+ HashMap<String, String> ids;
+ if (identifier instanceof Map) {
+ ids = (HashMap<String, String>) 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(APPLICATION_INPUT);
+ generator.setParameter(AppInputConstants.INTERFACE_ID, ids.get(AppInputConstants.INTERFACE_ID));
+ generator.setParameter(AppInputConstants.INPUT_KEY, ids.get(AppInputConstants.INPUT_KEY));
+ Query q = generator.selectQuery(em);
+ ApplicationInput applicationInput = (ApplicationInput) q.getSingleResult();
+ ApplicationInputAppCatalogResourceAppCat applicationInputResource =
+ (ApplicationInputAppCatalogResourceAppCat) AppCatalogJPAUtils.getResource(AppCatalogResourceType.APPLICATION_INPUT
+ , applicationInput);
+ em.getTransaction().commit();
+ em.close();
+ return applicationInputResource;
+ } 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();
+ }
+ }
+ }
+
+ public List<AppCatalogResource> get(String fieldName, Object value) throws AppCatalogException {
+ List<AppCatalogResource> appInputResources = new ArrayList<AppCatalogResource>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ Query q;
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(APPLICATION_INPUT);
+ List results;
+ if (fieldName.equals(AppInputConstants.INTERFACE_ID)) {
+ generator.setParameter(AppInputConstants.INTERFACE_ID, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ ApplicationInput applicationInput = (ApplicationInput) result;
+ ApplicationInputAppCatalogResourceAppCat applicationInputResource =
+ (ApplicationInputAppCatalogResourceAppCat) AppCatalogJPAUtils.getResource(
+ AppCatalogResourceType.APPLICATION_INPUT, applicationInput);
+ appInputResources.add(applicationInputResource);
+ }
+ }
+ } else if (fieldName.equals(AppInputConstants.INPUT_KEY)) {
+ generator.setParameter(AppInputConstants.INPUT_KEY, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ ApplicationInput applicationInput = (ApplicationInput) result;
+ ApplicationInputAppCatalogResourceAppCat applicationInputResource =
+ (ApplicationInputAppCatalogResourceAppCat) AppCatalogJPAUtils.getResource(
+ AppCatalogResourceType.APPLICATION_INPUT, applicationInput);
+ appInputResources.add(applicationInputResource);
+ }
+ }
+ } else if (fieldName.equals(AppInputConstants.DATA_TYPE)) {
+ generator.setParameter(AppInputConstants.DATA_TYPE, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ ApplicationInput applicationInput = (ApplicationInput) result;
+ ApplicationInputAppCatalogResourceAppCat applicationInputResource =
+ (ApplicationInputAppCatalogResourceAppCat) AppCatalogJPAUtils.getResource(
+ AppCatalogResourceType.APPLICATION_INPUT, applicationInput);
+ appInputResources.add(applicationInputResource);
+ }
+ }
+ } else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for AppInput Resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for AppInput 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 appInputResources;
+ }
+
+ @Override
+ public List<AppCatalogResource> getAll() throws AppCatalogException {
+ return null;
+ }
+
+ @Override
+ public List<String> getAllIds() throws AppCatalogException {
+ return null;
+ }
+
+ public List<String> getIds(String fieldName, Object value) throws AppCatalogException {
+ List<String> appInputResourceIDs = new ArrayList<String>();
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ Query q;
+ AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(APPLICATION_INPUT);
+ List results;
+ if (fieldName.equals(AppInputConstants.INTERFACE_ID)) {
+ generator.setParameter(AppInputConstants.INTERFACE_ID, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ ApplicationInput applicationInput = (ApplicationInput) result;
+ appInputResourceIDs.add(applicationInput.getInterfaceID());
+ }
+ }
+ } else if (fieldName.equals(AppInputConstants.INPUT_KEY)) {
+ generator.setParameter(AppInputConstants.INPUT_KEY, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ ApplicationInput applicationInput = (ApplicationInput) result;
+ appInputResourceIDs.add(applicationInput.getInterfaceID());
+ }
+ }
+ } else if (fieldName.equals(AppInputConstants.DATA_TYPE)) {
+ generator.setParameter(AppInputConstants.DATA_TYPE, value);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ ApplicationInput applicationInput = (ApplicationInput) result;
+ appInputResourceIDs.add(applicationInput.getInterfaceID());
+ }
+ }
+ } else {
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported field name for AppInput resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported field name for AppInput 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 appInputResourceIDs;
+ }
+
+ public void save() throws AppCatalogException {
+ EntityManager em = null;
+ try {
+ em = AppCatalogJPAUtils.getEntityManager();
+ ApplicationInput existingApplicationInput = em.find(ApplicationInput.class, new AppInput_PK(interfaceID, inputKey));
+ em.close();
+ ApplicationInput applicationInput;
+ em = AppCatalogJPAUtils.getEntityManager();
+ em.getTransaction().begin();
+ if (existingApplicationInput == null) {
+ applicationInput = new ApplicationInput();
+ } else {
+ applicationInput=existingApplicationInput;
+ }
+ ApplicationInterface applicationInterface = em.find(ApplicationInterface.class, interfaceID);
+ applicationInput.setApplicationInterface(applicationInterface);
+ applicationInput.setInterfaceID(applicationInterface.getInterfaceID());
+ applicationInput.setDataType(dataType);
+ applicationInput.setInputKey(inputKey);
+ applicationInput.setInputVal(inputVal);
+ applicationInput.setMetadata(metadata);
+ applicationInput.setAppArgument(appArgument);
+ applicationInput.setUserFriendlyDesc(userFriendlyDesc);
+ applicationInput.setStandardInput(standardInput);
+ applicationInput.setInputOrder(inputOrder);
+ applicationInput.setRequiredToCMD(requiredToCMD);
+ applicationInput.setRequired(isRequired);
+ applicationInput.setDataStaged(dataStaged);
+ if (existingApplicationInput == null) {
+ em.persist(applicationInput);
+ } else {
+ em.merge(applicationInput);
+ }
+ 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();
+ }
+ }
+ }
+
+ public boolean isExists(Object identifier) throws AppCatalogException {
+ HashMap<String, String> ids;
+ if (identifier instanceof Map) {
+ ids = (HashMap<String, String>) 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();
+ ApplicationInput applicationInput = em.find(ApplicationInput.class, new AppInput_PK(
+ ids.get(AppInputConstants.INTERFACE_ID),
+ ids.get(AppInputConstants.INPUT_KEY)));
+
+ em.close();
+ return applicationInput != null;
+ } 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();
+ }
+ }
+ }
+
+ public String getInterfaceID() {
+ return interfaceID;
+ }
+
+ public void setInterfaceID(String interfaceID) {
+ this.interfaceID = interfaceID;
+ }
+
+ public String getInputKey() {
+ return inputKey;
+ }
+
+ public void setInputKey(String inputKey) {
+ this.inputKey = inputKey;
+ }
+
+ public String getDataType() {
+ return dataType;
+ }
+
+ public void setDataType(String dataType) {
+ this.dataType = dataType;
+ }
+
+ public String getInputVal() {
+ return inputVal;
+ }
+
+ public void setInputVal(String inputVal) {
+ this.inputVal = inputVal;
+ }
+
+ public String getMetadata() {
+ return metadata;
+ }
+
+ public void setMetadata(String metadata) {
+ this.metadata = metadata;
+ }
+
+ public String getAppArgument() {
+ return appArgument;
+ }
+
+ public void setAppArgument(String appArgument) {
+ this.appArgument = appArgument;
+ }
+
+ public String getUserFriendlyDesc() {
+ return userFriendlyDesc;
+ }
+
+ public void setUserFriendlyDesc(String userFriendlyDesc) {
+ this.userFriendlyDesc = userFriendlyDesc;
+ }
+
+ public AppInterfaceAppCatalogResourceAppCat getAppInterfaceResource() {
+ return appInterfaceResource;
+ }
+
+ public void setAppInterfaceResource(AppInterfaceAppCatalogResourceAppCat appInterfaceResource) {
+ this.appInterfaceResource = appInterfaceResource;
+ }
+
+ public boolean isStandardInput() {
+ return standardInput;
+ }
+
+ public void setStandardInput(boolean standardInput) {
+ this.standardInput = standardInput;
+ }
+
+ public int getInputOrder() {
+ return inputOrder;
+ }
+
+ public void setInputOrder(int inputOrder) {
+ this.inputOrder = inputOrder;
+ }
+
+ public boolean getRequired() {
+ return isRequired;
+ }
+
+ public void setRequired(boolean required) {
+ this.isRequired = required;
+ }
+
+ public boolean getRequiredToCMD() {
+ return requiredToCMD;
+ }
+
+ public void setRequiredToCMD(boolean requiredToCMD) {
+ this.requiredToCMD = requiredToCMD;
+ }
+
+ public boolean isDataStaged() {
+ return dataStaged;
+ }
+
+ public void setDataStaged(boolean dataStaged) {
+ this.dataStaged = dataStaged;
+ }
+}