KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > tc > l2 > msg > ClusterStateMessageFactory


1 /*
2  * All content copyright (c) 2003-2007 Terracotta, Inc., except as may otherwise be noted in a separate copyright
3  * notice. All rights reserved.
4  */

5 package com.tc.l2.msg;
6
7 import com.tc.l2.ha.ClusterState;
8 import com.tc.net.groups.GroupMessage;
9 import com.tc.net.protocol.transport.ConnectionID;
10
11 public class ClusterStateMessageFactory {
12
13   public static GroupMessage createNextAvailableObjectIDMessage(ClusterState state) {
14     ClusterStateMessage msg = new ClusterStateMessage(ClusterStateMessage.OBJECT_ID);
15     msg.initMessage(state);
16     return msg;
17   }
18
19   public static GroupMessage createOKResponse(ClusterStateMessage msg) {
20     ClusterStateMessage response = new ClusterStateMessage(ClusterStateMessage.OPERATION_SUCCESS, msg.getMessageID());
21     return response;
22   }
23
24   public static GroupMessage createClusterStateMessage(ClusterState state) {
25     ClusterStateMessage msg = new ClusterStateMessage(ClusterStateMessage.COMPLETE_STATE);
26     msg.initMessage(state);
27     return msg;
28   }
29
30   public static GroupMessage createNewConnectionCreatedMessage(ConnectionID connID) {
31     ClusterStateMessage msg = new ClusterStateMessage(ClusterStateMessage.NEW_CONNECTION_CREATED, connID);
32     return msg;
33   }
34
35   public static GroupMessage createConnectionDestroyedMessage(ConnectionID connID) {
36     ClusterStateMessage msg = new ClusterStateMessage(ClusterStateMessage.CONNECTION_DESTROYED, connID);
37     return msg;
38   }
39
40 }
41
Popular Tags