Add update method of handlers for REST services
[netconf.git] / restconf / restconf-nb-rfc8040 / src / main / java / org / opendaylight / restconf / nb / rfc8040 / services / simple / impl / RestconfSchemaServiceImpl.java
index e19e9db38945b78de8b1e349d102f30dfdfcd1c3..231b436c5e2e6d8400ee8701f6d91d6c8839750d 100644 (file)
@@ -21,8 +21,8 @@ import org.opendaylight.yangtools.yang.model.api.SchemaContext;
  */
 public class RestconfSchemaServiceImpl implements RestconfSchemaService {
 
-    private final SchemaContextHandler schemaContextHandler;
-    private final DOMMountPointServiceHandler domMountPointServiceHandler;
+    private SchemaContextHandler schemaContextHandler;
+    private DOMMountPointServiceHandler domMountPointServiceHandler;
 
     /**
      * Set {@link SchemaContextHandler} for getting actual {@link SchemaContext}
@@ -45,4 +45,15 @@ public class RestconfSchemaServiceImpl implements RestconfSchemaService {
         return ParserIdentifier.toSchemaExportContextFromIdentifier(schemaContextRef.get(), identifier,
                 this.domMountPointServiceHandler.get());
     }
+
+    @Override
+    public synchronized void updateHandlers(final Object... handlers) {
+        for (final Object object : handlers) {
+            if (object instanceof SchemaContextHandler) {
+                schemaContextHandler = (SchemaContextHandler) object;
+            } else if (object instanceof DOMMountPointServiceHandler) {
+                domMountPointServiceHandler = (DOMMountPointServiceHandler) object;
+            }
+        }
+    }
 }