org.apache.oozie.command.coord
Class CoordCommandUtils

java.lang.Object
  extended by org.apache.oozie.command.coord.CoordCommandUtils

public class CoordCommandUtils
extends Object


Field Summary
static int CURRENT
           
static int FUTURE
           
static int LATEST
           
static int OFFSET
           
static String RESOLVED_UNRESOLVED_SEPARATOR
           
static int UNEXPECTED
           
static String UNRESOLVED_INST_TAG
           
 
Constructor Summary
CoordCommandUtils()
           
 
Method Summary
static void checkIfBothSameType(String startInst, String endInst)
           
static String createEarlyURIs(org.jdom.Element event, String instances, StringBuilder unresolvedInstances, StringBuilder urisWithDoneFlag)
          The function create a list of URIs separated by "," using the instances time stamp and URI-template
static int getFuncType(String function)
           
static int getInstanceNumber(String function, StringBuilder restArg)
          parse a function like coord:latest(n)/future() and return the 'n'.
static String getResolvedList(String missDepList, StringBuilder resolved, StringBuilder unresolved)
          Get resolved string from missDepList
static Map<String,StringBuilder> materializeDataEvents(List<org.jdom.Element> events, SyncCoordAction appInst, org.apache.hadoop.conf.Configuration conf)
          Materialize all / or / tags Create uris for resolved instances.
static String materializeInstance(org.jdom.Element event, String expr, SyncCoordAction appInst, org.apache.hadoop.conf.Configuration conf, ELEvaluator evalInst)
          Materialize one instance like current(-2)
static String materializeOneInstance(String jobId, boolean dryrun, org.jdom.Element eAction, Date nominalTime, Date actualTime, int instanceCount, org.apache.hadoop.conf.Configuration conf, CoordinatorActionBean actionBean)
          Materialize one instance for specific nominal time.
static boolean materializeSLA(org.jdom.Element eSla, Date nominalTime, org.apache.hadoop.conf.Configuration conf)
           
static int parseOneArg(String funcName)
           
static void resolveInstanceRange(org.jdom.Element event, StringBuilder instances, SyncCoordAction appInst, org.apache.hadoop.conf.Configuration conf, ELEvaluator eval)
          Resolve tag.
static void resolveInstances(org.jdom.Element event, StringBuilder instances, SyncCoordAction actionInst, org.apache.hadoop.conf.Configuration conf, ELEvaluator eval)
          Resolve list of tags.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CURRENT

public static int CURRENT

LATEST

public static int LATEST

FUTURE

public static int FUTURE

OFFSET

public static int OFFSET

UNEXPECTED

public static int UNEXPECTED

RESOLVED_UNRESOLVED_SEPARATOR

public static final String RESOLVED_UNRESOLVED_SEPARATOR
See Also:
Constant Field Values

UNRESOLVED_INST_TAG

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

CoordCommandUtils

public CoordCommandUtils()
Method Detail

getInstanceNumber

public static int getInstanceNumber(String function,
                                    StringBuilder restArg)
                             throws Exception
parse a function like coord:latest(n)/future() and return the 'n'.

Parameters:
function -
restArg -
Returns:
int instanceNumber
Throws:
Exception

parseOneArg

public static int parseOneArg(String funcName)
                       throws Exception
Throws:
Exception

getFuncType

public static int getFuncType(String function)
Parameters:
EL - function name
Returns:
type of EL function

checkIfBothSameType

public static void checkIfBothSameType(String startInst,
                                       String endInst)
                                throws CommandException
Parameters:
startInst: - EL function name
endInst: - EL function name
Throws:
CommandException - if both are not the same function

resolveInstances

public static void resolveInstances(org.jdom.Element event,
                                    StringBuilder instances,
                                    SyncCoordAction actionInst,
                                    org.apache.hadoop.conf.Configuration conf,
                                    ELEvaluator eval)
                             throws Exception
Resolve list of tags.

Parameters:
event -
instances -
actionInst -
conf -
eval: - ELEvalautor
Throws:
Exception

resolveInstanceRange

public static void resolveInstanceRange(org.jdom.Element event,
                                        StringBuilder instances,
                                        SyncCoordAction appInst,
                                        org.apache.hadoop.conf.Configuration conf,
                                        ELEvaluator eval)
                                 throws Exception
Resolve tag. Don't resolve any latest()/future()

Parameters:
event -
instances -
appInst -
conf -
eval: - ELEvalautor
Throws:
Exception

materializeInstance

public static String materializeInstance(org.jdom.Element event,
                                         String expr,
                                         SyncCoordAction appInst,
                                         org.apache.hadoop.conf.Configuration conf,
                                         ELEvaluator evalInst)
                                  throws Exception
Materialize one instance like current(-2)

Parameters:
event - :
expr - : instance like current(-1)
appInst - : application specific info
conf -
evalInst - :ELEvaluator
Returns:
materialized date string
Throws:
Exception

createEarlyURIs

public static String createEarlyURIs(org.jdom.Element event,
                                     String instances,
                                     StringBuilder unresolvedInstances,
                                     StringBuilder urisWithDoneFlag)
                              throws Exception
The function create a list of URIs separated by "," using the instances time stamp and URI-template

Parameters:
event - : event
instances - : List of time stamp separated by ","
unresolvedInstances - : list of instance with latest function
urisWithDoneFlag - : list of URIs with the done flag appended
Returns:
: list of URIs separated by ";" as a string.
Throws:
Exception

materializeSLA

public static boolean materializeSLA(org.jdom.Element eSla,
                                     Date nominalTime,
                                     org.apache.hadoop.conf.Configuration conf)
                              throws CoordinatorJobException
Parameters:
eSla -
nominalTime -
conf -
Returns:
boolean to determine whether the SLA element is present or not
Throws:
CoordinatorJobException

materializeOneInstance

public static String materializeOneInstance(String jobId,
                                            boolean dryrun,
                                            org.jdom.Element eAction,
                                            Date nominalTime,
                                            Date actualTime,
                                            int instanceCount,
                                            org.apache.hadoop.conf.Configuration conf,
                                            CoordinatorActionBean actionBean)
                                     throws Exception
Materialize one instance for specific nominal time. It includes: 1. Materialize data events (i.e. and ) 2. Materialize data properties (i.e dataIn() and dataOut() 3. remove 'start' and 'end' tag 4. Add 'instance_number' and 'nominal-time' tag

Parameters:
jobId - coordinator job id
dryrun - true if it is dryrun
eAction - frequency unexploded-job
nominalTime - materialization time
actualTime - action actual time
instanceCount - instance numbers
conf - job configuration
actionBean - CoordinatorActionBean to materialize
Returns:
one materialized action for specific nominal time
Throws:
Exception

materializeDataEvents

public static Map<String,StringBuilder> materializeDataEvents(List<org.jdom.Element> events,
                                                              SyncCoordAction appInst,
                                                              org.apache.hadoop.conf.Configuration conf)
                                                       throws Exception
Materialize all / or / tags Create uris for resolved instances. Create unresolved instance for latest()/future().

Parameters:
events -
appInst -
conf -
Throws:
Exception

getResolvedList

public static String getResolvedList(String missDepList,
                                     StringBuilder resolved,
                                     StringBuilder unresolved)
Get resolved string from missDepList

Parameters:
missDepList -
resolved -
unresolved -
Returns:
resolved string


Copyright © 2013 Apache Software Foundation. All Rights Reserved.