airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chath...@apache.org
Subject git commit: implementing add and update methods for experiment basic metadata and configuration data - AIRAVATA-1006
Date Thu, 06 Feb 2014 21:22:12 GMT
Updated Branches:
  refs/heads/master 4626b43a0 -> a52692e7f


implementing add and update methods for experiment basic metadata and configuration data -
AIRAVATA-1006


Project: http://git-wip-us.apache.org/repos/asf/airavata/repo
Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/a52692e7
Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/a52692e7
Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/a52692e7

Branch: refs/heads/master
Commit: a52692e7ff8c0467c280d6937c1a838a5370bc8f
Parents: 4626b43
Author: chathuri <chathuri@apache.org>
Authored: Thu Feb 6 16:22:05 2014 -0500
Committer: chathuri <chathuri@apache.org>
Committed: Thu Feb 6 16:22:05 2014 -0500

----------------------------------------------------------------------
 .../registry/jpa/impl/ExperimentRegistry.java   | 279 +++++++++++++++++--
 .../registry/jpa/impl/RegistryImpl.java         |  39 ++-
 .../apache/airavata/registry/cpi/Registry.java  |  43 +--
 .../airavata/registry/cpi/utils/Constants.java  |  45 +++
 4 files changed, 358 insertions(+), 48 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/a52692e7/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 84eeda3..f9e1d6f 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
@@ -22,21 +22,20 @@
 package org.apache.airavata.persistance.registry.jpa.impl;
 
 import org.apache.airavata.common.exception.ApplicationSettingsException;
-import org.apache.airavata.model.experiment.BasicMetadata;
-import org.apache.airavata.model.experiment.ConfigurationData;
+import org.apache.airavata.model.experiment.*;
 import org.apache.airavata.persistance.registry.jpa.Resource;
 import org.apache.airavata.persistance.registry.jpa.ResourceType;
 import org.apache.airavata.persistance.registry.jpa.resources.ExperimentConfigDataResource;
+import org.apache.airavata.persistance.registry.jpa.resources.ExperimentInputResource;
 import org.apache.airavata.persistance.registry.jpa.resources.ExperimentMetadataResource;
 import org.apache.airavata.persistance.registry.jpa.resources.GatewayResource;
 import org.apache.airavata.registry.cpi.DependentDataType;
+import org.apache.airavata.registry.cpi.utils.Constants;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import java.sql.Timestamp;
-import java.util.Calendar;
-import java.util.List;
-import java.util.UUID;
+import java.util.*;
 
 public class ExperimentRegistry {
     private GatewayRegistry gatewayRegistry;
@@ -62,17 +61,17 @@ public class ExperimentRegistry {
         try {
             gatewayRegistry = new GatewayRegistry();
             GatewayResource gateway = gatewayRegistry.getGateway();
-            ExperimentMetadataResource exBasicData = (ExperimentMetadataResource)gateway.get(ResourceType.EXPERIMENT_METADATA,
experimentID);
-            ExperimentConfigDataResource exConfigData = (ExperimentConfigDataResource)exBasicData.create(ResourceType.EXPERIMENT_CONFIG_DATA);
+            ExperimentMetadataResource exBasicData = (ExperimentMetadataResource) gateway.get(ResourceType.EXPERIMENT_METADATA,
experimentID);
+            ExperimentConfigDataResource exConfigData = (ExperimentConfigDataResource) exBasicData.create(ResourceType.EXPERIMENT_CONFIG_DATA);
             BasicMetadata updatedBasicMetadata = configurationData.getBasicMetadata();
-            if (updatedBasicMetadata != null){
-                if (updatedBasicMetadata.getExperimentName() != null && !updatedBasicMetadata.getExperimentName().equals("")){
+            if (updatedBasicMetadata != null) {
+                if (updatedBasicMetadata.getExperimentName() != null && !updatedBasicMetadata.getExperimentName().equals(""))
{
                     exBasicData.setExperimentName(updatedBasicMetadata.getExperimentName());
                 }
-                if (updatedBasicMetadata.getExperimentDescription() != null && !updatedBasicMetadata.getExperimentDescription().equals("")){
+                if (updatedBasicMetadata.getExperimentDescription() != null && !updatedBasicMetadata.getExperimentDescription().equals(""))
{
                     exBasicData.setDescription(updatedBasicMetadata.getExperimentDescription());
                 }
-                if (updatedBasicMetadata.getUserName() != null && !updatedBasicMetadata.getUserName().equals("")){
+                if (updatedBasicMetadata.getUserName() != null && !updatedBasicMetadata.getUserName().equals(""))
{
                     exBasicData.setExecutionUser(updatedBasicMetadata.getUserName());
                 }
                 exBasicData.setShareExp(updatedBasicMetadata.isSetShareExperimentPublicly());
@@ -84,24 +83,264 @@ public class ExperimentRegistry {
             exConfigData.setWorkflowTemplateId(configurationData.getWorkflowTemplateId());
             exConfigData.setWorkflowTemplateVersion(configurationData.getWorklfowTemplateVersion());
 
-            exConfigData.setCpuCount(configurationData.getComputationalResourceScheduling().getTotalCPUCount());
-            exConfigData.setAiravataAutoSchedule(configurationData.getComputationalResourceScheduling().isAiravataAutoSchedule());
-            exConfigData.setOverrideManualSchedule(configurationData.getComputationalResourceScheduling().isOverrideManualScheduledParams());
-            exConfigData.setResourceHostID(configurationData.getComputationalResourceScheduling().getResourceHostId());
+            ComputationalResourceScheduling resourceScheduling = configurationData.getComputationalResourceScheduling();
+            if (resourceScheduling != null) {
+                exConfigData.setCpuCount(resourceScheduling.getTotalCPUCount());
+                exConfigData.setAiravataAutoSchedule(resourceScheduling.isAiravataAutoSchedule());
+                exConfigData.setOverrideManualSchedule(resourceScheduling.isOverrideManualScheduledParams());
+                exConfigData.setResourceHostID(resourceScheduling.getResourceHostId());
+                exConfigData.setNodeCount(resourceScheduling.getNodeCount());
+                exConfigData.setNumberOfThreads(resourceScheduling.getNumberOfThreads());
+                exConfigData.setQueueName(resourceScheduling.getQueueName());
+                exConfigData.setWallTimeLimit(resourceScheduling.getWallTimeLimit());
+                exConfigData.setJobStartTime(getTime(resourceScheduling.getJobStartTime()));
+                exConfigData.setPhysicalMemory(resourceScheduling.getTotalPhysicalMemory());
+                exConfigData.setProjectAccount(resourceScheduling.getComputationalProjectAccount());
+            }
+
+            AdvancedInputDataHandling inputDataHandling = configurationData.getAdvanceInputDataHandling();
+            if (inputDataHandling != null) {
+                exConfigData.setStageInputsToWDir(inputDataHandling.isStageInputFilesToWorkingDir());
+                exConfigData.setWorkingDirParent(inputDataHandling.getWorkingDirectoryParent());
+                exConfigData.setWorkingDir(inputDataHandling.getUniqueWorkingDirectory());
+                exConfigData.setCleanAfterJob(inputDataHandling.isCleanUpWorkingDirAfterJob());
+            }
+
+            AdvancedOutputDataHandling outputDataHandling = configurationData.getAdvanceOutputDataHandling();
+            if (outputDataHandling != null) {
+                exConfigData.setOutputDataDir(outputDataHandling.getOutputdataDir());
+                exConfigData.setDataRegURL(outputDataHandling.getDataRegistryURL());
+                exConfigData.setPersistOutputData(outputDataHandling.isPersistOutputData());
+            }
+
+            QualityOfServiceParams qosParams = configurationData.getQosParams();
+            if (qosParams != null) {
+                exConfigData.setStartExecutionAt(qosParams.getStartExecutionAt());
+                exConfigData.setExecuteBefore(qosParams.getExecuteBefore());
+                exConfigData.setNumberOfRetries(qosParams.getNumberofRetries());
+            }
 
+            Map<String, String> experimentInputs = configurationData.getExperimentInputs();
+            for (String inputKey : experimentInputs.keySet()) {
+                ExperimentInputResource exInputResource = (ExperimentInputResource) exBasicData.create(ResourceType.EXPERIMENT_INPUT);
+                String value = experimentInputs.get(inputKey);
+                exInputResource.setExperimentKey(inputKey);
+                exInputResource.setValue(value);
+                exInputResource.setExperimentMetadataResource(exBasicData);
+                exInputResource.save();
+            }
+            exConfigData.save();
         } catch (ApplicationSettingsException e) {
             logger.error("Unable to read airavata-server properties", e.getMessage());
         }
     }
 
-    public String getExperimentID (String experimentName){
+    public String getExperimentID(String experimentName) {
         return experimentName + "_" + UUID.randomUUID();
     }
 
-    public void update(DependentDataType dataType, Object newObjectToUpdate) {
+    public void update(Object experimentObject, String expId) {
+        try {
+            gatewayRegistry = new GatewayRegistry();
+            if (experimentObject instanceof BasicMetadata) {
+                updateBasicData((BasicMetadata) experimentObject, expId);
+            } else if (experimentObject instanceof ConfigurationData) {
+                updateExpConfigData((ConfigurationData) experimentObject, expId);
+            }
+
+        } catch (ApplicationSettingsException e) {
+            logger.error("Unable to read airavata-server properties", e.getMessage());
+        }
+    }
+
+    public void updateExpBasicMetadataField(String expID, String fieldName, Object value)
{
+        try {
+            GatewayResource gateway = gatewayRegistry.getGateway();
+            ExperimentMetadataResource exBasicData = (ExperimentMetadataResource) gateway.get(ResourceType.EXPERIMENT_METADATA,
expID);
+            if (fieldName.equals(Constants.FieldConstants.BasicMetadataConstants.EXPERIMENT_NAME))
{
+                exBasicData.setExperimentName((String) value);
+                exBasicData.save();
+            } else if (fieldName.equals(Constants.FieldConstants.BasicMetadataConstants.USER_NAME))
{
+                exBasicData.setExecutionUser((String) value);
+                exBasicData.save();
+            } else if (fieldName.equals(Constants.FieldConstants.BasicMetadataConstants.EXPERIMENT_DESC))
{
+                exBasicData.setDescription((String) value);
+                exBasicData.save();
+            } else if (fieldName.equals(Constants.FieldConstants.BasicMetadataConstants.SHARE_EXP_PUBLIC))
{
+                exBasicData.setShareExp((Boolean) value);
+                exBasicData.save();
+            }else {
+                logger.error("Unsupported field type for Experiment basic metadata");
+            }
 
+        } catch (ApplicationSettingsException e) {
+            logger.error("Unable to read airavata-server properties", e.getMessage());
+        }
     }
 
+    public void updateExpConfigDataField(String expID, String fieldName, Object value) {
+        try {
+            GatewayResource gateway = gatewayRegistry.getGateway();
+            ExperimentMetadataResource exBasicData = (ExperimentMetadataResource) gateway.get(ResourceType.EXPERIMENT_METADATA,
expID);
+            ExperimentConfigDataResource exConfigData = (ExperimentConfigDataResource)exBasicData.get(ResourceType.EXPERIMENT_CONFIG_DATA,
expID);
+            if (fieldName.equals(Constants.FieldConstants.ConfigurationDataConstants.APPLICATION_ID))
{
+                exConfigData.setApplicationID((String) value);
+                exConfigData.save();
+            } else if (fieldName.equals(Constants.FieldConstants.ConfigurationDataConstants.APPLICATION_VERSION))
{
+                exConfigData.setApplicationVersion((String) value);
+                exConfigData.save();
+            } else if (fieldName.equals(Constants.FieldConstants.ConfigurationDataConstants.WORKFLOW_TEMPLATE_ID))
{
+                exConfigData.setWorkflowTemplateId((String) value);
+                exConfigData.save();
+            } else if (fieldName.equals(Constants.FieldConstants.ConfigurationDataConstants.WORKFLOW_TEMPLATE_VERSION))
{
+                exConfigData.setWorkflowTemplateVersion((String) value);
+                exConfigData.save();
+            }else if (fieldName.equals(Constants.FieldConstants.ConfigurationDataConstants.COMPUTATIONAL_RESOURCE_SCHEDULING)){
+                ComputationalResourceScheduling resourceScheduling = (ComputationalResourceScheduling)value;
+                exConfigData.setCpuCount(resourceScheduling.getTotalCPUCount());
+                exConfigData.setAiravataAutoSchedule(resourceScheduling.isAiravataAutoSchedule());
+                exConfigData.setOverrideManualSchedule(resourceScheduling.isOverrideManualScheduledParams());
+                exConfigData.setResourceHostID(resourceScheduling.getResourceHostId());
+                exConfigData.setNodeCount(resourceScheduling.getNodeCount());
+                exConfigData.setNumberOfThreads(resourceScheduling.getNumberOfThreads());
+                exConfigData.setQueueName(resourceScheduling.getQueueName());
+                exConfigData.setWallTimeLimit(resourceScheduling.getWallTimeLimit());
+                exConfigData.setJobStartTime(getTime(resourceScheduling.getJobStartTime()));
+                exConfigData.setPhysicalMemory(resourceScheduling.getTotalPhysicalMemory());
+                exConfigData.setProjectAccount(resourceScheduling.getComputationalProjectAccount());
+                exConfigData.save();
+            }else if (fieldName.equals(Constants.FieldConstants.ConfigurationDataConstants.ADVANCED_INPUT_HANDLING)){
+                AdvancedInputDataHandling adInputHandling = (AdvancedInputDataHandling)value;
+                exConfigData.setStageInputsToWDir(adInputHandling.isStageInputFilesToWorkingDir());
+                exConfigData.setWorkingDirParent(adInputHandling.getWorkingDirectoryParent());
+                exConfigData.setWorkingDir(adInputHandling.getUniqueWorkingDirectory());
+                exConfigData.setCleanAfterJob(adInputHandling.isCleanUpWorkingDirAfterJob());
+                exConfigData.save();
+            }else if (fieldName.equals(Constants.FieldConstants.ConfigurationDataConstants.ADVANCED_OUTPUT_HANDLING)){
+                AdvancedOutputDataHandling adOutputHandling = (AdvancedOutputDataHandling)value;
+                exConfigData.setOutputDataDir(adOutputHandling.getOutputdataDir());
+                exConfigData.setDataRegURL(adOutputHandling.getDataRegistryURL());
+                exConfigData.setPersistOutputData(adOutputHandling.isPersistOutputData());
+                exConfigData.save();
+            }else if (fieldName.equals(Constants.FieldConstants.ConfigurationDataConstants.QOS_PARAMS)){
+                QualityOfServiceParams qosParams = (QualityOfServiceParams)value;
+                exConfigData.setStartExecutionAt(qosParams.getStartExecutionAt());
+                exConfigData.setExecuteBefore(qosParams.getExecuteBefore());
+                exConfigData.setNumberOfRetries(qosParams.getNumberofRetries());
+                exConfigData.save();
+            }else if (fieldName.equals(Constants.FieldConstants.ConfigurationDataConstants.EXPERIMENT_INPUTS)){
+                if (value instanceof HashMap){
+                    Map<String, String> experimentInputs = (HashMap<String, String>)value;
+                    List<Resource> exInputs = exBasicData.get(ResourceType.EXPERIMENT_INPUT);
+                    int i = 0;
+                    for (String exInputKey : experimentInputs.keySet()){
+                        ExperimentInputResource exInput = (ExperimentInputResource)exInputs.get(i);
+                        if (exInput.getExperimentKey().equals(exInputKey)){
+                            exInput.setValue(experimentInputs.get(exInputKey));
+                            exInput.save();
+                        }
+                        i++;
+                    }
+                }
+            }else {
+                logger.error("Unsupported field type for Experiment config data");
+            }
+
+        } catch (ApplicationSettingsException e) {
+            logger.error("Unable to read airavata-server properties", e.getMessage());
+        }
+    }
+
+
+    public void updateBasicData(BasicMetadata basicMetadata, String expId) throws ApplicationSettingsException
{
+        GatewayResource gateway = gatewayRegistry.getGateway();
+        ExperimentMetadataResource exBasicData = (ExperimentMetadataResource) gateway.get(ResourceType.EXPERIMENT_METADATA,
expId);
+        exBasicData.setExperimentName(basicMetadata.getExperimentName());
+        exBasicData.setDescription(basicMetadata.getExperimentDescription());
+        exBasicData.setExecutionUser(basicMetadata.getUserName());
+        exBasicData.setSubmittedDate(getCurrentTimestamp());
+        exBasicData.setShareExp(basicMetadata.isSetShareExperimentPublicly());
+        exBasicData.save();
+    }
+
+    public void updateExpConfigData(ConfigurationData configData, String expId) throws ApplicationSettingsException
{
+        GatewayResource gateway = gatewayRegistry.getGateway();
+        ExperimentMetadataResource exBasicData = (ExperimentMetadataResource) gateway.get(ResourceType.EXPERIMENT_METADATA,
expId);
+        ExperimentConfigDataResource exConfigResource = (ExperimentConfigDataResource) exBasicData.get(ResourceType.EXPERIMENT_CONFIG_DATA,
expId);
+        BasicMetadata updatedBasicMetadata = configData.getBasicMetadata();
+        if (updatedBasicMetadata != null) {
+            if (updatedBasicMetadata.getExperimentName() != null && !updatedBasicMetadata.getExperimentName().equals(""))
{
+                exBasicData.setExperimentName(updatedBasicMetadata.getExperimentName());
+            }
+            if (updatedBasicMetadata.getExperimentDescription() != null && !updatedBasicMetadata.getExperimentDescription().equals(""))
{
+                exBasicData.setDescription(updatedBasicMetadata.getExperimentDescription());
+            }
+            if (updatedBasicMetadata.getUserName() != null && !updatedBasicMetadata.getUserName().equals(""))
{
+                exBasicData.setExecutionUser(updatedBasicMetadata.getUserName());
+            }
+            exBasicData.setShareExp(updatedBasicMetadata.isSetShareExperimentPublicly());
+            exBasicData.save();
+        }
+        exConfigResource.setExMetadata(exBasicData);
+        exConfigResource.setApplicationID(configData.getApplicationId());
+        exConfigResource.setApplicationVersion(configData.getApplicationVersion());
+        exConfigResource.setWorkflowTemplateId(configData.getWorkflowTemplateId());
+        exConfigResource.setWorkflowTemplateVersion(configData.getWorklfowTemplateVersion());
+
+        ComputationalResourceScheduling resourceScheduling = configData.getComputationalResourceScheduling();
+        if (resourceScheduling != null) {
+            exConfigResource.setCpuCount(resourceScheduling.getTotalCPUCount());
+            exConfigResource.setAiravataAutoSchedule(resourceScheduling.isAiravataAutoSchedule());
+            exConfigResource.setOverrideManualSchedule(resourceScheduling.isOverrideManualScheduledParams());
+            exConfigResource.setResourceHostID(resourceScheduling.getResourceHostId());
+            exConfigResource.setNodeCount(resourceScheduling.getNodeCount());
+            exConfigResource.setNumberOfThreads(resourceScheduling.getNumberOfThreads());
+            exConfigResource.setQueueName(resourceScheduling.getQueueName());
+            exConfigResource.setWallTimeLimit(resourceScheduling.getWallTimeLimit());
+            exConfigResource.setJobStartTime(getTime(resourceScheduling.getJobStartTime()));
+            exConfigResource.setPhysicalMemory(resourceScheduling.getTotalPhysicalMemory());
+            exConfigResource.setProjectAccount(resourceScheduling.getComputationalProjectAccount());
+        }
+
+        AdvancedInputDataHandling inputDataHandling = configData.getAdvanceInputDataHandling();
+        if (inputDataHandling != null) {
+            exConfigResource.setStageInputsToWDir(inputDataHandling.isStageInputFilesToWorkingDir());
+            exConfigResource.setWorkingDirParent(inputDataHandling.getWorkingDirectoryParent());
+            exConfigResource.setWorkingDir(inputDataHandling.getUniqueWorkingDirectory());
+            exConfigResource.setCleanAfterJob(inputDataHandling.isCleanUpWorkingDirAfterJob());
+        }
+
+        AdvancedOutputDataHandling outputDataHandling = configData.getAdvanceOutputDataHandling();
+        if (outputDataHandling != null) {
+            exConfigResource.setOutputDataDir(outputDataHandling.getOutputdataDir());
+            exConfigResource.setDataRegURL(outputDataHandling.getDataRegistryURL());
+            exConfigResource.setPersistOutputData(outputDataHandling.isPersistOutputData());
+        }
+
+        QualityOfServiceParams qosParams = configData.getQosParams();
+        if (qosParams != null) {
+            exConfigResource.setStartExecutionAt(qosParams.getStartExecutionAt());
+            exConfigResource.setExecuteBefore(qosParams.getExecuteBefore());
+            exConfigResource.setNumberOfRetries(qosParams.getNumberofRetries());
+        }
+
+        Map<String, String> experimentInputs = configData.getExperimentInputs();
+        for (String inputKey : experimentInputs.keySet()) {
+            ExperimentInputResource exInputResource = (ExperimentInputResource) exBasicData.create(ResourceType.EXPERIMENT_INPUT);
+            String value = experimentInputs.get(inputKey);
+            exInputResource.setExperimentKey(inputKey);
+            exInputResource.setValue(value);
+            exInputResource.setExperimentMetadataResource(exBasicData);
+            exInputResource.save();
+        }
+        exConfigResource.save();
+    }
+
+    public void update(ConfigurationData configurationData, String experimentID) {
+
+    }
+
+
     public void update(DependentDataType dataType, Object identifier, Object field, Object
value) {
 
     }
@@ -127,4 +366,10 @@ public class ExperimentRegistry {
         java.util.Date d = calender.getTime();
         return new Timestamp(d.getTime());
     }
+
+    public Timestamp getTime(int time) {
+        long timeInMileseconds = time * 1000L;
+        Date date = new Date(timeInMileseconds);
+        return new Timestamp(date.getTime());
+    }
 }

http://git-wip-us.apache.org/repos/asf/airavata/blob/a52692e7/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/RegistryImpl.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/RegistryImpl.java
b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/RegistryImpl.java
index bd1be77..ca394bc 100644
--- a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/RegistryImpl.java
+++ b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/RegistryImpl.java
@@ -42,7 +42,7 @@ public class RegistryImpl implements Registry {
                 experimentRegistry.add((BasicMetadata)newObjectToAdd);
                 break;
             default:
-                logger.error("Unsupported data type", new UnsupportedOperationException());
+                logger.error("Unsupported top level type..", new UnsupportedOperationException());
                 throw new UnsupportedOperationException();
         }
     }
@@ -54,35 +54,52 @@ public class RegistryImpl implements Registry {
                 experimentRegistry.add((ConfigurationData)newObjectToAdd, (String)dependentIdentifier);
                 break;
             case EXPERIMENT_SUMMARY:
+                // no thrift model yet
                 break;
             case EXPERIMENT_GENERATED_DATA:
+                // no thrift model yet
                 break;
             case EXECUTION_ERROR:
+                // no thrift model yet
                 break;
             default:
-                logger.error("Unsupported data type", new UnsupportedOperationException());
+                logger.error("Unsupported dependent data type...", new UnsupportedOperationException());
                 throw new UnsupportedOperationException();
         }
 
     }
 
     @Override
-    public void update(TopLevelDataType dataType, Object newObjectToUpdate) {
-
-    }
-
-    @Override
-    public void update(DependentDataType dataType, Object newObjectToUpdate, Object dependentIdentifier)
{
+    public void update(DataType dataType, Object newObjectToUpdate, Object identifier) {
+        switch (dataType){
+            case EXPERIMENT_BASIC_DATA:
+                experimentRegistry.update(newObjectToUpdate, (String)identifier);
+                break;
+            case EXPERIMENT_CONFIGURATION_DATA:
+                experimentRegistry.update(newObjectToUpdate, (String)identifier);
+            default:
+                logger.error("Unsupported data type...", new UnsupportedOperationException());
+                throw new UnsupportedOperationException();
+        }
 
     }
 
     @Override
-    public void update(DataType dataType, Object identifier, Object field, Object value)
{
-
+    public void update(DataType dataType, Object identifier, String field, Object value)
{
+        switch (dataType){
+            case EXPERIMENT_BASIC_DATA:
+                experimentRegistry.updateExpBasicMetadataField((String) identifier, field,
value);
+                break;
+            case EXPERIMENT_CONFIGURATION_DATA:
+                experimentRegistry.updateExpConfigDataField((String) identifier, field, value);
+            default:
+                logger.error("Unsupported data type...", new UnsupportedOperationException());
+                throw new UnsupportedOperationException();
+        }
     }
 
     @Override
-    public List<Object> get(DataType dataType, Object filteredBy, Object value) {
+    public List<Object> get(DataType dataType, Object fieldName, Object value) {
         return null;
     }
 

http://git-wip-us.apache.org/repos/asf/airavata/blob/a52692e7/modules/registry/registry-cpi/src/main/java/org/apache/airavata/registry/cpi/Registry.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-cpi/src/main/java/org/apache/airavata/registry/cpi/Registry.java
b/modules/registry/registry-cpi/src/main/java/org/apache/airavata/registry/cpi/Registry.java
index 7bc9198..6a3c434 100644
--- a/modules/registry/registry-cpi/src/main/java/org/apache/airavata/registry/cpi/Registry.java
+++ b/modules/registry/registry-cpi/src/main/java/org/apache/airavata/registry/cpi/Registry.java
@@ -1,5 +1,7 @@
 package org.apache.airavata.registry.cpi;
 
+import org.apache.airavata.registry.cpi.utils.Constants;
+
 import javax.xml.crypto.Data;
 import java.util.List;
 
@@ -41,22 +43,22 @@ public interface Registry {
      *                       have to fill the whole object. He needs to only fill the mandatory
fields and whatever the
      *                       other fields that need to be updated.
      */
-    public void update(TopLevelDataType dataType, Object newObjectToUpdate);
+    public void update(DataType dataType, Object newObjectToUpdate, Object identifier);
 
-    /**
-     * This method is to update the whole object in registry
-     * @param dataType Data type is a predefined type which the programmer should choose
according to the object he
-     *                 is going to save in to registry
-     * @param newObjectToUpdate Object which contains the fields that need to be updated
in to registry. This object is a
-     *                       thrift model object. In experiment case this object can be BasicMetadata,
ConfigurationData
-     *                       etc. CPI programmer can only fill necessary fields that need
to be updated. He does not
-     *                       have to fill the whole object. He needs to only fill the mandatory
fields and whatever the
-     *                       other fields that need to be updated.
-     * @param dependentIdentifier Object which contains the identifier if the object that
is going to add is not a top
-     *                            level object in the data model. If it is a top level object,
programmer can pass it as
-     *                            null
-     */
-    public void update(DependentDataType dataType, Object newObjectToUpdate, Object dependentIdentifier);
+//    /**
+//     * This method is to update the whole object in registry
+//     * @param dataType Data type is a predefined type which the programmer should choose
according to the object he
+//     *                 is going to save in to registry
+//     * @param newObjectToUpdate Object which contains the fields that need to be updated
in to registry. This object is a
+//     *                       thrift model object. In experiment case this object can be
BasicMetadata, ConfigurationData
+//     *                       etc. CPI programmer can only fill necessary fields that need
to be updated. He does not
+//     *                       have to fill the whole object. He needs to only fill the mandatory
fields and whatever the
+//     *                       other fields that need to be updated.
+//     * @param dependentIdentifier Object which contains the identifier if the object that
is going to add is not a top
+//     *                            level object in the data model. If it is a top level
object, programmer can pass it as
+//     *                            null
+//     */
+//    public void update(DependentDataType dataType, Object newObjectToUpdate, Object dependentIdentifier);
 
     /**
      * This method is to update a specific field of the data model
@@ -64,23 +66,24 @@ public interface Registry {
      *                 is going to save in to registry
      * @param identifier Identifier which will uniquely identify the data model. For example,
in Experiment_Basic_Type,
      *                   identifier will be generated experimentID
-     * @param field Field which need to be updated in the registry. In Experiment_Basic_Type,
if you want to update the
-     *              description, field will be "description"
+     * @param fieldName Field which need to be updated in the registry. In Experiment_Basic_Type,
if you want to update the
+     *              description, field will be "description". Field names are defined in
+     *              org.apache.airavata.registry.cpi.utils.Constants
      * @param value Value by which the given field need to be updated. If the field is "description",
that field will be
      *              updated by given value
      */
-    public void update(DataType dataType, Object identifier, Object field, Object value);
+    public void update(DataType dataType, Object identifier, String fieldName, Object value);
 
     /**
      * This method is to retrieve list of objects according to a given criteria
      * @param dataType Data type is a predefined type which the programmer should choose
according to the object he
      *                 is going to save in to registry
-     * @param filteredBy FilterBy is the field that filtering should be done. For example,
if we want to retrieve all
+     * @param fieldName FieldName is the field that filtering should be done. For example,
if we want to retrieve all
      *                   the experiments for a given user, filterBy will be "userName"
      * @param value value for the filtering field. In the experiment case, value for "userName"
can be "admin"
      * @return List of objects according to the given criteria
      */
-    public List<Object> get(DataType dataType, Object filteredBy, Object value);
+    public List<Object> get(DataType dataType, Object fieldName, Object value);
 
     /**
      * This method is to retrieve a specific value for a given field.

http://git-wip-us.apache.org/repos/asf/airavata/blob/a52692e7/modules/registry/registry-cpi/src/main/java/org/apache/airavata/registry/cpi/utils/Constants.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-cpi/src/main/java/org/apache/airavata/registry/cpi/utils/Constants.java
b/modules/registry/registry-cpi/src/main/java/org/apache/airavata/registry/cpi/utils/Constants.java
new file mode 100644
index 0000000..1556d06
--- /dev/null
+++ b/modules/registry/registry-cpi/src/main/java/org/apache/airavata/registry/cpi/utils/Constants.java
@@ -0,0 +1,45 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.airavata.registry.cpi.utils;
+
+public class Constants {
+    public final class FieldConstants {
+        public final class BasicMetadataConstants {
+            public static final String EXPERIMENT_NAME = "experimentName";
+            public static final String USER_NAME = "userName";
+            public static final String EXPERIMENT_DESC = "experimentDescription";
+            public static final String SHARE_EXP_PUBLIC = "shareExperimentPublicly";
+        }
+
+        public final class ConfigurationDataConstants {
+            public static final String APPLICATION_ID = "applicationId";
+            public static final String APPLICATION_VERSION = "applicationVersion";
+            public static final String WORKFLOW_TEMPLATE_ID = "workflowTemplateId";
+            public static final String WORKFLOW_TEMPLATE_VERSION = "worklfowTemplateVersion";
+            public static final String EXPERIMENT_INPUTS = "experimentInputs";
+            public static final String COMPUTATIONAL_RESOURCE_SCHEDULING = "computationalResourceScheduling";
+            public static final String ADVANCED_INPUT_HANDLING = "advanceInputDataHandling";
+            public static final String ADVANCED_OUTPUT_HANDLING = "advanceOutputDataHandling";
+            public static final String QOS_PARAMS = "qosParams";
+        }
+    }
+}


Mime
View raw message