1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.springframework.osgi.service.exporter;
18
19 import java.util.Map;
20
21 /**
22 * Registration listener that needs notifications of registration and
23 * unregistration of OSGi services exported through Spring OSGi. Implementations
24 * can 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 * @see org.springframework.osgi.service.exporter.support.OsgiServiceFactoryBean
29 */
30 public interface OsgiServiceRegistrationListener {
31
32 /**
33 * Called when the the service exported has been registered in the OSGi
34 * space. The service properties are made available as a {@link Map} which
35 * can be safely cast to a {@link java.util.Dictionary} if needed.
36 *
37 * @param service object registered as an OSGi service
38 * @param serviceProperties OSGi service registration properties
39 * @throws Exception custom exception that is logged but not propagated to
40 * other listeners
41 */
42 void registered(Object service, Map serviceProperties) throws Exception;
43
44 /**
45 * Called when the OSGi service has been unregistered (removed from OSGi
46 * space). The service properties are made available as a {@link Map} which
47 * can be safely cast to a {@link java.util.Dictionary} if needed.
48 *
49 * @param service object unregistered as a service from the OSGi space
50 * @param serviceProperties OSGi service registration properties
51 * @throws Exception custom exception that is logged but not propagated to
52 * other listeners
53 */
54 void unregistered(Object service, Map serviceProperties) throws Exception;
55
56 }