当前位置: 首页>>代码示例>>Java>>正文


Java DataChangeListener类代码示例

本文整理汇总了Java中org.opendaylight.controller.md.sal.binding.api.DataChangeListener的典型用法代码示例。如果您正苦于以下问题:Java DataChangeListener类的具体用法?Java DataChangeListener怎么用?Java DataChangeListener使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


DataChangeListener类属于org.opendaylight.controller.md.sal.binding.api包,在下文中一共展示了DataChangeListener类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testDataChangeListener

import org.opendaylight.controller.md.sal.binding.api.DataChangeListener; //导入依赖的package包/类
@SuppressWarnings({ "rawtypes", "unchecked" })
@Test
public void testDataChangeListener() throws Exception {
    DataChangeListener listener = mock(DataChangeListener.class);
    InstanceIdentifier<ListItem> wildCard = InstanceIdentifier.builder(ListenerTest.class)
            .child(ListItem.class).build();
    ListenerRegistration<DataChangeListener> reg = getDataBroker().registerDataChangeListener(
            LogicalDatastoreType.OPERATIONAL, wildCard, listener, AsyncDataBroker.DataChangeScope.SUBTREE);

    final ListItem item = writeListItem();

    ArgumentCaptor<AsyncDataChangeEvent> captor = ArgumentCaptor.forClass(AsyncDataChangeEvent.class);

    verify(listener, timeout(100)).onDataChanged(captor.capture());

    AsyncDataChangeEvent event = captor.getValue();
    assertEquals("createdData", 1, event.getCreatedData().size());
    assertEquals("ListItem", item, event.getCreatedData().values().iterator().next());
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:20,代码来源:Bug4513Test.java

示例2: registerDataChangeListeners

import org.opendaylight.controller.md.sal.binding.api.DataChangeListener; //导入依赖的package包/类
private List<Registration> registerDataChangeListeners() {
    Preconditions.checkNotNull(dataBroker);
    List<Registration> registrations = Lists.newArrayList();
    try {
        //Register listener for config updates and topology
        InstanceIdentifier<AclSpec> aclSpecIID = InstanceIdentifier.builder(AclSpec.class)
                .build();
        ListenerRegistration<DataChangeListener> registration = dataBroker.registerDataChangeListener(
                LogicalDatastoreType.CONFIGURATION,
                aclSpecIID, this, AsyncDataBroker.DataChangeScope.SUBTREE);
        LOG.debug("DataChangeListener registered with MD-SAL for path {}", aclSpecIID);
        registrations.add(registration);

    } catch (Exception e) {
        LOG.error("Exception reached {}", e);
    }
    return registrations;
}
 
开发者ID:sdnhub,项目名称:SDNHub_Opendaylight_Tutorial,代码行数:19,代码来源:TutorialACL.java

示例3: registerDataChangeListeners

import org.opendaylight.controller.md.sal.binding.api.DataChangeListener; //导入依赖的package包/类
private List<Registration> registerDataChangeListeners() {
    Preconditions.checkNotNull(dataBroker);
    List<Registration> registrations = Lists.newArrayList();
    try {
        //Register listener for config updates and topology
        InstanceIdentifier<TapSpec> tapSpecIID = InstanceIdentifier.builder(TapSpec.class)
                .build();
        ListenerRegistration<DataChangeListener> registration = dataBroker.registerDataChangeListener(
                LogicalDatastoreType.CONFIGURATION,
                tapSpecIID, this, AsyncDataBroker.DataChangeScope.SUBTREE);
        LOG.debug("DataChangeListener registered with MD-SAL for path {}", tapSpecIID);
        registrations.add(registration);

    } catch (Exception e) {
        LOG.error("Exception reached {}", e);
    }
    return registrations;
}
 
开发者ID:sdnhub,项目名称:SDNHub_Opendaylight_Tutorial,代码行数:19,代码来源:TutorialTapProvider.java

示例4: registerDataChangeListener

import org.opendaylight.controller.md.sal.binding.api.DataChangeListener; //导入依赖的package包/类
public ListenerRegistration<DataChangeListener> registerDataChangeListener(final LogicalDatastoreType store,
        final InstanceIdentifier<?> path, final DataChangeListener listener, final DataChangeScope triggeringScope) {
    final DOMDataChangeListener domDataChangeListener;

    if(listener instanceof ClusteredDataChangeListener) {
        domDataChangeListener = new TranslatingClusteredDataChangeInvoker(store, path, listener, triggeringScope);
    } else {
        domDataChangeListener = new TranslatingDataChangeInvoker(store, path, listener,
            triggeringScope);
    }
    final YangInstanceIdentifier domPath = codec.toYangInstanceIdentifierBlocking(path);
    final ListenerRegistration<DOMDataChangeListener> domRegistration = domDataBroker.registerDataChangeListener(store,
            domPath, domDataChangeListener, triggeringScope);
    return new ListenerRegistrationImpl(listener, domRegistration);
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:16,代码来源:AbstractForwardedDataBroker.java

示例5: TranslatingDataChangeInvoker

import org.opendaylight.controller.md.sal.binding.api.DataChangeListener; //导入依赖的package包/类
public TranslatingDataChangeInvoker(final LogicalDatastoreType store, final InstanceIdentifier<?> path,
        final DataChangeListener bindingDataChangeListener, final DataChangeScope triggeringScope) {
    this.store = store;
    this.path = path;
    this.bindingDataChangeListener = bindingDataChangeListener;
    this.triggeringScope = triggeringScope;
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:8,代码来源:AbstractForwardedDataBroker.java

示例6: TranslatingClusteredDataChangeInvoker

import org.opendaylight.controller.md.sal.binding.api.DataChangeListener; //导入依赖的package包/类
public TranslatingClusteredDataChangeInvoker(final LogicalDatastoreType store, final InstanceIdentifier<?> path,
                                             final DataChangeListener bindingDataChangeListener,
                                             final DataChangeScope triggeringScope) {
    super(store, path, bindingDataChangeListener, triggeringScope);
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:6,代码来源:AbstractForwardedDataBroker.java

示例7: ListenerRegistrationImpl

import org.opendaylight.controller.md.sal.binding.api.DataChangeListener; //导入依赖的package包/类
public ListenerRegistrationImpl(final DataChangeListener listener,
        final ListenerRegistration<DOMDataChangeListener> registration) {
    super(listener);
    this.registration = registration;
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:6,代码来源:AbstractForwardedDataBroker.java


注:本文中的org.opendaylight.controller.md.sal.binding.api.DataChangeListener类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。