+ private static SchemaPathHolder processIdentifier(String node,
+ SchemaContext context,
+ String prefix) {
+
+ String[] values = node.split(UNDERSCORE);
+ String val = values[0];
+ StringBuilder firstHalf = new StringBuilder();
+ String secondHalf = "";
+ if (node.contains(UNDERSCORE)) {
+ secondHalf = node.substring(values[0].length()+1);
+ }
+ InstanceIdentifierContext<?> id;
+ for (int i = 0; i< values.length-1; i++) {
+ val = values[i];
+ val = firstHalf + val + COLON + secondHalf;
+ try {
+ id = toInstanceIdentifier(prefix + val, context, null);
+ return new SchemaPathHolder(id, val);
+ } catch (IllegalArgumentException | RestconfDocumentedException |
+ NullPointerException e) {
+ log.info(format(INFO_MSG, val));
+ }
+ firstHalf.append(values[i]).append(UNDERSCORE);
+ secondHalf = secondHalf.replaceFirst(
+ values[i + 1] + UNDERSCORE,"");
+ }
+ val = val.replace(COLON,UNDERSCORE);
+ try {
+ id = toInstanceIdentifier(prefix + val, context, null);
+ return new SchemaPathHolder(id, val);
+ } catch (IllegalArgumentException | RestconfDocumentedException |
+ NullPointerException e1) {
+ throw new IllegalArgumentException(EXC_MSG, e1);
+ }
+ }
+
+ /**
+ * Returns the namespace of the given node name. If the node name is
+ * separated by colon, the it splits with colon and forms the namespace.
+ * If the node name is formed with underscore, then it splits the node
+ * name consecutively to figure out the proper module name.
+ *
+ * @param childName node name
+ * @param ctx schema context
+ * @param parent parent properties node
+ * @param curSchema current schema
+ * @return namespace of the given node
+ */
+ static Namespace getNamespace(String childName, SchemaContext ctx,
+ PropertiesNode parent, SchemaNode curSchema) {
+
+ Namespace parentNs = parent.namespace();
+ Namespace ns = new Namespace(parentNs.moduleName(),
+ parentNs.moduleNs(), parentNs.revision());
+ int lastIndexOfColon = childName.lastIndexOf(COLON);