james-mime4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefano Bagnara <apa...@bago.org>
Subject Re: [DISCUSSION] make most of mime4j immutable
Date Mon, 13 May 2013 19:20:06 GMT
2013/5/13 Oleg Kalnichevski <olegk@apache.org>:
> I am about to take the first cut at the DOM API redesign. If no
> objections are raised I am planning to do it on trunk and _without_
> preserving backward compatibility with 0.7. If you would rather prefer
> me to work on a branch (or keep deprecated 0.7 DOM APIs in place) please
> do let me know.

+1 to work in trunk: branches are only an overhead when there is a
single active developer ;-)

> I also would like to make MimeConfig immutable which cannot be done
> without breaking API compatibility. Please complain loudly if you think
> it is not OK.

When you say immutable do you mean you want to move everything from
setters (8 properties) to a long list of constructor arguments? Or
something else?

I hope to find some time to test the updated code against my products
and report any broken use case, if any, before 0.8 release so we can
fix them.

Not sure what you're going to do, but please take into consideration
the way we use MimeConfig in jDKIM:
    private MessageServiceFactory newMessageBuilder() throws MimeException {
        MimeConfig mec = new MimeConfig();

        MessageServiceFactory mbf = MessageServiceFactory.newInstance();
        mbf.setAttribute("MimeEntityConfig", mec);
        mbf.setAttribute("FlatMode", true);
        mbf.setAttribute("ContentDecoding", false);

        return mbf;
Here is another use case where I used MimeConfig in a customer project:
MimeConfig mimeEntityConfig = new MimeConfig();
MessageServiceFactory factory = MessageServiceFactory.newInstance();
factory.setAttribute("StorageProvider", new MemoryStorageProvider());
factory.setAttribute("MimeEntityConfig", mimeEntityConfig);
factory.setAttribute("DecodeMonitor", new CheckHandlerDecodeMonitor(eh));
MessageBuilder builder = factory.newMessageBuilder();
Message message = builder.parseMessage(is);
And I also attach another snippet using MimeConfig, too.

I don't expect everything to remaing unchanged and of course I'm ready
to update my code to mime4j changes, but I prefer to report the use
cases in advance, for reference.

If you prefer to commit the changes before explaining what is your
plan with MimeConfig immutability please go ahead (maybe it's easier
for you to commit the change than explaining it).


  • Unnamed multipart/mixed (inline, None, 0 bytes)
View raw message