Update URL according to microservice name
[vfc/nfvo/driver/vnfm/svnfm.git] / huawei / vnfmadapter / VnfmadapterService / service / src / main / java / org / openo / nfvo / vnfmadapter / 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.openo.nfvo.vnfmadapter.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  * HTTP Restful helper.
27  * .</br>
28  *
29  * @author
30  * @version     NFVO 0.5  Sep 10, 2016
31  */
32 public class HttpRestfulHelp {
33
34     public static final String PROTO_HTTPS = "https";
35
36     public static final String PROTO_HTTP = "http";
37
38     private static final Map<String, Restful> INSTANCES = new HashMap<>(2);
39
40     private HttpRestfulHelp() {
41         // constructor
42     }
43
44     /**
45      * Factory method to create Restful instances.
46      * <br>
47      *
48      * @param ssloptionfile
49      * @param restoptionfile
50      * @return
51      * @since  NFVO 0.5
52      */
53     public static synchronized Restful getRestInstance(String ssloptionfile, String restoptionfile) {
54         Restful rest = INSTANCES.get(PROTO_HTTP);
55         if(rest != null) {
56             return rest;
57         }
58         rest = createHttpsRest(ssloptionfile, restoptionfile);
59         INSTANCES.put(PROTO_HTTP, rest);
60         return rest;
61     }
62
63     private static Restful createHttpsRest(String ssloptionfile, String restoptionfile) { //NOSONAR
64         return new HttpRest();
65     }
66
67 }