for @avalon.dependency, does the container restrict components from looking up services not declared? If so, how do we specify service dependencies which are not known until runtime?
Good questions. To my knowledge, the answer largely depends on your container. Fortress doesn't restrict you right now, but Phoenix and Merlin do. Truthfully speaking, it is better to restrict things as much as you can from a security perspective.
That said, I have a couple of ideas rolling around my head. Phoenix has some special characters that can be appended to the ROLE name to specify how to get the dependencies back:
[] for an array of components implementing the service
{} for a map of components implementing the service
/name for a specific instance implementing a serviceCurrently there is no standard way of doing this. And (brace yourself for the "d" word) Phoenix is divergent from the common definition of acceptable return types from the ServiceManager due to the List and Map return values.
The critical piece of information that the container needs to know is that your component requires (or would like) a component that implements a service. In some specific cases you have a role for a speicific variant of a service, like the difference between a memory Store and a persistent Store. Other times we don't have that luxury (Cocoon sitemap).
If we adopt the suffix approach, then we have to agree to a set of suffixes and how they apply. However if we separate the concept of Type and Role, this becomes a little more manageable.
If the @dependency type="......" defines the type, we can ensure that we get the type we want. If we add a role="..." attribute then we can add some other semantics as follows:
* No "role" attribute identified--get the default implementation of the service and apply it as normal (i.e. current standards).
* One or more "role" attribtues identified with names--supply the implementations of the type that the assembler identifies as that role.
* One "role" attribute with the value "*"--all implementations of the type need to be available to the component.
That leaves the decision up to the developer how they want to do it. In some cases a role is important at assembly time, and in others it doesn't become important until run time.
What do yall think of the additional "role" attribute?
--
"They that give up essential liberty to obtain a little temporary safety
deserve neither liberty nor safety."
- Benjamin Franklin
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
