Re: Rework of mbox provider

Countach <[email protected]>
Newsgroups gmane.comp.java.classpath.extensions.javamail
Message-ID <[email protected]>
I think encouraging or defaulting the use of platform specific 
separators is just as bad as merely allowing them. If the important 
methods like getFullname() return platform specific, then you are 
encouraging the embedding of these platform specific things into config 
files and preferences files and so forth.

It seems to me that whatever absolute file path names you initially pass 
into JavaMail, have nothing whatsoever to do with the MBOX separator 
character. As far as MBOX is concerned they should be treated as opaque 
blobs or strings. You shouldn't have a need to disassemble them. I know 
there could be a need if you call Store.getFolder() with an absolute 
path name, but maybe you should exercise your option under the spec not 
to implement that. If someone wants to open individual files separately 
they should either open a new Store for each file, or else open a Store 
higher up in the hierarchy and pass in relative file names. Then you 
could stick 100% to a standardised separator and not mess with multiple 
separators.

Anyway, that's a side issue. The bigger issue is that JavaMail tries to 
put a consistent interface onto lots of different types of folder 
hierarchies whether they be IMAP or directories of MBOXes or whatever. 
I'm not convinced that users want to see different naming because of the 
platform, anymore than they would want to when looking at IMAP servers 
hosted on different platforms. JavaMail is not trying to be a 
convenience veneer around local file systems, it is trying to be a 
consistent interface across multiple mail sources.


Chris Burdess wrote:

> Countach wrote:
>
>> If I understand the new code correctly, the MBOX code will now name 
>> folders differently depending on the platform. i.e. the hierarchy 
>> separator is backslash for windows platform and forword slash for Unix.
>>
>> I wonder if this isn't a step backwards? Previously the MBOX 
>> hierarchy separator was always forward slash regardless of platform 
>> (just like URLs),
>
>
> Actually there was an inconsistency in the old code: the hierarchy 
> separator was always reported as being the platform separator, but 
> folder paths were only interpreted as if the separator was a slash.
>
>>  and code that uses it doesn't have to worry about what platform it 
>> is on. Now with this setup, the clients of this library have to do a 
>> lot more work to get the same level of platform independance.
>
>
> I agree. I've applied a patch which allows you to use either a slash 
> or the platform separator. The Folder.getFullName method will report 
> the platform separator though, as will getSeparator. You can also use 
> URLNames to reference your mailboxes, which always use slashes in 
> their pathnames.
>
> This code change gives you more options with DOS/Windows filenames; in 
> particular, you should be able to do something like
>
>   Folder f = store.getFolder("C:\\My Mailboxes\\My Inbox.mbx");
>
> as well as
>
>   Folder f = store.getFolder("C:/My Mailboxes/My Inbox.mbx");
>
> and
>
>   Folder f = store.getFolder(new 
> URLName("mbox:///C%3A/My%20Mailboxes/My%20Inbox.mbx"));
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.