|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.unitils.core.ModulesLoader
public class ModulesLoader
A class for loading unitils modules.
The core names set by thePROPKEY_MODULES
property which modules will be loaded. These names can then
be used to construct properties that define the classnames and optionally the dependencies of these modules. E.g.
unitils.modules= a, b, c, d
unitils.module.a.className= org.unitils.A
unitils.module.a.runAfter= b, c
unitils.module.b.className= org.unitils.B
unitils.module.b.runAfter= c
unitils.module.c.className= org.unitils.C
unitils.module.d.enabled= false
The above configuration will load 3 core classes A, B and C and will always perform processing in
order C, B, A.
If a circular dependency is found in the runAfter configuration, a runtime exception will be thrown.
Field Summary | |
---|---|
static String |
PROPKEY_MODULE_PREFIX
First part of all core specific properties. |
static String |
PROPKEY_MODULE_SUFFIX_CLASS_NAME
Last part of the core specific property that specifies the classname of the core. |
static String |
PROPKEY_MODULE_SUFFIX_ENABLED
Last part of the core specific property that specifies whether the core should be loaded. |
static String |
PROPKEY_MODULE_SUFFIX_RUN_AFTER
Last part of the core specific property that specifies the names of the modules that should be run before this core. |
static String |
PROPKEY_MODULES
Property that contains the names of the modules that are to be loaded. |
Constructor Summary | |
---|---|
ModulesLoader()
|
Method Summary | |
---|---|
protected boolean |
classFileExistsInClasspath(String className)
|
protected List<Module> |
createAndInitializeModules(List<String> moduleNames,
Properties configuration)
Creates the modules with the given class names and calls initializes them with the given configuration. |
List<Module> |
loadModules(Properties configuration)
Loads all unitils modules as described in the class javadoc. |
protected void |
removeDisabledModules(Set<String> moduleNames,
Properties configuration)
Removes all modules that have a value false for the enabled property. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String PROPKEY_MODULES
public static final String PROPKEY_MODULE_PREFIX
public static final String PROPKEY_MODULE_SUFFIX_ENABLED
public static final String PROPKEY_MODULE_SUFFIX_CLASS_NAME
public static final String PROPKEY_MODULE_SUFFIX_RUN_AFTER
Constructor Detail |
---|
public ModulesLoader()
Method Detail |
---|
public List<Module> loadModules(Properties configuration)
configuration
- the configuration, not null
protected List<Module> createAndInitializeModules(List<String> moduleNames, Properties configuration)
moduleNames
- the module class names, not nullconfiguration
- the configuration, not null
protected void removeDisabledModules(Set<String> moduleNames, Properties configuration)
moduleNames
- the module names, not nullconfiguration
- the configuration, not nullprotected boolean classFileExistsInClasspath(String className)
className
- The name of the class to check, not null
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |