001 /*
002 * Copyright (c) OSGi Alliance (2005, 2008). All Rights Reserved.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 * http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016
017 package org.osgi.service.event;
018
019 /**
020 * The Event Admin service. Bundles wishing to publish events must obtain the
021 * Event Admin service and call one of the event delivery methods.
022 *
023 * @ThreadSafe
024 * @version $Revision: 5673 $
025 */
026 public interface EventAdmin {
027 /**
028 * Initiate asynchronous delivery of an event. This method returns to the
029 * caller before delivery of the event is completed.
030 *
031 * @param event The event to send to all listeners which subscribe to the
032 * topic of the event.
033 *
034 * @throws SecurityException If the caller does not have
035 * <code>TopicPermission[topic,PUBLISH]</code> for the topic
036 * specified in the event.
037 */
038 void postEvent(Event event);
039
040 /**
041 * Initiate synchronous delivery of an event. This method does not return to
042 * the caller until delivery of the event is completed.
043 *
044 * @param event The event to send to all listeners which subscribe to the
045 * topic of the event.
046 *
047 * @throws SecurityException If the caller does not have
048 * <code>TopicPermission[topic,PUBLISH]</code> for the topic
049 * specified in the event.
050 */
051 void sendEvent(Event event);
052 }