org.apache.oozie.service
Class ConfigurationService

java.lang.Object
  extended by org.apache.oozie.service.ConfigurationService
All Implemented Interfaces:
Service, Instrumentable

public class ConfigurationService
extends Object
implements Service, Instrumentable

Built in service that initializes the services configuration.

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
static String CONF_IGNORE_SYS_PROPS
           
static String CONF_PREFIX
           
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, USE_XCOMMAND
 
Constructor Summary
ConfigurationService()
           
 
Method Summary
 void destroy()
          Destroy the configuration service.
 org.apache.hadoop.conf.Configuration getConf()
          Return the services configuration.
 String getConfigDir()
          Return Oozie configuration directory.
static String getConfigurationDirectory()
           
 Class<? extends Service> getInterface()
          Return the public interface for configuration service.
 void init(Services services)
          Initialize the log service.
 void instrument(Instrumentation instr)
          Instruments the configuration service.
static org.apache.hadoop.conf.Configuration maskPasswords(org.apache.hadoop.conf.Configuration conf)
          Return a configuration with all sensitive values masked.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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

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.

Specified by:
destroy in interface 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.

maskPasswords

public static org.apache.hadoop.conf.Configuration maskPasswords(org.apache.hadoop.conf.Configuration conf)
Return a configuration with all sensitive values masked.

Parameters:
conf - configuration to mask.
Returns:
masked configuration.


Copyright © 2013 Apache Software Foundation. All Rights Reserved.