diff options
| -rw-r--r-- | ROADMAP | 50 | ||||
| -rwxr-xr-x | build.sh | 4 | ||||
| -rw-r--r-- | sources/events/VSAbstractEvent.java | 26 | ||||
| -rw-r--r-- | sources/events/VSRegisteredEvents.java | 100 | ||||
| -rw-r--r-- | sources/events/implementations/VSProcessCrashEvent.java | 6 | ||||
| -rw-r--r-- | sources/events/implementations/VSProcessRecoverEvent.java | 6 | ||||
| -rw-r--r-- | sources/events/internal/VSMessageReceiveEvent.java | 10 | ||||
| -rw-r--r-- | sources/events/internal/VSProtocolEvent.java | 42 | ||||
| -rw-r--r-- | sources/events/internal/VSProtocolScheduleEvent.java | 27 |
9 files changed, 166 insertions, 105 deletions
@@ -1,29 +1,25 @@ -TODO: -Basic Multicast -Reliable Multicast -VSSimulationCanvas calls VSProcess.resetProcessCounter Bugfix! - -Kapseln: Protokolle sollen nur fuer sie bestimtme methoden aufrufen koennen -Ganze simulationseinstellungen abspeichern/laden koennen - TaskManager + Tasks serialisierbar machen - VSPrefsRestriction serialisierbar machen - Tasks anhand der Tasknummern den richtigen Prozessen zuordnen - Jedes Eventobjekte den Tasks und der Prozesse anhand der IDs zuordnen -Periodische Tasks anlegen koennen -"Himmelobjekt"? -Evtl: -Protocols: - Waehlermengen nach Maekawa? - NFS - AFS - Local deliver max/min time - Systemschnitte? - Middleware-Schicht? - Ereignisse, die Prozessvariablen aendern - Bedingte Ereignisse +Must do: + Basic Multicast + Reliable Multicast + VSSimulationCanvas calls VSProcess.resetProcessCounter Bugfix! + Ganze simulationseinstellungen abspeichern/laden koennen + TaskManager + Tasks serialisierbar machen + VSPrefsRestriction serialisierbar machen + Tasks anhand der Tasknummern den richtigen Prozessen zuordnen + Jedes Eventobjekte den Tasks und der Prozesse anhand der IDs zuordnen +Evtl.: + Kapseln: Protokolle sollen nur fuer sie bestimtme methoden aufrufen koennen + Periodische Tasks anlegen koennen + "Himmelobjekt"? Simulationen beliebig lang machen - Loggingfenster soll nur Lamport/Vektorzeit anzeigen, wenn ausgewaehlt -Optimierungen: - Methoden alphanumerisch sortieren, code tools KeyEvent Manager - + Loggingfenster soll nur Lamport/Vektorzeit anzeigen, wenn ausgewaehlt +Evtl. nicht: + Protocols: + Waehlermengen nach Maekawa? + NFS + AFS + Systemschnitte? + Middleware-Schicht? + Ereignisse, die Prozessvariablen aendern + Bedingte Ereignisse diff --git a/build.sh b/build.sh deleted file mode 100755 index 7ea62f4..0000000 --- a/build.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh -x - -ant $@ - diff --git a/sources/events/VSAbstractEvent.java b/sources/events/VSAbstractEvent.java index be721cd..9c32a7a 100644 --- a/sources/events/VSAbstractEvent.java +++ b/sources/events/VSAbstractEvent.java @@ -8,9 +8,14 @@ import core.VSProcess; import prefs.VSPrefs; /** - * The Class VSAbstractEvent. + * The Class VSAbstractEvent. This abstract class defines the basic framework + * of each event. an event is used to fullfill a specific task. An event object + * will get stored in a VSTask object. + * + * @author Paul C. Buetow */ abstract public class VSAbstractEvent extends VSPrefs { + /** The serial version uid */ private static final long serialVersionUID = 1L; /** The prefs. */ @@ -38,8 +43,8 @@ abstract public class VSAbstractEvent extends VSPrefs { } /** - * Inits the event. - * + * Inits the event without setting the processes and prefs variables + * of the object. */ public void init() { onInit(); @@ -106,32 +111,33 @@ abstract public class VSAbstractEvent extends VSPrefs { } /** - * Logg. + * Logg a specific message. * - * @param message the message + * @param message the logging message */ public void logg(String message) { process.logg(/*toString() + "; " + */message); } /** - * Equals. + * Checks if the event equals to another event.. * - * @param event the event + * @param event the event to compare against. * - * @return true, if successful + * @return true, if the events are the same (have the same event id) */ public boolean equals(VSAbstractEvent event) { return super.getID() == event.getID(); } /** - * On init. + * Every event has its own initialize method. */ abstract public void onInit(); /** - * On start. + * Every event can get started. This method get's executed if the event + * takes place. * * @return false, if a message has been delivered but is not relevant and * can get removed from the simulator canvas paint area. true otherwise. diff --git a/sources/events/VSRegisteredEvents.java b/sources/events/VSRegisteredEvents.java index 45bff26..6e67c66 100644 --- a/sources/events/VSRegisteredEvents.java +++ b/sources/events/VSRegisteredEvents.java @@ -11,9 +11,15 @@ import core.*; import utils.*; /** - * The Class VSRegisteredEvents. + * The Class VSRegisteredEvents. This class is responsible to manage all + * events. It manages the event classnames, the event shortnames and the event + * names. It also checks if a protocol (which is an event as well) has + * variables which are editable through the GUI of the simulator. + * + * @author Paul C. Buetow */ public final class VSRegisteredEvents { + /** The serial version uid */ private static final long serialVersionUID = 1L; /** The event classnames by eventnames. */ @@ -56,20 +62,33 @@ public final class VSRegisteredEvents { public static void init(VSPrefs prefs_) { prefs = prefs_; - registerEvent("events.implementations.VSProcessCrashEvent", "Prozessabsturz", null); - registerEvent("events.implementations.VSProcessRecoverEvent", "Prozesswiederbelebung", null); - registerEvent("protocols.implementations.VSBerkelyTimeProtocol", "Berkeley Algorithmus zur internen Sync.", "Berkeley"); - registerEvent("protocols.implementations.VSBroadcastSturmProtocol", "Broadcaststurm", null); - registerEvent("protocols.implementations.VSDummyProtocol", "Beispiel/Dummy", null); - registerEvent("protocols.implementations.VSExternalTimeSyncProtocol", "Christians Methode zur externen Sync.", "Christians"); - registerEvent("protocols.implementations.VSInternalTimeSyncProtocol", "Interne Synchronisation", "Interne Sync."); - registerEvent("protocols.implementations.VSPingPongProtocol", "Ping Pong", null); - registerEvent("protocols.implementations.VSOnePhaseCommitProtocol", "Ein-Phasen Commit", "1-Phasen Commit"); - registerEvent("protocols.implementations.VSTwoPhaseCommitProtocol", "Zwei-Phasen Commit", "2-Phasen Commit"); - registerEvent("protocols.implementations.VSBasicMulticastProtocol", "Basic Multicast", "Basic Multicast"); - registerEvent("protocols.implementations.VSReliableMulticastProtocol", "Reliable Multicast", "Reliable Multicast"); - - /* Make dummy objects of each protocol, to see if they contain VSPrefs values to edit */ + registerEvent("events.implementations.VSProcessCrashEvent", + "Prozessabsturz", null); + registerEvent("events.implementations.VSProcessRecoverEvent", + "Prozesswiederbelebung", null); + registerEvent("protocols.implementations.VSBasicMulticastProtocol", + "Basic Multicast", "Basic Multicast"); + registerEvent("protocols.implementations.VSBerkelyTimeProtocol", + "Berkeley Algorithmus zur internen Sync.", "Berkeley"); + registerEvent("protocols.implementations.VSBroadcastSturmProtocol", + "Broadcaststurm", null); + registerEvent("protocols.implementations.VSDummyProtocol", + "Beispiel/Dummy", null); + registerEvent("protocols.implementations.VSExternalTimeSyncProtocol", + "Christians Methode zur externen Sync.", "Christians"); + registerEvent("protocols.implementations.VSInternalTimeSyncProtocol", + "Interne Synchronisation", "Interne Sync."); + registerEvent("protocols.implementations.VSOnePhaseCommitProtocol", + "Ein-Phasen Commit", "1-Phasen Commit"); + registerEvent("protocols.implementations.VSPingPongProtocol", + "Ping Pong", null); + registerEvent("protocols.implementations.VSReliableMulticastProtocol", + "Reliable Multicast", "Reliable Multicast"); + registerEvent("protocols.implementations.VSTwoPhaseCommitProtocol", + "Zwei-Phasen Commit", "2-Phasen Commit"); + + /* Make dummy objects of each protocol, to see if they contain VSPrefs + values to edit */ Vector<String> protocolClassnames = getProtocolClassnames(); VSClassLoader classLoader = new VSClassLoader(); @@ -80,8 +99,10 @@ public final class VSRegisteredEvents { if (clientObject instanceof protocols.VSAbstractProtocol && serverObject instanceof protocols.VSAbstractProtocol) { - protocols.VSAbstractProtocol serverProtocol = (protocols.VSAbstractProtocol) serverObject; - protocols.VSAbstractProtocol clientProtocol = (protocols.VSAbstractProtocol) clientObject; + protocols.VSAbstractProtocol serverProtocol = + (protocols.VSAbstractProtocol) serverObject; + protocols.VSAbstractProtocol clientProtocol = + (protocols.VSAbstractProtocol) clientObject; serverProtocol.onServerInit(); clientProtocol.onClientInit(); @@ -102,7 +123,8 @@ public final class VSRegisteredEvents { } if (serverProtocol.hasOnServerStart()) - isOnServerStartProtocol.put(protocolClassname, new Boolean(true)); + isOnServerStartProtocol.put(protocolClassname, + new Boolean(true)); } } } @@ -117,20 +139,22 @@ public final class VSRegisteredEvents { } /** - * Gets the protocols server variable names + * Gets the protocols server variable names. * * @return The variable names */ - public static ArrayList<String> getProtocolServerVariables(String protocolClassname) { + public static ArrayList<String> getProtocolServerVariables( + String protocolClassname) { return serverVariables.get(protocolClassname); } /** - * Gets the protocols server variable names + * Gets the protocols server variable names. * * @return The variable names */ - public static ArrayList<String> getProtocolClientVariables(String protocolClassname) { + public static ArrayList<String> getProtocolClientVariables( + String protocolClassname) { return clientVariables.get(protocolClassname); } @@ -144,7 +168,8 @@ public final class VSRegisteredEvents { Vector<String> vector = new Vector<String>(); for (String eventName : set) - if (getClassnameByEventname(eventName).startsWith("protocols.implementations")) + if (getClassnameByEventname(eventName).startsWith( + "protocols.implementations")) vector.add(eventName); Collections.sort(vector); @@ -182,7 +207,8 @@ public final class VSRegisteredEvents { Vector<String> vector = new Vector<String>(); for (String eventName : set) - if (getClassnameByEventname(eventName).startsWith("events.implementations")) + if (getClassnameByEventname(eventName).startsWith( + "events.implementations")) vector.add(eventName); Collections.sort(vector); @@ -260,8 +286,10 @@ public final class VSRegisteredEvents { * @return true if onServerStart, false if onClientStart */ public static boolean isOnServerStartProtocol(String protocolClassname) { - if (isOnServerStartProtocol.containsKey(protocolClassname)) - return isOnServerStartProtocol.get(protocolClassname).booleanValue(); + if (isOnServerStartProtocol.containsKey(protocolClassname)) { + Boolean bool = isOnServerStartProtocol.get(protocolClassname); + return bool.booleanValue(); + } return false; } @@ -272,10 +300,11 @@ public final class VSRegisteredEvents { * @param eventClassname the event classname * @param process the process * - * @return the lang.process.removeevent + * @return An instance of the event classname, if exists. Else null. */ - public static VSAbstractEvent createEventInstanceByClassname(String eventClassname, VSProcess process) { - final Object protocolObj = new VSClassLoader().newInstance(eventClassname); + public static VSAbstractEvent createEventInstanceByClassname( + String eventClassname, VSProcess process) { + Object protocolObj = new VSClassLoader().newInstance(eventClassname); if (protocolObj instanceof VSAbstractEvent) { VSAbstractEvent event = (VSAbstractEvent) protocolObj; @@ -292,20 +321,23 @@ public final class VSRegisteredEvents { * @param eventName the event name * @param process the process * - * @return the lang.process.removeevent + * @return An instance of the event, if exists. Else null. */ - public static VSAbstractEvent createEventInstanceByName(String eventName, VSProcess process) { - return createEventInstanceByClassname(eventClassnamesByNames.get(eventName), process); + public static VSAbstractEvent createEventInstanceByName(String eventName, + VSProcess process) { + return createEventInstanceByClassname( + eventClassnamesByNames.get(eventName), process); } /** - * Register event. + * Registers an event. * * @param eventClassname the event classname * @param eventName the event name * @param eventShortname the event shortname */ - private static void registerEvent(String eventClassname, String eventName, String eventShortname) { + private static void registerEvent(String eventClassname, String eventName, + String eventShortname) { if (eventShortname == null) eventShortname = eventName; diff --git a/sources/events/implementations/VSProcessCrashEvent.java b/sources/events/implementations/VSProcessCrashEvent.java index bfb58ff..32cf017 100644 --- a/sources/events/implementations/VSProcessCrashEvent.java +++ b/sources/events/implementations/VSProcessCrashEvent.java @@ -7,9 +7,13 @@ package events.implementations; import events.VSAbstractEvent; /** - * The Class VSProcessCrashEvent. + * The Class VSProcessCrashEvent. This event makes a process to crash. + * + * @author Paul C. Buetow */ public class VSProcessCrashEvent extends VSAbstractEvent { + /** The serial version uid */ + private static final long serialVersionUID = 1L; /* (non-Javadoc) * @see events.VSAbstractEvent#onInit() diff --git a/sources/events/implementations/VSProcessRecoverEvent.java b/sources/events/implementations/VSProcessRecoverEvent.java index 6799915..b2778fb 100644 --- a/sources/events/implementations/VSProcessRecoverEvent.java +++ b/sources/events/implementations/VSProcessRecoverEvent.java @@ -7,9 +7,13 @@ package events.implementations; import events.VSAbstractEvent; /** - * The Class VSProcessRecoverEvent. + * The Class VSProcessRecoverEvent. This event makes a process to recover if + * it is crashed. + * + * @author Paul C. Buetow */ public class VSProcessRecoverEvent extends VSAbstractEvent { + /** The serial version uid */ private static final long serialVersionUID = 1L; /* (non-Javadoc) diff --git a/sources/events/internal/VSMessageReceiveEvent.java b/sources/events/internal/VSMessageReceiveEvent.java index 0012775..6a12bba 100644 --- a/sources/events/internal/VSMessageReceiveEvent.java +++ b/sources/events/internal/VSMessageReceiveEvent.java @@ -9,9 +9,13 @@ import events.VSAbstractEvent; import protocols.VSAbstractProtocol; /** - * The Class VSMessageReceiveEvent. + * The Class VSMessageReceiveEvent. This event is used if a process receives + * a message. + * + * @author Paul C. Buetow */ public class VSMessageReceiveEvent extends VSAbstractEvent { + /** The serioal version uid */ private static final long serialVersionUID = 1L; /** The message. */ @@ -38,8 +42,8 @@ public class VSMessageReceiveEvent extends VSAbstractEvent { */ public boolean onStart() { boolean returnValue = true; - boolean onlyRelevantMessages = process.getPrefs(). - getBoolean("sim.messages.relevant"); + boolean onlyRelevantMessages = process.getPrefs().getBoolean( + "sim.messages.relevant"); String eventName = message.getName(); String protocolClassname = message.getProtocolClassname(); diff --git a/sources/events/internal/VSProtocolEvent.java b/sources/events/internal/VSProtocolEvent.java index 8b65c79..2720fe7 100644 --- a/sources/events/internal/VSProtocolEvent.java +++ b/sources/events/internal/VSProtocolEvent.java @@ -8,19 +8,26 @@ import events.*; import protocols.VSAbstractProtocol; /** - * The Class VSProtocolEvent. + * The Class VSProtocolEvent. This event is used if a protocol (server or + * client part) of a process gets enabled or disabled. An object of this class + * can be for 4 different purporses! Activation of the client protocol, + * deactivation of the client protocol, activation of the server protocol, + * deactivation of the server protocol. + * + * @author Paul C. Buetow */ public class VSProtocolEvent extends VSAbstractEvent { + /** The serial version uid */ private static final long serialVersionUID = 1L; /** The protocol classname. */ private String protocolClassname; - /** The event is a client protocol. */ - private boolean isClientProtocol; /* true = client, false = server */ + /** The event is a client protocol if true. Else it is a server protocol */ + private boolean isClientProtocol; - /** The event is a protocol activation. */ - private boolean isProtocolActivation; /* true = activate, false = deactivate */ + /** The event is a protocol activation if true. Else it is a deactivation */ + private boolean isProtocolActivation; /* (non-Javadoc) * @see events.VSAbstractEvent#onInit() @@ -30,36 +37,40 @@ public class VSProtocolEvent extends VSAbstractEvent { } /** - * Checks if is client protocol. + * Sets if it is a client protocol activation/deactivation. * - * @param isClientProtocol the is client protocol + * @param isClientProtocol the event is client protocol if true. the event + * is a server protocol if false. */ public void isClientProtocol(boolean isClientProtocol) { this.isClientProtocol = isClientProtocol; } /** - * Checks if is client protocol. + * Checks if it is a client protocol activation/deactivation. * - * @return true, if is client protocol + * @return the event is client protocol if true. the event + * is a server protocol if false. */ public boolean isClientProtocol() { return isClientProtocol; } /** - * Checks if is protocol activation. + * Sets if it is protocol activation. * - * @param isProtocolActivation the is protocol activation + * @param isProtocolActivation true, if it is a protocol activation. false, + * if it is a protocol deactivation. */ public void isProtocolActivation(boolean isProtocolActivation) { this.isProtocolActivation = isProtocolActivation; } /** - * Checks if is protocol activation. + * Checks if it is protocol activation. * - * @return true, if is protocol activation + * @return true, if it is a protocol activation. false, if it is a protocol + * deactivation. */ public boolean isProtocolActivation() { return isProtocolActivation; @@ -78,12 +89,11 @@ public class VSProtocolEvent extends VSAbstractEvent { * @see events.VSAbstractEvent#onStart() */ public boolean onStart() { - VSAbstractProtocol protocol = process.getProtocolObject( - protocolClassname); + VSAbstractProtocol protocol = + process.getProtocolObject(protocolClassname); if (isClientProtocol) protocol.isClient(isProtocolActivation); - else protocol.isServer(isProtocolActivation); diff --git a/sources/events/internal/VSProtocolScheduleEvent.java b/sources/events/internal/VSProtocolScheduleEvent.java index 9c72124..abe1380 100644 --- a/sources/events/internal/VSProtocolScheduleEvent.java +++ b/sources/events/internal/VSProtocolScheduleEvent.java @@ -8,9 +8,14 @@ import events.*; import protocols.VSAbstractProtocol; /** - * The Class VSProtocolScheduleEvent. + * The Class VSProtocolScheduleEvent. This event is used if a protocol (which + * is a subclass of VSAbstractProtocol) reschedules itself to run again on a + * specific time. + * + * @author Paul C. Buetow */ public class VSProtocolScheduleEvent extends VSAbstractEvent { + /** The serial version uid */ private static final long serialVersionUID = 1L; /** The event is a server protocol schedule. */ @@ -23,9 +28,11 @@ public class VSProtocolScheduleEvent extends VSAbstractEvent { * Create a VSProtocolScheduleEvent object * * @param protocol the protocol - * @param isServerSchedule the event is a client protocol schedule if false, else server schedule + * @param isServerSchedule the event is a client protocol schedule if + * false, else server schedule */ - public VSProtocolScheduleEvent(VSAbstractProtocol protocol, boolean isServerSchedule) { + public VSProtocolScheduleEvent(VSAbstractProtocol protocol, + boolean isServerSchedule) { this.protocol = protocol; this.isServerSchedule = isServerSchedule; } @@ -38,25 +45,27 @@ public class VSProtocolScheduleEvent extends VSAbstractEvent { } /** - * Checks if is client protocol schedule. + * Sets if it is client protocol schedule. * - * @param isServerSchedule the event is a client protocol schedule if false, else server schedule + * @param isServerSchedule false, if the event is a client protocol + * schedule. true, if server. */ public void isServerSchedule(boolean isServerSchedule) { this.isServerSchedule = isServerSchedule; } /** - * Checks if is client protocol. + * Sets if it is client protocol schedule. * - * @return false, if is client protocol schedule, else server protocol schedule + * @return false, if the event is a client protocol schedule. true, if + * server. */ public boolean isServerSchedule() { return isServerSchedule; } /** - * Sets the protocol + * Sets the protocol. * * @param protocol the protocol */ @@ -65,7 +74,7 @@ public class VSProtocolScheduleEvent extends VSAbstractEvent { } /** - * Gets the protocol + * Gets the protocol. * * @return the protocol */ |
