Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.sablecc.sablecc
Class Executable  view Executable download Executable.java

java.lang.Object
  extended byorg.sablecc.sablecc.Executable
Direct Known Subclasses:
SableCC

public abstract class Executable
extends java.lang.Object

Template for executable applications. Supports command line options processing model based string matching. User defined application should inherit from this base class, and implement at least methods: optionsSetup() for preparing all application specific command line options, constantsSetup() for application specific constant initialization and start() for the application bootstrapping routines. User defined application should define main() as:
public static void main(String[] args){
ApplicationClass app = new ApplicationClass();
app.Main(args);
}

and all necessary processing should be placed inside options and start() method.

Created: Wed Sep 22 22:22:55 1999


Nested Class Summary
 class Executable.Option
          Represents a single command line option.
 
Field Summary
protected  java.lang.String APP_BANNER
          Application banner printed always after invocation.
protected  java.lang.String APP_NAME
          Application name.
protected  java.lang.String APP_VERSION
          Application banner printed always after infocation.
private  java.util.HashSet cmdln_options
           
protected  boolean NEED_OPTIONS
          Application invocation needs to have options.
private  Executable.Option[] options
           
 
Constructor Summary
Executable()
           
 
Method Summary
private  void bootstrap(java.lang.String[] args)
          Creates cmdln_options set, prepares and process the user defined options.
protected  void constantsSetup()
          User specific constant setup goes here.
private  java.util.HashSet createOptionLookupTable(java.lang.String[] args)
           
protected  void displayUsage()
          Usage.
 void Main(java.lang.String[] args)
          Main method for the template.
protected  java.lang.String optionsInfo()
          Prepares short info for each option.
protected  Executable.Option[] optionsSetup()
          Application specific options declaration.
protected  void processLeftOvers(java.util.Iterator enum)
          Routine to postprocess the command line arguments not matched by the Options, ie.
private  void processOptions(Executable.Option[] option)
           
protected  void start()
          Application specific code goes here.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

APP_NAME

protected java.lang.String APP_NAME
Application name.


APP_BANNER

protected java.lang.String APP_BANNER
Application banner printed always after invocation. To be used for short application description, copyrights, authors crap, etc.


APP_VERSION

protected java.lang.String APP_VERSION
Application banner printed always after infocation.


NEED_OPTIONS

protected boolean NEED_OPTIONS
Application invocation needs to have options.


cmdln_options

private java.util.HashSet cmdln_options

options

private Executable.Option[] options
Constructor Detail

Executable

public Executable()
Method Detail

Main

public void Main(java.lang.String[] args)
Main method for the template. Application main() should call this method.


optionsSetup

protected Executable.Option[] optionsSetup()
Application specific options declaration. User class must override this method, providing definition for all application specific command-line options. This implementation returns empty option table.


processLeftOvers

protected void processLeftOvers(java.util.Iterator enum)
Routine to postprocess the command line arguments not matched by the Options, ie. files, patterns, etc. usually added as last command line arguments.


constantsSetup

protected void constantsSetup()
User specific constant setup goes here. User class should override this method.


start

protected void start()
Application specific code goes here. User class must override this method to perform bootstrapping processing.


displayUsage

protected void displayUsage()
Usage. Should be overwritten by the application.


optionsInfo

protected java.lang.String optionsInfo()
Prepares short info for each option. This method simply concatenate short help for each option with appending new line character to each of them. The user has to format help lines herself, or overwrite this method.


bootstrap

private void bootstrap(java.lang.String[] args)
Creates cmdln_options set, prepares and process the user defined options. User can modify the behaviour, but for most cases it should just work.


createOptionLookupTable

private java.util.HashSet createOptionLookupTable(java.lang.String[] args)

processOptions

private void processOptions(Executable.Option[] option)