You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-user@james.apache.org by Carl Downs <ca...@yahoo.com> on 2004/10/05 08:21:52 UTC

Mailet: Getting MailRepository and UsersRepository from MailetContext

Hello-

v2.2.0 distribution
Java 1.4.0

I would like to use the UsersRepository and
MailRepository from within a Mailet interface
service() method.

The javadocs posted on the James site show these
MailetContext interface signatures:

  MailRepository getMailRepository
  (String specificationURL);
  
  UsersRepository getUserRepository
  (String repositoryName);

However, they do not seem to be a part of the actual
interface contained in the v2.2.0 distribution.

I have looked through the org.apache.james packages
and tried accessing AvalonUsersStore, AvalonMailStore,
UsersRepository, AvalonMailRepository, etc., but
cannot find the manager or service entry point to
acquire them from within a Mailet.

I'm thinking there must be some kind of Avalon /
Phoenix framework registry sitting around where these
objects are placed after bootstrapping from
SAR-INF/config.xml but I haven't been able to find it
thus far.

Where should I be looking?  

Thanks,
Carl



		
_______________________________
Do you Yahoo!?
Declare Yourself - Register online to vote today!
http://vote.yahoo.com

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


Re: Mailet: Getting MailRepository and UsersRepository from MailetContext

Posted by Carl Downs <ca...@yahoo.com>.
I was able to get this to work.  Not sure it's *the*
way to do it, though... Carl

>From the James class source file:

// For mailet engine provide MailetContext
//compMgr.put("org.apache.mailet.MailetContext",
this);
// For AVALON aware mailets and matchers, we put the
Component object as
// an attribute
      
Object o = context.getAttribute
(Constants.AVALON_COMPONENT_MANAGER);
DefaultComponentManager compMgr =
(DefaultComponentManager) o;

MailStore mailStore = (MailStore) compMgr.lookup(
MailStore.ROLE );

UsersStore usersStore = (UsersStore) compMgr.lookup(
UsersStore.ROLE );

MailServer mailServer = (MailServer) compMgr.lookup(
MailServer.ROLE );     


--- Carl Downs <ca...@yahoo.com> wrote:

> Hello-
> 
> v2.2.0 distribution
> Java 1.4.0
> 
> I would like to use the UsersRepository and
> MailRepository from within a Mailet interface
> service() method.
> 
> The javadocs posted on the James site show these
> MailetContext interface signatures:
> 
>   MailRepository getMailRepository
>   (String specificationURL);
>   
>   UsersRepository getUserRepository
>   (String repositoryName);
> 
> However, they do not seem to be a part of the actual
> interface contained in the v2.2.0 distribution.
> 
> I have looked through the org.apache.james packages
> and tried accessing AvalonUsersStore,
> AvalonMailStore,
> UsersRepository, AvalonMailRepository, etc., but
> cannot find the manager or service entry point to
> acquire them from within a Mailet.
> 
> I'm thinking there must be some kind of Avalon /
> Phoenix framework registry sitting around where
> these
> objects are placed after bootstrapping from
> SAR-INF/config.xml but I haven't been able to find
> it
> thus far.
> 
> Where should I be looking?  
> 
> Thanks,
> Carl
> 
> 
> 
> 		
> _______________________________
> Do you Yahoo!?
> Declare Yourself - Register online to vote today!
> http://vote.yahoo.com
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> server-user-unsubscribe@james.apache.org
> For additional commands, e-mail:
> server-user-help@james.apache.org
> 
> 



		
_______________________________
Do you Yahoo!?
Declare Yourself - Register online to vote today!
http://vote.yahoo.com

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