2 * Copyright 2016 Huawei Technologies Co., Ltd.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 package org.onap.vfc.nfvo.vnfm.gvnfm.jujuvnfmadapter.service.entity;
19 import java.util.List;
21 import net.sf.json.JSONObject;
23 import org.apache.commons.lang3.builder.ToStringBuilder;
24 import org.apache.commons.lang3.builder.ToStringStyle;
28 * Juju Driver Class.<br>
33 * @version NFVO 0.5 Sep 10, 2016
35 public class JujuDriver {
37 private String serviceName;
39 private String protocol;
41 private String version;
43 private String visualRange;
55 private String status;
57 public static final String NOTES = "notes";
60 // Default Constructor
69 * @param jujuJsonObject
72 public JujuDriver(JSONObject jujuJsonObject) {
73 this.serviceName = jujuJsonObject.getString("serviceName");
74 this.protocol = jujuJsonObject.getString("protocol");
75 this.version = jujuJsonObject.getString("version");
76 this.visualRange = jujuJsonObject.getString("visualRange");
77 this.url = jujuJsonObject.getString("url");
78 this.nodes = jujuJsonObject.getJSONArray("nodes");
79 this.ip = jujuJsonObject.getJSONArray(NOTES).getString(0);
80 this.port = jujuJsonObject.getJSONArray(NOTES).getString(1);
81 this.ttl = jujuJsonObject.getJSONArray(NOTES).getString(2);
82 this.status = jujuJsonObject.getString("status");
85 public String getServiceName() {
89 public void setServiceName(String serviceName) {
90 this.serviceName = serviceName;
93 public String getVisualRange() {
97 public void setVisualRange(String visualRange) {
98 this.visualRange = visualRange;
101 public String getProtocol() {
105 public void setProtocol(String protocol) {
106 this.protocol = protocol;
109 public String getVersion() {
113 public void setVersion(String version) {
114 this.version = version;
117 public List getNodes() {
121 public void setNodes(List nodes) {
125 public String getUrl() {
129 public void setUrl(String url) {
133 public String getIP() {
137 public void setIP(String ip) {
141 public String getPort() {
145 public void setPort(String port) {
149 public String getTtl() {
153 public void setTtl(String ttl) {
157 public String getStatus() {
161 public void setStatus(String status) {
162 this.status = status;
166 public String toString() {
167 return ToStringBuilder.reflectionToString(this, ToStringStyle.SHORT_PREFIX_STYLE);
171 public int hashCode() {
172 final int prime = 31;
174 result = prime * result + ((serviceName == null) ? 0 : serviceName.hashCode());
179 public boolean equals(Object obj) {
186 if(!(obj instanceof JujuDriver)) {
189 if(getClass() != obj.getClass()) {
192 JujuDriver other = (JujuDriver)obj;
193 if(serviceName == null) {
194 if(other.serviceName != null) {
197 } else if(!serviceName.equals(other.serviceName)) {