airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chath...@apache.org
Subject git commit: implementing get list method for child elements - AIRAVATA-1006
Date Tue, 25 Feb 2014 16:39:46 GMT
Repository: airavata
Updated Branches:
  refs/heads/master 2ffc36cf5 -> 102ee17a1


implementing get list method for child elements - AIRAVATA-1006


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

Branch: refs/heads/master
Commit: 102ee17a175bd0d2ea200dc5f37849aac4fdc061
Parents: 2ffc36c
Author: chathuri <chathuri@apache.org>
Authored: Tue Feb 25 11:39:42 2014 -0500
Committer: chathuri <chathuri@apache.org>
Committed: Tue Feb 25 11:39:42 2014 -0500

----------------------------------------------------------------------
 .../registry/jpa/impl/ExperimentRegistry.java   | 124 ++++++++++++++++++-
 .../registry/jpa/impl/RegistryImpl.java         |  48 ++++++-
 .../airavata/registry/cpi/utils/Constants.java  |  27 ++++
 3 files changed, 193 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/102ee17a/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 1fb6352..8c93165 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
@@ -27,6 +27,7 @@ import org.apache.airavata.model.workspace.experiment.*;
 import org.apache.airavata.persistance.registry.jpa.Resource;
 import org.apache.airavata.persistance.registry.jpa.ResourceType;
 import org.apache.airavata.persistance.registry.jpa.ResourceUtils;
+import org.apache.airavata.persistance.registry.jpa.model.Status;
 import org.apache.airavata.persistance.registry.jpa.resources.*;
 import org.apache.airavata.persistance.registry.jpa.utils.ThriftDataModelConversion;
 import org.apache.airavata.registry.cpi.CompositeIdentifier;
@@ -1171,7 +1172,7 @@ public class ExperimentRegistry {
                 }
                 return experiments;
             }else {
-                logger.error("Unsupported field type for Experiment meta data");
+                logger.error("Unsupported field name to retrieve experiment list...");
             }
         } catch (ApplicationSettingsException e) {
             logger.error("Unable to read airavata-server properties", e.getMessage());
@@ -1179,6 +1180,91 @@ public class ExperimentRegistry {
         return experiments;
     }
 
+    public List<WorkflowNodeDetails> getWFNodeDetails (String fieldName, Object value){
+        try {
+            GatewayResource defaultGateway = gatewayRegistry.getDefaultGateway();
+            if (fieldName.equals(Constants.FieldConstants.WorkflowNodeConstants.EXPERIMENT_ID)){
+                ExperimentResource experiment = defaultGateway.getExperiment((String) value);
+                List<WorkflowNodeDetailResource> workflowNodeDetails = experiment.getWorkflowNodeDetails();
+                return ThriftDataModelConversion.getWfNodeList(workflowNodeDetails);
+            }else {
+                logger.error("Unsupported field name to retrieve workflow detail list...");
+            }
+        } catch (ApplicationSettingsException e) {
+            logger.error("Unable to read airavata-server properties", e.getMessage());
+        }
+        return null;
+    }
+
+    public List<WorkflowNodeStatus> getWFNodeStatusList (String fieldName, Object value){
+        try {
+            GatewayResource defaultGateway = gatewayRegistry.getDefaultGateway();
+            if (fieldName.equals(Constants.FieldConstants.WorkflowNodeStatus.EXPERIMENT_ID)){
+                ExperimentResource experiment = defaultGateway.getExperiment((String) value);
+                List<StatusResource> workflowNodeStatuses = experiment.getWorkflowNodeStatuses();
+                return ThriftDataModelConversion.getWorkflowNodeStatusList(workflowNodeStatuses);
+            }else {
+                logger.error("Unsupported field name to retrieve workflow status list...");
+            }
+        } catch (ApplicationSettingsException e) {
+            logger.error("Unable to read airavata-server properties", e.getMessage());
+        }
+        return null;
+    }
+
+    public List<TaskDetails> getTaskDetails (String fieldName, Object value){
+        try {
+            GatewayResource defaultGateway = gatewayRegistry.getDefaultGateway();
+            if (fieldName.equals(Constants.FieldConstants.TaskDetailConstants.NODE_ID)){
+                ExperimentResource experiment = (ExperimentResource)defaultGateway.create(ResourceType.EXPERIMENT);
+                WorkflowNodeDetailResource workflowNode = experiment.getWorkflowNode((String)
value);
+                List<TaskDetailResource> taskDetails = workflowNode.getTaskDetails();
+                return ThriftDataModelConversion.getTaskDetailsList(taskDetails);
+            }else {
+                logger.error("Unsupported field name to retrieve task detail list...");
+            }
+        } catch (ApplicationSettingsException e) {
+            logger.error("Unable to read airavata-server properties", e.getMessage());
+        }
+        return null;
+    }
+
+    public List<JobDetails> getJobDetails (String fieldName, Object value){
+        try {
+            GatewayResource defaultGateway = gatewayRegistry.getDefaultGateway();
+            if (fieldName.equals(Constants.FieldConstants.JobDetaisConstants.TASK_ID)){
+                ExperimentResource experiment = (ExperimentResource)defaultGateway.create(ResourceType.EXPERIMENT);
+                WorkflowNodeDetailResource workflowNode = (WorkflowNodeDetailResource)experiment.create(ResourceType.WORKFLOW_NODE_DETAIL);
+                TaskDetailResource taskDetail = workflowNode.getTaskDetail((String) value);
+                List<JobDetailResource> jobDetailList = taskDetail.getJobDetailList();
+                return ThriftDataModelConversion.getJobDetailsList(jobDetailList);
+            }else {
+                logger.error("Unsupported field name to retrieve job details list...");
+            }
+        } catch (ApplicationSettingsException e) {
+            logger.error("Unable to read airavata-server properties", e.getMessage());
+        }
+        return null;
+    }
+
+    public List<DataTransferDetails> getDataTransferDetails (String fieldName, Object
value){
+        try {
+            GatewayResource defaultGateway = gatewayRegistry.getDefaultGateway();
+            if (fieldName.equals(Constants.FieldConstants.DataTransferDetailConstants.TASK_ID)){
+                ExperimentResource experiment = (ExperimentResource)defaultGateway.create(ResourceType.EXPERIMENT);
+                WorkflowNodeDetailResource workflowNode = (WorkflowNodeDetailResource)experiment.create(ResourceType.WORKFLOW_NODE_DETAIL);
+                TaskDetailResource taskDetail = workflowNode.getTaskDetail((String) value);
+                List<DataTransferDetailResource> dataTransferDetailList = taskDetail.getDataTransferDetailList();
+                return ThriftDataModelConversion.getDataTransferlList(dataTransferDetailList);
+            }else {
+                logger.error("Unsupported field name to retrieve job details list...");
+            }
+        } catch (ApplicationSettingsException e) {
+            logger.error("Unable to read airavata-server properties", e.getMessage());
+        }
+        return null;
+    }
+
     public Object getExperiment(String expId, String fieldName) {
         try {
             GatewayResource gateway = gatewayRegistry.getDefaultGateway();
@@ -1565,6 +1651,42 @@ public class ExperimentRegistry {
         return expIDs;
     }
 
+    public List<String> getWorkflowNodeIds (String fieldName, Object value){
+        List<String> wfIds = new ArrayList<String>();
+        List<WorkflowNodeDetails> wfNodeDetails = getWFNodeDetails(fieldName, value);
+        for (WorkflowNodeDetails wf : wfNodeDetails){
+            wfIds.add(wf.getNodeInstanceId());
+        }
+        return wfIds;
+    }
+
+    public List<String> getTaskDetailIds (String fieldName, Object value){
+        List<String> taskDetailIds = new ArrayList<String>();
+        List<TaskDetails> taskDetails = getTaskDetails(fieldName, value);
+        for (TaskDetails td : taskDetails){
+            taskDetailIds.add(td.getTaskID());
+        }
+        return taskDetailIds;
+    }
+
+    public List<String> getJobDetailIds (String fieldName, Object value){
+        List<String> jobIds = new ArrayList<String>();
+        List<JobDetails> jobDetails = getJobDetails(fieldName, value);
+        for (JobDetails jd : jobDetails){
+            jobIds.add(jd.getJobID());
+        }
+        return jobIds;
+    }
+
+    public List<String> getTransferDetailIds (String fieldName, Object value){
+        List<String> transferIds = new ArrayList<String>();
+        List<DataTransferDetails> dataTransferDetails = getDataTransferDetails(fieldName,
value);
+        for (DataTransferDetails dtd : dataTransferDetails){
+            transferIds.add(dtd.getTransferID());
+        }
+        return transferIds;
+    }
+
 
     public void removeExperiment(String experimentId) {
         try {

http://git-wip-us.apache.org/repos/asf/airavata/blob/102ee17a/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 173bbcb..bf0a4e3 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
@@ -153,19 +153,19 @@ public class RegistryImpl implements Registry {
                 experimentRegistry.updateTaskStatus((TaskStatus) newObjectToUpdate, (String)
identifier);
                 break;
             case JOB_DETAIL:
-                experimentRegistry.updateJobDetails((JobDetails)newObjectToUpdate, (String)identifier);
+                experimentRegistry.updateJobDetails((JobDetails) newObjectToUpdate, (String)
identifier);
                 break;
             case JOB_STATUS:
-                experimentRegistry.updateJobStatus((JobStatus)newObjectToUpdate, (String)identifier);
+                experimentRegistry.updateJobStatus((JobStatus) newObjectToUpdate, (String)
identifier);
                 break;
             case APPLICATION_STATUS:
-                experimentRegistry.updateApplicationStatus((ApplicationStatus)newObjectToUpdate,
(String)identifier);
+                experimentRegistry.updateApplicationStatus((ApplicationStatus) newObjectToUpdate,
(String) identifier);
                 break;
             case DATA_TRANSFER_DETAIL:
-                experimentRegistry.updateDataTransferDetails((DataTransferDetails)newObjectToUpdate,
(String)identifier);
+                experimentRegistry.updateDataTransferDetails((DataTransferDetails) newObjectToUpdate,
(String) identifier);
                 break;
             case TRANSFER_STATUS:
-                experimentRegistry.updateTransferStatus((TransferStatus)newObjectToUpdate,
(String)identifier);
+                experimentRegistry.updateTransferStatus((TransferStatus) newObjectToUpdate,
(String) identifier);
                 break;
             case COMPUTATIONAL_RESOURCE_SCHEDULING:
                 experimentRegistry.updateScheduling((ComputationalResourceScheduling) newObjectToUpdate,
(String) identifier, dataType.toString());
@@ -288,6 +288,36 @@ public class RegistryImpl implements Registry {
                     result.add(experiment);
                 }
                 return result;
+            case WORKFLOW_NODE_DETAIL:
+                List<WorkflowNodeDetails> wfNodeDetails = experimentRegistry.getWFNodeDetails(fieldName,
value);
+                for (WorkflowNodeDetails wf : wfNodeDetails){
+                    result.add(wf);
+                }
+                return result;
+            case WORKFLOW_NODE_STATUS:
+                List<WorkflowNodeStatus> wfNodeStatusList = experimentRegistry.getWFNodeStatusList(fieldName,
value);
+                for (WorkflowNodeStatus wfs : wfNodeStatusList){
+                    result.add(wfs);
+                }
+                return result;
+            case TASK_DETAIL:
+                List<TaskDetails> taskDetails = experimentRegistry.getTaskDetails(fieldName,
value);
+                for (TaskDetails task : taskDetails){
+                    result.add(task);
+                }
+                return result;
+            case JOB_DETAIL:
+                List<JobDetails> jobDetails = experimentRegistry.getJobDetails(fieldName,
value);
+                for (JobDetails job : jobDetails){
+                    result.add(job);
+                }
+                return result;
+            case DATA_TRANSFER_DETAIL:
+                List<DataTransferDetails> dataTransferDetails = experimentRegistry.getDataTransferDetails(fieldName,
value);
+                for (DataTransferDetails transferDetails : dataTransferDetails){
+                    result.add(transferDetails);
+                }
+                return result;
             default:
                 logger.error("Unsupported data type...", new UnsupportedOperationException());
                 throw new UnsupportedOperationException();
@@ -336,6 +366,14 @@ public class RegistryImpl implements Registry {
                 return experimentRegistry.getExperimentIDs(fieldName, value);
             case EXPERIMENT_CONFIGURATION_DATA:
                 return experimentRegistry.getExperimentIDs(fieldName, value);
+            case WORKFLOW_NODE_DETAIL:
+                return experimentRegistry.getWorkflowNodeIds(fieldName, value);
+            case TASK_DETAIL:
+                return experimentRegistry.getTaskDetailIds(fieldName, value);
+            case JOB_DETAIL:
+                return experimentRegistry.getJobDetailIds(fieldName, value);
+            case DATA_TRANSFER_DETAIL:
+                return experimentRegistry.getTransferDetailIds(fieldName, value);
             default:
                 logger.error("Unsupported data type...", new UnsupportedOperationException());
                 throw new UnsupportedOperationException();

http://git-wip-us.apache.org/repos/asf/airavata/blob/102ee17a/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
index 10aa1e0..4c0cf86 100644
--- 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
@@ -55,5 +55,32 @@ public class Constants {
             public static final String ADVANCED_OUTPUT_HANDLING = "advanceOutputDataHandling";
             public static final String QOS_PARAMS = "qosParams";
         }
+
+        public final class WorkflowNodeConstants {
+            public static final String EXPERIMENT_ID = "experimentId";
+            public static final String NODE_NAME = "nodeName";
+            public static final String NODE_INPUTS = "nodeInputs";
+            public static final String NODE_OUTPUTS = "nodeOutputs";
+            public static final String WF_NODE_STATUS = "workflowNodeStatus";
+            public static final String TASK_LIST = "taskDetailsList";
+            public static final String NODE_ERRORS = "errors";
+        }
+
+        public final class TaskDetailConstants {
+            public static final String EXPERIMENT_ID = "experimentId";
+            public static final String NODE_ID = "nodeId";
+        }
+
+        public final class JobDetaisConstants {
+            public static final String TASK_ID = "taskId";
+        }
+
+        public final class DataTransferDetailConstants {
+            public static final String TASK_ID = "taskId";
+        }
+
+        public final class WorkflowNodeStatus {
+            public static final String EXPERIMENT_ID = "experimentId";
+        }
     }
 }


Mime
View raw message