Class AbstractDTService
java.lang.Object
org.apache.hadoop.service.AbstractService
org.apache.hadoop.fs.s3a.auth.delegation.AbstractDTService
- All Implemented Interfaces:
Closeable,AutoCloseable,org.apache.hadoop.service.Service
- Direct Known Subclasses:
AbstractDelegationTokenBinding,S3ADelegationTokens
public abstract class AbstractDTService
extends org.apache.hadoop.service.AbstractService
This is the base class for both the delegation binding
code and the back end service created; allows for
shared methods across both.
The lifecycle sequence is as follows
- create - bindToFileSystem(uri, ownerFS) - init - start ...api calls... - stopAs the S3ADelegation mechanism is all configured during the filesystem initalize() operation, it is not ready for use through all the start process.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.hadoop.service.Service
org.apache.hadoop.service.Service.STATE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidbindToFileSystem(URI uri, StoreContext context, DelegationOperations delegationOperations) Bind to the filesystem.Get the canonical URI of the filesystem, which is what is used to identify the tokens.org.apache.hadoop.security.UserGroupInformationgetOwner()Get the owner of this Service.protected DelegationOperationsprotected StoreContextprotected voidRequire the service to be started.protected voidrequireServiceState(org.apache.hadoop.service.Service.STATE state) Require that the service is in a given state.protected voidserviceInit(org.apache.hadoop.conf.Configuration conf) Methods inherited from class org.apache.hadoop.service.AbstractService
close, getBlockers, getConfig, getFailureCause, getFailureState, getLifecycleHistory, getName, getServiceState, getStartTime, init, isInState, noteFailure, putBlocker, registerGlobalListener, registerServiceListener, removeBlocker, serviceStart, serviceStop, setConfig, start, stop, toString, unregisterGlobalListener, unregisterServiceListener, waitForServiceToStop
-
Constructor Details
-
AbstractDTService
Protected constructor.- Parameters:
name- service name.
-
-
Method Details
-
bindToFileSystem
public void bindToFileSystem(URI uri, StoreContext context, DelegationOperations delegationOperations) throws IOException Bind to the filesystem. Subclasses can use this to perform their own binding operations - but they must always call their superclass implementation. This Must be called before callinginit(). Important: This binding will happen during FileSystem.initialize(); the FS is not live for actual use and will not yet have interacted with AWS services.- Parameters:
uri- the canonical URI of the FS.context- store contextdelegationOperations- delegation operations- Throws:
IOException- failure.
-
getCanonicalUri
Get the canonical URI of the filesystem, which is what is used to identify the tokens.- Returns:
- the URI.
-
getOwner
public org.apache.hadoop.security.UserGroupInformation getOwner()Get the owner of this Service.- Returns:
- owner; non-null after binding to an FS.
-
getStoreContext
-
getPolicyProvider
-
requireServiceState
protected void requireServiceState(org.apache.hadoop.service.Service.STATE state) throws IllegalStateException Require that the service is in a given state.- Parameters:
state- desired state.- Throws:
IllegalStateException- if the condition is not met
-
requireServiceStarted
Require the service to be started.- Throws:
IllegalStateException- if it is not.
-
serviceInit
- Overrides:
serviceInitin classorg.apache.hadoop.service.AbstractService- Throws:
Exception
-