SRJRCFrames
v0.1.296

de.schwarzrot.app.support
Class AbstractApplicationLauncher<C extends AbstractSysConfig>

java.lang.Object
  extended by de.schwarzrot.app.support.AbstractApplicationLauncher<C>
Type Parameters:
C - - config type of application
Direct Known Subclasses:
DesktopApplicationLauncher, ServiceLauncher, SimpleApplicationLauncher

public abstract class AbstractApplicationLauncher<C extends AbstractSysConfig>
extends Object

is a helper class called from main, responsable for all the grunt work at application-startup (i.e. fetch beans from context, setup services, load preferences ...).

typical usage:

 class MyApplication implements MainEntry {
    ...
    public static void main(String[] args) {
        String contextBase = "de/schwarzrot/app/ctx/";
        String appContext = contextBase + "application-context.xml";
        String dataAccessCtx = contextBase + "data-access-context.xml";
        String securityCtx = contextBase + "security-context.xml";
        List sArgs = new ArrayList(Arrays.asList(args));

        // if AnyClass needs some fake entries at commandline, 
        // it could add them to sArgs
        
        new ApplicationLauncher(new MyApplication()
                              , new String[] { securityContext, dataAccessCtx, appCtx }
                              , sArgs).start();
    }
 }
 

The use-case of this class is very similar to the ApplicationLauncher from springframework, with the main difference, that this class supports application extensions with dynamically loaded jarfiles.

Such a jarfile-extension needs a Manifest-Entry Application-Context with the fully qualified path of the application-context-file usable for an UrlClassLoader.

Author:
Reinhard Mantey

Field Summary
static String APPLICATION_TYPE
           
protected  MainEntry<C> starter
           
protected  SysInfo sysInfo
           
 
Constructor Summary
AbstractApplicationLauncher(MainEntry<C> starter, String[] appContextFiles, List<String> appArgs)
          constructor - loads the given context's and validates configuration.
 
Method Summary
protected  void checkDBAccess()
          validate the configuration from application context.
protected  void doUsage()
           
protected  void dumpCharsets()
           
protected  org.apache.commons.logging.Log getLogger()
           
 MainEntry<C> getStarter()
           
 SysInfo getSysInfo()
           
protected  AbstractApplicationContext init(String[] appContextFiles)
           
protected  void loadExtensions()
          checks the plugin-directory for jarfiles, that contain valid application extensions.
protected  void parseAppArgs(List<String> args)
           
protected  void printAppInfo()
           
 void setSysInfo(SysInfo sysInfo)
           
 void start()
          entry point for application startup
protected  void sysDump()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

APPLICATION_TYPE

public static final String APPLICATION_TYPE
See Also:
Constant Field Values

starter

protected MainEntry<C extends AbstractSysConfig> starter

sysInfo

protected SysInfo sysInfo
Constructor Detail

AbstractApplicationLauncher

public AbstractApplicationLauncher(MainEntry<C> starter,
                                   String[] appContextFiles,
                                   List<String> appArgs)
constructor - loads the given context's and validates configuration.

Parameters:
starter - - usually the class providing the main()
appContextFiles - - the very basic requirements - at least one path to a context file
appArgs - - the arguments from main, so commandline parsing can be deffered
Method Detail

getStarter

public final MainEntry<C> getStarter()

getSysInfo

public final SysInfo getSysInfo()

setSysInfo

public final void setSysInfo(SysInfo sysInfo)

start

public void start()
entry point for application startup


checkDBAccess

protected void checkDBAccess()
validate the configuration from application context. Database access is vital for applications from SRFramework


doUsage

protected void doUsage()

dumpCharsets

protected void dumpCharsets()

getLogger

protected final org.apache.commons.logging.Log getLogger()

init

protected AbstractApplicationContext init(String[] appContextFiles)

loadExtensions

protected void loadExtensions()
checks the plugin-directory for jarfiles, that contain valid application extensions. Such a jarfile-extension needs a Manifest-Entry Application-Context with the fully qualified path of the application-context-file usable for an UrlClassLoader.


parseAppArgs

protected void parseAppArgs(List<String> args)

printAppInfo

protected void printAppInfo()

sysDump

protected void sysDump()

SRJRCFrames
v0.1.296

hosted at
Find SRJRCFrames at SourceForge.net. Fast, secure and free:
           Open Source Software download
Submit a bug or request a feature

SRJRCFrames is published according to the GNU General Public License
Copyright 2005-2012 Reinhard Mantey - some rights reserved.