org.expasy.jpl.commons.app
Class AbstractApplicationParameters

java.lang.Object
  extended by org.expasy.jpl.commons.app.AbstractApplicationParameters

public abstract class AbstractApplicationParameters
extends Object

A basic command line parameter handler.

Version:
1.0
Author:
nikitin

Field Summary
protected  Properties settings
          the parameters
protected  org.apache.commons.cli.HelpFormatter usage
          usage
 
Constructor Summary
AbstractApplicationParameters(Class<?> app, String version, String mandatoryParams, String[] params)
           
 
Method Summary
abstract  void addSettings(Properties settings)
           
abstract  org.apache.commons.cli.Options createAppOptions()
          add the app specific options
 Properties createBaseSettings()
           
 String getCommandLine()
           
 File getConfigFile()
           
 String getParamInfos()
           
abstract  String getSpecificParamInfos()
           
 String getVersion()
           
abstract  void init()
           
 boolean isVerbose()
           
abstract  void parseArguments(List<String> argList)
           
abstract  void parseSpecificOptions(org.apache.commons.cli.Options options, Properties settings, org.apache.commons.cli.CommandLine line)
           
 void setHeader(String header)
           
protected  void setPropertyValues()
          This method handles all setting/conversions of parameter values to the correct type.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

settings

protected Properties settings
the parameters


usage

protected final org.apache.commons.cli.HelpFormatter usage
usage

Constructor Detail

AbstractApplicationParameters

public AbstractApplicationParameters(Class<?> app,
                                     String version,
                                     String mandatoryParams,
                                     String[] params)
Method Detail

createBaseSettings

public Properties createBaseSettings()

setPropertyValues

protected void setPropertyValues()
                          throws org.apache.commons.cli.ParseException
This method handles all setting/conversions of parameter values to the correct type.
  1. all subclassses will have to override this method
  2. do not forget to call super.convertPropertyValues() to correctly convert the base params

Throws:
org.apache.commons.cli.ParseException - if convertion failed.

getParamInfos

public String getParamInfos()

init

public abstract void init()

addSettings

public abstract void addSettings(Properties settings)

getSpecificParamInfos

public abstract String getSpecificParamInfos()

createAppOptions

public abstract org.apache.commons.cli.Options createAppOptions()
add the app specific options


parseSpecificOptions

public abstract void parseSpecificOptions(org.apache.commons.cli.Options options,
                                          Properties settings,
                                          org.apache.commons.cli.CommandLine line)
                                   throws org.apache.commons.cli.ParseException
Throws:
org.apache.commons.cli.ParseException

parseArguments

public abstract void parseArguments(List<String> argList)
                             throws org.apache.commons.cli.ParseException
Throws:
org.apache.commons.cli.ParseException

getCommandLine

public final String getCommandLine()

getVersion

public final String getVersion()
Returns:
the version

setHeader

public final void setHeader(String header)

getConfigFile

public final File getConfigFile()
Returns:
the configFile

isVerbose

public final boolean isVerbose()
Returns:
the true if verbose


Copyright (c) 2012 Swiss Institute of Bioinformatics. All rights reserved.