cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ugo Cei <u....@cbim.it>
Subject [Cocoon+Avalon] Adding a new ComponentSelector
Date Tue, 04 Dec 2001 17:29:49 GMT
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?
       }

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


-- 
Ugo Cei - Consorzio di Bioingegneria e Informatica Medica
P.le Volontari del Sangue, 2 - 27100 Pavia - Italy
Phone: +39.0382.525100 - E-mail: u.cei@cbim.it


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


Mime
View raw message