| 1 | // $Id: PnfsDeleteEntryMessage.java,v 1.3 2005-01-14 13:56:25 tigran Exp $ |
| 2 | |
| 3 | package diskCacheV111.vehicles; |
| 4 | import diskCacheV111.util.PnfsId; |
| 5 | |
| 6 | import java.util.Set; |
| 7 | import java.util.EnumSet; |
| 8 | |
| 9 | import org.dcache.namespace.FileType; |
| 10 | |
| 11 | public class PnfsDeleteEntryMessage extends PnfsMessage |
| 12 | { |
| 13 | private static final long serialVersionUID = 7375207858020099787L; |
| 14 | |
| 15 | /** Path of entry to delete. */ |
| 16 | private final String _path; |
| 17 | |
| 18 | /** |
| 19 | * Allowed FileTypes to delete. If the entry is not of this type, |
| 20 | * then the operation will fail. |
| 21 | */ |
| 22 | private final Set<FileType> _allowed; |
| 23 | |
| 24 | public PnfsDeleteEntryMessage(String path) |
| 25 | { |
| 26 | this(null, path); |
| 27 | } |
| 28 | |
| 29 | public PnfsDeleteEntryMessage(PnfsId pnfsId) |
| 30 | { |
| 31 | this(pnfsId, (String) null); |
| 32 | } |
| 33 | |
| 34 | public PnfsDeleteEntryMessage(PnfsId pnfsId, String path) |
| 35 | { |
| 36 | this(pnfsId, path, EnumSet.allOf(FileType.class)); |
| 37 | } |
| 38 | |
| 39 | public PnfsDeleteEntryMessage(String path, Set<FileType> allowed) |
| 40 | { |
| 41 | this(null, path, allowed); |
| 42 | } |
| 43 | |
| 44 | public PnfsDeleteEntryMessage(PnfsId pnfsId, Set<FileType> allowed) |
| 45 | { |
| 46 | this(pnfsId, null, allowed); |
| 47 | } |
| 48 | |
| 49 | public PnfsDeleteEntryMessage(PnfsId pnfsId, String path, |
| 50 | Set<FileType> allowed) |
| 51 | { |
| 52 | super(pnfsId); |
| 53 | _allowed = allowed; |
| 54 | _path = path; |
| 55 | setPnfsPath(path); |
| 56 | setReplyRequired(false); |
| 57 | } |
| 58 | |
| 59 | public String getPath() |
| 60 | { |
| 61 | return _path; |
| 62 | } |
| 63 | |
| 64 | public Set<FileType> getAllowedFileTypes() |
| 65 | { |
| 66 | return (_allowed == null) ? EnumSet.allOf(FileType.class) : _allowed; |
| 67 | } |
| 68 | } |