geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r380273 - in /geronimo/branches/configid: modules/deployment/src/java/org/apache/geronimo/deployment/ modules/jetty-builder/src/java/org/apache/geronimo/jetty/deployment/ modules/kernel/src/java/org/apache/geronimo/kernel/config/ modules/ke...
Date Thu, 23 Feb 2006 23:57:47 GMT
Author: djencks
Date: Thu Feb 23 15:57:43 2006
New Revision: 380273

URL: http://svn.apache.org/viewcvs?rev=380273&view=rev
Log:
Fix problems with parent configurations of wars from ears.  new4 works: jetty builder is adapted
to using configurations for web cl.  Assembly still broken.

Modified:
    geronimo/branches/configid/modules/deployment/src/java/org/apache/geronimo/deployment/DeploymentContext.java
    geronimo/branches/configid/modules/jetty-builder/src/java/org/apache/geronimo/jetty/deployment/JettyModuleBuilder.java
    geronimo/branches/configid/modules/kernel/src/java/org/apache/geronimo/kernel/config/Configuration.java
    geronimo/branches/configid/modules/kernel/src/java/org/apache/geronimo/kernel/config/ManageableAttributeStore.java
    geronimo/branches/configid/modules/kernel/src/java/org/apache/geronimo/kernel/repository/Environment.java
    geronimo/branches/configid/modules/system/src/java/org/apache/geronimo/system/configuration/LocalAttributeManager.java
    geronimo/branches/configid/modules/system/src/test/org/apache/geronimo/system/configuration/LocalAttributeManagerTest.java
    geronimo/branches/configid/plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/MavenAttributeStore.java

Modified: geronimo/branches/configid/modules/deployment/src/java/org/apache/geronimo/deployment/DeploymentContext.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/configid/modules/deployment/src/java/org/apache/geronimo/deployment/DeploymentContext.java?rev=380273&r1=380272&r2=380273&view=diff
==============================================================================
--- geronimo/branches/configid/modules/deployment/src/java/org/apache/geronimo/deployment/DeploymentContext.java
(original)
+++ geronimo/branches/configid/modules/deployment/src/java/org/apache/geronimo/deployment/DeploymentContext.java
Thu Feb 23 15:57:43 2006
@@ -505,14 +505,34 @@
     }
 
     public ClassLoader getClassLoader(Repository repository) throws DeploymentException {
+        return getClassLoader(repository, null);
+    }
+
+    public ClassLoader getClassLoader(Repository repository, Configuration knownParent) throws
DeploymentException {
+        return getConfiguration(repository, knownParent).getConfigurationClassLoader();
+    }
+
+    public Configuration getConfiguration(Repository repository, Configuration knownParent)
throws DeploymentException {
+        Environment environmentCopy = new Environment(environment);
+        if (knownParent != null) {
+            LinkedHashSet allImports = environmentCopy.getImports();
+            Artifact knownParentId = knownParent.getId();
+            allImports.remove(knownParentId);
+        }
+        Set repositories = Collections.singleton(repository);
         try {
-            Configuration configuration = new Configuration(kernel,
+            ArrayList parents = Configuration.buildParents(environmentCopy, null, null, repositories,
kernel);
+            if (knownParent != null) {
+                parents.add(knownParent);
+            }
+            Configuration configuration = new Configuration(parents,
+                    kernel,
                     null,
                     moduleType,
-                    environment,
+                    environmentCopy,
                     new ArrayList(classpath),
                     null,
-                    Collections.singleton(repository),
+                    repositories,
                     new ConfigurationStore() {
 
                         public Artifact install(URL source) {
@@ -551,7 +571,7 @@
                     },
                     null,
                     null);
-            return configuration.getConfigurationClassLoader();
+            return configuration;
         } catch (Exception e) {
             throw new DeploymentException("Could not construct configuration classloader
for deployment context", e);
         }

Modified: geronimo/branches/configid/modules/jetty-builder/src/java/org/apache/geronimo/jetty/deployment/JettyModuleBuilder.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/configid/modules/jetty-builder/src/java/org/apache/geronimo/jetty/deployment/JettyModuleBuilder.java?rev=380273&r1=380272&r2=380273&view=diff
==============================================================================
--- geronimo/branches/configid/modules/jetty-builder/src/java/org/apache/geronimo/jetty/deployment/JettyModuleBuilder.java
(original)
+++ geronimo/branches/configid/modules/jetty-builder/src/java/org/apache/geronimo/jetty/deployment/JettyModuleBuilder.java
Thu Feb 23 15:57:43 2006
@@ -44,6 +44,7 @@
 import org.apache.geronimo.jetty.JettyWebAppContext;
 import org.apache.geronimo.kernel.GBeanNotFoundException;
 import org.apache.geronimo.kernel.Kernel;
+import org.apache.geronimo.kernel.config.Configuration;
 import org.apache.geronimo.kernel.config.ConfigurationData;
 import org.apache.geronimo.kernel.config.ConfigurationModuleType;
 import org.apache.geronimo.kernel.config.ConfigurationStore;
@@ -370,7 +371,6 @@
             Artifact earConfigId = earContext.getConfigID();
             Artifact configId = new Artifact(earConfigId.getGroupId(), earConfigId.getArtifactId()
+ "_" + module.getTargetPath(), earConfigId.getVersion(), "car");
             environment.setConfigId(configId);
-            environment.addImport(earConfigId);
             File configurationDir = configurationStore.createNewConfigurationDir(environment.getConfigId());
 
             // construct the web app deployment context... this is the same class used by
the ear context
@@ -391,7 +391,9 @@
                 DeploymentUtil.recursiveDelete(configurationDir);
                 throw new DeploymentException("Could not create a deployment context for
the web app", e);
             }
-
+            //TODO this is extremely fishy
+            //Add the ear parent here since it can't be loaded by any config store.
+            environment.addImport(earConfigId);
         }
         module.setEarContext(moduleContext);
 
@@ -408,7 +410,7 @@
                     moduleContext.addFile(targetPath, module.getOriginalSpecDD());
                 } else if (entry.getName().startsWith("WEB-INF/lib") && entry.getName().endsWith(".jar"))
{
                     moduleContext.addInclude(targetPath, warFile, entry);
-                } else if (entry.getName().equals("WEB-INF/classes")) {
+                } else if (entry.getName().equals("WEB-INF/classes/")) {
                     moduleContext.addInclude(targetPath, warFile, entry);
                 } else {
                     moduleContext.addFile(targetPath, warFile, entry);
@@ -451,7 +453,11 @@
 
     public void addGBeans(EARContext earContext, Module module, ClassLoader cl, Repository
repository) throws DeploymentException {
         EARContext moduleContext = module.getEarContext();
-        ClassLoader moduleClassLoader = moduleContext.getClassLoader(repository);
+        Configuration knownParent = null;
+        if (!module.isStandAlone()) {
+            knownParent = earContext.getConfiguration(repository, null);
+        }
+        ClassLoader moduleClassLoader = moduleContext.getClassLoader(repository, knownParent);
         J2eeContext earJ2eeContext = moduleContext.getJ2eeContext();
         J2eeContext moduleJ2eeContext = J2eeContextImpl.newModuleContextFromApplication(earJ2eeContext,
NameFactory.WEB_MODULE, module.getName());
         WebModule webModule = (WebModule) module;

Modified: geronimo/branches/configid/modules/kernel/src/java/org/apache/geronimo/kernel/config/Configuration.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/configid/modules/kernel/src/java/org/apache/geronimo/kernel/config/Configuration.java?rev=380273&r1=380272&r2=380273&view=diff
==============================================================================
--- geronimo/branches/configid/modules/kernel/src/java/org/apache/geronimo/kernel/config/Configuration.java
(original)
+++ geronimo/branches/configid/modules/kernel/src/java/org/apache/geronimo/kernel/config/Configuration.java
Thu Feb 23 15:57:43 2006
@@ -50,7 +50,6 @@
 import java.io.ObjectOutputStream;
 import java.net.MalformedURLException;
 import java.net.URI;
-import java.net.URISyntaxException;
 import java.net.URL;
 import java.util.ArrayList;
 import java.util.Arrays;
@@ -219,6 +218,30 @@
                          ConfigurationStore configurationStore,
                          ArtifactManager artifactManager,
                          ArtifactResolver artifactResolver) throws Exception {
+
+        this(buildParents(environment, artifactResolver, artifactManager, repositories, kernel),
kernel, objectName, moduleType, environment, classPath, gbeanState, repositories, configurationStore,
artifactManager, artifactResolver);
+    }
+
+    public static ArrayList buildParents(Environment environment, ArtifactResolver artifactResolver,
ArtifactManager artifactManager, Collection repositories, Kernel kernel) throws MissingDependencyException,
InvalidConfigException {
+        if (artifactResolver == null) {
+            artifactResolver = new DefaultArtifactResolver(artifactManager, repositories);
+        }
+        LinkedHashSet imports = environment.getImports();
+        imports = artifactResolver.resolve(imports);
+        environment.setImports(imports);
+
+        // get proxies to my parent configurations (now that the imports have been resolved)
+        ArrayList parents = new ArrayList();
+        for (Iterator iterator = imports.iterator(); iterator.hasNext();) {
+            Artifact artifact = (Artifact) iterator.next();
+            ObjectName parentName = getConfigurationObjectName(artifact);
+            parents.add(kernel.getProxyManager().createProxy(parentName, Configuration.class));
+        }
+        return parents;
+    }
+
+    public Configuration(ArrayList parents, Kernel kernel, String objectName, ConfigurationModuleType
moduleType, Environment environment, List classPath, byte[] gbeanState, Collection repositories,
ConfigurationStore configurationStore, ArtifactManager artifactManager, ArtifactResolver artifactResolver)
throws MissingDependencyException, MalformedURLException, NoSuchConfigException {
+        this.parents = parents;
         this.kernel = kernel;
         this.environment = environment;
         this.objectNameString = objectName;
@@ -226,6 +249,7 @@
         this.moduleType = moduleType;
         this.gbeanState = gbeanState;
         this.repositories = repositories;
+
         if (classPath != null) {
             this.classPath = classPath;
         } else {
@@ -239,19 +263,6 @@
             artifactResolver = new DefaultArtifactResolver(artifactManager, repositories);
         }
 
-        // resolve imports artifacts
-        LinkedHashSet imports = environment.getImports();
-        imports = artifactResolver.resolve(imports);
-        environment.setImports(imports);
-
-        // get proxies to my parent configurations (now that the imports have been resolved)
-        parents = new ArrayList();
-        for (Iterator iterator = imports.iterator(); iterator.hasNext();) {
-            Artifact artifact = (Artifact) iterator.next();
-            ObjectName parentName = getConfigurationObjectName(artifact);
-            parents.add(kernel.getProxyManager().createProxy(parentName, Configuration.class));
-        }
-
         //propagate non overridable classes etc from parents.
         determineInherited();
 
@@ -326,11 +337,7 @@
             // create and initialize GBeans
             Collection gbeans = loadGBeans();
             if (attributeStore != null) {
-                try {
-                    gbeans = attributeStore.setAttributes(environment.getConfigId().toURI(),
gbeans, configurationClassLoader);
-                } catch (URISyntaxException e) {
-                    throw new InvalidConfigException(e);
-                }
+                gbeans = attributeStore.setAttributes(environment.getConfigId(), gbeans,
configurationClassLoader);
             }
 
             // register all the GBeans

Modified: geronimo/branches/configid/modules/kernel/src/java/org/apache/geronimo/kernel/config/ManageableAttributeStore.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/configid/modules/kernel/src/java/org/apache/geronimo/kernel/config/ManageableAttributeStore.java?rev=380273&r1=380272&r2=380273&view=diff
==============================================================================
--- geronimo/branches/configid/modules/kernel/src/java/org/apache/geronimo/kernel/config/ManageableAttributeStore.java
(original)
+++ geronimo/branches/configid/modules/kernel/src/java/org/apache/geronimo/kernel/config/ManageableAttributeStore.java
Thu Feb 23 15:57:43 2006
@@ -19,10 +19,10 @@
 import org.apache.geronimo.gbean.GAttributeInfo;
 import org.apache.geronimo.gbean.GBeanData;
 import org.apache.geronimo.gbean.GReferenceInfo;
+import org.apache.geronimo.kernel.repository.Artifact;
 
 import javax.management.ObjectName;
 import java.io.IOException;
-import java.net.URI;
 import java.util.Collection;
 import java.util.Set;
 
@@ -49,7 +49,7 @@
      * @return                  The modified GBeanData's
      * @throws InvalidConfigException If something bad happens
      */
-    public Collection setAttributes(URI configurationName, Collection datas, ClassLoader
classLoader) throws InvalidConfigException;
+    public Collection setAttributes(Artifact configurationName, Collection datas, ClassLoader
classLoader) throws InvalidConfigException;
 
     /**
      * Sets the stored value for a particular attribute.  The attribute is

Modified: geronimo/branches/configid/modules/kernel/src/java/org/apache/geronimo/kernel/repository/Environment.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/configid/modules/kernel/src/java/org/apache/geronimo/kernel/repository/Environment.java?rev=380273&r1=380272&r2=380273&view=diff
==============================================================================
--- geronimo/branches/configid/modules/kernel/src/java/org/apache/geronimo/kernel/repository/Environment.java
(original)
+++ geronimo/branches/configid/modules/kernel/src/java/org/apache/geronimo/kernel/repository/Environment.java
Thu Feb 23 15:57:43 2006
@@ -17,15 +17,13 @@
 
 package org.apache.geronimo.kernel.repository;
 
-import org.apache.geronimo.kernel.repository.Artifact;
-
-import java.util.Map;
-import java.util.HashMap;
+import java.io.Serializable;
 import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
 import java.util.LinkedHashSet;
+import java.util.Map;
 import java.util.Set;
-import java.util.HashSet;
-import java.io.Serializable;
 
 /**
  * holds the data from the EnvironmentType xml while it is being resolved, transitively closed,
etc.
@@ -50,6 +48,18 @@
     private boolean suppressDefaultEnvironment;
 
     public Environment() {
+    }
+
+    public Environment(Environment environment) {
+        this.configId = environment.getConfigId();
+        this.imports.addAll(environment.getImports());
+        this.references.addAll(environment.getReferences());
+        this.dependencies.addAll(environment.getDependencies());
+        this.includes.addAll(environment.getIncludes());
+        this.hiddenClasses.addAll(environment.getHiddenClasses());
+        this.nonOverrideableClasses.addAll(environment.getNonOverrideableClasses());
+        this.inverseClassLoading = environment.isInverseClassLoading();
+        this.suppressDefaultEnvironment = environment.isSuppressDefaultEnvironment();
     }
 
     public Artifact getConfigId() {

Modified: geronimo/branches/configid/modules/system/src/java/org/apache/geronimo/system/configuration/LocalAttributeManager.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/configid/modules/system/src/java/org/apache/geronimo/system/configuration/LocalAttributeManager.java?rev=380273&r1=380272&r2=380273&view=diff
==============================================================================
--- geronimo/branches/configid/modules/system/src/java/org/apache/geronimo/system/configuration/LocalAttributeManager.java
(original)
+++ geronimo/branches/configid/modules/system/src/java/org/apache/geronimo/system/configuration/LocalAttributeManager.java
Thu Feb 23 15:57:43 2006
@@ -45,7 +45,6 @@
 import java.io.FileWriter;
 import java.io.IOException;
 import java.io.PrintWriter;
-import java.net.URI;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
@@ -96,7 +95,7 @@
         return readOnly;
     }
 
-    public synchronized Collection setAttributes(URI configurationName, Collection gbeanDatas,
ClassLoader classLoader) throws InvalidConfigException {
+    public synchronized Collection setAttributes(Artifact configurationName, Collection gbeanDatas,
ClassLoader classLoader) throws InvalidConfigException {
         // clone the datas since we will be modifying this collection
         gbeanDatas = new ArrayList(gbeanDatas);
 

Modified: geronimo/branches/configid/modules/system/src/test/org/apache/geronimo/system/configuration/LocalAttributeManagerTest.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/configid/modules/system/src/test/org/apache/geronimo/system/configuration/LocalAttributeManagerTest.java?rev=380273&r1=380272&r2=380273&view=diff
==============================================================================
--- geronimo/branches/configid/modules/system/src/test/org/apache/geronimo/system/configuration/LocalAttributeManagerTest.java
(original)
+++ geronimo/branches/configid/modules/system/src/test/org/apache/geronimo/system/configuration/LocalAttributeManagerTest.java
Thu Feb 23 15:57:43 2006
@@ -22,17 +22,17 @@
 import org.apache.geronimo.gbean.GBeanInfo;
 import org.apache.geronimo.gbean.GBeanInfoBuilder;
 import org.apache.geronimo.gbean.GReferenceInfo;
+import org.apache.geronimo.kernel.repository.Artifact;
 import org.apache.geronimo.system.serverinfo.BasicServerInfo;
 
 import javax.management.ObjectName;
-import java.net.URI;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.Collection;
 import java.util.Collections;
-import java.util.Set;
-import java.util.LinkedHashSet;
-import java.util.Arrays;
 import java.util.HashSet;
+import java.util.LinkedHashSet;
+import java.util.Set;
 
 /**
  * @version $Rev$ $Date$
@@ -41,7 +41,7 @@
     private static final String basedir = System.getProperties().getProperty("basedir", ".");
 
     private LocalAttributeManager localAttributeManager;
-    private URI configurationName;
+    private Artifact configurationName;
     private ObjectName gbeanName;
     private GAttributeInfo attributeInfo;
     private GReferenceInfo referenceInfo;
@@ -170,7 +170,7 @@
     protected void setUp() throws Exception {
         super.setUp();
         localAttributeManager = new LocalAttributeManager("target/test-config.xml", false,
new BasicServerInfo(basedir));
-        configurationName = URI.create("configuration/name");
+        configurationName = Artifact.create("configuration/name/1/car");
         gbeanName = ObjectName.getInstance(":name=gbean");
         attributeInfo = GBEAN_INFO.getAttribute("attribute");
         referenceInfo = GBEAN_INFO.getReference("reference");

Modified: geronimo/branches/configid/plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/MavenAttributeStore.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/configid/plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/MavenAttributeStore.java?rev=380273&r1=380272&r2=380273&view=diff
==============================================================================
--- geronimo/branches/configid/plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/MavenAttributeStore.java
(original)
+++ geronimo/branches/configid/plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/MavenAttributeStore.java
Thu Feb 23 15:57:43 2006
@@ -16,18 +16,18 @@
  */
 package org.apache.geronimo.plugin.packaging;
 
-import java.io.IOException;
-import java.net.URI;
-import java.util.Collection;
-import java.util.Set;
-import javax.management.ObjectName;
-
 import org.apache.geronimo.gbean.GAttributeInfo;
+import org.apache.geronimo.gbean.GBeanData;
 import org.apache.geronimo.gbean.GBeanInfo;
 import org.apache.geronimo.gbean.GBeanInfoBuilder;
-import org.apache.geronimo.gbean.GBeanData;
 import org.apache.geronimo.gbean.GReferenceInfo;
 import org.apache.geronimo.kernel.config.ManageableAttributeStore;
+import org.apache.geronimo.kernel.repository.Artifact;
+
+import javax.management.ObjectName;
+import java.io.IOException;
+import java.util.Collection;
+import java.util.Set;
 
 /**
  * @version $Rev$ $Date$
@@ -36,7 +36,7 @@
     public MavenAttributeStore() {
     }
 
-    public Collection setAttributes(URI configurationName, Collection datas, ClassLoader
classLoader) {
+    public Collection setAttributes(Artifact configurationName, Collection datas, ClassLoader
classLoader) {
         return datas;
     }
 



Mime
View raw message