Search in sources :

Example 1 with JobValidatorService

use of org.ow2.proactive.scheduler.common.job.factories.spi.JobValidatorService in project scheduling by ow2-proactive.

the class StaxJobFactory method validate.

/*
     * Validate the given job descriptor
     */
private File validate(File file) throws VerifierConfigurationException, JobCreationException {
    Map<String, JobValidatorService> factories;
    try {
        factories = JobValidatorRegistry.getInstance().getRegisteredFactories();
    } catch (Exception e) {
        logger.error(MSG_UNABLE_TO_INSTANCIATE_JOB_VALIDATION_FACTORIES, e);
        throw new VerifierConfigurationException(MSG_UNABLE_TO_INSTANCIATE_JOB_VALIDATION_FACTORIES, e);
    }
    File updatedFile = file;
    try {
        for (JobValidatorService factory : factories.values()) {
            updatedFile = factory.validateJob(updatedFile);
        }
    } catch (JobValidationException e) {
        throw e;
    } catch (Exception e) {
        throw new JobValidationException(true, e);
    }
    return updatedFile;
}
Also used : JobValidatorService(org.ow2.proactive.scheduler.common.job.factories.spi.JobValidatorService) VerifierConfigurationException(org.iso_relax.verifier.VerifierConfigurationException) File(java.io.File) JobValidationException(org.ow2.proactive.scheduler.common.exception.JobValidationException) XMLStreamException(javax.xml.stream.XMLStreamException) JobValidationException(org.ow2.proactive.scheduler.common.exception.JobValidationException) FileNotFoundException(java.io.FileNotFoundException) JobCreationException(org.ow2.proactive.scheduler.common.exception.JobCreationException) VerifierConfigurationException(org.iso_relax.verifier.VerifierConfigurationException)

Example 2 with JobValidatorService

use of org.ow2.proactive.scheduler.common.job.factories.spi.JobValidatorService in project scheduling by ow2-proactive.

the class StaxJobFactory method validate.

/*
     * Validate the given job descriptor
     */
private TaskFlowJob validate(TaskFlowJob job) throws VerifierConfigurationException, JobCreationException {
    Map<String, JobValidatorService> factories;
    try {
        factories = JobValidatorRegistry.getInstance().getRegisteredFactories();
    } catch (Exception e) {
        throw new VerifierConfigurationException(MSG_UNABLE_TO_INSTANCIATE_JOB_VALIDATION_FACTORIES, e);
    }
    TaskFlowJob updatedJob = job;
    try {
        for (JobValidatorService factory : factories.values()) {
            updatedJob = factory.validateJob(updatedJob);
        }
    } catch (JobValidationException e) {
        throw e;
    } catch (Exception e) {
        throw new JobValidationException(e);
    }
    return updatedJob;
}
Also used : TaskFlowJob(org.ow2.proactive.scheduler.common.job.TaskFlowJob) JobValidatorService(org.ow2.proactive.scheduler.common.job.factories.spi.JobValidatorService) VerifierConfigurationException(org.iso_relax.verifier.VerifierConfigurationException) JobValidationException(org.ow2.proactive.scheduler.common.exception.JobValidationException) XMLStreamException(javax.xml.stream.XMLStreamException) JobValidationException(org.ow2.proactive.scheduler.common.exception.JobValidationException) FileNotFoundException(java.io.FileNotFoundException) JobCreationException(org.ow2.proactive.scheduler.common.exception.JobCreationException) VerifierConfigurationException(org.iso_relax.verifier.VerifierConfigurationException)

Example 3 with JobValidatorService

use of org.ow2.proactive.scheduler.common.job.factories.spi.JobValidatorService in project scheduling by ow2-proactive.

the class StaxJobFactory method validate.

/*
     * Validate the given job descriptor
     */
private TaskFlowJob validate(TaskFlowJob job, Scheduler scheduler, SchedulerSpaceInterface space, String sessionId) throws JobCreationException {
    Map<String, JobValidatorService> factories;
    try {
        factories = JobValidatorRegistry.getInstance().getRegisteredFactories();
    } catch (Exception e) {
        throw new JobCreationException(MSG_UNABLE_TO_INSTANCIATE_JOB_VALIDATION_FACTORIES, e);
    }
    TaskFlowJob updatedJob = job;
    try {
        for (JobValidatorService factory : factories.values()) {
            updatedJob = factory.validateJob(updatedJob, scheduler, space, sessionId);
        }
    } catch (JobValidationException e) {
        fillUpdatedVariables(e, job);
        throw e;
    } catch (Exception e) {
        JobValidationException validationException = new JobValidationException(e);
        fillUpdatedVariables(validationException, job);
        throw validationException;
    }
    return updatedJob;
}
Also used : TaskFlowJob(org.ow2.proactive.scheduler.common.job.TaskFlowJob) JobCreationException(org.ow2.proactive.scheduler.common.exception.JobCreationException) JobValidatorService(org.ow2.proactive.scheduler.common.job.factories.spi.JobValidatorService) JobValidationException(org.ow2.proactive.scheduler.common.exception.JobValidationException) XMLStreamException(javax.xml.stream.XMLStreamException) JobValidationException(org.ow2.proactive.scheduler.common.exception.JobValidationException) FileNotFoundException(java.io.FileNotFoundException) JobCreationException(org.ow2.proactive.scheduler.common.exception.JobCreationException) IOException(java.io.IOException)

Aggregations

FileNotFoundException (java.io.FileNotFoundException)3 XMLStreamException (javax.xml.stream.XMLStreamException)3 JobCreationException (org.ow2.proactive.scheduler.common.exception.JobCreationException)3 JobValidationException (org.ow2.proactive.scheduler.common.exception.JobValidationException)3 JobValidatorService (org.ow2.proactive.scheduler.common.job.factories.spi.JobValidatorService)3 VerifierConfigurationException (org.iso_relax.verifier.VerifierConfigurationException)2 TaskFlowJob (org.ow2.proactive.scheduler.common.job.TaskFlowJob)2 File (java.io.File)1 IOException (java.io.IOException)1