use of org.ow2.proactive.scheduler.common.exception.JobValidationException in project scheduling by ow2-proactive.
the class DefaultModelJobValidatorServiceProvider method validateJob.
@Override
public TaskFlowJob validateJob(TaskFlowJob job) throws JobValidationException {
ModelValidatorContext context = new ModelValidatorContext(job);
for (JobVariable jobVariable : job.getVariables().values()) {
checkVariableFormat(null, jobVariable, context);
context.updateJobWithContext(job);
}
for (Task task : job.getTasks()) {
context = new ModelValidatorContext(task);
for (TaskVariable taskVariable : task.getVariables().values()) {
checkVariableFormat(task, taskVariable, context);
context.updateTaskWithContext(task);
}
}
return job;
}
use of org.ow2.proactive.scheduler.common.exception.JobValidationException in project scheduling by ow2-proactive.
the class StaxJobValidatorServiceProvider method validateJob.
@Override
public File validateJob(File jobFile) throws JobValidationException {
String findSchemaByNamespaceUsed;
try {
findSchemaByNamespaceUsed = findSchemaByNamespaceUsed(jobFile);
InputStream schemaStream = this.getClass().getResourceAsStream(findSchemaByNamespaceUsed);
ValidationUtil.validate(jobFile, schemaStream);
} catch (Exception e) {
// wrap all occurring exceptions as a schema exception
throw new JobValidationException(true, e);
}
return jobFile;
}
use of org.ow2.proactive.scheduler.common.exception.JobValidationException 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;
}
use of org.ow2.proactive.scheduler.common.exception.JobValidationException 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;
}
Aggregations