本文整理汇总了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");
}
}
示例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));
}
}
示例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));
}
}
示例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));
}
}
示例5: Topology
import org.opendaylight.controller.configuration.IConfigurationAware; //导入依赖的package包/类
public Topology() {
ServiceHelper.registerGlobalService(IConfigurationAware.class, this, null);
topologyWebFileName = ROOT + "topologyCache.sav";
loadConfiguration();
}
示例6: addConfigurationAware
import org.opendaylight.controller.configuration.IConfigurationAware; //导入依赖的package包/类
public void addConfigurationAware(IConfigurationAware configurationAware) {
if (!this.configurationAwareList.contains(configurationAware)) {
this.configurationAwareList.add(configurationAware);
}
}
示例7: removeConfigurationAware
import org.opendaylight.controller.configuration.IConfigurationAware; //导入依赖的package包/类
public void removeConfigurationAware(IConfigurationAware configurationAware) {
this.configurationAwareList.remove(configurationAware);
}
示例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());
}