Merge "BUG-868: use a single version of ClassLoaderUtils"
[controller.git] / opendaylight / md-sal / sal-rest-connector / src / main / java / org / opendaylight / controller / 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.controller.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.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.Encoded;
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
25 import org.opendaylight.controller.sal.restconf.impl.StructuredData;
26 import org.opendaylight.yangtools.yang.data.api.CompositeNode;
27
28 /**
29  *   The URI hierarchy for the RESTCONF resources consists of an entry
30  *   point container, 4 top-level resources, and 1 field.
31  *   <ul>
32  *    <li><b>/restconf</b> - {@link #getRoot()}
33  *     <ul>
34  *      <li><b>/config</b> - {@link #readConfigurationData(String)}
35  *                              {@link #updateConfigurationData(String, CompositeNode)}
36  *                              {@link #createConfigurationData(CompositeNode)}
37  *                              {@link #createConfigurationData(String, CompositeNode)}
38  *                              {@link #deleteConfigurationData(String)}
39  *      <li><b>/operational</b> - {@link #readOperationalData(String)}
40  *      <li>/modules - {@link #getModules()}
41  *       <ul>
42  *        <li>/module
43  *       </ul>
44  *      <li><b>/operations</b> - {@link #invokeRpc(String, CompositeNode)}
45  *                               {@link #invokeRpc(String, CompositeNode)}
46  *      <li>/version (field)
47  *     </ul>
48  *   </ul>
49  */
50 @Path("/")
51 public interface RestconfService {
52
53     public static final String XML = "+xml";
54     public static final String JSON = "+json";
55
56     @GET
57     public Object getRoot();
58
59     @GET
60     @Path("/modules")
61     @Produces({Draft02.MediaTypes.API+XML, Draft02.MediaTypes.API+JSON,
62                MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_XML})
63     public StructuredData getModules();
64
65     @GET
66     @Path("/modules/{identifier:.+}")
67     @Produces({Draft02.MediaTypes.API+XML, Draft02.MediaTypes.API+JSON,
68                MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_XML})
69     public StructuredData getModules(@PathParam("identifier") String identifier);
70
71     @GET
72     @Path("/modules/module/{identifier:.+}")
73     @Produces({Draft02.MediaTypes.API+XML, Draft02.MediaTypes.API+JSON,
74                MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_XML})
75     public StructuredData getModule(@PathParam("identifier") String identifier);
76
77     @GET
78     @Path("/operations")
79     @Produces({Draft02.MediaTypes.API+XML, Draft02.MediaTypes.API+JSON,
80                MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_XML})
81     public StructuredData getOperations();
82
83     @GET
84     @Path("/operations/{identifier:.+}")
85     @Produces({Draft02.MediaTypes.API+XML, Draft02.MediaTypes.API+JSON,
86                MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_XML})
87     public StructuredData getOperations(@PathParam("identifier") String identifier);
88
89     @POST
90     @Path("/operations/{identifier:.+}")
91     @Produces({Draft02.MediaTypes.OPERATION+JSON, Draft02.MediaTypes.OPERATION+XML,
92                Draft02.MediaTypes.DATA+JSON, Draft02.MediaTypes.DATA+XML,
93                MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_XML})
94     @Consumes({Draft02.MediaTypes.OPERATION+JSON, Draft02.MediaTypes.OPERATION+XML,
95                Draft02.MediaTypes.DATA+JSON, Draft02.MediaTypes.DATA+XML,
96                MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_XML})
97     public StructuredData invokeRpc(@Encoded @PathParam("identifier") String identifier, CompositeNode payload);
98
99     @POST
100     @Path("/operations/{identifier:.+}")
101     @Produces({Draft02.MediaTypes.OPERATION+JSON, Draft02.MediaTypes.OPERATION+XML,
102                Draft02.MediaTypes.DATA+JSON, Draft02.MediaTypes.DATA+XML,
103                MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_XML})
104     public StructuredData invokeRpc(@Encoded @PathParam("identifier") String identifier, @DefaultValue("") String noPayload);
105
106     @GET
107     @Path("/config/{identifier:.+}")
108     @Produces({Draft02.MediaTypes.DATA+JSON,Draft02.MediaTypes.DATA+XML,
109                MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_XML})
110     public StructuredData readConfigurationData(@Encoded @PathParam("identifier") String identifier);
111
112     @GET
113     @Path("/operational/{identifier:.+}")
114     @Produces({Draft02.MediaTypes.DATA+JSON,Draft02.MediaTypes.DATA+XML,
115                MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_XML})
116     public StructuredData readOperationalData(@Encoded @PathParam("identifier") String identifier);
117
118     @PUT
119     @Path("/config/{identifier:.+}")
120     @Consumes({Draft02.MediaTypes.DATA+JSON,Draft02.MediaTypes.DATA+XML,
121                MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_XML})
122     public Response updateConfigurationData(@Encoded @PathParam("identifier") String identifier, CompositeNode payload);
123
124     @POST
125     @Path("/config/{identifier:.+}")
126     @Consumes({Draft02.MediaTypes.DATA+JSON,Draft02.MediaTypes.DATA+XML,
127                MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_XML})
128     public Response createConfigurationData(@Encoded @PathParam("identifier") String identifier, CompositeNode payload);
129
130     @POST
131     @Path("/config")
132     @Consumes({Draft02.MediaTypes.DATA+JSON,Draft02.MediaTypes.DATA+XML,
133                MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_XML})
134     public Response createConfigurationData(CompositeNode payload);
135
136     @DELETE
137     @Path("/config/{identifier:.+}")
138     public Response deleteConfigurationData(@Encoded @PathParam("identifier") String identifier);
139
140     @GET
141     @Path("/streams/stream/{identifier:.+}")
142     public Response subscribeToStream(@Encoded @PathParam("identifier") String identifier, @Context UriInfo uriInfo);
143
144     @GET
145     @Path("/streams")
146     @Produces({Draft02.MediaTypes.API+XML, Draft02.MediaTypes.API+JSON,
147             MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_XML})
148     public StructuredData getAvailableStreams();
149
150
151 }