• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java OnEnabled类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.apache.nifi.annotation.lifecycle.OnEnabled的典型用法代码示例。如果您正苦于以下问题:Java OnEnabled类的具体用法?Java OnEnabled怎么用?Java OnEnabled使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



OnEnabled类属于org.apache.nifi.annotation.lifecycle包,在下文中一共展示了OnEnabled类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: enable

import org.apache.nifi.annotation.lifecycle.OnEnabled; //导入依赖的package包/类
/**
 *
 */
@OnEnabled
public void enable(ConfigurationContext context) throws InitializationException {
    try {
        if (!this.configured) {
            if (logger.isInfoEnabled()) {
                logger.info("Configuring " + this.getClass().getSimpleName() + " for '"
                        + context.getProperty(CONNECTION_FACTORY_IMPL).evaluateAttributeExpressions().getValue() + "' to be connected to '"
                        + context.getProperty(BROKER_URI).evaluateAttributeExpressions().getValue() + "'");
            }
            // will load user provided libraries/resources on the classpath
            Utils.addResourcesToClasspath(context.getProperty(CLIENT_LIB_DIR_PATH).evaluateAttributeExpressions().getValue());

            this.createConnectionFactoryInstance(context);
            if(!isSolace(context))
                this.setConnectionFactoryProperties(context);
        }
        this.configured = true;
    } catch (Exception e) {
        logger.error("Failed to configure " + this.getClass().getSimpleName(), e);
        this.configured = false;
        throw new IllegalStateException(e);
    }
}
 
开发者ID:lsac,项目名称:nifi-jms-jndi,代码行数:27,代码来源:JNDIConnectionFactoryProvider.java


示例2: enable

import org.apache.nifi.annotation.lifecycle.OnEnabled; //导入依赖的package包/类
/**
 *
 */
@OnEnabled
public void enable(ConfigurationContext context) throws InitializationException {
    try {
        if (!this.configured) {
            if (logger.isInfoEnabled()) {
                logger.info("Configuring " + this.getClass().getSimpleName() + " for '"
                        + context.getProperty(CONNECTION_FACTORY_IMPL).evaluateAttributeExpressions().getValue() + "' to be connected to '"
                        + BROKER_URI + "'");
            }
            // will load user provided libraries/resources on the classpath
            Utils.addResourcesToClasspath(context.getProperty(CLIENT_LIB_DIR_PATH).evaluateAttributeExpressions().getValue());

            this.createConnectionFactoryInstance(context);

            this.setConnectionFactoryProperties(context);
        }
        this.configured = true;
    } catch (Exception e) {
        logger.error("Failed to configure " + this.getClass().getSimpleName(), e);
        this.configured = false;
        throw new IllegalStateException(e);
    }
}
 
开发者ID:lsac,项目名称:nifi-jms-jndi,代码行数:27,代码来源:JMSConnectionFactoryProvider.java


示例3: onEnabled

import org.apache.nifi.annotation.lifecycle.OnEnabled; //导入依赖的package包/类
/**
 * @param context the configuration context
 * @throws InitializationException if unable to create a database connection
 */
@OnEnabled
public void onEnabled(final ConfigurationContext context) throws InitializationException {
    Set<AuthorizationToken> tokensToUse = new HashSet<>();

    final String authorizationFilePath = context.getProperty(AUTHORIZATION_FILE_PATH).getValue();

    try (Scanner authsScanner = new Scanner(new File(authorizationFilePath))) {
        authsScanner.useDelimiter(",");
        while (authsScanner.hasNext()) {
            tokensToUse.add(new StandardAuthorizationToken(authsScanner.next()));
        }
    } catch (IOException ioe) {
        throw new InitializationException("Could not initialize " + this.getClass().getSimpleName() + " when trying to acquire authorizations.", ioe);
    }
    getLogger().info("Providing authorities for the following: {}", new Object[]{tokensToUse});
    this.authorizationTokens = tokensToUse;
}
 
开发者ID:apiri,项目名称:nifi-delegated-authorization-bundle,代码行数:22,代码来源:FileBasedDelegatedAuthorizationProviderService.java


示例4: initialize

import org.apache.nifi.annotation.lifecycle.OnEnabled; //导入依赖的package包/类
@OnEnabled
public void initialize(final ConfigurationContext context) {
    if (cache == null) {
        final int maxSize = context.getProperty(MAX_SIZE).asInteger();
        final Long expireDuration = context.getProperty(AGE_OFF_DURATION).asTimePeriod(TimeUnit.MILLISECONDS);
        final int concurrencyLevel = context.getProperty(CONCURRENCY_LEVEL).isSet() ?
                context.getProperty(CONCURRENCY_LEVEL).asInteger() : -1;
        cache = new SetCacheImpl<>(maxSize, expireDuration, TimeUnit.MILLISECONDS, concurrencyLevel);
    }
}
 
开发者ID:Asymmetrik,项目名称:nifi-nars,代码行数:11,代码来源:LocalCache.java


示例5: startServer

import org.apache.nifi.annotation.lifecycle.OnEnabled; //导入依赖的package包/类
@OnEnabled
public void startServer(final ConfigurationContext context)  throws InitializationException {
    vertx = Vertx.vertx();
    eventBus = vertx.eventBus();
    getLogger().info("initializing vertx server...");
    createSockJSServer(context);
}
 
开发者ID:xmlking,项目名称:nifi-websocket,代码行数:8,代码来源:VertxService.java


示例6: start

import org.apache.nifi.annotation.lifecycle.OnEnabled; //导入依赖的package包/类
@OnEnabled
public void start(final ConfigurationContext context) throws IOException {
    createCache(context);

    startServer(context);
}
 
开发者ID:Asymmetrik,项目名称:nifi-nars,代码行数:7,代码来源:DistributedCacheServer.java


示例7: initialize

import org.apache.nifi.annotation.lifecycle.OnEnabled; //导入依赖的package包/类
@OnEnabled
public void initialize(final ConfigurationContext context) {
    this.closed = false;
    this.configContext = context;
}
 
开发者ID:Asymmetrik,项目名称:nifi-nars,代码行数:6,代码来源:DistributedCacheClient.java


示例8: onEnabled

import org.apache.nifi.annotation.lifecycle.OnEnabled; //导入依赖的package包/类
/**
 * Configures connection pool by creating an instance of the
 * {@link BasicDataSource} based on configuration provided with
 * {@link ConfigurationContext}.
 *
 * This operation makes no guarantees that the actual connection could be
 * made since the underlying system may still go off-line during normal
 * operation of the connection pool.
 *
 * @param context
 *            the configuration context
 * @throws InitializationException
 *             if unable to create a database connection
 */
@OnEnabled
public void onEnabled(final ConfigurationContext context) throws InitializationException {

    final String dburl = context.getProperty(DATABASE_URL).getValue();
    final Integer maxTotal = context.getProperty(MAX_TOTAL_SESSIONS).asInteger();
    final String user = context.getProperty(DB_USER).getValue();
    final String passw = context.getProperty(DB_PASSWORD).getValue();
    // final Long maxWaitMillis = context.getProperty(MAX_WAIT_TIME).asTimePeriod(TimeUnit.MILLISECONDS);

    driver = GraphDatabase.driver(dburl,
                                  AuthTokens.basic(user, passw),
                                  Config.build().withMaxSessions(maxTotal).toConfig() );
}
 
开发者ID:jonathantelfer,项目名称:nifi-neo4j,代码行数:28,代码来源:Neo4jBoltSessionPool.java


示例9: onEnabled

import org.apache.nifi.annotation.lifecycle.OnEnabled; //导入依赖的package包/类
/**
 * @param context
 *            the configuration context
 * @throws InitializationException
 *             if unable to create a database connection
 */
@OnEnabled
public void onEnabled(final ConfigurationContext context) throws InitializationException {
}
 
开发者ID:bbende,项目名称:nifi-dependency-example,代码行数:10,代码来源:StandardMyService.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java RuntimeOptionsFactory类代码示例发布时间:2022-05-22
下一篇:
Java LBHttpSolrClient类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap