Bug 5679 - ietf-yang-library module implemetation
[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.base.services.api.RestconfOperationsService;
30 import org.opendaylight.restconf.base.services.api.RestconfStreamsService;
31 import org.opendaylight.restconf.restful.services.api.RestconfDataService;
32 import org.opendaylight.restconf.restful.services.api.RestconfInvokeOperationsService;
33
34 /**
35  * The URI hierarchy for the RESTCONF resources consists of an entry point
36  * container, 4 top-level resources, and 1 field.
37  * <ul>
38  * <li><b>/restconf</b> - {@link #getRoot()}
39  * <ul>
40  * <li><b>/config</b> - {@link #readConfigurationData(String, UriInfo)}
41  * {@link #updateConfigurationData(String, NormalizedNodeContext, UriInfo)}
42  * {@link #createConfigurationData(NormalizedNodeContext, UriInfo)}
43  * {@link #createConfigurationData(String, NormalizedNodeContext, UriInfo)}
44  * {@link #deleteConfigurationData(String)}
45  * <li><b>/operational</b> - {@link #readOperationalData(String, UriInfo)}
46  * <li>/modules - {@link #getModules(UriInfo)}
47  * <ul>
48  * <li>/module
49  * </ul>
50  * <li><b>/operations</b> -
51  * {@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 RestconfDataService#readData(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 RestconfDataService#readData(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 RestconfDataService#readData(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, UriInfo)}
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,
180             NormalizedNodeContext payload, @Context UriInfo uriInfo);
181
182     /**
183      * @deprecated do not use this method. It will be replaced by
184      *             {@link RestconfDataService#postData(String, NormalizedNodeContext, UriInfo)}
185      */
186     @Deprecated
187     @POST
188     @Path("/config/{identifier:.+}")
189     @Consumes({ Draft02.MediaTypes.DATA + JSON, Draft02.MediaTypes.DATA + XML, MediaType.APPLICATION_JSON,
190             MediaType.APPLICATION_XML, MediaType.TEXT_XML })
191     public Response createConfigurationData(@Encoded @PathParam("identifier") String identifier, NormalizedNodeContext payload,
192             @Context UriInfo uriInfo);
193
194     /**
195      * @deprecated do not use this method. It will be replaced by
196      *             {@link RestconfDataService#postData(NormalizedNodeContext, UriInfo)}
197      */
198     @Deprecated
199     @POST
200     @Path("/config")
201     @Consumes({ Draft02.MediaTypes.DATA + JSON, Draft02.MediaTypes.DATA + XML, MediaType.APPLICATION_JSON,
202             MediaType.APPLICATION_XML, MediaType.TEXT_XML })
203     public Response createConfigurationData(NormalizedNodeContext payload, @Context UriInfo uriInfo);
204
205     /**
206      * @deprecated do not use this method. It will be replaced by
207      *             {@link RestconfDataService#deleteData(String)}
208      */
209     @Deprecated
210     @DELETE
211     @Path("/config/{identifier:.+}")
212     public Response deleteConfigurationData(@Encoded @PathParam("identifier") String identifier);
213
214     @GET
215     @Path("/streams/stream/{identifier:.+}")
216     public NormalizedNodeContext subscribeToStream(@Encoded @PathParam("identifier") String identifier,
217             @Context UriInfo uriInfo);
218
219     /**
220      * @deprecated do not use this method. It will be replaced by
221      *             {@link RestconfStreamsService#getAvailableStreams(UriInfo)}
222      */
223     @Deprecated
224     @GET
225     @Path("/streams")
226     @Produces({ Draft02.MediaTypes.API + JSON, Draft02.MediaTypes.API + XML, MediaType.APPLICATION_JSON,
227             MediaType.APPLICATION_XML, MediaType.TEXT_XML })
228     public NormalizedNodeContext getAvailableStreams(@Context UriInfo uriInfo);
229
230     /**
231      * @deprecated do not use this method. It will be replaced by
232      *             {@link RestconfDataService#patchData(String, PATCHContext, UriInfo)}
233      */
234     @Deprecated
235     @PATCH
236     @Path("/config/{identifier:.+}")
237     @Consumes({MediaTypes.PATCH + JSON, MediaTypes.PATCH + XML})
238     @Produces({MediaTypes.PATCH_STATUS + JSON, MediaTypes.PATCH_STATUS + XML})
239     PATCHStatusContext patchConfigurationData(@Encoded @PathParam("identifier") String identifier, PATCHContext
240             context, @Context UriInfo uriInfo);
241
242     /**
243      * @deprecated do not use this method. It will be replaced by
244      *             {@link RestconfDataService#patchData(PATCHContext, UriInfo)}
245      */
246     @Deprecated
247     @PATCH
248     @Path("/config")
249     @Consumes({MediaTypes.PATCH + JSON, MediaTypes.PATCH + XML})
250     @Produces({MediaTypes.PATCH_STATUS + JSON, MediaTypes.PATCH_STATUS + XML})
251     PATCHStatusContext patchConfigurationData(PATCHContext context, @Context UriInfo uriInfo);
252 }