On Friday 04 April 2003 13:41, Danny Angus wrote:
> > Third: this is what I have cooked up for a migration document,
> > Does this match
> > what is needed?
>
> What would really be needed would be a tool which converts mail in existing
> repositories to the new format, otherwise upgrading James would require
> users to flush all of their repositories because the old serialized classes
> would not be able to be de-serialized.

Ahh of course, the problem is not code migration, but data migration, hmmm. 

I tried to find some code of how this had been done on earlier occasions of 
upgrading the Mailet API, but without luck. Is this really the first time the 
serialization format of Mail has changed?

Okay, what about this approach to readObject/writeObject, that would solve the 
problem in a way eliminating the need for a data migration tool:

    private void readObject(java.io.ObjectInputStream in)
        ... //------ code snipped for clarity -------
        remoteAddr = (String) in.readObject();

        Object o = in.readObject();
        if (o instanceof HashMap) {
           attributes = (HashMap) o;
           setLastUpdated((Date) in.readObject());
        } else {
           setLastUpdated((Date) o);
        }
    }

    private void writeObject(java.io.ObjectOutputStream out) throws 
IOException {
        ... //------ code snipped for clarity -------
        out.writeObject(remoteAddr);
        out.writeObject(attributes);
        out.writeObject(lastUpdated);
    }

-S�ren

-- 
S�ren Hilmer, M.Sc.
R&D manager             Phone:  +45 70 27 64 00
TietoEnator IT+ A/S     Fax:    +45 70 27 64 40
Ved Lunden 12           Direct: +45 87 46 64 57
DK-8230 �byh�j          Email:  [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to