geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r155896 - geronimo/trunk/modules/service-builder/src/java/org/apache/geronimo/deployment/service/ServiceConfigBuilder.java
Date Wed, 02 Mar 2005 07:23:33 GMT
Author: djencks
Date: Tue Mar  1 23:23:33 2005
New Revision: 155896

URL: http://svn.apache.org/viewcvs?view=rev&rev=155896
Log:
use reference map

Modified:
    geronimo/trunk/modules/service-builder/src/java/org/apache/geronimo/deployment/service/ServiceConfigBuilder.java

Modified: geronimo/trunk/modules/service-builder/src/java/org/apache/geronimo/deployment/service/ServiceConfigBuilder.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/service-builder/src/java/org/apache/geronimo/deployment/service/ServiceConfigBuilder.java?view=diff&r1=155895&r2=155896
==============================================================================
--- geronimo/trunk/modules/service-builder/src/java/org/apache/geronimo/deployment/service/ServiceConfigBuilder.java
(original)
+++ geronimo/trunk/modules/service-builder/src/java/org/apache/geronimo/deployment/service/ServiceConfigBuilder.java
Tue Mar  1 23:23:33 2005
@@ -55,6 +55,7 @@
 import org.apache.geronimo.gbean.ReferenceCollection;
 import org.apache.geronimo.gbean.ReferenceCollectionListener;
 import org.apache.geronimo.gbean.ReferenceCollectionEvent;
+import org.apache.geronimo.gbean.ReferenceMap;
 import org.apache.geronimo.j2ee.j2eeobjectnames.J2eeContext;
 import org.apache.geronimo.j2ee.j2eeobjectnames.J2eeContextImpl;
 import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
@@ -75,6 +76,7 @@
 
     //TODO this being static is a really good argument that all other builders should have
a reference to this gbean, not use static methods on it.
     private static final Map xmlAttributeBuilderMap = new HashMap();
+    private Map refMap;
 
     public ServiceConfigBuilder(URI defaultParentId, Repository repository) {
         this(defaultParentId, repository, null, null);
@@ -85,27 +87,13 @@
         this.repository = repository;
         this.kernel = kernel;
         if (xmlAttributeBuilders != null) {
-            ReferenceCollection builders = (ReferenceCollection)xmlAttributeBuilders;
-            ReferenceCollectionListener listener = new ReferenceCollectionListener() {
+            ReferenceMap.Key key = new ReferenceMap.Key() {
 
-                public void memberAdded(ReferenceCollectionEvent event) {
-                    XmlAttributeBuilder attributeBuilder = (XmlAttributeBuilder) event.getMember();
-                    String namespace = attributeBuilder.getNamespace();
-                    xmlAttributeBuilderMap.put(namespace, attributeBuilder);
-                }
-
-                public void memberRemoved(ReferenceCollectionEvent event) {
-                    XmlAttributeBuilder attributeBuilder = (XmlAttributeBuilder) event.getMember();
-                    String namespace = attributeBuilder.getNamespace();
-                    xmlAttributeBuilderMap.remove(namespace);
+                public Object getKey(Object object) {
+                    return ((XmlAttributeBuilder)object).getNamespace();
                 }
             };
-            builders.addReferenceCollectionListener(listener);
-            for (Iterator iterator = builders.iterator(); iterator.hasNext();) {
-                Object o = iterator.next();
-                ReferenceCollectionEvent e = new ReferenceCollectionEvent(null, o);
-                listener.memberAdded(e);
-            }
+            refMap = new ReferenceMap(xmlAttributeBuilders, xmlAttributeBuilderMap, key);
         }
     }
 



Mime
View raw message