You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by ch...@apache.org on 2015/06/05 18:25:57 UTC
[07/30] airavata git commit: registry refactoring changes
http://git-wip-us.apache.org/repos/asf/airavata/blob/4045c094/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/GatewayResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/GatewayResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/GatewayResource.java
new file mode 100644
index 0000000..a7d8544
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/GatewayResource.java
@@ -0,0 +1,437 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS 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.resources;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.persistence.EntityManager;
+import javax.persistence.Query;
+
+import org.apache.airavata.registry.core.experiment.catalog.ExpCatResourceUtils;
+import org.apache.airavata.registry.core.experiment.catalog.ExperimentCatResource;
+import org.apache.airavata.registry.core.experiment.catalog.ResourceType;
+import org.apache.airavata.registry.core.experiment.catalog.model.*;
+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;
+
+public class GatewayResource extends AbstractExpCatResource {
+ 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 ExperimentCatResource 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 = ExpCatResourceUtils.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 ExperimentCatResource get(ResourceType type, Object name) throws RegistryException{
+ EntityManager em = null;
+ try {
+ em = ExpCatResourceUtils.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<ExperimentCatResource> get(ResourceType type) throws RegistryException{
+ List<ExperimentCatResource> resourceList = new ArrayList<ExperimentCatResource>();
+ EntityManager em = null;
+ try {
+ em = ExpCatResourceUtils.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 = ExpCatResourceUtils.getEntityManager();
+ Gateway existingGateway = em.find(Gateway.class, gatewayId);
+ em.close();
+
+ em = ExpCatResourceUtils.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 = ExpCatResourceUtils.getEntityManager();
+ Gateway_Worker existingWorker = em.find(Gateway_Worker.class, new Gateway_Worker_PK(gatewayId, name.toString()));
+ em.close();
+ return existingWorker != null;
+ case USER:
+ em = ExpCatResourceUtils.getEntityManager();
+ Users existingUser = em.find(Users.class, name);
+ em.close();
+ return existingUser != null;
+ case EXPERIMENT:
+ em = ExpCatResourceUtils.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<ExperimentCatResource> resources = get(ResourceType.EXPERIMENT);
+ for (ExperimentCatResource resource : resources){
+ experiments.add((ExperimentResource)resource);
+ }
+ return experiments;
+ }
+}
+
http://git-wip-us.apache.org/repos/asf/airavata/blob/4045c094/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/JobDetailExperimentCatResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/JobDetailExperimentCatResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/JobDetailExperimentCatResource.java
deleted file mode 100644
index 1350f71..0000000
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/JobDetailExperimentCatResource.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.registry.core.experiment.catalog.resources;
-
-import org.apache.airavata.registry.core.experiment.catalog.ExpCatResourceUtils;
-import org.apache.airavata.registry.core.experiment.catalog.ExperimentCatResource;
-import org.apache.airavata.registry.core.experiment.catalog.ResourceType;
-import org.apache.airavata.registry.core.experiment.catalog.model.*;
-import org.apache.airavata.registry.core.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 JobDetailExperimentCatResource extends AbstractExperimentCatResource {
- private static final Logger logger = LoggerFactory.getLogger(JobDetailExperimentCatResource.class);
- private String jobId;
- private String taskId;
- private String jobDescription;
- private Timestamp creationTime;
- private String computeResourceConsumed;
- private String jobName;
- private String workingDir;
- private StatusExperimentCatResource jobStatus;
- private List<ErrorDetailExperimentCatResource> errors;
-
- public void setJobStatus(StatusExperimentCatResource jobStatus) {
- this.jobStatus = jobStatus;
- }
-
- public List<ErrorDetailExperimentCatResource> getErrors() {
- return errors;
- }
-
- public void setErrors(List<ErrorDetailExperimentCatResource> 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 ExperimentCatResource create(ResourceType type) throws RegistryException {
- switch (type){
- case STATUS:
- StatusExperimentCatResource statusResource = new StatusExperimentCatResource();
- statusResource.setJobId(jobId);
- return statusResource;
- case ERROR_DETAIL:
- ErrorDetailExperimentCatResource errorDetailResource = new ErrorDetailExperimentCatResource();
- 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 = ExpCatResourceUtils.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 ExperimentCatResource get(ResourceType type, Object name) throws RegistryException {
- EntityManager em = null;
- try {
- em = ExpCatResourceUtils.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();
- StatusExperimentCatResource statusResource = (StatusExperimentCatResource) 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();
- ErrorDetailExperimentCatResource errorDetailResource = (ErrorDetailExperimentCatResource) 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<ExperimentCatResource> get(ResourceType type) throws RegistryException{
- List<ExperimentCatResource> resourceList = new ArrayList<ExperimentCatResource>();
- EntityManager em = null;
- try {
- em = ExpCatResourceUtils.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;
- StatusExperimentCatResource statusResource =
- (StatusExperimentCatResource) 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;
- ErrorDetailExperimentCatResource errorDetailResource =
- (ErrorDetailExperimentCatResource) 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 = ExpCatResourceUtils.getEntityManager();
- JobDetail existingJobDetail = em.find(JobDetail.class, new JobDetails_PK(jobId, taskId));
- em.close();
-
- em = ExpCatResourceUtils.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 StatusExperimentCatResource getJobStatus() {
- return jobStatus;
- }
-
- public StatusExperimentCatResource getJobStatus1() throws RegistryException{
- List<ExperimentCatResource> resources = get(ResourceType.STATUS);
- for (ExperimentCatResource resource : resources) {
- StatusExperimentCatResource jobStatus = (StatusExperimentCatResource) resource;
- if(jobStatus.getStatusType().equals(StatusType.JOB.toString())){
- if (jobStatus.getState() == null || jobStatus.getState().equals("") ){
- jobStatus.setState("UNKNOWN");
- }
- return jobStatus;
- }
- }
- return null;
- }
-
- public StatusExperimentCatResource getApplicationStatus() throws RegistryException{
- List<ExperimentCatResource> resources = get(ResourceType.STATUS);
- for (ExperimentCatResource resource : resources) {
- StatusExperimentCatResource appStatus = (StatusExperimentCatResource) resource;
- if(appStatus.getStatusType().equals(StatusType.APPLICATION.toString())){
- if (appStatus.getState() == null || appStatus.getState().equals("") ){
- appStatus.setState("UNKNOWN");
- }
- return appStatus;
- }
- }
- return null;
- }
-
- public List<ErrorDetailExperimentCatResource> getErrorDetails () throws RegistryException{
- List<ErrorDetailExperimentCatResource> errorDetailResources = new ArrayList<ErrorDetailExperimentCatResource>();
- List<ExperimentCatResource> resources = get(ResourceType.ERROR_DETAIL);
- for(ExperimentCatResource resource : resources){
- errorDetailResources.add((ErrorDetailExperimentCatResource)resource);
- }
- return errorDetailResources;
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/4045c094/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/JobDetailResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/JobDetailResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/JobDetailResource.java
new file mode 100644
index 0000000..0dffd8e
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/JobDetailResource.java
@@ -0,0 +1,376 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS 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.resources;
+
+import org.apache.airavata.registry.core.experiment.catalog.ExpCatResourceUtils;
+import org.apache.airavata.registry.core.experiment.catalog.ExperimentCatResource;
+import org.apache.airavata.registry.core.experiment.catalog.ResourceType;
+import org.apache.airavata.registry.core.experiment.catalog.model.*;
+import org.apache.airavata.registry.core.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 AbstractExpCatResource {
+ 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 ExperimentCatResource 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 = ExpCatResourceUtils.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 ExperimentCatResource get(ResourceType type, Object name) throws RegistryException {
+ EntityManager em = null;
+ try {
+ em = ExpCatResourceUtils.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<ExperimentCatResource> get(ResourceType type) throws RegistryException{
+ List<ExperimentCatResource> resourceList = new ArrayList<ExperimentCatResource>();
+ EntityManager em = null;
+ try {
+ em = ExpCatResourceUtils.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 = ExpCatResourceUtils.getEntityManager();
+ JobDetail existingJobDetail = em.find(JobDetail.class, new JobDetails_PK(jobId, taskId));
+ em.close();
+
+ em = ExpCatResourceUtils.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<ExperimentCatResource> resources = get(ResourceType.STATUS);
+ for (ExperimentCatResource 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<ExperimentCatResource> resources = get(ResourceType.STATUS);
+ for (ExperimentCatResource 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<ExperimentCatResource> resources = get(ResourceType.ERROR_DETAIL);
+ for(ExperimentCatResource resource : resources){
+ errorDetailResources.add((ErrorDetailResource)resource);
+ }
+ return errorDetailResources;
+ }
+
+
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/4045c094/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/NodeInputExperimentCatResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/NodeInputExperimentCatResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/NodeInputExperimentCatResource.java
deleted file mode 100644
index 0c7239a..0000000
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/NodeInputExperimentCatResource.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.registry.core.experiment.catalog.resources;
-
-import java.util.List;
-
-import javax.persistence.EntityManager;
-
-import org.apache.airavata.registry.core.experiment.catalog.ExpCatResourceUtils;
-import org.apache.airavata.registry.core.experiment.catalog.ExperimentCatResource;
-import org.apache.airavata.registry.core.experiment.catalog.ResourceType;
-import org.apache.airavata.registry.core.experiment.catalog.model.NodeInput;
-import org.apache.airavata.registry.core.experiment.catalog.model.NodeInput_PK;
-import org.apache.airavata.registry.cpi.RegistryException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class NodeInputExperimentCatResource extends AbstractExperimentCatResource {
- private static final Logger logger = LoggerFactory.getLogger(NodeInputExperimentCatResource.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 ExperimentCatResource 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 ExperimentCatResource get(ResourceType type, Object name) throws RegistryException {
- logger.error("Unsupported resource type for node input data resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
-
- public List<ExperimentCatResource> 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 = ExpCatResourceUtils.getEntityManager();
- NodeInput existingInput = em.find(NodeInput.class, new NodeInput_PK(inputKey, nodeId));
- em.close();
-
- em = ExpCatResourceUtils.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();
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/4045c094/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/NodeInputResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/NodeInputResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/NodeInputResource.java
new file mode 100644
index 0000000..5820b17
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/NodeInputResource.java
@@ -0,0 +1,227 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS 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.resources;
+
+import java.util.List;
+
+import javax.persistence.EntityManager;
+
+import org.apache.airavata.registry.core.experiment.catalog.ExpCatResourceUtils;
+import org.apache.airavata.registry.core.experiment.catalog.ExperimentCatResource;
+import org.apache.airavata.registry.core.experiment.catalog.ResourceType;
+import org.apache.airavata.registry.core.experiment.catalog.model.NodeInput;
+import org.apache.airavata.registry.core.experiment.catalog.model.NodeInput_PK;
+import org.apache.airavata.registry.cpi.RegistryException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class NodeInputResource extends AbstractExpCatResource {
+ 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 ExperimentCatResource 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 ExperimentCatResource get(ResourceType type, Object name) throws RegistryException {
+ logger.error("Unsupported resource type for node input data resource.", new UnsupportedOperationException());
+ throw new UnsupportedOperationException();
+ }
+
+
+ public List<ExperimentCatResource> 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 = ExpCatResourceUtils.getEntityManager();
+ NodeInput existingInput = em.find(NodeInput.class, new NodeInput_PK(inputKey, nodeId));
+ em.close();
+
+ em = ExpCatResourceUtils.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();
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/4045c094/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/NodeOutputExperimentCatResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/NodeOutputExperimentCatResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/NodeOutputExperimentCatResource.java
deleted file mode 100644
index defd2b9..0000000
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/NodeOutputExperimentCatResource.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.registry.core.experiment.catalog.resources;
-
-import java.util.List;
-
-import javax.persistence.EntityManager;
-
-import org.apache.airavata.registry.core.experiment.catalog.ExpCatResourceUtils;
-import org.apache.airavata.registry.core.experiment.catalog.ExperimentCatResource;
-import org.apache.airavata.registry.core.experiment.catalog.ResourceType;
-import org.apache.airavata.registry.core.experiment.catalog.model.NodeOutput;
-import org.apache.airavata.registry.core.experiment.catalog.model.NodeOutput_PK;
-import org.apache.airavata.registry.cpi.RegistryException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class NodeOutputExperimentCatResource extends AbstractExperimentCatResource {
- private static final Logger logger = LoggerFactory.getLogger(NodeOutputExperimentCatResource.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 ExperimentCatResource 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 ExperimentCatResource get(ResourceType type, Object name) throws RegistryException{
- logger.error("Unsupported resource type for node output data resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
-
- public List<ExperimentCatResource> 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 = ExpCatResourceUtils.getEntityManager();
- NodeOutput existingOutput = em.find(NodeOutput.class, new NodeOutput_PK(outputKey, nodeId));
- em.close();
-
- em = ExpCatResourceUtils.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/4045c094/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/NodeOutputResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/NodeOutputResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/NodeOutputResource.java
new file mode 100644
index 0000000..0c0cd63
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/NodeOutputResource.java
@@ -0,0 +1,207 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS 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.resources;
+
+import java.util.List;
+
+import javax.persistence.EntityManager;
+
+import org.apache.airavata.registry.core.experiment.catalog.ExpCatResourceUtils;
+import org.apache.airavata.registry.core.experiment.catalog.ExperimentCatResource;
+import org.apache.airavata.registry.core.experiment.catalog.ResourceType;
+import org.apache.airavata.registry.core.experiment.catalog.model.NodeOutput;
+import org.apache.airavata.registry.core.experiment.catalog.model.NodeOutput_PK;
+import org.apache.airavata.registry.cpi.RegistryException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class NodeOutputResource extends AbstractExpCatResource {
+ 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 ExperimentCatResource 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 ExperimentCatResource get(ResourceType type, Object name) throws RegistryException{
+ logger.error("Unsupported resource type for node output data resource.", new UnsupportedOperationException());
+ throw new UnsupportedOperationException();
+ }
+
+
+ public List<ExperimentCatResource> 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 = ExpCatResourceUtils.getEntityManager();
+ NodeOutput existingOutput = em.find(NodeOutput.class, new NodeOutput_PK(outputKey, nodeId));
+ em.close();
+
+ em = ExpCatResourceUtils.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/4045c094/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/NotificationEmailExperimentCatResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/NotificationEmailExperimentCatResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/NotificationEmailExperimentCatResource.java
deleted file mode 100644
index 833a1eb..0000000
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/NotificationEmailExperimentCatResource.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.registry.core.experiment.catalog.resources;
-
-import org.apache.airavata.registry.core.experiment.catalog.ExpCatResourceUtils;
-import org.apache.airavata.registry.core.experiment.catalog.ExperimentCatResource;
-import org.apache.airavata.registry.core.experiment.catalog.ResourceType;
-import org.apache.airavata.registry.core.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 NotificationEmailExperimentCatResource extends AbstractExperimentCatResource {
- private static final Logger logger = LoggerFactory.getLogger(NotificationEmailExperimentCatResource.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 ExperimentCatResource 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 ExperimentCatResource get(ResourceType type, Object name) throws RegistryException {
- logger.error("Unsupported resource type for experiment input data resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
- public List<ExperimentCatResource> 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 = ExpCatResourceUtils.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();
- }
- }
- }
-}