Search in sources :

Example 1 with StepAnalyzer

use of org.pentaho.metaverse.api.analyzer.kettle.step.StepAnalyzer in project pentaho-metaverse by pentaho.

the class AbstractStepMetaJsonSerializer method getFieldLineageMetadataProvider.

protected IFieldLineageMetadataProvider getFieldLineageMetadataProvider(T meta) {
    IStepAnalyzerProvider provider = getStepAnalyzerProvider();
    if (provider == null) {
        // try to get it from PentahoSystem
        provider = PentahoSystem.get(IStepAnalyzerProvider.class);
    }
    if (provider != null) {
        Set<Class<?>> types = new HashSet<Class<?>>();
        types.add(meta.getClass());
        List<IStepAnalyzer> analyzers = provider.getAnalyzers(types);
        if (analyzers != null) {
            for (IStepAnalyzer analyzer : analyzers) {
                // try to set up the analyzer with parent step & trans meta
                if (analyzer instanceof StepAnalyzer) {
                    StepAnalyzer bsa = (StepAnalyzer) analyzer;
                    try {
                        bsa.validateState(null, meta);
                        bsa.loadInputAndOutputStreamFields(meta);
                    } catch (MetaverseAnalyzerException e) {
                    // eat it
                    }
                }
                if (analyzer instanceof IFieldLineageMetadataProvider) {
                    return (IFieldLineageMetadataProvider) analyzer;
                }
            }
        }
    }
    return new GenericStepMetaAnalyzer();
}
Also used : IStepAnalyzer(org.pentaho.metaverse.api.analyzer.kettle.step.IStepAnalyzer) IFieldLineageMetadataProvider(org.pentaho.metaverse.api.analyzer.kettle.step.IFieldLineageMetadataProvider) MetaverseAnalyzerException(org.pentaho.metaverse.api.MetaverseAnalyzerException) StepAnalyzer(org.pentaho.metaverse.api.analyzer.kettle.step.StepAnalyzer) IStepAnalyzer(org.pentaho.metaverse.api.analyzer.kettle.step.IStepAnalyzer) IStepAnalyzerProvider(org.pentaho.metaverse.api.analyzer.kettle.step.IStepAnalyzerProvider) HashSet(java.util.HashSet) GenericStepMetaAnalyzer(org.pentaho.metaverse.analyzer.kettle.step.GenericStepMetaAnalyzer)

Aggregations

HashSet (java.util.HashSet)1 GenericStepMetaAnalyzer (org.pentaho.metaverse.analyzer.kettle.step.GenericStepMetaAnalyzer)1 MetaverseAnalyzerException (org.pentaho.metaverse.api.MetaverseAnalyzerException)1 IFieldLineageMetadataProvider (org.pentaho.metaverse.api.analyzer.kettle.step.IFieldLineageMetadataProvider)1 IStepAnalyzer (org.pentaho.metaverse.api.analyzer.kettle.step.IStepAnalyzer)1 IStepAnalyzerProvider (org.pentaho.metaverse.api.analyzer.kettle.step.IStepAnalyzerProvider)1 StepAnalyzer (org.pentaho.metaverse.api.analyzer.kettle.step.StepAnalyzer)1