use of diskCacheV111.vehicles.PnfsMapPathMessage in project dcache by dCache.
the class PnfsManagerV3 method mapPath.
public void mapPath(PnfsMapPathMessage pnfsMessage) {
PnfsId pnfsId = pnfsMessage.getPnfsId();
Subject subject = pnfsMessage.getSubject();
if (pnfsId == null) {
pnfsMessage.setFailed(5, "Illegal Arguments : need pnfsid");
return;
}
try {
LOGGER.info("map: id2path for {}", pnfsId);
String path = pathfinder(subject, pnfsId);
checkRestriction(pnfsMessage, READ_METADATA, FsPath.create(path));
pnfsMessage.setGlobalPath(path);
checkMask(pnfsMessage);
} catch (FileNotFoundCacheException fnf) {
pnfsMessage.setFailed(CacheException.FILE_NOT_FOUND, fnf.getMessage());
} catch (CacheException ce) {
pnfsMessage.setFailed(ce.getRc(), ce.getMessage());
LOGGER.warn("mapPath: {}", ce.getMessage());
} catch (RuntimeException e) {
LOGGER.error("Exception in mapPath (pathfinder) " + e, e);
pnfsMessage.setFailed(CacheException.UNEXPECTED_SYSTEM_EXCEPTION, e);
}
}
use of diskCacheV111.vehicles.PnfsMapPathMessage in project dcache by dCache.
the class RemoteNameSpaceProviderTests method shouldSucceedForPnfsidToPathWithKnownPnfsId.
@Test
public void shouldSucceedForPnfsidToPathWithKnownPnfsId() throws Exception {
givenSuccessfulResponse((Modifier<PnfsMapPathMessage>) (m) -> m.setGlobalPath("/path/to/entry"));
String path = _namespace.pnfsidToPath(ROOT, A_PNFSID);
PnfsMapPathMessage sent = getSingleSendAndWaitMessage(PnfsMapPathMessage.class);
assertThat(sent.getReplyRequired(), is(true));
assertThat(sent.getSubject(), is(ROOT));
assertThat(sent.getGlobalPath(), nullValue());
assertThat(sent.getPnfsId(), is(A_PNFSID));
assertThat(path, is("/path/to/entry"));
}
Aggregations