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