View Javadoc

1   /*
2    * Copyright 2011 Vincent Behar
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.rundeck.api.domain;
17  
18  import java.io.Serializable;
19  import java.util.List;
20  
21  /**
22   * Represents a RunDeck node (server on which RunDeck can execute jobs and commands)
23   * 
24   * @author Vincent Behar
25   */
26  public class RundeckNode implements Serializable {
27  
28      private static final long serialVersionUID = 1L;
29  
30      /** The node name. This is a logical identifier from the node. (required) */
31      private String name;
32  
33      /** The node type, such as "Node". (required) */
34      private String type;
35  
36      /** A brief description about the node. (optional) */
37      private String description;
38  
39      /** List of filtering tags. (optional) */
40      private List<String> tags;
41  
42      /** The hostname or IP address of the remote host. (required) */
43      private String hostname;
44  
45      /** The operating system architecture. (optional) */
46      private String osArch;
47  
48      /** The operating system family, such as unix or windows. (optional) */
49      private String osFamily;
50  
51      /** The operating system name such as Linux or Mac OS X. (optional) */
52      private String osName;
53  
54      /** The operating system version. (optional) */
55      private String osVersion;
56  
57      /** The username used for the remote connection. (required) */
58      private String username;
59  
60      /** URL to an external resource model editor service (optional) */
61      private String editUrl;
62  
63      /** URL to an external resource model service. (optional) */
64      private String remoteUrl;
65  
66      public String getName() {
67          return name;
68      }
69  
70      public void setName(String name) {
71          this.name = name;
72      }
73  
74      public String getType() {
75          return type;
76      }
77  
78      public void setType(String type) {
79          this.type = type;
80      }
81  
82      public String getDescription() {
83          return description;
84      }
85  
86      public void setDescription(String description) {
87          this.description = description;
88      }
89  
90      public List<String> getTags() {
91          return tags;
92      }
93  
94      public void setTags(List<String> tags) {
95          this.tags = tags;
96      }
97  
98      public String getHostname() {
99          return hostname;
100     }
101 
102     public void setHostname(String hostname) {
103         this.hostname = hostname;
104     }
105 
106     public String getOsArch() {
107         return osArch;
108     }
109 
110     public void setOsArch(String osArch) {
111         this.osArch = osArch;
112     }
113 
114     public String getOsFamily() {
115         return osFamily;
116     }
117 
118     public void setOsFamily(String osFamily) {
119         this.osFamily = osFamily;
120     }
121 
122     public String getOsName() {
123         return osName;
124     }
125 
126     public void setOsName(String osName) {
127         this.osName = osName;
128     }
129 
130     public String getOsVersion() {
131         return osVersion;
132     }
133 
134     public void setOsVersion(String osVersion) {
135         this.osVersion = osVersion;
136     }
137 
138     public String getUsername() {
139         return username;
140     }
141 
142     public void setUsername(String username) {
143         this.username = username;
144     }
145 
146     public String getEditUrl() {
147         return editUrl;
148     }
149 
150     public void setEditUrl(String editUrl) {
151         this.editUrl = editUrl;
152     }
153 
154     public String getRemoteUrl() {
155         return remoteUrl;
156     }
157 
158     public void setRemoteUrl(String remoteUrl) {
159         this.remoteUrl = remoteUrl;
160     }
161 
162     @Override
163     public String toString() {
164         return "RundeckNode [name=" + name + ", hostname=" + hostname + ", description=" + description + ", tags="
165                + tags + ", type=" + type + ", username=" + username + ", osArch=" + osArch + ", osFamily=" + osFamily
166                + ", osName=" + osName + ", osVersion=" + osVersion + ", editUrl=" + editUrl + ", remoteUrl="
167                + remoteUrl + "]";
168     }
169 
170     @Override
171     public int hashCode() {
172         final int prime = 31;
173         int result = 1;
174         result = prime * result + ((description == null) ? 0 : description.hashCode());
175         result = prime * result + ((editUrl == null) ? 0 : editUrl.hashCode());
176         result = prime * result + ((hostname == null) ? 0 : hostname.hashCode());
177         result = prime * result + ((name == null) ? 0 : name.hashCode());
178         result = prime * result + ((osArch == null) ? 0 : osArch.hashCode());
179         result = prime * result + ((osFamily == null) ? 0 : osFamily.hashCode());
180         result = prime * result + ((osName == null) ? 0 : osName.hashCode());
181         result = prime * result + ((osVersion == null) ? 0 : osVersion.hashCode());
182         result = prime * result + ((remoteUrl == null) ? 0 : remoteUrl.hashCode());
183         result = prime * result + ((tags == null) ? 0 : tags.hashCode());
184         result = prime * result + ((type == null) ? 0 : type.hashCode());
185         result = prime * result + ((username == null) ? 0 : username.hashCode());
186         return result;
187     }
188 
189     @Override
190     public boolean equals(Object obj) {
191         if (this == obj)
192             return true;
193         if (obj == null)
194             return false;
195         if (getClass() != obj.getClass())
196             return false;
197         RundeckNode other = (RundeckNode) obj;
198         if (description == null) {
199             if (other.description != null)
200                 return false;
201         } else if (!description.equals(other.description))
202             return false;
203         if (editUrl == null) {
204             if (other.editUrl != null)
205                 return false;
206         } else if (!editUrl.equals(other.editUrl))
207             return false;
208         if (hostname == null) {
209             if (other.hostname != null)
210                 return false;
211         } else if (!hostname.equals(other.hostname))
212             return false;
213         if (name == null) {
214             if (other.name != null)
215                 return false;
216         } else if (!name.equals(other.name))
217             return false;
218         if (osArch == null) {
219             if (other.osArch != null)
220                 return false;
221         } else if (!osArch.equals(other.osArch))
222             return false;
223         if (osFamily == null) {
224             if (other.osFamily != null)
225                 return false;
226         } else if (!osFamily.equals(other.osFamily))
227             return false;
228         if (osName == null) {
229             if (other.osName != null)
230                 return false;
231         } else if (!osName.equals(other.osName))
232             return false;
233         if (osVersion == null) {
234             if (other.osVersion != null)
235                 return false;
236         } else if (!osVersion.equals(other.osVersion))
237             return false;
238         if (remoteUrl == null) {
239             if (other.remoteUrl != null)
240                 return false;
241         } else if (!remoteUrl.equals(other.remoteUrl))
242             return false;
243         if (tags == null) {
244             if (other.tags != null)
245                 return false;
246         } else if (!tags.equals(other.tags))
247             return false;
248         if (type == null) {
249             if (other.type != null)
250                 return false;
251         } else if (!type.equals(other.type))
252             return false;
253         if (username == null) {
254             if (other.username != null)
255                 return false;
256         } else if (!username.equals(other.username))
257             return false;
258         return true;
259     }
260 
261 }