classpathx-discuss
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Classpathx-discuss] Help needed gnu classpathx mail


From: Chris
Subject: Re: [Classpathx-discuss] Help needed gnu classpathx mail
Date: Wed, 31 Dec 2003 04:37:49 +1100
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.5) Gecko/20031007


Ok, I see what's going on. Now here's a tough question... My application has a plugin architecture and uses custom plugins, and therefore custom classloaders. My plugin is calling Session.getSession(). That means its gets a Session object from the Sun java class library. However I have the gnu Providers in my plugin, and I mention them in my META-INF/javamail.providers file. However because that is in my plugin under a different class loader it isn't found. I need a way to get the Session object to load its javamail.providers from a custom location so it doesn't rely on the default classloader.

Sun seems to be very lame about how they design their plugin architectures that they won't work with other people's plugin architectures. They do the same annoying thing with their jdbc java.sql Driver architecture.



Chris Burdess wrote:

Chris wrote:
I can't figure out how to use the mbox mail provider. I'm new to java mail API for reading mail boxes, but it seems to me that a provider should provide a subclass of the "javax.mail.Provider" class, which the gnuclasspathx providers don't seem to do.

no. a provider provides subclasses of the Store and/or Transport
classes. the Provider class is simply a convenience class to tell you
which providers are registered; it shouldn't be subclassed.

Has anyone got some example code?

how about:

Properties props = System.getProperties();
Session session = Session.getDefaultInstance(props, null);
URLName url = new URLName("mbox:///home/chris/mail");
Store store = session.getStore(url);
Folder root = store.getDefaultFolder();
Folder mymailbox = root.getFolder("mymailbox.mbox");

for further information, read the javamail documentation and the javadoc
for the mbox provider.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]