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 java.io.Serializable;
18  
19  import java.util.Arrays;
20  import java.util.List;
21  
22  /**
23   * <a href="ClusterEvent.java.html"><b><i>View Source</i></b></a>
24   *
25   * @author Tina Tian
26   */
27  public class ClusterEvent implements Serializable {
28  
29      public static ClusterEvent depart(ClusterNode... clusterNodes) {
30          return new ClusterEvent(
31              ClusterEventType.DEPART, Arrays.asList(clusterNodes));
32      }
33  
34      public static ClusterEvent depart(List<ClusterNode> clusterNodes) {
35          return new ClusterEvent(ClusterEventType.DEPART, clusterNodes);
36      }
37  
38      public static ClusterEvent join(ClusterNode... clusterNodes) {
39          return new ClusterEvent(
40              ClusterEventType.JOIN, Arrays.asList(clusterNodes));
41      }
42  
43      public static ClusterEvent join(List<ClusterNode> clusterNodes) {
44          return new ClusterEvent(ClusterEventType.JOIN, clusterNodes);
45      }
46  
47      public ClusterEvent(ClusterEventType clusterEventType) {
48          _clusterEventType = clusterEventType;
49      }
50  
51      public ClusterEvent(
52          ClusterEventType clusterEventType, List<ClusterNode> clusterNodes) {
53  
54          _clusterEventType = clusterEventType;
55          _clusterNodes = clusterNodes;
56      }
57  
58      public ClusterEventType getClusterEventType() {
59          return _clusterEventType;
60      }
61  
62      public List<ClusterNode> getClusterNodes() {
63          return _clusterNodes;
64      }
65  
66      public void setClusterNodes(List<ClusterNode> clusterNodes) {
67          _clusterNodes = clusterNodes;
68      }
69  
70      private ClusterEventType _clusterEventType;
71      private List<ClusterNode> _clusterNodes;
72  
73  }