1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.springframework.osgi.service.importer;
18
19 import java.util.Map;
20
21 /**
22 * Listener tracking binding and unbinding of OSGi services used as normal
23 * object references inside a Spring application context. Implementations can
24 * throws exceptions if they need/have to but they are not be propagated to
25 * other listeners nor do they stop the other listeners from being notified.
26 *
27 * @author Costin Leau
28 *
29 */
30 public interface OsgiServiceLifecycleListener {
31
32 /**
33 * Called when a service is being binded inside the proxy (be it single or
34 * multi value). The service properties are made available as a {@link Map}
35 * which can be safely cast to a {@link java.util.Dictionary} if needed.
36 *
37 * @param service the OSGi service instance
38 * @param properties the service properties
39 * @throws Exception custom exception that is logged but not propagated to
40 * other listeners
41 */
42 void bind(Object service, Map properties) throws Exception;
43
44 /**
45 * Called when a service is being unbinded inside the proxy (be it single or
46 * multi value). The service properties are made available as a {@link Map}
47 * which can be safely cast to a {@link java.util.Dictionary} if needed.
48 *
49 * @param service the OSGi service instance
50 * @param properties the service properties
51 * @throws Exception custom exception that is logged but not propagated to
52 * other listeners
53 */
54 void unbind(Object service, Map properties) throws Exception;
55 }