diff --git a/hera-core/src/doc/core.xml b/hera-core/src/doc/core.xml index 9f7ceca..f54754f 100644 --- a/hera-core/src/doc/core.xml +++ b/hera-core/src/doc/core.xml @@ -237,14 +237,14 @@ public interface ProductProcessor extends Plugin<ProductType> { select plugins supporting the given delimiter. To not reimplement the lookup logic for common cases Hera provides a PluginRegistry<T extends Plugin<S>, - S> that provides sophisticated methods to access certain - plugins: + S> interface that provides sophisticated methods to + access certain plugins: Usage of the PluginRegistry PluginRegistry<ProductProcessor, ProductType> registry = - PluginRegistry.create(); + SimplePluginRegistry.create(); // Add plugin instances registry.add(new FooImplementation()); @@ -283,5 +283,32 @@ registry.getPluginsFor(ProductType.HARDWARE, new MyException("Damn!");<plugin:registry id="plugins" class="com.acme.MyPluginInterface" /> + + + Ordering plugins + + Declaring plugin beans sometimes it is necessary to preserve a + certain order of plugins. Suppose you have a plugin host that already + defines one plugin that shall always be executed after all plugins + declared by extensions. Actually the Spring container typically returnes + beans in the order they were declared, so that you could import you + wildcarded config files right before declaring the default plugin. + Unfortunately the order of the beans is not contracted to be preserved + for the Spring container. Thus we need a different solution. + + Spring provides two ways to order beans. First, you can implement + Ordered interface and implement + getOrder to place a plugin at a certain point + in the list. Secondly you can user the @Order + annotation. For more information on ordering capabilities of Spring see + the section on this topic in the Spring reference + documentation. + + Using the Hera namespace you will get a + PluginRegistry instance that is capable + of preserving the order defined by the mentioned means. Using Hera + programatically use + OrderAwarePluginRegistry. + \ No newline at end of file