geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r1221397 - in /geronimo/server/trunk: framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/gbean/ framework/modules/geronimo-service-builder/src/main/java/org/apache/geronimo/deployment/service/ framework/modules/geronimo-ser...
Date Tue, 20 Dec 2011 18:05:34 GMT
Author: djencks
Date: Tue Dec 20 18:05:33 2011
New Revision: 1221397

URL: http://svn.apache.org/viewvc?rev=1221397&view=rev
Log:
GERONIMO-6240 make xml attribute and reference builders work and provide GBeanBuilder as a
gbean for modules builders to use

Added:
    geronimo/server/trunk/framework/modules/geronimo-service-builder/src/main/java/org/apache/geronimo/deployment/service/GBeanBuilderGBean.java
  (with props)
Modified:
    geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/gbean/ReferenceMap.java
    geronimo/server/trunk/framework/modules/geronimo-service-builder/src/main/java/org/apache/geronimo/deployment/service/GBeanBuilder.java
    geronimo/server/trunk/framework/modules/geronimo-service-builder/src/main/java/org/apache/geronimo/deployment/service/ServiceConfigBuilder.java
    geronimo/server/trunk/framework/modules/geronimo-service-builder/src/test/java/org/apache/geronimo/deployment/service/ServiceConfigBuilderTest.java
    geronimo/server/trunk/plugins/corba/geronimo-corba-builder/src/main/java/org/apache/geronimo/corba/deployment/security/config/css/CSSConfigEditor.java
    geronimo/server/trunk/plugins/corba/geronimo-corba-builder/src/main/java/org/apache/geronimo/corba/deployment/security/config/tss/TSSConfigEditor.java
    geronimo/server/trunk/plugins/j2ee/geronimo-security-builder/src/main/java/org/apache/geronimo/security/deployment/CredentialStoreBuilder.java
    geronimo/server/trunk/plugins/j2ee/geronimo-security-builder/src/main/java/org/apache/geronimo/security/deployment/LoginConfigBuilder.java
    geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/utils/WebAppXmlAttributeBuilder.java

Modified: geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/gbean/ReferenceMap.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/gbean/ReferenceMap.java?rev=1221397&r1=1221396&r2=1221397&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/gbean/ReferenceMap.java
(original)
+++ geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/gbean/ReferenceMap.java
Tue Dec 20 18:05:33 2011
@@ -22,9 +22,9 @@ import java.util.Map;
 import java.util.Set;
 
 
-public class ReferenceMap implements Map, ReferenceCollectionListener {
-    private final Map map;
-    private final Key key;
+public class ReferenceMap<T, U> implements Map<T, U>, ReferenceCollectionListener
{
+    private final Map<T, U> map;
+    private final Key<T, U> key;
 
     /**
      * Constructs the ReferenceMap using a new instance of
@@ -34,10 +34,10 @@ public class ReferenceMap implements Map
      * @param map The map instance to which references will be added/removed
      * @param key
      */
-    public ReferenceMap(Collection collection, Map map, Key key) {
+    public ReferenceMap(Collection<U> collection, Map<T, U> map, Key<T, U>
key) {
         this.map = map;
         this.key = key;
-        for (Object object : collection) {
+        for (U object : collection) {
             map.put(key.getKey(object), object);
         }
         if (collection instanceof ReferenceCollection) {
@@ -52,20 +52,20 @@ public class ReferenceMap implements Map
      * @param collection Must be an instance of ReferenceCollection
      * @param key
      */
-    public ReferenceMap(Collection collection, Key key) {
-        this(collection, new HashMap(), key);
+    public ReferenceMap(Collection<U> collection, Key<T, U> key) {
+        this(collection, new HashMap<T, U>(), key);
     }
 
     public void memberAdded(ReferenceCollectionEvent event) {
-        map.put(key.getKey(event.getMember()), event.getMember());
+        map.put(key.getKey((U)event.getMember()), (U)event.getMember());
     }
 
     public void memberRemoved(ReferenceCollectionEvent event) {
-        map.remove(key.getKey(event.getMember()));
+        map.remove(key.getKey((U)event.getMember()));
     }
 
-    public interface Key {
-        public Object getKey(Object object);
+    public interface Key<T, V> {
+        public T getKey(V object);
     }
 
     public int size() {
@@ -84,19 +84,19 @@ public class ReferenceMap implements Map
         return map.containsValue(value);
     }
 
-    public Object get(Object key) {
+    public U get(Object key) {
         return map.get(key);
     }
 
-    public Object put(Object key, Object value) {
+    public U put(T key, U value) {
         return map.put(key, value);
     }
 
-    public Object remove(Object key) {
+    public U remove(Object key) {
         return map.remove(key);
     }
 
-    public void putAll(Map t) {
+    public void putAll(Map<? extends T,? extends U> t) {
         map.putAll(t);
     }
 
@@ -104,15 +104,15 @@ public class ReferenceMap implements Map
         map.clear();
     }
 
-    public Set keySet() {
+    public Set<T> keySet() {
         return map.keySet();
     }
 
-    public Collection values() {
+    public Collection<U> values() {
         return map.values();
     }
 
-    public Set entrySet() {
+    public Set<Entry<T, U>> entrySet() {
         return map.entrySet();
     }
 

Modified: geronimo/server/trunk/framework/modules/geronimo-service-builder/src/main/java/org/apache/geronimo/deployment/service/GBeanBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-service-builder/src/main/java/org/apache/geronimo/deployment/service/GBeanBuilder.java?rev=1221397&r1=1221396&r2=1221397&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-service-builder/src/main/java/org/apache/geronimo/deployment/service/GBeanBuilder.java
(original)
+++ geronimo/server/trunk/framework/modules/geronimo-service-builder/src/main/java/org/apache/geronimo/deployment/service/GBeanBuilder.java
Tue Dec 20 18:05:33 2011
@@ -18,12 +18,10 @@
 package org.apache.geronimo.deployment.service;
 
 import java.beans.PropertyEditorManager;
-import java.util.Collection;
 import java.util.HashMap;
 import java.util.Map;
 
 import javax.xml.namespace.QName;
-
 import org.apache.geronimo.common.DeploymentException;
 import org.apache.geronimo.deployment.DeploymentContext;
 import org.apache.geronimo.deployment.NamespaceDrivenBuilder;
@@ -42,7 +40,6 @@ import org.apache.geronimo.gbean.GBeanIn
 import org.apache.geronimo.gbean.GBeanInfoBuilder;
 import org.apache.geronimo.gbean.GBeanInfoFactory;
 import org.apache.geronimo.gbean.MultiGBeanInfoFactory;
-import org.apache.geronimo.gbean.ReferenceMap;
 import org.apache.geronimo.kernel.GBeanAlreadyExistsException;
 import org.apache.geronimo.kernel.repository.Environment;
 import org.apache.xmlbeans.QNameSet;
@@ -54,43 +51,35 @@ import org.osgi.framework.Bundle;
  * @version $Rev$ $Date$
  */
 public class GBeanBuilder implements NamespaceDrivenBuilder {
-    protected Map attrRefMap;
-    protected Map refRefMap;
-    private final GBeanInfoFactory infoFactory;
+    protected final Map<String, XmlAttributeBuilder> attrRefMap = new HashMap<String,
XmlAttributeBuilder>();
+    protected final Map<String, XmlReferenceBuilder> refRefMap = new HashMap<String,
XmlReferenceBuilder>();
+    private final GBeanInfoFactory infoFactory = new MultiGBeanInfoFactory();
     public static final QName SERVICE_QNAME = ServiceDocument.type.getDocumentElementName();
     private static final QName GBEAN_QNAME = GbeanDocument.type.getDocumentElementName();
     private static final QNameSet GBEAN_QNAME_SET = QNameSet.singleton(GBEAN_QNAME);
 
-    public GBeanBuilder(Collection<XmlAttributeBuilder> xmlAttributeBuilders, Collection<XmlReferenceBuilder>
xmlReferenceBuilders) {
-        if (xmlAttributeBuilders != null) {
-            ReferenceMap.Key key = new ReferenceMap.Key() {
+    //TODO why is this here?
+    static {
+        PropertyEditorManager.registerEditor(Environment.class, EnvironmentBuilder.class);
+    }
+    public GBeanBuilder() {
+        bindXmlAttributeBuilder(new EnvironmentBuilder());
+    }
 
-                public Object getKey(Object object) {
-                    return ((XmlAttributeBuilder) object).getNamespace();
-                }
-            };
-            attrRefMap = new ReferenceMap(xmlAttributeBuilders, new HashMap(), key);
-        } else {
-            attrRefMap = new HashMap();
-        }
+    public void bindXmlAttributeBuilder(XmlAttributeBuilder xmlAttributeBuilder) {
+        attrRefMap.put(xmlAttributeBuilder.getNamespace(), xmlAttributeBuilder);
+    }
 
-        if (xmlReferenceBuilders != null) {
-            ReferenceMap.Key key = new ReferenceMap.Key() {
+    public void unbindXmlAttributeBuilder(XmlAttributeBuilder xmlAttributeBuilder) {
+        attrRefMap.remove(xmlAttributeBuilder.getNamespace());
+    }
 
-                public Object getKey(Object object) {
-                    return ((XmlReferenceBuilder) object).getNamespace();
-                }
-            };
-            refRefMap = new ReferenceMap(xmlReferenceBuilders, new HashMap(), key);
-        }
-        EnvironmentBuilder environmentBuilder = new EnvironmentBuilder();
-        attrRefMap.put(environmentBuilder.getNamespace(), environmentBuilder);
-        
-        infoFactory = newGBeanInfoFactory();
+    public void bindXmlReferenceBuilder(XmlReferenceBuilder xmlReferenceBuilder) {
+        refRefMap.put(xmlReferenceBuilder.getNamespace(), xmlReferenceBuilder);
     }
 
-    protected GBeanInfoFactory newGBeanInfoFactory() {
-        return new MultiGBeanInfoFactory();
+    public void unbindXmlReferenceBuilder(XmlReferenceBuilder xmlReferenceBuilder) {
+        refRefMap.remove(xmlReferenceBuilder.getNamespace());
     }
 
     public void buildEnvironment(XmlObject container, Environment environment) throws DeploymentException
{
@@ -195,25 +184,4 @@ public class GBeanBuilder implements Nam
         return SERVICE_QNAME;
     }
 
-    public static final GBeanInfo GBEAN_INFO;
-
-    static {
-        PropertyEditorManager.registerEditor(Environment.class, EnvironmentBuilder.class);
-
-        GBeanInfoBuilder infoBuilder = GBeanInfoBuilder.createStatic(GBeanBuilder.class,
"ModuleBuilder");
-
-        infoBuilder.addInterface(NamespaceDrivenBuilder.class);
-
-        infoBuilder.addReference("XmlAttributeBuilders", XmlAttributeBuilder.class, "XmlAttributeBuilder");
-        infoBuilder.addReference("XmlReferenceBuilders", XmlReferenceBuilder.class, "XmlReferenceBuilder");
-
-        infoBuilder.setConstructor(new String[]{"XmlAttributeBuilders", "XmlReferenceBuilders"});
-
-        GBEAN_INFO = infoBuilder.getBeanInfo();
-    }
-
-    public static GBeanInfo getGBeanInfo() {
-        return GBEAN_INFO;
-    }
-
 }

Added: geronimo/server/trunk/framework/modules/geronimo-service-builder/src/main/java/org/apache/geronimo/deployment/service/GBeanBuilderGBean.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-service-builder/src/main/java/org/apache/geronimo/deployment/service/GBeanBuilderGBean.java?rev=1221397&view=auto
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-service-builder/src/main/java/org/apache/geronimo/deployment/service/GBeanBuilderGBean.java
(added)
+++ geronimo/server/trunk/framework/modules/geronimo-service-builder/src/main/java/org/apache/geronimo/deployment/service/GBeanBuilderGBean.java
Tue Dec 20 18:05:33 2011
@@ -0,0 +1,70 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+
+package org.apache.geronimo.deployment.service;
+
+import javax.xml.namespace.QName;
+import org.apache.geronimo.common.DeploymentException;
+import org.apache.geronimo.deployment.DeploymentContext;
+import org.apache.geronimo.deployment.NamespaceDrivenBuilder;
+import org.apache.geronimo.gbean.annotation.GBean;
+import org.apache.geronimo.gbean.annotation.ParamSpecial;
+import org.apache.geronimo.gbean.annotation.SpecialAttributeType;
+import org.apache.geronimo.gbean.wrapper.AbstractServiceWrapper;
+import org.apache.geronimo.kernel.repository.Environment;
+import org.apache.xmlbeans.QNameSet;
+import org.apache.xmlbeans.XmlObject;
+import org.osgi.framework.Bundle;
+
+/**
+ * @version $Rev:$ $Date:$
+ */
+
+@GBean(j2eeType = "ModuleBuilder")
+public class GBeanBuilderGBean extends AbstractServiceWrapper<GBeanBuilder> implements
NamespaceDrivenBuilder {
+    public GBeanBuilderGBean(@ParamSpecial(type = SpecialAttributeType.bundle)final Bundle
bundle) {
+        super(bundle, GBeanBuilder.class);
+    }
+
+    @Override
+    public void buildEnvironment(XmlObject container, Environment environment) throws DeploymentException
{
+        get().buildEnvironment(container, environment);
+    }
+
+    @Override
+    public void build(XmlObject container, DeploymentContext applicationContext, DeploymentContext
moduleContext) throws DeploymentException {
+        get().build(container, applicationContext, moduleContext);
+    }
+
+    @Override
+    public QNameSet getSpecQNameSet() {
+        return get().getSpecQNameSet();
+    }
+
+    @Override
+    public QNameSet getPlanQNameSet() {
+        return get().getPlanQNameSet();
+    }
+
+    @Override
+    public QName getBaseQName() {
+        return get().getBaseQName();
+    }
+}

Propchange: geronimo/server/trunk/framework/modules/geronimo-service-builder/src/main/java/org/apache/geronimo/deployment/service/GBeanBuilderGBean.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/framework/modules/geronimo-service-builder/src/main/java/org/apache/geronimo/deployment/service/GBeanBuilderGBean.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/server/trunk/framework/modules/geronimo-service-builder/src/main/java/org/apache/geronimo/deployment/service/GBeanBuilderGBean.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: geronimo/server/trunk/framework/modules/geronimo-service-builder/src/main/java/org/apache/geronimo/deployment/service/ServiceConfigBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-service-builder/src/main/java/org/apache/geronimo/deployment/service/ServiceConfigBuilder.java?rev=1221397&r1=1221396&r2=1221397&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-service-builder/src/main/java/org/apache/geronimo/deployment/service/ServiceConfigBuilder.java
(original)
+++ geronimo/server/trunk/framework/modules/geronimo-service-builder/src/main/java/org/apache/geronimo/deployment/service/ServiceConfigBuilder.java
Tue Dec 20 18:05:33 2011
@@ -23,7 +23,6 @@ import java.io.IOException;
 import java.net.URI;
 import java.net.URL;
 import java.util.Collection;
-import java.util.Collections;
 import java.util.HashMap;
 import java.util.LinkedHashSet;
 import java.util.Map;
@@ -36,13 +35,13 @@ import org.apache.felix.scr.annotations.
 import org.apache.felix.scr.annotations.Reference;
 import org.apache.felix.scr.annotations.ReferenceCardinality;
 import org.apache.felix.scr.annotations.ReferencePolicy;
+import org.apache.felix.scr.annotations.References;
 import org.apache.felix.scr.annotations.Service;
 import org.apache.geronimo.common.DeploymentException;
 import org.apache.geronimo.deployment.ConfigurationBuilder;
 import org.apache.geronimo.deployment.DeploymentContext;
 import org.apache.geronimo.deployment.ModuleIDBuilder;
 import org.apache.geronimo.deployment.NamespaceDrivenBuilder;
-import org.apache.geronimo.deployment.NamespaceDrivenBuilderCollection;
 import org.apache.geronimo.deployment.xbeans.ArtifactType;
 import org.apache.geronimo.deployment.xbeans.EnvironmentType;
 import org.apache.geronimo.deployment.xbeans.ModuleDocument;
@@ -59,7 +58,6 @@ import org.apache.geronimo.kernel.config
 import org.apache.geronimo.kernel.repository.Artifact;
 import org.apache.geronimo.kernel.repository.ArtifactResolver;
 import org.apache.geronimo.kernel.repository.Environment;
-import org.apache.geronimo.kernel.repository.ListableRepository;
 import org.apache.geronimo.kernel.repository.Repository;
 import org.apache.geronimo.kernel.util.FileUtils;
 import org.apache.geronimo.kernel.util.JarUtils;
@@ -67,12 +65,16 @@ import org.apache.xmlbeans.XmlCursor;
 import org.apache.xmlbeans.XmlException;
 import org.apache.xmlbeans.XmlObject;
 import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceRegistration;
 
 /**
  * @version $Rev$ $Date$
  */
 @Component(immediate = true, metatype = true)
 @Service
+@References(value = {
+        @Reference(name = "xmlAttributeBuilder", referenceInterface = XmlAttributeBuilder.class,
cardinality = ReferenceCardinality.OPTIONAL_MULTIPLE, policy = ReferencePolicy.DYNAMIC),
+        @Reference(name = "xmlReferenceBuilder", referenceInterface = XmlReferenceBuilder.class,
cardinality = ReferenceCardinality.OPTIONAL_MULTIPLE, policy = ReferencePolicy.DYNAMIC)})
 public class ServiceConfigBuilder implements ConfigurationBuilder {
 
     private static final QName MODULE_QNAME = ModuleDocument.type.getDocumentElementName();
@@ -95,8 +97,15 @@ public class ServiceConfigBuilder implem
     @Reference(name = "repository", referenceInterface = Repository.class, cardinality =
ReferenceCardinality.OPTIONAL_MULTIPLE, policy = ReferencePolicy.DYNAMIC)
     private final Collection<Repository> repositories = new LinkedHashSet<Repository>();
 
+//    private final Collection<XmlAttributeBuilder> xmlAttributeBuilders = new LinkedHashSet<XmlAttributeBuilder>();
+
+//    private final Collection<XmlReferenceBuilder> xmlReferenceBuilders = new LinkedHashSet<XmlReferenceBuilder>();
+
     private BundleContext bundleContext;
-//    private final Naming naming = new Jsr77Naming();
+
+    private final GBeanBuilder gbeanBuilder = new GBeanBuilder();
+    private ServiceRegistration sr;
+    //    private final Naming naming = new Jsr77Naming();
 //    private final NamespaceDrivenBuilder serviceBuilders = new GBeanBuilder(Collections.emptyList(),
Collections.emptyList());
 //    private final GBeanBuilder serviceBuilders = new GBeanBuilder(Collections.emptyList(),
Collections.emptyList());
 //    private BundleContext bundleContext;
@@ -118,11 +127,7 @@ public class ServiceConfigBuilder implem
 //    }
 
     public ServiceConfigBuilder() {
-//        this.naming = new Jsr77Naming();
-
-//        this.serviceBuilders = new NamespaceDrivenBuilderCollection(serviceBuilders);
-//        this.bundleContext = bundleContext;
-        serviceBuilders.add(new GBeanBuilder(Collections.<XmlAttributeBuilder>emptySet(),
Collections.<XmlReferenceBuilder>emptySet()));
+        serviceBuilders.add(gbeanBuilder);
     }
 
     public void setConfigurationManager(ConfigurationManager configurationManager) {
@@ -151,17 +156,38 @@ public class ServiceConfigBuilder implem
         serviceBuilders.remove(namespaceDrivenBuilder);
     }
 
+    public void bindXmlAttributeBuilder(XmlAttributeBuilder xmlAttributeBuilder) {
+        gbeanBuilder.bindXmlAttributeBuilder(xmlAttributeBuilder);
+    }
+
+    public void unbindXmlAttributeBuilder(XmlAttributeBuilder xmlAttributeBuilder) {
+        gbeanBuilder.unbindXmlAttributeBuilder(xmlAttributeBuilder);
+    }
+
+    public void bindXmlReferenceBuilder(XmlReferenceBuilder xmlReferenceBuilder) {
+        gbeanBuilder.bindXmlReferenceBuilder(xmlReferenceBuilder);
+    }
+
+    public void unbindXmlReferenceBuilder(XmlReferenceBuilder xmlReferenceBuilder) {
+        gbeanBuilder.unbindXmlReferenceBuilder(xmlReferenceBuilder);
+    }
+
 
 
     @Activate
     public void activate(BundleContext bundleContext) {
         this.bundleContext = bundleContext;
+        sr = bundleContext.registerService(new String[] {NamespaceDrivenBuilder.class.getName(),
GBeanBuilder.class.getName()}, gbeanBuilder, null);
         XmlBeansUtil.registerNamespaceUpdates(NAMESPACE_UPDATES);
     }
 
     @Deactivate
-    public void doStop() {
+    public void deactivate() {
         XmlBeansUtil.unregisterNamespaceUpdates(NAMESPACE_UPDATES);
+        if (sr != null) {
+            sr.unregister();
+            sr = null;
+        }
     }
 
     public Object getDeploymentPlan(File planFile, JarFile jarFile, ModuleIDBuilder idBuilder)
throws DeploymentException {

Modified: geronimo/server/trunk/framework/modules/geronimo-service-builder/src/test/java/org/apache/geronimo/deployment/service/ServiceConfigBuilderTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-service-builder/src/test/java/org/apache/geronimo/deployment/service/ServiceConfigBuilderTest.java?rev=1221397&r1=1221396&r2=1221397&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-service-builder/src/test/java/org/apache/geronimo/deployment/service/ServiceConfigBuilderTest.java
(original)
+++ geronimo/server/trunk/framework/modules/geronimo-service-builder/src/test/java/org/apache/geronimo/deployment/service/ServiceConfigBuilderTest.java
Tue Dec 20 18:05:33 2011
@@ -78,13 +78,14 @@ public class ServiceConfigBuilderTest ex
         jar.close();
     }
 
-    public void xtestJavaBeanXmlAttribute() throws Exception {
-        ReferenceCollection referenceCollection = new MockReferenceCollection();
+    public void testJavaBeanXmlAttribute() throws Exception {
+//        ReferenceCollection referenceCollection = new MockReferenceCollection();
         JavaBeanXmlAttributeBuilder javaBeanXmlAttributeBuilder = new JavaBeanXmlAttributeBuilder();
         //this is kind of cheating, we rely on the builder to iterate through existing members
of the collection.
-        referenceCollection.add(javaBeanXmlAttributeBuilder);
+//        referenceCollection.add(javaBeanXmlAttributeBuilder);
         Naming naming = new Jsr77Naming();
-        NamespaceDrivenBuilder gbeanBuilder = new GBeanBuilder(referenceCollection, null);
+        GBeanBuilder gbeanBuilder = new GBeanBuilder();
+        gbeanBuilder.bindXmlAttributeBuilder(javaBeanXmlAttributeBuilder);
 //        ConfigurationBuilder serviceBuilder = new ServiceConfigBuilder(parentEnvironment,
null, Collections.singleton(gbeanBuilder), naming);
         ClassLoader cl = Thread.currentThread().getContextClassLoader();
         final URL plan1 = cl.getResource("services/plan1.xml");

Modified: geronimo/server/trunk/plugins/corba/geronimo-corba-builder/src/main/java/org/apache/geronimo/corba/deployment/security/config/css/CSSConfigEditor.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/corba/geronimo-corba-builder/src/main/java/org/apache/geronimo/corba/deployment/security/config/css/CSSConfigEditor.java?rev=1221397&r1=1221396&r2=1221397&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/corba/geronimo-corba-builder/src/main/java/org/apache/geronimo/corba/deployment/security/config/css/CSSConfigEditor.java
(original)
+++ geronimo/server/trunk/plugins/corba/geronimo-corba-builder/src/main/java/org/apache/geronimo/corba/deployment/security/config/css/CSSConfigEditor.java
Tue Dec 20 18:05:33 2011
@@ -19,6 +19,8 @@ package org.apache.geronimo.corba.deploy
 import java.util.Iterator;
 import java.util.List;
 
+import org.apache.felix.scr.annotations.Component;
+import org.apache.felix.scr.annotations.Service;
 import org.apache.geronimo.common.DeploymentException;
 import org.apache.geronimo.common.propertyeditor.PropertyEditorException;
 import org.apache.geronimo.corba.security.config.css.CSSASMechConfig;
@@ -48,7 +50,6 @@ import org.apache.geronimo.corba.xbeans.
 import org.apache.geronimo.corba.xbeans.csiv2.tss.TSSAssociationOption;
 import org.apache.geronimo.deployment.service.XmlAttributeBuilder;
 import org.apache.geronimo.deployment.xmlbeans.XmlBeansUtil;
-import org.apache.geronimo.gbean.annotation.GBean;
 import org.apache.geronimo.kernel.ClassLoading;
 import org.apache.xmlbeans.XmlException;
 import org.apache.xmlbeans.XmlObject;
@@ -68,7 +69,8 @@ import org.osgi.framework.Bundle;
 /**
  * @version $Revision: 451417 $ $Date: 2006-09-29 13:13:22 -0700 (Fri, 29 Sep 2006) $
  */
-@GBean(j2eeType = "XmlAttributeBuilder")
+@Component(immediate = true)
+@Service
 public class CSSConfigEditor implements XmlAttributeBuilder {
     private static final String NAMESPACE = CSSCssDocument.type.getDocumentElementName().getNamespaceURI();
 

Modified: geronimo/server/trunk/plugins/corba/geronimo-corba-builder/src/main/java/org/apache/geronimo/corba/deployment/security/config/tss/TSSConfigEditor.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/corba/geronimo-corba-builder/src/main/java/org/apache/geronimo/corba/deployment/security/config/tss/TSSConfigEditor.java?rev=1221397&r1=1221396&r2=1221397&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/corba/geronimo-corba-builder/src/main/java/org/apache/geronimo/corba/deployment/security/config/tss/TSSConfigEditor.java
(original)
+++ geronimo/server/trunk/plugins/corba/geronimo-corba-builder/src/main/java/org/apache/geronimo/corba/deployment/security/config/tss/TSSConfigEditor.java
Tue Dec 20 18:05:33 2011
@@ -19,6 +19,8 @@ package org.apache.geronimo.corba.deploy
 import java.util.Iterator;
 import java.util.List;
 
+import org.apache.felix.scr.annotations.Component;
+import org.apache.felix.scr.annotations.Service;
 import org.apache.geronimo.common.DeploymentException;
 import org.apache.geronimo.common.propertyeditor.PropertyEditorException;
 import org.apache.geronimo.corba.security.config.tss.TSSASMechConfig;
@@ -50,7 +52,6 @@ import org.apache.geronimo.corba.xbeans.
 import org.apache.geronimo.corba.xbeans.csiv2.tss.TSSTssType;
 import org.apache.geronimo.deployment.service.XmlAttributeBuilder;
 import org.apache.geronimo.deployment.xmlbeans.XmlBeansUtil;
-import org.apache.geronimo.gbean.annotation.GBean;
 import org.apache.geronimo.kernel.ClassLoading;
 import org.apache.xmlbeans.XmlException;
 import org.apache.xmlbeans.XmlObject;
@@ -72,7 +73,8 @@ import org.osgi.framework.Bundle;
  *
  * @version $Revision: 451417 $ $Date: 2006-09-29 13:13:22 -0700 (Fri, 29 Sep 2006) $
  */
-@GBean(j2eeType = "XmlAttributeBuilder")
+@Component(immediate = true)
+@Service
 public class TSSConfigEditor implements XmlAttributeBuilder {
 
     private static final String NAMESPACE = TSSTssDocument.type.getDocumentElementName().getNamespaceURI();

Modified: geronimo/server/trunk/plugins/j2ee/geronimo-security-builder/src/main/java/org/apache/geronimo/security/deployment/CredentialStoreBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/j2ee/geronimo-security-builder/src/main/java/org/apache/geronimo/security/deployment/CredentialStoreBuilder.java?rev=1221397&r1=1221396&r2=1221397&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/j2ee/geronimo-security-builder/src/main/java/org/apache/geronimo/security/deployment/CredentialStoreBuilder.java
(original)
+++ geronimo/server/trunk/plugins/j2ee/geronimo-security-builder/src/main/java/org/apache/geronimo/security/deployment/CredentialStoreBuilder.java
Tue Dec 20 18:05:33 2011
@@ -23,6 +23,8 @@ package org.apache.geronimo.security.dep
 import java.util.HashMap;
 import java.util.Map;
 
+import org.apache.felix.scr.annotations.Component;
+import org.apache.felix.scr.annotations.Service;
 import org.apache.geronimo.common.DeploymentException;
 import org.apache.geronimo.deployment.service.XmlAttributeBuilder;
 import org.apache.geronimo.gbean.GBeanInfo;
@@ -38,6 +40,8 @@ import org.osgi.framework.Bundle;
 /**
  * @version $Rev$ $Date$
  */
+@Component(immediate = true)
+@Service
 public class CredentialStoreBuilder implements XmlAttributeBuilder {
 
     private static final String NAMESPACE = CredentialStoreDocument.type.getDocumentElementName().getNamespaceURI();
@@ -69,14 +73,14 @@ public class CredentialStoreBuilder impl
     }
 
 
-    public static final GBeanInfo GBEAN_INFO;
-
-    static {
-        GBeanInfoBuilder infoBuilder = GBeanInfoBuilder.createStatic(CredentialStoreBuilder.class,
"XmlAttributeBuilder");
-        GBEAN_INFO = infoBuilder.getBeanInfo();
-    }
-
-    public static GBeanInfo getGBeanInfo() {
-        return GBEAN_INFO;
-    }
+//    public static final GBeanInfo GBEAN_INFO;
+//
+//    static {
+//        GBeanInfoBuilder infoBuilder = GBeanInfoBuilder.createStatic(CredentialStoreBuilder.class,
"XmlAttributeBuilder");
+//        GBEAN_INFO = infoBuilder.getBeanInfo();
+//    }
+//
+//    public static GBeanInfo getGBeanInfo() {
+//        return GBEAN_INFO;
+//    }
 }

Modified: geronimo/server/trunk/plugins/j2ee/geronimo-security-builder/src/main/java/org/apache/geronimo/security/deployment/LoginConfigBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/j2ee/geronimo-security-builder/src/main/java/org/apache/geronimo/security/deployment/LoginConfigBuilder.java?rev=1221397&r1=1221396&r2=1221397&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/j2ee/geronimo-security-builder/src/main/java/org/apache/geronimo/security/deployment/LoginConfigBuilder.java
(original)
+++ geronimo/server/trunk/plugins/j2ee/geronimo-security-builder/src/main/java/org/apache/geronimo/security/deployment/LoginConfigBuilder.java
Tue Dec 20 18:05:33 2011
@@ -26,6 +26,11 @@ import java.util.Set;
 
 import javax.xml.namespace.QName;
 
+import org.apache.felix.scr.annotations.Component;
+import org.apache.felix.scr.annotations.Reference;
+import org.apache.felix.scr.annotations.ReferenceCardinality;
+import org.apache.felix.scr.annotations.ReferencePolicy;
+import org.apache.felix.scr.annotations.Service;
 import org.apache.geronimo.common.DeploymentException;
 import org.apache.geronimo.deployment.DeploymentContext;
 import org.apache.geronimo.deployment.service.SingleGBeanBuilder;
@@ -42,6 +47,7 @@ import org.apache.geronimo.gbean.GRefere
 import org.apache.geronimo.gbean.ReferenceMap;
 import org.apache.geronimo.gbean.ReferencePatterns;
 import org.apache.geronimo.kernel.GBeanAlreadyExistsException;
+import org.apache.geronimo.kernel.Jsr77Naming;
 import org.apache.geronimo.kernel.Kernel;
 import org.apache.geronimo.kernel.Naming;
 import org.apache.geronimo.security.SecurityNames;
@@ -64,20 +70,29 @@ import org.osgi.framework.Bundle;
 /**
  * @version $Rev$ $Date$
  */
+@Component(immediate = true)
+@Service
 public class LoginConfigBuilder implements XmlReferenceBuilder {
     public static final String LOGIN_CONFIG_NAMESPACE = GerLoginConfigDocument.type.getDocumentElementName().getNamespaceURI();
     private static final QName LOGIN_MODULE_QNAME = new QName(LOGIN_CONFIG_NAMESPACE, "login-module");
     private static final QName SERVER_SIDE_QNAME = new QName(null, "server-side");
 
-    private final Naming naming;
-    private final Map xmlAttributeBuilderMap;
+    private final Naming naming = new Jsr77Naming();
+
+   @Reference(name = "xmlAttributeBuilder", referenceInterface = XmlAttributeBuilder.class,
cardinality = ReferenceCardinality.OPTIONAL_MULTIPLE, policy = ReferencePolicy.DYNAMIC)
+   private final Map<String, XmlAttributeBuilder> xmlAttributeBuilderMap;
+
+
+    public LoginConfigBuilder() {
+        xmlAttributeBuilderMap = new HashMap<String, XmlAttributeBuilder>();
+    }
 
     public LoginConfigBuilder(Kernel kernel, Collection xmlAttributeBuilderMap) {
         this(kernel.getNaming(), xmlAttributeBuilderMap);
     }
 
     public LoginConfigBuilder(Naming naming, Collection xmlAttributeBuilders) {
-        this.naming = naming;
+//        this.naming = naming;
         if (xmlAttributeBuilders != null) {
             ReferenceMap.Key key = new ReferenceMap.Key() {
 
@@ -91,6 +106,16 @@ public class LoginConfigBuilder implemen
         }
     }
 
+
+    public void bindXmlAttributeBuilder(XmlAttributeBuilder xmlAttributeBuilder) {
+        xmlAttributeBuilderMap.put(xmlAttributeBuilder.getNamespace(), xmlAttributeBuilder);
+    }
+
+    public void unbindXmlAttributeBuilder(XmlAttributeBuilder xmlAttributeBuilder) {
+        xmlAttributeBuilderMap.remove(xmlAttributeBuilder.getNamespace());
+    }
+
+
     public String getNamespace() {
         return LOGIN_CONFIG_NAMESPACE;
     }
@@ -231,17 +256,17 @@ public class LoginConfigBuilder implemen
         return string == null ? null : string.trim();
     }
 
-    public static final GBeanInfo GBEAN_INFO;
-
+//    public static final GBeanInfo GBEAN_INFO;
+//
     private static final GReferenceInfo USE_REFERENCE_INFO;
-
+//
     static {
-        GBeanInfoBuilder infoBuilder = GBeanInfoBuilder.createStatic(LoginConfigBuilder.class,
"XmlReferenceBuilder");
-        infoBuilder.addAttribute("kernel", Kernel.class, false, false);
-        infoBuilder.addReference("xmlAttributeBuilders", XmlAttributeBuilder.class, "XmlAttributeBuilder");
-        infoBuilder.setConstructor(new String[]{"kernel", "xmlAttributeBuilders"});
-        infoBuilder.addInterface(XmlReferenceBuilder.class);
-        GBEAN_INFO = infoBuilder.getBeanInfo();
+//        GBeanInfoBuilder infoBuilder = GBeanInfoBuilder.createStatic(LoginConfigBuilder.class,
"XmlReferenceBuilder");
+//        infoBuilder.addAttribute("kernel", Kernel.class, false, false);
+//        infoBuilder.addReference("xmlAttributeBuilders", XmlAttributeBuilder.class, "XmlAttributeBuilder");
+//        infoBuilder.setConstructor(new String[]{"kernel", "xmlAttributeBuilders"});
+//        infoBuilder.addInterface(XmlReferenceBuilder.class);
+//        GBEAN_INFO = infoBuilder.getBeanInfo();
 
         Set<GReferenceInfo> referenceInfos = JaasLoginModuleUse.GBEAN_INFO.getReferences();
         GReferenceInfo found = null;
@@ -258,8 +283,8 @@ public class LoginConfigBuilder implemen
         USE_REFERENCE_INFO = found;
 
     }
-
-    public static GBeanInfo getGBeanInfo() {
-        return GBEAN_INFO;
-    }
+//
+//    public static GBeanInfo getGBeanInfo() {
+//        return GBEAN_INFO;
+//    }
 }

Modified: geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/utils/WebAppXmlAttributeBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/utils/WebAppXmlAttributeBuilder.java?rev=1221397&r1=1221396&r2=1221397&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/utils/WebAppXmlAttributeBuilder.java
(original)
+++ geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/utils/WebAppXmlAttributeBuilder.java
Tue Dec 20 18:05:33 2011
@@ -36,6 +36,8 @@ import javax.xml.stream.XMLStreamReader;
 import javax.xml.transform.Source;
 import javax.xml.transform.stream.StreamSource;
 
+import org.apache.felix.scr.annotations.Component;
+import org.apache.felix.scr.annotations.Service;
 import org.apache.geronimo.common.DeploymentException;
 import org.apache.geronimo.common.propertyeditor.PropertyEditorException;
 import org.apache.geronimo.deployment.service.XmlAttributeBuilder;
@@ -53,7 +55,8 @@ import org.xml.sax.InputSource;
  * @version $Rev:$ $Date:$
  */
 
-@GBean(j2eeType = "XmlAttributeBuilder")
+@Component(immediate = true)
+@Service
 public class WebAppXmlAttributeBuilder extends PropertyEditorSupport implements XmlAttributeBuilder
{
 
     @Override



Mime
View raw message