Use ControllerContext non-statically
[netconf.git] / restconf / restconf-nb-bierman02 / src / main / java / org / opendaylight / netconf / sal / rest / impl / AbstractIdentifierAwareJaxRsProvider.java
index 095e73c952b76add9a2d3b69f9fa9269dc81177d..761b3bdd2eab7c539ca7ee001f2d1a7b771ab568 100644 (file)
@@ -31,12 +31,18 @@ public class AbstractIdentifierAwareJaxRsProvider {
     @Context
     private Request request;
 
+    private final ControllerContext controllerContext;
+
+    protected AbstractIdentifierAwareJaxRsProvider(ControllerContext controllerContext) {
+        this.controllerContext = controllerContext;
+    }
+
     protected final String getIdentifier() {
         return this.uriInfo.getPathParameters(false).getFirst(RestconfConstants.IDENTIFIER);
     }
 
     protected InstanceIdentifierContext<?> getInstanceIdentifierContext() {
-        return ControllerContext.getInstance().toInstanceIdentifier(getIdentifier());
+        return controllerContext.toInstanceIdentifier(getIdentifier());
     }
 
     protected UriInfo getUriInfo() {
@@ -47,6 +53,10 @@ public class AbstractIdentifierAwareJaxRsProvider {
         return POST.equals(this.request.getMethod());
     }
 
+    protected ControllerContext getControllerContext() {
+        return controllerContext;
+    }
+
     Request getRequest() {
         return this.request;
     }