public final class DtFileOperations extends Object
Modifier and Type | Field and Description |
---|---|
static String |
FORMAT_JAVA
Use FORMAT_* as arguments to format parameters.
|
static String |
FORMAT_PB
Use FORMAT_* as arguments to format parameters.
|
Modifier and Type | Method and Description |
---|---|
static void |
aliasTokenFile(File tokenFile,
String fileFormat,
Text alias,
Text service,
Configuration conf)
Alias a token from a file and save back to file in the local filesystem.
|
static void |
appendTokenFiles(ArrayList<File> tokenFiles,
String fileFormat,
Configuration conf)
Append tokens from list of files in local filesystem, saving to last file.
|
static void |
doFormattedWrite(File f,
String format,
Credentials creds,
Configuration conf)
Write out a Credentials object as a local file.
|
static void |
getTokenFile(File tokenFile,
String fileFormat,
Text alias,
Text service,
String url,
String renewer,
Configuration conf)
Fetch a token from a service and save to file in the local filesystem.
|
static void |
printCredentials(Credentials creds,
Text alias,
PrintStream out)
Print out a Credentials object.
|
static void |
printTokenFile(File tokenFile,
Text alias,
Configuration conf,
PrintStream out)
Print out a Credentials file from the local filesystem.
|
static void |
removeTokenFromFile(boolean cancel,
File tokenFile,
String fileFormat,
Text alias,
Configuration conf)
Remove a token from a file in the local filesystem, matching alias.
|
static void |
renewTokenFile(File tokenFile,
String fileFormat,
Text alias,
Configuration conf)
Renew a token from a file in the local filesystem, matching alias.
|
public static final String FORMAT_PB
public static final String FORMAT_JAVA
public static void doFormattedWrite(File f, String format, Credentials creds, Configuration conf) throws IOException
f
- a local File object.format
- a string equal to FORMAT_PB or FORMAT_JAVA.creds
- the Credentials object to be written out.conf
- a Configuration object passed along.IOException
public static void printTokenFile(File tokenFile, Text alias, Configuration conf, PrintStream out) throws IOException
tokenFile
- a local File object.alias
- print only tokens matching alias (null matches all).conf
- Configuration object passed along.out
- print to this stream.IOException
public static void printCredentials(Credentials creds, Text alias, PrintStream out) throws IOException
creds
- the Credentials object to be printed out.alias
- print only tokens matching alias (null matches all).out
- print to this stream.IOException
- failure to unmarshall a token identifier.public static void getTokenFile(File tokenFile, String fileFormat, Text alias, Text service, String url, String renewer, Configuration conf) throws Exception
tokenFile
- a local File object to hold the output.fileFormat
- a string equal to FORMAT_PB or FORMAT_JAVA, for outputalias
- overwrite service field of fetched token with this text.service
- use a DtFetcher implementation matching this service text.url
- pass this URL to fetcher after stripping any http/s prefix.renewer
- pass this renewer to the fetcher.conf
- Configuration object passed along.IOException
Exception
public static void aliasTokenFile(File tokenFile, String fileFormat, Text alias, Text service, Configuration conf) throws Exception
tokenFile
- a local File object to hold the input and output.fileFormat
- a string equal to FORMAT_PB or FORMAT_JAVA, for outputalias
- overwrite service field of fetched token with this text.service
- only apply alias to tokens matching this service text.conf
- Configuration object passed along.IOException
Exception
public static void appendTokenFiles(ArrayList<File> tokenFiles, String fileFormat, Configuration conf) throws IOException
tokenFiles
- list of local File objects. Last file holds the output.fileFormat
- a string equal to FORMAT_PB or FORMAT_JAVA, for outputconf
- Configuration object passed along.IOException
public static void removeTokenFromFile(boolean cancel, File tokenFile, String fileFormat, Text alias, Configuration conf) throws IOException, InterruptedException
cancel
- cancel token as well as remove from file.tokenFile
- a local File object.fileFormat
- a string equal to FORMAT_PB or FORMAT_JAVA, for outputalias
- remove only tokens matching alias; null matches all.conf
- Configuration object passed along.IOException
InterruptedException
public static void renewTokenFile(File tokenFile, String fileFormat, Text alias, Configuration conf) throws IOException, InterruptedException
tokenFile
- a local File object.fileFormat
- a string equal to FORMAT_PB or FORMAT_JAVA, for outputalias
- renew only tokens matching alias; null matches all.conf
- Configuration object passed along.IOException
InterruptedException
Copyright © 2008–2021 Apache Software Foundation. All rights reserved.