blob: ec0856029dfdac804ce6c7e819a3b335c3861841 [file] [log] [blame]
Richard S. Hallc88fca32006-10-18 22:01:22 +00001/*
Richard S. Hallf28d6762009-06-08 19:31:06 +00002 * Copyright (c) OSGi Alliance (2000, 2008). All Rights Reserved.
Richard S. Hallc88fca32006-10-18 22:01:22 +00003 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package org.osgi.framework;
18
19import java.util.EventListener;
20
21/**
Richard S. Hall53e70d32008-08-01 19:31:32 +000022 * A <code>ServiceEvent</code> listener. <code>ServiceListener</code> is a
23 * listener interface that may be implemented by a bundle developer. When a
24 * <code>ServiceEvent</code> is fired, it is synchronously delivered to a
25 * <code>ServiceListener</code>. The Framework may deliver
26 * <code>ServiceEvent</code> objects to a <code>ServiceListener</code> out
27 * of order and may concurrently call and/or reenter a
28 * <code>ServiceListener</code>.
Richard S. Hallc88fca32006-10-18 22:01:22 +000029 *
30 * <p>
Richard S. Hallc88fca32006-10-18 22:01:22 +000031 * A <code>ServiceListener</code> object is registered with the Framework
32 * using the <code>BundleContext.addServiceListener</code> method.
33 * <code>ServiceListener</code> objects are called with a
34 * <code>ServiceEvent</code> object when a service is registered, modified, or
35 * is in the process of unregistering.
36 *
37 * <p>
38 * <code>ServiceEvent</code> object delivery to <code>ServiceListener</code>
39 * objects is filtered by the filter specified when the listener was registered.
40 * If the Java Runtime Environment supports permissions, then additional
41 * filtering is done. <code>ServiceEvent</code> objects are only delivered to
42 * the listener if the bundle which defines the listener object's class has the
43 * appropriate <code>ServicePermission</code> to get the service using at
Richard S. Hall53e70d32008-08-01 19:31:32 +000044 * least one of the named classes under which the service was registered.
Richard S. Hallc88fca32006-10-18 22:01:22 +000045 *
46 * <p>
47 * <code>ServiceEvent</code> object delivery to <code>ServiceListener</code>
48 * objects is further filtered according to package sources as defined in
49 * {@link ServiceReference#isAssignableTo(Bundle, String)}.
50 *
Richard S. Hallc88fca32006-10-18 22:01:22 +000051 * @see ServiceEvent
52 * @see ServicePermission
Richard S. Hall53e70d32008-08-01 19:31:32 +000053 * @ThreadSafe
Richard S. Hallf28d6762009-06-08 19:31:06 +000054 * @version $Revision: 5673 $
Richard S. Hallc88fca32006-10-18 22:01:22 +000055 */
56
57public interface ServiceListener extends EventListener {
58 /**
59 * Receives notification that a service has had a lifecycle change.
60 *
61 * @param event The <code>ServiceEvent</code> object.
62 */
63 public void serviceChanged(ServiceEvent event);
64}