Revision 6119
Added by ben leinfelder almost 13 years ago
ReplicationService.java | ||
---|---|---|
1040 | 1040 |
} |
1041 | 1041 |
|
1042 | 1042 |
} |
1043 |
|
|
1044 |
/** |
|
1045 |
* when a forcereplication request comes in, local host sends a read request |
|
1046 |
* to the requesting server (remote server) for the specified docid. Then |
|
1047 |
* store it in local database. |
|
1048 |
*/ |
|
1049 |
protected static void handleForceReplicateSystemMetadataRequest( |
|
1050 |
Hashtable<String, String[]> params, HttpServletResponse response, |
|
1051 |
HttpServletRequest request) { |
|
1052 |
String server = ((String[]) params.get("server"))[0]; // the server that |
|
1053 |
String guid = ((String[]) params.get("guid"))[0]; // sent the document |
|
1054 |
|
|
1055 |
try { |
|
1056 |
logReplication.info("ReplicationService.handleForceReplicateSystemMetadataRequest - Force replication system metadata request from: " + server); |
|
1057 |
// get the system metadata from server |
|
1058 |
URL docinfourl = new URL("https://" + server + "?server=" |
|
1059 |
+ MetacatUtil.getLocalReplicationServerName() |
|
1060 |
+ "&action=getsystemmetadata&guid=" + guid); |
|
1061 |
|
|
1062 |
String systemMetadataXML = ReplicationService.getURLContent(docinfourl); |
|
1063 |
|
|
1064 |
// process system metadata |
|
1065 |
if (systemMetadataXML != null) { |
|
1066 |
SystemMetadata sysMeta = |
|
1067 |
(SystemMetadata) ServiceTypeUtil.deserializeServiceType( |
|
1068 |
SystemMetadata.class, |
|
1069 |
new ByteArrayInputStream(systemMetadataXML.getBytes("UTF-8"))); |
|
1070 |
if (!IdentifierManager.getInstance().identifierExists(guid)) { |
|
1071 |
logReplication.debug("Creating system metadata for guid: " + guid); |
|
1072 |
IdentifierManager.getInstance().createSystemMetadata(sysMeta); |
|
1073 |
} |
|
1074 |
IdentifierManager.getInstance().updateSystemMetadata(sysMeta); |
|
1075 |
} |
|
1076 |
|
|
1077 |
logReplication.info("ReplicationService.handleForceReplicateSystemMetadataRequest - processed guid: " + guid); |
|
1078 |
EventLog.getInstance().log(request.getRemoteAddr(), REPLICATIONUSER, guid, "systemMetadata"); |
|
1043 | 1079 |
|
1080 |
} catch (Exception e) { |
|
1081 |
logMetacat.error("ReplicationService.handleForceReplicateRequest - " + ReplicationService.METACAT_REPL_ERROR_MSG, e); |
|
1082 |
logReplication.error("ReplicationService.handleForceReplicateRequest - General error when processing guid: " + guid, e); |
|
1083 |
} |
|
1084 |
} |
|
1085 |
|
|
1044 | 1086 |
/** |
1045 | 1087 |
* Sends a datafile to a remote host |
1046 | 1088 |
*/ |
Also available in: Unified diff
include System Metadata forced replication - just need to figure out when to call it!