org.apache.oozie.service
Class ShareLibService

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

public class ShareLibService
extends Object
implements Service, Instrumentable


Field Summary
static SimpleDateFormat dateFormat
           
static String FAIL_FAST_ON_STARTUP
           
static String LAUNCHER_PREFIX
           
static String LAUNCHERJAR_LIB_RETENTION
           
static String PURGE_INTERVAL
           
static String SHARE_LIB_CONF_PREFIX
           
static String SHARED_LIB_PREFIX
           
static String SHARELIB_MAPPING_FILE
           
static String SHIP_LAUNCHER_JAR
           
 
Fields inherited from interface org.apache.oozie.service.Service
CONF_PREFIX, DEFAULT_LOCK_TIMEOUT, lockTimeout, USE_XCOMMAND
 
Constructor Summary
ShareLibService()
           
 
Method Summary
 void destroy()
          Destroy the service.
protected  String findContainingJar(Class clazz)
          Find containing jar containing.
 org.apache.hadoop.fs.FileSystem getFileSystem()
          Returns file system for shared libraries.
 Class<? extends Service> getInterface()
          Return the public interface of the service.
 org.apache.hadoop.fs.Path getLatestLibPath(org.apache.hadoop.fs.Path rootDir, String prefix)
          Gets the Latest lib path.
 Map<String,List<org.apache.hadoop.fs.Path>> getShareLib()
           
 List<org.apache.hadoop.fs.Path> getShareLibJars(String actionKey)
          Gets the action system lib common jars.
 List<org.apache.hadoop.fs.Path> getSystemLibJars(String actionKey)
          Gets the launcher jars.
 void init(Services services)
          Initialize the service.
 void instrument(Instrumentation instr)
          Instruments the log service.
 Map<String,String> updateShareLib()
          Update share lib cache.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LAUNCHERJAR_LIB_RETENTION

public static final String LAUNCHERJAR_LIB_RETENTION
See Also:
Constant Field Values

SHARELIB_MAPPING_FILE

public static final String SHARELIB_MAPPING_FILE
See Also:
Constant Field Values

SHIP_LAUNCHER_JAR

public static final String SHIP_LAUNCHER_JAR
See Also:
Constant Field Values

PURGE_INTERVAL

public static final String PURGE_INTERVAL
See Also:
Constant Field Values

FAIL_FAST_ON_STARTUP

public static final String FAIL_FAST_ON_STARTUP
See Also:
Constant Field Values

LAUNCHER_PREFIX

public static final String LAUNCHER_PREFIX
See Also:
Constant Field Values

SHARED_LIB_PREFIX

public static final String SHARED_LIB_PREFIX
See Also:
Constant Field Values

dateFormat

public static final SimpleDateFormat dateFormat

SHARE_LIB_CONF_PREFIX

public static String SHARE_LIB_CONF_PREFIX
Constructor Detail

ShareLibService

public ShareLibService()
Method Detail

init

public void init(Services services)
          throws ServiceException
Description copied from interface: Service
Initialize the service.

Invoked by the Service singleton at start up time.

Specified by:
init in interface Service
Parameters:
services - services singleton initializing the service.
Throws:
ServiceException - thrown if the service could not initialize.

getShareLib

public Map<String,List<org.apache.hadoop.fs.Path>> getShareLib()

getShareLibJars

public List<org.apache.hadoop.fs.Path> getShareLibJars(String actionKey)
                                                throws IOException
Gets the action system lib common jars.

Parameters:
actionKey - the action key
Returns:
List of paths
Throws:
IOException

getSystemLibJars

public List<org.apache.hadoop.fs.Path> getSystemLibJars(String actionKey)
                                                 throws IOException
Gets the launcher jars.

Parameters:
actionKey - the action key
Returns:
launcher jars paths
Throws:
ClassNotFoundException
IOException

findContainingJar

protected String findContainingJar(Class clazz)
Find containing jar containing.

Parameters:
clazz - the clazz
Returns:
the string

destroy

public void destroy()
Description copied from interface: Service
Destroy the service.

Invoked by the Service singleton at shutdown time.

Specified by:
destroy in interface Service

getInterface

public Class<? extends Service> getInterface()
Description copied from interface: Service
Return the public interface of the service.

Services are retrieved by its public interface. Specializations of services must return the public interface.

Specified by:
getInterface in interface Service
Returns:
the interface of the service.

updateShareLib

public Map<String,String> updateShareLib()
                                  throws IOException
Update share lib cache.

Returns:
the map
Throws:
IOException - Signals that an I/O exception has occurred.

getLatestLibPath

public org.apache.hadoop.fs.Path getLatestLibPath(org.apache.hadoop.fs.Path rootDir,
                                                  String prefix)
                                           throws IOException
Gets the Latest lib path.

Parameters:
rootDir - the root dir
prefix - the prefix
Returns:
latest lib path
Throws:
IOException - Signals that an I/O exception has occurred.

instrument

public void instrument(Instrumentation instr)
Instruments the log service.

It sets instrumentation variables indicating the location of the sharelib and launcherlib

Specified by:
instrument in interface Instrumentable
Parameters:
instr - instrumentation to use.

getFileSystem

public org.apache.hadoop.fs.FileSystem getFileSystem()
Returns file system for shared libraries.

If WorkflowAppService#getSystemLibPath doesn't have authority then a default one assumed

Returns:
file system for shared libraries


Copyright © 2015 Apache Software Foundation. All Rights Reserved.