Fix for radio buttons
[sdc.git] / common-app-api / src / main / java / org / openecomp / sdc / common / rest / api / IRestClient.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * SDC
4  * ================================================================================
5  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6  * ================================================================================
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  * 
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  * 
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  * ============LICENSE_END=========================================================
19  */
20
21 package org.openecomp.sdc.common.rest.api;
22
23 import java.util.Properties;
24
25 /**
26  * This interface describe the methods of the REST generic client. Each method
27  * will receive the destination URI and specific list of headers. With this
28  * information the REST Client will create a request to the specific REST Web
29  * server. Error from the REST Web server will be return by proprietary
30  * exception object.
31  * 
32  * @author esofer
33  *
34  */
35 public interface IRestClient {
36
37         /**
38          * This method will return resource according to the given URI.
39          * 
40          * @param uri
41          *            Full URL path to the desire resource.
42          * @param headers
43          *            - list of headers in format of name and value, to be add as
44          *            part of the HTTP request.
45          * @return JSON representation of the requested resource.
46          */
47         public RestResponse doGET(String uri, Properties headers);
48
49         /**
50          * This method will CREATE resource according to the given URI.
51          * 
52          * @param uri
53          *            Full URL path to the desire resource.
54          * @param headers
55          *            - list of headers in format of name and value, to be add as
56          *            part of the HTTP request.
57          * @param objectToCreate
58          *            - JSON representation of the resource.
59          */
60         public RestResponse doPOST(String uri, Properties headers, Object objectToCreate);
61
62         /**
63          * This method will UPDATE resource according to the given URI.
64          * 
65          * @param uri
66          *            Full URL path to the desire resource.
67          * @param headers
68          *            - list of headers in format of name and value, to be add as
69          *            part of the HTTP request.
70          * @param objectToUpdate
71          *            - JSON representation of the resource.
72          */
73         public RestResponse doPUT(String uri, Properties headers, Object objectToUpdate);
74
75         /**
76          * This method will return resource according to the given URI.
77          * 
78          * @param uri
79          *            Full URL path to the desire resource.
80          * @param headers
81          *            - list of headers in format of name and value, to be add as
82          *            part of the HTTP request.
83          * 
84          */
85         public RestResponse doDELETE(String uri, Properties headers);
86
87         /**
88          * initialize the rest client instance. The timeout is infinite.
89          */
90         public boolean init() throws Exception;
91
92         /**
93          * initialize the rest client instance with a given timeout in milliseconds.
94          * 
95          * @param restConfigurationInfo
96          */
97         public boolean init(RestConfigurationInfo restConfigurationInfo);
98
99         /**
100          * destroy the connections
101          */
102         public void destroy();
103 }