Farr, Aaron wrote:


The WIKI proposal states this:


    @avalon.dependency
        type=(ROLE|value)
        [version=(version)]
        [key=(value)]
        [optional=(true|false)]

So isn't the 'role' attribute you mentioned really just the 'key' attribute?

Yep.



Personally, I prefer something more like 'service' than 'type' and either 'key','alias', or just 'name' works for the other.

Type is more specific. It works, and I don't want to get hung up on it.



Also, not to start a flame war or anything, but isn't 'avalon.dependency' just as much a 'validation' issue as context, logging, and configuration tags? I mean, it's just the container validating that such services exist and allowing the component to access them. I don't see the difference between this and say 'context'. But perhaps I'm wrong.

Not necessarily. Both Phoenix and Merlin ensure you can only access what you declared you can access. In FOrtress and ECM there are no constraints, so it would amount to validation infomraiotn. However there is real function that can be derived from it.


While I'm at it, here's a questions about 'avalon.service': What about services in which the interface is defined by a third party, (ie- Sun)? The interface may not originally been intended to be an Avalon service, but that doesn't mean it can be used as such. In this case, you can't use AMTAGS, so however meta-info is gathered by the container, it should be in a way that's fairly easy to configure. Currently, it's difficult to pull this off in Phoenix and Merlin since they expect meta-info embedded in the jar files (for Fortress you can use a ROLE's file).

Remember it can be declared in an interface's class comments or the component implementation's version. For example:

/**
 * @avalon.component name="jdbc" lifestyle="singleton"
 * @avalon.service type="DataSource"
 */
public class JdbcDataSource implements javax.sql.DataSource {}

That allows you to export a service from an interface you can't control.

Alternatively, you can specify an interface directly as a service:

/**
 * @avalon.service
 */
public interface MyService {}

Those are the two ways it can be used.

--

"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]



Reply via email to