public class ConfigurationService extends Object implements Service, Instrumentable
The configuration loading sequence is identical to Hadoop configuration loading sequence.
Default values are loaded from the 'oozie-default.xml' file from the classpath, then site configured values are loaded from a site configuration file from the Oozie configuration directory.
The Oozie configuration directory is resolved using the OOZIE_HOME
environment variable as
${OOZIE_HOME}/conf
. If the OOZIE_HOME
environment variable is not defined the
initialization of the ConfigurationService
fails.
The site configuration is loaded from the oozie-site.xml
file in the configuration directory.
The site configuration file name to use can be changed by setting the OOZIE_CONFIG_FILE
environment
variable to an alternate file name. The alternate file must ber in the Oozie configuration directory.
Configuration properties, prefixed with 'oozie.', passed as system properties overrides default and site values.
The configuration service logs details on how the configuration was loaded as well as what properties were overrode via system properties settings.
Modifier and Type | Field and Description |
---|---|
static String |
CONF_IGNORE_SYS_PROPS |
static String |
CONF_JAVAX_XML_PARSERS_DOCUMENTBUILDERFACTORY |
static String |
CONF_PREFIX |
static String |
CONF_VERIFY_AVAILABLE_PROPS |
static String |
DEFAULT_CONFIG_FILE |
static String |
OOZIE_CONFIG_DIR
System property that indicates the configuration directory.
|
static String |
OOZIE_CONFIG_FILE
System property that indicates the name of the site configuration file to load.
|
static String |
OOZIE_DATA_DIR
System property that indicates the data directory.
|
static String |
SITE_CONFIG_FILE |
DEFAULT_LOCK_TIMEOUT, lockTimeout
Constructor and Description |
---|
ConfigurationService() |
Modifier and Type | Method and Description |
---|---|
void |
destroy()
Destroy the configuration service.
|
static String |
get(org.apache.hadoop.conf.Configuration conf,
String name) |
static String |
get(String name) |
static boolean |
getBoolean(org.apache.hadoop.conf.Configuration conf,
String name) |
static boolean |
getBoolean(String name) |
static boolean |
getBoolean(String name,
boolean defaultValue) |
static boolean |
getBooleanOrDefault(org.apache.hadoop.conf.Configuration conf,
String name,
boolean defaultValue)
Get the
boolean value for name from conf , or the default Configuration coming from
oozie-site.xml , or defaultValue , if no previous occurrences present. |
static Class<?> |
getClass(org.apache.hadoop.conf.Configuration conf,
String name) |
static Class<?>[] |
getClasses(org.apache.hadoop.conf.Configuration conf,
String name) |
static Class<?>[] |
getClasses(String name) |
org.apache.hadoop.conf.Configuration |
getConf()
Return the services configuration.
|
String |
getConfigDir()
Return Oozie configuration directory.
|
static String |
getConfigurationDirectory() |
static float |
getFloat(String name) |
static int |
getInt(org.apache.hadoop.conf.Configuration conf,
String name) |
static int |
getInt(String name) |
static int |
getInt(String name,
int defaultValue) |
Class<? extends Service> |
getInterface()
Return the public interface for configuration service.
|
static long |
getLong(org.apache.hadoop.conf.Configuration conf,
String name) |
static long |
getLong(org.apache.hadoop.conf.Configuration conf,
String name,
long defultValue) |
static long |
getLong(String name) |
static long |
getLong(String name,
long defultValue) |
org.apache.hadoop.conf.Configuration |
getMaskedConfiguration()
Return a configuration with all sensitive values masked.
|
static String |
getPassword(org.apache.hadoop.conf.Configuration conf,
String name) |
static String |
getPassword(org.apache.hadoop.conf.Configuration conf,
String name,
String defaultValue) |
static String |
getPassword(String name,
String defaultValue) |
static String[] |
getStrings(org.apache.hadoop.conf.Configuration conf,
String name) |
static String[] |
getStrings(String name) |
static Map<String,String> |
getValByRegex(String regex) |
void |
init(Services services)
Initialize the log service.
|
void |
instrument(Instrumentation instr)
Instruments the configuration service.
|
static void |
set(String name,
String value) |
static void |
setBoolean(String name,
boolean value) |
void |
verifyConfigurationName()
Verify the configuration is in oozie-default
|
public static final String CONF_PREFIX
public static final String CONF_IGNORE_SYS_PROPS
public static final String CONF_VERIFY_AVAILABLE_PROPS
public static final String CONF_JAVAX_XML_PARSERS_DOCUMENTBUILDERFACTORY
public static final String OOZIE_CONFIG_DIR
public static final String OOZIE_DATA_DIR
public static final String OOZIE_CONFIG_FILE
public static final String DEFAULT_CONFIG_FILE
public static final String SITE_CONFIG_FILE
public ConfigurationService()
public void init(Services services) throws ServiceException
init
in interface Service
services
- services instance.ServiceException
- thrown if the log service could not be initialized.public static String getConfigurationDirectory() throws ServiceException
ServiceException
public void destroy()
public Class<? extends Service> getInterface()
getInterface
in interface Service
ConfigurationService
.public org.apache.hadoop.conf.Configuration getConf()
public String getConfigDir()
public void instrument(Instrumentation instr)
It sets instrumentation variables indicating the config dir and config file used.
instrument
in interface Instrumentable
instr
- instrumentation to use.public org.apache.hadoop.conf.Configuration getMaskedConfiguration()
public void verifyConfigurationName()
public static void setBoolean(String name, boolean value)
public static String[] getStrings(String name)
public static String[] getStrings(org.apache.hadoop.conf.Configuration conf, String name)
public static boolean getBoolean(String name)
public static boolean getBoolean(String name, boolean defaultValue)
public static boolean getBoolean(org.apache.hadoop.conf.Configuration conf, String name)
public static boolean getBooleanOrDefault(org.apache.hadoop.conf.Configuration conf, String name, boolean defaultValue)
boolean
value for name
from conf
, or the default Configuration
coming from
oozie-site.xml
, or defaultValue
, if no previous occurrences present.conf
- the Configuration
for primary lookupname
- name of the parameter to look updefaultValue
- default value to return when every other possibility is exhaustedboolean
given above lookup orderpublic static long getLong(org.apache.hadoop.conf.Configuration conf, String name, long defultValue)
public static Class<?>[] getClasses(String name)
public static Class<?>[] getClasses(org.apache.hadoop.conf.Configuration conf, String name)
public static String getPassword(org.apache.hadoop.conf.Configuration conf, String name)
public static String getPassword(org.apache.hadoop.conf.Configuration conf, String name, String defaultValue)
public static String getPassword(String name, String defaultValue)
public static Map<String,String> getValByRegex(String regex)
Copyright © 2018 Apache Software Foundation. All rights reserved.