net.sf.mmm.util.cli.api
Class AbstractVersionedMain

java.lang.Object
  extended by net.sf.mmm.util.component.base.AbstractLoggableObject
      extended by net.sf.mmm.util.cli.api.AbstractMain
          extended by net.sf.mmm.util.cli.api.AbstractVersionedMain
Direct Known Subclasses:
ResourceBundleSynchronizer

@CliMode(id="version",
         title="version",
         usage="Print the version of this program.")
public abstract class AbstractVersionedMain
extends AbstractMain

This is the abstract base class for a main-program that has a version.

Since:
2.0.0
Author:
Joerg Hohwiller (hohwille at users.sourceforge.net)

Field Summary
private static String SNAPSHOT
          The version if NOT available from Manifest.
private  boolean version
          The option to print the version.
 
Fields inherited from class net.sf.mmm.util.cli.api.AbstractMain
EXIT_CODE_CONSTRAINT_VIOLATION, EXIT_CODE_ILLEGAL_SYNTAX, EXIT_CODE_OK, EXIT_CODE_UNEXPECTED
 
Constructor Summary
AbstractVersionedMain()
           
 
Method Summary
protected  String getVersion()
          This method gets the Version of this program.
protected  int run(CliModeObject mode)
          This method is called after the options are parsed and injected.
 
Methods inherited from class net.sf.mmm.util.cli.api.AbstractMain
getIocContainer, getOutputSettings, getParserBuilder, getStandardError, getStandardOutput, getStreamUtil, handleError, printHelp, run, setStandardError, setStandardOutput, validate
 
Methods inherited from class net.sf.mmm.util.component.base.AbstractLoggableObject
getLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SNAPSHOT

private static final String SNAPSHOT
The version if NOT available from Manifest.

See Also:
Constant Field Values

version

@CliOption(name="--version",
           aliases="-v",
           usage="Print the program-version.",
           mode="version",
           required=true)
private boolean version
The option to print the version.

Constructor Detail

AbstractVersionedMain

public AbstractVersionedMain()
Method Detail

getVersion

protected String getVersion()
This method gets the Version of this program.

Returns:
the program-version.

run

protected int run(CliModeObject mode)
           throws Exception
This method is called after the options are parsed and injected. It has to be implemented and should do the actual job.

Specified by:
run in class AbstractMain
Parameters:
mode - is the mode of the invocation.
Returns:
the error-code or AbstractMain.EXIT_CODE_OK on success.
Throws:
Exception - in case of an unexpected error.


Copyright © 2001-2010 mmm-Team. All Rights Reserved.