Added line number to error messages. 97/297/2
authorMartin Vitez <mvitez@cisco.com>
Mon, 6 May 2013 07:12:46 +0000 (09:12 +0200)
committerMartin Vitez <mvitez@cisco.com>
Mon, 6 May 2013 13:30:19 +0000 (15:30 +0200)
Change-Id: I180438f8e617ca910b16d524576e88650d966bbd
Signed-off-by: Martin Vitez <mvitez@cisco.com>
34 files changed:
opendaylight/sal/yang-prototype/code-generator/yang-model-parser-impl/src/main/java/org/opendaylight/controller/yang/model/parser/builder/api/AbstractTypeAwareBuilder.java
opendaylight/sal/yang-prototype/code-generator/yang-model-parser-impl/src/main/java/org/opendaylight/controller/yang/model/parser/builder/api/Builder.java
opendaylight/sal/yang-prototype/code-generator/yang-model-parser-impl/src/main/java/org/opendaylight/controller/yang/model/parser/builder/api/TypeAwareBuilder.java
opendaylight/sal/yang-prototype/code-generator/yang-model-parser-impl/src/main/java/org/opendaylight/controller/yang/model/parser/builder/impl/AnyXmlBuilder.java
opendaylight/sal/yang-prototype/code-generator/yang-model-parser-impl/src/main/java/org/opendaylight/controller/yang/model/parser/builder/impl/AugmentationSchemaBuilderImpl.java
opendaylight/sal/yang-prototype/code-generator/yang-model-parser-impl/src/main/java/org/opendaylight/controller/yang/model/parser/builder/impl/ChoiceBuilder.java
opendaylight/sal/yang-prototype/code-generator/yang-model-parser-impl/src/main/java/org/opendaylight/controller/yang/model/parser/builder/impl/ChoiceCaseBuilder.java
opendaylight/sal/yang-prototype/code-generator/yang-model-parser-impl/src/main/java/org/opendaylight/controller/yang/model/parser/builder/impl/ConstraintsBuilder.java
opendaylight/sal/yang-prototype/code-generator/yang-model-parser-impl/src/main/java/org/opendaylight/controller/yang/model/parser/builder/impl/ContainerSchemaNodeBuilder.java
opendaylight/sal/yang-prototype/code-generator/yang-model-parser-impl/src/main/java/org/opendaylight/controller/yang/model/parser/builder/impl/DeviationBuilder.java
opendaylight/sal/yang-prototype/code-generator/yang-model-parser-impl/src/main/java/org/opendaylight/controller/yang/model/parser/builder/impl/ExtensionBuilder.java
opendaylight/sal/yang-prototype/code-generator/yang-model-parser-impl/src/main/java/org/opendaylight/controller/yang/model/parser/builder/impl/FeatureBuilder.java
opendaylight/sal/yang-prototype/code-generator/yang-model-parser-impl/src/main/java/org/opendaylight/controller/yang/model/parser/builder/impl/GroupingBuilderImpl.java
opendaylight/sal/yang-prototype/code-generator/yang-model-parser-impl/src/main/java/org/opendaylight/controller/yang/model/parser/builder/impl/IdentitySchemaNodeBuilder.java
opendaylight/sal/yang-prototype/code-generator/yang-model-parser-impl/src/main/java/org/opendaylight/controller/yang/model/parser/builder/impl/IdentityrefTypeBuilder.java
opendaylight/sal/yang-prototype/code-generator/yang-model-parser-impl/src/main/java/org/opendaylight/controller/yang/model/parser/builder/impl/LeafListSchemaNodeBuilder.java
opendaylight/sal/yang-prototype/code-generator/yang-model-parser-impl/src/main/java/org/opendaylight/controller/yang/model/parser/builder/impl/LeafSchemaNodeBuilder.java
opendaylight/sal/yang-prototype/code-generator/yang-model-parser-impl/src/main/java/org/opendaylight/controller/yang/model/parser/builder/impl/ListSchemaNodeBuilder.java
opendaylight/sal/yang-prototype/code-generator/yang-model-parser-impl/src/main/java/org/opendaylight/controller/yang/model/parser/builder/impl/ModuleBuilder.java
opendaylight/sal/yang-prototype/code-generator/yang-model-parser-impl/src/main/java/org/opendaylight/controller/yang/model/parser/builder/impl/NotificationBuilder.java
opendaylight/sal/yang-prototype/code-generator/yang-model-parser-impl/src/main/java/org/opendaylight/controller/yang/model/parser/builder/impl/RpcDefinitionBuilder.java
opendaylight/sal/yang-prototype/code-generator/yang-model-parser-impl/src/main/java/org/opendaylight/controller/yang/model/parser/builder/impl/TypedefBuilder.java
opendaylight/sal/yang-prototype/code-generator/yang-model-parser-impl/src/main/java/org/opendaylight/controller/yang/model/parser/builder/impl/UnionTypeBuilder.java
opendaylight/sal/yang-prototype/code-generator/yang-model-parser-impl/src/main/java/org/opendaylight/controller/yang/model/parser/builder/impl/UnknownSchemaNodeBuilder.java
opendaylight/sal/yang-prototype/code-generator/yang-model-parser-impl/src/main/java/org/opendaylight/controller/yang/model/parser/builder/impl/UsesNodeBuilderImpl.java
opendaylight/sal/yang-prototype/code-generator/yang-model-parser-impl/src/main/java/org/opendaylight/controller/yang/model/parser/impl/YangModelParserImpl.java
opendaylight/sal/yang-prototype/code-generator/yang-model-parser-impl/src/main/java/org/opendaylight/controller/yang/model/parser/impl/YangModelParserListenerImpl.java
opendaylight/sal/yang-prototype/code-generator/yang-model-parser-impl/src/main/java/org/opendaylight/controller/yang/model/parser/util/ParserUtils.java
opendaylight/sal/yang-prototype/code-generator/yang-model-parser-impl/src/main/java/org/opendaylight/controller/yang/model/parser/util/RefineHolder.java
opendaylight/sal/yang-prototype/code-generator/yang-model-parser-impl/src/main/java/org/opendaylight/controller/yang/model/parser/util/YangModelBuilderUtil.java
opendaylight/sal/yang-prototype/code-generator/yang-model-parser-impl/src/main/java/org/opendaylight/controller/yang/model/parser/util/YangParseException.java
opendaylight/sal/yang-prototype/code-generator/yang-model-parser-impl/src/main/java/org/opendaylight/controller/yang/model/validator/BasicValidations.java
opendaylight/sal/yang-prototype/code-generator/yang-model-parser-impl/src/test/java/org/opendaylight/controller/yang/model/validator/YangModelValidationTest.java
opendaylight/sal/yang-prototype/yang/yang-model-util/src/main/java/org/opendaylight/controller/yang/model/util/YangTypesConverter.java

index 02b4d7ff6c9cfe28e168234f6db72c58cc1242e6..fb1464160a6719edb5440df04e8f4fbc6a2024b9 100644 (file)
@@ -12,7 +12,7 @@ import org.opendaylight.controller.yang.model.api.TypeDefinition;
 /**
  * Basic implementation for TypeAwareBuilder builders.
  */
 /**
  * Basic implementation for TypeAwareBuilder builders.
  */
-public class AbstractTypeAwareBuilder implements TypeAwareBuilder {
+public abstract class AbstractTypeAwareBuilder implements TypeAwareBuilder {
 
     protected TypeDefinition<?> type;
     protected TypeDefinitionBuilder typedef;
 
     protected TypeDefinition<?> type;
     protected TypeDefinitionBuilder typedef;
index 73f2cf28ca9dacb5343aaa76922807df299c86bd..172e660413cb477cab3e85b837fcc5ff87c7ddea 100644 (file)
@@ -13,7 +13,7 @@ import org.opendaylight.controller.yang.model.api.TypeDefinition;
  * Builders of all nodes, which can have 'type' statement must implement this interface.
  * [typedef, type, leaf, leaf-list, deviate]
  */
  * Builders of all nodes, which can have 'type' statement must implement this interface.
  * [typedef, type, leaf, leaf-list, deviate]
  */
-public interface TypeAwareBuilder {
+public interface TypeAwareBuilder extends Builder {
 
     TypeDefinition<?> getType();
 
 
     TypeDefinition<?> getType();
 
index 212e2f8d4fbbf77196e784fb18a7dd054c76c27c..68f2d06d963b159a8d1d129a0aa7c0a70b465219 100644 (file)
@@ -20,10 +20,11 @@ import org.opendaylight.controller.yang.model.api.UnknownSchemaNode;
 import org.opendaylight.controller.yang.model.parser.builder.api.DataSchemaNodeBuilder;
 
 public class AnyXmlBuilder implements DataSchemaNodeBuilder {
 import org.opendaylight.controller.yang.model.parser.builder.api.DataSchemaNodeBuilder;
 
 public class AnyXmlBuilder implements DataSchemaNodeBuilder {
+    private final int line;
     private final QName qname;
     private SchemaPath path;
     private final AnyXmlSchemaNodeImpl instance;
     private final QName qname;
     private SchemaPath path;
     private final AnyXmlSchemaNodeImpl instance;
-    private final ConstraintsBuilder constraints = new ConstraintsBuilder();
+    private final ConstraintsBuilder constraints;
     private final List<UnknownSchemaNodeBuilder> addedUnknownNodes = new ArrayList<UnknownSchemaNodeBuilder>();
 
     private String description;
     private final List<UnknownSchemaNodeBuilder> addedUnknownNodes = new ArrayList<UnknownSchemaNodeBuilder>();
 
     private String description;
@@ -31,9 +32,11 @@ public class AnyXmlBuilder implements DataSchemaNodeBuilder {
     private Status status = Status.CURRENT;
     private boolean configuration;
 
     private Status status = Status.CURRENT;
     private boolean configuration;
 
-    public AnyXmlBuilder(final QName qname) {
+    public AnyXmlBuilder(final QName qname, final int line) {
         this.qname = qname;
         this.qname = qname;
+        this.line = line;
         instance = new AnyXmlSchemaNodeImpl(qname);
         instance = new AnyXmlSchemaNodeImpl(qname);
+        constraints = new ConstraintsBuilder(line);
     }
 
     @Override
     }
 
     @Override
@@ -55,6 +58,11 @@ public class AnyXmlBuilder implements DataSchemaNodeBuilder {
         return instance;
     }
 
         return instance;
     }
 
+    @Override
+    public int getLine() {
+        return line;
+    }
+
     @Override
     public QName getQName() {
         return qname;
     @Override
     public QName getQName() {
         return qname;
index e7d389fc4eece95cb9b8de5e1fe5113c16914179..c85955d28948693bc397e4b3d60b560d66f8ca4b 100644 (file)
@@ -31,8 +31,8 @@ import org.opendaylight.controller.yang.model.parser.util.YangModelBuilderUtil;
 import org.opendaylight.controller.yang.model.util.RevisionAwareXPathImpl;
 
 public class AugmentationSchemaBuilderImpl implements AugmentationSchemaBuilder {
 import org.opendaylight.controller.yang.model.util.RevisionAwareXPathImpl;
 
 public class AugmentationSchemaBuilderImpl implements AugmentationSchemaBuilder {
-
     private final AugmentationSchemaImpl instance;
     private final AugmentationSchemaImpl instance;
+    private final int line;
     private final String augmentTargetStr;
     private final SchemaPath augmentTarget;
     private String whenCondition;
     private final String augmentTargetStr;
     private final SchemaPath augmentTarget;
     private String whenCondition;
@@ -40,14 +40,20 @@ public class AugmentationSchemaBuilderImpl implements AugmentationSchemaBuilder
     private final Set<GroupingBuilder> groupings = new HashSet<GroupingBuilder>();
     private final Set<UsesNodeBuilder> usesNodes = new HashSet<UsesNodeBuilder>();
 
     private final Set<GroupingBuilder> groupings = new HashSet<GroupingBuilder>();
     private final Set<UsesNodeBuilder> usesNodes = new HashSet<UsesNodeBuilder>();
 
-    AugmentationSchemaBuilderImpl(final String augmentTargetStr) {
+    AugmentationSchemaBuilderImpl(final String augmentTargetStr, final int line) {
         this.augmentTargetStr = augmentTargetStr;
         this.augmentTargetStr = augmentTargetStr;
+        this.line = line;
         final SchemaPath targetPath = YangModelBuilderUtil
                 .parseAugmentPath(augmentTargetStr);
         augmentTarget = targetPath;
         instance = new AugmentationSchemaImpl(targetPath);
     }
 
         final SchemaPath targetPath = YangModelBuilderUtil
                 .parseAugmentPath(augmentTargetStr);
         augmentTarget = targetPath;
         instance = new AugmentationSchemaImpl(targetPath);
     }
 
+    @Override
+    public int getLine() {
+        return line;
+    }
+
     @Override
     public void addChildNode(DataSchemaNodeBuilder childNode) {
         childNodes.add(childNode);
     @Override
     public void addChildNode(DataSchemaNodeBuilder childNode) {
         childNodes.add(childNode);
index 946ba4ae0529352bce572b57a541a1713ad1ce3a..6660ac32155b229f256cce6e554a2deab8f657ee 100644 (file)
@@ -32,6 +32,7 @@ import org.opendaylight.controller.yang.model.parser.builder.api.UsesNodeBuilder
 public class ChoiceBuilder implements DataSchemaNodeBuilder, ChildNodeBuilder,
         AugmentationTargetBuilder {
     private final ChoiceNodeImpl instance;
 public class ChoiceBuilder implements DataSchemaNodeBuilder, ChildNodeBuilder,
         AugmentationTargetBuilder {
     private final ChoiceNodeImpl instance;
+    private final int line;
     // SchemaNode args
     private final QName qname;
     private SchemaPath schemaPath;
     // SchemaNode args
     private final QName qname;
     private SchemaPath schemaPath;
@@ -52,10 +53,11 @@ public class ChoiceBuilder implements DataSchemaNodeBuilder, ChildNodeBuilder,
     private final Set<ChoiceCaseBuilder> cases = new HashSet<ChoiceCaseBuilder>();
     private String defaultCase;
 
     private final Set<ChoiceCaseBuilder> cases = new HashSet<ChoiceCaseBuilder>();
     private String defaultCase;
 
-    public ChoiceBuilder(QName qname) {
+    public ChoiceBuilder(final QName qname, final int line) {
         this.qname = qname;
         this.qname = qname;
+        this.line = line;
         instance = new ChoiceNodeImpl(qname);
         instance = new ChoiceNodeImpl(qname);
-        constraints = new ConstraintsBuilder();
+        constraints = new ConstraintsBuilder(line);
     }
 
     @Override
     }
 
     @Override
@@ -93,6 +95,11 @@ public class ChoiceBuilder implements DataSchemaNodeBuilder, ChildNodeBuilder,
         return instance;
     }
 
         return instance;
     }
 
+    @Override
+    public int getLine() {
+        return line;
+    }
+
     public Set<ChoiceCaseBuilder> getCases() {
         return cases;
     }
     public Set<ChoiceCaseBuilder> getCases() {
         return cases;
     }
@@ -101,7 +108,7 @@ public class ChoiceBuilder implements DataSchemaNodeBuilder, ChildNodeBuilder,
     public void addChildNode(DataSchemaNodeBuilder childNode) {
         if (!(childNode instanceof ChoiceCaseBuilder)) {
             ChoiceCaseBuilder caseBuilder = new ChoiceCaseBuilder(
     public void addChildNode(DataSchemaNodeBuilder childNode) {
         if (!(childNode instanceof ChoiceCaseBuilder)) {
             ChoiceCaseBuilder caseBuilder = new ChoiceCaseBuilder(
-                    childNode.getQName());
+                    childNode.getQName(), childNode.getLine());
             caseBuilder.addChildNode(childNode);
             cases.add(caseBuilder);
         } else {
             caseBuilder.addChildNode(childNode);
             cases.add(caseBuilder);
         } else {
index 27cead10f11a0b32eb472be311b1fb9a18ba937d..a631f00b52129e300c08f8143e64fc19142e5435 100644 (file)
@@ -27,6 +27,7 @@ import org.opendaylight.controller.yang.model.parser.builder.api.UsesNodeBuilder
 public final class ChoiceCaseBuilder extends AbstractChildNodeBuilder implements
         DataSchemaNodeBuilder {
     private final ChoiceCaseNodeImpl instance;
 public final class ChoiceCaseBuilder extends AbstractChildNodeBuilder implements
         DataSchemaNodeBuilder {
     private final ChoiceCaseNodeImpl instance;
+    private final int line;
     private SchemaPath schemaPath;
     private String description;
     private String reference;
     private SchemaPath schemaPath;
     private String description;
     private String reference;
@@ -37,10 +38,11 @@ public final class ChoiceCaseBuilder extends AbstractChildNodeBuilder implements
     private final Set<UsesNodeBuilder> addedUsesNodes = new HashSet<UsesNodeBuilder>();
     private final Set<AugmentationSchema> augmentations = new HashSet<AugmentationSchema>();
 
     private final Set<UsesNodeBuilder> addedUsesNodes = new HashSet<UsesNodeBuilder>();
     private final Set<AugmentationSchema> augmentations = new HashSet<AugmentationSchema>();
 
-    ChoiceCaseBuilder(QName qname) {
+    ChoiceCaseBuilder(final QName qname, final int line) {
         super(qname);
         super(qname);
+        this.line = line;
         instance = new ChoiceCaseNodeImpl(qname);
         instance = new ChoiceCaseNodeImpl(qname);
-        constraints = new ConstraintsBuilder();
+        constraints = new ConstraintsBuilder(line);
     }
 
     @Override
     }
 
     @Override
@@ -77,6 +79,11 @@ public final class ChoiceCaseBuilder extends AbstractChildNodeBuilder implements
         return instance;
     }
 
         return instance;
     }
 
+    @Override
+    public int getLine() {
+        return line;
+    }
+
     public SchemaPath getPath() {
         return schemaPath;
     }
     public SchemaPath getPath() {
         return schemaPath;
     }
index 905a107f3165a5a709a0e3374d4668d76a1df141..24549539a6785eddab443a90a5b3bbbd2668fbb9 100644 (file)
@@ -19,15 +19,16 @@ import org.opendaylight.controller.yang.model.parser.builder.api.Builder;
 import org.opendaylight.controller.yang.model.util.RevisionAwareXPathImpl;
 
 public class ConstraintsBuilder implements Builder {
 import org.opendaylight.controller.yang.model.util.RevisionAwareXPathImpl;
 
 public class ConstraintsBuilder implements Builder {
-
     private final ConstraintDefinitionImpl instance;
     private final ConstraintDefinitionImpl instance;
+    private final int line;
     private final Set<MustDefinition> mustDefinitions;
     private String whenCondition;
     private boolean mandatory;
     private Integer min;
     private Integer max;
 
     private final Set<MustDefinition> mustDefinitions;
     private String whenCondition;
     private boolean mandatory;
     private Integer min;
     private Integer max;
 
-    ConstraintsBuilder() {
+    ConstraintsBuilder(final int line) {
+        this.line = line;
         instance = new ConstraintDefinitionImpl();
         mustDefinitions = new HashSet<MustDefinition>();
     }
         instance = new ConstraintDefinitionImpl();
         mustDefinitions = new HashSet<MustDefinition>();
     }
@@ -48,6 +49,11 @@ public class ConstraintsBuilder implements Builder {
         return instance;
     }
 
         return instance;
     }
 
+    @Override
+    public int getLine() {
+        return line;
+    }
+
     public Integer getMinElements() {
         return min;
     }
     public Integer getMinElements() {
         return min;
     }
index 8d82bda60a878ad31f3d0478054c753cb77ccdbd..7693b3a467eb50caed6aec251842ef14896c59ab 100644 (file)
@@ -38,8 +38,8 @@ import org.opendaylight.controller.yang.model.parser.builder.api.UsesNodeBuilder
 public class ContainerSchemaNodeBuilder extends AbstractChildNodeBuilder
         implements TypeDefinitionAwareBuilder, AugmentationTargetBuilder,
         DataSchemaNodeBuilder {
 public class ContainerSchemaNodeBuilder extends AbstractChildNodeBuilder
         implements TypeDefinitionAwareBuilder, AugmentationTargetBuilder,
         DataSchemaNodeBuilder {
-
     private final ContainerSchemaNodeImpl instance;
     private final ContainerSchemaNodeImpl instance;
+    private final int line;
     private final ConstraintsBuilder constraints;
     private SchemaPath schemaPath;
     private String description;
     private final ConstraintsBuilder constraints;
     private SchemaPath schemaPath;
     private String description;
@@ -54,10 +54,11 @@ public class ContainerSchemaNodeBuilder extends AbstractChildNodeBuilder
     private final Set<AugmentationSchemaBuilder> addedAugmentations = new HashSet<AugmentationSchemaBuilder>();
     private final List<UnknownSchemaNodeBuilder> addedUnknownNodes = new ArrayList<UnknownSchemaNodeBuilder>();
 
     private final Set<AugmentationSchemaBuilder> addedAugmentations = new HashSet<AugmentationSchemaBuilder>();
     private final List<UnknownSchemaNodeBuilder> addedUnknownNodes = new ArrayList<UnknownSchemaNodeBuilder>();
 
-    public ContainerSchemaNodeBuilder(QName qname) {
+    public ContainerSchemaNodeBuilder(final QName qname, final int line) {
         super(qname);
         super(qname);
+        this.line = line;
         instance = new ContainerSchemaNodeImpl(qname);
         instance = new ContainerSchemaNodeImpl(qname);
-        constraints = new ConstraintsBuilder();
+        constraints = new ConstraintsBuilder(line);
     }
 
     @Override
     }
 
     @Override
@@ -118,6 +119,11 @@ public class ContainerSchemaNodeBuilder extends AbstractChildNodeBuilder
         return instance;
     }
 
         return instance;
     }
 
+    @Override
+    public int getLine() {
+        return line;
+    }
+
     public Set<TypeDefinitionBuilder> getTypedefs() {
         return addedTypedefs;
     }
     public Set<TypeDefinitionBuilder> getTypedefs() {
         return addedTypedefs;
     }
index 0888811853d172674db74f93cb2e34b3aa86d695..53fcbf5fd2377d64f4434ff8ae733924d32fefc9 100644 (file)
@@ -14,10 +14,11 @@ import org.opendaylight.controller.yang.model.parser.builder.api.Builder;
 import org.opendaylight.controller.yang.model.parser.util.YangModelBuilderUtil;
 
 public class DeviationBuilder implements Builder {
 import org.opendaylight.controller.yang.model.parser.util.YangModelBuilderUtil;
 
 public class DeviationBuilder implements Builder {
-
     private final DeviationImpl instance;
     private final DeviationImpl instance;
+    private final int line;
 
 
-    DeviationBuilder(final String targetPathStr) {
+    DeviationBuilder(final String targetPathStr, final int line) {
+        this.line = line;
         final SchemaPath targetPath = YangModelBuilderUtil
                 .parseAugmentPath(targetPathStr);
         instance = new DeviationImpl(targetPath);
         final SchemaPath targetPath = YangModelBuilderUtil
                 .parseAugmentPath(targetPathStr);
         instance = new DeviationImpl(targetPath);
@@ -28,6 +29,11 @@ public class DeviationBuilder implements Builder {
         return instance;
     }
 
         return instance;
     }
 
+    @Override
+    public int getLine() {
+        return line;
+    }
+
     public void setDeviate(final String deviate) {
         if ("not-supported".equals(deviate)) {
             instance.setDeviate(Deviate.NOT_SUPPORTED);
     public void setDeviate(final String deviate) {
         if ("not-supported".equals(deviate)) {
             instance.setDeviate(Deviate.NOT_SUPPORTED);
@@ -130,11 +136,12 @@ public class DeviationBuilder implements Builder {
 
         @Override
         public String toString() {
 
         @Override
         public String toString() {
-            StringBuilder sb = new StringBuilder(DeviationImpl.class.getSimpleName());
+            StringBuilder sb = new StringBuilder(
+                    DeviationImpl.class.getSimpleName());
             sb.append("[");
             sb.append("[");
-            sb.append("targetPath="+ targetPath);
-            sb.append(", deviate="+ deviate);
-            sb.append(", reference="+ reference);
+            sb.append("targetPath=" + targetPath);
+            sb.append(", deviate=" + deviate);
+            sb.append(", reference=" + reference);
             sb.append("]");
             return sb.toString();
         }
             sb.append("]");
             return sb.toString();
         }
index 5828a33df919e11cb2082ade4b1439039139c884..cca167c59f95e8d414aabcb53181f3ea40d68710 100644 (file)
@@ -19,15 +19,16 @@ import org.opendaylight.controller.yang.model.api.UnknownSchemaNode;
 import org.opendaylight.controller.yang.model.parser.builder.api.SchemaNodeBuilder;
 
 public class ExtensionBuilder implements SchemaNodeBuilder {
 import org.opendaylight.controller.yang.model.parser.builder.api.SchemaNodeBuilder;
 
 public class ExtensionBuilder implements SchemaNodeBuilder {
-
     private final ExtensionDefinitionImpl instance;
     private final ExtensionDefinitionImpl instance;
+    private final int line;
     private final QName qname;
     private SchemaPath schemaPath;
     private final List<UnknownSchemaNodeBuilder> addedExtensions = new ArrayList<UnknownSchemaNodeBuilder>();
     private final List<UnknownSchemaNodeBuilder> addedUnknownNodes = new ArrayList<UnknownSchemaNodeBuilder>();
 
     private final QName qname;
     private SchemaPath schemaPath;
     private final List<UnknownSchemaNodeBuilder> addedExtensions = new ArrayList<UnknownSchemaNodeBuilder>();
     private final List<UnknownSchemaNodeBuilder> addedUnknownNodes = new ArrayList<UnknownSchemaNodeBuilder>();
 
-    ExtensionBuilder(final QName qname) {
+    ExtensionBuilder(final QName qname, final int line) {
         this.qname = qname;
         this.qname = qname;
+        this.line = line;
         instance = new ExtensionDefinitionImpl(qname);
     }
 
         instance = new ExtensionDefinitionImpl(qname);
     }
 
@@ -45,6 +46,11 @@ public class ExtensionBuilder implements SchemaNodeBuilder {
         return instance;
     }
 
         return instance;
     }
 
+    @Override
+    public int getLine() {
+        return line;
+    }
+
     public void addExtension(UnknownSchemaNodeBuilder extension) {
         addedExtensions.add(extension);
     }
     public void addExtension(UnknownSchemaNodeBuilder extension) {
         addedExtensions.add(extension);
     }
index ec5bcd7f4b80570cd514a5dfdef7a504bc7aaeec..372d786685cad15234871c754ce201b8332e7a0c 100644 (file)
@@ -19,14 +19,15 @@ import org.opendaylight.controller.yang.model.api.UnknownSchemaNode;
 import org.opendaylight.controller.yang.model.parser.builder.api.SchemaNodeBuilder;
 
 public class FeatureBuilder implements SchemaNodeBuilder {
 import org.opendaylight.controller.yang.model.parser.builder.api.SchemaNodeBuilder;
 
 public class FeatureBuilder implements SchemaNodeBuilder {
-
     private final FeatureDefinitionImpl instance;
     private final FeatureDefinitionImpl instance;
+    private final int line;
     private final QName qname;
     private SchemaPath schemaPath;
     private final List<UnknownSchemaNodeBuilder> addedUnknownNodes = new ArrayList<UnknownSchemaNodeBuilder>();
 
     private final QName qname;
     private SchemaPath schemaPath;
     private final List<UnknownSchemaNodeBuilder> addedUnknownNodes = new ArrayList<UnknownSchemaNodeBuilder>();
 
-    FeatureBuilder(final QName qname) {
+    FeatureBuilder(final QName qname, final int line) {
         this.qname = qname;
         this.qname = qname;
+        this.line = line;
         instance = new FeatureDefinitionImpl(qname);
     }
 
         instance = new FeatureDefinitionImpl(qname);
     }
 
@@ -44,6 +45,11 @@ public class FeatureBuilder implements SchemaNodeBuilder {
         return instance;
     }
 
         return instance;
     }
 
+    @Override
+    public int getLine() {
+        return line;
+    }
+
     @Override
     public QName getQName() {
         return qname;
     @Override
     public QName getQName() {
         return qname;
index bffa7e381e9ff2ebecec083b2458f02f99d89908..1ccd0fcc483afcabfd8417c0157e8dc99b7bfc1b 100644 (file)
@@ -29,8 +29,8 @@ import org.opendaylight.controller.yang.model.parser.builder.api.TypeDefinitionB
 import org.opendaylight.controller.yang.model.parser.builder.api.UsesNodeBuilder;
 
 public class GroupingBuilderImpl implements GroupingBuilder {
 import org.opendaylight.controller.yang.model.parser.builder.api.UsesNodeBuilder;
 
 public class GroupingBuilderImpl implements GroupingBuilder {
-
     private final GroupingDefinitionImpl instance;
     private final GroupingDefinitionImpl instance;
+    private final int line;
     private SchemaPath schemaPath;
     private final Set<DataSchemaNodeBuilder> childNodes = new HashSet<DataSchemaNodeBuilder>();
     private final Set<GroupingBuilder> groupings = new HashSet<GroupingBuilder>();
     private SchemaPath schemaPath;
     private final Set<DataSchemaNodeBuilder> childNodes = new HashSet<DataSchemaNodeBuilder>();
     private final Set<GroupingBuilder> groupings = new HashSet<GroupingBuilder>();
@@ -38,8 +38,9 @@ public class GroupingBuilderImpl implements GroupingBuilder {
     private final Set<UsesNodeBuilder> usesNodes = new HashSet<UsesNodeBuilder>();
     private final List<UnknownSchemaNodeBuilder> addedUnknownNodes = new ArrayList<UnknownSchemaNodeBuilder>();
 
     private final Set<UsesNodeBuilder> usesNodes = new HashSet<UsesNodeBuilder>();
     private final List<UnknownSchemaNodeBuilder> addedUnknownNodes = new ArrayList<UnknownSchemaNodeBuilder>();
 
-    GroupingBuilderImpl(final QName qname) {
+    GroupingBuilderImpl(final QName qname, final int line) {
         this.instance = new GroupingDefinitionImpl(qname);
         this.instance = new GroupingDefinitionImpl(qname);
+        this.line = line;
     }
 
     @Override
     }
 
     @Override
@@ -84,6 +85,11 @@ public class GroupingBuilderImpl implements GroupingBuilder {
         return instance;
     }
 
         return instance;
     }
 
+    @Override
+    public int getLine() {
+        return line;
+    }
+
     /**
      * Always returns null.
      */
     /**
      * Always returns null.
      */
index 5cfde8e7a0b7b7cbc21ababcc2c11a90dfcaf0eb..810ceeced500ca28d1bf4da4d8e83de8de5ab703 100644 (file)
@@ -20,14 +20,16 @@ import org.opendaylight.controller.yang.model.parser.builder.api.SchemaNodeBuild
 
 public final class IdentitySchemaNodeBuilder implements SchemaNodeBuilder {
     private final IdentitySchemaNodeImpl instance;
 
 public final class IdentitySchemaNodeBuilder implements SchemaNodeBuilder {
     private final IdentitySchemaNodeImpl instance;
+    private final int line;
     private final QName qname;
     private SchemaPath schemaPath;
     private IdentitySchemaNodeBuilder baseIdentity;
     private String baseIdentityName;
     private final List<UnknownSchemaNodeBuilder> addedUnknownNodes = new ArrayList<UnknownSchemaNodeBuilder>();
 
     private final QName qname;
     private SchemaPath schemaPath;
     private IdentitySchemaNodeBuilder baseIdentity;
     private String baseIdentityName;
     private final List<UnknownSchemaNodeBuilder> addedUnknownNodes = new ArrayList<UnknownSchemaNodeBuilder>();
 
-    IdentitySchemaNodeBuilder(final QName qname) {
+    IdentitySchemaNodeBuilder(final QName qname, final int line) {
         this.qname = qname;
         this.qname = qname;
+        this.line = line;
         instance = new IdentitySchemaNodeImpl(qname);
     }
 
         instance = new IdentitySchemaNodeImpl(qname);
     }
 
@@ -48,6 +50,11 @@ public final class IdentitySchemaNodeBuilder implements SchemaNodeBuilder {
         return instance;
     }
 
         return instance;
     }
 
+    @Override
+    public int getLine() {
+        return line;
+    }
+
     @Override
     public QName getQName() {
         return qname;
     @Override
     public QName getQName() {
         return qname;
index 33b6416234b83750a19e249109f706ef09671281..f46b1d544a03f0626bff882fa46956367e4b1225 100644 (file)
@@ -30,12 +30,14 @@ import org.opendaylight.controller.yang.model.util.IdentityrefType;
  */
 public class IdentityrefTypeBuilder extends AbstractTypeAwareBuilder implements
         TypeDefinitionBuilder, Builder {
  */
 public class IdentityrefTypeBuilder extends AbstractTypeAwareBuilder implements
         TypeDefinitionBuilder, Builder {
+    private final int line;
     private final String baseString;
     private final SchemaPath schemaPath;
     private QName baseQName;
 
 
     private final String baseString;
     private final SchemaPath schemaPath;
     private QName baseQName;
 
 
-    public IdentityrefTypeBuilder(final String baseString, SchemaPath schemaPath) {
+    public IdentityrefTypeBuilder(final String baseString, final SchemaPath schemaPath, final int line) {
+        this.line = line;
         this.baseString = baseString;
         this.schemaPath = schemaPath;
     }
         this.baseString = baseString;
         this.schemaPath = schemaPath;
     }
@@ -48,6 +50,11 @@ public class IdentityrefTypeBuilder extends AbstractTypeAwareBuilder implements
         this.baseQName = baseQName;
     }
 
         this.baseQName = baseQName;
     }
 
+    @Override
+    public int getLine() {
+        return line;
+    }
+
     @Override
     public TypeDefinition<?> getType() {
         return null;
     @Override
     public TypeDefinition<?> getType() {
         return null;
index 3884311e8e3da8cd88fd32a36cc482d56ca050bb..5ea82c214477665f9d761dedcafee84bd229e857 100644 (file)
@@ -25,21 +25,26 @@ import org.opendaylight.controller.yang.model.parser.builder.api.SchemaNodeBuild
 public class LeafListSchemaNodeBuilder extends AbstractTypeAwareBuilder
         implements SchemaNodeBuilder, DataSchemaNodeBuilder {
     private final LeafListSchemaNodeImpl instance;
 public class LeafListSchemaNodeBuilder extends AbstractTypeAwareBuilder
         implements SchemaNodeBuilder, DataSchemaNodeBuilder {
     private final LeafListSchemaNodeImpl instance;
+    private final int line;
+    // SchemaNode args
     private final QName qname;
     private final QName qname;
-    private final ConstraintsBuilder constraints = new ConstraintsBuilder();
     private SchemaPath schemaPath;
     private String description;
     private String reference;
     private Status status = Status.CURRENT;
     private SchemaPath schemaPath;
     private String description;
     private String reference;
     private Status status = Status.CURRENT;
+    private final List<UnknownSchemaNodeBuilder> addedUnknownNodes = new ArrayList<UnknownSchemaNodeBuilder>();
+    // DataSchemaNode args
     private boolean augmenting;
     private boolean configuration;
     private boolean augmenting;
     private boolean configuration;
+    private final ConstraintsBuilder constraints;
+    // LeafListSchemaNode args
     private boolean userOrdered;
 
     private boolean userOrdered;
 
-    private final List<UnknownSchemaNodeBuilder> addedUnknownNodes = new ArrayList<UnknownSchemaNodeBuilder>();
-
-    public LeafListSchemaNodeBuilder(final QName qname) {
+    public LeafListSchemaNodeBuilder(final QName qname, final int line) {
         this.qname = qname;
         this.qname = qname;
+        this.line = line;
         instance = new LeafListSchemaNodeImpl(qname);
         instance = new LeafListSchemaNodeImpl(qname);
+        constraints = new ConstraintsBuilder(line);
     }
 
     @Override
     }
 
     @Override
@@ -69,6 +74,11 @@ public class LeafListSchemaNodeBuilder extends AbstractTypeAwareBuilder
         return instance;
     }
 
         return instance;
     }
 
+    @Override
+    public int getLine() {
+        return line;
+    }
+
     @Override
     public QName getQName() {
         return qname;
     @Override
     public QName getQName() {
         return qname;
@@ -107,7 +117,7 @@ public class LeafListSchemaNodeBuilder extends AbstractTypeAwareBuilder
 
     @Override
     public void setStatus(Status status) {
 
     @Override
     public void setStatus(Status status) {
-        if(status != null) {
+        if (status != null) {
             this.status = status;
         }
     }
             this.status = status;
         }
     }
index fe039b2394807037fbb6e0568f8f16c049f780e2..45bb17b318a981596f8e9aaffa34917bed941519 100644 (file)
@@ -24,23 +24,28 @@ import org.opendaylight.controller.yang.model.parser.builder.api.SchemaNodeBuild
 
 public class LeafSchemaNodeBuilder extends AbstractTypeAwareBuilder implements
         DataSchemaNodeBuilder, SchemaNodeBuilder {
 
 public class LeafSchemaNodeBuilder extends AbstractTypeAwareBuilder implements
         DataSchemaNodeBuilder, SchemaNodeBuilder {
+    private final LeafSchemaNodeImpl instance;
+    private final int line;
+    // SchemaNode args
     private final QName qname;
     private SchemaPath path;
     private final QName qname;
     private SchemaPath path;
-    private final LeafSchemaNodeImpl instance;
-    private final ConstraintsBuilder constraints = new ConstraintsBuilder();
-    private final List<UnknownSchemaNodeBuilder> addedUnknownNodes = new ArrayList<UnknownSchemaNodeBuilder>();
-
     private String description;
     private String reference;
     private Status status = Status.CURRENT;
     private String description;
     private String reference;
     private Status status = Status.CURRENT;
+    private final List<UnknownSchemaNodeBuilder> addedUnknownNodes = new ArrayList<UnknownSchemaNodeBuilder>();
+    // DataSchemaNode args
     private boolean augmenting;
     private boolean configuration;
     private boolean augmenting;
     private boolean configuration;
+    private final ConstraintsBuilder constraints;
+    // leaf args
     private String defaultStr;
     private String unitsStr;
 
     private String defaultStr;
     private String unitsStr;
 
-    public LeafSchemaNodeBuilder(final QName qname) {
+    public LeafSchemaNodeBuilder(final QName qname, final int line) {
         this.qname = qname;
         this.qname = qname;
+        this.line = line;
         instance = new LeafSchemaNodeImpl(qname);
         instance = new LeafSchemaNodeImpl(qname);
+        constraints = new ConstraintsBuilder(line);
     }
 
     @Override
     }
 
     @Override
@@ -72,6 +77,11 @@ public class LeafSchemaNodeBuilder extends AbstractTypeAwareBuilder implements
         return instance;
     }
 
         return instance;
     }
 
+    @Override
+    public int getLine() {
+        return line;
+    }
+
     @Override
     public QName getQName() {
         return qname;
     @Override
     public QName getQName() {
         return qname;
index b032b32804f2beb20b05a972bce579d88e1756b9..c9f338fed1236a00e1f008ed6864e06d524452df 100644 (file)
@@ -40,25 +40,31 @@ public class ListSchemaNodeBuilder extends AbstractChildNodeBuilder implements
         DataSchemaNodeBuilder, SchemaNodeBuilder, AugmentationTargetBuilder,
         TypeDefinitionAwareBuilder {
     private final ListSchemaNodeImpl instance;
         DataSchemaNodeBuilder, SchemaNodeBuilder, AugmentationTargetBuilder,
         TypeDefinitionAwareBuilder {
     private final ListSchemaNodeImpl instance;
-    private List<QName> keyDefinition;
-    private final ConstraintsBuilder constraints;
+    private final int line;
+    // SchemaNode args
     private SchemaPath schemaPath;
     private String description;
     private String reference;
     private Status status = Status.CURRENT;
     private SchemaPath schemaPath;
     private String description;
     private String reference;
     private Status status = Status.CURRENT;
+    private final List<UnknownSchemaNodeBuilder> addedUnknownNodes = new ArrayList<UnknownSchemaNodeBuilder>();
+    // DataSchemaNode args
     private boolean augmenting;
     private boolean configuration;
     private boolean augmenting;
     private boolean configuration;
-    private boolean userOrdered;
-
+    private final ConstraintsBuilder constraints;
+    // DataNodeContainer args
     private final Set<TypeDefinitionBuilder> addedTypedefs = new HashSet<TypeDefinitionBuilder>();
     private final Set<UsesNodeBuilder> addedUsesNodes = new HashSet<UsesNodeBuilder>();
     private final Set<TypeDefinitionBuilder> addedTypedefs = new HashSet<TypeDefinitionBuilder>();
     private final Set<UsesNodeBuilder> addedUsesNodes = new HashSet<UsesNodeBuilder>();
+    // AugmentationTarget args
     private final Set<AugmentationSchemaBuilder> addedAugmentations = new HashSet<AugmentationSchemaBuilder>();
     private final Set<AugmentationSchemaBuilder> addedAugmentations = new HashSet<AugmentationSchemaBuilder>();
-    private final List<UnknownSchemaNodeBuilder> addedUnknownNodes = new ArrayList<UnknownSchemaNodeBuilder>();
+    // ListSchemaNode args
+    private List<QName> keyDefinition;
+    private boolean userOrdered;
 
 
-    public ListSchemaNodeBuilder(final QName qname) {
+    public ListSchemaNodeBuilder(final QName qname, final int line) {
         super(qname);
         super(qname);
+        this.line = line;
         instance = new ListSchemaNodeImpl(qname);
         instance = new ListSchemaNodeImpl(qname);
-        constraints = new ConstraintsBuilder();
+        constraints = new ConstraintsBuilder(line);
     }
 
     @Override
     }
 
     @Override
@@ -102,7 +108,7 @@ public class ListSchemaNodeBuilder extends AbstractChildNodeBuilder implements
 
         // AUGMENTATIONS
         final Set<AugmentationSchema> augmentations = new HashSet<AugmentationSchema>();
 
         // AUGMENTATIONS
         final Set<AugmentationSchema> augmentations = new HashSet<AugmentationSchema>();
-        for(AugmentationSchemaBuilder builder : addedAugmentations) {
+        for (AugmentationSchemaBuilder builder : addedAugmentations) {
             augmentations.add(builder.build());
         }
         instance.setAvailableAugmentations(augmentations);
             augmentations.add(builder.build());
         }
         instance.setAvailableAugmentations(augmentations);
@@ -120,6 +126,11 @@ public class ListSchemaNodeBuilder extends AbstractChildNodeBuilder implements
         return instance;
     }
 
         return instance;
     }
 
+    @Override
+    public int getLine() {
+        return line;
+    }
+
     public Set<TypeDefinitionBuilder> getTypedefs() {
         return addedTypedefs;
     }
     public Set<TypeDefinitionBuilder> getTypedefs() {
         return addedTypedefs;
     }
@@ -162,7 +173,7 @@ public class ListSchemaNodeBuilder extends AbstractChildNodeBuilder implements
 
     @Override
     public void setStatus(Status status) {
 
     @Override
     public void setStatus(Status status) {
-        if(status != null) {
+        if (status != null) {
             this.status = status;
         }
     }
             this.status = status;
         }
     }
index cca505e98505d26907b0c49202285cfda98040d6..5d72a0edf1467e9a8c029298829aa3c39701139a 100644 (file)
@@ -164,6 +164,11 @@ public class ModuleBuilder implements Builder {
         return instance;
     }
 
         return instance;
     }
 
+    @Override
+    public int getLine() {
+        return 0;
+    }
+
     public Builder getNode(final List<String> path) {
         return moduleNodes.get(path);
     }
     public Builder getNode(final List<String> path) {
         return moduleNodes.get(path);
     }
@@ -286,17 +291,18 @@ public class ModuleBuilder implements Builder {
         return imports;
     }
 
         return imports;
     }
 
-    public ExtensionBuilder addExtension(final QName qname) {
-        final ExtensionBuilder builder = new ExtensionBuilder(qname);
+    public ExtensionBuilder addExtension(final QName qname, final int line) {
+        final ExtensionBuilder builder = new ExtensionBuilder(qname, line);
         addedExtensions.add(builder);
         return builder;
     }
 
     public ContainerSchemaNodeBuilder addContainerNode(
         addedExtensions.add(builder);
         return builder;
     }
 
     public ContainerSchemaNodeBuilder addContainerNode(
-            final QName containerName, final List<String> parentPath) {
+            final QName containerName, final List<String> parentPath,
+            final int line) {
         final List<String> pathToNode = new ArrayList<String>(parentPath);
         final ContainerSchemaNodeBuilder containerBuilder = new ContainerSchemaNodeBuilder(
         final List<String> pathToNode = new ArrayList<String>(parentPath);
         final ContainerSchemaNodeBuilder containerBuilder = new ContainerSchemaNodeBuilder(
-                containerName);
+                containerName, line);
         final ChildNodeBuilder parent = (ChildNodeBuilder) moduleNodes
                 .get(pathToNode);
         if (parent != null) {
         final ChildNodeBuilder parent = (ChildNodeBuilder) moduleNodes
                 .get(pathToNode);
         if (parent != null) {
@@ -314,10 +320,10 @@ public class ModuleBuilder implements Builder {
     }
 
     public ListSchemaNodeBuilder addListNode(final QName listName,
     }
 
     public ListSchemaNodeBuilder addListNode(final QName listName,
-            final List<String> parentPath) {
+            final List<String> parentPath, final int line) {
         final List<String> pathToNode = new ArrayList<String>(parentPath);
         final ListSchemaNodeBuilder listBuilder = new ListSchemaNodeBuilder(
         final List<String> pathToNode = new ArrayList<String>(parentPath);
         final ListSchemaNodeBuilder listBuilder = new ListSchemaNodeBuilder(
-                listName);
+                listName, line);
         final ChildNodeBuilder parent = (ChildNodeBuilder) moduleNodes
                 .get(pathToNode);
         if (parent != null) {
         final ChildNodeBuilder parent = (ChildNodeBuilder) moduleNodes
                 .get(pathToNode);
         if (parent != null) {
@@ -335,10 +341,10 @@ public class ModuleBuilder implements Builder {
     }
 
     public LeafSchemaNodeBuilder addLeafNode(final QName leafName,
     }
 
     public LeafSchemaNodeBuilder addLeafNode(final QName leafName,
-            final List<String> parentPath) {
+            final List<String> parentPath, final int line) {
         final List<String> pathToNode = new ArrayList<String>(parentPath);
         final LeafSchemaNodeBuilder leafBuilder = new LeafSchemaNodeBuilder(
         final List<String> pathToNode = new ArrayList<String>(parentPath);
         final LeafSchemaNodeBuilder leafBuilder = new LeafSchemaNodeBuilder(
-                leafName);
+                leafName, line);
         final ChildNodeBuilder parent = (ChildNodeBuilder) moduleNodes
                 .get(pathToNode);
         if (parent != null) {
         final ChildNodeBuilder parent = (ChildNodeBuilder) moduleNodes
                 .get(pathToNode);
         if (parent != null) {
@@ -356,10 +362,10 @@ public class ModuleBuilder implements Builder {
     }
 
     public LeafListSchemaNodeBuilder addLeafListNode(final QName leafListName,
     }
 
     public LeafListSchemaNodeBuilder addLeafListNode(final QName leafListName,
-            final List<String> parentPath) {
+            final List<String> parentPath, final int line) {
         final List<String> pathToNode = new ArrayList<String>(parentPath);
         final LeafListSchemaNodeBuilder leafListBuilder = new LeafListSchemaNodeBuilder(
         final List<String> pathToNode = new ArrayList<String>(parentPath);
         final LeafListSchemaNodeBuilder leafListBuilder = new LeafListSchemaNodeBuilder(
-                leafListName);
+                leafListName, line);
         final ChildNodeBuilder parent = (ChildNodeBuilder) moduleNodes
                 .get(pathToNode);
         if (parent != null) {
         final ChildNodeBuilder parent = (ChildNodeBuilder) moduleNodes
                 .get(pathToNode);
         if (parent != null) {
@@ -377,9 +383,9 @@ public class ModuleBuilder implements Builder {
     }
 
     public GroupingBuilder addGrouping(final QName qname,
     }
 
     public GroupingBuilder addGrouping(final QName qname,
-            final List<String> parentPath) {
+            final List<String> parentPath, final int line) {
         final List<String> pathToGroup = new ArrayList<String>(parentPath);
         final List<String> pathToGroup = new ArrayList<String>(parentPath);
-        final GroupingBuilder builder = new GroupingBuilderImpl(qname);
+        final GroupingBuilder builder = new GroupingBuilderImpl(qname, line);
         final ChildNodeBuilder parentNodeBuilder = (ChildNodeBuilder) moduleNodes
                 .get(pathToGroup);
         if (parentNodeBuilder != null) {
         final ChildNodeBuilder parentNodeBuilder = (ChildNodeBuilder) moduleNodes
                 .get(pathToGroup);
         if (parentNodeBuilder != null) {
@@ -395,10 +401,10 @@ public class ModuleBuilder implements Builder {
     }
 
     public AugmentationSchemaBuilder addAugment(final String name,
     }
 
     public AugmentationSchemaBuilder addAugment(final String name,
-            final List<String> parentPath) {
+            final List<String> parentPath, final int line) {
         final List<String> pathToAugment = new ArrayList<String>(parentPath);
         final AugmentationSchemaBuilder builder = new AugmentationSchemaBuilderImpl(
         final List<String> pathToAugment = new ArrayList<String>(parentPath);
         final AugmentationSchemaBuilder builder = new AugmentationSchemaBuilderImpl(
-                name);
+                name, line);
 
         // augment can only be in 'module' or 'uses' statement
         final UsesNodeBuilder parent = addedUsesNodes.get(pathToAugment);
 
         // augment can only be in 'module' or 'uses' statement
         final UsesNodeBuilder parent = addedUsesNodes.get(pathToAugment);
@@ -414,10 +420,10 @@ public class ModuleBuilder implements Builder {
     }
 
     public UsesNodeBuilder addUsesNode(final String groupingPathStr,
     }
 
     public UsesNodeBuilder addUsesNode(final String groupingPathStr,
-            final List<String> parentPath) {
+            final List<String> parentPath, final int line) {
         final List<String> pathToUses = new ArrayList<String>(parentPath);
         final UsesNodeBuilder usesBuilder = new UsesNodeBuilderImpl(
         final List<String> pathToUses = new ArrayList<String>(parentPath);
         final UsesNodeBuilder usesBuilder = new UsesNodeBuilderImpl(
-                groupingPathStr);
+                groupingPathStr, line);
         final ChildNodeBuilder parent = (ChildNodeBuilder) moduleNodes
                 .get(pathToUses);
         if (parent != null) {
         final ChildNodeBuilder parent = (ChildNodeBuilder) moduleNodes
                 .get(pathToUses);
         if (parent != null) {
@@ -445,9 +451,10 @@ public class ModuleBuilder implements Builder {
     }
 
     public RpcDefinitionBuilder addRpc(final QName qname,
     }
 
     public RpcDefinitionBuilder addRpc(final QName qname,
-            final List<String> parentPath) {
+            final List<String> parentPath, final int line) {
         final List<String> pathToRpc = new ArrayList<String>(parentPath);
         final List<String> pathToRpc = new ArrayList<String>(parentPath);
-        final RpcDefinitionBuilder rpcBuilder = new RpcDefinitionBuilder(qname);
+        final RpcDefinitionBuilder rpcBuilder = new RpcDefinitionBuilder(qname,
+                line);
 
         pathToRpc.add(qname.getLocalName());
         addedRpcs.put(pathToRpc, rpcBuilder);
 
         pathToRpc.add(qname.getLocalName());
         addedRpcs.put(pathToRpc, rpcBuilder);
@@ -455,7 +462,7 @@ public class ModuleBuilder implements Builder {
         final QName inputQName = new QName(qname.getNamespace(),
                 qname.getRevision(), qname.getPrefix(), "input");
         final ContainerSchemaNodeBuilder inputBuilder = new ContainerSchemaNodeBuilder(
         final QName inputQName = new QName(qname.getNamespace(),
                 qname.getRevision(), qname.getPrefix(), "input");
         final ContainerSchemaNodeBuilder inputBuilder = new ContainerSchemaNodeBuilder(
-                inputQName);
+                inputQName, line);
         final List<String> pathToInput = new ArrayList<String>(pathToRpc);
         pathToInput.add("input");
         moduleNodes.put(pathToInput, inputBuilder);
         final List<String> pathToInput = new ArrayList<String>(pathToRpc);
         pathToInput.add("input");
         moduleNodes.put(pathToInput, inputBuilder);
@@ -464,7 +471,7 @@ public class ModuleBuilder implements Builder {
         final QName outputQName = new QName(qname.getNamespace(),
                 qname.getRevision(), qname.getPrefix(), "output");
         final ContainerSchemaNodeBuilder outputBuilder = new ContainerSchemaNodeBuilder(
         final QName outputQName = new QName(qname.getNamespace(),
                 qname.getRevision(), qname.getPrefix(), "output");
         final ContainerSchemaNodeBuilder outputBuilder = new ContainerSchemaNodeBuilder(
-                outputQName);
+                outputQName, line);
         final List<String> pathToOutput = new ArrayList<String>(pathToRpc);
         pathToOutput.add("output");
         moduleNodes.put(pathToOutput, outputBuilder);
         final List<String> pathToOutput = new ArrayList<String>(pathToRpc);
         pathToOutput.add("output");
         moduleNodes.put(pathToOutput, outputBuilder);
@@ -474,11 +481,12 @@ public class ModuleBuilder implements Builder {
     }
 
     public NotificationBuilder addNotification(final QName notificationName,
     }
 
     public NotificationBuilder addNotification(final QName notificationName,
-            final List<String> parentPath) {
+            final List<String> parentPath, final int line) {
         final List<String> pathToNotification = new ArrayList<String>(
                 parentPath);
 
         final List<String> pathToNotification = new ArrayList<String>(
                 parentPath);
 
-        NotificationBuilder builder = new NotificationBuilder(notificationName);
+        NotificationBuilder builder = new NotificationBuilder(notificationName,
+                line);
 
         pathToNotification.add(notificationName.getLocalName());
         moduleNodes.put(pathToNotification, builder);
 
         pathToNotification.add(notificationName.getLocalName());
         moduleNodes.put(pathToNotification, builder);
@@ -488,19 +496,19 @@ public class ModuleBuilder implements Builder {
     }
 
     public FeatureBuilder addFeature(final QName featureName,
     }
 
     public FeatureBuilder addFeature(final QName featureName,
-            final List<String> parentPath) {
+            final List<String> parentPath, final int line) {
         List<String> pathToFeature = new ArrayList<String>(parentPath);
         pathToFeature.add(featureName.getLocalName());
 
         List<String> pathToFeature = new ArrayList<String>(parentPath);
         pathToFeature.add(featureName.getLocalName());
 
-        FeatureBuilder builder = new FeatureBuilder(featureName);
+        FeatureBuilder builder = new FeatureBuilder(featureName, line);
         addedFeatures.put(pathToFeature, builder);
         return builder;
     }
 
     public ChoiceBuilder addChoice(final QName choiceName,
         addedFeatures.put(pathToFeature, builder);
         return builder;
     }
 
     public ChoiceBuilder addChoice(final QName choiceName,
-            final List<String> parentPath) {
+            final List<String> parentPath, final int line) {
         List<String> pathToChoice = new ArrayList<String>(parentPath);
         List<String> pathToChoice = new ArrayList<String>(parentPath);
-        ChoiceBuilder builder = new ChoiceBuilder(choiceName);
+        ChoiceBuilder builder = new ChoiceBuilder(choiceName, line);
 
         final ChildNodeBuilder parent = (ChildNodeBuilder) moduleNodes
                 .get(pathToChoice);
 
         final ChildNodeBuilder parent = (ChildNodeBuilder) moduleNodes
                 .get(pathToChoice);
@@ -519,9 +527,9 @@ public class ModuleBuilder implements Builder {
     }
 
     public ChoiceCaseBuilder addCase(final QName caseName,
     }
 
     public ChoiceCaseBuilder addCase(final QName caseName,
-            final List<String> parentPath) {
+            final List<String> parentPath, final int line) {
         List<String> pathToCase = new ArrayList<String>(parentPath);
         List<String> pathToCase = new ArrayList<String>(parentPath);
-        ChoiceCaseBuilder builder = new ChoiceCaseBuilder(caseName);
+        ChoiceCaseBuilder builder = new ChoiceCaseBuilder(caseName, line);
 
         final ChildNodeBuilder parent = (ChildNodeBuilder) moduleNodes
                 .get(pathToCase);
 
         final ChildNodeBuilder parent = (ChildNodeBuilder) moduleNodes
                 .get(pathToCase);
@@ -539,9 +547,9 @@ public class ModuleBuilder implements Builder {
     }
 
     public AnyXmlBuilder addAnyXml(final QName anyXmlName,
     }
 
     public AnyXmlBuilder addAnyXml(final QName anyXmlName,
-            final List<String> parentPath) {
+            final List<String> parentPath, final int line) {
         List<String> pathToAnyXml = new ArrayList<String>(parentPath);
         List<String> pathToAnyXml = new ArrayList<String>(parentPath);
-        AnyXmlBuilder builder = new AnyXmlBuilder(anyXmlName);
+        AnyXmlBuilder builder = new AnyXmlBuilder(anyXmlName, line);
 
         final ChildNodeBuilder parent = (ChildNodeBuilder) moduleNodes
                 .get(pathToAnyXml);
 
         final ChildNodeBuilder parent = (ChildNodeBuilder) moduleNodes
                 .get(pathToAnyXml);
@@ -561,9 +569,9 @@ public class ModuleBuilder implements Builder {
     }
 
     public TypedefBuilder addTypedef(final QName typeDefName,
     }
 
     public TypedefBuilder addTypedef(final QName typeDefName,
-            final List<String> parentPath) {
+            final List<String> parentPath, final int line) {
         List<String> pathToType = new ArrayList<String>(parentPath);
         List<String> pathToType = new ArrayList<String>(parentPath);
-        TypedefBuilder builder = new TypedefBuilder(typeDefName);
+        TypedefBuilder builder = new TypedefBuilder(typeDefName, line);
         TypeDefinitionAwareBuilder parent = (TypeDefinitionAwareBuilder) moduleNodes
                 .get(pathToType);
         if (parent != null) {
         TypeDefinitionAwareBuilder parent = (TypeDefinitionAwareBuilder) moduleNodes
                 .get(pathToType);
         if (parent != null) {
@@ -587,12 +595,12 @@ public class ModuleBuilder implements Builder {
     }
 
     public void addUnionType(final List<String> actualPath,
     }
 
     public void addUnionType(final List<String> actualPath,
-            final URI namespace, final Date revision) {
+            final URI namespace, final Date revision, final int line) {
         List<String> pathToUnion = new ArrayList<String>(actualPath);
         TypeAwareBuilder parent = (TypeAwareBuilder) moduleNodes
                 .get(pathToUnion);
         UnionTypeBuilder union = new UnionTypeBuilder(pathToUnion, namespace,
         List<String> pathToUnion = new ArrayList<String>(actualPath);
         TypeAwareBuilder parent = (TypeAwareBuilder) moduleNodes
                 .get(pathToUnion);
         UnionTypeBuilder union = new UnionTypeBuilder(pathToUnion, namespace,
-                revision);
+                revision, line);
         parent.setType(union);
 
         List<String> path = new ArrayList<String>(pathToUnion);
         parent.setType(union);
 
         List<String> path = new ArrayList<String>(pathToUnion);
@@ -601,31 +609,33 @@ public class ModuleBuilder implements Builder {
         moduleNodes.put(path, union);
     }
 
         moduleNodes.put(path, union);
     }
 
-    public void addIdentityrefType(String baseString, List<String> parentPath,
-            SchemaPath schemaPath) {
+    public void addIdentityrefType(final String baseString,
+            final List<String> parentPath, final SchemaPath schemaPath,
+            final int line) {
         List<String> pathToIdentityref = new ArrayList<String>(parentPath);
         TypeAwareBuilder parent = (TypeAwareBuilder) moduleNodes
                 .get(pathToIdentityref);
         IdentityrefTypeBuilder identityref = new IdentityrefTypeBuilder(
         List<String> pathToIdentityref = new ArrayList<String>(parentPath);
         TypeAwareBuilder parent = (TypeAwareBuilder) moduleNodes
                 .get(pathToIdentityref);
         IdentityrefTypeBuilder identityref = new IdentityrefTypeBuilder(
-                baseString, schemaPath);
+                baseString, schemaPath, line);
         parent.setType(identityref);
         dirtyNodes.put(pathToIdentityref, parent);
     }
 
         parent.setType(identityref);
         dirtyNodes.put(pathToIdentityref, parent);
     }
 
-    public DeviationBuilder addDeviation(String targetPath,
-            List<String> parentPath) {
+    public DeviationBuilder addDeviation(final String targetPath,
+            final List<String> parentPath, final int line) {
         final List<String> pathToDeviation = new ArrayList<String>(parentPath);
         pathToDeviation.add(targetPath);
         final List<String> pathToDeviation = new ArrayList<String>(parentPath);
         pathToDeviation.add(targetPath);
-        DeviationBuilder builder = new DeviationBuilder(targetPath);
+        DeviationBuilder builder = new DeviationBuilder(targetPath, line);
         addedDeviations.put(targetPath, builder);
         moduleNodes.put(pathToDeviation, builder);
         return builder;
     }
 
         addedDeviations.put(targetPath, builder);
         moduleNodes.put(pathToDeviation, builder);
         return builder;
     }
 
-    public IdentitySchemaNodeBuilder addIdentity(QName qname,
-            List<String> parentPath) {
-        List<String> pathToIdentity = new ArrayList<String>(parentPath);
-        IdentitySchemaNodeBuilder builder = new IdentitySchemaNodeBuilder(qname);
+    public IdentitySchemaNodeBuilder addIdentity(final QName qname,
+            final List<String> parentPath, final int line) {
+        final List<String> pathToIdentity = new ArrayList<String>(parentPath);
+        final IdentitySchemaNodeBuilder builder = new IdentitySchemaNodeBuilder(
+                qname, line);
         pathToIdentity.add(qname.getLocalName());
         moduleNodes.put(pathToIdentity, builder);
         addedIdentities.add(builder);
         pathToIdentity.add(qname.getLocalName());
         moduleNodes.put(pathToIdentity, builder);
         addedIdentities.add(builder);
@@ -642,11 +652,11 @@ public class ModuleBuilder implements Builder {
         }
     }
 
         }
     }
 
-    public UnknownSchemaNodeBuilder addUnknownSchemaNode(QName qname,
-            List<String> parentPath) {
+    public UnknownSchemaNodeBuilder addUnknownSchemaNode(final QName qname,
+            final List<String> parentPath, final int line) {
         final List<String> pathToUnknown = new ArrayList<String>(parentPath);
         final UnknownSchemaNodeBuilder builder = new UnknownSchemaNodeBuilder(
         final List<String> pathToUnknown = new ArrayList<String>(parentPath);
         final UnknownSchemaNodeBuilder builder = new UnknownSchemaNodeBuilder(
-                qname);
+                qname, line);
         final Builder parent = moduleNodes.get(pathToUnknown);
         if (parent instanceof RefineHolder) {
             ((RefineHolder) parent).addUnknownSchemaNode(builder);
         final Builder parent = moduleNodes.get(pathToUnknown);
         if (parent instanceof RefineHolder) {
             ((RefineHolder) parent).addUnknownSchemaNode(builder);
index 3931b80ae97373754a2a28f0808b6c46d151e598..f2a0a07777e713498a2dbd2290f80163749c77e7 100644 (file)
@@ -35,15 +35,16 @@ import org.opendaylight.controller.yang.model.parser.builder.api.UsesNodeBuilder
 
 public class NotificationBuilder extends AbstractChildNodeBuilder implements
         TypeDefinitionAwareBuilder, SchemaNodeBuilder {
 
 public class NotificationBuilder extends AbstractChildNodeBuilder implements
         TypeDefinitionAwareBuilder, SchemaNodeBuilder {
-
     private final NotificationDefinitionImpl instance;
     private final NotificationDefinitionImpl instance;
+    private final int line;
     private SchemaPath schemaPath;
     private final Set<TypeDefinitionBuilder> addedTypedefs = new HashSet<TypeDefinitionBuilder>();
     private final Set<UsesNodeBuilder> addedUsesNodes = new HashSet<UsesNodeBuilder>();
     private final List<UnknownSchemaNodeBuilder> addedUnknownNodes = new ArrayList<UnknownSchemaNodeBuilder>();
 
     private SchemaPath schemaPath;
     private final Set<TypeDefinitionBuilder> addedTypedefs = new HashSet<TypeDefinitionBuilder>();
     private final Set<UsesNodeBuilder> addedUsesNodes = new HashSet<UsesNodeBuilder>();
     private final List<UnknownSchemaNodeBuilder> addedUnknownNodes = new ArrayList<UnknownSchemaNodeBuilder>();
 
-    NotificationBuilder(QName qname) {
+    NotificationBuilder(final QName qname, final int line) {
         super(qname);
         super(qname);
+        this.line = line;
         instance = new NotificationDefinitionImpl(qname);
     }
 
         instance = new NotificationDefinitionImpl(qname);
     }
 
@@ -89,6 +90,11 @@ public class NotificationBuilder extends AbstractChildNodeBuilder implements
         return instance;
     }
 
         return instance;
     }
 
+    @Override
+    public int getLine() {
+        return line;
+    }
+
     @Override
     public void addTypedef(final TypeDefinitionBuilder type) {
         addedTypedefs.add(type);
     @Override
     public void addTypedef(final TypeDefinitionBuilder type) {
         addedTypedefs.add(type);
index 6bf7750e7c5679d254eb4f9755b12c85b83230a7..f9b1a04cf953a065b52497aadb70792602327b75 100644 (file)
@@ -29,6 +29,7 @@ import org.opendaylight.controller.yang.model.parser.builder.api.TypeDefinitionB
 public class RpcDefinitionBuilder implements SchemaNodeBuilder,
         TypeDefinitionAwareBuilder {
     private final RpcDefinitionImpl instance;
 public class RpcDefinitionBuilder implements SchemaNodeBuilder,
         TypeDefinitionAwareBuilder {
     private final RpcDefinitionImpl instance;
+    private final int line;
     private final QName qname;
     private SchemaPath schemaPath;
     private ContainerSchemaNodeBuilder inputBuilder;
     private final QName qname;
     private SchemaPath schemaPath;
     private ContainerSchemaNodeBuilder inputBuilder;
@@ -37,8 +38,9 @@ public class RpcDefinitionBuilder implements SchemaNodeBuilder,
     private final Set<GroupingBuilder> addedGroupings = new HashSet<GroupingBuilder>();
     private final List<UnknownSchemaNodeBuilder> addedUnknownNodes = new ArrayList<UnknownSchemaNodeBuilder>();
 
     private final Set<GroupingBuilder> addedGroupings = new HashSet<GroupingBuilder>();
     private final List<UnknownSchemaNodeBuilder> addedUnknownNodes = new ArrayList<UnknownSchemaNodeBuilder>();
 
-    RpcDefinitionBuilder(final QName qname) {
+    RpcDefinitionBuilder(final QName qname, final int line) {
         this.qname = qname;
         this.qname = qname;
+        this.line = line;
         this.instance = new RpcDefinitionImpl(qname);
     }
 
         this.instance = new RpcDefinitionImpl(qname);
     }
 
@@ -75,6 +77,11 @@ public class RpcDefinitionBuilder implements SchemaNodeBuilder,
         return instance;
     }
 
         return instance;
     }
 
+    @Override
+    public int getLine() {
+        return line;
+    }
+
     void setInput(final ContainerSchemaNodeBuilder inputBuilder) {
         this.inputBuilder = inputBuilder;
     }
     void setInput(final ContainerSchemaNodeBuilder inputBuilder) {
         this.inputBuilder = inputBuilder;
     }
index 0e768c1107f4c9a48cbc3eba653476b427509b7f..94b46e6360caeb64c12854c1a90e6b68c3f83f9f 100644 (file)
@@ -27,6 +27,7 @@ import org.opendaylight.controller.yang.model.util.UnknownType;
 
 public class TypedefBuilder extends AbstractTypeAwareBuilder implements
         TypeDefinitionBuilder {
 
 public class TypedefBuilder extends AbstractTypeAwareBuilder implements
         TypeDefinitionBuilder {
+    private final int line;
     private final QName qname;
     private SchemaPath schemaPath;
 
     private final QName qname;
     private SchemaPath schemaPath;
 
@@ -42,8 +43,9 @@ public class TypedefBuilder extends AbstractTypeAwareBuilder implements
     private String units;
     private Object defaultValue;
 
     private String units;
     private Object defaultValue;
 
-    public TypedefBuilder(final QName qname) {
+    public TypedefBuilder(final QName qname, final int line) {
         this.qname = qname;
         this.qname = qname;
+        this.line = line;
     }
 
     @Override
     }
 
     @Override
@@ -80,6 +82,11 @@ public class TypedefBuilder extends AbstractTypeAwareBuilder implements
         return result;
     }
 
         return result;
     }
 
+    @Override
+    public int getLine() {
+        return line;
+    }
+
     @Override
     public QName getQName() {
         return qname;
     @Override
     public QName getQName() {
         return qname;
index 9ab103d71e890696e5ae60367bb48fd5f160906d..ec889c53e85acb5efa6f0ac4425e0bca19ab821c 100644 (file)
@@ -33,6 +33,7 @@ import org.opendaylight.controller.yang.model.util.UnionType;
  */
 public class UnionTypeBuilder extends AbstractTypeAwareBuilder implements
         TypeDefinitionBuilder, Builder {
  */
 public class UnionTypeBuilder extends AbstractTypeAwareBuilder implements
         TypeDefinitionBuilder, Builder {
+    private final int line;
     private final List<TypeDefinition<?>> types;
     private final List<TypeDefinitionBuilder> typedefs;
     private final UnionType instance;
     private final List<TypeDefinition<?>> types;
     private final List<TypeDefinitionBuilder> typedefs;
     private final UnionType instance;
@@ -42,7 +43,8 @@ public class UnionTypeBuilder extends AbstractTypeAwareBuilder implements
     private final Date revision;
 
     public UnionTypeBuilder(final List<String> actualPath, final URI namespace,
     private final Date revision;
 
     public UnionTypeBuilder(final List<String> actualPath, final URI namespace,
-            final Date revision) {
+            final Date revision, final int line) {
+        this.line = line;
         types = new ArrayList<TypeDefinition<?>>();
         typedefs = new ArrayList<TypeDefinitionBuilder>();
         instance = new UnionType(actualPath, namespace, revision, types);
         types = new ArrayList<TypeDefinition<?>>();
         typedefs = new ArrayList<TypeDefinitionBuilder>();
         instance = new UnionType(actualPath, namespace, revision, types);
@@ -52,6 +54,11 @@ public class UnionTypeBuilder extends AbstractTypeAwareBuilder implements
         this.revision = revision;
     }
 
         this.revision = revision;
     }
 
+    @Override
+    public int getLine() {
+        return line;
+    }
+
     public List<TypeDefinition<?>> getTypes() {
         return types;
     }
     public List<TypeDefinition<?>> getTypes() {
         return types;
     }
index f24502bab2903d2ba545be05547c521f3ab26339..c2c32ca347b4ae52d44b2111f08cd2de184217fa 100644 (file)
@@ -19,14 +19,16 @@ import org.opendaylight.controller.yang.model.parser.builder.api.SchemaNodeBuild
 
 public class UnknownSchemaNodeBuilder implements SchemaNodeBuilder {
     private final UnknownSchemaNodeImpl instance;
 
 public class UnknownSchemaNodeBuilder implements SchemaNodeBuilder {
     private final UnknownSchemaNodeImpl instance;
+    private final int line;
     private final QName qname;
     private SchemaPath schemaPath;
     private final List<UnknownSchemaNodeBuilder> addedUnknownNodes = new ArrayList<UnknownSchemaNodeBuilder>();
     private QName nodeType;
     private String nodeParameter;
 
     private final QName qname;
     private SchemaPath schemaPath;
     private final List<UnknownSchemaNodeBuilder> addedUnknownNodes = new ArrayList<UnknownSchemaNodeBuilder>();
     private QName nodeType;
     private String nodeParameter;
 
-    UnknownSchemaNodeBuilder(final QName qname) {
+    UnknownSchemaNodeBuilder(final QName qname, final int line) {
         this.qname = qname;
         this.qname = qname;
+        this.line = line;
         instance = new UnknownSchemaNodeImpl(qname);
     }
 
         instance = new UnknownSchemaNodeImpl(qname);
     }
 
@@ -45,6 +47,11 @@ public class UnknownSchemaNodeBuilder implements SchemaNodeBuilder {
         return instance;
     }
 
         return instance;
     }
 
+    @Override
+    public int getLine() {
+        return line;
+    }
+
     @Override
     public QName getQName() {
         return qname;
     @Override
     public QName getQName() {
         return qname;
index 05d2faa4099e61e38c47e15fe69447ce79faaa35..65bdf6e03a6b30b3aebcf9d0703aedf90f4826b9 100644 (file)
@@ -28,13 +28,15 @@ import org.opendaylight.controller.yang.model.parser.util.RefineHolder;
 \r
 final class UsesNodeBuilderImpl implements UsesNodeBuilder, Builder {\r
     private final UsesNodeImpl instance;\r
 \r
 final class UsesNodeBuilderImpl implements UsesNodeBuilder, Builder {\r
     private final UsesNodeImpl instance;\r
+    private final int line;\r
     private final SchemaPath groupingPath;\r
     private final Set<AugmentationSchemaBuilder> addedAugments = new HashSet<AugmentationSchemaBuilder>();\r
     private List<SchemaNodeBuilder> refineBuilders = new ArrayList<SchemaNodeBuilder>();\r
     private List<RefineHolder> refines = new ArrayList<RefineHolder>();\r
 \r
     private final SchemaPath groupingPath;\r
     private final Set<AugmentationSchemaBuilder> addedAugments = new HashSet<AugmentationSchemaBuilder>();\r
     private List<SchemaNodeBuilder> refineBuilders = new ArrayList<SchemaNodeBuilder>();\r
     private List<RefineHolder> refines = new ArrayList<RefineHolder>();\r
 \r
-    UsesNodeBuilderImpl(final String groupingPathStr) {\r
+    UsesNodeBuilderImpl(final String groupingPathStr, final int line) {\r
         this.groupingPath = parseUsesPath(groupingPathStr);\r
         this.groupingPath = parseUsesPath(groupingPathStr);\r
+        this.line = line;\r
         instance = new UsesNodeImpl(groupingPath);\r
     }\r
 \r
         instance = new UsesNodeImpl(groupingPath);\r
     }\r
 \r
@@ -49,7 +51,7 @@ final class UsesNodeBuilderImpl implements UsesNodeBuilder, Builder {
 \r
         // REFINES\r
         final Map<SchemaPath, SchemaNode> refineNodes = new HashMap<SchemaPath, SchemaNode>();\r
 \r
         // REFINES\r
         final Map<SchemaPath, SchemaNode> refineNodes = new HashMap<SchemaPath, SchemaNode>();\r
-        for(SchemaNodeBuilder refineBuilder : refineBuilders) {\r
+        for (SchemaNodeBuilder refineBuilder : refineBuilders) {\r
             SchemaNode refineNode = refineBuilder.build();\r
             refineNodes.put(refineNode.getPath(), refineNode);\r
         }\r
             SchemaNode refineNode = refineBuilder.build();\r
             refineNodes.put(refineNode.getPath(), refineNode);\r
         }\r
@@ -58,6 +60,11 @@ final class UsesNodeBuilderImpl implements UsesNodeBuilder, Builder {
         return instance;\r
     }\r
 \r
         return instance;\r
     }\r
 \r
+    @Override\r
+    public int getLine() {\r
+        return line;\r
+    }\r
+\r
     @Override\r
     public SchemaPath getGroupingPath() {\r
         return groupingPath;\r
     @Override\r
     public SchemaPath getGroupingPath() {\r
         return groupingPath;\r
@@ -126,7 +133,8 @@ final class UsesNodeBuilderImpl implements UsesNodeBuilder, Builder {
             return augmentations;\r
         }\r
 \r
             return augmentations;\r
         }\r
 \r
-        private void setAugmentations(final Set<AugmentationSchema> augmentations) {\r
+        private void setAugmentations(\r
+                final Set<AugmentationSchema> augmentations) {\r
             if (augmentations != null) {\r
                 this.augmentations = augmentations;\r
             }\r
             if (augmentations != null) {\r
                 this.augmentations = augmentations;\r
             }\r
@@ -147,7 +155,7 @@ final class UsesNodeBuilderImpl implements UsesNodeBuilder, Builder {
         }\r
 \r
         private void setRefines(Map<SchemaPath, SchemaNode> refines) {\r
         }\r
 \r
         private void setRefines(Map<SchemaPath, SchemaNode> refines) {\r
-            if(refines != null) {\r
+            if (refines != null) {\r
                 this.refines = refines;\r
             }\r
         }\r
                 this.refines = refines;\r
             }\r
         }\r
index 35c04a8713bcae29908491b443b726a5a83aabe6..c7bd7f57e843842f560f6ea5a0c0f049ba220fe5 100644 (file)
@@ -318,9 +318,10 @@ public class YangModelParserImpl implements YangModelParser {
 
         // search for module which contains referenced typedef
         final ModuleBuilder dependentModule = findDependentModule(modules,
 
         // search for module which contains referenced typedef
         final ModuleBuilder dependentModule = findDependentModule(modules,
-                builder, unknownTypeQName.getPrefix());
+                builder, unknownTypeQName.getPrefix(), nodeToResolve.getLine());
         final TypeDefinitionBuilder lookedUpBuilder = findTypedefBuilderByName(
         final TypeDefinitionBuilder lookedUpBuilder = findTypedefBuilderByName(
-                dependentModule, unknownTypeQName.getLocalName());
+                dependentModule, unknownTypeQName.getLocalName(),
+                builder.getName(), nodeToResolve.getLine());
 
         final TypeDefinitionBuilder lookedUpBuilderCopy = copyTypedefBuilder(
                 lookedUpBuilder, nodeToResolve instanceof TypeDefinitionBuilder);
 
         final TypeDefinitionBuilder lookedUpBuilderCopy = copyTypedefBuilder(
                 lookedUpBuilder, nodeToResolve instanceof TypeDefinitionBuilder);
@@ -344,9 +345,10 @@ public class YangModelParserImpl implements YangModelParser {
         final QName unknownTypeQName = unknownType.getQName();
         // search for module which contains referenced typedef
         final ModuleBuilder dependentModule = findDependentModule(modules,
         final QName unknownTypeQName = unknownType.getQName();
         // search for module which contains referenced typedef
         final ModuleBuilder dependentModule = findDependentModule(modules,
-                module, unknownTypeQName.getPrefix());
+                module, unknownTypeQName.getPrefix(), nodeToResolve.getLine());
         final TypeDefinitionBuilder lookedUpBuilder = findTypedefBuilderByName(
         final TypeDefinitionBuilder lookedUpBuilder = findTypedefBuilderByName(
-                dependentModule, unknownTypeQName.getLocalName());
+                dependentModule, unknownTypeQName.getLocalName(),
+                module.getName(), nodeToResolve.getLine());
 
         final TypeDefinitionBuilder lookedUpBuilderCopy = copyTypedefBuilder(
                 lookedUpBuilder, nodeToResolve instanceof TypeDefinitionBuilder);
 
         final TypeDefinitionBuilder lookedUpBuilderCopy = copyTypedefBuilder(
                 lookedUpBuilder, nodeToResolve instanceof TypeDefinitionBuilder);
@@ -361,7 +363,7 @@ public class YangModelParserImpl implements YangModelParser {
             final UnionTypeBuilder oldUnion = (UnionTypeBuilder) old;
             final UnionTypeBuilder newUnion = new UnionTypeBuilder(
                     oldUnion.getActualPath(), oldUnion.getNamespace(),
             final UnionTypeBuilder oldUnion = (UnionTypeBuilder) old;
             final UnionTypeBuilder newUnion = new UnionTypeBuilder(
                     oldUnion.getActualPath(), oldUnion.getNamespace(),
-                    oldUnion.getRevision());
+                    oldUnion.getRevision(), old.getLine());
             for (TypeDefinition<?> td : oldUnion.getTypes()) {
                 newUnion.setType(td);
             }
             for (TypeDefinition<?> td : oldUnion.getTypes()) {
                 newUnion.setType(td);
             }
@@ -375,7 +377,8 @@ public class YangModelParserImpl implements YangModelParser {
         final QName newName = new QName(oldName.getNamespace(),
                 oldName.getRevision(), oldName.getPrefix(),
                 oldName.getLocalName());
         final QName newName = new QName(oldName.getNamespace(),
                 oldName.getRevision(), oldName.getPrefix(),
                 oldName.getLocalName());
-        final TypeDefinitionBuilder tdb = new TypedefBuilder(newName);
+        final TypeDefinitionBuilder tdb = new TypedefBuilder(newName,
+                old.getLine());
 
         tdb.setRanges(old.getRanges());
         tdb.setLengths(old.getLengths());
 
         tdb.setRanges(old.getRanges());
         tdb.setLengths(old.getLengths());
@@ -432,7 +435,7 @@ public class YangModelParserImpl implements YangModelParser {
             final QName unknownTypeQName = unknownType.getQName();
             final String unknownTypePrefix = unknownTypeQName.getPrefix();
             final ModuleBuilder dependentModule = findDependentModule(modules,
             final QName unknownTypeQName = unknownType.getQName();
             final String unknownTypePrefix = unknownTypeQName.getPrefix();
             final ModuleBuilder dependentModule = findDependentModule(modules,
-                    builder, unknownTypePrefix);
+                    builder, unknownTypePrefix, copy.getLine());
             final TypeDefinitionBuilder utBuilder = getTypedefBuilder(copy,
                     modules, dependentModule);
             copy.setType(utBuilder);
             final TypeDefinitionBuilder utBuilder = getTypedefBuilder(copy,
                     modules, dependentModule);
             copy.setType(utBuilder);
@@ -454,12 +457,13 @@ public class YangModelParserImpl implements YangModelParser {
     private TypeDefinitionBuilder findTypedefBuilder(
             final QName unknownTypeQName,
             final Map<String, TreeMap<Date, ModuleBuilder>> modules,
     private TypeDefinitionBuilder findTypedefBuilder(
             final QName unknownTypeQName,
             final Map<String, TreeMap<Date, ModuleBuilder>> modules,
-            final ModuleBuilder builder) {
+            final ModuleBuilder builder, int line) {
         // search for module which contains referenced typedef
         final ModuleBuilder dependentModule = findDependentModule(modules,
         // search for module which contains referenced typedef
         final ModuleBuilder dependentModule = findDependentModule(modules,
-                builder, unknownTypeQName.getPrefix());
+                builder, unknownTypeQName.getPrefix(), line);
         final TypeDefinitionBuilder lookedUpBuilder = findTypedefBuilderByName(
         final TypeDefinitionBuilder lookedUpBuilder = findTypedefBuilderByName(
-                dependentModule, unknownTypeQName.getLocalName());
+                dependentModule, unknownTypeQName.getLocalName(),
+                builder.getName(), line);
         return copyTypedefBuilder(lookedUpBuilder, true);
     }
 
         return copyTypedefBuilder(lookedUpBuilder, true);
     }
 
@@ -502,8 +506,9 @@ public class YangModelParserImpl implements YangModelParser {
             fractionDigits = ext.getFractionDigits();
             constraints.setFractionDigits(fractionDigits);
             return findConstraints(
             fractionDigits = ext.getFractionDigits();
             constraints.setFractionDigits(fractionDigits);
             return findConstraints(
-                    findTypedefBuilder(ext.getQName(), modules, builder),
-                    constraints, modules, builder);
+                    findTypedefBuilder(ext.getQName(), modules, builder,
+                            nodeToResolve.getLine()), constraints, modules,
+                    builder);
         } else if (referencedType instanceof UnknownType) {
             final UnknownType unknown = (UnknownType) referencedType;
             ranges = unknown.getRangeStatements();
         } else if (referencedType instanceof UnknownType) {
             final UnknownType unknown = (UnknownType) referencedType;
             ranges = unknown.getRangeStatements();
@@ -520,9 +525,11 @@ public class YangModelParserImpl implements YangModelParser {
                 unknownTypePrefix = builder.getPrefix();
             }
             final ModuleBuilder dependentModule = findDependentModule(modules,
                 unknownTypePrefix = builder.getPrefix();
             }
             final ModuleBuilder dependentModule = findDependentModule(modules,
-                    builder, unknown.getQName().getPrefix());
+                    builder, unknown.getQName().getPrefix(),
+                    nodeToResolve.getLine());
             final TypeDefinitionBuilder utBuilder = findTypedefBuilder(
             final TypeDefinitionBuilder utBuilder = findTypedefBuilder(
-                    unknown.getQName(), modules, builder);
+                    unknown.getQName(), modules, builder,
+                    nodeToResolve.getLine());
             return findConstraints(utBuilder, constraints, modules,
                     dependentModule);
         } else {
             return findConstraints(utBuilder, constraints, modules,
                     dependentModule);
         } else {
@@ -543,7 +550,8 @@ public class YangModelParserImpl implements YangModelParser {
      * @return typedef with name equals to given name
      */
     private TypeDefinitionBuilder findTypedefBuilderByName(
      * @return typedef with name equals to given name
      */
     private TypeDefinitionBuilder findTypedefBuilderByName(
-            final ModuleBuilder dependentModule, final String name) {
+            final ModuleBuilder dependentModule, final String name,
+            final String currentModuleName, final int line) {
         TypeDefinitionBuilder result = null;
         final Set<TypeDefinitionBuilder> typedefs = dependentModule
                 .getModuleTypedefs();
         TypeDefinitionBuilder result = null;
         final Set<TypeDefinitionBuilder> typedefs = dependentModule
                 .getModuleTypedefs();
@@ -554,9 +562,9 @@ public class YangModelParserImpl implements YangModelParser {
             }
         }
         if (result == null) {
             }
         }
         if (result == null) {
-            throw new YangParseException("Target module '"
-                    + dependentModule.getName()
-                    + "' does not contain typedef '" + name + "'.");
+            throw new YangParseException(currentModuleName, line,
+                    "Target module '" + dependentModule.getName()
+                            + "' does not contain typedef '" + name + "'.");
         }
         return result;
     }
         }
         return result;
     }
@@ -661,7 +669,7 @@ public class YangModelParserImpl implements YangModelParser {
 
                 DataSchemaNodeBuilder currentParent = null;
                 final ModuleBuilder dependentModule = findDependentModule(
 
                 DataSchemaNodeBuilder currentParent = null;
                 final ModuleBuilder dependentModule = findDependentModule(
-                        modules, module, prefix);
+                        modules, module, prefix, augmentBuilder.getLine());
                 for (DataSchemaNodeBuilder child : dependentModule
                         .getChildNodes()) {
                     final QName childQName = child.getQName();
                 for (DataSchemaNodeBuilder child : dependentModule
                         .getChildNodes()) {
                     final QName childQName = child.getQName();
@@ -733,7 +741,7 @@ public class YangModelParserImpl implements YangModelParser {
                     baseIdentityLocalName = baseIdentityName;
                 }
                 final ModuleBuilder dependentModule = findDependentModule(
                     baseIdentityLocalName = baseIdentityName;
                 }
                 final ModuleBuilder dependentModule = findDependentModule(
-                        modules, module, baseIdentityPrefix);
+                        modules, module, baseIdentityPrefix, identity.getLine());
 
                 final Set<IdentitySchemaNodeBuilder> dependentModuleIdentities = dependentModule
                         .getAddedIdentities();
 
                 final Set<IdentitySchemaNodeBuilder> dependentModuleIdentities = dependentModule
                         .getAddedIdentities();
@@ -896,7 +904,7 @@ public class YangModelParserImpl implements YangModelParser {
             final ModuleBuilder module) {
         Builder result = null;
         final Builder lookedUpBuilder = findRefineTargetBuilder(groupingPath,
             final ModuleBuilder module) {
         Builder result = null;
         final Builder lookedUpBuilder = findRefineTargetBuilder(groupingPath,
-                refine.getName(), modules, module);
+                refine, modules, module);
         if (lookedUpBuilder instanceof LeafSchemaNodeBuilder) {
             result = ParserUtils
                     .copyLeafBuilder((LeafSchemaNodeBuilder) lookedUpBuilder);
         if (lookedUpBuilder instanceof LeafSchemaNodeBuilder) {
             result = ParserUtils
                     .copyLeafBuilder((LeafSchemaNodeBuilder) lookedUpBuilder);
@@ -916,8 +924,8 @@ public class YangModelParserImpl implements YangModelParser {
             result = ParserUtils
                     .copyAnyXmlBuilder((AnyXmlBuilder) lookedUpBuilder);
         } else {
             result = ParserUtils
                     .copyAnyXmlBuilder((AnyXmlBuilder) lookedUpBuilder);
         } else {
-            throw new YangParseException("Target '" + refine.getName()
-                    + "' can not be refined");
+            throw new YangParseException(module.getName(), refine.getLine(),
+                    "Target '" + refine.getName() + "' can not be refined");
         }
         return result;
     }
         }
         return result;
     }
@@ -937,7 +945,7 @@ public class YangModelParserImpl implements YangModelParser {
      *         otherwise
      */
     private Builder findRefineTargetBuilder(final String groupingPath,
      *         otherwise
      */
     private Builder findRefineTargetBuilder(final String groupingPath,
-            final String refineNodeName,
+            final RefineHolder refine,
             final Map<String, TreeMap<Date, ModuleBuilder>> modules,
             final ModuleBuilder module) {
         final SchemaPath path = ParserUtils.parseUsesPath(groupingPath);
             final Map<String, TreeMap<Date, ModuleBuilder>> modules,
             final ModuleBuilder module) {
         final SchemaPath path = ParserUtils.parseUsesPath(groupingPath);
@@ -952,13 +960,13 @@ public class YangModelParserImpl implements YangModelParser {
         }
 
         final ModuleBuilder dependentModule = findDependentModule(modules,
         }
 
         final ModuleBuilder dependentModule = findDependentModule(modules,
-                module, prefix);
+                module, prefix, refine.getLine());
         builderPath.add(0, "grouping");
         builderPath.add(0, dependentModule.getName());
         final GroupingBuilder builder = (GroupingBuilder) dependentModule
                 .getNode(builderPath);
 
         builderPath.add(0, "grouping");
         builderPath.add(0, dependentModule.getName());
         final GroupingBuilder builder = (GroupingBuilder) dependentModule
                 .getNode(builderPath);
 
-        return builder.getChildNode(refineNodeName);
+        return builder.getChildNode(refine.getName());
     }
 
     private QName findFullQName(
     }
 
     private QName findFullQName(
@@ -969,13 +977,13 @@ public class YangModelParserImpl implements YangModelParser {
         if (baseString.contains(":")) {
             String[] splittedBase = baseString.split(":");
             if (splittedBase.length > 2) {
         if (baseString.contains(":")) {
             String[] splittedBase = baseString.split(":");
             if (splittedBase.length > 2) {
-                throw new YangParseException(
+                throw new YangParseException(module.getName(), idref.getLine(),
                         "Failed to parse identityref base: " + baseString);
             }
             String prefix = splittedBase[0];
             String name = splittedBase[1];
             ModuleBuilder dependentModule = findDependentModule(modules,
                         "Failed to parse identityref base: " + baseString);
             }
             String prefix = splittedBase[0];
             String name = splittedBase[1];
             ModuleBuilder dependentModule = findDependentModule(modules,
-                    module, prefix);
+                    module, prefix, idref.getLine());
             result = new QName(dependentModule.getNamespace(),
                     dependentModule.getRevision(), prefix, name);
         } else {
             result = new QName(dependentModule.getNamespace(),
                     dependentModule.getRevision(), prefix, name);
         } else {
@@ -994,15 +1002,16 @@ public class YangModelParserImpl implements YangModelParser {
                     || nodeType.getRevision() == null) {
                 try {
                     ModuleBuilder dependentModule = findDependentModule(
                     || nodeType.getRevision() == null) {
                 try {
                     ModuleBuilder dependentModule = findDependentModule(
-                            modules, module, nodeType.getPrefix());
+                            modules, module, nodeType.getPrefix(),
+                            usnb.getLine());
                     QName newNodeType = new QName(
                             dependentModule.getNamespace(),
                             dependentModule.getRevision(),
                             nodeType.getPrefix(), nodeType.getLocalName());
                     usnb.setNodeType(newNodeType);
                 } catch (YangParseException e) {
                     QName newNodeType = new QName(
                             dependentModule.getNamespace(),
                             dependentModule.getRevision(),
                             nodeType.getPrefix(), nodeType.getLocalName());
                     usnb.setNodeType(newNodeType);
                 } catch (YangParseException e) {
-                    logger.debug("Failed to find unknown node type: "
-                            + nodeType);
+                    logger.debug(module.getName(), usnb.getLine(),
+                            "Failed to find unknown node type: " + nodeType);
                 }
             }
         }
                 }
             }
         }
@@ -1021,7 +1030,7 @@ public class YangModelParserImpl implements YangModelParser {
      */
     private ModuleBuilder findDependentModule(
             final Map<String, TreeMap<Date, ModuleBuilder>> modules,
      */
     private ModuleBuilder findDependentModule(
             final Map<String, TreeMap<Date, ModuleBuilder>> modules,
-            final ModuleBuilder module, final String prefix) {
+            final ModuleBuilder module, final String prefix, final int line) {
         ModuleBuilder dependentModule = null;
         Date dependentModuleRevision = null;
 
         ModuleBuilder dependentModule = null;
         Date dependentModuleRevision = null;
 
@@ -1031,8 +1040,8 @@ public class YangModelParserImpl implements YangModelParser {
             final ModuleImport dependentModuleImport = ParserUtils
                     .getModuleImport(module, prefix);
             if (dependentModuleImport == null) {
             final ModuleImport dependentModuleImport = ParserUtils
                     .getModuleImport(module, prefix);
             if (dependentModuleImport == null) {
-                throw new YangParseException("No import found with prefix '"
-                        + prefix + "' in module " + module.getName() + "'.");
+                throw new YangParseException(module.getName(), line,
+                        "No import found with prefix '" + prefix + "'.");
             }
             final String dependentModuleName = dependentModuleImport
                     .getModuleName();
             }
             final String dependentModuleName = dependentModuleImport
                     .getModuleName();
@@ -1041,10 +1050,9 @@ public class YangModelParserImpl implements YangModelParser {
             final TreeMap<Date, ModuleBuilder> moduleBuildersByRevision = modules
                     .get(dependentModuleName);
             if (moduleBuildersByRevision == null) {
             final TreeMap<Date, ModuleBuilder> moduleBuildersByRevision = modules
                     .get(dependentModuleName);
             if (moduleBuildersByRevision == null) {
-                throw new YangParseException(
+                throw new YangParseException(module.getName(), line,
                         "Failed to find dependent module '"
                         "Failed to find dependent module '"
-                                + dependentModuleName + "' needed by module '"
-                                + module.getName() + "'.");
+                                + dependentModuleName + "'.");
             }
             if (dependentModuleRevision == null) {
                 dependentModule = moduleBuildersByRevision.lastEntry()
             }
             if (dependentModuleRevision == null) {
                 dependentModule = moduleBuildersByRevision.lastEntry()
@@ -1056,7 +1064,7 @@ public class YangModelParserImpl implements YangModelParser {
         }
 
         if (dependentModule == null) {
         }
 
         if (dependentModule == null) {
-            throw new YangParseException(
+            throw new YangParseException(module.getName(), line,
                     "Failed to find dependent module with prefix '" + prefix
                             + "' and revision '" + dependentModuleRevision
                             + "'.");
                     "Failed to find dependent module with prefix '" + prefix
                             + "' and revision '" + dependentModuleRevision
                             + "'.");
index 98b81bd958d0ed338dc6c6a2521f233fa11928eb..511c610e3f42e25241e8ae2e01c82c3a82e2bb78 100644 (file)
@@ -78,8 +78,8 @@ import org.opendaylight.controller.yang.model.util.YangTypesConverter;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-public final class YangModelParserListenerImpl extends YangParserBaseListener {\r
-\r
+public final class YangModelParserListenerImpl extends YangParserBaseListener {
+
     private static final Logger logger = LoggerFactory
             .getLogger(YangModelParserListenerImpl.class);
 
     private static final Logger logger = LoggerFactory
             .getLogger(YangModelParserListenerImpl.class);
 
@@ -90,7 +90,7 @@ public final class YangModelParserListenerImpl extends YangParserBaseListener {
     private String yangModelPrefix;
     private Date revision = new Date(0L);
 
     private String yangModelPrefix;
     private Date revision = new Date(0L);
 
-    public final static DateFormat simpleDateFormat = new SimpleDateFormat(\r
+    public final static DateFormat simpleDateFormat = new SimpleDateFormat(
             "yyyy-MM-dd");
     private final Stack<String> actualPath = new Stack<String>();
 
             "yyyy-MM-dd");
     private final Stack<String> actualPath = new Stack<String>();
 
@@ -238,7 +238,7 @@ public final class YangModelParserListenerImpl extends YangParserBaseListener {
     public void enterAugment_stmt(YangParser.Augment_stmtContext ctx) {
         final String augmentPath = stringFromNode(ctx);
         AugmentationSchemaBuilder builder = moduleBuilder.addAugment(
     public void enterAugment_stmt(YangParser.Augment_stmtContext ctx) {
         final String augmentPath = stringFromNode(ctx);
         AugmentationSchemaBuilder builder = moduleBuilder.addAugment(
-                augmentPath, actualPath);
+                augmentPath, actualPath, ctx.getStart().getLine());
         updatePath(augmentPath);
 
         for (int i = 0; i < ctx.getChildCount(); i++) {
         updatePath(augmentPath);
 
         for (int i = 0; i < ctx.getChildCount(); i++) {
@@ -269,7 +269,8 @@ public final class YangModelParserListenerImpl extends YangParserBaseListener {
     public void enterExtension_stmt(YangParser.Extension_stmtContext ctx) {
         final String extName = stringFromNode(ctx);
         QName qname = new QName(namespace, revision, yangModelPrefix, extName);
     public void enterExtension_stmt(YangParser.Extension_stmtContext ctx) {
         final String extName = stringFromNode(ctx);
         QName qname = new QName(namespace, revision, yangModelPrefix, extName);
-        ExtensionBuilder builder = moduleBuilder.addExtension(qname);
+        ExtensionBuilder builder = moduleBuilder.addExtension(qname, ctx
+                .getStart().getLine());
         parseSchemaNodeArgs(ctx, builder);
 
         String argument = null;
         parseSchemaNodeArgs(ctx, builder);
 
         String argument = null;
@@ -292,7 +293,7 @@ public final class YangModelParserListenerImpl extends YangParserBaseListener {
         QName typedefQName = new QName(namespace, revision, yangModelPrefix,
                 typedefName);
         TypedefBuilder builder = moduleBuilder.addTypedef(typedefQName,
         QName typedefQName = new QName(namespace, revision, yangModelPrefix,
                 typedefName);
         TypedefBuilder builder = moduleBuilder.addTypedef(typedefQName,
-                actualPath);
+                actualPath, ctx.getStart().getLine());
         updatePath(typedefName);
 
         builder.setPath(createActualSchemaPath(actualPath, namespace, revision,
         updatePath(typedefName);
 
         builder.setPath(createActualSchemaPath(actualPath, namespace, revision,
@@ -310,7 +311,8 @@ public final class YangModelParserListenerImpl extends YangParserBaseListener {
     @Override
     public void enterType_stmt(YangParser.Type_stmtContext ctx) {
         final String typeName = stringFromNode(ctx);
     @Override
     public void enterType_stmt(YangParser.Type_stmtContext ctx) {
         final String typeName = stringFromNode(ctx);
-        QName typeQName = parseQName(typeName);
+        final int line = ctx.getStart().getLine();
+        final QName typeQName = parseQName(typeName);
 
         TypeDefinition<?> type = null;
         Type_body_stmtsContext typeBody = null;
 
         TypeDefinition<?> type = null;
         Type_body_stmtsContext typeBody = null;
@@ -324,15 +326,22 @@ public final class YangModelParserListenerImpl extends YangParserBaseListener {
         // if this is base yang type...
         if (YangTypesConverter.isBaseYangType(typeName)) {
             if (typeBody == null) {
         // if this is base yang type...
         if (YangTypesConverter.isBaseYangType(typeName)) {
             if (typeBody == null) {
+                // check for types which must have body
+                checkMissingBody(typeName, moduleName, line);
                 // if there are no constraints, just grab default base yang type
                 // if there are no constraints, just grab default base yang type
-                type = YangTypesConverter.javaTypeForBaseYangType(actualPath, namespace, revision, typeName);
+                type = YangTypesConverter.javaTypeForBaseYangType(actualPath,
+                        namespace, revision, typeName);
                 moduleBuilder.setType(type, actualPath);
             } else {
                 if ("union".equals(typeName)) {
                 moduleBuilder.setType(type, actualPath);
             } else {
                 if ("union".equals(typeName)) {
-                    moduleBuilder.addUnionType(actualPath, namespace, revision);
-                } else if("identityref".equals(typeName)) {
-                    SchemaPath path = createActualSchemaPath(actualPath, namespace, revision, yangModelPrefix);
-                    moduleBuilder.addIdentityrefType(getIdentityrefBase(typeBody), actualPath, path);
+                    moduleBuilder.addUnionType(actualPath, namespace, revision,
+                            line);
+                } else if ("identityref".equals(typeName)) {
+                    SchemaPath path = createActualSchemaPath(actualPath,
+                            namespace, revision, yangModelPrefix);
+                    moduleBuilder.addIdentityrefType(
+                            getIdentityrefBase(typeBody), actualPath, path,
+                            line);
                 } else {
                     List<String> typePath = new ArrayList<String>(actualPath);
                     typePath.remove(0);
                 } else {
                     List<String> typePath = new ArrayList<String>(actualPath);
                     typePath.remove(0);
@@ -381,7 +390,7 @@ public final class YangModelParserListenerImpl extends YangParserBaseListener {
         QName groupQName = new QName(namespace, revision, yangModelPrefix,
                 groupName);
         GroupingBuilder groupBuilder = moduleBuilder.addGrouping(groupQName,
         QName groupQName = new QName(namespace, revision, yangModelPrefix,
                 groupName);
         GroupingBuilder groupBuilder = moduleBuilder.addGrouping(groupQName,
-                actualPath);
+                actualPath, ctx.getStart().getLine());
         updatePath("grouping");
         updatePath(groupName);
         parseSchemaNodeArgs(ctx, groupBuilder);
         updatePath("grouping");
         updatePath(groupName);
         parseSchemaNodeArgs(ctx, groupBuilder);
@@ -400,7 +409,8 @@ public final class YangModelParserListenerImpl extends YangParserBaseListener {
         QName containerQName = new QName(namespace, revision, yangModelPrefix,
                 containerName);
         ContainerSchemaNodeBuilder containerBuilder = moduleBuilder
         QName containerQName = new QName(namespace, revision, yangModelPrefix,
                 containerName);
         ContainerSchemaNodeBuilder containerBuilder = moduleBuilder
-                .addContainerNode(containerQName, actualPath);
+                .addContainerNode(containerQName, actualPath, ctx.getStart()
+                        .getLine());
         updatePath(containerName);
 
         containerBuilder.setPath(createActualSchemaPath(actualPath, namespace,
         updatePath(containerName);
 
         containerBuilder.setPath(createActualSchemaPath(actualPath, namespace,
@@ -429,7 +439,7 @@ public final class YangModelParserListenerImpl extends YangParserBaseListener {
         QName leafQName = new QName(namespace, revision, yangModelPrefix,
                 leafName);
         LeafSchemaNodeBuilder leafBuilder = moduleBuilder.addLeafNode(
         QName leafQName = new QName(namespace, revision, yangModelPrefix,
                 leafName);
         LeafSchemaNodeBuilder leafBuilder = moduleBuilder.addLeafNode(
-                leafQName, actualPath);
+                leafQName, actualPath, ctx.getStart().getLine());
         updatePath(leafName);
 
         leafBuilder.setPath(createActualSchemaPath(actualPath, namespace,
         updatePath(leafName);
 
         leafBuilder.setPath(createActualSchemaPath(actualPath, namespace,
@@ -460,8 +470,8 @@ public final class YangModelParserListenerImpl extends YangParserBaseListener {
     @Override
     public void enterUses_stmt(YangParser.Uses_stmtContext ctx) {
         final String groupingPathStr = stringFromNode(ctx);
     @Override
     public void enterUses_stmt(YangParser.Uses_stmtContext ctx) {
         final String groupingPathStr = stringFromNode(ctx);
-        moduleBuilder.addUsesNode(groupingPathStr,
-                actualPath);
+        moduleBuilder.addUsesNode(groupingPathStr, actualPath, ctx.getStart()
+                .getLine());
         updatePath(groupingPathStr);
     }
 
         updatePath(groupingPathStr);
     }
 
@@ -491,7 +501,8 @@ public final class YangModelParserListenerImpl extends YangParserBaseListener {
         QName leafListQName = new QName(namespace, revision, yangModelPrefix,
                 leafListName);
         LeafListSchemaNodeBuilder leafListBuilder = moduleBuilder
         QName leafListQName = new QName(namespace, revision, yangModelPrefix,
                 leafListName);
         LeafListSchemaNodeBuilder leafListBuilder = moduleBuilder
-                .addLeafListNode(leafListQName, actualPath);
+                .addLeafListNode(leafListQName, actualPath, ctx.getStart()
+                        .getLine());
         updatePath(leafListName);
 
         parseSchemaNodeArgs(ctx, leafListBuilder);
         updatePath(leafListName);
 
         parseSchemaNodeArgs(ctx, leafListBuilder);
@@ -520,7 +531,7 @@ public final class YangModelParserListenerImpl extends YangParserBaseListener {
         QName containerQName = new QName(namespace, revision, yangModelPrefix,
                 containerName);
         ListSchemaNodeBuilder listBuilder = moduleBuilder.addListNode(
         QName containerQName = new QName(namespace, revision, yangModelPrefix,
                 containerName);
         ListSchemaNodeBuilder listBuilder = moduleBuilder.addListNode(
-                containerQName, actualPath);
+                containerQName, actualPath, ctx.getStart().getLine());
         updatePath(containerName);
 
         listBuilder.setPath(createActualSchemaPath(actualPath, namespace,
         updatePath(containerName);
 
         listBuilder.setPath(createActualSchemaPath(actualPath, namespace,
@@ -556,7 +567,7 @@ public final class YangModelParserListenerImpl extends YangParserBaseListener {
         QName anyXmlQName = new QName(namespace, revision, yangModelPrefix,
                 anyXmlName);
         AnyXmlBuilder anyXmlBuilder = moduleBuilder.addAnyXml(anyXmlQName,
         QName anyXmlQName = new QName(namespace, revision, yangModelPrefix,
                 anyXmlName);
         AnyXmlBuilder anyXmlBuilder = moduleBuilder.addAnyXml(anyXmlQName,
-                actualPath);
+                actualPath, ctx.getStart().getLine());
         updatePath(anyXmlName);
 
         anyXmlBuilder.setPath(createActualSchemaPath(actualPath, namespace,
         updatePath(anyXmlName);
 
         anyXmlBuilder.setPath(createActualSchemaPath(actualPath, namespace,
@@ -577,7 +588,7 @@ public final class YangModelParserListenerImpl extends YangParserBaseListener {
         QName choiceQName = new QName(namespace, revision, yangModelPrefix,
                 choiceName);
         ChoiceBuilder choiceBuilder = moduleBuilder.addChoice(choiceQName,
         QName choiceQName = new QName(namespace, revision, yangModelPrefix,
                 choiceName);
         ChoiceBuilder choiceBuilder = moduleBuilder.addChoice(choiceQName,
-                actualPath);
+                actualPath, ctx.getStart().getLine());
 
         updatePath(choiceName);
         choiceBuilder.setPath(createActualSchemaPath(actualPath, namespace,
 
         updatePath(choiceName);
         choiceBuilder.setPath(createActualSchemaPath(actualPath, namespace,
@@ -608,7 +619,7 @@ public final class YangModelParserListenerImpl extends YangParserBaseListener {
         QName choiceQName = new QName(namespace, revision, yangModelPrefix,
                 caseName);
         ChoiceCaseBuilder caseBuilder = moduleBuilder.addCase(choiceQName,
         QName choiceQName = new QName(namespace, revision, yangModelPrefix,
                 caseName);
         ChoiceCaseBuilder caseBuilder = moduleBuilder.addCase(choiceQName,
-                actualPath);
+                actualPath, ctx.getStart().getLine());
 
         updatePath(caseName);
         caseBuilder.setPath(createActualSchemaPath(actualPath, namespace,
 
         updatePath(caseName);
         caseBuilder.setPath(createActualSchemaPath(actualPath, namespace,
@@ -629,7 +640,8 @@ public final class YangModelParserListenerImpl extends YangParserBaseListener {
         QName notificationQName = new QName(namespace, revision,
                 yangModelPrefix, notificationName);
         NotificationBuilder notificationBuilder = moduleBuilder
         QName notificationQName = new QName(namespace, revision,
                 yangModelPrefix, notificationName);
         NotificationBuilder notificationBuilder = moduleBuilder
-                .addNotification(notificationQName, actualPath);
+                .addNotification(notificationQName, actualPath, ctx.getStart()
+                        .getLine());
         updatePath(notificationName);
 
         notificationBuilder.setPath(createActualSchemaPath(actualPath,
         updatePath(notificationName);
 
         notificationBuilder.setPath(createActualSchemaPath(actualPath,
@@ -652,7 +664,8 @@ public final class YangModelParserListenerImpl extends YangParserBaseListener {
         final String nodeTypeStr = ctx.getChild(0).getText();
         final String[] splittedElement = nodeTypeStr.split(":");
         if (splittedElement.length == 1) {
         final String nodeTypeStr = ctx.getChild(0).getText();
         final String[] splittedElement = nodeTypeStr.split(":");
         if (splittedElement.length == 1) {
-            nodeType = new QName(null, null, yangModelPrefix, splittedElement[0]);
+            nodeType = new QName(null, null, yangModelPrefix,
+                    splittedElement[0]);
         } else {
             nodeType = new QName(null, null, splittedElement[0],
                     splittedElement[1]);
         } else {
             nodeType = new QName(null, null, splittedElement[0],
                     splittedElement[1]);
@@ -668,11 +681,12 @@ public final class YangModelParserListenerImpl extends YangParserBaseListener {
                         splittedName[0]);
             }
         } else {
                         splittedName[0]);
             }
         } else {
-            qname = new QName(namespace, revision, yangModelPrefix, nodeParameter);
+            qname = new QName(namespace, revision, yangModelPrefix,
+                    nodeParameter);
         }
 
         UnknownSchemaNodeBuilder builder = moduleBuilder.addUnknownSchemaNode(
         }
 
         UnknownSchemaNodeBuilder builder = moduleBuilder.addUnknownSchemaNode(
-                qname, actualPath);
+                qname, actualPath, ctx.getStart().getLine());
         builder.setNodeType(nodeType);
         builder.setNodeParameter(nodeParameter);
         updatePath(nodeParameter);
         builder.setNodeType(nodeType);
         builder.setNodeParameter(nodeParameter);
         updatePath(nodeParameter);
@@ -693,7 +707,7 @@ public final class YangModelParserListenerImpl extends YangParserBaseListener {
         QName rpcQName = new QName(namespace, revision, yangModelPrefix,
                 rpcName);
         RpcDefinitionBuilder rpcBuilder = moduleBuilder.addRpc(rpcQName,
         QName rpcQName = new QName(namespace, revision, yangModelPrefix,
                 rpcName);
         RpcDefinitionBuilder rpcBuilder = moduleBuilder.addRpc(rpcQName,
-                actualPath);
+                actualPath, ctx.getStart().getLine());
         updatePath(rpcName);
 
         rpcBuilder.setPath(createActualSchemaPath(actualPath, namespace,
         updatePath(rpcName);
 
         rpcBuilder.setPath(createActualSchemaPath(actualPath, namespace,
@@ -735,7 +749,7 @@ public final class YangModelParserListenerImpl extends YangParserBaseListener {
         QName featureQName = new QName(namespace, revision, yangModelPrefix,
                 featureName);
         FeatureBuilder featureBuilder = moduleBuilder.addFeature(featureQName,
         QName featureQName = new QName(namespace, revision, yangModelPrefix,
                 featureName);
         FeatureBuilder featureBuilder = moduleBuilder.addFeature(featureQName,
-                actualPath);
+                actualPath, ctx.getStart().getLine());
         updatePath(featureName);
 
         featureBuilder.setPath(createActualSchemaPath(actualPath, namespace,
         updatePath(featureName);
 
         featureBuilder.setPath(createActualSchemaPath(actualPath, namespace,
@@ -755,7 +769,7 @@ public final class YangModelParserListenerImpl extends YangParserBaseListener {
         String reference = null;
         String deviate = null;
         DeviationBuilder builder = moduleBuilder.addDeviation(targetPath,
         String reference = null;
         String deviate = null;
         DeviationBuilder builder = moduleBuilder.addDeviation(targetPath,
-                actualPath);
+                actualPath, ctx.getStart().getLine());
         updatePath(targetPath);
 
         for (int i = 0; i < ctx.getChildCount(); i++) {
         updatePath(targetPath);
 
         for (int i = 0; i < ctx.getChildCount(); i++) {
@@ -793,8 +807,8 @@ public final class YangModelParserListenerImpl extends YangParserBaseListener {
         final String identityName = stringFromNode(ctx);
         final QName identityQName = new QName(namespace, revision,
                 yangModelPrefix, identityName);
         final String identityName = stringFromNode(ctx);
         final QName identityQName = new QName(namespace, revision,
                 yangModelPrefix, identityName);
-        IdentitySchemaNodeBuilder builder = moduleBuilder
-                .addIdentity(identityQName, actualPath);
+        IdentitySchemaNodeBuilder builder = moduleBuilder.addIdentity(
+                identityQName, actualPath, ctx.getStart().getLine());
         updatePath(identityName);
 
         builder.setPath(createActualSchemaPath(actualPath, namespace, revision,
         updatePath(identityName);
 
         builder.setPath(createActualSchemaPath(actualPath, namespace, revision,
index fa88a29981335c1f34c834decbc0f2bb366e53f7..8237da69b0d6fa04f1ae5be237fa4442352f0b2f 100644 (file)
@@ -103,7 +103,7 @@ public final class ParserUtils {
     public static LeafSchemaNodeBuilder copyLeafBuilder(
             final LeafSchemaNodeBuilder old) {
         final LeafSchemaNodeBuilder copy = new LeafSchemaNodeBuilder(
     public static LeafSchemaNodeBuilder copyLeafBuilder(
             final LeafSchemaNodeBuilder old) {
         final LeafSchemaNodeBuilder copy = new LeafSchemaNodeBuilder(
-                old.getQName());
+                old.getQName(), old.getLine());
         final TypeDefinition<?> type = old.getType();
 
         if (type == null) {
         final TypeDefinition<?> type = old.getType();
 
         if (type == null) {
@@ -129,7 +129,7 @@ public final class ParserUtils {
     public static ContainerSchemaNodeBuilder copyContainerBuilder(
             final ContainerSchemaNodeBuilder old) {
         final ContainerSchemaNodeBuilder copy = new ContainerSchemaNodeBuilder(
     public static ContainerSchemaNodeBuilder copyContainerBuilder(
             final ContainerSchemaNodeBuilder old) {
         final ContainerSchemaNodeBuilder copy = new ContainerSchemaNodeBuilder(
-                old.getQName());
+                old.getQName(), old.getLine());
         copy.setPath(old.getPath());
         copyConstraints(old, copy);
         for (UnknownSchemaNodeBuilder unknown : old.getUnknownNodes()) {
         copy.setPath(old.getPath());
         copyConstraints(old, copy);
         for (UnknownSchemaNodeBuilder unknown : old.getUnknownNodes()) {
@@ -165,7 +165,7 @@ public final class ParserUtils {
     public static ListSchemaNodeBuilder copyListBuilder(
             final ListSchemaNodeBuilder old) {
         final ListSchemaNodeBuilder copy = new ListSchemaNodeBuilder(
     public static ListSchemaNodeBuilder copyListBuilder(
             final ListSchemaNodeBuilder old) {
         final ListSchemaNodeBuilder copy = new ListSchemaNodeBuilder(
-                old.getQName());
+                old.getQName(), old.getLine());
         copy.setPath(old.getPath());
         copyConstraints(old, copy);
         for (UnknownSchemaNodeBuilder unknown : old.getUnknownNodes()) {
         copy.setPath(old.getPath());
         copyConstraints(old, copy);
         for (UnknownSchemaNodeBuilder unknown : old.getUnknownNodes()) {
@@ -201,7 +201,7 @@ public final class ParserUtils {
     public static LeafListSchemaNodeBuilder copyLeafListBuilder(
             final LeafListSchemaNodeBuilder old) {
         final LeafListSchemaNodeBuilder copy = new LeafListSchemaNodeBuilder(
     public static LeafListSchemaNodeBuilder copyLeafListBuilder(
             final LeafListSchemaNodeBuilder old) {
         final LeafListSchemaNodeBuilder copy = new LeafListSchemaNodeBuilder(
-                old.getQName());
+                old.getQName(), old.getLine());
         copy.setPath(old.getPath());
         copyConstraints(old, copy);
         final TypeDefinition<?> type = old.getType();
         copy.setPath(old.getPath());
         copyConstraints(old, copy);
         final TypeDefinition<?> type = old.getType();
@@ -226,7 +226,7 @@ public final class ParserUtils {
     }
 
     public static ChoiceBuilder copyChoiceBuilder(final ChoiceBuilder old) {
     }
 
     public static ChoiceBuilder copyChoiceBuilder(final ChoiceBuilder old) {
-        final ChoiceBuilder copy = new ChoiceBuilder(old.getQName());
+        final ChoiceBuilder copy = new ChoiceBuilder(old.getQName(), old.getLine());
         copy.setPath(old.getPath());
         copyConstraints(old, copy);
         for (ChoiceCaseBuilder caseBuilder : old.getCases()) {
         copy.setPath(old.getPath());
         copyConstraints(old, copy);
         for (ChoiceCaseBuilder caseBuilder : old.getCases()) {
@@ -254,7 +254,7 @@ public final class ParserUtils {
     }
 
     public static AnyXmlBuilder copyAnyXmlBuilder(final AnyXmlBuilder old) {
     }
 
     public static AnyXmlBuilder copyAnyXmlBuilder(final AnyXmlBuilder old) {
-        final AnyXmlBuilder copy = new AnyXmlBuilder(old.getQName());
+        final AnyXmlBuilder copy = new AnyXmlBuilder(old.getQName(), old.getLine());
         copy.setPath(old.getPath());
         copyConstraints(old, copy);
         for (UnknownSchemaNodeBuilder unknown : old.getUnknownNodes()) {
         copy.setPath(old.getPath());
         copyConstraints(old, copy);
         for (UnknownSchemaNodeBuilder unknown : old.getUnknownNodes()) {
index 0c31655610410e50ab929546e4d69464462df115..5a24773707898579f2db8a05b43a7104d3f9fae3 100644 (file)
@@ -16,6 +16,7 @@ import org.opendaylight.controller.yang.model.parser.builder.impl.UnknownSchemaN
 
 public final class RefineHolder implements Builder {
     private final String name;
 
 public final class RefineHolder implements Builder {
     private final String name;
+    private final int line;
     private String defaultStr;
     private String description;
     private String reference;
     private String defaultStr;
     private String description;
     private String reference;
@@ -27,8 +28,14 @@ public final class RefineHolder implements Builder {
     private Integer maxElements;
     private final List<UnknownSchemaNodeBuilder> addedUnknownNodes = new ArrayList<UnknownSchemaNodeBuilder>();
 
     private Integer maxElements;
     private final List<UnknownSchemaNodeBuilder> addedUnknownNodes = new ArrayList<UnknownSchemaNodeBuilder>();
 
-    public RefineHolder(final String name) {
+    public RefineHolder(final String name, final int line) {
         this.name = name;
         this.name = name;
+        this.line = line;
+    }
+
+    @Override
+    public int getLine() {
+        return line;
     }
 
     public String getDefaultStr() {
     }
 
     public String getDefaultStr() {
index fff33b63bd513baa2b4e435b6266e497ce5ea874..49b177eb6693d3394f5c2c51d40cbda9cbdfb54b 100644 (file)
@@ -550,6 +550,7 @@ public final class YangModelBuilderUtil {
      */
     private static List<RangeConstraint> parseRangeConstraints(
             final Range_stmtContext ctx) {
      */
     private static List<RangeConstraint> parseRangeConstraints(
             final Range_stmtContext ctx) {
+        final int line = ctx.getStart().getLine();
         List<RangeConstraint> rangeConstraints = new ArrayList<RangeConstraint>();
         String description = null;
         String reference = null;
         List<RangeConstraint> rangeConstraints = new ArrayList<RangeConstraint>();
         String description = null;
         String reference = null;
@@ -571,10 +572,11 @@ public final class YangModelBuilderUtil {
             Number min;
             Number max;
             if (splittedRangeDef.length == 1) {
             Number min;
             Number max;
             if (splittedRangeDef.length == 1) {
-                min = max = parseNumberConstraintValue(splittedRangeDef[0]);
+                min = max = parseNumberConstraintValue(splittedRangeDef[0],
+                        line);
             } else {
             } else {
-                min = parseNumberConstraintValue(splittedRangeDef[0]);
-                max = parseNumberConstraintValue(splittedRangeDef[1]);
+                min = parseNumberConstraintValue(splittedRangeDef[0], line);
+                max = parseNumberConstraintValue(splittedRangeDef[1], line);
             }
             RangeConstraint range = BaseConstraints.rangeConstraint(min, max,
                     description, reference);
             }
             RangeConstraint range = BaseConstraints.rangeConstraint(min, max,
                     description, reference);
@@ -618,6 +620,7 @@ public final class YangModelBuilderUtil {
      */
     private static List<LengthConstraint> parseLengthConstraints(
             final Length_stmtContext ctx) {
      */
     private static List<LengthConstraint> parseLengthConstraints(
             final Length_stmtContext ctx) {
+        final int line = ctx.getStart().getLine();
         List<LengthConstraint> lengthConstraints = new ArrayList<LengthConstraint>();
         String description = null;
         String reference = null;
         List<LengthConstraint> lengthConstraints = new ArrayList<LengthConstraint>();
         String description = null;
         String reference = null;
@@ -639,10 +642,11 @@ public final class YangModelBuilderUtil {
             Number min;
             Number max;
             if (splittedRangeDef.length == 1) {
             Number min;
             Number max;
             if (splittedRangeDef.length == 1) {
-                min = max = parseNumberConstraintValue(splittedRangeDef[0]);
+                min = max = parseNumberConstraintValue(splittedRangeDef[0],
+                        line);
             } else {
             } else {
-                min = parseNumberConstraintValue(splittedRangeDef[0]);
-                max = parseNumberConstraintValue(splittedRangeDef[1]);
+                min = parseNumberConstraintValue(splittedRangeDef[0], line);
+                max = parseNumberConstraintValue(splittedRangeDef[1], line);
             }
             LengthConstraint range = BaseConstraints.lengthConstraint(min, max,
                     description, reference);
             }
             LengthConstraint range = BaseConstraints.lengthConstraint(min, max,
                     description, reference);
@@ -658,7 +662,8 @@ public final class YangModelBuilderUtil {
      * @return wrapper object of primitive java type or UnknownBoundaryNumber if
      *         type is one of special YANG values 'min' or 'max'
      */
      * @return wrapper object of primitive java type or UnknownBoundaryNumber if
      *         type is one of special YANG values 'min' or 'max'
      */
-    private static Number parseNumberConstraintValue(final String value) {
+    private static Number parseNumberConstraintValue(final String value,
+            final int line) {
         Number result = null;
         if ("min".equals(value) || "max".equals(value)) {
             result = new UnknownBoundaryNumber(value);
         Number result = null;
         if ("min".equals(value) || "max".equals(value)) {
             result = new UnknownBoundaryNumber(value);
@@ -666,8 +671,8 @@ public final class YangModelBuilderUtil {
             try {
                 result = Long.valueOf(value);
             } catch (NumberFormatException e) {
             try {
                 result = Long.valueOf(value);
             } catch (NumberFormatException e) {
-                throw new YangParseException("Unable to parse range value '"
-                        + value + "'.", e);
+                throw new YangParseException("Error on line " + line
+                        + ": Unable to parse range value '" + value + "'.", e);
             }
         }
         return result;
             }
         }
         return result;
@@ -988,35 +993,45 @@ public final class YangModelBuilderUtil {
                 typeBody, actualPath, namespace, revision, prefix);
 
         if ("decimal64".equals(typeName)) {
                 typeBody, actualPath, namespace, revision, prefix);
 
         if ("decimal64".equals(typeName)) {
-            type = new Decimal64(actualPath, namespace, revision, fractionDigits);
+            type = new Decimal64(actualPath, namespace, revision,
+                    fractionDigits);
         } else if (typeName.startsWith("int")) {
             if (typeName.equals("int8")) {
         } else if (typeName.startsWith("int")) {
             if (typeName.equals("int8")) {
-                type = new Int8(actualPath, namespace, revision, rangeStatements, null, null);
+                type = new Int8(actualPath, namespace, revision,
+                        rangeStatements, null, null);
             } else if (typeName.equals("int16")) {
             } else if (typeName.equals("int16")) {
-                type = new Int16(actualPath, namespace, revision, rangeStatements, null, null);
+                type = new Int16(actualPath, namespace, revision,
+                        rangeStatements, null, null);
             } else if (typeName.equals("int32")) {
             } else if (typeName.equals("int32")) {
-                type = new Int32(actualPath, namespace, revision, rangeStatements, null, null);
+                type = new Int32(actualPath, namespace, revision,
+                        rangeStatements, null, null);
             } else if (typeName.equals("int64")) {
             } else if (typeName.equals("int64")) {
-                type = new Int64(actualPath, namespace, revision, rangeStatements, null, null);
+                type = new Int64(actualPath, namespace, revision,
+                        rangeStatements, null, null);
             }
         } else if (typeName.startsWith("uint")) {
             if (typeName.equals("uint8")) {
             }
         } else if (typeName.startsWith("uint")) {
             if (typeName.equals("uint8")) {
-                type = new Uint8(actualPath, namespace, revision, rangeStatements, null, null);
+                type = new Uint8(actualPath, namespace, revision,
+                        rangeStatements, null, null);
             } else if (typeName.equals("uint16")) {
             } else if (typeName.equals("uint16")) {
-                type = new Uint16(actualPath, namespace, revision, rangeStatements, null, null);
+                type = new Uint16(actualPath, namespace, revision,
+                        rangeStatements, null, null);
             } else if (typeName.equals("uint32")) {
             } else if (typeName.equals("uint32")) {
-                type = new Uint32(actualPath, namespace, revision, rangeStatements, null, null);
+                type = new Uint32(actualPath, namespace, revision,
+                        rangeStatements, null, null);
             } else if (typeName.equals("uint64")) {
             } else if (typeName.equals("uint64")) {
-                type = new Uint64(actualPath, namespace, revision, rangeStatements, null, null);
+                type = new Uint64(actualPath, namespace, revision,
+                        rangeStatements, null, null);
             }
         } else if ("enumeration".equals(typeName)) {
             type = new EnumerationType(actualPath, namespace, revision,
                     enumConstants);
         } else if ("string".equals(typeName)) {
             }
         } else if ("enumeration".equals(typeName)) {
             type = new EnumerationType(actualPath, namespace, revision,
                     enumConstants);
         } else if ("string".equals(typeName)) {
-            type = new StringType(actualPath, namespace, revision, lengthStatements, patternStatements);
+            type = new StringType(actualPath, namespace, revision,
+                    lengthStatements, patternStatements);
         } else if ("bits".equals(typeName)) {
         } else if ("bits".equals(typeName)) {
-            type = new BitsType(actualPath, namespace, revision, getBits(typeBody, actualPath, namespace,
-                    revision, prefix));
+            type = new BitsType(actualPath, namespace, revision, getBits(
+                    typeBody, actualPath, namespace, revision, prefix));
         } else if ("leafref".equals(typeName)) {
             final String path = parseLeafrefPath(typeBody);
             final boolean absolute = path.startsWith("/");
         } else if ("leafref".equals(typeName)) {
             final String path = parseLeafrefPath(typeBody);
             final boolean absolute = path.startsWith("/");
@@ -1025,18 +1040,19 @@ public final class YangModelBuilderUtil {
             type = new Leafref(actualPath, namespace, revision, xpath);
         } else if ("binary".equals(typeName)) {
             List<Byte> bytes = Collections.emptyList();
             type = new Leafref(actualPath, namespace, revision, xpath);
         } else if ("binary".equals(typeName)) {
             List<Byte> bytes = Collections.emptyList();
-            type = new BinaryType(actualPath, namespace, revision, bytes, lengthStatements, null);
+            type = new BinaryType(actualPath, namespace, revision, bytes,
+                    lengthStatements, null);
         } else if ("instance-identifier".equals(typeName)) {
             boolean requireInstance = isRequireInstance(typeBody);
         } else if ("instance-identifier".equals(typeName)) {
             boolean requireInstance = isRequireInstance(typeBody);
-            type = new InstanceIdentifier(actualPath, namespace, revision, null, requireInstance);
+            type = new InstanceIdentifier(actualPath, namespace, revision,
+                    null, requireInstance);
         }
         return type;
     }
 
     public static String getIdentityrefBase(Type_body_stmtsContext ctx) {
         String result = null;
         }
         return type;
     }
 
     public static String getIdentityrefBase(Type_body_stmtsContext ctx) {
         String result = null;
-        outer:
-        for (int i = 0; i < ctx.getChildCount(); i++) {
+        outer: for (int i = 0; i < ctx.getChildCount(); i++) {
             ParseTree child = ctx.getChild(i);
             if (child instanceof Identityref_specificationContext) {
                 for (int j = 0; j < child.getChildCount(); j++) {
             ParseTree child = ctx.getChild(i);
             if (child instanceof Identityref_specificationContext) {
                 for (int j = 0; j < child.getChildCount(); j++) {
@@ -1194,52 +1210,43 @@ public final class YangModelBuilderUtil {
         return yinValue;
     }
 
         return yinValue;
     }
 
-//    public static List<RefineHolder> parseRefines(Uses_stmtContext ctx) {
-//        List<RefineHolder> refines = new ArrayList<RefineHolder>();
-//
-//        for (int i = 0; i < ctx.getChildCount(); i++) {
-//            ParseTree child = ctx.getChild(i);
-//            if (child instanceof Refine_stmtContext) {
-//                final String refineTarget = stringFromNode(child);
-//                final RefineHolder refine = new RefineHolder(refineTarget);
-//                for (int j = 0; j < child.getChildCount(); j++) {
-//                    ParseTree refinePom = child.getChild(j);
-//                    if (refinePom instanceof Refine_pomContext) {
-//                        for (int k = 0; k < refinePom.getChildCount(); k++) {
-//                            ParseTree refineStmt = refinePom.getChild(k);
-//                            if (refineStmt instanceof Refine_leaf_stmtsContext) {
-//                                parseRefine(refine,
-//                                        (Refine_leaf_stmtsContext) refineStmt);
-//                            } else if (refineStmt instanceof Refine_container_stmtsContext) {
-//                                parseRefine(
-//                                        refine,
-//                                        (Refine_container_stmtsContext) refineStmt);
-//                            } else if (refineStmt instanceof Refine_list_stmtsContext) {
-//                                parseRefine(refine,
-//                                        (Refine_list_stmtsContext) refineStmt);
-//                            } else if (refineStmt instanceof Refine_leaf_list_stmtsContext) {
-//                                parseRefine(
-//                                        refine,
-//                                        (Refine_leaf_list_stmtsContext) refineStmt);
-//                            } else if (refineStmt instanceof Refine_choice_stmtsContext) {
-//                                parseRefine(refine,
-//                                        (Refine_choice_stmtsContext) refineStmt);
-//                            } else if (refineStmt instanceof Refine_anyxml_stmtsContext) {
-//                                parseRefine(refine,
-//                                        (Refine_anyxml_stmtsContext) refineStmt);
-//                            }
-//                        }
-//                    }
-//                }
-//                refines.add(refine);
-//            }
-//        }
-//        return refines;
-//    }
+    /**
+     * Check this base type.
+     *
+     * @param typeName
+     *            base YANG type name
+     * @param moduleName
+     *            name of current module
+     * @param line
+     *            line in module
+     * @throws YangParseException
+     *             if this is one of YANG type which MUST contain additional
+     *             informations in its body
+     */
+    public static void checkMissingBody(final String typeName,
+            final String moduleName, final int line) throws YangParseException {
+        if ("decimal64".equals(typeName)) {
+            throw new YangParseException(moduleName, line,
+                    "The 'fraction-digits' statement MUST be present if the type is 'decimal64'.");
+        } else if ("identityref".equals(typeName)) {
+            throw new YangParseException(moduleName, line,
+                    "The 'base' statement MUST be present if the type is 'identityref'.");
+        } else if ("leafref".equals(typeName)) {
+            throw new YangParseException(moduleName, line,
+                    "The 'path' statement MUST be present if the type is 'leafref'.");
+        } else if("bits".equals(typeName)) {
+            throw new YangParseException(moduleName, line,
+                    "The 'bit' statement MUST be present if the type is 'bits'.");
+        } else if("enumeration".equals(typeName)) {
+            throw new YangParseException(moduleName, line,
+                    "The 'enum' statement MUST be present if the type is 'enumeration'.");
+        }
+    }
 
     public static RefineHolder parseRefine(Refine_stmtContext child) {
         final String refineTarget = stringFromNode(child);
 
     public static RefineHolder parseRefine(Refine_stmtContext child) {
         final String refineTarget = stringFromNode(child);
-        final RefineHolder refine = new RefineHolder(refineTarget);
+        final RefineHolder refine = new RefineHolder(refineTarget, child
+                .getStart().getLine());
         for (int j = 0; j < child.getChildCount(); j++) {
             ParseTree refinePom = child.getChild(j);
             if (refinePom instanceof Refine_pomContext) {
         for (int j = 0; j < child.getChildCount(); j++) {
             ParseTree refinePom = child.getChild(j);
             if (refinePom instanceof Refine_pomContext) {
@@ -1249,15 +1256,13 @@ public final class YangModelBuilderUtil {
                         parseRefine(refine,
                                 (Refine_leaf_stmtsContext) refineStmt);
                     } else if (refineStmt instanceof Refine_container_stmtsContext) {
                         parseRefine(refine,
                                 (Refine_leaf_stmtsContext) refineStmt);
                     } else if (refineStmt instanceof Refine_container_stmtsContext) {
-                        parseRefine(
-                                refine,
+                        parseRefine(refine,
                                 (Refine_container_stmtsContext) refineStmt);
                     } else if (refineStmt instanceof Refine_list_stmtsContext) {
                         parseRefine(refine,
                                 (Refine_list_stmtsContext) refineStmt);
                     } else if (refineStmt instanceof Refine_leaf_list_stmtsContext) {
                                 (Refine_container_stmtsContext) refineStmt);
                     } else if (refineStmt instanceof Refine_list_stmtsContext) {
                         parseRefine(refine,
                                 (Refine_list_stmtsContext) refineStmt);
                     } else if (refineStmt instanceof Refine_leaf_list_stmtsContext) {
-                        parseRefine(
-                                refine,
+                        parseRefine(refine,
                                 (Refine_leaf_list_stmtsContext) refineStmt);
                     } else if (refineStmt instanceof Refine_choice_stmtsContext) {
                         parseRefine(refine,
                                 (Refine_leaf_list_stmtsContext) refineStmt);
                     } else if (refineStmt instanceof Refine_choice_stmtsContext) {
                         parseRefine(refine,
index 2c1b9b80d5b72d128a32e92623f9ea19dcb5ec64..301e5332f8d7cc38b1066c4998d9d0135488d02a 100644 (file)
@@ -19,4 +19,25 @@ public class YangParseException extends RuntimeException {
         super(errorMsg, exception);
     }
 
         super(errorMsg, exception);
     }
 
+    public YangParseException(final int line, final String errorMsg) {
+        super("Error on line " + line + ": " + errorMsg);
+    }
+
+    public YangParseException(final int line, final String errorMsg,
+            final Exception exception) {
+        super("Error on line " + line + ": " + errorMsg, exception);
+    }
+
+    public YangParseException(final String moduleName, final int line,
+            final String errorMsg) {
+        super("Error in module '" + moduleName + "' on line " + line + ": "
+                + errorMsg);
+    }
+
+    public YangParseException(final String moduleName, final int line,
+            final String errorMsg, final Exception exception) {
+        super("Error in module '" + moduleName + "' on line " + line + ": "
+                + errorMsg, exception);
+    }
+
 }
 }
index f9e3fc2770c78c18127e4551b85ffdf5d1841b0a..ed8df4652ed1ffca6b0d28ea95c0c1960b5ee41a 100644 (file)
@@ -15,6 +15,7 @@ import java.util.Set;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
+import org.antlr.v4.runtime.ParserRuleContext;
 import org.antlr.v4.runtime.tree.ParseTree;
 import org.opendaylight.controller.antlrv4.code.gen.YangParser.Yang_version_stmtContext;
 import org.opendaylight.controller.yang.model.parser.impl.YangModelParserListenerImpl;
 import org.antlr.v4.runtime.tree.ParseTree;
 import org.opendaylight.controller.antlrv4.code.gen.YangParser.Yang_version_stmtContext;
 import org.opendaylight.controller.yang.model.parser.impl.YangModelParserListenerImpl;
@@ -132,6 +133,10 @@ final class BasicValidations {
             message = parent.equals(name) ? message : ValidationUtil.f(
                     "(In (sub)module:%s) %s", parent, message);
 
             message = parent.equals(name) ? message : ValidationUtil.f(
                     "(In (sub)module:%s) %s", parent, message);
 
+            if(statement instanceof ParserRuleContext) {
+                message = "Error on line "+ ((ParserRuleContext)statement).getStart().getLine() + ": "+ message;
+            }
+
             ValidationUtil.ex(message);
         }
     }
             ValidationUtil.ex(message);
         }
     }
index ffcadf63970bf1743d8532c8083d5ebf15f247e9..bd39da2919cab79c1188968b85358e5baa77450f 100644 (file)
@@ -7,9 +7,9 @@
  */
 package org.opendaylight.controller.yang.model.validator;
 
  */
 package org.opendaylight.controller.yang.model.validator;
 
-import static org.hamcrest.core.Is.*;
+import static org.hamcrest.core.Is.is;
 import static org.junit.Assert.*;
 import static org.junit.Assert.*;
-import static org.junit.matchers.JUnitMatchers.*;
+import static org.junit.matchers.JUnitMatchers.containsString;
 import static org.mockito.Mockito.*;
 
 import java.util.ArrayList;
 import static org.mockito.Mockito.*;
 
 import java.util.ArrayList;
@@ -17,6 +17,7 @@ import java.util.Date;
 import java.util.HashSet;
 import java.util.List;
 
 import java.util.HashSet;
 import java.util.List;
 
+import org.antlr.v4.runtime.Token;
 import org.antlr.v4.runtime.tree.ParseTree;
 import org.junit.Before;
 import org.junit.Test;
 import org.antlr.v4.runtime.tree.ParseTree;
 import org.junit.Before;
 import org.junit.Test;
@@ -159,8 +160,11 @@ public class YangModelValidationTest {
         int thrown = 0;
         for (String id : ids) {
             try {
         int thrown = 0;
         for (String id : ids) {
             try {
+                Module_stmtContext module = mock(Module_stmtContext.class);
+                Token token = mock(Token.class);
+                when(module.getStart()).thenReturn(token);
                 BasicValidations.checkIdentifierInternal(
                 BasicValidations.checkIdentifierInternal(
-                        mock(Module_stmtContext.class), id);
+                        module, id);
             } catch (YangValidationException e) {
                 thrown++;
             }
             } catch (YangValidationException e) {
                 thrown++;
             }
@@ -177,6 +181,9 @@ public class YangModelValidationTest {
                 "mod1");
         addChild(mod1, augument);
 
                 "mod1");
         addChild(mod1, augument);
 
+        Token token = mock(Token.class);
+        when(augument.getStart()).thenReturn(token);
+
         try {
             valid.enterAugment_stmt(augument);
         } catch (YangValidationException e) {
         try {
             valid.enterAugment_stmt(augument);
         } catch (YangValidationException e) {
index 6d41321bfd0cb5042c150f3f77779e9f68cc344a..e4d176c12b1e62d45e4eb94e6ffe87e332c005a8 100644 (file)
@@ -73,8 +73,6 @@ public class YangTypesConverter {
             type = new StringType(actualPath, namespace, revision);\r
         } else if("binary".equals(typeName)) {\r
             type = new BinaryType(actualPath, namespace, revision);\r
             type = new StringType(actualPath, namespace, revision);\r
         } else if("binary".equals(typeName)) {\r
             type = new BinaryType(actualPath, namespace, revision);\r
-        } else if("bits".equals(typeName)) {\r
-            type = new BitsType(actualPath, namespace, revision);\r
         } else if("boolean".equals(typeName)) {\r
             type = new BooleanType(actualPath, namespace, revision);\r
         } else if("empty".equals(typeName)) {\r
         } else if("boolean".equals(typeName)) {\r
             type = new BooleanType(actualPath, namespace, revision);\r
         } else if("empty".equals(typeName)) {\r