use of diskCacheV111.util.FsPath in project dcache by dCache.
the class XrootdRedirectHandler method doOnStatx.
@Override
protected XrootdResponse<StatxRequest> doOnStatx(ChannelHandlerContext ctx, StatxRequest req) throws XrootdException {
if (req.getPaths().length == 0) {
throw new XrootdException(kXR_ArgMissing, "no paths specified");
}
try {
FsPath[] paths = new FsPath[req.getPaths().length];
for (int i = 0; i < paths.length; i++) {
paths[i] = createFullPath(req.getPaths()[i]);
}
LoginSessionInfo loginSessionInfo = sessionInfo();
Subject subject = loginSessionInfo.getSubject();
Restriction restriction = loginSessionInfo.getRestriction();
return new StatxResponse(req, _door.getMultipleFileStatuses(paths, subject, restriction));
} catch (TimeoutCacheException e) {
throw xrootdException(e.getRc(), "Internal timeout");
} catch (PermissionDeniedCacheException e) {
throw xrootdException(e);
} catch (CacheException e) {
throw xrootdException(e.getRc(), String.format("Failed to open file (%s [%d])", e.getMessage(), e.getRc()));
}
}
use of diskCacheV111.util.FsPath in project dcache by dCache.
the class XrootdRedirectHandler method doOnDirList.
@Override
protected XrootdResponse<DirListRequest> doOnDirList(ChannelHandlerContext ctx, DirListRequest request) throws XrootdException {
try {
String listPath = request.getPath();
if (listPath.isEmpty()) {
throw new XrootdException(kXR_ArgMissing, "no source path specified");
}
_log.info("Listing directory {}", listPath);
FsPath fullListPath = createFullPath(listPath);
if (!_door.isReadAllowed(fullListPath)) {
throw new PermissionDeniedCacheException("Permission denied.");
}
LoginSessionInfo loginSessionInfo = sessionInfo();
Subject subject = loginSessionInfo.getSubject();
Restriction restriction = loginSessionInfo.getRestriction();
if (request.isDirectoryStat()) {
_door.listPath(fullListPath, subject, restriction, new StatListCallback(request, subject, restriction, fullListPath, ctx), _door.getRequiredAttributesForFileStatus());
} else {
_door.listPath(fullListPath, subject, restriction, new ListCallback(request, ctx), EnumSet.noneOf(FileAttribute.class));
}
return null;
} catch (PermissionDeniedCacheException e) {
throw xrootdException(e);
}
}
use of diskCacheV111.util.FsPath in project dcache by dCache.
the class DcacheResourceFactory method deleteFile.
/**
* Deletes a file.
*/
public void deleteFile(FileAttributes attributes, FsPath path) throws CacheException {
PnfsHandler pnfs = roleAwarePnfsHandler();
pnfs.deletePnfsEntry(attributes.getPnfsId(), path.toString(), EnumSet.of(REGULAR, LINK), EnumSet.noneOf(FileAttribute.class));
sendRemoveInfoToBilling(attributes, path);
}
use of diskCacheV111.util.FsPath in project dcache by dCache.
the class DcacheResourceFactory method deleteDirectory.
/**
* Deletes a directory.
*/
public void deleteDirectory(PnfsId pnfsid, FsPath path) throws CacheException {
PnfsHandler pnfs = roleAwarePnfsHandler();
pnfs.deletePnfsEntry(pnfsid, path.toString(), EnumSet.of(DIR), EnumSet.noneOf(FileAttribute.class));
}
use of diskCacheV111.util.FsPath in project dcache by dCache.
the class DcacheResourceFactory method readExtendedAttributes.
Map<String, byte[]> readExtendedAttributes(FsPath path, Collection<String> names) throws CacheException {
PnfsReadExtendedAttributesMessage message = new PnfsReadExtendedAttributesMessage(path.toString());
names.forEach(message::addName);
return _pnfs.request(message).getAllValues();
}
Aggregations