use of diskCacheV111.util.PnfsHandler in project dcache by dCache.
the class ALRPStorageUnitQoSProvider method pnfsHandler.
private PnfsHandler pnfsHandler() {
PnfsHandler pnfsHandler = new PnfsHandler(pnfsManager);
pnfsHandler.setSubject(Subjects.ROOT);
pnfsHandler.setRestriction(Restrictions.none());
return pnfsHandler;
}
use of diskCacheV111.util.PnfsHandler in project dcache by dCache.
the class XrootdDoor method deleteFile.
/**
* Delete the file denoted by path from the namespace
*
* @param path The path of the file that is going to be deleted
* @throws CacheException Deletion of the file failed
* @throws PermissionDeniedCacheException Caller does not have permission to delete the file
*/
public void deleteFile(FsPath path, Subject subject, Restriction restriction) throws PermissionDeniedCacheException, CacheException {
PnfsHandler pnfsHandler = new PnfsHandler(_pnfs, subject, restriction);
if (!isWriteAllowed(path)) {
throw new PermissionDeniedCacheException("Write permission denied");
}
Set<FileType> allowedSet = EnumSet.of(FileType.REGULAR);
PnfsId pnfsId = pnfsHandler.deletePnfsEntry(path.toString(), allowedSet);
sendRemoveInfoToBilling(pnfsId, path, subject);
}
use of diskCacheV111.util.PnfsHandler in project dcache by dCache.
the class XrootdDoor method deleteDirectory.
/**
* Delete the directory denoted by path from the namespace
*
* @param path The path of the directory that is going to be deleted
* @throws CacheException
*/
public void deleteDirectory(FsPath path, Subject subject, Restriction restriction) throws CacheException {
PnfsHandler pnfsHandler = new PnfsHandler(_pnfs, subject, restriction);
if (!isWriteAllowed(path)) {
throw new PermissionDeniedCacheException("Write permission denied");
}
Set<FileType> allowedSet = EnumSet.of(FileType.DIR);
pnfsHandler.deletePnfsEntry(path.toString(), allowedSet);
}
use of diskCacheV111.util.PnfsHandler in project dcache by dCache.
the class XrootdDoor method listPath.
/**
* List the contents of a path, usually a directory. In order to make fragmented responses, as
* supported by the xroot protocol, possible and not block the processing thread in the door,
* this will register the passed callback along with the UUID of the message that is sent to
* PNFS-manager.
* <p>
* Once PNFS-manager replies to the message, that callback is retrieved and the response is
* processed by the callback.
*
* @param path The path that is listed
* @param restriction The Restriction in effect
* @param subject Representation of user that request listing
* @param callback The callback that will process the response
*/
public void listPath(FsPath path, Subject subject, Restriction restriction, MessageCallback<PnfsListDirectoryMessage> callback, EnumSet<FileAttribute> attributes) {
PnfsHandler pnfsHandler = new PnfsHandler(_pnfs, subject, restriction);
PnfsListDirectoryMessage msg = new PnfsListDirectoryMessage(path.toString(), null, Range.<Integer>all(), attributes);
UUID uuid = msg.getUUID();
try {
DirlistRequestHandler requestHandler = new DirlistRequestHandler(uuid, pnfsHandler.getPnfsTimeout(), callback);
_requestHandlers.put(uuid, requestHandler);
pnfsHandler.send(msg);
requestHandler.resetTimeout();
} catch (RejectedExecutionException ree) {
_requestHandlers.remove(uuid);
callback.failure(CacheException.UNEXPECTED_SYSTEM_EXCEPTION, ree.getMessage());
}
}
use of diskCacheV111.util.PnfsHandler in project dcache by dCache.
the class XrootdDoor method getMultipleFileStatuses.
public int[] getMultipleFileStatuses(FsPath[] allPaths, Subject subject, Restriction restriction) throws CacheException {
PnfsHandler pnfsHandler = new PnfsHandler(_pnfs, subject, restriction);
int[] flags = new int[allPaths.length];
// TODO: Use SpreadAndWait
for (int i = 0; i < allPaths.length; i++) {
try {
Set<FileAttribute> requestedAttributes = EnumSet.of(TYPE);
requestedAttributes.addAll(_pdp.getRequiredAttributes());
FileAttributes attributes = pnfsHandler.getFileAttributes(allPaths[i].toString(), requestedAttributes);
flags[i] = getFileStatusFlags(subject, restriction, allPaths[i], attributes);
} catch (CacheException e) {
if (e.getRc() != CacheException.FILE_NOT_FOUND) {
throw e;
}
flags[i] = kXR_other;
}
}
return flags;
}
Aggregations