/** * Get delegation tokens for the file systems accessed for a given * path. * @param p Path for which delegations tokens are requested. * @param renewer the account name that is allowed to renew the token. * @return List of delegation tokens. * @throws IOException */ @InterfaceAudience.LimitedPrivate( { "HDFS", "MapReduce" }) public List<Token<?>> getDelegationTokens( Path p, String renewer) throws IOException { Set<AbstractFileSystem> afsSet = resolveAbstractFileSystems(p); List<Token<?>> tokenList = new ArrayList<Token<?>>(); for (AbstractFileSystem afs : afsSet) { List<Token<?>> afsTokens = afs.getDelegationTokens(renewer); tokenList.addAll(afsTokens); } return tokenList; }
/** * Get delegation tokens for the file systems accessed for a given * path. * @param p Path for which delegations tokens are requested. * @param renewer the account name that is allowed to renew the token. * @return List of delegation tokens. * @throws IOException */ @InterfaceAudience.LimitedPrivate( { "HDFS", "MapReduce" }) public List<Token<?>> getDelegationTokens( Path p, String renewer) throws IOException { Set<AbstractFileSystem> afsSet = resolveAbstractFileSystems(p); List<Token<?>> tokenList = new ArrayList<Token<?>>(); for (AbstractFileSystem afs : afsSet) { List<Token<?>> afsTokens = afs.getDelegationTokens(renewer); tokenList.addAll(afsTokens); } return tokenList; }
/** * Get delegation tokens for the file systems accessed for a given * path. * @param p Path for which delegations tokens are requested. * @param renewer the account name that is allowed to renew the token. * @return List of delegation tokens. * @throws IOException */ @InterfaceAudience.LimitedPrivate( { "HDFS", "MapReduce" }) public List<Token<?>> getDelegationTokens( Path p, String renewer) throws IOException { Set<AbstractFileSystem> afsSet = resolveAbstractFileSystems(p); List<Token<?>> tokenList = new ArrayList<Token<?>>(); for (AbstractFileSystem afs : afsSet) { List<Token<?>> afsTokens = afs.getDelegationTokens(renewer); tokenList.addAll(afsTokens); } return tokenList; }
/** * Get delegation tokens for the file systems accessed for a given * path. * @param p Path for which delegations tokens are requested. * @param renewer the account name that is allowed to renew the token. * @return List of delegation tokens. * @throws IOException */ @InterfaceAudience.LimitedPrivate( { "HDFS", "MapReduce" }) public List<Token<?>> getDelegationTokens( Path p, String renewer) throws IOException { Set<AbstractFileSystem> afsSet = resolveAbstractFileSystems(p); List<Token<?>> tokenList = new ArrayList<Token<?>>(); for (AbstractFileSystem afs : afsSet) { List<Token<?>> afsTokens = afs.getDelegationTokens(renewer); tokenList.addAll(afsTokens); } return tokenList; }
/** * Get delegation tokens for the file systems accessed for a given * path. * @param p Path for which delegations tokens are requested. * @param renewer the account name that is allowed to renew the token. * @return List of delegation tokens. * @throws IOException */ @InterfaceAudience.LimitedPrivate( { "HDFS", "MapReduce" }) public List<Token<?>> getDelegationTokens( Path p, String renewer) throws IOException { Set<AbstractFileSystem> afsSet = resolveAbstractFileSystems(p); List<Token<?>> tokenList = new ArrayList<Token<?>>(); for (AbstractFileSystem afs : afsSet) { List<Token<?>> afsTokens = afs.getDelegationTokens(renewer); tokenList.addAll(afsTokens); } return tokenList; }
@Test (timeout = 30000) public void testFileContextResolveAfs() throws IOException { Configuration conf = new Configuration(); localFs = FileSystem.get(conf); Path localPath = new Path(TEST_ROOT_DIR_LOCAL + "/TestFileContextResolveAfs1"); Path linkPath = localFs.makeQualified(new Path(TEST_ROOT_DIR_LOCAL, "TestFileContextResolveAfs2")); localFs.mkdirs(new Path(TEST_ROOT_DIR_LOCAL)); localFs.create(localPath); fc.createSymlink(localPath, linkPath, true); Set<AbstractFileSystem> afsList = fc.resolveAbstractFileSystems(linkPath); Assert.assertEquals(1, afsList.size()); localFs.deleteOnExit(localPath); localFs.deleteOnExit(linkPath); localFs.close(); } }
@Test (timeout = 30000) public void testFileContextResolveAfs() throws IOException { Configuration conf = new Configuration(); localFs = FileSystem.get(conf); Path localPath = new Path(TEST_ROOT_DIR_LOCAL + "/TestFileContextResolveAfs1"); Path linkPath = localFs.makeQualified(new Path(TEST_ROOT_DIR_LOCAL, "TestFileContextResolveAfs2")); localFs.mkdirs(new Path(TEST_ROOT_DIR_LOCAL)); localFs.create(localPath); fc.createSymlink(localPath, linkPath, true); Set<AbstractFileSystem> afsList = fc.resolveAbstractFileSystems(linkPath); Assert.assertEquals(1, afsList.size()); localFs.deleteOnExit(localPath); localFs.deleteOnExit(linkPath); localFs.close(); } }
.resolveAbstractFileSystems(alphaHdfsPathViaLink); Assert.assertEquals(2, afsList.size()); for (AbstractFileSystem afs : afsList) {