Source code: java/beans/beancontext/BeanContextServicesSupport.java
1 /* BeanContextServicesSupport.java --
2 Copyright (C) 2003, 2005 Free Software Foundation, Inc.
3
4 This file is part of GNU Classpath.
5
6 GNU Classpath is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
9 any later version.
10
11 GNU Classpath is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with GNU Classpath; see the file COPYING. If not, write to the
18 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19 02110-1301 USA.
20
21 Linking this library statically or dynamically with other modules is
22 making a combined work based on this library. Thus, the terms and
23 conditions of the GNU General Public License cover the whole
24 combination.
25
26 As a special exception, the copyright holders of this library give you
27 permission to link this library with independent modules to produce an
28 executable, regardless of the license terms of these independent
29 modules, and to copy and distribute the resulting executable under
30 terms of your choice, provided that you also meet, for each linked
31 independent module, the terms and conditions of the license of that
32 module. An independent module is a module which is not derived from
33 or based on this library. If you modify this library, you may extend
34 this exception to your version of the library, but you are not
35 obligated to do so. If you do not wish to do so, delete this
36 exception statement from your version. */
37
38
39 package java.beans.beancontext;
40
41 import java.io.IOException;
42 import java.io.ObjectInputStream;
43 import java.io.ObjectOutputStream;
44 import java.io.Serializable;
45 import java.util.ArrayList;
46 import java.util.HashMap;
47 import java.util.Iterator;
48 import java.util.Locale;
49 import java.util.TooManyListenersException;
50
51 /**
52 * @author Michael Koch
53 * @since 1.2
54 */
55 public class BeanContextServicesSupport
56 extends BeanContextSupport
57 implements BeanContextServices
58 {
59 private static final long serialVersionUID = -8494482757288719206L;
60
61 protected class BCSSChild
62 extends BeanContextSupport.BCSChild
63 {
64 private static final long serialVersionUID = -6848044915271367103L;
65 }
66
67 protected class BCSSProxyServiceProvider
68 implements BeanContextServiceProvider,
69 BeanContextServiceRevokedListener
70 {
71 private static final long serialVersionUID = 7078212910685744490L;
72
73 public Iterator getCurrentServiceSelectors (BeanContextServices bcs,
74 Class serviceClass)
75 {
76 throw new Error ("Not implemented");
77 }
78
79 public Object getService (BeanContextServices bcs,
80 Object requestor,
81 Class serviceClass,
82 Object serviceSelector)
83 {
84 throw new Error ("Not implemented");
85 }
86
87 public void releaseService (BeanContextServices bcs,
88 Object requestor,
89 Object service)
90 {
91 throw new Error ("Not implemented");
92 }
93
94 public void serviceRevoked (BeanContextServiceRevokedEvent bcsre)
95 {
96 throw new Error ("Not implemented");
97 }
98 }
99
100 protected static class BCSSServiceProvider
101 implements Serializable
102 {
103 private static final long serialVersionUID = 861278251667444782L;
104
105 protected BeanContextServiceProvider serviceProvider;
106
107 protected BeanContextServiceProvider getServiceProvider()
108 {
109 return serviceProvider;
110 }
111 }
112
113 protected transient ArrayList bcsListeners;
114
115 protected transient BCSSProxyServiceProvider proxy;
116
117 protected transient int serializable;
118
119 protected transient HashMap services;
120
121 public BeanContextServicesSupport ()
122 {
123 super();
124 }
125
126 public BeanContextServicesSupport (BeanContextServices peer)
127 {
128 super(peer);
129 }
130
131 public BeanContextServicesSupport(BeanContextServices peer, Locale locale)
132 {
133 super(peer, locale);
134 }
135
136 public BeanContextServicesSupport(BeanContextServices peer, Locale locale,
137 boolean dtime)
138 {
139 super(peer, locale, dtime);
140 }
141
142 public BeanContextServicesSupport(BeanContextServices peer, Locale locale,
143 boolean dtime, boolean visible)
144 {
145 super(peer, locale, dtime, visible);
146 }
147
148 public void addBeanContextServicesListener
149 (BeanContextServicesListener listener)
150 {
151 if (! bcsListeners.contains(listener))
152 bcsListeners.add(listener);
153 }
154
155 public boolean addService (Class serviceClass, BeanContextServiceProvider bcsp)
156 {
157 throw new Error ("Not implemented");
158 }
159
160 protected boolean addService (Class serviceClass,
161 BeanContextServiceProvider bcsp,
162 boolean fireEvent)
163 {
164 throw new Error ("Not implemented");
165 }
166
167 protected void bcsPreDeserializationHook (ObjectInputStream ois)
168 throws ClassNotFoundException, IOException
169 {
170 throw new Error ("Not implemented");
171 }
172
173 protected void bcsPreSerializationHook (ObjectOutputStream oos)
174 throws IOException
175 {
176 throw new Error ("Not implemented");
177 }
178
179 protected void childJustRemovedHook (Object child,
180 BeanContextSupport.BCSChild bcsc)
181 {
182 throw new Error ("Not implemented");
183 }
184
185 protected BeanContextSupport.BCSChild createBCSChild (Object targetChild,
186 Object peer)
187 {
188 throw new Error ("Not implemented");
189 }
190
191 protected BeanContextServicesSupport.BCSSServiceProvider
192 createBCSSServiceProvider (Class sc, BeanContextServiceProvider bcsp)
193 {
194 throw new Error ("Not implemented");
195 }
196
197 protected final void fireServiceAdded (BeanContextServiceAvailableEvent bcssae)
198 {
199 throw new Error ("Not implemented");
200 }
201
202 protected final void fireServiceAdded (Class serviceClass)
203 {
204 throw new Error ("Not implemented");
205 }
206
207 protected final void fireServiceRevoked(BeanContextServiceRevokedEvent event)
208 {
209 throw new Error ("Not implemented");
210 }
211
212 protected final void fireServiceRevoked (Class serviceClass,
213 boolean revokeNow)
214 {
215 throw new Error ("Not implemented");
216 }
217
218 public BeanContextServices getBeanContextServicesPeer ()
219 {
220 throw new Error ("Not implemented");
221 }
222
223 protected static final BeanContextServicesListener
224 getChildBeanContextServicesListener (Object child)
225 {
226 throw new Error ("Not implemented");
227 }
228
229 public Iterator getCurrentServiceClasses ()
230 {
231 throw new Error ("Not implemented");
232 }
233
234 public Iterator getCurrentServiceSelectors (Class serviceClass)
235 {
236 throw new Error ("Not implemented");
237 }
238
239 public Object getService (BeanContextChild child, Object requestor,
240 Class serviceClass, Object serviceSelector,
241 BeanContextServiceRevokedListener bcsrl)
242 throws TooManyListenersException
243 {
244 throw new Error ("Not implemented");
245 }
246
247 public boolean hasService (Class serviceClass)
248 {
249 throw new Error ("Not implemented");
250 }
251
252 public void initialize ()
253 {
254 super.initialize();
255
256 bcsListeners = new ArrayList();
257 services = new HashMap();
258 }
259
260 protected void initializeBeanContextResources ()
261 {
262 throw new Error ("Not implemented");
263 }
264
265 protected void releaseBeanContextResources ()
266 {
267 throw new Error ("Not implemented");
268 }
269
270 public void releaseService (BeanContextChild child, Object requestor,
271 Object service)
272 {
273 throw new Error ("Not implemented");
274 }
275
276 public void removeBeanContextServicesListener
277 (BeanContextServicesListener listener)
278 {
279 int index = bcsListeners.indexOf(listener);
280
281 if (index > -1)
282 bcsListeners.remove(index);
283 }
284
285 public void revokeService (Class serviceClass, BeanContextServiceProvider bcsp,
286 boolean revokeCurrentServicesNow)
287 {
288 throw new Error ("Not implemented");
289 }
290
291 public void serviceAvailable (BeanContextServiceAvailableEvent bcssae)
292 {
293 throw new Error ("Not implemented");
294 }
295
296 public void serviceRevoked (BeanContextServiceRevokedEvent bcssre)
297 {
298 throw new Error ("Not implemented");
299 }
300 }