You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by Serge Knystautas <se...@lokitech.com> on 2001/10/24 22:59:40 UTC

Avalon ComponentManager differences

I'm trying to get the DataSourceSelector from the ComponentManager in the
JAMES component, but it's not offered.  It is offered to the
JDBCMailRepository.  So I tried copying the code from the repository into
James.java, but it doesn't like it...
datasources = (DataSourceSelector)componentManager.lookup(
DataSourceSelector.ROLE );
works in the repository but not in James.java.

I printed out the component manager offerings in a few components (spool
manager, james, and the repository) and get this...

jdbc repo:
Components:[org.apache.avalon.cornerstone.services.store.Store][org.apache.a
valon.cornerstone.services.datasource.DataSourceSelector]

spool mgr:
Components:[org.apache.mailet.MailetContext][org.apache.avalon.cornerstone.s
ervices.threads.ThreadManager][org.apache.james.services.MailStore]

james:
Components:[org.apache.james.services.UsersRepository][org.apache.james.serv
ices.MailServer]

Would someone explain to me how these are set and/or how I change these?
I've tried reading over Avalon docs but am obviously missing something.
Thanks.

Serge Knystautas
Loki Technologies - Unstoppable Websites
http://www.lokitech.com/


---------------------------------------------------------------------
To unsubscribe, e-mail: james-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: james-dev-help@jakarta.apache.org


Re: Avalon ComponentManager differences

Posted by Peter Donald <do...@apache.org>.
On Thu, 25 Oct 2001 06:59, Serge Knystautas wrote:
> I'm trying to get the DataSourceSelector from the ComponentManager in the
> JAMES component, but it's not offered.  It is offered to the
> JDBCMailRepository.  So I tried copying the code from the repository into
> James.java, but it doesn't like it...
> datasources = (DataSourceSelector)componentManager.lookup(
> DataSourceSelector.ROLE );
> works in the repository but not in James.java.
>
> I printed out the component manager offerings in a few components (spool
> manager, james, and the repository) and get this...
>
> jdbc repo:
> Components:[org.apache.avalon.cornerstone.services.store.Store][org.apache.
>a valon.cornerstone.services.datasource.DataSourceSelector]
>
> spool mgr:
> Components:[org.apache.mailet.MailetContext][org.apache.avalon.cornerstone.
>s ervices.threads.ThreadManager][org.apache.james.services.MailStore]
>
> james:
> Components:[org.apache.james.services.UsersRepository][org.apache.james.ser
>v ices.MailServer]
>
> Would someone explain to me how these are set and/or how I change these?
> I've tried reading over Avalon docs but am obviously missing something.
> Thanks.

Each block declares that it has a dependency in it's BlockInfo. So look in 
JAMES.xinfo and add an extra dependency - something like

<dependency>
    <service 
name="org.apache.avalon.cornerstone.services.datasource.DataSourceSelector" 
version="1.0"/>
</dependency>

This just declares that the block requires that service. Now you have to map 
the service instance into james in the assembly.xml file. It should be 
something like putting the following under the assembly declaration for James 
block.

<provide name="datasource"
role="org.apache.avalon.cornerstone.services.datasource.DataSourceSelector"/>

-- 
Cheers,

Pete

-----------------------------------------------------------
 "Remember, your body is a temple; however, it's also your 
 dancehall and bowling alley"   -- Dharma Montgomery
-----------------------------------------------------------

---------------------------------------------------------------------
To unsubscribe, e-mail: james-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: james-dev-help@jakarta.apache.org