Package org.apache.hadoop.fs.s3native
Class S3xLoginHelper
java.lang.Object
org.apache.hadoop.fs.s3native.S3xLoginHelper
Class to aid logging in to S3 endpoints.
It is in S3N so that it can be used across all S3 filesystems.
The core function of this class was the extraction and decoding of user:secret
information from filesystems URIs.
All that is left now is some URI canonicalization and checking.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classSimple tuple of login details. -
Method Summary
Modifier and TypeMethodDescriptionstatic URIbuildFSURI(URI uri) Build the filesystem URI.static URIcanonicalizeUri(URI uri, int defaultPort) Canonicalize the given URI.static voidcheckPath(org.apache.hadoop.conf.Configuration conf, URI fsUri, org.apache.hadoop.fs.Path path, int defaultPort) Check the path, ignoring authentication details.
-
Method Details
-
buildFSURI
Build the filesystem URI.- Parameters:
uri- filesystem uri- Returns:
- the URI to use as the basis for FS operation and qualifying paths.
- Throws:
NullPointerException- if the URI has null parts.
-
canonicalizeUri
Canonicalize the given URI.- Parameters:
uri- the URI to canonicalizedefaultPort- default port to use in canonicalized URI if the input URI has no port and this value is greater than 0- Returns:
- a new, canonicalized URI.
-
checkPath
public static void checkPath(org.apache.hadoop.conf.Configuration conf, URI fsUri, org.apache.hadoop.fs.Path path, int defaultPort) Check the path, ignoring authentication details. SeeFileSystem.checkPath(Path)for the operation of this. Essentially- The URI is canonicalized.
- If the schemas match, the hosts are compared.
- If there is a mismatch between null/non-null host, the default FS values are used to patch in the host.
URI.getHost()overURI.getAuthority(). Some of that code looks a relic of the code anti-pattern of using "hdfs:file.txt" to define the path without declaring the hostname. It's retained for compatibility.- Parameters:
conf- FS configurationfsUri- the FS URIpath- path to checkdefaultPort- default port of FS
-