geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ga...@apache.org
Subject svn commit: r902507 [1/3] - in /geronimo/server/trunk: framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/ framework/modules/geronimo-deployment/src/test/java/org/apache/geronimo/deployment/ plugins/ plugins/axis/geronim...
Date Sat, 23 Jan 2010 23:28:13 GMT
Author: gawor
Date: Sat Jan 23 23:28:10 2010
New Revision: 902507

URL: http://svn.apache.org/viewvc?rev=902507&view=rev
Log:
GERONIMO-5030: Initial refactoring of some of the module deployment code to support deployment of Bundles. Also, implemented rfc66 extender that can actually deploy WABs with simple servlets and jsps.

Added:
    geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/BundleResourceContext.java   (with props)
    geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/ClassPathUtils.java   (with props)
    geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/Deployable.java   (with props)
    geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/DeployableBundle.java   (with props)
    geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/DeployableJarFile.java   (with props)
    geronimo/server/trunk/plugins/wab/TODO
    geronimo/server/trunk/plugins/wab/web-jetty-server/
    geronimo/server/trunk/plugins/wab/web-jetty-server/pom.xml   (with props)
    geronimo/server/trunk/plugins/wab/web-tomcat-server/
    geronimo/server/trunk/plugins/wab/web-tomcat-server/pom.xml   (with props)
Modified:
    geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/DeploymentContext.java
    geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/ResourceContext.java
    geronimo/server/trunk/framework/modules/geronimo-deployment/src/test/java/org/apache/geronimo/deployment/DeploymentContextTest.java
    geronimo/server/trunk/plugins/   (props changed)
    geronimo/server/trunk/plugins/axis/geronimo-axis-builder/src/main/java/org/apache/geronimo/axis/builder/AxisModuleBuilderExtension.java
    geronimo/server/trunk/plugins/client/geronimo-client-builder/src/main/java/org/apache/geronimo/client/builder/AppClientModuleBuilder.java
    geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment/ConnectorModuleBuilder.java
    geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/EARContext.java
    geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/Module.java
    geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/ModuleBuilder.java
    geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/ModuleBuilderExtension.java
    geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/SwitchingModuleBuilder.java
    geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/UnavailableModuleBuilder.java
    geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/WebModule.java
    geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/test/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder13NakedTest.java
    geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/test/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder13Test.java
    geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/test/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder14AltDDTest.java
    geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/test/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder14AltDDUnpackedTest.java
    geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/test/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder14NakedTest.java
    geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/test/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder14NakedUnpackedTest.java
    geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/test/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder14Test.java
    geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/test/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder14UnpackedTest.java
    geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/test/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder5AltDDTest.java
    geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/test/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder5AltDDUnpackedTest.java
    geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/test/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder5NakedTest.java
    geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/test/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder5NakedUnpackedTest.java
    geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/test/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder5Test.java
    geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/test/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder5UnpackedTest.java
    geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/test/java/org/apache/geronimo/j2ee/deployment/MockConnectorConfigBuilder.java
    geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/test/java/org/apache/geronimo/j2ee/deployment/MockEJBConfigBuilder.java
    geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/test/java/org/apache/geronimo/j2ee/deployment/MockWARConfigBuilder.java
    geronimo/server/trunk/plugins/j2ee/geronimo-naming-builder/src/main/java/org/apache/geronimo/naming/deployment/SwitchingServiceRefBuilder.java
    geronimo/server/trunk/plugins/j2ee/geronimo-security-builder/src/main/java/org/apache/geronimo/security/deployment/GeronimoSecurityBuilderImpl.java
    geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/AbstractWebModuleBuilder.java
    geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/test/java/org/apache/geronimo/web25/deployment/SchemaConversionTest.java
    geronimo/server/trunk/plugins/jasper/geronimo-jasper-builder/src/main/java/org/apache/geronimo/jasper/deployment/JspModuleBuilderExtension.java
    geronimo/server/trunk/plugins/jaxws/geronimo-jaxws-ejb-builder/src/main/java/org/apache/geronimo/jaxws/ejb/builder/JAXWSEJBModuleBuilderExtension.java
    geronimo/server/trunk/plugins/jetty8/geronimo-jetty8-builder/src/main/java/org/apache/geronimo/jetty8/deployment/JettyModuleBuilder.java
    geronimo/server/trunk/plugins/jetty8/geronimo-jetty8-builder/src/test/java/org/apache/geronimo/jetty8/deployment/PlanParsingTest.java
    geronimo/server/trunk/plugins/myfaces/geronimo-myfaces-builder/src/main/java/org/apache/geronimo/myfaces/deployment/MyFacesModuleBuilderExtension.java
    geronimo/server/trunk/plugins/openejb/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbModuleBuilder.java
    geronimo/server/trunk/plugins/openejb/geronimo-openejb-clustering-builder-wadi/src/main/java/org/apache/geronimo/openejb/deployment/cluster/WADIOpenEJBClusteringBuilder.java
    geronimo/server/trunk/plugins/openjpa2/geronimo-persistence-jpa20-builder/src/main/java/org/apache/geronimo/persistence/builder/PersistenceUnitBuilder.java
    geronimo/server/trunk/plugins/pom.xml
    geronimo/server/trunk/plugins/tomcat/geronimo-tomcat7-builder/src/main/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java
    geronimo/server/trunk/plugins/wab/geronimo-web-extender/pom.xml
    geronimo/server/trunk/plugins/wab/geronimo-web-extender/src/main/java/org/apache/geronimo/osgi/web/WebApplication.java
    geronimo/server/trunk/plugins/wab/geronimo-web-extender/src/main/java/org/apache/geronimo/osgi/web/WebContainerExtender.java
    geronimo/server/trunk/plugins/wab/pom.xml
    geronimo/server/trunk/plugins/wab/web-extender/pom.xml
    geronimo/server/trunk/plugins/wab/web-extender/src/main/history/dependencies.xml
    geronimo/server/trunk/plugins/wab/web-extender/src/main/plan/plan.xml

Added: geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/BundleResourceContext.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/BundleResourceContext.java?rev=902507&view=auto
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/BundleResourceContext.java (added)
+++ geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/BundleResourceContext.java Sat Jan 23 23:28:10 2010
@@ -0,0 +1,66 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.geronimo.deployment;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.URI;
+import java.net.URL;
+import java.util.jar.JarFile;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipFile;
+
+public class BundleResourceContext implements ResourceContext {
+
+    public void addFile(URI targetPath, ZipFile zipFile, ZipEntry zipEntry) throws IOException {
+    }
+
+    public void addFile(URI targetPath, URL source) throws IOException {
+    }
+
+    public void addFile(URI targetPath, File source) throws IOException {
+    }
+
+    public void addFile(URI targetPath, String source) throws IOException {
+    }
+
+    public void addFile(URI targetPath, byte[] contents) throws IOException {
+    }
+
+    public void addInclude(URI targetPath, ZipFile zipFile, ZipEntry zipEntry) throws IOException {
+    }
+
+    public void addIncludBundleResourceContexte(URI targetPath, URL source) throws IOException {
+    }
+
+    public void addInclude(URI targetPath, File source) throws IOException {
+    }
+
+    public void addInclude(URI targetPath, URL source) throws IOException {
+    }
+    
+    public void addIncludeAsPackedJar(URI targetPath, JarFile jarFile) throws IOException {
+    }
+
+    public void flush() throws IOException {
+    }
+
+    public File getTargetFile(URI targetPath) {
+        throw new RuntimeException("getTargetFile() is not supported on Bundle-based deployment");
+    }
+
+}

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

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

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

Added: geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/ClassPathUtils.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/ClassPathUtils.java?rev=902507&view=auto
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/ClassPathUtils.java (added)
+++ geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/ClassPathUtils.java Sat Jan 23 23:28:10 2010
@@ -0,0 +1,298 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.geronimo.deployment;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.StringTokenizer;
+import java.util.jar.JarFile;
+
+import org.apache.geronimo.common.DeploymentException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ClassPathUtils {
+    
+    private static final Logger log = LoggerFactory.getLogger(ClassPathUtils.class);
+    
+    // values for lenience vs. strict manifest classpath interpretation
+    private final static int manifestClassLoaderMode;
+    private final static String manifestClassLoaderMessage;
+    private final static int MFCP_LENIENT = 1;
+    private final static int MFCP_STRICT = 2;
+
+    static {
+        // Extract the LenientMFCP value if specified.  If not, default to strict..
+        String mode = System.getProperty("Xorg.apache.geronimo.deployment.LenientMFCP");
+        int mfcpMode = MFCP_STRICT;    // Default to strict
+        String mfcpModeMessage = "Strict Manifest Classpath";
+        if (mode != null) {
+            if (mode.equals("true")) {
+                mfcpMode = MFCP_LENIENT;
+                mfcpModeMessage = "Lenient Manifest Classpath";
+            }
+        }
+
+        manifestClassLoaderMode = mfcpMode;
+        manifestClassLoaderMessage = mfcpModeMessage;
+        LoggerFactory.getLogger(DeploymentContext.class).info(
+                "The " + manifestClassLoaderMessage + " processing mode is in effect.\n" +
+                        "This option can be altered by specifying -DXorg.apache.geronimo.deployment.LenientMFCP=true|false\n" +
+                        "Specify =\"true\" for more lenient processing such as ignoring missing jars and references that are not spec compliant.");
+    }
+    
+    interface JarFileFactory {
+        JarFile newJarFile(URI relativeURI) throws IOException;
+
+        String getManifestClassPath(JarFile jarFile) throws IOException;
+
+        boolean isDirectory(URI relativeURI) throws IOException;
+
+        File[] listFiles(URI relativeURI) throws IOException;
+    }
+    
+    /**
+     * Import the classpath from a jar file's manifest.  The imported classpath
+     * is crafted relative to <code>moduleBaseUri</code>.
+     *
+     * @param moduleFile    the jar file from which the manifest is obtained.
+     * @param moduleBaseUri the base for the imported classpath
+     * @param factory       the factory for constructing JarFiles and the way to extract the manifest classpath from a JarFile. Introduced to make
+     *                      testing plausible, but may be useful for in-IDE deployment.
+     * @param problems      List to save all the problems we encounter.
+     * @throws DeploymentException if there is a problem with the classpath in
+     *                             the manifest
+     */
+    public static void addManifestClassPath(JarFile moduleFile, URI moduleBaseUri, LinkedHashSet<String> classPath, JarFileFactory factory, List<DeploymentException> problems) throws DeploymentException {
+        String manifestClassPath;
+        try {
+            manifestClassPath = factory.getManifestClassPath(moduleFile);
+        } catch (IOException e) {
+            problems.add(new DeploymentException("Could not read manifest: " + moduleBaseUri, e));
+            return;
+        }
+
+        if (manifestClassPath == null) {
+            return;
+        }
+
+        for (StringTokenizer tokenizer = new StringTokenizer(manifestClassPath, " "); tokenizer.hasMoreTokens();) {
+            String path = tokenizer.nextToken();
+
+            URI pathUri;
+            try {
+                pathUri = new URI(path);
+            } catch (URISyntaxException e) {
+                problems.add(new DeploymentException("Invalid manifest classpath entry: module= " + moduleBaseUri + ", path= " + path));
+                continue;
+            }
+
+            if (pathUri.isAbsolute()) {
+                problems.add(new DeploymentException("Manifest class path entries must be relative (J2EE 1.4 Section 8.2): path= " + path + ", module= " + moduleBaseUri));
+                continue;
+            }
+
+            URI targetUri = moduleBaseUri.resolve(pathUri);
+
+            try {
+                if (factory.isDirectory(targetUri)) {
+                    if (!targetUri.getPath().endsWith("/")) {
+                        targetUri = URI.create(targetUri.getPath() + "/");
+                    }
+                    for (File file : factory.listFiles(targetUri)) {
+                        if (file.isDirectory()) {
+                            log.debug("Sub directory [" + file.getAbsolutePath() + "] in the manifest entry directory is ignored");
+                            continue;
+                        }
+                        if (!file.getName().endsWith(".jar")) {
+                            log.debug("Only jar files are added to classpath, file [" + file.getAbsolutePath() + "] is ignored");
+                            continue;
+                        }
+                        classPath.add(targetUri.resolve(file.getName()).getPath());
+                    }
+                } else {
+                    if (!pathUri.getPath().endsWith(".jar")) {
+                        if (manifestClassLoaderMode == MFCP_STRICT) {
+                            problems.add(new DeploymentException(
+                                    "Manifest class path entries must end with the .jar extension (J2EE 1.4 Section 8.2): path= "
+                                            + path + ", module= " + moduleBaseUri));
+                        } else {
+                            log.info("The " + manifestClassLoaderMessage + " processing mode is in effect.\n"
+                                    + "Therefore, a manifest classpath entry which does not end with .jar, "
+                                    + pathUri + " is being permitted and ignored.");
+                        }
+                        continue;
+                    }
+                    classPath.add(targetUri.getPath());
+                }
+            } catch (IOException e) {
+                if (manifestClassLoaderMode == MFCP_STRICT) {
+                    problems.add(new DeploymentException(
+                            "An IOException resulting from manifest classpath : targetUri= " + targetUri, e));
+                } else {
+                    log.info("The " + manifestClassLoaderMessage + " processing mode is in effect.\n"
+                            + "Therefore, an IOException resulting from manifest classpath " + targetUri
+                            + " is being ignored.");
+                }
+            }
+        }
+    }
+    
+    /**
+     * Recursively construct the complete set of paths in the ear for the manifest classpath of the supplied modulefile.
+     * Used only in PersistenceUnitBuilder to figure out if a persistence.xml relates to the starting module.  Having a classloader for
+     * each ejb module would eliminate the need for this and be more elegant.
+     *
+     * @param moduleFile    the module that we start looking at classpaths at, in the car.
+     * @param moduleBaseUri where the moduleFile is inside the car file.  For an (unpacked) war this ends with / which means we also need:
+     * @param resolutionUri the uri to resolve all entries against. For a module such as an ejb jar that is part of the
+     *                      root ear car it is ".".  For a sub-configuration such as a war it is the "reverse" of the path to the war file in the car.
+     *                      For instance, if the war file is foo/bar/myweb.war, the resolutionUri is "../../..".
+     * @param classpath     the classpath list we are constructing.
+     * @param exclusions    the paths to not investigate.  These are typically the other modules in the ear/car file: they will have their contents processed for themselves.
+     * @param factory       the factory for constructing JarFiles and the way to extract the manifest classpath from a JarFile. Introduced to make
+     *                      testing plausible, but may be useful for in-IDE deployment.
+     * @param problems      List to save all the problems we encounter.
+     * @throws org.apache.geronimo.common.DeploymentException
+     *          if something goes wrong.
+     */
+    public static void getCompleteManifestClassPath(JarFile moduleFile, URI moduleBaseUri, URI resolutionUri, ClassPathList classpath, ModuleList exclusions, JarFileFactory factory, List<DeploymentException> problems) throws DeploymentException {
+        String manifestClassPath;
+        try {
+            manifestClassPath = factory.getManifestClassPath(moduleFile);
+        } catch (IOException e) {
+            problems.add(new DeploymentException(printInfo("Could not read manifest: " + moduleBaseUri, moduleBaseUri, classpath, exclusions), e));
+            return;
+        }
+
+        if (manifestClassPath == null) {
+            return;
+        }
+
+        for (StringTokenizer tokenizer = new StringTokenizer(manifestClassPath, " "); tokenizer.hasMoreTokens();) {
+            String path = tokenizer.nextToken();
+
+            URI pathUri;
+            try {
+                pathUri = new URI(path);
+            } catch (URISyntaxException e) {
+                problems.add(new DeploymentException(printInfo("Invalid manifest classpath entry, path= " + path, moduleBaseUri, classpath, exclusions)));
+                continue;
+            }
+
+            if (pathUri.isAbsolute()) {
+                problems.add(new DeploymentException(printInfo("Manifest class path entries must be relative (J2EE 1.4 Section 8.2): path= " + path, moduleBaseUri, classpath, exclusions)));
+                continue;
+            }
+
+            URI targetUri = moduleBaseUri.resolve(pathUri);
+
+            try {
+                if (factory.isDirectory(targetUri)) {
+                    if (!targetUri.getPath().endsWith("/")) {
+                        targetUri = URI.create(targetUri.getPath() + "/");
+                    }
+                    for (File file : factory.listFiles(targetUri)) {
+                        if (file.isDirectory()) {
+                            log.debug("Sub directory [" + file.getAbsolutePath() + "] in the manifest entry directory is ignored");
+                            continue;
+                        }
+                        if (!file.getName().endsWith(".jar")) {
+                            log.debug("Only jar files are added to classpath, file [" + file.getAbsolutePath() + "] is ignored");
+                            continue;
+                        }
+                        addToClassPath(moduleBaseUri, resolutionUri, targetUri.resolve(file.getName()), classpath, exclusions, factory, problems);
+                    }
+                } else {
+                    if (!pathUri.getPath().endsWith(".jar")) {
+                        if (manifestClassLoaderMode == MFCP_STRICT) {
+                            problems.add(new DeploymentException(printInfo(
+                                    "Manifest class path entries must end with the .jar extension (J2EE 1.4 Section 8.2): path= "
+                                            + path, moduleBaseUri, classpath, exclusions)));
+                        } else {
+                            log.info("The " + manifestClassLoaderMessage + " processing mode is in effect.\n"
+                                    + "Therefore, a manifest classpath entry which does not end with .jar, "
+                                    + pathUri + " is being permitted and ignored.");
+                        }
+                        continue;
+                    }
+                    addToClassPath(moduleBaseUri, resolutionUri, targetUri, classpath, exclusions, factory, problems);
+                }
+            } catch (IOException e) {
+                if (manifestClassLoaderMode == MFCP_STRICT) {
+                    problems.add(new DeploymentException(
+                            "An IOException resulting from manifest classpath : targetUri= " + targetUri, e));
+                } else {
+                    log.info("The " + manifestClassLoaderMessage + " processing mode is in effect.\n"
+                            + "Therefore, an IOException resulting from manifest classpath " + targetUri
+                            + " is being ignored.");
+                }
+            }
+        }
+    }
+
+    private static void addToClassPath(URI moduleBaseUri, URI resolutionUri, URI targetUri, ClassPathList classpath, ModuleList exclusions, JarFileFactory factory, List<DeploymentException> problems) throws DeploymentException {
+        String targetEntry = targetUri.toString();
+        if (exclusions.contains(targetEntry)) {
+            return;
+        }
+        URI resolvedUri = resolutionUri.resolve(targetUri);
+        String classpathEntry = resolvedUri.toString();
+        //don't get caught in circular references
+        if (classpath.contains(classpathEntry)) {
+            return;
+        }
+        classpath.add(classpathEntry);
+        JarFile classPathJarFile;
+        try {
+            classPathJarFile = factory.newJarFile(targetUri);
+        } catch (IOException e) {
+            if (manifestClassLoaderMode == MFCP_STRICT) {
+                problems.add(new DeploymentException(
+                        printInfo(
+                                "Manifest class path entries must be a valid jar file, or if it is a directory, all the files with jar suffix in it must be a valid jar file (JAVAEE 5 Section 8.2):  resolved to targetURI= "
+                                        + targetUri, moduleBaseUri, classpath, exclusions), e));
+            } else {
+                log.info("The " + manifestClassLoaderMessage + " processing mode is in effect.\n"
+                        + "Therefore, an IOException resulting from manifest classpath " + targetUri
+                        + " is being ignored.");
+            }
+            return;
+        }
+
+        getCompleteManifestClassPath(classPathJarFile, targetUri, resolutionUri, classpath, exclusions, factory, problems);
+    }
+
+    private static String printInfo(String message, URI moduleBaseUri, ClassPathList classpath, ModuleList exclusions) {
+        StringBuffer buf = new StringBuffer(message).append("\n");
+        buf.append("    looking at: ").append(moduleBaseUri);
+        buf.append("    current classpath: ").append(classpath);
+        buf.append("    ignoring modules: ").append(exclusions);
+        return buf.toString();
+    }
+
+}

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

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

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

Added: geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/Deployable.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/Deployable.java?rev=902507&view=auto
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/Deployable.java (added)
+++ geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/Deployable.java Sat Jan 23 23:28:10 2010
@@ -0,0 +1,30 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.geronimo.deployment;
+
+import java.net.URL;
+
+/**
+ * @version $Rev:386276 $ $Date$
+ */
+public interface Deployable {
+    
+    URL getResource(String name);
+        
+    void close();
+    
+}

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

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

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

Added: geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/DeployableBundle.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/DeployableBundle.java?rev=902507&view=auto
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/DeployableBundle.java (added)
+++ geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/DeployableBundle.java Sat Jan 23 23:28:10 2010
@@ -0,0 +1,46 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.geronimo.deployment;
+
+import java.net.URL;
+
+import org.osgi.framework.Bundle;
+
+/**
+ * @version $Rev:386276 $ $Date$
+ */
+public class DeployableBundle implements Deployable {
+    
+    private Bundle bundle;
+    
+    public DeployableBundle(Bundle bundle) {
+        this.bundle = bundle;
+    }
+    
+    public URL getResource(String name) {
+        return bundle.getEntry(name);
+    }
+    
+    public void close() {        
+    }
+    
+    public Bundle getBundle() {
+        return bundle;
+    }
+    
+}
+

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

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

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

Added: geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/DeployableJarFile.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/DeployableJarFile.java?rev=902507&view=auto
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/DeployableJarFile.java (added)
+++ geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/DeployableJarFile.java Sat Jan 23 23:28:10 2010
@@ -0,0 +1,57 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.geronimo.deployment;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.jar.JarEntry;
+import java.util.jar.JarFile;
+
+import org.apache.geronimo.kernel.util.JarUtils;
+
+/**
+ * @version $Rev:386276 $ $Date$
+ */
+public class DeployableJarFile implements Deployable {
+    
+    private JarFile jarFile;
+    
+    public DeployableJarFile(JarFile jarFile) {
+        this.jarFile = jarFile;
+    }
+    
+    public URL getResource(String name) {
+        JarEntry entry = jarFile.getJarEntry(name);
+        if (entry != null) {
+            try {
+                return JarUtils.createJarURL(jarFile, name);
+            } catch (MalformedURLException e) {
+                // ignore
+            }
+        }
+        return null;
+    }
+        
+    public void close() {
+        JarUtils.close(jarFile);
+    }
+    
+    public JarFile getJarFile() {
+        return jarFile;
+    }
+    
+}

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

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

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

Modified: geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/DeploymentContext.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/DeploymentContext.java?rev=902507&r1=902506&r2=902507&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/DeploymentContext.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/DeploymentContext.java Sat Jan 23 23:28:10 2010
@@ -24,7 +24,6 @@
 import java.io.OutputStream;
 import java.io.PrintWriter;
 import java.net.URI;
-import java.net.URISyntaxException;
 import java.net.URL;
 import java.net.URLEncoder;
 import java.util.ArrayList;
@@ -36,7 +35,6 @@
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
-import java.util.StringTokenizer;
 import java.util.jar.Attributes;
 import java.util.jar.JarFile;
 import java.util.zip.ZipEntry;
@@ -62,7 +60,6 @@
 import org.apache.geronimo.kernel.config.ConfigurationModuleType;
 import org.apache.geronimo.kernel.config.Manifest;
 import org.apache.geronimo.kernel.config.ManifestException;
-import org.apache.geronimo.kernel.config.NoSuchConfigException;
 import org.apache.geronimo.kernel.osgi.BundleUtils;
 import org.apache.geronimo.kernel.osgi.ConfigurationActivator;
 import org.apache.geronimo.kernel.repository.Artifact;
@@ -90,32 +87,6 @@
 
     private static final Logger log = LoggerFactory.getLogger(DeploymentContext.class);
 
-    // values for lenience vs. strict manifest classpath interpretation
-    private final static int manifestClassLoaderMode;
-    private final static String manifestClassLoaderMessage;
-    private final static int MFCP_LENIENT = 1;
-    private final static int MFCP_STRICT = 2;
-
-    static {
-        // Extract the LenientMFCP value if specified.  If not, default to strict..
-        String mode = System.getProperty("Xorg.apache.geronimo.deployment.LenientMFCP");
-        int mfcpMode = MFCP_STRICT;    // Default to strict
-        String mfcpModeMessage = "Strict Manifest Classpath";
-        if (mode != null) {
-            if (mode.equals("true")) {
-                mfcpMode = MFCP_LENIENT;
-                mfcpModeMessage = "Lenient Manifest Classpath";
-            }
-        }
-
-        manifestClassLoaderMode = mfcpMode;
-        manifestClassLoaderMessage = mfcpModeMessage;
-        LoggerFactory.getLogger(DeploymentContext.class).info(
-                "The " + manifestClassLoaderMessage + " processing mode is in effect.\n" +
-                        "This option can be altered by specifying -DXorg.apache.geronimo.deployment.LenientMFCP=true|false\n" +
-                        "Specify =\"true\" for more lenient processing such as ignoring missing jars and references that are not spec compliant.");
-    }
-
     protected final File baseDir;
     protected final File inPlaceConfigurationDir;
     protected final ResourceContext resourceContext;
@@ -131,8 +102,6 @@
     //It should be a disposable nested framework so as to not pollute the main framework with stuff we load as deployment parents.
     private final BundleContext bundleContext;
     protected Configuration configuration;
-    //TODO OSGI set this
-    private boolean boot;
     private Bundle tempBundle;
 
 
@@ -140,36 +109,42 @@
         this(baseDir, inPlaceConfigurationDir, environment, moduleName, moduleType, naming, createConfigurationManager(configurationManager, repositories, bundleContext), bundleContext);
     }
 
-    public DeploymentContext(File baseDir, File inPlaceConfigurationDir, Environment environment, AbstractName moduleName, ConfigurationModuleType moduleType, Naming naming, ConfigurationManager configurationManager, BundleContext bundleContext) throws DeploymentException {
-        if (baseDir == null) throw new NullPointerException("baseDir is null");
+    public DeploymentContext(File baseDir, File inPlaceConfigurationDir, Environment environment, AbstractName moduleName, ConfigurationModuleType moduleType, Naming naming, ConfigurationManager configurationManager, BundleContext bundleContext) throws DeploymentException {        
         if (environment == null) throw new NullPointerException("environment is null");
         if (moduleType == null) throw new NullPointerException("type is null");
         if (configurationManager == null) throw new NullPointerException("configurationManager is null");
-
-        if (!baseDir.exists() && !baseDir.mkdirs()) {
-            throw new DeploymentException("Could not create directory for deployment context assembly: " + baseDir);
-        }
-        this.baseDir = baseDir;
-
+        
+        this.baseDir = baseDir; 
         this.inPlaceConfigurationDir = inPlaceConfigurationDir;
-
         this.moduleName = moduleName;
-
         this.naming = naming;
         this.moduleType = moduleType;
         this.environment = environment;
-
-
         this.configurationManager = configurationManager;
+        this.bundleContext = bundleContext;
+
+        verifyArguments();
+        
+        this.resourceContext = createResourceContext();
+    }
 
+    protected void verifyArguments() throws DeploymentException {
+        if (baseDir == null) {
+            throw new NullPointerException("baseDir is null");
+        }        
+        if (!baseDir.exists() && !baseDir.mkdirs()) {
+            throw new DeploymentException("Could not create directory for deployment context assembly: " + baseDir);
+        }
+    }
+    
+    protected ResourceContext createResourceContext() throws DeploymentException {
         if (null == inPlaceConfigurationDir) {
-            resourceContext = new CopyResourceContext(this, baseDir);
+            return new CopyResourceContext(this, baseDir);
         } else {
-            resourceContext = new InPlaceResourceContext(this, inPlaceConfigurationDir);
+            return new InPlaceResourceContext(this, inPlaceConfigurationDir);
         }
-        this.bundleContext = bundleContext;
     }
-
+    
     private static ConfigurationManager createConfigurationManager(ConfigurationManager configurationManager, Collection<Repository> repositories, BundleContext bundleContext) {
         return new DeploymentConfigurationManager(configurationManager, repositories, bundleContext);
     }
@@ -186,29 +161,6 @@
         LinkedHashSet<Artifact> resolvedParentIds = null;
         try {
             ConfigurationData configurationData = new ConfigurationData(moduleType, null, childConfigurationDatas, environment, baseDir, inPlaceConfigurationDir, naming);
-//            ConfigurationResolver configurationResolver = configurationManager.newConfigurationResolver(configurationData);
-//            List<URL> urls = new ArrayList<URL>();
-//            for (String path: classPath) {
-//                urls.addAll(configurationResolver.resolve(path));
-//            }
-//            List<Bundle> parents = new ArrayList<Bundle>();
-//             resolvedParentIds = configurationManager.resolveParentIds(configurationData);
-//            for (Artifact artifact: resolvedParentIds) {
-//                configurationManager.loadConfiguration(artifact);
-//                Bundle bundle = configurationManager.getBundle(artifact);
-//                if (bundle.getSymbolicName() != null) {
-//                    parents.add(bundle);
-//                }
-//            }
-////            URL[] urls = new URL[0];//TODO crib code from ConfigurationResolver
-////            Bundle[] parents = new Bundle[] {bundleContext.getBundle()}; //TODO this is the "no parents" case, normally use ConfigurationManager to turn parent artifactIds into bundles
-//            ClassLoadingRules classLoadingRules = new ClassLoadingRules();
-//            BundleContext bundleContext = new DeploymentBundleContext(this.bundleContext,
-//                    baseDir.getAbsolutePath(),
-//                    environment.getConfigId(),
-//                    urls.toArray(new URL[urls.size()]),
-//                    parents.toArray(new Bundle[parents.size()]),
-//                    classLoadingRules);
             File tempBundleFile = FileUtils.createTempFile();
             createTempManifest();
             createTempPluginMetadata();
@@ -429,17 +381,7 @@
         resourceContext.addInclude(targetPath, source);
     }
 
-    interface JarFileFactory {
-        JarFile newJarFile(URI relativeURI) throws IOException;
-
-        String getManifestClassPath(JarFile jarFile) throws IOException;
-
-        boolean isDirectory(URI relativeURI) throws IOException;
-
-        File[] listFiles(URI relativeURI) throws IOException;
-    }
-
-    private class DefaultJarFileFactory implements JarFileFactory {
+    private class DefaultJarFileFactory implements ClassPathUtils.JarFileFactory {
 
         public JarFile newJarFile(URI relativeURI) throws IOException {
             File targetFile = getTargetFile(relativeURI);
@@ -474,9 +416,13 @@
         }
     }
 
-    public void getCompleteManifestClassPath(JarFile moduleFile, URI moduleBaseUri, URI resolutionUri, ClassPathList classpath, ModuleList exclusions) throws DeploymentException {
+    public void getCompleteManifestClassPath(Deployable deployable, URI moduleBaseUri, URI resolutionUri, ClassPathList classpath, ModuleList exclusions) throws DeploymentException {
+        if (!(deployable instanceof DeployableJarFile)) {
+            throw new IllegalArgumentException("Expected DeployableJarFile");
+        }
+        JarFile moduleFile = ((DeployableJarFile) deployable).getJarFile();
         List<DeploymentException> problems = new ArrayList<DeploymentException>();
-        getCompleteManifestClassPath(moduleFile, moduleBaseUri, resolutionUri, classpath, exclusions, new DefaultJarFileFactory(), problems);
+        ClassPathUtils.getCompleteManifestClassPath(moduleFile, moduleBaseUri, resolutionUri, classpath, exclusions, new DefaultJarFileFactory(), problems);
         if (!problems.isEmpty()) {
             if (problems.size() == 1) {
                 throw problems.get(0);
@@ -485,142 +431,10 @@
         }
     }
 
-    /**
-     * Recursively construct the complete set of paths in the ear for the manifest classpath of the supplied modulefile.
-     * Used only in PersistenceUnitBuilder to figure out if a persistence.xml relates to the starting module.  Having a classloader for
-     * each ejb module would eliminate the need for this and be more elegant.
-     *
-     * @param moduleFile    the module that we start looking at classpaths at, in the car.
-     * @param moduleBaseUri where the moduleFile is inside the car file.  For an (unpacked) war this ends with / which means we also need:
-     * @param resolutionUri the uri to resolve all entries against. For a module such as an ejb jar that is part of the
-     *                      root ear car it is ".".  For a sub-configuration such as a war it is the "reverse" of the path to the war file in the car.
-     *                      For instance, if the war file is foo/bar/myweb.war, the resolutionUri is "../../..".
-     * @param classpath     the classpath list we are constructing.
-     * @param exclusions    the paths to not investigate.  These are typically the other modules in the ear/car file: they will have their contents processed for themselves.
-     * @param factory       the factory for constructing JarFiles and the way to extract the manifest classpath from a JarFile. Introduced to make
-     *                      testing plausible, but may be useful for in-IDE deployment.
-     * @param problems      List to save all the problems we encounter.
-     * @throws org.apache.geronimo.common.DeploymentException
-     *          if something goes wrong.
-     */
-    public void getCompleteManifestClassPath(JarFile moduleFile, URI moduleBaseUri, URI resolutionUri, ClassPathList classpath, ModuleList exclusions, JarFileFactory factory, List<DeploymentException> problems) throws DeploymentException {
-        String manifestClassPath;
-        try {
-            manifestClassPath = factory.getManifestClassPath(moduleFile);
-        } catch (IOException e) {
-            problems.add(new DeploymentException(printInfo("Could not read manifest: " + moduleBaseUri, moduleBaseUri, classpath, exclusions), e));
-            return;
-        }
-
-        if (manifestClassPath == null) {
-            return;
-        }
-
-        for (StringTokenizer tokenizer = new StringTokenizer(manifestClassPath, " "); tokenizer.hasMoreTokens();) {
-            String path = tokenizer.nextToken();
-
-            URI pathUri;
-            try {
-                pathUri = new URI(path);
-            } catch (URISyntaxException e) {
-                problems.add(new DeploymentException(printInfo("Invalid manifest classpath entry, path= " + path, moduleBaseUri, classpath, exclusions)));
-                continue;
-            }
-
-            if (pathUri.isAbsolute()) {
-                problems.add(new DeploymentException(printInfo("Manifest class path entries must be relative (J2EE 1.4 Section 8.2): path= " + path, moduleBaseUri, classpath, exclusions)));
-                continue;
-            }
-
-            URI targetUri = moduleBaseUri.resolve(pathUri);
-
-            try {
-                if (factory.isDirectory(targetUri)) {
-                    if (!targetUri.getPath().endsWith("/")) {
-                        targetUri = URI.create(targetUri.getPath() + "/");
-                    }
-                    for (File file : factory.listFiles(targetUri)) {
-                        if (file.isDirectory()) {
-                            log.debug("Sub directory [" + file.getAbsolutePath() + "] in the manifest entry directory is ignored");
-                            continue;
-                        }
-                        if (!file.getName().endsWith(".jar")) {
-                            log.debug("Only jar files are added to classpath, file [" + file.getAbsolutePath() + "] is ignored");
-                            continue;
-                        }
-                        addToClassPath(moduleBaseUri, resolutionUri, targetUri.resolve(file.getName()), classpath, exclusions, factory, problems);
-                    }
-                } else {
-                    if (!pathUri.getPath().endsWith(".jar")) {
-                        if (manifestClassLoaderMode == MFCP_STRICT) {
-                            problems.add(new DeploymentException(printInfo(
-                                    "Manifest class path entries must end with the .jar extension (J2EE 1.4 Section 8.2): path= "
-                                            + path, moduleBaseUri, classpath, exclusions)));
-                        } else {
-                            log.info("The " + manifestClassLoaderMessage + " processing mode is in effect.\n"
-                                    + "Therefore, a manifest classpath entry which does not end with .jar, "
-                                    + pathUri + " is being permitted and ignored.");
-                        }
-                        continue;
-                    }
-                    addToClassPath(moduleBaseUri, resolutionUri, targetUri, classpath, exclusions, factory, problems);
-                }
-            } catch (IOException e) {
-                if (manifestClassLoaderMode == MFCP_STRICT) {
-                    problems.add(new DeploymentException(
-                            "An IOException resulting from manifest classpath : targetUri= " + targetUri, e));
-                } else {
-                    log.info("The " + manifestClassLoaderMessage + " processing mode is in effect.\n"
-                            + "Therefore, an IOException resulting from manifest classpath " + targetUri
-                            + " is being ignored.");
-                }
-            }
-        }
-    }
-
-    private void addToClassPath(URI moduleBaseUri, URI resolutionUri, URI targetUri, ClassPathList classpath, ModuleList exclusions, JarFileFactory factory, List<DeploymentException> problems) throws DeploymentException {
-        String targetEntry = targetUri.toString();
-        if (exclusions.contains(targetEntry)) {
-            return;
-        }
-        URI resolvedUri = resolutionUri.resolve(targetUri);
-        String classpathEntry = resolvedUri.toString();
-        //don't get caught in circular references
-        if (classpath.contains(classpathEntry)) {
-            return;
-        }
-        classpath.add(classpathEntry);
-        JarFile classPathJarFile;
-        try {
-            classPathJarFile = factory.newJarFile(targetUri);
-        } catch (IOException e) {
-            if (manifestClassLoaderMode == MFCP_STRICT) {
-                problems.add(new DeploymentException(
-                        printInfo(
-                                "Manifest class path entries must be a valid jar file, or if it is a directory, all the files with jar suffix in it must be a valid jar file (JAVAEE 5 Section 8.2):  resolved to targetURI= "
-                                        + targetUri, moduleBaseUri, classpath, exclusions), e));
-            } else {
-                log.info("The " + manifestClassLoaderMessage + " processing mode is in effect.\n"
-                        + "Therefore, an IOException resulting from manifest classpath " + targetUri
-                        + " is being ignored.");
-            }
-            return;
-        }
-
-        getCompleteManifestClassPath(classPathJarFile, targetUri, resolutionUri, classpath, exclusions, factory, problems);
-    }
-
-    private String printInfo(String message, URI moduleBaseUri, ClassPathList classpath, ModuleList exclusions) {
-        StringBuffer buf = new StringBuffer(message).append("\n");
-        buf.append("    looking at: ").append(moduleBaseUri);
-        buf.append("    current classpath: ").append(classpath);
-        buf.append("    ignoring modules: ").append(exclusions);
-        return buf.toString();
-    }
-
+ 
     public void addManifestClassPath(JarFile moduleFile, URI moduleBaseUri) throws DeploymentException {
         List<DeploymentException> problems = new ArrayList<DeploymentException>();
-        addManifestClassPath(moduleFile, moduleBaseUri, new DefaultJarFileFactory(), problems);
+        ClassPathUtils.addManifestClassPath(moduleFile, moduleBaseUri, classPath, new DefaultJarFileFactory(), problems);
         if (!problems.isEmpty()) {
             if (problems.size() == 1) {
                 throw problems.get(0);
@@ -629,105 +443,10 @@
         }
     }
 
-    /**
-     * Import the classpath from a jar file's manifest.  The imported classpath
-     * is crafted relative to <code>moduleBaseUri</code>.
-     *
-     * @param moduleFile    the jar file from which the manifest is obtained.
-     * @param moduleBaseUri the base for the imported classpath
-     * @param factory       the factory for constructing JarFiles and the way to extract the manifest classpath from a JarFile. Introduced to make
-     *                      testing plausible, but may be useful for in-IDE deployment.
-     * @param problems      List to save all the problems we encounter.
-     * @throws DeploymentException if there is a problem with the classpath in
-     *                             the manifest
-     */
-    public void addManifestClassPath(JarFile moduleFile, URI moduleBaseUri, JarFileFactory factory, List<DeploymentException> problems) throws DeploymentException {
-        String manifestClassPath;
-        try {
-            manifestClassPath = factory.getManifestClassPath(moduleFile);
-        } catch (IOException e) {
-            problems.add(new DeploymentException("Could not read manifest: " + moduleBaseUri, e));
-            return;
-        }
-
-        if (manifestClassPath == null) {
-            return;
-        }
-
-        for (StringTokenizer tokenizer = new StringTokenizer(manifestClassPath, " "); tokenizer.hasMoreTokens();) {
-            String path = tokenizer.nextToken();
-
-            URI pathUri;
-            try {
-                pathUri = new URI(path);
-            } catch (URISyntaxException e) {
-                problems.add(new DeploymentException("Invalid manifest classpath entry: module= " + moduleBaseUri + ", path= " + path));
-                continue;
-            }
-
-            if (pathUri.isAbsolute()) {
-                problems.add(new DeploymentException("Manifest class path entries must be relative (J2EE 1.4 Section 8.2): path= " + path + ", module= " + moduleBaseUri));
-                continue;
-            }
-
-            URI targetUri = moduleBaseUri.resolve(pathUri);
-
-            try {
-                if (factory.isDirectory(targetUri)) {
-                    if (!targetUri.getPath().endsWith("/")) {
-                        targetUri = URI.create(targetUri.getPath() + "/");
-                    }
-                    for (File file : factory.listFiles(targetUri)) {
-                        if (file.isDirectory()) {
-                            log.debug("Sub directory [" + file.getAbsolutePath() + "] in the manifest entry directory is ignored");
-                            continue;
-                        }
-                        if (!file.getName().endsWith(".jar")) {
-                            log.debug("Only jar files are added to classpath, file [" + file.getAbsolutePath() + "] is ignored");
-                            continue;
-                        }
-                        addToClassPath(targetUri.resolve(file.getName()));
-                    }
-                } else {
-                    if (!pathUri.getPath().endsWith(".jar")) {
-                        if (manifestClassLoaderMode == MFCP_STRICT) {
-                            problems.add(new DeploymentException(
-                                    "Manifest class path entries must end with the .jar extension (J2EE 1.4 Section 8.2): path= "
-                                            + path + ", module= " + moduleBaseUri));
-                        } else {
-                            log.info("The " + manifestClassLoaderMessage + " processing mode is in effect.\n"
-                                    + "Therefore, a manifest classpath entry which does not end with .jar, "
-                                    + pathUri + " is being permitted and ignored.");
-                        }
-                        continue;
-                    }
-                    addToClassPath(targetUri);
-                }
-            } catch (IOException e) {
-                if (manifestClassLoaderMode == MFCP_STRICT) {
-                    problems.add(new DeploymentException(
-                            "An IOException resulting from manifest classpath : targetUri= " + targetUri, e));
-                } else {
-                    log.info("The " + manifestClassLoaderMessage + " processing mode is in effect.\n"
-                            + "Therefore, an IOException resulting from manifest classpath " + targetUri
-                            + " is being ignored.");
-                }
-            }
-        }
-    }
-
     public void addToClassPath(String target) {
         classPath.add(target);
     }
 
-    private void addToClassPath(URI targetUri) throws DeploymentException {
-        classPath.add(targetUri.getPath());
-//        String classFileName = fqcn.replace('.', '/') + ".class";
-//        resourceContext.addFile(new URI(targetPath.toString() + classFileName), bytes);
-//
-//        configuration.addToClassPath(targetPath.toString());
-    }
-
     public void addFile(URI targetPath, ZipFile zipFile, ZipEntry zipEntry) throws IOException {
         resourceContext.addFile(targetPath, zipFile, zipEntry);
     }
@@ -768,7 +487,6 @@
     public void close() throws IOException, DeploymentException {
         if (configurationManager != null && configuration != null) {
             try {
-                //TODO OSGI make sure this unloads the bundle from the framework
                 configurationManager.unloadConfiguration(configuration.getId());
             } catch (Exception ignored) {
             }

Modified: geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/ResourceContext.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/ResourceContext.java?rev=902507&r1=902506&r2=902507&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/ResourceContext.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/ResourceContext.java Sat Jan 23 23:28:10 2010
@@ -24,7 +24,7 @@
 import java.util.zip.ZipEntry;
 import java.util.zip.ZipFile;
 
-interface ResourceContext {
+public interface ResourceContext {
     void addIncludeAsPackedJar(URI targetPath, JarFile jarFile) throws IOException;
 
     void addInclude(URI targetPath, ZipFile zipFile, ZipEntry zipEntry) throws IOException;

Modified: geronimo/server/trunk/framework/modules/geronimo-deployment/src/test/java/org/apache/geronimo/deployment/DeploymentContextTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-deployment/src/test/java/org/apache/geronimo/deployment/DeploymentContextTest.java?rev=902507&r1=902506&r2=902507&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-deployment/src/test/java/org/apache/geronimo/deployment/DeploymentContextTest.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-deployment/src/test/java/org/apache/geronimo/deployment/DeploymentContextTest.java Sat Jan 23 23:28:10 2010
@@ -119,7 +119,7 @@
         }
     }
 
-    static class MockJarFileFactory implements DeploymentContext.JarFileFactory {
+    static class MockJarFileFactory implements ClassPathUtils.JarFileFactory {
 
         private final Map<URI, String> data;
 
@@ -160,10 +160,10 @@
         Map<URI, String> data = new HashMap<URI, String>();
         data.put(URI.create("lib1.jar"), "lib1.jar lib2.jar");
 
-        DeploymentContext.JarFileFactory factory = new MockJarFileFactory(data);
+        ClassPathUtils.JarFileFactory factory = new MockJarFileFactory(data);
         DeploymentContext context = new DeploymentContext(new File("."), null, new Environment(Artifact.create("test/foo/1/ear")), new AbstractName(URI.create("test/foo/1/ear?name=test")), ConfigurationModuleType.EAR, new Jsr77Naming(), new MockConfigurationManager(), bundleContext);
         ClassPathList classPathList = new ClassPathList();
-        context.getCompleteManifestClassPath(start, start.getRelativeURI(), resolutionURI, classPathList, exclusions, factory, new ArrayList<DeploymentException>());
+        ClassPathUtils.getCompleteManifestClassPath(start, start.getRelativeURI(), resolutionURI, classPathList, exclusions, factory, new ArrayList<DeploymentException>());
         assertEquals(2, classPathList.size());
     }
 
@@ -176,10 +176,10 @@
         data.put(URI.create("lib2/lib2.jar"), "lib2a.jar");
         data.put(URI.create("lib2/lib2a.jar"), "../lib3.jar ../lib1/lib1/lib1.jar");
 
-        DeploymentContext.JarFileFactory factory = new MockJarFileFactory(data);
+        ClassPathUtils.JarFileFactory factory = new MockJarFileFactory(data);
         DeploymentContext context = new DeploymentContext(new File("."), null, new Environment(Artifact.create("test/foo/1/ear")), new AbstractName(URI.create("test/foo/1/ear?name=test")), ConfigurationModuleType.EAR, new Jsr77Naming(), new MockConfigurationManager(), bundleContext);
         ClassPathList classPathList = new ClassPathList();
-        context.getCompleteManifestClassPath(start, start.getRelativeURI(), resolutionURI, classPathList, exclusions, factory, new ArrayList<DeploymentException>());
+        ClassPathUtils.getCompleteManifestClassPath(start, start.getRelativeURI(), resolutionURI, classPathList, exclusions, factory, new ArrayList<DeploymentException>());
         assertEquals(4, classPathList.size());
         assertEquals("lib1/lib1/lib1.jar", classPathList.get(0));
         assertEquals("lib2/lib2.jar", classPathList.get(1));
@@ -198,10 +198,10 @@
         data.put(URI.create("libfolder/a.jar"), "");
         data.put(URI.create("libfolder/b.jar"), "");
 
-        DeploymentContext.JarFileFactory factory = new MockJarFileFactory(data);
+        ClassPathUtils.JarFileFactory factory = new MockJarFileFactory(data);
         DeploymentContext context = new DeploymentContext(new File("."), null, new Environment(Artifact.create("test/foo/1/ear")), new AbstractName(URI.create("test/foo/1/ear?name=test")), ConfigurationModuleType.EAR, new Jsr77Naming(), new MockConfigurationManager(), bundleContext);
         ClassPathList classPathList = new ClassPathList();
-        context.getCompleteManifestClassPath(start, start.getRelativeURI(), resolutionURI, classPathList, exclusions, factory, new ArrayList<DeploymentException>());
+        ClassPathUtils.getCompleteManifestClassPath(start, start.getRelativeURI(), resolutionURI, classPathList, exclusions, factory, new ArrayList<DeploymentException>());
         assertEquals(6, classPathList.size());
         assertEquals("lib1/lib1/lib1.jar", classPathList.get(0));
         assertEquals("lib2/lib2.jar", classPathList.get(1));
@@ -219,10 +219,10 @@
         Map<URI, String> data = new HashMap<URI, String>();
         data.put(URI.create("lib1.jar"), "lib1.jar lib2.jar");
 
-        DeploymentContext.JarFileFactory factory = new MockJarFileFactory(data);
+        ClassPathUtils.JarFileFactory factory = new MockJarFileFactory(data);
         DeploymentContext context = new DeploymentContext(new File("."), null, new Environment(Artifact.create("test/foo/1/ear")), new AbstractName(URI.create("test/foo/1/ear?name=test")), ConfigurationModuleType.EAR, new Jsr77Naming(), new MockConfigurationManager(), bundleContext);
         ClassPathList classPathList = new ClassPathList();
-        context.getCompleteManifestClassPath(start, start.getRelativeURI(), resolutionURI, classPathList, exclusions, factory, new ArrayList<DeploymentException>());
+        ClassPathUtils.getCompleteManifestClassPath(start, start.getRelativeURI(), resolutionURI, classPathList, exclusions, factory, new ArrayList<DeploymentException>());
         assertEquals(2, classPathList.size());
         assertEquals("../lib1.jar", classPathList.get(0));
         assertEquals("../lib2.jar", classPathList.get(1));
@@ -238,10 +238,10 @@
         data.put(URI.create("lib2/lib2/lib2.jar"), "../lib2a/lib2a.jar");
         data.put(URI.create("lib2/lib2a/lib2a.jar"), "../../lib3/lib3/lib3.jar ../../lib1/lib1/lib1.jar");
 
-        DeploymentContext.JarFileFactory factory = new MockJarFileFactory(data);
+        ClassPathUtils.JarFileFactory factory = new MockJarFileFactory(data);
         DeploymentContext context = new DeploymentContext(new File("."), null, new Environment(Artifact.create("test/foo/1/ear")), new AbstractName(URI.create("test/foo/1/ear?name=test")), ConfigurationModuleType.EAR, new Jsr77Naming(), new MockConfigurationManager(), bundleContext);
         ClassPathList classPathList = new ClassPathList();
-        context.getCompleteManifestClassPath(start, start.getRelativeURI(), resolutionURI, classPathList, exclusions, factory, new ArrayList<DeploymentException>());
+        ClassPathUtils.getCompleteManifestClassPath(start, start.getRelativeURI(), resolutionURI, classPathList, exclusions, factory, new ArrayList<DeploymentException>());
         assertEquals(4, classPathList.size());
         assertEquals("../../../lib1/lib1/lib1.jar", classPathList.get(0));
         assertEquals("../../../lib2/lib2/lib2.jar", classPathList.get(1));
@@ -258,10 +258,10 @@
         data.put(URI.create("lib2/lib2.jar"), "lib2a.jar");
         data.put(URI.create("lib2/lib2a.jar"), "../lib3.jar ../lib1/lib1/lib1.jar");
 
-        DeploymentContext.JarFileFactory factory = new MockJarFileFactory(data);
+        ClassPathUtils.JarFileFactory factory = new MockJarFileFactory(data);
         DeploymentContext context = new DeploymentContext(new File("."), null, new Environment(Artifact.create("test/foo/1/ear")), new AbstractName(URI.create("test/foo/1/ear?name=test")), ConfigurationModuleType.EAR, new Jsr77Naming(), new MockConfigurationManager(), bundleContext);
         ClassPathList classPathList = new ClassPathList();
-        context.getCompleteManifestClassPath(start, start.getRelativeURI(), resolutionURI, classPathList, exclusions, factory, new ArrayList<DeploymentException>());
+        ClassPathUtils.getCompleteManifestClassPath(start, start.getRelativeURI(), resolutionURI, classPathList, exclusions, factory, new ArrayList<DeploymentException>());
         assertEquals(4, classPathList.size());
         assertEquals("../../../lib1/lib1/lib1.jar", classPathList.get(0));
         assertEquals("../../../lib2/lib2.jar", classPathList.get(1));
@@ -280,10 +280,10 @@
         data.put(URI.create("lib2.jar"), "ejb2.jar lib1.jar");
         data.put(URI.create("ejb2.jar"), "lib3.jar lib4.jar");
 
-        DeploymentContext.JarFileFactory factory = new MockJarFileFactory(data);
+        ClassPathUtils.JarFileFactory factory = new MockJarFileFactory(data);
         DeploymentContext context = new DeploymentContext(new File("."), null, new Environment(Artifact.create("test/foo/1/ear")), new AbstractName(URI.create("test/foo/1/ear?name=test")), ConfigurationModuleType.EAR, new Jsr77Naming(), new MockConfigurationManager(), bundleContext);
         ClassPathList classPathList = new ClassPathList();
-        context.getCompleteManifestClassPath(start, start.getRelativeURI(), resolutionURI, classPathList, exclusions, factory, new ArrayList<DeploymentException>());
+        ClassPathUtils.getCompleteManifestClassPath(start, start.getRelativeURI(), resolutionURI, classPathList, exclusions, factory, new ArrayList<DeploymentException>());
         assertEquals(2, classPathList.size());
     }
 

Propchange: geronimo/server/trunk/plugins/
------------------------------------------------------------------------------
--- svn:mergeinfo (added)
+++ svn:mergeinfo Sat Jan 23 23:28:10 2010
@@ -0,0 +1,2 @@
+/geronimo/server/branches/2.2/plugins:832538,885058
+/geronimo/server/trunk/plugins/j2ee:887507

Modified: geronimo/server/trunk/plugins/axis/geronimo-axis-builder/src/main/java/org/apache/geronimo/axis/builder/AxisModuleBuilderExtension.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/axis/geronimo-axis-builder/src/main/java/org/apache/geronimo/axis/builder/AxisModuleBuilderExtension.java?rev=902507&r1=902506&r2=902507&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/axis/geronimo-axis-builder/src/main/java/org/apache/geronimo/axis/builder/AxisModuleBuilderExtension.java (original)
+++ geronimo/server/trunk/plugins/axis/geronimo-axis-builder/src/main/java/org/apache/geronimo/axis/builder/AxisModuleBuilderExtension.java Sat Jan 23 23:28:10 2010
@@ -83,6 +83,9 @@
         this.listener = listener;
     }
 
+    public void createModule(Module module, Bundle bundle, Naming naming, ModuleIDBuilder idBuilder) throws DeploymentException {
+    }
+
     @Override
     public void createModule(Module module, Object plan, JarFile moduleFile, String targetPath, URL specDDUrl, Environment environment, Object moduleContextInfo, AbstractName earName, Naming naming, ModuleIDBuilder idBuilder) throws DeploymentException {
         if (module.getType() != ConfigurationModuleType.EJB) {

Modified: geronimo/server/trunk/plugins/client/geronimo-client-builder/src/main/java/org/apache/geronimo/client/builder/AppClientModuleBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/client/geronimo-client-builder/src/main/java/org/apache/geronimo/client/builder/AppClientModuleBuilder.java?rev=902507&r1=902506&r2=902507&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/client/geronimo-client-builder/src/main/java/org/apache/geronimo/client/builder/AppClientModuleBuilder.java (original)
+++ geronimo/server/trunk/plugins/client/geronimo-client-builder/src/main/java/org/apache/geronimo/client/builder/AppClientModuleBuilder.java Sat Jan 23 23:28:10 2010
@@ -227,6 +227,10 @@
         return (ModuleBuilder) connectorModuleBuilder.getElement();
     }
 
+    public Module createModule(Bundle bundle, Naming naming, ModuleIDBuilder idBuilder) throws DeploymentException {
+        return null;
+    }
+    
     public Module createModule(File plan, JarFile moduleFile, Naming naming, ModuleIDBuilder idBuilder) throws DeploymentException {
         return createModule(plan, moduleFile, "app-client", null, null, null, naming, idBuilder);
     }

Modified: geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment/ConnectorModuleBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment/ConnectorModuleBuilder.java?rev=902507&r1=902506&r2=902507&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment/ConnectorModuleBuilder.java (original)
+++ geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment/ConnectorModuleBuilder.java Sat Jan 23 23:28:10 2010
@@ -205,6 +205,10 @@
         doStop();
     }
 
+    public Module createModule(Bundle bundle, Naming naming, ModuleIDBuilder idBuilder) throws DeploymentException {
+        return null;
+    }
+    
     public Module createModule(File plan, JarFile moduleFile, Naming naming, ModuleIDBuilder idBuilder) throws DeploymentException {
         return createModule(plan, moduleFile, "rar", null, null, null, naming, idBuilder);
     }

Modified: geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/EARContext.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/EARContext.java?rev=902507&r1=902506&r2=902507&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/EARContext.java (original)
+++ geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/EARContext.java Sat Jan 23 23:28:10 2010
@@ -100,28 +100,6 @@
         this.messageDestinations = messageDestinations;
     }
 
-//    public EARContext(File baseDir,
-//                      File inPlaceConfigurationDir,
-//                      Environment environment,
-//                      ConfigurationModuleType moduleType,
-//                      Naming naming,
-//                      ConfigurationManager configurationManager,
-//                      AbstractNameQuery serverName,
-//                      AbstractName baseName,
-//                      AbstractNameQuery transactionManagerObjectName,
-//                      AbstractNameQuery connectionTrackerObjectName,
-//                      AbstractNameQuery corbaGBeanObjectName,
-//                      Map messageDestinations) throws DeploymentException {
-//        super(baseDir, inPlaceConfigurationDir, environment, baseName, moduleType, naming, configurationManager);
-//
-//        this.serverName = serverName;
-//
-//        this.transactionManagerObjectName = transactionManagerObjectName;
-//        this.connectionTrackerObjectName = connectionTrackerObjectName;
-//        this.corbaGBeanObjectName = corbaGBeanObjectName;
-//        this.messageDestinations = messageDestinations;
-//    }
-
     public EARContext(File baseDir, File inPlaceConfigurationDir, Environment environment, ConfigurationModuleType moduleType, AbstractName baseName, EARContext parent) throws DeploymentException {
         super(baseDir, inPlaceConfigurationDir, environment, baseName, moduleType, parent.getNaming(), parent.getConfigurationManager(), parent.getBundleContext());
         this.serverName = parent.getServerName();

Modified: geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/Module.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/Module.java?rev=902507&r1=902506&r2=902507&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/Module.java (original)
+++ geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/Module.java Sat Jan 23 23:28:10 2010
@@ -22,13 +22,14 @@
 import java.util.jar.JarFile;
 
 import org.apache.geronimo.common.DeploymentException;
+import org.apache.geronimo.deployment.Deployable;
+import org.apache.geronimo.deployment.DeployableJarFile;
 import org.apache.geronimo.gbean.AbstractName;
 import org.apache.geronimo.j2ee.deployment.annotation.AnnotatedApp;
 import org.apache.geronimo.kernel.config.ConfigurationData;
 import org.apache.geronimo.kernel.config.ConfigurationModuleType;
 import org.apache.geronimo.kernel.repository.Artifact;
 import org.apache.geronimo.kernel.repository.Environment;
-import org.apache.geronimo.kernel.util.JarUtils;
 import org.apache.xbean.finder.ClassFinder;
 import org.apache.xmlbeans.XmlObject;
 
@@ -42,7 +43,7 @@
     private final String name;
     private final Environment environment;
     private final URI moduleURI;
-    private final JarFile moduleFile;
+    private final Deployable deployable;
     private final String targetPath;
     private final URI targetPathURI;
     private final XmlObject vendorDD;
@@ -58,13 +59,17 @@
     protected final Map sharedContext = new HashMap();
 
     protected Module(boolean standAlone, AbstractName moduleName, Environment environment, JarFile moduleFile, String targetPath, XmlObject specDD, XmlObject vendorDD, String originalSpecDD, String namespace, AnnotatedApp annotatedApp) {
+        this(standAlone, moduleName, environment, new DeployableJarFile(moduleFile), targetPath, specDD, vendorDD, originalSpecDD, namespace, annotatedApp);
+    }
+        
+    protected Module(boolean standAlone, AbstractName moduleName, Environment environment, Deployable deployable, String targetPath, XmlObject specDD, XmlObject vendorDD, String originalSpecDD, String namespace, AnnotatedApp annotatedApp) {
         assert targetPath != null: "targetPath is null";
         assert moduleName != null: "moduleName is null";
 
         this.standAlone = standAlone;
         this.moduleName = moduleName;
         this.environment = environment;
-        this.moduleFile = moduleFile;
+        this.deployable = deployable;
         this.targetPath = targetPath;
         this.specDD = specDD;
         this.vendorDD = vendorDD;
@@ -106,9 +111,17 @@
     }
 
     public JarFile getModuleFile() {
-        return moduleFile;
+        if (deployable instanceof DeployableJarFile) {
+            return ((DeployableJarFile) deployable).getJarFile();
+        } else {
+            throw new RuntimeException("getModuleFile() is not supported on Bundle-based deployment");
+        }      
     }
-
+    
+    public Deployable getDeployable() {
+        return deployable;        
+    }
+    
     public String getTargetPath() {
         return targetPath;
     }
@@ -157,10 +170,9 @@
     }
 
     public void close() {
-        JarUtils.close(moduleFile);
+        deployable.close();
     }
 
-
     public EARContext getEarContext() {
         return earContext;
     }

Modified: geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/ModuleBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/ModuleBuilder.java?rev=902507&r1=902506&r2=902507&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/ModuleBuilder.java (original)
+++ geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/ModuleBuilder.java Sat Jan 23 23:28:10 2010
@@ -33,6 +33,9 @@
  * @version $Rev:386276 $ $Date$
  */
 public interface ModuleBuilder {
+    
+    Module createModule(Bundle bundle, Naming naming, ModuleIDBuilder idBuilder) throws DeploymentException;
+    
     Module createModule(File plan, JarFile moduleFile, Naming naming, ModuleIDBuilder idBuilder) throws DeploymentException;
 
     Module createModule(Object plan, JarFile moduleFile, String targetPath, URL specDDUrl, Environment environment, Object moduleContextInfo, AbstractName earName, Naming naming, ModuleIDBuilder idBuilder) throws DeploymentException;

Modified: geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/ModuleBuilderExtension.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/ModuleBuilderExtension.java?rev=902507&r1=902506&r2=902507&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/ModuleBuilderExtension.java (original)
+++ geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/ModuleBuilderExtension.java Sat Jan 23 23:28:10 2010
@@ -32,6 +32,9 @@
  * @version $Rev$ $Date$
  */
 public interface ModuleBuilderExtension {
+    
+    void createModule(Module module, Bundle bundle, Naming naming, ModuleIDBuilder idBuilder) throws DeploymentException;
+
     void createModule(Module module, Object plan, JarFile moduleFile, String targetPath, URL specDDUrl, Environment environment, Object moduleContextInfo, AbstractName earName, Naming naming, ModuleIDBuilder idBuilder) throws DeploymentException;
 
     void installModule(JarFile earFile, EARContext earContext, Module module, Collection configurationStores, ConfigurationStore targetConfigurationStore, Collection repository) throws DeploymentException;

Modified: geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/SwitchingModuleBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/SwitchingModuleBuilder.java?rev=902507&r1=902506&r2=902507&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/SwitchingModuleBuilder.java (original)
+++ geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/SwitchingModuleBuilder.java Sat Jan 23 23:28:10 2010
@@ -83,6 +83,15 @@
         this.defaultNamespace = defaultNamespace;
     }
 
+    public Module createModule(Bundle bundle, Naming naming, ModuleIDBuilder idBuilder) throws DeploymentException {
+        ModuleBuilder builder = getBuilderFromNamespace(null);
+        if (builder != null) {
+            return builder.createModule(bundle, naming, idBuilder);
+        } else {
+            return null;
+        }
+    }
+    
     public Module createModule(File plan, JarFile moduleFile, Naming naming, ModuleIDBuilder idBuilder) throws DeploymentException {
         String namespace;
         if (plan == null) {

Modified: geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/UnavailableModuleBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/UnavailableModuleBuilder.java?rev=902507&r1=902506&r2=902507&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/UnavailableModuleBuilder.java (original)
+++ geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/UnavailableModuleBuilder.java Sat Jan 23 23:28:10 2010
@@ -37,12 +37,16 @@
  */
 public class UnavailableModuleBuilder implements ModuleBuilder {
 
+    public Module createModule(Bundle bundle, Naming naming, ModuleIDBuilder idBuilder) throws DeploymentException {
+        return null;
+    }
+    
     public Module createModule(File plan, JarFile moduleFile, Naming naming, ModuleIDBuilder idBuilder) throws DeploymentException {
-            return null;
+        return null;
     }
 
     public Module createModule(Object plan, JarFile moduleFile, String targetPath, URL specDDUrl, Environment environment, Object moduleContextInfo, AbstractName earName, Naming naming, ModuleIDBuilder idBuilder) throws DeploymentException {
-            return null;
+        return null;
     }
 
     public void installModule(JarFile earFile, EARContext earContext, Module module, Collection configurationStores, ConfigurationStore targetConfigurationStore, Collection repository) throws DeploymentException {



Mime
View raw message