Split Restconf implementations (draft02 and RFC) - Application
[netconf.git] / restconf / restconf-nb-bierman02 / src / main / java / org / opendaylight / restconf / restful / services / api / RestconfDataService.java
1 /*
2  * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8 package org.opendaylight.restconf.restful.services.api;
9
10 import javax.ws.rs.Consumes;
11 import javax.ws.rs.DELETE;
12 import javax.ws.rs.Encoded;
13 import javax.ws.rs.GET;
14 import javax.ws.rs.POST;
15 import javax.ws.rs.PUT;
16 import javax.ws.rs.Path;
17 import javax.ws.rs.PathParam;
18 import javax.ws.rs.Produces;
19 import javax.ws.rs.core.Context;
20 import javax.ws.rs.core.MediaType;
21 import javax.ws.rs.core.Response;
22 import javax.ws.rs.core.UriInfo;
23 import org.opendaylight.restconf.Rfc8040;
24 import org.opendaylight.restconf.common.context.NormalizedNodeContext;
25 import org.opendaylight.restconf.common.patch.Patch;
26 import org.opendaylight.restconf.common.patch.PatchContext;
27 import org.opendaylight.restconf.common.patch.PatchStatusContext;
28 import org.opendaylight.restconf.utils.RestconfConstants;
29
30 /**
31  * The "{+restconf}/data" subtree represents the datastore resource type, which is a collection of
32  * configuration data and state data nodes.
33  *
34  * @deprecated move to splitted module restconf-nb-rfc8040
35  */
36 @Deprecated
37 public interface RestconfDataService {
38
39     /**
40      * Get target data resource.
41      *
42      * @param identifier
43      *            path to target
44      * @param uriInfo
45      *            URI info
46      * @return {@link NormalizedNodeContext}
47      */
48     @GET
49     @Path("/data/{identifier:.+}")
50     @Produces({ Rfc8040.MediaTypes.DATA + RestconfConstants.JSON, Rfc8040.MediaTypes.DATA, MediaType.APPLICATION_JSON,
51             MediaType.APPLICATION_XML, MediaType.TEXT_XML })
52     Response readData(@Encoded @PathParam("identifier") String identifier, @Context UriInfo uriInfo);
53
54     /**
55      * Get target data resource from data root.
56      *
57      * @param uriInfo
58      *            URI info
59      * @return {@link NormalizedNodeContext}
60      */
61     @GET
62     @Path("/data")
63     @Produces({ Rfc8040.MediaTypes.DATA + RestconfConstants.JSON, Rfc8040.MediaTypes.DATA, MediaType.APPLICATION_JSON,
64             MediaType.APPLICATION_XML, MediaType.TEXT_XML })
65     Response readData(@Context UriInfo uriInfo);
66
67     /**
68      * Create or replace the target data resource.
69      *
70      * @param identifier
71      *            path to target
72      * @param payload
73      *            data node for put to config DS
74      * @return {@link Response}
75      */
76     @PUT
77     @Path("/data/{identifier:.+}")
78     @Consumes({ Rfc8040.MediaTypes.DATA + RestconfConstants.JSON, Rfc8040.MediaTypes.DATA, MediaType.APPLICATION_JSON,
79             MediaType.APPLICATION_XML, MediaType.TEXT_XML })
80     Response putData(@Encoded @PathParam("identifier") String identifier, NormalizedNodeContext payload,
81             @Context UriInfo uriInfo);
82
83     /**
84      * Create a data resource in target.
85      *
86      * @param identifier
87      *            path to target
88      * @param payload
89      *            new data
90      * @param uriInfo
91      *            URI info
92      * @return {@link Response}
93      */
94     @POST
95     @Path("/data/{identifier:.+}")
96     @Consumes({ Rfc8040.MediaTypes.DATA + RestconfConstants.JSON, Rfc8040.MediaTypes.DATA, MediaType.APPLICATION_JSON,
97             MediaType.APPLICATION_XML, MediaType.TEXT_XML })
98     Response postData(@Encoded @PathParam("identifier") String identifier, NormalizedNodeContext payload,
99             @Context UriInfo uriInfo);
100
101     /**
102      * Create a data resource.
103      *
104      * @param payload
105      *            new data
106      * @param uriInfo
107      *            URI info
108      * @return {@link Response}
109      */
110     @POST
111     @Path("/data")
112     @Consumes({ Rfc8040.MediaTypes.DATA + RestconfConstants.JSON, Rfc8040.MediaTypes.DATA, MediaType.APPLICATION_JSON,
113             MediaType.APPLICATION_XML, MediaType.TEXT_XML })
114     Response postData(NormalizedNodeContext payload, @Context UriInfo uriInfo);
115
116     /**
117      * Delete the target data resource.
118      *
119      * @param identifier
120      *            path to target
121      * @return {@link Response}
122      */
123     @DELETE
124     @Path("/data/{identifier:.+}")
125     Response deleteData(@Encoded @PathParam("identifier") String identifier);
126
127     /**
128      * Ordered list of edits that are applied to the target datastore by the
129      * server.
130      *
131      * @param identifier
132      *            path to target
133      * @param context
134      *            edits
135      * @param uriInfo
136      *            URI info
137      * @return {@link PatchStatusContext}
138      */
139     @Patch
140     @Path("/data/{identifier:.+}")
141     @Consumes({ Rfc8040.MediaTypes.PATCH + RestconfConstants.JSON, Rfc8040.MediaTypes.PATCH + RestconfConstants.XML })
142     @Produces({ Rfc8040.MediaTypes.PATCH_STATUS + RestconfConstants.JSON,
143             Rfc8040.MediaTypes.PATCH_STATUS + RestconfConstants.XML })
144     PatchStatusContext patchData(@Encoded @PathParam("identifier") String identifier, PatchContext context,
145                                  @Context UriInfo uriInfo);
146
147     /**
148      * Ordered list of edits that are applied to the datastore by the server.
149      *
150      * @param context
151      *            edits
152      * @param uriInfo
153      *            URI info
154      * @return {@link PatchStatusContext}
155      */
156     @Patch
157     @Path("/data")
158     @Consumes({ Rfc8040.MediaTypes.PATCH + RestconfConstants.JSON, Rfc8040.MediaTypes.PATCH + RestconfConstants.XML })
159     @Produces({ Rfc8040.MediaTypes.PATCH_STATUS + RestconfConstants.JSON,
160             Rfc8040.MediaTypes.PATCH_STATUS + RestconfConstants.XML })
161     PatchStatusContext patchData(PatchContext context, @Context UriInfo uriInfo);
162 }