Search in sources :

Example 1 with NoEntException

use of org.dcache.nfs.status.NoEntException in project dcache by dCache.

the class ChimeraVfs method lookup.

@Override
public Inode lookup(Inode parent, String path) throws IOException {
    try {
        FsInode parentFsInode = toFsInode(parent);
        FsInode fsInode = parentFsInode.inodeOf(path, NO_STAT);
        return toInode(fsInode);
    } catch (FileNotFoundChimeraFsException e) {
        throw new NoEntException("Path Do not exist.");
    }
}
Also used : FileNotFoundChimeraFsException(org.dcache.chimera.FileNotFoundChimeraFsException) FsInode(org.dcache.chimera.FsInode) NoEntException(org.dcache.nfs.status.NoEntException)

Example 2 with NoEntException

use of org.dcache.nfs.status.NoEntException in project dcache by dCache.

the class ChimeraVfs method move.

@Override
public boolean move(Inode src, String oldName, Inode dest, String newName) throws IOException {
    FsInode from = toFsInode(src);
    FsInode to = toFsInode(dest);
    try {
        return _fs.rename(_fs.inodeOf(from, oldName, NO_STAT), from, oldName, to, newName);
    } catch (NotDirChimeraException e) {
        throw new NotDirException("not a directory");
    } catch (FileExistsChimeraFsException e) {
        throw new ExistException("destination exists");
    } catch (DirNotEmptyChimeraFsException e) {
        throw new NotEmptyException("directory exist and not empty");
    } catch (FileNotFoundChimeraFsException e) {
        throw new NoEntException("file not found");
    } catch (PermissionDeniedChimeraFsException e) {
        throw new PermException(e.getMessage());
    }
}
Also used : FileNotFoundChimeraFsException(org.dcache.chimera.FileNotFoundChimeraFsException) NotDirException(org.dcache.nfs.status.NotDirException) PermissionDeniedChimeraFsException(org.dcache.chimera.PermissionDeniedChimeraFsException) NotDirChimeraException(org.dcache.chimera.NotDirChimeraException) FsInode(org.dcache.chimera.FsInode) NoEntException(org.dcache.nfs.status.NoEntException) PermException(org.dcache.nfs.status.PermException) NotEmptyException(org.dcache.nfs.status.NotEmptyException) DirNotEmptyChimeraFsException(org.dcache.chimera.DirNotEmptyChimeraFsException) ExistException(org.dcache.nfs.status.ExistException) FileExistsChimeraFsException(org.dcache.chimera.FileExistsChimeraFsException)

Example 3 with NoEntException

use of org.dcache.nfs.status.NoEntException in project dcache by dCache.

the class MonitoringVfs method remove.

@Override
public void remove(Inode parent, String name) throws IOException {
    Optional<PnfsId> parentId = toPnfsId(parent);
    Optional<PnfsId> target;
    FileType type = FileType.SPECIAL;
    try {
        Inode targetInode = super.lookup(parent, name);
        type = asFileType(super.getattr(targetInode).type());
        target = toPnfsId(targetInode);
    } catch (NoEntException ignored) {
        // don't send event.
        target = Optional.empty();
        // don't send event.
        parentId = Optional.empty();
    } catch (IOException e) {
        LOGGER.warn("Problem looking up {} in inode {}: {}", name, parent, e.toString());
        // don't send event.
        target = Optional.empty();
        // don't send event.
        parentId = Optional.empty();
    }
    /* REVISIT: update VirtualFileSystem#remove to return attributes of delete item? */
    super.remove(parent, name);
    FileType t = type;
    parentId.ifPresent(id -> eventReceiver.notifyChildEvent(IN_DELETE, id, name, t));
    target.ifPresent(id -> eventReceiver.notifySelfEvent(IN_DELETE_SELF, id, t));
}
Also used : FsInode(org.dcache.chimera.FsInode) Inode(org.dcache.nfs.vfs.Inode) FileType(org.dcache.namespace.FileType) PnfsId(diskCacheV111.util.PnfsId) NoEntException(org.dcache.nfs.status.NoEntException) IOException(java.io.IOException)

Aggregations

FsInode (org.dcache.chimera.FsInode)3 NoEntException (org.dcache.nfs.status.NoEntException)3 FileNotFoundChimeraFsException (org.dcache.chimera.FileNotFoundChimeraFsException)2 PnfsId (diskCacheV111.util.PnfsId)1 IOException (java.io.IOException)1 DirNotEmptyChimeraFsException (org.dcache.chimera.DirNotEmptyChimeraFsException)1 FileExistsChimeraFsException (org.dcache.chimera.FileExistsChimeraFsException)1 NotDirChimeraException (org.dcache.chimera.NotDirChimeraException)1 PermissionDeniedChimeraFsException (org.dcache.chimera.PermissionDeniedChimeraFsException)1 FileType (org.dcache.namespace.FileType)1 ExistException (org.dcache.nfs.status.ExistException)1 NotDirException (org.dcache.nfs.status.NotDirException)1 NotEmptyException (org.dcache.nfs.status.NotEmptyException)1 PermException (org.dcache.nfs.status.PermException)1 Inode (org.dcache.nfs.vfs.Inode)1