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, RundeckNodeIdentity {
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      @Override
67      public String getName() {
68          return name;
69      }
70  
71      public void setName(String name) {
72          this.name = name;
73      }
74  
75      public String getType() {
76          return type;
77      }
78  
79      public void setType(String type) {
80          this.type = type;
81      }
82  
83      public String getDescription() {
84          return description;
85      }
86  
87      public void setDescription(String description) {
88          this.description = description;
89      }
90  
91      public List<String> getTags() {
92          return tags;
93      }
94  
95      public void setTags(List<String> tags) {
96          this.tags = tags;
97      }
98  
99      public String getHostname() {
100         return hostname;
101     }
102 
103     public void setHostname(String hostname) {
104         this.hostname = hostname;
105     }
106 
107     public String getOsArch() {
108         return osArch;
109     }
110 
111     public void setOsArch(String osArch) {
112         this.osArch = osArch;
113     }
114 
115     public String getOsFamily() {
116         return osFamily;
117     }
118 
119     public void setOsFamily(String osFamily) {
120         this.osFamily = osFamily;
121     }
122 
123     public String getOsName() {
124         return osName;
125     }
126 
127     public void setOsName(String osName) {
128         this.osName = osName;
129     }
130 
131     public String getOsVersion() {
132         return osVersion;
133     }
134 
135     public void setOsVersion(String osVersion) {
136         this.osVersion = osVersion;
137     }
138 
139     public String getUsername() {
140         return username;
141     }
142 
143     public void setUsername(String username) {
144         this.username = username;
145     }
146 
147     public String getEditUrl() {
148         return editUrl;
149     }
150 
151     public void setEditUrl(String editUrl) {
152         this.editUrl = editUrl;
153     }
154 
155     public String getRemoteUrl() {
156         return remoteUrl;
157     }
158 
159     public void setRemoteUrl(String remoteUrl) {
160         this.remoteUrl = remoteUrl;
161     }
162 
163     @Override
164     public String toString() {
165         return "RundeckNode [name=" + name + ", hostname=" + hostname + ", description=" + description + ", tags="
166                + tags + ", type=" + type + ", username=" + username + ", osArch=" + osArch + ", osFamily=" + osFamily
167                + ", osName=" + osName + ", osVersion=" + osVersion + ", editUrl=" + editUrl + ", remoteUrl="
168                + remoteUrl + "]";
169     }
170 
171     @Override
172     public int hashCode() {
173         final int prime = 31;
174         int result = 1;
175         result = prime * result + ((description == null) ? 0 : description.hashCode());
176         result = prime * result + ((editUrl == null) ? 0 : editUrl.hashCode());
177         result = prime * result + ((hostname == null) ? 0 : hostname.hashCode());
178         result = prime * result + ((name == null) ? 0 : name.hashCode());
179         result = prime * result + ((osArch == null) ? 0 : osArch.hashCode());
180         result = prime * result + ((osFamily == null) ? 0 : osFamily.hashCode());
181         result = prime * result + ((osName == null) ? 0 : osName.hashCode());
182         result = prime * result + ((osVersion == null) ? 0 : osVersion.hashCode());
183         result = prime * result + ((remoteUrl == null) ? 0 : remoteUrl.hashCode());
184         result = prime * result + ((tags == null) ? 0 : tags.hashCode());
185         result = prime * result + ((type == null) ? 0 : type.hashCode());
186         result = prime * result + ((username == null) ? 0 : username.hashCode());
187         return result;
188     }
189 
190     @Override
191     public boolean equals(Object obj) {
192         if (this == obj)
193             return true;
194         if (obj == null)
195             return false;
196         if (getClass() != obj.getClass())
197             return false;
198         RundeckNode other = (RundeckNode) obj;
199         if (description == null) {
200             if (other.description != null)
201                 return false;
202         } else if (!description.equals(other.description))
203             return false;
204         if (editUrl == null) {
205             if (other.editUrl != null)
206                 return false;
207         } else if (!editUrl.equals(other.editUrl))
208             return false;
209         if (hostname == null) {
210             if (other.hostname != null)
211                 return false;
212         } else if (!hostname.equals(other.hostname))
213             return false;
214         if (name == null) {
215             if (other.name != null)
216                 return false;
217         } else if (!name.equals(other.name))
218             return false;
219         if (osArch == null) {
220             if (other.osArch != null)
221                 return false;
222         } else if (!osArch.equals(other.osArch))
223             return false;
224         if (osFamily == null) {
225             if (other.osFamily != null)
226                 return false;
227         } else if (!osFamily.equals(other.osFamily))
228             return false;
229         if (osName == null) {
230             if (other.osName != null)
231                 return false;
232         } else if (!osName.equals(other.osName))
233             return false;
234         if (osVersion == null) {
235             if (other.osVersion != null)
236                 return false;
237         } else if (!osVersion.equals(other.osVersion))
238             return false;
239         if (remoteUrl == null) {
240             if (other.remoteUrl != null)
241                 return false;
242         } else if (!remoteUrl.equals(other.remoteUrl))
243             return false;
244         if (tags == null) {
245             if (other.tags != null)
246                 return false;
247         } else if (!tags.equals(other.tags))
248             return false;
249         if (type == null) {
250             if (other.type != null)
251                 return false;
252         } else if (!type.equals(other.type))
253             return false;
254         if (username == null) {
255             if (other.username != null)
256                 return false;
257         } else if (!username.equals(other.username))
258             return false;
259         return true;
260     }
261 
262 }