本文整理匯總了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();
}
}