Mercurial > projects > dwt2
comparison org.eclipse.osgi/osgi/src/org/osgi/framework/ServiceRegistration.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.framework/src/org/osgi/framework/ServiceRegistration.java,v 1.14 2007/02/21 16:49:05 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.framework.ServiceRegistration; | |
20 import org.osgi.framework.ServiceReference; | |
21 | |
22 import java.lang.all; | |
23 import java.util.Dictionary; | |
24 | |
25 /** | |
26 * A registered service. | |
27 * | |
28 * <p> | |
29 * The Framework returns a <code>ServiceRegistration</code> object when a | |
30 * <code>BundleContext.registerService</code> method invocation is successful. | |
31 * The <code>ServiceRegistration</code> object is for the private use of the | |
32 * registering bundle and should not be shared with other bundles. | |
33 * <p> | |
34 * The <code>ServiceRegistration</code> object may be used to update the | |
35 * properties of the service or to unregister the service. | |
36 * | |
37 * @see BundleContext#registerService(String[],Object,Dictionary) | |
38 * @ThreadSafe | |
39 * @version $Revision: 1.14 $ | |
40 */ | |
41 | |
42 public interface ServiceRegistration { | |
43 /** | |
44 * Returns a <code>ServiceReference</code> object for a service being | |
45 * registered. | |
46 * <p> | |
47 * The <code>ServiceReference</code> object may be shared with other | |
48 * bundles. | |
49 * | |
50 * @throws java.lang.IllegalStateException If this | |
51 * <code>ServiceRegistration</code> object has already been | |
52 * unregistered. | |
53 * @return <code>ServiceReference</code> object. | |
54 */ | |
55 public ServiceReference getReference(); | |
56 | |
57 /** | |
58 * Updates the properties associated with a service. | |
59 * | |
60 * <p> | |
61 * The {@link Constants#OBJECTCLASS} and {@link Constants#SERVICE_ID} keys | |
62 * cannot be modified by this method. These values are set by the Framework | |
63 * when the service is registered in the OSGi environment. | |
64 * | |
65 * <p> | |
66 * The following steps are required to modify service properties: | |
67 * <ol> | |
68 * <li>The service's properties are replaced with the provided properties. | |
69 * <li>A service event of type {@link ServiceEvent#MODIFIED} is | |
70 * fired. | |
71 * </ol> | |
72 * | |
73 * @param properties The properties for this service. See {@link Constants} | |
74 * for a list of standard service property keys. Changes should not | |
75 * be made to this object after calling this method. To update the | |
76 * service's properties this method should be called again. | |
77 * | |
78 * @throws IllegalStateException If this <code>ServiceRegistration</code> | |
79 * object has already been unregistered. | |
80 * @throws IllegalArgumentException If <code>properties</code> contains | |
81 * case variants of the same key name. | |
82 */ | |
83 public void setProperties(Dictionary properties); | |
84 | |
85 /** | |
86 * Unregisters a service. Remove a <code>ServiceRegistration</code> object | |
87 * from the Framework service registry. All <code>ServiceReference</code> | |
88 * objects associated with this <code>ServiceRegistration</code> object | |
89 * can no longer be used to interact with the service. | |
90 * | |
91 * <p> | |
92 * The following steps are required to unregister a service: | |
93 * <ol> | |
94 * <li>The service is removed from the Framework service registry so that | |
95 * it can no longer be used. <code>ServiceReference</code> objects for the | |
96 * service may no longer be used to get a service object for the service. | |
97 * <li>A service event of type {@link ServiceEvent#UNREGISTERING} is | |
98 * fired so that bundles using this service can release their | |
99 * use of it. | |
100 * <li>For each bundle whose use count for this service is greater than | |
101 * zero: <br> | |
102 * The bundle's use count for this service is set to zero. <br> | |
103 * If the service was registered with a {@link ServiceFactory} object, the | |
104 * <code>ServiceFactory.ungetService</code> method is called to release | |
105 * the service object for the bundle. | |
106 * </ol> | |
107 * | |
108 * @throws java.lang.IllegalStateException If this | |
109 * <code>ServiceRegistration</code> object has already been | |
110 * unregistered. | |
111 * @see BundleContext#ungetService | |
112 * @see ServiceFactory#ungetService | |
113 */ | |
114 public void unregister(); | |
115 } |