import org.opendaylight.yangtools.yang.model.api.SchemaContext
import static com.google.common.base.Preconditions.*
+import org.opendaylight.controller.sal.core.api.model.SchemaServiceListener
+
+class ControllerContext implements SchemaServiceListener {
-class ControllerContext {
-
val static ControllerContext INSTANCE = new ControllerContext
-
+
val static NULL_VALUE = "null"
-
+
@Property
SchemaContext schemas;
if (targetNode instanceof ListSchemaNode) {
val listNode = targetNode as ListSchemaNode;
val keysSize = listNode.keyDefinition.size
+
// every key has to be filled
if ((strings.length - consumed) < keysSize) {
return null;
var i = 0;
for (key : listNode.keyDefinition) {
val uriKeyValue = uriKeyValues.get(i);
+
// key value cannot be NULL
if (uriKeyValue.equals(NULL_VALUE)) {
return null
consumed = consumed + i;
builder.nodeWithKey(targetNode.QName, keyValues);
} else {
+
// Only one instance of node is allowed
builder.node(targetNode.QName);
}
public def QName toRpcQName(String name) {
}
+
+ override onGlobalContextUpdated(SchemaContext context) {
+ this.schemas = context;
+ }
+
}