public class ConfiguratorBase extends Object
Modifier and Type | Class and Description |
---|---|
static class |
ConfiguratorBase.ConnectorInfo
Specifies that connection info was configured
|
static class |
ConfiguratorBase.GeneralOpts
Configuration keys for general configuration options.
|
static class |
ConfiguratorBase.InstanceOpts
Configuration keys for available Instance types.
|
static class |
ConfiguratorBase.TokenSource |
Modifier and Type | Field and Description |
---|---|
protected static org.apache.log4j.Logger |
log |
Constructor and Description |
---|
ConfiguratorBase() |
Modifier and Type | Method and Description |
---|---|
static ClientContext |
client(Class<?> CLASS,
org.apache.hadoop.conf.Configuration conf) |
static ClientContext |
client(Class<?> CLASS,
RangeInputSplit split,
org.apache.hadoop.conf.Configuration conf) |
protected static String |
enumToConfKey(Class<?> implementingClass,
Enum<?> e)
Provides a configuration key for a given feature enum, prefixed by the implementingClass
|
protected static String |
enumToConfKey(Enum<?> e)
Provides a configuration key for a given feature enum.
|
static AuthenticationToken |
getAuthenticationToken(Class<?> implementingClass,
org.apache.hadoop.conf.Configuration conf)
Gets the authenticated token from either the specified token file or directly from the
configuration, whichever was used when the job was configured.
|
static ClientConfiguration |
getClientConfiguration(Class<?> implementingClass,
org.apache.hadoop.conf.Configuration conf)
Obtain a ClientConfiguration based on the configuration.
|
static Instance |
getInstance(Class<?> implementingClass,
org.apache.hadoop.conf.Configuration conf)
Initializes an Accumulo Instance based on the configuration.
|
static org.apache.log4j.Level |
getLogLevel(Class<?> implementingClass,
org.apache.hadoop.conf.Configuration conf)
Gets the log level from this configuration.
|
static String |
getPrincipal(Class<?> implementingClass,
org.apache.hadoop.conf.Configuration conf)
Gets the user name from the configuration.
|
static AuthenticationToken |
getTokenFromFile(org.apache.hadoop.conf.Configuration conf,
String principal,
String tokenFile)
Reads from the token file in distributed cache.
|
static int |
getVisibilityCacheSize(org.apache.hadoop.conf.Configuration conf)
Gets the valid visibility count for this job.
|
static Boolean |
isConnectorInfoSet(Class<?> implementingClass,
org.apache.hadoop.conf.Configuration conf)
Determines if the connector info has already been set for this instance.
|
static void |
setConnectorInfo(Class<?> implementingClass,
org.apache.hadoop.conf.Configuration conf,
String principal,
AuthenticationToken token)
Sets the connector information needed to communicate with Accumulo in this job.
|
static void |
setConnectorInfo(Class<?> implementingClass,
org.apache.hadoop.conf.Configuration conf,
String principal,
String tokenFile)
Sets the connector information needed to communicate with Accumulo in this job.
|
static void |
setLogLevel(Class<?> implementingClass,
org.apache.hadoop.conf.Configuration conf,
org.apache.log4j.Level level)
Sets the log level for this job.
|
static void |
setVisibilityCacheSize(org.apache.hadoop.conf.Configuration conf,
int visibilityCacheSize)
Sets the valid visibility count for this job.
|
static void |
setZooKeeperInstance(Class<?> implementingClass,
org.apache.hadoop.conf.Configuration conf,
ClientConfiguration clientConfig)
Configures a ZooKeeperInstance for this job.
|
static AuthenticationToken |
unwrapAuthenticationToken(org.apache.hadoop.mapred.JobConf job,
AuthenticationToken token)
Unwraps the provided
AuthenticationToken if it is an instance of DelegationTokenStub,
reconstituting it from the provided JobConf . |
static AuthenticationToken |
unwrapAuthenticationToken(org.apache.hadoop.mapreduce.JobContext job,
AuthenticationToken token)
Unwraps the provided
AuthenticationToken if it is an instance of DelegationTokenStub,
reconstituting it from the provided JobConf . |
protected static String enumToConfKey(Class<?> implementingClass, Enum<?> e)
implementingClass
- the class whose name will be used as a prefix for the property configuration keye
- the enum used to provide the unique part of the configuration keyprotected static String enumToConfKey(Enum<?> e)
e
- the enum used to provide the unique part of the configuration keypublic static void setConnectorInfo(Class<?> implementingClass, org.apache.hadoop.conf.Configuration conf, String principal, AuthenticationToken token)
WARNING: The serialized token is stored in the configuration and shared with all MapReduce tasks. It is BASE64 encoded to provide a charset safe conversion to a string, and is not intended to be secure.
implementingClass
- the class whose name will be used as a prefix for the property configuration keyconf
- the Hadoop configuration object to configureprincipal
- a valid Accumulo user nametoken
- the user's passwordpublic static void setConnectorInfo(Class<?> implementingClass, org.apache.hadoop.conf.Configuration conf, String principal, String tokenFile)
Pulls a token file into the Distributed Cache that contains the authentication token in an attempt to be more secure than storing the password in the Configuration. Token file created with "bin/accumulo create-token".
implementingClass
- the class whose name will be used as a prefix for the property configuration keyconf
- the Hadoop configuration object to configureprincipal
- a valid Accumulo user nametokenFile
- the path to the token file in DFSpublic static Boolean isConnectorInfoSet(Class<?> implementingClass, org.apache.hadoop.conf.Configuration conf)
implementingClass
- the class whose name will be used as a prefix for the property configuration keyconf
- the Hadoop configuration object to configuresetConnectorInfo(Class, Configuration, String, AuthenticationToken)
public static String getPrincipal(Class<?> implementingClass, org.apache.hadoop.conf.Configuration conf)
implementingClass
- the class whose name will be used as a prefix for the property configuration keyconf
- the Hadoop configuration object to configuresetConnectorInfo(Class, Configuration, String, AuthenticationToken)
public static AuthenticationToken getAuthenticationToken(Class<?> implementingClass, org.apache.hadoop.conf.Configuration conf)
implementingClass
- the class whose name will be used as a prefix for the property configuration keyconf
- the Hadoop configuration object to configuresetConnectorInfo(Class, Configuration, String, AuthenticationToken)
,
setConnectorInfo(Class, Configuration, String, String)
public static AuthenticationToken getTokenFromFile(org.apache.hadoop.conf.Configuration conf, String principal, String tokenFile)
conf
- the Hadoop context for the configured jobsetConnectorInfo(Class, Configuration, String, AuthenticationToken)
public static void setZooKeeperInstance(Class<?> implementingClass, org.apache.hadoop.conf.Configuration conf, ClientConfiguration clientConfig)
implementingClass
- the class whose name will be used as a prefix for the property configuration keyconf
- the Hadoop configuration object to configureclientConfig
- client configuration for specifying connection timeouts, SSL connection options, etc.public static Instance getInstance(Class<?> implementingClass, org.apache.hadoop.conf.Configuration conf)
implementingClass
- the class whose name will be used as a prefix for the property configuration keyconf
- the Hadoop configuration object to configurepublic static ClientConfiguration getClientConfiguration(Class<?> implementingClass, org.apache.hadoop.conf.Configuration conf)
implementingClass
- the class whose name will be used as a prefix for the property configuration keyconf
- the Hadoop configuration object to configurepublic static void setLogLevel(Class<?> implementingClass, org.apache.hadoop.conf.Configuration conf, org.apache.log4j.Level level)
implementingClass
- the class whose name will be used as a prefix for the property configuration keyconf
- the Hadoop configuration object to configurelevel
- the logging levelpublic static org.apache.log4j.Level getLogLevel(Class<?> implementingClass, org.apache.hadoop.conf.Configuration conf)
implementingClass
- the class whose name will be used as a prefix for the property configuration keyconf
- the Hadoop configuration object to configuresetLogLevel(Class, Configuration, Level)
public static void setVisibilityCacheSize(org.apache.hadoop.conf.Configuration conf, int visibilityCacheSize)
conf
- the Hadoop configuration object to configurevisibilityCacheSize
- the LRU cache sizepublic static int getVisibilityCacheSize(org.apache.hadoop.conf.Configuration conf)
conf
- the Hadoop configuration object to configurepublic static AuthenticationToken unwrapAuthenticationToken(org.apache.hadoop.mapred.JobConf job, AuthenticationToken token)
AuthenticationToken
if it is an instance of DelegationTokenStub,
reconstituting it from the provided JobConf
.job
- The jobtoken
- The authentication tokenpublic static AuthenticationToken unwrapAuthenticationToken(org.apache.hadoop.mapreduce.JobContext job, AuthenticationToken token)
AuthenticationToken
if it is an instance of DelegationTokenStub,
reconstituting it from the provided JobConf
.job
- The jobtoken
- The authentication tokenpublic static ClientContext client(Class<?> CLASS, org.apache.hadoop.conf.Configuration conf) throws AccumuloException, AccumuloSecurityException
public static ClientContext client(Class<?> CLASS, RangeInputSplit split, org.apache.hadoop.conf.Configuration conf) throws IOException
IOException
Copyright © 2011–2019 The Apache Software Foundation. All rights reserved.