james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Soeren Hilmer <soren.hil...@tietoenator.com>
Subject Re: Bug 18471
Date Fri, 04 Apr 2003 12:19:05 GMT
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:	soren.hilmer@tietoenator.com


---------------------------------------------------------------------
To unsubscribe, e-mail: james-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: james-dev-help@jakarta.apache.org


Mime
View raw message