Search in sources :

Example 1 with EngineFactory

use of eu.esdihumboldt.hale.common.align.extension.engine.EngineFactory in project hale by halestudio.

the class EngineManager method get.

/**
 * Get the transformation engine with the given ID
 *
 * @param engineId the transformation engine ID
 * @param log the transformation log to report any errors to
 * @return the transformation engine or <code>null</code> if none with the
 *         given ID was found or the creation failed
 */
public synchronized TransformationEngine get(String engineId, TransformationLog log) {
    TransformationEngine engine = engines.get(engineId);
    if (engine == null) {
        EngineExtension ee = EngineExtension.getInstance();
        EngineFactory engineFactory = ee.getFactory(engineId);
        if (engineFactory == null) {
            log.error(log.createMessage(MessageFormat.format("Transformation engine with ID {0} not found.", engineId), null));
        } else {
            try {
                TransformationEngine tmp = engineFactory.createExtensionObject();
                tmp.setup();
                engine = tmp;
            } catch (Exception e) {
                log.error(log.createMessage("Could not create transformation engine", e));
            }
        }
    }
    return engine;
}
Also used : EngineFactory(eu.esdihumboldt.hale.common.align.extension.engine.EngineFactory) TransformationEngine(eu.esdihumboldt.hale.common.align.transformation.engine.TransformationEngine) EngineExtension(eu.esdihumboldt.hale.common.align.extension.engine.EngineExtension)

Aggregations

EngineExtension (eu.esdihumboldt.hale.common.align.extension.engine.EngineExtension)1 EngineFactory (eu.esdihumboldt.hale.common.align.extension.engine.EngineFactory)1 TransformationEngine (eu.esdihumboldt.hale.common.align.transformation.engine.TransformationEngine)1