當前位置: 首頁>>代碼示例>>Java>>正文


Java XmlFileStorageAdapter類代碼示例

本文整理匯總了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;
}
 
開發者ID:hashsdn,項目名稱:hashsdn-controller,代碼行數:24,代碼來源:FeatureServiceCustomizer.java

示例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;
}
 
開發者ID:hashsdn,項目名稱:hashsdn-controller,代碼行數:22,代碼來源:FeatureConfigPusher.java

示例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());
}
 
開發者ID:hashsdn,項目名稱:hashsdn-controller,代碼行數:10,代碼來源:PersisterAggregatorTest.java

示例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();
    }
}
 
開發者ID:hashsdn,項目名稱:hashsdn-controller,代碼行數:7,代碼來源:PersisterAggregatorTest.java


注:本文中的org.opendaylight.controller.config.persist.storage.file.xml.XmlFileStorageAdapter類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。