Revision 1061
Added by Jing Tao over 22 years ago
src/edu/ucsb/nceas/metacat/MetacatReplication.java | ||
---|---|---|
405 | 405 |
String dbaction = "UPDATE"; // the default action is UPDATE |
406 | 406 |
boolean override = false; |
407 | 407 |
int serverCode = 1; |
408 |
|
|
408 |
|
|
409 | 409 |
try { |
410 | 410 |
//if the url contains a dbaction then the default action is overridden |
411 | 411 |
if(params.containsKey("dbaction")) { |
... | ... | |
414 | 414 |
//override = true; //we are now overriding the default action |
415 | 415 |
} |
416 | 416 |
MetacatReplication.replLog("force replication request from " + server); |
417 |
|
|
417 |
util.debugMessage("Force replication docid: "+docid, 20); |
|
418 |
util.debugMessage("Force replication action: "+dbaction, 20); |
|
418 | 419 |
// sending back read request to server |
419 | 420 |
|
420 | 421 |
URL u = new URL("https://" + server + "?server=" |
... | ... | |
437 | 438 |
String user = (String)docinfoHash.get("user_owner"); |
438 | 439 |
|
439 | 440 |
String homeServer=(String)docinfoHash.get("home_server"); |
440 |
|
|
441 |
util.debugMessage("homeServer: "+homeServer,20); |
|
441 | 442 |
// write the document here |
442 | 443 |
Connection conn = util.openDBConnection(); |
443 | 444 |
DocumentImpl.writeReplication(conn, new StringReader(xmldoc), null, null, |
444 |
dbaction, docid, user, null, homeServer, false);
|
|
445 |
dbaction, docid, user, null, homeServer, true);
|
|
445 | 446 |
|
446 | 447 |
|
447 | 448 |
conn.close(); |
... | ... | |
449 | 450 |
MetacatReplication.replLog("document " + docid + " added to DB with " + |
450 | 451 |
"action " + dbaction); |
451 | 452 |
} catch(Exception e) { |
453 |
|
|
452 | 454 |
System.out.println("ERROR in MetacatReplication.handleForceReplicate" + |
453 | 455 |
"Request(): " + e.getMessage()); |
454 | 456 |
e.printStackTrace(); |
... | ... | |
645 | 647 |
sb.append("</user_owner><user_updated>").append(doc.getUserupdated()); |
646 | 648 |
sb.append("</user_updated>"); |
647 | 649 |
sb.append("<home_server>"); |
648 |
sb.append(doc.getHomeServer(docid));
|
|
650 |
sb.append(doc.getDocHomeServer());
|
|
649 | 651 |
sb.append("</home_server>"); |
650 | 652 |
sb.append("<public_access>").append(doc.getPublicaccess()); |
651 | 653 |
sb.append("</public_access><rev>").append(doc.getRev()); |
Also available in: Unified diff
Use DocumentImpl.getDocHomeServer method to get home server in method handleGetDocumentInfo