Search in sources :

Example 1 with IStepExternalResourceConsumerProvider

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

the class AbstractStepMetaJsonSerializer method writeExternalResources.

protected void writeExternalResources(T meta, JsonGenerator json, SerializerProvider serializerProvider) throws IOException, JsonGenerationException {
    Set<Class<?>> metaClassSet = new HashSet<Class<?>>(1);
    metaClassSet.add(meta.getClass());
    IStepExternalResourceConsumerProvider stepExternalResourceConsumerProvider = getStepExternalResourceConsumerProvider();
    List<IStepExternalResourceConsumer> resourceConsumers = null;
    if (stepExternalResourceConsumerProvider != null) {
        resourceConsumers = stepExternalResourceConsumerProvider.getExternalResourceConsumers(metaClassSet);
    }
    json.writeArrayFieldStart(JSON_PROPERTY_EXTERNAL_RESOURCES);
    if (resourceConsumers != null) {
        for (IStepExternalResourceConsumer resourceConsumer : resourceConsumers) {
            Collection<IExternalResourceInfo> infos = resourceConsumer.getResourcesFromMeta(meta);
            for (IExternalResourceInfo info : infos) {
                json.writeObject(info);
            }
        }
    }
    json.writeEndArray();
}
Also used : IExternalResourceInfo(org.pentaho.metaverse.api.model.IExternalResourceInfo) IStepExternalResourceConsumerProvider(org.pentaho.metaverse.api.analyzer.kettle.step.IStepExternalResourceConsumerProvider) IStepExternalResourceConsumer(org.pentaho.metaverse.api.analyzer.kettle.step.IStepExternalResourceConsumer) HashSet(java.util.HashSet)

Aggregations

HashSet (java.util.HashSet)1 IStepExternalResourceConsumer (org.pentaho.metaverse.api.analyzer.kettle.step.IStepExternalResourceConsumer)1 IStepExternalResourceConsumerProvider (org.pentaho.metaverse.api.analyzer.kettle.step.IStepExternalResourceConsumerProvider)1 IExternalResourceInfo (org.pentaho.metaverse.api.model.IExternalResourceInfo)1