comparison org.eclipse.osgi/osgi/src/org/osgi/framework/ServiceEvent.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/ServiceEvent.java,v 1.15 2007/02/20 00:14:12 hargrave Exp $ 2 * $Header: /cvshome/build/org.osgi.framework/src/org/osgi/framework/ServiceEvent.java,v 1.15 2007/02/20 00:14:12 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.ServiceEvent; 21 module org.osgi.framework.ServiceEvent;
20 import org.osgi.framework.ServiceReference;
21 22
22 import java.lang.util; 23 import java.lang.all;
24
25 import org.osgi.framework.ServiceReference; // packageimport
26
23 import java.util.EventObject; 27 import java.util.EventObject;
24 28
25 /** 29 /**
26 * An event from the Framework describing a service lifecycle change. 30 * An event from the Framework describing a service lifecycle change.
27 * <p> 31 * <p>
28 * <code>ServiceEvent</code> objects are delivered to 32 * <code>ServiceEvent</code> objects are delivered to
29 * <code>ServiceListener</code>s and <code>AllServiceListener</code>s when 33 * <code>ServiceListener</code>s and <code>AllServiceListener</code>s when
30 * a change occurs in this service's lifecycle. A type code is used to identify 34 * a change occurs in this service's lifecycle. A type code is used to identify
31 * the event type for future extendability. 35 * the event type for future extendability.
32 * 36 *
33 * <p> 37 * <p>
34 * OSGi Alliance reserves the right to extend the set of types. 38 * OSGi Alliance reserves the right to extend the set of types.
35 * 39 *
36 * @Immutable 40 * @Immutable
37 * @see ServiceListener 41 * @see ServiceListener
38 * @see AllServiceListener 42 * @see AllServiceListener
39 * @version $Revision: 1.15 $ 43 * @version $Revision: 1.15 $
40 */ 44 */
54 /** 58 /**
55 * This service has been registered. 59 * This service has been registered.
56 * <p> 60 * <p>
57 * This event is synchronously delivered <strong>after</strong> the service 61 * This event is synchronously delivered <strong>after</strong> the service
58 * has been registered with the Framework. 62 * has been registered with the Framework.
59 * 63 *
60 * <p> 64 * <p>
61 * The value of <code>REGISTERED</code> is 0x00000001. 65 * The value of <code>REGISTERED</code> is 0x00000001.
62 * 66 *
63 * @see BundleContext#registerService(String[],Object,java.util.Dictionary) 67 * @see BundleContext#registerService(String[],Object,java.util.Dictionary)
64 */ 68 */
65 public final static int REGISTERED = 0x00000001; 69 public final static int REGISTERED = 0x00000001;
66 70
67 /** 71 /**
68 * The properties of a registered service have been modified. 72 * The properties of a registered service have been modified.
69 * <p> 73 * <p>
70 * This event is synchronously delivered <strong>after</strong> the service 74 * This event is synchronously delivered <strong>after</strong> the service
71 * properties have been modified. 75 * properties have been modified.
72 * 76 *
73 * <p> 77 * <p>
74 * The value of <code>MODIFIED</code> is 0x00000002. 78 * The value of <code>MODIFIED</code> is 0x00000002.
75 * 79 *
76 * @see ServiceRegistration#setProperties 80 * @see ServiceRegistration#setProperties
77 */ 81 */
78 public final static int MODIFIED = 0x00000002; 82 public final static int MODIFIED = 0x00000002;
79 83
80 /** 84 /**
81 * This service is in the process of being unregistered. 85 * This service is in the process of being unregistered.
82 * <p> 86 * <p>
83 * This event is synchronously delivered <strong>before</strong> the 87 * This event is synchronously delivered <strong>before</strong> the
84 * service has completed unregistering. 88 * service has completed unregistering.
85 * 89 *
86 * <p> 90 * <p>
87 * If a bundle is using a service that is <code>UNREGISTERING</code>, the 91 * If a bundle is using a service that is <code>UNREGISTERING</code>, the
88 * bundle should release its use of the service when it receives this event. 92 * bundle should release its use of the service when it receives this event.
89 * If the bundle does not release its use of the service when it receives 93 * If the bundle does not release its use of the service when it receives
90 * this event, the Framework will automatically release the bundle's use of 94 * this event, the Framework will automatically release the bundle's use of
91 * the service while completing the service unregistration operation. 95 * the service while completing the service unregistration operation.
92 * 96 *
93 * <p> 97 * <p>
94 * The value of UNREGISTERING is 0x00000004. 98 * The value of UNREGISTERING is 0x00000004.
95 * 99 *
96 * @see ServiceRegistration#unregister 100 * @see ServiceRegistration#unregister
97 * @see BundleContext#ungetService 101 * @see BundleContext#ungetService
98 */ 102 */
99 public final static int UNREGISTERING = 0x00000004; 103 public final static int UNREGISTERING = 0x00000004;
100 104
101 /** 105 /**
102 * Creates a new service event object. 106 * Creates a new service event object.
103 * 107 *
104 * @param type The event type. 108 * @param type The event type.
105 * @param reference A <code>ServiceReference</code> object to the service 109 * @param reference A <code>ServiceReference</code> object to the service
106 * that had a lifecycle change. 110 * that had a lifecycle change.
107 */ 111 */
108 public this(int type, ServiceReference reference) { 112 public this(int type, ServiceReference reference) {
109 super(cast(Object)reference); 113 super(reference);
110 this.reference = reference; 114 this.reference = reference;
111 this.type = type; 115 this.type = type;
112 } 116 }
113 117
114 /** 118 /**
115 * Returns a reference to the service that had a change occur in its 119 * Returns a reference to the service that had a change occur in its
116 * lifecycle. 120 * lifecycle.
117 * <p> 121 * <p>
118 * This reference is the source of the event. 122 * This reference is the source of the event.
119 * 123 *
120 * @return Reference to the service that had a lifecycle change. 124 * @return Reference to the service that had a lifecycle change.
121 */ 125 */
122 public ServiceReference getServiceReference() { 126 public ServiceReference getServiceReference() {
123 return reference; 127 return reference;
124 } 128 }
128 * <ul> 132 * <ul>
129 * <li>{@link #REGISTERED} 133 * <li>{@link #REGISTERED}
130 * <li>{@link #MODIFIED} 134 * <li>{@link #MODIFIED}
131 * <li>{@link #UNREGISTERING} 135 * <li>{@link #UNREGISTERING}
132 * </ul> 136 * </ul>
133 * 137 *
134 * @return Type of service lifecycle change. 138 * @return Type of service lifecycle change.
135 */ 139 */
136 140
137 public int getType() { 141 public int getType() {
138 return type; 142 return type;