Package fuse

Examples of fuse.FuseException


    if(!config.isNonSharing()){
      try {
        metadata = namespace.getMetadata(path);

      } catch (DirectoryServiceConnectionProblemException e) {
        throw new FuseException(e.getMessage()).initErrno(FuseException.ECONNABORTED);
      } catch (DirectoryServiceException e) {
        long time = System.currentTimeMillis();
        try {
          metadata = directoryService.getMetadata(path);
        } catch (DirectoryServiceException e1) {
          throw new FuseException(e1.getMessage()).initErrno(FuseException.ENOENT);
        }
        Statistics.incGetMeta(System.currentTimeMillis()-time);
      }
    }else{
      long time = System.currentTimeMillis();
      try {
        metadata = directoryService.getMetadata(path);
      } catch (DirectoryServiceException e1) {
        throw new FuseException(e1.getMessage()).initErrno(FuseException.ENOENT);
      }
      Statistics.incGetMeta(System.currentTimeMillis()-time);
    }
    FileStats stats = metadata.getStats();
    getattrSetter.set(stats.getInode(), stats.getMode(), stats.getNlink(), Integer.parseInt(System.getProperty("uid")), Integer.parseInt(System.getProperty("gid")),
View Full Code Here


        Statistics.incGetDirMeta(System.currentTimeMillis() - time);
        for (NodeMetadata n : nodes) {
          dirFiller.add(n.getName(), n.getStats().getInode(), n.getStats().getMode());
        }
      } catch (DirectoryServiceConnectionProblemException e) {
        throw new FuseException(e.getMessage()).initErrno(FuseException.ECONNABORTED);
      } catch (DirectoryServiceException e) {
        exists=false;
      }
      try {
        for(NodeMetadata n : namespace.getNodeChildren(path)){
          dirFiller.add(n.getName(), n.getStats().getInode(), n.getStats().getMode());
        }
      } catch (DirectoryServiceException e1) {
        if(!exists)
          throw new FuseException(e1.getMessage()).initErrno(FuseException.ENOTDIR);
      }
    }else{
      try {
        long time = System.currentTimeMillis();
        Collection<NodeMetadata> nodes = directoryService.getNodeChildren(path);
        Statistics.incGetDirMeta(System.currentTimeMillis() - time);
        for (NodeMetadata n : nodes) {
          dirFiller.add(n.getName(), n.getStats().getInode(), n.getStats().getMode());
        }
      } catch (DirectoryServiceConnectionProblemException e) {
        throw new FuseException(e.getMessage()).initErrno(FuseException.ECONNABORTED);
      } catch (DirectoryServiceException e) {
        throw new FuseException(e.getMessage()).initErrno(FuseException.ENOTDIR);
      }
    }

    if(path.equals("/"))
      dirFiller.add(".statistics.txt", statistics.getInode(), statistics.getMode());
View Full Code Here

      long time = System.currentTimeMillis();
      directoryService.putMetadata(m);
      Statistics.incPutMeta(System.currentTimeMillis()-time);
      //      }
    } catch (DirectoryServiceConnectionProblemException e) {
      throw new FuseException(e.getMessage()).initErrno(FuseException.ECONNABORTED);
    } catch (DirectoryServiceException e) {
      throw new FuseException("Directory already exists").initErrno(FuseException.EALREADY);
    }

    return 0;
  }
View Full Code Here

      directoryService.putMetadata(m);
      Statistics.incPutMeta(System.currentTimeMillis()-time);

      statfs.blocks = statfs.blocks + (SCFSConstants.BLOCK_SIZE - 1) / SCFSConstants.BLOCK_SIZE;
    } catch (DirectoryServiceConnectionProblemException e) {
      throw new FuseException(e.getMessage()).initErrno(FuseException.ECONNABORTED);
    } catch (DirectoryServiceException e) {
      throw new FuseException(e.getMessage()).initErrno(FuseException.ECONNABORTED);
    catch (Exception e) {
      throw new FuseException("Impossible to create a secure file").initErrno(FuseException.ECONNABORTED);
    }

    return 0;
  }
View Full Code Here

      if ((flags & SCFSConstants.O_ACCMODE) == O_WRONLY || (flags & SCFSConstants.O_ACCMODE) == O_RDWR && !nm.getStats().isPrivate()) { 
        if(lockService.tryAcquire(nm.getId_path(), LOCK_TIME)){
          lockedFiles.put(nm.getId_path(), true);
        }else{
          throw new FuseException("No Lock available.").initErrno(FuseException.ENOLCK);
        }
      }
    }else {
      try {
        long time = System.currentTimeMillis();
        nm = directoryService.getMetadata(path);
        Statistics.incGetMeta(System.currentTimeMillis() - time);
      } catch (DirectoryServiceException e1) {
        throw new FuseException(e1.getMessage()).initErrno(FuseException.ENOENT);
      }
    }


    daS.updateCache(nm.getId_path(), nm.getKey(), nm.getStats().getDataHash(), nm.getStats().isPending());
View Full Code Here

    NodeMetadata nm = null;
    try{
      nm = namespace.getMetadata(path);

    } catch (DirectoryServiceConnectionProblemException e) {
      throw new FuseException(e.getMessage()).initErrno(FuseException.ECONNABORTED);
    }catch (DirectoryServiceException e) {
      try {
        long time = System.currentTimeMillis();
        nm = directoryService.getMetadata(path);
        inPNS=false;
        Statistics.incGetMeta(System.currentTimeMillis() - time);
      } catch (DirectoryServiceException e1) {
        throw new FuseException(e.getMessage()).initErrno(FuseException.ENOENT);
      }
    }
    nm.getStats().setPrivate(inPNS);
    return nm;
View Full Code Here

        Statistics.reset();
      }else
        value = daS.readData(metadata.getId_path(), (int)offset, buf.capacity(), metadata.getKey(), metadata.getStats().getDataHash(), metadata.getStats().isPending());

      if(value == null)
        throw new FuseException("Cannot read.").initErrno(FuseException.EIO);
      try{
        buf.put(value);
      }catch (Exception e) {
      }
    }
View Full Code Here

        a[i] = buf.get();
        i++;
      }
      int size = daS.writeData(metadata.getId_path(), a, (int)offset);
      if(size==-1)
        throw new FuseException("IOException on write.").initErrno(FuseException.ECONNABORTED);

      NodeMetadata meta = null;
      try {
        meta = (NodeMetadata) metadata.clone();
      } catch (CloneNotSupportedException e) { e.printStackTrace()}
      meta.getStats().setSize(size);
      meta.getStats().setPending(false);
      metadata.getStats().setSize(size);
      metadata.getStats().setPending(false);
      if(!config.isNonSharing() && namespace.containsMetadata(path))
        namespace.insertMetadataInBuffer(metadata.getId_path(), meta);
      else
        directoryService.insertMetadataInBuffer(metadata.getId_path(), meta);

    } catch (DirectoryServiceConnectionProblemException e) {
      throw new FuseException(e.getMessage()).initErrno(FuseException.ECONNABORTED);
    } catch (DirectoryServiceException e) {
      throw new FuseException(e.getMessage()).initErrno(FuseException.ECONNABORTED);
    }
    return 0;
  }
View Full Code Here

        try {
          long time = System.currentTimeMillis();
          metadata = directoryService.getMetadata(from);
          Statistics.incGetMeta(System.currentTimeMillis() - time);
        } catch (DirectoryServiceException e1) {
          throw new FuseException(e.getMessage()).initErrno(FuseException.ECONNABORTED);
        }
        isInPNS = false;
      }


      try{
        if(isInPNS){
          namespace.updateMetadata(from, new NodeMetadata(metadata.getNodeType(), vec[0], vec[1], metadata.getStats(), metadata.getId_path(), metadata.getKey(), metadata.getC_r(), metadata.getC_w()));
        }else{
          NodeMetadata node=null;

          node = new NodeMetadata(metadata.getNodeType(), vec[0], vec[1], metadata.getStats(), metadata.getId_path(), metadata.getKey(), metadata.getC_r(), metadata.getC_w());

          long time = System.currentTimeMillis();
          directoryService.updateMetadata(from, node);
          Statistics.incUpdateMeta(System.currentTimeMillis() - time);

        }
      } catch (DirectoryServiceConnectionProblemException e) {
        throw new FuseException(e.getMessage()).initErrno(FuseException.ECONNABORTED);
      } catch (DirectoryServiceException e) {
        throw new FuseException(e.getMessage()).initErrno(FuseException.ECONNABORTED);
      }
    }else{
      try {
        long time = System.currentTimeMillis();
        metadata = directoryService.getMetadata(from);
        Statistics.incGetMeta(System.currentTimeMillis() - time);

        NodeMetadata node=new NodeMetadata(metadata.getNodeType(), vec[0], vec[1], metadata.getStats(), metadata.getId_path(), metadata.getKey(), metadata.getC_r(), metadata.getC_w());

        time = System.currentTimeMillis();
        directoryService.updateMetadata(from, node);
        Statistics.incUpdateMeta(System.currentTimeMillis() - time);
      } catch (DirectoryServiceException e1) {
        throw new FuseException(e1.getMessage()).initErrno(FuseException.ECONNABORTED);
      }
    }

    return 0;
  }
View Full Code Here

        try {
          long time = System.currentTimeMillis();
          metadata = directoryService.getMetadata(path);
          Statistics.incGetMeta(System.currentTimeMillis() - time);
        } catch (DirectoryServiceException e) {
          throw new FuseException(e.getMessage()).initErrno(FuseException.ECONNABORTED);
        }
        isInPNS = false;
      }

      if (mode == metadata.getStats().getMode())
        return 0;

      try {
        FileStats fs = metadata.getStats();
        fs.setMode(mode);
        NodeMetadata node = new NodeMetadata(metadata.getNodeType(), metadata.getParent(), metadata.getName(), fs, metadata.getId_path(), metadata.getKey(), ((mode & SCFSConstants.S_IRGRP) == 0 && (mode & SCFSConstants.S_IROTH) == 0) ? new int[] { clientId } : null, metadata.getC_w());

        if(isInPNS){
          namespace.updateMetadata(path, node);
        }else{
          long time = System.currentTimeMillis();
          directoryService.updateMetadata(path, node);
          Statistics.incUpdateMeta(System.currentTimeMillis() - time);
        }
      } catch (DirectoryServiceConnectionProblemException e) {
        throw new FuseException(e.getMessage()).initErrno(FuseException.ECONNABORTED);
      } catch (DirectoryServiceException e) {
        e.printStackTrace();
        throw new FuseException(e.getMessage()).initErrno(FuseException.ECONNABORTED);
      }
    }else{
      try {
        long time = System.currentTimeMillis();
        metadata = directoryService.getMetadata(path);
        Statistics.incGetMeta(System.currentTimeMillis() - time);

        if (mode == metadata.getStats().getMode())
          return 0;

        FileStats fs = metadata.getStats();
        fs.setMode(mode);
        NodeMetadata node = new NodeMetadata(metadata.getNodeType(), metadata.getParent(), metadata.getName(), fs, metadata.getId_path(), metadata.getKey(), ((mode & SCFSConstants.S_IRGRP) == 0 && (mode & SCFSConstants.S_IROTH) == 0) ? new int[] { clientId } : null, metadata.getC_w());

        time = System.currentTimeMillis();
        directoryService.updateMetadata(path, node);
        Statistics.incUpdateMeta(System.currentTimeMillis() - time);

      } catch (DirectoryServiceException e) {
        throw new FuseException(e.getMessage()).initErrno(FuseException.ECONNABORTED);
      }
    }
    return 0;
  }
View Full Code Here

TOP

Related Classes of fuse.FuseException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.