Search in sources :

Example 6 with IPipelineEngine

use of org.apache.hop.pipeline.engine.IPipelineEngine in project hop by apache.

the class PipelineRunConfigurationMetadataObjectFactory method createObject.

@Override
public Object createObject(String id, Object parentObject) throws HopException {
    PluginRegistry registry = PluginRegistry.getInstance();
    IPlugin plugin = registry.findPluginWithId(PipelineEnginePluginType.class, id);
    if (plugin == null) {
        throw new HopException("Unable to find the plugin in the context of a pipeline engine plugin for id: " + id);
    }
    try {
        // We don't return the engine but the corresponding engine configuration
        // 
        IPipelineEngine engine = registry.loadClass(plugin, IPipelineEngine.class);
        IPipelineEngineRunConfiguration engineRunConfiguration = engine.createDefaultPipelineEngineRunConfiguration();
        engineRunConfiguration.setEnginePluginId(plugin.getIds()[0]);
        engineRunConfiguration.setEnginePluginName(plugin.getName());
        if (parentObject != null && (parentObject instanceof IVariables)) {
            engineRunConfiguration.initializeFrom((IVariables) parentObject);
        }
        return engineRunConfiguration;
    } catch (HopPluginException e) {
        throw new HopException("Unable to load the pipeline engine plugin class with plugin id: " + id, e);
    }
}
Also used : HopException(org.apache.hop.core.exception.HopException) IVariables(org.apache.hop.core.variables.IVariables) PluginRegistry(org.apache.hop.core.plugins.PluginRegistry) HopPluginException(org.apache.hop.core.exception.HopPluginException) IPipelineEngine(org.apache.hop.pipeline.engine.IPipelineEngine) IPlugin(org.apache.hop.core.plugins.IPlugin)

Aggregations

IPipelineEngine (org.apache.hop.pipeline.engine.IPipelineEngine)6 HopException (org.apache.hop.core.exception.HopException)5 IVariables (org.apache.hop.core.variables.IVariables)4 PipelineMeta (org.apache.hop.pipeline.PipelineMeta)4 List (java.util.List)2 Const (org.apache.hop.core.Const)2 Result (org.apache.hop.core.Result)2 ILogChannel (org.apache.hop.core.logging.ILogChannel)2 IHopMetadataProvider (org.apache.hop.metadata.api.IHopMetadataProvider)2 Pipeline (org.apache.hop.pipeline.Pipeline)2 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 IOException (java.io.IOException)1 PrintWriter (java.io.PrintWriter)1 OperatingSystemMXBean (java.lang.management.OperatingSystemMXBean)1 RuntimeMXBean (java.lang.management.RuntimeMXBean)1 ThreadMXBean (java.lang.management.ThreadMXBean)1 SimpleDateFormat (java.text.SimpleDateFormat)1 java.util (java.util)1 ArrayList (java.util.ArrayList)1 Collections (java.util.Collections)1