Search in sources :

Example 1 with ExternalTransformRegistrar

use of org.apache.beam.sdk.expansion.ExternalTransformRegistrar in project beam by apache.

the class ExternalSchemaIOTransformRegistrar method knownBuilderInstances.

@Override
public Map<String, ExternalTransformBuilder<?, ?, ?>> knownBuilderInstances() {
    ImmutableMap.Builder builder = ImmutableMap.<String, ExternalTransformRegistrar>builder();
    try {
        for (SchemaIOProvider schemaIOProvider : ServiceLoader.load(SchemaIOProvider.class)) {
            builder.put("beam:transform:org.apache.beam:schemaio_" + schemaIOProvider.identifier() + "_read:v1", new ReaderBuilder(schemaIOProvider));
            builder.put("beam:transform:org.apache.beam:schemaio_" + schemaIOProvider.identifier() + "_write:v1", new WriterBuilder(schemaIOProvider));
        }
    } catch (Exception e) {
        throw new RuntimeException(e.getMessage());
    }
    return builder.build();
}
Also used : ExternalTransformRegistrar(org.apache.beam.sdk.expansion.ExternalTransformRegistrar) SchemaIOProvider(org.apache.beam.sdk.schemas.io.SchemaIOProvider) ImmutableMap(org.apache.beam.vendor.guava.v26_0_jre.com.google.common.collect.ImmutableMap) IOException(java.io.IOException) InvalidProtocolBufferException(org.apache.beam.vendor.grpc.v1p43p2.com.google.protobuf.InvalidProtocolBufferException)

Aggregations

IOException (java.io.IOException)1 ExternalTransformRegistrar (org.apache.beam.sdk.expansion.ExternalTransformRegistrar)1 SchemaIOProvider (org.apache.beam.sdk.schemas.io.SchemaIOProvider)1 InvalidProtocolBufferException (org.apache.beam.vendor.grpc.v1p43p2.com.google.protobuf.InvalidProtocolBufferException)1 ImmutableMap (org.apache.beam.vendor.guava.v26_0_jre.com.google.common.collect.ImmutableMap)1