org.apache.oozie.service
Class UUIDService

java.lang.Object
  extended by org.apache.oozie.service.UUIDService
All Implemented Interfaces:
Service

public class UUIDService
extends Object
implements Service

The UUID service generates unique IDs.

The configuration property CONF_GENERATOR specifies the ID generation type, 'random' or 'counter'.

For 'random' uses the JDK UUID.randomUUID() method.

For 'counter' uses a counter postfixed wit the system start up time.


Nested Class Summary
static class UUIDService.ApplicationType
           
 
Field Summary
static String CONF_GENERATOR
           
static String CONF_PREFIX
           
 
Fields inherited from interface org.apache.oozie.service.Service
DEFAULT_LOCK_TIMEOUT, lockTimeout, USE_XCOMMAND
 
Constructor Summary
UUIDService()
           
 
Method Summary
 void destroy()
          Destroy the UUID service.
 String generateChildId(String id, String childName)
          Create a child ID.
 String generateId(UUIDService.ApplicationType type)
          Create a unique ID.
 String getChildName(String childId)
          Return the child name from a child ID.
 String getId(String childId)
          Return the ID from a child ID.
 Class<? extends Service> getInterface()
          Return the public interface for UUID service.
 void init(Services services)
          Initialize the UUID service.
 
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_GENERATOR

public static final String CONF_GENERATOR
See Also:
Constant Field Values
Constructor Detail

UUIDService

public UUIDService()
Method Detail

init

public void init(Services services)
          throws ServiceException
Initialize the UUID service.

Specified by:
init in interface Service
Parameters:
services - services instance.
Throws:
ServiceException - thrown if the UUID service could not be initialized.

destroy

public void destroy()
Destroy the UUID service.

Specified by:
destroy in interface Service

getInterface

public Class<? extends Service> getInterface()
Return the public interface for UUID service.

Specified by:
getInterface in interface Service
Returns:
UUIDService.

generateId

public String generateId(UUIDService.ApplicationType type)
Create a unique ID.

Parameters:
type: - Type of Id. Generally 'C' for Coordinator and 'W' for Workflow.
Returns:
unique ID.

generateChildId

public String generateChildId(String id,
                              String childName)
Create a child ID.

If the same child name is given the returned child ID is the same.

Parameters:
id - unique ID.
childName - child name.
Returns:
a child ID.

getId

public String getId(String childId)
Return the ID from a child ID.

Parameters:
childId - child ID.
Returns:
ID of the child ID.

getChildName

public String getChildName(String childId)
Return the child name from a child ID.

Parameters:
childId - child ID.
Returns:
child name.


Copyright © 2013 Apache Software Foundation. All Rights Reserved.