/** * Returns a request for the given event. This method will only be used if the <code>EventManager * </code> is handling event filtering. * * @param event the event * @return request that was interested in this event or <code>null</code> if none (and event * should not be sent) * @throws IllegalArgumentException for invalid event kind */ public EventRequest getEventRequest(Event event) { EventRequest interestedRequest = null; Hashtable requests; Byte kind = new Byte(event.getEventKind()); requests = (Hashtable) _requests.get(kind); if (requests == null) { // Did not get a valid event type throw new IllegalArgumentException("invalid event kind: " + kind); } boolean match = false; // Loop through the requests. Must look at ALL requests in order // to evaluate all filters (think count filter). // TODO: What if multiple matches? Spec isn't so clear on this. Iterator rIter = requests.values().iterator(); while (rIter.hasNext()) { EventRequest request = (EventRequest) rIter.next(); if (request.matches(event)) interestedRequest = request; } return interestedRequest; }