com.dtolabs.rundeck.core.cli.queue
Class QueueTool

java.lang.Object
  extended by com.dtolabs.rundeck.core.cli.BaseTool
      extended by com.dtolabs.rundeck.core.cli.queue.QueueTool
All Implemented Interfaces:
CLITool, CLIToolLogger, BaseLogger

public class QueueTool
extends BaseTool
implements CLIToolLogger

QueueTool is ...


Nested Class Summary
static class QueueTool.Actions
          Enumeration of available actions
 
Field Summary
static java.lang.String ACTION_FOLLOW
          kill action identifier
static java.lang.String ACTION_KILL
          kill action identifier
static java.lang.String ACTION_LIST
          list action identifier
static org.apache.log4j.Logger log4j
          log4j
 
Constructor Summary
QueueTool()
          Create QueueTool with default Framework instances located by the system rdeck.base property.
QueueTool(CLIToolLogger logger)
          Create QueueTool specifying the logger
QueueTool(Framework framework)
          Create QueueTool specifying the framework
QueueTool(Framework framework, CLIToolLogger logger)
          Create QueueTool with the framework.
 
Method Summary
 void debug(java.lang.String message)
          Logs debug message via implementation specific log facility
 void error(java.lang.String output)
          Logs error message via implementation specific log facility
static boolean followAction(java.lang.String execid, boolean restart, ConsoleExecutionFollowReceiver.Mode mode, Framework framework, java.io.PrintStream out, BaseLogger logger)
          Perform the Follow action for an Execution
 QueueTool.Actions getAction()
          Get action
 java.lang.String getExecid()
          Get jobId for use with Kill action
 java.lang.String getHelpString()
          Return the help string used when -h option is specified.
protected  void go()
          Call the action
 boolean isArgVerbose()
          Return verbose
protected  boolean isUseHelpOption()
          Return true if the -h/--help option should be added to the options automatically.
 void log(java.lang.String output)
          Logs message via implementation specific log facility
static void main(java.lang.String[] args)
          Creates an instance and executes BaseTool.run(String[]).
 org.apache.commons.cli.CommandLine parseArgs(java.lang.String[] args)
          Reads the argument vector and constructs a CommandLine object containing params
 void setAction(QueueTool.Actions action)
          Set action
 void setArgVerbose(boolean argVerbose)
          Set verbose
 void setExecid(java.lang.String execid)
          Set execid for use with kill action
 void verbose(java.lang.String message)
          Logs verbose message via implementation specific log facility
 void warn(java.lang.String output)
          Logs warning message via implementation specific log facility
 
Methods inherited from class com.dtolabs.rundeck.core.cli.BaseTool
addToolOptions, exit, getCommandLine, getOptions, help, initOptions, run, setShouldExit, validateOptions
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log4j

public static final org.apache.log4j.Logger log4j
log4j


ACTION_LIST

public static final java.lang.String ACTION_LIST
list action identifier

See Also:
Constant Field Values

ACTION_KILL

public static final java.lang.String ACTION_KILL
kill action identifier

See Also:
Constant Field Values

ACTION_FOLLOW

public static final java.lang.String ACTION_FOLLOW
kill action identifier

See Also:
Constant Field Values
Constructor Detail

QueueTool

public QueueTool()
Create QueueTool with default Framework instances located by the system rdeck.base property.


QueueTool

public QueueTool(CLIToolLogger logger)
Create QueueTool specifying the logger

Parameters:
logger - the logger

QueueTool

public QueueTool(Framework framework)
Create QueueTool specifying the framework

Parameters:
framework - framework

QueueTool

public QueueTool(Framework framework,
                 CLIToolLogger logger)
Create QueueTool with the framework.

Parameters:
framework - the framework
logger - the logger
Method Detail

getAction

public QueueTool.Actions getAction()
Get action

Returns:
action

setAction

public void setAction(QueueTool.Actions action)
Set action

Parameters:
action - the action

getExecid

public java.lang.String getExecid()
Get jobId for use with Kill action

Returns:
execution ID

setExecid

public void setExecid(java.lang.String execid)
Set execid for use with kill action

Parameters:
execid - execution ID

isArgVerbose

public boolean isArgVerbose()
Return verbose

Returns:
is verbose

setArgVerbose

public void setArgVerbose(boolean argVerbose)
Set verbose

Parameters:
argVerbose - is verbose

main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception
Creates an instance and executes BaseTool.run(String[]).

Parameters:
args - command line arg vector
Throws:
java.lang.Exception - action error

isUseHelpOption

protected boolean isUseHelpOption()
Description copied from class: BaseTool
Return true if the -h/--help option should be added to the options automatically.

Specified by:
isUseHelpOption in class BaseTool
Returns:

getHelpString

public java.lang.String getHelpString()
Description copied from class: BaseTool
Return the help string used when -h option is specified.

Specified by:
getHelpString in class BaseTool
Returns:

parseArgs

public org.apache.commons.cli.CommandLine parseArgs(java.lang.String[] args)
                                             throws CLIToolOptionsException
Reads the argument vector and constructs a CommandLine object containing params

Specified by:
parseArgs in interface CLITool
Overrides:
parseArgs in class BaseTool
Parameters:
args - the cli arg vector
Returns:
a new instance of CommandLine
Throws:
CLIToolOptionsException - if arguments are incorrect

go

protected void go()
           throws QueueToolException,
                  CLIToolOptionsException
Call the action

Specified by:
go in class BaseTool
Throws:
QueueToolException - if an error occurs
CLIToolOptionsException

followAction

public static boolean followAction(java.lang.String execid,
                                   boolean restart,
                                   ConsoleExecutionFollowReceiver.Mode mode,
                                   Framework framework,
                                   java.io.PrintStream out,
                                   BaseLogger logger)
                            throws CentralDispatcherException
Perform the Follow action for an Execution

Parameters:
mode - follow mode
framework - framework
out - output for progress marks
logger - logger for output of log lines
execid - the execution id
Throws:
CentralDispatcherException - if any error occurs

log

public void log(java.lang.String output)
Description copied from interface: BaseLogger
Logs message via implementation specific log facility

Specified by:
log in interface BaseLogger
Parameters:
output - message to log

error

public void error(java.lang.String output)
Description copied from interface: BaseLogger
Logs error message via implementation specific log facility

Specified by:
error in interface BaseLogger
Parameters:
output - message to log

warn

public void warn(java.lang.String output)
Description copied from interface: BaseLogger
Logs warning message via implementation specific log facility

Specified by:
warn in interface BaseLogger
Parameters:
output - message to log

verbose

public void verbose(java.lang.String message)
Logs verbose message via implementation specific log facility

Specified by:
verbose in interface BaseLogger
Parameters:
message - message to log

debug

public void debug(java.lang.String message)
Description copied from interface: BaseLogger
Logs debug message via implementation specific log facility

Specified by:
debug in interface BaseLogger
Parameters:
message - message to log