01: /*
02: * All content copyright (c) 2003-2007 Terracotta, Inc., except as may otherwise be noted in a separate copyright
03: * notice. All rights reserved.
04: */
05: package com.tc.l2.msg;
06:
07: import com.tc.l2.state.Enrollment;
08: import com.tc.net.groups.GroupMessage;
09:
10: public class L2StateMessageFactory {
11:
12: public static GroupMessage createElectionStartedMessage(Enrollment e) {
13: return new L2StateMessage(L2StateMessage.START_ELECTION, e);
14: }
15:
16: public static GroupMessage createElectionResultMessage(Enrollment e) {
17: return new L2StateMessage(L2StateMessage.ELECTION_RESULT, e);
18: }
19:
20: public static GroupMessage createAbortElectionMessage(
21: L2StateMessage initiatingMsg, Enrollment e) {
22: return new L2StateMessage(initiatingMsg.getMessageID(),
23: L2StateMessage.ABORT_ELECTION, e);
24: }
25:
26: public static GroupMessage createElectionStartedMessage(
27: L2StateMessage initiatingMsg, Enrollment e) {
28: return new L2StateMessage(initiatingMsg.getMessageID(),
29: L2StateMessage.START_ELECTION, e);
30: }
31:
32: public static GroupMessage createResultConflictMessage(
33: L2StateMessage initiatingMsg, Enrollment e) {
34: return new L2StateMessage(initiatingMsg.getMessageID(),
35: L2StateMessage.RESULT_CONFLICT, e);
36: }
37:
38: public static GroupMessage createResultAgreedMessage(
39: L2StateMessage initiatingMsg, Enrollment e) {
40: return new L2StateMessage(initiatingMsg.getMessageID(),
41: L2StateMessage.RESULT_AGREED, e);
42: }
43:
44: public static GroupMessage createElectionWonMessage(Enrollment e) {
45: return new L2StateMessage(L2StateMessage.ELECTION_WON, e);
46: }
47:
48: public static GroupMessage createMoveToPassiveStandbyMessage(
49: Enrollment e) {
50: return new L2StateMessage(
51: L2StateMessage.MOVE_TO_PASSIVE_STANDBY, e);
52: }
53:
54: }
|