當前位置: 首頁>>代碼示例>>Java>>正文


Java FileSystem.removeDefaultAcl方法代碼示例

本文整理匯總了Java中org.apache.hadoop.fs.FileSystem.removeDefaultAcl方法的典型用法代碼示例。如果您正苦於以下問題:Java FileSystem.removeDefaultAcl方法的具體用法?Java FileSystem.removeDefaultAcl怎麽用?Java FileSystem.removeDefaultAcl使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.hadoop.fs.FileSystem的用法示例。


在下文中一共展示了FileSystem.removeDefaultAcl方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: testDirAcls

import org.apache.hadoop.fs.FileSystem; //導入方法依賴的package包/類
/**
 * Simple acl tests on a directory: set a default acl, remove default acls.
 * @throws Exception
 */
private void testDirAcls() throws Exception {
  if ( isLocalFS() ) {
    return;
  }

  final String defUser1 = "default:user:glarch:r-x";

  FileSystem proxyFs = FileSystem.get(getProxiedFSConf());
  FileSystem httpfs = getHttpFSFileSystem();

  Path dir = getProxiedFSTestDir();

  /* ACL Status on a directory */
  AclStatus proxyAclStat = proxyFs.getAclStatus(dir);
  AclStatus httpfsAclStat = httpfs.getAclStatus(dir);
  assertSameAcls(httpfsAclStat, proxyAclStat);

  /* Set a default ACL on the directory */
  httpfs.setAcl(dir, (AclEntry.parseAclSpec(defUser1,true)));
  proxyAclStat = proxyFs.getAclStatus(dir);
  httpfsAclStat = httpfs.getAclStatus(dir);
  assertSameAcls(httpfsAclStat, proxyAclStat);

  /* Remove the default ACL */
  httpfs.removeDefaultAcl(dir);
  proxyAclStat = proxyFs.getAclStatus(dir);
  httpfsAclStat = httpfs.getAclStatus(dir);
  assertSameAcls(httpfsAclStat, proxyAclStat);
}
 
開發者ID:naver,項目名稱:hadoop,代碼行數:34,代碼來源:BaseTestHttpFSWith.java

示例2: testAclMethods

import org.apache.hadoop.fs.FileSystem; //導入方法依賴的package包/類
/**
 * Tests that ViewFileSystem dispatches calls for every ACL method through the
 * mount table to the correct underlying FileSystem with all Path arguments
 * translated as required.
 */
@Test
public void testAclMethods() throws Exception {
  Configuration conf = ViewFileSystemTestSetup.createConfig();
  FileSystem mockFs1 = setupMockFileSystem(conf, new URI("mockfs1:/"));
  FileSystem mockFs2 = setupMockFileSystem(conf, new URI("mockfs2:/"));
  FileSystem viewFs = FileSystem.get(FsConstants.VIEWFS_URI, conf);

  Path viewFsPath1 = new Path("/mounts/mockfs1/a/b/c");
  Path mockFsPath1 = new Path("/a/b/c");
  Path viewFsPath2 = new Path("/mounts/mockfs2/d/e/f");
  Path mockFsPath2 = new Path("/d/e/f");
  List<AclEntry> entries = Collections.emptyList();

  viewFs.modifyAclEntries(viewFsPath1, entries);
  verify(mockFs1).modifyAclEntries(mockFsPath1, entries);
  viewFs.modifyAclEntries(viewFsPath2, entries);
  verify(mockFs2).modifyAclEntries(mockFsPath2, entries);

  viewFs.removeAclEntries(viewFsPath1, entries);
  verify(mockFs1).removeAclEntries(mockFsPath1, entries);
  viewFs.removeAclEntries(viewFsPath2, entries);
  verify(mockFs2).removeAclEntries(mockFsPath2, entries);

  viewFs.removeDefaultAcl(viewFsPath1);
  verify(mockFs1).removeDefaultAcl(mockFsPath1);
  viewFs.removeDefaultAcl(viewFsPath2);
  verify(mockFs2).removeDefaultAcl(mockFsPath2);

  viewFs.removeAcl(viewFsPath1);
  verify(mockFs1).removeAcl(mockFsPath1);
  viewFs.removeAcl(viewFsPath2);
  verify(mockFs2).removeAcl(mockFsPath2);

  viewFs.setAcl(viewFsPath1, entries);
  verify(mockFs1).setAcl(mockFsPath1, entries);
  viewFs.setAcl(viewFsPath2, entries);
  verify(mockFs2).setAcl(mockFsPath2, entries);

  viewFs.getAclStatus(viewFsPath1);
  verify(mockFs1).getAclStatus(mockFsPath1);
  viewFs.getAclStatus(viewFsPath2);
  verify(mockFs2).getAclStatus(mockFsPath2);
}
 
開發者ID:nucypher,項目名稱:hadoop-oss,代碼行數:49,代碼來源:TestViewFileSystemDelegation.java

示例3: execute

import org.apache.hadoop.fs.FileSystem; //導入方法依賴的package包/類
/**
 * Executes the filesystem operation.
 *
 * @param fs filesystem instance to use.
 *
 * @return void.
 *
 * @throws IOException thrown if an IO error occurred.
 */
@Override
public Void execute(FileSystem fs) throws IOException {
  fs.removeDefaultAcl(path);
  return null;
}
 
開發者ID:naver,項目名稱:hadoop,代碼行數:15,代碼來源:FSOperations.java


注:本文中的org.apache.hadoop.fs.FileSystem.removeDefaultAcl方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。