Obvious if you think about it...

All you need to do is add the datasource selector lines as follows:
(I'm very sorry, but given my dev env., I can't provide diffs without
destroying lots of work, or giving you stuff you don't need)

In AuthServiceImpl.xinfo add:
    <dependency>
      <service
name="org.apache.avalon.cornerstone.services.datasource.DataSourceSelect
or" version="1.0"/>
    </dependency>

In james-assembly.xml:
(add the DataSourceSelector line)

  <!-- NNTP Authentication Service -->
  <block class="org.apache.james.nntpserver.AuthServiceImpl"
name="nntpauth" >
    <provide name="users-store"
role="org.apache.james.services.UsersStore"/>
        <provide name="database-connections"
        
role="org.apache.avalon.cornerstone.services.datasource.DataSourceSelect
or" />
  </block>

-- Jason


-----Original Message-----
From: Noel J. Bergman [mailto:[EMAIL PROTECTED]] 
Sent: 19 August 2002 07:39
To: James Developers List
Subject: RE: NNTP auth issues


Paul,

FYI, the NNTP code is not a Mailet.  :-)  It is one of these:

public class AuthServiceImpl extends AbstractLogEnabled
    implements AuthService, Composable, Configurable

and acquired by the NNTPHandler like this:

  auth =
(AuthService)componentManager.lookup("org.apache.james.nntpserver.AuthSe
rvic
e");

so I presume that it is probably supposed to carry the Component
decoration until you show us how you want that replaced.

> anti-pattern of Mailets getting free reign of the ComponentManager

We'll get there.  There is no way to have a portable Mailet API if
Mailets have to keep getting at non-portable services.

        --- Noel

-----Original Message-----
From: Paul Hammant [mailto:[EMAIL PROTECTED]]
Sent: Monday, August 19, 2002 2:18
To: James Developers List
Subject: Re: NNTP auth issues


Noel,  Jason,

>Shouldn't be any different.  Did you make any progress on this?
>
>You might want to ask Paul Hammant to take a look at it.  For example, 
>I don't know what the relationship is between the .xinfo files and 
>things
like
>the assembly file, but the .xinfo for the nntp server doesn't have an 
>entry for the UsersStore, which is present in the .xinfo for other 
>services.
>
There is a strong relationship is Noel suspects.

You will have to fork the root NNTP block to declare its need for and
get DataSource from ComponentManager in its compose method.

At least until we find a way of eliminating the dar I suggest insecure
anti-pattern of Mailets getting free reign of the ComponentManager.

- Paul

>       --- Noel
>
>-----Original Message-----
>From: Jason Webb [mailto:[EMAIL PROTECTED]]
>Sent: Thursday, August 15, 2002 6:30
>To: 'James Developers List'
>Subject: NNTP auth issues
>
>
>I'm trying to link our database into the NNTP auth mechanism as we 
>provide an MLM that has a lot of NNTP style features. However, when I 
>ask for a DataSource from the ComponentManager, I get an exception 
>thrown at me:
>
>org.apache.avalon.framework.component.ComponentException: Unable to 
>provide implementation for 
>org.apache.avalon.cornerstone.services.datasource.DataSourceSelector
>        at 
>org.apache.avalon.framework.component.DefaultComponentManager.lookup
>DefaultComponentManager.java:70)
>        at 
>org.apache.james.nntpserver.AuthServiceImpl.isAuthenticated(AuthService
>I
>mpl.java:84)
>        at
>org.apache.james.nntpserver.AuthServiceImpl.isAuthorized(AuthServiceImp
l
>.java:53)
>
>
>Etc....
>
>It all works fine in the mailet we use for our MLM. Is NNTP special 
>with regards to DataSources?
>
>Help!
>
>-- Jason
>
>
>--
>To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
>For additional commands, e-mail: 
><mailto:[EMAIL PROTECTED]>
>
>
>




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


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



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

Reply via email to