KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > tc > object > msg > TestClientHandshakeMessage


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

5 package com.tc.object.msg;
6
7 import com.tc.exception.ImplementMe;
8 import com.tc.net.protocol.tcm.ChannelID;
9 import com.tc.net.protocol.tcm.MessageChannel;
10 import com.tc.net.protocol.tcm.TCMessageType;
11 import com.tc.net.protocol.tcm.TestMessageChannel;
12 import com.tc.object.ObjectID;
13 import com.tc.object.lockmanager.api.LockContext;
14 import com.tc.object.lockmanager.api.WaitContext;
15 import com.tc.util.concurrent.NoExceptionLinkedQueue;
16
17 import java.util.ArrayList JavaDoc;
18 import java.util.Collection JavaDoc;
19 import java.util.HashSet JavaDoc;
20 import java.util.List JavaDoc;
21 import java.util.Set JavaDoc;
22
23 public class TestClientHandshakeMessage implements ClientHandshakeMessage {
24   public Set JavaDoc clientObjectIds = new HashSet JavaDoc();
25   public Set JavaDoc waitContexts = new HashSet JavaDoc();
26   public NoExceptionLinkedQueue sendCalls = new NoExceptionLinkedQueue();
27   public ChannelID channelID;
28   public List JavaDoc lockContexts = new ArrayList JavaDoc();
29   public List JavaDoc pendingLockContexts = new ArrayList JavaDoc();
30   public boolean isChangeListener;
31   public boolean requestedObjectIDs;
32   public NoExceptionLinkedQueue setTransactionSequenceIDsCalls = new NoExceptionLinkedQueue();
33   public NoExceptionLinkedQueue setTransactionIDsCalls = new NoExceptionLinkedQueue();
34   public Collection JavaDoc transactionSequenceIDs = new ArrayList JavaDoc();
35   public Collection JavaDoc transactionIDs = new ArrayList JavaDoc();
36   private TestMessageChannel channel;
37
38   public void addObjectID(ObjectID id) {
39     clientObjectIds.add(id);
40   }
41
42   public void send() {
43     sendCalls.put(new Object JavaDoc());
44   }
45
46   public MessageChannel getChannel() {
47     synchronized (this) {
48       if (channel == null) {
49         channel = new TestMessageChannel();
50         channel.channelID = channelID;
51       }
52
53       return channel;
54     }
55   }
56
57   public ChannelID getChannelID() {
58     return this.channelID;
59   }
60
61   public Set JavaDoc getObjectIDs() {
62     return clientObjectIds;
63   }
64
65   public int getCorrelationId(boolean initialize) {
66     throw new ImplementMe();
67   }
68
69   public void setCorrelationId(int id) {
70     throw new ImplementMe();
71   }
72
73   public TCMessageType getMessageType() {
74     throw new ImplementMe();
75   }
76
77   public void hydrate() {
78     //
79
}
80
81   public void dehydrate() {
82     //
83
}
84
85   public int getTotalLength() {
86     // TODO Auto-generated method stub
87
return 0;
88   }
89
90   public void addLockContext(LockContext ctxt) {
91     this.lockContexts.add(ctxt);
92   }
93
94   public Collection JavaDoc getLockContexts() {
95     return this.lockContexts;
96   }
97
98   public Collection JavaDoc getWaitContexts() {
99     return this.waitContexts;
100   }
101
102   public void addWaitContext(WaitContext ctxt) {
103     this.waitContexts.add(ctxt);
104   }
105
106   public void resend() {
107     throw new ImplementMe();
108
109   }
110
111   public void addPendingLockContext(LockContext ctxt) {
112     this.pendingLockContexts.add(ctxt);
113   }
114
115   public Collection JavaDoc getPendingLockContexts() {
116     return pendingLockContexts;
117   }
118
119   public Collection JavaDoc getTransactionSequenceIDs() {
120     return this.transactionSequenceIDs;
121   }
122
123   public void setTransactionSequenceIDs(Collection JavaDoc transactionSequenceIDs) {
124     this.transactionSequenceIDs = transactionSequenceIDs;
125     this.setTransactionSequenceIDsCalls.put(transactionSequenceIDs);
126   }
127
128   public void setResentTransactionIDs(Collection JavaDoc resentTransactionIDs) {
129     this.transactionIDs = resentTransactionIDs;
130     this.setTransactionIDsCalls.put(resentTransactionIDs);
131
132   }
133
134   public Collection JavaDoc getResentTransactionIDs() {
135     return transactionIDs;
136   }
137
138   public void setIsObjectIDsRequested(boolean request) {
139     this.requestedObjectIDs = request;
140   }
141
142   public boolean isObjectIDsRequested() {
143     return requestedObjectIDs;
144   }
145 }
146
Popular Tags