cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From giacomo <giac...@apache.org>
Subject Re: [Cocoon+Avalon] Adding a new ComponentSelector
Date Wed, 05 Dec 2001 11:11:18 GMT
On Tue, 4 Dec 2001, Ugo Cei wrote:

> Hi People,
>
> I'm trying to create a reusable component for use in Cocoon and in other
> applications, so I decided to create an Avalon component for this,
> called Authenticator. Since I need different components for the
> Authenticator role, I also created an AuthenticatorSelector.
>
> Now I'm trying to use my component in a Cocoon action. This is a snippet
> of code from the "act" method of my Action:
>
>      ComponentSelector selector = null;
>      try
>        {
>          selector = (ComponentSelector) manager.lookup
>            (Authenticator.ROLE + "Selector");
>        }
>      catch(ComponentException ce)
>        {
>          AuthenticatorSelector as = new AuthenticatorSelector();
>          as.setLogger(getLogger());
>          as.compose(manager);
>          as.configure(conf);
>          selector = as;
>
>          // HOW TO ADD SELECTOR TO MANAGER HERE?

You can't! You'll have to add your component to the cocoon.xconf file.

Giacomo

>        }
>
> The first time the action is invoked, the lookup method fails and a new
> selector is created, but I want that on the following invocations, the
> lookup method returns the previously created selector instance.
>
> Is it possible? Is this the correct way of using Avalon selectors? I
> must confess that after having read two or three times "Developing with
> Apache Avalon", I still don't grasp most of it :).
>
> 	Thanks in advance and sorry for the crossposting,
>
> 		Ugo
>
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org


Mime
View raw message