Revision 7840
Added by ben leinfelder over 11 years ago
src/edu/ucsb/nceas/metacat/DocumentImpl.java | ||
---|---|---|
3451 | 3451 |
conn.setAutoCommit(true); |
3452 | 3452 |
|
3453 | 3453 |
// add force delete replcation document here. |
3454 |
String deleteAction = ReplicationService.FORCEREPLICATEDELETE; |
|
3455 |
if (removeAll) { |
|
3456 |
deleteAction = ReplicationService.FORCEREPLICATEDELETEALL; |
|
3457 |
} |
|
3454 | 3458 |
ForceReplicationHandler frh = new ForceReplicationHandler( |
3455 |
accnum, ForceReplicationHandler.DELETE, isXML, notifyServer);
|
|
3459 |
accnum, deleteAction, isXML, notifyServer);
|
|
3456 | 3460 |
logMetacat.debug("DocumentImpl.delete - ForceReplicationHandler created: " + frh.toString()); |
3457 | 3461 |
|
3458 | 3462 |
double end = System.currentTimeMillis()/1000; |
src/edu/ucsb/nceas/metacat/replication/ForceReplicationHandler.java | ||
---|---|---|
64 | 64 |
private static Logger logReplication = Logger.getLogger("ReplicationLogging"); |
65 | 65 |
private static Logger logMetacat = Logger.getLogger(ForceReplicationHandler.class); |
66 | 66 |
|
67 |
//constant |
|
68 |
public static final String DELETE = "delete"; |
|
69 |
|
|
70 |
|
|
71 |
|
|
72 | 67 |
/** |
73 | 68 |
* Constructor of ForceReplicationHandler |
74 | 69 |
* @param docid the docid to force replicate |
... | ... | |
196 | 191 |
+ MetacatUtil.getLocalReplicationServerName() |
197 | 192 |
+ "&docid=" + docid + "&dbaction=" + action); |
198 | 193 |
//over write the url for delete |
199 |
if (action != null && action.equals(DELETE)) {
|
|
194 |
if (action != null && (action.equals(ReplicationService.FORCEREPLICATEDELETE) || action.equals(ReplicationService.FORCEREPLICATEDELETEALL))) {
|
|
200 | 195 |
comeAndGetIt = new URL("https://" + server |
201 | 196 |
+ "?action=" |
202 |
+ ReplicationService.FORCEREPLICATEDELETE
|
|
197 |
+ action
|
|
203 | 198 |
+ "&docid=" + docid + "&server=" |
204 | 199 |
+ MetacatUtil.getLocalReplicationServerName()); |
205 | 200 |
|
... | ... | |
218 | 213 |
+ MetacatUtil.getLocalReplicationServerName() |
219 | 214 |
+ "&docid=" + docid + "&dbaction=" + action); |
220 | 215 |
//over write the url for delete |
221 |
if (action != null && action.equals(DELETE)) {
|
|
216 |
if (action != null && (action.equals(ReplicationService.FORCEREPLICATEDELETE) || action.equals(ReplicationService.FORCEREPLICATEDELETEALL))) {
|
|
222 | 217 |
comeAndGetIt = new URL("https://" + server |
223 | 218 |
+ "?action=" |
224 |
+ ReplicationService.FORCEREPLICATEDELETE
|
|
219 |
+ action
|
|
225 | 220 |
+ "&docid=" + docid + "&server=" |
226 | 221 |
+ MetacatUtil.getLocalReplicationServerName()); |
227 | 222 |
|
... | ... | |
240 | 235 |
+ MetacatUtil.getLocalReplicationServerName() |
241 | 236 |
+ "&docid=" + docid + "&dbaction=" + action); |
242 | 237 |
//over write the url for delete |
243 |
if (action != null && action.equals(DELETE)) {
|
|
238 |
if (action != null && (action.equals(ReplicationService.FORCEREPLICATEDELETE) || action.equals(ReplicationService.FORCEREPLICATEDELETEALL))) {
|
|
244 | 239 |
comeAndGetIt = new URL("https://" + server |
245 | 240 |
+ "?action=" |
246 |
+ ReplicationService.FORCEREPLICATEDELETE
|
|
241 |
+ action
|
|
247 | 242 |
+ "&docid=" + docid + "&server=" |
248 | 243 |
+ MetacatUtil.getLocalReplicationServerName()); |
249 | 244 |
|
... | ... | |
263 | 258 |
+ MetacatUtil.getLocalReplicationServerName() |
264 | 259 |
+ "&docid=" + docid + "&dbaction=" + action); |
265 | 260 |
//over write the url for delete |
266 |
if (action != null && action.equals(DELETE)) {
|
|
261 |
if (action != null && (action.equals(ReplicationService.FORCEREPLICATEDELETE) || action.equals(ReplicationService.FORCEREPLICATEDELETEALL))) {
|
|
267 | 262 |
comeAndGetIt = new URL("https://" + server |
268 | 263 |
+ "?action=" |
269 |
+ ReplicationService.FORCEREPLICATEDELETE
|
|
264 |
+ action
|
|
270 | 265 |
+ "&docid=" + docid + "&server=" |
271 | 266 |
+ MetacatUtil.getLocalReplicationServerName()); |
272 | 267 |
|
src/edu/ucsb/nceas/metacat/replication/ReplicationService.java | ||
---|---|---|
111 | 111 |
private static Vector<String> fileLocks = new Vector<String>(); |
112 | 112 |
// private Thread lockThread = null; |
113 | 113 |
public static final String FORCEREPLICATEDELETE = "forcereplicatedelete"; |
114 |
public static final String FORCEREPLICATEDELETEALL = "forcereplicatedeleteall"; |
|
114 | 115 |
private static String TIMEREPLICATION = "replication.timedreplication"; |
115 | 116 |
private static String TIMEREPLICATIONINTERVAl ="replication.timedreplicationinterval"; |
116 | 117 |
private static String FIRSTTIME = "replication.firsttimedreplication"; |
... | ... | |
721 | 722 |
*/ |
722 | 723 |
protected static void handleForceReplicateDeleteRequest( |
723 | 724 |
Hashtable<String, String[]> params, HttpServletResponse response, |
724 |
HttpServletRequest request) { |
|
725 |
HttpServletRequest request, boolean removeAll) {
|
|
725 | 726 |
String server = ((String[]) params.get("server"))[0]; // the server that |
726 | 727 |
String docid = ((String[]) params.get("docid"))[0]; // sent the document |
727 | 728 |
try { |
... | ... | |
729 | 730 |
logReplication.info("ReplicationService.handleForceReplicateDeleteRequest - force replication delete docid " + docid); |
730 | 731 |
logReplication.info("ReplicationService.handleForceReplicateDeleteRequest - Force replication delete request from: " + server); |
731 | 732 |
logReplication.info("ReplicationService.handleForceReplicateDeleteRequest - Force replication delete docid: " + docid); |
732 |
DocumentImpl.delete(docid, null, null, server, false);
|
|
733 |
DocumentImpl.delete(docid, null, null, server, removeAll);
|
|
733 | 734 |
logReplication.info("ReplicationService.handleForceReplicateDeleteRequest - document " + docid + " was successfully deleted "); |
734 | 735 |
EventLog.getInstance().log(request.getRemoteAddr(), request.getHeader("User-Agent"), REPLICATIONUSER, docid, |
735 | 736 |
"delete"); |
src/edu/ucsb/nceas/metacat/replication/ReplicationServlet.java | ||
---|---|---|
156 | 156 |
ReplicationService.handleForceReplicateRequest(params, response, request); |
157 | 157 |
} else if (action.equals("forcereplicatesystemmetadata")) { |
158 | 158 |
ReplicationService.handleForceReplicateSystemMetadataRequest(params, response, request); |
159 |
} else if (action.equals("forcereplicatedelete")) {
|
|
159 |
} else if (action.equals(ReplicationService.FORCEREPLICATEDELETE)) {
|
|
160 | 160 |
// read a specific docid from remote host, and store it into local host |
161 |
ReplicationService.handleForceReplicateDeleteRequest(params, response, request); |
|
161 |
ReplicationService.handleForceReplicateDeleteRequest(params, response, request, false); |
|
162 |
} else if (action.equals(ReplicationService.FORCEREPLICATEDELETEALL)) { |
|
163 |
// read a specific docid from remote host, and store it into local host |
|
164 |
ReplicationService.handleForceReplicateDeleteRequest(params, response, request, true); |
|
162 | 165 |
} else if (action.equals("update")) { |
163 | 166 |
// request an update list from the server |
164 | 167 |
ReplicationService.handleUpdateRequest(params, response); |
Also available in: Unified diff
support a "force replication delete all action" during replication. This is used when we want Metacat to remove the content from the other target replicas because the DataONE delete() action was called (more powerful than just "archive").