geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r394430 - in /geronimo/branches/1.1: assemblies/j2ee-jetty-server/src/var/config/ assemblies/j2ee-tomcat-server/src/var/config/ modules/kernel/src/java/org/apache/geronimo/kernel/ modules/kernel/src/java/org/apache/geronimo/kernel/config/ m...
Date Sun, 16 Apr 2006 03:52:05 GMT
Author: djencks
Date: Sat Apr 15 20:52:01 2006
New Revision: 394430

URL: http://svn.apache.org/viewcvs?rev=394430&view=rev
Log:
GERONIMO-1852 modify the gbeans when the configuration is constructed, not an indefinite time
later

Modified:
    geronimo/branches/1.1/assemblies/j2ee-jetty-server/src/var/config/config.xml
    geronimo/branches/1.1/assemblies/j2ee-tomcat-server/src/var/config/config.xml
    geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/ClassLoading.java
    geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/Configuration.java
    geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationUtil.java
    geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/KernelConfigurationManager.java
    geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/SimpleConfigurationManager.java
    geronimo/branches/1.1/modules/kernel/src/test/org/apache/geronimo/kernel/repository/ArtifactResolverTest.java
    geronimo/branches/1.1/modules/naming-builder/src/test/org/apache/geronimo/naming/deployment/MessageDestinationTest.java

Modified: geronimo/branches/1.1/assemblies/j2ee-jetty-server/src/var/config/config.xml
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/assemblies/j2ee-jetty-server/src/var/config/config.xml?rev=394430&r1=394429&r2=394430&view=diff
==============================================================================
--- geronimo/branches/1.1/assemblies/j2ee-jetty-server/src/var/config/config.xml (original)
+++ geronimo/branches/1.1/assemblies/j2ee-jetty-server/src/var/config/config.xml Sat Apr 15
20:52:01 2006
@@ -78,6 +78,8 @@
             <attribute name="port">8009</attribute>
         </gbean>
     </configuration>
+    <!-- n.b. be sure the gbean deployer is explicitly loaded before j2ee-deployer so
that defaultEnvironment
+    overrides work properly -->
     <configuration name="geronimo/geronimo-gbean-deployer/${pom.currentVersion}/car"/>
     <configuration name="geronimo/j2ee-deployer/${pom.currentVersion}/car">
         <gbean name="WebBuilder">

Modified: geronimo/branches/1.1/assemblies/j2ee-tomcat-server/src/var/config/config.xml
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/assemblies/j2ee-tomcat-server/src/var/config/config.xml?rev=394430&r1=394429&r2=394430&view=diff
==============================================================================
--- geronimo/branches/1.1/assemblies/j2ee-tomcat-server/src/var/config/config.xml (original)
+++ geronimo/branches/1.1/assemblies/j2ee-tomcat-server/src/var/config/config.xml Sat Apr
15 20:52:01 2006
@@ -91,6 +91,8 @@
             <attribute name="port">${PlanHTTPSPortPrimary}</attribute>
         </gbean>
     </configuration>
+    <!-- n.b. be sure the gbean deployer is explicitly loaded before j2ee-deployer so
that defaultEnvironment
+    overrides work properly -->
     <configuration name="geronimo/geronimo-gbean-deployer/${pom.currentVersion}/car"/>
     <configuration name="geronimo/j2ee-deployer/${pom.currentVersion}/car">
         <gbean name="WebBuilder">

Modified: geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/ClassLoading.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/ClassLoading.java?rev=394430&r1=394429&r2=394430&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/ClassLoading.java
(original)
+++ geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/ClassLoading.java
Sat Apr 15 20:52:01 2006
@@ -26,6 +26,8 @@
 import java.util.List;
 import java.util.ArrayList;
 
+import org.apache.geronimo.kernel.config.MultiParentClassLoader;
+
 /**
  * Utility class for loading classes by a variety of name variations.
  * <p/>
@@ -206,7 +208,11 @@
         }
 
         // We're out of options, just toss an exception over the wall.
-        throw new ClassNotFoundException(className);
+        if (classLoader instanceof MultiParentClassLoader) {
+            MultiParentClassLoader cl = (MultiParentClassLoader) classLoader;
+            throw new ClassNotFoundException("Could not load class " + className + " from
classloader: " + cl.getId() + ", destroyed state: " + cl.isDestroyed());
+        }
+        throw new ClassNotFoundException("Could not load class " + className + " from unknown
classloader; " + classLoader);
     }
 
 

Modified: geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/Configuration.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/Configuration.java?rev=394430&r1=394429&r2=394430&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/Configuration.java
(original)
+++ geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/Configuration.java
Sat Apr 15 20:52:01 2006
@@ -208,7 +208,8 @@
      */
     public Configuration(Collection parents,
             ConfigurationData configurationData,
-            ConfigurationResolver configurationResolver) throws MissingDependencyException,
MalformedURLException, NoSuchConfigException, InvalidConfigException {
+            ConfigurationResolver configurationResolver,
+            ManageableAttributeStore attributeStore) throws MissingDependencyException, MalformedURLException,
NoSuchConfigException, InvalidConfigException {
         if (parents == null) parents = Collections.EMPTY_SET;
         if (configurationData == null) throw new NullPointerException("configurationData
is null");
         if (configurationResolver == null) throw new NullPointerException("configurationResolver
is null");
@@ -268,7 +269,10 @@
         //
         // Deserialize the GBeans in the configurationData
         //
-        List gbeans = configurationData.getGBeans(configurationClassLoader);
+        Collection gbeans = configurationData.getGBeans(configurationClassLoader);
+        if (attributeStore != null) {
+            gbeans = attributeStore.applyOverrides(id, gbeans, configurationClassLoader);
+        }
         for (Iterator iterator = gbeans.iterator(); iterator.hasNext();) {
             GBeanData gbeanData = (GBeanData) iterator.next();
             this.gbeans.put(gbeanData.getAbstractName(), gbeanData);
@@ -283,7 +287,7 @@
             Map.Entry entry = (Map.Entry) iterator.next();
             String moduleName = (String) entry.getKey();
             ConfigurationData childConfigurationData = (ConfigurationData) entry.getValue();
-            Configuration childConfiguration = new Configuration(childParents, childConfigurationData,
configurationResolver.createChildResolver(moduleName));
+            Configuration childConfiguration = new Configuration(childParents, childConfigurationData,
configurationResolver.createChildResolver(moduleName), attributeStore);
             childConfiguration.parent = this;
             children.add(childConfiguration);
         }
@@ -578,7 +582,12 @@
 
             // if we already found a match we have an ambiguous query
             if (result.size() > 1) {
-                throw new GBeanNotFoundException("More than one match to referencePatterns",
patterns);
+                List names = new ArrayList(result.size());
+                for (Iterator iterator1 = result.iterator(); iterator1.hasNext();) {
+                    GBeanData gBeanData = (GBeanData) iterator1.next();
+                    names.add(gBeanData.getAbstractName());
+                }
+                throw new GBeanNotFoundException("More than one match to referencePatterns:
" + names , patterns);
             }
         }
 
@@ -695,13 +704,15 @@
         infoFactory.addReference("Parents", Configuration.class);
         infoFactory.addAttribute("configurationData", ConfigurationData.class, true, false);
         infoFactory.addAttribute("configurationResolver", ConfigurationResolver.class, true);
+        infoFactory.addAttribute("managedAttributeStore", ManageableAttributeStore.class,
true);
 
         infoFactory.addInterface(Configuration.class);
 
         infoFactory.setConstructor(new String[]{
                 "Parents",
                 "configurationData",
-                "configurationResolver"
+                "configurationResolver",
+                "managedAttributeStore"
         });
 
         GBEAN_INFO = infoFactory.getBeanInfo();

Modified: geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationUtil.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationUtil.java?rev=394430&r1=394429&r2=394430&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationUtil.java
(original)
+++ geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationUtil.java
Sat Apr 15 20:52:01 2006
@@ -152,7 +152,7 @@
         Configuration configuration = (Configuration) kernel.getGBean(gbeanData.getAbstractName());
 
         // start the gbeans
-        startConfigurationGBeans(configuration.getAbstractName(), configuration, kernel,
null);
+        startConfigurationGBeans(configuration.getAbstractName(), configuration, kernel);
 
         ConfigurationManager configurationManager = getConfigurationManager(kernel);
         configurationManager.loadConfiguration(configId);
@@ -299,7 +299,7 @@
         gbeanData.setDependencies(newDependencies);
 
         // If the GBean has a configurationBaseUrl attribute, set it
-        // todo remove this when web app cl are config. cl.
+        // todo Even though this is not used by the classloader, web apps still need this.
 WHY???
         GAttributeInfo attribute = gbeanData.getGBeanInfo().getAttribute("configurationBaseUrl");
         if (attribute != null && attribute.getType().equals("java.net.URL")) {
             try {
@@ -314,11 +314,8 @@
         gbeanData.addDependency(configurationName);
     }
 
-    static void startConfigurationGBeans(AbstractName configurationName, Configuration configuration,
Kernel kernel, ManageableAttributeStore attributeStore) throws InvalidConfigException {
+    static void startConfigurationGBeans(AbstractName configurationName, Configuration configuration,
Kernel kernel) throws InvalidConfigException {
         Collection gbeans = configuration.getGBeans().values();
-        if (attributeStore != null) {
-            gbeans = attributeStore.applyOverrides(configuration.getId(), gbeans, configuration.getConfigurationClassLoader());
-        }
 
         List loaded = new ArrayList(gbeans.size());
         List started = new ArrayList(gbeans.size());
@@ -384,7 +381,7 @@
 
             for (Iterator iterator = configuration.getChildren().iterator(); iterator.hasNext();)
{
                 Configuration childConfiguration = (Configuration) iterator.next();
-                ConfigurationUtil.startConfigurationGBeans(configurationName, childConfiguration,
kernel, attributeStore);
+                ConfigurationUtil.startConfigurationGBeans(configurationName, childConfiguration,
kernel);
             }
         } catch (Throwable e) {
             for (Iterator iterator = started.iterator(); iterator.hasNext();) {
@@ -409,7 +406,7 @@
             }
             if (e instanceof Error) {
                 throw (Error) e;
-            }
+            }                         
             if (e instanceof InvalidConfigException) {
                 throw (InvalidConfigException) e;
             }

Modified: geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/KernelConfigurationManager.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/KernelConfigurationManager.java?rev=394430&r1=394429&r2=394430&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/KernelConfigurationManager.java
(original)
+++ geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/KernelConfigurationManager.java
Sat Apr 15 20:52:01 2006
@@ -114,6 +114,8 @@
         GBeanData gbeanData = new GBeanData(configurationName, Configuration.GBEAN_INFO);
         gbeanData.setAttribute("configurationData", configurationData);
         gbeanData.setAttribute("configurationResolver", new ConfigurationResolver(configurationData,
repositories, artifactResolver));
+        //TODO is this dangerous?
+        gbeanData.setAttribute("managedAttributeStore", attributeStore);
 
         // add parents to the parents reference collection
         LinkedHashSet parentNames = new LinkedHashSet();
@@ -160,7 +162,7 @@
     }
 
     public void start(Configuration configuration) throws InvalidConfigException {
-        ConfigurationUtil.startConfigurationGBeans(configuration.getAbstractName(), configuration,
kernel, attributeStore);
+        ConfigurationUtil.startConfigurationGBeans(configuration.getAbstractName(), configuration,
kernel);
 
         if (configurationList != null) {
             configurationList.addConfiguration(configuration.getId().toString());

Modified: geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/SimpleConfigurationManager.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/SimpleConfigurationManager.java?rev=394430&r1=394429&r2=394430&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/SimpleConfigurationManager.java
(original)
+++ geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/SimpleConfigurationManager.java
Sat Apr 15 20:52:01 2006
@@ -27,12 +27,11 @@
 import java.util.List;
 import java.util.ListIterator;
 import java.util.Map;
-import javax.management.ObjectName;
+
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.apache.geronimo.gbean.InvalidConfigurationException;
 import org.apache.geronimo.gbean.AbstractName;
-import org.apache.geronimo.kernel.jmx.JMXUtil;
+import org.apache.geronimo.gbean.InvalidConfigurationException;
 import org.apache.geronimo.kernel.management.State;
 import org.apache.geronimo.kernel.repository.Artifact;
 import org.apache.geronimo.kernel.repository.ArtifactResolver;
@@ -230,7 +229,7 @@
         try {
             Collection parents = findParentConfigurations(resolvedParentIds, loadedConfigurations);
 
-            Configuration configuration = new Configuration(parents, configurationData, new
ConfigurationResolver(configurationData, repositories, artifactResolver));
+            Configuration configuration = new Configuration(parents, configurationData, new
ConfigurationResolver(configurationData, repositories, artifactResolver), null);
             configuration.doStart();
             return configuration;
         } catch (Exception e) {

Modified: geronimo/branches/1.1/modules/kernel/src/test/org/apache/geronimo/kernel/repository/ArtifactResolverTest.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/kernel/src/test/org/apache/geronimo/kernel/repository/ArtifactResolverTest.java?rev=394430&r1=394429&r2=394430&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/kernel/src/test/org/apache/geronimo/kernel/repository/ArtifactResolverTest.java
(original)
+++ geronimo/branches/1.1/modules/kernel/src/test/org/apache/geronimo/kernel/repository/ArtifactResolverTest.java
Sat Apr 15 20:52:01 2006
@@ -113,7 +113,8 @@
 
         Configuration parent = new Configuration(null,
                 parentConfigurationData,
-                configurationResolver);
+                configurationResolver,
+                null);
 
         LinkedHashSet parents = new LinkedHashSet();
         parents.add(parent);

Modified: geronimo/branches/1.1/modules/naming-builder/src/test/org/apache/geronimo/naming/deployment/MessageDestinationTest.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/naming-builder/src/test/org/apache/geronimo/naming/deployment/MessageDestinationTest.java?rev=394430&r1=394429&r2=394430&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/naming-builder/src/test/org/apache/geronimo/naming/deployment/MessageDestinationTest.java
(original)
+++ geronimo/branches/1.1/modules/naming-builder/src/test/org/apache/geronimo/naming/deployment/MessageDestinationTest.java
Sat Apr 15 20:52:01 2006
@@ -47,7 +47,7 @@
 import java.util.Map;
 
 /**
- * @version $Rev: 385372 $ $Date$
+ * @version $Rev:390932 $ $Date$
  */
 public class MessageDestinationTest extends TestCase {
     private RefContext refContext = new RefContext(new EJBReferenceBuilder() {
@@ -111,7 +111,8 @@
         Artifact id = new Artifact("test", "test", "", "car");
         configuration = new Configuration(Collections.EMPTY_LIST,
                 new ConfigurationData(id, naming),
-                new ConfigurationResolver(id, null));
+                new ConfigurationResolver(id, null),
+                null);
         baseName = naming.createRootName(configuration.getId(), "testRoot", NameFactory.RESOURCE_ADAPTER_MODULE);
     }
 



Mime
View raw message