public static Source createSourceFromDictionary()

in sdk/src/main/java/com/google/cloud/dataflow/sdk/runners/worker/ConcatReaderFactory.java [113:162]


  public static Source createSourceFromDictionary(Map<String, Object> dictionary) throws Exception {
    Source source = new Source();

    // Set spec
    CloudObject subSourceSpec =
        CloudObject.fromSpec(getObject(dictionary, PropertyNames.SOURCE_SPEC));
    source.setSpec(subSourceSpec);

    // Set encoding
    CloudObject subSourceEncoding =
        CloudObject.fromSpec(getObject(dictionary, PropertyNames.ENCODING, null));
    if (subSourceEncoding != null) {
      source.setCodec(subSourceEncoding);
    }

    // Set base specs
    List<Map<String, Object>> subSourceBaseSpecs =
        getListOfMaps(dictionary, PropertyNames.CONCAT_SOURCE_BASE_SPECS, null);
    if (subSourceBaseSpecs != null) {
      source.setBaseSpecs(subSourceBaseSpecs);
    }

    // Set metadata
    SourceMetadata metadata = new SourceMetadata();
    Boolean producesSortedKeys =
        getBoolean(dictionary, PropertyNames.SOURCE_PRODUCES_SORTED_KEYS, null);
    if (producesSortedKeys != null) {
      metadata.setProducesSortedKeys(producesSortedKeys);
    }
    Boolean infinite = getBoolean(dictionary, PropertyNames.SOURCE_IS_INFINITE, null);
    if (infinite != null) {
      metadata.setInfinite(infinite);
    }
    Long estimatedSizeBytes = getLong(dictionary, PropertyNames.SOURCE_ESTIMATED_SIZE_BYTES, null);
    if (estimatedSizeBytes != null) {
      metadata.setEstimatedSizeBytes(estimatedSizeBytes);
    }
    if (producesSortedKeys != null || estimatedSizeBytes != null || infinite != null) {
      source.setMetadata(metadata);
    }

    // Set doesNotNeedSplitting
    Boolean doesNotNeedSplitting =
        getBoolean(dictionary, PropertyNames.SOURCE_DOES_NOT_NEED_SPLITTING, null);
    if (doesNotNeedSplitting != null) {
      source.setDoesNotNeedSplitting(doesNotNeedSplitting);
    }

    return source;
  }