public class Services extends Object
Services
. It has 2 built in
services: XLogService
and ConfigurationService
.
The rest of the services are loaded from the
CONF_SERVICE_CLASSES
configuration property. The services class names must be separated by commas (spaces
and enters are allowed).
The CONF_SYSTEM_MODE
configuration property is any of
NORMAL/SAFEMODE/NOWEBSERVICE.
Services are loaded and initialized in the order they are defined in the in configuration property.
After all services are initialized, if the Instrumentation service is present, all
services that implement the Instrumentable
are instrumented.
Services are destroyed in reverse order.
If services initialization fail, initialized services are immediatly destroyed.
Modifier and Type | Field and Description |
---|---|
static String |
CONF_DELETE_RUNTIME_DIR |
static String |
CONF_SERVICE_CLASSES |
static String |
CONF_SERVICE_EXT_CLASSES |
static String |
CONF_SYSTEM_ID |
static String |
CONF_SYSTEM_MODE |
static String |
OOZIE_HOME_DIR
Environment variable that indicates the location of the Oozie home directory.
|
Constructor and Description |
---|
Services()
Create a services.
|
Modifier and Type | Method and Description |
---|---|
void |
destroy()
Destroy all services.
|
static Services |
get()
Return the services singleton.
|
<T extends Service> |
get(Class<T> serviceKlass)
Return a service by its public interface.
|
org.apache.hadoop.conf.Configuration |
getConf()
Deprecated.
Use
ConfigurationService.get(String) to retrieve property from oozie configurations. |
static String |
getOozieHome() |
String |
getRuntimeDir()
Return the runtime directory of the Oozie instance.
|
String |
getSystemId()
Return the system ID, the value defined in the
CONF_SYSTEM_ID configuration property. |
OozieClient.SYSTEM_MODE |
getSystemMode()
Return active system mode.
|
void |
init()
Initialize all services define in the
CONF_SERVICE_CLASSES configuration property. |
static void |
setOozieHome() |
void |
setService(Class<? extends Service> klass)
Set a service programmatically.
|
void |
setSystemMode(OozieClient.SYSTEM_MODE sysMode)
Set and set system mode.
|
public static final String OOZIE_HOME_DIR
public static final String CONF_SYSTEM_ID
public static final String CONF_SERVICE_CLASSES
public static final String CONF_SERVICE_EXT_CLASSES
public static final String CONF_SYSTEM_MODE
public static final String CONF_DELETE_RUNTIME_DIR
public Services() throws ServiceException
The built in services are initialized.
ServiceException
- thrown if any of the built in services could not initialize.public static void setOozieHome() throws ServiceException
ServiceException
public static String getOozieHome() throws ServiceException
ServiceException
public OozieClient.SYSTEM_MODE getSystemMode()
.
public String getRuntimeDir()
The directory is created under TMP and it is always a new directory per Services initialization.
public String getSystemId()
CONF_SYSTEM_ID
configuration property.CONF_SYSTEM_ID
configuration property.public void setSystemMode(OozieClient.SYSTEM_MODE sysMode)
sysMode
- system mode@Deprecated public org.apache.hadoop.conf.Configuration getConf()
ConfigurationService.get(String)
to retrieve property from oozie configurations.public void init() throws ServiceException
CONF_SERVICE_CLASSES
configuration property.ServiceException
- thrown if any of the services could not initialize.public void destroy()
public <T extends Service> T get(Class<T> serviceKlass)
serviceKlass
- service public interface.null
if not define.public void setService(Class<? extends Service> klass) throws ServiceException
The service will be initialized by the services.
If a service is already defined with the same public interface it will be destroyed.
klass
- service klassServiceException
- if the service could not be initialized, at this point all services have been
destroyed.Copyright © 2018 Apache Software Foundation. All rights reserved.