Remove DOMRpcIdentifier.GLOBAL_CONTEXT
[controller.git] / opendaylight / md-sal / sal-dom-api / src / main / java / org / opendaylight / controller / md / sal / dom / api / DOMRpcIdentifier.java
index 4e6c7a5f7f2964dc8b4655c7a3d73d508409ae5a..fb38a8f18576dfa108c22548aae879e067ff0ba6 100644 (file)
@@ -22,6 +22,7 @@ import org.opendaylight.yangtools.yang.model.api.SchemaPath;
  * contexts concurrently.
  */
 public abstract class DOMRpcIdentifier {
+
     private static final class Global extends DOMRpcIdentifier {
         private Global(final @Nonnull SchemaPath type) {
             super(type);
@@ -29,7 +30,7 @@ public abstract class DOMRpcIdentifier {
 
         @Override
         public YangInstanceIdentifier getContextReference() {
-            return null;
+            return YangInstanceIdentifier.EMPTY;
         }
     }
 
@@ -71,11 +72,10 @@ public abstract class DOMRpcIdentifier {
      * @return A global RPC identifier, guaranteed to be non-null.
      */
     public static @Nonnull DOMRpcIdentifier create(final @Nonnull SchemaPath type, final @Nullable YangInstanceIdentifier contextReference) {
-        if (contextReference == null) {
+        if (contextReference == null || contextReference.isEmpty()) {
             return new Global(type);
-        } else {
-            return new Local(type, contextReference);
         }
+        return new Local(type, contextReference);
     }
 
     /**
@@ -92,7 +92,7 @@ public abstract class DOMRpcIdentifier {
      *
      * @return RPC context reference.
      */
-    public abstract @Nullable YangInstanceIdentifier getContextReference();
+    public abstract @Nonnull YangInstanceIdentifier getContextReference();
 
     @Override
     public final int hashCode() {