|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.fhcrc.cpl.toolbox.commandline.BaseCommandLineModuleImpl
public abstract class BaseCommandLineModuleImpl
Base class for command line modules. Command line modules do not have to extend this class (they only need to implement CommandLineModule), but it's highly recommended, because this class provides dozens of highly useful convenience methods for argument management
| Field Summary | |
|---|---|
protected java.util.Map<java.lang.String,CommandLineArgumentDefinition> |
mArgumentDefs
|
protected java.util.Map<java.lang.String,java.lang.Object> |
mArgumentValues
|
protected java.util.Map<java.lang.String,java.lang.String> |
mArgumentValueStrings
|
protected java.lang.String |
mCommandName
|
protected java.lang.String |
mHelpMessage
|
protected java.lang.String |
mShortDescription
|
protected java.lang.String |
mUsageMessage
|
| Fields inherited from interface org.fhcrc.cpl.toolbox.commandline.CommandLineModule |
|---|
MODULE_HELP_AUTOMATIC, MODULE_USAGE_AUTOMATIC, UNNAMED_ARG_SERIES_SEPARATOR |
| Constructor Summary | |
|---|---|
BaseCommandLineModuleImpl()
|
|
| Method Summary | |
|---|---|
protected void |
addArgumentDefinition(CommandLineArgumentDefinition def)
Add an argument definition |
protected void |
addArgumentDefinitions(CommandLineArgumentDefinition[] defArray)
Add argument definitions |
protected void |
addArgumentDefinitions(CommandLineArgumentDefinition[] defArray,
boolean advanced)
Add a argument definitions, setting the "advanced" state appropriately |
protected void |
assertArgumentAbsent(java.lang.String argumentName)
Asserts the absence of an argument. |
protected void |
assertArgumentAbsent(java.lang.String argumentName,
java.lang.String requiredAbsentByArgument)
Asserts the absence of an argument. |
protected void |
assertArgumentPresent(java.lang.String argumentName)
Asserts the presence of an argument. |
protected void |
assertArgumentPresent(java.lang.String requiredArgumentName,
java.lang.String requiredByArgumentName)
Asserts the presence of an argument. |
protected java.lang.String |
createArgsTableHTML(CommandLineArgumentDefinition[] argDefs)
|
protected FileToReadArgumentDefinition |
createUnnamedFileArgumentDefinition(boolean required,
java.lang.String helpText)
|
protected FileToReadArgumentDefinition |
createUnnamedSeriesFileArgumentDefinition(boolean required,
java.lang.String helpText)
Cover method for ArgumentDefinitionFactory method |
void |
digestArguments(java.util.Map<java.lang.String,java.lang.String> argumentValueMap)
Digest raw string argument values. |
CommandLineArgumentDefinition[] |
getAdvancedArgumentDefinitions()
Implements a method in CommandLineModule |
CommandLineArgumentDefinition |
getArgumentDefinition(java.lang.String argumentName)
Implements a method in CommandLineModule |
CommandLineArgumentDefinition[] |
getArgumentDefinitions()
Implements a method in CommandLineModule |
CommandLineArgumentDefinition[] |
getArgumentDefinitionsSortedForDisplay()
Return the array of argument definitions in the proper display order |
protected java.lang.Object |
getArgumentValue(java.lang.String argumentName)
|
protected java.util.Map<java.lang.String,java.lang.Object> |
getArgumentValues()
|
java.util.Map<java.lang.String,java.lang.String> |
getArgumentValueStrings()
Return the original argument name-value pairs that were passed into this module via digestArguments() |
CommandLineArgumentDefinition[] |
getBasicArgumentDefinitions()
Implements a method in CommandLineModule |
protected boolean |
getBooleanArgumentValue(java.lang.String argumentName)
|
java.lang.String |
getCommandName()
|
protected DeltaMassArgumentDefinition.DeltaMassWithType |
getDeltaMassArgumentValue(java.lang.String argumentName)
|
protected double |
getDoubleArgumentValue(java.lang.String argumentName)
|
protected double[] |
getDoubleArrayArgumentValue(java.lang.String argumentName)
|
protected Protein[] |
getFastaFileArgumentValue(java.lang.String argumentName)
|
protected java.io.File |
getFileArgumentValue(java.lang.String argumentName)
|
protected java.io.File[] |
getFileArrayArgumentValue(java.lang.String argumentName)
|
protected float |
getFloatArgumentValue(java.lang.String argumentName)
|
java.lang.String |
getFullHelp()
Returns the full help message to be displayed by --help |
java.lang.String |
getHelpMessage()
a String giving the user detailed help on invoking this command |
java.lang.String |
getHtmlHelpFragment()
Returns an HTML fragment containing full help information for this module |
protected int |
getIntegerArgumentValue(java.lang.String argumentName)
|
protected MS2Modification[] |
getModificationListArgumentValue(java.lang.String argumentName)
|
protected static java.io.PrintWriter |
getPrintWriter(java.io.File outFile)
|
java.lang.String |
getShortDescription()
|
protected java.lang.String |
getStringArgumentValue(java.lang.String argumentName)
|
protected java.lang.Object |
getUnnamedArgumentValue()
process an arguments from the unnamed definition, converting it to a given argument type |
protected java.io.File |
getUnnamedFileArgumentValue()
|
protected java.lang.Object[] |
getUnnamedSeriesArgumentValues()
process a bunch of arguments from the unnamed series definition, converting them to a given argument type |
protected java.io.File[] |
getUnnamedSeriesFileArgumentValues()
Convenience method for getting an array of files specified in an unnamed series, since files are the things most commonly specified that way. |
java.lang.String |
getUsage()
|
boolean |
hasAdvancedArguments()
Does this module have any 'advanced' arguments? |
protected boolean |
hasArgumentValue(java.lang.String argumentName)
Convenience method to tell whether an argument map contains an argument |
protected boolean |
hasUnnamedArgumentValue()
|
protected boolean |
hasUnnamedSeriesArgumentValue()
|
void |
invoke(java.util.Map<java.lang.String,java.lang.String> argumentValues)
Invoke the CommandLineModule, using the argument values specified in the argumentValues array. |
protected java.lang.String |
makeHtmlSafe(java.lang.String plainString)
|
protected CommandLineArgumentDefinition[] |
sortArgDefsForDisplay(java.util.Map<java.lang.String,CommandLineArgumentDefinition> defMap)
|
java.lang.String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface org.fhcrc.cpl.toolbox.commandline.CommandLineModule |
|---|
assignArgumentValues, execute |
| Field Detail |
|---|
protected java.lang.String mCommandName
protected java.lang.String mUsageMessage
protected java.lang.String mHelpMessage
protected java.lang.String mShortDescription
protected java.util.Map<java.lang.String,CommandLineArgumentDefinition> mArgumentDefs
protected java.util.Map<java.lang.String,java.lang.Object> mArgumentValues
protected java.util.Map<java.lang.String,java.lang.String> mArgumentValueStrings
| Constructor Detail |
|---|
public BaseCommandLineModuleImpl()
| Method Detail |
|---|
public java.lang.String toString()
toString in class java.lang.Objectprotected java.lang.String makeHtmlSafe(java.lang.String plainString)
public java.lang.String getUsage()
getUsage in interface CommandLineModulepublic java.lang.String getFullHelp()
getFullHelp in interface CommandLineModulepublic boolean hasAdvancedArguments()
public java.lang.String getHtmlHelpFragment()
getHtmlHelpFragment in interface CommandLineModuleprotected java.lang.String createArgsTableHTML(CommandLineArgumentDefinition[] argDefs)
public java.lang.String getHelpMessage()
CommandLineModule
getHelpMessage in interface CommandLineModulepublic java.lang.String getShortDescription()
getShortDescription in interface CommandLineModulepublic java.lang.String getCommandName()
getCommandName in interface CommandLineModuleprotected void addArgumentDefinition(CommandLineArgumentDefinition def)
def - protected void addArgumentDefinitions(CommandLineArgumentDefinition[] defArray)
defArray -
protected void addArgumentDefinitions(CommandLineArgumentDefinition[] defArray,
boolean advanced)
defArray - public CommandLineArgumentDefinition[] getBasicArgumentDefinitions()
getBasicArgumentDefinitions in interface CommandLineModulepublic CommandLineArgumentDefinition[] getAdvancedArgumentDefinitions()
getAdvancedArgumentDefinitions in interface CommandLineModulepublic CommandLineArgumentDefinition[] getArgumentDefinitions()
getArgumentDefinitions in interface CommandLineModuleprotected CommandLineArgumentDefinition[] sortArgDefsForDisplay(java.util.Map<java.lang.String,CommandLineArgumentDefinition> defMap)
public CommandLineArgumentDefinition[] getArgumentDefinitionsSortedForDisplay()
getArgumentDefinitionsSortedForDisplay in interface CommandLineModulepublic CommandLineArgumentDefinition getArgumentDefinition(java.lang.String argumentName)
getArgumentDefinition in interface CommandLineModuleargumentName -
protected java.lang.Object[] getUnnamedSeriesArgumentValues()
throws ArgumentValidationException
ArgumentValidationException
protected java.lang.Object getUnnamedArgumentValue()
throws ArgumentValidationException
ArgumentValidationException
protected java.io.File[] getUnnamedSeriesFileArgumentValues()
throws ArgumentValidationException
ArgumentValidationException
public void digestArguments(java.util.Map<java.lang.String,java.lang.String> argumentValueMap)
throws ArgumentValidationException
digestArguments in interface CommandLineModuleargumentValueMap -
ArgumentValidationException
public void invoke(java.util.Map<java.lang.String,java.lang.String> argumentValues)
throws ArgumentValidationException,
CommandLineModuleExecutionException
invoke in interface CommandLineModuleargumentValues -
ArgumentValidationException
CommandLineModuleExecutionException
protected void assertArgumentPresent(java.lang.String argumentName)
throws ArgumentValidationException
argumentName -
ArgumentValidationException
protected void assertArgumentPresent(java.lang.String requiredArgumentName,
java.lang.String requiredByArgumentName)
throws ArgumentValidationException
ArgumentValidationException
protected void assertArgumentAbsent(java.lang.String argumentName)
throws ArgumentValidationException
argumentName -
ArgumentValidationException
protected void assertArgumentAbsent(java.lang.String argumentName,
java.lang.String requiredAbsentByArgument)
throws ArgumentValidationException
argumentName -
ArgumentValidationExceptionprotected boolean hasArgumentValue(java.lang.String argumentName)
argumentName -
protected boolean hasUnnamedSeriesArgumentValue()
protected boolean hasUnnamedArgumentValue()
protected java.lang.String getStringArgumentValue(java.lang.String argumentName)
protected double getDoubleArgumentValue(java.lang.String argumentName)
protected double[] getDoubleArrayArgumentValue(java.lang.String argumentName)
protected float getFloatArgumentValue(java.lang.String argumentName)
protected int getIntegerArgumentValue(java.lang.String argumentName)
protected boolean getBooleanArgumentValue(java.lang.String argumentName)
protected java.io.File getFileArgumentValue(java.lang.String argumentName)
protected java.io.File[] getFileArrayArgumentValue(java.lang.String argumentName)
protected java.io.File getUnnamedFileArgumentValue()
protected Protein[] getFastaFileArgumentValue(java.lang.String argumentName)
protected DeltaMassArgumentDefinition.DeltaMassWithType getDeltaMassArgumentValue(java.lang.String argumentName)
protected MS2Modification[] getModificationListArgumentValue(java.lang.String argumentName)
protected java.util.Map<java.lang.String,java.lang.Object> getArgumentValues()
protected java.lang.Object getArgumentValue(java.lang.String argumentName)
protected FileToReadArgumentDefinition createUnnamedFileArgumentDefinition(boolean required,
java.lang.String helpText)
protected FileToReadArgumentDefinition createUnnamedSeriesFileArgumentDefinition(boolean required,
java.lang.String helpText)
required - helpText -
protected static java.io.PrintWriter getPrintWriter(java.io.File outFile)
throws java.io.FileNotFoundException
java.io.FileNotFoundExceptionpublic java.util.Map<java.lang.String,java.lang.String> getArgumentValueStrings()
getArgumentValueStrings in interface CommandLineModule
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||