Preconditions.checkArgument(properties.containsKey(AUTH_TOKEN_PATH)); Path tokenPath = new Path(properties.getProperty(AUTH_TOKEN_PATH)); Optional<Token<?>> proxyToken = getTokenFromSeqFile(userNameToProxyAs, tokenPath); if (proxyToken.isPresent()) { try {
private static FileSystem getWriterFsUsingToken(State state, URI uri) throws IOException { try { String user = state.getProp(ConfigurationKeys.FS_PROXY_AS_USER_NAME); Optional<Token<?>> token = ProxiedFileSystemUtils .getTokenFromSeqFile(user, new Path(state.getProp(ConfigurationKeys.FS_PROXY_AS_USER_TOKEN_FILE))); if (!token.isPresent()) { throw new IOException("No token found for user " + user); } return ProxiedFileSystemCache.fromToken().userNameToken(token.get()) .userNameToProxyAs(state.getProp(ConfigurationKeys.FS_PROXY_AS_USER_NAME)).fsURI(uri) .conf(HadoopUtils.newConfiguration()).build(); } catch (ExecutionException e) { throw new IOException(e); } }