• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java AsyncDataChangeEvent类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: putTopLevelOneNested

import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeEvent; //导入依赖的package包/类
@Override
public void putTopLevelOneNested(final DatastoreTestTask task) throws InterruptedException, ExecutionException {

    AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent();

    assertNotNull(change);

    /*
     * Created data must not contain nested-list item, since that is two-level deep.
     */
    assertNotContains(change.getCreatedData(), TOP_LEVEL,path(FOO, BAR));
    assertContains(change.getCreatedData(), path(FOO) );

    assertEmpty(change.getUpdatedData());
    assertEmpty(change.getRemovedPaths());

}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:18,代码来源:WildcardedScopeBaseTest.java


示例2: replaceTopLevelNestedChanged

import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeEvent; //导入依赖的package包/类
@Override
public void replaceTopLevelNestedChanged(final DatastoreTestTask task) throws InterruptedException,
        ExecutionException {

    AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent();
    assertNotNull(change);
    /*
     * Created data must NOT contain nested-list item since scope is base, and change is two
     * level deep.
     */
    assertNotContains(change.getCreatedData(), path(FOO, BAZ));
    assertContains(change.getUpdatedData(), path(FOO));
    assertNotContains(change.getUpdatedData(), TOP_LEVEL);
    /*
     * Removed data must NOT contain nested-list item since scope is base, and change is two
     * level deep.
     */
    assertNotContains(change.getRemovedPaths(), path(FOO, BAR));

}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:21,代码来源:WildcardedScopeBaseTest.java


示例3: nestedListExistsRootDeleted

import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeEvent; //导入依赖的package包/类
@Override
public void nestedListExistsRootDeleted(final DatastoreTestTask task) throws InterruptedException,
        ExecutionException {

    AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent();

    assertEmpty(change.getCreatedData());
    assertEmpty(change.getUpdatedData());

    assertNotContains(change.getUpdatedData(), TOP_LEVEL);
    /*
     *  Scope base listener event should contain top-level-list item and nested list path
     *  and should not contain baz, bar which are two-level deep
     */
    assertContains(change.getRemovedPaths(), path(FOO));
    assertNotContains(change.getRemovedPaths(),path(FOO, BAZ),path(FOO,BAR));
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:18,代码来源:WildcardedScopeBaseTest.java


示例4: replaceTopLevelNestedChanged

import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeEvent; //导入依赖的package包/类
@Override
public void replaceTopLevelNestedChanged(final DatastoreTestTask task) throws InterruptedException,
        ExecutionException {

    AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent();
    assertNotNull(change);
    /*
     * Created data must NOT contain nested-list item since scope is base, and change is two
     * level deep.
     */
    assertNotContains(change.getCreatedData(), path(FOO, BAZ));
    assertContains(change.getUpdatedData(), path(FOO),path(FOO).node(NestedList.QNAME));
    assertNotContains(change.getUpdatedData(), TOP_LEVEL);
    /*
     * Removed data must NOT contain nested-list item since scope is base, and change is two
     * level deep.
     */
    assertNotContains(change.getRemovedPaths(), path(FOO, BAR));

}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:21,代码来源:WildcardedScopeOneTest.java


示例5: dataChanged

import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeEvent; //导入依赖的package包/类
@SuppressWarnings("checkstyle:IllegalCatch")
private void dataChanged(Object message) {

    // Do nothing if notifications are not enabled
    if (!notificationsEnabled) {
        LOG.debug("Notifications not enabled for listener {} - dropping change notification", listener);
        return;
    }

    DataChanged reply = (DataChanged) message;
    AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> change = reply.getChange();

    LOG.debug("Sending change notification {} to listener {}", change, listener);

    notificationCount++;

    try {
        this.listener.onDataChanged(change);
    } catch (RuntimeException e) {
        LOG.error(String.format("Error notifying listener %s", this.listener), e);
    }

    if (isValidSender(getSender())) {
        getSender().tell(DataChangedReply.INSTANCE, getSelf());
    }
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:27,代码来源:DataChangeListener.java


示例6: testDataChangedWhenNotificationsAreEnabled

import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeEvent; //导入依赖的package包/类
@SuppressWarnings({ "rawtypes", "unchecked" })
@Test
public void testDataChangedWhenNotificationsAreEnabled() {
    new JavaTestKit(getSystem()) {
        {
            final AsyncDataChangeEvent mockChangeEvent = Mockito.mock(AsyncDataChangeEvent.class);
            final AsyncDataChangeListener mockListener = Mockito.mock(AsyncDataChangeListener.class);
            final Props props = DataChangeListener.props(mockListener, TEST_PATH);
            final ActorRef subject = getSystem().actorOf(props, "testDataChangedNotificationsEnabled");

            // Let the DataChangeListener know that notifications should be
            // enabled
            subject.tell(new EnableNotification(true, "test"), getRef());

            subject.tell(new DataChanged(mockChangeEvent), getRef());

            expectMsgClass(DataChangedReply.class);

            Mockito.verify(mockListener).onDataChanged(mockChangeEvent);
        }
    };
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:23,代码来源:DataChangeListenerTest.java


示例7: testDataChangedWhenNotificationsAreDisabled

import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeEvent; //导入依赖的package包/类
@SuppressWarnings({ "rawtypes", "unchecked" })
@Test
public void testDataChangedWhenNotificationsAreDisabled() {
    new JavaTestKit(getSystem()) {
        {
            final AsyncDataChangeEvent mockChangeEvent = Mockito.mock(AsyncDataChangeEvent.class);
            final AsyncDataChangeListener mockListener = Mockito.mock(AsyncDataChangeListener.class);
            final Props props = DataChangeListener.props(mockListener, TEST_PATH);
            final ActorRef subject = getSystem().actorOf(props, "testDataChangedNotificationsDisabled");

            subject.tell(new DataChanged(mockChangeEvent), getRef());

            new Within(duration("1 seconds")) {
                @Override
                protected void run() {
                    expectNoMsg();

                    Mockito.verify(mockListener, Mockito.never())
                            .onDataChanged(Mockito.any(AsyncDataChangeEvent.class));
                }
            };
        }
    };
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:25,代码来源:DataChangeListenerTest.java


示例8: testSeparateWrites

import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeEvent; //导入依赖的package包/类
@Test
public void testSeparateWrites() throws InterruptedException, TimeoutException, ExecutionException {

    DataBroker dataBroker = testContext.getDataBroker();

    final SettableFuture<AsyncDataChangeEvent<InstanceIdentifier<?>, DataObject>> eventFuture =
            SettableFuture.create();
    dataBroker.registerDataChangeListener(LogicalDatastoreType.OPERATIONAL, DEEP_WILDCARDED_PATH,
        dataChangeEvent -> eventFuture.set(dataChangeEvent), DataChangeScope.SUBTREE);

    final WriteTransaction transaction = dataBroker.newWriteOnlyTransaction();
    transaction.put(LogicalDatastoreType.OPERATIONAL, NODE_0_CWU_PATH, CWU, true);
    transaction.put(LogicalDatastoreType.OPERATIONAL, NODE_0_LVU_PATH, LVU, true);
    transaction.put(LogicalDatastoreType.OPERATIONAL, NODE_1_LVU_PATH, LVU, true);
    transaction.submit().get(5, TimeUnit.SECONDS);

    AsyncDataChangeEvent<InstanceIdentifier<?>, DataObject> event = eventFuture.get(1000, TimeUnit.MILLISECONDS);

    validateEvent(event);
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:21,代码来源:WildcardedDataChangeListenerTest.java


示例9: deleteChildListenParent

import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeEvent; //导入依赖的package包/类
@Test
public void deleteChildListenParent() throws InterruptedException, ExecutionException, TimeoutException {
    DataBroker dataBroker = testContext.getDataBroker();
    final WriteTransaction initTx = dataBroker.newWriteOnlyTransaction();

    initTx.put(LogicalDatastoreType.OPERATIONAL, LIST11_PATH, createList11(), true);
    initTx.submit().get(5, TimeUnit.SECONDS);

    final SettableFuture<AsyncDataChangeEvent<InstanceIdentifier<?>, DataObject>> event = SettableFuture.create();
    dataBroker.registerDataChangeListener(LogicalDatastoreType.OPERATIONAL, LIST11_PATH,
        change -> event.set(change), DataChangeScope.SUBTREE);

    final WriteTransaction deleteTx = dataBroker.newWriteOnlyTransaction();
    deleteTx.delete(LogicalDatastoreType.OPERATIONAL, LIST11_PATH.augmentation(List11SimpleAugment.class));
    deleteTx.submit().get(5, TimeUnit.SECONDS);

    AsyncDataChangeEvent<InstanceIdentifier<?>, DataObject> receivedEvent = event.get();
    assertFalse(receivedEvent.getRemovedPaths().contains(TLL_COMPLEX_AUGMENT_PATH));
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:20,代码来源:DeleteNestedAugmentationListenParentTest.java


示例10: leafOnlyAugmentationUpdatedTest

import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeEvent; //导入依赖的package包/类
@Test
public void leafOnlyAugmentationUpdatedTest() {
    WriteTransaction writeTx = getDataBroker().newWriteOnlyTransaction();
    writeTx.put(LogicalDatastoreType.CONFIGURATION, TOP, top());
    writeTx.put(LogicalDatastoreType.CONFIGURATION, TOP_FOO, topLevelList(new TopLevelListKey(TOP_FOO_KEY)));
    writeTx.put(LogicalDatastoreType.CONFIGURATION, SIMPLE_AUGMENT, leafOnlyUsesAugment("test leaf"));
    assertCommit(writeTx.submit());
    TestListener listener = createListener(LogicalDatastoreType.CONFIGURATION, SIMPLE_AUGMENT,
            AsyncDataBroker.DataChangeScope.SUBTREE);
    writeTx = getDataBroker().newWriteOnlyTransaction();
    writeTx.put(LogicalDatastoreType.CONFIGURATION, SIMPLE_AUGMENT, leafOnlyUsesAugment("test leaf changed"));
    assertCommit(writeTx.submit());
    AsyncDataChangeEvent<InstanceIdentifier<?>, DataObject> event = listener.event();
    assertContains(event.getUpdatedData(), SIMPLE_AUGMENT);
    assertContains(event.getOriginalData(), SIMPLE_AUGMENT);
    assertEmpty(event.getCreatedData());
    assertEmpty(event.getRemovedPaths());
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:19,代码来源:Bug1418AugmentationTest.java


示例11: leafOnlyAugmentationDeletedTest

import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeEvent; //导入依赖的package包/类
@Test
public void leafOnlyAugmentationDeletedTest() {
    WriteTransaction writeTx = getDataBroker().newWriteOnlyTransaction();
    writeTx.put(LogicalDatastoreType.CONFIGURATION, TOP, top());
    writeTx.put(LogicalDatastoreType.CONFIGURATION, TOP_FOO, topLevelList(new TopLevelListKey(TOP_FOO_KEY)));
    writeTx.put(LogicalDatastoreType.CONFIGURATION, SIMPLE_AUGMENT, leafOnlyUsesAugment("test leaf"));
    assertCommit(writeTx.submit());
    TestListener listener = createListener(LogicalDatastoreType.CONFIGURATION, SIMPLE_AUGMENT,
            AsyncDataBroker.DataChangeScope.SUBTREE);
    writeTx = getDataBroker().newWriteOnlyTransaction();
    writeTx.delete(LogicalDatastoreType.CONFIGURATION, SIMPLE_AUGMENT);
    assertCommit(writeTx.submit());
    AsyncDataChangeEvent<InstanceIdentifier<?>, DataObject> event = listener.event();
    assertContains(event.getRemovedPaths(), SIMPLE_AUGMENT);
    assertContains(event.getOriginalData(), SIMPLE_AUGMENT);
    assertEmpty(event.getCreatedData());
    assertEmpty(event.getUpdatedData());
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:19,代码来源:Bug1418AugmentationTest.java


示例12: complexAugmentationCreatedTest

import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeEvent; //导入依赖的package包/类
@Test
public void complexAugmentationCreatedTest() {
    TestListener listener = createListener(LogicalDatastoreType.CONFIGURATION, COMPLEX_AUGMENT,
            AsyncDataBroker.DataChangeScope.SUBTREE, false);
    WriteTransaction writeTx = getDataBroker().newWriteOnlyTransaction();
    writeTx.put(LogicalDatastoreType.CONFIGURATION, TOP, top());
    writeTx.put(LogicalDatastoreType.CONFIGURATION, TOP_FOO, topLevelList(new TopLevelListKey(TOP_FOO_KEY)));
    writeTx.put(LogicalDatastoreType.CONFIGURATION, COMPLEX_AUGMENT, complexUsesAugment(LIST_VIA_USES_KEY));
    assertCommit(writeTx.submit());
    AsyncDataChangeEvent<InstanceIdentifier<?>, DataObject> event = listener.event();
    assertContains(event.getCreatedData(), COMPLEX_AUGMENT);
    assertContains(event.getCreatedData(), COMPLEX_AUGMENT.child(ListViaUses.class, LIST_VIA_USES_KEY));
    assertEmpty(event.getUpdatedData());
    assertEmpty(event.getOriginalData());
    assertEmpty(event.getRemovedPaths());
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:17,代码来源:Bug1418AugmentationTest.java


示例13: complexAugmentationUpdatedTest

import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeEvent; //导入依赖的package包/类
@Test
public void complexAugmentationUpdatedTest() {
    WriteTransaction writeTx = getDataBroker().newWriteOnlyTransaction();
    writeTx.put(LogicalDatastoreType.CONFIGURATION, TOP, top());
    writeTx.put(LogicalDatastoreType.CONFIGURATION, TOP_FOO, topLevelList(new TopLevelListKey(TOP_FOO_KEY)));
    writeTx.put(LogicalDatastoreType.CONFIGURATION, COMPLEX_AUGMENT, complexUsesAugment(LIST_VIA_USES_KEY));
    assertCommit(writeTx.submit());
    TestListener listener = createListener(LogicalDatastoreType.CONFIGURATION, COMPLEX_AUGMENT,
            AsyncDataBroker.DataChangeScope.SUBTREE);
    writeTx = getDataBroker().newWriteOnlyTransaction();
    writeTx.put(LogicalDatastoreType.CONFIGURATION, COMPLEX_AUGMENT, complexUsesAugment(LIST_VIA_USES_KEY_MOD));
    assertCommit(writeTx.submit());
    AsyncDataChangeEvent<InstanceIdentifier<?>, DataObject> event = listener.event();
    assertContains(event.getUpdatedData(), COMPLEX_AUGMENT);
    assertContains(event.getCreatedData(), COMPLEX_AUGMENT.child(ListViaUses.class, LIST_VIA_USES_KEY_MOD));
    assertContains(event.getRemovedPaths(), COMPLEX_AUGMENT.child(ListViaUses.class, LIST_VIA_USES_KEY));
    assertContains(event.getOriginalData(), COMPLEX_AUGMENT);
    assertContains(event.getOriginalData(), COMPLEX_AUGMENT.child(ListViaUses.class, LIST_VIA_USES_KEY));
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:20,代码来源:Bug1418AugmentationTest.java


示例14: testDataChangeListener

import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeEvent; //导入依赖的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


示例15: writeTopWithListItemAugmentedListenTopSubtree

import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeEvent; //导入依赖的package包/类
@Test
public void writeTopWithListItemAugmentedListenTopSubtree() {
    TestListener listener = createListener(CONFIGURATION,TOP_PATH, DataChangeScope.SUBTREE, false);

    writeTopWithListItem(CONFIGURATION);

    AsyncDataChangeEvent<InstanceIdentifier<?>, DataObject> event = listener.event();

    assertContains(event.getCreatedData(), TOP_PATH);
    assertContains(event.getCreatedData(), path(TOP_FOO_KEY));
    assertContains(event.getCreatedData(), path(TOP_FOO_KEY, TreeComplexUsesAugment.class));
    assertContains(event.getCreatedData(), path(TOP_FOO_KEY, USES_ONE_KEY));
    assertContains(event.getCreatedData(), path(TOP_FOO_KEY, USES_TWO_KEY));

    assertEmpty(event.getUpdatedData());
    assertEmpty(event.getRemovedPaths());
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:18,代码来源:Bug1333DataChangeListenerTest.java


示例16: writeTopWithListItemAugmentedListenAugmentSubtreeWildcarded

import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeEvent; //导入依赖的package包/类
@Test
public void writeTopWithListItemAugmentedListenAugmentSubtreeWildcarded() {
    TestListener listener = createListener(CONFIGURATION,AUGMENT_WILDCARD, DataChangeScope.SUBTREE, false);
    writeTopWithListItem(CONFIGURATION);

    AsyncDataChangeEvent<InstanceIdentifier<?>, DataObject> event = listener.event();

    /*
     * Event should not contain parent nodes
     */
    assertNotContains(event.getCreatedData(), TOP_PATH, path(TOP_FOO_KEY));

    assertContains(event.getCreatedData(), path(TOP_FOO_KEY, TreeComplexUsesAugment.class));
    assertContains(event.getCreatedData(), path(TOP_FOO_KEY, USES_ONE_KEY));
    assertContains(event.getCreatedData(), path(TOP_FOO_KEY, USES_TWO_KEY));

    assertEmpty(event.getUpdatedData());
    assertEmpty(event.getRemovedPaths());
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:20,代码来源:Bug1333DataChangeListenerTest.java


示例17: deleteAugmentChildListenTopSubtree

import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeEvent; //导入依赖的package包/类
@Test
public void deleteAugmentChildListenTopSubtree() {
    writeTopWithListItem(CONFIGURATION);
    TestListener listener = createListener(CONFIGURATION, TOP_PATH, DataChangeScope.SUBTREE);
    InstanceIdentifier<?> deletePath = path(TOP_FOO_KEY,USES_ONE_KEY);
    deleteItem(CONFIGURATION,deletePath);

    AsyncDataChangeEvent<InstanceIdentifier<?>, DataObject> event = listener.event();


    assertEmpty(event.getCreatedData());

    assertContains(event.getRemovedPaths(), deletePath);

    assertContains(event.getUpdatedData(), TOP_PATH);
    assertContains(event.getUpdatedData(), path(TOP_FOO_KEY));
    assertContains(event.getUpdatedData(), path(TOP_FOO_KEY, TreeComplexUsesAugment.class));

    assertNotContains(event.getCreatedData(), path(TOP_FOO_KEY, USES_TWO_KEY));
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:21,代码来源:Bug1333DataChangeListenerTest.java


示例18: deleteAugmentChildListenAugmentSubtreeWildcarded

import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeEvent; //导入依赖的package包/类
@Test
public void deleteAugmentChildListenAugmentSubtreeWildcarded() {
    writeTopWithListItem(CONFIGURATION);

    TestListener listener = createListener(CONFIGURATION, AUGMENT_WILDCARD, DataChangeScope.SUBTREE, false);
    InstanceIdentifier<?> deletePath = path(TOP_FOO_KEY,USES_ONE_KEY);
    deleteItem(CONFIGURATION,deletePath);
    AsyncDataChangeEvent<InstanceIdentifier<?>, DataObject> event = listener.event();

    assertEmpty(event.getCreatedData());

    assertContains(event.getUpdatedData(), path(TOP_FOO_KEY, TreeComplexUsesAugment.class));

    /*
     * Event should not contain parent nodes
     */
    assertNotContains(event.getUpdatedData(), TOP_PATH, path(TOP_FOO_KEY));

    assertContains(event.getRemovedPaths(), deletePath);
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:21,代码来源:Bug1333DataChangeListenerTest.java


示例19: onDataChanged

import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeEvent; //导入依赖的package包/类
@Override
public void onDataChanged(final AsyncDataChangeEvent<InstanceIdentifier<?>, DataObject> changeEvent) {
    Preconditions.checkNotNull(changeEvent,"Async ChangeEvent can not be null!");

    /* All DataObjects for create */
    final Map<InstanceIdentifier<?>, DataObject> createdData = changeEvent.getCreatedData() != null
            ? changeEvent.getCreatedData() : Collections.<InstanceIdentifier<?>, DataObject> emptyMap();
    /* All DataObjects for remove */
    final Set<InstanceIdentifier<?>> removeData = changeEvent.getRemovedPaths() != null
            ? changeEvent.getRemovedPaths() : Collections.<InstanceIdentifier<?>> emptySet();
    /* All DataObjects for updates */
    final Map<InstanceIdentifier<?>, DataObject> updateData = changeEvent.getUpdatedData() != null
            ? changeEvent.getUpdatedData() : Collections.<InstanceIdentifier<?>, DataObject> emptyMap();
    /* All Original DataObjects */
    final Map<InstanceIdentifier<?>, DataObject> originalData = changeEvent.getOriginalData() != null
            ? changeEvent.getOriginalData() : Collections.<InstanceIdentifier<?>, DataObject> emptyMap();

    this.createData(createdData);
    this.updateData(updateData, originalData);
    this.removeData(removeData, originalData);
}
 
开发者ID:onfsdn,项目名称:atrium-odl,代码行数:22,代码来源:AbstractDataChangeListener.java


示例20: BridgeOperationalState

import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeEvent; //导入依赖的package包/类
public BridgeOperationalState(DataBroker db, AsyncDataChangeEvent<InstanceIdentifier<?>,
        DataObject> changes) {
    try (ReadOnlyTransaction transaction = db.newReadOnlyTransaction()) {
        Map<InstanceIdentifier<Node>, Node> nodeCreateOrUpdate =
                TransactUtils.extractCreatedOrUpdatedOrRemoved(changes, Node.class);
        if (nodeCreateOrUpdate != null) {
            for (Entry<InstanceIdentifier<Node>, Node> entry: nodeCreateOrUpdate.entrySet()) {
                CheckedFuture<Optional<Node>, ReadFailedException> nodeFuture =
                        transaction.read(LogicalDatastoreType.OPERATIONAL, entry.getKey());
                try {
                    Optional<Node> nodeOptional = nodeFuture.get();
                    if (nodeOptional.isPresent()) {
                        operationalNodes.put(entry.getKey(), nodeOptional.get());
                    }
                } catch (InterruptedException | ExecutionException e) {
                    LOG.warn("Error reading from datastore",e);
                }
            }
        }
    }
}
 
开发者ID:opendaylight,项目名称:ovsdb,代码行数:22,代码来源:BridgeOperationalState.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java JAnnotationArrayMember类代码示例发布时间:2022-05-22
下一篇:
Java BitmapCanvasProvider类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap