public class FileContextLocationFactory extends Object implements LocationFactory
Constructor and Description |
---|
FileContextLocationFactory(org.apache.hadoop.conf.Configuration configuration)
|
FileContextLocationFactory(org.apache.hadoop.conf.Configuration configuration,
org.apache.hadoop.fs.FileContext fc,
String pathBase)
Deprecated.
Use
FileContextLocationFactory(Configuration)
or FileContextLocationFactory(Configuration, String) instead. The FileContext
provided to this method will only be used if the current user calling any methods of this class
matches with the UserGroupInformation of the FileContext instance. |
FileContextLocationFactory(org.apache.hadoop.conf.Configuration configuration,
String pathBase)
Creates a new instance.
|
Modifier and Type | Method and Description |
---|---|
Location |
create(String path)
Creates an instance of
Location of the given path. |
Location |
create(URI uri)
|
org.apache.hadoop.conf.Configuration |
getConfiguration()
Returns the
Configuration used by this LocationFactory . |
org.apache.hadoop.fs.FileContext |
getFileContext()
Returns the
FileContext for the current user based on UserGroupInformation.getCurrentUser() . |
Location |
getHomeLocation()
Returns the home location.
|
public FileContextLocationFactory(org.apache.hadoop.conf.Configuration configuration)
public FileContextLocationFactory(org.apache.hadoop.conf.Configuration configuration, String pathBase)
configuration
- the hadoop configurationpathBase
- base path for all non-absolute location created through this LocationFactory
.@Deprecated public FileContextLocationFactory(org.apache.hadoop.conf.Configuration configuration, org.apache.hadoop.fs.FileContext fc, String pathBase)
FileContextLocationFactory(Configuration)
or FileContextLocationFactory(Configuration, String)
instead. The FileContext
provided to this method will only be used if the current user calling any methods of this class
matches with the UserGroupInformation
of the FileContext
instance.FileContext
created from the given Configuration
.configuration
- the hadoop configurationfc
- FileContext
instance created from the given configurationpathBase
- base path for all non-absolute location created through this (@link LocationFactory}.public Location create(String path)
LocationFactory
Location
of the given path.create
in interface LocationFactory
path
- The path representing the location.Location
.public Location create(URI uri)
LocationFactory
create
in interface LocationFactory
uri
- to the resource on the filesystem.Location
public Location getHomeLocation()
LocationFactory
getHomeLocation
in interface LocationFactory
public org.apache.hadoop.fs.FileContext getFileContext()
FileContext
for the current user based on UserGroupInformation.getCurrentUser()
.IllegalStateException
- if failed to determine the current user or fail to create the FileContext.RuntimeException
- if failed to get the FileContext
object for the current user due to exceptionpublic org.apache.hadoop.conf.Configuration getConfiguration()
Configuration
used by this LocationFactory
.Copyright © 2013-2020 The Apache Software Foundation. All rights reserved.