热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

org.apache.nifi.components.AllowableValue类的使用及代码示例

本文整理了Java中org.apache.nifi.components.AllowableValue类的一些代码示例,展示了AllowableValue

本文整理了Java中org.apache.nifi.components.AllowableValue类的一些代码示例,展示了AllowableValue类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。AllowableValue类的具体详情如下:
包路径:org.apache.nifi.components.AllowableValue
类名称:AllowableValue

AllowableValue介绍

[英]Represents a valid value for a PropertyDescriptor
[中]表示PropertyDescriptor的有效值

代码示例

代码示例来源:origin: apache/nifi

@Override
protected String getDefaultTimePrecision() {
// User does not have to choose one.
// AUTO_DETECT can handle most cases, but it may incur longer latency
// when all listed files do not have SECOND part in their timestamps although Azure Blob Storage does support seconds.
return PRECISION_SECONDS.getValue();
}

代码示例来源:origin: apache/nifi

private static AllowableValue buildDefaultWeakCryptoAllowableValue() {
return new AllowableValue(WEAK_CRYPTO_NOT_ALLOWED_NAME, "Not Allowed", "When set, operation will be blocked and alerts will be presented to the user " +
"if unsafe combinations of encryption algorithms and passwords are provided on a JVM with limited strength crypto. To fix this, see the Admin Guide.");
}

代码示例来源:origin: apache/nifi

private static String getSchemaAccessStrategyName(final String schemaAccessValue, final List schemaAccessStrategyValues) {
for (final AllowableValue allowableValue : schemaAccessStrategyValues) {
if (allowableValue.getValue().equalsIgnoreCase(schemaAccessValue)) {
return allowableValue.getDisplayName();
}
}
return null;
}

代码示例来源:origin: apache/nifi

private boolean shouldReportOnlyOnPrimary(boolean isClusterScope, final ProcessContext context) {
if (REPORT_NODE_PRIMARY.equals(context.getProperty(REPORTING_NODE).getValue())) {
if (isClusterScope) {
return true;
}
}
return false;
}

代码示例来源:origin: apache/nifi

private static void validateRequiredProperty(ValidationContext context, Collection results, PropertyDescriptor property) {
if (!context.getProperty(property).isSet()) {
final String displayName = property.getDisplayName();
results.add(new ValidationResult.Builder()
.subject(displayName)
.explanation(format("'%s' is required to use '%s' listing strategy", displayName, AbstractListProcessor.BY_ENTITIES.getDisplayName()))
.valid(false)
.build());
}
}

代码示例来源:origin: apache/nifi

@Override
public void onTrigger(final ProcessContext context, final ProcessSession session) throws ProcessException {
final String listingStrategy = context.getProperty(LISTING_STRATEGY).getValue();
if (BY_TIMESTAMPS.equals(listingStrategy)) {
listByTrackingTimestamps(context, session);
} else if (BY_ENTITIES.equals(listingStrategy)) {
listByTrackingEntities(context, session);
} else {
throw new ProcessException("Unknown listing strategy: " + listingStrategy);
}
}

代码示例来源:origin: apache/nifi

static void validateProperties(ValidationContext context, Collection results, Scope scope) {
validateRequiredProperty(context, results, ListedEntityTracker.TRACKING_STATE_CACHE);
validateRequiredProperty(context, results, ListedEntityTracker.TRACKING_TIME_WINDOW);
if (Scope.LOCAL.equals(scope)
&& StringUtils.isEmpty(context.getProperty(NODE_IDENTIFIER).evaluateAttributeExpressions().getValue())) {
results.add(new ValidationResult.Builder()
.subject(NODE_IDENTIFIER.getDisplayName())
.explanation(format("'%s' is required to use local scope with '%s' listing strategy",
NODE_IDENTIFIER.getDisplayName(), AbstractListProcessor.BY_ENTITIES.getDisplayName()))
.build());
}
}

代码示例来源:origin: apache/nifi

private FlattenMode getFlattenMode(String mode) {
if (FLATTEN_MODE_NORMAL.getValue().equals(mode)) {
return FlattenMode.NORMAL;
} else if (FLATTEN_MODE_DOT_NOTATION.getValue().equals(mode)) {
return FlattenMode.MONGODB;
} else {
return FlattenMode.KEEP_ARRAYS;
}
}
}

代码示例来源:origin: apache/nifi

@Override
protected Collection customValidate(final ValidationContext validationContext) {
if (!validationContext.getProperty(ARRAY_WRAPPING).getValue().equals(NO_WRAPPING.getValue())) {
if (!validationContext.getProperty(ARRAY_TAG_NAME).isSet()) {
StringBuilder explanation = new StringBuilder()
.append("if property \'")
.append(ARRAY_WRAPPING.getName())
.append("\' is defined as \'")
.append(USE_PROPERTY_AS_WRAPPER.getDisplayName())
.append("\' or \'")
.append(USE_PROPERTY_FOR_ELEMENTS.getDisplayName())
.append("\' the property \'")
.append(ARRAY_TAG_NAME.getDisplayName())
.append("\' has to be set.");
return Collections.singleton(new ValidationResult.Builder()
.subject(ARRAY_TAG_NAME.getName())
.valid(false)
.explanation(explanation.toString())
.build());
}
}
return Collections.emptyList();
}

代码示例来源:origin: apache/nifi

/**
* @param values contrained set of values
* @return the builder
*/
public Builder allowableValues(final Set values) {
if (null != values) {
this.allowableValues = new ArrayList<>();
for (final String value : values) {
this.allowableValues.add(new AllowableValue(value, value));
}
}
return this;
}

代码示例来源:origin: apache/nifi

@Override
public void onPropertyModified(final PropertyDescriptor descriptor, final String oldValue, final String newValue) {
if (descriptor.equals(ROUTE_STRATEGY)) {
cOnfiguredRouteStrategy= newValue;
} else {
final Set newDynamicPropertyNames = new HashSet<>(dynamicPropertyNames);
if (newValue == null) {
newDynamicPropertyNames.remove(descriptor.getName());
} else if (oldValue == null) { // new property
newDynamicPropertyNames.add(descriptor.getName());
}
this.dynamicPropertyNames = Collections.unmodifiableSet(newDynamicPropertyNames);
}
// formulate the new set of Relationships
final Set allDynamicProps = this.dynamicPropertyNames;
final Set newRelatiOnships= new HashSet<>();
final String routeStrategy = configuredRouteStrategy;
if (ROUTE_PROPERTY_NAME.equals(routeStrategy)) {
for (final String propName : allDynamicProps) {
newRelationships.add(new Relationship.Builder().name(propName).build());
}
} else {
newRelationships.add(REL_MATCH);
}
newRelationships.add(REL_NO_MATCH);
this.relationships.set(newRelationships);
}

代码示例来源:origin: apache/nifi

private boolean isValueAllowed(final String value) {
if (allowableValues == null || value == null) {
return true;
}
for (final AllowableValue allowableValue : allowableValues) {
if (allowableValue.getValue().equals(value)) {
return true;
}
}
return false;
}

代码示例来源:origin: apache/nifi

@Override
protected Collection customValidate(ValidationContext validationContext) {
final List problems = new ArrayList<>(super.customValidate(validationContext));
final boolean isWriterSet = validationContext.getProperty(RECORD_WRITER).isSet();
if (validationContext.getProperty(FORMAT).getValue().equals(RECORD_FORMAT.getValue()) && !isWriterSet) {
problems.add(new ValidationResult.Builder()
.input("Record Writer")
.valid(false)
.explanation("If using " + RECORD_FORMAT.getDisplayName() + ", a record writer needs to be set.")
.build());
}
if (validationContext.getProperty(FORMAT).getValue().equals(AMBARI_FORMAT.getValue()) && isWriterSet) {
problems.add(new ValidationResult.Builder()
.input("Record Writer")
.valid(false)
.explanation("If using " + AMBARI_FORMAT.getDisplayName() + ", no record writer should be set.")
.build());
}
return problems;
}

代码示例来源:origin: apache/nifi

/**
* @param values constrained set of values
* @return the builder
*/
public Builder allowableValues(final String... values) {
if (null != values) {
this.allowableValues = new ArrayList<>();
for (final String value : values) {
allowableValues.add(new AllowableValue(value, value));
}
}
return this;
}

代码示例来源:origin: apache/nifi

private SslContextFactory createSslFactory(final ConfigurationContext context) {
final SSLContextService sslService = context.getProperty(SSL_CONTEXT).asControllerService(SSLContextService.class);
final String clientAuthValue = context.getProperty(CLIENT_AUTH).getValue();
final boolean need;
final boolean want;
if (CLIENT_NEED.equals(clientAuthValue)) {
need = true;
want = false;
} else if (CLIENT_WANT.equals(clientAuthValue)) {
need = false;
want = true;
} else {
need = false;
want = false;
}
final SslContextFactory sslFactory = (sslService == null) ? null : createSslFactory(sslService, need, want);
return sslFactory;
}

代码示例来源:origin: apache/nifi

private static boolean isSchemaRegistryRequired(final String schemaAccessValue) {
return HWX_CONTENT_ENCODED_SCHEMA.getValue().equalsIgnoreCase(schemaAccessValue) || SCHEMA_NAME_PROPERTY.getValue().equalsIgnoreCase(schemaAccessValue)
|| HWX_SCHEMA_REF_ATTRIBUTES.getValue().equalsIgnoreCase(schemaAccessValue) || CONFLUENT_ENCODED_SCHEMA.getValue().equalsIgnoreCase(schemaAccessValue);
}

代码示例来源:origin: apache/nifi

@Override
protected Collection customValidate(final ValidationContext validationContext) {
final List results = new ArrayList<>();
if (COMPLETION_MOVE.getValue().equalsIgnoreCase(validationContext.getProperty(COMPLETION_STRATEGY).getValue())) {
if (!validationContext.getProperty(MOVE_DESTINATION_DIR).isSet()) {
results.add(new ValidationResult.Builder().subject(MOVE_DESTINATION_DIR.getName()).input(null).valid(false).explanation(
MOVE_DESTINATION_DIR.getName() + " must be specified if " + COMPLETION_STRATEGY.getName() + " is set to " + COMPLETION_MOVE.getDisplayName()).build());
}
}
return results;
}

代码示例来源:origin: apache/nifi

public > Builder allowableValues(final E[] values) {
if (null != values) {
this.allowableValues = new ArrayList<>();
for (final E value : values) {
allowableValues.add(new AllowableValue(value.name(), value.name()));
}
}
return this;
}

代码示例来源:origin: apache/nifi

private void initLineageStrategy(ConfigurationContext context) throws IOException {
nifiAtlasHook = new NiFiAtlasHook();
final String strategy = context.getProperty(NIFI_LINEAGE_STRATEGY).getValue();
if (LINEAGE_STRATEGY_SIMPLE_PATH.equals(strategy)) {
lineageStrategy = new SimpleFlowPathLineage();
} else if (LINEAGE_STRATEGY_COMPLETE_PATH.equals(strategy)) {
lineageStrategy = new CompleteFlowPathLineage();
}
lineageStrategy.setLineageContext(nifiAtlasHook);
initProvenanceConsumer(context);
}

代码示例来源:origin: apache/nifi

private static String encodeKafkaKey(final byte[] key, final String encoding) {
if (key == null) {
return null;
}
if (HEX_ENCODING.getValue().equals(encoding)) {
return DatatypeConverter.printHexBinary(key);
} else if (UTF8_ENCODING.getValue().equals(encoding)) {
return new String(key, StandardCharsets.UTF_8);
} else {
return null; // won't happen because it is guaranteed by the Allowable Values
}
}

推荐阅读
author-avatar
清潇静凌
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有