org.stanwood.media.source.xbmc.cli
Class CLIManageAddons

java.lang.Object
  extended by org.stanwood.media.cli.BaseLauncher
      extended by org.stanwood.media.cli.AbstractLauncher
          extended by org.stanwood.media.source.xbmc.cli.CLIManageAddons
All Implemented Interfaces:
ICLICommand

public class CLIManageAddons
extends AbstractLauncher

The main XBMC addon manager command line command


Field Summary
protected  int subExitCode
           
 
Method Summary
protected  boolean checkArgs(org.apache.commons.cli.CommandLine cmd)
           
protected  java.lang.String checkSubCommand(java.lang.String arg)
           
 void displayHelp(org.apache.commons.cli.Options options, java.io.PrintStream stdout, java.io.PrintStream stderr)
          Called to display the commands help
protected  void handleBadSubCommandOption(org.apache.commons.cli.Options options, java.lang.String arg)
           
static void main(java.lang.String[] args)
           This CLI launcher command is used to manage XBMC addons.
protected  void printUsage(org.apache.commons.cli.Options options, java.io.PrintStream stdout, java.io.PrintStream stderr)
           
protected  boolean processOptions(java.lang.String[] args, org.apache.commons.cli.CommandLine cmd)
          This is called to validate the tools CLI options.
protected  boolean run()
          This is executed to make the tool perform its function and should be extended.
static void setExitHandler(IExitHandler handler)
          Used to se a exit handler
static void setStderr(java.io.PrintStream stream)
          Set the stderr that this command should use.
static void setStdout(java.io.PrintStream stream)
          Set the stdout that this command should use.
 
Methods inherited from class org.stanwood.media.cli.AbstractLauncher
getController, parseLongOption, processOptionsInternal, setConfig
 
Methods inherited from class org.stanwood.media.cli.BaseLauncher
addOption, doExit, fatal, fatal, getName, getOptions, getStderr, getStdout, info, init, launch, printOptions, shouldDisplayHelp, warn
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.stanwood.media.cli.ICLICommand
getName
 

Field Detail

subExitCode

protected int subExitCode
Method Detail

run

protected boolean run()
Description copied from class: BaseLauncher
This is executed to make the tool perform its function and should be extended.

Specified by:
run in class BaseLauncher
Returns:
True if executed without problems, otherwise false

processOptions

protected boolean processOptions(java.lang.String[] args,
                                 org.apache.commons.cli.CommandLine cmd)
Description copied from class: AbstractLauncher
This is called to validate the tools CLI options. When this is called, the default options added by AbstractLauncher will already have been validated sucesfully.

Specified by:
processOptions in class AbstractLauncher
cmd - The command line options
Returns:
True, if the command line options verified successfully, otherwise false

checkArgs

protected boolean checkArgs(org.apache.commons.cli.CommandLine cmd)

checkSubCommand

protected java.lang.String checkSubCommand(java.lang.String arg)
Overrides:
checkSubCommand in class BaseLauncher

handleBadSubCommandOption

protected void handleBadSubCommandOption(org.apache.commons.cli.Options options,
                                         java.lang.String arg)
Overrides:
handleBadSubCommandOption in class BaseLauncher

displayHelp

public void displayHelp(org.apache.commons.cli.Options options,
                        java.io.PrintStream stdout,
                        java.io.PrintStream stderr)
Description copied from class: BaseLauncher
Called to display the commands help

Overrides:
displayHelp in class BaseLauncher
Parameters:
options - The commands options
stdout - The standard output stream
stderr - The standard error stream

printUsage

protected void printUsage(org.apache.commons.cli.Options options,
                          java.io.PrintStream stdout,
                          java.io.PrintStream stderr)
Overrides:
printUsage in class BaseLauncher

main

public static void main(java.lang.String[] args)

This CLI launcher command is used to manage XBMC addons. It has sub commands and args listed below.

usage: mm-xbmc [--global-options] [--command-options] [arguments] Global options: --version, -v Display the version --config_file, -c The location of the config file. If not present, attempts to load it from /etc/mediamanager-conf.xml --log_config, -l The log config mode [||] --help, -h Show the help Commands: list lists the installed XBMC addons update Update the installed XBMC addons to the latest versions install Install a new XBMC addon remove Remove a installed XBMC addons

Parameters:
args - The arguments passed to the program from the command line

setExitHandler

public static void setExitHandler(IExitHandler handler)
Used to se a exit handler

Parameters:
handler - The exit handler

setStdout

public static void setStdout(java.io.PrintStream stream)
Set the stdout that this command should use. Mainly used by tests

Parameters:
stream - The stdout stream

setStderr

public static void setStderr(java.io.PrintStream stream)
Set the stderr that this command should use. Mainly used by tests

Parameters:
stream - The stderr stream