public abstract class BaseCommand extends Object implements Command, org.apache.hadoop.conf.Configurable
| Modifier and Type | Field and Description |
|---|---|
protected org.slf4j.Logger |
console |
| Constructor and Description |
|---|
BaseCommand(org.slf4j.Logger console) |
| Modifier and Type | Method and Description |
|---|---|
org.apache.hadoop.fs.FSDataOutputStream |
create(String filename)
Creates a file and returns an open
FSDataOutputStream. |
org.apache.hadoop.fs.FSDataOutputStream |
createWithChecksum(String filename)
Creates a file and returns an open
FSDataOutputStream. |
org.apache.hadoop.fs.FSDataOutputStream |
createWithNoOverwrite(String filename)
Creates a file and returns an open
FSDataOutputStream. |
org.apache.hadoop.fs.FileSystem |
defaultFS() |
protected org.apache.avro.Schema |
getAvroSchema(String source) |
org.apache.hadoop.conf.Configuration |
getConf() |
protected static ClassLoader |
loaderFor(List<String> jars,
List<String> paths)
Returns a
ClassLoader for a set of jars and directories. |
protected static ClassLoader |
loaderForJars(List<String> jars)
Returns a
ClassLoader for a set of jars. |
protected static ClassLoader |
loaderForPaths(List<String> paths)
Returns a
ClassLoader for a set of directories. |
InputStream |
open(String filename)
Opens an existing file or resource.
|
protected <D> Iterable<D> |
openDataFile(String source,
org.apache.avro.Schema projection) |
org.apache.avro.file.SeekableInput |
openSeekable(String filename) |
void |
output(String content,
org.slf4j.Logger console,
String filename)
Output content to the console or a file.
|
org.apache.hadoop.fs.Path |
qualifiedPath(String filename)
Returns a qualified
Path for the filename. |
URI |
qualifiedURI(String filename)
Returns a
URI for the filename that is a qualified Path or
a resource URI. |
void |
setConf(org.apache.hadoop.conf.Configuration conf) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetExamples, runpublic org.apache.hadoop.fs.FileSystem defaultFS()
throws IOException
IOException - if there is an error loading the default fspublic void output(String content, org.slf4j.Logger console, String filename) throws IOException
content - String content to writeconsole - A Logger for writing to the consolefilename - The destination Path as a StringIOException - if there is an error while writingpublic org.apache.hadoop.fs.FSDataOutputStream create(String filename) throws IOException
FSDataOutputStream.
If the file does not have a file system scheme, this uses the default FS.
This will not produce checksum files and will overwrite a file that
already exists.filename - The filename to createIOException - if there is an error creating the filepublic org.apache.hadoop.fs.FSDataOutputStream createWithChecksum(String filename) throws IOException
FSDataOutputStream.
If the file does not have a file system scheme, this uses the default FS.
This will produce checksum files and will overwrite a file that already
exists.filename - The filename to createIOException - if there is an error creating the filepublic org.apache.hadoop.fs.FSDataOutputStream createWithNoOverwrite(String filename) throws IOException
FSDataOutputStream.
If the file does not have a file system scheme, this uses the default FS.
This will neither produce checksum files nor overwrite a file that already
exists.filename - The filename to createIOException - if there is an error creating the filepublic org.apache.hadoop.fs.Path qualifiedPath(String filename) throws IOException
Path for the filename.
If the file does not have a file system scheme, this uses the default FS.filename - The filename to qualifyIOException - if there is an error creating a qualified pathpublic URI qualifiedURI(String filename) throws IOException
URI for the filename that is a qualified Path or
a resource URI.
If the file does not have a file system scheme, this uses the default FS.filename - The filename to qualifyIOException - if there is an error creating a qualified URIpublic InputStream open(String filename) throws IOException
filename - The filename to open.IOException - if there is an error opening the fileIllegalArgumentException - If the file does not existpublic org.apache.avro.file.SeekableInput openSeekable(String filename) throws IOException
IOExceptionpublic void setConf(org.apache.hadoop.conf.Configuration conf)
setConf in interface org.apache.hadoop.conf.Configurablepublic org.apache.hadoop.conf.Configuration getConf()
getConf in interface org.apache.hadoop.conf.Configurableprotected static ClassLoader loaderFor(List<String> jars, List<String> paths) throws MalformedURLException
ClassLoader for a set of jars and directories.jars - A list of jar pathspaths - A list of directories containing .class filesMalformedURLException - if a jar or path is invalidprotected static ClassLoader loaderForJars(List<String> jars) throws MalformedURLException
ClassLoader for a set of jars.jars - A list of jar pathsMalformedURLException - if a URL is invalidprotected static ClassLoader loaderForPaths(List<String> paths) throws MalformedURLException
ClassLoader for a set of directories.paths - A list of directories containing .class filesMalformedURLException - if a path is invalidprotected <D> Iterable<D> openDataFile(String source, org.apache.avro.Schema projection) throws IOException
IOExceptionprotected org.apache.avro.Schema getAvroSchema(String source) throws IOException
IOExceptionCopyright © 2023 The Apache Software Foundation. All rights reserved.