Revision 1014
Added by Jing Tao over 22 years ago
src/edu/ucsb/nceas/metacat/MetacatReplication.java | ||
---|---|---|
383 | 383 |
MetacatReplication.replLog("force replication request from " + server); |
384 | 384 |
|
385 | 385 |
// sending back read request to server |
386 |
URL u = new URL("https://" + server + "?action=read&docid=" + docid); |
|
386 |
URL u = new URL("https://" + server + "?server=" |
|
387 |
+util.getLocalReplicationServerName() |
|
388 |
+"&action=read&docid=" + docid); |
|
387 | 389 |
String xmldoc = MetacatReplication.getURLContent(u); |
388 | 390 |
|
389 | 391 |
// get the document info from server |
390 | 392 |
URL docinfourl = new URL("https://" + server + |
391 |
"?action=getdocumentinfo&docid=" + docid); |
|
393 |
"?server="+util.getLocalReplicationServerName() |
|
394 |
+"&action=getdocumentinfo&docid=" + docid); |
|
392 | 395 |
String docInfoStr = MetacatReplication.getURLContent(docinfourl); |
393 | 396 |
|
394 | 397 |
//dih is the parser for the docinfo xml format |
... | ... | |
399 | 402 |
String user = (String)docinfoHash.get("user_owner"); |
400 | 403 |
|
401 | 404 |
// write the document here |
402 |
System.out.println("Open db connection"); |
|
403 | 405 |
Connection conn = util.openDBConnection(); |
404 |
System.out.println("DB connection opened"); |
|
405 | 406 |
DocumentImpl.write(conn, new StringReader(xmldoc), null, dbaction, docid, |
406 | 407 |
user, null, serverCode, override); |
407 | 408 |
conn.close(); |
... | ... | |
446 | 447 |
lockThread = new Thread(this); |
447 | 448 |
lockThread.setPriority(Thread.MIN_PRIORITY); |
448 | 449 |
lockThread.start(); |
449 |
System.out.println("lock granted for " + docid); |
|
450 | 450 |
MetacatReplication.replLog("lock granted for " + docid); |
451 | 451 |
} |
452 | 452 |
else |
... | ... | |
524 | 524 |
try |
525 | 525 |
{ |
526 | 526 |
String docid = ((String[])(params.get("docid")))[0]; |
527 |
System.out.println("incoming get request for document: " + docid); |
|
528 | 527 |
conn = MetacatReplication.getDBConnection("MetacatReplication." + |
529 | 528 |
"handleGetDocumentRequest"); |
530 | 529 |
DocumentImpl di = new DocumentImpl(conn, docid); |
... | ... | |
532 | 531 |
out.print(di.toString()); |
533 | 532 |
conn.close(); |
534 | 533 |
MetacatReplication.replLog("document " + docid + " sent"); |
535 |
System.out.println("document " + docid + " sent"); |
|
534 |
|
|
536 | 535 |
} |
537 | 536 |
catch(Exception e) |
538 | 537 |
{ |
... | ... | |
563 | 562 |
Connection conn = null; |
564 | 563 |
try |
565 | 564 |
{ |
566 |
System.out.println("received update request"); |
|
565 |
|
|
567 | 566 |
StringBuffer docsql = new StringBuffer(); |
568 | 567 |
StringBuffer doclist = new StringBuffer(); |
569 | 568 |
Vector packageFiles = new Vector(); |
... | ... | |
647 | 646 |
conn.close(); |
648 | 647 |
response.setContentType("text/xml"); |
649 | 648 |
out.println(doclist.toString()); |
650 |
System.out.println("doclist: " + doclist.toString()); |
|
651 |
System.out.println("update request handled"); |
|
649 |
|
|
652 | 650 |
} |
653 | 651 |
catch(Exception e) |
654 | 652 |
{ |
Also available in: Unified diff
Fixed the bug that to handle forceReplication action