org.apache.oozie.command.bundle
Class BundleSubmitXCommand

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.bundle.BundleSubmitXCommand
All Implemented Interfaces:
Callable<String>, XCallable<String>

public class BundleSubmitXCommand
extends SubmitTransitionXCommand

This Command will submit the bundle.


Field Summary
static String BUNDLE_XML_FILE
           
static String CONFIG_DEFAULT
           
 
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, dryrun, eventService, instrumentation, INSTRUMENTATION_GROUP, LOG, logInfo
 
Constructor Summary
BundleSubmitXCommand(boolean dryrun, org.apache.hadoop.conf.Configuration conf)
          Constructor to create the bundle submit command.
BundleSubmitXCommand(org.apache.hadoop.conf.Configuration conf)
          Constructor to create the bundle submit command.
 
Method Summary
 ELEvaluator createEvaluator(org.apache.hadoop.conf.Configuration conf)
          Create ELEvaluator
protected  void eagerLoadState()
          Load the necessary state to perform an eager precondition check.
protected  void eagerVerifyPrecondition()
          Verify the precondition for the command before obtaining a lock.
 String getEntityKey()
          Return the entity key for the command.
 org.apache.oozie.client.Job getJob()
          Get the Job for the command.
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.
protected  void mergeDefaultConfig()
          Merge default configuration with user-defined configuration.
 void notifyParent()
          This will be used to notify the parent about the status of that perticular job.
 void performWrites()
          This will be used to perform atomically all the writes within this command.
protected  String readDefinition(String appPath)
          Read bundle definition.
protected  String submit()
          Submit the job
 void updateJob()
          Update the parent 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.SubmitTransitionXCommand
execute, transitToNext
 
Methods inherited from class org.apache.oozie.command.TransitionXCommand
generateEvents, setJob
 
Methods inherited from class org.apache.oozie.command.XCommand
call, executeInterrupts, getCreatedTime, getInstrumentation, getKey, getLockTimeOut, getLog, getName, getPriority, getRequeueDelay, getType, inInterruptMode, isReQueueRequired, queue, queue, resetUsed, setInterruptMode
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CONFIG_DEFAULT

public static final String CONFIG_DEFAULT
See Also:
Constant Field Values

BUNDLE_XML_FILE

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

BundleSubmitXCommand

public BundleSubmitXCommand(org.apache.hadoop.conf.Configuration conf)
Constructor to create the bundle submit command.

Parameters:
conf - configuration for bundle job

BundleSubmitXCommand

public BundleSubmitXCommand(boolean dryrun,
                            org.apache.hadoop.conf.Configuration conf)
Constructor to create the bundle submit command.

Parameters:
dryrun - true if dryrun is enable
conf - configuration for bundle job
Method Detail

submit

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

Specified by:
submit in class SubmitTransitionXCommand
Returns:
the id
Throws:
CommandException - thrown if unable to submit

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.

Specified by:
notifyParent in class TransitionXCommand<String>
Throws:
CommandException

getEntityKey

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

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

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.

Specified by:
isLockRequired in class XCommand<String>
Returns:
true/false

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.

Specified by:
loadState in class XCommand<String>
Throws:
CommandException

verifyPrecondition

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

Specified by:
verifyPrecondition in class XCommand<String>
Throws:
CommandException - thrown if the precondition is not met.
PreconditionException

eagerLoadState

protected void eagerLoadState()
                       throws CommandException
Description copied from class: XCommand
Load the necessary state to perform an eager precondition check.

This implementation does a NOP.

Subclasses should override this method and load the state needed to do an eager precondition check.

A trivial implementation is calling {link #loadState}.

Overrides:
eagerLoadState in class XCommand<String>
Throws:
CommandException

eagerVerifyPrecondition

protected void eagerVerifyPrecondition()
                                throws CommandException,
                                       PreconditionException
Description copied from class: XCommand
Verify the precondition for the command before obtaining a lock.

This implementation does a NOP.

A trivial implementation is calling {link #verifyPrecondition}.

Overrides:
eagerVerifyPrecondition in class XCommand<String>
Throws:
CommandException - thrown if the precondition is not met.
PreconditionException

mergeDefaultConfig

protected void mergeDefaultConfig()
                           throws CommandException
Merge default configuration with user-defined configuration.

Throws:
CommandException - thrown if failed to merge configuration

readDefinition

protected String readDefinition(String appPath)
                         throws BundleJobException
Read bundle definition.

Parameters:
appPath - application path.
user - user name.
group - group name.
Returns:
bundle definition.
Throws:
BundleJobException - thrown if the definition could not be read.

getJob

public org.apache.oozie.client.Job getJob()
Description copied from class: TransitionXCommand
Get the Job for the command.

Overrides:
getJob in class TransitionXCommand<String>
Returns:
the job

createEvaluator

public ELEvaluator createEvaluator(org.apache.hadoop.conf.Configuration conf)
                            throws BundleJobException
Create ELEvaluator

Parameters:
conf - job configuration
Returns:
ELEvaluator the evaluator for el function
Throws:
BundleJobException - thrown if failed to create evaluator

updateJob

public void updateJob()
               throws CommandException
Description copied from class: TransitionXCommand
Update the parent job.

Specified by:
updateJob in class TransitionXCommand<String>
Throws:
CommandException

performWrites

public void performWrites()
                   throws CommandException
Description copied from class: TransitionXCommand
This will be used to perform atomically all the writes within this command.

Specified by:
performWrites in class TransitionXCommand<String>
Throws:
CommandException


Copyright © 2013 Apache Software Foundation. All Rights Reserved.