本文整理汇总了Java中org.opendaylight.controller.config.persist.storage.file.xml.XmlFileStorageAdapter类的典型用法代码示例。如果您正苦于以下问题:Java XmlFileStorageAdapter类的具体用法?Java XmlFileStorageAdapter怎么用?Java XmlFileStorageAdapter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
XmlFileStorageAdapter类属于org.opendaylight.controller.config.persist.storage.file.xml包,在下文中一共展示了XmlFileStorageAdapter类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addingService
import org.opendaylight.controller.config.persist.storage.file.xml.XmlFileStorageAdapter; //导入依赖的package包/类
@Override
@SuppressWarnings("IllegalCatch")
public FeaturesService addingService(final ServiceReference<FeaturesService> reference) {
BundleContext bc = reference.getBundle().getBundleContext();
final FeaturesService featureService = bc.getService(reference);
final Optional<XmlFileStorageAdapter> currentPersister = XmlFileStorageAdapter.getInstance();
if (XmlFileStorageAdapter.getInstance().isPresent()) {
final Set<String> installedFeatureIds = Sets.newHashSet();
try {
for (final Feature installedFeature : featureService.listInstalledFeatures()) {
installedFeatureIds.add(installedFeature.getId());
}
} catch (final Exception e) {
LOG.error("Error listing installed features", e);
}
currentPersister.get().setFeaturesService(() -> installedFeatureIds);
}
ConfigFeaturesListener configFeaturesListener = new ConfigFeaturesListener(configPusher, featureService);
registration = bc.registerService(FeaturesListener.class.getCanonicalName(), configFeaturesListener, null);
return featureService;
}
示例2: pushConfig
import org.opendaylight.controller.config.persist.storage.file.xml.XmlFileStorageAdapter; //导入依赖的package包/类
private Set<FeatureConfigSnapshotHolder> pushConfig(final Set<FeatureConfigSnapshotHolder> configs,
final Feature feature) throws InterruptedException {
Set<FeatureConfigSnapshotHolder> configsToPush = new LinkedHashSet<>(configs);
configsToPush.removeAll(pushedConfigs);
if (!configsToPush.isEmpty()) {
// Ignore features that are present in persisted current config
final Optional<XmlFileStorageAdapter> currentCfgPusher = XmlFileStorageAdapter.getInstance();
if (currentCfgPusher.isPresent() && currentCfgPusher.get().getPersistedFeatures()
.contains(feature.getId())) {
LOG.warn("Ignoring default configuration {} for feature {}, the configuration is present in {}",
configsToPush, feature.getId(), currentCfgPusher.get());
} else {
pusher.pushConfigs(new ArrayList<>(configsToPush));
}
pushedConfigs.addAll(configsToPush);
}
Set<FeatureConfigSnapshotHolder> configsPushed = new LinkedHashSet<>(pushedConfigs);
configsPushed.retainAll(configs);
return configsPushed;
}
示例3: testLoadFromPropertyFile
import org.opendaylight.controller.config.persist.storage.file.xml.XmlFileStorageAdapter; //导入依赖的package包/类
@Test
public void testLoadFromPropertyFile() throws Exception {
PersisterAggregator persisterAggregator = PersisterAggregator.createFromProperties(TestingPropertiesProvider.loadFile("test2.properties"));
List<PersisterWithConfiguration> persisters = persisterAggregator.getPersisterWithConfigurations();
assertEquals(1, persisters.size());
PersisterWithConfiguration persister = persisters.get(0);
assertEquals(XmlFileStorageAdapter.class.getName() ,persister.getStorage().getClass().getName());
assertFalse(persister.isReadOnly());
}
示例4: setUp
import org.opendaylight.controller.config.persist.storage.file.xml.XmlFileStorageAdapter; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
if(XmlFileStorageAdapter.getInstance().isPresent()) {
XmlFileStorageAdapter.getInstance().get().reset();
}
}