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 C ZG <iz...@yahoo.com.cn> on 2006/03/27 19:40:47 UTC

How to create an Instance of org.apache.james.James and how to get a Reference of UserRepository

I want to get the Instance of UsersFileRepository or UserRepository.
So i have to create an Instance of class of James,
And how to create a Instance of class James.
  I write a test code,but I think there is something wrong with it.
   
     DefaultConfigurationBuilder builder=new DefaultConfigurationBuilder();
   Configuration conf=builder.buildFromFile("D:\\JAVA\\MailServer\\james-2.2.0\\apps\\james\\SAR-INF\\config.xml");
   James j=new James();
   j.configure(conf);
     j.initialize();
     j.getUserRepository(anyone);
   
  This short code doesn't work at all,plz give a sample,I hard to know how to create it.
thx!

		
---------------------------------
 雅虎1G免费邮箱百分百防垃圾信
 雅虎助手-搜索、杀毒、防骚扰  

回复: Re: How to create an Instance of org.apache.james.James and how to get a Reference of UserRepository

Posted by C ZG <iz...@yahoo.com.cn>.
hi Stefano
  I want to add users in programing way.
  I think I should create or reference a  Instance of UsersFileRepository.
  what can i do ?how to do?

Stefano Bagnara <ap...@bago.org> 写道:
  If you want to instantiate an avalon component you must use/create an
Avalon container.
There are many but I don't understand why you don't use phoenix.

What are you trying to do?

If you want to extend James you should create your own avalon components
and use assembly.xml to wire your component to James' components and
viceversa.

Stefano

> I want to get the Instance of UsersFileRepository or UserRepository.
> So i have to create an Instance of class of James,
> And how to create a Instance of class James.
> I write a test code,but I think there is something wrong with it.
> 
> DefaultConfigurationBuilder builder=new DefaultConfigurationBuilder();
> Configuration conf=builder.buildFromFile("D:\\JAVA\\MailServer\\james-2.2.0\\apps\\james\\SAR-INF\\config.xml");
> James j=new James();
> j.configure(conf);
> j.initialize();
> j.getUserRepository(anyone);
> 
> This short code doesn't work at all,plz give a sample,I hard to know how to create it.
> thx!



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



		
---------------------------------
 雅虎1G免费邮箱百分百防垃圾信

Re: How to create an Instance of org.apache.james.James and how to get a Reference of UserRepository

Posted by Stefano Bagnara <ap...@bago.org>.
If you want to instantiate an avalon component you must use/create an
Avalon container.
There are many but I don't understand why you don't use phoenix.

What are you trying to do?

If you want to extend James you should create your own avalon components
and use assembly.xml to wire your component to James' components and
viceversa.

Stefano

> I want to get the Instance of UsersFileRepository or UserRepository.
> So i have to create an Instance of class of James,
> And how to create a Instance of class James.
>   I write a test code,but I think there is something wrong with it.
>    
>      DefaultConfigurationBuilder builder=new DefaultConfigurationBuilder();
>    Configuration conf=builder.buildFromFile("D:\\JAVA\\MailServer\\james-2.2.0\\apps\\james\\SAR-INF\\config.xml");
>    James j=new James();
>    j.configure(conf);
>      j.initialize();
>      j.getUserRepository(anyone);
>    
>   This short code doesn't work at all,plz give a sample,I hard to know how to create it.
> thx!



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