Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 8468dbc769382269184c932d41e084cb2fa58eb9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/*
 * Copyright (c) OSGi Alliance (2000, 2013). All Rights Reserved.
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.osgi.framework;

import java.util.EventListener;
import org.osgi.annotation.versioning.ConsumerType;

/**
 * A {@code ServiceEvent} listener. {@code ServiceListener} is a listener
 * interface that may be implemented by a bundle developer. When a
 * {@code ServiceEvent} is fired, it is synchronously delivered to a
 * {@code ServiceListener}. The Framework may deliver {@code ServiceEvent}
 * objects to a {@code ServiceListener} out of order and may concurrently call
 * and/or reenter a {@code ServiceListener}.
 * 
 * <p>
 * A {@code ServiceListener} object is registered with the Framework using the
 * {@code BundleContext.addServiceListener} method. {@code ServiceListener}
 * objects are called with a {@code ServiceEvent} object when a service is
 * registered, modified, or is in the process of unregistering.
 * 
 * <p>
 * {@code ServiceEvent} object delivery to {@code ServiceListener} objects is
 * filtered by the filter specified when the listener was registered. If the
 * Java Runtime Environment supports permissions, then additional filtering is
 * done. {@code ServiceEvent} objects are only delivered to the listener if the
 * bundle which defines the listener object's class has the appropriate
 * {@code ServicePermission} to get the service using at least one of the named
 * classes under which the service was registered.
 * 
 * <p>
 * {@code ServiceEvent} object delivery to {@code ServiceListener} objects is
 * further filtered according to package sources as defined in
 * {@link ServiceReference#isAssignableTo(Bundle, String)}.
 * 
 * @see ServiceEvent
 * @see ServicePermission
 * @ThreadSafe
 * @author $Id$
 */
@ConsumerType
public interface ServiceListener extends EventListener {
	/**
	 * Receives notification that a service has had a lifecycle change.
	 * 
	 * @param event The {@code ServiceEvent} object.
	 */
	public void serviceChanged(ServiceEvent event);
}

Back to the top