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


Java DataObjectModification.getModifiedChildren方法代码示例

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


在下文中一共展示了DataObjectModification.getModifiedChildren方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: logDataTreeChangeEvent

import org.opendaylight.controller.md.sal.binding.api.DataObjectModification; //导入方法依赖的package包/类
private static synchronized void logDataTreeChangeEvent(final int eventNum,
        final Collection<DataTreeModification<TestExec>> changes) {
    LOG.debug("DsbenchmarkListener-onDataTreeChanged: Event {}", eventNum);

    for (DataTreeModification<TestExec> change : changes) {
        final DataObjectModification<TestExec> rootNode = change.getRootNode();
        final ModificationType modType = rootNode.getModificationType();
        final PathArgument changeId = rootNode.getIdentifier();
        final Collection<DataObjectModification<? extends DataObject>> modifications =
                rootNode.getModifiedChildren();

        LOG.debug("    changeId {}, modType {}, mods: {}", changeId, modType, modifications.size());

        for (DataObjectModification<? extends DataObject> mod : modifications) {
            LOG.debug("      mod-getDataAfter: {}", mod.getDataAfter());
        }
    }
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:19,代码来源:DsbenchmarkListener.java

示例2: extractDataObjectModifications

import org.opendaylight.controller.md.sal.binding.api.DataObjectModification; //导入方法依赖的package包/类
/**
 * Extract all the modifications affecting instances of {@code clazz} which are present in the given set of
 * modifications and satisfy the given filter.
 *
 * @param changes The changes to process.
 * @param paths The paths of the changes.
 * @param clazz The class we're interested in.
 * @param filter The filter the changes must satisfy.
 * @param <T> The type of changes we're interested in.
 * @return The modifications, mapped by instance identifier.
 */
private static <T extends DataObject> Map<InstanceIdentifier<T>, DataObjectModification<T>>
        extractDataObjectModifications(
        Collection<DataObjectModification<? extends DataObject>> changes,
        Collection<InstanceIdentifier<? extends DataObject>> paths, Class<T> clazz,
        Predicate<DataObjectModification<T>> filter) {
    Map<InstanceIdentifier<T>, DataObjectModification<T>> result = new HashMap<>();
    Queue<DataObjectModification<? extends DataObject>> remainingChanges = new LinkedList<>(changes);
    Queue<InstanceIdentifier<? extends DataObject>> remainingPaths = new LinkedList<>(paths);
    while (!remainingChanges.isEmpty()) {
        DataObjectModification<? extends DataObject> change = remainingChanges.remove();
        InstanceIdentifier<? extends DataObject> path = remainingPaths.remove();
        // Is the change relevant?
        if (clazz.isAssignableFrom(change.getDataType()) && filter.test((DataObjectModification<T>) change)) {
            result.put((InstanceIdentifier<T>) path, (DataObjectModification<T>) change);
        }
        // Add any children to the queue
        for (DataObjectModification<? extends DataObject> child : change.getModifiedChildren()) {
            remainingChanges.add(child);
            remainingPaths.add(extendPath(path, child));
        }
    }
    return result;
}
 
开发者ID:opendaylight,项目名称:netvirt,代码行数:35,代码来源:ChangeUtils.java

示例3: getChildMod

import org.opendaylight.controller.md.sal.binding.api.DataObjectModification; //导入方法依赖的package包/类
@Override
protected Map<InstanceIdentifier<LocalUcastMacs>, DataObjectModification<LocalUcastMacs>> getChildMod(
        final InstanceIdentifier<Node> parentIid,
        final DataObjectModification<Node> mod) {

    Map<InstanceIdentifier<LocalUcastMacs>, DataObjectModification<LocalUcastMacs>> result = new HashMap<>();
    DataObjectModification<HwvtepGlobalAugmentation> aug = mod.getModifiedAugmentation(
            HwvtepGlobalAugmentation.class);
    if (aug != null && getModificationType(aug) != null) {
        Collection<DataObjectModification<? extends DataObject>> children = aug.getModifiedChildren();
        children.stream()
            .filter(childMod -> getModificationType(childMod) != null)
            .filter(childMod -> childMod.getDataType() == LocalUcastMacs.class)
            .forEach(childMod -> {
                LocalUcastMacs afterMac = (LocalUcastMacs) childMod.getDataAfter();
                LocalUcastMacs mac = afterMac != null ? afterMac : (LocalUcastMacs)childMod.getDataBefore();
                InstanceIdentifier<LocalUcastMacs> iid = parentIid
                    .augmentation(HwvtepGlobalAugmentation.class)
                    .child(LocalUcastMacs.class, mac.getKey());
                result.put(iid, (DataObjectModification<LocalUcastMacs>) childMod);
            });
    }
    return result;
}
 
开发者ID:opendaylight,项目名称:netvirt,代码行数:25,代码来源:LocalUcastMacListener.java

示例4: onNeighborsChanged

import org.opendaylight.controller.md.sal.binding.api.DataObjectModification; //导入方法依赖的package包/类
synchronized void onNeighborsChanged(final DataObjectModification<Neighbors> dataObjectModification) {
    for (final DataObjectModification<? extends DataObject> neighborModification :
            dataObjectModification.getModifiedChildren()) {
        switch (neighborModification.getModificationType()) {
            case DELETE:
                onNeighborRemoved((Neighbor) neighborModification.getDataBefore());
                break;
            case SUBTREE_MODIFIED:
            case WRITE:
                onNeighborModified((Neighbor) neighborModification.getDataAfter());
                break;
            default:
                break;
        }
    }
}
 
开发者ID:opendaylight,项目名称:bgpcep,代码行数:17,代码来源:BGPClusterSingletonService.java

示例5: onDataTreeChanged

import org.opendaylight.controller.md.sal.binding.api.DataObjectModification; //导入方法依赖的package包/类
@Override
public synchronized void onDataTreeChanged(final Collection<DataTreeModification<Bgp>> changes) {
    if (this.closed) {
        LOG.trace("BGP Deployer was already closed, skipping changes.");
        return;
    }
    for (final DataTreeModification<Bgp> dataTreeModification : changes) {
        final InstanceIdentifier<Bgp> rootIdentifier = dataTreeModification.getRootPath().getRootIdentifier();
        final DataObjectModification<Bgp> rootNode = dataTreeModification.getRootNode();
        LOG.trace("BGP configuration has changed: {}", rootNode);
        for (final DataObjectModification<? extends DataObject> dataObjectModification :
                rootNode.getModifiedChildren()) {
            if (dataObjectModification.getDataType().equals(Global.class)) {
                onGlobalChanged((DataObjectModification<Global>) dataObjectModification, rootIdentifier);
            } else if (dataObjectModification.getDataType().equals(Neighbors.class)) {
                onNeighborsChanged((DataObjectModification<Neighbors>) dataObjectModification, rootIdentifier);
            }
        }
    }
}
 
开发者ID:opendaylight,项目名称:bgpcep,代码行数:21,代码来源:BgpDeployerImpl.java

示例6: extractDataObjectModifications

import org.opendaylight.controller.md.sal.binding.api.DataObjectModification; //导入方法依赖的package包/类
/**
 * Extract all the modifications affecting instances of {@code clazz} which are present in the given set of
 * modifications and satisfy the given filter.
 *
 * @param changes The changes to process.
 * @param paths The paths of the changes.
 * @param clazz The class we're interested in.
 * @param filter The filter the changes must satisfy.
 * @param <T> The type of changes we're interested in.
 * @return The modifications, mapped by instance identifier.
 */
private static <T extends DataObject> Map<InstanceIdentifier<T>, DataObjectModification<T>>
    extractDataObjectModifications(
        Collection<DataObjectModification<? extends DataObject>> changes,
        Collection<InstanceIdentifier<? extends DataObject>> paths, Class<T> clazz,
        Predicate<DataObjectModification<T>> filter) {
    Map<InstanceIdentifier<T>, DataObjectModification<T>> result = new HashMap<>();
    Queue<DataObjectModification<? extends DataObject>> remainingChanges = new LinkedList<>(changes);
    Queue<InstanceIdentifier<? extends DataObject>> remainingPaths = new LinkedList<>(paths);
    while (!remainingChanges.isEmpty()) {
        DataObjectModification<? extends DataObject> change = remainingChanges.remove();
        InstanceIdentifier<? extends DataObject> path = remainingPaths.remove();
        // Is the change relevant?
        if (clazz.isAssignableFrom(change.getDataType()) && filter.test((DataObjectModification<T>) change)) {
            result.put((InstanceIdentifier<T>) path, (DataObjectModification<T>) change);
        }
        // Add any children to the queue
        for (DataObjectModification<? extends DataObject> child : change.getModifiedChildren()) {
            remainingChanges.add(child);
            remainingPaths.add(extendPath(path, child));
        }
    }
    return result;
}
 
开发者ID:opendaylight,项目名称:ovsdb,代码行数:35,代码来源:TransactUtils.java

示例7: formatModification

import org.opendaylight.controller.md.sal.binding.api.DataObjectModification; //导入方法依赖的package包/类
private <T extends DataObject> void formatModification(@Nonnull final StringBuilder messageBuilder,
        @Nonnull final DataObjectModification<T> objectModification) {
    final String typeName = objectModification.getDataType().getSimpleName();

    switch (objectModification.getModificationType()) {
        case SUBTREE_MODIFIED:
            for (final DataObjectModification<? extends DataObject> child :
                    objectModification.getModifiedChildren()) {
                formatModification(messageBuilder, child);
            }
            break;
        case WRITE:
            messageBuilder.append("\n");
            messageBuilder.append("WRITE: type: ").append(typeName).append("\n");
            final T dataAfter = objectModification.getDataAfter();
            messageBuilder.append(dataAfter.toString());
            break;
        case DELETE:
            messageBuilder.append("\n");
            messageBuilder.append("DELETE: type: ").append(typeName).append("\n");
            final T dataBefore = objectModification.getDataBefore();
            messageBuilder.append(dataBefore.toString());
            break;
        default:
            LOG.warn("unknown modification type: {}", typeName);
            break;
    }
}
 
开发者ID:opendaylight,项目名称:neutron,代码行数:29,代码来源:NeutronLogger.java

示例8: handleChangedNode

import org.opendaylight.controller.md.sal.binding.api.DataObjectModification; //导入方法依赖的package包/类
private void handleChangedNode(final DataObjectModification<?> changedNode, final InstanceIdentifier<?> iid,
        final Set<InstanceIdentifier<ReportedLsp>> lsps, final Set<InstanceIdentifier<Node>> nodes,
        final Map<InstanceIdentifier<?>, DataObject> original, final Map<InstanceIdentifier<?>, DataObject> updated,
        final Map<InstanceIdentifier<?>, DataObject> created) {

    // Categorize reported identifiers
    categorizeIdentifier(iid, lsps, nodes);

    // Get the subtrees
    switch (changedNode.getModificationType()) {
        case DELETE:
            original.put(iid, changedNode.getDataBefore());
            break;
        case SUBTREE_MODIFIED:
            original.put(iid, changedNode.getDataBefore());
            updated.put(iid, changedNode.getDataAfter());
            break;
        case WRITE:
            created.put(iid, changedNode.getDataAfter());
            break;
        default:
            throw new IllegalArgumentException("Unhandled modification type " + changedNode.getModificationType());
    }

    for (DataObjectModification<? extends DataObject> child : changedNode.getModifiedChildren()) {
        final List<PathArgument> pathArguments = new ArrayList<>();
        for (PathArgument pathArgument : iid.getPathArguments()) {
            pathArguments.add(pathArgument);
        }
        pathArguments.add(child.getIdentifier());
        final InstanceIdentifier<?> childIID = InstanceIdentifier.create(pathArguments);
        handleChangedNode(child, childIID, lsps, nodes, original, updated, created);
    }
}
 
开发者ID:opendaylight,项目名称:bgpcep,代码行数:35,代码来源:NodeChangedListener.java


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