X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;ds=sidebyside;f=opendaylight%2Fmd-sal%2Fsal-binding-broker%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fmd%2Fsal%2Fbinding%2Fimpl%2FLazyDataTreeModification.java;h=e64d6795ba0eace8bb07f712e82ee59edb9734dd;hb=HEAD;hp=2a90f96646a7733056353f898beca3c08bdf3770;hpb=a54ec60368110d22794602343c934902f6833c65;p=controller.git diff --git a/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/impl/LazyDataTreeModification.java b/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/impl/LazyDataTreeModification.java deleted file mode 100644 index 2a90f96646..0000000000 --- a/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/impl/LazyDataTreeModification.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ -package org.opendaylight.controller.md.sal.binding.impl; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; -import java.util.Map.Entry; -import org.opendaylight.controller.md.sal.binding.api.DataObjectModification; -import org.opendaylight.controller.md.sal.binding.api.DataTreeIdentifier; -import org.opendaylight.controller.md.sal.binding.api.DataTreeModification; -import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType; -import org.opendaylight.yangtools.binding.data.codec.api.BindingCodecTreeNode; -import org.opendaylight.yangtools.yang.binding.DataObject; -import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; -import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidate; - -/** - * Lazily translated {@link DataTreeModification} based on {@link DataTreeCandidate}. - * - * {@link DataTreeModification} represents Data tree change event, - * but whole tree is not translated or resolved eagerly, but only child nodes - * which are directly accessed by user of data object modification. - * - */ -class LazyDataTreeModification implements DataTreeModification { - - private final DataTreeIdentifier path; - private final DataObjectModification rootNode; - - LazyDataTreeModification(final LogicalDatastoreType datastoreType, final InstanceIdentifier path, final BindingCodecTreeNode codec, final DataTreeCandidate domChange) { - this.path = new DataTreeIdentifier<>(datastoreType, path); - this.rootNode = LazyDataObjectModification.create(codec, domChange.getRootNode()); - } - - @Override - public DataObjectModification getRootNode() { - return rootNode; - } - - @Override - public DataTreeIdentifier getRootPath() { - return path; - } - - @SuppressWarnings({"unchecked", "rawtypes"}) - static DataTreeModification create(final BindingToNormalizedNodeCodec codec, final DataTreeCandidate domChange, - final LogicalDatastoreType datastoreType) { - final Entry, BindingCodecTreeNode> codecCtx = - codec.getSubtreeCodec(domChange.getRootPath()); - return (DataTreeModification) new LazyDataTreeModification(datastoreType, codecCtx.getKey(), codecCtx.getValue(), domChange); - } - - static Collection> from(final BindingToNormalizedNodeCodec codec, - final Collection domChanges, final LogicalDatastoreType datastoreType) { - final List> result = new ArrayList<>(domChanges.size()); - for (final DataTreeCandidate domChange : domChanges) { - result.add(LazyDataTreeModification.create(codec, domChange, datastoreType)); - } - return result; - } - -}