Package org.apache.airavata.model.error

Examples of org.apache.airavata.model.error.ValidatorResult


    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);
            }
        }
View Full Code Here


import org.apache.airavata.orchestrator.core.validator.JobMetadataValidator;

public class SecondValidator implements JobMetadataValidator {
    public ValidatorResult validate(Experiment experiment, WorkflowNodeDetails workflowNodeDetail, TaskDetails taskID) {
        if(taskID.getTaskID() == null) {
            ValidatorResult validatorResult = new ValidatorResult(false);
            validatorResult.setErrorDetails("No taskID is set, so Validation failed");
            return validatorResult;
        }
        return new ValidatorResult(true);
    }
View Full Code Here

    private final static Logger logger = LoggerFactory.getLogger(TestValidator.class);

    public ValidatorResult validate(Experiment experiment, WorkflowNodeDetails workflowNodeDetail, TaskDetails taskID) {
        if (experiment.getProjectID() == null) {
            logger.error("Project ID is not set");
            ValidatorResult validatorResult = new ValidatorResult(false);
            validatorResult.setErrorDetails("Project ID is not set");
            return validatorResult;
        } else if (experiment.getExperimentID() == null) {
            logger.error("This experiment is wrong, no experimentID set");
             ValidatorResult validatorResult = new ValidatorResult(false);
            validatorResult.setErrorDetails("This experiment is wrong, no experimentID set");
            return validatorResult;
        }
        return new ValidatorResult(true);
    }
View Full Code Here

    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);
            }
        }
View Full Code Here

    public ValidatorResult validate(Experiment experiment, WorkflowNodeDetails workflowNodeDetail, TaskDetails taskID) {
        boolean result = false;
        if (experiment.getUserConfigurationData().isAiravataAutoSchedule()) {
            logger.error("We dont' support auto scheduling at this point, We will simply use user data as it is");
        }
        return new ValidatorResult(true);
    }
View Full Code Here

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().getExperimentState().equals(ExperimentState.CREATED)) {
            error += experiment.getExperimentStatus().getExperimentState().toString();
            log.error(error);
            validatorResult.setErrorDetails(error);
            validatorResult.setResult(false);;
            return validatorResult;
        }
        validatorResult.setResult(true);
        return validatorResult;
    }
View Full Code Here

TOP

Related Classes of org.apache.airavata.model.error.ValidatorResult

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.