org.apache.accumulo.core.client.mapreduce.lib.util
Class ConfiguratorBase

java.lang.Object
  extended by org.apache.accumulo.core.client.mapreduce.lib.util.ConfiguratorBase
Direct Known Subclasses:
FileOutputConfigurator, InputConfigurator, OutputConfigurator

public class ConfiguratorBase
extends Object

Since:
1.5.0

Nested Class Summary
static class ConfiguratorBase.ConnectorInfo
          Configuration keys for Instance.getConnector(String, byte[]).
protected static class ConfiguratorBase.GeneralOpts
          Configuration keys for general configuration options.
protected static class ConfiguratorBase.InstanceOpts
          Configuration keys for Instance, ZooKeeperInstance, and MockInstance.
 
Constructor Summary
ConfiguratorBase()
           
 
Method Summary
protected static String enumToConfKey(Class<?> implementingClass, Enum<?> e)
          Provides a configuration key for a given feature enum, prefixed by the implementingClass
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 byte[] getToken(Class<?> implementingClass, org.apache.hadoop.conf.Configuration conf)
          Gets the password from the configuration.
static String getTokenClass(Class<?> implementingClass, org.apache.hadoop.conf.Configuration conf)
          Gets the serialized token class from the configuration.
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 setLogLevel(Class<?> implementingClass, org.apache.hadoop.conf.Configuration conf, org.apache.log4j.Level level)
          Sets the log level for this job.
static void setMockInstance(Class<?> implementingClass, org.apache.hadoop.conf.Configuration conf, String instanceName)
          Configures a MockInstance for this job.
static void setZooKeeperInstance(Class<?> implementingClass, org.apache.hadoop.conf.Configuration conf, String instanceName, String zooKeepers)
          Configures a ZooKeeperInstance for this job.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConfiguratorBase

public ConfiguratorBase()
Method Detail

enumToConfKey

protected static String enumToConfKey(Class<?> implementingClass,
                                      Enum<?> e)
Provides a configuration key for a given feature enum, prefixed by the implementingClass

Parameters:
implementingClass - the class whose name will be used as a prefix for the property configuration key
e - the enum used to provide the unique part of the configuration key
Returns:
the configuration key
Since:
1.5.0

setConnectorInfo

public static void setConnectorInfo(Class<?> implementingClass,
                                    org.apache.hadoop.conf.Configuration conf,
                                    String principal,
                                    AuthenticationToken token)
                             throws AccumuloSecurityException
Sets the connector information needed to communicate with Accumulo in this job.

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.

Parameters:
implementingClass - the class whose name will be used as a prefix for the property configuration key
conf - the Hadoop configuration object to configure
principal - a valid Accumulo user name
token - the user's password
Throws:
AccumuloSecurityException
Since:
1.5.0

isConnectorInfoSet

public static Boolean isConnectorInfoSet(Class<?> implementingClass,
                                         org.apache.hadoop.conf.Configuration conf)
Determines if the connector info has already been set for this instance.

Parameters:
implementingClass - the class whose name will be used as a prefix for the property configuration key
conf - the Hadoop configuration object to configure
Returns:
true if the connector info has already been set, false otherwise
Since:
1.5.0
See Also:
setConnectorInfo(Class, Configuration, String, AuthenticationToken)

getPrincipal

public static String getPrincipal(Class<?> implementingClass,
                                  org.apache.hadoop.conf.Configuration conf)
Gets the user name from the configuration.

Parameters:
implementingClass - the class whose name will be used as a prefix for the property configuration key
conf - the Hadoop configuration object to configure
Returns:
the principal
Since:
1.5.0
See Also:
setConnectorInfo(Class, Configuration, String, AuthenticationToken)

getTokenClass

public static String getTokenClass(Class<?> implementingClass,
                                   org.apache.hadoop.conf.Configuration conf)
Gets the serialized token class from the configuration.

Parameters:
implementingClass - the class whose name will be used as a prefix for the property configuration key
conf - the Hadoop configuration object to configure
Returns:
the principal
Since:
1.5.0
See Also:
setConnectorInfo(Class, Configuration, String, AuthenticationToken)

getToken

public static byte[] getToken(Class<?> implementingClass,
                              org.apache.hadoop.conf.Configuration conf)
Gets the password from the configuration. WARNING: The password 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.

Parameters:
implementingClass - the class whose name will be used as a prefix for the property configuration key
conf - the Hadoop configuration object to configure
Returns:
the decoded principal's authentication token
Since:
1.5.0
See Also:
setConnectorInfo(Class, Configuration, String, AuthenticationToken)

setZooKeeperInstance

public static void setZooKeeperInstance(Class<?> implementingClass,
                                        org.apache.hadoop.conf.Configuration conf,
                                        String instanceName,
                                        String zooKeepers)
Configures a ZooKeeperInstance for this job.

Parameters:
implementingClass - the class whose name will be used as a prefix for the property configuration key
conf - the Hadoop configuration object to configure
instanceName - the Accumulo instance name
zooKeepers - a comma-separated list of zookeeper servers
Since:
1.5.0

setMockInstance

public static void setMockInstance(Class<?> implementingClass,
                                   org.apache.hadoop.conf.Configuration conf,
                                   String instanceName)
Configures a MockInstance for this job.

Parameters:
implementingClass - the class whose name will be used as a prefix for the property configuration key
conf - the Hadoop configuration object to configure
instanceName - the Accumulo instance name
Since:
1.5.0

getInstance

public static Instance getInstance(Class<?> implementingClass,
                                   org.apache.hadoop.conf.Configuration conf)
Initializes an Accumulo Instance based on the configuration.

Parameters:
implementingClass - the class whose name will be used as a prefix for the property configuration key
conf - the Hadoop configuration object to configure
Returns:
an Accumulo instance
Since:
1.5.0
See Also:
setZooKeeperInstance(Class, Configuration, String, String), setMockInstance(Class, Configuration, String)

setLogLevel

public static void setLogLevel(Class<?> implementingClass,
                               org.apache.hadoop.conf.Configuration conf,
                               org.apache.log4j.Level level)
Sets the log level for this job.

Parameters:
implementingClass - the class whose name will be used as a prefix for the property configuration key
conf - the Hadoop configuration object to configure
level - the logging level
Since:
1.5.0

getLogLevel

public static org.apache.log4j.Level getLogLevel(Class<?> implementingClass,
                                                 org.apache.hadoop.conf.Configuration conf)
Gets the log level from this configuration.

Parameters:
implementingClass - the class whose name will be used as a prefix for the property configuration key
conf - the Hadoop configuration object to configure
Returns:
the log level
Since:
1.5.0
See Also:
setLogLevel(Class, Configuration, Level)


Copyright © 2013 Apache Accumulo Project. All Rights Reserved.