Index: java/beans/beancontext/BeanContextServicesSupport.java =================================================================== RCS file: /cvsroot/classpath/classpath/java/beans/beancontext/BeanContextServicesSupport.java,v retrieving revision 1.4 diff -u -r1.4 BeanContextServicesSupport.java --- java/beans/beancontext/BeanContextServicesSupport.java 26 Dec 2003 19:39:54 -0000 1.4 +++ java/beans/beancontext/BeanContextServicesSupport.java 30 Mar 2005 12:45:51 -0000 @@ -1,5 +1,5 @@ -/* java.beans.beancontext.BeanContextServicesSupport - Copyright (C) 2003 Free Software Foundation, Inc. +/* BeanContextServicesSupport.java -- + Copyright (C) 2003, 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -7,7 +7,7 @@ it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. - + GNU Classpath is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU @@ -120,34 +120,36 @@ public BeanContextServicesSupport () { - this (null, null, true, true); + super(); } public BeanContextServicesSupport (BeanContextServices peer) { - this (peer, null, true, true); + super(peer); } - public BeanContextServicesSupport (BeanContextServices peer, Locale lcle) + public BeanContextServicesSupport(BeanContextServices peer, Locale locale) { - this (peer, lcle, true, true); + super(peer, locale); } - public BeanContextServicesSupport (BeanContextServices peer, Locale lcle, - boolean dtime) + public BeanContextServicesSupport(BeanContextServices peer, Locale locale, + boolean dtime) { - this (peer, lcle, dtime, true); + super(peer, locale, dtime); } - public BeanContextServicesSupport (BeanContextServices peer, Locale lcle, - boolean dtime, boolean visible) + public BeanContextServicesSupport(BeanContextServices peer, Locale locale, + boolean dtime, boolean visible) { - throw new Error ("Not implemented"); + super(peer, locale, dtime, visible); } - public void addBeanContextServicesListener (BeanContextServicesListener bcsl) + public void addBeanContextServicesListener + (BeanContextServicesListener listener) { - throw new Error ("Not implemented"); + if (! bcsListeners.contains(listener)) + bcsListeners.add(listener); } public boolean addService (Class serviceClass, BeanContextServiceProvider bcsp) @@ -202,8 +204,7 @@ throw new Error ("Not implemented"); } - protected final void - fireServiceRevoked (BeanContextServiceRevokedEvent bcsre) + protected final void fireServiceRevoked(BeanContextServiceRevokedEvent event) { throw new Error ("Not implemented"); } @@ -250,7 +251,10 @@ public void initialize () { - throw new Error ("Not implemented"); + super.initialize(); + + bcsListeners = new ArrayList(); + services = new HashMap(); } protected void initializeBeanContextResources () @@ -269,10 +273,13 @@ throw new Error ("Not implemented"); } - public void - removeBeanContextServicesListener (BeanContextServicesListener bcsl) + public void removeBeanContextServicesListener + (BeanContextServicesListener listener) { - throw new Error ("Not implemented"); + int index = bcsListeners.indexOf(listener); + + if (index > -1) + bcsListeners.remove(index); } public void revokeService (Class serviceClass, BeanContextServiceProvider bcsp, Index: java/beans/beancontext/BeanContextSupport.java =================================================================== RCS file: /cvsroot/classpath/classpath/java/beans/beancontext/BeanContextSupport.java,v retrieving revision 1.2 diff -u -r1.2 BeanContextSupport.java --- java/beans/beancontext/BeanContextSupport.java 26 Jun 2003 19:52:43 -0000 1.2 +++ java/beans/beancontext/BeanContextSupport.java 30 Mar 2005 12:45:51 -0000 @@ -1,5 +1,5 @@ -/* java.beans.beancontext.BeanContextSupport - Copyright (C) 2003 Free Software Foundation, Inc. +/* BeanContextSupport.java -- + Copyright (C) 2003, 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -7,7 +7,7 @@ it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. - + GNU Classpath is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU @@ -153,13 +153,19 @@ okToUseGui = visible; initialize (); - - throw new Error ("Not implemented"); } public boolean add (Object targetChild) { - throw new Error ("Not implemented"); + if (targetChild == null) + throw new IllegalArgumentException(); + + if (children.containsKey(targetChild)) + return false; + + System.out.println("java.beans.beancontext.BeanContextSupport.add() ignored for now"); + return true; + //throw new Error ("Not implemented"); } public boolean addAll (Collection c) @@ -167,9 +173,11 @@ throw new Error ("Not implemented"); } - public void addBeanContextMembershipListener (BeanContextMembershipListener bcml) + public void addBeanContextMembershipListener + (BeanContextMembershipListener listener) { - throw new Error ("Not implemented"); + if (! bcmListeners.contains(listener)) + bcmListeners.add(listener); } public boolean avoidingGui () @@ -302,7 +310,7 @@ public Locale getLocale () { - throw new Error ("Not implemented"); + return locale; } public URL getResource (String name, BeanContextChild bcc) @@ -317,7 +325,8 @@ protected void initialize () { - throw new Error ("Not implemented"); + bcmListeners = new ArrayList(); + children = new HashMap(); } public Object instantiateChild (String beanName) @@ -343,7 +352,7 @@ public Iterator iterator () { - throw new Error ("Not implemented"); + return children.keySet().iterator(); } public boolean needsGui () @@ -369,11 +378,14 @@ public boolean remove (Object targetChild) { - throw new Error ("Not implemented"); + return remove(targetChild, true); } protected boolean remove (Object targetChild, boolean callChildSetBC) { + if (targetChild == null) + throw new IllegalArgumentException(); + throw new Error ("Not implemented"); } @@ -416,12 +428,12 @@ public Object[] toArray () { - throw new Error ("Not implemented"); + return children.keySet().toArray(); } - public Object[] toArray (Object[] arry) + public Object[] toArray(Object[] array) { - throw new Error ("Not implemented"); + return children.keySet().toArray(array); } protected boolean validatePendingAdd (Object targetChild)