X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-dom-broker%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fsal%2Fdom%2Fbroker%2Futil%2FYangSchemaUtils.java;h=306cd34a69502187084bec2a33643cac5231e979;hp=7f150626c08b3eca26e2d07797aa70cf519a7667;hb=292f9b9abf0bc7f63b0f903b111fca6632ba00f9;hpb=405ea7ce68d22bd3d2501857c5253793b581b086 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 7f150626c0..306cd34a69 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 @@ -7,6 +7,8 @@ */ package org.opendaylight.controller.sal.dom.broker.util; +import static com.google.common.base.Preconditions.checkArgument; +import static com.google.common.base.Preconditions.checkState; import java.util.Iterator; import java.util.List; @@ -31,19 +33,16 @@ import org.opendaylight.yangtools.yang.model.api.Status; import org.opendaylight.yangtools.yang.model.api.TypeDefinition; import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode; import org.opendaylight.yangtools.yang.model.api.UsesNode; -import org.opendaylight.yangtools.yang.model.api.YangNode; - -import static com.google.common.base.Preconditions.*; import com.google.common.base.Function; import com.google.common.collect.FluentIterable; -public class YangSchemaUtils { +public final class YangSchemaUtils { private static final Function QNAME_FROM_PATH_ARGUMENT = new Function(){ - + @Override - public QName apply(PathArgument input) { + public QName apply(final PathArgument input) { if(input == null) { return null; } @@ -51,29 +50,28 @@ public class YangSchemaUtils { } }; - private YangSchemaUtils() { + private YangSchemaUtils() { throw new UnsupportedOperationException("Utility class."); } - - - public static DataSchemaNode getSchemaNode(SchemaContext schema,InstanceIdentifier path) { + + public static DataSchemaNode getSchemaNode(final SchemaContext schema,final InstanceIdentifier path) { checkArgument(schema != null,"YANG Schema must not be null."); checkArgument(path != null,"Path must not be null."); return getSchemaNode(schema, FluentIterable.from(path.getPath()).transform(QNAME_FROM_PATH_ARGUMENT)); } - - public static DataSchemaNode getSchemaNode(SchemaContext schema,Iterable path) { + + public static DataSchemaNode getSchemaNode(final SchemaContext schema,final Iterable path) { checkArgument(schema != null,"YANG Schema must not be null."); checkArgument(path != null,"Path must not be null."); if(!path.iterator().hasNext()){ return toRootDataNode(schema); } - + QName firstNode = path.iterator().next(); DataNodeContainer previous = schema.findModuleByNamespaceAndRevision(firstNode.getNamespace(), firstNode.getRevision()); Iterator iterator = path.iterator(); - + while (iterator.hasNext()) { checkArgument(previous!= null, "Supplied path does not resolve into valid schema node."); QName arg = iterator.next(); @@ -93,7 +91,7 @@ public class YangSchemaUtils { return (DataSchemaNode) previous; } - private static DataSchemaNode searchInChoices(DataNodeContainer node, QName arg) { + private static DataSchemaNode searchInChoices(final DataNodeContainer node, final QName arg) { Set children = node.getChildNodes(); for (DataSchemaNode child : children) { if (child instanceof ChoiceNode) { @@ -107,7 +105,7 @@ public class YangSchemaUtils { return null; } - private static DataSchemaNode searchInCases(ChoiceNode choiceNode, QName arg) { + private static DataSchemaNode searchInCases(final ChoiceNode choiceNode, final QName arg) { Set cases = choiceNode.getCases(); for (ChoiceCaseNode caseNode : cases) { DataSchemaNode node = caseNode.getDataChildByName(arg); @@ -118,129 +116,124 @@ public class YangSchemaUtils { return null; } - private static ContainerSchemaNode toRootDataNode(SchemaContext schema) { + private static ContainerSchemaNode toRootDataNode(final SchemaContext schema) { return new NetconfDataRootNode(schema); } private static final class NetconfDataRootNode implements ContainerSchemaNode { - - public NetconfDataRootNode(SchemaContext schema) { + + public NetconfDataRootNode(final SchemaContext schema) { // TODO Auto-generated constructor stub } - public YangNode getParent() { - // TODO Auto-generated method stub - return null; - } - @Override public Set> getTypeDefinitions() { // TODO Auto-generated method stub return null; } - + @Override public Set getChildNodes() { // TODO Auto-generated method stub return null; } - + @Override public Set getGroupings() { // TODO Auto-generated method stub return null; } - + @Override - public DataSchemaNode getDataChildByName(QName name) { + public DataSchemaNode getDataChildByName(final QName name) { // TODO Auto-generated method stub return null; } - + @Override - public DataSchemaNode getDataChildByName(String name) { + public DataSchemaNode getDataChildByName(final String name) { // TODO Auto-generated method stub return null; } - + @Override public Set getUses() { // TODO Auto-generated method stub return null; } - + @Override public Set getAvailableAugmentations() { // TODO Auto-generated method stub return null; } - + @Override public boolean isAugmenting() { // TODO Auto-generated method stub return false; } - + @Override public boolean isAddedByUses() { // TODO Auto-generated method stub return false; } - + @Override public boolean isConfiguration() { // TODO Auto-generated method stub return false; } - + @Override public ConstraintDefinition getConstraints() { // TODO Auto-generated method stub return null; } - + @Override public QName getQName() { // TODO Auto-generated method stub return null; } - + @Override public SchemaPath getPath() { // TODO Auto-generated method stub return null; } - + @Override public String getDescription() { // TODO Auto-generated method stub return null; } - + @Override public String getReference() { // TODO Auto-generated method stub return null; } - + @Override public Status getStatus() { // TODO Auto-generated method stub return null; } - + @Override public List getUnknownSchemaNodes() { // TODO Auto-generated method stub return null; } - + @Override public boolean isPresenceContainer() { // TODO Auto-generated method stub return false; } - + } }