JPF 0.10

org.java.plugin.boot
Class DefaultApplicationInitializer

java.lang.Object
  extended byorg.java.plugin.boot.DefaultApplicationInitializer
All Implemented Interfaces:
ApplicationInitializer

public class DefaultApplicationInitializer
extends java.lang.Object
implements ApplicationInitializer

Default implementation of the application initializer interface.

Supported configuration parameters:

org.java.plugin.boot.applicationPlugin
ID of plug-in to start. There is no default value for this parameter. In common scenario, this is the only parameter that you must provide.
org.java.plugin.boot.integrityCheckMode
Regulates how to check plug-ins integrity when running JPF. Possible values: full, light, off. The default value is full.
org.java.plugin.boot.pluginsCollector
Plug-ins location collector class, for details see PluginsCollector. Default is DefaultPluginsCollector.
Note that all given configuration parameters are passed to ObjectFactory.newInstance(ExtendedProperties) when running JPF (see bellow). This allows you to configure JPF precisely.

What is application plug-in?

When application starts, the Boot.main(String[]) method executed calling initApplication(BootErrorHandler, String[]) to get initialized instance of Application (or ServiceApplication) class. The method initApplication(BootErrorHandler, String[]) in this implementation scans plug-in repositories to collect all available plug-in files and folders (using special class that can be customized), instantiates JPF and publishes all discovered plug-ins. After that it asks PluginManager for an Application Plug-in with ID provided as configuration parameter. Returned class instance is expected to be of type ApplicationPlugin and it's method ApplicationPlugin.initApplication(ExtendedProperties, String[]) called.

To the mentioned initApplication method passed a subset of configuration properties whose names start with application plug-in ID followed with dot character '.' (see ExtendedProperties.getSubset(String) for details).

As a result of the described procedure, the Boot get instance of Application interface, so it can start application calling Application.startApplication() method.

Version:
$Id: DefaultApplicationInitializer.java,v 1.7 2006/02/04 14:51:31 ddimon Exp $

Field Summary
protected static java.lang.String PARAM_APPLICATION_PLUGIN
           
protected static java.lang.String PARAM_INTEGRITY_CHECK_MODE
           
protected static java.lang.String PARAM_PLUGINS_COLLECTOR
           
 
Constructor Summary
DefaultApplicationInitializer()
           
 
Method Summary
 void configure(ExtendedProperties configuration)
          Configures this instance and application environment.
 Application initApplication(BootErrorHandler errorHandler, java.lang.String[] args)
          Initializes application.
protected  java.lang.String integrityCheckReport2str(IntegrityCheckReport report)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PARAM_APPLICATION_PLUGIN

protected static final java.lang.String PARAM_APPLICATION_PLUGIN
See Also:
Constant Field Values

PARAM_INTEGRITY_CHECK_MODE

protected static final java.lang.String PARAM_INTEGRITY_CHECK_MODE
See Also:
Constant Field Values

PARAM_PLUGINS_COLLECTOR

protected static final java.lang.String PARAM_PLUGINS_COLLECTOR
See Also:
Constant Field Values
Constructor Detail

DefaultApplicationInitializer

public DefaultApplicationInitializer()
Method Detail

configure

public void configure(ExtendedProperties configuration)
               throws java.lang.Exception
Configures this instance and application environment. The sequence is:

Specified by:
configure in interface ApplicationInitializer
Parameters:
configuration - application configuration data from boot.properties file and System properties as defaults
Throws:
java.lang.Exception - if any error has occurred during initializer configuring
See Also:
ApplicationInitializer.configure( org.java.plugin.util.ExtendedProperties)

initApplication

public Application initApplication(BootErrorHandler errorHandler,
                                   java.lang.String[] args)
                            throws java.lang.Exception
Initializes application. The sequence is:

Specified by:
initApplication in interface ApplicationInitializer
Parameters:
errorHandler - callback interface to report errors to the user, it is recommended to use this handler only for "non-fatal" errors and ask user via BootErrorHandler.handleError(String, Exception) or BootErrorHandler.handleError(String, org.java.plugin.registry.IntegrityCheckReport) if he wants to abort application boot process
args - command line arguments as they passed to program main method
Returns:
initialized application instance or null if initializing failed
Throws:
java.lang.Exception - if any error has occurred during application initializing
See Also:
ApplicationInitializer.initApplication( BootErrorHandler, String[])

integrityCheckReport2str

protected java.lang.String integrityCheckReport2str(IntegrityCheckReport report)

JPF 0.10

Copyright © 2004-2005 Dmitry Olshansky. All Rights Reserved.