2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
21 package org.onap.so.cloud;
23 import java.security.GeneralSecurityException;
24 import java.util.Comparator;
26 import org.onap.so.logger.MessageEnum;
27 import org.onap.so.logger.MsoLogger;
28 import org.onap.so.utils.CryptoUtils;
30 import com.fasterxml.jackson.annotation.JsonProperty;
31 import com.openpojo.business.annotation.BusinessKey;
32 import org.apache.commons.lang3.builder.ToStringBuilder;
33 import org.apache.commons.lang3.builder.ToStringStyle;
34 import org.apache.commons.lang3.builder.HashCodeBuilder;
35 import org.apache.commons.lang3.builder.EqualsBuilder;
38 * JavaBean JSON class for a Cloudify Manager. This bean represents a Cloudify
39 * node through which TOSCA-based VNFs may be deployed. Each CloudSite in the
40 * CloudConfig may have a Cloudify Manager for deployments using TOSCA blueprints.
41 * Cloudify Managers may support multiple Cloud Sites, but each site will have
42 * at most one Cloudify Manager.
44 * This does not replace the ability to use the CloudSite directly via Openstack.
46 * Note that this is only used to access Cloud Configurations loaded from a
47 * JSON config file, so there are no explicit setters.
51 public class CloudifyManager {
53 private static MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA, CloudifyManager.class);
60 @JsonProperty ("cloudify_url")
61 private String cloudifyUrl;
64 @JsonProperty("username")
65 private String username;
68 @JsonProperty("password")
69 private String password;
72 @JsonProperty("version")
73 private String version;
75 public CloudifyManager() {}
77 public String getId() {
80 public void setId(String id) {
84 public String getCloudifyUrl() {
88 public void setCloudifyUrl(String cloudifyUrl) {
89 this.cloudifyUrl = cloudifyUrl;
92 public String getUsername() {
96 public void setUsername(String username) {
97 this.username = username;
100 public String getPassword() {
104 public void setPassword(String password) {
105 this.password = password;
108 public String getVersion() {
112 public void setVersion(String version) {
113 this.version = version;
117 public CloudifyManager clone() {
118 CloudifyManager cloudifyManagerCopy = new CloudifyManager();
119 cloudifyManagerCopy.id = this.id;
120 cloudifyManagerCopy.cloudifyUrl = this.cloudifyUrl;
121 cloudifyManagerCopy.username = this.username;
122 cloudifyManagerCopy.password = this.password;
123 cloudifyManagerCopy.version = this.version;
124 return cloudifyManagerCopy;
128 public String toString() {
129 return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE).append("id", getId())
130 .append("cloudifyUrl", getCloudifyUrl()).append("username", getUsername())
131 .append("password", getPassword()).append("version", getVersion()).toString();
135 public boolean equals(final Object other) {
139 if (!getClass().equals(other.getClass())) {
142 CloudifyManager castOther = (CloudifyManager) other;
143 return new EqualsBuilder().append(getId(), castOther.getId())
144 .append(getCloudifyUrl(), castOther.getCloudifyUrl()).append(getUsername(), castOther.getUsername())
145 .append(getPassword(), castOther.getPassword()).append(getVersion(), castOther.getVersion()).isEquals();
149 public int hashCode() {
150 return new HashCodeBuilder(1, 31).append(getId()).append(getCloudifyUrl()).append(getUsername())
151 .append(getPassword()).append(getVersion()).toHashCode();