public class DefaultApplicationInitializer extends java.lang.Object implements ApplicationInitializer
Supported configuration parameters:
full, light, off. The
default value is full.PluginsCollector. Default is
DefaultPluginsCollector.ObjectFactory.newInstance(ExtendedProperties)
when running JPF (see bellow). This allows you to configure JPF precisely.
Black and white lists of plug-ins
In some situations you may want to temporary exclude some of your plug-ins from the application scope. This may be achieved with help of while and black lists - simple plain text files that contain lists of plug-in identifiers to be included/excluded from the application. Each identifies should be in separate line. You may provide unique plug-in ID also.
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.
| Modifier and Type | Field and Description |
|---|---|
protected static java.lang.String |
PARAM_APPLICATION_PLUGIN |
protected static java.lang.String |
PARAM_INTEGRITY_CHECK_MODE |
protected static java.lang.String |
PARAM_PLUGINS_BLACK_LIST |
protected static java.lang.String |
PARAM_PLUGINS_COLLECTOR |
protected static java.lang.String |
PARAM_PLUGINS_WHITE_LIST |
| Constructor and Description |
|---|
DefaultApplicationInitializer() |
| Modifier and Type | Method and Description |
|---|---|
void |
configure(ExtendedProperties configuration)
Configures this instance and application environment.
|
protected java.util.Collection<PluginManager.PluginLocation> |
filterPluginLocations(PluginRegistry registry,
java.util.Collection<PluginManager.PluginLocation> pluginLocations)
This method may remove unwanted plug-in locations from the given list.
|
Application |
initApplication(BootErrorHandler errorHandler,
java.lang.String[] args)
Initializes application.
|
protected java.lang.String |
integrityCheckReport2str(IntegrityCheckReport report) |
protected static final java.lang.String PARAM_APPLICATION_PLUGIN
protected static final java.lang.String PARAM_INTEGRITY_CHECK_MODE
protected static final java.lang.String PARAM_PLUGINS_COLLECTOR
protected static final java.lang.String PARAM_PLUGINS_WHITE_LIST
protected static final java.lang.String PARAM_PLUGINS_BLACK_LIST
public void configure(ExtendedProperties configuration) throws java.lang.Exception
Log4j logging system only. All other systems support
come from commons-logging package.PluginsCollector using
configuration data.configure in interface ApplicationInitializerconfiguration - application configuration data from
boot.properties file and System
properties as defaultsjava.lang.Exception - if any error has occurred during initializer
configuringApplicationInitializer.configure(
org.java.plugin.util.ExtendedProperties)public Application initApplication(BootErrorHandler errorHandler, java.lang.String[] args) throws java.lang.Exception
PluginsCollector.PluginManager instance from ObjectFactory
using code
ObjectFactory.newInstance(config).createManager().PluginManager.publishPlugins(org.java.plugin.PluginManager.PluginLocation[]).JpfApplication initApplication(Properties) method.Application interface.initApplication in interface ApplicationInitializererrorHandler - 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 processargs - command line arguments as they passed to program
main methodnull if
initializing failedjava.lang.Exception - if any error has occurred during application
initializingApplicationInitializer.initApplication(
BootErrorHandler, String[])protected java.lang.String integrityCheckReport2str(IntegrityCheckReport report)
protected java.util.Collection<PluginManager.PluginLocation> filterPluginLocations(PluginRegistry registry, java.util.Collection<PluginManager.PluginLocation> pluginLocations) throws ManifestProcessingException
registry - plug-in registry to process manifestspluginLocations - collected plug-in locations to be filteredManifestProcessingExceptionCopyright © 2004-2007 Dmitry Olshansky. All Rights Reserved.