本文整理汇总了Java中org.apache.nifi.processor.ProcessContext.getProperty方法的典型用法代码示例。如果您正苦于以下问题:Java ProcessContext.getProperty方法的具体用法?Java ProcessContext.getProperty怎么用?Java ProcessContext.getProperty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.nifi.processor.ProcessContext
的用法示例。
在下文中一共展示了ProcessContext.getProperty方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: openSession
import org.apache.nifi.processor.ProcessContext; //导入方法依赖的package包/类
protected Session openSession(final ProcessContext context) throws JSchException {
final JSch jsch = new JSch();
final String hostKeyVal = context.getProperty(HOST_KEY_FILE).getValue();
if (hostKeyVal != null) {
jsch.setKnownHosts(hostKeyVal);
}
final Session session = jsch.getSession(context.getProperty(USERNAME).evaluateAttributeExpressions().getValue(),
context.getProperty(HOSTNAME).evaluateAttributeExpressions().getValue(),
context.getProperty(PORT).evaluateAttributeExpressions().asInteger().intValue());
final Properties properties = new Properties();
properties.setProperty("StrictHostKeyChecking", context.getProperty(STRICT_HOST_KEY_CHECKING).asBoolean() ? "yes" : "no");
properties.setProperty("PreferredAuthentications", "publickey,password,keyboard-interactive");
final PropertyValue compressionValue = context.getProperty(USE_COMPRESSION);
if (compressionValue != null && "true".equalsIgnoreCase(compressionValue.getValue())) {
properties.setProperty("compression.s2c", "[email protected],zlib,none");
properties.setProperty("compression.c2s", "[email protected],zlib,none");
} else {
properties.setProperty("compression.s2c", "none");
properties.setProperty("compression.c2s", "none");
}
session.setConfig(properties);
final String privateKeyFile = context.getProperty(PRIVATE_KEY_PATH).evaluateAttributeExpressions().getValue();
if (privateKeyFile != null) {
jsch.addIdentity(privateKeyFile, context.getProperty(PRIVATE_KEY_PASSPHRASE).evaluateAttributeExpressions().getValue());
}
final String password = context.getProperty(PASSWORD).evaluateAttributeExpressions().getValue();
if (password != null) {
session.setPassword(password);
}
session.setTimeout(context.getProperty(CONNECTION_TIMEOUT).asTimePeriod(TimeUnit.MILLISECONDS).intValue());
session.connect();
return session;
}
示例2: onScheduled
import org.apache.nifi.processor.ProcessContext; //导入方法依赖的package包/类
@OnScheduled
public void onScheduled(final ProcessContext context) {
batchSize = context.getProperty(BATCH_SIZE).asInteger();
reportingIntervalMillis = context.getProperty(REPORTING_INTERVAL).asTimePeriod(TimeUnit.MILLISECONDS);
PropertyValue correlationAttrProp = context.getProperty(CORRELATION_ATTR);
correlationKey = correlationAttrProp.isSet() ? correlationAttrProp.getValue() : DEFAULT_MOMENT_AGGREGATOR_KEY;
momentsMap = new ConcurrentHashMap<>();
latestStats = new ConcurrentHashMap<>();
}
示例3: onScheduled
import org.apache.nifi.processor.ProcessContext; //导入方法依赖的package包/类
@OnScheduled
public void onScheduled(final ProcessContext context) {
queryProperty = context.getProperty(QUERY);
projectionProperty = context.getProperty(PROJECTION);
sortProperty = context.getProperty(SORT);
limit = context.getProperty(LIMIT).isSet() ? context.getProperty(LIMIT).asInteger() : null;
createMongoConnection(context);
ensureIndexes(context, collection);
}
示例4: onScheduled
import org.apache.nifi.processor.ProcessContext; //导入方法依赖的package包/类
@OnScheduled
public void onScheduled(final ProcessContext context) {
batchSize = context.getProperty(MongoProps.BATCH_SIZE).asInteger();
updateOperator = context.getProperty(MongoProps.UPDATE_OPERATOR).getValue();
updateQueryKeys = getSetFromCsvList(context.getProperty(MongoProps.UPDATE_QUERY_KEYS).getValue());
updateKeysProp = context.getProperty(MongoProps.UPDATE_KEYS);
boolean upsert = context.getProperty(MongoProps.UPSERT).asBoolean();
updateOptions = new UpdateOptions().upsert(upsert);
createMongoConnection(context);
ensureIndexes(context, collection);
}
示例5: initialize
import org.apache.nifi.processor.ProcessContext; //导入方法依赖的package包/类
@OnScheduled
public void initialize(final ProcessContext context) {
logger = getLogger();
delayPeriodPropertyValue = context.getProperty(TIME_PERIOD);
}