geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r475947 - in /geronimo/server/trunk/modules: geronimo-client-builder/src/main/java/org/apache/geronimo/client/builder/ geronimo-clustering-builder-wadi/src/main/java/org/apache/geronimo/clustering/wadi/jetty/ geronimo-connector-builder/src/...
Date Thu, 16 Nov 2006 22:14:55 GMT
Author: djencks
Date: Thu Nov 16 14:14:54 2006
New Revision: 475947

URL: http://svn.apache.org/viewvc?view=rev&rev=475947
Log:
GERONIMO-2484 NamespaceDrivenBuilders should register QNameSets

Added:
    geronimo/server/trunk/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/AbstractBuilderCollection.java   (with props)
    geronimo/server/trunk/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/AbstractNamespaceBuilder.java   (with props)
    geronimo/server/trunk/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/xmlbeans/
    geronimo/server/trunk/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/xmlbeans/XmlBeansUtil.java   (contents, props changed)
      - copied, changed from r474886, geronimo/server/trunk/modules/geronimo-service-builder/src/main/java/org/apache/geronimo/deployment/xmlbeans/XmlBeansUtil.java
Removed:
    geronimo/server/trunk/modules/geronimo-service-builder/src/main/java/org/apache/geronimo/deployment/xmlbeans/XmlBeansUtil.java
Modified:
    geronimo/server/trunk/modules/geronimo-client-builder/src/main/java/org/apache/geronimo/client/builder/AppClientModuleBuilder.java
    geronimo/server/trunk/modules/geronimo-clustering-builder-wadi/src/main/java/org/apache/geronimo/clustering/wadi/jetty/WADIJettyClusteringBuilder.java
    geronimo/server/trunk/modules/geronimo-connector-builder/src/main/java/org/apache/geronimo/connector/deployment/ConnectorModuleBuilder.java
    geronimo/server/trunk/modules/geronimo-connector-builder/src/main/java/org/apache/geronimo/connector/deployment/ResourceRefBuilder.java
    geronimo/server/trunk/modules/geronimo-connector-builder/src/test/java/org/apache/geronimo/connector/deployment/MessageDestinationTest.java
    geronimo/server/trunk/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/NamespaceDrivenBuilder.java
    geronimo/server/trunk/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/NamespaceDrivenBuilderCollection.java
    geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder.java
    geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/NamingBuilder.java
    geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/NamingBuilderCollection.java
    geronimo/server/trunk/modules/geronimo-jetty-builder/src/main/java/org/apache/geronimo/jetty/deployment/JettyModuleBuilder.java
    geronimo/server/trunk/modules/geronimo-naming-builder/src/main/java/org/apache/geronimo/naming/deployment/AbstractNamingBuilder.java
    geronimo/server/trunk/modules/geronimo-naming-builder/src/main/java/org/apache/geronimo/naming/deployment/ResourceEnvironmentSetter.java
    geronimo/server/trunk/modules/geronimo-persistence-jpa10-builder/src/main/java/org/apache/geronimo/persistence/builder/PersistenceUnitBuilder.java
    geronimo/server/trunk/modules/geronimo-security-builder/src/main/java/org/apache/geronimo/security/deployment/GeronimoSecurityBuilderImpl.java
    geronimo/server/trunk/modules/geronimo-service-builder/src/main/java/org/apache/geronimo/deployment/service/GBeanBuilder.java
    geronimo/server/trunk/modules/geronimo-service-builder/src/main/java/org/apache/geronimo/deployment/service/ServiceConfigBuilder.java
    geronimo/server/trunk/modules/geronimo-web-builder/src/main/java/org/apache/geronimo/web/deployment/AbstractWebModuleBuilder.java

Modified: geronimo/server/trunk/modules/geronimo-client-builder/src/main/java/org/apache/geronimo/client/builder/AppClientModuleBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-client-builder/src/main/java/org/apache/geronimo/client/builder/AppClientModuleBuilder.java?view=diff&rev=475947&r1=475946&r2=475947
==============================================================================
--- geronimo/server/trunk/modules/geronimo-client-builder/src/main/java/org/apache/geronimo/client/builder/AppClientModuleBuilder.java (original)
+++ geronimo/server/trunk/modules/geronimo-client-builder/src/main/java/org/apache/geronimo/client/builder/AppClientModuleBuilder.java Thu Nov 16 14:14:54 2006
@@ -45,6 +45,7 @@
 import org.apache.geronimo.deployment.NamespaceDrivenBuilder;
 import org.apache.geronimo.deployment.NamespaceDrivenBuilderCollection;
 import org.apache.geronimo.deployment.service.EnvironmentBuilder;
+import org.apache.geronimo.deployment.service.GBeanBuilder;
 import org.apache.geronimo.deployment.util.DeploymentUtil;
 import org.apache.geronimo.deployment.util.NestedJarFile;
 import org.apache.geronimo.deployment.xbeans.EnvironmentType;
@@ -169,7 +170,7 @@
         this.repositories = repositories;
         this.connectorModuleBuilder = connectorModuleBuilder;
         this.securityBuilder = securityBuilder;
-        this.serviceBuilder = new NamespaceDrivenBuilderCollection(serviceBuilder);
+        this.serviceBuilder = new NamespaceDrivenBuilderCollection(serviceBuilder, GBeanBuilder.SERVICE_QNAME);
         this.namingBuilders = new NamingBuilderCollection(namingBuilders, GerAbstractNamingEntryDocument.type.getDocumentElementName());
     }
 

Modified: geronimo/server/trunk/modules/geronimo-clustering-builder-wadi/src/main/java/org/apache/geronimo/clustering/wadi/jetty/WADIJettyClusteringBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-clustering-builder-wadi/src/main/java/org/apache/geronimo/clustering/wadi/jetty/WADIJettyClusteringBuilder.java?view=diff&rev=475947&r1=475946&r2=475947
==============================================================================
--- geronimo/server/trunk/modules/geronimo-clustering-builder-wadi/src/main/java/org/apache/geronimo/clustering/wadi/jetty/WADIJettyClusteringBuilder.java (original)
+++ geronimo/server/trunk/modules/geronimo-clustering-builder-wadi/src/main/java/org/apache/geronimo/clustering/wadi/jetty/WADIJettyClusteringBuilder.java Thu Nov 16 14:14:54 2006
@@ -51,6 +51,7 @@
 import org.apache.geronimo.xbeans.geronimo.naming.GerPatternType;
 import org.apache.xmlbeans.QNameSet;
 import org.apache.xmlbeans.XmlObject;
+import org.apache.xmlbeans.XmlException;
 
 /**
  *
@@ -115,29 +116,28 @@
         }
     }
 
-    public String getNamespace() {
-        XmlBeansUtil.registerSubstitutionGroupElements(org.apache.geronimo.xbeans.geronimo.j2ee.GerClusteringDocument.type.getDocumentElementName(), CLUSTERING_WADI_QNAME_SET);
-        return CLUSTERING_WADI_QNAME.getNamespaceURI();
-    }
-
     private GerClusteringWadiType getWadiClusterConfig(XmlObject container) throws DeploymentException {
         XmlObject[] items = container.selectChildren(CLUSTERING_WADI_QNAME_SET);
         if (items.length > 1) {
             throw new DeploymentException("Unexpected count of clustering elements in geronimo plan " + items.length + " qnameset: " + CLUSTERING_WADI_QNAME_SET);
         }
         if (items.length == 1) {
-            return (GerClusteringWadiType) items[0].copy().changeType(GerClusteringWadiType.type);
+            try {
+                return (GerClusteringWadiType) XmlBeansUtil.typedCopy(items[0], GerClusteringWadiType.type);
+            } catch (XmlException e) {
+                throw new DeploymentException("Could not validate jetty wadi clustering config", e);
+            }
         }
         return null;
     }
 
-    private AbstractName addSessionManager(GerClusteringWadiType clustering, GBeanData webModuleData, 
+    private AbstractName addSessionManager(GerClusteringWadiType clustering, GBeanData webModuleData,
             DeploymentContext moduleContext) throws GBeanAlreadyExistsException {
         AbstractName name = moduleContext.getNaming().createChildName(moduleContext.getModuleName(),
                 "WADISessionManager", NameFactory.GERONIMO_SERVICE);
 
         GBeanData beanData = new GBeanData(name, BasicWADISessionManager.GBEAN_INFO);
-        
+
         setConfigInfo(clustering, webModuleData, beanData);
         setReplicationManagerFactory(clustering, beanData);
         setReplicaStorageFactory(clustering, beanData);
@@ -162,7 +162,7 @@
         if (null == sessionTimeout) {
             throw new AssertionError();
         }
-        
+
         WADISessionManagerConfigInfo configInfo = new WADISessionManagerConfigInfo(
                 beanData.getAbstractName().toURI(),
                 sweepInterval,
@@ -246,6 +246,14 @@
             AbstractNameQuery query = ENCConfigBuilder.buildAbstractNameQuery(patternTypes[i], null, null, null);
             patterns.add(query);
         }
+    }
+
+    public QNameSet getSpecQNameSet() {
+        return QNameSet.EMPTY;
+    }
+
+    public QNameSet getPlanQNameSet() {
+        return CLUSTERING_WADI_QNAME_SET;
     }
 
     public static final GBeanInfo GBEAN_INFO;

Modified: geronimo/server/trunk/modules/geronimo-connector-builder/src/main/java/org/apache/geronimo/connector/deployment/ConnectorModuleBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-connector-builder/src/main/java/org/apache/geronimo/connector/deployment/ConnectorModuleBuilder.java?view=diff&rev=475947&r1=475946&r2=475947
==============================================================================
--- geronimo/server/trunk/modules/geronimo-connector-builder/src/main/java/org/apache/geronimo/connector/deployment/ConnectorModuleBuilder.java (original)
+++ geronimo/server/trunk/modules/geronimo-connector-builder/src/main/java/org/apache/geronimo/connector/deployment/ConnectorModuleBuilder.java Thu Nov 16 14:14:54 2006
@@ -68,6 +68,7 @@
 import org.apache.geronimo.deployment.NamespaceDrivenBuilder;
 import org.apache.geronimo.deployment.NamespaceDrivenBuilderCollection;
 import org.apache.geronimo.deployment.service.EnvironmentBuilder;
+import org.apache.geronimo.deployment.service.GBeanBuilder;
 import org.apache.geronimo.deployment.util.DeploymentUtil;
 import org.apache.geronimo.deployment.xbeans.EnvironmentType;
 import org.apache.geronimo.deployment.xmlbeans.XmlBeansUtil;
@@ -157,7 +158,7 @@
         this.defaultIdleTimeoutMinutes = defaultIdleTimeoutMinutes;
         this.defaultXATransactionCaching = defaultXATransactionCaching;
         this.defaultXAThreadCaching = defaultXAThreadCaching;
-        this.serviceBuilders = new NamespaceDrivenBuilderCollection(serviceBuilders);
+        this.serviceBuilders = new NamespaceDrivenBuilderCollection(serviceBuilders, GBeanBuilder.SERVICE_QNAME);
     }
 
     public Module createModule(File plan, JarFile moduleFile, Naming naming, ModuleIDBuilder idBuilder) throws DeploymentException {

Modified: geronimo/server/trunk/modules/geronimo-connector-builder/src/main/java/org/apache/geronimo/connector/deployment/ResourceRefBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-connector-builder/src/main/java/org/apache/geronimo/connector/deployment/ResourceRefBuilder.java?view=diff&rev=475947&r1=475946&r2=475947
==============================================================================
--- geronimo/server/trunk/modules/geronimo-connector-builder/src/main/java/org/apache/geronimo/connector/deployment/ResourceRefBuilder.java (original)
+++ geronimo/server/trunk/modules/geronimo-connector-builder/src/main/java/org/apache/geronimo/connector/deployment/ResourceRefBuilder.java Thu Nov 16 14:14:54 2006
@@ -148,7 +148,7 @@
 
     }
 
-    public void setResourceEnvironment(ResourceEnvironmentBuilder builder, XmlObject[] resourceRefs, GerResourceRefType[] gerResourceRefs) {
+    public void setResourceEnvironment(ResourceEnvironmentBuilder builder, XmlObject[] resourceRefs, GerResourceRefType[] gerResourceRefs) throws DeploymentException {
         resourceRefs = convert(resourceRefs, J2EE_CONVERTER, ResourceRefType.type);
         Map refMap = mapResourceRefs(gerResourceRefs);
         Set unshareableResources = new HashSet();

Modified: geronimo/server/trunk/modules/geronimo-connector-builder/src/test/java/org/apache/geronimo/connector/deployment/MessageDestinationTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-connector-builder/src/test/java/org/apache/geronimo/connector/deployment/MessageDestinationTest.java?view=diff&rev=475947&r1=475946&r2=475947
==============================================================================
--- geronimo/server/trunk/modules/geronimo-connector-builder/src/test/java/org/apache/geronimo/connector/deployment/MessageDestinationTest.java (original)
+++ geronimo/server/trunk/modules/geronimo-connector-builder/src/test/java/org/apache/geronimo/connector/deployment/MessageDestinationTest.java Thu Nov 16 14:14:54 2006
@@ -232,11 +232,13 @@
             "<message-destination-ref>" +
             "  <message-destination-ref-name>n1</message-destination-ref-name>" +
             "  <message-destination-type>java.lang.Object</message-destination-type>" +
+            "  <message-destination-usage>Consumes</message-destination-usage>" +
             "  <message-destination-link>d1</message-destination-link>" +
             "</message-destination-ref>" +
             "<message-destination-ref>" +
             "  <message-destination-ref-name>n2</message-destination-ref-name>" +
             "  <message-destination-type>java.lang.Object</message-destination-type>" +
+            "  <message-destination-usage>Consumes</message-destination-usage>" +
             "  <message-destination-link>d2</message-destination-link>" +
             "</message-destination-ref>" +
             "</tmp>";

Added: geronimo/server/trunk/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/AbstractBuilderCollection.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/AbstractBuilderCollection.java?view=auto&rev=475947
==============================================================================
--- geronimo/server/trunk/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/AbstractBuilderCollection.java (added)
+++ geronimo/server/trunk/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/AbstractBuilderCollection.java Thu Nov 16 14:14:54 2006
@@ -0,0 +1,101 @@
+/*
+ * 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;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Iterator;
+
+import javax.xml.namespace.QName;
+
+import org.apache.xmlbeans.QNameSet;
+import org.apache.geronimo.deployment.xmlbeans.XmlBeansUtil;
+import org.apache.geronimo.gbean.ReferenceCollection;
+import org.apache.geronimo.gbean.ReferenceCollectionListener;
+import org.apache.geronimo.gbean.ReferenceCollectionEvent;
+
+/**
+ * @version $Rev:$ $Date:$
+ */
+public abstract class AbstractBuilderCollection {
+    protected final Collection builders;
+    protected final QName basePlanElementName;
+    protected QNameSet specQNames = QNameSet.EMPTY;
+    protected QNameSet planQNames = QNameSet.EMPTY;
+
+    protected AbstractBuilderCollection(Collection builders, final QName basePlanElementName) {
+        this.builders = builders == null ? Collections.EMPTY_SET : builders;
+        this.basePlanElementName = basePlanElementName;
+        if (builders instanceof ReferenceCollection) {
+            ((ReferenceCollection) builders).addReferenceCollectionListener(new ReferenceCollectionListener() {
+
+                public void memberAdded(ReferenceCollectionEvent event) {
+                    addBuilder(event.getMember());
+                }
+
+                public void memberRemoved(ReferenceCollectionEvent event) {
+                    Object builder = event.getMember();
+                    QNameSet builderSpecQNames = ((AbstractNamespaceBuilder) builder).getSpecQNameSet();
+                    specQNames = specQNames.intersect(builderSpecQNames.inverse());
+                    QNameSet builderPlanQNames = ((AbstractNamespaceBuilder) builder).getPlanQNameSet();
+                    planQNames = planQNames.intersect(builderPlanQNames.inverse());
+                    XmlBeansUtil.unregisterSubstitutionGroupElements(basePlanElementName, builderPlanQNames);
+                }
+            });
+        }
+        for (Iterator iterator = this.builders.iterator(); iterator.hasNext();) {
+            Object builder = iterator.next();
+            addBuilder(builder);
+        }
+    }
+
+
+    protected void addBuilder(Object builder) {
+        QNameSet builderSpecQNames = ((AbstractNamespaceBuilder) builder).getSpecQNameSet();
+        QNameSet builderPlanQNames = ((AbstractNamespaceBuilder) builder).getPlanQNameSet();
+        if (builderSpecQNames == null) {
+            throw new IllegalStateException("Builder " + builder + " is missing spec qnames");
+        }
+        if (builderPlanQNames == null) {
+            throw new IllegalStateException("Builder " + builder + " is missing plan qnames");
+        }
+        if (!specQNames.isDisjoint(builderSpecQNames) && !planQNames.isDisjoint(builderPlanQNames)) {
+            throw new IllegalArgumentException("Duplicate builderSpecQNames in builder set: " + builderSpecQNames + " and duplicate builderPlanQNames in builder set: " + builderPlanQNames);
+        }
+        try {
+            specQNames = specQNames.union(builderSpecQNames);
+            planQNames = planQNames.union(builderPlanQNames);
+        } catch (NullPointerException e) {
+            throw (IllegalArgumentException) new IllegalArgumentException("could not merge qnamesets for builder " + builder).initCause(e);
+
+        }
+        //really?
+        XmlBeansUtil.registerSubstitutionGroupElements(basePlanElementName, builderPlanQNames);
+    }
+
+    public QNameSet getSpecQNameSet() {
+        return specQNames;
+    }
+
+    public QNameSet getPlanQNameSet() {
+        return null;
+    }
+}

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

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

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

Added: geronimo/server/trunk/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/AbstractNamespaceBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/AbstractNamespaceBuilder.java?view=auto&rev=475947
==============================================================================
--- geronimo/server/trunk/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/AbstractNamespaceBuilder.java (added)
+++ geronimo/server/trunk/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/AbstractNamespaceBuilder.java Thu Nov 16 14:14:54 2006
@@ -0,0 +1,32 @@
+/*
+ * 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;
+
+import org.apache.xmlbeans.QNameSet;
+
+/**
+ * @version $Rev:$ $Date:$
+ */
+public interface AbstractNamespaceBuilder {
+    QNameSet getSpecQNameSet();
+
+    QNameSet getPlanQNameSet();
+}

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

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

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

Modified: geronimo/server/trunk/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/NamespaceDrivenBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/NamespaceDrivenBuilder.java?view=diff&rev=475947&r1=475946&r2=475947
==============================================================================
--- geronimo/server/trunk/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/NamespaceDrivenBuilder.java (original)
+++ geronimo/server/trunk/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/NamespaceDrivenBuilder.java Thu Nov 16 14:14:54 2006
@@ -28,12 +28,10 @@
 /**
  * @version $Rev$ $Date$
  */
-public interface NamespaceDrivenBuilder {
+public interface NamespaceDrivenBuilder extends AbstractNamespaceBuilder {
 
     void buildEnvironment(XmlObject container, Environment environment) throws DeploymentException;
  
     void build(XmlObject container, DeploymentContext applicationContext, DeploymentContext moduleContext) throws DeploymentException;
-
-    String getNamespace();
 
 }

Modified: geronimo/server/trunk/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/NamespaceDrivenBuilderCollection.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/NamespaceDrivenBuilderCollection.java?view=diff&rev=475947&r1=475946&r2=475947
==============================================================================
--- geronimo/server/trunk/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/NamespaceDrivenBuilderCollection.java (original)
+++ geronimo/server/trunk/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/NamespaceDrivenBuilderCollection.java Thu Nov 16 14:14:54 2006
@@ -18,16 +18,11 @@
 
 package org.apache.geronimo.deployment;
 
-import java.util.Set;
-import java.util.HashSet;
-import java.util.Iterator;
 import java.util.Collection;
-import java.util.List;
-import java.util.Collections;
+import java.util.Iterator;
+
+import javax.xml.namespace.QName;
 
-import org.apache.geronimo.gbean.ReferenceCollection;
-import org.apache.geronimo.gbean.ReferenceCollectionListener;
-import org.apache.geronimo.gbean.ReferenceCollectionEvent;
 import org.apache.geronimo.common.DeploymentException;
 import org.apache.geronimo.kernel.repository.Environment;
 import org.apache.xmlbeans.XmlObject;
@@ -35,39 +30,10 @@
 /**
  * @version $Rev$ $Date$
  */
-public class NamespaceDrivenBuilderCollection {
-
-    private final Collection builders;
-    private final Set namespaces = new HashSet();
-
-    public NamespaceDrivenBuilderCollection(Collection builders) {
-        this.builders = builders == null? Collections.EMPTY_SET: builders;
-        if (builders instanceof ReferenceCollection) {
-            ((ReferenceCollection)builders).addReferenceCollectionListener(new ReferenceCollectionListener() {
-
-                public void memberAdded(ReferenceCollectionEvent event) {
-                    addBuilder(event.getMember());
-                }
-
-                public void memberRemoved(ReferenceCollectionEvent event) {
-                    Object builder = event.getMember();
-                    String namespace = ((NamespaceDrivenBuilder)builder).getNamespace();
-                    namespaces.remove(namespace);
-                }
-            });
-        }
-        for (Iterator iterator = this.builders.iterator(); iterator.hasNext();) {
-            Object builder = iterator.next();
-            addBuilder(builder);
-        }
-    }
+public class NamespaceDrivenBuilderCollection extends AbstractBuilderCollection {
 
-    private void addBuilder(Object builder) {
-        String namespace = ((NamespaceDrivenBuilder)builder).getNamespace();
-        if (namespaces.contains(namespace)) {
-            throw new IllegalArgumentException("Duplicate namespace in builder set: " + namespace);
-        }
-        namespaces.add(namespace);                                                                   
+    public NamespaceDrivenBuilderCollection(Collection builders, final QName basePlanElementName) {
+        super(builders, basePlanElementName);
     }
 
     public void buildEnvironment(XmlObject container, Environment environment) throws DeploymentException {
@@ -84,6 +50,4 @@
         }
     }
 
-    public void addLoaders(List loaderList) {
-    }
 }

Copied: geronimo/server/trunk/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/xmlbeans/XmlBeansUtil.java (from r474886, geronimo/server/trunk/modules/geronimo-service-builder/src/main/java/org/apache/geronimo/deployment/xmlbeans/XmlBeansUtil.java)
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/xmlbeans/XmlBeansUtil.java?view=diff&rev=475947&p1=geronimo/server/trunk/modules/geronimo-service-builder/src/main/java/org/apache/geronimo/deployment/xmlbeans/XmlBeansUtil.java&r1=474886&p2=geronimo/server/trunk/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/xmlbeans/XmlBeansUtil.java&r2=475947
==============================================================================
--- geronimo/server/trunk/modules/geronimo-service-builder/src/main/java/org/apache/geronimo/deployment/xmlbeans/XmlBeansUtil.java (original)
+++ geronimo/server/trunk/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/xmlbeans/XmlBeansUtil.java Thu Nov 16 14:14:54 2006
@@ -177,6 +177,12 @@
         return container.selectChildren(substitutionGroupMembers);
     }
 
+    public static XmlObject typedCopy(XmlObject in, SchemaType type) throws XmlException {
+        XmlObject out = in.copy().changeType(type);
+        validateDD(out);
+        return out;
+    }
+
     public static void validateDD(XmlObject dd) throws XmlException {
         XmlOptions xmlOptions = new XmlOptions();
         xmlOptions.setLoadLineNumbers();

Propchange: geronimo/server/trunk/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/xmlbeans/XmlBeansUtil.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/xmlbeans/XmlBeansUtil.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/server/trunk/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/xmlbeans/XmlBeansUtil.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder.java?view=diff&rev=475947&r1=475946&r2=475947
==============================================================================
--- geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder.java (original)
+++ geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder.java Thu Nov 16 14:14:54 2006
@@ -49,6 +49,7 @@
 import org.apache.geronimo.deployment.NamespaceDrivenBuilder;
 import org.apache.geronimo.deployment.NamespaceDrivenBuilderCollection;
 import org.apache.geronimo.deployment.service.EnvironmentBuilder;
+import org.apache.geronimo.deployment.service.GBeanBuilder;
 import org.apache.geronimo.deployment.util.DeploymentUtil;
 import org.apache.geronimo.deployment.util.NestedJarFile;
 import org.apache.geronimo.deployment.xbeans.ArtifactType;
@@ -85,6 +86,7 @@
 import org.apache.geronimo.xbeans.geronimo.j2ee.GerApplicationType;
 import org.apache.geronimo.xbeans.geronimo.j2ee.GerExtModuleType;
 import org.apache.geronimo.xbeans.geronimo.j2ee.GerModuleType;
+import org.apache.geronimo.xbeans.geronimo.j2ee.GerSecurityDocument;
 import org.apache.geronimo.xbeans.j2ee.ApplicationType;
 import org.apache.geronimo.xbeans.j2ee.ModuleType;
 import org.apache.geronimo.xbeans.j2ee.ApplicationDocument;
@@ -216,8 +218,8 @@
         this.webConfigBuilder = webConfigBuilder;
         this.connectorConfigBuilder = connectorConfigBuilder;
         this.appClientConfigBuilder = appClientConfigBuilder;
-        this.securityBuilders = new NamespaceDrivenBuilderCollection(securityBuilders);
-        this.serviceBuilders = new NamespaceDrivenBuilderCollection(serviceBuilders);
+        this.securityBuilders = new NamespaceDrivenBuilderCollection(securityBuilders, GerSecurityDocument.type.getDocumentElementName());
+        this.serviceBuilders = new NamespaceDrivenBuilderCollection(serviceBuilders, GBeanBuilder.SERVICE_QNAME);
 
         this.transactionManagerObjectName = transactionManagerAbstractName;
         this.connectionTrackerObjectName = connectionTrackerAbstractName;

Modified: geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/NamingBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/NamingBuilder.java?view=diff&rev=475947&r1=475946&r2=475947
==============================================================================
--- geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/NamingBuilder.java (original)
+++ geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/NamingBuilder.java Thu Nov 16 14:14:54 2006
@@ -23,13 +23,14 @@
 import org.apache.geronimo.common.DeploymentException;
 import org.apache.geronimo.kernel.config.Configuration;
 import org.apache.geronimo.kernel.repository.Environment;
+import org.apache.geronimo.deployment.AbstractNamespaceBuilder;
 import org.apache.xmlbeans.QNameSet;
 import org.apache.xmlbeans.XmlObject;
 
 /**
  * @version $Rev$ $Date$
  */
-public interface NamingBuilder {
+public interface NamingBuilder extends AbstractNamespaceBuilder {
 
     XmlObject[] NO_REFS = new XmlObject[] {};
     String ENV = "env/";
@@ -43,7 +44,4 @@
     
     void buildNaming(XmlObject specDD, XmlObject plan, Configuration localConfiguration, Configuration remoteConfiguration, Module module, Map componentContext) throws DeploymentException;
 
-    QNameSet getSpecQNameSet();
-
-    QNameSet getPlanQNameSet();
 }

Modified: geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/NamingBuilderCollection.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/NamingBuilderCollection.java?view=diff&rev=475947&r1=475946&r2=475947
==============================================================================
--- geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/NamingBuilderCollection.java (original)
+++ geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/NamingBuilderCollection.java Thu Nov 16 14:14:54 2006
@@ -20,78 +20,23 @@
 
 import java.util.Collection;
 import java.util.Iterator;
-import java.util.Collections;
 import java.util.Map;
 
 import javax.xml.namespace.QName;
 
 import org.apache.geronimo.common.DeploymentException;
-import org.apache.geronimo.deployment.xmlbeans.XmlBeansUtil;
-import org.apache.geronimo.gbean.ReferenceCollection;
-import org.apache.geronimo.gbean.ReferenceCollectionEvent;
-import org.apache.geronimo.gbean.ReferenceCollectionListener;
+import org.apache.geronimo.deployment.AbstractBuilderCollection;
 import org.apache.geronimo.kernel.config.Configuration;
 import org.apache.geronimo.kernel.repository.Environment;
-import org.apache.xmlbeans.QNameSet;
 import org.apache.xmlbeans.XmlObject;
 
 /**
  * @version $Rev$ $Date$
  */
-public class NamingBuilderCollection implements NamingBuilder {
-
-    private final Collection builders;
-    private final QName basePlanElementName;
-    private QNameSet specQNames = QNameSet.EMPTY;
-    private QNameSet planQNames = QNameSet.EMPTY;
+public class NamingBuilderCollection extends AbstractBuilderCollection implements NamingBuilder {
 
     public NamingBuilderCollection(Collection builders, final QName basePlanElementName) {
-        this.builders = builders == null ? Collections.EMPTY_SET : builders;
-        this.basePlanElementName = basePlanElementName;
-        if (builders instanceof ReferenceCollection) {
-            ((ReferenceCollection) builders).addReferenceCollectionListener(new ReferenceCollectionListener() {
-
-                public void memberAdded(ReferenceCollectionEvent event) {
-                    addBuilder(event.getMember());
-                }
-
-                public void memberRemoved(ReferenceCollectionEvent event) {
-                    Object builder = event.getMember();
-                    QNameSet builderSpecQNames = ((NamingBuilder) builder).getSpecQNameSet();
-                    specQNames = specQNames.intersect(builderSpecQNames.inverse());
-                    QNameSet builderPlanQNames = ((NamingBuilder) builder).getPlanQNameSet();
-                    planQNames = planQNames.intersect(builderPlanQNames.inverse());
-                    XmlBeansUtil.unregisterSubstitutionGroupElements(basePlanElementName, builderPlanQNames);
-                }
-            });
-        }
-        for (Iterator iterator = this.builders.iterator(); iterator.hasNext();) {
-            Object builder = iterator.next();
-            addBuilder(builder);
-        }
-    }
-
-    private void addBuilder(Object builder) {
-        QNameSet builderSpecQNames = ((NamingBuilder) builder).getSpecQNameSet();
-        QNameSet builderPlanQNames = ((NamingBuilder) builder).getPlanQNameSet();
-        if (builderSpecQNames == null) {
-            throw new IllegalStateException("Builder " + builder + " is missing spec qnames");
-        }
-        if (builderPlanQNames == null) {
-            throw new IllegalStateException("Builder " + builder + " is missing plan qnames");
-        }
-        if (!specQNames.isDisjoint(builderSpecQNames) && !planQNames.isDisjoint(builderPlanQNames)) {
-            throw new IllegalArgumentException("Duplicate builderSpecQNames in builder set: " + builderSpecQNames + " and duplicate builderPlanQNames in builder set: " + builderPlanQNames);
-        }
-        try {
-            specQNames = specQNames.union(builderSpecQNames);
-            planQNames = planQNames.union(builderPlanQNames);
-        } catch (NullPointerException e) {
-            throw (IllegalArgumentException) new IllegalArgumentException("could not merge qnamesets for builder " + builder).initCause(e);
-
-        }
-        //really?
-        XmlBeansUtil.registerSubstitutionGroupElements(basePlanElementName, builderPlanQNames);
+        super(builders, basePlanElementName);
     }
 
     public void buildEnvironment(XmlObject specDD, XmlObject plan, Environment environment) throws DeploymentException {
@@ -115,11 +60,4 @@
         }
     }
 
-    public QNameSet getSpecQNameSet() {
-        return specQNames;
-    }
-
-    public QNameSet getPlanQNameSet() {
-        return null;
-    }
 }

Modified: geronimo/server/trunk/modules/geronimo-jetty-builder/src/main/java/org/apache/geronimo/jetty/deployment/JettyModuleBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-jetty-builder/src/main/java/org/apache/geronimo/jetty/deployment/JettyModuleBuilder.java?view=diff&rev=475947&r1=475946&r2=475947
==============================================================================
--- geronimo/server/trunk/modules/geronimo-jetty-builder/src/main/java/org/apache/geronimo/jetty/deployment/JettyModuleBuilder.java (original)
+++ geronimo/server/trunk/modules/geronimo-jetty-builder/src/main/java/org/apache/geronimo/jetty/deployment/JettyModuleBuilder.java Thu Nov 16 14:14:54 2006
@@ -91,6 +91,7 @@
 import org.apache.geronimo.xbeans.geronimo.web.jetty.JettyWebAppDocument;
 import org.apache.geronimo.xbeans.geronimo.web.jetty.JettyWebAppType;
 import org.apache.geronimo.xbeans.geronimo.web.jetty.config.GerJettyDocument;
+import org.apache.geronimo.xbeans.geronimo.j2ee.GerClusteringDocument;
 import org.apache.geronimo.xbeans.j2ee.DispatcherType;
 import org.apache.geronimo.xbeans.j2ee.ErrorPageType;
 import org.apache.geronimo.xbeans.j2ee.FilterMappingType;
@@ -161,7 +162,7 @@
         this.defaultFilterMappings = defaultFilterMappings;
         this.pojoWebServiceTemplate = getGBeanData(kernel, pojoWebServiceTemplate);
         this.webServiceBuilder = new SingleElementCollection(webServiceBuilder);
-        this.clusteringBuilders = new NamespaceDrivenBuilderCollection(clusteringBuilders);
+        this.clusteringBuilders = new NamespaceDrivenBuilderCollection(clusteringBuilders, GerClusteringDocument.type.getDocumentElementName());
 
         //todo locale mappings
 
@@ -198,6 +199,7 @@
             specDD = DeploymentUtil.readAll(specDDUrl);
         } catch (Exception e) {
             //no web.xml, not for us
+            e.printStackTrace();
             return null;
         }
         //we found web.xml, if it won't parse that's an error.

Modified: geronimo/server/trunk/modules/geronimo-naming-builder/src/main/java/org/apache/geronimo/naming/deployment/AbstractNamingBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-naming-builder/src/main/java/org/apache/geronimo/naming/deployment/AbstractNamingBuilder.java?view=diff&rev=475947&r1=475946&r2=475947
==============================================================================
--- geronimo/server/trunk/modules/geronimo-naming-builder/src/main/java/org/apache/geronimo/naming/deployment/AbstractNamingBuilder.java (original)
+++ geronimo/server/trunk/modules/geronimo-naming-builder/src/main/java/org/apache/geronimo/naming/deployment/AbstractNamingBuilder.java Thu Nov 16 14:14:54 2006
@@ -29,6 +29,7 @@
 
 import org.apache.geronimo.common.DeploymentException;
 import org.apache.geronimo.deployment.service.EnvironmentBuilder;
+import org.apache.geronimo.deployment.xmlbeans.XmlBeansUtil;
 import org.apache.geronimo.gbean.AbstractName;
 import org.apache.geronimo.gbean.AbstractNameQuery;
 import org.apache.geronimo.j2ee.deployment.Module;
@@ -41,6 +42,7 @@
 import org.apache.xmlbeans.QNameSet;
 import org.apache.xmlbeans.SchemaType;
 import org.apache.xmlbeans.XmlObject;
+import org.apache.xmlbeans.XmlException;
 
 /**
  * @version $Rev$ $Date$
@@ -92,7 +94,7 @@
         return QNameSet.forSets(null, Collections.EMPTY_SET, Collections.EMPTY_SET, qnames);
     }
 
-    protected XmlObject[] convert(XmlObject[] xmlObjects, NamespaceElementConverter converter, SchemaType type) {
+    protected XmlObject[] convert(XmlObject[] xmlObjects, NamespaceElementConverter converter, SchemaType type) throws DeploymentException {
         //bizarre ArrayStoreException if xmlObjects is loaded by the wrong classloader
         XmlObject[] converted = new XmlObject[xmlObjects.length];
         for (int i = 0; i < xmlObjects.length; i++) {
@@ -103,6 +105,11 @@
                 converted[i] = xmlObject.changeType(type);
             } else {
                 converted[i] = xmlObject;
+            }
+            try {
+                XmlBeansUtil.validateDD(converted[i]);
+            } catch (XmlException e) {
+                throw new DeploymentException("Could not validate xmlObject of type " + type, e);
             }
         }
         return converted;

Modified: geronimo/server/trunk/modules/geronimo-naming-builder/src/main/java/org/apache/geronimo/naming/deployment/ResourceEnvironmentSetter.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-naming-builder/src/main/java/org/apache/geronimo/naming/deployment/ResourceEnvironmentSetter.java?view=diff&rev=475947&r1=475946&r2=475947
==============================================================================
--- geronimo/server/trunk/modules/geronimo-naming-builder/src/main/java/org/apache/geronimo/naming/deployment/ResourceEnvironmentSetter.java (original)
+++ geronimo/server/trunk/modules/geronimo-naming-builder/src/main/java/org/apache/geronimo/naming/deployment/ResourceEnvironmentSetter.java Thu Nov 16 14:14:54 2006
@@ -22,12 +22,13 @@
 
 import org.apache.xmlbeans.XmlObject;
 import org.apache.geronimo.xbeans.geronimo.naming.GerResourceRefType;
+import org.apache.geronimo.common.DeploymentException;
 
 /**
- * @version $Rev:$ $Date:$
+ * @version $Rev$ $Date$
  */
 public interface ResourceEnvironmentSetter {
 
-    void setResourceEnvironment(ResourceEnvironmentBuilder builder, XmlObject[] resourceRefs, GerResourceRefType[] gerResourceRefs);
+    void setResourceEnvironment(ResourceEnvironmentBuilder builder, XmlObject[] resourceRefs, GerResourceRefType[] gerResourceRefs) throws DeploymentException;
 
 }

Modified: geronimo/server/trunk/modules/geronimo-persistence-jpa10-builder/src/main/java/org/apache/geronimo/persistence/builder/PersistenceUnitBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-persistence-jpa10-builder/src/main/java/org/apache/geronimo/persistence/builder/PersistenceUnitBuilder.java?view=diff&rev=475947&r1=475946&r2=475947
==============================================================================
--- geronimo/server/trunk/modules/geronimo-persistence-jpa10-builder/src/main/java/org/apache/geronimo/persistence/builder/PersistenceUnitBuilder.java (original)
+++ geronimo/server/trunk/modules/geronimo-persistence-jpa10-builder/src/main/java/org/apache/geronimo/persistence/builder/PersistenceUnitBuilder.java Thu Nov 16 14:14:54 2006
@@ -165,9 +165,12 @@
         }
     }
 
-    public String getNamespace() {
-        XmlBeansUtil.registerSubstitutionGroupElements(ServiceDocument.type.getDocumentElementName(), QNameSet.singleton(PERSISTENCE_QNAME));
-        return PERSISTENCE_QNAME.getNamespaceURI();
+    public QNameSet getSpecQNameSet() {
+        return QNameSet.EMPTY;
+    }
+
+    public QNameSet getPlanQNameSet() {
+        return QNameSet.singleton(PERSISTENCE_QNAME);
     }
 
     public static final GBeanInfo GBEAN_INFO;

Modified: geronimo/server/trunk/modules/geronimo-security-builder/src/main/java/org/apache/geronimo/security/deployment/GeronimoSecurityBuilderImpl.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-security-builder/src/main/java/org/apache/geronimo/security/deployment/GeronimoSecurityBuilderImpl.java?view=diff&rev=475947&r1=475946&r2=475947
==============================================================================
--- geronimo/server/trunk/modules/geronimo-security-builder/src/main/java/org/apache/geronimo/security/deployment/GeronimoSecurityBuilderImpl.java (original)
+++ geronimo/server/trunk/modules/geronimo-security-builder/src/main/java/org/apache/geronimo/security/deployment/GeronimoSecurityBuilderImpl.java Thu Nov 16 14:14:54 2006
@@ -30,6 +30,7 @@
 
 import org.apache.xmlbeans.XmlObject;
 import org.apache.xmlbeans.QNameSet;
+import org.apache.xmlbeans.XmlException;
 import org.apache.geronimo.deployment.DeploymentContext;
 import org.apache.geronimo.deployment.xmlbeans.XmlBeansUtil;
 import org.apache.geronimo.common.DeploymentException;
@@ -83,13 +84,18 @@
             throw new DeploymentException("Unexpected count of security elements in geronimo plan " + items.length + " qnameset: " + SECURITY_QNAME_SET);
         }
         if (items.length == 1) {
-            GerSecurityType securityType = (GerSecurityType) items[0].copy().changeType(GerSecurityType.type);
+            GerSecurityType securityType;
+            try {
+                securityType = (GerSecurityType) XmlBeansUtil.typedCopy(items[0], GerSecurityType.type);
+            } catch (XmlException e) {
+                throw new DeploymentException("Could not validate security element", e);
+            }
             Security security = buildSecurityConfig(securityType);
             ClassLoader classLoader = applicationContext.getClassLoader();
             SecurityConfiguration securityConfiguration = buildSecurityConfiguration(security, classLoader);
             earContext.setSecurityConfiguration(securityConfiguration);
         }
-        //add the JACC gbean if there is a principal-role mapping and we are on the corect module
+        //add the JACC gbean if there is a principal-role mapping and we are on the correct module
         if (earContext.getSecurityConfiguration() != null && applicationContext == moduleContext) {
             Naming naming = earContext.getNaming();
             GBeanData roleMapperData = configureRoleMapper(naming, earContext.getModuleName(), earContext.getSecurityConfiguration());
@@ -109,12 +115,6 @@
         }
     }
 
-    public String getNamespace() {
-        XmlBeansUtil.registerSubstitutionGroupElements(org.apache.geronimo.xbeans.geronimo.j2ee.GerSecurityDocument.type.getDocumentElementName(), SECURITY_QNAME_SET);
-
-        return GerSecurityDocument.type.getDocumentElementName().getLocalPart();
-    }
-
     private static SecurityConfiguration buildSecurityConfiguration(Security security, ClassLoader classLoader) {
         Map roleDesignates = new HashMap();
         Map principalRoleMap = new HashMap();
@@ -317,6 +317,14 @@
 
     }
 
+    public QNameSet getSpecQNameSet() {
+        return QNameSet.EMPTY;
+    }
+
+    public QNameSet getPlanQNameSet() {
+        return SECURITY_QNAME_SET;
+    }
+
     public static final GBeanInfo GBEAN_INFO;
 
     static {
@@ -331,6 +339,5 @@
     public static GBeanInfo getGBeanInfo() {
         return GBEAN_INFO;
     }
-
 
 }

Modified: geronimo/server/trunk/modules/geronimo-service-builder/src/main/java/org/apache/geronimo/deployment/service/GBeanBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-service-builder/src/main/java/org/apache/geronimo/deployment/service/GBeanBuilder.java?view=diff&rev=475947&r1=475946&r2=475947
==============================================================================
--- geronimo/server/trunk/modules/geronimo-service-builder/src/main/java/org/apache/geronimo/deployment/service/GBeanBuilder.java (original)
+++ geronimo/server/trunk/modules/geronimo-service-builder/src/main/java/org/apache/geronimo/deployment/service/GBeanBuilder.java Thu Nov 16 14:14:54 2006
@@ -18,37 +18,35 @@
 
 package org.apache.geronimo.deployment.service;
 
-import java.util.Map;
-import java.util.HashMap;
-import java.util.Collection;
 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.deployment.NamespaceDrivenBuilder;
+import org.apache.geronimo.common.DeploymentException;
 import org.apache.geronimo.deployment.DeploymentContext;
-import org.apache.geronimo.deployment.ConfigurationBuilder;
-import org.apache.geronimo.deployment.xbeans.GbeanType;
+import org.apache.geronimo.deployment.NamespaceDrivenBuilder;
 import org.apache.geronimo.deployment.xbeans.AttributeType;
-import org.apache.geronimo.deployment.xbeans.XmlAttributeType;
+import org.apache.geronimo.deployment.xbeans.GbeanDocument;
+import org.apache.geronimo.deployment.xbeans.GbeanType;
+import org.apache.geronimo.deployment.xbeans.PatternType;
 import org.apache.geronimo.deployment.xbeans.ReferenceType;
 import org.apache.geronimo.deployment.xbeans.ReferencesType;
-import org.apache.geronimo.deployment.xbeans.PatternType;
 import org.apache.geronimo.deployment.xbeans.ServiceDocument;
-import org.apache.geronimo.deployment.xbeans.GbeanDocument;
+import org.apache.geronimo.deployment.xbeans.XmlAttributeType;
 import org.apache.geronimo.deployment.xmlbeans.XmlBeansUtil;
-import org.apache.geronimo.common.DeploymentException;
 import org.apache.geronimo.gbean.AbstractName;
-import org.apache.geronimo.gbean.GBeanInfo;
 import org.apache.geronimo.gbean.GBeanData;
-import org.apache.geronimo.gbean.ReferenceMap;
+import org.apache.geronimo.gbean.GBeanInfo;
 import org.apache.geronimo.gbean.GBeanInfoBuilder;
+import org.apache.geronimo.gbean.ReferenceMap;
 import org.apache.geronimo.kernel.GBeanAlreadyExistsException;
-import org.apache.geronimo.kernel.Kernel;
 import org.apache.geronimo.kernel.repository.Environment;
-import org.apache.geronimo.kernel.repository.Repository;
-import org.apache.xmlbeans.XmlObject;
 import org.apache.xmlbeans.QNameSet;
+import org.apache.xmlbeans.XmlException;
+import org.apache.xmlbeans.XmlObject;
 
 /**
  * @version $Rev$ $Date$
@@ -56,7 +54,7 @@
 public class GBeanBuilder implements NamespaceDrivenBuilder {
     protected Map attrRefMap;
     protected Map refRefMap;
-    private static final QName SERVICE_QNAME = ServiceDocument.type.getDocumentElementName();
+    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);
 
@@ -91,21 +89,17 @@
 
     public void build(XmlObject container, DeploymentContext applicationContext, DeploymentContext moduleContext) throws DeploymentException {
         XmlObject[] items = container.selectChildren(GBEAN_QNAME_SET);
-        GbeanType[] gbeans = new GbeanType[items.length];
         for (int i = 0; i < items.length; i++) {
-            XmlObject any = items[i];
-            gbeans[i] = (GbeanType) any.copy().changeType(GbeanType.type);
-        }
-        for (int i1 = 0; i1 < gbeans.length; i1++) {
-            addGBeanData(gbeans[i1], moduleContext.getModuleName(), moduleContext.getClassLoader(), moduleContext);
+            GbeanType gbean;
+            try {
+                gbean = (GbeanType) XmlBeansUtil.typedCopy(items[i], GbeanType.type);
+            } catch (XmlException e) {
+                throw new DeploymentException("Could not validate gbean xml", e);
+            }
+            addGBeanData(gbean, moduleContext.getModuleName(), moduleContext.getClassLoader(), moduleContext);
         }
     }
 
-    public String getNamespace() {
-        XmlBeansUtil.registerSubstitutionGroupElements(SERVICE_QNAME, QNameSet.singleton(GBEAN_QNAME));
-        return GBEAN_QNAME.getLocalPart();
-    }
-
     private AbstractName addGBeanData(GbeanType gbean, AbstractName moduleName, ClassLoader cl, DeploymentContext context) throws DeploymentException {
         GBeanInfo gBeanInfo = GBeanInfo.getGBeanInfo(gbean.getClass1(), cl);
         String namePart = gbean.getName();
@@ -178,6 +172,14 @@
             throw new DeploymentException(e);
         }
         return abstractName;
+    }
+
+    public QNameSet getSpecQNameSet() {
+        return QNameSet.EMPTY;
+    }
+
+    public QNameSet getPlanQNameSet() {
+        return GBEAN_QNAME_SET;
     }
 
     public static final GBeanInfo GBEAN_INFO;

Modified: geronimo/server/trunk/modules/geronimo-service-builder/src/main/java/org/apache/geronimo/deployment/service/ServiceConfigBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-service-builder/src/main/java/org/apache/geronimo/deployment/service/ServiceConfigBuilder.java?view=diff&rev=475947&r1=475946&r2=475947
==============================================================================
--- geronimo/server/trunk/modules/geronimo-service-builder/src/main/java/org/apache/geronimo/deployment/service/ServiceConfigBuilder.java (original)
+++ geronimo/server/trunk/modules/geronimo-service-builder/src/main/java/org/apache/geronimo/deployment/service/ServiceConfigBuilder.java Thu Nov 16 14:14:54 2006
@@ -94,7 +94,7 @@
         this.defaultEnvironment = defaultEnvironment;
 
         this.repositories = repositories;
-        this.serviceBuilders = new NamespaceDrivenBuilderCollection(serviceBuilders);
+        this.serviceBuilders = new NamespaceDrivenBuilderCollection(serviceBuilders, GBeanBuilder.SERVICE_QNAME);
     }
 
     public Object getDeploymentPlan(File planFile, JarFile jarFile, ModuleIDBuilder idBuilder) throws DeploymentException {

Modified: geronimo/server/trunk/modules/geronimo-web-builder/src/main/java/org/apache/geronimo/web/deployment/AbstractWebModuleBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-web-builder/src/main/java/org/apache/geronimo/web/deployment/AbstractWebModuleBuilder.java?view=diff&rev=475947&r1=475946&r2=475947
==============================================================================
--- geronimo/server/trunk/modules/geronimo-web-builder/src/main/java/org/apache/geronimo/web/deployment/AbstractWebModuleBuilder.java (original)
+++ geronimo/server/trunk/modules/geronimo-web-builder/src/main/java/org/apache/geronimo/web/deployment/AbstractWebModuleBuilder.java Thu Nov 16 14:14:54 2006
@@ -50,6 +50,7 @@
 import org.apache.geronimo.deployment.util.DeploymentUtil;
 import org.apache.geronimo.deployment.ModuleIDBuilder;
 import org.apache.geronimo.deployment.NamespaceDrivenBuilderCollection;
+import org.apache.geronimo.deployment.service.GBeanBuilder;
 import org.apache.geronimo.deployment.xmlbeans.XmlBeansUtil;
 import org.apache.geronimo.deployment.xbeans.ServiceDocument;
 import org.apache.geronimo.gbean.AbstractName;
@@ -120,8 +121,8 @@
 
     protected AbstractWebModuleBuilder(Kernel kernel, Collection securityBuilders, Collection serviceBuilders, NamingBuilder namingBuilders, ResourceEnvironmentSetter resourceEnvironmentSetter) {
         this.kernel = kernel;
-        this.securityBuilders = new NamespaceDrivenBuilderCollection(securityBuilders);
-        this.serviceBuilders = new NamespaceDrivenBuilderCollection(serviceBuilders);
+        this.securityBuilders = new NamespaceDrivenBuilderCollection(securityBuilders, GerSecurityDocument.type.getDocumentElementName());
+        this.serviceBuilders = new NamespaceDrivenBuilderCollection(serviceBuilders, GBeanBuilder.SERVICE_QNAME);
         this.namingBuilders = namingBuilders;
         this.resourceEnvironmentSetter = resourceEnvironmentSetter;
     }



Mime
View raw message