public ValidationResults validateExperiment(Experiment experiment, WorkflowNodeDetails workflowNodeDetail, TaskDetails taskID) throws OrchestratorException,LaunchValidationException {
org.apache.airavata.model.error.ValidationResults validationResults = new org.apache.airavata.model.error.ValidationResults();
validationResults.setValidationState(true); // initially making it to success, if atleast one failed them simply mark it failed.
if (this.orchestratorConfiguration.isEnableValidation()) {
List<String> validatorClzzez = this.orchestratorContext.getOrchestratorConfiguration().getValidatorClasses();
ValidatorResult vResult = null;
for (String validator : validatorClzzez) {
try {
Class<? extends JobMetadataValidator> vClass = Class.forName(validator.trim()).asSubclass(JobMetadataValidator.class);
JobMetadataValidator jobMetadataValidator = vClass.newInstance();
vResult = jobMetadataValidator.validate(experiment, workflowNodeDetail, taskID);
if (vResult.isResult()) {
logger.info("Validation of " + validator + " is SUCCESSFUL");
} else {
logger.error("Validation of " + validator + " is FAILED:[error]" + vResult.getErrorDetails());
//todo we need to store this message to registry
validationResults.setValidationState(false);
// we do not return immediately after the first failure
}
} catch (ClassNotFoundException e) {
logger.error("Error loading the validation class: ", validator, e);
vResult = new ValidatorResult();
vResult.setResult(false);
vResult.setErrorDetails("Error loading the validation class: " + e.getMessage());
validationResults.setValidationState(false);
} catch (InstantiationException e) {
logger.error("Error loading the validation class: ", validator, e);
vResult = new ValidatorResult();
vResult.setResult(false);
vResult.setErrorDetails("Error loading the validation class: " + e.getMessage());
validationResults.setValidationState(false);
} catch (IllegalAccessException e) {
logger.error("Error loading the validation class: ", validator, e);
vResult = new ValidatorResult();
vResult.setResult(false);
vResult.setErrorDetails("Error loading the validation class: " + e.getMessage());
validationResults.setValidationState(false);
}
validationResults.addToValidationResultList(vResult);
}
}