diff options
| author | Paul Buetow <paul@buetow.org> | 2008-06-02 00:21:43 +0000 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2008-06-02 00:21:43 +0000 |
| commit | 378c2674fc704b2a6bbf0e6a01b721a7aea7c2e2 (patch) | |
| tree | ae228c2fb8c1387d2667322f60a649032c52c152 /sources/events | |
| parent | a24f52761a623afa3c041b7823004952d8c5286e (diff) | |
saveing seems work, but may have bugs
Diffstat (limited to 'sources/events')
| -rw-r--r-- | sources/events/VSAbstractEvent.java | 11 | ||||
| -rw-r--r-- | sources/events/internal/VSProtocolEvent.java | 36 |
2 files changed, 44 insertions, 3 deletions
diff --git a/sources/events/VSAbstractEvent.java b/sources/events/VSAbstractEvent.java index 34e2b87..0dd814c 100644 --- a/sources/events/VSAbstractEvent.java +++ b/sources/events/VSAbstractEvent.java @@ -173,8 +173,11 @@ abstract public class VSAbstractEvent extends VSPrefs { ObjectOutputStream objectOutputStream) throws IOException { super.serialize(serialize, objectOutputStream); + + if (VSSerialize.DEBUG) + System.out.println("Serializing: VSAbstractEvent; id="+getID()); + objectOutputStream.writeObject(new Integer(super.getID())); - //objectOutputStream.writeObject(new Integer(process.getProcessNum())); objectOutputStream.writeObject(eventShortname); objectOutputStream.writeObject(eventClassname); } @@ -190,13 +193,15 @@ abstract public class VSAbstractEvent extends VSPrefs { super.deserialize(serialize, objectInputStream); if (VSSerialize.DEBUG) - System.out.println("Deserializing: VSAbstractEvent"); + System.out.print("Deserializing: VSAbstractEvent "); int id = ((Integer) objectInputStream.readObject()).intValue(); - //Integer processNum = (Integer) objectInputStream.readObject(); this.eventShortname = (String) objectInputStream.readObject(); this.eventClassname = (String) objectInputStream.readObject(); + if (VSSerialize.DEBUG) + System.out.println(eventClassname); + serialize.setObject(id, "event", this); } } diff --git a/sources/events/internal/VSProtocolEvent.java b/sources/events/internal/VSProtocolEvent.java index cfb1e35..5f5ceb4 100644 --- a/sources/events/internal/VSProtocolEvent.java +++ b/sources/events/internal/VSProtocolEvent.java @@ -23,8 +23,11 @@ package events.internal; +import java.io.*; + import events.*; import protocols.VSAbstractProtocol; +import serialize.*; /** * The class VSProtocolEvent. This event is used if a protocol (server or @@ -132,4 +135,37 @@ public class VSProtocolEvent extends VSAbstractEvent { logg(buffer.toString()); } + + /* (non-Javadoc) + * @see serialize.VSSerializable#serialize(serialize.VSSerialize, + * java.io.ObjectOutputStream) + */ + public synchronized void serialize(VSSerialize serialize, + ObjectOutputStream objectOutputStream) + throws IOException { + super.serialize(serialize, objectOutputStream); + objectOutputStream.writeObject(protocolClassname); + objectOutputStream.writeObject(new Boolean(isClientProtocol)); + objectOutputStream.writeObject(new Boolean(isProtocolActivation)); + } + + /* (non-Javadoc) + * @see serialize.VSSerializable#deserialize(serialize.VSSerialize, + * java.io.ObjectInputStream) + */ + @SuppressWarnings("unchecked") + public synchronized void deserialize(VSSerialize serialize, + ObjectInputStream objectInputStream) + throws IOException, ClassNotFoundException { + super.deserialize(serialize, objectInputStream); + + if (VSSerialize.DEBUG) + System.out.println("Deserializing: VSProtocolEvent"); + + protocolClassname = (String) objectInputStream.readObject(); + isClientProtocol = ((Boolean) + objectInputStream.readObject()).booleanValue();; + isProtocolActivation = ((Boolean) + objectInputStream.readObject()).booleanValue();; + } } |
