Source for java.beans.beancontext.BeanContextSupport

   1: /* BeanContextSupport.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.beans.PropertyChangeEvent;
  42: import java.beans.PropertyChangeListener;
  43: import java.beans.PropertyVetoException;
  44: import java.beans.VetoableChangeListener;
  45: import java.beans.Visibility;
  46: import java.io.IOException;
  47: import java.io.InputStream;
  48: import java.io.ObjectInputStream;
  49: import java.io.ObjectOutputStream;
  50: import java.io.Serializable;
  51: import java.net.URL;
  52: import java.util.ArrayList;
  53: import java.util.Collection;
  54: import java.util.HashMap;
  55: import java.util.Iterator;
  56: import java.util.Locale;
  57: 
  58: /**
  59:  * @author Michael Koch
  60:  * @since 1.2
  61:  */
  62: public class BeanContextSupport extends BeanContextChildSupport
  63:   implements BeanContext, Serializable, PropertyChangeListener,
  64:   VetoableChangeListener
  65: {
  66:   private static final long serialVersionUID = -4879613978649577204L;
  67:   
  68:   private void readObject (ObjectInputStream s)
  69:     throws ClassNotFoundException, IOException
  70:   {
  71:     throw new Error ("Not implemented");
  72:   }
  73: 
  74:   private void writeObject (ObjectOutputStream s)
  75:     throws ClassNotFoundException, IOException
  76:   {
  77:     throw new Error ("Not implemented");
  78:   }
  79: 
  80:   protected class BCSChild implements Serializable
  81:   {
  82:     private static final long serialVersionUID = -5815286101609939109L;
  83:   }
  84: 
  85:   protected static final class BCSIterator implements Iterator
  86:   {
  87:     public boolean hasNext ()
  88:     {
  89:       throw new Error ("Not implemented");
  90:     }
  91: 
  92:     public Object next ()
  93:     {
  94:       throw new Error ("Not implemented");
  95:     }
  96: 
  97:     public void remove ()
  98:     {
  99:       // This must be a noop remove operation.
 100:     }
 101:   }
 102: 
 103:   protected transient ArrayList bcmListeners;
 104: 
 105:   protected transient HashMap children;
 106: 
 107:   protected transient boolean designTime;
 108: 
 109:   protected transient Locale locale;
 110: 
 111:   protected transient boolean okToUseGui;
 112: 
 113:   /**
 114:    * Construct a BeanContextSupport instance.
 115:    */
 116:   public BeanContextSupport ()
 117:   {
 118:     this (null, null, true, true);
 119:   }
 120: 
 121:   /**
 122:    * Construct a BeanContextSupport instance.
 123:    */
 124:   public BeanContextSupport (BeanContext peer)
 125:   {
 126:     this (peer, null, true, true);
 127:   }
 128: 
 129:   /**
 130:    * Construct a BeanContextSupport instance.
 131:    */
 132:   public BeanContextSupport (BeanContext peer, Locale lcle)
 133:   {
 134:     this (peer, lcle, true, true);
 135:   }
 136: 
 137:   /**
 138:    * Construct a BeanContextSupport instance.
 139:    */
 140:   public BeanContextSupport (BeanContext peer, Locale lcle, boolean dtime)
 141:   {
 142:     this (peer, lcle, dtime, true);
 143:   }
 144: 
 145:   /**
 146:    * Construct a BeanContextSupport instance.
 147:    */
 148:   public BeanContextSupport (BeanContext peer, Locale lcle, boolean dtime,
 149:                              boolean visible)
 150:   {
 151:     locale = lcle;
 152:     designTime = dtime;
 153:     okToUseGui = visible;
 154: 
 155:     initialize ();
 156:   }
 157: 
 158:   public boolean add (Object targetChild)
 159:   {
 160:     if (targetChild == null)
 161:       throw new IllegalArgumentException();
 162: 
 163:     if (children.containsKey(targetChild))
 164:       return false;
 165: 
 166:     // FIXME: The second argument is surely wrong.
 167:     children.put(targetChild, targetChild);
 168:     return true;
 169:   }
 170: 
 171:   public boolean addAll (Collection c)
 172:   {
 173:     throw new UnsupportedOperationException();
 174:   }
 175: 
 176:   public void addBeanContextMembershipListener
 177:     (BeanContextMembershipListener listener)
 178:   {
 179:     if (! bcmListeners.contains(listener))
 180:       bcmListeners.add(listener);
 181:   }
 182: 
 183:   public boolean avoidingGui ()
 184:   {
 185:     throw new Error ("Not implemented");
 186:   }
 187: 
 188:   protected Iterator bcsChildren ()
 189:   {
 190:     throw new Error ("Not implemented");
 191:   }
 192: 
 193:   protected void bcsPreDeserializationHook (ObjectInputStream ois)
 194:     throws ClassNotFoundException, IOException 
 195:   {
 196:     throw new Error ("Not implemented");
 197:   }
 198: 
 199:   protected void bcsPreSerializationHook (ObjectOutputStream oos)
 200:     throws IOException
 201:   {
 202:     throw new Error ("Not implemented");
 203:   }
 204: 
 205:   protected void childDeserializedHook (Object child, BeanContextSupport.BCSChild bcsc)
 206:   {
 207:     throw new Error ("Not implemented");
 208:   }
 209: 
 210:   protected void childJustAddedHook (Object child, BeanContextSupport.BCSChild bcsc)
 211:   {
 212:     throw new Error ("Not implemented");
 213:   }
 214: 
 215:   protected void childJustRemovedHook (Object child, BeanContextSupport.BCSChild bcsc)
 216:   {
 217:     throw new Error ("Not implemented");
 218:   }
 219: 
 220:   protected static final boolean classEquals (Class first, Class second)
 221:   {
 222:     throw new Error ("Not implemented");
 223:   }
 224: 
 225:   public void clear ()
 226:   {
 227:     throw new UnsupportedOperationException();
 228:   }
 229: 
 230:   public boolean contains (Object o)
 231:   {
 232:     throw new Error ("Not implemented");
 233:   }
 234: 
 235:   public boolean containsAll (Collection c)
 236:   {
 237:     throw new Error ("Not implemented");
 238:   }
 239: 
 240:   public boolean containsKey (Object o)
 241:   {
 242:     throw new Error ("Not implemented");
 243:   }
 244: 
 245:   protected final Object[] copyChildren ()
 246:   {
 247:     throw new Error ("Not implemented");
 248:   }
 249: 
 250:   protected BeanContextSupport.BCSChild createBCSChild (Object targetChild, Object peer)
 251:   {
 252:     throw new Error ("Not implemented");
 253:   }
 254: 
 255:   protected final void deserialize (ObjectInputStream ois, Collection coll)
 256:     throws ClassNotFoundException, IOException
 257:   {
 258:     throw new Error ("Not implemented");
 259:   }
 260: 
 261:   public void dontUseGui ()
 262:   {
 263:     throw new Error ("Not implemented");
 264:   }
 265: 
 266:   protected final void fireChildrenAdded (BeanContextMembershipEvent bcme)
 267:   {
 268:     throw new Error ("Not implemented");
 269:   }
 270: 
 271:   protected final void fireChildrenRemoved (BeanContextMembershipEvent bcme)
 272:   {
 273:     throw new Error ("Not implemented");
 274:   }
 275: 
 276:   public BeanContext getBeanContextPeer ()
 277:   {
 278:     throw new Error ("Not implemented");
 279:   }
 280: 
 281:   protected static final BeanContextChild getChildBeanContextChild (Object child)
 282:   {
 283:     throw new Error ("Not implemented");
 284:   }
 285: 
 286:   protected static final BeanContextMembershipListener getChildBeanContextMembershipListener (Object child)
 287:   {
 288:     throw new Error ("Not implemented");
 289:   }
 290: 
 291:   protected static final PropertyChangeListener getChildPropertyChangeListener (Object child)
 292:   {
 293:     throw new Error ("Not implemented");
 294:   }
 295: 
 296:   protected static final Serializable getChildSerializable (Object child)
 297:   {
 298:     throw new Error ("Not implemented");
 299:   }
 300: 
 301:   protected static final VetoableChangeListener getChildVetoableChangeListener (Object child)
 302:   {
 303:     throw new Error ("Not implemented");
 304:   }
 305: 
 306:   protected static final Visibility getChildVisibility (Object child)
 307:   {
 308:     throw new Error ("Not implemented");
 309:   }
 310: 
 311:   public Locale getLocale ()
 312:   {
 313:     return locale;
 314:   }
 315: 
 316:   public URL getResource (String name, BeanContextChild bcc)
 317:   {
 318:     throw new Error ("Not implemented");
 319:   }
 320: 
 321:   public InputStream getResourceAsStream (String name, BeanContextChild bcc)
 322:   {
 323:     throw new Error ("Not implemented");
 324:   }
 325: 
 326:   protected void initialize ()
 327:   {
 328:     bcmListeners = new ArrayList();
 329:     children = new HashMap();
 330:   }
 331: 
 332:   public Object instantiateChild (String beanName)
 333:     throws IOException, ClassNotFoundException
 334:   {
 335:     throw new Error ("Not implemented");
 336:   }
 337: 
 338:   public boolean isDesignTime ()
 339:   {
 340:     throw new Error ("Not implemented");
 341:   }
 342: 
 343:   public boolean isEmpty ()
 344:   {
 345:     throw new Error ("Not implemented");
 346:   }
 347: 
 348:   public boolean isSerializing ()
 349:   {
 350:     throw new Error ("Not implemented");
 351:   }
 352: 
 353:   public Iterator iterator ()
 354:   {
 355:     return children.keySet().iterator();
 356:   }
 357: 
 358:   public boolean needsGui ()
 359:   {
 360:     throw new Error ("Not implemented");
 361:   }
 362: 
 363:   public void okToUseGui ()
 364:   {
 365:     throw new Error ("Not implemented");
 366:   }
 367: 
 368:   public void propertyChange (PropertyChangeEvent pce)
 369:   {
 370:     throw new Error ("Not implemented");
 371:   }
 372: 
 373:   public final void readChildren (ObjectInputStream ois)
 374:     throws IOException, ClassNotFoundException
 375:   {
 376:     throw new Error ("Not implemented");
 377:   }
 378: 
 379:   public boolean remove (Object targetChild)
 380:   {
 381:     return remove(targetChild, true);
 382:   }
 383: 
 384:   protected boolean remove (Object targetChild, boolean callChildSetBC)
 385:   {
 386:     if (targetChild == null)
 387:       throw new IllegalArgumentException();
 388:     
 389:     throw new Error ("Not implemented");
 390:   }
 391: 
 392:   public boolean removeAll (Collection c)
 393:   {
 394:     throw new UnsupportedOperationException();
 395:   }
 396: 
 397:   public void removeBeanContextMembershipListener (BeanContextMembershipListener bcml)
 398:   {
 399:     throw new Error ("Not implemented");
 400:   }
 401: 
 402:   public boolean retainAll (Collection c)
 403:   {
 404:     throw new UnsupportedOperationException();
 405:   }
 406: 
 407:   protected final void serialize (ObjectOutputStream oos, Collection coll)
 408:     throws IOException
 409:   {
 410:     throw new Error ("Not implemented");
 411:   }
 412: 
 413:   public void setDesignTime (boolean dtime)
 414:   {
 415:     throw new Error ("Not implemented");
 416:   }
 417: 
 418:   public void setLocale (Locale newLocale)
 419:     throws PropertyVetoException
 420:   {
 421:     throw new Error ("Not implemented");
 422:   }
 423: 
 424:   public int size ()
 425:   {
 426:     throw new Error ("Not implemented");
 427:   }
 428: 
 429:   public Object[] toArray ()
 430:   {
 431:     return children.keySet().toArray();
 432:   }
 433: 
 434:   public Object[] toArray(Object[] array)
 435:   {
 436:     return children.keySet().toArray(array);
 437:   }
 438: 
 439:   protected boolean validatePendingAdd (Object targetChild)
 440:   {
 441:     throw new Error ("Not implemented");
 442:   }
 443: 
 444:   protected boolean validatePendingRemove (Object targetChild)
 445:   {
 446:     throw new Error ("Not implemented");
 447:   }
 448: 
 449:   public void vetoableChange (PropertyChangeEvent pce)
 450:     throws PropertyVetoException
 451:   {
 452:     throw new Error ("Not implemented");
 453:   }
 454: 
 455:   public final void writeChildren (ObjectOutputStream oos)
 456:     throws IOException
 457:   {
 458:     throw new Error ("Not implemented");
 459:   }
 460: }