Bug 5528 - Preparing enviroment for impl of restful services
[netconf.git] / restconf / sal-rest-connector / src / main / java / org / opendaylight / netconf / sal / rest / api / RestconfService.java
1 /*
2  * Copyright (c) 2013 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.netconf.sal.rest.api;
9
10 import javax.ws.rs.Consumes;
11 import javax.ws.rs.DELETE;
12 import javax.ws.rs.DefaultValue;
13 import javax.ws.rs.Encoded;
14 import javax.ws.rs.GET;
15 import javax.ws.rs.POST;
16 import javax.ws.rs.PUT;
17 import javax.ws.rs.Path;
18 import javax.ws.rs.PathParam;
19 import javax.ws.rs.Produces;
20 import javax.ws.rs.core.Context;
21 import javax.ws.rs.core.MediaType;
22 import javax.ws.rs.core.Response;
23 import javax.ws.rs.core.UriInfo;
24 import org.opendaylight.netconf.sal.rest.api.Draft02.MediaTypes;
25 import org.opendaylight.netconf.sal.rest.impl.PATCH;
26 import org.opendaylight.netconf.sal.restconf.impl.NormalizedNodeContext;
27 import org.opendaylight.netconf.sal.restconf.impl.PATCHContext;
28 import org.opendaylight.netconf.sal.restconf.impl.PATCHStatusContext;
29 import org.opendaylight.restconf.rest.services.api.RestconfModulesService;
30 import org.opendaylight.restconf.rest.services.api.RestconfOperationsService;
31 import org.opendaylight.restconf.rest.services.api.RestconfStreamsService;
32 import org.opendaylight.restconf.restful.services.api.RestconfDataService;
33 import org.opendaylight.restconf.restful.services.api.RestconfInvokeOperationsService;
34
35 /**
36  * The URI hierarchy for the RESTCONF resources consists of an entry point container, 4 top-level resources, and 1
37  * field.
38  * <ul>
39  * <li><b>/restconf</b> - {@link #getRoot()}
40  * <ul>
41  *      <li><b>/config</b> - {@link #readConfigurationData(String, UriInfo)}
42  *                              {@link #updateConfigurationData(String, NormalizedNodeContext)}
43  *                              {@link #createConfigurationData(NormalizedNodeContext, UriInfo)}
44  *                              {@link #createConfigurationData(String, NormalizedNodeContext, UriInfo)}
45  * {@link #deleteConfigurationData(String)}
46  * <li><b>/operational</b> - {@link #readOperationalData(String, UriInfo)}
47  * <li>/modules - {@link #getModules(UriInfo)}
48  * <ul>
49  * <li>/module
50  * </ul>
51  *      <li><b>/operations</b> - {@link #invokeRpc(String, NormalizedNodeContext, UriInfo)}
52  *                               {@link #invokeRpc(String, NormalizedNodeContext, UriInfo)}
53  * <li>/version (field)
54  * </ul>
55  * </ul>
56  */
57 @Path("/")
58 public interface RestconfService {
59
60     public static final String XML = "+xml";
61     public static final String JSON = "+json";
62
63     @GET
64     public Object getRoot();
65
66     /**
67      * @deprecated do not use this method. It will be replaced by
68      *             {@link RestconfModulesService#getModules(UriInfo)}
69      */
70     @Deprecated
71     @GET
72     @Path("/modules")
73     @Produces({ Draft02.MediaTypes.API + JSON, Draft02.MediaTypes.API + XML, MediaType.APPLICATION_JSON,
74             MediaType.APPLICATION_XML, MediaType.TEXT_XML })
75     public NormalizedNodeContext getModules(@Context UriInfo uriInfo);
76
77     /**
78      * @deprecated do not use this method. It will be replaced by
79      *             {@link RestconfModulesService#getModules(String, UriInfo)}
80      */
81     @Deprecated
82     @GET
83     @Path("/modules/{identifier:.+}")
84     @Produces({ Draft02.MediaTypes.API + JSON, Draft02.MediaTypes.API + XML, MediaType.APPLICATION_JSON,
85             MediaType.APPLICATION_XML, MediaType.TEXT_XML })
86     public NormalizedNodeContext getModules(@PathParam("identifier") String identifier, @Context UriInfo uriInfo);
87
88     /**
89      * @deprecated do not use this method. It will be replaced by
90      *             {@link RestconfModulesService#getModule(String, UriInfo)}
91      */
92     @Deprecated
93     @GET
94     @Path("/modules/module/{identifier:.+}")
95     @Produces({ Draft02.MediaTypes.API + JSON, Draft02.MediaTypes.API + XML, MediaType.APPLICATION_JSON,
96             MediaType.APPLICATION_XML, MediaType.TEXT_XML })
97     public NormalizedNodeContext getModule(@PathParam("identifier") String identifier, @Context UriInfo uriInfo);
98
99     /**
100      * @deprecated do not use this method. It will be replaced by
101      *             {@link RestconfOperationsService#getOperations(UriInfo)}
102      */
103     @Deprecated
104     @GET
105     @Path("/operations")
106     @Produces({ Draft02.MediaTypes.API + JSON, Draft02.MediaTypes.API + XML, MediaType.APPLICATION_JSON,
107             MediaType.APPLICATION_XML, MediaType.TEXT_XML })
108     public NormalizedNodeContext getOperations(@Context UriInfo uriInfo);
109
110     /**
111      * @deprecated do not use this method. It will be replaced by
112      *             {@link RestconfOperationsService#getOperations(String, UriInfo)}
113      */
114     @Deprecated
115     @GET
116     @Path("/operations/{identifier:.+}")
117     @Produces({ Draft02.MediaTypes.API + JSON, Draft02.MediaTypes.API + XML, MediaType.APPLICATION_JSON,
118             MediaType.APPLICATION_XML, MediaType.TEXT_XML })
119     public NormalizedNodeContext getOperations(@PathParam("identifier") String identifier, @Context UriInfo uriInfo);
120
121     /**
122      * @deprecated do not use this method. It will be replaced by
123      *             {@link RestconfInvokeOperationsService#invokeRpc(String, NormalizedNodeContext, UriInfo)}
124      */
125     @Deprecated
126     @POST
127     @Path("/operations/{identifier:.+}")
128     @Produces({ Draft02.MediaTypes.OPERATION + JSON, Draft02.MediaTypes.OPERATION + XML,
129             Draft02.MediaTypes.DATA + JSON, Draft02.MediaTypes.DATA + XML, MediaType.APPLICATION_JSON,
130             MediaType.APPLICATION_XML, MediaType.TEXT_XML })
131     @Consumes({ Draft02.MediaTypes.OPERATION + JSON, Draft02.MediaTypes.OPERATION + XML,
132             Draft02.MediaTypes.DATA + JSON, Draft02.MediaTypes.DATA + XML, MediaType.APPLICATION_JSON,
133             MediaType.APPLICATION_XML, MediaType.TEXT_XML })
134     public NormalizedNodeContext invokeRpc(@Encoded @PathParam("identifier") String identifier, NormalizedNodeContext payload,
135             @Context UriInfo uriInfo);
136
137     @POST
138     @Path("/operations/{identifier:.+}")
139     @Produces({ Draft02.MediaTypes.OPERATION + JSON, Draft02.MediaTypes.OPERATION + XML,
140             Draft02.MediaTypes.DATA + JSON, Draft02.MediaTypes.DATA + XML, MediaType.APPLICATION_JSON,
141             MediaType.APPLICATION_XML, MediaType.TEXT_XML })
142     @Deprecated // method isn't use anywhere
143     public NormalizedNodeContext invokeRpc(@Encoded @PathParam("identifier") String identifier,
144             @DefaultValue("") String noPayload, @Context UriInfo uriInfo);
145
146     /**
147      * @deprecated do not use this method. It will be replaced by
148      *             {@link RestconfDataService#readData(String, UriInfo)}
149      */
150     @Deprecated
151     @GET
152     @Path("/config/{identifier:.+}")
153     @Produces({ Draft02.MediaTypes.DATA + JSON, Draft02.MediaTypes.DATA + XML, MediaType.APPLICATION_JSON,
154             MediaType.APPLICATION_XML, MediaType.TEXT_XML })
155     public NormalizedNodeContext readConfigurationData(@Encoded @PathParam("identifier") String identifier,
156             @Context UriInfo uriInfo);
157
158     /**
159      * @deprecated do not use this method. It will be replaced by
160      *             {@link RestconfDataService#readData(String, UriInfo)}
161      */
162     @Deprecated
163     @GET
164     @Path("/operational/{identifier:.+}")
165     @Produces({ Draft02.MediaTypes.DATA + JSON, Draft02.MediaTypes.DATA + XML, MediaType.APPLICATION_JSON,
166             MediaType.APPLICATION_XML, MediaType.TEXT_XML })
167     public NormalizedNodeContext readOperationalData(@Encoded @PathParam("identifier") String identifier,
168             @Context UriInfo uriInfo);
169
170     /**
171      * @deprecated do not use this method. It will be replaced by
172      *             {@link RestconfDataService#putData(String, NormalizedNodeContext)}
173      */
174     @Deprecated
175     @PUT
176     @Path("/config/{identifier:.+}")
177     @Consumes({ Draft02.MediaTypes.DATA + JSON, Draft02.MediaTypes.DATA + XML, MediaType.APPLICATION_JSON,
178             MediaType.APPLICATION_XML, MediaType.TEXT_XML })
179     public Response updateConfigurationData(@Encoded @PathParam("identifier") String identifier, NormalizedNodeContext payload);
180
181     /**
182      * @deprecated do not use this method. It will be replaced by
183      *             {@link RestconfDataService#postData(String, NormalizedNodeContext, UriInfo)}
184      */
185     @Deprecated
186     @POST
187     @Path("/config/{identifier:.+}")
188     @Consumes({ Draft02.MediaTypes.DATA + JSON, Draft02.MediaTypes.DATA + XML, MediaType.APPLICATION_JSON,
189             MediaType.APPLICATION_XML, MediaType.TEXT_XML })
190     public Response createConfigurationData(@Encoded @PathParam("identifier") String identifier, NormalizedNodeContext payload,
191             @Context UriInfo uriInfo);
192
193     /**
194      * @deprecated do not use this method. It will be replaced by
195      *             {@link RestconfDataService#postData(NormalizedNodeContext, UriInfo)}
196      */
197     @Deprecated
198     @POST
199     @Path("/config")
200     @Consumes({ Draft02.MediaTypes.DATA + JSON, Draft02.MediaTypes.DATA + XML, MediaType.APPLICATION_JSON,
201             MediaType.APPLICATION_XML, MediaType.TEXT_XML })
202     public Response createConfigurationData(NormalizedNodeContext payload, @Context UriInfo uriInfo);
203
204     /**
205      * @deprecated do not use this method. It will be replaced by
206      *             {@link RestconfDataService#deleteData(String)}
207      */
208     @Deprecated
209     @DELETE
210     @Path("/config/{identifier:.+}")
211     public Response deleteConfigurationData(@Encoded @PathParam("identifier") String identifier);
212
213     @GET
214     @Path("/streams/stream/{identifier:.+}")
215     public Response subscribeToStream(@Encoded @PathParam("identifier") String identifier, @Context UriInfo uriInfo);
216
217     /**
218      * @deprecated do not use this method. It will be replaced by
219      *             {@link RestconfStreamsService#getAvailableStreams(UriInfo)}
220      */
221     @Deprecated
222     @GET
223     @Path("/streams")
224     @Produces({ Draft02.MediaTypes.API + JSON, Draft02.MediaTypes.API + XML, MediaType.APPLICATION_JSON,
225             MediaType.APPLICATION_XML, MediaType.TEXT_XML })
226     public NormalizedNodeContext getAvailableStreams(@Context UriInfo uriInfo);
227
228     /**
229      * @deprecated do not use this method. It will be replaced by
230      *             {@link RestconfDataService#patchData(String, PATCHContext, UriInfo)}
231      */
232     @Deprecated
233     @PATCH
234     @Path("/config/{identifier:.+}")
235     @Consumes({MediaTypes.PATCH + JSON, MediaTypes.PATCH + XML})
236     @Produces({MediaTypes.PATCH_STATUS + JSON, MediaTypes.PATCH_STATUS + XML})
237     PATCHStatusContext patchConfigurationData(@Encoded @PathParam("identifier") String identifier, PATCHContext
238             context, @Context UriInfo uriInfo);
239
240     /**
241      * @deprecated do not use this method. It will be replaced by
242      *             {@link RestconfDataService#patchData(PATCHContext, UriInfo)}
243      */
244     @Deprecated
245     @PATCH
246     @Path("/config")
247     @Consumes({MediaTypes.PATCH + JSON, MediaTypes.PATCH + XML})
248     @Produces({MediaTypes.PATCH_STATUS + JSON, MediaTypes.PATCH_STATUS + XML})
249     PATCHStatusContext patchConfigurationData(PATCHContext context, @Context UriInfo uriInfo);
250 }