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


Java PathData类代码示例

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


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

示例1: isPathRecursable

import org.apache.hadoop.fs.shell.PathData; //导入依赖的package包/类
@Override
protected boolean isPathRecursable(PathData item) throws IOException {
  if (item.stat.isDirectory()) {
    return true;
  }
  if (item.stat.isSymlink()) {
    PathData linkedItem =
        new PathData(item.fs.resolvePath(item.stat.getSymlink()).toString(),
            getConf());
    if (linkedItem.stat.isDirectory()) {
      if (getOptions().isFollowLink()) {
        return true;
      }
      if (getOptions().isFollowArgLink() && (getDepth() == 0)) {
        return true;
      }
    }
  }
  return false;
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:21,代码来源:Find.java

示例2: processPath

import org.apache.hadoop.fs.shell.PathData; //导入依赖的package包/类
@Override
protected void processPath(PathData item) throws IOException {
  //Should we do case insensitive match?
  String newOwner = (owner == null || owner.equals(item.stat.getOwner())) ?
                    null : owner;
  String newGroup = (group == null || group.equals(item.stat.getGroup())) ?
                    null : group;

  if (newOwner != null || newGroup != null) {
    try {
      item.fs.setOwner(item.path, newOwner, newGroup);
    } catch (IOException e) {
      LOG.debug("Error changing ownership of " + item, e);
      throw new IOException(
          "changing ownership of '" + item + "': " + e.getMessage());
    }
  }
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:19,代码来源:FsShellPermissions.java

示例3: testFailFirst

import org.apache.hadoop.fs.shell.PathData; //导入依赖的package包/类
@Test(timeout = 1000)
public void testFailFirst() throws IOException {
  And and = new And();

  PathData pathData = mock(PathData.class);

  Expression first = mock(Expression.class);
  when(first.apply(pathData, -1)).thenReturn(Result.FAIL);

  Expression second = mock(Expression.class);
  when(second.apply(pathData, -1)).thenReturn(Result.PASS);

  Deque<Expression> children = new LinkedList<Expression>();
  children.add(second);
  children.add(first);
  and.addChildren(children);

  assertEquals(Result.FAIL, and.apply(pathData, -1));
  verify(first).apply(pathData, -1);
  verifyNoMoreInteractions(first);
  verifyNoMoreInteractions(second);
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:23,代码来源:TestAnd.java

示例4: testFailSecond

import org.apache.hadoop.fs.shell.PathData; //导入依赖的package包/类
@Test(timeout = 1000)
public void testFailSecond() throws IOException {
  And and = new And();

  PathData pathData = mock(PathData.class);

  Expression first = mock(Expression.class);
  when(first.apply(pathData, -1)).thenReturn(Result.PASS);

  Expression second = mock(Expression.class);
  when(second.apply(pathData, -1)).thenReturn(Result.FAIL);

  Deque<Expression> children = new LinkedList<Expression>();
  children.add(second);
  children.add(first);
  and.addChildren(children);

  assertEquals(Result.FAIL, and.apply(pathData, -1));
  verify(first).apply(pathData, -1);
  verify(second).apply(pathData, -1);
  verifyNoMoreInteractions(first);
  verifyNoMoreInteractions(second);
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:24,代码来源:TestAnd.java

示例5: testFailBoth

import org.apache.hadoop.fs.shell.PathData; //导入依赖的package包/类
@Test(timeout = 1000)
public void testFailBoth() throws IOException {
  And and = new And();

  PathData pathData = mock(PathData.class);

  Expression first = mock(Expression.class);
  when(first.apply(pathData, -1)).thenReturn(Result.FAIL);

  Expression second = mock(Expression.class);
  when(second.apply(pathData, -1)).thenReturn(Result.FAIL);

  Deque<Expression> children = new LinkedList<Expression>();
  children.add(second);
  children.add(first);
  and.addChildren(children);

  assertEquals(Result.FAIL, and.apply(pathData, -1));
  verify(first).apply(pathData, -1);
  verifyNoMoreInteractions(first);
  verifyNoMoreInteractions(second);
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:23,代码来源:TestAnd.java

示例6: testStopFirst

import org.apache.hadoop.fs.shell.PathData; //导入依赖的package包/类
@Test(timeout = 1000)
public void testStopFirst() throws IOException {
  And and = new And();

  PathData pathData = mock(PathData.class);

  Expression first = mock(Expression.class);
  when(first.apply(pathData, -1)).thenReturn(Result.STOP);

  Expression second = mock(Expression.class);
  when(second.apply(pathData, -1)).thenReturn(Result.PASS);

  Deque<Expression> children = new LinkedList<Expression>();
  children.add(second);
  children.add(first);
  and.addChildren(children);

  assertEquals(Result.STOP, and.apply(pathData, -1));
  verify(first).apply(pathData, -1);
  verify(second).apply(pathData, -1);
  verifyNoMoreInteractions(first);
  verifyNoMoreInteractions(second);
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:24,代码来源:TestAnd.java

示例7: testStopSecond

import org.apache.hadoop.fs.shell.PathData; //导入依赖的package包/类
@Test(timeout = 1000)
public void testStopSecond() throws IOException {
  And and = new And();

  PathData pathData = mock(PathData.class);

  Expression first = mock(Expression.class);
  when(first.apply(pathData, -1)).thenReturn(Result.PASS);

  Expression second = mock(Expression.class);
  when(second.apply(pathData, -1)).thenReturn(Result.STOP);

  Deque<Expression> children = new LinkedList<Expression>();
  children.add(second);
  children.add(first);
  and.addChildren(children);

  assertEquals(Result.STOP, and.apply(pathData, -1));
  verify(first).apply(pathData, -1);
  verify(second).apply(pathData, -1);
  verifyNoMoreInteractions(first);
  verifyNoMoreInteractions(second);
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:24,代码来源:TestAnd.java

示例8: testStopFail

import org.apache.hadoop.fs.shell.PathData; //导入依赖的package包/类
@Test(timeout = 1000)
public void testStopFail() throws IOException {
  And and = new And();

  PathData pathData = mock(PathData.class);

  Expression first = mock(Expression.class);
  when(first.apply(pathData, -1)).thenReturn(Result.STOP);

  Expression second = mock(Expression.class);
  when(second.apply(pathData, -1)).thenReturn(Result.FAIL);

  Deque<Expression> children = new LinkedList<Expression>();
  children.add(second);
  children.add(first);
  and.addChildren(children);

  assertEquals(Result.STOP.combine(Result.FAIL), and.apply(pathData, -1));
  verify(first).apply(pathData, -1);
  verify(second).apply(pathData, -1);
  verifyNoMoreInteractions(first);
  verifyNoMoreInteractions(second);
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:24,代码来源:TestAnd.java

示例9: testChgrpGroupValidity

import org.apache.hadoop.fs.shell.PathData; //导入依赖的package包/类
/**
 * Tests valid and invalid group arguments to chgrp.
 */
@Test
public void testChgrpGroupValidity() {
  // This test only covers argument parsing, so override to skip processing.
  FsCommand chgrp = new FsShellPermissions.Chgrp() {
    @Override
    protected void processArgument(PathData item) {
    }
  };
  chgrp.setConf(new Configuration());

  // The following are valid (no exception expected).
  chgrp.run("group", "/path");

  // The following are valid only on Windows.
  assertValidArgumentsOnWindows(chgrp, "Group With Spaces", "/path");

  // The following are invalid (exception expected).
  assertIllegalArguments(chgrp, ":gr#oup", "/path");
  assertIllegalArguments(chgrp, ":gr%oup", "/path");
}
 
开发者ID:naver,项目名称:hadoop,代码行数:24,代码来源:TestFsShellReturnCode.java

示例10: testPass

import org.apache.hadoop.fs.shell.PathData; //导入依赖的package包/类
@Test(timeout = 1000)
public void testPass() throws IOException {
  And and = new And();

  PathData pathData = mock(PathData.class);

  Expression first = mock(Expression.class);
  when(first.apply(pathData, -1)).thenReturn(Result.PASS);

  Expression second = mock(Expression.class);
  when(second.apply(pathData, -1)).thenReturn(Result.PASS);

  Deque<Expression> children = new LinkedList<Expression>();
  children.add(second);
  children.add(first);
  and.addChildren(children);

  assertEquals(Result.PASS, and.apply(pathData, -1));
  verify(first).apply(pathData, -1);
  verify(second).apply(pathData, -1);
  verifyNoMoreInteractions(first);
  verifyNoMoreInteractions(second);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:24,代码来源:TestAnd.java

示例11: isAncestor

import org.apache.hadoop.fs.shell.PathData; //导入依赖的package包/类
/** Returns true if the target is an ancestor of the source. */
private boolean isAncestor(PathData source, PathData target) {
  for (Path parent = source.path; (parent != null) && !parent.isRoot();
      parent = parent.getParent()) {
    if (parent.equals(target.path)) {
      return true;
    }
  }
  return false;
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:11,代码来源:Find.java

示例12: recursePath

import org.apache.hadoop.fs.shell.PathData; //导入依赖的package包/类
@Override
protected void recursePath(PathData item) throws IOException {
  if (isStop(item)) {
    // this item returned a stop result so don't recurse any further
    return;
  }
  if (getDepth() >= getOptions().getMaxDepth()) {
    // reached the maximum depth so don't got any further.
    return;
  }
  if (item.stat.isSymlink() && getOptions().isFollowLink()) {
    PathData linkedItem =
        new PathData(item.stat.getSymlink().toString(), getConf());
    if (isAncestor(item, linkedItem)) {
      getOptions().getErr().println(
          "Infinite loop ignored: " + item.toString() + " -> "
              + linkedItem.toString());
      return;
    }
    if (linkedItem.exists) {
      item = linkedItem;
    }
  }
  if (item.stat.isDirectory()) {
    super.recursePath(item);
  }
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:28,代码来源:Find.java

示例13: processPath

import org.apache.hadoop.fs.shell.PathData; //导入依赖的package包/类
@Override
protected void processPath(PathData item) throws IOException {
  if (getOptions().isDepthFirst()) {
    // depth first so leave until post processing
    return;
  }
  applyItem(item);
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:9,代码来源:Find.java

示例14: postProcessPath

import org.apache.hadoop.fs.shell.PathData; //导入依赖的package包/类
@Override
protected void postProcessPath(PathData item) throws IOException {
  if (!getOptions().isDepthFirst()) {
    // not depth first so already processed
    return;
  }
  applyItem(item);
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:9,代码来源:Find.java

示例15: applyItem

import org.apache.hadoop.fs.shell.PathData; //导入依赖的package包/类
private void applyItem(PathData item) throws IOException {
  if (getDepth() >= getOptions().getMinDepth()) {
    Result result = getRootExpression().apply(item, getDepth());
    if (Result.STOP.equals(result)) {
      addStop(item);
    }
  }
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:9,代码来源:Find.java


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