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  
19  import java.io.Serializable;
20  
21  /**
22   * <a href="ClusterNodeResponse.java.html"><b><i>View Source</i></b></a>
23   *
24   * @author Tina Tian
25   */
26  public class ClusterNodeResponse implements Serializable {
27  
28      public ClusterMessageType getClusterMessageType() {
29          return _clusterMessageType;
30      }
31  
32      public ClusterNode getClusterNode() {
33          return _clusterNode;
34      }
35  
36      public Exception getException() {
37          return _exception;
38      }
39  
40      public Object getResult() throws Exception {
41          if (_exception != null) {
42              throw _exception;
43          }
44  
45          return _result;
46      }
47  
48      public String getUuid() {
49          return _uuid;
50      }
51  
52      public boolean hasException() {
53          if (_exception != null) {
54              return true;
55          }
56          else {
57              return false;
58          }
59      }
60  
61      public boolean isMulticast() {
62          return _multicast;
63      }
64  
65      public void setClusterMessageType(ClusterMessageType clusterMessageType) {
66          _clusterMessageType = clusterMessageType;
67      }
68  
69      public void setClusterNode(ClusterNode clusterNode) {
70          _clusterNode = clusterNode;
71      }
72  
73      public void setException(Exception exception) {
74          _exception = exception;
75      }
76  
77      public void setMulticast(boolean multicast) {
78          _multicast = multicast;
79      }
80  
81      public void setResult(Object result) {
82          _result = result;
83      }
84  
85      public void setUuid(String uuid) {
86          _uuid = uuid;
87      }
88  
89      public String toString() {
90          StringBundler sb = new StringBundler(9);
91  
92          sb.append("{clusterMessageType=");
93          sb.append(_clusterMessageType);
94          sb.append(", multicast=");
95          sb.append(_multicast);
96          sb.append(", uuid=");
97          sb.append(_uuid);
98  
99          if (_clusterMessageType.equals(ClusterMessageType.NOTIFY) ||
100             _clusterMessageType.equals(ClusterMessageType.UPDATE)) {
101 
102             sb.append(", clusterNode=");
103             sb.append(_clusterNode);
104         }
105         else {
106             if (hasException()) {
107                 sb.append(", exception=");
108                 sb.append(_exception);
109             }
110             else {
111                 sb.append(", result=");
112                 sb.append(_result);
113             }
114         }
115 
116         sb.append("}");
117 
118         return sb.toString();
119     }
120 
121     private ClusterMessageType _clusterMessageType;
122     private ClusterNode _clusterNode;
123     private Exception _exception;
124     private boolean _multicast;
125     private Object _result;
126     private String _uuid;
127 
128 }