1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * The contents of this file are subject to the terms of the Liferay Enterprise
5    * Subscription License ("License"). You may not use this file except in
6    * compliance with the License. You can obtain a copy of the License by
7    * contacting Liferay, Inc. See the License for the specific language governing
8    * permissions and limitations under the License, including but not limited to
9    * distribution rights of the Software.
10   *
11   *
12   *
13   */
14  
15  package com.liferay.portal.kernel.cluster;
16  
17  import com.liferay.portal.kernel.util.StringBundler;
18  import com.liferay.portal.kernel.util.Validator;
19  
20  import java.io.Serializable;
21  
22  import java.net.InetAddress;
23  
24  /**
25   * <a href="ClusterNode.java.html"><b><i>View Source</i></b></a>
26   *
27   * @author Tina Tian
28   */
29  public class ClusterNode implements Serializable {
30  
31      public ClusterNode(String clusterNodeId) {
32          _clusterNodeId = clusterNodeId;
33      }
34  
35      public boolean equals(Object obj) {
36          if (this == obj) {
37              return true;
38          }
39  
40          if (!(obj instanceof ClusterNode)) {
41              return false;
42          }
43  
44          ClusterNode clusterNode = (ClusterNode)obj;
45  
46          if (Validator.equals(_clusterNodeId, clusterNode._clusterNodeId)) {
47              return true;
48          }
49  
50          return false;
51      }
52  
53      public String getClusterNodeId() {
54          return _clusterNodeId;
55      }
56  
57      public String getHostName() {
58          return _hostName;
59      }
60  
61      public InetAddress getInetAddress() {
62          return _inetAddress;
63      }
64  
65      public int getPort() {
66          return _port;
67      }
68  
69      public int hashCode() {
70          return _clusterNodeId.hashCode();
71      }
72  
73      public void setHostName(String hostName) {
74          _hostName = hostName;
75      }
76  
77      public void setInetAddress(InetAddress inetAddress) {
78          _inetAddress = inetAddress;
79      }
80  
81      public void setPort(int port) {
82          _port = port;
83      }
84  
85      public String toString() {
86          StringBundler sb = new StringBundler(9);
87  
88          sb.append("{clusterNodeId=");
89          sb.append(_clusterNodeId);
90          sb.append(", hostName=");
91          sb.append(_hostName);
92          sb.append(", inetAddress=");
93          sb.append(_inetAddress);
94          sb.append(", port=");
95          sb.append(_port);
96          sb.append("}");
97  
98          return sb.toString();
99      }
100 
101     private String _clusterNodeId;
102     private String _hostName;
103     private InetAddress _inetAddress;
104     private int _port;
105 
106 }