Mercurial > projects > dwt2
comparison org.eclipse.osgi/osgi/src/org/osgi/framework/ServiceReference.d @ 105:bbe49769ec18
...
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Sun, 08 Nov 2009 12:42:30 +0100 |
parents | 12b890a6392a |
children |
comparison
equal
deleted
inserted
replaced
104:88652073d1c2 | 105:bbe49769ec18 |
---|---|
1 /* | 1 /* |
2 * $Header: /cvshome/build/org.osgi.framework/src/org/osgi/framework/ServiceReference.java,v 1.20 2007/02/21 16:49:05 hargrave Exp $ | 2 * $Header: /cvshome/build/org.osgi.framework/src/org/osgi/framework/ServiceReference.java,v 1.20 2007/02/21 16:49:05 hargrave Exp $ |
3 * | 3 * |
4 * Copyright (c) OSGi Alliance (2000, 2007). All Rights Reserved. | 4 * Copyright (c) OSGi Alliance (2000, 2007). All Rights Reserved. |
5 * | 5 * |
6 * Licensed under the Apache License, Version 2.0 (the "License"); | 6 * Licensed under the Apache License, Version 2.0 (the "License"); |
7 * you may not use this file except in compliance with 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 | 8 * You may obtain a copy of the License at |
9 * | 9 * |
10 * http://www.apache.org/licenses/LICENSE-2.0 | 10 * http://www.apache.org/licenses/LICENSE-2.0 |
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
15 * See the License for the specific language governing permissions and | 15 * See the License for the specific language governing permissions and |
16 * limitations under the License. | 16 * limitations under the License. |
17 */ | 17 */ |
18 | 18 |
19 // Port to the D programming language: | |
20 // Frank Benoit <benoit@tionex.de> | |
19 module org.osgi.framework.ServiceReference; | 21 module org.osgi.framework.ServiceReference; |
20 import org.osgi.framework.Bundle; | |
21 | 22 |
22 import java.lang.all; | 23 import java.lang.all; |
23 | 24 |
25 import org.osgi.framework.Bundle; // packageimport | |
26 | |
24 /** | 27 /** |
25 * A reference to a service. | 28 * A reference to a service. |
26 * | 29 * |
27 * <p> | 30 * <p> |
28 * The Framework returns <code>ServiceReference</code> objects from the | 31 * The Framework returns <code>ServiceReference</code> objects from the |
29 * <code>BundleContext.getServiceReference</code> and | 32 * <code>BundleContext.getServiceReference</code> and |
30 * <code>BundleContext.getServiceReferences</code> methods. | 33 * <code>BundleContext.getServiceReferences</code> methods. |
31 * <p> | 34 * <p> |
42 * method will return <code>true</code> when compared). | 45 * method will return <code>true</code> when compared). |
43 * <p> | 46 * <p> |
44 * If the same service object is registered multiple times, | 47 * If the same service object is registered multiple times, |
45 * <code>ServiceReference</code> objects associated with different | 48 * <code>ServiceReference</code> objects associated with different |
46 * <code>ServiceRegistration</code> objects are not equal. | 49 * <code>ServiceRegistration</code> objects are not equal. |
47 * | 50 * |
48 * @see BundleContext#getServiceReference | 51 * @see BundleContext#getServiceReference |
49 * @see BundleContext#getServiceReferences | 52 * @see BundleContext#getServiceReferences |
50 * @see BundleContext#getService | 53 * @see BundleContext#getService |
51 * @ThreadSafe | 54 * @ThreadSafe |
52 * @version $Revision: 1.20 $ | 55 * @version $Revision: 1.20 $ |
55 public interface ServiceReference : Comparable { | 58 public interface ServiceReference : Comparable { |
56 /** | 59 /** |
57 * Returns the property value to which the specified property key is mapped | 60 * Returns the property value to which the specified property key is mapped |
58 * in the properties <code>Dictionary</code> object of the service | 61 * in the properties <code>Dictionary</code> object of the service |
59 * referenced by this <code>ServiceReference</code> object. | 62 * referenced by this <code>ServiceReference</code> object. |
60 * | 63 * |
61 * <p> | 64 * <p> |
62 * Property keys are case-insensitive. | 65 * Property keys are case-insensitive. |
63 * | 66 * |
64 * <p> | 67 * <p> |
65 * This method must continue to return property values after the service has | 68 * This method must continue to return property values after the service has |
66 * been unregistered. This is so references to unregistered services (for | 69 * been unregistered. This is so references to unregistered services (for |
67 * example, <code>ServiceReference</code> objects stored in the log) can | 70 * example, <code>ServiceReference</code> objects stored in the log) can |
68 * still be interrogated. | 71 * still be interrogated. |
69 * | 72 * |
70 * @param key The property key. | 73 * @param key The property key. |
71 * @return The property value to which the key is mapped; <code>null</code> | 74 * @return The property value to which the key is mapped; <code>null</code> |
72 * if there is no property named after the key. | 75 * if there is no property named after the key. |
73 */ | 76 */ |
74 public Object getProperty(String key); | 77 public Object getProperty(String key); |
75 | 78 |
76 /** | 79 /** |
77 * Returns an array of the keys in the properties <code>Dictionary</code> | 80 * Returns an array of the keys in the properties <code>Dictionary</code> |
78 * object of the service referenced by this <code>ServiceReference</code> | 81 * object of the service referenced by this <code>ServiceReference</code> |
79 * object. | 82 * object. |
80 * | 83 * |
81 * <p> | 84 * <p> |
82 * This method will continue to return the keys after the service has been | 85 * This method will continue to return the keys after the service has been |
83 * unregistered. This is so references to unregistered services (for | 86 * unregistered. This is so references to unregistered services (for |
84 * example, <code>ServiceReference</code> objects stored in the log) can | 87 * example, <code>ServiceReference</code> objects stored in the log) can |
85 * still be interrogated. | 88 * still be interrogated. |
86 * | 89 * |
87 * <p> | 90 * <p> |
88 * This method is <i>case-preserving </i>; this means that every key in the | 91 * This method is <i>case-preserving </i>; this means that every key in the |
89 * returned array must have the same case as the corresponding key in the | 92 * returned array must have the same case as the corresponding key in the |
90 * properties <code>Dictionary</code> that was passed to the | 93 * properties <code>Dictionary</code> that was passed to the |
91 * {@link BundleContext#registerService(String[],Object,java.util.Dictionary)} | 94 * {@link BundleContext#registerService(String[],Object,java.util.Dictionary)} |
92 * or {@link ServiceRegistration#setProperties} methods. | 95 * or {@link ServiceRegistration#setProperties} methods. |
93 * | 96 * |
94 * @return An array of property keys. | 97 * @return An array of property keys. |
95 */ | 98 */ |
96 public String[] getPropertyKeys(); | 99 public String[] getPropertyKeys(); |
97 | 100 |
98 /** | 101 /** |
99 * Returns the bundle that registered the service referenced by this | 102 * Returns the bundle that registered the service referenced by this |
100 * <code>ServiceReference</code> object. | 103 * <code>ServiceReference</code> object. |
101 * | 104 * |
102 * <p> | 105 * <p> |
103 * This method must return <code>null</code> when the service has been | 106 * This method must return <code>null</code> when the service has been |
104 * unregistered. This can be used to determine if the service has been | 107 * unregistered. This can be used to determine if the service has been |
105 * unregistered. | 108 * unregistered. |
106 * | 109 * |
107 * @return The bundle that registered the service referenced by this | 110 * @return The bundle that registered the service referenced by this |
108 * <code>ServiceReference</code> object; <code>null</code> if | 111 * <code>ServiceReference</code> object; <code>null</code> if |
109 * that service has already been unregistered. | 112 * that service has already been unregistered. |
110 * @see BundleContext#registerService(String[],Object,java.util.Dictionary) | 113 * @see BundleContext#registerService(String[],Object,java.util.Dictionary) |
111 */ | 114 */ |
113 | 116 |
114 /** | 117 /** |
115 * Returns the bundles that are using the service referenced by this | 118 * Returns the bundles that are using the service referenced by this |
116 * <code>ServiceReference</code> object. Specifically, this method returns | 119 * <code>ServiceReference</code> object. Specifically, this method returns |
117 * the bundles whose usage count for that service is greater than zero. | 120 * the bundles whose usage count for that service is greater than zero. |
118 * | 121 * |
119 * @return An array of bundles whose usage count for the service referenced | 122 * @return An array of bundles whose usage count for the service referenced |
120 * by this <code>ServiceReference</code> object is greater than | 123 * by this <code>ServiceReference</code> object is greater than |
121 * zero; <code>null</code> if no bundles are currently using that | 124 * zero; <code>null</code> if no bundles are currently using that |
122 * service. | 125 * service. |
123 * | 126 * |
124 * @since 1.1 | 127 * @since 1.1 |
125 */ | 128 */ |
126 public Bundle[] getUsingBundles(); | 129 public Bundle[] getUsingBundles(); |
127 | 130 |
128 /** | 131 /** |
140 * <code>false</code>.</li> | 143 * <code>false</code>.</li> |
141 * <li>If the package source of the registrant bundle is equal to the | 144 * <li>If the package source of the registrant bundle is equal to the |
142 * package source of the specified bundle then return <code>true</code>; | 145 * package source of the specified bundle then return <code>true</code>; |
143 * otherwise return <code>false</code>.</li> | 146 * otherwise return <code>false</code>.</li> |
144 * </ol> | 147 * </ol> |
145 * | 148 * |
146 * @param bundle The <code>Bundle</code> object to check. | 149 * @param bundle The <code>Bundle</code> object to check. |
147 * @param className The class name to check. | 150 * @param className The class name to check. |
148 * @return <code>true</code> if the bundle which registered the service | 151 * @return <code>true</code> if the bundle which registered the service |
149 * referenced by this <code>ServiceReference</code> and the | 152 * referenced by this <code>ServiceReference</code> and the |
150 * specified bundle use the same source for the package of the | 153 * specified bundle use the same source for the package of the |
151 * specified class name. Otherwise <code>false</code> is returned. | 154 * specified class name. Otherwise <code>false</code> is returned. |
152 * | 155 * |
153 * @since 1.3 | 156 * @since 1.3 |
154 */ | 157 */ |
155 public bool isAssignableTo(Bundle bundle, String className); | 158 public bool isAssignableTo(Bundle bundle, String className); |
156 | 159 |
157 /** | 160 /** |
158 * Compares this <code>ServiceReference</code> with the specified | 161 * Compares this <code>ServiceReference</code> with the specified |
159 * <code>ServiceReference</code> for order. | 162 * <code>ServiceReference</code> for order. |
160 * | 163 * |
161 * <p> | 164 * <p> |
162 * If this <code>ServiceReference</code> and the specified | 165 * If this <code>ServiceReference</code> and the specified |
163 * <code>ServiceReference</code> have the same | 166 * <code>ServiceReference</code> have the same |
164 * {@link Constants#SERVICE_ID service id} they are equal. This | 167 * {@link Constants#SERVICE_ID service id} they are equal. This |
165 * <code>ServiceReference</code> is less than the specified | 168 * <code>ServiceReference</code> is less than the specified |
170 * {@link Constants#SERVICE_RANKING service ranking}, this | 173 * {@link Constants#SERVICE_RANKING service ranking}, this |
171 * <code>ServiceReference</code> is less than the specified | 174 * <code>ServiceReference</code> is less than the specified |
172 * <code>ServiceReference</code> if it has a higher | 175 * <code>ServiceReference</code> if it has a higher |
173 * {@link Constants#SERVICE_ID service id} and greater if it has a lower | 176 * {@link Constants#SERVICE_ID service id} and greater if it has a lower |
174 * service id. | 177 * service id. |
175 * | 178 * |
176 * @param reference The <code>ServiceReference</code> to be compared. | 179 * @param reference The <code>ServiceReference</code> to be compared. |
177 * @return Returns a negative integer, zero, or a positive integer if this | 180 * @return Returns a negative integer, zero, or a positive integer if this |
178 * <code>ServiceReference</code> is less than, equal to, or | 181 * <code>ServiceReference</code> is less than, equal to, or |
179 * greater than the specified <code>ServiceReference</code>. | 182 * greater than the specified <code>ServiceReference</code>. |
180 * @since 1.4 | 183 * @since 1.4 |