e15f4ae7169ba4570749601f466bd8f9f423a714
[ccsdk/features.git] /
1 /*\r
2  * Copyright © 2017-2018 AT&T Intellectual Property.\r
3  * \r
4  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except\r
5  * in compliance with the License. You may obtain a copy of the License at\r
6  * \r
7  * http://www.apache.org/licenses/LICENSE-2.0\r
8  * \r
9  * Unless required by applicable law or agreed to in writing, software distributed under the License\r
10  * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express\r
11  * or implied. See the License for the specific language governing permissions and limitations under\r
12  * the License.\r
13  */\r
14 \r
15 package org.onap.ccsdk.config.rest.adaptor.service;\r
16 \r
17 import org.onap.ccsdk.config.rest.adaptor.ConfigRestAdaptorException;\r
18 import org.onap.ccsdk.config.rest.adaptor.data.RestResponse;\r
19 \r
20 public interface ConfigRestAdaptorService {\r
21     \r
22     /**\r
23      * Retrieve an entity by doing a GET on the specified URL. The response is converted and stored in\r
24      * defined responseType.\r
25      * \r
26      * @param selectorName the property selector\r
27      * @param path the URI path which will append in baseURL mentioned in selector property\r
28      * @param responseType the type of the return value\r
29      */\r
30     public <T> T getResource(String selectorName, String path, Class<T> responseType) throws ConfigRestAdaptorException;\r
31     \r
32     /**\r
33      * Create a new resource by POSTing the given object to the URI template, and returns the response\r
34      * as defined responseType\r
35      * \r
36      * @param selectorName the property selector\r
37      * @param path the URI path which will append in baseURL mentioned in selector property\r
38      * @param request the Object to be POSTed, may be {@code null}\r
39      * @param responseType the type of the return value\r
40      */\r
41     public <T> T postResource(String selectorName, String path, Object request, Class<T> responseType)\r
42             throws ConfigRestAdaptorException;\r
43     \r
44     /**\r
45      * Execute the HTTP method to the given URI template, writing the given request entity to the\r
46      * request, and returns the response as defined responseType\r
47      * \r
48      * @param selectorName the property selector\r
49      * @param path the URI path which will append in baseURL mentioned in selector property\r
50      * @param request the Object to be POSTed, may be {@code null}\r
51      * @param responseType the type of the return value\r
52      * @param method the HTTP method (GET, POST, etc)\r
53      */\r
54     public <T> T exchangeResource(String selectorName, String path, Object request, Class<T> responseType,\r
55             String method) throws ConfigRestAdaptorException;\r
56     \r
57     /**\r
58      * Retrieve an entity by doing a GET on the specified URL. The response is converted and stored in\r
59      * defined responseType.\r
60      * \r
61      * @param selectorName the property selector\r
62      * @param path the URI path which will append in baseURL mentioned in selector property\r
63      */\r
64     public RestResponse getResource(String selectorName, String path) throws ConfigRestAdaptorException;\r
65     \r
66     /**\r
67      * Create a new resource by POSTing the given object to the URI template, and returns the response\r
68      * as defined responseType\r
69      * \r
70      * @param selectorName the property selector\r
71      * @param path the URI path which will append in baseURL mentioned in selector property\r
72      * @param request the Object to be POSTed, may be {@code null}\r
73      */\r
74     public RestResponse postResource(String selectorName, String path, Object request)\r
75             throws ConfigRestAdaptorException;\r
76     \r
77     /**\r
78      * Execute the HTTP method to the given URI template, writing the given request entity to the\r
79      * request, and returns the response as defined responseType\r
80      * \r
81      * @param selectorName the property selector\r
82      * @param path the URI path which will append in baseURL mentioned in selector property\r
83      * @param request the Object to be POSTed, may be {@code null}\r
84      * @param method the HTTP method (GET, POST, etc)\r
85      */\r
86     public RestResponse exchangeResource(String selectorName, String path, Object request, String method)\r
87             throws ConfigRestAdaptorException;\r
88     \r
89 }\r