Revision 6118
Added by ben leinfelder almost 13 years ago
ReplicationService.java | ||
---|---|---|
49 | 49 |
import java.util.Date; |
50 | 50 |
import java.util.Enumeration; |
51 | 51 |
import java.util.Hashtable; |
52 |
import java.util.List; |
|
52 | 53 |
import java.util.Timer; |
53 | 54 |
import java.util.Vector; |
54 | 55 |
|
... | ... | |
1010 | 1011 |
} |
1011 | 1012 |
|
1012 | 1013 |
} |
1014 |
|
|
1015 |
/** |
|
1016 |
* Sends System Metadata as XML |
|
1017 |
*/ |
|
1018 |
protected static void handleGetSystemMetadataRequest( |
|
1019 |
Hashtable<String, String[]> params, HttpServletResponse response) { |
|
1020 |
String guid = ((String[]) (params.get("guid")))[0]; |
|
1021 |
String systemMetadataXML = null; |
|
1022 |
try { |
|
1023 |
|
|
1024 |
// serialize the System Metadata as XML |
|
1025 |
SystemMetadata systemMetadata = IdentifierManager.getInstance().getSystemMetadata(guid); |
|
1026 |
ByteArrayOutputStream baos = new ByteArrayOutputStream(); |
|
1027 |
ServiceTypeUtil.serializeServiceType(SystemMetadata.class, systemMetadata, baos); |
|
1028 |
systemMetadataXML = baos.toString("UTF-8"); |
|
1029 |
|
|
1030 |
// get a writer for sending back to response |
|
1031 |
response.setContentType("text/xml"); |
|
1032 |
Writer out = response.getWriter(); |
|
1033 |
out.write(systemMetadataXML); |
|
1034 |
out.close(); |
|
1013 | 1035 |
|
1036 |
} catch (Exception e) { |
|
1037 |
String msg = "ReplicationService.handleGetSystemMetadataRequest for guid: " + guid + " : " + e.getMessage(); |
|
1038 |
logMetacat.error(msg); |
|
1039 |
logReplication.error(msg); |
|
1040 |
} |
|
1041 |
|
|
1042 |
} |
|
1043 |
|
|
1014 | 1044 |
/** |
1015 | 1045 |
* Sends a datafile to a remote host |
1016 | 1046 |
*/ |
... | ... | |
1432 | 1462 |
// add revision doc list |
1433 | 1463 |
doclist.append(prepareRevisionDoc(dbConn, revisionSql.toString(), |
1434 | 1464 |
replicateData)); |
1465 |
|
|
1466 |
// add the system metadata entries |
|
1467 |
Date since = new Date(System.currentTimeMillis()); |
|
1468 |
since = serverList.getLastCheckedDate(server); |
|
1469 |
List<String> systemMetadataEntries = |
|
1470 |
IdentifierManager.getInstance().getUpdatedSystemMetadataIds(since); |
|
1471 |
for (int i = 0; i < systemMetadataEntries.size(); i++) { |
|
1472 |
String guid = systemMetadataEntries.get(i); |
|
1473 |
doclist.append("<updatedSystemMetadata>"); |
|
1474 |
doclist.append("<guid>"); |
|
1475 |
doclist.append(guid); |
|
1476 |
doclist.append("</guid>"); |
|
1477 |
doclist.append("</updatedSystemMetadata>"); |
|
1478 |
} |
|
1435 | 1479 |
|
1436 | 1480 |
doclist.append("</updates></replication>"); |
1437 | 1481 |
logReplication.info("ReplicationService.handleUpdateRequest - doclist: " + doclist.toString()); |
Also available in: Unified diff
handle timed replication of system metadata. there are still a few outstanding issues:
-track server location of system metadata-only entries
-replication policy flag for system metadata-only entries?
-locking for replicated entries?
-forced replication of entries