From 97a3a4f07cdc8437f73f4270b237e85c7739a6be Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Tue, 27 May 2008 17:23:45 +0000 Subject: client and server variables are now separate in the editor. --- sources/events/VSRegisteredEvents.java | 72 +++++++++++++++++++++++++++------- 1 file changed, 58 insertions(+), 14 deletions(-) (limited to 'sources/events/VSRegisteredEvents.java') 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 eventClassnames; + private static HashMap eventClassnames = + new HashMap(); /** The event shortnames. */ - private static HashMap eventShortnames; + private static HashMap eventShortnames = + new HashMap(); /** The event names. */ - private static HashMap eventNames; + private static HashMap eventNames = + new HashMap(); /** The editable protocols classnames. */ - private static ArrayList editableProtocolsClassnames; + private static ArrayList editableProtocolsClassnames = + new ArrayList(); + + private static HashMap> clientVariables = + new HashMap>(); + + private static HashMap> serverVariables = + new HashMap>(); /** 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(); - eventShortnames = new HashMap(); - eventClassnames = new HashMap(); - editableProtocolsClassnames = new ArrayList(); 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 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 variables = new ArrayList(); + variables.addAll(serverProtocol.getAllFullKeys()); + serverVariables.put(protocolClassname, variables); + } + + if (!clientProtocol.isEmpty()) { + ArrayList variables = new ArrayList(); + variables.addAll(clientProtocol.getAllFullKeys()); + clientVariables.put(protocolClassname, variables); + } } } - - //Collections.sort(editableProtocolsClassnames); } /** @@ -78,6 +104,24 @@ public final class VSRegisteredEvents { return editableProtocolsClassnames; } + /** + * Gets the protocols server variable names + * + * @return The variable names + */ + public static ArrayList getProtocolServerVariables(String protocolClassname) { + return serverVariables.get(protocolClassname); + } + + /** + * Gets the protocols server variable names + * + * @return The variable names + */ + public static ArrayList getProtocolClientVariables(String protocolClassname) { + return clientVariables.get(protocolClassname); + } + /** * Gets the protocol names. * -- cgit v1.2.3