use of eu.esdihumboldt.util.groovy.sandbox.DefaultGroovyService in project hale by halestudio.
the class GroovyFilter method getGroovyService.
/**
* @return the Groovy service to use for building and evaluating the filter
* script.
*/
protected GroovyService getGroovyService() {
synchronized (this) {
if (groovyService != null) {
return groovyService;
}
GroovyService result = HalePlatform.getService(GroovyService.class);
// fall back to restrictive Groovy service
if (result == null) {
DefaultGroovyService def = new DefaultGroovyService();
def.setRestrictionActive(true);
result = def;
log.warn("No GroovyService found, using restricted execution for filter");
}
groovyService = result;
return result;
}
}
use of eu.esdihumboldt.util.groovy.sandbox.DefaultGroovyService in project hale by halestudio.
the class ExecTransformation method transform.
private void transform() throws InterruptedException, ExecutionException {
status("Running hale transformation...");
// configure transformation environment
// override/set Groovy service
GroovyService gs = new DefaultGroovyService();
gs.setRestrictionActive(context.isRestrictGroovy());
env.addService(GroovyService.class, gs);
// run transformation
ListenableFuture<Boolean> res = Transformation.transform(sources, target, env, reportHandler, id, validators, context.getFilters());
if (res.get()) {
info("Transformation completed. Please check the reports for more details.");
} else {
// complete and file their report (otherwise error may get lost)
try {
Thread.sleep(3000);
} catch (Throwable e) {
// ignore
}
throw fail("Transformation failed, please check the reports for details.");
}
}
Aggregations