当前位置: 首页>>代码示例>>Java>>正文


Java PathIsNotDirectoryException类代码示例

本文整理汇总了Java中org.apache.hadoop.fs.PathIsNotDirectoryException的典型用法代码示例。如果您正苦于以下问题:Java PathIsNotDirectoryException类的具体用法?Java PathIsNotDirectoryException怎么用?Java PathIsNotDirectoryException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


PathIsNotDirectoryException类属于org.apache.hadoop.fs包,在下文中一共展示了PathIsNotDirectoryException类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: processArguments

import org.apache.hadoop.fs.PathIsNotDirectoryException; //导入依赖的package包/类
@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);
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:22,代码来源:CommandWithDestination.java

示例2: setQuota

import org.apache.hadoop.fs.PathIsNotDirectoryException; //导入依赖的package包/类
/**
 * 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();
  }
}
 
开发者ID:ict-carch,项目名称:hadoop-plus,代码行数:21,代码来源:FSDirectory.java

示例3: recursePath

import org.apache.hadoop.fs.PathIsNotDirectoryException; //导入依赖的package包/类
@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;
  }
}
 
开发者ID:ict-carch,项目名称:hadoop-plus,代码行数:26,代码来源:CommandWithDestination.java

示例4: processArguments

import org.apache.hadoop.fs.PathIsNotDirectoryException; //导入依赖的package包/类
@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);
}
 
开发者ID:hopshadoop,项目名称:hops,代码行数:23,代码来源:CommandWithDestination.java

示例5: setQuota

import org.apache.hadoop.fs.PathIsNotDirectoryException; //导入依赖的package包/类
/**
 * 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();
  }
}
 
开发者ID:Seagate,项目名称:hadoop-on-lustre2,代码行数:22,代码来源:FSDirectory.java

示例6: processPath

import org.apache.hadoop.fs.PathIsNotDirectoryException; //导入依赖的package包/类
@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());
  }
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:14,代码来源:Delete.java

示例7: recursePath

import org.apache.hadoop.fs.PathIsNotDirectoryException; //导入依赖的package包/类
@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;
  }
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:31,代码来源:CommandWithDestination.java

示例8: checkIfExists

import org.apache.hadoop.fs.PathIsNotDirectoryException; //导入依赖的package包/类
/**
 * 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());
  }
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:21,代码来源:PathData.java

示例9: processPath

import org.apache.hadoop.fs.PathIsNotDirectoryException; //导入依赖的package包/类
@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());
  }
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:11,代码来源:Mkdir.java

示例10: valueOf

import org.apache.hadoop.fs.PathIsNotDirectoryException; //导入依赖的package包/类
/** 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(); 
}
 
开发者ID:naver,项目名称:hadoop,代码行数:13,代码来源:INodeDirectory.java

示例11: getParentINodeDirectory

import org.apache.hadoop.fs.PathIsNotDirectoryException; //导入依赖的package包/类
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);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:12,代码来源:FSImageFormat.java


注:本文中的org.apache.hadoop.fs.PathIsNotDirectoryException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。