org.apache.oozie.service
Class UUIDService

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

public class UUIDService
extends java.lang.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 java.lang.String CONF_GENERATOR
           
static java.lang.String CONF_PREFIX
           
 
Constructor Summary
UUIDService()
           
 
Method Summary
 void destroy()
          Destroy the UUID service.
 java.lang.String generateChildId(java.lang.String id, java.lang.String childName)
          Create a child ID.
 java.lang.String generateId(UUIDService.ApplicationType type)
          Create a unique ID.
 java.lang.String getChildName(java.lang.String childId)
          Return the child name from a child ID.
 java.lang.String getId(java.lang.String childId)
          Return the ID from a child ID.
 java.lang.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 java.lang.String CONF_PREFIX
See Also:
Constant Field Values

CONF_GENERATOR

public static final java.lang.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 java.lang.Class<? extends Service> getInterface()
Return the public interface for UUID service.

Specified by:
getInterface in interface Service
Returns:
UUIDService.

generateId

public java.lang.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 java.lang.String generateChildId(java.lang.String id,
                                        java.lang.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 java.lang.String getId(java.lang.String childId)
Return the ID from a child ID.

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

getChildName

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

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


Copyright © 2010 Yahoo. All Rights Reserved.