org.apache.oozie.command
Class TransitionXCommand<T>

java.lang.Object
  extended by org.apache.oozie.command.XCommand<T>
      extended by org.apache.oozie.command.TransitionXCommand<T>
Type Parameters:
T -
All Implemented Interfaces:
Callable<T>, XCallable<T>
Direct Known Subclasses:
KillTransitionXCommand, MaterializeTransitionXCommand, PauseTransitionXCommand, RerunTransitionXCommand, ResumeTransitionXCommand, StartTransitionXCommand, SubmitTransitionXCommand, SuspendTransitionXCommand, UnpauseTransitionXCommand

public abstract class TransitionXCommand<T>
extends XCommand<T>

This is the base commands for all the jobs related commands . This will drive the statuses for all the jobs and all the jobs will follow the same state machine.


Field Summary
protected  List<JsonBean> insertList
           
protected  org.apache.oozie.client.Job job
           
protected  List<JsonBean> updateList
           
 
Fields inherited from class org.apache.oozie.command.XCommand
DEFAULT_LOCK_TIMEOUT, DEFAULT_REQUEUE_DELAY, dryrun, eventService, instrumentation, INSTRUMENTATION_GROUP, LOG, logInfo
 
Constructor Summary
TransitionXCommand(String name, String type, int priority)
           
TransitionXCommand(String name, String type, int priority, boolean dryrun)
           
 
Method Summary
protected  T execute()
          Command execution body.
 void generateEvents(CoordinatorJobBean coordJob)
          This will be used to generate Job Notification events on status changes
 org.apache.oozie.client.Job getJob()
          Get the Job for the command.
abstract  void notifyParent()
          This will be used to notify the parent about the status of that perticular job.
abstract  void performWrites()
          This will be used to perform atomically all the writes within this command.
 void setJob(org.apache.oozie.client.Job job)
          Set the Job for the command.
abstract  void transitToNext()
          Transit to the next status based on the result of the Job.
abstract  void updateJob()
          Update the parent job.
 
Methods inherited from class org.apache.oozie.command.XCommand
call, eagerLoadState, eagerVerifyPrecondition, executeInterrupts, getCreatedTime, getEntityKey, getInstrumentation, getKey, getLockTimeOut, getLog, getName, getPriority, getRequeueDelay, getType, inInterruptMode, isLockRequired, isReQueueRequired, loadState, queue, queue, resetUsed, setInterruptMode, verifyPrecondition
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

job

protected org.apache.oozie.client.Job job

updateList

protected List<JsonBean> updateList

insertList

protected List<JsonBean> insertList
Constructor Detail

TransitionXCommand

public TransitionXCommand(String name,
                          String type,
                          int priority)

TransitionXCommand

public TransitionXCommand(String name,
                          String type,
                          int priority,
                          boolean dryrun)
Method Detail

transitToNext

public abstract void transitToNext()
                            throws CommandException
Transit to the next status based on the result of the Job.

Throws:
CommandException

updateJob

public abstract void updateJob()
                        throws CommandException
Update the parent job.

Throws:
CommandException

notifyParent

public abstract void notifyParent()
                           throws CommandException
This will be used to notify the parent about the status of that perticular job.

Throws:
CommandException

generateEvents

public void generateEvents(CoordinatorJobBean coordJob)
                    throws CommandException
This will be used to generate Job Notification events on status changes

Parameters:
user -
appName -
em -
Throws:
CommandException

performWrites

public abstract void performWrites()
                            throws CommandException
This will be used to perform atomically all the writes within this command.

Throws:
CommandException

execute

protected T execute()
             throws CommandException
Description copied from class: XCommand
Command execution body.

This method will be invoked after the {link #loadState} and {link #verifyPrecondition} methods.

If the command requires locking, this method will be invoked ONLY if the lock has been acquired.

Specified by:
execute in class XCommand<T>
Returns:
a return value from the execution of the command, only meaningful if the command is executed synchronously.
Throws:
CommandException - thrown if the command execution failed.

getJob

public org.apache.oozie.client.Job getJob()
Get the Job for the command.

Returns:
the job

setJob

public void setJob(org.apache.oozie.client.Job job)
Set the Job for the command.

Parameters:
job - the job


Copyright © 2013 Apache Software Foundation. All Rights Reserved.