comparison org.eclipse.osgi/osgi/src/org/osgi/framework/BundleEvent.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/BundleEvent.java,v 1.19 2007/02/20 00:14:12 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.BundleEvent;
20 import org.osgi.framework.Bundle;
21
22 import java.util.EventObject;
23
24 /**
25 * An event from the Framework describing a bundle lifecycle change.
26 * <p>
27 * <code>BundleEvent</code> objects are delivered to
28 * <code>SynchronousBundleListener</code>s and <code>BundleListener</code>s
29 * when a change occurs in a bundle's lifecycle. A type code is used to identify
30 * the event type for future extendability.
31 *
32 * <p>
33 * OSGi Alliance reserves the right to extend the set of types.
34 *
35 * @Immutable
36 * @see BundleListener
37 * @see SynchronousBundleListener
38 * @version $Revision: 1.19 $
39 */
40
41 public class BundleEvent : EventObject {
42 static final long serialVersionUID = 4080640865971756012L;
43 /**
44 * Bundle that had a change occur in its lifecycle.
45 */
46 private final Bundle bundle;
47
48 /**
49 * Type of bundle lifecycle change.
50 */
51 private final int type;
52
53 /**
54 * The bundle has been installed.
55 * <p>
56 * The value of <code>INSTALLED</code> is 0x00000001.
57 *
58 * @see BundleContext#installBundle(String)
59 */
60 public final static int INSTALLED = 0x00000001;
61
62 /**
63 * The bundle has been started.
64 * <p>
65 * The bundle's
66 * {@link BundleActivator#start(BundleContext) BundleActivator start} method
67 * has been executed if the bundle has a bundle activator class.
68 * <p>
69 * The value of <code>STARTED</code> is 0x00000002.
70 *
71 * @see Bundle#start()
72 */
73 public final static int STARTED = 0x00000002;
74
75 /**
76 * The bundle has been stopped.
77 * <p>
78 * The bundle's
79 * {@link BundleActivator#stop(BundleContext) BundleActivator stop} method
80 * has been executed if the bundle has a bundle activator class.
81 * <p>
82 * The value of <code>STOPPED</code> is 0x00000004.
83 *
84 * @see Bundle#stop()
85 */
86 public final static int STOPPED = 0x00000004;
87
88 /**
89 * The bundle has been updated.
90 * <p>
91 * The value of <code>UPDATED</code> is 0x00000008.
92 *
93 * @see Bundle#update()
94 */
95 public final static int UPDATED = 0x00000008;
96
97 /**
98 * The bundle has been uninstalled.
99 * <p>
100 * The value of <code>UNINSTALLED</code> is 0x00000010.
101 *
102 * @see Bundle#uninstall
103 */
104 public final static int UNINSTALLED = 0x00000010;
105
106 /**
107 * The bundle has been resolved.
108 * <p>
109 * The value of <code>RESOLVED</code> is 0x00000020.
110 *
111 * @see Bundle#RESOLVED
112 * @since 1.3
113 */
114 public final static int RESOLVED = 0x00000020;
115
116 /**
117 * The bundle has been unresolved.
118 * <p>
119 * The value of <code>UNRESOLVED</code> is 0x00000040.
120 *
121 * @see Bundle#INSTALLED
122 * @since 1.3
123 */
124 public final static int UNRESOLVED = 0x00000040;
125
126 /**
127 * The bundle is about to be activated.
128 * <p>
129 * The bundle's
130 * {@link BundleActivator#start(BundleContext) BundleActivator start} method
131 * is about to be called if the bundle has a bundle activator class. This
132 * event is only delivered to {@link SynchronousBundleListener}s. It is not
133 * delivered to <code>BundleListener</code>s.
134 * <p>
135 * The value of <code>STARTING</code> is 0x00000080.
136 *
137 * @see Bundle#start()
138 * @since 1.3
139 */
140 public final static int STARTING = 0x00000080;
141
142 /**
143 * The bundle is about to deactivated.
144 * <p>
145 * The bundle's
146 * {@link BundleActivator#stop(BundleContext) BundleActivator stop} method
147 * is about to be called if the bundle has a bundle activator class. This
148 * event is only delivered to {@link SynchronousBundleListener}s. It is not
149 * delivered to <code>BundleListener</code>s.
150 * <p>
151 * The value of <code>STOPPING</code> is 0x00000100.
152 *
153 * @see Bundle#stop()
154 * @since 1.3
155 */
156 public final static int STOPPING = 0x00000100;
157
158 /**
159 * The bundle will be lazily activated.
160 * <p>
161 * The bundle has a {@link Constants#ACTIVATION_LAZY lazy activation policy}
162 * and is waiting to be activated. It is now in the
163 * {@link Bundle#STARTING STARTING} state and has a valid
164 * <code>BundleContext</code>. This event is only delivered to
165 * {@link SynchronousBundleListener}s. It is not delivered to
166 * <code>BundleListener</code>s.
167 * <p>
168 * The value of <code>LAZY_ACTIVATION</code> is 0x00000200.
169 *
170 * @since 1.4
171 */
172 public final static int LAZY_ACTIVATION = 0x00000200;
173
174 /**
175 * Creates a bundle event of the specified type.
176 *
177 * @param type The event type.
178 * @param bundle The bundle which had a lifecycle change.
179 */
180
181 public this(int type, Bundle bundle) {
182 super(cast(Object)bundle);
183 this.bundle = bundle;
184 this.type = type;
185 }
186
187 /**
188 * Returns the bundle which had a lifecycle change. This bundle is the
189 * source of the event.
190 *
191 * @return The bundle that had a change occur in its lifecycle.
192 */
193 public Bundle getBundle() {
194 return bundle;
195 }
196
197 /**
198 * Returns the type of lifecyle event. The type values are:
199 * <ul>
200 * <li>{@link #INSTALLED}
201 * <li>{@link #RESOLVED}
202 * <li>{@link #LAZY_ACTIVATION}
203 * <li>{@link #STARTING}
204 * <li>{@link #STARTED}
205 * <li>{@link #STOPPING}
206 * <li>{@link #STOPPED}
207 * <li>{@link #UPDATED}
208 * <li>{@link #UNRESOLVED}
209 * <li>{@link #UNINSTALLED}
210 * </ul>
211 *
212 * @return The type of lifecycle event.
213 */
214
215 public int getType() {
216 return type;
217 }
218 }