Berin Loritsch wrote:
your/** * This component depends on the following: * * @avalon.dependency type="Generator" * @avalon.dependency type="Transformer" * @avalon.dependency type="Serializer" */ public void service(ServiceManager manager) throws ServiceException { manager.lookup(Generator.ROLE); manager.lookup(Transformer.ROLE); manager.lookup(Serializer.ROLE); }
This allows Fortress to guarantee a proper shutdown order for the components, and to guarantee that there are no circular dependencies. The type parameter is a class name (interface in this case) that can be resolved againstimport statements. The services your component uses should bedeclared inqualifiedthe imports by default anyway. If not, and you are proxying for another component that does the actual lookup, then you will have to add the fullyclass name.
Ok, I am running into the following situation: Looking at
components.modules.input.AbstractMetaModule it defines that it is
Composable and assigns the component manager to a protected member
variable. A subclass, ChainMetaModule, uses the component manager to
lookup a dependency. This means ChainMetaModule should redefine the
compose()/ (->service()) method in order to declare its dependencies.
So, in order to avoid this I'd like to put the dependency tags above at
class declaration level instead of directly above the service() method.
Can I do this?
And while you're at it can you confirm whether or not tags are inherited by subclasses?
Geoff