geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r519834 - in /geronimo/server/trunk/modules: geronimo-connector-builder/src/main/java/org/apache/geronimo/connector/deployment/ geronimo-jetty6-builder/src/main/java/org/apache/geronimo/jetty6/deployment/ geronimo-kernel/src/main/java/org/a...
Date Mon, 19 Mar 2007 04:32:07 GMT
Author: djencks
Date: Sun Mar 18 21:32:05 2007
New Revision: 519834

URL: http://svn.apache.org/viewvc?view=rev&rev=519834
Log:
GERONIMO-2982 Prepend  / to path url patterns in servlet mappings if missing.  Also some much bigger changes to improve info in exception messages and some genericization

Modified:
    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-jetty6-builder/src/main/java/org/apache/geronimo/jetty6/deployment/JettyModuleBuilder.java
    geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/gbean/GBeanInfo.java
    geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/GBeanNotFoundException.java
    geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/basic/BasicRegistry.java
    geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/Configuration.java
    geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/repository/Environment.java
    geronimo/server/trunk/modules/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/AbstractWebModuleBuilder.java

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=519834&r1=519833&r2=519834
==============================================================================
--- 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 Sun Mar 18 21:32:05 2007
@@ -31,6 +31,7 @@
 import java.util.HashSet;
 import java.util.Iterator;
 import java.util.LinkedHashMap;
+import java.util.List;
 import java.util.Map;
 import java.util.Set;
 import java.util.TreeMap;
@@ -80,12 +81,12 @@
 import org.apache.geronimo.gbean.GBeanInfo;
 import org.apache.geronimo.gbean.GBeanInfoBuilder;
 import org.apache.geronimo.gbean.InvalidConfigurationException;
-import org.apache.geronimo.j2ee.deployment.annotation.AnnotatedApp;
 import org.apache.geronimo.j2ee.deployment.ActivationSpecInfoLocator;
 import org.apache.geronimo.j2ee.deployment.ConnectorModule;
 import org.apache.geronimo.j2ee.deployment.EARContext;
 import org.apache.geronimo.j2ee.deployment.Module;
 import org.apache.geronimo.j2ee.deployment.ModuleBuilder;
+import org.apache.geronimo.j2ee.deployment.annotation.AnnotatedApp;
 import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
 import org.apache.geronimo.kernel.GBeanAlreadyExistsException;
 import org.apache.geronimo.kernel.GBeanNotFoundException;
@@ -171,9 +172,9 @@
     }
 
     private Module createModule(Object plan, JarFile moduleFile, String targetPath, URL specDDUrl, Environment earEnvironment, AbstractName earName, Naming naming, ModuleIDBuilder idBuilder) throws DeploymentException {
-        assert moduleFile != null: "moduleFile is null";
-        assert targetPath != null: "targetPath is null";
-        assert !targetPath.endsWith("/"): "targetPath must not end with a '/'";
+        assert moduleFile != null : "moduleFile is null";
+        assert targetPath != null : "targetPath is null";
+        assert !targetPath.endsWith("/") : "targetPath must not end with a '/'";
 
         String specDD;
         XmlObject connector;
@@ -420,7 +421,7 @@
             resourceAdapterGBeanData.setAttribute("resourceAdapterClass", resourceadapter.getResourceadapterClass().getStringValue().trim());
 
             // Add map from messageListenerInterface to activationSpec class
-            Map<String,String> messageListenerToActivationSpecMap = new TreeMap<String,String>();
+            Map<String, String> messageListenerToActivationSpecMap = new TreeMap<String, String>();
             if (resourceadapter.isSetInboundResourceadapter() && resourceadapter.getInboundResourceadapter().isSetMessageadapter()) {
                 for (MessagelistenerType messagelistenerType : resourceadapter.getInboundResourceadapter().getMessageadapter().getMessagelistenerArray()) {
                     String messageListenerInterface = messagelistenerType.getMessagelistenerType().getStringValue().trim();
@@ -434,8 +435,7 @@
             resourceAdapterModuleData.setAttribute("resourceAdapterGBeanData", resourceAdapterGBeanData);
         }
 
-        if (resourceadapter.isSetInboundResourceadapter() && resourceadapter.getInboundResourceadapter().isSetMessageadapter())
-        {
+        if (resourceadapter.isSetInboundResourceadapter() && resourceadapter.getInboundResourceadapter().isSetMessageadapter()) {
             Map activationSpecInfoMap = getActivationSpecInfoMap(resourceadapter.getInboundResourceadapter().getMessageadapter().getMessagelistenerArray(), cl);
             resourceAdapterModuleData.setAttribute("activationSpecInfoMap", activationSpecInfoMap);
         }
@@ -534,7 +534,7 @@
                 for (int i = 0; i < geronimoResourceAdapter.getOutboundResourceadapter().getConnectionDefinitionArray().length; i++)
                 {
                     GerConnectionDefinitionType geronimoConnectionDefinition = geronimoResourceAdapter.getOutboundResourceadapter().getConnectionDefinitionArray(i);
-                    assert geronimoConnectionDefinition != null: "Null GeronimoConnectionDefinition";
+                    assert geronimoConnectionDefinition != null : "Null GeronimoConnectionDefinition";
 
                     String connectionFactoryInterfaceName = geronimoConnectionDefinition.getConnectionfactoryInterface().trim();
                     GBeanData connectionFactoryGBeanData = locateConnectionFactoryInfo(resourceAdapterModuleData, connectionFactoryInterfaceName);
@@ -580,6 +580,7 @@
             }
         }
     }
+
     private Map getActivationSpecInfoMap(MessagelistenerType[] messagelistenerArray, ClassLoader cl) throws DeploymentException {
         Map activationSpecInfos = new HashMap();
         for (int i = 0; i < messagelistenerArray.length; i++) {
@@ -602,8 +603,7 @@
             for (int j = 0; j < methods.length; j++) {
                 Method method = methods[j];
                 String methodName = method.getName();
-                if ((methodName.startsWith("get") || methodName.startsWith("is")) && method.getParameterTypes().length == 0)
-                {
+                if ((methodName.startsWith("get") || methodName.startsWith("is")) && method.getParameterTypes().length == 0) {
                     String attributeName = (methodName.startsWith("get")) ? methodName.substring(3) : methodName.substring(2);
                     getters.put(Introspector.decapitalize(attributeName), method.getReturnType().getName());
                 } else if (methodName.startsWith("set") && method.getParameterTypes().length == 1) {
@@ -689,22 +689,25 @@
     }
 
     private void setDynamicGBeanDataAttributes(GBeanData gbeanData, GerConfigPropertySettingType[] configProperties, ClassLoader cl) throws DeploymentException {
-
-        try {
-            for (int i = 0; i < configProperties.length; i++) {
-                String name = configProperties[i].getName();
-                GAttributeInfo attributeInfo = gbeanData.getGBeanInfo().getAttribute(name);
-                if (attributeInfo == null) {
-                    throw new DeploymentException("The plan is trying to set attribute: " + name + " which does not exist.  Known attributs are: " + gbeanData.getGBeanInfo().getAttributes());
-                }
+        List<String> unknownNames = new ArrayList<String>();
+        for (GerConfigPropertySettingType configProperty : configProperties) {
+            String name = configProperty.getName();
+            GAttributeInfo attributeInfo = gbeanData.getGBeanInfo().getAttribute(name);
+            if (attributeInfo == null) {
+                unknownNames.add(name);
+//                    throw new DeploymentException("The plan is trying to set attribute: " + name + " which does not exist.  Known attributes are: " + gbeanData.getGBeanInfo().getAttributes());
+            } else {
                 String type = attributeInfo.getType();
-                gbeanData.setAttribute(name,
-                        getValue(type, configProperties[i].getStringValue().trim(), cl));
+                gbeanData.setAttribute(name, getValue(type, configProperty.getStringValue().trim(), cl));
             }
-        } catch (DeploymentException e) {
-            throw e;
-        } catch (Exception e) {
-            throw new DeploymentException(e);
+        }
+        if (unknownNames.size() > 0) {
+            StringBuffer buf = new StringBuffer("The plan is trying to set attributes: ").append(unknownNames).append("\n");
+            buf.append("Known attributes: \n");
+            for (GAttributeInfo attributeInfo: gbeanData.getGBeanInfo().getAttributes()) {
+                buf.append(attributeInfo).append("\n");
+            }
+            throw new DeploymentException(buf.toString());
         }
     }
 
@@ -849,9 +852,9 @@
         Object driver = managedConnectionFactoryInstanceGBeanData.getAttribute("Driver");
         if (driver != null && driver instanceof String) {
             try {
-                cl.loadClass((String)driver);
+                cl.loadClass((String) driver);
             } catch (ClassNotFoundException e1) {
-                log.warn("Problem loading driver class '"+driver+"', possibly due to a missing dependency on the driver jar!!", e1);
+                log.warn("Problem loading driver class '" + driver + "', possibly due to a missing dependency on the driver jar!!", e1);
             }
         }
 

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=519834&r1=519833&r2=519834
==============================================================================
--- 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 Sun Mar 18 21:32:05 2007
@@ -35,7 +35,7 @@
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.geronimo.common.DeploymentException;
-import org.apache.geronimo.common.UnresolvedReferenceException;
+import org.apache.geronimo.gbean.AbstractName;
 import org.apache.geronimo.gbean.AbstractNameQuery;
 import org.apache.geronimo.gbean.GBeanInfo;
 import org.apache.geronimo.gbean.GBeanInfoBuilder;
@@ -46,6 +46,7 @@
 import org.apache.geronimo.kernel.GBeanNotFoundException;
 import org.apache.geronimo.kernel.config.Configuration;
 import org.apache.geronimo.kernel.repository.Environment;
+import org.apache.geronimo.kernel.repository.Dependency;
 import org.apache.geronimo.naming.deployment.AbstractNamingBuilder;
 import org.apache.geronimo.naming.deployment.ResourceEnvironmentBuilder;
 import org.apache.geronimo.naming.deployment.ResourceEnvironmentSetter;
@@ -144,21 +145,20 @@
                 try {
                     AbstractNameQuery containerId = getResourceContainerId(name, j2eeType, null, gerResourceRef);
 
-                    try {
-                        localConfiguration.findGBean(containerId);
-                    } catch (GBeanNotFoundException e) {
-                        throw new UnresolvedReferenceException("Resource", false, containerId.toString(), localConfiguration.getId().toString());
-                    }
+                    localConfiguration.findGBean(containerId);
 
                     Reference ref = new ResourceReference(localConfiguration.getId(), containerId, iface);
                     getJndiContextMap(componentContext).put(ENV + name, ref);
-                } catch (UnresolvedReferenceException e) {
+                } catch (GBeanNotFoundException e) {
 
                     StringBuffer errorMessage = new StringBuffer("Unable to resolve resource reference '");
                     errorMessage.append(name);
                     errorMessage.append("' (");
-                    if (e.isMultiple()) {
-                        errorMessage.append("Found multiple matching resources.  Try being more specific in a resource-ref mapping in your Geronimo deployment plan.");
+                    if (e.hasMatches()) {
+                        errorMessage.append("Found multiple matching resources.  Try being more specific in a resource-ref mapping in your Geronimo deployment plan.\n");
+                        for (AbstractName match : e.getMatches()) {
+                            errorMessage.append(match).append("\n");
+                        }
                     } else if (gerResourceRef == null) {
                         errorMessage.append("Could not auto-map to resource.  Try adding a resource-ref mapping to your Geronimo deployment plan.");
                     } else if (gerResourceRef.isSetResourceLink()) {
@@ -168,6 +168,10 @@
                     } else {
                         errorMessage.append("Could not find the resource specified in your Geronimo deployment plan:");
                         errorMessage.append(gerResourceRef.getPattern());
+                    }
+                    errorMessage.append("\nSearch conducted in current module and dependencies:\n");
+                    for (Dependency dependency: localConfiguration.getEnvironment().getDependencies()) {
+                        errorMessage.append(dependency).append("\n");
                     }
                     errorMessage.append(")");
 

Modified: geronimo/server/trunk/modules/geronimo-jetty6-builder/src/main/java/org/apache/geronimo/jetty6/deployment/JettyModuleBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-jetty6-builder/src/main/java/org/apache/geronimo/jetty6/deployment/JettyModuleBuilder.java?view=diff&rev=519834&r1=519833&r2=519834
==============================================================================
--- geronimo/server/trunk/modules/geronimo-jetty6-builder/src/main/java/org/apache/geronimo/jetty6/deployment/JettyModuleBuilder.java (original)
+++ geronimo/server/trunk/modules/geronimo-jetty6-builder/src/main/java/org/apache/geronimo/jetty6/deployment/JettyModuleBuilder.java Sun Mar 18 21:32:05 2007
@@ -20,6 +20,8 @@
 import java.io.File;
 import java.io.FileNotFoundException;
 import java.io.IOException;
+import static java.lang.Boolean.FALSE;
+import static java.lang.Boolean.TRUE;
 import java.net.URL;
 import java.security.Permission;
 import java.security.PermissionCollection;
@@ -32,14 +34,12 @@
 import java.util.Enumeration;
 import java.util.HashMap;
 import java.util.HashSet;
-import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
 import java.util.TreeSet;
 import java.util.concurrent.atomic.AtomicBoolean;
 import java.util.jar.JarFile;
-import static java.lang.Boolean.*;
 
 import javax.management.ObjectName;
 import javax.servlet.Servlet;
@@ -59,7 +59,6 @@
 import org.apache.geronimo.gbean.GBeanData;
 import org.apache.geronimo.gbean.GBeanInfo;
 import org.apache.geronimo.gbean.GBeanInfoBuilder;
-import org.apache.geronimo.j2ee.annotation.Holder;
 import org.apache.geronimo.j2ee.deployment.EARContext;
 import org.apache.geronimo.j2ee.deployment.Module;
 import org.apache.geronimo.j2ee.deployment.ModuleBuilder;
@@ -80,7 +79,6 @@
 import org.apache.geronimo.kernel.GBeanNotFoundException;
 import org.apache.geronimo.kernel.Kernel;
 import org.apache.geronimo.kernel.Naming;
-import org.apache.geronimo.kernel.config.Configuration;
 import org.apache.geronimo.kernel.config.ConfigurationData;
 import org.apache.geronimo.kernel.repository.Environment;
 import org.apache.geronimo.naming.deployment.ENCConfigBuilder;
@@ -136,7 +134,7 @@
 
     protected final NamespaceDrivenBuilderCollection clusteringBuilders;
 
-    private final List defaultWelcomeFiles;
+    private final List<String> defaultWelcomeFiles;
     private final Integer defaultSessionTimeoutSeconds;
 
     private static final String JETTY_NAMESPACE = JettyWebAppDocument.type.getDocumentElementName().getNamespaceURI();
@@ -144,13 +142,13 @@
 
     public JettyModuleBuilder(Environment defaultEnvironment,
             Integer defaultSessionTimeoutSeconds,
-            List defaultWelcomeFiles,
+            List<String> defaultWelcomeFiles,
             AbstractNameQuery jettyContainerName,
             String jspServletClassName, Collection defaultServlets,
             Collection defaultFilters,
             Collection defaultFilterMappings,
             Object pojoWebServiceTemplate,
-            Collection webServiceBuilder,
+            Collection<WebServiceBuilder> webServiceBuilder,
             Collection clusteringBuilders,
             Collection securityBuilders,
             Collection serviceBuilders,
@@ -160,7 +158,7 @@
             Kernel kernel) throws GBeanNotFoundException {
         super(kernel, securityBuilders, serviceBuilders, namingBuilders, resourceEnvironmentSetter, webServiceBuilder, moduleBuilderExtensions);
         this.defaultEnvironment = defaultEnvironment;
-        this.defaultSessionTimeoutSeconds = (defaultSessionTimeoutSeconds == null) ? new Integer(30 * 60) : defaultSessionTimeoutSeconds;
+        this.defaultSessionTimeoutSeconds = (defaultSessionTimeoutSeconds == null) ? 30 * 60 : defaultSessionTimeoutSeconds;
         this.jettyContainerObjectName = jettyContainerName;
         this.jspServletClassName = jspServletClassName;
         this.defaultServlets = defaultServlets;
@@ -328,63 +326,30 @@
 
     public void addGBeans(EARContext earContext, Module module, ClassLoader cl, Collection repository) throws DeploymentException {
         EARContext moduleContext = module.getEarContext();
-        ClassLoader moduleClassLoader = moduleContext.getClassLoader();
         AbstractName moduleName = moduleContext.getModuleName();
         WebModule webModule = (WebModule) module;
 
         WebAppType webApp = (WebAppType) webModule.getSpecDD();
-        JettyWebAppType jettyWebApp = (JettyWebAppType) webModule.getVendorDD();
-
-        //N.B. we use the ear context which has all the gbeans we could possibly be looking up from this ear.
-        Map buildingContext = new HashMap();
-        buildingContext.put(NamingBuilder.GBEAN_NAME_KEY, moduleName);
-        Configuration earConfiguration = earContext.getConfiguration();
-
-        if (!webApp.getMetadataComplete()) {
-            // Create a classfinder and populate it for the naming builder(s). The absence of a
-            // classFinder in the module will convey whether metadata-complete is set (or not)
-            webModule.setClassFinder(createWebAppClassFinder(webApp, webModule));
-        }
-
-        getNamingBuilders().buildNaming(webApp, jettyWebApp, earConfiguration, earConfiguration, webModule, buildingContext);
-
-        Map compContext = NamingBuilder.JNDI_KEY.get(buildingContext);
-        Holder holder = NamingBuilder.INJECTION_KEY.get(buildingContext);
-
+        JettyWebAppType jettyWebApp = (JettyWebAppType)webModule.getVendorDD();
         GBeanData webModuleData = new GBeanData(moduleName, JettyWebAppContext.GBEAN_INFO);
-        webModule.getSharedContext().put(WebModule.WEB_APP_DATA, webModuleData);
-        try {
-            moduleContext.addGBean(webModuleData);
-            if (moduleContext.getServerName() != null) {
-                webModuleData.setReferencePattern("J2EEServer", moduleContext.getServerName());
-            }
-            if (!module.isStandAlone()) {
-                webModuleData.setReferencePattern("J2EEApplication", earContext.getModuleName());
-            }
 
-            webModuleData.setAttribute("holder", holder);
+        configureBasicWebModuleAttributes(webApp, jettyWebApp, moduleContext, earContext, webModule, webModuleData);
 
-            webModuleData.setAttribute("deploymentDescriptor", module.getOriginalSpecDD());
-            Set securityRoles = collectRoleNames(webApp);
-            Map rolePermissions = new HashMap();
+        // unsharableResources, applicationManagedSecurityResources
+         GBeanResourceEnvironmentBuilder rebuilder = new GBeanResourceEnvironmentBuilder(webModuleData);
+         //N.B. use earContext not moduleContext
+         //TODO fix this for javaee 5 !!!
+         resourceEnvironmentSetter.setResourceEnvironment(rebuilder, webApp.getResourceRefArray(), jettyWebApp.getResourceRefArray());
+         try {
+            moduleContext.addGBean(webModuleData);
+            Set<String> securityRoles = collectRoleNames(webApp);
+            Map<String, PermissionCollection> rolePermissions = new HashMap<String, PermissionCollection>();
 
             // configure hosts and virtual-hosts
             configureHosts(earContext, jettyWebApp, webModuleData);
 
-            //Add dependencies on managed connection factories and ejbs in this app
-            //This is overkill, but allows for people not using java:comp context (even though we don't support it)
-            //and sidesteps the problem of circular references between ejbs.
-            Set dependencies = findGBeanDependencies(earContext);
-            webModuleData.addDependencies(dependencies);
-
-            webModuleData.setAttribute("componentContext", compContext);
             //classpath may have been augmented with enhanced classes
 //            webModuleData.setAttribute("webClassPath", webModule.getWebClasspath());
-            // unsharableResources, applicationManagedSecurityResources
-            GBeanResourceEnvironmentBuilder rebuilder = new GBeanResourceEnvironmentBuilder(webModuleData);
-            //N.B. use earContext not moduleContext
-            //TODO fix this for javaee 5 !!!
-            resourceEnvironmentSetter.setResourceEnvironment(rebuilder, webApp.getResourceRefArray(), jettyWebApp.getResourceRefArray());
 
             String contextPath = webModule.getContextRoot();
             if (contextPath == null) {
@@ -395,15 +360,13 @@
             }
             webModuleData.setAttribute("contextPath", contextPath);
 
-            webModuleData.setReferencePattern("TransactionManager", moduleContext.getTransactionManagerName());
-            webModuleData.setReferencePattern("TrackedConnectionAssociator", moduleContext.getConnectionTrackerName());
             if (jettyWebApp.isSetWebContainer()) {
                 AbstractNameQuery webContainerName = ENCConfigBuilder.getGBeanQuery(NameFactory.GERONIMO_SERVICE, jettyWebApp.getWebContainer());
                 webModuleData.setReferencePattern("JettyContainer", webContainerName);
             } else {
                 webModuleData.setReferencePattern("JettyContainer", jettyContainerObjectName);
             }
-            //stuff that jetty6 used to do
+            //stuff that jetty used to do
             if (webApp.getDisplayNameArray().length > 0) {
                 webModuleData.setAttribute("displayName", webApp.getDisplayNameArray()[0].getStringValue());
             }
@@ -450,8 +413,8 @@
             configureLoginConfigs(module, webApp, jettyWebApp, webModuleData);
 
             // Make sure that servlet mappings point to available servlets and never add a duplicate pattern.
-            Set knownServletMappings = new HashSet();
-            Map servletMappings = new HashMap();
+            Set<String> knownServletMappings = new HashSet<String>();
+            Map<String, Set<String>> servletMappings = new HashMap<String, Set<String>>();
 
             buildServletMappings(module, webApp, servletMappings, knownServletMappings);
 
@@ -539,7 +502,7 @@
 //        moduleContext.addGBean(beanData);
     }
 
-    private void configureSecurityRealm(EARContext earContext, WebAppType webApp, JettyWebAppType jettyWebApp, GBeanData webModuleData, Set securityRoles, Map rolePermissions) throws DeploymentException {
+    private void configureSecurityRealm(EARContext earContext, WebAppType webApp, JettyWebAppType jettyWebApp, GBeanData webModuleData, Set<String> securityRoles, Map<String, PermissionCollection> rolePermissions) throws DeploymentException {
         AbstractName moduleName = webModuleData.getAbstractName();
         if (earContext.getSecurityConfiguration() == null) {
             throw new DeploymentException("You have specified a <security-realm-name> for the webapp " + moduleName + " but no <security> configuration (role mapping) is supplied in the Geronimo plan for the web application (or the Geronimo plan for the EAR if the web app is in an EAR)");
@@ -557,8 +520,7 @@
         ComponentPermissions componentPermissions = buildSpecSecurityConfig(webApp, securityRoles, rolePermissions);
         webModuleData.setAttribute("excludedPermissions", componentPermissions.getExcludedPermissions());
         PermissionCollection checkedPermissions = new Permissions();
-        for (Iterator iterator = rolePermissions.values().iterator(); iterator.hasNext();) {
-            PermissionCollection permissionsForRole = (PermissionCollection) iterator.next();
+        for (PermissionCollection permissionsForRole : rolePermissions.values()) {
             for (Enumeration iterator2 = permissionsForRole.elements(); iterator2.hasMoreElements();) {
                 Permission permission = (Permission) iterator2.nextElement();
                 checkedPermissions.add(permission);
@@ -577,7 +539,7 @@
             AbstractName defaultServletObjectName = earContext.getNaming().createChildName(moduleName, (String) servletGBeanData.getAttribute("servletName"), NameFactory.SERVLET);
             servletGBeanData.setAbstractName(defaultServletObjectName);
             servletGBeanData.setReferencePattern("JettyServletRegistration", moduleName);
-            Set defaultServletMappings = new HashSet((Collection) servletGBeanData.getAttribute("servletMappings"));
+            Set<String> defaultServletMappings = new HashSet<String>((Collection) servletGBeanData.getAttribute("servletMappings"));
             defaultServletMappings.removeAll(knownServletMappings);
             servletGBeanData.setAttribute("servletMappings", defaultServletMappings);
             moduleContext.addGBean(servletGBeanData);
@@ -592,7 +554,7 @@
             GBeanData filterData = new GBeanData(filterAbstractName, JettyFilterHolder.GBEAN_INFO);
             filterData.setAttribute("filterName", filterName);
             filterData.setAttribute("filterClass", filterType.getFilterClass().getStringValue().trim());
-            Map initParams = new HashMap();
+            Map<String, String> initParams = new HashMap<String, String>();
             ParamValueType[] initParamArray = filterType.getInitParamArray();
             for (ParamValueType paramValueType : initParamArray) {
                 initParams.put(paramValueType.getParamName().getStringValue().trim(), paramValueType.getParamValue().getStringValue().trim());
@@ -625,7 +587,7 @@
                 filterMappingName = earContext.getNaming().createChildName(filterAbstractName, ObjectName.quote(Arrays.deepToString(urlPatterns)), NameFactory.URL_WEB_FILTER_MAPPING);
             }
             if (filterMappingType.sizeOfServletNameArray() > 0) {
-                Set servletNameSet = new HashSet();
+                Set<AbstractName> servletNameSet = new HashSet<AbstractName>();
                 for (int j = 0; j < filterMappingType.sizeOfServletNameArray(); j++) {
                     String servletName = filterMappingType.getServletNameArray(j).getStringValue().trim();
                     AbstractName abstractServletName = earContext.getNaming().createChildName(moduleName, servletName, NameFactory.SERVLET);
@@ -697,9 +659,9 @@
         return previous;
     }
 
-    private Map buildServletMappings(Module module, WebAppType webApp, Map servletMappings, Set knownServletMappings) throws DeploymentException {
+    private Map buildServletMappings(Module module, WebAppType webApp, Map<String, Set<String>> servletMappings, Set<String> knownServletMappings) throws DeploymentException {
         ServletType[] servletTypes = webApp.getServletArray();
-        Set knownServlets = new HashSet();
+        Set<String> knownServlets = new HashSet<String>();
         for (ServletType type : servletTypes) {
             knownServlets.add(type.getServletName().getStringValue().trim());
         }
@@ -713,14 +675,17 @@
                         "' but no such servlet was found!");
             }
             UrlPatternType[] urlPatterns = servletMappingType.getUrlPatternArray();
-            for (UrlPatternType urlPattern1 : urlPatterns) {
-                String urlPattern = urlPattern1.getStringValue().trim();
+            for (UrlPatternType patternType : urlPatterns) {
+                String urlPattern = patternType.getStringValue().trim();
+                if (!urlPattern.startsWith("*") && !urlPattern.startsWith("/")) {
+                    urlPattern = "/" + urlPattern;
+                }
                 if (!knownServletMappings.contains(urlPattern)) {
                     knownServletMappings.add(urlPattern);
                     checkString(urlPattern);
-                    Set urlsForServlet = (Set) servletMappings.get(servletName);
+                    Set<String> urlsForServlet = servletMappings.get(servletName);
                     if (urlsForServlet == null) {
-                        urlsForServlet = new HashSet();
+                        urlsForServlet = new HashSet<String>();
                         servletMappings.put(servletName, urlsForServlet);
                     }
                     urlsForServlet.add(urlPattern);
@@ -771,7 +736,7 @@
         if (jspConfigArray.length > 1) {
             throw new DeploymentException("Web app " + module.getName() + " cannot have more than one jsp-config element.  Currently has " + jspConfigArray.length + " jsp-config elements.");
         }
-        Map tagLibMap = new HashMap();
+        Map<String, String> tagLibMap = new HashMap<String, String>();
         for (JspConfigType aJspConfigArray : jspConfigArray) {
             TaglibType[] tagLibArray = aJspConfigArray.getTaglibArray();
             for (TaglibType taglib : tagLibArray) {
@@ -783,12 +748,12 @@
 
     private void configureErrorPages(WebAppType webApp, GBeanData webModuleData) {
         ErrorPageType[] errorPageArray = webApp.getErrorPageArray();
-        Map errorPageMap = new HashMap();
+        Map<String, String> errorPageMap = new HashMap<String, String>();
         for (ErrorPageType errorPageType : errorPageArray) {
             if (errorPageType.isSetErrorCode()) {
-                errorPageMap.put(errorPageType.getErrorCode().getStringValue(), errorPageType.getLocation().getStringValue());
+                errorPageMap.put(errorPageType.getErrorCode().getStringValue().trim(), errorPageType.getLocation().getStringValue().trim());
             } else {
-                errorPageMap.put(errorPageType.getExceptionType().getStringValue(), errorPageType.getLocation().getStringValue());
+                errorPageMap.put(errorPageType.getExceptionType().getStringValue().trim(), errorPageType.getLocation().getStringValue().trim());
             }
         }
         webModuleData.setAttribute("errorPages", errorPageMap);
@@ -796,11 +761,11 @@
 
     private void configureLocalEncodingMappingLists(WebAppType webApp, GBeanData webModuleData) {
         LocaleEncodingMappingListType[] localeEncodingMappingListArray = webApp.getLocaleEncodingMappingListArray();
-        Map localeEncodingMappingMap = new HashMap();
+        Map<String, String> localeEncodingMappingMap = new HashMap<String, String>();
         for (LocaleEncodingMappingListType aLocaleEncodingMappingListArray : localeEncodingMappingListArray) {
             LocaleEncodingMappingType[] localeEncodingMappingArray = aLocaleEncodingMappingListArray.getLocaleEncodingMappingArray();
             for (LocaleEncodingMappingType localeEncodingMapping : localeEncodingMappingArray) {
-                localeEncodingMappingMap.put(localeEncodingMapping.getLocale(), localeEncodingMapping.getEncoding());
+                localeEncodingMappingMap.put(localeEncodingMapping.getLocale().trim(), localeEncodingMapping.getEncoding().trim());
             }
         }
         webModuleData.setAttribute("localeEncodingMapping", localeEncodingMappingMap);
@@ -808,43 +773,42 @@
 
     private void configureWelcomeFileLists(WebAppType webApp, GBeanData webModuleData) {
         WelcomeFileListType[] welcomeFileArray = webApp.getWelcomeFileListArray();
-        List welcomeFiles;
+        List<String> welcomeFiles;
         if (welcomeFileArray.length > 0) {
-            welcomeFiles = new ArrayList();
+            welcomeFiles = new ArrayList<String>();
             for (WelcomeFileListType aWelcomeFileArray : welcomeFileArray) {
                 String[] welcomeFileListType = aWelcomeFileArray.getWelcomeFileArray();
-                for (String aWelcomeFileListType : welcomeFileListType) {
-                    String welcomeFile = aWelcomeFileListType.trim();
-                    welcomeFiles.add(welcomeFile);
+                for (String welcomeFile : welcomeFileListType) {
+                    welcomeFiles.add(welcomeFile.trim());
                 }
             }
         } else {
-            welcomeFiles = new ArrayList(defaultWelcomeFiles);
+            welcomeFiles = new ArrayList<String>(defaultWelcomeFiles);
         }
         webModuleData.setAttribute("welcomeFiles", welcomeFiles.toArray(new String[welcomeFiles.size()]));
     }
 
     private void configureMimeMappings(WebAppType webApp, GBeanData webModuleData) {
         MimeMappingType[] mimeMappingArray = webApp.getMimeMappingArray();
-        Map mimeMappingMap = new HashMap();
+        Map<String, String> mimeMappingMap = new HashMap<String, String>();
         for (MimeMappingType mimeMappingType : mimeMappingArray) {
-            mimeMappingMap.put(mimeMappingType.getExtension().getStringValue(), mimeMappingType.getMimeType().getStringValue());
+            mimeMappingMap.put(mimeMappingType.getExtension().getStringValue().trim(), mimeMappingType.getMimeType().getStringValue().trim());
         }
         webModuleData.setAttribute("mimeMap", mimeMappingMap);
     }
 
     private void configureListeners(WebAppType webApp, GBeanData webModuleData) {
         ListenerType[] listenerArray = webApp.getListenerArray();
-        Collection listeners = new ArrayList();
+        Collection<String> listeners = new ArrayList<String>();
         for (ListenerType listenerType : listenerArray) {
-            listeners.add(listenerType.getListenerClass().getStringValue());
+            listeners.add(listenerType.getListenerClass().getStringValue().trim());
         }
         webModuleData.setAttribute("listenerClassNames", listeners);
     }
 
     private void configureContextParams(WebAppType webApp, GBeanData webModuleData) {
         ParamValueType[] contextParamArray = webApp.getContextParamArray();
-        Map contextParams = new HashMap();
+        Map<String, String> contextParams = new HashMap<String, String>();
         for (ParamValueType contextParam : contextParamArray) {
             contextParams.put(contextParam.getParamName().getStringValue().trim(), contextParam.getParamValue().getStringValue().trim());
         }
@@ -897,7 +861,7 @@
 
         // this TreeSet will order the ServletTypes based on whether
         // they have a load-on-startup element and what its value is
-        TreeSet loadOrder = new TreeSet(new StartupOrderComparator());
+        TreeSet<ServletType> loadOrder = new TreeSet<ServletType>(new StartupOrderComparator());
 
         // add all of the servlets to the sorted set
         for (ServletType servletType1 : servletTypes) {
@@ -939,14 +903,14 @@
             Module module,
             AbstractName previousServlet,
             ServletType servletType,
-            Map servletMappings,
-            Set securityRoles,
-            Map rolePermissions,
+            Map<String, Set<String>> servletMappings,
+            Set<String> securityRoles,
+            Map<String, PermissionCollection> rolePermissions,
             EARContext moduleContext) throws DeploymentException {
         String servletName = servletType.getServletName().getStringValue().trim();
         AbstractName servletAbstractName = moduleContext.getNaming().createChildName(webModuleName, servletName, NameFactory.SERVLET);
         GBeanData servletData;
-        Map initParams = new HashMap();
+        Map<String, String> initParams = new HashMap<String, String>();
         if (servletType.isSetServletClass()) {
             ClassLoader webClassLoader = moduleContext.getClassLoader();
             String servletClassName = servletType.getServletClass().getStringValue().trim();
@@ -974,8 +938,8 @@
 //                    throw new DeploymentException("No web service deployment info for servlet name " + servletName); // TODO identify web app in message
 //                }
                 boolean configured = false;
-                for (Iterator iterator = webServiceBuilder.iterator(); iterator.hasNext();) {
-                    WebServiceBuilder serviceBuilder = (WebServiceBuilder) iterator.next();
+                for (Object aWebServiceBuilder : webServiceBuilder) {
+                    WebServiceBuilder serviceBuilder = (WebServiceBuilder) aWebServiceBuilder;
                     if (serviceBuilder.configurePOJO(servletData, servletName, module, servletClassName, moduleContext)) {
                         configured = true;
                         break;
@@ -1086,20 +1050,18 @@
         return GBEAN_INFO;
     }
 
-    static class StartupOrderComparator implements Comparator {
+    static class StartupOrderComparator implements Comparator<ServletType> {
         /**
          * comparator that compares first on the basis of startup order, and then on the lexicographical
          * ordering of servlet name.  Since the servlet names have a uniqueness constraint, this should
          * provide a total ordering consistent with equals.  All servlets with no startup order are after
          * all servlets with a startup order.
          *
-         * @param o1 first ServletType object
-         * @param o2 second ServletType object
+         * @param s1 first ServletType object
+         * @param s2 second ServletType object
          * @return an int < 0 if o1 precedes o2, 0 if they are equal, and > 0 if o2 preceeds o1.
          */
-        public int compare(Object o1, Object o2) {
-            ServletType s1 = (ServletType) o1;
-            ServletType s2 = (ServletType) o2;
+        public int compare(ServletType s1, ServletType s2) {
 
             // load-on-startup is set for neither.  the
             // ordering at this point doesn't matter, but we

Modified: geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/gbean/GBeanInfo.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/gbean/GBeanInfo.java?view=diff&rev=519834&r1=519833&r2=519834
==============================================================================
--- geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/gbean/GBeanInfo.java (original)
+++ geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/gbean/GBeanInfo.java Sun Mar 18 21:32:05 2007
@@ -90,7 +90,7 @@
     private final String name;
     private final String className;
     private final String j2eeType;
-    private final Set attributes;
+    private final Set<GAttributeInfo> attributes;
     private final Map attributesByName;
     private final GConstructorInfo constructor;
     private final Set operations;
@@ -218,7 +218,7 @@
     /**
      * Returns a Set where the elements are type GAttributeInfo
      */
-    public Set getAttributes() {
+    public Set<GAttributeInfo> getAttributes() {
         return attributes;
     }
 

Modified: geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/GBeanNotFoundException.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/GBeanNotFoundException.java?view=diff&rev=519834&r1=519833&r2=519834
==============================================================================
--- geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/GBeanNotFoundException.java (original)
+++ geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/GBeanNotFoundException.java Sun Mar 18 21:32:05 2007
@@ -28,6 +28,7 @@
 public class GBeanNotFoundException extends KernelException {
     private ObjectName gBeanName;
     private AbstractName abstractName;
+    private Set<AbstractName> matches;
 
     public GBeanNotFoundException(ObjectName gBeanName) {
         super(gBeanName+" not found");
@@ -44,8 +45,9 @@
         this.abstractName = abstractName;
     }
 
-    public GBeanNotFoundException(String message, Set patterns) {
+    public GBeanNotFoundException(String message, Set patterns, Set<AbstractName> matches) {
         super(message + ": " + patterns);
+        this.matches = matches;
     }
 
     public GBeanNotFoundException(String message, Throwable cause) {
@@ -66,5 +68,13 @@
 
     public boolean isAbstractName() {
         return abstractName != null;
+    }
+
+    public Set<AbstractName> getMatches() {
+        return matches;
+    }
+
+    public boolean hasMatches() {
+        return matches != null && matches.size() > 0;
     }
 }

Modified: geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/basic/BasicRegistry.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/basic/BasicRegistry.java?view=diff&rev=519834&r1=519833&r2=519834
==============================================================================
--- geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/basic/BasicRegistry.java (original)
+++ geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/basic/BasicRegistry.java Sun Mar 18 21:32:05 2007
@@ -150,21 +150,28 @@
         Set instances = listGBeans(nameQuery);
 
         if (instances.size() == 0) {
-            throw new GBeanNotFoundException("No GBeans found", Collections.singleton(nameQuery));
+            throw new GBeanNotFoundException("No GBeans found", Collections.singleton(nameQuery), null);
         }
 
         if (instances.size() > 1) {
             if (type == null) {
-                throw new GBeanNotFoundException("More then one GBean was found with shortName '" + shortName + "'", Collections.singleton(nameQuery));
+                throw new GBeanNotFoundException("More then one GBean was found with shortName '" + shortName + "'", Collections.singleton(nameQuery), mapToNames(instances));
             }
             if (shortName == null) {
-                throw new GBeanNotFoundException("More then one GBean was found with type '" + type.getName() + "'", Collections.singleton(nameQuery));
+                throw new GBeanNotFoundException("More then one GBean was found with type '" + type.getName() + "'", Collections.singleton(nameQuery), mapToNames(instances));
             }
-            throw new GBeanNotFoundException("More then one GBean was found with shortName '" + shortName + "' and type '" + type.getName() + "'", Collections.singleton(nameQuery));
+            throw new GBeanNotFoundException("More then one GBean was found with shortName '" + shortName + "' and type '" + type.getName() + "'", Collections.singleton(nameQuery), mapToNames(instances));
         }
 
-        GBeanInstance instance = (GBeanInstance) instances.iterator().next();
-        return instance;
+        return (GBeanInstance) instances.iterator().next();
+    }
+
+    private Set<AbstractName> mapToNames(Set<GBeanInstance> instances) {
+        Set<AbstractName> names = new HashSet<AbstractName>(instances.size());
+        for (GBeanInstance instance: instances) {
+            names.add(instance.getAbstractName());
+        }
+        return names;
     }
 
 

Modified: geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/Configuration.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/Configuration.java?view=diff&rev=519834&r1=519833&r2=519834
==============================================================================
--- geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/Configuration.java (original)
+++ geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/Configuration.java Sun Mar 18 21:32:05 2007
@@ -631,7 +631,7 @@
         if (patterns == null) throw new NullPointerException("patterns is null");
         Set<GBeanData> result = findGBeanDatas(this, patterns);
         if (result.size() > 1) {
-            throw new GBeanNotFoundException("More than one match to referencePatterns", patterns);
+            throw new GBeanNotFoundException("More than one match to referencePatterns in local configuration", patterns, mapToNames(result));
         } else if (result.size() == 1) {
             return (GBeanData) result.iterator().next();
         }
@@ -640,21 +640,29 @@
         for (Configuration configuration : allServiceParents) {
             result.addAll(findGBeanDatas(configuration, patterns));
 
-            // if we already found a match we have an ambiguous query
-            if (result.size() > 1) {
-                List<AbstractName> names = new ArrayList<AbstractName>(result.size());
-                for (GBeanData gBeanData : result) {
-                    names.add(gBeanData.getAbstractName());
-                }
-                throw new GBeanNotFoundException("More than one match to referencePatterns: " + names.toString(), patterns);
+        }
+        // if we already found a match we have an ambiguous query
+        if (result.size() > 1) {
+            List<AbstractName> names = new ArrayList<AbstractName>(result.size());
+            for (GBeanData gBeanData : result) {
+                names.add(gBeanData.getAbstractName());
             }
+            throw new GBeanNotFoundException("More than one match to referencePatterns in parent configurations: " + names.toString(), patterns, mapToNames(result));
         }
 
         if (result.isEmpty()) {
-            throw new GBeanNotFoundException("No matches for referencePatterns", patterns);
+            throw new GBeanNotFoundException("No matches for referencePatterns", patterns, null);
         }
 
         return result.iterator().next();
+    }
+
+    private Set<AbstractName> mapToNames(Set<GBeanData> datas) {
+        Set<AbstractName> names = new HashSet<AbstractName>(datas.size());
+        for (GBeanData gBeanData: datas) {
+            names.add(gBeanData.getAbstractName());
+        }
+        return names;
     }
 
     public LinkedHashSet<AbstractName> findGBeans(AbstractNameQuery pattern) {

Modified: geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/repository/Environment.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/repository/Environment.java?view=diff&rev=519834&r1=519833&r2=519834
==============================================================================
--- geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/repository/Environment.java (original)
+++ geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/repository/Environment.java Sun Mar 18 21:32:05 2007
@@ -75,8 +75,8 @@
      *
      * @see Dependency
      */
-    public List getDependencies() {
-        return Collections.unmodifiableList(new ArrayList(dependencies));
+    public List<Dependency> getDependencies() {
+        return Collections.unmodifiableList(new ArrayList<Dependency>(dependencies));
     }
 
     public void addDependency(Artifact artifact, ImportType importType) {

Modified: geronimo/server/trunk/modules/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/AbstractWebModuleBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/AbstractWebModuleBuilder.java?view=diff&rev=519834&r1=519833&r2=519834
==============================================================================
--- geronimo/server/trunk/modules/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/AbstractWebModuleBuilder.java (original)
+++ geronimo/server/trunk/modules/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/AbstractWebModuleBuilder.java Sun Mar 18 21:32:05 2007
@@ -54,16 +54,19 @@
 import org.apache.geronimo.deployment.xmlbeans.XmlBeansUtil;
 import org.apache.geronimo.gbean.AbstractName;
 import org.apache.geronimo.gbean.AbstractNameQuery;
+import org.apache.geronimo.gbean.GBeanData;
+import org.apache.geronimo.j2ee.annotation.Holder;
 import org.apache.geronimo.j2ee.deployment.EARContext;
 import org.apache.geronimo.j2ee.deployment.Module;
 import org.apache.geronimo.j2ee.deployment.ModuleBuilder;
+import org.apache.geronimo.j2ee.deployment.ModuleBuilderExtension;
 import org.apache.geronimo.j2ee.deployment.NamingBuilder;
 import org.apache.geronimo.j2ee.deployment.WebModule;
 import org.apache.geronimo.j2ee.deployment.WebServiceBuilder;
-import org.apache.geronimo.j2ee.deployment.ModuleBuilderExtension;
 import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
 import org.apache.geronimo.kernel.Kernel;
 import org.apache.geronimo.kernel.Naming;
+import org.apache.geronimo.kernel.config.Configuration;
 import org.apache.geronimo.kernel.config.ConfigurationModuleType;
 import org.apache.geronimo.kernel.config.ConfigurationStore;
 import org.apache.geronimo.kernel.repository.Artifact;
@@ -75,8 +78,6 @@
 import org.apache.geronimo.security.util.HTTPMethods;
 import org.apache.geronimo.security.util.URLPattern;
 import org.apache.geronimo.xbeans.geronimo.j2ee.GerSecurityDocument;
-import org.apache.geronimo.xbeans.javaee.EjbLocalRefType;
-import org.apache.geronimo.xbeans.javaee.EjbRefType;
 import org.apache.geronimo.xbeans.javaee.FilterMappingType;
 import org.apache.geronimo.xbeans.javaee.FilterType;
 import org.apache.geronimo.xbeans.javaee.FullyQualifiedClassType;
@@ -116,7 +117,7 @@
     protected final NamespaceDrivenBuilderCollection securityBuilders;
     protected final NamespaceDrivenBuilderCollection serviceBuilders;
     protected final ResourceEnvironmentSetter resourceEnvironmentSetter;
-    protected final Collection webServiceBuilder;
+    protected final Collection<WebServiceBuilder> webServiceBuilder;
 
     protected final NamingBuilder namingBuilders;
     protected final Collection<ModuleBuilderExtension> moduleBuilderExtensions;
@@ -131,7 +132,7 @@
      */
     private static final URI RELATIVE_MODULE_BASE_URI = URI.create("../");
 
-    protected AbstractWebModuleBuilder(Kernel kernel, Collection securityBuilders, Collection serviceBuilders, NamingBuilder namingBuilders, ResourceEnvironmentSetter resourceEnvironmentSetter, Collection webServiceBuilder, Collection<ModuleBuilderExtension> moduleBuilderExtensions) {
+    protected AbstractWebModuleBuilder(Kernel kernel, Collection securityBuilders, Collection serviceBuilders, NamingBuilder namingBuilders, ResourceEnvironmentSetter resourceEnvironmentSetter, Collection<WebServiceBuilder> webServiceBuilder, Collection<ModuleBuilderExtension> moduleBuilderExtensions) {
         this.kernel = kernel;
         this.securityBuilders = new NamespaceDrivenBuilderCollection(securityBuilders, SECURITY_QNAME);
         this.serviceBuilders = new NamespaceDrivenBuilderCollection(serviceBuilders, SERVICE_QNAME);
@@ -156,7 +157,7 @@
 
     //TODO configid these need to be converted to ReferencePatterns
     protected Set findGBeanDependencies(EARContext earContext) {
-        Set dependencies = new HashSet();
+        Set<AbstractName> dependencies = new HashSet<AbstractName>();
         dependencies.addAll(earContext.listGBeans(MANAGED_CONNECTION_FACTORY_PATTERN));
         dependencies.addAll(earContext.listGBeans(ADMIN_OBJECT_PATTERN));
         dependencies.addAll(earContext.listGBeans(STATELESS_SESSION_BEAN_PATTERN));
@@ -764,6 +765,44 @@
         }
 
         return new ClassFinder(classes);
+    }
+
+    protected void configureBasicWebModuleAttributes(WebAppType webApp, XmlObject vendorPlan, EARContext moduleContext, EARContext earContext, WebModule webModule, GBeanData webModuleData) throws DeploymentException {
+        Map<NamingBuilder.Key, Object> buildingContext = new HashMap<NamingBuilder.Key, Object>();
+        buildingContext.put(NamingBuilder.GBEAN_NAME_KEY, moduleContext.getModuleName());
+
+        if (!webApp.getMetadataComplete()) {
+            // Create a classfinder and populate it for the naming builder(s). The absence of a
+            // classFinder in the module will convey whether metadata-complete is set (or not)
+            webModule.setClassFinder(createWebAppClassFinder(webApp, webModule));
+        }
+        //N.B. we use the ear context which has all the gbeans we could possibly be looking up from this ear.
+        //This means that you cannot use the default environment of the web builder to add configs that will be searched.
+        Configuration earConfiguration = earContext.getConfiguration();
+        getNamingBuilders().buildNaming(webApp, vendorPlan, earConfiguration, earConfiguration, webModule, buildingContext);
+
+        Map compContext = NamingBuilder.JNDI_KEY.get(buildingContext);
+        Holder holder = NamingBuilder.INJECTION_KEY.get(buildingContext);
+
+        webModule.getSharedContext().put(WebModule.WEB_APP_DATA, webModuleData);
+        if (moduleContext.getServerName() != null) {
+            webModuleData.setReferencePattern("J2EEServer", moduleContext.getServerName());
+        }
+        if (!webModule.isStandAlone()) {
+            webModuleData.setReferencePattern("J2EEApplication", earContext.getModuleName());
+        }
+
+        webModuleData.setAttribute("holder", holder);
+
+        //Add dependencies on managed connection factories and ejbs in this app
+        //This is overkill, but allows for people not using java:comp context (even though we don't support it)
+        //and sidesteps the problem of circular references between ejbs.
+        Set dependencies = findGBeanDependencies(earContext);
+        webModuleData.addDependencies(dependencies);
+
+        webModuleData.setAttribute("componentContext", compContext);
+        webModuleData.setReferencePattern("TransactionManager", moduleContext.getTransactionManagerName());
+        webModuleData.setReferencePattern("TrackedConnectionAssociator", moduleContext.getConnectionTrackerName());
     }
 
     class UncheckedItem {



Mime
View raw message