consciouscode.util
Class Application
java.lang.Object
consciouscode.util.Application
- Direct Known Subclasses:
- Launcher
public abstract class Application
- extends Object
Basic startup functionality for an application.
To create your application, subclass this and add code like the following:
public static void main(String[] args)
{
new ApplicationSubclass().runSafely(args);
}
The subclass must also provide an implementation of run(java.lang.String[])
.
On startup, the application immediately renders (to System.out
)
the text provided by getBannerText()
. Then it looks for a resource
file called /system.properties
. If found, the properties
defined in that file are added to the System properties table, but
properties that already have values (presumably defined at the
java command line) will not be modified.
The application's code goes into the subclass's implementation of
run(java.lang.String[])
; the command-line parameters are passed-through from
main
. Implementations of run
may throw any
exception, since this class will properly handle them and render an error
message to the console.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Application
public Application()
loadSystemProperties
public static void loadSystemProperties()
runSafely
public void runSafely(String[] args)
run
protected abstract int run(String[] args)
throws Exception
- Returns:
- the application result, generally zero if the application is
exiting without error.
- Throws:
Exception
getBannerText
protected String getBannerText()
Copyright © 2001–2012
Todd V. Jonker. All Rights Reserved.