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


Java IConfigurationAware类代码示例

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


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

示例1: saveConfigurationsInternal

import org.opendaylight.controller.configuration.IConfigurationAware; //导入依赖的package包/类
private Status saveConfigurationsInternal() {
    boolean success = true;
    for (IConfigurationAware configurationAware : configurationAwareList) {
        Status status = configurationAware.saveConfiguration();
        if (!status.isSuccess()) {
            success = false;
            logger.info("Failed to save config for {}",
                    configurationAware.getClass().getName());
        }
    }
    if (success) {
        return new Status(StatusCode.SUCCESS);
    } else {
        return new Status(StatusCode.INTERNALERROR,
                "Failed to Save All Configurations");
    }
}
 
开发者ID:lbchen,项目名称:ODL,代码行数:18,代码来源:ConfigurationImpl.java

示例2: configureGlobalInstance

import org.opendaylight.controller.configuration.IConfigurationAware; //导入依赖的package包/类
/**
 * Configure the dependency for a given instance Global
 *
 * @param c Component assigned for this instance, this will be
 * what will be used for configuration
 * @param imp implementation to be configured
 * @param containerName container on which the configuration happens
 */
protected void configureGlobalInstance(Component c, Object imp) {
    if (imp.equals(ConfigurationImpl.class)) {
        Dictionary<String, Set<String>> props = new Hashtable<String, Set<String>>();
        Set<String> propSet = new HashSet<String>();
        propSet.add("config.event.save");
        props.put("cachenames", propSet);

        // export the service
        c.setInterface(
                new String[] { IConfigurationService.class.getName(),
                        ICacheUpdateAware.class.getName()},
                        props);

        c.add(createServiceDependency().setService(
                IClusterGlobalServices.class).setCallbacks(
                        "setClusterServices", "unsetClusterServices").setRequired(
                                true));

        c.add(createServiceDependency().setService(
                IConfigurationAware.class).setCallbacks(
                        "addConfigurationAware", "removeConfigurationAware")
                        .setRequired(false));
    }
}
 
开发者ID:lbchen,项目名称:ODL,代码行数:33,代码来源:Activator.java

示例3: configureInstance

import org.opendaylight.controller.configuration.IConfigurationAware; //导入依赖的package包/类
/**
 * Function that is called when configuration of the dependencies
 * is required.
 *
 * @param c dependency manager Component object, used for
 * configuring the dependencies exported and imported
 * @param imp Implementation class that is being configured,
 * needed as long as the same routine can configure multiple
 * implementations
 * @param containerName The containerName being configured, this allow
 * also optional per-container different behavior if needed, usually
 * should not be the case though.
 */
public void configureInstance(Component c, Object imp, String containerName) {
    if (imp.equals(ConfigurationContainerImpl.class)) {
        // export the service
        c.setInterface(new String[] {
                IConfigurationContainerService.class.getName(),
                IConfigurationAware.class.getName() }, null);

        c.add(createContainerServiceDependency(containerName).setService(
                IConfigurationContainerAware.class).setCallbacks(
                        "addConfigurationContainerAware",
                        "removeConfigurationContainerAware").setRequired(false));
    }
}
 
开发者ID:lbchen,项目名称:ODL,代码行数:27,代码来源:Activator.java

示例4: configureGlobalInstance

import org.opendaylight.controller.configuration.IConfigurationAware; //导入依赖的package包/类
/**
 * Configure the dependency for a given instance Global
 *
 * @param c Component assigned for this instance, this will be
 * what will be used for configuration
 * @param imp implementation to be configured
 * @param containerName container on which the configuration happens
 */
protected void configureGlobalInstance(Component c, Object imp) {
    if (imp.equals(UserManagerImpl.class)) {
        // export the service
        Dictionary<String, Set<String>> props = new Hashtable<String, Set<String>>();
        Set<String> propSet = new HashSet<String>();
        propSet.add("usermanager.localUserSaveConfigEvent");
        propSet.add("usermanager.remoteServerSaveConfigEvent");
        propSet.add("usermanager.authorizationSaveConfigEvent");
        props.put("cachenames", propSet);

        // export the service
        c.setInterface(new String[] { ICacheUpdateAware.class.getName(),
                IUserManager.class.getName(),
                IConfigurationAware.class.getName() }, props);

        c.add(createServiceDependency().setService(
                IClusterGlobalServices.class).setCallbacks(
                "setClusterGlobalService", "unsetClusterGlobalService")
                .setRequired(true));

        c.add(createServiceDependency().setService(IAAAProvider.class)
                .setCallbacks("addAAAProvider", "removeAAAProvider")
                .setRequired(false));

        c.add(createServiceDependency().setService(
                IContainerAuthorization.class).setCallbacks(
                "setContainerAuthClient", "unsetContainerAuthClient")
                .setRequired(false));

        c.add(createServiceDependency().setService(
                IResourceAuthorization.class).setCallbacks(
                "setAppAuthClient", "unsetAppAuthClient")
                .setRequired(false));
    }
}
 
开发者ID:lbchen,项目名称:ODL,代码行数:44,代码来源:Activator.java

示例5: Topology

import org.opendaylight.controller.configuration.IConfigurationAware; //导入依赖的package包/类
public Topology() {
    ServiceHelper.registerGlobalService(IConfigurationAware.class, this, null);
    topologyWebFileName = ROOT + "topologyCache.sav";
    loadConfiguration();
}
 
开发者ID:lbchen,项目名称:ODL,代码行数:6,代码来源:Topology.java

示例6: addConfigurationAware

import org.opendaylight.controller.configuration.IConfigurationAware; //导入依赖的package包/类
public void addConfigurationAware(IConfigurationAware configurationAware) {
    if (!this.configurationAwareList.contains(configurationAware)) {
        this.configurationAwareList.add(configurationAware);
    }
}
 
开发者ID:lbchen,项目名称:ODL,代码行数:6,代码来源:ConfigurationImpl.java

示例7: removeConfigurationAware

import org.opendaylight.controller.configuration.IConfigurationAware; //导入依赖的package包/类
public void removeConfigurationAware(IConfigurationAware configurationAware) {
    this.configurationAwareList.remove(configurationAware);
}
 
开发者ID:lbchen,项目名称:ODL,代码行数:4,代码来源:ConfigurationImpl.java

示例8: testAddRemoveSaveConfiguration

import org.opendaylight.controller.configuration.IConfigurationAware; //导入依赖的package包/类
@Test
public void testAddRemoveSaveConfiguration() {

        ConfigurationImpl configurationImpl = new ConfigurationImpl();
        IConfigurationAware testConfigurationAware = new ConfigurationAwareTest();

        configurationImpl.addConfigurationAware(testConfigurationAware);
        configurationImpl.addConfigurationAware(testConfigurationAware);

        Assert.assertEquals(1, configurationImpl.getConfigurationAwareListSize());

        ConfigurationAwareTest testConfigurationAware1 = new ConfigurationAwareTest();
        configurationImpl.addConfigurationAware(testConfigurationAware1);

        Assert.assertEquals(2, configurationImpl.getConfigurationAwareListSize());

        ConfigurationAwareTest testConfigurationAware2 = new ConfigurationAwareTest();
        configurationImpl.addConfigurationAware(testConfigurationAware2);

        Assert.assertEquals(3, configurationImpl.getConfigurationAwareListSize());

        ConfigurationAwareTest testConfigurationAware3 = new ConfigurationAwareTest();
        configurationImpl.addConfigurationAware(testConfigurationAware3);

        Assert.assertEquals(4, configurationImpl.getConfigurationAwareListSize());


        configurationImpl.removeConfigurationAware(testConfigurationAware);
        Assert.assertEquals(3, configurationImpl.getConfigurationAwareListSize());

        configurationImpl.removeConfigurationAware(testConfigurationAware);
        Assert.assertEquals(3, configurationImpl.getConfigurationAwareListSize());

        configurationImpl.removeConfigurationAware(testConfigurationAware3);
        Assert.assertEquals(2, configurationImpl.getConfigurationAwareListSize());

        configurationImpl.removeConfigurationAware(testConfigurationAware1);
        Assert.assertEquals(1, configurationImpl.getConfigurationAwareListSize());

        configurationImpl.removeConfigurationAware(testConfigurationAware2);
        Assert.assertEquals(0, configurationImpl.getConfigurationAwareListSize());

}
 
开发者ID:lbchen,项目名称:ODL,代码行数:44,代码来源:ConfigurationImplTest.java


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