@Override public FileAttributes setFileAttributes( Subject subject, PnfsId id, FileAttributes attr, Set<FileAttribute> acquire) throws CacheException { PnfsHandler pnfs = new PnfsHandler(_pnfs, subject, Restrictions.none()); return pnfs.setFileAttributes(id, attr, acquire); }
@Override public FileAttributes deleteEntry( Subject subject, Set<FileType> allowed, String path, Set<FileAttribute> attr) throws CacheException { PnfsHandler pnfs = new PnfsHandler(_pnfs, subject, Restrictions.none()); return pnfs.deletePnfsEntry(null, path, allowed, attr); }
@Override public void rename( Subject subject, PnfsId id, String sourcePath, String newName, boolean overwrite) throws CacheException { PnfsHandler pnfs = new PnfsHandler(_pnfs, subject, Restrictions.none()); pnfs.renameEntry(id, sourcePath, newName, overwrite); }
@Override public PnfsId createDirectory(Subject subject, String path, FileAttributes attributes) throws CacheException { PnfsHandler pnfs = new PnfsHandler(_pnfs, subject, Restrictions.none()); attributes.setFileType(DIR); PnfsCreateEntryMessage returnMsg = pnfs.createPnfsDirectory(path, attributes); return returnMsg.getPnfsId(); }
@Override public PnfsId createSymLink(Subject subject, String path, String dest, FileAttributes attributes) throws CacheException { PnfsHandler pnfs = new PnfsHandler(_pnfs, subject, Restrictions.none()); PnfsCreateEntryMessage returnMsg = pnfs.createSymLink(path, dest, attributes); return returnMsg.getPnfsId(); }
@Override public FileAttributes commitUpload( Subject subject, FsPath uploadPath, FsPath pnfsPath, Set<CreateOption> options, Set<FileAttribute> attributes) throws CacheException { PnfsCommitUpload msg = new PnfsCommitUpload( subject, Restrictions.none(), uploadPath, pnfsPath, options, attributes); return _pnfs.request(msg).getFileAttributes(); }
@Override public FileAttributes createFile( Subject subject, String path, FileAttributes assignAttributes, Set<FileAttribute> requestedAttributes) throws CacheException { PnfsHandler pnfs = new PnfsHandler(_pnfs, subject, Restrictions.none()); assignAttributes.setFileType(REGULAR); PnfsCreateEntryMessage message = new PnfsCreateEntryMessage(path, assignAttributes, requestedAttributes); return pnfs.request(message).getFileAttributes(); }
@Override public Collection<FileAttributes> cancelUpload( Subject subject, FsPath uploadPath, FsPath path, Set<FileAttribute> requested, String explanation) throws CacheException { return _pnfs .request( new PnfsCancelUpload( subject, Restrictions.none(), uploadPath, path, requested, explanation)) .getDeletedFiles(); }
@Override public FsPath createUploadPath( Subject subject, FsPath path, FsPath rootPath, Long size, AccessLatency al, RetentionPolicy rp, String spaceToken, Set<CreateOption> options) throws CacheException { PnfsCreateUploadPath msg = new PnfsCreateUploadPath( subject, Restrictions.none(), path, rootPath, size, al, rp, spaceToken, options); return _pnfs.request(msg).getUploadPath(); }
@Override public void list( Subject subject, String path, Glob glob, Range<Integer> range, Set<FileAttribute> attrs, ListHandler handler) throws CacheException { try (DirectoryStream stream = _handler.list(subject, Restrictions.none(), FsPath.create(path), glob, range, attrs)) { for (DirectoryEntry entry : stream) { handler.addEntry(entry.getName(), entry.getFileAttributes()); } } catch (InterruptedException e) { throw new TimeoutCacheException(e.getMessage()); } }
@Override public String pnfsidToPath(Subject subject, PnfsId id) throws CacheException { PnfsHandler pnfs = new PnfsHandler(_pnfs, subject, Restrictions.none()); return pnfs.getPathByPnfsId(id).toString(); }
@Override public List<String> getCacheLocation(Subject subject, PnfsId id) throws CacheException { PnfsHandler pnfs = new PnfsHandler(_pnfs, subject, Restrictions.none()); return pnfs.getCacheLocations(id); }
@Override public void clearCacheLocation(Subject subject, PnfsId id, String pool, boolean removeIfLast) throws CacheException { PnfsHandler pnfs = new PnfsHandler(_pnfs, subject, Restrictions.none()); pnfs.request(new PnfsClearCacheLocationMessage(id, pool, removeIfLast)); }
@Override public void addCacheLocation(Subject subject, PnfsId id, String pool) throws CacheException { PnfsHandler pnfs = new PnfsHandler(_pnfs, subject, Restrictions.none()); pnfs.addCacheLocation(id, pool); }
@Override public void removeChecksum(Subject subject, PnfsId id, ChecksumType type) throws CacheException { PnfsHandler pnfs = new PnfsHandler(_pnfs, subject, Restrictions.none()); pnfs.removeChecksum(id, type); }
@Override public void removeFileAttribute(Subject subject, PnfsId id, String attribute) throws CacheException { PnfsHandler pnfs = new PnfsHandler(_pnfs, subject, Restrictions.none()); pnfs.notify(new PnfsFlagMessage(id, attribute, REMOVE)); }
@Override public PnfsId getParentOf(Subject subject, PnfsId id) throws CacheException { PnfsHandler pnfs = new PnfsHandler(_pnfs, subject, Restrictions.none()); return pnfs.getParentOf(id); }
@Override public PnfsId pathToPnfsid(Subject subject, String path, boolean followLinks) throws CacheException { PnfsHandler pnfs = new PnfsHandler(_pnfs, subject, Restrictions.none()); return pnfs.getPnfsIdByPath(path, followLinks); }