d510ba2501cd0fccdedc7f9a88e5ebacd2c26d06
[vfc/nfvo/driver/vnfm/svnfm.git] / nokiav2 / driver / src / main / java / org / onap / vfc / nfvo / driver / vnfm / svnfm / nokia / vnfm / DriverProperties.java
1 /*
2  * Copyright 2016-2017, Nokia Corporation
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.driver.vnfm.svnfm.nokia.vnfm;
18
19 import org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.onap.core.SelfRegistrationManager;
20 import org.springframework.beans.factory.annotation.Value;
21 import org.springframework.stereotype.Component;
22
23 import java.util.Objects;
24
25 /**
26  * Wraps the properties supplied to the servlet
27  */
28 @Component
29 public class DriverProperties {
30     public static final String BASE_SUFFIX = "/" + SelfRegistrationManager.SERVICE_NAME + "/v1";
31     public static final String BASE_URL = "/api" + BASE_SUFFIX;
32     public static final String LCN_URL = "/lcn";
33
34     @Value("${cbamCatalogUrl}")
35     private String cbamCatalogUrl;
36     @Value("${cbamLcnUrl}")
37     private String cbamLcnUrl;
38     @Value("${vnfmId}")
39     private String vnfmId;
40
41     /**
42      * @return the URL on which the CBAM catalog API can be accessed (ex. https://1.2.3.4:443/api/catalog/adapter )
43      */
44     public String getCbamCatalogUrl() {
45         return cbamCatalogUrl;
46     }
47
48     /**
49      * @param cbamCatalogUrl the URL on which the CBAM catalog API can be accessed (ex. https://1.2.3.4:443/api/catalog/adapter )
50      */
51     public void setCbamCatalogUrl(String cbamCatalogUrl) {
52         this.cbamCatalogUrl = cbamCatalogUrl;
53     }
54
55     /**
56      * @return the URL on which the CBAM LCN subscription API can be accessed (ex. https://1.2.3.4:443/vnfm/lcn/v3 )
57      */
58     public String getCbamLcnUrl() {
59         return cbamLcnUrl;
60     }
61
62     /**
63      * @param cbamLcnUrl the URL on which the CBAM LCN subscription API can be accessed (ex. https://1.2.3.4:443/vnfm/lcn/v3 )
64      */
65     public void setCbamLcnUrl(String cbamLcnUrl) {
66         this.cbamLcnUrl = cbamLcnUrl;
67     }
68
69     /**
70      * @return the identifier of the VNFM
71      */
72     public String getVnfmId() {
73         return vnfmId;
74     }
75
76     /**
77      * @param vnfmId the identifier of the VNFM
78      */
79     public void setVnfmId(String vnfmId) {
80         this.vnfmId = vnfmId;
81     }
82
83     @Override
84     public String toString() {
85         return "DriverProperties{" +
86                 ", cbamCatalogUrl='" + cbamCatalogUrl + '\'' +
87                 ", cbamLcnUrl='" + cbamLcnUrl + '\'' +
88                 ", vnfmId='" + vnfmId + '\'' +
89                 '}';
90     }
91
92     @Override
93     //generated code. This is the recommended way to formulate equals
94     @SuppressWarnings({"squid:S00122", "squid:S1067"})
95     public boolean equals(Object o) {
96         if (this == o) return true;
97         if (o == null || getClass() != o.getClass()) return false;
98         DriverProperties that = (DriverProperties) o;
99         return Objects.equals(cbamCatalogUrl, that.cbamCatalogUrl) &&
100                 Objects.equals(cbamLcnUrl, that.cbamLcnUrl) &&
101                 Objects.equals(vnfmId, that.vnfmId);
102     }
103
104     @Override
105     public int hashCode() {
106         return Objects.hash(cbamCatalogUrl, cbamLcnUrl, vnfmId);
107     }
108 }