01: // DeletedEntry.java
02: // $Id: DeletedEntry.java,v 1.2 2000/08/16 21:37:32 ylafon Exp $
03: // (c) COPYRIGHT MIT and INRIA, 1998.
04: // Please first read the full copyright statement in file COPYRIGHT.html
05: package org.w3c.jigedit.filters;
06:
07: import org.w3c.tools.resources.Resource;
08: import org.w3c.tools.resources.ResourceReference;
09: import org.w3c.tools.resources.InvalidResourceException;
10: import org.w3c.tools.resources.FileResource;
11:
12: import org.w3c.jigsaw.http.Request;
13:
14: /**
15: * @version $Revision: 1.2 $
16: * @author Benoît Mahé (bmahe@w3.org)
17: */
18: public class DeletedEntry extends PutedEntry {
19:
20: private boolean confirmed = false;
21:
22: public void confirm() {
23: confirmed = true;
24: }
25:
26: public boolean isConfirmed() {
27: return confirmed;
28: }
29:
30: protected String getKey() {
31: return getURL();
32: }
33:
34: static PutedEntry makeEntry(Request request) {
35: ResourceReference rr = request.getTargetResource();
36: Resource r = null;
37: if (rr != null) {
38: try {
39: r = rr.lock();
40: // Build an entry:
41: DeletedEntry e = new DeletedEntry();
42: e.setValue(ATTR_URL, request.getURL().toExternalForm());
43: if (r instanceof FileResource)
44: e.setValue(ATTR_FILENAME, ((FileResource) r)
45: .getFile().getAbsolutePath());
46: // Update other infos:
47: e.update(request);
48: return e;
49: } catch (InvalidResourceException ex) {
50: return null;
51: } finally {
52: rr.unlock();
53: }
54: }
55: return null;
56: }
57:
58: }
|