Search in sources :

Example 1 with TransformationSettings

use of eu.esdihumboldt.hale.common.headless.transform.TransformationSettings in project hale by halestudio.

the class ExecTransformation method transform.

private int transform() throws InterruptedException, ExecutionException {
    status("Running hale transformation...");
    TransformationSettings settings = new DefaultTransformationSettings();
    // TODO make settings configurable?
    // run transformation
    ListenableFuture<Boolean> res = Transformation.transform(sources, target, env, reportHandler, id, validators, context.getFilters(), settings);
    boolean orgSuccess = res.get();
    // them to complete and file their report (otherwise error may get lost)
    try {
        Thread.sleep(3000);
    } catch (Throwable e) {
    // ignore
    }
    boolean success;
    try {
        success = evaluateSuccess(orgSuccess);
    } catch (Throwable e) {
        error("Success evaluation resulted in an error:\n" + e.getMessage());
        if (context.isLogException()) {
            e.printStackTrace();
        }
        return 2;
    }
    if (success) {
        info("Transformation completed. Please check the reports for more details.");
    } else {
        if (orgSuccess) {
            error("Transformation failed according to the success evaluation script.");
            return 2;
        } else {
            error("Transformation failed, please check the reports for details.");
            return 1;
        }
    }
    // exit OK
    return 0;
}
Also used : DefaultTransformationSettings(eu.esdihumboldt.hale.common.headless.transform.DefaultTransformationSettings) TransformationSettings(eu.esdihumboldt.hale.common.headless.transform.TransformationSettings) DefaultTransformationSettings(eu.esdihumboldt.hale.common.headless.transform.DefaultTransformationSettings)

Aggregations

DefaultTransformationSettings (eu.esdihumboldt.hale.common.headless.transform.DefaultTransformationSettings)1 TransformationSettings (eu.esdihumboldt.hale.common.headless.transform.TransformationSettings)1