airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lah...@apache.org
Subject [2/2] git commit: adding new validator
Date Tue, 20 May 2014 19:46:04 GMT
adding new validator


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

Branch: refs/heads/master
Commit: 2710f6e3aab71af1803d79ad8b77d4432a356d05
Parents: 6bb880a
Author: lahiru <lahiru@apache.org>
Authored: Tue May 20 15:15:30 2014 -0400
Committer: lahiru <lahiru@apache.org>
Committed: Tue May 20 15:15:30 2014 -0400

----------------------------------------------------------------------
 .../impl/ExperimentStatusValidator.java         | 45 ++++++++++++++++++++
 1 file changed, 45 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/2710f6e3/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/validator/impl/ExperimentStatusValidator.java
----------------------------------------------------------------------
diff --git a/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/validator/impl/ExperimentStatusValidator.java
b/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/validator/impl/ExperimentStatusValidator.java
new file mode 100644
index 0000000..357f2e2
--- /dev/null
+++ b/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/validator/impl/ExperimentStatusValidator.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.orchestrator.core.validator.impl;
+
+import org.apache.airavata.model.error.ValidatorResult;
+import org.apache.airavata.model.workspace.experiment.*;
+import org.apache.airavata.orchestrator.core.validator.JobMetadataValidator;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class ExperimentStatusValidator implements JobMetadataValidator {
+    private static Logger log = LoggerFactory.getLogger(ExperimentStatusValidator.class);
+
+    public ValidatorResult validate(Experiment experiment, WorkflowNodeDetails workflowNodeDetail,
TaskDetails taskID) {
+        String error = "During the validation step experiment status should be CREATED, But
this experiment status is : ";
+        ValidatorResult validatorResult = new ValidatorResult();
+        if (experiment.getExperimentStatus().equals(ExperimentState.CREATED)) {
+            error += experiment.getExperimentStatus().getExperimentState().toString();
+            log.error(error);
+            validatorResult.setErrorDetails(error);
+            validatorResult.setResult(false);;
+            return validatorResult;
+        }
+        validatorResult.setResult(true);
+        return validatorResult;
+    }
+}


Mime
View raw message