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


Java ComponentContext.getProperties方法代码示例

本文整理汇总了Java中org.osgi.service.component.ComponentContext.getProperties方法的典型用法代码示例。如果您正苦于以下问题:Java ComponentContext.getProperties方法的具体用法?Java ComponentContext.getProperties怎么用?Java ComponentContext.getProperties使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.osgi.service.component.ComponentContext的用法示例。


在下文中一共展示了ComponentContext.getProperties方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: activate

import org.osgi.service.component.ComponentContext; //导入方法依赖的package包/类
@Activate
public void activate(ComponentContext context) {
    Dictionary<String, Object> config = context.getProperties();
    this.topic = (String)config.get("topic");
    if (topic == null) {
        throw new IllegalArgumentException("Config property topic must be present.");
    }
    String eventTopics = (String)config.get(EventConstants.EVENT_TOPIC);
    Publisher<Event> fromEventAdmin = eventAdmin.from(eventTopics, Event.class);
    toKafka = kafka.to(topic, ProducerRecord.class);
    org.slf4j.MDC.put("inLogAppender", "true");
    Flux.from(fromEventAdmin)
        .doOnEach(event -> org.slf4j.MDC.put("inLogAppender", "true"))
        //.log()
        .map(event->toRecord(event))
        .doOnError(ex -> LOGGER.error(ex.getMessage(), ex))
        .subscribe(toKafka);
    LOGGER.info("Kafka appender started. Listening on topic " + topic);
}
 
开发者ID:cschneider,项目名称:reactive-components,代码行数:20,代码来源:KafkaAppender.java

示例2: modified

import org.osgi.service.component.ComponentContext; //导入方法依赖的package包/类
@Modified
public void modified(ComponentContext context) {
    Dictionary<?, ?> properties = context != null ? context.getProperties() : new Properties();

    int newMessageHandlerThreadPoolSize;

    try {
        String s = get(properties, "messageHandlerThreadPoolSize");

        newMessageHandlerThreadPoolSize =
                isNullOrEmpty(s) ? messageHandlerThreadPoolSize : Integer.parseInt(s.trim());

    } catch (NumberFormatException e) {
        log.warn(e.getMessage());
        newMessageHandlerThreadPoolSize = messageHandlerThreadPoolSize;
    }

    // Any change in the following parameters implies thread pool restart
    if (newMessageHandlerThreadPoolSize != messageHandlerThreadPoolSize) {
        setMessageHandlerThreadPoolSize(newMessageHandlerThreadPoolSize);
        restartMessageHandlerThreadPool();
    }

    log.info(FORMAT, messageHandlerThreadPoolSize);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:26,代码来源:DistributedStatisticStore.java

示例3: modified

import org.osgi.service.component.ComponentContext; //导入方法依赖的package包/类
@Modified
public void modified(ComponentContext context) {
    Dictionary<?, ?> properties = context.getProperties();
    int newTunnelStatsPollFrequency;
    try {
        String s = get(properties, "tunnelStatsPollFrequency");
        newTunnelStatsPollFrequency = isNullOrEmpty(s) ? tunnelStatsPollFrequency : Integer.parseInt(s.trim());

    } catch (NumberFormatException | ClassCastException e) {
        newTunnelStatsPollFrequency = tunnelStatsPollFrequency;
    }

    if (newTunnelStatsPollFrequency != tunnelStatsPollFrequency) {
        tunnelStatsPollFrequency = newTunnelStatsPollFrequency;
        collectors.values().forEach(tsc -> tsc.adjustPollInterval(tunnelStatsPollFrequency));
        log.info("New setting: tunnelStatsPollFrequency={}", tunnelStatsPollFrequency);
    }

}
 
开发者ID:shlee89,项目名称:athena,代码行数:20,代码来源:PcepTunnelProvider.java

示例4: activate

import org.osgi.service.component.ComponentContext; //导入方法依赖的package包/类
@Activate
public void activate(ComponentContext context) {
    alarmsExecutor = Executors.newScheduledThreadPool(CORE_POOL_SIZE);
    eventHandlingExecutor =
            Executors.newFixedThreadPool(CORE_POOL_SIZE,
                                         groupedThreads("onos/pollingalarmprovider",
                                                        "device-installer-%d", log));

    providerService = providerRegistry.register(this);

    deviceService.addListener(deviceListener);
    mastershipService.addListener(mastershipListener);

    if (context == null) {
        alarmPollFrequencySeconds = DEFAULT_POLL_FREQUENCY_SECONDS;
        log.info("No component configuration");
    } else {
        Dictionary<?, ?> properties = context.getProperties();
        alarmPollFrequencySeconds = getNewPollFrequency(properties, alarmPollFrequencySeconds);
    }
    scheduledTask = schedulePolling();
    log.info("Started");
}
 
开发者ID:shlee89,项目名称:athena,代码行数:24,代码来源:PollingAlarmProvider.java

示例5: modified

import org.osgi.service.component.ComponentContext; //导入方法依赖的package包/类
@Modified
public void modified(ComponentContext context) {
    int newRate = DEFAULT_RATE;
    if (context != null) {
        Dictionary properties = context.getProperties();
        try {
            String s = get(properties, "rate");
            newRate = isNullOrEmpty(s)
                    ? rate : Integer.parseInt(s.trim());
        } catch (Exception e) {
            return;
        }
    }
    if (newRate != rate) {
        log.info("Per node rate changed to {}", newRate);
        rate = newRate;
        stopTest();
        runner.execute(this::startTest);
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:21,代码来源:DistributedConsensusLoadTest.java

示例6: modified

import org.osgi.service.component.ComponentContext; //导入方法依赖的package包/类
@Modified
protected void modified(ComponentContext context) {
    Dictionary<?, ?> properties = context.getProperties();

    String newLinkWeightFunction = get(properties, "linkWeightFunction");
    if (newLinkWeightFunction != null &&
            !Objects.equals(newLinkWeightFunction, linkWeightFunction)) {
        linkWeightFunction = newLinkWeightFunction;
        LinkWeight weight = linkWeightFunction.equals(LINK_METRIC) ?
                new MetricLinkWeight() :
                linkWeightFunction.equals(GEO_DISTANCE) ?
                        new GeoDistanceLinkWeight(deviceService) : null;
        setDefaultLinkWeight(weight);
    }
    log.info(FORMAT, linkWeightFunction);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:17,代码来源:DistributedTopologyStore.java

示例7: readComponentConfiguration

import org.osgi.service.component.ComponentContext; //导入方法依赖的package包/类
/**
 * Extracts properties from the component configuration context.
 *
 * @param context the component context
 */
private void readComponentConfiguration(ComponentContext context) {
    Dictionary<?, ?> properties = context.getProperties();

    String newXosServerAddress =
            Tools.get(properties, XOS_SERVER_ADDRESS_PROPERTY_NAME);
    if (!isNullOrEmpty(newXosServerAddress)) {
        xosServerAddress = newXosServerAddress;
    }

    String newXosServerPortString =
            Tools.get(properties, XOS_SERVER_PORT_PROPERTY_NAME);
    if (!isNullOrEmpty(newXosServerPortString)) {
        xosServerPort = Integer.parseInt(newXosServerPortString);
    }

    String newXosProviderServiceString =
            Tools.get(properties, XOS_PROVIDER_SERVICE_PROPERTY_NAME);
    if (!isNullOrEmpty(newXosProviderServiceString)) {
        xosProviderService = Integer.parseInt(newXosProviderServiceString);
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:27,代码来源:OnosXosIntegrationManager.java

示例8: modified

import org.osgi.service.component.ComponentContext; //导入方法依赖的package包/类
@Modified
protected void modified(ComponentContext context) {
    log.info("Received configuration change...");
    Dictionary<?, ?> properties = context != null ? context.getProperties() : new Properties();
    String newIp = get(properties, "aliasIp");
    String newMask = get(properties, "aliasMask");
    String newAdapter = get(properties, "aliasAdapter");

    // Process any changes in the parameters...
    if (!Objects.equals(newIp, aliasIp) ||
            !Objects.equals(newMask, aliasMask) ||
            !Objects.equals(newAdapter, aliasAdapter)) {
        synchronized (this) {
            log.info("Reconfiguring with aliasIp={}, aliasMask={}, aliasAdapter={}, wasLeader={}",
                     newIp, newMask, newAdapter, wasLeader);
            if (wasLeader) {
                removeIpAlias(aliasIp, aliasMask, aliasAdapter);
                addIpAlias(newIp, newMask, newAdapter);
            }
            aliasIp = newIp;
            aliasMask = newMask;
            aliasAdapter = newAdapter;
        }
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:26,代码来源:ClusterIpManager.java

示例9: readComponentConfiguration

import org.osgi.service.component.ComponentContext; //导入方法依赖的package包/类
/**
 * Extracts properties from the component configuration context.
 *
 * @param context the component context
 */
private void readComponentConfiguration(ComponentContext context) {
    Dictionary<?, ?> properties = context.getProperties();

    Integer newPendingFutureTimeoutMinutes =
            Tools.getIntegerProperty(properties, "pendingFutureTimeoutMinutes");
    if (newPendingFutureTimeoutMinutes == null) {
        pendingFutureTimeoutMinutes = DEFAULT_PENDING_FUTURE_TIMEOUT_MINUTES;
        log.info("Pending future timeout is not configured, " +
                         "using current value of {}", pendingFutureTimeoutMinutes);
    } else {
        pendingFutureTimeoutMinutes = newPendingFutureTimeoutMinutes;
        log.info("Configured. Pending future timeout is configured to {}",
                 pendingFutureTimeoutMinutes);
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:21,代码来源:SimpleFlowRuleStore.java

示例10: readComponentConfiguration

import org.osgi.service.component.ComponentContext; //导入方法依赖的package包/类
/**
 * Extracts properties from the component configuration context.
 *
 * @param context the component context
 */
private void readComponentConfiguration(ComponentContext context) {
    Dictionary<?, ?> properties = context.getProperties();

    Integer newHeartbeatInterval = Tools.getIntegerProperty(properties,
                                                            "heartbeatInterval");
    if (newHeartbeatInterval == null) {
        setHeartbeatInterval(DEFAULT_HEARTBEAT_INTERVAL);
        log.info("Heartbeat interval time is not configured, default value is {}",
                 DEFAULT_HEARTBEAT_INTERVAL);
    } else {
        setHeartbeatInterval(newHeartbeatInterval);
        log.info("Configured. Heartbeat interval time is configured to {}",
                 heartbeatInterval);
    }

    Integer newPhiFailureThreshold = Tools.getIntegerProperty(properties,
                                                              "phiFailureThreshold");
    if (newPhiFailureThreshold == null) {
        setPhiFailureThreshold(DEFAULT_PHI_FAILURE_THRESHOLD);
        log.info("Phi failure threshold is not configured, default value is {}",
                 DEFAULT_PHI_FAILURE_THRESHOLD);
    } else {
        setPhiFailureThreshold(newPhiFailureThreshold);
        log.info("Configured. Phi failure threshold is configured to {}",
                 phiFailureThreshold);
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:33,代码来源:DistributedClusterStore.java

示例11: modified

import org.osgi.service.component.ComponentContext; //导入方法依赖的package包/类
@Modified
public void modified(ComponentContext context) {
    Dictionary<?, ?> properties = context != null ? context.getProperties() : new Properties();

    try {
        String s = get(properties, "garbageCollect");
        garbageCollect = isNullOrEmpty(s) ? GARBAGE_COLLECT : Boolean.parseBoolean(s.trim());

        s = get(properties, "gcThresh");
        gcThresh = isNullOrEmpty(s) ? GC_THRESH : Integer.parseInt(s.trim());
    } catch (Exception e) {
        gcThresh = GC_THRESH;
        garbageCollect = GARBAGE_COLLECT;
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:16,代码来源:DistributedGroupStore.java

示例12: readComponentConfiguration

import org.osgi.service.component.ComponentContext; //导入方法依赖的package包/类
/**
 * Extracts properties from the component configuration context.
 *
 * @param context the component context
 */
private void readComponentConfiguration(ComponentContext context) {
    Dictionary<?, ?> properties = context.getProperties();

    String addressStr = Tools.get(properties, "address");
    address = addressStr != null ? addressStr : DEFAULT_ADDRESS;
    log.info("Configured. InfluxDB server address is {}", address);

    String databaseStr = Tools.get(properties, "database");
    database = databaseStr != null ? databaseStr : DEFAULT_DATABASE;
    log.info("Configured. InfluxDB server database is {}", database);

    String usernameStr = Tools.get(properties, "username");
    username = usernameStr != null ? usernameStr : DEFAULT_USERNAME;
    log.info("Configured. InfluxDB server username is {}", username);

    String passwordStr = Tools.get(properties, "password");
    password = passwordStr != null ? passwordStr : DEFAULT_PASSWORD;
    log.info("Configured. InfluxDB server password is {}", password);

    Integer portConfigured = Tools.getIntegerProperty(properties, "port");
    if (portConfigured == null) {
        port = DEFAULT_PORT;
        log.info("InfluxDB port is not configured, default value is {}", port);
    } else {
        port = portConfigured;
        log.info("Configured. InfluxDB port is configured to {}", port);
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:34,代码来源:InfluxDbMetricsConfig.java

示例13: readComponentConfiguration

import org.osgi.service.component.ComponentContext; //导入方法依赖的package包/类
/**
 * Extracts properties from the component configuration context.
 *
 * @param context the component context
 */
private void readComponentConfiguration(ComponentContext context) {
    Dictionary<?, ?> properties = context.getProperties();
    Boolean flag;

    flag = Tools.isPropertyEnabled(properties, "allowExtraneousRules");
    if (flag == null) {
        log.info("AllowExtraneousRules is not configured, " +
                "using current value of {}", allowExtraneousRules);
    } else {
        allowExtraneousRules = flag;
        log.info("Configured. AllowExtraneousRules is {}",
                allowExtraneousRules ? "enabled" : "disabled");
    }

    flag = Tools.isPropertyEnabled(properties, "purgeOnDisconnection");
    if (flag == null) {
        log.info("PurgeOnDisconnection is not configured, " +
                "using current value of {}", purgeOnDisconnection);
    } else {
        purgeOnDisconnection = flag;
        log.info("Configured. PurgeOnDisconnection is {}",
                purgeOnDisconnection ? "enabled" : "disabled");
    }

    String s = get(properties, "fallbackFlowPollFrequency");
    try {
        fallbackFlowPollFrequency = isNullOrEmpty(s) ? DEFAULT_POLL_FREQUENCY : Integer.parseInt(s);
    } catch (NumberFormatException e) {
        fallbackFlowPollFrequency = DEFAULT_POLL_FREQUENCY;
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:37,代码来源:FlowRuleManager.java

示例14: modified

import org.osgi.service.component.ComponentContext; //导入方法依赖的package包/类
@Modified
protected void modified(ComponentContext context) {
    Dictionary<?, ?> properties = context.getProperties();
    if (properties == null) {
        return;
    }
    String strClearRoutes = Tools.get(properties, "clearRoutes");
    clearRoutes = Boolean.parseBoolean(strClearRoutes);

    log.info("clearRoutes set to {}", clearRoutes);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:12,代码来源:FpmManager.java

示例15: readComponentConfiguration

import org.osgi.service.component.ComponentContext; //导入方法依赖的package包/类
/**
 * Extracts properties from the component configuration context.
 *
 * @param context the component context
 */
private void readComponentConfiguration(ComponentContext context) {
    Dictionary<?, ?> properties = context.getProperties();
    try {
        String strPort = (String) properties.get("bgpPort");
        if (strPort != null) {
            bgpPort = Integer.parseInt(strPort);
        } else {
            bgpPort = DEFAULT_BGP_PORT;
        }
    } catch (NumberFormatException | ClassCastException e) {
        bgpPort = DEFAULT_BGP_PORT;
    }
    log.debug("BGP port is set to {}", bgpPort);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:20,代码来源:BgpSessionManager.java


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