airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chath...@apache.org
Subject [3/4] adding resources to data models - AIRAVATA-1017
Date Tue, 18 Feb 2014 05:28:15 GMT
http://git-wip-us.apache.org/repos/asf/airavata/blob/a584c2c7/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ExperimentConfigDataResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ExperimentConfigDataResource.java b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ExperimentConfigDataResource.java
deleted file mode 100644
index d13008f..0000000
--- a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ExperimentConfigDataResource.java
+++ /dev/null
@@ -1,389 +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.persistance.registry.jpa.resources;
-//
-//import org.apache.airavata.persistance.registry.jpa.Resource;
-//import org.apache.airavata.persistance.registry.jpa.ResourceType;
-//import org.apache.airavata.persistance.registry.jpa.ResourceUtils;
-//import org.apache.airavata.persistance.registry.jpa.model.Experiment_Configuration_Data;
-//import org.apache.airavata.persistance.registry.jpa.model.Experiment_Metadata;
-//import org.slf4j.Logger;
-//import org.slf4j.LoggerFactory;
-//
-//import javax.persistence.EntityManager;
-//import java.sql.Timestamp;
-//import java.util.List;
-//
-//public class ExperimentConfigDataResource extends AbstractResource {
-//    private static final Logger logger = LoggerFactory.getLogger(ExperimentConfigDataResource.class);
-//    private ExperimentMetadataResource exMetadata;
-//    private String expID;
-//    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 projectAccount;
-//    private boolean airavataAutoSchedule;
-//    private boolean overrideManualSchedule;
-//    private String workingDir;
-//    private boolean stageInputsToWDir;
-//    private String outputDataDir;
-//    private String dataRegURL;
-//    private boolean persistOutputData;
-//    private boolean cleanAfterJob;
-//    private String applicationID;
-//    private String applicationVersion;
-//    private String workflowTemplateId;
-//    private String workflowTemplateVersion;
-//    private String workingDirParent;
-//    private String startExecutionAt;
-//    private String executeBefore;
-//    private int numberOfRetries;
-//
-//    private byte[] request;
-//
-//    public String getExpID() {
-//        return expID;
-//    }
-//
-//    public void setExpID(String expID) {
-//        this.expID = expID;
-//    }
-//
-//    public ExperimentMetadataResource getExMetadata() {
-//        return exMetadata;
-//    }
-//
-//    public void setExMetadata(ExperimentMetadataResource exMetadata) {
-//        this.exMetadata = exMetadata;
-//    }
-//
-//    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 getProjectAccount() {
-//        return projectAccount;
-//    }
-//
-//    public void setProjectAccount(String projectAccount) {
-//        this.projectAccount = projectAccount;
-//    }
-//
-//    public boolean isAiravataAutoSchedule() {
-//        return airavataAutoSchedule;
-//    }
-//
-//    public void setAiravataAutoSchedule(boolean airavataAutoSchedule) {
-//        this.airavataAutoSchedule = airavataAutoSchedule;
-//    }
-//
-//    public boolean isOverrideManualSchedule() {
-//        return overrideManualSchedule;
-//    }
-//
-//    public void setOverrideManualSchedule(boolean overrideManualSchedule) {
-//        this.overrideManualSchedule = overrideManualSchedule;
-//    }
-//
-//    public String getWorkingDir() {
-//        return workingDir;
-//    }
-//
-//    public void setWorkingDir(String workingDir) {
-//        this.workingDir = workingDir;
-//    }
-//
-//    public boolean isStageInputsToWDir() {
-//        return stageInputsToWDir;
-//    }
-//
-//    public void setStageInputsToWDir(boolean stageInputsToWDir) {
-//        this.stageInputsToWDir = stageInputsToWDir;
-//    }
-//
-//    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 boolean isCleanAfterJob() {
-//        return cleanAfterJob;
-//    }
-//
-//    public void setCleanAfterJob(boolean cleanAfterJob) {
-//        this.cleanAfterJob = cleanAfterJob;
-//    }
-//
-//    public byte[] getRequest() {
-//        return request;
-//    }
-//
-//    public void setRequest(byte[] request) {
-//        this.request = request;
-//    }
-//
-//    public static Logger getLogger() {
-//        return logger;
-//    }
-//
-//    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 getWorkingDirParent() {
-//        return workingDirParent;
-//    }
-//
-//    public void setWorkingDirParent(String workingDirParent) {
-//        this.workingDirParent = workingDirParent;
-//    }
-//
-//    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 getNumberOfRetries() {
-//        return numberOfRetries;
-//    }
-//
-//    public void setNumberOfRetries(int numberOfRetries) {
-//        this.numberOfRetries = numberOfRetries;
-//    }
-//
-//    public Resource create(ResourceType type) {
-//        logger.error("Unsupported resource type for experiment config data resource.", new UnsupportedOperationException());
-//        throw new UnsupportedOperationException();
-//    }
-//
-//    public void remove(ResourceType type, Object name) {
-//        logger.error("Unsupported resource type for experiment config data resource.", new UnsupportedOperationException());
-//        throw new UnsupportedOperationException();    }
-//
-//    public Resource get(ResourceType type, Object name) {
-//        logger.error("Unsupported resource type for experiment config data resource.", new UnsupportedOperationException());
-//        throw new UnsupportedOperationException();    }
-//
-//    public List<Resource> get(ResourceType type) {
-//        logger.error("Unsupported resource type for experiment config data resource.", new UnsupportedOperationException());
-//        throw new UnsupportedOperationException();    }
-//
-//    public void save() {
-//        EntityManager em = ResourceUtils.getEntityManager();
-//        Experiment_Configuration_Data existingConfig = em.find(Experiment_Configuration_Data.class, exMetadata.getExpID());
-//        em.close();
-//
-//        em = ResourceUtils.getEntityManager();
-//        em.getTransaction().begin();
-//        Experiment_Configuration_Data exconfig = new Experiment_Configuration_Data();
-//        exconfig.setAiravata_auto_schedule(isAiravataAutoSchedule());
-//        exconfig.setClean_after_job(cleanAfterJob);
-//        exconfig.setComputational_project_account(projectAccount);
-//        exconfig.setData_reg_url(dataRegURL);
-//        exconfig.setExperiment_config_data(request);
-//        Experiment_Metadata metadata = em.find(Experiment_Metadata.class, exMetadata.getExpID());
-//        exconfig.setExperiment_metadata(metadata);
-//        exconfig.setExperiment_id(metadata.getExperiment_id());
-//        exconfig.setJob_start_time(jobStartTime);
-//        exconfig.setNode_count(nodeCount);
-//        exconfig.setNumber_of_threads(numberOfThreads);
-//        exconfig.setOutput_data_dir(outputDataDir);
-//        exconfig.setOverride_manual_schedule(overrideManualSchedule);
-//        exconfig.setPersist_output_data(persistOutputData);
-//        exconfig.setQueue_name(queueName);
-//        exconfig.setResource_host_id(resourceHostID);
-//        exconfig.setStage_input_files_to_working_dir(stageInputsToWDir);
-//        exconfig.setTotal_cpu_count(cpuCount);
-//        exconfig.setTotal_physical_memory(physicalMemory);
-//        exconfig.setWalltime_limit(wallTimeLimit);
-//        exconfig.setUnique_working_dir(workingDir);
-//        exconfig.setWorking_dir_parent(workingDirParent);
-//        exconfig.setApplication_id(applicationID);
-//        exconfig.setApplication_version(applicationVersion);
-//        exconfig.setWorkflow_template_id(workflowTemplateId);
-//        exconfig.setWorkflow_template_version(workflowTemplateVersion);
-//        exconfig.setStart_execution_at(startExecutionAt);
-//        exconfig.setExecute_before(executeBefore);
-//        exconfig.setNumber_of_retries(numberOfRetries);
-//
-//        if (existingConfig != null){
-//            existingConfig.setAiravata_auto_schedule(isAiravataAutoSchedule());
-//            existingConfig.setClean_after_job(cleanAfterJob);
-//            existingConfig.setComputational_project_account(projectAccount);
-//            existingConfig.setData_reg_url(dataRegURL);
-//            existingConfig.setExperiment_config_data(request);
-//            existingConfig.setExperiment_metadata(metadata);
-//            existingConfig.setExperiment_id(metadata.getExperiment_id());
-//            existingConfig.setJob_start_time(jobStartTime);
-//            existingConfig.setNode_count(nodeCount);
-//            existingConfig.setNumber_of_threads(numberOfThreads);
-//            existingConfig.setOutput_data_dir(outputDataDir);
-//            existingConfig.setOverride_manual_schedule(overrideManualSchedule);
-//            existingConfig.setPersist_output_data(persistOutputData);
-//            existingConfig.setQueue_name(queueName);
-//            existingConfig.setResource_host_id(resourceHostID);
-//            existingConfig.setStage_input_files_to_working_dir(stageInputsToWDir);
-//            existingConfig.setTotal_cpu_count(cpuCount);
-//            existingConfig.setTotal_physical_memory(physicalMemory);
-//            existingConfig.setWalltime_limit(wallTimeLimit);
-//            existingConfig.setUnique_working_dir(workingDir);
-//            existingConfig.setUnique_working_dir(workingDir);
-//            existingConfig.setWorking_dir_parent(workingDirParent);
-//            existingConfig.setApplication_id(applicationID);
-//            existingConfig.setApplication_version(applicationVersion);
-//            existingConfig.setWorkflow_template_id(workflowTemplateId);
-//            existingConfig.setWorkflow_template_version(workflowTemplateVersion);
-//            existingConfig.setStart_execution_at(startExecutionAt);
-//            existingConfig.setExecute_before(executeBefore);
-//            existingConfig.setNumber_of_retries(numberOfRetries);
-//            exconfig = em.merge(existingConfig);
-//        }
-//        else {
-//           em.persist(exconfig);
-//        }
-//        em.getTransaction().commit();
-//        em.close();
-//    }
-//}

http://git-wip-us.apache.org/repos/asf/airavata/blob/a584c2c7/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ExperimentDataResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ExperimentDataResource.java b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ExperimentDataResource.java
deleted file mode 100644
index caf4310..0000000
--- a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ExperimentDataResource.java
+++ /dev/null
@@ -1,358 +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.persistance.registry.jpa.resources;
-//
-//import org.apache.airavata.persistance.registry.jpa.Resource;
-//import org.apache.airavata.persistance.registry.jpa.ResourceType;
-//import org.apache.airavata.persistance.registry.jpa.ResourceUtils;
-//import org.apache.airavata.persistance.registry.jpa.model.*;
-//import org.apache.airavata.persistance.registry.jpa.utils.QueryGenerator;
-//import org.slf4j.Logger;
-//import org.slf4j.LoggerFactory;
-//
-//import javax.persistence.EntityManager;
-//import javax.persistence.Query;
-//import java.util.ArrayList;
-//import java.util.List;
-//
-///**
-// * @deprecated
-// */
-//public class ExperimentDataResource extends AbstractResource{
-//
-//    private final static Logger logger = LoggerFactory.getLogger(ExperimentDataResource.class);
-//    private String experimentID;
-//    private String expName;
-//    private String userName;
-//
-//    public String getExperimentID() {
-//        return experimentID;
-//    }
-//
-//    public String getExpName() {
-//        return expName;
-//    }
-//
-//    public String getUserName() {
-//        return userName;
-//    }
-//
-//    public void setExperimentID(String experimentID) {
-//        this.experimentID = experimentID;
-//    }
-//
-//    public void setExpName(String expName) {
-//        this.expName = expName;
-//    }
-//
-//    public void setUserName(String userName) {
-//        this.userName = userName;
-//    }
-//
-//    public Resource create(ResourceType type) {
-//        switch (type){
-//            case WORKFLOW_DATA:
-//                WorkflowDataResource workflowDataResource = new WorkflowDataResource();
-//                workflowDataResource.setExperimentID(experimentID);
-//                return workflowDataResource;
-//            case EXECUTION_ERROR:
-//				ExecutionErrorResource executionErrorResource = new ExecutionErrorResource();
-//				executionErrorResource.setMetadataResource(this);
-//				return executionErrorResource;
-//            case EXPERIMENT_METADATA:
-//                ExperimentMetadataResource experimentMetadataResource = new ExperimentMetadataResource();
-//                experimentMetadataResource.setExpID(experimentID);
-//                return experimentMetadataResource;
-//            case GFAC_JOB_DATA:
-//                GFacJobDataResource gFacJobDataResource = new GFacJobDataResource();
-//                gFacJobDataResource.setMetadataResource(this);
-//                return gFacJobDataResource;
-//            default:
-//                logger.error("Unsupported resource type for experiment data resource... ", new UnsupportedOperationException());
-//                throw new IllegalArgumentException("Unsupported resource type for experiment data resource.");
-//        }
-//
-//    }
-//
-//    public void remove(ResourceType type, Object name) {
-//        EntityManager em = ResourceUtils.getEntityManager();
-//        em.getTransaction().begin();
-//        Query q;
-//        QueryGenerator generator;
-//        switch (type){
-//            case WORKFLOW_DATA:
-//                generator = new QueryGenerator(WORKFLOW_DATA);
-////                generator.setParameter(WorkflowDataConstants.EXPERIMENT_ID, experimentID);
-//                generator.setParameter(WorkflowDataConstants.WORKFLOW_INSTANCE_ID, name);
-//                q = generator.deleteQuery(em);
-//                q.executeUpdate();
-//                break;
-//            case EXPERIMENT_METADATA:
-//                generator = new QueryGenerator(EXPERIMENT_METADATA);
-//                generator.setParameter(ExperimentDataConstants.EXPERIMENT_ID, name);
-//                q = generator.deleteQuery(em);
-//                q.executeUpdate();
-//                break;
-//            case GFAC_JOB_DATA:
-//                generator = new QueryGenerator(GFAC_JOB_DATA);
-//                generator.setParameter(GFacJobDataConstants.LOCAL_JOB_ID, name);
-//                q = generator.deleteQuery(em);
-//                q.executeUpdate();
-//                break;
-//            default:
-//                break;
-//        }
-//        em.getTransaction().commit();
-//        em.close();
-//    }
-//
-//    public Resource get(ResourceType type, Object name) {
-//        EntityManager em = ResourceUtils.getEntityManager();
-//        em.getTransaction().begin();
-//        QueryGenerator generator;
-//        Query q;
-//        switch (type) {
-//            case WORKFLOW_DATA:
-//                generator = new QueryGenerator(WORKFLOW_DATA);
-////                generator.setParameter(WorkflowDataConstants.EXPERIMENT_ID, experimentID);
-//                generator.setParameter(WorkflowDataConstants.WORKFLOW_INSTANCE_ID, name);
-//                q = generator.selectQuery(em);
-//                Workflow_Data eworkflowData = (Workflow_Data)q.getSingleResult();
-//                WorkflowDataResource workflowDataResource = (WorkflowDataResource)Utils.getResource(ResourceType.WORKFLOW_DATA, eworkflowData);
-//                em.getTransaction().commit();
-//                em.close();
-//                return workflowDataResource;
-//            case EXPERIMENT_METADATA:
-//                generator = new QueryGenerator(EXPERIMENT_METADATA);
-//                generator.setParameter(ExperimentDataConstants.EXPERIMENT_ID, name);
-//                q = generator.selectQuery(em);
-//                Experiment_Metadata expMetadata = (Experiment_Metadata)q.getSingleResult();
-//                ExperimentMetadataResource experimentMetadataResource = (ExperimentMetadataResource)Utils.getResource(ResourceType.EXPERIMENT_METADATA, expMetadata);
-//                em.getTransaction().commit();
-//                em.close();
-//                return experimentMetadataResource;
-//            case GFAC_JOB_DATA:
-//                generator = new QueryGenerator(GFAC_JOB_DATA);
-//                generator.setParameter(GFacJobDataConstants.LOCAL_JOB_ID, name);
-//                q = generator.selectQuery(em);
-//                GFac_Job_Data gFacJobData = (GFac_Job_Data)q.getSingleResult();
-//                GFacJobDataResource gFacJobDataResource = (GFacJobDataResource)Utils.getResource(ResourceType.GFAC_JOB_DATA, gFacJobData);
-//                em.getTransaction().commit();
-//                em.close();
-//                return gFacJobDataResource;
-//            default:
-//                em.getTransaction().commit();
-//                em.close();
-//                logger.error("Unsupported resource type for experiment data resource... ", new UnsupportedOperationException());
-//                throw new IllegalArgumentException("Unsupported resource type for experiment data resource.");
-//        }
-//    }
-//
-//    public List<Resource> get(ResourceType type) {
-//        List<Resource> resourceList = new ArrayList<Resource>();
-//        EntityManager em = ResourceUtils.getEntityManager();
-//        em.getTransaction().begin();
-//        Query q;
-//        QueryGenerator generator;
-//        List<?> results;
-//        switch (type){
-//            case WORKFLOW_DATA:
-//                generator = new QueryGenerator(WORKFLOW_DATA);
-////                generator.setParameter(WorkflowDataConstants.EXPERIMENT_ID, experimentID);
-//                Experiment_Data experiment_data = em.find(Experiment_Data.class, experimentID);
-//                generator.setParameter("experiment_data", experiment_data);
-//                q = generator.selectQuery(em);
-//                results = q.getResultList();
-//                if (results.size() != 0) {
-//                    for (Object result : results) {
-//                        Workflow_Data workflowData = (Workflow_Data) result;
-//                        WorkflowDataResource workflowDataResource = (WorkflowDataResource)Utils.getResource(ResourceType.WORKFLOW_DATA, workflowData);
-//                        resourceList.add(workflowDataResource);
-//                    }
-//                }
-//                break;
-//            case EXPERIMENT_METADATA:
-//                generator = new QueryGenerator(EXPERIMENT_METADATA);
-//                generator.setParameter(ExperimentDataConstants.EXPERIMENT_ID, experimentID);
-//                q = generator.selectQuery(em);
-//                results = q.getResultList();
-//                if (results.size() != 0) {
-//                    for (Object result : results) {
-//                        Experiment_Metadata expMetadata = (Experiment_Metadata) result;
-//                        ExperimentMetadataResource experimentMetadataResource = (ExperimentMetadataResource)Utils.getResource(ResourceType.EXPERIMENT_METADATA, expMetadata);
-//                        resourceList.add(experimentMetadataResource);
-//                    }
-//                }
-//                break;
-//            case EXECUTION_ERROR:
-//                generator = new QueryGenerator(EXECUTION_ERROR);
-//                generator.setParameter(ExecutionErrorConstants.EXPERIMENT_ID, experimentID);
-//                q = generator.selectQuery(em);
-//                results = q.getResultList();
-//                if (results.size() != 0) {
-//                    for (Object result : results) {
-//                        Execution_Error executionError = (Execution_Error)result;
-//                        ExecutionErrorResource executionErrorResource = (ExecutionErrorResource)Utils.getResource(ResourceType.EXECUTION_ERROR, executionError);
-//                        resourceList.add(executionErrorResource);
-//                    }
-//                }
-//                break;
-//            case GFAC_JOB_DATA:
-//                generator = new QueryGenerator(GFAC_JOB_DATA);
-//                generator.setParameter(GFacJobDataConstants.EXPERIMENT_ID, experimentID);
-//                q = generator.selectQuery(em);
-//                results = q.getResultList();
-//                if (results.size() != 0) {
-//                    for (Object result : results) {
-//                        GFac_Job_Data gFacJobData = (GFac_Job_Data)result;
-//                        GFacJobDataResource gFacJobDataResource = (GFacJobDataResource)Utils.getResource(ResourceType.GFAC_JOB_DATA, gFacJobData);
-//                        resourceList.add(gFacJobDataResource);
-//                    }
-//                }
-//                break;
-//            default:
-//                em.getTransaction().commit();
-//                em.close();
-//                logger.error("Unsupported resource type for experiment data resource... ", new UnsupportedOperationException());
-//                throw new IllegalArgumentException("Unsupported resource type for experiment data resource.");
-//        }
-//        em.getTransaction().commit();
-//        em.close();
-//        return resourceList;
-//    }
-//
-//    public void save() {
-//        EntityManager em = ResourceUtils.getEntityManager();
-//        Experiment_Data existingExpData = em.find(Experiment_Data.class, experimentID);
-//        em.close();
-//
-//        em = ResourceUtils.getEntityManager();
-//        em.getTransaction().begin();
-//        Experiment_Data experimentData = new Experiment_Data();
-//        experimentData.setExperiment_ID(experimentID);
-//        experimentData.setName(expName);
-//        experimentData.setUsername(userName);
-//        if(existingExpData != null){
-//            existingExpData.setName(expName);
-//            existingExpData.setUsername(userName);
-//            experimentData = em.merge(existingExpData);
-//        } else{
-//            em.persist(experimentData);
-//        }
-//        em.getTransaction().commit();
-//        em.close();
-//
-//    }
-//
-//    public boolean isWorkflowInstancePresent(String workflowInstanceId){
-//		return isExists(ResourceType.WORKFLOW_DATA, workflowInstanceId);
-//    }
-//
-//    public boolean isGFacJobPresent(String jobId){
-//		return isExists(ResourceType.GFAC_JOB_DATA, jobId);
-//    }
-//
-//    public boolean isExperimentMetadataPresent(){
-//		return isExists(ResourceType.EXPERIMENT_METADATA, getExperimentID());
-//    }
-//
-//    public WorkflowDataResource getWorkflowInstance(String workflowInstanceId){
-//    	return (WorkflowDataResource)get(ResourceType.WORKFLOW_DATA, workflowInstanceId);
-//    }
-//
-//    public List<Resource> getGFacJobs(){
-//    	return get(ResourceType.GFAC_JOB_DATA);
-//    }
-//
-//    public ExperimentMetadataResource getExperimentMetadata(){
-//    	return (ExperimentMetadataResource)get(ResourceType.EXPERIMENT_METADATA,getExperimentID());
-//    }
-//
-//    public List<WorkflowDataResource> getWorkflowInstances(){
-//    	return getResourceList(get(ResourceType.WORKFLOW_DATA),WorkflowDataResource.class);
-//    }
-//
-//    public WorkflowDataResource createWorkflowInstanceResource(String workflowInstanceID){
-//    	WorkflowDataResource r=(WorkflowDataResource)create(ResourceType.WORKFLOW_DATA);
-//    	r.setWorkflowInstanceID(workflowInstanceID);
-//    	return r;
-//    }
-//
-//    public GFacJobDataResource createGFacJob(String jobID){
-//    	GFacJobDataResource r=(GFacJobDataResource)create(ResourceType.GFAC_JOB_DATA);
-//    	r.setLocalJobID(jobID);
-//    	return r;
-//    }
-//
-//    public ExperimentMetadataResource createExperimentMetadata(){
-//    	return (ExperimentMetadataResource)create(ResourceType.EXPERIMENT_METADATA);
-//    }
-//
-//    public ExecutionErrorResource createExecutionError(){
-//    	return (ExecutionErrorResource) create(ResourceType.EXECUTION_ERROR);
-//    }
-//
-//    public void removeWorkflowInstance(String workflowInstanceId){
-//    	remove(ResourceType.WORKFLOW_DATA, workflowInstanceId);
-//    }
-//
-//    public void removeExperimentMetadata(){
-//    	remove(ResourceType.EXPERIMENT_METADATA,getExperimentID());
-//    }
-//
-//    public List<ExecutionErrorResource> getExecutionErrors(String type, String experimentId, String workflowInstanceId, String nodeId, String gfacJobId){
-//    	List<ExecutionErrorResource> resourceList = new ArrayList<ExecutionErrorResource>();
-//        EntityManager em = ResourceUtils.getEntityManager();
-//        em.getTransaction().begin();
-//        Query q;
-//        QueryGenerator generator;
-//        List<?> results;
-//    	generator = new QueryGenerator(EXECUTION_ERROR);
-//        if (experimentId!=null){
-//            generator.setParameter(ExecutionErrorConstants.EXPERIMENT_ID, experimentId);
-//        }
-//        if (type!=null){
-//            generator.setParameter(ExecutionErrorConstants.SOURCE_TYPE, type);
-//        }
-//        if (workflowInstanceId!=null){
-//        	generator.setParameter(ExecutionErrorConstants.WORKFLOW_ID, workflowInstanceId);
-//        }
-//        if (nodeId!=null){
-//        	generator.setParameter(ExecutionErrorConstants.NODE_ID, nodeId);
-//        }
-//        if (gfacJobId!=null){
-//        	generator.setParameter(ExecutionErrorConstants.GFAC_JOB_ID, gfacJobId);
-//        }
-//        q = generator.selectQuery(em);
-//        results = q.getResultList();
-//        if (results.size() != 0) {
-//            for (Object result : results) {
-//                Execution_Error executionError = (Execution_Error)result;
-//                ExecutionErrorResource executionErrorResource = (ExecutionErrorResource)Utils.getResource(ResourceType.EXECUTION_ERROR, executionError);
-//                resourceList.add(executionErrorResource);
-//            }
-//        }
-//        em.getTransaction().commit();
-//        em.close();
-//        return resourceList;
-//    }
-//}

http://git-wip-us.apache.org/repos/asf/airavata/blob/a584c2c7/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ExperimentInputResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ExperimentInputResource.java b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ExperimentInputResource.java
index 6c7aa35..25408ac 100644
--- a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ExperimentInputResource.java
+++ b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ExperimentInputResource.java
@@ -1,113 +1,135 @@
-///*
-// *
-// * Licensed to the Apache Software Foundation (ASF) under one
-// * or more contributor license agreements.  See the NOTICE file
-// * distributed with this work for additional information
-// * regarding copyright ownership.  The ASF licenses this file
-// * to you under the Apache License, Version 2.0 (the
-// * "License"); you may not use this file except in compliance
-// * with the License.  You may obtain a copy of the License at
-// *
-// *   http://www.apache.org/licenses/LICENSE-2.0
-// *
-// * Unless required by applicable law or agreed to in writing,
-// * software distributed under the License is distributed on an
-// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS 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.persistance.registry.jpa.resources;
-//
-//import org.apache.airavata.persistance.registry.jpa.Resource;
-//import org.apache.airavata.persistance.registry.jpa.ResourceType;
-//import org.apache.airavata.persistance.registry.jpa.ResourceUtils;
-//import org.apache.airavata.persistance.registry.jpa.model.Experiment_Input;
-//import org.apache.airavata.persistance.registry.jpa.model.Experiment_Input_PK;
-//import org.apache.airavata.persistance.registry.jpa.model.Experiment_Metadata;
-//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 ExperimentMetadataResource experimentMetadataResource;
-//    private String experimentKey;
-//    private String value;
-//
-//    public ExperimentMetadataResource getExperimentMetadataResource() {
-//        return experimentMetadataResource;
-//    }
-//
-//    public void setExperimentMetadataResource(ExperimentMetadataResource experimentMetadataResource) {
-//        this.experimentMetadataResource = experimentMetadataResource;
-//    }
-//
-//    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 Resource create(ResourceType type) {
-//        logger.error("Unsupported resource type for experiment input data resource.", new UnsupportedOperationException());
-//        throw new UnsupportedOperationException();
-//    }
-//
-//    public void remove(ResourceType type, Object name) {
-//        logger.error("Unsupported resource type for experiment input data resource.", new UnsupportedOperationException());
-//        throw new UnsupportedOperationException();
-//    }
-//
-//    public Resource get(ResourceType type, Object name) {
-//        logger.error("Unsupported resource type for experiment input data resource.", new UnsupportedOperationException());
-//        throw new UnsupportedOperationException();
-//    }
-//
-//    public List<Resource> get(ResourceType type) {
-//        logger.error("Unsupported resource type for experiment input data resource.", new UnsupportedOperationException());
-//        throw new UnsupportedOperationException();
-//    }
-//
-//    public void save() {
-//        EntityManager em = ResourceUtils.getEntityManager();
-//        Experiment_Input existingInput = em.find(Experiment_Input.class, new Experiment_Input_PK(experimentMetadataResource.getExpID(), experimentKey));
-//        em.close();
-//
-//        em = ResourceUtils.getEntityManager();
-//        em.getTransaction().begin();
-//        Experiment_Input exInput = new Experiment_Input();
-//        exInput.setEx_key(experimentKey);
-//        Experiment_Metadata metadata = em.find(Experiment_Metadata.class, experimentMetadataResource.getExpID());
-//        exInput.setExperiment_metadata(metadata);
-//        exInput.setExperiment_id(metadata.getExperiment_id());
-//        exInput.setValue(value);
-//
-//        if (existingInput != null){
-//            existingInput.setEx_key(experimentKey);
-//            existingInput.setExperiment_metadata(metadata);
-//            existingInput.setExperiment_id(metadata.getExperiment_id());
-//            existingInput.setValue(value);
-//            exInput = em.merge(existingInput);
-//        }else {
-//            em.persist(exInput);
-//        }
-//        em.getTransaction().commit();
-//        em.close();
-//    }
-//}
+/*
+*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements.  See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership.  The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License.  You may obtain a copy of the License at
+*
+*   http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS 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.persistance.registry.jpa.resources;
+
+import org.apache.airavata.persistance.registry.jpa.Resource;
+import org.apache.airavata.persistance.registry.jpa.ResourceType;
+import org.apache.airavata.persistance.registry.jpa.ResourceUtils;
+import org.apache.airavata.persistance.registry.jpa.model.Experiment;
+import org.apache.airavata.persistance.registry.jpa.model.Experiment_Input;
+import org.apache.airavata.persistance.registry.jpa.model.Experiment_Input_PK;
+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 ExperimentResource experimentResource;
+    private String experimentKey;
+    private String value;
+    private String inputType;
+    private String metadata;
+
+    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 ExperimentResource getExperimentResource() {
+        return experimentResource;
+    }
+
+    public void setExperimentResource(ExperimentResource experimentResource) {
+        this.experimentResource = experimentResource;
+    }
+
+    public String getInputType() {
+        return inputType;
+    }
+
+    public void setInputType(String inputType) {
+        this.inputType = inputType;
+    }
+
+    public String getMetadata() {
+        return metadata;
+    }
+
+    public void setMetadata(String metadata) {
+        this.metadata = metadata;
+    }
+
+    public Resource create(ResourceType type) {
+        logger.error("Unsupported resource type for experiment input data resource.", new UnsupportedOperationException());
+        throw new UnsupportedOperationException();
+    }
+
+    public void remove(ResourceType type, Object name) {
+        logger.error("Unsupported resource type for experiment input data resource.", new UnsupportedOperationException());
+        throw new UnsupportedOperationException();
+    }
+
+    public Resource get(ResourceType type, Object name) {
+        logger.error("Unsupported resource type for experiment input data resource.", new UnsupportedOperationException());
+        throw new UnsupportedOperationException();
+    }
+
+    public List<Resource> get(ResourceType type) {
+        logger.error("Unsupported resource type for experiment input data resource.", new UnsupportedOperationException());
+        throw new UnsupportedOperationException();
+    }
+
+    public void save() {
+        EntityManager em = ResourceUtils.getEntityManager();
+        Experiment_Input existingInput = em.find(Experiment_Input.class, new Experiment_Input_PK(experimentResource.getExpID(), experimentKey));
+        em.close();
+
+        em = ResourceUtils.getEntityManager();
+        em.getTransaction().begin();
+        Experiment_Input exInput = new Experiment_Input();
+        exInput.setEx_key(experimentKey);
+        Experiment experiment = em.find(Experiment.class, experimentResource.getExpID());
+        exInput.setExperiment(experiment);
+        exInput.setExperiment_id(experiment.getExpId());
+        exInput.setValue(value);
+        exInput.setInputType(inputType);
+        exInput.setMetadata(metadata);
+
+        if (existingInput != null){
+            existingInput.setEx_key(experimentKey);
+            existingInput.setExperiment(experiment);
+            existingInput.setExperiment_id(experiment.getExpId());
+            existingInput.setValue(value);
+            existingInput.setInputType(inputType);
+            existingInput.setMetadata(metadata);
+            exInput = em.merge(existingInput);
+        }else {
+            em.persist(exInput);
+        }
+        em.getTransaction().commit();
+        em.close();
+    }
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/a584c2c7/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ExperimentMetadataResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ExperimentMetadataResource.java b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ExperimentMetadataResource.java
deleted file mode 100644
index 1178336..0000000
--- a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ExperimentMetadataResource.java
+++ /dev/null
@@ -1,482 +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.persistance.registry.jpa.resources;
-//
-//import org.apache.airavata.persistance.registry.jpa.Resource;
-//import org.apache.airavata.persistance.registry.jpa.ResourceType;
-//import org.apache.airavata.persistance.registry.jpa.ResourceUtils;
-//import org.apache.airavata.persistance.registry.jpa.model.*;
-//import org.apache.airavata.persistance.registry.jpa.utils.QueryGenerator;
-//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 ExperimentMetadataResource extends AbstractResource {
-//    private static final Logger logger = LoggerFactory.getLogger(ExperimentMetadataResource.class);
-//    private String expID;
-//    private String experimentName;
-//    private String description;
-//    private Timestamp submittedDate;
-//    private String executionUser;
-//    private GatewayResource gateway;
-//    private ProjectResource project;
-//    private boolean shareExp;
-//
-//    public static Logger getLogger() {
-//        return logger;
-//    }
-//
-//    public String getExpID() {
-//        return expID;
-//    }
-//
-//    public void setExpID(String expID) {
-//        this.expID = expID;
-//    }
-//
-//    public String getExperimentName() {
-//        return experimentName;
-//    }
-//
-//    public void setExperimentName(String experimentName) {
-//        this.experimentName = experimentName;
-//    }
-//
-//    public String getDescription() {
-//        return description;
-//    }
-//
-//    public void setDescription(String description) {
-//        this.description = description;
-//    }
-//
-//    public Timestamp getSubmittedDate() {
-//        return submittedDate;
-//    }
-//
-//    public void setSubmittedDate(Timestamp submittedDate) {
-//        this.submittedDate = submittedDate;
-//    }
-//
-//    public String getExecutionUser() {
-//        return executionUser;
-//    }
-//
-//    public void setExecutionUser(String executionUser) {
-//        this.executionUser = executionUser;
-//    }
-//
-//    public GatewayResource getGateway() {
-//        return gateway;
-//    }
-//
-//    public void setGateway(GatewayResource gateway) {
-//        this.gateway = gateway;
-//    }
-//
-//    public ProjectResource getProject() {
-//        return project;
-//    }
-//
-//    public void setProject(ProjectResource project) {
-//        this.project = project;
-//    }
-//
-//    public boolean isShareExp() {
-//        return shareExp;
-//    }
-//
-//    public void setShareExp(boolean shareExp) {
-//        this.shareExp = shareExp;
-//    }
-//
-//    public Resource create(ResourceType type) {
-//        switch (type) {
-//            case EXPERIMENT_CONFIG_DATA:
-//                ExperimentConfigDataResource configDataResource = new ExperimentConfigDataResource();
-//                configDataResource.setExMetadata(this);
-//                return configDataResource;
-//            case EXPERIMENT_SUMMARY:
-//                ExperimentSummaryResource summaryResource = new ExperimentSummaryResource();
-//                summaryResource.setExperimentMetadataResource(this);
-//                return summaryResource;
-//            case EXPERIMENT_INPUT:
-//                ExperimentInputResource exInputResource = new ExperimentInputResource();
-//                exInputResource.setExperimentMetadataResource(this);
-//                return exInputResource;
-//            case EXPERIMENT_OUTPUT:
-//                ExperimentOutputResource exOutputResouce = new ExperimentOutputResource();
-//                exOutputResouce.setExperimentMetadataResource(this);
-//                return exOutputResouce;
-//            case WORKFLOW_DATA:
-//                WorkflowDataResource workflowDataResource = new WorkflowDataResource();
-//                workflowDataResource.setExperimentID(expID);
-//                return workflowDataResource;
-//            case EXECUTION_ERROR:
-//                ExecutionErrorResource executionErrorResource = new ExecutionErrorResource();
-//                executionErrorResource.setMetadataResource(this);
-//                return executionErrorResource;
-//            case GFAC_JOB_DATA:
-//                GFacJobDataResource gFacJobDataResource = new GFacJobDataResource();
-//                gFacJobDataResource.setMetadataResource(this);
-//                return gFacJobDataResource;
-//            default:
-//                logger.error("Unsupported resource type for experiment metadata resource.", new IllegalArgumentException());
-//                throw new IllegalArgumentException("Unsupported resource type for gateway resource.");
-//            }
-//    }
-//
-//    public void remove(ResourceType type, Object name) {
-//        EntityManager em = ResourceUtils.getEntityManager();
-//        em.getTransaction().begin();
-//        Query q;
-//        QueryGenerator generator;
-//        switch (type){
-//            case EXPERIMENT_CONFIG_DATA:
-//                generator = new QueryGenerator(EXPERIMENT_CONFIG_DATA);
-//                generator.setParameter(ExperimentConfigurationDataConstants.EXPERIMENT_ID, name);
-//                q = generator.deleteQuery(em);
-//                q.executeUpdate();
-//                break;
-//            case EXPERIMENT_SUMMARY:
-//                generator = new QueryGenerator(EXPERIMENT_SUMMARY);
-//                generator.setParameter(ExperimentSummaryConstants.EXPERIMENT_ID, name);
-//                q = generator.deleteQuery(em);
-//                q.executeUpdate();
-//                break;
-//            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 WORKFLOW_DATA:
-//                generator = new QueryGenerator(WORKFLOW_DATA);
-//                generator.setParameter(WorkflowDataConstants.WORKFLOW_INSTANCE_ID, name);
-//                q = generator.deleteQuery(em);
-//                q.executeUpdate();
-//                break;
-//            case GFAC_JOB_DATA:
-//                generator = new QueryGenerator(GFAC_JOB_DATA);
-//                generator.setParameter(GFacJobDataConstants.LOCAL_JOB_ID, name);
-//                q = generator.deleteQuery(em);
-//                q.executeUpdate();
-//                break;
-//            default:
-//                logger.error("Unsupported operation for experiment metadata resource "
-//                + "since there are no child resources generated by experiment metadata resource.. ",
-//                new UnsupportedOperationException());
-//                throw new UnsupportedOperationException();
-//        }
-//        em.getTransaction().commit();
-//        em.close();
-//    }
-//
-//    public Resource get(ResourceType type, Object name) {
-//        EntityManager em = ResourceUtils.getEntityManager();
-//        em.getTransaction().begin();
-//        QueryGenerator generator;
-//        Query q;
-//        switch (type) {
-//            case EXPERIMENT_CONFIG_DATA:
-//                generator = new QueryGenerator(EXPERIMENT_CONFIG_DATA);
-//                generator.setParameter(ExperimentConfigurationDataConstants.EXPERIMENT_ID, name);
-//                q = generator.selectQuery(em);
-//                Experiment_Configuration_Data exConfigData = (Experiment_Configuration_Data) q.getSingleResult();
-//                ExperimentConfigDataResource experimentConfigDataResource =
-//                        (ExperimentConfigDataResource)Utils.getResource(ResourceType.EXPERIMENT_CONFIG_DATA, exConfigData);
-//                em.getTransaction().commit();
-//                em.close();
-//                return experimentConfigDataResource;
-//            case EXPERIMENT_SUMMARY:
-//                generator = new QueryGenerator(EXPERIMENT_SUMMARY);
-//                generator.setParameter(ExperimentSummaryConstants.EXPERIMENT_ID, name);
-//                q = generator.selectQuery(em);
-//                Experiment_Summary exSummaryData = (Experiment_Summary) q.getSingleResult();
-//                ExperimentSummaryResource exSummary =
-//                        (ExperimentSummaryResource)Utils.getResource(ResourceType.EXPERIMENT_SUMMARY, exSummaryData);
-//                em.getTransaction().commit();
-//                em.close();
-//                return exSummary;
-//            case EXPERIMENT_INPUT:
-//                generator = new QueryGenerator(EXPERIMENT_INPUT);
-//                generator.setParameter(ExperimentInputConstants.EXPERIMENT_ID, name);
-//                q = generator.selectQuery(em);
-//                Experiment_Input exInput = (Experiment_Input) q.getSingleResult();
-//                ExperimentInputResource experimentInput =
-//                        (ExperimentInputResource)Utils.getResource(ResourceType.EXPERIMENT_INPUT, exInput);
-//                em.getTransaction().commit();
-//                em.close();
-//                return experimentInput;
-//            case EXPERIMENT_OUTPUT:
-//                generator = new QueryGenerator(EXPERIMENT_OUTPUT);
-//                generator.setParameter(ExperimentOutputConstants.EXPERIMENT_ID, name);
-//                q = generator.selectQuery(em);
-//                Experiment_Output exOutput = (Experiment_Output) q.getSingleResult();
-//                ExperimentOutputResource experimentOutput =
-//                        (ExperimentOutputResource)Utils.getResource(ResourceType.EXPERIMENT_OUTPUT, exOutput);
-//                em.getTransaction().commit();
-//                em.close();
-//                return experimentOutput;
-//            case WORKFLOW_DATA:
-//                generator = new QueryGenerator(WORKFLOW_DATA);
-////                generator.setParameter(WorkflowDataConstants.EXPERIMENT_ID, experimentID);
-//                generator.setParameter(WorkflowDataConstants.WORKFLOW_INSTANCE_ID, name);
-//                q = generator.selectQuery(em);
-//                Workflow_Data eworkflowData = (Workflow_Data)q.getSingleResult();
-//                WorkflowDataResource workflowDataResource = (WorkflowDataResource)Utils.getResource(ResourceType.WORKFLOW_DATA, eworkflowData);
-//                em.getTransaction().commit();
-//                em.close();
-//                return workflowDataResource;
-//            case GFAC_JOB_DATA:
-//                generator = new QueryGenerator(GFAC_JOB_DATA);
-//                generator.setParameter(GFacJobDataConstants.LOCAL_JOB_ID, name);
-//                q = generator.selectQuery(em);
-//                GFac_Job_Data gFacJobData = (GFac_Job_Data)q.getSingleResult();
-//                GFacJobDataResource gFacJobDataResource = (GFacJobDataResource)Utils.getResource(ResourceType.GFAC_JOB_DATA, gFacJobData);
-//                em.getTransaction().commit();
-//                em.close();
-//                return gFacJobDataResource;
-//            default:
-//                logger.error("Unsupported operation for experiment metadata resource "
-//                        + "since there are no child resources generated by experiment metadata resource.. ",
-//                        new UnsupportedOperationException());
-//                throw new UnsupportedOperationException();
-//        }
-//    }
-//
-//    public List<Resource> get(ResourceType type) {
-//        List<Resource> resourceList = new ArrayList<Resource>();
-//        EntityManager 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 expInput = (Experiment_Input) result;
-//                        ExperimentInputResource experimentResource =
-//                                (ExperimentInputResource)Utils.getResource(ResourceType.EXPERIMENT_INPUT, expInput);
-//                        resourceList.add(experimentResource);
-//                    }
-//                }
-//                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 expOutput = (Experiment_Output) result;
-//                        ExperimentOutputResource experimentResource =
-//                                (ExperimentOutputResource)Utils.getResource(ResourceType.EXPERIMENT_INPUT, expOutput);
-//                        resourceList.add(experimentResource);
-//                    }
-//                }
-//                break;
-//            case WORKFLOW_DATA:
-//                generator = new QueryGenerator(WORKFLOW_DATA);
-////                generator.setParameter(WorkflowDataConstants.EXPERIMENT_ID, experimentID);
-//                Experiment_Metadata experiment_metadata = em.find(Experiment_Metadata.class, expID);
-//                generator.setParameter("experiment_metadata", experiment_metadata);
-//                q = generator.selectQuery(em);
-//                results = q.getResultList();
-//                if (results.size() != 0) {
-//                    for (Object result : results) {
-//                        Workflow_Data workflowData = (Workflow_Data) result;
-//                        WorkflowDataResource workflowDataResource = (WorkflowDataResource)Utils.getResource(ResourceType.WORKFLOW_DATA, workflowData);
-//                        resourceList.add(workflowDataResource);
-//                    }
-//                }
-//                break;
-//            case EXECUTION_ERROR:
-//                generator = new QueryGenerator(EXECUTION_ERROR);
-//                generator.setParameter(ExecutionErrorConstants.EXPERIMENT_ID, expID);
-//                q = generator.selectQuery(em);
-//                results = q.getResultList();
-//                if (results.size() != 0) {
-//                    for (Object result : results) {
-//                        Execution_Error executionError = (Execution_Error)result;
-//                        ExecutionErrorResource executionErrorResource = (ExecutionErrorResource)Utils.getResource(ResourceType.EXECUTION_ERROR, executionError);
-//                        resourceList.add(executionErrorResource);
-//                    }
-//                }
-//                break;
-//            case GFAC_JOB_DATA:
-//                generator = new QueryGenerator(GFAC_JOB_DATA);
-//                generator.setParameter(GFacJobDataConstants.EXPERIMENT_ID, expID);
-//                q = generator.selectQuery(em);
-//                results = q.getResultList();
-//                if (results.size() != 0) {
-//                    for (Object result : results) {
-//                        GFac_Job_Data gFacJobData = (GFac_Job_Data)result;
-//                        GFacJobDataResource gFacJobDataResource = (GFacJobDataResource)Utils.getResource(ResourceType.GFAC_JOB_DATA, gFacJobData);
-//                        resourceList.add(gFacJobDataResource);
-//                    }
-//                }
-//                break;
-//            default:
-//                logger.error("Unsupported operation for experiment metadata resource "
-//                        + "since there are no child resources generated by experiment metadata resource.. ",
-//                        new UnsupportedOperationException());
-//                throw new UnsupportedOperationException();
-//        }
-//        em.getTransaction().commit();
-//        em.close();
-//        return resourceList;
-//    }
-//
-//    public void save() {
-//        EntityManager em = ResourceUtils.getEntityManager();
-//        Experiment_Metadata existingExpMetaData = em.find(Experiment_Metadata.class, expID);
-//        em.close();
-//
-//        em = ResourceUtils.getEntityManager();
-//        em.getTransaction().begin();
-//        Experiment_Metadata experimentMetadata = new Experiment_Metadata();
-//        experimentMetadata.setExperiment_id(expID);
-//        experimentMetadata.setExperiment_name(experimentName);
-//        experimentMetadata.setShare_experiment(shareExp);
-//        experimentMetadata.setDescription(description);
-//        Gateway gatewayModel = em.find(Gateway.class, gateway.getGatewayName());
-//        experimentMetadata.setGateway(gatewayModel);
-//        Project projectModel = em.find(Project.class, project.getName());
-//        experimentMetadata.setProject(projectModel);
-//        experimentMetadata.setExecution_user(executionUser);
-//        experimentMetadata.setSubmitted_date(submittedDate);
-//        if (existingExpMetaData != null) {
-//            existingExpMetaData.setExperiment_id(expID);
-//            existingExpMetaData.setDescription(description);
-//            existingExpMetaData.setExperiment_name(experimentName);
-//            existingExpMetaData.setGateway(gatewayModel);
-//            existingExpMetaData.setExecution_user(executionUser);
-//            existingExpMetaData.setProject(projectModel);
-//            existingExpMetaData.setShare_experiment(shareExp);
-//            existingExpMetaData.setSubmitted_date(submittedDate);
-//            experimentMetadata = em.merge(existingExpMetaData);
-//        } else {
-//            em.persist(experimentMetadata);
-//        }
-//        em.getTransaction().commit();
-//        em.close();
-//
-//    }
-//
-//    public boolean isWorkflowInstancePresent(String workflowInstanceId){
-//        return isExists(ResourceType.WORKFLOW_DATA, workflowInstanceId);
-//    }
-//
-//    public boolean isGFacJobPresent(String jobId){
-//        return isExists(ResourceType.GFAC_JOB_DATA, jobId);
-//    }
-//
-//    public WorkflowDataResource getWorkflowInstance(String workflowInstanceId){
-//        return (WorkflowDataResource)get(ResourceType.WORKFLOW_DATA, workflowInstanceId);
-//    }
-//
-//    public List<Resource> getGFacJobs(){
-//        return get(ResourceType.GFAC_JOB_DATA);
-//    }
-//
-//    public List<WorkflowDataResource> getWorkflowInstances(){
-//        return getResourceList(get(ResourceType.WORKFLOW_DATA),WorkflowDataResource.class);
-//    }
-//
-//    public WorkflowDataResource createWorkflowInstanceResource(String workflowInstanceID){
-//        WorkflowDataResource r=(WorkflowDataResource)create(ResourceType.WORKFLOW_DATA);
-//        r.setWorkflowInstanceID(workflowInstanceID);
-//        return r;
-//    }
-//
-//    public GFacJobDataResource createGFacJob(String jobID){
-//        GFacJobDataResource r=(GFacJobDataResource)create(ResourceType.GFAC_JOB_DATA);
-//        r.setLocalJobID(jobID);
-//        return r;
-//    }
-//
-//    public ExperimentMetadataResource createExperimentMetadata(){
-//        return (ExperimentMetadataResource)create(ResourceType.EXPERIMENT_METADATA);
-//    }
-//
-//    public ExecutionErrorResource createExecutionError(){
-//        return (ExecutionErrorResource) create(ResourceType.EXECUTION_ERROR);
-//    }
-//
-//    public void removeWorkflowInstance(String workflowInstanceId){
-//        remove(ResourceType.WORKFLOW_DATA, workflowInstanceId);
-//    }
-//
-//    public List<ExecutionErrorResource> getExecutionErrors(String type, String experimentId, String workflowInstanceId, String nodeId, String gfacJobId){
-//        List<ExecutionErrorResource> resourceList = new ArrayList<ExecutionErrorResource>();
-//        EntityManager em = ResourceUtils.getEntityManager();
-//        em.getTransaction().begin();
-//        Query q;
-//        QueryGenerator generator;
-//        List<?> results;
-//        generator = new QueryGenerator(EXECUTION_ERROR);
-//        if (experimentId!=null){
-//            generator.setParameter(ExecutionErrorConstants.EXPERIMENT_ID, experimentId);
-//        }
-//        if (type!=null){
-//            generator.setParameter(ExecutionErrorConstants.SOURCE_TYPE, type);
-//        }
-//        if (workflowInstanceId!=null){
-//            generator.setParameter(ExecutionErrorConstants.WORKFLOW_ID, workflowInstanceId);
-//        }
-//        if (nodeId!=null){
-//            generator.setParameter(ExecutionErrorConstants.NODE_ID, nodeId);
-//        }
-//        if (gfacJobId!=null){
-//            generator.setParameter(ExecutionErrorConstants.GFAC_JOB_ID, gfacJobId);
-//        }
-//        q = generator.selectQuery(em);
-//        results = q.getResultList();
-//        if (results.size() != 0) {
-//            for (Object result : results) {
-//                Execution_Error executionError = (Execution_Error)result;
-//                ExecutionErrorResource executionErrorResource = (ExecutionErrorResource)Utils.getResource(ResourceType.EXECUTION_ERROR, executionError);
-//                resourceList.add(executionErrorResource);
-//            }
-//        }
-//        em.getTransaction().commit();
-//        em.close();
-//        return resourceList;
-//    }
-//}

http://git-wip-us.apache.org/repos/asf/airavata/blob/a584c2c7/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ExperimentOutputResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ExperimentOutputResource.java b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ExperimentOutputResource.java
index bcd70e8..d5ed2a5 100644
--- a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ExperimentOutputResource.java
+++ b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ExperimentOutputResource.java
@@ -1,113 +1,135 @@
-///*
-// *
-// * Licensed to the Apache Software Foundation (ASF) under one
-// * or more contributor license agreements.  See the NOTICE file
-// * distributed with this work for additional information
-// * regarding copyright ownership.  The ASF licenses this file
-// * to you under the Apache License, Version 2.0 (the
-// * "License"); you may not use this file except in compliance
-// * with the License.  You may obtain a copy of the License at
-// *
-// *   http://www.apache.org/licenses/LICENSE-2.0
-// *
-// * Unless required by applicable law or agreed to in writing,
-// * software distributed under the License is distributed on an
-// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS 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.persistance.registry.jpa.resources;
-//
-//import org.apache.airavata.persistance.registry.jpa.Resource;
-//import org.apache.airavata.persistance.registry.jpa.ResourceType;
-//import org.apache.airavata.persistance.registry.jpa.ResourceUtils;
-//import org.apache.airavata.persistance.registry.jpa.model.Experiment_Metadata;
-//import org.apache.airavata.persistance.registry.jpa.model.Experiment_Output;
-//import org.apache.airavata.persistance.registry.jpa.model.Experiment_Output_PK;
-//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 ExperimentMetadataResource experimentMetadataResource;
-//    private String experimentKey;
-//    private String value;
-//
-//    public ExperimentMetadataResource getExperimentMetadataResource() {
-//        return experimentMetadataResource;
-//    }
-//
-//    public void setExperimentMetadataResource(ExperimentMetadataResource experimentMetadataResource) {
-//        this.experimentMetadataResource = experimentMetadataResource;
-//    }
-//
-//    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 Resource create(ResourceType type) {
-//        logger.error("Unsupported resource type for experiment output data resource.", new UnsupportedOperationException());
-//        throw new UnsupportedOperationException();
-//    }
-//
-//    public void remove(ResourceType type, Object name) {
-//        logger.error("Unsupported resource type for experiment output data resource.", new UnsupportedOperationException());
-//        throw new UnsupportedOperationException();
-//    }
-//
-//    public Resource get(ResourceType type, Object name) {
-//        logger.error("Unsupported resource type for experiment output data resource.", new UnsupportedOperationException());
-//        throw new UnsupportedOperationException();
-//    }
-//
-//    public List<Resource> get(ResourceType type) {
-//        logger.error("Unsupported resource type for experiment output data resource.", new UnsupportedOperationException());
-//        throw new UnsupportedOperationException();
-//    }
-//
-//    public void save() {
-//        EntityManager em = ResourceUtils.getEntityManager();
-//        Experiment_Output existingOutput = em.find(Experiment_Output.class, new Experiment_Output_PK(experimentMetadataResource.getExpID(), experimentKey));
-//        em.close();
-//
-//        em = ResourceUtils.getEntityManager();
-//        em.getTransaction().begin();
-//        Experiment_Output exOutput = new Experiment_Output();
-//        exOutput.setEx_key(experimentKey);
-//        Experiment_Metadata metadata = em.find(Experiment_Metadata.class, experimentMetadataResource.getExpID());
-//        exOutput.setExperiment_metadata(metadata);
-//        exOutput.setExperiment_id(metadata.getExperiment_id());
-//        exOutput.setValue(value);
-//
-//        if (existingOutput != null){
-//            existingOutput.setEx_key(experimentKey);
-//            existingOutput.setExperiment_metadata(metadata);
-//            existingOutput.setValue(value);
-//            existingOutput.setExperiment_id(metadata.getExperiment_id());
-//            exOutput = em.merge(existingOutput);
-//        }else {
-//            em.persist(exOutput);
-//        }
-//        em.getTransaction().commit();
-//        em.close();
-//    }
-//}
+/*
+*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements.  See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership.  The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License.  You may obtain a copy of the License at
+*
+*   http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS 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.persistance.registry.jpa.resources;
+
+import org.apache.airavata.persistance.registry.jpa.Resource;
+import org.apache.airavata.persistance.registry.jpa.ResourceType;
+import org.apache.airavata.persistance.registry.jpa.ResourceUtils;
+import org.apache.airavata.persistance.registry.jpa.model.Experiment;
+import org.apache.airavata.persistance.registry.jpa.model.Experiment_Output;
+import org.apache.airavata.persistance.registry.jpa.model.Experiment_Output_PK;
+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 ExperimentResource experimentResource;
+    private String experimentKey;
+    private String value;
+    private String outputType;
+    private String metadata;
+
+    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 ExperimentResource getExperimentResource() {
+        return experimentResource;
+    }
+
+    public void setExperimentResource(ExperimentResource experimentResource) {
+        this.experimentResource = experimentResource;
+    }
+
+    public String getOutputType() {
+        return outputType;
+    }
+
+    public void setOutputType(String outputType) {
+        this.outputType = outputType;
+    }
+
+    public String getMetadata() {
+        return metadata;
+    }
+
+    public void setMetadata(String metadata) {
+        this.metadata = metadata;
+    }
+
+    public Resource create(ResourceType type) {
+        logger.error("Unsupported resource type for experiment output data resource.", new UnsupportedOperationException());
+        throw new UnsupportedOperationException();
+    }
+
+    public void remove(ResourceType type, Object name) {
+        logger.error("Unsupported resource type for experiment output data resource.", new UnsupportedOperationException());
+        throw new UnsupportedOperationException();
+    }
+
+    public Resource get(ResourceType type, Object name) {
+        logger.error("Unsupported resource type for experiment output data resource.", new UnsupportedOperationException());
+        throw new UnsupportedOperationException();
+    }
+
+    public List<Resource> get(ResourceType type) {
+        logger.error("Unsupported resource type for experiment output data resource.", new UnsupportedOperationException());
+        throw new UnsupportedOperationException();
+    }
+
+    public void save() {
+        EntityManager em = ResourceUtils.getEntityManager();
+        Experiment_Output existingOutput = em.find(Experiment_Output.class, new Experiment_Output_PK(experimentResource.getExpID(), experimentKey));
+        em.close();
+
+        em = ResourceUtils.getEntityManager();
+        em.getTransaction().begin();
+        Experiment_Output exOutput = new Experiment_Output();
+        exOutput.setEx_key(experimentKey);
+        Experiment experiment = em.find(Experiment.class, experimentResource.getExpID());
+        exOutput.setExperiment(experiment);
+        exOutput.setExperiment_id(experiment.getExpId());
+        exOutput.setValue(value);
+        exOutput.setOutputKeyType(outputType);
+        exOutput.setMetadata(metadata);
+
+        if (existingOutput != null){
+            existingOutput.setEx_key(experimentKey);
+            existingOutput.setExperiment(experiment);
+            existingOutput.setValue(value);
+            existingOutput.setExperiment_id(experiment.getExpId());
+            existingOutput.setOutputKeyType(outputType);
+            existingOutput.setMetadata(metadata);
+            exOutput = em.merge(existingOutput);
+        }else {
+            em.persist(exOutput);
+        }
+        em.getTransaction().commit();
+        em.close();
+    }
+}


Mime
View raw message