org.apache.oozie.command.coord
Class CoordUpdateXCommand

java.lang.Object
  extended by org.apache.oozie.command.XCommand<T>
      extended by org.apache.oozie.command.TransitionXCommand<String>
          extended by org.apache.oozie.command.SubmitTransitionXCommand
              extended by org.apache.oozie.command.coord.CoordSubmitXCommand
                  extended by org.apache.oozie.command.coord.CoordUpdateXCommand
All Implemented Interfaces:
Callable<String>, XCallable<String>

public class CoordUpdateXCommand
extends CoordSubmitXCommand

This class provides the functionalities to update coordinator job XML and properties. It uses CoordSubmitXCommand functionality to validate XML and resolve all the variables or properties using job configurations.


Field Summary
 
Fields inherited from class org.apache.oozie.command.coord.CoordSubmitXCommand
conf, CONF_CHECK_MAX_FREQUENCY, CONF_DEFAULT_CONCURRENCY, CONF_DEFAULT_MAX_TIMEOUT, CONF_DEFAULT_THROTTLE, CONF_DEFAULT_TIMEOUT_NORMAL, CONF_MAT_THROTTLING_FACTOR, CONF_QUEUE_SIZE, CONFIG_DEFAULT, COORD_INPUT_EVENTS, COORD_INPUT_EVENTS_DATA_IN, COORD_OUTPUT_EVENTS, COORD_OUTPUT_EVENTS_DATA_OUT, COORDINATOR_XML_FILE, coordJob, dryrun, jpaService
 
Fields inherited from class org.apache.oozie.command.TransitionXCommand
insertList, job, updateList
 
Fields inherited from class org.apache.oozie.command.XCommand
DEFAULT_LOCK_TIMEOUT, DEFAULT_REQUEUE_DELAY, eventService, instrumentation, INSTRUMENTATION_GROUP, LOG, logInfo
 
Constructor Summary
CoordUpdateXCommand(boolean dryrun, org.apache.hadoop.conf.Configuration conf, String jobId)
           
CoordUpdateXCommand(boolean dryrun, org.apache.hadoop.conf.Configuration conf, String jobId, boolean showDiff)
           
 
Method Summary
 void check(CoordinatorJobBean oldCoord, CoordinatorJobBean newCoord)
          Check.
 String getDryRun(CoordinatorJobBean job)
          Gets the dryrun output.
 String getEntityKey()
          Return the entity key for the command.
 String getKey()
          Get command key
protected  boolean isLockRequired()
          Indicate if the the command requires locking.
protected  void loadState()
          Load the necessary state to perform the precondition check and to execute the command.
 void notifyParent()
          This will be used to notify the parent about the status of that perticular job.
protected  void queueMaterializeTransitionXCommand(String jobId)
          Queue MaterializeTransitionXCommand
protected  String storeToDB(String xmlElement, org.jdom.Element eJob, CoordinatorJobBean coordJob)
          Write a coordinator job into database
protected  String submit()
          Submit the job
 void transitToNext()
          Transit to the next status based on the result of the Job.
protected  void verifyPrecondition()
          Verify the precondition for the command after a lock has been obtain, just before executing the command.
 
Methods inherited from class org.apache.oozie.command.coord.CoordSubmitXCommand
basicResolveAndIncludeDS, getJob, includeDataSets, initEvaluators, mergeDefaultConfig, performWrites, readAndValidateXml, readDefinition, resolveInitial, submitJob, updateJob
 
Methods inherited from class org.apache.oozie.command.SubmitTransitionXCommand
execute
 
Methods inherited from class org.apache.oozie.command.TransitionXCommand
generateEvents, setJob
 
Methods inherited from class org.apache.oozie.command.XCommand
call, call, eagerLoadState, eagerVerifyPrecondition, executeInterrupts, getCreatedTime, getInstrumentation, getLockTimeOut, getLog, getName, getPriority, getRequeueDelay, getType, inInterruptMode, isReQueueRequired, queue, queue, resetUsed, setInterruptMode, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CoordUpdateXCommand

public CoordUpdateXCommand(boolean dryrun,
                           org.apache.hadoop.conf.Configuration conf,
                           String jobId)

CoordUpdateXCommand

public CoordUpdateXCommand(boolean dryrun,
                           org.apache.hadoop.conf.Configuration conf,
                           String jobId,
                           boolean showDiff)
Method Detail

storeToDB

protected String storeToDB(String xmlElement,
                           org.jdom.Element eJob,
                           CoordinatorJobBean coordJob)
                    throws CommandException
Description copied from class: CoordSubmitXCommand
Write a coordinator job into database

Overrides:
storeToDB in class CoordSubmitXCommand
Parameters:
xmlElement - : Coordinator definition xml
eJob - : XML element of job
coordJob - : Coordinator job bean
Returns:
Job id
Throws:
CommandException - thrown if unable to save coordinator job to db

loadState

protected void loadState()
                  throws CommandException
Description copied from class: XCommand
Load the necessary state to perform the precondition check and to execute the command.

Subclasses must implement this method and load the state needed to do the precondition check and execute the command.

Overrides:
loadState in class CoordSubmitXCommand
Throws:
CommandException

verifyPrecondition

protected void verifyPrecondition()
                           throws CommandException
Description copied from class: XCommand
Verify the precondition for the command after a lock has been obtain, just before executing the command.

Overrides:
verifyPrecondition in class CoordSubmitXCommand
Throws:
CommandException - thrown if the precondition is not met.

submit

protected String submit()
                 throws CommandException
Description copied from class: SubmitTransitionXCommand
Submit the job

Overrides:
submit in class CoordSubmitXCommand
Returns:
the id
Throws:
CommandException - thrown if unable to submit

check

public void check(CoordinatorJobBean oldCoord,
                  CoordinatorJobBean newCoord)
           throws CommandException
Check. Frequency can't be changed. EndTime can't be changed. StartTime can't be changed. AppName can't be changed Timeunit can't be changed. Timezone can't be changed

Parameters:
oldCoord - the old coord
newCoord - the new coord
Throws:
CommandException - the command exception

queueMaterializeTransitionXCommand

protected void queueMaterializeTransitionXCommand(String jobId)
Description copied from class: CoordSubmitXCommand
Queue MaterializeTransitionXCommand

Overrides:
queueMaterializeTransitionXCommand in class CoordSubmitXCommand

notifyParent

public void notifyParent()
                  throws CommandException
Description copied from class: TransitionXCommand
This will be used to notify the parent about the status of that perticular job.

Overrides:
notifyParent in class CoordSubmitXCommand
Throws:
CommandException

isLockRequired

protected boolean isLockRequired()
Description copied from class: XCommand
Indicate if the the command requires locking.

Subclasses should override this method if they require locking.

Overrides:
isLockRequired in class CoordSubmitXCommand
Returns:
true/false

getEntityKey

public String getEntityKey()
Description copied from class: XCommand
Return the entity key for the command.

Specified by:
getEntityKey in interface XCallable<String>
Overrides:
getEntityKey in class CoordSubmitXCommand
Returns:
the entity key for the command.

transitToNext

public void transitToNext()
Description copied from class: TransitionXCommand
Transit to the next status based on the result of the Job.

Overrides:
transitToNext in class SubmitTransitionXCommand

getKey

public String getKey()
Description copied from class: XCommand
Get command key

Specified by:
getKey in interface XCallable<String>
Overrides:
getKey in class XCommand<String>
Returns:
command key

getDryRun

public String getDryRun(CoordinatorJobBean job)
                 throws Exception
Description copied from class: CoordSubmitXCommand
Gets the dryrun output.

Overrides:
getDryRun in class CoordSubmitXCommand
Returns:
the dry run
Throws:
Exception - the exception


Copyright © 2015 Apache Software Foundation. All Rights Reserved.