use of org.pentaho.metaverse.api.analyzer.kettle.step.IStepExternalResourceConsumer in project pentaho-metaverse by pentaho.
the class StepExternalResourceConsumerListener method callExtensionPoint.
/**
* This method is called by the Kettle code when a step is about to start
*
* @param log the logging channel to log debugging information to
* @param object The subject object that is passed to the plugin code
* @throws org.pentaho.di.core.exception.KettleException In case the plugin decides that an error has occurred
* and the parent process should stop.
*/
@Override
public void callExtensionPoint(LogChannelInterface log, Object object) throws KettleException {
if (stepConsumerProvider == null) {
stepConsumerProvider = (IStepExternalResourceConsumerProvider) MetaverseBeanUtil.getInstance().get("IStepExternalResourceConsumerProvider");
}
StepMetaDataCombi stepCombi = (StepMetaDataCombi) object;
if (stepCombi != null) {
StepMetaInterface meta = stepCombi.meta;
StepInterface step = stepCombi.step;
if (meta != null) {
Class<?> metaClass = meta.getClass();
if (BaseStepMeta.class.isAssignableFrom(metaClass)) {
if (stepConsumerProvider != null) {
// Put the class into a collection and get the consumers that can process this class
Set<Class<?>> metaClassSet = new HashSet<Class<?>>(1);
metaClassSet.add(metaClass);
List<IStepExternalResourceConsumer> stepConsumers = stepConsumerProvider.getExternalResourceConsumers(metaClassSet);
if (stepConsumers != null) {
for (IStepExternalResourceConsumer stepConsumer : stepConsumers) {
// We might know enough at this point, so call the consumer
Collection<IExternalResourceInfo> resources = stepConsumer.getResourcesFromMeta(meta);
addExternalResources(resources, step);
// Add a RowListener if the step is data-driven
if (stepConsumer.isDataDriven(meta)) {
stepCombi.step.addRowListener(new StepExternalConsumerRowListener(stepConsumer, step));
}
}
}
}
}
}
}
}
Aggregations