use of org.pentaho.di.trans.step.StepMetaInterface in project pdi-dataservice-server-plugin by pentaho.
the class AnnotationsQueryServiceTest method createPseudoAnnotate.
private DummyTransMeta createPseudoAnnotate(final ModelAnnotationGroup mag) {
final String magicKey = "KEY_MODEL_ANNOTATIONS";
DummyTransMeta annot1Meta = new DummyTransMeta() {
@Override
public StepInterface getStep(StepMeta stepMeta, StepDataInterface stepDataInterface, int cnr, TransMeta tr, final Trans trans) {
return new DummyTrans(stepMeta, stepDataInterface, cnr, tr, trans) {
@Override
public boolean init(StepMetaInterface smi, StepDataInterface sdi) {
ModelAnnotationGroup existing = (ModelAnnotationGroup) trans.getExtensionDataMap().get(magicKey);
if (existing == null) {
trans.getExtensionDataMap().put(magicKey, mag);
} else {
existing.addAll(mag);
}
return true;
}
};
}
};
return annot1Meta;
}
use of org.pentaho.di.trans.step.StepMetaInterface in project pentaho-metaverse by pentaho.
the class TransMetaJsonDeserializer method deserializeSteps.
protected void deserializeSteps(TransMeta transMeta, JsonNode node, ObjectMapper mapper) throws IOException {
ArrayNode stepsArrayNode = (ArrayNode) node.get(TransMetaJsonSerializer.JSON_PROPERTY_STEPS);
String stepName = null;
for (int i = 0; i < stepsArrayNode.size(); i++) {
JsonNode stepNode = stepsArrayNode.get(i);
String className = stepNode.get(IInfo.JSON_PROPERTY_CLASS).asText();
stepName = stepNode.get(IInfo.JSON_PROPERTY_NAME).asText();
ObjectId stepId = new StringObjectId(stepName);
// add the step attributes to the repo so they can be found when they are looked up by the readRep impl
JsonNode attributes = stepNode.get(AbstractStepMetaJsonSerializer.JSON_PROPERTY_ATTRIBUTES);
writeJsonAttributes(attributes, mapper, stepId);
JsonNode fields = stepNode.get(AbstractStepMetaJsonSerializer.JSON_PROPERTY_FIELDS);
writeJsonFields(fields, mapper, stepId);
try {
Class clazz = this.getClass().getClassLoader().loadClass(className);
BaseStepMeta meta = (BaseStepMeta) clazz.newInstance();
meta.readRep(getRepository(), null, stepId, transMeta.getDatabases());
StepMetaInterface smi = (StepMetaInterface) meta;
StepMeta step = new StepMeta(stepName, smi);
transMeta.addStep(step);
} catch (Exception e) {
LOGGER.warn(Messages.getString("WARNING.Deserialization.Trans.Steps", stepName), e);
}
}
}
use of org.pentaho.di.trans.step.StepMetaInterface in project pentaho-metaverse by pentaho.
the class MetaverseValidationIT method getBaseStepMetaFromStepMeta.
protected BaseStepMeta getBaseStepMetaFromStepMeta(StepMeta stepMeta) {
// Attempt to discover a BaseStepMeta from the given StepMeta
BaseStepMeta baseStepMeta = new BaseStepMeta();
baseStepMeta.setParentStepMeta(stepMeta);
if (stepMeta != null) {
StepMetaInterface smi = stepMeta.getStepMetaInterface();
if (smi instanceof BaseStepMeta) {
baseStepMeta = (BaseStepMeta) smi;
}
}
return baseStepMeta;
}
use of org.pentaho.di.trans.step.StepMetaInterface in project pentaho-metaverse by pentaho.
the class TransformationAnalyzer method getBaseStepMetaFromStepMeta.
protected BaseStepMeta getBaseStepMetaFromStepMeta(StepMeta stepMeta) {
// Attempt to discover a BaseStepMeta from the given StepMeta
BaseStepMeta baseStepMeta = new BaseStepMeta();
baseStepMeta.setParentStepMeta(stepMeta);
if (stepMeta != null) {
StepMetaInterface smi = stepMeta.getStepMetaInterface();
if (smi instanceof BaseStepMeta) {
baseStepMeta = (BaseStepMeta) smi;
}
}
return baseStepMeta;
}
use of org.pentaho.di.trans.step.StepMetaInterface 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