diff options
| author | Paul Buetow <paul@buetow.org> | 2008-05-20 21:45:17 +0000 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2008-05-20 21:45:17 +0000 |
| commit | ef5e2356312e8354e1fe0addef6e24636f95ad78 (patch) | |
| tree | d22dd1de31452e8aca8b6c6a74408092eae2b3ba /sources/events/internal/MessageReceiveEvent.java | |
| parent | 3958e0e3f754a0e4a7760bf86ed5a79999f29ccc (diff) | |
A new package events.internal has been introduced. It only contains events which are for internal usage. the events which are in the events.implementations menu are the events which are editable in the task manager.
Diffstat (limited to 'sources/events/internal/MessageReceiveEvent.java')
| -rw-r--r-- | sources/events/internal/MessageReceiveEvent.java | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/sources/events/internal/MessageReceiveEvent.java b/sources/events/internal/MessageReceiveEvent.java new file mode 100644 index 0000000..d499899 --- /dev/null +++ b/sources/events/internal/MessageReceiveEvent.java @@ -0,0 +1,46 @@ +package events.internal; + +import core.VSMessage; +import core.VSProcess; +import events.VSEvent; +import protocols.VSProtocol; + +public class MessageReceiveEvent extends VSEvent { + private VSMessage message; + + public MessageReceiveEvent(VSMessage message) { + this.message = message; + } + + protected void onInit() { + setClassname(getClass().toString()); + } + + public void onStart() { + String eventName = message.getName(); + String protocolClassname = message.getProtocolClassname(); + + process.updateLamportTime(message.getLamportTime()+1); + process.updateVectorTime(message.getVectorTime()); + + Object protocolObj = null; + + if (process.objectExists(protocolClassname)) + protocolObj = process.getObject(protocolClassname); + + StringBuffer buffer = new StringBuffer(); + buffer.append(prefs.getString("lang.message.recv")); + buffer.append("; "); + buffer.append(message);; + + if (protocolObj == null) { + logg(buffer.toString()); + + } else { + final VSProtocol protocol = (VSProtocol) protocolObj; + logg(buffer.toString()); + protocol.onMessageRecv(message); + } + + } +} |
