
HiveMind 1.x was able to load all "META-INF/hivemodule.xml" files automatically.
The concept of autolading was broadened and made more extensible.
The RegistryBuilder now has a method autoDetectModules.
It tries to detect so called RegistryProviders by searching the classpath for a global manifest entry "hivemind-providers".
Example of MANIFEST.MF:
Manifest-Version: 1.0 hivemind-providers: org.apache.hivemind.impl.HivemoduleProvider
An instance of the specified class (multiple classes can be specified, separated by comma) is created and the registry definition
is passed via the RegistryProvider interface:
public interface RegistryProvider { public void process(RegistryDefinition registryDefinition, ErrorHandler errorHandler); }
For example the HivemoduleProvider loads all hivemodule.xml files.
It just delegates the work to a XmlModuleReader:
public void process(RegistryDefinition registryDefinition, ErrorHandler errorHandler) { XmlModuleReader xmlModuleReader = new XmlModuleReader(registryDefinition); xmlModuleReader.readClassPathModules("META-INF/hivemodules.xml"); }