X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=restconf%2Frestconf-nb%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Frestconf%2Fserver%2Fapi%2FRestconfServer.java;h=0385dd611c2a51a45036394e65a7a6143e510e32;hb=9c06901f26a8429c18a6ca1967dc293a685ffa98;hp=590567c8f3f86c62736848c354093643716444b6;hpb=c66961f9aa0ae79b3f298c4cf685409fa82df392;p=netconf.git diff --git a/restconf/restconf-nb/src/main/java/org/opendaylight/restconf/server/api/RestconfServer.java b/restconf/restconf-nb/src/main/java/org/opendaylight/restconf/server/api/RestconfServer.java index 590567c8f3..0385dd611c 100644 --- a/restconf/restconf-nb/src/main/java/org/opendaylight/restconf/server/api/RestconfServer.java +++ b/restconf/restconf-nb/src/main/java/org/opendaylight/restconf/server/api/RestconfServer.java @@ -8,18 +8,11 @@ package org.opendaylight.restconf.server.api; import java.net.URI; -import java.util.Map; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; import org.opendaylight.restconf.api.ApiPath; +import org.opendaylight.restconf.api.FormattableBody; import org.opendaylight.restconf.common.errors.RestconfFuture; -import org.opendaylight.restconf.common.patch.PatchStatusContext; -import org.opendaylight.restconf.nb.rfc8040.databind.ChildBody; -import org.opendaylight.restconf.nb.rfc8040.databind.DataPostBody; -import org.opendaylight.restconf.nb.rfc8040.databind.OperationInputBody; -import org.opendaylight.restconf.nb.rfc8040.databind.PatchBody; -import org.opendaylight.restconf.nb.rfc8040.databind.ResourceBody; -import org.opendaylight.restconf.nb.rfc8040.legacy.NormalizedNodePayload; import org.opendaylight.yangtools.yang.common.Empty; /** @@ -35,97 +28,110 @@ public interface RestconfServer { * @return A {@link RestconfFuture} of the operation */ @SuppressWarnings("checkstyle:abbreviationAsWordInName") - RestconfFuture dataDELETE(ApiPath identifier); + RestconfFuture dataDELETE(ServerRequest request, ApiPath identifier); /** * Return the content of the datastore. * - * @param params {@link DataGetParams} for this request + * @param request {@link ServerRequest} for this request * @return A {@link RestconfFuture} of the {@link DataGetResult} content */ - RestconfFuture dataGET(DataGetParams params); + RestconfFuture dataGET(ServerRequest request); /** * Return the content of a data resource. * + * @param request {@link ServerRequest} for this request * @param identifier resource identifier - * @param params {@link DataGetParams} for this request * @return A {@link RestconfFuture} of the {@link DataGetResult} content */ - RestconfFuture dataGET(ApiPath identifier, DataGetParams params); + RestconfFuture dataGET(ServerRequest request, ApiPath identifier); /** * Partially modify the target data resource, as defined in * RFC8040, section 4.6.1. * + * @param request {@link ServerRequest} for this request * @param body data node for put to config DS * @return A {@link RestconfFuture} of the operation */ - RestconfFuture dataPATCH(ResourceBody body); + RestconfFuture dataPATCH(ServerRequest request, ResourceBody body); /** * Partially modify the target data resource, as defined in * RFC8040, section 4.6.1. * + * @param request {@link ServerRequest} for this request * @param identifier resource identifier * @param body data node for put to config DS * @return A {@link RestconfFuture} of the operation */ - RestconfFuture dataPATCH(ApiPath identifier, ResourceBody body); + RestconfFuture dataPATCH(ServerRequest request, ApiPath identifier, ResourceBody body); /** * Ordered list of edits that are applied to the datastore by the server, as defined in * RFC8072, section 2. * + * @param request {@link ServerRequest} for this request * @param body YANG Patch body - * @return A {@link RestconfFuture} of the {@link PatchStatusContext} content + * @return A {@link RestconfFuture} of the {@link DataYangPatchResult} content */ - // FIXME: NETCONF-1207: result should carry ConfigurationMetadata - RestconfFuture dataPATCH(PatchBody body); + RestconfFuture dataPATCH(ServerRequest request, PatchBody body); /** * Ordered list of edits that are applied to the datastore by the server, as defined in * RFC8072, section 2. * + * @param request {@link ServerRequest} for this request * @param identifier path to target * @param body YANG Patch body - * @return A {@link RestconfFuture} of the {@link PatchStatusContext} content + * @return A {@link RestconfFuture} of the {@link DataYangPatchResult} content */ - // FIXME: NETCONF-1207: result should carry ConfigurationMetadata - RestconfFuture dataPATCH(ApiPath identifier, PatchBody body); + RestconfFuture dataPATCH(ServerRequest request, ApiPath identifier, PatchBody body); - RestconfFuture dataPOST(ChildBody body, Map queryParameters); + RestconfFuture dataPOST(ServerRequest request, ChildBody body); - RestconfFuture dataPOST(ApiPath identifier, DataPostBody body, - Map queryParameters); + /** + * Create or invoke a operation, as described in + * RFC8040 section 4.4. + * + * @param request {@link ServerRequest} for this request + * @param identifier path to target + * @param body body of the post request + */ + RestconfFuture dataPOST(ServerRequest request, ApiPath identifier, DataPostBody body); /** - * Replace the data store. + * Replace the data store, as described in + * RFC8040 section 4.5. * + * @param request {@link ServerRequest} for this request * @param body data node for put to config DS - * @param queryParameters Query parameters * @return A {@link RestconfFuture} completing with {@link DataPutResult} */ - RestconfFuture dataPUT(ResourceBody body, Map queryParameters); + RestconfFuture dataPUT(ServerRequest request, ResourceBody body); /** - * Create or replace a data store resource. + * Create or replace a data store resource, as described in + * RFC8040 section 4.5. * + * @param request {@link ServerRequest} for this request * @param identifier resource identifier * @param body data node for put to config DS - * @param queryParameters Query parameters * @return A {@link RestconfFuture} completing with {@link DataPutResult} */ - RestconfFuture dataPUT(ApiPath identifier, ResourceBody body, Map queryParameters); + RestconfFuture dataPUT(ServerRequest request, ApiPath identifier, ResourceBody body); /** - * Return the set of supported RPCs supported by {@link #operationsPOST(URI, ApiPath, OperationInputBody)}, + * Return the set of supported RPCs supported by + * {@link #operationsPOST(ServerRequest, URI, ApiPath, OperationInputBody)}, * as expressed in the ietf-restconf.yang * {@code container operations} statement. * - * @return A {@link RestconfFuture} completing with an {@link OperationsGetResult} + * @param request {@link ServerRequest} for this request + * @return A {@link RestconfFuture} completing with an {@link FormattableBody} */ - RestconfFuture operationsGET(); + RestconfFuture operationsGET(ServerRequest request); /* * Return the details about a particular operation supported by @@ -133,40 +139,44 @@ public interface RestconfServer { * ietf-restconfig.yang * {@code container operations} statement. * + * @param request {@link ServerRequest} for this request * @param operation An operation - * @return A {@link RestconfFuture} completing with an {@link OperationsGetResult} + * @return A {@link RestconfFuture} completing with an {@link FormattableBody} */ - RestconfFuture operationsGET(ApiPath operation); + RestconfFuture operationsGET(ServerRequest request, ApiPath operation); /** * Invoke an RPC operation, as defined in * RFC8040 Operation Resource. * + * @param request {@link ServerRequest} for this request * @param restconfURI Base URI of the request * @param operation {@code } path, really an {@link ApiPath} to an {@code rpc} * @param body RPC operation - * @return A {@link RestconfFuture} completing with {@link OperationsPostResult} + * @return A {@link RestconfFuture} completing with {@link InvokeResult} */ // FIXME: 'operation' should really be an ApiIdentifier with non-null module, but we also support yang-ext:mount, // and hence it is a path right now - RestconfFuture operationsPOST(URI restconfURI, ApiPath operation, OperationInputBody body); + RestconfFuture operationsPOST(ServerRequest request, URI restconfURI, ApiPath operation, + OperationInputBody body); /** * Return the revision of {@code ietf-yang-library} module implemented by this server, as defined in * RFC8040 {+restconf}/yang-library-version. * - * @return A {@link RestconfFuture} completing with {@link NormalizedNodePayload} containing a single + * @param request {@link ServerRequest} for this request + * @return A {@link RestconfFuture} completing with {@link FormattableBody} containing a single * {@code yang-library-version} leaf element. */ - // FIXME: this is a simple encoding-variadic return, similar to how OperationsContent is handled use a common - // construct for both cases -- in this case it carries a yang.common.Revision - RestconfFuture yangLibraryVersionGET(); + RestconfFuture yangLibraryVersionGET(ServerRequest request); - RestconfFuture modulesYangGET(String fileName, @Nullable String revision); + RestconfFuture modulesYangGET(ServerRequest request, String fileName, @Nullable String revision); - RestconfFuture modulesYangGET(ApiPath mountPath, String fileName, @Nullable String revision); + RestconfFuture modulesYangGET(ServerRequest request, ApiPath mountPath, String fileName, + @Nullable String revision); - RestconfFuture modulesYinGET(String fileName, @Nullable String revision); + RestconfFuture modulesYinGET(ServerRequest request, String fileName, @Nullable String revision); - RestconfFuture modulesYinGET(ApiPath mountPath, String fileName, @Nullable String revision); + RestconfFuture modulesYinGET(ServerRequest request, ApiPath mountPath, String fileName, + @Nullable String revision); }