package org.opendaylight.restconf.nb.rfc8040.rests.services.impl;
import java.net.URI;
+import javax.ws.rs.Path;
import javax.ws.rs.core.UriInfo;
-import org.opendaylight.controller.md.sal.dom.api.DOMMountPoint;
-import org.opendaylight.controller.md.sal.dom.api.DOMRpcResult;
+import org.opendaylight.mdsal.dom.api.DOMMountPoint;
+import org.opendaylight.mdsal.dom.api.DOMRpcResult;
import org.opendaylight.restconf.common.context.InstanceIdentifierContext;
import org.opendaylight.restconf.common.context.NormalizedNodeContext;
import org.opendaylight.restconf.common.errors.RestconfDocumentedException;
* Implementation of {@link RestconfInvokeOperationsService}.
*
*/
+@Path("/")
public class RestconfInvokeOperationsServiceImpl implements RestconfInvokeOperationsService {
- private final RpcServiceHandler rpcServiceHandler;
- private final SchemaContextHandler schemaContextHandler;
+ private volatile RpcServiceHandler rpcServiceHandler;
+ private volatile SchemaContextHandler schemaContextHandler;
public RestconfInvokeOperationsServiceImpl(final RpcServiceHandler rpcServiceHandler,
final SchemaContextHandler schemaContextHandler) {
this.schemaContextHandler = schemaContextHandler;
}
+ @Override
+ public synchronized void updateHandlers(final Object... handlers) {
+ for (final Object object : handlers) {
+ if (object instanceof SchemaContextHandler) {
+ schemaContextHandler = (SchemaContextHandler) object;
+ } else if (object instanceof RpcServiceHandler) {
+ rpcServiceHandler = (RpcServiceHandler) object;
+ }
+ }
+ }
+
@Override
public NormalizedNodeContext invokeRpc(final String identifier, final NormalizedNodeContext payload,
final UriInfo uriInfo) {
final DOMRpcResult result = RestconfInvokeOperationsUtil.checkResponse(response);
RpcDefinition resultNodeSchema = null;
- final NormalizedNode<?, ?> resultData = result.getResult();
- if ((result != null) && (result.getResult() != null)) {
+ NormalizedNode<?, ?> resultData = null;
+ if (result != null && result.getResult() != null) {
+ resultData = result.getResult();
resultNodeSchema = (RpcDefinition) payload.getInstanceIdentifierContext().getSchemaNode();
}
- return new NormalizedNodeContext(new InstanceIdentifierContext<RpcDefinition>(null, resultNodeSchema,
+ return new NormalizedNodeContext(new InstanceIdentifierContext<>(null, resultNodeSchema,
mountPoint, schemaContextRef.get()), resultData);
}
}