1 /******************************************************************************* 2 * Copyright (c) 2003, 2005 IBM Corporation and others. 3 * All rights reserved. This program and the accompanying materials 4 * are made available under the terms of the Eclipse Public License v1.0 5 * which accompanies this distribution, and is available at 6 * http://www.eclipse.org/legal/epl-v10.html 7 * 8 * Contributors: 9 * IBM Corporation - initial API and implementation 10 *******************************************************************************/ 11 12 package org.eclipse.osgi.framework.eventmgr; 13 14 /** 15 * The EventDispatcher interface contains the method that is called by the 16 * Event Manager to complete the event delivery to the event listener. 17 * <p> 18 * Clients may implement this interface. 19 * </p> 20 * @since 3.1 21 */ 22 public interface EventDispatcher { 23 /** 24 * This method is called once for each listener. 25 * This method must cast the event listener object to the appropriate listener 26 * class for the event type and call the appropriate listener method. 27 * 28 * <p>The method should properly log/handle any exceptions thrown by the called 29 * listener. The EventManager will ignore any Throwable thrown by this method 30 * in order to continue delivery of the event to the next listener. 31 * 32 * @param eventListener This listener must be cast to the appropriate listener 33 * class for the event to be delivered and the appropriate listener method 34 * must then be called. 35 * @param listenerObject This is the optional companion object that was 36 * specified when the listener was added to the EventListeners object. 37 * @param eventAction This value was passed to the ListenerQueue object via one of its 38 * dispatchEvent* method calls. It can provide information (such 39 * as which listener method to call) so that the EventDispatcher 40 * can complete the delivery of the event to the listener. 41 * @param eventObject This object was passed to the ListenerQueue object via one of its 42 * dispatchEvent* method calls. This object was created by the event source and 43 * is passed to this method. It should contain all the necessary information (such 44 * as what event object to pass) so that this method 45 * can complete the delivery of the event to the listener. 46 * This is typically the actual event object. 47 */ 48 public void dispatchEvent(Object eventListener, Object listenerObject, int eventAction, Object eventObject); 49 } 50