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.
-
-
Field Summary
Fields
Modifier and Type
Field and Description
static String
CONF_IGNORE_SYS_PROPS
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
-
Fields inherited from interface org.apache.oozie.service.Service
DEFAULT_LOCK_TIMEOUT, lockTimeout
-
Constructor Summary
Constructors
Constructor and Description
ConfigurationService()
-
Method Summary
Methods
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 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)
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(String name)
org.apache.hadoop.conf.Configuration
getMaskedConfiguration()
Return a configuration with all sensitive values masked.
static String[]
getStrings(org.apache.hadoop.conf.Configuration conf,
String name)
static String[]
getStrings(String name)
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
-
-
Field Detail
-
CONF_PREFIX
public static final String CONF_PREFIX
- See Also:
- Constant Field Values
-
CONF_IGNORE_SYS_PROPS
public static final String CONF_IGNORE_SYS_PROPS
- See Also:
- Constant Field Values
-
CONF_VERIFY_AVAILABLE_PROPS
public static final String CONF_VERIFY_AVAILABLE_PROPS
- See Also:
- Constant Field Values
-
OOZIE_CONFIG_DIR
public static final String OOZIE_CONFIG_DIR
System property that indicates the configuration directory.
- See Also:
- Constant Field Values
-
OOZIE_DATA_DIR
public static final String OOZIE_DATA_DIR
System property that indicates the data directory.
- See Also:
- Constant Field Values
-
OOZIE_CONFIG_FILE
public static final String OOZIE_CONFIG_FILE
System property that indicates the name of the site configuration file to load.
- See Also:
- Constant Field Values
-
DEFAULT_CONFIG_FILE
public static final String DEFAULT_CONFIG_FILE
- See Also:
- Constant Field Values
-
SITE_CONFIG_FILE
public static final String SITE_CONFIG_FILE
- See Also:
- Constant Field Values
-
Constructor Detail
-
ConfigurationService
public ConfigurationService()
-
Method Detail
-
init
public void init(Services services)
throws ServiceException
Initialize the log service.
- Specified by:
init
in interface Service
- Parameters:
services
- services instance.
- Throws:
ServiceException
- thrown if the log service could not be initialized.
-
getConfigurationDirectory
public static String getConfigurationDirectory()
throws ServiceException
- Throws:
ServiceException
-
destroy
public void destroy()
Destroy the configuration service.
-
getInterface
public Class<? extends Service> getInterface()
Return the public interface for configuration service.
- Specified by:
getInterface
in interface Service
- Returns:
ConfigurationService
.
-
getConf
public org.apache.hadoop.conf.Configuration getConf()
Return the services configuration.
- Returns:
- the services configuration.
-
getConfigDir
public String getConfigDir()
Return Oozie configuration directory.
- Returns:
- Oozie configuration directory.
-
instrument
public void instrument(Instrumentation instr)
Instruments the configuration service. It sets instrumentation variables indicating the config dir and
config file used.
- Specified by:
instrument
in interface Instrumentable
- Parameters:
instr
- instrumentation to use.
-
getMaskedConfiguration
public org.apache.hadoop.conf.Configuration getMaskedConfiguration()
Return a configuration with all sensitive values masked.
- Returns:
- masked configuration.
-
verifyConfigurationName
public void verifyConfigurationName()
Verify the configuration is in oozie-default
-
setBoolean
public static void setBoolean(String name,
boolean value)
-
getStrings
public static String[] getStrings(String name)
-
getStrings
public static String[] getStrings(org.apache.hadoop.conf.Configuration conf,
String name)
-
getBoolean
public static boolean getBoolean(String name)
-
getBoolean
public static boolean getBoolean(org.apache.hadoop.conf.Configuration conf,
String name)
-
getClasses
public static Class<?>[] getClasses(String name)
-
getClasses
public static Class<?>[] getClasses(org.apache.hadoop.conf.Configuration conf,
String name)
Copyright © 2015 Apache Software Foundation. All Rights Reserved.