当前位置: 首页>>代码示例>>Java>>正文


Java ProcessContext.getProperty方法代码示例

本文整理汇总了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;
}
 
开发者ID:Asymmetrik,项目名称:nifi-nars,代码行数:41,代码来源:AbstractScpProcessor.java

示例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<>();
}
 
开发者ID:Asymmetrik,项目名称:nifi-nars,代码行数:11,代码来源:AbstractStatsProcessor.java

示例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);
}
 
开发者ID:Asymmetrik,项目名称:nifi-nars,代码行数:12,代码来源:QueryMongo.java

示例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);
}
 
开发者ID:Asymmetrik,项目名称:nifi-nars,代码行数:15,代码来源:UpdateMongo.java

示例5: initialize

import org.apache.nifi.processor.ProcessContext; //导入方法依赖的package包/类
@OnScheduled
public void initialize(final ProcessContext context) {
    logger = getLogger();
    delayPeriodPropertyValue = context.getProperty(TIME_PERIOD);
}
 
开发者ID:Asymmetrik,项目名称:nifi-nars,代码行数:6,代码来源:DelayProcessor.java


注:本文中的org.apache.nifi.processor.ProcessContext.getProperty方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。