45d09eda6f0e43257cf6a3098669d83e59bebb11
[vfc/nfvo/driver/vnfm/svnfm.git] /
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 package org.onap.vfc.nfvo.vnfm.svnfm.vnfmadapter.service.csm.api;
17
18 import org.onap.vfc.nfvo.vnfm.svnfm.vnfmadapter.service.constant.Constant;
19
20 /**
21  * Connection Information
22  * .</br>
23  *
24  * @author
25  * @version     NFVO 0.5  Sep 14, 2016
26  */
27 public class ConnectInfo {
28
29     private String url;
30
31     private String userName;
32
33     private String userPwd;
34
35     private String authenticateMode;
36
37     /**
38      *
39      * Constructor<br>
40      *
41      * @param url
42      * @since  NFVO 0.5
43      */
44     public ConnectInfo(String url) {
45         this.url = url == null ? "" : url;
46         this.authenticateMode = Constant.ANONYMOUS;
47     }
48
49     /**
50      *
51      * Constructor<br>
52      *
53      * @param url
54      * @param userName
55      * @param userPwd
56      * @param authenticateMode
57      * @since  NFVO 0.5
58      */
59     public ConnectInfo(String url, String userName, String userPwd, String authenticateMode) {
60         this.url = url == null ? "" : url;
61         this.userName = userName == null ? "" : userName;
62         this.userPwd = userPwd == null ? "" : userPwd;
63         this.authenticateMode = authenticateMode == null ? "" : authenticateMode;
64     }
65
66     public String getUrl() {
67         return this.url;
68     }
69
70     public void setUrl(String vnfUrl) {
71         this.url = vnfUrl;
72     }
73
74     public String getUserName() {
75         return this.userName;
76     }
77
78     public void setUserName(String vnfUserName) {
79         this.userName = vnfUserName;
80     }
81
82     public String getUserPwd() {
83         return this.userPwd;
84     }
85
86     public void setUserPwd(String vnfUserPwd) {
87         this.userPwd = vnfUserPwd;
88     }
89
90     public String getAuthenticateMode() {
91         return this.authenticateMode;
92     }
93
94     public void setAuthenticateMode(String vnfAuthenticateMode) {
95         this.authenticateMode = vnfAuthenticateMode;
96     }
97
98     @Override
99     public String toString() {
100         return "ConnectInfo [AuthenticateMode: " + authenticateMode + ",url=" + url + ", userName=" + userName + ']';
101     }
102
103     @Override
104     public int hashCode() {
105         final int prime = 31;
106         int result = 1;
107         result = prime * result + ((url == null) ? 0 : url.hashCode());
108         return result;
109     }
110
111     @Override
112     public boolean equals(Object obj) {
113         if(this == obj) {
114             return true;
115         }
116         if(obj == null) {
117             return false;
118         }
119
120         if(!(obj instanceof ConnectInfo)) {
121             return false;
122         }
123
124         if(getClass() != obj.getClass()) {
125             return false;
126         }
127         ConnectInfo other = (ConnectInfo)obj;
128         if(url == null) {
129             if(other.url != null) {
130                 return false;
131             }
132         } else if(!url.equals(other.url)) {
133             return false;
134         }
135         return true;
136     }
137 }