comparison org.eclipse.osgi/osgi/src/org/osgi/util/tracker/ServiceTrackerCustomizer.d @ 86:12b890a6392a

Work on databinding
author Frank Benoit <benoit@tionex.de>
date Sat, 18 Apr 2009 13:58:35 +0200
parents
children bbe49769ec18
comparison
equal deleted inserted replaced
85:6be48cf9f95c 86:12b890a6392a
1 /*
2 * $Header: /cvshome/build/org.osgi.util.tracker/src/org/osgi/util/tracker/ServiceTrackerCustomizer.java,v 1.13 2007/02/19 19:04:33 hargrave Exp $
3 *
4 * Copyright (c) OSGi Alliance (2000, 2007). All Rights Reserved.
5 *
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 */
18
19 module org.osgi.util.tracker.ServiceTrackerCustomizer;
20
21 import java.lang.all;
22 import org.osgi.framework.ServiceReference;
23
24 /**
25 * The <code>ServiceTrackerCustomizer</code> interface allows a
26 * <code>ServiceTracker</code> object to customize the service objects that
27 * are tracked. The <code>ServiceTrackerCustomizer</code> object is called
28 * when a service is being added to the <code>ServiceTracker</code> object.
29 * The <code>ServiceTrackerCustomizer</code> can then return an object for the
30 * tracked service. The <code>ServiceTrackerCustomizer</code> object is also
31 * called when a tracked service is modified or has been removed from the
32 * <code>ServiceTracker</code> object.
33 *
34 * <p>
35 * The methods in this interface may be called as the result of a
36 * <code>ServiceEvent</code> being received by a <code>ServiceTracker</code>
37 * object. Since <code>ServiceEvent</code> s are synchronously delivered by
38 * the Framework, it is highly recommended that implementations of these methods
39 * do not register (<code>BundleContext.registerService</code>), modify (
40 * <code>ServiceRegistration.setProperties</code>) or unregister (
41 * <code>ServiceRegistration.unregister</code>) a service while being
42 * synchronized on any object.
43 *
44 * <p>
45 * The <code>ServiceTracker</code> class is thread-safe. It does not call a
46 * <code>ServiceTrackerCustomizer</code> object while holding any locks.
47 * <code>ServiceTrackerCustomizer</code> implementations must also be
48 * thread-safe.
49 *
50 * @ThreadSafe
51 * @version $Revision: 1.13 $
52 */
53 public interface ServiceTrackerCustomizer {
54 /**
55 * A service is being added to the <code>ServiceTracker</code> object.
56 *
57 * <p>
58 * This method is called before a service which matched the search
59 * parameters of the <code>ServiceTracker</code> object is added to it.
60 * This method should return the service object to be tracked for this
61 * <code>ServiceReference</code> object. The returned service object is
62 * stored in the <code>ServiceTracker</code> object and is available from
63 * the <code>getService</code> and <code>getServices</code> methods.
64 *
65 * @param reference Reference to service being added to the
66 * <code>ServiceTracker</code> object.
67 * @return The service object to be tracked for the
68 * <code>ServiceReference</code> object or <code>null</code> if
69 * the <code>ServiceReference</code> object should not be tracked.
70 */
71 public Object addingService(ServiceReference reference);
72
73 /**
74 * A service tracked by the <code>ServiceTracker</code> object has been
75 * modified.
76 *
77 * <p>
78 * This method is called when a service being tracked by the
79 * <code>ServiceTracker</code> object has had it properties modified.
80 *
81 * @param reference Reference to service that has been modified.
82 * @param service The service object for the modified service.
83 */
84 public void modifiedService(ServiceReference reference, Object service);
85
86 /**
87 * A service tracked by the <code>ServiceTracker</code> object has been
88 * removed.
89 *
90 * <p>
91 * This method is called after a service is no longer being tracked by the
92 * <code>ServiceTracker</code> object.
93 *
94 * @param reference Reference to service that has been removed.
95 * @param service The service object for the removed service.
96 */
97 public void removedService(ServiceReference reference, Object service);
98 }