.withNamespace(optionSpec.getDefiningInterface())); .withNamespace(UnknownPipelineOptions.class)); continue; builder.add( DisplayData.item(jsonOption.getKey(), resolved.getType(), resolved.getValue()) .withNamespace(spec.getDefiningInterface()));
private static <T> ItemSpec<T> create(String key, Type type, @Nullable T value) { return ItemSpec.<T>builder().setKey(key).setType(type).setRawValue(value).build(); }
@Override public void populateDisplayData(DisplayData.Builder builder) { super.populateDisplayData(builder); builder.addIfNotNull( DisplayData.item("table", getJsonTableRef()).withLabel("Table Reference")); if (getJsonSchema() != null) { builder.addIfNotNull(DisplayData.item("schema", getJsonSchema()).withLabel("Table Schema")); } else { builder.add(DisplayData.item("schema", "Custom Schema Function").withLabel("Table Schema")); } if (getTableFunction() != null) { builder.add( DisplayData.item("tableFn", getTableFunction().getClass()) .withLabel("Table Reference Function")); } builder .add( DisplayData.item("createDisposition", getCreateDisposition().toString()) .withLabel("Table CreateDisposition")) .add( DisplayData.item("writeDisposition", getWriteDisposition().toString()) .withLabel("Table WriteDisposition")) .addIfNotDefault( DisplayData.item("validation", getValidate()).withLabel("Validation Enabled"), true) .addIfNotNull( DisplayData.item("tableDescription", getTableDescription()) .withLabel("Table Description")); }
.add( DisplayData.item("windowFn", getWindowFn().getClass()) .withLabel("Windowing Function")) .include("windowFn", getWindowFn()); DisplayData.item("allowedLateness", getAllowedLateness()).withLabel("Allowed Lateness"), Duration.millis(BoundedWindow.TIMESTAMP_MAX_VALUE.getMillis())); builder.add(DisplayData.item("trigger", getTrigger().toString()).withLabel("Trigger")); builder.add( DisplayData.item("accumulationMode", getAccumulationMode().toString()) .withLabel("Accumulation Mode")); builder.add( DisplayData.item("closingBehavior", getClosingBehavior().toString()) .withLabel("Window Closing Behavior")); builder.add( DisplayData.item("timestampCombiner", getTimestampCombiner().toString()) .withLabel("Timestamp Combiner"));
@SuppressWarnings("unchecked") @Override public void populateDisplayData(DisplayData.Builder builder) { super.populateDisplayData(builder); List<String> topics = getTopics(); List<TopicPartition> topicPartitions = getTopicPartitions(); if (topics.size() > 0) { builder.add(DisplayData.item("topics", Joiner.on(",").join(topics)).withLabel("Topic/s")); } else if (topicPartitions.size() > 0) { builder.add( DisplayData.item("topicPartitions", Joiner.on(",").join(topicPartitions)) .withLabel("Topic Partition/s")); } Set<String> ignoredConsumerPropertiesKeys = IGNORED_CONSUMER_PROPERTIES.keySet(); for (Map.Entry<String, Object> conf : getConsumerConfig().entrySet()) { String key = conf.getKey(); if (!ignoredConsumerPropertiesKeys.contains(key)) { Object value = DisplayData.inferType(conf.getValue()) != null ? conf.getValue() : String.valueOf(conf.getValue()); builder.add(DisplayData.item(key, ValueProvider.StaticValueProvider.of(value))); } } } }
@Override public void populateDisplayData(DisplayData.Builder builder) { super.populateDisplayData(builder); Configuration hadoopConfig = configuration; if (hadoopConfig != null) { builder.addIfNotNull( DisplayData.item(OUTPUT_FORMAT_CLASS_ATTR, hadoopConfig.get(OUTPUT_FORMAT_CLASS_ATTR)) .withLabel("OutputFormat Class")); builder.addIfNotNull( DisplayData.item(OUTPUT_KEY_CLASS, hadoopConfig.get(OUTPUT_KEY_CLASS)) .withLabel("OutputFormat Key Class")); builder.addIfNotNull( DisplayData.item(OUTPUT_VALUE_CLASS, hadoopConfig.get(OUTPUT_VALUE_CLASS)) .withLabel("OutputFormat Value Class")); builder.addIfNotNull( DisplayData.item( PARTITIONER_CLASS_ATTR, hadoopConfig.get( PARTITIONER_CLASS_ATTR, HadoopFormats.DEFAULT_PARTITIONER_CLASS_ATTR.getName())) .withLabel("Partitioner Class")); } }
public void populateDisplayData(DisplayData.Builder builder) { builder.add( DisplayData.item( "projectId", getDisplayValue(configuration.get(BigtableOptionsFactory.PROJECT_ID_KEY))) .withLabel("Project ID")); builder.add( DisplayData.item( "instanceId", getDisplayValue(configuration.get(BigtableOptionsFactory.INSTANCE_ID_KEY))) .withLabel("Instance ID")); Map<String, ValueProvider<String>> hashMap = new HashMap<String, ValueProvider<String>>(configuration); hashMap.remove(BigtableOptionsFactory.PROJECT_ID_KEY); hashMap.remove(BigtableOptionsFactory.INSTANCE_ID_KEY); for (Entry<String, ValueProvider<String>> entry : configuration.entrySet()) { builder.add( DisplayData.item(entry.getKey(), getDisplayValue(entry.getValue())) .withLabel(entry.getKey())); } }
public void populateDisplayData(DisplayData.Builder builder) { builder.add( DisplayData.item( "projectId", getDisplayValue(configuration.get(BigtableOptionsFactory.PROJECT_ID_KEY))) .withLabel("Project ID")); builder.add( DisplayData.item( "instanceId", getDisplayValue(configuration.get(BigtableOptionsFactory.INSTANCE_ID_KEY))) .withLabel("Instance ID")); Map<String, ValueProvider<String>> hashMap = new HashMap<String, ValueProvider<String>>(configuration); hashMap.remove(BigtableOptionsFactory.PROJECT_ID_KEY); hashMap.remove(BigtableOptionsFactory.INSTANCE_ID_KEY); for (Entry<String, ValueProvider<String>> entry : configuration.entrySet()) { builder.add( DisplayData.item(entry.getKey(), getDisplayValue(entry.getValue())) .withLabel(entry.getKey())); } }
private Builder addItemIf(boolean condition, ItemSpec<?> spec) { if (!condition) { return this; } checkNotNull(spec, "Input display item cannot be null"); checkNotNull(spec.getValue(), "Input display value cannot be null"); if (spec.getNamespace() == null) { spec = spec.withNamespace(latestNs); } Item item = Item.create(spec, latestPath); Identifier id = Identifier.of(item.getPath(), item.getNamespace(), item.getKey()); checkArgument( !entries.containsKey(id), "Display data key (%s) is not unique within the specified path and namespace: %s%s.", item.getKey(), item.getPath(), item.getNamespace()); entries.put(id, item); return this; }
@Override public void populateDisplayData(DisplayData.Builder builder) { super.populateDisplayData(builder); resolveDynamicDestinations().populateDisplayData(builder); builder .addIfNotDefault( DisplayData.item("numShards", getNumShards()).withLabel("Maximum Output Shards"), 0) .addIfNotNull( DisplayData.item("tempDirectory", getTempDirectory()) .withLabel("Directory for temporary files")) .addIfNotNull(DisplayData.item("fileHeader", getHeader()).withLabel("File Header")) .addIfNotNull(DisplayData.item("fileFooter", getFooter()).withLabel("File Footer")) .add( DisplayData.item( "writableByteChannelFactory", getWritableByteChannelFactory().toString()) .withLabel("Compression/Transformation Type")); } }
@Override public void populateDisplayData(DisplayData.Builder builder) { // We explicitly do not register base-class data, instead we use the delegate inner source. builder .include("source", sourceDelegate) .add(DisplayData.item("source", sourceDelegate.getClass()).withLabel("Read Source")); if (channelFactory instanceof Enum) { // GZIP, BZIP, ZIP and DEFLATE are implemented as enums; Enum classes are anonymous, so use // the .name() value instead builder.add( DisplayData.item("compressionMode", ((Enum) channelFactory).name()) .withLabel("Compression Mode")); } else { builder.add( DisplayData.item("compressionMode", channelFactory.getClass()) .withLabel("Compression Mode")); } }
@Override public void populateDisplayData(DisplayData.Builder builder) { String displayBaseFilename = params.baseFilename.isAccessible() ? params.baseFilename.get().toString() : ("(" + params.baseFilename + ")"); builder.add( DisplayData.item( "filenamePattern", String.format("%s%s%s", displayBaseFilename, params.shardTemplate, params.suffix)) .withLabel("Filename pattern")); builder.add( DisplayData.item("filePrefix", params.baseFilename).withLabel("Output File Prefix")); builder.add( DisplayData.item("shardNameTemplate", params.shardTemplate) .withLabel("Output Shard Name Template")); builder.add(DisplayData.item("fileSuffix", params.suffix).withLabel("Output file Suffix")); }
@Override public void populateDisplayData(DisplayData.Builder builder) { super.populateDisplayData(builder); builder.addIfNotNull(DisplayData.item("topic", getTopic()).withLabel("Topic")); Set<String> ignoredProducerPropertiesKeys = IGNORED_PRODUCER_PROPERTIES.keySet(); for (Map.Entry<String, Object> conf : getProducerConfig().entrySet()) { String key = conf.getKey(); if (!ignoredProducerPropertiesKeys.contains(key)) { Object value = DisplayData.inferType(conf.getValue()) != null ? conf.getValue() : String.valueOf(conf.getValue()); builder.add(DisplayData.item(key, ValueProvider.StaticValueProvider.of(value))); } } } }
@Override public void populateDisplayData(DisplayData.Builder builder) { builder.add(DisplayData.item("from", getFrom()).withLabel("Generate sequence from")); builder.addIfNotDefault( DisplayData.item("to", getTo()).withLabel("Generate sequence to (exclusive)"), -1L); builder.addIfNotNull( DisplayData.item( "timestampFn", getTimestampFn() == null ? null : getTimestampFn().getClass()) .withLabel("Timestamp Function")); builder.addIfNotNull( DisplayData.item("maxReadTime", getMaxReadTime()).withLabel("Maximum Read Time")); if (getElementsPerPeriod() > 0) { builder.add( DisplayData.item("elementsPerPeriod", getElementsPerPeriod()) .withLabel("Elements per period")); builder.add(DisplayData.item("period", getPeriod()).withLabel("Period")); } } }
@Override public void populateDisplayData(DisplayData.Builder builder) { super.populateDisplayData(builder); if (getTikaConfigPath() != null) { builder.add( DisplayData.item("tikaConfigPath", getTikaConfigPath()).withLabel("TikaConfig Path")); } Metadata metadata = getInputMetadata(); if (metadata != null) { //TODO: use metadata.toString() only without a trim() once Apache Tika 1.17 gets released builder.add( DisplayData.item("inputMetadata", metadata.toString().trim()) .withLabel("Input Metadata")); } builder.addIfNotNull( DisplayData.item("contentTypeHint", getContentTypeHint()).withLabel("Content type hint")); }
@Override public void populateDisplayData(DisplayData.Builder builder) { super.populateDisplayData(builder); Configuration hadoopConfig = getConfiguration().get(); if (hadoopConfig != null) { builder.addIfNotNull( DisplayData.item( "mapreduce.job.inputformat.class", hadoopConfig.get("mapreduce.job.inputformat.class")) .withLabel("InputFormat Class")); builder.addIfNotNull( DisplayData.item("key.class", hadoopConfig.get("key.class")).withLabel("Key Class")); builder.addIfNotNull( DisplayData.item("value.class", hadoopConfig.get("value.class")) .withLabel("Value Class")); } }
/** * Populate display data for the {@code combineFns} that make up a composed combine transform. * * <p>The same combineFn class may be used multiple times, in which case we must take special care * to register display data with unique namespaces. */ private static void populateDisplayData( DisplayData.Builder builder, List<? extends HasDisplayData> combineFns) { for (int i = 0; i < combineFns.size(); i++) { HasDisplayData combineFn = combineFns.get(i); String token = "combineFn" + (i + 1); builder.add(DisplayData.item(token, combineFn.getClass()).withLabel("Combine Function")); builder.include(token, combineFn); } } }
@Override public void populateDisplayData(DisplayData.Builder builder) { super.populateDisplayData(builder); builder.addIfNotNull(DisplayData.item("topic", getTopic()).withLabel("Topic")); Set<String> ignoredProducerPropertiesKeys = IGNORED_PRODUCER_PROPERTIES.keySet(); for (Map.Entry<String, Object> conf : getProducerConfig().entrySet()) { String key = conf.getKey(); if (!ignoredProducerPropertiesKeys.contains(key)) { Object value = DisplayData.inferType(conf.getValue()) != null ? conf.getValue() : String.valueOf(conf.getValue()); builder.add(DisplayData.item(key, ValueProvider.StaticValueProvider.of(value))); } } } }
@Override public void populateDisplayData(DisplayData.Builder builder) { super.populateDisplayData(builder); builder .addIfNotNull( DisplayData.item("table", BigQueryHelpers.displayTable(getTableProvider())) .withLabel("Table")) .addIfNotNull(DisplayData.item("query", getQuery()).withLabel("Query")) .addIfNotNull( DisplayData.item("flattenResults", getFlattenResults()) .withLabel("Flatten Query Results")) .addIfNotNull( DisplayData.item("useLegacySql", getUseLegacySql()) .withLabel("Use Legacy SQL Dialect")) .addIfNotDefault( DisplayData.item("validation", getValidate()).withLabel("Validation Enabled"), true); }