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  org.apache.oozie.client.Job job
           
 
Fields inherited from class org.apache.oozie.command.XCommand
DEFAULT_LOCK_TIMEOUT, DEFAULT_REQUEUE_DELAY, dryrun, 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.
 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.
 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, getCreatedTime, getEntityKey, getInstrumentation, getKey, getLockTimeOut, getLog, getName, getPriority, getRequeueDelay, getType, isLockRequired, isReQueueRequired, loadState, queue, queue, resetUsed, 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
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

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 © 2012 Apache Software Foundation. All Rights Reserved.