当前位置: 首页>>代码示例>>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;未经允许,请勿转载。