X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-common-impl%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fmd%2Fsal%2Fcommon%2Fimpl%2Futil%2Fcompat%2FDataNormalizationOperation.java;h=7c5c2ba0e090b85f1833308264b16abbc38e2d1f;hb=262f25762a55f26db800c8881819a200803b729c;hp=617697710449b32602682802d10dd2022f551ee2;hpb=79202e1fd05d2606b35e163f608fad9cce84b5d4;p=controller.git diff --git a/opendaylight/md-sal/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/util/compat/DataNormalizationOperation.java b/opendaylight/md-sal/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/util/compat/DataNormalizationOperation.java index 6176977104..7c5c2ba0e0 100644 --- a/opendaylight/md-sal/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/util/compat/DataNormalizationOperation.java +++ b/opendaylight/md-sal/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/util/compat/DataNormalizationOperation.java @@ -18,14 +18,15 @@ import java.util.Map.Entry; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; +import javax.xml.transform.dom.DOMSource; import org.opendaylight.yangtools.concepts.Identifiable; import org.opendaylight.yangtools.yang.common.QName; import org.opendaylight.yangtools.yang.data.api.CompositeNode; -import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.AugmentationIdentifier; -import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.NodeIdentifier; -import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.NodeIdentifierWithPredicates; -import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.NodeWithValue; -import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.PathArgument; +import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.AugmentationIdentifier; +import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier; +import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates; +import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeWithValue; +import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument; import org.opendaylight.yangtools.yang.data.api.Node; import org.opendaylight.yangtools.yang.data.api.SimpleNode; import org.opendaylight.yangtools.yang.data.api.schema.AnyXmlNode; @@ -40,6 +41,7 @@ import org.opendaylight.yangtools.yang.model.api.AnyXmlSchemaNode; import org.opendaylight.yangtools.yang.model.api.AugmentationSchema; import org.opendaylight.yangtools.yang.model.api.AugmentationTarget; import org.opendaylight.yangtools.yang.model.api.ChoiceCaseNode; +import org.opendaylight.yangtools.yang.model.api.ChoiceSchemaNode; import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode; import org.opendaylight.yangtools.yang.model.api.DataNodeContainer; import org.opendaylight.yangtools.yang.model.api.DataSchemaNode; @@ -54,6 +56,11 @@ import com.google.common.collect.FluentIterable; import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; +/** + * @deprecated This class provides compatibility between {@link CompositeNode} and {@link NormalizedNode}. + * Users of this class should use {@link NormalizedNode}s directly. + */ +@Deprecated public abstract class DataNormalizationOperation implements Identifiable { private final T identifier; @@ -588,7 +595,7 @@ public abstract class DataNormalizationOperation impleme private final ImmutableMap> byQName; private final ImmutableMap> byArg; - protected ChoiceNodeNormalization(final org.opendaylight.yangtools.yang.model.api.ChoiceNode schema) { + protected ChoiceNodeNormalization(final ChoiceSchemaNode schema) { super(new NodeIdentifier(schema.getQName()),schema); ImmutableMap.Builder> byQNameBuilder = ImmutableMap.builder(); ImmutableMap.Builder> byArgBuilder = ImmutableMap.builder(); @@ -645,10 +652,11 @@ public abstract class DataNormalizationOperation impleme @Override public NormalizedNode normalize( final Node legacyData ) { - NormalizedNodeAttrBuilder, AnyXmlNode> builder = + NormalizedNodeAttrBuilder builder = Builders.anyXmlBuilder().withNodeIdentifier( new NodeIdentifier( legacyData.getNodeType() ) ); - builder.withValue(legacyData); + // Will be removed +// builder.withValue(legacyData); return builder.build(); } @@ -666,8 +674,7 @@ public abstract class DataNormalizationOperation impleme private static final Optional findChildSchemaNode(final DataNodeContainer parent,final QName child) { DataSchemaNode potential = parent.getDataChildByName(child); if (potential == null) { - Iterable choices = FluentIterable.from( - parent.getChildNodes()).filter(org.opendaylight.yangtools.yang.model.api.ChoiceNode.class); + Iterable choices = FluentIterable.from(parent.getChildNodes()).filter(ChoiceSchemaNode.class); potential = findChoice(choices, child); } return Optional.fromNullable(potential); @@ -689,10 +696,9 @@ public abstract class DataNormalizationOperation impleme return fromDataSchemaNode(result); } - private static org.opendaylight.yangtools.yang.model.api.ChoiceNode findChoice( - final Iterable choices, final QName child) { - org.opendaylight.yangtools.yang.model.api.ChoiceNode foundChoice = null; - choiceLoop: for (org.opendaylight.yangtools.yang.model.api.ChoiceNode choice : choices) { + private static ChoiceSchemaNode findChoice(final Iterable choices, final QName child) { + ChoiceSchemaNode foundChoice = null; + choiceLoop: for (ChoiceSchemaNode choice : choices) { for (ChoiceCaseNode caze : choice.getCases()) { if (findChildSchemaNode(caze, child).isPresent()) { foundChoice = choice; @@ -759,8 +765,8 @@ public abstract class DataNormalizationOperation impleme return fromListSchemaNode((ListSchemaNode) potential); } else if (potential instanceof LeafSchemaNode) { return new LeafNormalization((LeafSchemaNode) potential); - } else if (potential instanceof org.opendaylight.yangtools.yang.model.api.ChoiceNode) { - return new ChoiceNodeNormalization((org.opendaylight.yangtools.yang.model.api.ChoiceNode) potential); + } else if (potential instanceof ChoiceSchemaNode) { + return new ChoiceNodeNormalization((ChoiceSchemaNode) potential); } else if (potential instanceof LeafListSchemaNode) { return fromLeafListSchemaNode((LeafListSchemaNode) potential); } else if (potential instanceof AnyXmlSchemaNode) {