diff options
| author | Paul Buetow <paul@buetow.org> | 2008-06-03 16:41:37 +0000 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2008-06-03 16:41:37 +0000 |
| commit | 11af1c9fa7fe66e10de0a92878311b4e22befb0f (patch) | |
| tree | 8dfc7af2ec18eb5889327426bc6fdb7379a3feba /sources/core | |
| parent | f7bdf8a7f6ebd43bfacc22eeeda3eb52bf50efd7 (diff) | |
made future serialized class versions backwards compatible.
Diffstat (limited to 'sources/core')
| -rw-r--r-- | sources/core/VSProcess.java | 12 | ||||
| -rw-r--r-- | sources/core/VSTask.java | 12 | ||||
| -rw-r--r-- | sources/core/VSTaskManager.java | 11 |
3 files changed, 35 insertions, 0 deletions
diff --git a/sources/core/VSProcess.java b/sources/core/VSProcess.java index c6456de..9842321 100644 --- a/sources/core/VSProcess.java +++ b/sources/core/VSProcess.java @@ -1024,12 +1024,18 @@ public class VSProcess extends VSPrefs implements VSSerializable { System.out.println("Serializing: VSProcess (num: " + processNum + "; id: " + processID + ")"); + /** For later backwards compatibility, to add more stuff */ + objectOutputStream.writeObject(new Boolean(false)); + objectOutputStream.writeObject(new Integer(processID)); objectOutputStream.writeObject(new Integer(protocolsToReset.size())); for (VSAbstractProtocol protocol : protocolsToReset) { objectOutputStream.writeObject(protocol.getClassname()); protocol.serialize(serialize, objectOutputStream); } + + /** For later backwards compatibility, to add more stuff */ + objectOutputStream.writeObject(new Boolean(false)); } /* (non-Javadoc) @@ -1046,6 +1052,9 @@ public class VSProcess extends VSPrefs implements VSSerializable { if (VSSerialize.DEBUG) System.out.println("Deserializing: VSProcess"); + /** For later backwards compatibility, to add more stuff */ + objectInputStream.readObject(); + this.processID = ((Integer) objectInputStream.readObject()).intValue(); int numProtocols = ((Integer) @@ -1057,6 +1066,9 @@ public class VSProcess extends VSPrefs implements VSSerializable { protocol.deserialize(serialize, objectInputStream); } + /** For later backwards compatibility, to add more stuff */ + objectInputStream.readObject(); + serialize.setObject(processNum, "process", this); } } diff --git a/sources/core/VSTask.java b/sources/core/VSTask.java index 1b8f744..c1323e8 100644 --- a/sources/core/VSTask.java +++ b/sources/core/VSTask.java @@ -362,6 +362,9 @@ public class VSTask implements Comparable, VSSerializable { public synchronized void serialize(VSSerialize serialize, ObjectOutputStream objectOutputStream) throws IOException { + /** For later backwards compatibility, to add more stuff */ + objectOutputStream.writeObject(new Boolean(false)); + objectOutputStream.writeObject(new Integer(process.getProcessNum())); objectOutputStream.writeObject(event.getClassname()); objectOutputStream.writeObject(new Integer(event.getID())); @@ -370,6 +373,9 @@ public class VSTask implements Comparable, VSSerializable { objectOutputStream.writeObject(new Long(taskTime)); objectOutputStream.writeObject(new Boolean(isGlobalTimed)); objectOutputStream.writeObject(new Boolean(isProgrammed)); + + /** For later backwards compatibility, to add more stuff */ + objectOutputStream.writeObject(new Boolean(false)); } /* (non-Javadoc) @@ -383,6 +389,9 @@ public class VSTask implements Comparable, VSSerializable { if (VSSerialize.DEBUG) System.out.println("Deserializing: VSTask"); + /** For later backwards compatibility, to add more stuff */ + objectInputStream.readObject(); + int processNum = ((Integer) objectInputStream.readObject()).intValue(); VSProcess process = (VSProcess) serialize.getObject(processNum, "process"); @@ -412,6 +421,9 @@ public class VSTask implements Comparable, VSSerializable { serialize.setObject(taskNum, "task", this); init(taskTime, process, event, !isGlobalTimed.booleanValue()); this.isProgrammed = isProgrammed.booleanValue(); + + /** For later backwards compatibility, to add more stuff */ + objectInputStream.readObject(); } } diff --git a/sources/core/VSTaskManager.java b/sources/core/VSTaskManager.java index 272a52c..d4ee83c 100644 --- a/sources/core/VSTaskManager.java +++ b/sources/core/VSTaskManager.java @@ -503,6 +503,8 @@ public class VSTaskManager implements VSSerializable { public synchronized void serialize(VSSerialize serialize, ObjectOutputStream objectOutputStream) throws IOException { + /** For later backwards compatibility, to add more stuff */ + objectOutputStream.writeObject(new Boolean(false)); ArrayList<VSTask> tasks = new ArrayList<VSTask>(); @@ -526,6 +528,9 @@ public class VSTaskManager implements VSSerializable { objectOutputStream.writeObject(new Integer(tasks.size())); for (VSTask task : tasks) task.serialize(serialize, objectOutputStream); + + /** For later backwards compatibility, to add more stuff */ + objectOutputStream.writeObject(new Boolean(false)); } /* (non-Javadoc) @@ -539,6 +544,9 @@ public class VSTaskManager implements VSSerializable { if (VSSerialize.DEBUG) System.out.println("Deserializing: VSTaskManager"); + /** For later backwards compatibility, to add more stuff */ + objectInputStream.readObject(); + globalTasks.clear(); ArrayList<VSProcess> processes = simulatorCanvas.getProcesses(); @@ -552,5 +560,8 @@ public class VSTaskManager implements VSSerializable { VSTask task = new VSTask(serialize, objectInputStream); addTask(task, task.isProgrammed()); } + + /** For later backwards compatibility, to add more stuff */ + objectInputStream.readObject(); } } |
