use of org.dcache.xrootd.protocol.messages.StatxResponse 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 org.dcache.xrootd.protocol.messages.StatxResponse in project xrootd4j by dCache.
the class DataServerHandler method doOnStatx.
@Override
protected StatxResponse doOnStatx(ChannelHandlerContext ctx, StatxRequest req) throws XrootdException {
if (req.getPaths().length == 0) {
throw new XrootdException(kXR_ArgMissing, "no paths specified");
}
String[] paths = req.getPaths();
String[] opaques = req.getOpaques();
int[] flags = new int[paths.length];
for (int i = 0; i < paths.length; i++) {
File file = getFile(paths[i]);
if (!file.exists()) {
flags[i] = kXR_other;
} else {
flags[i] = getFileStatusFlagsOf(file);
}
}
return new StatxResponse(req, flags);
}
Aggregations