Revision 2624
Added by Jing Tao about 19 years ago
src/edu/ucsb/nceas/metacat/MetacatReplication.java | ||
---|---|---|
618 | 618 |
String user = (String)docinfoHash.get("user_owner"); |
619 | 619 |
// Get home server of this docid |
620 | 620 |
String homeServer=(String)docinfoHash.get("home_server"); |
621 |
String createdDate = (String)docinfoHash.get("date_created"); |
|
622 |
String updatedDate = (String)docinfoHash.get("date_updated"); |
|
621 | 623 |
MetaCatUtil.debugMessage("homeServer: "+homeServer, 34); |
622 | 624 |
// Get Document type |
623 | 625 |
String docType = (String)docinfoHash.get("doctype"); |
... | ... | |
649 | 651 |
// write the document to local database |
650 | 652 |
DocumentImplWrapper wrapper = new DocumentImplWrapper(parserBase, false); |
651 | 653 |
wrapper.writeReplication(dbConn, new StringReader(xmldoc), null, null, |
652 |
dbaction, docid, user, null, homeServer, server); |
|
654 |
dbaction, docid, user, null, homeServer, |
|
655 |
server, createdDate, updatedDate); |
|
653 | 656 |
|
654 | 657 |
MetacatReplication.replLog("document " + docid + " added to DB with " + |
655 | 658 |
"action " + dbaction); |
... | ... | |
770 | 773 |
String docType = (String)docinfoHash.get("doctype"); |
771 | 774 |
|
772 | 775 |
String docHomeServer= (String)docinfoHash.get("home_server"); |
776 |
|
|
777 |
String createdDate = (String)docinfoHash.get("date_created"); |
|
778 |
|
|
779 |
String updatedDate = (String)docinfoHash.get("date_updated"); |
|
773 | 780 |
MetaCatUtil.debugMessage("docHomeServer of datafile: "+docHomeServer, 34); |
774 | 781 |
|
775 | 782 |
|
... | ... | |
795 | 802 |
//into file system |
796 | 803 |
DocumentImpl.writeDataFileInReplication(url.openStream(), datafilePath, |
797 | 804 |
docName, docType, docid, user,docHomeServer,server, |
798 |
DocumentImpl.DOCUMENTTABLE, false);//false means non-timed replication |
|
805 |
DocumentImpl.DOCUMENTTABLE, false, createdDate, updatedDate); |
|
806 |
//false means non-timed replication |
|
799 | 807 |
} |
800 | 808 |
|
801 | 809 |
|
... | ... | |
895 | 903 |
sb.append("<user_owner>").append(doc.getUserowner()); |
896 | 904 |
sb.append("</user_owner><user_updated>").append(doc.getUserupdated()); |
897 | 905 |
sb.append("</user_updated>"); |
906 |
sb.append("<date_created>"); |
|
907 |
sb.append(doc.getCreateDate()); |
|
908 |
sb.append("</date_created>"); |
|
909 |
sb.append("<date_updated>"); |
|
910 |
sb.append(doc.getUpdateDate()); |
|
911 |
sb.append("</date_updated>"); |
|
898 | 912 |
sb.append("<home_server>"); |
899 | 913 |
sb.append(doc.getDocHomeServer()); |
900 | 914 |
sb.append("</home_server>"); |
src/edu/ucsb/nceas/metacat/ReplicationHandler.java | ||
---|---|---|
312 | 312 |
// Get home server of the docid |
313 | 313 |
String docHomeServer = (String)docinfoHash.get("home_server"); |
314 | 314 |
MetaCatUtil.debugMessage("doc home server in repl: "+docHomeServer, 45); |
315 |
|
|
315 |
String createdDate = (String)docinfoHash.get("date_created"); |
|
316 |
String updatedDate = (String)docinfoHash.get("date_updated"); |
|
316 | 317 |
//docid should include rev number too |
317 | 318 |
String accnum=docId+util.getOption("accNumSeparator")+ |
318 | 319 |
(String)docinfoHash.get("rev"); |
... | ... | |
345 | 346 |
(String)docinfoHash.get("user_owner"), |
346 | 347 |
null, /* null for groups[] */ |
347 | 348 |
docHomeServer, |
348 |
remoteserver, tableName, true);// true is for time replication |
|
349 |
remoteserver, tableName, true,// true is for time replication |
|
350 |
createdDate, |
|
351 |
updatedDate); |
|
349 | 352 |
MetaCatUtil.debugMessage("Successfully replicated doc " + accnum, 35); |
350 | 353 |
MetacatReplication.replLog("wrote doc " + accnum + " from " + |
351 | 354 |
remoteserver); |
... | ... | |
403 | 406 |
// Get docid home sever. it might be different to remoteserver |
404 | 407 |
// becuause of hub feature |
405 | 408 |
String docHomeServer = (String)docinfoHash.get("home_server"); |
406 |
|
|
409 |
String createdDate = (String)docinfoHash.get("date_created"); |
|
410 |
String updatedDate = (String)docinfoHash.get("date_updated"); |
|
407 | 411 |
//docid should include rev number too |
408 | 412 |
String accnum=docId+util.getOption("accNumSeparator")+ |
409 | 413 |
(String)docinfoHash.get("rev"); |
... | ... | |
428 | 432 |
docHomeServer, |
429 | 433 |
remoteserver, |
430 | 434 |
tableName, |
431 |
true);//true means timed replication |
|
435 |
true, //true means timed replication |
|
436 |
createdDate, |
|
437 |
updatedDate); |
|
438 |
|
|
432 | 439 |
MetaCatUtil.debugMessage("Successfully to write datafile " + docId, 30); |
433 | 440 |
MetacatReplication.replLog("wrote datafile " + accnum + " from " + |
434 | 441 |
remoteserver); |
src/edu/ucsb/nceas/metacat/Eml210SAXHandler.java | ||
---|---|---|
183 | 183 |
*/ |
184 | 184 |
public Eml210SAXHandler(DBConnection conn, String action, String docid, |
185 | 185 |
String revision, String user, String[] groups, String pub, |
186 |
int serverCode) throws SAXException |
|
186 |
int serverCode, String createDate, String updateDate) throws SAXException
|
|
187 | 187 |
{ |
188 |
super(conn, action, docid, revision, user, groups, pub, serverCode); |
|
188 |
super(conn, action, docid, revision, user, groups, pub, |
|
189 |
serverCode, createDate, updateDate); |
|
189 | 190 |
// Get the unchangable subtrees (user doesn't have write permission) |
190 | 191 |
try { |
191 | 192 |
PermissionController control = new PermissionController(docid |
... | ... | |
419 | 420 |
// In order to decrease DBConnection usage count, we get a |
420 | 421 |
// new |
421 | 422 |
// dbconnection from pool |
422 |
String catalogid = null; |
|
423 |
//String catalogid = null;
|
|
423 | 424 |
DBConnection dbConn = null; |
424 | 425 |
int serialNumber = -1; |
425 | 426 |
|
... | ... | |
453 | 454 |
{ |
454 | 455 |
currentDocument = new DocumentImpl(connection, rootNode |
455 | 456 |
.getNodeID(), docname, doctype, docid, revision, |
456 |
action, user, this.pub, catalogid, this.serverCode); |
|
457 |
action, user, this.pub, catalogid, this.serverCode, |
|
458 |
createDate, updateDate); |
|
457 | 459 |
} |
458 |
else |
|
459 |
{ |
|
460 |
currentDocument = new DeletedDocumentImpl(connection, rootNode |
|
461 |
.getNodeID(), docname, doctype, docid, revision, |
|
462 |
action, user, this.pub, catalogid, this.serverCode); |
|
463 |
} |
|
464 |
|
|
460 |
|
|
465 | 461 |
} catch (Exception ane) { |
466 | 462 |
throw (new SAXException( |
467 | 463 |
"Error in EMLSaxHandler.startElement " + action, |
Also available in: Unified diff
Add date info.