Java 类org.apache.hadoop.fs.PathIsNotDirectoryException 实例源码

项目:hadoop-oss    文件:CommandWithDestination.java   
@Override
protected void processArguments(LinkedList<PathData> args)
throws IOException {
  // if more than one arg, the destination must be a directory
  // if one arg, the dst must not exist or must be a directory
  if (args.size() > 1) {
    if (!dst.exists) {
      throw new PathNotFoundException(dst.toString());
    }
    if (!dst.stat.isDirectory()) {
      throw new PathIsNotDirectoryException(dst.toString());
    }
  } else if (dst.exists) {
    if (!dst.stat.isDirectory() && !overwrite) {
      throw new PathExistsException(dst.toString());
    }
  } else if (!dst.parentExists()) {
    throw new PathNotFoundException(dst.toString());
  }
  super.processArguments(args);
}
项目:hadoop    文件:CommandWithDestination.java   
@Override
protected void processArguments(LinkedList<PathData> args)
throws IOException {
  // if more than one arg, the destination must be a directory
  // if one arg, the dst must not exist or must be a directory
  if (args.size() > 1) {
    if (!dst.exists) {
      throw new PathNotFoundException(dst.toString());
    }
    if (!dst.stat.isDirectory()) {
      throw new PathIsNotDirectoryException(dst.toString());
    }
  } else if (dst.exists) {
    if (!dst.stat.isDirectory() && !overwrite) {
      throw new PathExistsException(dst.toString());
    }
  } else if (!dst.parentExists()) {
    throw new PathNotFoundException(dst.toString());
  }
  super.processArguments(args);
}
项目:aliyun-oss-hadoop-fs    文件:CommandWithDestination.java   
@Override
protected void processArguments(LinkedList<PathData> args)
throws IOException {
  // if more than one arg, the destination must be a directory
  // if one arg, the dst must not exist or must be a directory
  if (args.size() > 1) {
    if (!dst.exists) {
      throw new PathNotFoundException(dst.toString());
    }
    if (!dst.stat.isDirectory()) {
      throw new PathIsNotDirectoryException(dst.toString());
    }
  } else if (dst.exists) {
    if (!dst.stat.isDirectory() && !overwrite) {
      throw new PathExistsException(dst.toString());
    }
  } else if (!dst.parentExists()) {
    throw new PathNotFoundException(dst.toString());
  }
  super.processArguments(args);
}
项目:big-c    文件:CommandWithDestination.java   
@Override
protected void processArguments(LinkedList<PathData> args)
throws IOException {
  // if more than one arg, the destination must be a directory
  // if one arg, the dst must not exist or must be a directory
  if (args.size() > 1) {
    if (!dst.exists) {
      throw new PathNotFoundException(dst.toString());
    }
    if (!dst.stat.isDirectory()) {
      throw new PathIsNotDirectoryException(dst.toString());
    }
  } else if (dst.exists) {
    if (!dst.stat.isDirectory() && !overwrite) {
      throw new PathExistsException(dst.toString());
    }
  } else if (!dst.parentExists()) {
    throw new PathNotFoundException(dst.toString());
  }
  super.processArguments(args);
}
项目:hadoop-2.6.0-cdh5.4.3    文件:CommandWithDestination.java   
@Override
protected void processArguments(LinkedList<PathData> args)
throws IOException {
  // if more than one arg, the destination must be a directory
  // if one arg, the dst must not exist or must be a directory
  if (args.size() > 1) {
    if (!dst.exists) {
      throw new PathNotFoundException(dst.toString());
    }
    if (!dst.stat.isDirectory()) {
      throw new PathIsNotDirectoryException(dst.toString());
    }
  } else if (dst.exists) {
    if (!dst.stat.isDirectory() && !overwrite) {
      throw new PathExistsException(dst.toString());
    }
  } else if (!dst.parentExists()) {
    throw new PathNotFoundException(dst.toString());
  }
  super.processArguments(args);
}
项目:hadoop-plus    文件:FSDirectory.java   
/**
 * See {@link ClientProtocol#setQuota(String, long, long)} for the contract.
 * @throws SnapshotAccessControlException if path is in RO snapshot
 * @see #unprotectedSetQuota(String, long, long)
 */
void setQuota(String src, long nsQuota, long dsQuota) 
    throws FileNotFoundException, PathIsNotDirectoryException,
    QuotaExceededException, UnresolvedLinkException,
    SnapshotAccessControlException {
  writeLock();
  try {
    INodeDirectory dir = unprotectedSetQuota(src, nsQuota, dsQuota);
    if (dir != null) {
      fsImage.getEditLog().logSetQuota(src, dir.getNsQuota(), 
                                       dir.getDsQuota());
    }
  } finally {
    writeUnlock();
  }
}
项目:hadoop-plus    文件:CommandWithDestination.java   
@Override
protected void processArguments(LinkedList<PathData> args)
throws IOException {
  // if more than one arg, the destination must be a directory
  // if one arg, the dst must not exist or must be a directory
  if (args.size() > 1) {
    if (!dst.exists) {
      throw new PathNotFoundException(dst.toString());
    }
    if (!dst.stat.isDirectory()) {
      throw new PathIsNotDirectoryException(dst.toString());
    }
  } else if (dst.exists) {
    if (!dst.stat.isDirectory() && !overwrite) {
      throw new PathExistsException(dst.toString());
    }
  } else if (!dst.parentExists()) {
    throw new PathNotFoundException(dst.toString());
  }
  super.processArguments(args);
}
项目:hadoop-plus    文件:CommandWithDestination.java   
@Override
protected void recursePath(PathData src) throws IOException {
  PathData savedDst = dst;
  try {
    // modify dst as we descend to append the basename of the
    // current directory being processed
    dst = getTargetPath(src);
    if (dst.exists) {
      if (!dst.stat.isDirectory()) {
        throw new PathIsNotDirectoryException(dst.toString());
      }
    } else {
      if (!dst.fs.mkdirs(dst.path)) {
        // too bad we have no clue what failed
        PathIOException e = new PathIOException(dst.toString());
        e.setOperation("mkdir");
        throw e;
      }    
      dst.refreshStatus(); // need to update stat to know it exists now
    }      
    super.recursePath(src);
  } finally {
    dst = savedDst;
  }
}
项目:hops    文件:CommandWithDestination.java   
@Override
protected void processArguments(LinkedList<PathData> args)
throws IOException {
  // if more than one arg, the destination must be a directory
  // if one arg, the dst must not exist or must be a directory
  if (args.size() > 1) {
    if (!dst.exists) {
      throw new PathNotFoundException(dst.toString());
    }
    if (!dst.stat.isDirectory()) {
      throw new PathIsNotDirectoryException(dst.toString());
    }
  } else if (dst.exists) {
    if (!dst.stat.isDirectory() && !overwrite) {
      throw new PathExistsException(dst.toString());
    }
  } else if (!dst.parentExists()) {
    throw new PathNotFoundException(dst.toString())
        .withFullyQualifiedPath(dst.path.toUri().toString());
  }
  super.processArguments(args);
}
项目:hadoop-TCP    文件:FSDirectory.java   
/**
 * See {@link ClientProtocol#setQuota(String, long, long)} for the contract.
 * @throws SnapshotAccessControlException if path is in RO snapshot
 * @see #unprotectedSetQuota(String, long, long)
 */
void setQuota(String src, long nsQuota, long dsQuota) 
    throws FileNotFoundException, PathIsNotDirectoryException,
    QuotaExceededException, UnresolvedLinkException,
    SnapshotAccessControlException {
  writeLock();
  try {
    INodeDirectory dir = unprotectedSetQuota(src, nsQuota, dsQuota);
    if (dir != null) {
      fsImage.getEditLog().logSetQuota(src, dir.getNsQuota(), 
                                       dir.getDsQuota());
    }
  } finally {
    writeUnlock();
  }
}
项目:hadoop-TCP    文件:CommandWithDestination.java   
@Override
protected void processArguments(LinkedList<PathData> args)
throws IOException {
  // if more than one arg, the destination must be a directory
  // if one arg, the dst must not exist or must be a directory
  if (args.size() > 1) {
    if (!dst.exists) {
      throw new PathNotFoundException(dst.toString());
    }
    if (!dst.stat.isDirectory()) {
      throw new PathIsNotDirectoryException(dst.toString());
    }
  } else if (dst.exists) {
    if (!dst.stat.isDirectory() && !overwrite) {
      throw new PathExistsException(dst.toString());
    }
  } else if (!dst.parentExists()) {
    throw new PathNotFoundException(dst.toString());
  }
  super.processArguments(args);
}
项目:hadoop-TCP    文件:CommandWithDestination.java   
@Override
protected void recursePath(PathData src) throws IOException {
  PathData savedDst = dst;
  try {
    // modify dst as we descend to append the basename of the
    // current directory being processed
    dst = getTargetPath(src);
    if (dst.exists) {
      if (!dst.stat.isDirectory()) {
        throw new PathIsNotDirectoryException(dst.toString());
      }
    } else {
      if (!dst.fs.mkdirs(dst.path)) {
        // too bad we have no clue what failed
        PathIOException e = new PathIOException(dst.toString());
        e.setOperation("mkdir");
        throw e;
      }    
      dst.refreshStatus(); // need to update stat to know it exists now
    }      
    super.recursePath(src);
  } finally {
    dst = savedDst;
  }
}
项目:hardfs    文件:FSDirectory.java   
/**
 * See {@link ClientProtocol#setQuota(String, long, long)} for the contract.
 * @throws SnapshotAccessControlException if path is in RO snapshot
 * @see #unprotectedSetQuota(String, long, long)
 */
void setQuota(String src, long nsQuota, long dsQuota) 
    throws FileNotFoundException, PathIsNotDirectoryException,
    QuotaExceededException, UnresolvedLinkException,
    SnapshotAccessControlException {
  writeLock();
  try {
    INodeDirectory dir = unprotectedSetQuota(src, nsQuota, dsQuota);
    if (dir != null) {
      fsImage.getEditLog().logSetQuota(src, dir.getNsQuota(), 
                                       dir.getDsQuota());
    }
  } finally {
    writeUnlock();
  }
}
项目:hardfs    文件:CommandWithDestination.java   
@Override
protected void processArguments(LinkedList<PathData> args)
throws IOException {
  // if more than one arg, the destination must be a directory
  // if one arg, the dst must not exist or must be a directory
  if (args.size() > 1) {
    if (!dst.exists) {
      throw new PathNotFoundException(dst.toString());
    }
    if (!dst.stat.isDirectory()) {
      throw new PathIsNotDirectoryException(dst.toString());
    }
  } else if (dst.exists) {
    if (!dst.stat.isDirectory() && !overwrite) {
      throw new PathExistsException(dst.toString());
    }
  } else if (!dst.parentExists()) {
    throw new PathNotFoundException(dst.toString());
  }
  super.processArguments(args);
}
项目:hardfs    文件:CommandWithDestination.java   
@Override
protected void recursePath(PathData src) throws IOException {
  PathData savedDst = dst;
  try {
    // modify dst as we descend to append the basename of the
    // current directory being processed
    dst = getTargetPath(src);
    if (dst.exists) {
      if (!dst.stat.isDirectory()) {
        throw new PathIsNotDirectoryException(dst.toString());
      }
    } else {
      if (!dst.fs.mkdirs(dst.path)) {
        // too bad we have no clue what failed
        PathIOException e = new PathIOException(dst.toString());
        e.setOperation("mkdir");
        throw e;
      }    
      dst.refreshStatus(); // need to update stat to know it exists now
    }      
    super.recursePath(src);
  } finally {
    dst = savedDst;
  }
}
项目:hadoop-on-lustre2    文件:FSDirectory.java   
/**
 * See {@link ClientProtocol#setQuota(String, long, long)} for the contract.
 * @throws SnapshotAccessControlException if path is in RO snapshot
 * @see #unprotectedSetQuota(String, long, long)
 */
void setQuota(String src, long nsQuota, long dsQuota) 
    throws FileNotFoundException, PathIsNotDirectoryException,
    QuotaExceededException, UnresolvedLinkException,
    SnapshotAccessControlException {
  writeLock();
  try {
    INodeDirectory dir = unprotectedSetQuota(src, nsQuota, dsQuota);
    if (dir != null) {
      final Quota.Counts q = dir.getQuotaCounts();
      fsImage.getEditLog().logSetQuota(src,
          q.get(Quota.NAMESPACE), q.get(Quota.DISKSPACE));
    }
  } finally {
    writeUnlock();
  }
}
项目:hadoop-on-lustre2    文件:CommandWithDestination.java   
@Override
protected void processArguments(LinkedList<PathData> args)
throws IOException {
  // if more than one arg, the destination must be a directory
  // if one arg, the dst must not exist or must be a directory
  if (args.size() > 1) {
    if (!dst.exists) {
      throw new PathNotFoundException(dst.toString());
    }
    if (!dst.stat.isDirectory()) {
      throw new PathIsNotDirectoryException(dst.toString());
    }
  } else if (dst.exists) {
    if (!dst.stat.isDirectory() && !overwrite) {
      throw new PathExistsException(dst.toString());
    }
  } else if (!dst.parentExists()) {
    throw new PathNotFoundException(dst.toString());
  }
  super.processArguments(args);
}
项目:hadoop-on-lustre2    文件:CommandWithDestination.java   
@Override
protected void recursePath(PathData src) throws IOException {
  PathData savedDst = dst;
  try {
    // modify dst as we descend to append the basename of the
    // current directory being processed
    dst = getTargetPath(src);
    if (dst.exists) {
      if (!dst.stat.isDirectory()) {
        throw new PathIsNotDirectoryException(dst.toString());
      }
    } else {
      if (!dst.fs.mkdirs(dst.path)) {
        // too bad we have no clue what failed
        PathIOException e = new PathIOException(dst.toString());
        e.setOperation("mkdir");
        throw e;
      }    
      dst.refreshStatus(); // need to update stat to know it exists now
    }      
    super.recursePath(src);
  } finally {
    dst = savedDst;
  }
}
项目:hadoop-oss    文件:Delete.java   
@Override
protected void processPath(PathData item) throws IOException {
  if (!item.stat.isDirectory()) {
    throw new PathIsNotDirectoryException(item.toString());
  }      
  if (item.fs.listStatus(item.path).length == 0) {
    if (!item.fs.delete(item.path, false)) {
      throw new PathIOException(item.toString());
    }
  } else if (!ignoreNonEmpty) {
    throw new PathIsNotEmptyDirectoryException(item.toString());
  }
}
项目:hadoop-oss    文件:CommandWithDestination.java   
@Override
protected void recursePath(PathData src) throws IOException {
  PathData savedDst = dst;
  try {
    // modify dst as we descend to append the basename of the
    // current directory being processed
    dst = getTargetPath(src);
    final boolean preserveRawXattrs =
        checkPathsForReservedRaw(src.path, dst.path);
    if (dst.exists) {
      if (!dst.stat.isDirectory()) {
        throw new PathIsNotDirectoryException(dst.toString());
      }
    } else {
      if (!dst.fs.mkdirs(dst.path)) {
        // too bad we have no clue what failed
        PathIOException e = new PathIOException(dst.toString());
        e.setOperation("mkdir");
        throw e;
      }    
      dst.refreshStatus(); // need to update stat to know it exists now
    }      
    super.recursePath(src);
    if (dst.stat.isDirectory()) {
      preserveAttributes(src, dst, preserveRawXattrs);
    }
  } finally {
    dst = savedDst;
  }
}
项目:hadoop-oss    文件:PathData.java   
/**
 * Ensure that the file exists and if it is or is not a directory
 * @param typeRequirement Set it to the desired requirement.
 * @throws PathIOException if file doesn't exist or the type does not match
 * what was specified in typeRequirement.
 */
private void checkIfExists(FileTypeRequirement typeRequirement) 
throws PathIOException {
  if (!exists) {
    throw new PathNotFoundException(toString());      
  }

  if ((typeRequirement == FileTypeRequirement.SHOULD_BE_DIRECTORY)
     && !stat.isDirectory()) {
    throw new PathIsNotDirectoryException(toString());
  } else if ((typeRequirement == FileTypeRequirement.SHOULD_NOT_BE_DIRECTORY)
            && stat.isDirectory()) {
    throw new PathIsDirectoryException(toString());
  }
}
项目:hadoop-oss    文件:Mkdir.java   
@Override
protected void processPath(PathData item) throws IOException {
  if (item.stat.isDirectory()) {
    if (!createParents) {
      throw new PathExistsException(item.toString());
    }
  } else {
    throw new PathIsNotDirectoryException(item.toString());
  }
}
项目:hadoop    文件:INodeDirectory.java   
/** Cast INode to INodeDirectory. */
public static INodeDirectory valueOf(INode inode, Object path
    ) throws FileNotFoundException, PathIsNotDirectoryException {
  if (inode == null) {
    throw new FileNotFoundException("Directory does not exist: "
        + DFSUtil.path2String(path));
  }
  if (!inode.isDirectory()) {
    throw new PathIsNotDirectoryException(DFSUtil.path2String(path));
  }
  return inode.asDirectory(); 
}
项目:hadoop    文件:FSImageFormat.java   
private INodeDirectory getParentINodeDirectory(byte[][] pathComponents
    ) throws FileNotFoundException, PathIsNotDirectoryException,
    UnresolvedLinkException {
  if (pathComponents.length < 2) { // root
    return null;
  }
  // Gets the parent INode
  final INodesInPath inodes = namesystem.dir.getExistingPathINodes(
      pathComponents);
  return INodeDirectory.valueOf(inodes.getINode(-2), pathComponents);
}
项目:hadoop    文件:Delete.java   
@Override
protected void processPath(PathData item) throws IOException {
  if (!item.stat.isDirectory()) {
    throw new PathIsNotDirectoryException(item.toString());
  }      
  if (item.fs.listStatus(item.path).length == 0) {
    if (!item.fs.delete(item.path, false)) {
      throw new PathIOException(item.toString());
    }
  } else if (!ignoreNonEmpty) {
    throw new PathIsNotEmptyDirectoryException(item.toString());
  }
}
项目:hadoop    文件:CommandWithDestination.java   
@Override
protected void recursePath(PathData src) throws IOException {
  PathData savedDst = dst;
  try {
    // modify dst as we descend to append the basename of the
    // current directory being processed
    dst = getTargetPath(src);
    final boolean preserveRawXattrs =
        checkPathsForReservedRaw(src.path, dst.path);
    if (dst.exists) {
      if (!dst.stat.isDirectory()) {
        throw new PathIsNotDirectoryException(dst.toString());
      }
    } else {
      if (!dst.fs.mkdirs(dst.path)) {
        // too bad we have no clue what failed
        PathIOException e = new PathIOException(dst.toString());
        e.setOperation("mkdir");
        throw e;
      }    
      dst.refreshStatus(); // need to update stat to know it exists now
    }      
    super.recursePath(src);
    if (dst.stat.isDirectory()) {
      preserveAttributes(src, dst, preserveRawXattrs);
    }
  } finally {
    dst = savedDst;
  }
}
项目:hadoop    文件:PathData.java   
/**
 * Ensure that the file exists and if it is or is not a directory
 * @param typeRequirement Set it to the desired requirement.
 * @throws PathIOException if file doesn't exist or the type does not match
 * what was specified in typeRequirement.
 */
private void checkIfExists(FileTypeRequirement typeRequirement) 
throws PathIOException {
  if (!exists) {
    throw new PathNotFoundException(toString());      
  }

  if ((typeRequirement == FileTypeRequirement.SHOULD_BE_DIRECTORY)
     && !stat.isDirectory()) {
    throw new PathIsNotDirectoryException(toString());
  } else if ((typeRequirement == FileTypeRequirement.SHOULD_NOT_BE_DIRECTORY)
            && stat.isDirectory()) {
    throw new PathIsDirectoryException(toString());
  }
}
项目:hadoop    文件:Mkdir.java   
@Override
protected void processPath(PathData item) throws IOException {
  if (item.stat.isDirectory()) {
    if (!createParents) {
      throw new PathExistsException(item.toString());
    }
  } else {
    throw new PathIsNotDirectoryException(item.toString());
  }
}
项目:aliyun-oss-hadoop-fs    文件:INodeDirectory.java   
/** Cast INode to INodeDirectory. */
public static INodeDirectory valueOf(INode inode, Object path
    ) throws FileNotFoundException, PathIsNotDirectoryException {
  if (inode == null) {
    throw new FileNotFoundException("Directory does not exist: "
        + DFSUtil.path2String(path));
  }
  if (!inode.isDirectory()) {
    throw new PathIsNotDirectoryException(DFSUtil.path2String(path));
  }
  return inode.asDirectory(); 
}
项目:aliyun-oss-hadoop-fs    文件:FSImageFormat.java   
private INodeDirectory getParentINodeDirectory(byte[][] pathComponents
    ) throws FileNotFoundException, PathIsNotDirectoryException,
    UnresolvedLinkException {
  if (pathComponents.length < 2) { // root
    return null;
  }
  // Gets the parent INode
  final INodesInPath inodes = namesystem.dir.getExistingPathINodes(
      pathComponents);
  return INodeDirectory.valueOf(inodes.getINode(-2), pathComponents);
}
项目:aliyun-oss-hadoop-fs    文件:Delete.java   
@Override
protected void processPath(PathData item) throws IOException {
  if (!item.stat.isDirectory()) {
    throw new PathIsNotDirectoryException(item.toString());
  }      
  if (item.fs.listStatus(item.path).length == 0) {
    if (!item.fs.delete(item.path, false)) {
      throw new PathIOException(item.toString());
    }
  } else if (!ignoreNonEmpty) {
    throw new PathIsNotEmptyDirectoryException(item.toString());
  }
}
项目:aliyun-oss-hadoop-fs    文件:CommandWithDestination.java   
@Override
protected void recursePath(PathData src) throws IOException {
  PathData savedDst = dst;
  try {
    // modify dst as we descend to append the basename of the
    // current directory being processed
    dst = getTargetPath(src);
    final boolean preserveRawXattrs =
        checkPathsForReservedRaw(src.path, dst.path);
    if (dst.exists) {
      if (!dst.stat.isDirectory()) {
        throw new PathIsNotDirectoryException(dst.toString());
      }
    } else {
      if (!dst.fs.mkdirs(dst.path)) {
        // too bad we have no clue what failed
        PathIOException e = new PathIOException(dst.toString());
        e.setOperation("mkdir");
        throw e;
      }    
      dst.refreshStatus(); // need to update stat to know it exists now
    }      
    super.recursePath(src);
    if (dst.stat.isDirectory()) {
      preserveAttributes(src, dst, preserveRawXattrs);
    }
  } finally {
    dst = savedDst;
  }
}
项目:aliyun-oss-hadoop-fs    文件:PathData.java   
/**
 * Ensure that the file exists and if it is or is not a directory
 * @param typeRequirement Set it to the desired requirement.
 * @throws PathIOException if file doesn't exist or the type does not match
 * what was specified in typeRequirement.
 */
private void checkIfExists(FileTypeRequirement typeRequirement) 
throws PathIOException {
  if (!exists) {
    throw new PathNotFoundException(toString());      
  }

  if ((typeRequirement == FileTypeRequirement.SHOULD_BE_DIRECTORY)
     && !stat.isDirectory()) {
    throw new PathIsNotDirectoryException(toString());
  } else if ((typeRequirement == FileTypeRequirement.SHOULD_NOT_BE_DIRECTORY)
            && stat.isDirectory()) {
    throw new PathIsDirectoryException(toString());
  }
}
项目:aliyun-oss-hadoop-fs    文件:Mkdir.java   
@Override
protected void processPath(PathData item) throws IOException {
  if (item.stat.isDirectory()) {
    if (!createParents) {
      throw new PathExistsException(item.toString());
    }
  } else {
    throw new PathIsNotDirectoryException(item.toString());
  }
}
项目:big-c    文件:INodeDirectory.java   
/** Cast INode to INodeDirectory. */
public static INodeDirectory valueOf(INode inode, Object path
    ) throws FileNotFoundException, PathIsNotDirectoryException {
  if (inode == null) {
    throw new FileNotFoundException("Directory does not exist: "
        + DFSUtil.path2String(path));
  }
  if (!inode.isDirectory()) {
    throw new PathIsNotDirectoryException(DFSUtil.path2String(path));
  }
  return inode.asDirectory(); 
}
项目:big-c    文件:FSImageFormat.java   
private INodeDirectory getParentINodeDirectory(byte[][] pathComponents
    ) throws FileNotFoundException, PathIsNotDirectoryException,
    UnresolvedLinkException {
  if (pathComponents.length < 2) { // root
    return null;
  }
  // Gets the parent INode
  final INodesInPath inodes = namesystem.dir.getExistingPathINodes(
      pathComponents);
  return INodeDirectory.valueOf(inodes.getINode(-2), pathComponents);
}
项目:big-c    文件:Delete.java   
@Override
protected void processPath(PathData item) throws IOException {
  if (!item.stat.isDirectory()) {
    throw new PathIsNotDirectoryException(item.toString());
  }      
  if (item.fs.listStatus(item.path).length == 0) {
    if (!item.fs.delete(item.path, false)) {
      throw new PathIOException(item.toString());
    }
  } else if (!ignoreNonEmpty) {
    throw new PathIsNotEmptyDirectoryException(item.toString());
  }
}
项目:big-c    文件:CommandWithDestination.java   
@Override
protected void recursePath(PathData src) throws IOException {
  PathData savedDst = dst;
  try {
    // modify dst as we descend to append the basename of the
    // current directory being processed
    dst = getTargetPath(src);
    final boolean preserveRawXattrs =
        checkPathsForReservedRaw(src.path, dst.path);
    if (dst.exists) {
      if (!dst.stat.isDirectory()) {
        throw new PathIsNotDirectoryException(dst.toString());
      }
    } else {
      if (!dst.fs.mkdirs(dst.path)) {
        // too bad we have no clue what failed
        PathIOException e = new PathIOException(dst.toString());
        e.setOperation("mkdir");
        throw e;
      }    
      dst.refreshStatus(); // need to update stat to know it exists now
    }      
    super.recursePath(src);
    if (dst.stat.isDirectory()) {
      preserveAttributes(src, dst, preserveRawXattrs);
    }
  } finally {
    dst = savedDst;
  }
}
项目:big-c    文件:PathData.java   
/**
 * Ensure that the file exists and if it is or is not a directory
 * @param typeRequirement Set it to the desired requirement.
 * @throws PathIOException if file doesn't exist or the type does not match
 * what was specified in typeRequirement.
 */
private void checkIfExists(FileTypeRequirement typeRequirement) 
throws PathIOException {
  if (!exists) {
    throw new PathNotFoundException(toString());      
  }

  if ((typeRequirement == FileTypeRequirement.SHOULD_BE_DIRECTORY)
     && !stat.isDirectory()) {
    throw new PathIsNotDirectoryException(toString());
  } else if ((typeRequirement == FileTypeRequirement.SHOULD_NOT_BE_DIRECTORY)
            && stat.isDirectory()) {
    throw new PathIsDirectoryException(toString());
  }
}
项目:big-c    文件:Mkdir.java   
@Override
protected void processPath(PathData item) throws IOException {
  if (item.stat.isDirectory()) {
    if (!createParents) {
      throw new PathExistsException(item.toString());
    }
  } else {
    throw new PathIsNotDirectoryException(item.toString());
  }
}