/** * Adds a custom handler for a given message type. If a "base" type (like WHOAREYOU) is given a * custom handler, it will be combined with the default handler and executed after it. * * @param msgType The message type, as a unique string. * @param handler The handler to call when this message type is encountered. */ public void addCustomHandler(String msgType, AbstractMessageHandler handler) { if (!handler.hasBroker()) { throw new LoggingRuntimeException("Can't set a custom handler with a null Broker."); } customHandlers.put(msgType, handler); }
public void init(Map<String, String> params, MessageHandlerErrorCollector errorCollector) { log.debug("CreateIssueHandler.init(params: " + params + ")"); super.init(params, errorCollector); if (params.containsKey(KEY_PROJECT)) { projectKey = params.get(KEY_PROJECT); } if (params.containsKey(KEY_ISSUETYPE)) { issueType = params.get(KEY_ISSUETYPE); } if (params.containsKey(CC_ASSIGNEE)) { ccAssignee = Boolean.valueOf(params.get(CC_ASSIGNEE)); } if (params.containsKey(CC_WATCHER)) { ccWatcher = Boolean.valueOf(params.get(CC_WATCHER)); } }
/** * Adds a default message handler. This method should only be called internally; to set up your * own handlers you should call addCustomHandler(). * * @param msgType The message type, as a unique string. * @param handler The handler to call when this message type is encountered. * @param broker The Broker requesting this handler to be added. */ public void addDefaultHandler( String msgType, AbstractMessageHandler handler, SimMobilityBroker broker) { handler.setBroker(broker); defaultHandlers.put(msgType, handler); }