From 331d878a4ed6b881fd1543c54324fa6a803d29ae Mon Sep 17 00:00:00 2001 From: Robert Varga Date: Wed, 11 Mar 2015 10:59:11 +0100 Subject: [PATCH] BUG-1513: migrate users to ChoiceSchemaNode This migrates all users to the new interface name, cleaning them up as the data.api and model.api name clash is resolved. Change-Id: Ibdc317d5ff86c6a895cccdacf6dfea1fb005d9b6 Signed-off-by: Robert Varga --- .../xml/codec/XmlDocumentUtils.java | 24 +++++++++---------- .../compat/DataNormalizationOperation.java | 17 +++++++------ .../sal/dom/broker/util/YangSchemaUtils.java | 8 +++---- .../netconf/util/InstanceIdToNodes.java | 17 +++++++------ .../controller/sal/rest/impl/JsonMapper.java | 6 ++--- .../sal/restconf/impl/ControllerContext.java | 18 +++++++------- .../sal/rest/doc/impl/ModelGenerator.java | 14 +++++------ .../netconf/cli/reader/AbstractReader.java | 6 ++--- .../cli/reader/custom/EditContentReader.java | 4 ++-- .../netconf/cli/reader/impl/ChoiceReader.java | 12 +++++----- .../cli/reader/impl/GenericReader.java | 6 ++--- .../writer/impl/ChoiceNodeCliSerializer.java | 7 +++--- ...utFromNormalizedNodeSerializerFactory.java | 5 ++-- .../impl/NodeCliSerializerDispatcher.java | 6 ++--- .../cli/writer/impl/NormalizedNodeWriter.java | 6 ++--- 15 files changed, 78 insertions(+), 78 deletions(-) diff --git a/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/xml/codec/XmlDocumentUtils.java b/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/xml/codec/XmlDocumentUtils.java index 8af6a3140b..79075b38b7 100644 --- a/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/xml/codec/XmlDocumentUtils.java +++ b/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/xml/codec/XmlDocumentUtils.java @@ -22,7 +22,7 @@ import org.opendaylight.yangtools.yang.data.impl.SimpleNodeTOImpl; import org.opendaylight.yangtools.yang.data.impl.codec.TypeDefinitionAwareCodec; import org.opendaylight.yangtools.yang.data.impl.codec.xml.XmlCodecProvider; import org.opendaylight.yangtools.yang.model.api.ChoiceCaseNode; -import org.opendaylight.yangtools.yang.model.api.ChoiceNode; +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; @@ -76,7 +76,7 @@ public class XmlDocumentUtils { } public static final QName OPERATION_ATTRIBUTE_QNAME = QName.create(URI.create("urn:ietf:params:xml:ns:netconf:base:1.0"), null, "operation"); - private static final Logger logger = LoggerFactory.getLogger(XmlDocumentUtils.class); + private static final Logger LOG = LoggerFactory.getLogger(XmlDocumentUtils.class); private static final XMLOutputFactory FACTORY = XMLOutputFactory.newFactory(); /** @@ -107,7 +107,7 @@ public class XmlDocumentUtils { writer.close(); return (Document)result.getNode(); } catch (XMLStreamException e) { - logger.error("Failed to serialize data {}", data, e); + LOG.error("Failed to serialize data {}", data, e); return null; } } @@ -151,23 +151,23 @@ public class XmlDocumentUtils { String text = xmlElement.getTextContent(); Object value = null; if (codec != null) { - logger.debug("toSimpleNodeWithType: found codec, deserializing text {}", text); + LOG.debug("toSimpleNodeWithType: found codec, deserializing text {}", text); value = codec.deserialize(text); } final TypeDefinition baseType = XmlUtils.resolveBaseTypeFrom(schema.getType()); if (baseType instanceof InstanceIdentifierType) { - logger.debug("toSimpleNodeWithType: base type of node is instance identifier, deserializing element", xmlElement); + LOG.debug("toSimpleNodeWithType: base type of node is instance identifier, deserializing element", xmlElement); value = InstanceIdentifierForXmlCodec.deserialize(xmlElement,schemaCtx); } else if(baseType instanceof IdentityrefTypeDefinition){ - logger.debug("toSimpleNodeWithType: base type of node is IdentityrefTypeDefinition, deserializing element", xmlElement); + LOG.debug("toSimpleNodeWithType: base type of node is IdentityrefTypeDefinition, deserializing element", xmlElement); value = InstanceIdentifierForXmlCodec.toIdentity(xmlElement.getTextContent(), xmlElement, schemaCtx); } if (value == null) { - logger.debug("toSimpleNodeWithType: no type found for element, returning just the text string value of element {}", xmlElement); + LOG.debug("toSimpleNodeWithType: no type found for element, returning just the text string value of element {}", xmlElement); value = xmlElement.getTextContent(); } @@ -181,18 +181,18 @@ public class XmlDocumentUtils { String text = xmlElement.getTextContent(); Object value = null; if (codec != null) { - logger.debug("toSimpleNodeWithType: found codec, deserializing text {}", text); + LOG.debug("toSimpleNodeWithType: found codec, deserializing text {}", text); value = codec.deserialize(text); } final TypeDefinition baseType = XmlUtils.resolveBaseTypeFrom(schema.getType()); if (baseType instanceof InstanceIdentifierType) { - logger.debug("toSimpleNodeWithType: base type of node is instance identifier, deserializing element", xmlElement); + LOG.debug("toSimpleNodeWithType: base type of node is instance identifier, deserializing element", xmlElement); value = InstanceIdentifierForXmlCodec.deserialize(xmlElement,schemaCtx); } if (value == null) { - logger.debug("toSimpleNodeWithType: no type found for element, returning just the text string value of element {}", xmlElement); + LOG.debug("toSimpleNodeWithType: no type found for element, returning just the text string value of element {}", xmlElement); value = xmlElement.getTextContent(); } @@ -229,8 +229,8 @@ public class XmlDocumentUtils { for (DataSchemaNode dsn : dataSchemaNode) { if (qname.isEqualWithoutRevision(dsn.getQName())) { return Optional. of(dsn); - } else if (dsn instanceof ChoiceNode) { - for (ChoiceCaseNode choiceCase : ((ChoiceNode) dsn).getCases()) { + } else if (dsn instanceof ChoiceSchemaNode) { + for (ChoiceCaseNode choiceCase : ((ChoiceSchemaNode) dsn).getCases()) { Optional foundDsn = findFirstSchema(qname, choiceCase.getChildNodes()); if (foundDsn != null && foundDsn.isPresent()) { return foundDsn; 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 a8719a8753..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 @@ -41,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; @@ -594,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(); @@ -673,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); @@ -696,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; @@ -766,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) { diff --git a/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/util/YangSchemaUtils.java b/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/util/YangSchemaUtils.java index 970bb02899..238ad100e4 100644 --- a/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/util/YangSchemaUtils.java +++ b/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/util/YangSchemaUtils.java @@ -22,7 +22,7 @@ import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument; import org.opendaylight.yangtools.yang.model.api.AugmentationSchema; import org.opendaylight.yangtools.yang.model.api.ChoiceCaseNode; -import org.opendaylight.yangtools.yang.model.api.ChoiceNode; +import org.opendaylight.yangtools.yang.model.api.ChoiceSchemaNode; import org.opendaylight.yangtools.yang.model.api.ConstraintDefinition; import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode; import org.opendaylight.yangtools.yang.model.api.DataNodeContainer; @@ -93,8 +93,8 @@ public final class YangSchemaUtils { private static DataSchemaNode searchInChoices(final DataNodeContainer node, final QName arg) { for (DataSchemaNode child : node.getChildNodes()) { - if (child instanceof ChoiceNode) { - ChoiceNode choiceNode = (ChoiceNode) child; + if (child instanceof ChoiceSchemaNode) { + ChoiceSchemaNode choiceNode = (ChoiceSchemaNode) child; DataSchemaNode potential = searchInCases(choiceNode, arg); if (potential != null) { return potential; @@ -104,7 +104,7 @@ public final class YangSchemaUtils { return null; } - private static DataSchemaNode searchInCases(final ChoiceNode choiceNode, final QName arg) { + private static DataSchemaNode searchInCases(final ChoiceSchemaNode choiceNode, final QName arg) { Set cases = choiceNode.getCases(); for (ChoiceCaseNode caseNode : cases) { DataSchemaNode node = caseNode.getDataChildByName(arg); diff --git a/opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/util/InstanceIdToNodes.java b/opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/util/InstanceIdToNodes.java index 30a7efaa56..d0b9efc8c0 100644 --- a/opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/util/InstanceIdToNodes.java +++ b/opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/util/InstanceIdToNodes.java @@ -51,6 +51,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; @@ -404,7 +405,7 @@ public abstract class InstanceIdToNodes implements Ident 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())); final ImmutableMap.Builder> byArgBuilder = ImmutableMap.builder(); @@ -460,8 +461,7 @@ public abstract class InstanceIdToNodes implements Ident private static Optional findChildSchemaNode(final DataNodeContainer parent, final QName child) { DataSchemaNode potential = parent.getDataChildByName(child); if (potential == null) { - final Iterable choices = FluentIterable.from( - parent.getChildNodes()).filter(org.opendaylight.yangtools.yang.model.api.ChoiceNode.class); + final Iterable choices = FluentIterable.from(parent.getChildNodes()).filter(ChoiceSchemaNode.class); potential = findChoice(choices, child); } return Optional.fromNullable(potential); @@ -481,11 +481,10 @@ public abstract class InstanceIdToNodes implements Ident 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; + private static ChoiceSchemaNode findChoice(final Iterable choices, final QName child) { + org.opendaylight.yangtools.yang.model.api.ChoiceSchemaNode foundChoice = null; choiceLoop: - for (final org.opendaylight.yangtools.yang.model.api.ChoiceNode choice : choices) { + for (final ChoiceSchemaNode choice : choices) { for (final ChoiceCaseNode caze : choice.getCases()) { if (findChildSchemaNode(caze, child).isPresent()) { foundChoice = choice; @@ -545,8 +544,8 @@ public abstract class InstanceIdToNodes implements Ident 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) { diff --git a/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/impl/JsonMapper.java b/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/impl/JsonMapper.java index 863de10325..3f014124ff 100644 --- a/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/impl/JsonMapper.java +++ b/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/impl/JsonMapper.java @@ -32,7 +32,7 @@ import org.opendaylight.yangtools.yang.data.api.Node; import org.opendaylight.yangtools.yang.data.api.SimpleNode; import org.opendaylight.yangtools.yang.model.api.AnyXmlSchemaNode; import org.opendaylight.yangtools.yang.model.api.ChoiceCaseNode; -import org.opendaylight.yangtools.yang.model.api.ChoiceNode; +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; @@ -176,8 +176,8 @@ class JsonMapper { if (node.getNodeType().equals(dsn.getQName())) { return dsn; } - if (dsn instanceof ChoiceNode) { - for (ChoiceCaseNode choiceCase : ((ChoiceNode) dsn).getCases()) { + if (dsn instanceof ChoiceSchemaNode) { + for (ChoiceCaseNode choiceCase : ((ChoiceSchemaNode) dsn).getCases()) { DataSchemaNode foundDsn = findFirstSchemaForNode(node, choiceCase.getChildNodes()); if (foundDsn != null) { return foundDsn; diff --git a/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/restconf/impl/ControllerContext.java b/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/restconf/impl/ControllerContext.java index c4d46a7551..6a2aae2f7d 100644 --- a/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/restconf/impl/ControllerContext.java +++ b/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/restconf/impl/ControllerContext.java @@ -52,7 +52,7 @@ import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgum import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode; import org.opendaylight.yangtools.yang.model.api.AnyXmlSchemaNode; import org.opendaylight.yangtools.yang.model.api.ChoiceCaseNode; -import org.opendaylight.yangtools.yang.model.api.ChoiceNode; +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; @@ -445,7 +445,7 @@ public class ControllerContext implements SchemaContextListener { return null; } - private static DataSchemaNode childByQName(final ChoiceNode container, final QName name) { + private static DataSchemaNode childByQName(final ChoiceSchemaNode container, final QName name) { for (final ChoiceCaseNode caze : container.getCases()) { final DataSchemaNode ret = ControllerContext.childByQName(caze, name); if (ret != null) { @@ -480,8 +480,8 @@ public class ControllerContext implements SchemaContextListener { final DataSchemaNode ret = container.getDataChildByName(name); if (ret == null) { for (final DataSchemaNode node : container.getChildNodes()) { - if ((node instanceof ChoiceNode)) { - final ChoiceNode choiceNode = ((ChoiceNode) node); + if ((node instanceof ChoiceSchemaNode)) { + final ChoiceSchemaNode choiceNode = ((ChoiceSchemaNode) node); final DataSchemaNode childByQName = ControllerContext.childByQName(choiceNode, name); if (childByQName != null) { return childByQName; @@ -708,9 +708,9 @@ public class ControllerContext implements SchemaContextListener { return instantiatedDataNodeContainers; } - private static final Function> CHOICE_FUNCTION = new Function>() { + private static final Function> CHOICE_FUNCTION = new Function>() { @Override - public Set apply(final ChoiceNode node) { + public Set apply(final ChoiceSchemaNode node) { return node.getCases(); } }; @@ -735,7 +735,7 @@ public class ControllerContext implements SchemaContextListener { } } - final Iterable choiceNodes = Iterables.filter(container.getChildNodes(), ChoiceNode.class); + final Iterable choiceNodes = Iterables.filter(container.getChildNodes(), ChoiceSchemaNode.class); final Iterable> map = Iterables.transform(choiceNodes, CHOICE_FUNCTION); final Iterable allCases = Iterables. concat(map); @@ -922,8 +922,8 @@ public class ControllerContext implements SchemaContextListener { private static DataSchemaNode childByQName(final Object container, final QName name) { if (container instanceof ChoiceCaseNode) { return childByQName((ChoiceCaseNode) container, name); - } else if (container instanceof ChoiceNode) { - return childByQName((ChoiceNode) container, name); + } else if (container instanceof ChoiceSchemaNode) { + return childByQName((ChoiceSchemaNode) container, name); } else if (container instanceof ContainerSchemaNode) { return childByQName((ContainerSchemaNode) container, name); } else if (container instanceof ListSchemaNode) { diff --git a/opendaylight/md-sal/sal-rest-docgen/src/main/java/org/opendaylight/controller/sal/rest/doc/impl/ModelGenerator.java b/opendaylight/md-sal/sal-rest-docgen/src/main/java/org/opendaylight/controller/sal/rest/doc/impl/ModelGenerator.java index 3b503ebba3..65c835723d 100644 --- a/opendaylight/md-sal/sal-rest-docgen/src/main/java/org/opendaylight/controller/sal/rest/doc/impl/ModelGenerator.java +++ b/opendaylight/md-sal/sal-rest-docgen/src/main/java/org/opendaylight/controller/sal/rest/doc/impl/ModelGenerator.java @@ -27,7 +27,7 @@ import org.opendaylight.controller.sal.rest.doc.model.builder.OperationBuilder; import org.opendaylight.yangtools.yang.common.QName; import org.opendaylight.yangtools.yang.model.api.AnyXmlSchemaNode; import org.opendaylight.yangtools.yang.model.api.ChoiceCaseNode; -import org.opendaylight.yangtools.yang.model.api.ChoiceNode; +import org.opendaylight.yangtools.yang.model.api.ChoiceSchemaNode; import org.opendaylight.yangtools.yang.model.api.ConstraintDefinition; import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode; import org.opendaylight.yangtools.yang.model.api.DataNodeContainer; @@ -69,7 +69,7 @@ import org.slf4j.LoggerFactory; */ public class ModelGenerator { - private static Logger _logger = LoggerFactory.getLogger(ModelGenerator.class); + private static final Logger LOG = LoggerFactory.getLogger(ModelGenerator.class); private static final String BASE_64 = "base64"; private static final String BINARY_ENCODING_KEY = "binaryEncoding"; @@ -201,12 +201,12 @@ public class ModelGenerator { String moduleName = module.getName(); Set idNodes = module.getIdentities(); - _logger.debug("Processing Identities for module {} . Found {} identity statements", moduleName, idNodes.size()); + LOG.debug("Processing Identities for module {} . Found {} identity statements", moduleName, idNodes.size()); for (IdentitySchemaNode idNode : idNodes) { JSONObject identityObj = new JSONObject(); String identityName = idNode.getQName().getLocalName(); - _logger.debug("Processing Identity: {}", identityName); + LOG.debug("Processing Identity: {}", identityName); identityObj.put(ID_KEY, identityName); identityObj.put(DESCRIPTION_KEY, idNode.getDescription()); @@ -351,8 +351,8 @@ public class ModelGenerator { } else if (node instanceof LeafListSchemaNode) { property = processLeafListNode((LeafListSchemaNode) node); - } else if (node instanceof ChoiceNode) { - property = processChoiceNode((ChoiceNode) node, moduleName, models, schemaContext); + } else if (node instanceof ChoiceSchemaNode) { + property = processChoiceNode((ChoiceSchemaNode) node, moduleName, models, schemaContext); } else if (node instanceof AnyXmlSchemaNode) { property = processAnyXMLNode((AnyXmlSchemaNode) node); @@ -398,7 +398,7 @@ public class ModelGenerator { * @throws JSONException * @throws IOException */ - private JSONObject processChoiceNode(ChoiceNode choiceNode, String moduleName, JSONObject models, + private JSONObject processChoiceNode(ChoiceSchemaNode choiceNode, String moduleName, JSONObject models, SchemaContext schemaContext) throws JSONException, IOException { Set cases = choiceNode.getCases(); diff --git a/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/reader/AbstractReader.java b/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/reader/AbstractReader.java index 6131eef4bc..0c5e276995 100644 --- a/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/reader/AbstractReader.java +++ b/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/reader/AbstractReader.java @@ -17,7 +17,7 @@ import jline.console.completer.NullCompleter; import org.opendaylight.controller.netconf.cli.io.ConsoleContext; import org.opendaylight.controller.netconf.cli.io.ConsoleIO; import org.opendaylight.yangtools.yang.data.api.Node; -import org.opendaylight.yangtools.yang.model.api.ChoiceNode; +import org.opendaylight.yangtools.yang.model.api.ChoiceSchemaNode; import org.opendaylight.yangtools.yang.model.api.DataSchemaNode; import org.opendaylight.yangtools.yang.model.api.LeafSchemaNode; import org.opendaylight.yangtools.yang.model.api.SchemaContext; @@ -88,8 +88,8 @@ public abstract class AbstractReader implements Reader String defaultValue = null; if (schemaNode instanceof LeafSchemaNode) { defaultValue = ((LeafSchemaNode) schemaNode).getDefault(); - } else if (schemaNode instanceof ChoiceNode) { - defaultValue = ((ChoiceNode) schemaNode).getDefaultCase(); + } else if (schemaNode instanceof ChoiceSchemaNode) { + defaultValue = ((ChoiceSchemaNode) schemaNode).getDefaultCase(); } return Optional.fromNullable(defaultValue); diff --git a/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/reader/custom/EditContentReader.java b/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/reader/custom/EditContentReader.java index af43d37909..bdd9cd0f49 100644 --- a/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/reader/custom/EditContentReader.java +++ b/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/reader/custom/EditContentReader.java @@ -18,7 +18,7 @@ import org.opendaylight.controller.netconf.cli.reader.impl.ChoiceReader; import org.opendaylight.yangtools.yang.common.QName; import org.opendaylight.yangtools.yang.data.api.Node; import org.opendaylight.yangtools.yang.model.api.ChoiceCaseNode; -import org.opendaylight.yangtools.yang.model.api.ChoiceNode; +import org.opendaylight.yangtools.yang.model.api.ChoiceSchemaNode; import org.opendaylight.yangtools.yang.model.api.SchemaContext; public class EditContentReader extends ChoiceReader { @@ -33,7 +33,7 @@ public class EditContentReader extends ChoiceReader { } @Override - public List> readWithContext(final ChoiceNode choiceNode) throws IOException, ReadingException { + public List> readWithContext(final ChoiceSchemaNode choiceNode) throws IOException, ReadingException { Preconditions.checkState(choiceNode.getQName().equals(EDIT_CONTENT_QNAME), "Unexpected choice %s, expected %s", choiceNode, EDIT_CONTENT_QNAME); final ChoiceCaseNode selectedCase = choiceNode.getCaseNodeByName(CONFIG_QNAME); Preconditions.checkNotNull(selectedCase, "Unexpected choice %s, expected %s that contains %s", choiceNode, EDIT_CONTENT_QNAME, CONFIG_QNAME); diff --git a/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/reader/impl/ChoiceReader.java b/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/reader/impl/ChoiceReader.java index 1e69fbb774..ef0396f4cc 100644 --- a/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/reader/impl/ChoiceReader.java +++ b/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/reader/impl/ChoiceReader.java @@ -28,7 +28,7 @@ import org.opendaylight.controller.netconf.cli.reader.ReadingException; import org.opendaylight.yangtools.yang.data.api.Node; import org.opendaylight.yangtools.yang.data.impl.NodeFactory; import org.opendaylight.yangtools.yang.model.api.ChoiceCaseNode; -import org.opendaylight.yangtools.yang.model.api.ChoiceNode; +import org.opendaylight.yangtools.yang.model.api.ChoiceSchemaNode; import org.opendaylight.yangtools.yang.model.api.DataSchemaNode; import org.opendaylight.yangtools.yang.model.api.LeafSchemaNode; import org.opendaylight.yangtools.yang.model.api.SchemaContext; @@ -36,7 +36,7 @@ import org.opendaylight.yangtools.yang.model.api.TypeDefinition; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -public class ChoiceReader extends AbstractReader { +public class ChoiceReader extends AbstractReader { private static final Logger LOG = LoggerFactory.getLogger(ChoiceReader.class); @@ -55,7 +55,7 @@ public class ChoiceReader extends AbstractReader { } @Override - public List> readWithContext(final ChoiceNode choiceNode) throws IOException, ReadingException { + public List> readWithContext(final ChoiceSchemaNode choiceNode) throws IOException, ReadingException { final Map availableCases = collectAllCases(choiceNode); console.formatLn("Select case for choice %s from: %s", choiceNode.getQName().getLocalName(), formatSet(availableCases.keySet())); @@ -117,7 +117,7 @@ public class ChoiceReader extends AbstractReader { return false; } - private Map collectAllCases(final ChoiceNode schemaNode) { + private Map collectAllCases(final ChoiceSchemaNode schemaNode) { return Maps.uniqueIndex(schemaNode.getCases(), new Function() { @Override public String apply(final ChoiceCaseNode input) { @@ -127,8 +127,8 @@ public class ChoiceReader extends AbstractReader { } @Override - protected ConsoleContext getContext(final ChoiceNode schemaNode) { - return new BaseConsoleContext(schemaNode) { + protected ConsoleContext getContext(final ChoiceSchemaNode schemaNode) { + return new BaseConsoleContext(schemaNode) { @Override public List getAdditionalCompleters() { return Collections diff --git a/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/reader/impl/GenericReader.java b/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/reader/impl/GenericReader.java index 8fbfbb7e3a..8be30b3e26 100644 --- a/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/reader/impl/GenericReader.java +++ b/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/reader/impl/GenericReader.java @@ -23,7 +23,7 @@ import org.opendaylight.controller.netconf.cli.reader.ReadingException; import org.opendaylight.yangtools.yang.common.QName; import org.opendaylight.yangtools.yang.data.api.Node; import org.opendaylight.yangtools.yang.model.api.AnyXmlSchemaNode; -import org.opendaylight.yangtools.yang.model.api.ChoiceNode; +import org.opendaylight.yangtools.yang.model.api.ChoiceSchemaNode; import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode; import org.opendaylight.yangtools.yang.model.api.DataSchemaNode; import org.opendaylight.yangtools.yang.model.api.LeafListSchemaNode; @@ -86,9 +86,9 @@ public class GenericReader extends AbstractReader { getSchemaContext(), getReadConfigNode()); return new GenericListReader<>(console, entryReader, getSchemaContext(), getReadConfigNode()) .read((LeafListSchemaNode) schemaNode); - } else if (schemaNode instanceof ChoiceNode) { + } else if (schemaNode instanceof ChoiceSchemaNode) { return new ChoiceReader(console, argumentHandlerRegistry, getSchemaContext(), getReadConfigNode()) - .read((ChoiceNode) schemaNode); + .read((ChoiceSchemaNode) schemaNode); } else if (schemaNode instanceof AnyXmlSchemaNode) { return new AnyXmlReader(console, getSchemaContext(), getReadConfigNode()) .read((AnyXmlSchemaNode) schemaNode); diff --git a/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/writer/impl/ChoiceNodeCliSerializer.java b/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/writer/impl/ChoiceNodeCliSerializer.java index 1ca902f739..33bc6df9eb 100644 --- a/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/writer/impl/ChoiceNodeCliSerializer.java +++ b/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/writer/impl/ChoiceNodeCliSerializer.java @@ -12,11 +12,12 @@ import java.util.Collections; import org.opendaylight.controller.netconf.cli.writer.OutFormatter; import org.opendaylight.yangtools.yang.common.QName; import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument; +import org.opendaylight.yangtools.yang.data.api.schema.ChoiceNode; import org.opendaylight.yangtools.yang.data.api.schema.DataContainerChild; import org.opendaylight.yangtools.yang.data.impl.schema.transform.base.serializer.ChoiceNodeBaseSerializer; import org.opendaylight.yangtools.yang.data.impl.schema.transform.base.serializer.NodeSerializerDispatcher; import org.opendaylight.yangtools.yang.model.api.ChoiceCaseNode; -import org.opendaylight.yangtools.yang.model.api.ChoiceNode; +import org.opendaylight.yangtools.yang.model.api.ChoiceSchemaNode; final class ChoiceNodeCliSerializer extends ChoiceNodeBaseSerializer { private final NodeSerializerDispatcher dispatcher; @@ -28,7 +29,7 @@ final class ChoiceNodeCliSerializer extends ChoiceNodeBaseSerializer { } @Override - public Iterable serialize(final ChoiceNode schema, final org.opendaylight.yangtools.yang.data.api.schema.ChoiceNode node) { + public Iterable serialize(final ChoiceSchemaNode schema, final ChoiceNode node) { final StringBuilder output = new StringBuilder(); out.increaseIndent(); out.addStringWithIndent(output, "choice "); @@ -49,7 +50,7 @@ final class ChoiceNodeCliSerializer extends ChoiceNodeBaseSerializer { return Collections.singletonList(output.toString()); } - private String detectCase(final ChoiceNode schema, final org.opendaylight.yangtools.yang.data.api.schema.ChoiceNode node) { + private String detectCase(final ChoiceSchemaNode schema, final ChoiceNode node) { for (final DataContainerChild caseChild : node.getValue()) { final QName presentChildQName = caseChild.getNodeType(); for (final ChoiceCaseNode choiceCaseNode : schema.getCases()) { diff --git a/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/writer/impl/CliOutputFromNormalizedNodeSerializerFactory.java b/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/writer/impl/CliOutputFromNormalizedNodeSerializerFactory.java index fd07b1ad04..3bb2461fcd 100644 --- a/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/writer/impl/CliOutputFromNormalizedNodeSerializerFactory.java +++ b/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/writer/impl/CliOutputFromNormalizedNodeSerializerFactory.java @@ -24,6 +24,7 @@ import org.opendaylight.yangtools.yang.data.impl.schema.transform.FromNormalized import org.opendaylight.yangtools.yang.data.impl.schema.transform.base.serializer.NodeSerializerDispatcher; import org.opendaylight.yangtools.yang.model.api.AnyXmlSchemaNode; import org.opendaylight.yangtools.yang.model.api.AugmentationSchema; +import org.opendaylight.yangtools.yang.model.api.ChoiceSchemaNode; import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode; import org.opendaylight.yangtools.yang.model.api.LeafListSchemaNode; import org.opendaylight.yangtools.yang.model.api.LeafSchemaNode; @@ -69,7 +70,7 @@ public final class CliOutputFromNormalizedNodeSerializerFactory implements FromN } @Override - public FromNormalizedNodeSerializer getChoiceNodeSerializer() { + public FromNormalizedNodeSerializer getChoiceNodeSerializer() { return choiceSerializer; } @@ -113,4 +114,4 @@ public final class CliOutputFromNormalizedNodeSerializerFactory implements FromN throw new UnsupportedOperationException(); } -} \ No newline at end of file +} diff --git a/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/writer/impl/NodeCliSerializerDispatcher.java b/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/writer/impl/NodeCliSerializerDispatcher.java index 566829d178..e6d47cc24f 100644 --- a/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/writer/impl/NodeCliSerializerDispatcher.java +++ b/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/writer/impl/NodeCliSerializerDispatcher.java @@ -21,6 +21,7 @@ import org.opendaylight.yangtools.yang.data.api.schema.MixinNode; import org.opendaylight.yangtools.yang.data.impl.schema.transform.FromNormalizedNodeSerializerFactory; import org.opendaylight.yangtools.yang.data.impl.schema.transform.base.serializer.NodeSerializerDispatcher; import org.opendaylight.yangtools.yang.model.api.AugmentationSchema; +import org.opendaylight.yangtools.yang.model.api.ChoiceSchemaNode; import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode; import org.opendaylight.yangtools.yang.model.api.LeafListSchemaNode; import org.opendaylight.yangtools.yang.model.api.LeafSchemaNode; @@ -63,10 +64,9 @@ public class NodeCliSerializerDispatcher implements NodeSerializerDispatcher onChoiceNode(final Object childSchema, final DataContainerChild dataContainerChild) { - checkSchemaCompatibility(childSchema, org.opendaylight.yangtools.yang.model.api.ChoiceNode.class, - dataContainerChild); + checkSchemaCompatibility(childSchema, ChoiceSchemaNode.class, dataContainerChild); return factory.getChoiceNodeSerializer().serialize( - (org.opendaylight.yangtools.yang.model.api.ChoiceNode) childSchema, (ChoiceNode) dataContainerChild); + (ChoiceSchemaNode) childSchema, (ChoiceNode) dataContainerChild); } private Iterable onListNode(final Object childSchema, diff --git a/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/writer/impl/NormalizedNodeWriter.java b/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/writer/impl/NormalizedNodeWriter.java index 2c7c23e7e9..814822ec96 100644 --- a/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/writer/impl/NormalizedNodeWriter.java +++ b/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/writer/impl/NormalizedNodeWriter.java @@ -20,7 +20,7 @@ import org.opendaylight.yangtools.yang.data.composite.node.schema.cnsn.parser.Cn import org.opendaylight.yangtools.yang.data.impl.schema.transform.base.serializer.NodeSerializerDispatcher; import org.opendaylight.yangtools.yang.data.impl.schema.transform.dom.DomUtils; import org.opendaylight.yangtools.yang.model.api.AugmentationSchema; -import org.opendaylight.yangtools.yang.model.api.ChoiceNode; +import org.opendaylight.yangtools.yang.model.api.ChoiceSchemaNode; import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode; import org.opendaylight.yangtools.yang.model.api.DataSchemaNode; import org.opendaylight.yangtools.yang.model.api.LeafListSchemaNode; @@ -83,8 +83,8 @@ public class NormalizedNodeWriter extends AbstractWriter { return factoryParsing.getLeafSetNodeParser().parse(dataNodes, (LeafListSchemaNode) dataSchemaNode); } else if (dataSchemaNode instanceof ListSchemaNode) { return factoryParsing.getMapNodeParser().parse(dataNodes, (ListSchemaNode) dataSchemaNode); - } else if (dataSchemaNode instanceof ChoiceNode) { - return factoryParsing.getChoiceNodeParser().parse(dataNodes, (ChoiceNode) dataSchemaNode); + } else if (dataSchemaNode instanceof ChoiceSchemaNode) { + return factoryParsing.getChoiceNodeParser().parse(dataNodes, (ChoiceSchemaNode) dataSchemaNode); } else if (dataSchemaNode instanceof AugmentationSchema) { return factoryParsing.getAugmentationNodeParser().parse(dataNodes, (AugmentationSchema) dataSchemaNode); } -- 2.36.6