diff options
| author | Paul Buetow <paul@buetow.org> | 2008-05-27 17:23:45 +0000 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2008-05-27 17:23:45 +0000 |
| commit | 97a3a4f07cdc8437f73f4270b237e85c7739a6be (patch) | |
| tree | 32154e63775f1fa145d176301840e3150b8eb001 /sources/events/VSRegisteredEvents.java | |
| parent | 39e9eb74c011ee5351ac1796e5df529a70aa8945 (diff) | |
client and server variables are now separate in the editor.
Diffstat (limited to 'sources/events/VSRegisteredEvents.java')
| -rw-r--r-- | sources/events/VSRegisteredEvents.java | 72 |
1 files changed, 58 insertions, 14 deletions
diff --git a/sources/events/VSRegisteredEvents.java b/sources/events/VSRegisteredEvents.java index 81b68dc..997cc19 100644 --- a/sources/events/VSRegisteredEvents.java +++ b/sources/events/VSRegisteredEvents.java @@ -17,16 +17,26 @@ public final class VSRegisteredEvents { private static final long serialVersionUID = 1L; /** The event classnames. */ - private static HashMap<String,String> eventClassnames; + private static HashMap<String,String> eventClassnames = + new HashMap<String,String>(); /** The event shortnames. */ - private static HashMap<String,String> eventShortnames; + private static HashMap<String,String> eventShortnames = + new HashMap<String,String>(); /** The event names. */ - private static HashMap<String,String> eventNames; + private static HashMap<String,String> eventNames = + new HashMap<String,String>(); /** The editable protocols classnames. */ - private static ArrayList<String> editableProtocolsClassnames; + private static ArrayList<String> editableProtocolsClassnames = + new ArrayList<String>(); + + private static HashMap<String,ArrayList<String>> clientVariables = + new HashMap<String,ArrayList<String>>(); + + private static HashMap<String,ArrayList<String>> serverVariables = + new HashMap<String,ArrayList<String>>(); /** The prefs. */ private static VSPrefs prefs; @@ -38,10 +48,6 @@ public final class VSRegisteredEvents { */ public static void init(VSPrefs prefs_) { prefs = prefs_; - eventNames = new HashMap<String, String>(); - eventShortnames = new HashMap<String, String>(); - eventClassnames = new HashMap<String, String>(); - editableProtocolsClassnames = new ArrayList<String>(); registerEvent("events.implementations.ProcessCrashEvent", "Prozessabsturz", null); registerEvent("events.implementations.ProcessRecoverEvent", "Prozesswiederbelebung", null); @@ -57,16 +63,36 @@ public final class VSRegisteredEvents { /* Make dummy objects of each protocol, to see if they contain VSPrefs values to edit */ Vector<String> protocolClassnames = getProtocolClassnames(); VSClassLoader classLoader = new VSClassLoader(); + for (String protocolClassname : protocolClassnames) { - Object object = classLoader.newInstance(protocolClassname); - if (object instanceof protocols.VSAbstractProtocol) { - protocols.VSAbstractProtocol protocol = (protocols.VSAbstractProtocol) object; - if (!protocol.isEmpty()) + Object serverObject = classLoader.newInstance(protocolClassname); + Object clientObject = classLoader.newInstance(protocolClassname); + + if (clientObject instanceof protocols.VSAbstractProtocol && + serverObject instanceof protocols.VSAbstractProtocol) { + + protocols.VSAbstractProtocol serverProtocol = (protocols.VSAbstractProtocol) serverObject; + protocols.VSAbstractProtocol clientProtocol = (protocols.VSAbstractProtocol) clientObject; + + serverProtocol.onServerInit(); + clientProtocol.onClientInit(); + + if (!serverProtocol.isEmpty() || !clientProtocol.isEmpty()) editableProtocolsClassnames.add(protocolClassname); + + if (!serverProtocol.isEmpty()) { + ArrayList<String> variables = new ArrayList<String>(); + variables.addAll(serverProtocol.getAllFullKeys()); + serverVariables.put(protocolClassname, variables); + } + + if (!clientProtocol.isEmpty()) { + ArrayList<String> variables = new ArrayList<String>(); + variables.addAll(clientProtocol.getAllFullKeys()); + clientVariables.put(protocolClassname, variables); + } } } - - //Collections.sort(editableProtocolsClassnames); } /** @@ -79,6 +105,24 @@ public final class VSRegisteredEvents { } /** + * Gets the protocols server variable names + * + * @return The variable names + */ + public static ArrayList<String> getProtocolServerVariables(String protocolClassname) { + return serverVariables.get(protocolClassname); + } + + /** + * Gets the protocols server variable names + * + * @return The variable names + */ + public static ArrayList<String> getProtocolClientVariables(String protocolClassname) { + return clientVariables.get(protocolClassname); + } + + /** * Gets the protocol names. * * @return the protocol names |
