Update gvnfm-driver .gitreview file
[vfc/nfvo/driver/vnfm/gvnfm.git] / juju / juju-vnfmadapter / Juju-vnfmadapterService / service / src / main / java / org / onap / vfc / nfvo / vnfm / gvnfm / jujuvnfmadapter / common / servicetoken / HttpRestfulHelp.java
1 /*
2  * Copyright 2016 Huawei Technologies Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 package org.onap.vfc.nfvo.vnfm.gvnfm.jujuvnfmadapter.common.servicetoken;
18
19 import java.util.HashMap;
20 import java.util.Map;
21
22 import org.openo.baseservice.roa.util.restclient.HttpRest;
23 import org.openo.baseservice.roa.util.restclient.Restful;
24
25 /**
26  * 
27  * Http restful help class.<br>
28  * <p>
29  * </p>
30  * 
31  * @author
32  * @version     NFVO 0.5  Sep 12, 2016
33  */
34 public class HttpRestfulHelp {
35
36     public static final String PROTO_HTTPS = "https";
37
38     public static final String PROTO_HTTP = "http";
39
40     private static final Map<String, Restful> INSTANCES = new HashMap<>(2);
41
42     private HttpRestfulHelp() {
43         // constructor
44     }
45
46     /**
47      * 
48      * Get rest instance.<br>
49      * 
50      * @param ssloptionfile
51      * @param restoptionfile
52      * @return
53      * @since  NFVO 0.5
54      */
55     public static synchronized Restful getRestInstance(String ssloptionfile, String restoptionfile) {
56         Restful rest = INSTANCES.get(PROTO_HTTP);
57         if(rest != null) {
58             return rest;
59         }
60         rest = createHttpsRest(ssloptionfile, restoptionfile);
61         INSTANCES.put(PROTO_HTTP, rest);
62         return rest;
63     }
64
65     private static Restful createHttpsRest(String ssloptionfile, String restoptionfile) {
66         return new HttpRest();
67     }
68
69 }