and I forgot the dependancies... <dependency>
<groupId>org.springframework</groupId> <artifactId>spring-orm</artifactId> <version>3.0.6.RELEASE</version> <type>jar</type> <scope>compile</scope> </dependency> <dependency> <groupId>org.apache.james</groupId> <artifactId>james-server-mailbox-adapter</artifactId> <version>3.0-M2</version> <type>jar</type> <scope>compile</scope> </dependency> <dependency> <groupId>org.apache.james</groupId> <artifactId>james-server-core</artifactId> <version>3.0-beta3</version> <type>jar</type> <scope>compile</scope> </dependency> <dependency> <groupId>commons-dbcp</groupId> <artifactId>commons-dbcp</artifactId> <version>20030825.184428</version> <type>jar</type> <scope>compile</scope> </dependency> <dependency> <groupId>org.apache.james</groupId> <artifactId>apache-james-mailbox-jpa</artifactId> <version>0.3</version> <type>jar</type> <scope>compile</scope> </dependency> <dependency> <groupId>org.apache.james</groupId> <artifactId>apache-james-mailbox-store</artifactId> <version>0.3</version> <type>jar</type> <scope>compile</scope> </dependency> 2011/9/15 Luc Saulière <luc.sauli...@gmail.com> > I think I've find a way... > > I load : > > <bean id=*"datasource"* class=*"org.apache.commons.dbcp.BasicDataSource"* > > destroy-method=*"close"*> > > <property name=*"driverClassName"* value=*"${database.driverClassName}"* > /> > > <property name=*"url"* value=*"${database.url}"* /> > > <property name=*"username"* value=*"${database.username}"* /> > > <property name=*"password"* value=*"${database.password}"* /> > > </bean> > > <import resource=*"file:///path-to/james-mailbox-jpa-context.xml"* /> > > > <bean id=*"authenticator"* class=* > "org.apache.james.adapter.mailbox.store.UserRepositoryAuthenticator"*/> > > > <bean id=*"entityManagerFactory"* class=* > "org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"*> > > <property name=*"dataSource"* ref=*"datasource"*/> > > <property name=*"jpaVendorAdapter"* ref=*"vendorAdapter"*/> > > <property name=*"persistenceXmlLocation"* value=*"file:///path-to > /META-INF/persistence.xml"*/> > > </bean> > > <bean id=*"vendorAdapter"* class=* > "org.springframework.orm.jpa.vendor.OpenJpaVendorAdapter"*> > > <property name=*"database"* value=*"${vendorAdapter.database}"*/> > > <!-- set this to true for debugging purposes --> > > <property name=*"showSql"* value=*"false"*/> > > </bean> > > > and it works pretty well... > > Is it the easyest/fastest way to do so? > > > Thx...for reading me ;) > Luc. > > 2011/9/14 Luc Saulière <luc.sauli...@gmail.com> > >> Let's use the beta3 then! >> >> We want to store message in a users's mailbox using methods : >> >> >> user is the String name of my user, >> >> message is my MimeMessage to be stored, >> >> mailboxManager is a MailboxManager loaded in my context, >> >> logger is a logger... >> >> >> *new *MailboxSession *mailboxSession* = mailboxManager >> .createSystemSession(user, logger); >> >> *new *MailboxPath mailboxPath = MailboxPath.*inbox*(*mailboxSession*); >> >> >> mailboxManager.startProcessingRequest(*mailboxSession*); >> >> *try* { >> >> mailboxManager.createMailbox(mailboxPath, *mailboxSession*); >> >> } *catch* (MailboxExistsException e) { >> >> logger.info("Mailbox already exists..."); >> >> } >> >> mailboxManager.endProcessingRequest(*mailboxSession*); >> >> >> *new *MessageManager messageManager = mailboxManager.getMailbox(mailboxPath, >> *mailboxSession*); >> >> >> MimeMessageInputStream mmis = *new *MimeMessageInputStream(message); >> >> Date date = *new* Date(); >> >> messageManager.appendMessage(mmis, date, *mailboxSession*, >> *true*,*new*Flags()); >> >> It worked well for the M2 but I don't know which MailboxManager bean to >> load on my context for the M3... >> Is it still the same method to store mails? >> >> Thx >> Luc. >> >> >> >> 2011/9/14 Eric Charles <eric.umg.char...@gmail.com> >> >>> Hi Luc, >>> >>> beta3 is the newest one, so the good one :) >>> >>> I remember our conversations on mailing list where you wanted to >>> integrate james spring injection in your application. Sounds like you >>> finally found your way, but we broke it with new release... >>> >>> Yes, spring injection has quite changed since then. The beans wiring, the >>> place where spring files are located [1], and the embedding in jar rather as >>> plain file in the server. >>> >>> Can you send us the exceptions you have so we can better help? >>> >>> Thx. >>> >>> [1] http://svn.apache.org/repos/**asf/james/mailbox/trunk/** >>> spring/src/main/resources/**META-INF/org/apache/james/<http://svn.apache.org/repos/asf/james/mailbox/trunk/spring/src/main/resources/META-INF/org/apache/james/> >>> >>> >>> On 14/09/11 09:55, Luc Saulière wrote: >>> >>>> We are using the beta3, but we can use the m3 if it's simpler. >>>> We're trying to access the mailboxes first, to store messages on it. >>>> To do so, we've decided to use Spring framework and beans. We wonder >>>> which >>>> beans we have to load to use the mailboxmanager and its append method. >>>> We got many exceptions about missing beans or class not found. >>>> >>>> Next we will try to create users... >>>> >>>> thx >>>> Luc. >>>> >>>> 2011/9/14 Eric >>>> Charles<eric.umg.charles@**gmail.com<eric.umg.char...@gmail.com> >>>> > >>>> >>>> Hi Luc, >>>>> >>>>> Do you want to access only the mailboxes or the users+mailboxes? >>>>> Are you talking about M3 or beta3? >>>>> Can you send any exceptions? >>>>> >>>>> Thx >>>>> >>>>> >>>>> On 14/09/11 04:20, Luc Sauličre wrote: >>>>> >>>>> Hello James Devs, >>>>>> >>>>>> We are developing an app based on James 3 M3 database. We try to >>>>>> analyse >>>>>> the >>>>>> content of the mail received by a James user. >>>>>> We need to access the mailbox of the user. >>>>>> Until now we use org.apache.james.mailbox.****MailboxManager to >>>>>> access >>>>>> one's >>>>>> mailbox on James3 M2, but we realise that we need to add to our >>>>>> classpath >>>>>> several james classes and some XML files for configuration >>>>>> (userrepository.xml on James3M2)... >>>>>> But it does not work with M3... >>>>>> >>>>>> Could help us? How can we access a James3M3 user mailbox? >>>>>> >>>>>> thx >>>>>> >>>>>> >>>>>> -- >>>>> Eric >>>>> http://about.echarles.net >>>>> >>>>> ------------------------------****----------------------------** >>>>> --**--------- >>>>> To unsubscribe, e-mail: server-dev-unsubscribe@james.****apache.org< >>>>> server-dev-**unsubscr...@james.apache.org<server-dev-unsubscr...@james.apache.org> >>>>> > >>>>> For additional commands, e-mail: server-dev-help@james.apache.****org< >>>>> server-dev-help@james.**apache.org <server-dev-h...@james.apache.org>> >>>>> >>>>> >>>>> >>>> >>> -- >>> Eric >>> http://about.echarles.net >>> >>> ------------------------------**------------------------------** >>> --------- >>> To unsubscribe, e-mail: >>> server-dev-unsubscribe@james.**apache.org<server-dev-unsubscr...@james.apache.org> >>> For additional commands, e-mail: >>> server-dev-help@james.apache.**org<server-dev-h...@james.apache.org> >>> >>> >> >> >> -- >> * >> Luc Saulière >> Directeur Général Kiengi >> Tél : 01 72 42 12 17 | Mobile : 06 70 04 23 10 >> luc.sauli...@centraliens.net >> http://kiengi.com >> >> KIENGI S.A.S >> 24, rue du tertre >> 92150 Suresnes >> SAS au capital de 2000€ >> RCS Nanterre 530 008 887 >> * >> >> > > > -- > * > Luc Saulière > Directeur Général Kiengi > Tél : 01 72 42 12 17 | Mobile : 06 70 04 23 10 > luc.sauli...@centraliens.net > http://kiengi.com > > KIENGI S.A.S > 24, rue du tertre > 92150 Suresnes > SAS au capital de 2000€ > RCS Nanterre 530 008 887 > * > > -- * Luc Saulière Directeur Général Kiengi Tél : 01 72 42 12 17 | Mobile : 06 70 04 23 10 luc.sauli...@centraliens.net http://kiengi.com KIENGI S.A.S 24, rue du tertre 92150 Suresnes SAS au capital de 2000€ RCS Nanterre 530 008 887 *