1 |
| package org.jboss.cache.notifications.event; |
2 |
| |
3 |
| import org.jboss.cache.Cache; |
4 |
| import org.jboss.cache.Fqn; |
5 |
| import org.jgroups.View; |
6 |
| |
7 |
| import javax.transaction.Transaction; |
8 |
| import java.util.Map; |
9 |
| |
10 |
| |
11 |
| |
12 |
| |
13 |
| |
14 |
| |
15 |
| |
16 |
| public class EventImpl implements CacheBlockedEvent, CacheUnblockedEvent, CacheStartedEvent, CacheStoppedEvent, |
17 |
| NodeActivatedEvent, NodeCreatedEvent, NodeEvictedEvent, NodeLoadedEvent, NodeModifiedEvent, NodeMovedEvent, |
18 |
| NodePassivatedEvent, NodeRemovedEvent, NodeVisitedEvent, TransactionCompletedEvent, TransactionRegisteredEvent, |
19 |
| ViewChangedEvent |
20 |
| { |
21 |
| private boolean pre = false; |
22 |
| private Cache cache; |
23 |
| private ModificationType modificationType; |
24 |
| private Map data; |
25 |
| private Fqn fqn; |
26 |
| private Transaction transaction; |
27 |
| private boolean originLocal = true; |
28 |
| private Fqn targetFqn; |
29 |
| private boolean successful; |
30 |
| private View newView; |
31 |
| private Type type; |
32 |
| |
33 |
| |
34 |
200
| public EventImpl(boolean pre, Cache cache, ModificationType modificationType, Map data, Fqn fqn, Transaction transaction, boolean originLocal, Fqn targetFqn, boolean successful, View newView, Type type)
|
35 |
| { |
36 |
200
| this.pre = pre;
|
37 |
200
| this.cache = cache;
|
38 |
200
| this.modificationType = modificationType;
|
39 |
200
| this.data = data;
|
40 |
200
| this.fqn = fqn;
|
41 |
200
| this.transaction = transaction;
|
42 |
200
| this.originLocal = originLocal;
|
43 |
200
| this.targetFqn = targetFqn;
|
44 |
200
| this.successful = successful;
|
45 |
200
| this.newView = newView;
|
46 |
200
| this.type = type;
|
47 |
| } |
48 |
| |
49 |
4538
| public EventImpl()
|
50 |
| { |
51 |
| } |
52 |
| |
53 |
323
| public Type getType()
|
54 |
| { |
55 |
323
| return type;
|
56 |
| } |
57 |
| |
58 |
2339
| public boolean isPre()
|
59 |
| { |
60 |
2339
| return pre;
|
61 |
| } |
62 |
| |
63 |
0
| public Cache getCache()
|
64 |
| { |
65 |
0
| return cache;
|
66 |
| } |
67 |
| |
68 |
1198
| public ModificationType getModificationType()
|
69 |
| { |
70 |
1198
| return modificationType;
|
71 |
| } |
72 |
| |
73 |
1198
| public Map getData()
|
74 |
| { |
75 |
1198
| return data;
|
76 |
| } |
77 |
| |
78 |
1784
| public Fqn getFqn()
|
79 |
| { |
80 |
1784
| return fqn;
|
81 |
| } |
82 |
| |
83 |
112
| public Transaction getTransaction()
|
84 |
| { |
85 |
112
| return transaction;
|
86 |
| } |
87 |
| |
88 |
1380
| public boolean isOriginLocal()
|
89 |
| { |
90 |
1380
| return originLocal;
|
91 |
| } |
92 |
| |
93 |
0
| public Fqn getTargetFqn()
|
94 |
| { |
95 |
0
| return targetFqn;
|
96 |
| } |
97 |
| |
98 |
49
| public boolean isSuccessful()
|
99 |
| { |
100 |
49
| return successful;
|
101 |
| } |
102 |
| |
103 |
222
| public View getNewView()
|
104 |
| { |
105 |
222
| return newView;
|
106 |
| } |
107 |
| |
108 |
| |
109 |
| |
110 |
3782
| public void setPre(boolean pre)
|
111 |
| { |
112 |
3782
| this.pre = pre;
|
113 |
| } |
114 |
| |
115 |
4626
| public void setCache(Cache cache)
|
116 |
| { |
117 |
4626
| this.cache = cache;
|
118 |
| } |
119 |
| |
120 |
1887
| public void setModificationType(ModificationType modificationType)
|
121 |
| { |
122 |
1887
| this.modificationType = modificationType;
|
123 |
| } |
124 |
| |
125 |
2413
| public void setData(Map data)
|
126 |
| { |
127 |
2413
| this.data = data;
|
128 |
| } |
129 |
| |
130 |
3782
| public void setFqn(Fqn fqn)
|
131 |
| { |
132 |
3782
| this.fqn = fqn;
|
133 |
| } |
134 |
| |
135 |
4402
| public void setTransaction(Transaction transaction)
|
136 |
| { |
137 |
4402
| this.transaction = transaction;
|
138 |
| } |
139 |
| |
140 |
3992
| public void setOriginLocal(boolean originLocal)
|
141 |
| { |
142 |
3992
| this.originLocal = originLocal;
|
143 |
| } |
144 |
| |
145 |
40
| public void setTargetFqn(Fqn targetFqn)
|
146 |
| { |
147 |
40
| this.targetFqn = targetFqn;
|
148 |
| } |
149 |
| |
150 |
224
| public void setSuccessful(boolean successful)
|
151 |
| { |
152 |
224
| this.successful = successful;
|
153 |
| } |
154 |
| |
155 |
246
| public void setNewView(View newView)
|
156 |
| { |
157 |
246
| this.newView = newView;
|
158 |
| } |
159 |
| |
160 |
4538
| public void setType(Type type)
|
161 |
| { |
162 |
4538
| this.type = type;
|
163 |
| } |
164 |
| |
165 |
| |
166 |
378
| public boolean equals(Object o)
|
167 |
| { |
168 |
0
| if (this == o) return true;
|
169 |
0
| if (o == null || getClass() != o.getClass()) return false;
|
170 |
| |
171 |
378
| EventImpl event = (EventImpl) o;
|
172 |
| |
173 |
0
| if (originLocal != event.originLocal) return false;
|
174 |
0
| if (pre != event.pre) return false;
|
175 |
0
| if (successful != event.successful) return false;
|
176 |
0
| if (cache != null ? !cache.equals(event.cache) : event.cache != null) return false;
|
177 |
0
| if (data != null ? !data.equals(event.data) : event.data != null) return false;
|
178 |
0
| if (fqn != null ? !fqn.equals(event.fqn) : event.fqn != null) return false;
|
179 |
0
| if (modificationType != event.modificationType) return false;
|
180 |
0
| if (targetFqn != null ? !targetFqn.equals(event.targetFqn) : event.targetFqn != null) return false;
|
181 |
0
| if (transaction != null ? !transaction.equals(event.transaction) : event.transaction != null) return false;
|
182 |
0
| if (newView != null ? !newView.equals(event.newView) : event.newView != null) return false;
|
183 |
0
| if (type != null ? !type.equals(event.type) : event.type != null) return false;
|
184 |
| |
185 |
378
| return true;
|
186 |
| } |
187 |
| |
188 |
0
| public int hashCode()
|
189 |
| { |
190 |
0
| int result;
|
191 |
0
| result = (pre ? 1 : 0);
|
192 |
0
| result = 31 * result + (cache != null ? cache.hashCode() : 0);
|
193 |
0
| result = 31 * result + (modificationType != null ? modificationType.hashCode() : 0);
|
194 |
0
| result = 31 * result + (data != null ? data.hashCode() : 0);
|
195 |
0
| result = 31 * result + (fqn != null ? fqn.hashCode() : 0);
|
196 |
0
| result = 31 * result + (transaction != null ? transaction.hashCode() : 0);
|
197 |
0
| result = 31 * result + (originLocal ? 1 : 0);
|
198 |
0
| result = 31 * result + (targetFqn != null ? targetFqn.hashCode() : 0);
|
199 |
0
| result = 31 * result + (successful ? 1 : 0);
|
200 |
0
| result = 31 * result + (newView != null ? newView.hashCode() : 0);
|
201 |
0
| result = 31 * result + (type != null ? type.hashCode() : 0);
|
202 |
0
| return result;
|
203 |
| } |
204 |
| |
205 |
| |
206 |
794
| public String toString()
|
207 |
| { |
208 |
794
| return "EventImpl{" +
|
209 |
| "pre=" + pre + |
210 |
| ", cache=" + cache + |
211 |
| ", modificationType=" + modificationType + |
212 |
| ", data=" + data + |
213 |
| ", fqn=" + fqn + |
214 |
| ", transaction=" + transaction + |
215 |
| ", originLocal=" + originLocal + |
216 |
| ", targetFqn=" + targetFqn + |
217 |
| ", successful=" + successful + |
218 |
| ", newView=" + newView + |
219 |
| ", type=" + type + |
220 |
| '}'; |
221 |
| } |
222 |
| |
223 |
| } |