airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chath...@apache.org
Subject [2/3] adding throw statements to registry cpi impl
Date Sun, 02 Mar 2014 21:53:58 GMT
http://git-wip-us.apache.org/repos/asf/airavata/blob/4bd8af6f/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/ExperimentRegistry.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/ExperimentRegistry.java b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/ExperimentRegistry.java
index 04e2330..a4bac31 100644
--- a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/ExperimentRegistry.java
+++ b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/ExperimentRegistry.java
@@ -48,10 +48,10 @@ public class ExperimentRegistry {
         workerResource.save();
     }
 
-    public String addExperiment(Experiment experiment) throws Exception{
+    public String addExperiment(Experiment experiment) throws Exception {
         String experimentID = "";
         try {
-            if (!ResourceUtils.isUserExist(experiment.getUserName())){
+            if (!ResourceUtils.isUserExist(experiment.getUserName())) {
                 logger.error("User does not exist in the system..");
                 throw new Exception("User does not exist in the system..");
             }
@@ -62,12 +62,12 @@ public class ExperimentRegistry {
             experimentResource.setExecutionUser(experiment.getUserName());
             experimentResource.setGateway(gatewayResource);
             ProjectResource project;
-            if (!workerResource.isProjectExists(experiment.getProjectID())){
+            if (!workerResource.isProjectExists(experiment.getProjectID())) {
                 project = workerResource.createProject(experiment.getProjectID());
                 project.setGateway(gatewayResource);
                 project.save();
                 experimentResource.setProject(project);
-            }else {
+            } else {
                 project = workerResource.getProject(experiment.getProjectID());
                 experimentResource.setProject(project);
             }
@@ -80,25 +80,26 @@ public class ExperimentRegistry {
             experimentResource.setWorkflowExecutionId(experiment.getWorkflowExecutionInstanceId());
             experimentResource.save();
             List<DataObjectType> experimentInputs = experiment.getExperimentInputs();
-            if (experimentInputs != null){
+            if (experimentInputs != null) {
                 addExpInputs(experimentInputs, experimentResource);
             }
 
             UserConfigurationData userConfigurationData = experiment.getUserConfigurationData();
-            if (userConfigurationData != null){
+            if (userConfigurationData != null) {
                 addUserConfigData(userConfigurationData, experimentID);
             }
 
-        } catch (Exception e){
+        } catch (Exception e) {
             logger.error("Error while saving experiment to registry", e.getMessage());
+            throw new Exception(e);
         }
         return experimentID;
     }
 
-    public String addUserConfigData(UserConfigurationData configurationData, String experimentID) {
+    public String addUserConfigData(UserConfigurationData configurationData, String experimentID) throws Exception {
         try {
             ExperimentResource experiment = gatewayResource.getExperiment(experimentID);
-            ConfigDataResource configData = (ConfigDataResource)experiment.create(ResourceType.CONFIG_DATA);
+            ConfigDataResource configData = (ConfigDataResource) experiment.create(ResourceType.CONFIG_DATA);
             configData.setExperimentResource(experiment);
             configData.setAiravataAutoSchedule(configurationData.isAiravataAutoSchedule());
             configData.setOverrideManualParams(configurationData.isOverrideManualScheduledParams());
@@ -115,118 +116,154 @@ public class ExperimentRegistry {
 
             AdvancedOutputDataHandling outputDataHandling = configurationData.getAdvanceOutputDataHandling();
             if (outputDataHandling != null) {
-                addOutputDataHandling(outputDataHandling,experiment);
+                addOutputDataHandling(outputDataHandling, experiment);
             }
 
             QualityOfServiceParams qosParams = configurationData.getQosParams();
             if (qosParams != null) {
-                addQosParams(qosParams,experiment);
+                addQosParams(qosParams, experiment);
             }
-        } catch (Exception e){
+        } catch (Exception e) {
             logger.error("Unable to save user config data", e.getMessage());
+            throw new Exception(e);
         }
         return experimentID;
     }
 
-    public void addQosParams(QualityOfServiceParams qosParams, Resource resource) {
-        QosParamResource qosr = new QosParamResource();
-        if (resource instanceof  ExperimentResource){
-            ExperimentResource experiment = (ExperimentResource)resource;
-            qosr.setExperimentResource(experiment);
-        }
-        if (resource instanceof TaskDetailResource){
-            TaskDetailResource taskDetailResource = (TaskDetailResource)resource;
-            qosr.setTaskDetailResource(taskDetailResource);
+    public void addQosParams(QualityOfServiceParams qosParams, Resource resource) throws Exception {
+        try {
+            QosParamResource qosr = new QosParamResource();
+            if (resource instanceof ExperimentResource) {
+                ExperimentResource experiment = (ExperimentResource) resource;
+                qosr.setExperimentResource(experiment);
+            }
+            if (resource instanceof TaskDetailResource) {
+                TaskDetailResource taskDetailResource = (TaskDetailResource) resource;
+                qosr.setTaskDetailResource(taskDetailResource);
+            }
+            qosr.setStartExecutionAt(qosParams.getStartExecutionAt());
+            qosr.setExecuteBefore(qosParams.getExecuteBefore());
+            qosr.setNoOfRetries(qosParams.getNumberofRetries());
+            qosr.save();
+        } catch (Exception e) {
+            logger.error("Unable to save QOS params", e.getMessage());
+            throw new Exception(e);
         }
-        qosr.setStartExecutionAt(qosParams.getStartExecutionAt());
-        qosr.setExecuteBefore(qosParams.getExecuteBefore());
-        qosr.setNoOfRetries(qosParams.getNumberofRetries());
-        qosr.save();
+
     }
 
-    public void addOutputDataHandling(AdvancedOutputDataHandling outputDataHandling, Resource resource) {
+    public void addOutputDataHandling(AdvancedOutputDataHandling outputDataHandling, Resource resource) throws Exception {
         AdvancedOutputDataHandlingResource adodh = new AdvancedOutputDataHandlingResource();
-        if (resource instanceof  ExperimentResource){
-            ExperimentResource experiment = (ExperimentResource)resource;
-            adodh.setExperimentResource(experiment);
-        }
-        if (resource instanceof TaskDetailResource){
-            TaskDetailResource taskDetailResource = (TaskDetailResource)resource;
-            adodh.setTaskDetailResource(taskDetailResource);
+        try {
+            if (resource instanceof ExperimentResource) {
+                ExperimentResource experiment = (ExperimentResource) resource;
+                adodh.setExperimentResource(experiment);
+            }
+            if (resource instanceof TaskDetailResource) {
+                TaskDetailResource taskDetailResource = (TaskDetailResource) resource;
+                adodh.setTaskDetailResource(taskDetailResource);
+            }
+            adodh.setOutputDataDir(outputDataHandling.getOutputDataDir());
+            adodh.setDataRegUrl(outputDataHandling.getDataRegistryURL());
+            adodh.setPersistOutputData(outputDataHandling.isPersistOutputData());
+            adodh.save();
+        } catch (Exception e) {
+            logger.error("Unable to save output data handling data", e.getMessage());
+            throw new Exception(e);
         }
-        adodh.setOutputDataDir(outputDataHandling.getOutputDataDir());
-        adodh.setDataRegUrl(outputDataHandling.getDataRegistryURL());
-        adodh.setPersistOutputData(outputDataHandling.isPersistOutputData());
-        adodh.save();
+
     }
 
-    public void addInputDataHandling(AdvancedInputDataHandling inputDataHandling, Resource resource) {
+    public void addInputDataHandling(AdvancedInputDataHandling inputDataHandling, Resource resource) throws Exception {
         AdvanceInputDataHandlingResource adidh = new AdvanceInputDataHandlingResource();
-        if (resource instanceof  ExperimentResource){
-            ExperimentResource experiment = (ExperimentResource)resource;
-            adidh.setExperimentResource(experiment);
-        }
-        if (resource instanceof TaskDetailResource){
-            TaskDetailResource taskDetailResource = (TaskDetailResource)resource;
-            adidh.setTaskDetailResource(taskDetailResource);
+        try {
+            if (resource instanceof ExperimentResource) {
+                ExperimentResource experiment = (ExperimentResource) resource;
+                adidh.setExperimentResource(experiment);
+            }
+            if (resource instanceof TaskDetailResource) {
+                TaskDetailResource taskDetailResource = (TaskDetailResource) resource;
+                adidh.setTaskDetailResource(taskDetailResource);
+            }
+            adidh.setWorkingDir(inputDataHandling.getUniqueWorkingDirectory());
+            adidh.setWorkingDirParent(inputDataHandling.getParentWorkingDirectory());
+            adidh.setStageInputFiles(inputDataHandling.isSetStageInputFilesToWorkingDir());
+            adidh.setCleanAfterJob(inputDataHandling.isCleanUpWorkingDirAfterJob());
+            adidh.save();
+        } catch (Exception e) {
+            logger.error("Unable to save input data handling data", e.getMessage());
+            throw new Exception(e);
         }
-        adidh.setWorkingDir(inputDataHandling.getUniqueWorkingDirectory());
-        adidh.setWorkingDirParent(inputDataHandling.getParentWorkingDirectory());
-        adidh.setStageInputFiles(inputDataHandling.isSetStageInputFilesToWorkingDir());
-        adidh.setCleanAfterJob(inputDataHandling.isCleanUpWorkingDirAfterJob());
-        adidh.save();
+
     }
 
-    public void addComputationScheduling(ComputationalResourceScheduling resourceScheduling, Resource resource) {
+    public void addComputationScheduling(ComputationalResourceScheduling resourceScheduling, Resource resource) throws Exception {
         ComputationSchedulingResource cmsr = new ComputationSchedulingResource();
-        if (resource instanceof  ExperimentResource){
-            ExperimentResource experiment = (ExperimentResource)resource;
-            cmsr.setExperimentResource(experiment);
-        }
-        if (resource instanceof TaskDetailResource){
-            TaskDetailResource taskDetailResource = (TaskDetailResource)resource;
-            cmsr.setTaskDetailResource(taskDetailResource);
-            cmsr.setExperimentResource(taskDetailResource.getWorkflowNodeDetailResource().getExperimentResource());
-        }
-        cmsr.setResourceHostId(resourceScheduling.getResourceHostId());
-        cmsr.setCpuCount(resourceScheduling.getTotalCPUCount());
-        cmsr.setNodeCount(resourceScheduling.getNodeCount());
-        cmsr.setNumberOfThreads(resourceScheduling.getNumberOfThreads());
-        cmsr.setQueueName(resourceScheduling.getQueueName());
-        cmsr.setWalltimeLimit(resourceScheduling.getWallTimeLimit());
-        cmsr.setJobStartTime(getTime(resourceScheduling.getJobStartTime()));
-        cmsr.setPhysicalMemory(resourceScheduling.getTotalPhysicalMemory());
-        cmsr.setProjectName(resourceScheduling.getComputationalProjectAccount());
-        cmsr.save();
-    }
-
-    public void addExpInputs (List<DataObjectType> exInputs, ExperimentResource experimentResource ){
-        for (DataObjectType input : exInputs){
-            ExperimentInputResource resource = (ExperimentInputResource)experimentResource.create(ResourceType.EXPERIMENT_INPUT);
-            resource.setExperimentResource(experimentResource);
-            resource.setExperimentKey(input.getKey());
-            resource.setValue(input.getValue());
-            resource.setInputType(input.getType());
-            resource.setMetadata(input.getMetaData());
-            resource.save();
+        try {
+            if (resource instanceof ExperimentResource) {
+                ExperimentResource experiment = (ExperimentResource) resource;
+                cmsr.setExperimentResource(experiment);
+            }
+            if (resource instanceof TaskDetailResource) {
+                TaskDetailResource taskDetailResource = (TaskDetailResource) resource;
+                cmsr.setTaskDetailResource(taskDetailResource);
+                cmsr.setExperimentResource(taskDetailResource.getWorkflowNodeDetailResource().getExperimentResource());
+            }
+            cmsr.setResourceHostId(resourceScheduling.getResourceHostId());
+            cmsr.setCpuCount(resourceScheduling.getTotalCPUCount());
+            cmsr.setNodeCount(resourceScheduling.getNodeCount());
+            cmsr.setNumberOfThreads(resourceScheduling.getNumberOfThreads());
+            cmsr.setQueueName(resourceScheduling.getQueueName());
+            cmsr.setWalltimeLimit(resourceScheduling.getWallTimeLimit());
+            cmsr.setJobStartTime(getTime(resourceScheduling.getJobStartTime()));
+            cmsr.setPhysicalMemory(resourceScheduling.getTotalPhysicalMemory());
+            cmsr.setProjectName(resourceScheduling.getComputationalProjectAccount());
+            cmsr.save();
+        } catch (Exception e) {
+            logger.error("Unable to save computational scheduling data", e.getMessage());
+            throw new Exception(e);
         }
+
     }
 
-    public void updateExpInputs (List<DataObjectType> exInputs, ExperimentResource experimentResource ){
-        List<ExperimentInputResource> experimentInputs = experimentResource.getExperimentInputs();
-        for (DataObjectType input : exInputs){
-            for (ExperimentInputResource exinput : experimentInputs){
-                if (exinput.getExperimentKey().equals(input.getKey())){
-                    exinput.setValue(input.getValue());
-                    exinput.setInputType(input.getType());
-                    exinput.setMetadata(input.getMetaData());
-                    exinput.save();
+    public void addExpInputs(List<DataObjectType> exInputs, ExperimentResource experimentResource) throws Exception {
+        try {
+            for (DataObjectType input : exInputs) {
+                ExperimentInputResource resource = (ExperimentInputResource) experimentResource.create(ResourceType.EXPERIMENT_INPUT);
+                resource.setExperimentResource(experimentResource);
+                resource.setExperimentKey(input.getKey());
+                resource.setValue(input.getValue());
+                resource.setInputType(input.getType());
+                resource.setMetadata(input.getMetaData());
+                resource.save();
+            }
+        } catch (Exception e) {
+            logger.error("Unable to save experiment inputs", e.getMessage());
+            throw new Exception(e);
+        }
+    }
+
+    public void updateExpInputs(List<DataObjectType> exInputs, ExperimentResource experimentResource) throws Exception {
+        try {
+            List<ExperimentInputResource> experimentInputs = experimentResource.getExperimentInputs();
+            for (DataObjectType input : exInputs) {
+                for (ExperimentInputResource exinput : experimentInputs) {
+                    if (exinput.getExperimentKey().equals(input.getKey())) {
+                        exinput.setValue(input.getValue());
+                        exinput.setInputType(input.getType());
+                        exinput.setMetadata(input.getMetaData());
+                        exinput.save();
+                    }
                 }
             }
+        } catch (Exception e) {
+            logger.error("Unable to update experiment inputs", e.getMessage());
+            throw new Exception(e);
         }
+
     }
 
-    public String addExpOutputs(List<DataObjectType> exOutput, String expId) {
+    public String addExpOutputs(List<DataObjectType> exOutput, String expId) throws Exception {
         try {
             ExperimentResource experiment = gatewayResource.getExperiment(expId);
             for (DataObjectType output : exOutput) {
@@ -240,17 +277,18 @@ public class ExperimentRegistry {
             }
         } catch (Exception e) {
             logger.error("Error while adding experiment outputs...", e.getMessage());
+            throw new Exception(e);
         }
         return expId;
     }
 
-    public void updateExpOutputs(List<DataObjectType> exOutput, String expId) {
+    public void updateExpOutputs(List<DataObjectType> exOutput, String expId) throws Exception {
         try {
             ExperimentResource experiment = gatewayResource.getExperiment(expId);
             List<ExperimentOutputResource> existingExpOutputs = experiment.getExperimentOutputs();
             for (DataObjectType output : exOutput) {
-                for (ExperimentOutputResource resource : existingExpOutputs){
-                    if (resource.getExperimentKey().equals(output.getKey())){
+                for (ExperimentOutputResource resource : existingExpOutputs) {
+                    if (resource.getExperimentKey().equals(output.getKey())) {
                         resource.setExperimentResource(experiment);
                         resource.setExperimentKey(output.getKey());
                         resource.setValue(output.getValue());
@@ -262,12 +300,13 @@ public class ExperimentRegistry {
             }
         } catch (Exception e) {
             logger.error("Error while updating experiment outputs", e.getMessage());
+            throw new Exception(e);
         }
     }
 
-    public String addNodeOutputs (List<DataObjectType> wfOutputs, CompositeIdentifier ids ) {
+    public String addNodeOutputs(List<DataObjectType> wfOutputs, CompositeIdentifier ids) throws Exception {
         try {
-            ExperimentResource experiment = gatewayResource.getExperiment((String)ids.getTopLevelIdentifier());
+            ExperimentResource experiment = gatewayResource.getExperiment((String) ids.getTopLevelIdentifier());
             WorkflowNodeDetailResource workflowNode = experiment.getWorkflowNode((String) ids.getSecondLevelIdentifier());
             for (DataObjectType output : wfOutputs) {
                 NodeOutputResource resource = (NodeOutputResource) workflowNode.create(ResourceType.NODE_OUTPUT);
@@ -280,17 +319,18 @@ public class ExperimentRegistry {
             }
         } catch (Exception e) {
             logger.error("Error while adding node outputs...", e.getMessage());
+            throw new Exception(e);
         }
-        return (String)ids.getSecondLevelIdentifier();
+        return (String) ids.getSecondLevelIdentifier();
     }
 
-    public void updateNodeOutputs (List<DataObjectType> wfOutputs, String nodeId ) {
+    public void updateNodeOutputs(List<DataObjectType> wfOutputs, String nodeId) throws Exception {
         try {
-            ExperimentResource experiment = (ExperimentResource)gatewayResource.create(ResourceType.EXPERIMENT);
+            ExperimentResource experiment = (ExperimentResource) gatewayResource.create(ResourceType.EXPERIMENT);
             WorkflowNodeDetailResource workflowNode = experiment.getWorkflowNode(nodeId);
             List<NodeOutputResource> nodeOutputs = workflowNode.getNodeOutputs();
             for (DataObjectType output : wfOutputs) {
-                for (NodeOutputResource resource : nodeOutputs){
+                for (NodeOutputResource resource : nodeOutputs) {
                     resource.setNodeDetailResource(workflowNode);
                     resource.setOutputKey(output.getKey());
                     resource.setValue(output.getValue());
@@ -301,12 +341,13 @@ public class ExperimentRegistry {
             }
         } catch (Exception e) {
             logger.error("Error while updating node outputs...", e.getMessage());
+            throw new Exception(e);
         }
     }
 
-    public String addApplicationOutputs (List<DataObjectType> appOutputs, CompositeIdentifier ids ) {
+    public String addApplicationOutputs(List<DataObjectType> appOutputs, CompositeIdentifier ids) throws Exception {
         try {
-            ExperimentResource experiment = (ExperimentResource)gatewayResource.create(ResourceType.EXPERIMENT);
+            ExperimentResource experiment = (ExperimentResource) gatewayResource.create(ResourceType.EXPERIMENT);
             WorkflowNodeDetailResource workflowNode = experiment.getWorkflowNode((String) ids.getTopLevelIdentifier());
             TaskDetailResource taskDetail = workflowNode.getTaskDetail((String) ids.getSecondLevelIdentifier());
             for (DataObjectType output : appOutputs) {
@@ -320,16 +361,17 @@ public class ExperimentRegistry {
             }
         } catch (Exception e) {
             logger.error("Error while adding application outputs...", e.getMessage());
+            throw new Exception(e);
         }
-        return (String)ids.getSecondLevelIdentifier();
+        return (String) ids.getSecondLevelIdentifier();
     }
 
-    public String updateExperimentStatus (ExperimentStatus experimentStatus, String expId){
-        try{
+    public String updateExperimentStatus(ExperimentStatus experimentStatus, String expId) throws Exception {
+        try {
             ExperimentResource experiment = gatewayResource.getExperiment(expId);
             StatusResource status = experiment.getExperimentStatus();
-            if (status == null){
-                status = (StatusResource)experiment.create(ResourceType.STATUS);
+            if (status == null) {
+                status = (StatusResource) experiment.create(ResourceType.STATUS);
             }
             status.setExperimentResource(experiment);
             status.setStatusUpdateTime(getTime(experimentStatus.getTimeOfStateChange()));
@@ -338,15 +380,16 @@ public class ExperimentRegistry {
             status.save();
         } catch (Exception e) {
             logger.error("Error while updating experiment status...", e.getMessage());
+            throw new Exception(e);
         }
         return expId;
     }
 
-    public String addWorkflowNodeStatus(WorkflowNodeStatus status, CompositeIdentifier ids) {
+    public String addWorkflowNodeStatus(WorkflowNodeStatus status, CompositeIdentifier ids) throws Exception {
         try {
-            ExperimentResource experiment = gatewayResource.getExperiment((String)ids.getTopLevelIdentifier());
+            ExperimentResource experiment = gatewayResource.getExperiment((String) ids.getTopLevelIdentifier());
             WorkflowNodeDetailResource workflowNode = experiment.getWorkflowNode((String) ids.getSecondLevelIdentifier());
-            StatusResource statusResource = (StatusResource)experiment.create(ResourceType.STATUS);
+            StatusResource statusResource = (StatusResource) experiment.create(ResourceType.STATUS);
             statusResource.setExperimentResource(experiment);
             statusResource.setWorkflowNodeDetail(workflowNode);
             statusResource.setStatusType(StatusType.WORKFLOW_NODE.toString());
@@ -356,13 +399,13 @@ public class ExperimentRegistry {
             return String.valueOf(statusResource.getStatusId());
         } catch (Exception e) {
             logger.error("Error while adding workflow node status...", e.getMessage());
+            throw new Exception(e);
         }
-        return null;
     }
 
-    public String updateWorkflowNodeStatus(WorkflowNodeStatus status, String nodeId) {
+    public String updateWorkflowNodeStatus(WorkflowNodeStatus status, String nodeId) throws Exception {
         try {
-            ExperimentResource experiment = (ExperimentResource)gatewayResource.create(ResourceType.EXPERIMENT);
+            ExperimentResource experiment = (ExperimentResource) gatewayResource.create(ResourceType.EXPERIMENT);
             WorkflowNodeDetailResource workflowNode = experiment.getWorkflowNode(nodeId);
             StatusResource statusResource = workflowNode.getWorkflowNodeStatus();
             statusResource.setExperimentResource(workflowNode.getExperimentResource());
@@ -374,16 +417,16 @@ public class ExperimentRegistry {
             return String.valueOf(statusResource.getStatusId());
         } catch (Exception e) {
             logger.error("Error whilw updating workflow node status...", e.getMessage());
+            throw new Exception(e);
         }
-        return null;
     }
 
-    public String addTaskStatus(TaskStatus status, CompositeIdentifier ids) {
+    public String addTaskStatus(TaskStatus status, CompositeIdentifier ids) throws Exception {
         try {
-            ExperimentResource experiment = (ExperimentResource)gatewayResource.create(ResourceType.EXPERIMENT);
+            ExperimentResource experiment = (ExperimentResource) gatewayResource.create(ResourceType.EXPERIMENT);
             WorkflowNodeDetailResource workflowNode = experiment.getWorkflowNode((String) ids.getTopLevelIdentifier());
             TaskDetailResource taskDetail = workflowNode.getTaskDetail((String) ids.getSecondLevelIdentifier());
-            StatusResource statusResource = (StatusResource)workflowNode.create(ResourceType.STATUS);
+            StatusResource statusResource = (StatusResource) workflowNode.create(ResourceType.STATUS);
             statusResource.setExperimentResource(workflowNode.getExperimentResource());
             statusResource.setWorkflowNodeDetail(workflowNode);
             statusResource.setTaskDetailResource(taskDetail);
@@ -394,14 +437,14 @@ public class ExperimentRegistry {
             return String.valueOf(statusResource.getStatusId());
         } catch (Exception e) {
             logger.error("Error while adding task status...", e.getMessage());
+            throw new Exception(e);
         }
-        return null;
     }
 
-    public void updateTaskStatus(TaskStatus status, String taskId) {
+    public void updateTaskStatus(TaskStatus status, String taskId) throws Exception {
         try {
-            ExperimentResource experiment = (ExperimentResource)gatewayResource.create(ResourceType.EXPERIMENT);
-            WorkflowNodeDetailResource workflowNode = (WorkflowNodeDetailResource)experiment.create(ResourceType.WORKFLOW_NODE_DETAIL);
+            ExperimentResource experiment = (ExperimentResource) gatewayResource.create(ResourceType.EXPERIMENT);
+            WorkflowNodeDetailResource workflowNode = (WorkflowNodeDetailResource) experiment.create(ResourceType.WORKFLOW_NODE_DETAIL);
             TaskDetailResource taskDetail = workflowNode.getTaskDetail(taskId);
             StatusResource statusResource = workflowNode.geTaskStatus(taskId);
             statusResource.setExperimentResource(taskDetail.getWorkflowNodeDetailResource().getExperimentResource());
@@ -413,22 +456,22 @@ public class ExperimentRegistry {
             statusResource.save();
         } catch (Exception e) {
             logger.error("Error while updating task status...", e.getMessage());
+            throw new Exception(e);
         }
     }
 
     /**
-     *
      * @param status job status
-     * @param ids composite id will contain taskid and jobid
+     * @param ids    composite id will contain taskid and jobid
      * @return status id
      */
-    public String addJobStatus(JobStatus status, CompositeIdentifier ids) {
+    public String addJobStatus(JobStatus status, CompositeIdentifier ids) throws Exception {
         try {
-            ExperimentResource experiment = (ExperimentResource)gatewayResource.create(ResourceType.EXPERIMENT);
-            WorkflowNodeDetailResource workflowNode = (WorkflowNodeDetailResource)experiment.create(ResourceType.WORKFLOW_NODE_DETAIL);
+            ExperimentResource experiment = (ExperimentResource) gatewayResource.create(ResourceType.EXPERIMENT);
+            WorkflowNodeDetailResource workflowNode = (WorkflowNodeDetailResource) experiment.create(ResourceType.WORKFLOW_NODE_DETAIL);
             TaskDetailResource taskDetail = workflowNode.getTaskDetail((String) ids.getTopLevelIdentifier());
             JobDetailResource jobDetail = taskDetail.getJobDetail((String) ids.getSecondLevelIdentifier());
-            StatusResource statusResource = (StatusResource)jobDetail.create(ResourceType.STATUS);
+            StatusResource statusResource = (StatusResource) jobDetail.create(ResourceType.STATUS);
             statusResource.setExperimentResource(taskDetail.getWorkflowNodeDetailResource().getExperimentResource());
             statusResource.setWorkflowNodeDetail(taskDetail.getWorkflowNodeDetailResource());
             statusResource.setTaskDetailResource(taskDetail);
@@ -439,15 +482,15 @@ public class ExperimentRegistry {
             return String.valueOf(statusResource.getStatusId());
         } catch (Exception e) {
             logger.error("Error while adding job status...", e.getMessage());
+            throw new Exception(e);
         }
-        return null;
     }
 
-    public String updateJobStatus(JobStatus status, String jobId) {
+    public String updateJobStatus(JobStatus status, String jobId) throws Exception {
         try {
-            ExperimentResource experiment = (ExperimentResource)gatewayResource.create(ResourceType.EXPERIMENT);
-            WorkflowNodeDetailResource workflowNode = (WorkflowNodeDetailResource)experiment.create(ResourceType.WORKFLOW_NODE_DETAIL);
-            TaskDetailResource taskDetail = (TaskDetailResource)workflowNode.create(ResourceType.TASK_DETAIL);
+            ExperimentResource experiment = (ExperimentResource) gatewayResource.create(ResourceType.EXPERIMENT);
+            WorkflowNodeDetailResource workflowNode = (WorkflowNodeDetailResource) experiment.create(ResourceType.WORKFLOW_NODE_DETAIL);
+            TaskDetailResource taskDetail = (TaskDetailResource) workflowNode.create(ResourceType.TASK_DETAIL);
             JobDetailResource jobDetail = taskDetail.getJobDetail(jobId);
             StatusResource statusResource = jobDetail.getJobStatus();
             statusResource.setExperimentResource(jobDetail.getTaskDetailResource().getWorkflowNodeDetailResource().getExperimentResource());
@@ -460,22 +503,22 @@ public class ExperimentRegistry {
             return String.valueOf(statusResource.getStatusId());
         } catch (Exception e) {
             logger.error("Error while updating job status...", e.getMessage());
+            throw new Exception(e);
         }
-        return null;
     }
 
     /**
      * @param status application status
-     * @param ids composite id will contain taskid and jobid
+     * @param ids    composite id will contain taskid and jobid
      * @return status id
      */
-    public String addApplicationStatus(ApplicationStatus status, CompositeIdentifier ids) {
+    public String addApplicationStatus(ApplicationStatus status, CompositeIdentifier ids) throws Exception {
         try {
-            ExperimentResource experiment = (ExperimentResource)gatewayResource.create(ResourceType.EXPERIMENT);
-            WorkflowNodeDetailResource workflowNode = (WorkflowNodeDetailResource)experiment.create(ResourceType.WORKFLOW_NODE_DETAIL);
+            ExperimentResource experiment = (ExperimentResource) gatewayResource.create(ResourceType.EXPERIMENT);
+            WorkflowNodeDetailResource workflowNode = (WorkflowNodeDetailResource) experiment.create(ResourceType.WORKFLOW_NODE_DETAIL);
             TaskDetailResource taskDetail = workflowNode.getTaskDetail((String) ids.getTopLevelIdentifier());
             JobDetailResource jobDetail = taskDetail.getJobDetail((String) ids.getSecondLevelIdentifier());
-            StatusResource statusResource = (StatusResource)jobDetail.create(ResourceType.STATUS);
+            StatusResource statusResource = (StatusResource) jobDetail.create(ResourceType.STATUS);
             statusResource.setExperimentResource(taskDetail.getWorkflowNodeDetailResource().getExperimentResource());
             statusResource.setWorkflowNodeDetail(taskDetail.getWorkflowNodeDetailResource());
             statusResource.setTaskDetailResource(taskDetail);
@@ -486,15 +529,15 @@ public class ExperimentRegistry {
             return String.valueOf(statusResource.getStatusId());
         } catch (Exception e) {
             logger.error("Unable to read airavata-server properties", e.getMessage());
+            throw new Exception(e);
         }
-        return null;
     }
 
-    public void updateApplicationStatus(ApplicationStatus status, String jobId) {
+    public void updateApplicationStatus(ApplicationStatus status, String jobId) throws Exception {
         try {
-            ExperimentResource experiment = (ExperimentResource)gatewayResource.create(ResourceType.EXPERIMENT);
-            WorkflowNodeDetailResource workflowNode = (WorkflowNodeDetailResource)experiment.create(ResourceType.WORKFLOW_NODE_DETAIL);
-            TaskDetailResource taskDetail = (TaskDetailResource)workflowNode.create(ResourceType.TASK_DETAIL);
+            ExperimentResource experiment = (ExperimentResource) gatewayResource.create(ResourceType.EXPERIMENT);
+            WorkflowNodeDetailResource workflowNode = (WorkflowNodeDetailResource) experiment.create(ResourceType.WORKFLOW_NODE_DETAIL);
+            TaskDetailResource taskDetail = (TaskDetailResource) workflowNode.create(ResourceType.TASK_DETAIL);
             JobDetailResource jobDetail = taskDetail.getJobDetail(jobId);
             StatusResource statusResource = jobDetail.getApplicationStatus();
             statusResource.setExperimentResource(jobDetail.getTaskDetailResource().getWorkflowNodeDetailResource().getExperimentResource());
@@ -506,23 +549,23 @@ public class ExperimentRegistry {
             statusResource.save();
         } catch (Exception e) {
             logger.error("Error while updating application status...", e.getMessage());
+            throw new Exception(e);
         }
     }
 
 
     /**
-     *
      * @param status data transfer status
-     * @param ids contains taskId and transfer id
+     * @param ids    contains taskId and transfer id
      * @return status id
      */
-    public String addTransferStatus(TransferStatus status, CompositeIdentifier ids) {
+    public String addTransferStatus(TransferStatus status, CompositeIdentifier ids) throws Exception {
         try {
-            ExperimentResource experiment = (ExperimentResource)gatewayResource.create(ResourceType.EXPERIMENT);
-            WorkflowNodeDetailResource workflowNode = (WorkflowNodeDetailResource)experiment.create(ResourceType.WORKFLOW_NODE_DETAIL);
+            ExperimentResource experiment = (ExperimentResource) gatewayResource.create(ResourceType.EXPERIMENT);
+            WorkflowNodeDetailResource workflowNode = (WorkflowNodeDetailResource) experiment.create(ResourceType.WORKFLOW_NODE_DETAIL);
             TaskDetailResource taskDetail = workflowNode.getTaskDetail((String) ids.getTopLevelIdentifier());
             DataTransferDetailResource dataTransferDetail = taskDetail.getDataTransferDetail((String) ids.getSecondLevelIdentifier());
-            StatusResource statusResource = (StatusResource)dataTransferDetail.create(ResourceType.STATUS);
+            StatusResource statusResource = (StatusResource) dataTransferDetail.create(ResourceType.STATUS);
             statusResource.setExperimentResource(taskDetail.getWorkflowNodeDetailResource().getExperimentResource());
             statusResource.setWorkflowNodeDetail(taskDetail.getWorkflowNodeDetailResource());
             statusResource.setTaskDetailResource(taskDetail);
@@ -534,15 +577,15 @@ public class ExperimentRegistry {
             return String.valueOf(statusResource.getStatusId());
         } catch (Exception e) {
             logger.error("Error while adding transfer status...", e.getMessage());
+            throw new Exception(e);
         }
-        return null;
     }
 
-    public void updateTransferStatus(TransferStatus status, String transferId) {
+    public void updateTransferStatus(TransferStatus status, String transferId) throws Exception {
         try {
-            ExperimentResource experiment = (ExperimentResource)gatewayResource.create(ResourceType.EXPERIMENT);
-            WorkflowNodeDetailResource workflowNode = (WorkflowNodeDetailResource)experiment.create(ResourceType.WORKFLOW_NODE_DETAIL);
-            TaskDetailResource taskDetail = (TaskDetailResource)workflowNode.create(ResourceType.TASK_DETAIL);
+            ExperimentResource experiment = (ExperimentResource) gatewayResource.create(ResourceType.EXPERIMENT);
+            WorkflowNodeDetailResource workflowNode = (WorkflowNodeDetailResource) experiment.create(ResourceType.WORKFLOW_NODE_DETAIL);
+            TaskDetailResource taskDetail = (TaskDetailResource) workflowNode.create(ResourceType.TASK_DETAIL);
             DataTransferDetailResource dataTransferDetail = taskDetail.getDataTransferDetail(transferId);
             StatusResource statusResource = dataTransferDetail.getDataTransferStatus();
             statusResource.setExperimentResource(dataTransferDetail.getTaskDetailResource().getWorkflowNodeDetailResource().getExperimentResource());
@@ -555,32 +598,33 @@ public class ExperimentRegistry {
             statusResource.save();
         } catch (Exception e) {
             logger.error("Error while updating transfer status...", e.getMessage());
+            throw new Exception(e);
         }
     }
 
-    public String addWorkflowNodeDetails (WorkflowNodeDetails nodeDetails, String expId) {
+    public String addWorkflowNodeDetails(WorkflowNodeDetails nodeDetails, String expId) throws Exception {
         try {
             ExperimentResource experiment = gatewayResource.getExperiment(expId);
-            WorkflowNodeDetailResource resource = (WorkflowNodeDetailResource)experiment.create(ResourceType.WORKFLOW_NODE_DETAIL);
+            WorkflowNodeDetailResource resource = (WorkflowNodeDetailResource) experiment.create(ResourceType.WORKFLOW_NODE_DETAIL);
             resource.setExperimentResource(experiment);
             resource.setNodeName(nodeDetails.getNodeName());
             resource.setCreationTime(getTime(nodeDetails.getCreationTime()));
             resource.setNodeInstanceId(getNodeInstanceID(nodeDetails.getNodeName()));
             resource.save();
             List<DataObjectType> nodeInputs = nodeDetails.getNodeInputs();
-            if (nodeInputs != null){
-                addWorkflowInputs (nodeDetails.getNodeInputs(), resource);
+            if (nodeInputs != null) {
+                addWorkflowInputs(nodeDetails.getNodeInputs(), resource);
             }
             return resource.getNodeInstanceId();
         } catch (Exception e) {
             logger.error("Error while adding workflow node details...", e.getMessage());
+            throw new Exception(e);
         }
-        return null;
     }
 
-    public void updateWorkflowNodeDetails (WorkflowNodeDetails nodeDetails, String nodeId) {
+    public void updateWorkflowNodeDetails(WorkflowNodeDetails nodeDetails, String nodeId) throws Exception {
         try {
-            ExperimentResource experiment = (ExperimentResource)gatewayResource.create(ResourceType.EXPERIMENT);
+            ExperimentResource experiment = (ExperimentResource) gatewayResource.create(ResourceType.EXPERIMENT);
             WorkflowNodeDetailResource workflowNode = experiment.getWorkflowNode(nodeId);
             workflowNode.setExperimentResource(experiment);
             workflowNode.setNodeName(nodeDetails.getNodeName());
@@ -588,31 +632,20 @@ public class ExperimentRegistry {
             workflowNode.setNodeInstanceId(getNodeInstanceID(nodeDetails.getNodeName()));
             workflowNode.save();
             List<DataObjectType> nodeInputs = nodeDetails.getNodeInputs();
-            if (nodeInputs != null){
+            if (nodeInputs != null) {
                 updateWorkflowInputs(nodeDetails.getNodeInputs(), workflowNode);
             }
         } catch (Exception e) {
             logger.error("Error while updating workflow node details...", e.getMessage());
+            throw new Exception(e);
         }
     }
 
 
-    public void addWorkflowInputs (List<DataObjectType> wfInputs, WorkflowNodeDetailResource nodeDetailResource ){
-        for (DataObjectType input : wfInputs){
-            NodeInputResource resource = (NodeInputResource)nodeDetailResource.create(ResourceType.NODE_INPUT);
-            resource.setNodeDetailResource(nodeDetailResource);
-            resource.setInputKey(input.getKey());
-            resource.setValue(input.getValue());
-            resource.setInputType(input.getType());
-            resource.setMetadata(input.getMetaData());
-            resource.save();
-        }
-    }
-
-    public void updateWorkflowInputs (List<DataObjectType> wfInputs, WorkflowNodeDetailResource nodeDetailResource ){
-        List<NodeInputResource> nodeInputs = nodeDetailResource.getNodeInputs();
-        for (DataObjectType input : wfInputs){
-            for (NodeInputResource resource : nodeInputs){
+    public void addWorkflowInputs(List<DataObjectType> wfInputs, WorkflowNodeDetailResource nodeDetailResource) throws Exception {
+        try {
+            for (DataObjectType input : wfInputs) {
+                NodeInputResource resource = (NodeInputResource) nodeDetailResource.create(ResourceType.NODE_INPUT);
                 resource.setNodeDetailResource(nodeDetailResource);
                 resource.setInputKey(input.getKey());
                 resource.setValue(input.getValue());
@@ -620,14 +653,38 @@ public class ExperimentRegistry {
                 resource.setMetadata(input.getMetaData());
                 resource.save();
             }
+        } catch (Exception e) {
+            logger.error("Error while adding workflow inputs...", e.getMessage());
+            throw new Exception(e);
         }
+
     }
 
-    public String addTaskDetails (TaskDetails taskDetails, String nodeId) {
+    public void updateWorkflowInputs(List<DataObjectType> wfInputs, WorkflowNodeDetailResource nodeDetailResource) throws Exception {
         try {
-            ExperimentResource experiment = (ExperimentResource)gatewayResource.create(ResourceType.EXPERIMENT);
+            List<NodeInputResource> nodeInputs = nodeDetailResource.getNodeInputs();
+            for (DataObjectType input : wfInputs) {
+                for (NodeInputResource resource : nodeInputs) {
+                    resource.setNodeDetailResource(nodeDetailResource);
+                    resource.setInputKey(input.getKey());
+                    resource.setValue(input.getValue());
+                    resource.setInputType(input.getType());
+                    resource.setMetadata(input.getMetaData());
+                    resource.save();
+                }
+            }
+        } catch (Exception e) {
+            logger.error("Error while updating workflow inputs...", e.getMessage());
+            throw new Exception(e);
+        }
+
+    }
+
+    public String addTaskDetails(TaskDetails taskDetails, String nodeId) throws Exception {
+        try {
+            ExperimentResource experiment = (ExperimentResource) gatewayResource.create(ResourceType.EXPERIMENT);
             WorkflowNodeDetailResource workflowNode = experiment.getWorkflowNode(nodeId);
-            TaskDetailResource taskDetail = (TaskDetailResource)workflowNode.create(ResourceType.TASK_DETAIL);
+            TaskDetailResource taskDetail = (TaskDetailResource) workflowNode.create(ResourceType.TASK_DETAIL);
             taskDetail.setWorkflowNodeDetailResource(workflowNode);
             taskDetail.setTaskId(getTaskID(workflowNode.getNodeName()));
             taskDetail.setApplicationId(taskDetails.getApplicationId());
@@ -635,36 +692,36 @@ public class ExperimentRegistry {
             taskDetail.setCreationTime(getTime(taskDetails.getCreationTime()));
             taskDetail.save();
             List<DataObjectType> applicationInputs = taskDetails.getApplicationInputs();
-            if (applicationInputs != null){
+            if (applicationInputs != null) {
                 addAppInputs(applicationInputs, taskDetail);
             }
             List<DataObjectType> applicationOutput = taskDetails.getApplicationOutputs();
-            if (applicationOutput != null){
+            if (applicationOutput != null) {
                 addAppOutputs(applicationOutput, taskDetail);
             }
             ComputationalResourceScheduling taskScheduling = taskDetails.getTaskScheduling();
-            if (taskScheduling != null){
+            if (taskScheduling != null) {
                 addComputationScheduling(taskScheduling, taskDetail);
             }
             AdvancedInputDataHandling inputDataHandling = taskDetails.getAdvancedInputDataHandling();
-            if (inputDataHandling != null){
+            if (inputDataHandling != null) {
                 addInputDataHandling(inputDataHandling, taskDetail);
             }
             AdvancedOutputDataHandling outputDataHandling = taskDetails.getAdvancedOutputDataHandling();
-            if (outputDataHandling != null){
+            if (outputDataHandling != null) {
                 addOutputDataHandling(outputDataHandling, taskDetail);
             }
             return taskDetail.getTaskId();
         } catch (Exception e) {
             logger.error("Error while adding task details...", e.getMessage());
+            throw new Exception(e);
         }
-        return null;
     }
 
-    public String updateTaskDetails (TaskDetails taskDetails, String taskId) {
+    public String updateTaskDetails(TaskDetails taskDetails, String taskId) throws Exception {
         try {
-            ExperimentResource experiment = (ExperimentResource)gatewayResource.create(ResourceType.EXPERIMENT);
-            WorkflowNodeDetailResource workflowNode = (WorkflowNodeDetailResource)experiment.create(ResourceType.WORKFLOW_NODE_DETAIL);
+            ExperimentResource experiment = (ExperimentResource) gatewayResource.create(ResourceType.EXPERIMENT);
+            WorkflowNodeDetailResource workflowNode = (WorkflowNodeDetailResource) experiment.create(ResourceType.WORKFLOW_NODE_DETAIL);
             TaskDetailResource taskDetail = workflowNode.getTaskDetail(taskId);
             taskDetail.setWorkflowNodeDetailResource(workflowNode);
             taskDetail.setTaskId(getTaskID(workflowNode.getNodeName()));
@@ -673,52 +730,65 @@ public class ExperimentRegistry {
             taskDetail.setCreationTime(getTime(taskDetails.getCreationTime()));
             taskDetail.save();
             List<DataObjectType> applicationInputs = taskDetails.getApplicationInputs();
-            if (applicationInputs != null){
+            if (applicationInputs != null) {
                 updateAppInputs(applicationInputs, taskDetail);
             }
             ComputationalResourceScheduling taskScheduling = taskDetails.getTaskScheduling();
-            if (taskScheduling != null){
+            if (taskScheduling != null) {
                 updateSchedulingData(taskScheduling, taskDetail);
             }
             AdvancedInputDataHandling inputDataHandling = taskDetails.getAdvancedInputDataHandling();
-            if (inputDataHandling != null){
+            if (inputDataHandling != null) {
                 updateInputDataHandling(inputDataHandling, taskDetail);
             }
             AdvancedOutputDataHandling outputDataHandling = taskDetails.getAdvancedOutputDataHandling();
-            if (outputDataHandling != null){
+            if (outputDataHandling != null) {
                 updateOutputDataHandling(outputDataHandling, taskDetail);
             }
             return taskDetail.getTaskId();
         } catch (Exception e) {
             logger.error("Error while updating task details...", e.getMessage());
+            throw new Exception(e);
         }
-        return null;
     }
 
-    public void addAppInputs (List<DataObjectType> appInputs, TaskDetailResource taskDetailResource ){
-        for (DataObjectType input :  appInputs){
-            ApplicationInputResource resource = (ApplicationInputResource)taskDetailResource.create(ResourceType.APPLICATION_INPUT);
-            resource.setTaskDetailResource(taskDetailResource);
-            resource.setInputKey(input.getKey());
-            resource.setValue(input.getValue());
-            resource.setInputType(input.getType());
-            resource.setMetadata(input.getMetaData());
-            resource.save();
+    public void addAppInputs(List<DataObjectType> appInputs, TaskDetailResource taskDetailResource) throws Exception {
+        try {
+            for (DataObjectType input : appInputs) {
+                ApplicationInputResource resource = (ApplicationInputResource) taskDetailResource.create(ResourceType.APPLICATION_INPUT);
+                resource.setTaskDetailResource(taskDetailResource);
+                resource.setInputKey(input.getKey());
+                resource.setValue(input.getValue());
+                resource.setInputType(input.getType());
+                resource.setMetadata(input.getMetaData());
+                resource.save();
+            }
+        } catch (Exception e) {
+            logger.error("Error while adding application inputs...", e.getMessage());
+            throw new Exception(e);
         }
+
     }
-     public void addAppOutputs (List<DataObjectType> appInputs, TaskDetailResource taskDetailResource ){
-        for (DataObjectType input :  appInputs){
-            ApplicationInputResource resource = (ApplicationInputResource)taskDetailResource.create(ResourceType.APPLICATION_OUTPUT);
-            resource.setTaskDetailResource(taskDetailResource);
-            resource.setInputKey(input.getKey());
-            resource.setValue(input.getValue());
-            resource.setInputType(input.getType());
-            resource.setMetadata(input.getMetaData());
-            resource.save();
+
+    public void addAppOutputs(List<DataObjectType> appInputs, TaskDetailResource taskDetailResource) throws Exception {
+        try {
+            for (DataObjectType input : appInputs) {
+                ApplicationInputResource resource = (ApplicationInputResource) taskDetailResource.create(ResourceType.APPLICATION_OUTPUT);
+                resource.setTaskDetailResource(taskDetailResource);
+                resource.setInputKey(input.getKey());
+                resource.setValue(input.getValue());
+                resource.setInputType(input.getType());
+                resource.setMetadata(input.getMetaData());
+                resource.save();
+            }
+        } catch (Exception e) {
+            logger.error("Error while adding application outputs...", e.getMessage());
+            throw new Exception(e);
         }
+
     }
 
-    public void updateAppOutputs (List<DataObjectType> appOutputs, String taskId ) {
+    public void updateAppOutputs(List<DataObjectType> appOutputs, String taskId) throws Exception {
         try {
             ExperimentResource experiment = (ExperimentResource) gatewayResource.create(ResourceType.EXPERIMENT);
             WorkflowNodeDetailResource workflowNode = (WorkflowNodeDetailResource) experiment.create(ResourceType.WORKFLOW_NODE_DETAIL);
@@ -736,28 +806,35 @@ public class ExperimentRegistry {
             }
         } catch (Exception e) {
             logger.error("Error while updating application outputs...", e.getMessage());
+            throw new Exception(e);
         }
     }
 
-    public void updateAppInputs (List<DataObjectType> appInputs, TaskDetailResource taskDetailResource ){
-        List<ApplicationInputResource> inputs = taskDetailResource.getApplicationInputs();
-        for (DataObjectType input :  appInputs){
-            for (ApplicationInputResource resource : inputs){
-                resource.setTaskDetailResource(taskDetailResource);
-                resource.setInputKey(input.getKey());
-                resource.setValue(input.getValue());
-                resource.setInputType(input.getType());
-                resource.setMetadata(input.getMetaData());
-                resource.save();
-            }
+    public void updateAppInputs(List<DataObjectType> appInputs, TaskDetailResource taskDetailResource) throws Exception {
+        try {
+            List<ApplicationInputResource> inputs = taskDetailResource.getApplicationInputs();
+            for (DataObjectType input : appInputs) {
+                for (ApplicationInputResource resource : inputs) {
+                    resource.setTaskDetailResource(taskDetailResource);
+                    resource.setInputKey(input.getKey());
+                    resource.setValue(input.getValue());
+                    resource.setInputType(input.getType());
+                    resource.setMetadata(input.getMetaData());
+                    resource.save();
+                }
 
+            }
+        } catch (Exception e) {
+            logger.error("Error while updating application inputs...", e.getMessage());
+            throw new Exception(e);
         }
+
     }
 
-    public String addJobDetails (JobDetails jobDetails, CompositeIdentifier ids) {
+    public String addJobDetails(JobDetails jobDetails, CompositeIdentifier ids) throws Exception {
         try {
-            ExperimentResource experiment = (ExperimentResource)gatewayResource.create(ResourceType.EXPERIMENT);
-            WorkflowNodeDetailResource workflowNode = (WorkflowNodeDetailResource)experiment.create(ResourceType.WORKFLOW_NODE_DETAIL);
+            ExperimentResource experiment = (ExperimentResource) gatewayResource.create(ResourceType.EXPERIMENT);
+            WorkflowNodeDetailResource workflowNode = (WorkflowNodeDetailResource) experiment.create(ResourceType.WORKFLOW_NODE_DETAIL);
             TaskDetailResource taskDetail = workflowNode.getTaskDetail((String) ids.getTopLevelIdentifier());
             JobDetailResource jobDetail = taskDetail.createJobDetail((String) ids.getSecondLevelIdentifier());
             jobDetail.setTaskDetailResource(taskDetail);
@@ -768,15 +845,15 @@ public class ExperimentRegistry {
             return jobDetail.getJobId();
         } catch (Exception e) {
             logger.error("Error while adding job details...", e.getMessage());
+            throw new Exception(e);
         }
-        return null;
     }
 
-    public void updateJobDetails (JobDetails jobDetails, String jobId) {
+    public void updateJobDetails(JobDetails jobDetails, String jobId) throws Exception {
         try {
-            ExperimentResource experiment = (ExperimentResource)gatewayResource.create(ResourceType.EXPERIMENT);
-            WorkflowNodeDetailResource workflowNode = (WorkflowNodeDetailResource)experiment.create(ResourceType.WORKFLOW_NODE_DETAIL);
-            TaskDetailResource taskDetail = (TaskDetailResource)workflowNode.create(ResourceType.TASK_DETAIL);
+            ExperimentResource experiment = (ExperimentResource) gatewayResource.create(ResourceType.EXPERIMENT);
+            WorkflowNodeDetailResource workflowNode = (WorkflowNodeDetailResource) experiment.create(ResourceType.WORKFLOW_NODE_DETAIL);
+            TaskDetailResource taskDetail = (TaskDetailResource) workflowNode.create(ResourceType.TASK_DETAIL);
             JobDetailResource jobDetail = taskDetail.getJobDetail(jobId);
             jobDetail.setTaskDetailResource(jobDetail.getTaskDetailResource());
             jobDetail.setJobDescription(jobDetails.getJobDescription());
@@ -785,15 +862,16 @@ public class ExperimentRegistry {
             jobDetail.save();
         } catch (Exception e) {
             logger.error("Error while updating job details...", e.getMessage());
+            throw new Exception(e);
         }
     }
 
-    public String addDataTransferDetails (DataTransferDetails transferDetails, String taskId) {
+    public String addDataTransferDetails(DataTransferDetails transferDetails, String taskId) throws Exception {
         try {
-            ExperimentResource experiment = (ExperimentResource)gatewayResource.create(ResourceType.EXPERIMENT);
-            WorkflowNodeDetailResource workflowNode = (WorkflowNodeDetailResource)experiment.create(ResourceType.WORKFLOW_NODE_DETAIL);
+            ExperimentResource experiment = (ExperimentResource) gatewayResource.create(ResourceType.EXPERIMENT);
+            WorkflowNodeDetailResource workflowNode = (WorkflowNodeDetailResource) experiment.create(ResourceType.WORKFLOW_NODE_DETAIL);
             TaskDetailResource taskDetail = workflowNode.getTaskDetail(taskId);
-            DataTransferDetailResource resource = (DataTransferDetailResource)taskDetail.create(ResourceType.DATA_TRANSFER_DETAIL);
+            DataTransferDetailResource resource = (DataTransferDetailResource) taskDetail.create(ResourceType.DATA_TRANSFER_DETAIL);
             resource.setTaskDetailResource(taskDetail);
             resource.setTransferId(getDataTransferID(taskId));
             resource.setTransferDescription(transferDetails.getTransferDescription());
@@ -802,15 +880,15 @@ public class ExperimentRegistry {
             return resource.getTransferId();
         } catch (Exception e) {
             logger.error("Error while adding transfer details...", e.getMessage());
+            throw new Exception(e);
         }
-        return null;
     }
 
-    public String updateDataTransferDetails (DataTransferDetails transferDetails, String transferId) {
+    public String updateDataTransferDetails(DataTransferDetails transferDetails, String transferId) throws Exception {
         try {
-            ExperimentResource experiment = (ExperimentResource)gatewayResource.create(ResourceType.EXPERIMENT);
-            WorkflowNodeDetailResource workflowNode = (WorkflowNodeDetailResource)experiment.create(ResourceType.WORKFLOW_NODE_DETAIL);
-            TaskDetailResource taskDetail = (TaskDetailResource)workflowNode.create(ResourceType.TASK_DETAIL);
+            ExperimentResource experiment = (ExperimentResource) gatewayResource.create(ResourceType.EXPERIMENT);
+            WorkflowNodeDetailResource workflowNode = (WorkflowNodeDetailResource) experiment.create(ResourceType.WORKFLOW_NODE_DETAIL);
+            TaskDetailResource taskDetail = (TaskDetailResource) workflowNode.create(ResourceType.TASK_DETAIL);
             DataTransferDetailResource resource = taskDetail.getDataTransferDetail(transferId);
             resource.setTaskDetailResource(taskDetail);
             resource.setTransferDescription(transferDetails.getTransferDescription());
@@ -819,22 +897,21 @@ public class ExperimentRegistry {
             return resource.getTransferId();
         } catch (Exception e) {
             logger.error("Error while updating transfer details...", e.getMessage());
+            throw new Exception(e);
         }
-        return null;
     }
 
     /**
-     *
      * @param scheduling computational resource object
-     * @param ids contains expId and taskId, if it is an experiment, task id can be null
+     * @param ids        contains expId and taskId, if it is an experiment, task id can be null
      * @return scheduling id
      */
-    public String addComputationalResourceScheduling (ComputationalResourceScheduling scheduling, CompositeIdentifier ids){
+    public String addComputationalResourceScheduling(ComputationalResourceScheduling scheduling, CompositeIdentifier ids) throws Exception {
         try {
             ExperimentResource experiment = gatewayResource.getExperiment((String) ids.getTopLevelIdentifier());
-            ComputationSchedulingResource schedulingResource = (ComputationSchedulingResource)experiment.create(ResourceType.COMPUTATIONAL_RESOURCE_SCHEDULING);
-            if (ids.getSecondLevelIdentifier() != null){
-                WorkflowNodeDetailResource nodeDetailResource = (WorkflowNodeDetailResource)experiment.create(ResourceType.WORKFLOW_NODE_DETAIL);
+            ComputationSchedulingResource schedulingResource = (ComputationSchedulingResource) experiment.create(ResourceType.COMPUTATIONAL_RESOURCE_SCHEDULING);
+            if (ids.getSecondLevelIdentifier() != null) {
+                WorkflowNodeDetailResource nodeDetailResource = (WorkflowNodeDetailResource) experiment.create(ResourceType.WORKFLOW_NODE_DETAIL);
                 TaskDetailResource taskDetail = nodeDetailResource.getTaskDetail((String) ids.getSecondLevelIdentifier());
                 schedulingResource.setTaskDetailResource(taskDetail);
             }
@@ -852,22 +929,21 @@ public class ExperimentRegistry {
             return String.valueOf(schedulingResource.getSchedulingId());
         } catch (Exception e) {
             logger.error("Error while adding scheduling parameters...", e.getMessage());
+            throw new Exception(e);
         }
-        return null;
     }
 
     /**
-     *
      * @param dataHandling advanced input data handling object
-     * @param ids contains expId and taskId
+     * @param ids          contains expId and taskId
      * @return data handling id
      */
-    public String addInputDataHandling (AdvancedInputDataHandling dataHandling, CompositeIdentifier ids){
+    public String addInputDataHandling(AdvancedInputDataHandling dataHandling, CompositeIdentifier ids) throws Exception {
         try {
             ExperimentResource experiment = gatewayResource.getExperiment((String) ids.getTopLevelIdentifier());
-            AdvanceInputDataHandlingResource dataHandlingResource = (AdvanceInputDataHandlingResource)experiment.create(ResourceType.ADVANCE_INPUT_DATA_HANDLING);
-            if (ids.getSecondLevelIdentifier() != null){
-                WorkflowNodeDetailResource nodeDetailResource = (WorkflowNodeDetailResource)experiment.create(ResourceType.WORKFLOW_NODE_DETAIL);
+            AdvanceInputDataHandlingResource dataHandlingResource = (AdvanceInputDataHandlingResource) experiment.create(ResourceType.ADVANCE_INPUT_DATA_HANDLING);
+            if (ids.getSecondLevelIdentifier() != null) {
+                WorkflowNodeDetailResource nodeDetailResource = (WorkflowNodeDetailResource) experiment.create(ResourceType.WORKFLOW_NODE_DETAIL);
                 TaskDetailResource taskDetail = nodeDetailResource.getTaskDetail((String) ids.getSecondLevelIdentifier());
                 dataHandlingResource.setTaskDetailResource(taskDetail);
             }
@@ -880,22 +956,21 @@ public class ExperimentRegistry {
             return String.valueOf(dataHandlingResource.getDataHandlingId());
         } catch (Exception e) {
             logger.error("Error while adding input data handling...", e.getMessage());
+            throw new Exception(e);
         }
-        return null;
     }
 
     /**
-     *
      * @param dataHandling advanced output data handling object
-     * @param ids contains expId and taskId
+     * @param ids          contains expId and taskId
      * @return data handling id
      */
-    public String addOutputDataHandling (AdvancedOutputDataHandling dataHandling, CompositeIdentifier ids){
+    public String addOutputDataHandling(AdvancedOutputDataHandling dataHandling, CompositeIdentifier ids) throws Exception {
         try {
             ExperimentResource experiment = gatewayResource.getExperiment((String) ids.getTopLevelIdentifier());
-            AdvancedOutputDataHandlingResource dataHandlingResource = (AdvancedOutputDataHandlingResource)experiment.create(ResourceType.ADVANCE_OUTPUT_DATA_HANDLING);
-            if (ids.getSecondLevelIdentifier() != null){
-                WorkflowNodeDetailResource nodeDetailResource = (WorkflowNodeDetailResource)experiment.create(ResourceType.WORKFLOW_NODE_DETAIL);
+            AdvancedOutputDataHandlingResource dataHandlingResource = (AdvancedOutputDataHandlingResource) experiment.create(ResourceType.ADVANCE_OUTPUT_DATA_HANDLING);
+            if (ids.getSecondLevelIdentifier() != null) {
+                WorkflowNodeDetailResource nodeDetailResource = (WorkflowNodeDetailResource) experiment.create(ResourceType.WORKFLOW_NODE_DETAIL);
                 TaskDetailResource taskDetail = nodeDetailResource.getTaskDetail((String) ids.getSecondLevelIdentifier());
                 dataHandlingResource.setTaskDetailResource(taskDetail);
             }
@@ -907,16 +982,16 @@ public class ExperimentRegistry {
             return String.valueOf(dataHandlingResource.getOutputDataHandlingId());
         } catch (Exception e) {
             logger.error("Error while adding output data handling...", e.getMessage());
+            throw new Exception(e);
         }
-        return null;
     }
 
-    public String addQosParams (QualityOfServiceParams qosParams, CompositeIdentifier ids){
+    public String addQosParams(QualityOfServiceParams qosParams, CompositeIdentifier ids) throws Exception {
         try {
             ExperimentResource experiment = gatewayResource.getExperiment((String) ids.getTopLevelIdentifier());
-            QosParamResource qosParamResource = (QosParamResource)experiment.create(ResourceType.QOS_PARAM);
-            if (ids.getSecondLevelIdentifier() != null){
-                WorkflowNodeDetailResource nodeDetailResource = (WorkflowNodeDetailResource)experiment.create(ResourceType.WORKFLOW_NODE_DETAIL);
+            QosParamResource qosParamResource = (QosParamResource) experiment.create(ResourceType.QOS_PARAM);
+            if (ids.getSecondLevelIdentifier() != null) {
+                WorkflowNodeDetailResource nodeDetailResource = (WorkflowNodeDetailResource) experiment.create(ResourceType.WORKFLOW_NODE_DETAIL);
                 TaskDetailResource taskDetail = nodeDetailResource.getTaskDetail((String) ids.getSecondLevelIdentifier());
                 qosParamResource.setTaskDetailResource(taskDetail);
             }
@@ -928,57 +1003,57 @@ public class ExperimentRegistry {
             return String.valueOf(qosParamResource.getQosId());
         } catch (Exception e) {
             logger.error("Error while adding QOS params...", e.getMessage());
+            throw new Exception(e);
         }
-        return null;
     }
 
-    public String addErrorDetails (ErrorDetails error, Object id){
-        try{
+    public String addErrorDetails(ErrorDetails error, Object id) throws Exception {
+        try {
 
             ErrorDetailResource errorResource = null;
             ExperimentResource experiment;
             TaskDetailResource taskDetail;
             WorkflowNodeDetailResource workflowNode;
             // figure out the id is an experiment, node task or job
-            if (id instanceof String){
-                if (isExperimentExist((String) id)){
+            if (id instanceof String) {
+                if (isExperimentExist((String) id)) {
                     experiment = gatewayResource.getExperiment((String) id);
-                    errorResource = (ErrorDetailResource)experiment.create(ResourceType.ERROR_DETAIL);
-                }else if (isWFNodeExist((String) id)){
-                    experiment = (ExperimentResource)gatewayResource.create(ResourceType.EXPERIMENT);
-                    workflowNode = experiment.getWorkflowNode((String)id);
-                    errorResource = (ErrorDetailResource)workflowNode.create(ResourceType.ERROR_DETAIL);
+                    errorResource = (ErrorDetailResource) experiment.create(ResourceType.ERROR_DETAIL);
+                } else if (isWFNodeExist((String) id)) {
+                    experiment = (ExperimentResource) gatewayResource.create(ResourceType.EXPERIMENT);
+                    workflowNode = experiment.getWorkflowNode((String) id);
+                    errorResource = (ErrorDetailResource) workflowNode.create(ResourceType.ERROR_DETAIL);
                     errorResource.setExperimentResource(workflowNode.getExperimentResource());
-                }else if (isTaskDetailExist((String)id)){
-                    experiment = (ExperimentResource)gatewayResource.create(ResourceType.EXPERIMENT);
-                    workflowNode = (WorkflowNodeDetailResource)experiment.create(ResourceType.WORKFLOW_NODE_DETAIL);
-                    taskDetail = workflowNode.getTaskDetail((String)id);
-                    errorResource = (ErrorDetailResource)taskDetail.create(ResourceType.ERROR_DETAIL);
+                } else if (isTaskDetailExist((String) id)) {
+                    experiment = (ExperimentResource) gatewayResource.create(ResourceType.EXPERIMENT);
+                    workflowNode = (WorkflowNodeDetailResource) experiment.create(ResourceType.WORKFLOW_NODE_DETAIL);
+                    taskDetail = workflowNode.getTaskDetail((String) id);
+                    errorResource = (ErrorDetailResource) taskDetail.create(ResourceType.ERROR_DETAIL);
                     errorResource.setTaskDetailResource(taskDetail);
                     errorResource.setNodeDetail(taskDetail.getWorkflowNodeDetailResource());
                     errorResource.setExperimentResource(taskDetail.getWorkflowNodeDetailResource().getExperimentResource());
-                }else {
+                } else {
                     logger.error("The id provided is not an experiment id or a workflow id or a task id..");
                 }
-            }else if (id instanceof CompositeIdentifier){
-                CompositeIdentifier cid = (CompositeIdentifier)id;
-                if (isJobDetailExist(cid)){
-                    experiment = (ExperimentResource)gatewayResource.create(ResourceType.EXPERIMENT);
-                    workflowNode = (WorkflowNodeDetailResource)experiment.create(ResourceType.WORKFLOW_NODE_DETAIL);
-                    taskDetail = workflowNode.getTaskDetail((String)cid.getTopLevelIdentifier());
+            } else if (id instanceof CompositeIdentifier) {
+                CompositeIdentifier cid = (CompositeIdentifier) id;
+                if (isJobDetailExist(cid)) {
+                    experiment = (ExperimentResource) gatewayResource.create(ResourceType.EXPERIMENT);
+                    workflowNode = (WorkflowNodeDetailResource) experiment.create(ResourceType.WORKFLOW_NODE_DETAIL);
+                    taskDetail = workflowNode.getTaskDetail((String) cid.getTopLevelIdentifier());
                     JobDetailResource jobDetail = taskDetail.getJobDetail((String) cid.getSecondLevelIdentifier());
-                    errorResource = (ErrorDetailResource)jobDetail.create(ResourceType.ERROR_DETAIL);
+                    errorResource = (ErrorDetailResource) jobDetail.create(ResourceType.ERROR_DETAIL);
                     errorResource.setTaskDetailResource(taskDetail);
                     errorResource.setNodeDetail(taskDetail.getWorkflowNodeDetailResource());
                     errorResource.setExperimentResource(taskDetail.getWorkflowNodeDetailResource().getExperimentResource());
-                }else {
+                } else {
                     logger.error("The id provided is not a job in the system..");
                 }
-            }else {
+            } else {
                 logger.error("The id provided is not an experiment id or a workflow id or a task id or a composite " +
                         "identifier for job..");
             }
-            if (errorResource != null){
+            if (errorResource != null) {
                 errorResource.setCreationTime(getTime(error.getCreationTime()));
                 errorResource.setActualErrorMsg(error.getActualErrorMessage());
                 errorResource.setUserFriendlyErrorMsg(error.getUserFriendlyMessage());
@@ -991,6 +1066,7 @@ public class ExperimentRegistry {
             }
         } catch (Exception e) {
             logger.error("Unable to add error details...", e.getMessage());
+            throw new Exception(e);
         }
         return null;
     }
@@ -1007,47 +1083,48 @@ public class ExperimentRegistry {
         return nodeName + "_" + UUID.randomUUID();
     }
 
-    public String getDataTransferID (String taskId){
+    public String getDataTransferID(String taskId) {
         return taskId + "_" + UUID.randomUUID();
     }
 
-    public void updateExperimentField(String expID, String fieldName, Object value) {
+    public void updateExperimentField(String expID, String fieldName, Object value) throws Exception {
         try {
             ExperimentResource experiment = gatewayResource.getExperiment(expID);
             if (fieldName.equals(Constants.FieldConstants.ExperimentConstants.EXPERIMENT_NAME)) {
-                experiment.setExpName((String)value);
+                experiment.setExpName((String) value);
                 experiment.save();
             } else if (fieldName.equals(Constants.FieldConstants.ExperimentConstants.USER_NAME)) {
-                experiment.setExecutionUser((String)value);
+                experiment.setExecutionUser((String) value);
                 experiment.save();
             } else if (fieldName.equals(Constants.FieldConstants.ExperimentConstants.EXPERIMENT_DESC)) {
-                experiment.setDescription((String)value);
+                experiment.setDescription((String) value);
                 experiment.save();
             } else if (fieldName.equals(Constants.FieldConstants.ExperimentConstants.APPLICATION_ID)) {
-                experiment.setApplicationId((String)value);
+                experiment.setApplicationId((String) value);
                 experiment.save();
-            }else if (fieldName.equals(Constants.FieldConstants.ExperimentConstants.APPLICATION_VERSION)){
+            } else if (fieldName.equals(Constants.FieldConstants.ExperimentConstants.APPLICATION_VERSION)) {
                 experiment.setApplicationVersion((String) value);
                 experiment.save();
-            }else if (fieldName.equals(Constants.FieldConstants.ExperimentConstants.WORKFLOW_TEMPLATE_ID)){
+            } else if (fieldName.equals(Constants.FieldConstants.ExperimentConstants.WORKFLOW_TEMPLATE_ID)) {
                 experiment.setWorkflowTemplateId((String) value);
                 experiment.save();
-            }else if (fieldName.equals(Constants.FieldConstants.ExperimentConstants.WORKFLOW_TEMPLATE_VERSION)){
+            } else if (fieldName.equals(Constants.FieldConstants.ExperimentConstants.WORKFLOW_TEMPLATE_VERSION)) {
                 experiment.setWorkflowTemplateVersion((String) value);
                 experiment.save();
-            }else {
+            } else {
                 logger.error("Unsupported field type for Experiment");
             }
 
         } catch (Exception e) {
             logger.error("Error while updating fields in experiment...", e.getMessage());
+            throw new Exception(e);
         }
     }
 
-    public void updateExpConfigDataField(String expID, String fieldName, Object value) {
+    public void updateExpConfigDataField(String expID, String fieldName, Object value) throws Exception {
         try {
             ExperimentResource experiment = gatewayResource.getExperiment(expID);
-            ConfigDataResource exConfigData = (ConfigDataResource)experiment.get(ResourceType.CONFIG_DATA, expID);
+            ConfigDataResource exConfigData = (ConfigDataResource) experiment.get(ResourceType.CONFIG_DATA, expID);
             if (fieldName.equals(Constants.FieldConstants.ConfigurationDataConstants.AIRAVATA_AUTO_SCHEDULE)) {
                 exConfigData.setAiravataAutoSchedule((Boolean) value);
                 exConfigData.save();
@@ -1057,371 +1134,415 @@ public class ExperimentRegistry {
             } else if (fieldName.equals(Constants.FieldConstants.ConfigurationDataConstants.SHARE_EXP)) {
                 exConfigData.setShareExp((Boolean) value);
                 exConfigData.save();
-            } else if (fieldName.equals(Constants.FieldConstants.ConfigurationDataConstants.COMPUTATIONAL_RESOURCE_SCHEDULING)){
+            } else if (fieldName.equals(Constants.FieldConstants.ConfigurationDataConstants.COMPUTATIONAL_RESOURCE_SCHEDULING)) {
                 updateSchedulingData((ComputationalResourceScheduling) value, experiment);
-            }else if (fieldName.equals(Constants.FieldConstants.ConfigurationDataConstants.ADVANCED_INPUT_HANDLING)){
+            } else if (fieldName.equals(Constants.FieldConstants.ConfigurationDataConstants.ADVANCED_INPUT_HANDLING)) {
                 updateInputDataHandling((AdvancedInputDataHandling) value, experiment);
-            }else if (fieldName.equals(Constants.FieldConstants.ConfigurationDataConstants.ADVANCED_OUTPUT_HANDLING)){
+            } else if (fieldName.equals(Constants.FieldConstants.ConfigurationDataConstants.ADVANCED_OUTPUT_HANDLING)) {
                 updateOutputDataHandling((AdvancedOutputDataHandling) value, experiment);
-            }else if (fieldName.equals(Constants.FieldConstants.ConfigurationDataConstants.QOS_PARAMS)){
+            } else if (fieldName.equals(Constants.FieldConstants.ConfigurationDataConstants.QOS_PARAMS)) {
                 updateQosParams((QualityOfServiceParams) value, experiment);
-            }else {
+            } else {
                 logger.error("Unsupported field type for Experiment config data");
             }
 
         } catch (Exception e) {
             logger.error("Error while updating fields in experiment config...", e.getMessage());
+            throw new Exception(e);
         }
     }
 
     public void updateExperiment(Experiment experiment, String expId) throws Exception {
-        ExperimentResource existingExperiment = gatewayResource.getExperiment(expId);
-        existingExperiment.setExpName(experiment.getName());
-        existingExperiment.setExecutionUser(experiment.getUserName());
-        existingExperiment.setGateway(gatewayResource);
-        if (!workerResource.isProjectExists(experiment.getProjectID())){
-            ProjectResource project = workerResource.createProject(experiment.getProjectID());
-            existingExperiment.setProject(project);
-        }
-        existingExperiment.setCreationTime(getTime(experiment.getCreationTime()));
-        existingExperiment.setDescription(experiment.getDescription());
-        existingExperiment.setApplicationId(experiment.getApplicationId());
-        existingExperiment.setApplicationVersion(experiment.getApplicationVersion());
-        existingExperiment.setWorkflowTemplateId(experiment.getWorkflowTemplateId());
-        existingExperiment.setWorkflowTemplateVersion(experiment.getWorkflowTemplateVersion());
-        existingExperiment.setWorkflowExecutionId(experiment.getWorkflowExecutionInstanceId());
-        existingExperiment.save();
-        List<DataObjectType> experimentInputs = experiment.getExperimentInputs();
-        updateExpInputs(experimentInputs, existingExperiment);
+        try {
+            ExperimentResource existingExperiment = gatewayResource.getExperiment(expId);
+            existingExperiment.setExpName(experiment.getName());
+            existingExperiment.setExecutionUser(experiment.getUserName());
+            existingExperiment.setGateway(gatewayResource);
+            if (!workerResource.isProjectExists(experiment.getProjectID())) {
+                ProjectResource project = workerResource.createProject(experiment.getProjectID());
+                existingExperiment.setProject(project);
+            }
+            existingExperiment.setCreationTime(getTime(experiment.getCreationTime()));
+            existingExperiment.setDescription(experiment.getDescription());
+            existingExperiment.setApplicationId(experiment.getApplicationId());
+            existingExperiment.setApplicationVersion(experiment.getApplicationVersion());
+            existingExperiment.setWorkflowTemplateId(experiment.getWorkflowTemplateId());
+            existingExperiment.setWorkflowTemplateVersion(experiment.getWorkflowTemplateVersion());
+            existingExperiment.setWorkflowExecutionId(experiment.getWorkflowExecutionInstanceId());
+            existingExperiment.save();
+            List<DataObjectType> experimentInputs = experiment.getExperimentInputs();
+            updateExpInputs(experimentInputs, existingExperiment);
+        } catch (Exception e) {
+            logger.error("Error while updating experiment...", e.getMessage());
+            throw new Exception(e);
+        }
+
     }
 
     public void updateUserConfigData(UserConfigurationData configData, String expId) throws Exception {
-        ExperimentResource experiment = gatewayResource.getExperiment(expId);
-        ConfigDataResource resource = (ConfigDataResource)experiment.get(ResourceType.CONFIG_DATA, expId);
-        resource.setExperimentResource(experiment);
-        resource.setAiravataAutoSchedule(configData.isAiravataAutoSchedule());
-        resource.setOverrideManualParams(configData.isOverrideManualScheduledParams());
-        resource.setShareExp(configData.isShareExperimentPublicly());
+        try {
+            ExperimentResource experiment = gatewayResource.getExperiment(expId);
+            ConfigDataResource resource = (ConfigDataResource) experiment.get(ResourceType.CONFIG_DATA, expId);
+            resource.setExperimentResource(experiment);
+            resource.setAiravataAutoSchedule(configData.isAiravataAutoSchedule());
+            resource.setOverrideManualParams(configData.isOverrideManualScheduledParams());
+            resource.setShareExp(configData.isShareExperimentPublicly());
 
-        ComputationalResourceScheduling resourceScheduling = configData.getComputationalResourceScheduling();
-        if (resourceScheduling != null) {
-            updateSchedulingData(resourceScheduling, experiment);
-        }
-        AdvancedInputDataHandling inputDataHandling = configData.getAdvanceInputDataHandling();
-        if (inputDataHandling != null) {
-            updateInputDataHandling(inputDataHandling, experiment);
-        }
-        AdvancedOutputDataHandling outputDataHandling = configData.getAdvanceOutputDataHandling();
-        if (outputDataHandling != null) {
-            updateOutputDataHandling(outputDataHandling, experiment);
-        }
+            ComputationalResourceScheduling resourceScheduling = configData.getComputationalResourceScheduling();
+            if (resourceScheduling != null) {
+                updateSchedulingData(resourceScheduling, experiment);
+            }
+            AdvancedInputDataHandling inputDataHandling = configData.getAdvanceInputDataHandling();
+            if (inputDataHandling != null) {
+                updateInputDataHandling(inputDataHandling, experiment);
+            }
+            AdvancedOutputDataHandling outputDataHandling = configData.getAdvanceOutputDataHandling();
+            if (outputDataHandling != null) {
+                updateOutputDataHandling(outputDataHandling, experiment);
+            }
 
-        QualityOfServiceParams qosParams = configData.getQosParams();
-        if (qosParams != null) {
-            updateQosParams(qosParams, experiment);
+            QualityOfServiceParams qosParams = configData.getQosParams();
+            if (qosParams != null) {
+                updateQosParams(qosParams, experiment);
+            }
+            resource.save();
+        } catch (Exception e) {
+            logger.error("Error while updating user config data...", e.getMessage());
+            throw new Exception(e);
         }
-        resource.save();
+
     }
 
-    public void updateQosParams(QualityOfServiceParams qosParams, Resource resource) {
-        if (resource instanceof  ExperimentResource){
-            ExperimentResource expResource = (ExperimentResource) resource;
-            QosParamResource qosr = expResource.getQOSparams(expResource.getExpID());
-            qosr.setExperimentResource(expResource);
-            qosr.setStartExecutionAt(qosParams.getStartExecutionAt());
-            qosr.setExecuteBefore(qosParams.getExecuteBefore());
-            qosr.setNoOfRetries(qosParams.getNumberofRetries());
-            qosr.save();
+    public void updateQosParams(QualityOfServiceParams qosParams, Resource resource) throws Exception {
+        try {
+            if (resource instanceof ExperimentResource) {
+                ExperimentResource expResource = (ExperimentResource) resource;
+                QosParamResource qosr = expResource.getQOSparams(expResource.getExpID());
+                qosr.setExperimentResource(expResource);
+                qosr.setStartExecutionAt(qosParams.getStartExecutionAt());
+                qosr.setExecuteBefore(qosParams.getExecuteBefore());
+                qosr.setNoOfRetries(qosParams.getNumberofRetries());
+                qosr.save();
+            }
+        } catch (Exception e) {
+            logger.error("Error while updating QOS data...", e.getMessage());
+            throw new Exception(e);
         }
+
     }
 
-    public void updateOutputDataHandling(AdvancedOutputDataHandling outputDataHandling, Resource resource) {
+    public void updateOutputDataHandling(AdvancedOutputDataHandling outputDataHandling, Resource resource) throws Exception {
         AdvancedOutputDataHandlingResource adodh;
-        if (resource instanceof ExperimentResource){
-            ExperimentResource expResource = (ExperimentResource) resource;
-            adodh = expResource.getOutputDataHandling(expResource.getExpID());
-            adodh.setExperimentResource(expResource);
-        }else {
-            TaskDetailResource taskDetailResource = (TaskDetailResource) resource;
-            adodh = taskDetailResource.getOutputDataHandling(taskDetailResource.getTaskId());
-            adodh.setTaskDetailResource(taskDetailResource);
-            adodh.setExperimentResource(taskDetailResource.getWorkflowNodeDetailResource().getExperimentResource());
+        try {
+            if (resource instanceof ExperimentResource) {
+                ExperimentResource expResource = (ExperimentResource) resource;
+                adodh = expResource.getOutputDataHandling(expResource.getExpID());
+                adodh.setExperimentResource(expResource);
+            } else {
+                TaskDetailResource taskDetailResource = (TaskDetailResource) resource;
+                adodh = taskDetailResource.getOutputDataHandling(taskDetailResource.getTaskId());
+                adodh.setTaskDetailResource(taskDetailResource);
+                adodh.setExperimentResource(taskDetailResource.getWorkflowNodeDetailResource().getExperimentResource());
+            }
+            adodh.setOutputDataDir(outputDataHandling.getOutputDataDir());
+            adodh.setDataRegUrl(outputDataHandling.getDataRegistryURL());
+            adodh.setPersistOutputData(outputDataHandling.isPersistOutputData());
+            adodh.save();
+        } catch (Exception e) {
+            logger.error("Error while updating output data handling...", e.getMessage());
+            throw new Exception(e);
         }
-        adodh.setOutputDataDir(outputDataHandling.getOutputDataDir());
-        adodh.setDataRegUrl(outputDataHandling.getDataRegistryURL());
-        adodh.setPersistOutputData(outputDataHandling.isPersistOutputData());
-        adodh.save();
-    }
 
-    public void updateInputDataHandling(AdvancedInputDataHandling inputDataHandling, Resource resource) {
+    }
 
+    public void updateInputDataHandling(AdvancedInputDataHandling inputDataHandling, Resource resource) throws Exception {
         AdvanceInputDataHandlingResource adidh;
-        if (resource instanceof  ExperimentResource){
-            ExperimentResource expResource = (ExperimentResource) resource;
-            adidh = expResource.getInputDataHandling(expResource.getExpID());
-            adidh.setExperimentResource(expResource);
-        }else {
-            TaskDetailResource taskDetailResource = (TaskDetailResource) resource;
-            adidh = taskDetailResource.getInputDataHandling(taskDetailResource.getTaskId());
-            adidh.setTaskDetailResource(taskDetailResource);
-            adidh.setExperimentResource(taskDetailResource.getWorkflowNodeDetailResource().getExperimentResource());
-        }
-        adidh.setWorkingDir(inputDataHandling.getUniqueWorkingDirectory());
-        adidh.setWorkingDirParent(inputDataHandling.getParentWorkingDirectory());
-        adidh.setStageInputFiles(inputDataHandling.isSetStageInputFilesToWorkingDir());
-        adidh.setCleanAfterJob(inputDataHandling.isCleanUpWorkingDirAfterJob());
-        adidh.save();
-    }
-
-    public void updateSchedulingData(ComputationalResourceScheduling resourceScheduling, Resource resource) {
+        try {
+            if (resource instanceof ExperimentResource) {
+                ExperimentResource expResource = (ExperimentResource) resource;
+                adidh = expResource.getInputDataHandling(expReso

<TRUNCATED>

Mime
View raw message