comparison org.eclipse.osgi/osgi/src/org/osgi/framework/FrameworkEvent.d @ 105:bbe49769ec18

...
author Frank Benoit <benoit@tionex.de>
date Sun, 08 Nov 2009 12:42:30 +0100
parents 0628aaa2996c
children
comparison
equal deleted inserted replaced
104:88652073d1c2 105:bbe49769ec18
1 /* 1 /*
2 * $Header: /cvshome/build/org.osgi.framework/src/org/osgi/framework/FrameworkEvent.java,v 1.15 2007/02/20 00:14:12 hargrave Exp $ 2 * $Header: /cvshome/build/org.osgi.framework/src/org/osgi/framework/FrameworkEvent.java,v 1.15 2007/02/20 00:14:12 hargrave Exp $
3 * 3 *
4 * Copyright (c) OSGi Alliance (2004, 2007). All Rights Reserved. 4 * Copyright (c) OSGi Alliance (2004, 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.FrameworkEvent; 21 module org.osgi.framework.FrameworkEvent;
20 import org.osgi.framework.Bundle;
21 22
22 import java.lang.all; 23 import java.lang.all;
24
25 import org.osgi.framework.Bundle; // packageimport
26
23 import java.util.EventObject; 27 import java.util.EventObject;
24 28
25 /** 29 /**
26 * A general event from the Framework. 30 * A general event from the Framework.
27 * 31 *
28 * <p> 32 * <p>
29 * <code>FrameworkEvent</code> objects are delivered to 33 * <code>FrameworkEvent</code> objects are delivered to
30 * <code>FrameworkListener</code>s when a general event occurs within the 34 * <code>FrameworkListener</code>s when a general event occurs within the
31 * OSGi environment. A type code is used to identify the event type for future 35 * OSGi environment. A type code is used to identify the event type for future
32 * extendability. 36 * extendability.
33 * 37 *
34 * <p> 38 * <p>
35 * OSGi Alliance reserves the right to extend the set of event types. 39 * OSGi Alliance reserves the right to extend the set of event types.
36 * 40 *
37 * @Immutable 41 * @Immutable
38 * @see FrameworkListener 42 * @see FrameworkListener
39 * @version $Revision: 1.15 $ 43 * @version $Revision: 1.15 $
40 */ 44 */
41 45
56 */ 60 */
57 private final int type; 61 private final int type;
58 62
59 /** 63 /**
60 * The Framework has started. 64 * The Framework has started.
61 * 65 *
62 * <p> 66 * <p>
63 * This event is fired when the Framework has started after all installed 67 * This event is fired when the Framework has started after all installed
64 * bundles that are marked to be started have been started and the Framework 68 * bundles that are marked to be started have been started and the Framework
65 * has reached the intitial start level. 69 * has reached the intitial start level.
66 * 70 *
67 * <p> 71 * <p>
68 * The value of <code>STARTED</code> is 0x00000001. 72 * The value of <code>STARTED</code> is 0x00000001.
69 * 73 *
70 * @see "<code>StartLevel</code>" 74 * @see "<code>StartLevel</code>"
71 */ 75 */
72 public final static int STARTED = 0x00000001; 76 public final static int STARTED = 0x00000001;
73 77
74 /** 78 /**
75 * An error has occurred. 79 * An error has occurred.
76 * 80 *
77 * <p> 81 * <p>
78 * There was an error associated with a bundle. 82 * There was an error associated with a bundle.
79 * 83 *
80 * <p> 84 * <p>
81 * The value of <code>ERROR</code> is 0x00000002. 85 * The value of <code>ERROR</code> is 0x00000002.
82 */ 86 */
83 public final static int ERROR = 0x00000002; 87 public final static int ERROR = 0x00000002;
84 88
85 /** 89 /**
86 * A PackageAdmin.refreshPackage operation has completed. 90 * A PackageAdmin.refreshPackage operation has completed.
87 * 91 *
88 * <p> 92 * <p>
89 * This event is fired when the Framework has completed the refresh packages 93 * This event is fired when the Framework has completed the refresh packages
90 * operation initiated by a call to the PackageAdmin.refreshPackages method. 94 * operation initiated by a call to the PackageAdmin.refreshPackages method.
91 * 95 *
92 * <p> 96 * <p>
93 * The value of <code>PACKAGES_REFRESHED</code> is 0x00000004. 97 * The value of <code>PACKAGES_REFRESHED</code> is 0x00000004.
94 * 98 *
95 * @since 1.2 99 * @since 1.2
96 * @see "<code>PackageAdmin.refreshPackages</code>" 100 * @see "<code>PackageAdmin.refreshPackages</code>"
97 */ 101 */
98 public final static int PACKAGES_REFRESHED = 0x00000004; 102 public final static int PACKAGES_REFRESHED = 0x00000004;
99 103
100 /** 104 /**
101 * A StartLevel.setStartLevel operation has completed. 105 * A StartLevel.setStartLevel operation has completed.
102 * 106 *
103 * <p> 107 * <p>
104 * This event is fired when the Framework has completed changing the active 108 * This event is fired when the Framework has completed changing the active
105 * start level initiated by a call to the StartLevel.setStartLevel method. 109 * start level initiated by a call to the StartLevel.setStartLevel method.
106 * 110 *
107 * <p> 111 * <p>
108 * The value of <code>STARTLEVEL_CHANGED</code> is 0x00000008. 112 * The value of <code>STARTLEVEL_CHANGED</code> is 0x00000008.
109 * 113 *
110 * @since 1.2 114 * @since 1.2
111 * @see "<code>StartLevel</code>" 115 * @see "<code>StartLevel</code>"
112 */ 116 */
113 public final static int STARTLEVEL_CHANGED = 0x00000008; 117 public final static int STARTLEVEL_CHANGED = 0x00000008;
114 118
115 /** 119 /**
116 * A warning has occurred. 120 * A warning has occurred.
117 * 121 *
118 * <p> 122 * <p>
119 * There was a warning associated with a bundle. 123 * There was a warning associated with a bundle.
120 * 124 *
121 * <p> 125 * <p>
122 * The value of <code>WARNING</code> is 0x00000010. 126 * The value of <code>WARNING</code> is 0x00000010.
123 * 127 *
124 * @since 1.3 128 * @since 1.3
125 */ 129 */
126 public final static int WARNING = 0x00000010; 130 public final static int WARNING = 0x00000010;
127 131
128 /** 132 /**
129 * An informational event has occurred. 133 * An informational event has occurred.
130 * 134 *
131 * <p> 135 * <p>
132 * There was an informational event associated with a bundle. 136 * There was an informational event associated with a bundle.
133 * 137 *
134 * <p> 138 * <p>
135 * The value of <code>INFO</code> is 0x00000020. 139 * The value of <code>INFO</code> is 0x00000020.
136 * 140 *
137 * @since 1.3 141 * @since 1.3
138 */ 142 */
139 public final static int INFO = 0x00000020; 143 public final static int INFO = 0x00000020;
140 144
141 /** 145 /**
142 * Creates a Framework event. 146 * Creates a Framework event.
143 * 147 *
144 * @param type The event type. 148 * @param type The event type.
145 * @param source The event source object. This may not be <code>null</code>. 149 * @param source The event source object. This may not be <code>null</code>.
146 * @deprecated As of 1.2. This constructor is deprecated in favor of using 150 * @deprecated As of 1.2. This constructor is deprecated in favor of using
147 * the other constructor with the System Bundle as the event 151 * the other constructor with the System Bundle as the event
148 * source. 152 * source.
154 this.throwable = null; 158 this.throwable = null;
155 } 159 }
156 160
157 /** 161 /**
158 * Creates a Framework event regarding the specified bundle. 162 * Creates a Framework event regarding the specified bundle.
159 * 163 *
160 * @param type The event type. 164 * @param type The event type.
161 * @param bundle The event source. 165 * @param bundle The event source.
162 * @param throwable The related exception. This argument may be 166 * @param throwable The related exception. This argument may be
163 * <code>null</code> if there is no related exception. 167 * <code>null</code> if there is no related exception.
164 */ 168 */
165 public this(int type, Bundle bundle, Throwable throwable) { 169 public this(int type, Bundle bundle, Throwable throwable) {
166 super(cast(Object)bundle); 170 super(bundle);
167 this.type = type; 171 this.type = type;
168 this.bundle = bundle; 172 this.bundle = bundle;
169 this.throwable = throwable; 173 this.throwable = throwable;
170 } 174 }
171 175
172 /** 176 /**
173 * Returns the exception related to this event. 177 * Returns the exception related to this event.
174 * 178 *
175 * @return The related exception or <code>null</code> if none. 179 * @return The related exception or <code>null</code> if none.
176 */ 180 */
177 public Throwable getThrowable() { 181 public Throwable getThrowable() {
178 return throwable; 182 return throwable;
179 } 183 }
180 184
181 /** 185 /**
182 * Returns the bundle associated with the event. This bundle is also the 186 * Returns the bundle associated with the event. This bundle is also the
183 * source of the event. 187 * source of the event.
184 * 188 *
185 * @return The bundle associated with the event. 189 * @return The bundle associated with the event.
186 */ 190 */
187 public Bundle getBundle() { 191 public Bundle getBundle() {
188 return bundle; 192 return bundle;
189 } 193 }
198 * <li>{@link #WARNING} 202 * <li>{@link #WARNING}
199 * <li>{@link #INFO} 203 * <li>{@link #INFO}
200 * <li>{@link #PACKAGES_REFRESHED} 204 * <li>{@link #PACKAGES_REFRESHED}
201 * <li>{@link #STARTLEVEL_CHANGED} 205 * <li>{@link #STARTLEVEL_CHANGED}
202 * </ul> 206 * </ul>
203 * 207 *
204 * @return The type of state change. 208 * @return The type of state change.
205 */ 209 */
206 210
207 public int getType() { 211 public int getType() {
208 return type; 212 return type;