Revision 5451
Added by berkley over 14 years ago
src/edu/ucsb/nceas/metacat/IdentifierManager.java | ||
---|---|---|
404 | 404 |
{ |
405 | 405 |
String query = "select guid from identifier where docid = ? and rev = ?"; |
406 | 406 |
String guid = null; |
407 |
boolean found = false; |
|
407 | 408 |
|
408 | 409 |
DBConnection dbConn = null; |
409 | 410 |
int serialNumber = -1; |
... | ... | |
417 | 418 |
stmt.setString(1, docid); |
418 | 419 |
stmt.setInt(2, rev); |
419 | 420 |
ResultSet rs = stmt.executeQuery(); |
420 |
if (rs.next()) { |
|
421 |
if (rs.next()) |
|
422 |
{ |
|
421 | 423 |
guid = rs.getString(1); |
422 |
|
|
423 |
} else { |
|
424 |
throw new McdbDocNotFoundException("Document not found:" + guid); |
|
424 |
} |
|
425 |
else |
|
426 |
{ |
|
427 |
query = "select guid from systemmetadata where docid = ? and rev = ?"; |
|
428 |
stmt = dbConn.prepareStatement(query); |
|
429 |
stmt.setString(1, docid); |
|
430 |
stmt.setInt(2, rev); |
|
431 |
if(rs.next()) |
|
432 |
{ |
|
433 |
guid = rs.getString(1); |
|
434 |
} |
|
435 |
else |
|
436 |
{ |
|
437 |
throw new McdbDocNotFoundException("No guid registered for docid " + docid + "." + rev); |
|
438 |
} |
|
425 | 439 |
} |
426 |
stmt.close(); |
|
440 |
|
|
427 | 441 |
} catch (SQLException e) { |
428 | 442 |
logMetacat.error("Error while looking up the guid: " |
429 | 443 |
+ e.getMessage()); |
src/edu/ucsb/nceas/metacat/replication/ReplicationHandler.java | ||
---|---|---|
411 | 411 |
//process guid |
412 | 412 |
logReplication.debug("Processing guid information from docinfoHash: " + docinfoHash.toString()); |
413 | 413 |
String guid = docinfoHash.get("guid"); |
414 |
String docName = docinfoHash.get("docName"); |
|
414 | 415 |
System.out.println("%%%%%%%%%%%%%%%%%%%%%%%%%%guid passed from docinfo hash: " + guid); |
415 | 416 |
IdentifierManager idman = IdentifierManager.getInstance(); |
416 | 417 |
if(guid != null && !idman.identifierExists(guid)) |
417 | 418 |
{ //if the guid was passed in, put it in the identifiers table |
418 | 419 |
logReplication.debug("Creating guid/docid mapping for docid " + |
419 | 420 |
docinfoHash.get("docid") + " and guid: " + guid); |
420 |
idman.createMapping(guid, docinfoHash.get("docid")); |
|
421 |
System.out.println("docname: " + docName); |
|
422 |
if(docName.trim().equals("systemMetadata")) |
|
423 |
{ |
|
424 |
System.out.println("creating mapping for systemMetadata: guid: " + guid + " localId: " + docinfoHash.get("docid")); |
|
425 |
idman.createSystemMetadataMapping(guid, docinfoHash.get("docid")); |
|
426 |
} |
|
427 |
else |
|
428 |
{ |
|
429 |
System.out.println("creating mapping: guid: " + guid + " localId: " + docinfoHash.get("docid")); |
|
430 |
idman.createMapping(guid, docinfoHash.get("docid")); |
|
431 |
} |
|
421 | 432 |
} |
422 | 433 |
else |
423 | 434 |
{ |
src/edu/ucsb/nceas/metacat/replication/ReplicationService.java | ||
---|---|---|
531 | 531 |
String guid = (String) docinfoHash.get("guid"); |
532 | 532 |
logReplication.info("XXXXXXXXXXXXXXXX GUID found in dociinfoHash: " + guid); |
533 | 533 |
|
534 |
logReplication.debug("Processing guid " + guid +
|
|
534 |
logReplication.info("Processing guid " + guid +
|
|
535 | 535 |
" information from handleForceReplicationRequest: " + |
536 | 536 |
docinfoHash.toString()); |
537 | 537 |
IdentifierManager idman = IdentifierManager.getInstance(); |
538 | 538 |
if(guid != null && !idman.identifierExists(guid)) |
539 | 539 |
{ //if the guid was passed in, put it in the identifiers table |
540 |
logReplication.info("XXXXXXXXXXXXXXXXXXX Creating guid/docid mapping for docid " +
|
|
540 |
logReplication.info("YYYYYYYYYYYYYY Creating guid/docid mapping for docid " +
|
|
541 | 541 |
docinfoHash.get("docid") + " and guid: " + guid); |
542 |
idman.createMapping(guid, docinfoHash.get("docid")); |
|
542 |
|
|
543 |
String docName = (String) docinfoHash.get("docname"); |
|
544 |
logReplication.info("ZZZZZZZZZZZZ docName: " + docName); |
|
545 |
if(docName.trim().equals("systemMetadata")) |
|
546 |
{ |
|
547 |
logReplication.info("creating mapping for systemMetadata: guid: " + guid + " localId: " + docinfoHash.get("docid")); |
|
548 |
idman.createSystemMetadataMapping(guid, docinfoHash.get("docid")); |
|
549 |
} |
|
550 |
else |
|
551 |
{ |
|
552 |
logReplication.info("creating mapping: guid: " + guid + " localId: " + docinfoHash.get("docid")); |
|
553 |
idman.createMapping(guid, docinfoHash.get("docid")); |
|
554 |
} |
|
543 | 555 |
} |
544 | 556 |
else |
545 | 557 |
{ |
Also available in: Unified diff
fixing problems with replication and systemmetadata