Maintain and obtain YANG schema node identifier from YANG utils
Change-Id: I6ede58f62796ed3922d513331eacf4a33ce17bdf
diff --git a/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangAugment.java b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangAugment.java
index fa4becf..041ee58 100644
--- a/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangAugment.java
+++ b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangAugment.java
@@ -164,7 +164,7 @@
@Override
public void setNameSpaceAndAddToParentSchemaMap() {
// Get parent namespace.
- YangNameSpace nameSpace = this.getParent().getNameSpace();
+ String nameSpace = this.getParent().getNameSpace();
// Set namespace for self node.
setNameSpace(nameSpace);
/*
diff --git a/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangCase.java b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangCase.java
index 5990641..b849257 100644
--- a/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangCase.java
+++ b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangCase.java
@@ -19,7 +19,6 @@
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
-
import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
import org.onosproject.yangutils.datamodel.utils.Parsable;
import org.onosproject.yangutils.datamodel.utils.YangConstructType;
@@ -163,7 +162,7 @@
@Override
public void setNameSpaceAndAddToParentSchemaMap() {
// Get parent namespace.
- YangNameSpace nameSpace = this.getParent().getNameSpace();
+ String nameSpace = this.getParent().getNameSpace();
// Set namespace for self node.
setNameSpace(nameSpace);
/*
diff --git a/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangChoice.java b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangChoice.java
index da9db0d..7647e0d 100644
--- a/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangChoice.java
+++ b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangChoice.java
@@ -19,7 +19,6 @@
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
-
import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
import org.onosproject.yangutils.datamodel.utils.Parsable;
import org.onosproject.yangutils.datamodel.utils.YangConstructType;
@@ -87,21 +86,21 @@
/**
* Reference RFC 6020.
- *
+ * <p>
* The "mandatory" statement, which is optional, takes as an argument the
* string "true" or "false", and puts a constraint on valid data. If
* "mandatory" is "true", at least one node from exactly one of the choice's
* case branches MUST exist.
- *
+ * <p>
* If not specified, the default is "false".
- *
+ * <p>
* The behavior of the constraint depends on the type of the choice's
* closest ancestor node in the schema tree which is not a non-presence
* container:
- *
+ * <p>
* o If this ancestor is a case node, the constraint is enforced if any
* other node from the case exists.
- *
+ * <p>
* o Otherwise, it is enforced if the ancestor node exists.
*/
private String mandatory;
@@ -118,26 +117,26 @@
/**
* Reference RFC 6020.
- *
+ * <p>
* The "default" statement indicates if a case should be considered as the
* default if no child nodes from any of the choice's cases exist. The
* argument is the identifier of the "case" statement. If the "default"
* statement is missing, there is no default case.
- *
+ * <p>
* The "default" statement MUST NOT be present on choices where "mandatory"
* is true.
- *
+ * <p>
* The default case is only important when considering the default values of
* nodes under the cases. The default values for nodes under the default
* case are used if none of the nodes under any of the cases are present.
- *
+ * <p>
* There MUST NOT be any mandatory nodes directly under the default case.
- *
+ * <p>
* Default values for child nodes under a case are only used if one of the
* nodes under that case is present, or if that case is the default case. If
* none of the nodes under a case are present and the case is not the
* default case, the default values of the cases' child nodes are ignored.
- *
+ * <p>
* the default case to be used if no case members is present.
*/
private String defaultValueInString;
@@ -174,7 +173,7 @@
@Override
public void addToChildSchemaMap(YangSchemaNodeIdentifier schemaNodeIdentifier,
- YangSchemaNodeContextInfo yangSchemaNodeContextInfo)
+ YangSchemaNodeContextInfo yangSchemaNodeContextInfo)
throws DataModelException {
getYsnContextInfoMap().put(schemaNodeIdentifier, yangSchemaNodeContextInfo);
YangSchemaNodeContextInfo yangSchemaNodeContextInfo1 = new YangSchemaNodeContextInfo();
@@ -186,7 +185,7 @@
@Override
public void setNameSpaceAndAddToParentSchemaMap() {
// Get parent namespace.
- YangNameSpace nameSpace = this.getParent().getNameSpace();
+ String nameSpace = this.getParent().getNameSpace();
// Set namespace for self node.
setNameSpace(nameSpace);
}
diff --git a/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangInput.java b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangInput.java
index 4902abe..6a52f8f 100644
--- a/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangInput.java
+++ b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangInput.java
@@ -112,7 +112,7 @@
@Override
public void setNameSpaceAndAddToParentSchemaMap() {
// Get parent namespace.
- YangNameSpace nameSpace = this.getParent().getNameSpace();
+ String nameSpace = this.getParent().getNameSpace();
// Set namespace for self node.
setNameSpace(nameSpace);
/*
diff --git a/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangLeaf.java b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangLeaf.java
index 9d0ae23..36d39bf 100644
--- a/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangLeaf.java
+++ b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangLeaf.java
@@ -20,7 +20,6 @@
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
-
import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
import org.onosproject.yangutils.datamodel.utils.Parsable;
import org.onosproject.yangutils.datamodel.utils.YangConstructType;
@@ -69,14 +68,9 @@
private static final long serialVersionUID = 806201635L;
/**
- * Name of leaf.
+ * YANG schema node identifier.
*/
- private String name;
-
- /**
- * Namespace of leaf.
- */
- private YangNameSpace namespace;
+ private YangSchemaNodeIdentifier yangSchemaNodeIdentifier;
/**
* If the leaf is a config parameter.
@@ -146,24 +140,6 @@
}
/**
- * Returns the name of leaf.
- *
- * @return the leaf name
- */
- public String getName() {
- return name;
- }
-
- /**
- * Sets the name of leaf.
- *
- * @param leafName the leaf name to set
- */
- public void setLeafName(String leafName) {
- name = leafName;
- }
-
- /**
* Returns the config flag.
*
* @return if config flag
@@ -460,31 +436,64 @@
}
/**
- * Returns namespace of node.
+ * Sets leaf namespace and add itself to parent child schema map.
*
- * @return namespace of node
+ * @param nameSpace namespace
*/
- public YangNameSpace getNamespace() {
- return namespace;
+ public void setLeafNameSpaceAndAddToParentSchemaMap(String nameSpace) {
+ setNameSpace(nameSpace);
+ // Process addition of leaf to schema node map.
+ ((YangNode) getContainedIn()).processAdditionOfSchemaNodeToCurNodeMap(getName(), getNameSpace(), this);
+ }
+
+ @Override
+ public YangSchemaNodeIdentifier getYangSchemaNodeIdentifier() {
+ return yangSchemaNodeIdentifier;
+ }
+
+ /**
+ * Sets YANG schema node identifier.
+ *
+ * @param yangSchemaNodeIdentifier YANG schema node identifier
+ */
+ public void setYangSchemaNodeIdentifier(YangSchemaNodeIdentifier yangSchemaNodeIdentifier) {
+ if (this.yangSchemaNodeIdentifier == null) {
+ this.yangSchemaNodeIdentifier = new YangSchemaNodeIdentifier();
+ }
+ this.yangSchemaNodeIdentifier = yangSchemaNodeIdentifier;
+ }
+
+ @Override
+ public String getName() {
+ return yangSchemaNodeIdentifier.getName();
+ }
+
+ /**
+ * Sets name of node.
+ *
+ * @param name name of the node
+ */
+ public void setName(String name) {
+ if (yangSchemaNodeIdentifier == null) {
+ yangSchemaNodeIdentifier = new YangSchemaNodeIdentifier();
+ }
+ yangSchemaNodeIdentifier.setName(name);
+ }
+
+ @Override
+ public String getNameSpace() {
+ return yangSchemaNodeIdentifier.getNameSpace();
}
/**
* Sets namespace of node.
*
- * @param namespace namespace of node
+ * @param namespace namespace of the node
*/
- public void setNamespace(YangNameSpace namespace) {
- this.namespace = namespace;
- }
-
- /**
- * Sets leaf namespace and add itself to parent child schema map.
- *
- * @param nameSpace namespace
- */
- public void setLeafNameSpaceAndAddToParentSchemaMap(YangNameSpace nameSpace) {
- setNamespace(nameSpace);
- // Process addition of leaf to schema node map.
- ((YangNode) getContainedIn()).processAdditionOfSchemaNodeToCurNodeMap(getName(), getNamespace().getUri(), this);
+ public void setNameSpace(String namespace) {
+ if (yangSchemaNodeIdentifier == null) {
+ yangSchemaNodeIdentifier = new YangSchemaNodeIdentifier();
+ }
+ yangSchemaNodeIdentifier.setNameSpace(namespace);
}
}
diff --git a/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangLeafList.java b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangLeafList.java
index 975c271..8a296ea 100644
--- a/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangLeafList.java
+++ b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangLeafList.java
@@ -20,7 +20,6 @@
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
-
import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
import org.onosproject.yangutils.datamodel.utils.Parsable;
import org.onosproject.yangutils.datamodel.utils.YangConstructType;
@@ -67,12 +66,7 @@
/**
* Name of leaf-list.
*/
- private String name;
-
- /**
- * Namespace of leaf-list.
- */
- private YangNameSpace namespace;
+ private YangSchemaNodeIdentifier yangSchemaNodeIdentifier;
/**
* If the leaf-list is a config parameter.
@@ -86,32 +80,32 @@
/**
* Reference:RFC 6020.
- *
+ * <p>
* The "max-elements" statement, which is optional, takes as an argument a
* positive integer or the string "unbounded", which puts a constraint on
* valid list entries. A valid leaf-list or list always has at most
* max-elements entries.
- *
+ * <p>
* If no "max-elements" statement is present, it defaults to "unbounded".
*/
private YangMaxElement maxElement;
/**
* Reference:RFC 6020.
- *
+ * <p>
* The "min-elements" statement, which is optional, takes as an argument a
* non-negative integer that puts a constraint on valid list entries. A
* valid leaf-list or list MUST have at least min-elements entries.
- *
+ * <p>
* If no "min-elements" statement is present, it defaults to zero.
- *
+ * <p>
* The behavior of the constraint depends on the type of the leaf-list's or
* list's closest ancestor node in the schema tree that is not a non-
* presence container:
- *
+ * <p>
* o If this ancestor is a case node, the constraint is enforced if any
* other node from the case exists.
- *
+ * <p>
* o Otherwise, it is enforced if the ancestor node exists.
*/
private YangMinElement minElements;
@@ -165,24 +159,6 @@
}
/**
- * Returns the leaf-list name.
- *
- * @return the leaf-list name
- */
- public String getName() {
- return name;
- }
-
- /**
- * Sets the leaf-list name.
- *
- * @param leafListName the leaf-list name to set
- */
- public void setLeafName(String leafListName) {
- name = leafListName;
- }
-
- /**
* Returns the config flag.
*
* @return the config flag
@@ -478,31 +454,64 @@
}
/**
- * Returns namespace of node.
+ * Sets leaf namespace and add itself to parent child schema map.
*
- * @return namespace of node
+ * @param nameSpace namespace
*/
- public YangNameSpace getNamespace() {
- return namespace;
+ public void setLeafNameSpaceAndAddToParentSchemaMap(String nameSpace) {
+ setNameSpace(nameSpace);
+ // Process addition of leaf to schema node map.
+ ((YangNode) getContainedIn()).processAdditionOfSchemaNodeToCurNodeMap(getName(), getNameSpace(), this);
+ }
+
+ @Override
+ public YangSchemaNodeIdentifier getYangSchemaNodeIdentifier() {
+ return yangSchemaNodeIdentifier;
+ }
+
+ /**
+ * Sets YANG schema node identifier.
+ *
+ * @param yangSchemaNodeIdentifier YANG schema node identifier
+ */
+ public void setYangSchemaNodeIdentifier(YangSchemaNodeIdentifier yangSchemaNodeIdentifier) {
+ if (this.yangSchemaNodeIdentifier == null) {
+ this.yangSchemaNodeIdentifier = new YangSchemaNodeIdentifier();
+ }
+ this.yangSchemaNodeIdentifier = yangSchemaNodeIdentifier;
+ }
+
+ @Override
+ public String getName() {
+ return yangSchemaNodeIdentifier.getName();
+ }
+
+ /**
+ * Sets name of node.
+ *
+ * @param name name of the node
+ */
+ public void setName(String name) {
+ if (yangSchemaNodeIdentifier == null) {
+ yangSchemaNodeIdentifier = new YangSchemaNodeIdentifier();
+ }
+ yangSchemaNodeIdentifier.setName(name);
+ }
+
+ @Override
+ public String getNameSpace() {
+ return yangSchemaNodeIdentifier.getNameSpace();
}
/**
* Sets namespace of node.
*
- * @param namespace namespace of node
+ * @param namespace namespace of the node
*/
- public void setNamespace(YangNameSpace namespace) {
- this.namespace = namespace;
- }
-
- /**
- * Sets leaf namespace and add itself to parent child schema map.
- *
- * @param nameSpace namespace
- */
- public void setLeafNameSpaceAndAddToParentSchemaMap(YangNameSpace nameSpace) {
- setNamespace(nameSpace);
- // Process addition of leaf to schema node map.
- ((YangNode) getContainedIn()).processAdditionOfSchemaNodeToCurNodeMap(getName(), getNamespace().getUri(), this);
+ public void setNameSpace(String namespace) {
+ if (yangSchemaNodeIdentifier == null) {
+ yangSchemaNodeIdentifier = new YangSchemaNodeIdentifier();
+ }
+ yangSchemaNodeIdentifier.setNameSpace(namespace);
}
}
diff --git a/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangNode.java b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangNode.java
index 0a5177d..81f0a28 100644
--- a/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangNode.java
+++ b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangNode.java
@@ -17,7 +17,6 @@
import java.io.Serializable;
import java.util.Map;
-
import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
import org.onosproject.yangutils.datamodel.utils.Parsable;
@@ -36,14 +35,9 @@
private static final long serialVersionUID = 806201601L;
/**
- * Name of a node.
+ * YANG schema node identifier.
*/
- private String name;
-
- /**
- * Namespace of a node.
- */
- private YangNameSpace nameSpace;
+ private YangSchemaNodeIdentifier yangSchemaNodeIdentifier;
/**
* Type of node.
@@ -114,24 +108,6 @@
}
/**
- * Returns the nodes name.
- *
- * @return nodes name
- */
- public String getName() {
- return name;
- }
-
- /**
- * Sets the nodes name.
- *
- * @param name nodes name
- */
- public void setName(String name) {
- this.name = name;
- }
-
- /**
* Creates a YANG node object.
*/
@SuppressWarnings("unused")
@@ -299,7 +275,7 @@
* @param namespace namespace of the node
*/
protected void processAdditionOfSchemaNodeToParentMap(String name, String namespace) {
- processAdditionOfSchemaNodeToMap(getName(), getNameSpace().getUri(), this, getParent());
+ processAdditionOfSchemaNodeToMap(getName(), getNameSpace(), this, getParent());
}
/**
@@ -323,12 +299,12 @@
* @param childSchemaMapHolder child schema map holder
*/
private void processAdditionOfSchemaNodeToMap(String name, String namespace, YangSchemaNode yangSchemaNode,
- YangNode childSchemaMapHolder) {
+ YangNode childSchemaMapHolder) {
// Addition of node to schema node map.
// Create YANG schema node identifier with child node name.
YangSchemaNodeIdentifier yangSchemaNodeIdentifier = new YangSchemaNodeIdentifier();
yangSchemaNodeIdentifier.setName(name);
- yangSchemaNodeIdentifier.setNamespace(namespace);
+ yangSchemaNodeIdentifier.setNameSpace(namespace);
// Create YANG schema node context info and set child node.
YangSchemaNodeContextInfo yangSchemaNodeContextInfo = new YangSchemaNodeContextInfo();
yangSchemaNodeContextInfo.setSchemaNode(yangSchemaNode);
@@ -584,7 +560,7 @@
* @throws DataModelException a violation in data model rule
*/
public abstract void addToChildSchemaMap(YangSchemaNodeIdentifier schemaNodeIdentifier,
- YangSchemaNodeContextInfo yangSchemaNodeContextInfo)
+ YangSchemaNodeContextInfo yangSchemaNodeContextInfo)
throws DataModelException;
/**
@@ -608,7 +584,7 @@
* @param yangSchemaNode YANG schema node
*/
public abstract void addToDefaultChildMap(YangSchemaNodeIdentifier yangSchemaNodeIdentifier,
- YangSchemaNode yangSchemaNode);
+ YangSchemaNode yangSchemaNode);
/**
* Returns default child map.
@@ -628,27 +604,6 @@
return ysnContextInfoMap;
}
- @Override
- public abstract YangSchemaNodeType getYangSchemaNodeType();
-
- /**
- * Returns the name space of module elements.
- *
- * @return the nameSpace
- */
- public YangNameSpace getNameSpace() {
- return nameSpace;
- }
-
- /**
- * Sets the name space of module elements.
- *
- * @param nameSpace the nameSpace to set
- */
- public void setNameSpace(YangNameSpace nameSpace) {
- this.nameSpace = nameSpace;
- }
-
/**
* Adds namespace for self, next sibling and first child. This is used
* after obtaining namespace in case of submodule after performing
@@ -657,11 +612,11 @@
public void setNameSpaceAndAddToParentSchemaMap() {
// Get parent namespace.
if (this.getParent() != null) {
- YangNameSpace nameSpace = this.getParent().getNameSpace();
+ String nameSpace = this.getParent().getNameSpace();
// Set namespace for self node.
setNameSpace(nameSpace);
// Process addition of leaf to the child schema map of parent.
- processAdditionOfSchemaNodeToParentMap(getName(), getNameSpace().getUri());
+ processAdditionOfSchemaNodeToParentMap(getName(), getNameSpace());
}
/*
* Check if node contains leaf/leaf-list, if yes add namespace for leaf
@@ -677,4 +632,55 @@
throws DataModelException {
throw new DataModelException("Value validation asked for YANG node.");
}
+
+ @Override
+ public YangSchemaNodeIdentifier getYangSchemaNodeIdentifier() {
+ return yangSchemaNodeIdentifier;
+ }
+
+ /**
+ * Sets YANG schema node identifier.
+ *
+ * @param yangSchemaNodeIdentifier YANG schema node identifier
+ */
+ public void setYangSchemaNodeIdentifier(YangSchemaNodeIdentifier yangSchemaNodeIdentifier) {
+ if (this.yangSchemaNodeIdentifier == null) {
+ this.yangSchemaNodeIdentifier = new YangSchemaNodeIdentifier();
+ }
+ this.yangSchemaNodeIdentifier = yangSchemaNodeIdentifier;
+ }
+
+ @Override
+ public String getName() {
+ return yangSchemaNodeIdentifier.getName();
+ }
+
+ /**
+ * Sets name of node.
+ *
+ * @param name name of the node
+ */
+ public void setName(String name) {
+ if (yangSchemaNodeIdentifier == null) {
+ yangSchemaNodeIdentifier = new YangSchemaNodeIdentifier();
+ }
+ yangSchemaNodeIdentifier.setName(name);
+ }
+
+ @Override
+ public String getNameSpace() {
+ return yangSchemaNodeIdentifier.getNameSpace();
+ }
+
+ /**
+ * Sets namespace of node.
+ *
+ * @param namespace namespace of the node
+ */
+ public void setNameSpace(String namespace) {
+ if (yangSchemaNodeIdentifier == null) {
+ yangSchemaNodeIdentifier = new YangSchemaNodeIdentifier();
+ }
+ yangSchemaNodeIdentifier.setNameSpace(namespace);
+ }
}
diff --git a/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangOutput.java b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangOutput.java
index 0c40297..327146e 100644
--- a/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangOutput.java
+++ b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangOutput.java
@@ -111,7 +111,7 @@
@Override
public void setNameSpaceAndAddToParentSchemaMap() {
// Get parent namespace.
- YangNameSpace nameSpace = this.getParent().getNameSpace();
+ String nameSpace = this.getParent().getNameSpace();
// Set namespace for self node.
setNameSpace(nameSpace);
/*
diff --git a/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangSchemaNode.java b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangSchemaNode.java
index f2662ec..b79db9e 100644
--- a/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangSchemaNode.java
+++ b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangSchemaNode.java
@@ -17,7 +17,6 @@
package org.onosproject.yangutils.datamodel;
import java.util.Map;
-
import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
/**
@@ -87,5 +86,24 @@
*/
String getJavaClassNameOrBuiltInType();
+ /**
+ * Returns schema node identifier.
+ *
+ * @return schema node identifier
+ */
+ YangSchemaNodeIdentifier getYangSchemaNodeIdentifier();
+ /**
+ * Returns name of the node.
+ *
+ * @return name of the node
+ */
+ String getName();
+
+ /**
+ * Sets name of the node.
+ *
+ * @return name of the node
+ */
+ String getNameSpace();
}
diff --git a/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangSchemaNodeIdentifier.java b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangSchemaNodeIdentifier.java
index 08dd398..8c96630 100644
--- a/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangSchemaNodeIdentifier.java
+++ b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangSchemaNodeIdentifier.java
@@ -62,7 +62,7 @@
*
* @return namespace of the node
*/
- public String getNamespace() {
+ public String getNameSpace() {
return namespace;
}
@@ -71,7 +71,7 @@
*
* @param namespace namespace of the node
*/
- public void setNamespace(String namespace) {
+ public void setNameSpace(String namespace) {
this.namespace = namespace;
}
diff --git a/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/LeafListListener.java b/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/LeafListListener.java
index 70ff42a..99e8cae 100644
--- a/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/LeafListListener.java
+++ b/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/LeafListListener.java
@@ -110,7 +110,7 @@
detectCollidingChildUtil(listener, line, charPositionInLine, identifier, LEAF_LIST_DATA);
YangLeafList leafList = getYangLeafList(JAVA_GENERATION);
- leafList.setLeafName(identifier);
+ leafList.setName(identifier);
/*
* If "config" is not specified, the default is the same as the parent
diff --git a/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/LeafListener.java b/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/LeafListener.java
index 8c66183..edf0ed4 100644
--- a/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/LeafListener.java
+++ b/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/LeafListener.java
@@ -114,7 +114,7 @@
detectCollidingChildUtil(listener, line, charPositionInLine, identifier, LEAF_DATA);
YangLeaf leaf = getYangLeaf(JAVA_GENERATION);
- leaf.setLeafName(identifier);
+ leaf.setName(identifier);
/*
* If "config" is not specified, the default is the same as the parent
diff --git a/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/NamespaceListener.java b/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/NamespaceListener.java
index ee2cb3d..0c6a816 100644
--- a/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/NamespaceListener.java
+++ b/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/NamespaceListener.java
@@ -18,7 +18,6 @@
import java.net.URI;
import org.onosproject.yangutils.datamodel.YangModule;
-import org.onosproject.yangutils.datamodel.YangNameSpace;
import org.onosproject.yangutils.datamodel.utils.Parsable;
import org.onosproject.yangutils.parser.antlrgencode.GeneratedYangParser;
import org.onosproject.yangutils.parser.exceptions.ParserException;
@@ -91,9 +90,7 @@
switch (tmpNode.getYangConstructType()) {
case MODULE_DATA: {
YangModule module = (YangModule) tmpNode;
- YangNameSpace uri = new YangNameSpace();
- uri.setUri(removeQuotesAndHandleConcat(ctx.string().getText()));
- module.setNameSpace(uri);
+ module.setNameSpace(removeQuotesAndHandleConcat(ctx.string().getText()));
break;
}
default:
diff --git a/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/YangJavaModelUtils.java b/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/YangJavaModelUtils.java
index 5e98919..eb02fd7 100644
--- a/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/YangJavaModelUtils.java
+++ b/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/YangJavaModelUtils.java
@@ -19,7 +19,6 @@
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
-
import org.onosproject.yangutils.datamodel.RpcNotificationContainer;
import org.onosproject.yangutils.datamodel.YangAtomicPath;
import org.onosproject.yangutils.datamodel.YangAugment;
@@ -32,13 +31,13 @@
import org.onosproject.yangutils.datamodel.YangSubModule;
import org.onosproject.yangutils.datamodel.YangTranslatorOperatorNode;
import org.onosproject.yangutils.datamodel.YangTypeHolder;
-import org.onosproject.yangutils.utils.io.YangPluginConfig;
import org.onosproject.yangutils.datamodel.utils.DataModelUtils;
import org.onosproject.yangutils.translator.exception.TranslatorException;
import org.onosproject.yangutils.translator.tojava.javamodel.YangJavaAugmentTranslator;
import org.onosproject.yangutils.translator.tojava.javamodel.YangJavaEnumerationTranslator;
import org.onosproject.yangutils.translator.tojava.javamodel.YangJavaModuleTranslator;
import org.onosproject.yangutils.translator.tojava.javamodel.YangJavaSubModuleTranslator;
+import org.onosproject.yangutils.utils.io.YangPluginConfig;
import static org.onosproject.yangutils.datamodel.utils.DataModelUtils.isRpcChildNodePresent;
import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.GENERATE_SERVICE_AND_MANAGER;
@@ -479,7 +478,7 @@
StringBuilder pkg = new StringBuilder();
if (node instanceof YangJavaModuleTranslator) {
YangJavaModuleTranslator module = (YangJavaModuleTranslator) node;
- pkg.append(getRootPackage(module.getVersion(), module.getNameSpace().getUri(), module
+ pkg.append(getRootPackage(module.getVersion(), module.getNameSpace(), module
.getRevision().getRevDate(), yangPluginConfig.getConflictResolver()));
} else if (node instanceof YangJavaSubModuleTranslator) {
YangJavaSubModuleTranslator subModule = (YangJavaSubModuleTranslator) node;
diff --git a/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/AttributesJavaDataType.java b/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/AttributesJavaDataType.java
index fd1210d..ce172ff 100644
--- a/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/AttributesJavaDataType.java
+++ b/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/AttributesJavaDataType.java
@@ -17,7 +17,6 @@
package org.onosproject.yangutils.translator.tojava.javamodel;
import java.util.Stack;
-
import org.onosproject.yangutils.datamodel.YangDerivedInfo;
import org.onosproject.yangutils.datamodel.YangEnumeration;
import org.onosproject.yangutils.datamodel.YangIdentity;
@@ -26,12 +25,12 @@
import org.onosproject.yangutils.datamodel.YangNode;
import org.onosproject.yangutils.datamodel.YangType;
import org.onosproject.yangutils.datamodel.YangUnion;
-import org.onosproject.yangutils.translator.tojava.JavaFileInfoTranslator;
-import org.onosproject.yangutils.utils.io.YangToJavaNamingConflictUtil;
import org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes;
import org.onosproject.yangutils.translator.exception.TranslatorException;
import org.onosproject.yangutils.translator.tojava.JavaCodeGeneratorInfo;
import org.onosproject.yangutils.translator.tojava.JavaFileInfoContainer;
+import org.onosproject.yangutils.translator.tojava.JavaFileInfoTranslator;
+import org.onosproject.yangutils.utils.io.YangToJavaNamingConflictUtil;
import static org.onosproject.yangutils.translator.tojava.YangJavaModelUtils.getCurNodePackage;
import static org.onosproject.yangutils.translator.tojava.utils.JavaIdentifierSyntax.getRootPackage;
@@ -427,7 +426,7 @@
String pkg;
if (yangNode instanceof YangJavaModuleTranslator) {
YangJavaModuleTranslator module = (YangJavaModuleTranslator) yangNode;
- pkg = getRootPackage(module.getVersion(), module.getNameSpace().getUri(), module
+ pkg = getRootPackage(module.getVersion(), module.getNameSpace(), module
.getRevision().getRevDate(), conflictResolver);
} else if (yangNode instanceof YangJavaSubModuleTranslator) {
YangJavaSubModuleTranslator submodule = (YangJavaSubModuleTranslator) yangNode;
diff --git a/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaModuleTranslator.java b/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaModuleTranslator.java
index 82156be..774e422 100644
--- a/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaModuleTranslator.java
+++ b/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaModuleTranslator.java
@@ -18,16 +18,15 @@
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
-
import org.onosproject.yangutils.datamodel.YangNode;
import org.onosproject.yangutils.datamodel.YangNotification;
-import org.onosproject.yangutils.translator.tojava.JavaFileInfoTranslator;
import org.onosproject.yangutils.datamodel.javadatamodel.YangJavaModule;
-import org.onosproject.yangutils.utils.io.YangPluginConfig;
import org.onosproject.yangutils.translator.exception.TranslatorException;
import org.onosproject.yangutils.translator.tojava.JavaCodeGenerator;
import org.onosproject.yangutils.translator.tojava.JavaCodeGeneratorInfo;
+import org.onosproject.yangutils.translator.tojava.JavaFileInfoTranslator;
import org.onosproject.yangutils.translator.tojava.TempJavaCodeFragmentFiles;
+import org.onosproject.yangutils.utils.io.YangPluginConfig;
import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.GENERATE_ALL_EVENT_CLASS_MASK;
import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.GENERATE_INTERFACE_WITH_BUILDER;
@@ -119,7 +118,7 @@
*/
@Override
public void generateCodeEntry(YangPluginConfig yangPlugin) throws TranslatorException {
- String modulePkg = getRootPackage(getVersion(), getNameSpace().getUri(), getRevision().getRevDate(),
+ String modulePkg = getRootPackage(getVersion(), getNameSpace(), getRevision().getRevDate(),
yangPlugin.getConflictResolver());
if (isNotificationChildNodePresent(this)) {
diff --git a/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaSubModuleTranslator.java b/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaSubModuleTranslator.java
index 42a8245..4f403c9 100644
--- a/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaSubModuleTranslator.java
+++ b/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaSubModuleTranslator.java
@@ -18,16 +18,15 @@
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
-
import org.onosproject.yangutils.datamodel.YangBelongsTo;
import org.onosproject.yangutils.datamodel.YangModule;
import org.onosproject.yangutils.datamodel.YangNode;
import org.onosproject.yangutils.datamodel.YangNotification;
-import org.onosproject.yangutils.translator.tojava.JavaFileInfoTranslator;
import org.onosproject.yangutils.datamodel.javadatamodel.YangJavaSubModule;
import org.onosproject.yangutils.translator.exception.TranslatorException;
import org.onosproject.yangutils.translator.tojava.JavaCodeGenerator;
import org.onosproject.yangutils.translator.tojava.JavaCodeGeneratorInfo;
+import org.onosproject.yangutils.translator.tojava.JavaFileInfoTranslator;
import org.onosproject.yangutils.translator.tojava.TempJavaCodeFragmentFiles;
import org.onosproject.yangutils.utils.io.YangPluginConfig;
@@ -122,7 +121,7 @@
* @return the name space string of the module.
*/
public String getNameSpaceFromModule(YangBelongsTo belongsToInfo) {
- return ((YangModule) belongsToInfo.getModuleNode()).getNameSpace().getUri();
+ return ((YangModule) belongsToInfo.getModuleNode()).getNameSpace();
}
/**
diff --git a/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/NamespaceListenerTest.java b/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/NamespaceListenerTest.java
index c10046f..3a96361 100644
--- a/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/NamespaceListenerTest.java
+++ b/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/NamespaceListenerTest.java
@@ -51,7 +51,7 @@
YangNode node = manager.getDataModel("src/test/resources/NamespaceInDoubleQuotes.yang");
// Checks for the version value in data model tree.
- assertThat(((YangModule) node).getNameSpace().getUri(), is("urn:ietf:params:xml:ns:yang:ietf-ospf"));
+ assertThat(((YangModule) node).getNameSpace(), is("urn:ietf:params:xml:ns:yang:ietf-ospf"));
}
/**
@@ -63,7 +63,7 @@
YangNode node = manager.getDataModel("src/test/resources/NamespaceWithoutQuotes.yang");
// Checks for the version value in data model tree.
- assertThat(((YangModule) node).getNameSpace().getUri(), is("urn:ietf:params:xml:ns:yang:ietf-ospf"));
+ assertThat(((YangModule) node).getNameSpace(), is("urn:ietf:params:xml:ns:yang:ietf-ospf"));
}
/**
diff --git a/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/SchemaNodeTest.java b/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/SchemaNodeTest.java
index df41c3d..88a4e2d 100644
--- a/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/SchemaNodeTest.java
+++ b/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/SchemaNodeTest.java
@@ -67,7 +67,7 @@
Map<YangSchemaNodeIdentifier, YangSchemaNodeContextInfo> schemaMap = rootNode.getYsnContextInfoMap();
YangSchemaNodeIdentifier yangSchemaNodeIdentifier = new YangSchemaNodeIdentifier();
yangSchemaNodeIdentifier.setName("testcontainer");
- yangSchemaNodeIdentifier.setNamespace("http://huawei.com");
+ yangSchemaNodeIdentifier.setNameSpace("http://huawei.com");
assertThat(schemaMap.get(yangSchemaNodeIdentifier), is(notNullValue()));
YangSchemaNodeContextInfo yangSchemaNodeContextInfo = schemaMap.get(yangSchemaNodeIdentifier);
assertThat(yangSchemaNodeContextInfo.getSchemaNode(), is(rootNode.getChild()));
@@ -76,18 +76,18 @@
Map<YangSchemaNodeIdentifier, YangSchemaNodeContextInfo> schemaMap2 = rootNode.getChild()
.getYsnContextInfoMap();
yangSchemaNodeIdentifier.setName("testleaf");
- yangSchemaNodeIdentifier.setNamespace("http://huawei.com");
+ yangSchemaNodeIdentifier.setNameSpace("http://huawei.com");
assertThat(schemaMap2.get(yangSchemaNodeIdentifier), is(notNullValue()));
yangSchemaNodeIdentifier.setName("pretzel");
- yangSchemaNodeIdentifier.setNamespace("http://huawei.com");
+ yangSchemaNodeIdentifier.setNameSpace("http://huawei.com");
assertThat(schemaMap2.get(yangSchemaNodeIdentifier), is(notNullValue()));
assertThat(rootNode.getChild().getChild().getYsnContextInfoMap(), is(notNullValue()));
Map<YangSchemaNodeIdentifier, YangSchemaNodeContextInfo> schemaMap3 = rootNode.getChild().getChild()
.getYsnContextInfoMap();
yangSchemaNodeIdentifier.setName("pretzel");
- yangSchemaNodeIdentifier.setNamespace("http://huawei.com");
+ yangSchemaNodeIdentifier.setNameSpace("http://huawei.com");
assertThat(schemaMap3.get(yangSchemaNodeIdentifier), is(notNullValue()));
YangSchemaNodeContextInfo yangSchemaNodeContextInfo3 = schemaMap3.get(yangSchemaNodeIdentifier);
@@ -95,7 +95,7 @@
Map<YangSchemaNodeIdentifier, YangSchemaNodeContextInfo> schemaMap4 = rootNode.getChild().getChild().getChild()
.getYsnContextInfoMap();
yangSchemaNodeIdentifier.setName("pretzel");
- yangSchemaNodeIdentifier.setNamespace("http://huawei.com");
+ yangSchemaNodeIdentifier.setNameSpace("http://huawei.com");
assertThat(schemaMap4.get(yangSchemaNodeIdentifier), is(notNullValue()));
YangSchemaNodeContextInfo yangSchemaNodeContextInfo2 = schemaMap4.get(yangSchemaNodeIdentifier);
@@ -108,4 +108,5 @@
deleteDirectory("target/schemaMap/");
}
+
}