1 /**
2 *
3 * Copyright (C) 2011 Cloud Conscious, LLC. <info@cloudconscious.com>
4 *
5 * ====================================================================
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 * ====================================================================
18 */
19 package org.jclouds.cloudsigma.domain;
20
21 import javax.annotation.Nullable;
22
23 /**
24 *
25 * @author Adrian Cole
26 */
27 public class VNC {
28 @Nullable
29 private final String ip;
30 @Nullable
31 private final String password;
32 private final boolean tls;
33
34 public VNC(String ip, String password, boolean tls) {
35 this.ip = ip;
36 this.password = password;
37 this.tls = tls;
38 }
39
40 /**
41 *
42 * @return IP address for overlay VNC access on port 5900. Set to 'auto', to reuse nic:0:dhcp if
43 * available, or otherwise allocate a temporary IP at boot.
44 */
45 public String getIp() {
46 return ip;
47 }
48
49 /**
50 *
51 * @return Password for VNC access. If unset, VNC is disabled.
52 */
53 public String getPassword() {
54 return password;
55 }
56
57 /**
58 *
59 * @return Set to 'on' to require VeNCrypt-style TLS auth in addition to the password. If this is
60 * unset, only unencrypted VNC is available.
61 */
62 public boolean isTls() {
63 return tls;
64 }
65
66 @Override
67 public int hashCode() {
68 final int prime = 31;
69 int result = 1;
70 result = prime * result + ((ip == null) ? 0 : ip.hashCode());
71 result = prime * result + ((password == null) ? 0 : password.hashCode());
72 result = prime * result + (tls ? 1231 : 1237);
73 return result;
74 }
75
76 @Override
77 public boolean equals(Object obj) {
78 if (this == obj)
79 return true;
80 if (obj == null)
81 return false;
82 if (getClass() != obj.getClass())
83 return false;
84 VNC other = (VNC) obj;
85 if (ip == null) {
86 if (other.ip != null)
87 return false;
88 } else if (!ip.equals(other.ip))
89 return false;
90 if (password == null) {
91 if (other.password != null)
92 return false;
93 } else if (!password.equals(other.password))
94 return false;
95 if (tls != other.tls)
96 return false;
97 return true;
98 }
99
100 @Override
101 public String toString() {
102 return "[ip=" + ip + ", password=" + password + ", tls=" + tls + "]";
103 }
104 }