Revision 3229
Added by Jing Tao about 17 years ago
ForceReplicationHandler.java | ||
---|---|---|
54 | 54 |
private String action; |
55 | 55 |
private boolean xmlDocument; |
56 | 56 |
private boolean dbactionFlag = true; |
57 |
private String user = null; |
|
58 |
private String ipAddress = null; |
|
57 | 59 |
private ReplicationServerList serverLists = null;//Serverlist |
58 | 60 |
private int homeServerCode = 0; // home server code for the docid |
59 | 61 |
// When a metacat A got forcereplication |
... | ... | |
80 | 82 |
* don't want A to notify B again. B is nofitification of A. |
81 | 83 |
*/ |
82 | 84 |
public ForceReplicationHandler(String docid, String action, boolean xml, |
83 |
String myNotificationServer) |
|
85 |
String myNotificationServer, String user, String ipAddress)
|
|
84 | 86 |
{ |
85 | 87 |
this.docid = docid; |
86 | 88 |
this.action = action; |
87 | 89 |
this.xmlDocument =xml; |
90 |
this.user = user; |
|
91 |
this.ipAddress = ipAddress; |
|
88 | 92 |
// Build a severLists from xml_replication table |
89 | 93 |
this.serverLists = new ReplicationServerList(); |
90 | 94 |
// Get sever code for this docid |
... | ... | |
114 | 118 |
* Use this constructor when the action is implied. |
115 | 119 |
*/ |
116 | 120 |
public ForceReplicationHandler(String docid, boolean xml, |
117 |
String myNotificationServer )
|
|
121 |
String myNotificationServer, String user, String ipAddress)
|
|
118 | 122 |
{ |
119 | 123 |
this.docid = docid; |
120 | 124 |
this.xmlDocument = xml; |
125 |
this.user = user; |
|
126 |
this.ipAddress = ipAddress; |
|
121 | 127 |
dbactionFlag = false; |
122 | 128 |
// Build a severLists from xml_replication table |
123 | 129 |
this.serverLists = new ReplicationServerList(); |
... | ... | |
199 | 205 |
"?action=forcereplicate&server=" + |
200 | 206 |
util.getLocalReplicationServerName()+ |
201 | 207 |
"&docid=" + docid + "&dbaction=" + |
202 |
action); |
|
208 |
action+"&ipAddress="+ipAddress);
|
|
203 | 209 |
//over write the url for delete |
204 | 210 |
if (action != null && action.equals(DELETE)) |
205 | 211 |
{ |
206 | 212 |
comeAndGetIt = new URL("https://" + server + "?action=" + |
207 | 213 |
MetacatReplication.FORCEREPLICATEDELETE + |
208 |
"&docid=" + docid +"&server="+ util.getLocalReplicationServerName()); |
|
214 |
"&docid=" + docid +"&server="+ util.getLocalReplicationServerName()+"&user="+user+"&ipAddress="+ipAddress);
|
|
209 | 215 |
|
210 | 216 |
} |
211 | 217 |
}//if servercode==1 |
... | ... | |
222 | 228 |
"?action=forcereplicate&server=" + |
223 | 229 |
util.getLocalReplicationServerName() + |
224 | 230 |
"&docid=" + docid + "&dbaction=" + |
225 |
action); |
|
231 |
action+"&ipAddress="+ipAddress);
|
|
226 | 232 |
//over write the url for delete |
227 | 233 |
if (action != null && action.equals(DELETE)) |
228 | 234 |
{ |
229 | 235 |
comeAndGetIt = new URL("https://" + server + "?action=" + |
230 | 236 |
MetacatReplication.FORCEREPLICATEDELETE + |
231 |
"&docid=" + docid+"&server="+ util.getLocalReplicationServerName()); |
|
237 |
"&docid=" + docid+"&server="+ util.getLocalReplicationServerName()+"&user="+user+"&ipAddress="+ipAddress);
|
|
232 | 238 |
|
233 | 239 |
} |
234 | 240 |
}//else |
... | ... | |
246 | 252 |
"?action=forcereplicatedatafile&server=" + |
247 | 253 |
util.getLocalReplicationServerName() + |
248 | 254 |
"&docid=" + docid + "&dbaction=" + |
249 |
action); |
|
255 |
action+"&ipAddress="+ipAddress);
|
|
250 | 256 |
//over write the url for delete |
251 | 257 |
if (action != null && action.equals(DELETE)) |
252 | 258 |
{ |
253 | 259 |
comeAndGetIt = new URL("https://" + server + "?action=" + |
254 | 260 |
MetacatReplication.FORCEREPLICATEDELETE + |
255 |
"&docid=" + docid +"&server="+ util.getLocalReplicationServerName()); |
|
261 |
"&docid=" + docid +"&server="+ util.getLocalReplicationServerName()+"&user="+user+"&ipAddress="+ipAddress);
|
|
256 | 262 |
|
257 | 263 |
} |
258 | 264 |
|
... | ... | |
270 | 276 |
"?action=forcereplicatedatafile&server=" + |
271 | 277 |
util.getLocalReplicationServerName() + |
272 | 278 |
"&docid=" + docid + "&dbaction=" + |
273 |
action); |
|
279 |
action+"&ipAddress="+ipAddress);
|
|
274 | 280 |
//over write the url for delete |
275 | 281 |
if (action != null && action.equals(DELETE)) |
276 | 282 |
{ |
277 | 283 |
comeAndGetIt = new URL("https://" + server + "?action=" + |
278 | 284 |
MetacatReplication.FORCEREPLICATEDELETE + |
279 |
"&docid=" + docid+"&server="+ util.getLocalReplicationServerName()); |
|
285 |
"&docid=" + docid+"&server="+ util.getLocalReplicationServerName()+"&user="+user+"&ipAddress="+ipAddress);
|
|
280 | 286 |
|
281 | 287 |
} |
282 | 288 |
|
... | ... | |
297 | 303 |
comeAndGetIt = new URL("https://" + server + |
298 | 304 |
"?action=forcereplicate&server=" + |
299 | 305 |
util.getLocalReplicationServerName()+ |
300 |
"&docid=" + docid); |
|
306 |
"&docid=" + docid+"&ipAddress="+ipAddress);
|
|
301 | 307 |
|
302 | 308 |
}//if homeserver ==1 |
303 | 309 |
else if (replicationServer.getHub()|| |
... | ... | |
310 | 316 |
comeAndGetIt = new URL("https://" + server + |
311 | 317 |
"?action=forcereplicate&server=" + |
312 | 318 |
util.getLocalReplicationServerName() + |
313 |
"&docid=" + docid); |
|
319 |
"&docid=" + docid+"&ipAddress="+ipAddress);
|
|
314 | 320 |
|
315 | 321 |
}//else if |
316 | 322 |
|
... | ... | |
324 | 330 |
comeAndGetIt = new URL("https://" + server + |
325 | 331 |
"?action=forcereplicatedatafile&server=" + |
326 | 332 |
util.getLocalReplicationServerName() + |
327 |
"&docid=" + docid); |
|
333 |
"&docid=" + docid+"&ipAddress="+ipAddress);
|
|
328 | 334 |
}//if |
329 | 335 |
else if (replicationServer.getHub()|| |
330 | 336 |
server.equals(MetacatReplication. |
... | ... | |
336 | 342 |
comeAndGetIt = new URL("https://" + server + |
337 | 343 |
"?action=forcereplicatedatafile&server=" + |
338 | 344 |
util.getLocalReplicationServerName() + |
339 |
"&docid=" + docid); |
|
345 |
"&docid=" + docid+"&ipAddress="+ipAddress);
|
|
340 | 346 |
|
341 | 347 |
}//else |
342 | 348 |
}//else if |
Also available in: Unified diff
This commit is for branch. In this commit the correct ip and user name will be stored in access_log table in replication event. However, it only for Forcereplication. And the test isn't completed yet. This commit is only for future use.