org.marketcetera.util.auth
Class CliContext

java.lang.Object
  extended by org.marketcetera.util.auth.Context<CliSetter<?>>
      extended by org.marketcetera.util.auth.CliContext

public class CliContext
extends Context<CliSetter<?>>

A context for command-line setters (CliSetter). This context provides command-line parsing, so that individual setters may use command-line options to set their holder data.

Since:
0.5.0
Version:
$Id: CliContext.java 16154 2012-07-14 16:34:05Z colin $
Author:
tlerios@marketcetera.com

Constructor Summary
CliContext(boolean override, String[] args)
          Constructor mirroring superclass constructor.
CliContext(I18NBoundMessage name, boolean override, String[] args)
          Constructor mirroring superclass constructor.
 
Method Summary
 String[] getArgs()
          Returns the receiver's command-line arguments.
 CommandLine getCommandLine()
          Returns the receiver's parsed command-line.
 OptionsProvider getOptionsProvider()
          Returns the receiver's options provider.
 ParseException getParseException()
          Returns any failure that the receiver encountered when parsing the command line.
 void setOptionsProvider(OptionsProvider optionsProvider)
          Sets the receiver's options provider, via which additional options may be added to the command-line.
 void setValues()
          Sets the data of the holders associated with the receivers' setters.
 
Methods inherited from class org.marketcetera.util.auth.Context
add, getName, getOverride, getSetters, printUsage, shouldProcess
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CliContext

public CliContext(I18NBoundMessage name,
                  boolean override,
                  String[] args)
Constructor mirroring superclass constructor. The new context will use the given command-line arguments.

Parameters:
args - The command-line arguments.
See Also:
Context.Context(I18NBoundMessage,boolean)

CliContext

public CliContext(boolean override,
                  String[] args)
Constructor mirroring superclass constructor. The context name is set automatically to a default value. The new context will use the given command-line arguments.

Parameters:
args - The command-line arguments.
See Also:
Context.Context(I18NBoundMessage,boolean)
Method Detail

getArgs

public String[] getArgs()
Returns the receiver's command-line arguments.

Returns:
The arguments.

getCommandLine

public CommandLine getCommandLine()
Returns the receiver's parsed command-line. It may be null if the receiver never had a reason to parse the command-line (such as a non-override context which is asked to set values after all values have already been set).

Returns:
The parsed command-line.

setValues

public void setValues()
               throws I18NException
Description copied from class: Context
Sets the data of the holders associated with the receivers' setters. Setters may be unable/unwilling to set their holder data so, when this method returns, some holders may still have unset data.

Specified by:
setValues in class Context<CliSetter<?>>
Throws:
I18NException - Thrown if the receiver cannot create an operational context for its setters, and therefore the setters cannot even attempt to set their holder data.

setOptionsProvider

public void setOptionsProvider(OptionsProvider optionsProvider)
Sets the receiver's options provider, via which additional options may be added to the command-line.

Parameters:
optionsProvider - The provider.

getOptionsProvider

public OptionsProvider getOptionsProvider()
Returns the receiver's options provider.

Returns:
The provider.

getParseException

public ParseException getParseException()
Returns any failure that the receiver encountered when parsing the command line.

Returns:
The failure. It may be null if no failure took place.


Copyright © 2012. All Rights Reserved.