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: [EMAIL PROTECTED]


-- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>



Reply via email to