X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-rest-connector%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fsal%2Frestconf%2Fimpl%2FControllerContext.java;h=b0a6e0d6f3885f20242d483044c0cfa92af1dea6;hp=93e6a2c0e98504e169703423837177078992c2a4;hb=351a78c9840c5b98a478b91ffd50befad998eb0e;hpb=c74d5c2399e500fe3e690edc8cee497b1cb6f867 diff --git a/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/restconf/impl/ControllerContext.java b/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/restconf/impl/ControllerContext.java index 93e6a2c0e9..b0a6e0d6f3 100644 --- a/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/restconf/impl/ControllerContext.java +++ b/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/restconf/impl/ControllerContext.java @@ -118,15 +118,19 @@ public class ControllerContext implements SchemaContextListener { this.onGlobalContextUpdated(schemas); } - public InstanceIdWithSchemaNode toInstanceIdentifier(final String restconfInstance) { + public InstanceIdentifierContext toInstanceIdentifier(final String restconfInstance) { return this.toIdentifier(restconfInstance, false); } - public InstanceIdWithSchemaNode toMountPointIdentifier(final String restconfInstance) { + public SchemaContext getGlobalSchema() { + return globalSchema; + } + + public InstanceIdentifierContext toMountPointIdentifier(final String restconfInstance) { return this.toIdentifier(restconfInstance, true); } - private InstanceIdWithSchemaNode toIdentifier(final String restconfInstance, final boolean toMountPointIdentifier) { + private InstanceIdentifierContext toIdentifier(final String restconfInstance, final boolean toMountPointIdentifier) { this.checkPreconditions(); final List pathArgs = urlPathArgsDecode(SLASH_SPLITTER.split(restconfInstance)); @@ -144,7 +148,7 @@ public class ControllerContext implements SchemaContextListener { InstanceIdentifierBuilder builder = YangInstanceIdentifier.builder(); Module latestModule = globalSchema.findModuleByName(startModule, null); - InstanceIdWithSchemaNode iiWithSchemaNode = this.collectPathArguments(builder, pathArgs, latestModule, null, + InstanceIdentifierContext iiWithSchemaNode = this.collectPathArguments(builder, pathArgs, latestModule, null, toMountPointIdentifier); if (iiWithSchemaNode == null) { @@ -462,7 +466,7 @@ public class ControllerContext implements SchemaContextListener { return object == null ? "" : URLEncoder.encode(object.toString(), ControllerContext.URI_ENCODING_CHAR_SET); } - private InstanceIdWithSchemaNode collectPathArguments(final InstanceIdentifierBuilder builder, + private InstanceIdentifierContext collectPathArguments(final InstanceIdentifierBuilder builder, final List strings, final DataNodeContainer parentNode, final DOMMountPoint mountPoint, final boolean returnJustMountPoint) { Preconditions.> checkNotNull(strings); @@ -472,7 +476,7 @@ public class ControllerContext implements SchemaContextListener { } if (strings.isEmpty()) { - return new InstanceIdWithSchemaNode(builder.toInstance(), ((DataSchemaNode) parentNode), mountPoint); + return new InstanceIdentifierContext(builder.toInstance(), ((DataSchemaNode) parentNode), mountPoint,mountPoint != null ? mountPoint.getSchemaContext() : globalSchema); } String head = strings.iterator().next(); @@ -511,12 +515,12 @@ public class ControllerContext implements SchemaContextListener { if (returnJustMountPoint) { YangInstanceIdentifier instance = YangInstanceIdentifier.builder().toInstance(); - return new InstanceIdWithSchemaNode(instance, mountPointSchema, mount); + return new InstanceIdentifierContext(instance, mountPointSchema, mount,mountPointSchema); } if (strings.size() == 1) { YangInstanceIdentifier instance = YangInstanceIdentifier.builder().toInstance(); - return new InstanceIdWithSchemaNode(instance, mountPointSchema, mount); + return new InstanceIdentifierContext(instance, mountPointSchema, mount,mountPointSchema); } final String moduleNameBehindMountPoint = toModuleName(strings.get(1)); @@ -632,7 +636,7 @@ public class ControllerContext implements SchemaContextListener { returnJustMountPoint); } - return new InstanceIdWithSchemaNode(builder.toInstance(), targetNode, mountPoint); + return new InstanceIdentifierContext(builder.toInstance(), targetNode, mountPoint,mountPoint != null ? mountPoint.getSchemaContext() : globalSchema); } public static DataSchemaNode findInstanceDataChildByNameAndNamespace(final DataNodeContainer container, final String name,