geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gdam...@apache.org
Subject svn commit: r394448 - in /geronimo/branches/1.1/modules: client-builder/src/java/org/apache/geronimo/client/builder/ connector-builder/src/test/org/apache/geronimo/connector/deployment/ deploy-jsr88/src/java/org/apache/geronimo/deployment/plugin/local/...
Date Sun, 16 Apr 2006 09:44:56 GMT
Author: gdamour
Date: Sun Apr 16 02:44:54 2006
New Revision: 394448

URL: http://svn.apache.org/viewcvs?rev=394448&view=rev
Log:
In-place deployment - more progress.

* get ride of InPlaceEARContext.java and refactor DeploymentContext such that it is easy to add support for in-place deployment of service modules;
* add support for in-place deployment of service module (not yet tested);
* add support for redeployment of in-place configurations: when an in-place configuration is redeployed, the cli automatically performs another in-place deployment; and
* fix the export of in-place configurations (not yet tested).

Added:
    geronimo/branches/1.1/modules/deployment/src/java/org/apache/geronimo/deployment/CopyResourceContext.java
    geronimo/branches/1.1/modules/deployment/src/java/org/apache/geronimo/deployment/InPlaceResourceContext.java
    geronimo/branches/1.1/modules/deployment/src/java/org/apache/geronimo/deployment/ResourceContext.java
Removed:
    geronimo/branches/1.1/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/InPlaceEARContext.java
Modified:
    geronimo/branches/1.1/modules/client-builder/src/java/org/apache/geronimo/client/builder/AppClientModuleBuilder.java
    geronimo/branches/1.1/modules/connector-builder/src/test/org/apache/geronimo/connector/deployment/ConnectorModuleBuilderTest.java
    geronimo/branches/1.1/modules/deploy-jsr88/src/java/org/apache/geronimo/deployment/plugin/local/RedeployCommand.java
    geronimo/branches/1.1/modules/deploy-tool/src/java/org/apache/geronimo/deployment/cli/CommandDistribute.java
    geronimo/branches/1.1/modules/deployment/src/java/org/apache/geronimo/deployment/DeploymentContext.java
    geronimo/branches/1.1/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder.java
    geronimo/branches/1.1/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/EARContext.java
    geronimo/branches/1.1/modules/j2ee-builder/src/test/org/apache/geronimo/j2ee/deployment/EARConfigBuilderTest.java
    geronimo/branches/1.1/modules/jetty-builder/src/test/org/apache/geronimo/jetty/deployment/JettyModuleBuilderTest.java
    geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationStore.java
    geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/NullConfigurationStore.java
    geronimo/branches/1.1/modules/service-builder/src/java/org/apache/geronimo/deployment/service/ServiceConfigBuilder.java
    geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/configuration/ExecutableConfigurationUtil.java
    geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/configuration/InPlaceConfigurationUtil.java
    geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/configuration/RepositoryConfigurationStore.java
    geronimo/branches/1.1/modules/system/src/test/org/apache/geronimo/system/configuration/InPlaceConfigurationUtilTest.java
    geronimo/branches/1.1/modules/tomcat-builder/src/test/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilderTest.java
    geronimo/branches/1.1/modules/web-builder/src/java/org/apache/geronimo/web/deployment/AbstractWebModuleBuilder.java

Modified: geronimo/branches/1.1/modules/client-builder/src/java/org/apache/geronimo/client/builder/AppClientModuleBuilder.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/client-builder/src/java/org/apache/geronimo/client/builder/AppClientModuleBuilder.java?rev=394448&r1=394447&r2=394448&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/client-builder/src/java/org/apache/geronimo/client/builder/AppClientModuleBuilder.java (original)
+++ geronimo/branches/1.1/modules/client-builder/src/java/org/apache/geronimo/client/builder/AppClientModuleBuilder.java Sun Apr 16 02:44:54 2006
@@ -274,6 +274,7 @@
         try {
 
             EARContext appClientDeploymentContext = new EARContext(appClientDir,
+                    null,
                     clientEnvironment,
                     ConfigurationModuleType.CAR,
                     earContext.getNaming(),

Modified: geronimo/branches/1.1/modules/connector-builder/src/test/org/apache/geronimo/connector/deployment/ConnectorModuleBuilderTest.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/connector-builder/src/test/org/apache/geronimo/connector/deployment/ConnectorModuleBuilderTest.java?rev=394448&r1=394447&r2=394448&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/connector-builder/src/test/org/apache/geronimo/connector/deployment/ConnectorModuleBuilderTest.java (original)
+++ geronimo/branches/1.1/modules/connector-builder/src/test/org/apache/geronimo/connector/deployment/ConnectorModuleBuilderTest.java Sun Apr 16 02:44:54 2006
@@ -351,6 +351,7 @@
             try {
                 tempDir = DeploymentUtil.createTempDir();
                 EARContext earContext = new EARContext(tempDir,
+                        null,
                         module.getEnvironment(),
                         module.getType(),
                         naming,

Modified: geronimo/branches/1.1/modules/deploy-jsr88/src/java/org/apache/geronimo/deployment/plugin/local/RedeployCommand.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/deploy-jsr88/src/java/org/apache/geronimo/deployment/plugin/local/RedeployCommand.java?rev=394448&r1=394447&r2=394448&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/deploy-jsr88/src/java/org/apache/geronimo/deployment/plugin/local/RedeployCommand.java (original)
+++ geronimo/branches/1.1/modules/deploy-jsr88/src/java/org/apache/geronimo/deployment/plugin/local/RedeployCommand.java Sun Apr 16 02:44:54 2006
@@ -29,7 +29,6 @@
 
 import javax.enterprise.deploy.shared.CommandType;
 import javax.enterprise.deploy.spi.TargetModuleID;
-import javax.management.ObjectName;
 import java.io.File;
 import java.io.InputStream;
 
@@ -37,6 +36,9 @@
  * @version $Rev$ $Date$
  */
 public class RedeployCommand extends AbstractDeployCommand {
+    private static final String[] IS_IN_PLACE_CONFIGURATION_SIG =  {Artifact.class.getName()};
+    private static final String IS_IN_PLACE_CONFIGURATION_METH = "isInPlaceConfiguration";
+    
     private static final String[] UNINSTALL_SIG = {Artifact.class.getName()};
     private final TargetModuleID[] modules;
 
@@ -100,6 +102,12 @@
 
                     TargetImpl target = (TargetImpl) module.getTarget();
                     AbstractName storeName = target.getAbstractName();
+
+                    // if the configuration is an in-place one, then redeploys
+                    // in in-place mode.
+                    Boolean inPlaceConfiguration = (Boolean) kernel.invoke(storeName, IS_IN_PLACE_CONFIGURATION_METH, new Object[]{configID}, IS_IN_PLACE_CONFIGURATION_SIG);
+                    commandContext.setInPlace(inPlaceConfiguration.booleanValue());
+                    
                     kernel.invoke(storeName, "uninstall", new Object[]{configID}, UNINSTALL_SIG);
                     updateStatus("Uninstalled "+configID);
 

Modified: geronimo/branches/1.1/modules/deploy-tool/src/java/org/apache/geronimo/deployment/cli/CommandDistribute.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/deploy-tool/src/java/org/apache/geronimo/deployment/cli/CommandDistribute.java?rev=394448&r1=394447&r2=394448&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/deploy-tool/src/java/org/apache/geronimo/deployment/cli/CommandDistribute.java (original)
+++ geronimo/branches/1.1/modules/deploy-tool/src/java/org/apache/geronimo/deployment/cli/CommandDistribute.java Sun Apr 16 02:44:54 2006
@@ -38,7 +38,7 @@
  */
 public class CommandDistribute extends AbstractCommand {
     public CommandDistribute() {
-        super("distribute", "2. Other Commands", "[--targets target;target;...] [module] [plan]",
+        super("distribute", "2. Other Commands", "[--inPlace] [--targets target;target;...] [module] [plan]",
                 "Processes a module and adds it to the server environment, but does "+
                 "not start it or mark it to be started in the future." +
                 "Normally both a module and plan are passed to the deployer.  " +
@@ -48,7 +48,9 @@
                 "not need to be provided.\n" +
                 "If no targets are provided, the module is distributed to all available " +
                 "targets.  Geronimo only provides one target (ever), so this is primarily " +
-                "useful when using a different driver.");
+                "useful when using a different driver.\n" +
+                "If inPlace is provided, the module is not copied to the configuration " +
+                "store of the selected targets. The targets directly use the module.");
     }
 
     protected CommandDistribute(String command, String group, String helpArgumentList, String helpText) {

Added: geronimo/branches/1.1/modules/deployment/src/java/org/apache/geronimo/deployment/CopyResourceContext.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/deployment/src/java/org/apache/geronimo/deployment/CopyResourceContext.java?rev=394448&view=auto
==============================================================================
--- geronimo/branches/1.1/modules/deployment/src/java/org/apache/geronimo/deployment/CopyResourceContext.java (added)
+++ geronimo/branches/1.1/modules/deployment/src/java/org/apache/geronimo/deployment/CopyResourceContext.java Sun Apr 16 02:44:54 2006
@@ -0,0 +1,200 @@
+/**
+ *
+ * Copyright 2006 The Apache Software Foundation
+ *
+ *  Licensed 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.ByteArrayInputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.URI;
+import java.net.URL;
+import java.util.jar.JarFile;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipFile;
+
+import org.apache.geronimo.common.DeploymentException;
+import org.apache.geronimo.deployment.util.DeploymentUtil;
+import org.apache.geronimo.kernel.config.Configuration;
+
+class CopyResourceContext implements ResourceContext {
+    private final Configuration configuration;
+    private final URI baseUri;
+    private final byte[] buffer = new byte[4096];
+    
+    public CopyResourceContext(Configuration configuration, File baseDir) throws DeploymentException {
+        this.configuration = configuration;
+        baseUri = baseDir.toURI();
+        
+        if (baseDir.isFile()) {
+            try {
+                configuration.addToClassPath(URI.create(""));
+            } catch (IOException e) {
+                throw new DeploymentException(e);
+            }
+        }
+    }
+
+    /**
+     * Copy a packed jar file into the deployment context and place it into the
+     * path specified in the target path.  The newly added packed jar is added
+     * to the classpath of the configuration.
+     *
+     * @param targetPath where the packed jar file should be placed
+     * @param jarFile the jar file to copy
+     * @throws IOException if there's a problem copying the jar file
+     */
+    public void addIncludeAsPackedJar(URI targetPath, JarFile jarFile) throws IOException {
+        if (targetPath.getPath().endsWith("/")) throw new IllegalStateException("target path must not end with a '/' character: " + targetPath);
+
+        File targetFile = getTargetFile(targetPath);
+        DeploymentUtil.copyToPackedJar(jarFile, targetFile);
+
+        if (!targetFile.isFile()) throw new IllegalStateException("target file should be a file: " + targetFile);
+        configuration.addToClassPath(targetPath);
+    }
+
+    /**
+     * Copy a ZIP file entry into the deployment context and place it into the
+     * path specified in the target path.  The newly added entry is added
+     * to the classpath of the configuration.
+     *
+     * @param targetPath where the ZIP file entry should be placed
+     * @param zipFile the ZIP file
+     * @param zipEntry the ZIP file entry
+     * @throws IOException if there's a problem copying the ZIP entry
+     */
+    public void addInclude(URI targetPath, ZipFile zipFile, ZipEntry zipEntry) throws IOException {
+//        if (!targetPath.getPath().endsWith("/")) throw new IllegalStateException("target path must end with a '/' character: " + targetPath);
+
+        File targetFile = getTargetFile(targetPath);
+        addFile(targetFile, zipFile, zipEntry);
+
+//        if (!targetFile.isDirectory()) throw new IllegalStateException("target file should be a directory: " + targetFile);
+        configuration.addToClassPath(targetPath);
+    }
+
+    /**
+     * Copy a file into the deployment context and place it into the
+     * path specified in the target path.  The newly added file is added
+     * to the classpath of the configuration.
+     *
+     * @param targetPath where the file should be placed
+     * @param source     the URL of file to be copied
+     * @throws IOException if there's a problem copying the ZIP entry
+     */
+    public void addInclude(URI targetPath, URL source) throws IOException {
+        if (targetPath.getPath().endsWith("/")) throw new IllegalStateException("target path must not end with a '/' character: " + targetPath);
+
+        File targetFile = getTargetFile(targetPath);
+        addFile(targetFile, source);
+
+        if (!targetFile.isFile()) throw new IllegalStateException("target file should be a file: " + targetFile);
+        configuration.addToClassPath(targetPath);
+    }
+
+    /**
+     * Copy a file into the deployment context and place it into the
+     * path specified in the target path.  The newly added file is added
+     * to the classpath of the configuration.
+     *
+     * @param targetPath where the file should be placed
+     * @param source     the file to be copied
+     * @throws IOException if there's a problem copying the ZIP entry
+     */
+    public void addInclude(URI targetPath, File source) throws IOException {
+        if (targetPath.getPath().endsWith("/")) throw new IllegalStateException("target path must not end with a '/' character: " + targetPath);
+
+        File targetFile = getTargetFile(targetPath);
+        addFile(targetFile, source);
+
+        if (!targetFile.isFile()) throw new IllegalStateException("target file should be a file: " + targetFile);
+        configuration.addToClassPath(targetPath);
+    }
+
+    public void addFile(URI targetPath, ZipFile zipFile, ZipEntry zipEntry) throws IOException {
+        addFile(getTargetFile(targetPath), zipFile, zipEntry);
+    }
+
+    public void addFile(URI targetPath, URL source) throws IOException {
+        addFile(getTargetFile(targetPath), source);
+    }
+
+    public void addFile(URI targetPath, File source) throws IOException {
+        addFile(getTargetFile(targetPath), source);
+    }
+
+    public void addFile(URI targetPath, String source) throws IOException {
+        addFile(getTargetFile(targetPath), new ByteArrayInputStream(source.getBytes()));
+    }
+
+    public File getTargetFile(URI targetPath) {
+        if (targetPath == null) throw new NullPointerException("targetPath is null");
+        if (targetPath.isAbsolute()) throw new IllegalArgumentException("targetPath is absolute");
+        if (targetPath.isOpaque()) throw new IllegalArgumentException("targetPath is opaque");
+        return new File(baseUri.resolve(targetPath));
+    }
+
+    private void addFile(File targetFile, ZipFile zipFile, ZipEntry zipEntry) throws IOException {
+        if (zipEntry.isDirectory()) {
+            targetFile.mkdirs();
+        } else {
+            InputStream is = zipFile.getInputStream(zipEntry);
+            try {
+                addFile(targetFile, is);
+            } finally {
+                DeploymentUtil.close(is);
+            }
+        }
+    }
+
+    private void addFile(File targetFile, URL source) throws IOException {
+        InputStream in = null;
+        try {
+            in = source.openStream();
+            addFile(targetFile, in);
+        } finally {
+            DeploymentUtil.close(in);
+        }
+    }
+
+    private void addFile(File targetFile, File source) throws IOException {
+        InputStream in = null;
+        try {
+            in = new FileInputStream(source);
+            addFile(targetFile, in);
+        } finally {
+            DeploymentUtil.close(in);
+        }
+    }
+
+    private void addFile(File targetFile, InputStream source) throws IOException {
+        targetFile.getParentFile().mkdirs();
+        OutputStream out = null;
+        try {
+            out = new FileOutputStream(targetFile);
+            int count;
+            while ((count = source.read(buffer)) > 0) {
+                out.write(buffer, 0, count);
+            }
+        } finally {
+            DeploymentUtil.close(out);
+        }
+    }
+}
\ No newline at end of file

Modified: geronimo/branches/1.1/modules/deployment/src/java/org/apache/geronimo/deployment/DeploymentContext.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/deployment/src/java/org/apache/geronimo/deployment/DeploymentContext.java?rev=394448&r1=394447&r2=394448&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/deployment/src/java/org/apache/geronimo/deployment/DeploymentContext.java (original)
+++ geronimo/branches/1.1/modules/deployment/src/java/org/apache/geronimo/deployment/DeploymentContext.java Sun Apr 16 02:44:54 2006
@@ -19,7 +19,6 @@
 
 import java.io.ByteArrayInputStream;
 import java.io.File;
-import java.io.FileInputStream;
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
@@ -32,12 +31,12 @@
 import java.util.Collections;
 import java.util.HashSet;
 import java.util.Iterator;
+import java.util.LinkedHashMap;
 import java.util.LinkedHashSet;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
 import java.util.StringTokenizer;
-import java.util.LinkedHashMap;
 import java.util.jar.Attributes;
 import java.util.jar.JarFile;
 import java.util.jar.Manifest;
@@ -76,11 +75,11 @@
 public class DeploymentContext {
     private final File baseDir;
     private final File inPlaceConfigurationDir;
-    private final URI baseUri;
+    private final ResourceContext resourceContext;
     private final byte[] buffer = new byte[4096];
     private final Map childConfigurationDatas = new LinkedHashMap();
     private final ConfigurationManager configurationManager;
-    protected final Configuration configuration;
+    private final Configuration configuration;
     private final Naming naming;
     private final List additionalDeployment = new ArrayList();
 
@@ -139,7 +138,6 @@
             baseDir.mkdirs();
         }
         this.baseDir = baseDir;
-        this.baseUri = baseDir.toURI();
 
         this.inPlaceConfigurationDir = inPlaceConfigurationDir;
         
@@ -147,12 +145,10 @@
 
         this.configuration = createTempConfiguration(environment, moduleType, baseDir, inPlaceConfigurationDir, configurationManager, naming);
 
-        if (baseDir.isFile()) {
-            try {
-                configuration.addToClassPath(URI.create(""));
-            } catch (IOException e) {
-                throw new DeploymentException(e);
-            }
+        if (null == inPlaceConfigurationDir) {
+            resourceContext = new CopyResourceContext(configuration, baseDir);
+        } else {
+            resourceContext = new InPlaceResourceContext(configuration, inPlaceConfigurationDir);
         }
     }
 
@@ -183,6 +179,10 @@
         return baseDir;
     }
 
+    public File getInPlaceConfigurationDir() {
+        return inPlaceConfigurationDir;
+    }
+
     public Naming getNaming() {
         return naming;
     }
@@ -238,7 +238,7 @@
     }
 
     /**
-     * Copy a packed jar file into the deployment context and place it into the
+     * Add a packed jar file into the deployment context and place it into the
      * path specified in the target path.  The newly added packed jar is added
      * to the classpath of the configuration.
      *
@@ -247,17 +247,11 @@
      * @throws IOException if there's a problem copying the jar file
      */
     public void addIncludeAsPackedJar(URI targetPath, JarFile jarFile) throws IOException {
-        if (targetPath.getPath().endsWith("/")) throw new IllegalStateException("target path must not end with a '/' character: " + targetPath);
-
-        File targetFile = getTargetFile(targetPath);
-        DeploymentUtil.copyToPackedJar(jarFile, targetFile);
-
-        if (!targetFile.isFile()) throw new IllegalStateException("target file should be a file: " + targetFile);
-        configuration.addToClassPath(targetPath);
+        resourceContext.addIncludeAsPackedJar(targetPath, jarFile);
     }
 
     /**
-     * Copy a ZIP file entry into the deployment context and place it into the
+     * Add a ZIP file entry into the deployment context and place it into the
      * path specified in the target path.  The newly added entry is added
      * to the classpath of the configuration.
      *
@@ -267,17 +261,11 @@
      * @throws IOException if there's a problem copying the ZIP entry
      */
     public void addInclude(URI targetPath, ZipFile zipFile, ZipEntry zipEntry) throws IOException {
-//        if (!targetPath.getPath().endsWith("/")) throw new IllegalStateException("target path must end with a '/' character: " + targetPath);
-
-        File targetFile = getTargetFile(targetPath);
-        addFile(targetFile, zipFile, zipEntry);
-
-//        if (!targetFile.isDirectory()) throw new IllegalStateException("target file should be a directory: " + targetFile);
-        configuration.addToClassPath(targetPath);
+        resourceContext.addInclude(targetPath, zipFile, zipEntry);
     }
 
     /**
-     * Copy a file into the deployment context and place it into the
+     * Add a file into the deployment context and place it into the
      * path specified in the target path.  The newly added file is added
      * to the classpath of the configuration.
      *
@@ -286,17 +274,11 @@
      * @throws IOException if there's a problem copying the ZIP entry
      */
     public void addInclude(URI targetPath, URL source) throws IOException {
-        if (targetPath.getPath().endsWith("/")) throw new IllegalStateException("target path must not end with a '/' character: " + targetPath);
-
-        File targetFile = getTargetFile(targetPath);
-        addFile(targetFile, source);
-
-        if (!targetFile.isFile()) throw new IllegalStateException("target file should be a file: " + targetFile);
-        configuration.addToClassPath(targetPath);
+        resourceContext.addInclude(targetPath, source);
     }
 
     /**
-     * Copy a file into the deployment context and place it into the
+     * Add a file into the deployment context and place it into the
      * path specified in the target path.  The newly added file is added
      * to the classpath of the configuration.
      *
@@ -305,13 +287,7 @@
      * @throws IOException if there's a problem copying the ZIP entry
      */
     public void addInclude(URI targetPath, File source) throws IOException {
-        if (targetPath.getPath().endsWith("/")) throw new IllegalStateException("target path must not end with a '/' character: " + targetPath);
-
-        File targetFile = getTargetFile(targetPath);
-        addFile(targetFile, source);
-
-        if (!targetFile.isFile()) throw new IllegalStateException("target file should be a file: " + targetFile);
-        configuration.addToClassPath(targetPath);
+        resourceContext.addInclude(targetPath, source);
     }
 
     /**
@@ -378,52 +354,19 @@
     }
 
     public void addFile(URI targetPath, ZipFile zipFile, ZipEntry zipEntry) throws IOException {
-        addFile(getTargetFile(targetPath), zipFile, zipEntry);
+        resourceContext.addFile(targetPath, zipFile, zipEntry);
     }
 
     public void addFile(URI targetPath, URL source) throws IOException {
-        addFile(getTargetFile(targetPath), source);
+        resourceContext.addFile(targetPath, source);
     }
 
     public void addFile(URI targetPath, File source) throws IOException {
-        addFile(getTargetFile(targetPath), source);
+        resourceContext.addFile(targetPath, source);
     }
 
     public void addFile(URI targetPath, String source) throws IOException {
-        addFile(getTargetFile(targetPath), new ByteArrayInputStream(source.getBytes()));
-    }
-
-    private void addFile(File targetFile, ZipFile zipFile, ZipEntry zipEntry) throws IOException {
-        if (zipEntry.isDirectory()) {
-            targetFile.mkdirs();
-        } else {
-            InputStream is = zipFile.getInputStream(zipEntry);
-            try {
-                addFile(targetFile, is);
-            } finally {
-                DeploymentUtil.close(is);
-            }
-        }
-    }
-
-    private void addFile(File targetFile, URL source) throws IOException {
-        InputStream in = null;
-        try {
-            in = source.openStream();
-            addFile(targetFile, in);
-        } finally {
-            DeploymentUtil.close(in);
-        }
-    }
-
-    private void addFile(File targetFile, File source) throws IOException {
-        InputStream in = null;
-        try {
-            in = new FileInputStream(source);
-            addFile(targetFile, in);
-        } finally {
-            DeploymentUtil.close(in);
-        }
+        resourceContext.addFile(targetPath, source);
     }
 
     private void addFile(File targetFile, InputStream source) throws IOException {
@@ -441,10 +384,7 @@
     }
 
     public File getTargetFile(URI targetPath) {
-        if (targetPath == null) throw new NullPointerException("targetPath is null");
-        if (targetPath.isAbsolute()) throw new IllegalArgumentException("targetPath is absolute");
-        if (targetPath.isOpaque()) throw new IllegalArgumentException("targetPath is opaque");
-        return new File(baseUri.resolve(targetPath));
+        return resourceContext.getTargetFile(targetPath);
     }
 
     public ClassLoader getClassLoader() throws DeploymentException {
@@ -492,9 +432,5 @@
 
     public List getAdditionalDeployment() {
         return additionalDeployment;
-    }
-
-    public File getInPlaceConfigurationDir() {
-        return inPlaceConfigurationDir;
     }
 }

Added: geronimo/branches/1.1/modules/deployment/src/java/org/apache/geronimo/deployment/InPlaceResourceContext.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/deployment/src/java/org/apache/geronimo/deployment/InPlaceResourceContext.java?rev=394448&view=auto
==============================================================================
--- geronimo/branches/1.1/modules/deployment/src/java/org/apache/geronimo/deployment/InPlaceResourceContext.java (added)
+++ geronimo/branches/1.1/modules/deployment/src/java/org/apache/geronimo/deployment/InPlaceResourceContext.java Sun Apr 16 02:44:54 2006
@@ -0,0 +1,81 @@
+/**
+ *
+ * Copyright 2006 The Apache Software Foundation
+ *
+ *  Licensed 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;
+
+import org.apache.geronimo.common.DeploymentException;
+import org.apache.geronimo.kernel.config.Configuration;
+
+class InPlaceResourceContext implements ResourceContext {
+    private final Configuration configuration;
+    private final URI inPlaceBaseConfigurationUri;
+    
+    public InPlaceResourceContext(Configuration configuration, File inPlaceBaseConfigurationDir) throws DeploymentException {
+        this.configuration = configuration;
+        this.inPlaceBaseConfigurationUri = inPlaceBaseConfigurationDir.toURI();
+
+        if (inPlaceBaseConfigurationDir.isFile()) {
+            try {
+                configuration.addToClassPath(URI.create(""));
+            } catch (IOException e) {
+                throw new DeploymentException(e);
+            }
+        }
+    }
+
+    public void addIncludeAsPackedJar(URI targetPath, JarFile jarFile) throws IOException {
+        configuration.addToClassPath(targetPath);
+    }
+
+    public void addInclude(URI targetPath, ZipFile zipFile, ZipEntry zipEntry) throws IOException {
+        configuration.addToClassPath(targetPath);
+    }
+
+    public void addInclude(URI targetPath, URL source) throws IOException {
+        configuration.addToClassPath(targetPath);
+    }
+
+    public void addInclude(URI targetPath, File source) throws IOException {
+        configuration.addToClassPath(targetPath);
+    }
+
+    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 File getTargetFile(URI targetPath) {
+        if (targetPath == null) throw new NullPointerException("targetPath is null");
+        if (targetPath.isAbsolute()) throw new IllegalArgumentException("targetPath is absolute");
+        if (targetPath.isOpaque()) throw new IllegalArgumentException("targetPath is opaque");
+        return new File(inPlaceBaseConfigurationUri.resolve(targetPath));
+    }
+}
\ No newline at end of file

Added: geronimo/branches/1.1/modules/deployment/src/java/org/apache/geronimo/deployment/ResourceContext.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/deployment/src/java/org/apache/geronimo/deployment/ResourceContext.java?rev=394448&view=auto
==============================================================================
--- geronimo/branches/1.1/modules/deployment/src/java/org/apache/geronimo/deployment/ResourceContext.java (added)
+++ geronimo/branches/1.1/modules/deployment/src/java/org/apache/geronimo/deployment/ResourceContext.java Sun Apr 16 02:44:54 2006
@@ -0,0 +1,45 @@
+/**
+ *
+ * Copyright 2006 The Apache Software Foundation
+ *
+ *  Licensed 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;
+
+interface ResourceContext {
+    void addIncludeAsPackedJar(URI targetPath, JarFile jarFile) throws IOException;
+
+    void addInclude(URI targetPath, ZipFile zipFile, ZipEntry zipEntry) throws IOException;
+
+    void addInclude(URI targetPath, URL source) throws IOException;
+
+    void addInclude(URI targetPath, File source) throws IOException;
+
+    void addFile(URI targetPath, ZipFile zipFile, ZipEntry zipEntry) throws IOException;
+
+    void addFile(URI targetPath, URL source) throws IOException;
+
+    void addFile(URI targetPath, File source) throws IOException;
+
+    void addFile(URI targetPath, String source) throws IOException;
+    
+    File getTargetFile(URI targetPath);
+}
\ No newline at end of file

Modified: geronimo/branches/1.1/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder.java?rev=394448&r1=394447&r2=394448&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder.java (original)
+++ geronimo/branches/1.1/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder.java Sun Apr 16 02:44:54 2006
@@ -16,6 +16,25 @@
  */
 package org.apache.geronimo.j2ee.deployment;
 
+import java.io.File;
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URL;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedHashSet;
+import java.util.Map;
+import java.util.Set;
+import java.util.jar.JarFile;
+import java.util.zip.ZipEntry;
+
+import javax.xml.namespace.QName;
+
 import org.apache.geronimo.common.DeploymentException;
 import org.apache.geronimo.deployment.ConfigurationBuilder;
 import org.apache.geronimo.deployment.DeploymentContext;
@@ -27,24 +46,25 @@
 import org.apache.geronimo.deployment.xbeans.EnvironmentType;
 import org.apache.geronimo.deployment.xbeans.GbeanType;
 import org.apache.geronimo.deployment.xmlbeans.XmlBeansUtil;
+import org.apache.geronimo.gbean.AbstractName;
+import org.apache.geronimo.gbean.AbstractNameQuery;
 import org.apache.geronimo.gbean.GBeanData;
 import org.apache.geronimo.gbean.GBeanInfo;
 import org.apache.geronimo.gbean.GBeanInfoBuilder;
-import org.apache.geronimo.gbean.AbstractName;
-import org.apache.geronimo.gbean.AbstractNameQuery;
 import org.apache.geronimo.gbean.ReferencePatterns;
 import org.apache.geronimo.j2ee.ApplicationInfo;
 import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
 import org.apache.geronimo.j2ee.management.impl.J2EEApplicationImpl;
 import org.apache.geronimo.kernel.GBeanAlreadyExistsException;
-import org.apache.geronimo.kernel.Naming;
 import org.apache.geronimo.kernel.Kernel;
+import org.apache.geronimo.kernel.Naming;
+import org.apache.geronimo.kernel.config.ConfigurationAlreadyExistsException;
 import org.apache.geronimo.kernel.config.ConfigurationModuleType;
 import org.apache.geronimo.kernel.config.ConfigurationStore;
-import org.apache.geronimo.kernel.config.ConfigurationAlreadyExistsException;
 import org.apache.geronimo.kernel.repository.Artifact;
 import org.apache.geronimo.kernel.repository.Environment;
 import org.apache.geronimo.kernel.repository.Repository;
+import org.apache.geronimo.management.J2EEServer;
 import org.apache.geronimo.schema.SchemaConversionUtils;
 import org.apache.geronimo.security.deployment.SecurityBuilder;
 import org.apache.geronimo.security.deployment.SecurityConfiguration;
@@ -54,30 +74,9 @@
 import org.apache.geronimo.xbeans.geronimo.j2ee.GerModuleType;
 import org.apache.geronimo.xbeans.j2ee.ApplicationType;
 import org.apache.geronimo.xbeans.j2ee.ModuleType;
-import org.apache.geronimo.management.J2EEServer;
 import org.apache.xmlbeans.XmlException;
 import org.apache.xmlbeans.XmlObject;
 
-import javax.xml.namespace.QName;
-import java.io.File;
-import java.io.IOException;
-import java.net.MalformedURLException;
-import java.net.URI;
-import java.net.URL;
-import java.util.Collections;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.LinkedHashSet;
-import java.util.Map;
-import java.util.Set;
-import java.util.Collection;
-import java.util.List;
-import java.util.ArrayList;
-import java.util.jar.JarFile;
-import java.util.zip.ZipEntry;
-
 /**
  * @version $Rev:385232 $ $Date$
  */
@@ -353,38 +352,21 @@
 
         try {
             // Create the output ear context
-        	if (inPlaceDeployment) {
-                earContext = new InPlaceEARContext(configurationDir,
-                        DeploymentUtil.toFile(earFile),
-                        applicationInfo.getEnvironment(),
-                        applicationType,
-                        naming,
-                        repositories,
-                        configurationStores,
-                        serverName,
-                        applicationInfo.getBaseName(),
-                        transactionContextManagerObjectName,
-                        connectionTrackerObjectName,
-                        transactionalTimerObjectName,
-                        nonTransactionalTimerObjectName,
-                        corbaGBeanObjectName,
-                        new RefContext(ejbReferenceBuilder, resourceReferenceBuilder, serviceReferenceBuilder));
-        	} else {
-                earContext = new EARContext(configurationDir,
-                        applicationInfo.getEnvironment(),
-                        applicationType,
-                        naming,
-                        repositories,
-                        configurationStores,
-                        serverName,
-                        applicationInfo.getBaseName(),
-                        transactionContextManagerObjectName,
-                        connectionTrackerObjectName,
-                        transactionalTimerObjectName,
-                        nonTransactionalTimerObjectName,
-                        corbaGBeanObjectName,
-                        new RefContext(ejbReferenceBuilder, resourceReferenceBuilder, serviceReferenceBuilder));
-        	}
+            earContext = new EARContext(configurationDir,
+                    inPlaceDeployment ? DeploymentUtil.toFile(earFile) : null,
+                    applicationInfo.getEnvironment(),
+                    applicationType,
+                    naming,
+                    repositories,
+                    configurationStores,
+                    serverName,
+                    applicationInfo.getBaseName(),
+                    transactionContextManagerObjectName,
+                    connectionTrackerObjectName,
+                    transactionalTimerObjectName,
+                    nonTransactionalTimerObjectName,
+                    corbaGBeanObjectName,
+                    new RefContext(ejbReferenceBuilder, resourceReferenceBuilder, serviceReferenceBuilder));
 
             // Copy over all files that are _NOT_ modules
             Set moduleLocations = applicationInfo.getModuleLocations();

Modified: geronimo/branches/1.1/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/EARContext.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/EARContext.java?rev=394448&r1=394447&r2=394448&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/EARContext.java (original)
+++ geronimo/branches/1.1/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/EARContext.java Sun Apr 16 02:44:54 2006
@@ -52,6 +52,7 @@
     private SecurityConfiguration securityConfiguration;
 
     public EARContext(File baseDir,
+        File inPlaceConfigurationDir,
         Environment environment,
         ConfigurationModuleType moduleType,
         Naming naming, 
@@ -65,30 +66,8 @@
         AbstractNameQuery nonTransactedTimerName, 
         AbstractNameQuery corbaGBeanObjectName, 
         RefContext refContext) throws DeploymentException {
-        this(baseDir, 
-           null, 
-           environment, 
-           moduleType, 
-           naming, 
-           repositories, 
-           configurationStores, 
-           serverName, 
-           baseName, 
-           transactionContextManagerObjectName, 
-           connectionTrackerObjectName, 
-           transactedTimerName, 
-           nonTransactedTimerName, 
-           corbaGBeanObjectName, 
-           refContext);
-    }
-
-    public EARContext(File baseDir, Environment environment, ConfigurationModuleType moduleType, AbstractName baseName, EARContext parent) throws DeploymentException {
-        this(baseDir, null, environment, moduleType, baseName, parent);
-    }
-
-    protected EARContext(File baseDir, File inPlaceConfigurationDir, Environment environment, ConfigurationModuleType moduleType, Naming naming, Collection repositories, Collection configurationStores, AbstractNameQuery serverName, AbstractName baseName, AbstractNameQuery transactionContextManagerObjectName, AbstractNameQuery connectionTrackerObjectName, AbstractNameQuery transactedTimerName, AbstractNameQuery nonTransactedTimerName, AbstractNameQuery corbaGBeanObjectName, RefContext refContext) throws DeploymentException {
         super(baseDir, inPlaceConfigurationDir, environment, moduleType, naming, repositories, configurationStores);
-    
+        
         moduleName = baseName;
         this.serverName = serverName;
 
@@ -100,7 +79,7 @@
         this.refContext = refContext;
     }
 
-    protected EARContext(File baseDir, File inPlaceConfigurationDir, Environment environment, ConfigurationModuleType moduleType, AbstractName baseName, EARContext parent) throws DeploymentException {
+    public EARContext(File baseDir, File inPlaceConfigurationDir, Environment environment, ConfigurationModuleType moduleType, AbstractName baseName, EARContext parent) throws DeploymentException {
         super(baseDir, inPlaceConfigurationDir, environment, moduleType, parent.getNaming(), parent.getConfigurationManager());
         moduleName = baseName;
         this.serverName = parent.getServerName();
@@ -112,7 +91,7 @@
         this.corbaGBeanObjectName = parent.getCORBAGBeanObjectName();
         this.refContext = parent.getRefContext();
     }
-    
+
     public AbstractNameQuery getServerName() {
         return serverName;
     }

Modified: geronimo/branches/1.1/modules/j2ee-builder/src/test/org/apache/geronimo/j2ee/deployment/EARConfigBuilderTest.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/j2ee-builder/src/test/org/apache/geronimo/j2ee/deployment/EARConfigBuilderTest.java?rev=394448&r1=394447&r2=394448&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/j2ee-builder/src/test/org/apache/geronimo/j2ee/deployment/EARConfigBuilderTest.java (original)
+++ geronimo/branches/1.1/modules/j2ee-builder/src/test/org/apache/geronimo/j2ee/deployment/EARConfigBuilderTest.java Sun Apr 16 02:44:54 2006
@@ -27,12 +27,14 @@
 import java.util.List;
 import java.util.Map;
 import java.util.jar.JarFile;
+
 import javax.xml.namespace.QName;
 
 import junit.extensions.TestSetup;
 import junit.framework.Test;
 import junit.framework.TestCase;
 import junit.framework.TestSuite;
+
 import org.apache.geronimo.common.DeploymentException;
 import org.apache.geronimo.deployment.DeploymentContext;
 import org.apache.geronimo.deployment.util.DeploymentUtil;
@@ -42,7 +44,6 @@
 import org.apache.geronimo.kernel.Jsr77Naming;
 import org.apache.geronimo.kernel.Naming;
 import org.apache.geronimo.kernel.config.ConfigurationData;
-import org.apache.geronimo.kernel.config.ConfigurationStore;
 import org.apache.geronimo.kernel.config.InvalidConfigException;
 import org.apache.geronimo.kernel.config.NoSuchConfigException;
 import org.apache.geronimo.kernel.config.NullConfigurationStore;

Modified: geronimo/branches/1.1/modules/jetty-builder/src/test/org/apache/geronimo/jetty/deployment/JettyModuleBuilderTest.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/jetty-builder/src/test/org/apache/geronimo/jetty/deployment/JettyModuleBuilderTest.java?rev=394448&r1=394447&r2=394448&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/jetty-builder/src/test/org/apache/geronimo/jetty/deployment/JettyModuleBuilderTest.java (original)
+++ geronimo/branches/1.1/modules/jetty-builder/src/test/org/apache/geronimo/jetty/deployment/JettyModuleBuilderTest.java Sun Apr 16 02:44:54 2006
@@ -137,6 +137,7 @@
 
     private EARContext createEARContext(File outputPath, Environment environment, Repository repository, ConfigurationStore configStore, AbstractName moduleName) throws DeploymentException {
         return new EARContext(outputPath,
+                null,
                 environment,
                 ConfigurationModuleType.WAR,
                 naming,

Modified: geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationStore.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationStore.java?rev=394448&r1=394447&r2=394448&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationStore.java (original)
+++ geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationStore.java Sun Apr 16 02:44:54 2006
@@ -34,6 +34,20 @@
  * @version $Rev$ $Date$
  */
 public interface ConfigurationStore {
+    
+    /**
+     * Determines if the identified configuration is an in-place one. This 
+     * means that the configuration store only stores some meta-data and the 
+     * actual content of the configuration is rooted somewhere else.
+     * 
+     * @param configId the unique ID of the configuration
+     * @return true if the identified configuration is an in-place one.
+     * @throws NoSuchConfigException if the configuration is not contained in
+     * the store
+     * @throws IOException If the store cannot be read.
+     */
+    boolean isInPlaceConfiguration(Artifact configId) throws NoSuchConfigException, IOException;
+    
     /**
      * Move the unpacked configuration directory into this store
      *

Modified: geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/NullConfigurationStore.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/NullConfigurationStore.java?rev=394448&r1=394447&r2=394448&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/NullConfigurationStore.java (original)
+++ geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/NullConfigurationStore.java Sun Apr 16 02:44:54 2006
@@ -33,6 +33,10 @@
  * @version $Rev: 46019 $ $Date: 2004-09-14 05:56:06 -0400 (Tue, 14 Sep 2004) $
  */
 public class NullConfigurationStore implements ConfigurationStore {
+    public boolean isInPlaceConfiguration(Artifact configId) throws NoSuchConfigException, IOException {
+        return false;
+    }
+    
     public void install(ConfigurationData configurationData) throws IOException, InvalidConfigException {
     }
 

Modified: geronimo/branches/1.1/modules/service-builder/src/java/org/apache/geronimo/deployment/service/ServiceConfigBuilder.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/service-builder/src/java/org/apache/geronimo/deployment/service/ServiceConfigBuilder.java?rev=394448&r1=394447&r2=394448&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/service-builder/src/java/org/apache/geronimo/deployment/service/ServiceConfigBuilder.java (original)
+++ geronimo/branches/1.1/modules/service-builder/src/java/org/apache/geronimo/deployment/service/ServiceConfigBuilder.java Sun Apr 16 02:44:54 2006
@@ -23,8 +23,6 @@
 import java.util.Collection;
 import java.util.HashMap;
 import java.util.Map;
-import java.util.List;
-import java.util.Collections;
 import java.util.jar.JarFile;
 import java.beans.PropertyEditorManager;
 import java.net.URI;
@@ -56,13 +54,11 @@
 import org.apache.geronimo.kernel.Kernel;
 import org.apache.geronimo.kernel.Naming;
 import org.apache.geronimo.kernel.config.ConfigurationAlreadyExistsException;
-import org.apache.geronimo.kernel.config.ConfigurationData;
 import org.apache.geronimo.kernel.config.ConfigurationModuleType;
 import org.apache.geronimo.kernel.config.ConfigurationStore;
 import org.apache.geronimo.kernel.repository.Artifact;
 import org.apache.geronimo.kernel.repository.Environment;
 import org.apache.geronimo.kernel.repository.Repository;
-import org.apache.geronimo.schema.SchemaConversionUtils;
 import org.apache.xmlbeans.XmlCursor;
 import org.apache.xmlbeans.XmlException;
 import org.apache.xmlbeans.XmlObject;
@@ -188,15 +184,16 @@
             throw new DeploymentException(e);
         }
 
-        DeploymentContext context = new DeploymentContext(outfile, null,environment, ConfigurationModuleType.SERVICE, naming, repositories, configurationStores);
+        DeploymentContext context = new DeploymentContext(outfile, 
+                inPlaceDeployment && null != jar ? DeploymentUtil.toFile(jar) : null,
+                environment, 
+                ConfigurationModuleType.SERVICE, 
+                naming, 
+                repositories, 
+                configurationStores);
         if(jar != null) {
-            if(inPlaceDeployment) {
-                //todo: add the JAR to the configuration Class Path and do whatever else we need to (may need to set in-place directory on the DeploymentContext just above?)
-                throw new UnsupportedOperationException("In-place deployments are not supported yet for services");
-            } else {
-                File file = new File(jar.getName());
-                context.addIncludeAsPackedJar(URI.create(file.getName()), jar);
-            }
+            File file = new File(jar.getName());
+            context.addIncludeAsPackedJar(URI.create(file.getName()), jar);
         }
         try {
             ClassLoader cl = context.getClassLoader();

Modified: geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/configuration/ExecutableConfigurationUtil.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/configuration/ExecutableConfigurationUtil.java?rev=394448&r1=394447&r2=394448&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/configuration/ExecutableConfigurationUtil.java (original)
+++ geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/configuration/ExecutableConfigurationUtil.java Sun Apr 16 02:44:54 2006
@@ -152,9 +152,6 @@
             flush(writer);
             close(writer);
         }
-
-        // write the in place location
-        InPlaceConfigurationUtil.writeInPlaceLocation(configurationData, source);
     }
 
     private static Collection listRecursiveFiles(File file) {

Modified: geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/configuration/InPlaceConfigurationUtil.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/configuration/InPlaceConfigurationUtil.java?rev=394448&r1=394447&r2=394448&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/configuration/InPlaceConfigurationUtil.java (original)
+++ geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/configuration/InPlaceConfigurationUtil.java Sun Apr 16 02:44:54 2006
@@ -32,21 +32,23 @@
 /**
  * @version $Rev: 391886 $ $Date: 2006-04-06 13:15:39 +1000 (Thu, 06 Apr 2006) $
  */
-public final class InPlaceConfigurationUtil {
-	private static final String IN_PLACE_LOCATION_FILE = "inPlaceLocation.txt";
+class InPlaceConfigurationUtil {
+	private static final String IN_PLACE_LOCATION_FILE = "inPlaceLocation.config";
 	
-    private InPlaceConfigurationUtil() {
+    InPlaceConfigurationUtil() {
     }
 
-    public static void writeInPlaceLocation(ConfigurationData configurationData, File source) throws IOException {
+    public boolean isInPlaceConfiguration(File source) {
+        File inPlaceLocation = getInPlaceLocation(source);
+        return inPlaceLocation.exists();
+    }
+    
+    public void writeInPlaceLocation(ConfigurationData configurationData, File source) throws IOException {
     	if (null == configurationData.getInPlaceConfigurationDir()) {
     		return;
     	}
-    	
-        File metaInf = new File(source, "META-INF");
-        metaInf.mkdirs();
-        
-        File inPlaceLocation = new File(metaInf, IN_PLACE_LOCATION_FILE);
+
+        File inPlaceLocation = getInPlaceLocation(source);
         Writer writer = null;
         try {
         	OutputStream os = new FileOutputStream(inPlaceLocation);
@@ -68,9 +70,8 @@
         }
     }
     
-    public static File readInPlaceLocation(File source) throws IOException {
-        File inPlaceLocation = new File(source, "META-INF");
-        inPlaceLocation = new File(inPlaceLocation, IN_PLACE_LOCATION_FILE);
+    public File readInPlaceLocation(File source) throws IOException {
+        File inPlaceLocation = getInPlaceLocation(source);
         
         if (!inPlaceLocation.exists()) {
         	return null;
@@ -90,5 +91,11 @@
 				}
         	}
         }
+    }
+
+    private File getInPlaceLocation(File source) {
+        File inPlaceLocation = new File(source, "META-INF");
+        inPlaceLocation.mkdirs();
+        return new File(inPlaceLocation, IN_PLACE_LOCATION_FILE);
     }
 }

Modified: geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/configuration/RepositoryConfigurationStore.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/configuration/RepositoryConfigurationStore.java?rev=394448&r1=394447&r2=394448&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/configuration/RepositoryConfigurationStore.java (original)
+++ geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/configuration/RepositoryConfigurationStore.java Sun Apr 16 02:44:54 2006
@@ -61,6 +61,7 @@
     private final Kernel kernel;
     private final ObjectName objectName;
     protected final WritableListableRepository repository;
+    private final InPlaceConfigurationUtil inPlaceConfUtil;
 
     public RepositoryConfigurationStore(WritableListableRepository repository) {
         this(null, null, repository);
@@ -70,6 +71,8 @@
         this.kernel = kernel;
         this.objectName = objectName == null ? null : JMXUtil.getObjectName(objectName);
         this.repository = repository;
+        
+        inPlaceConfUtil = new InPlaceConfigurationUtil();
     }
 
     public String getObjectName() {
@@ -169,7 +172,7 @@
         if (location.isDirectory()) {
             File inPlaceLocation = null;
             try {
-                inPlaceLocation = InPlaceConfigurationUtil.readInPlaceLocation(location);
+                inPlaceLocation = inPlaceConfUtil.readInPlaceLocation(location);
             } catch (IOException e) {
             }
             if (null != inPlaceLocation) {
@@ -207,6 +210,10 @@
         ZipOutputStream out = new ZipOutputStream(output);
         byte[] buf = new byte[10240];
         writeToZip(dir, out, "", buf);
+        if (inPlaceConfUtil.isInPlaceConfiguration(dir)) {
+            dir = inPlaceConfUtil.readInPlaceLocation(dir);
+            writeToZip(dir, out, "", buf);
+        }
         out.closeEntry();
         out.finish();
         out.flush();
@@ -248,6 +255,15 @@
         }
     }
 
+    public boolean isInPlaceConfiguration(Artifact configId) throws NoSuchConfigException, IOException {
+        File location = repository.getLocation(configId);
+        if (location.isDirectory()) {
+            return inPlaceConfUtil.isInPlaceConfiguration(location);
+        } else {
+            return false;
+        }
+    }
+    
     public void install(ConfigurationData configurationData) throws IOException, InvalidConfigException {
         // determine the source file/dir
         File source = configurationData.getConfigurationDir();
@@ -280,6 +296,9 @@
         }
 
         ExecutableConfigurationUtil.writeConfiguration(configurationData, destination);
+
+        // write in-place configuration config file, if need be.
+        inPlaceConfUtil.writeInPlaceLocation(configurationData, destination);
     }
 
     public void uninstall(Artifact configId) throws NoSuchConfigException, IOException {

Modified: geronimo/branches/1.1/modules/system/src/test/org/apache/geronimo/system/configuration/InPlaceConfigurationUtilTest.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/system/src/test/org/apache/geronimo/system/configuration/InPlaceConfigurationUtilTest.java?rev=394448&r1=394447&r2=394448&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/system/src/test/org/apache/geronimo/system/configuration/InPlaceConfigurationUtilTest.java (original)
+++ geronimo/branches/1.1/modules/system/src/test/org/apache/geronimo/system/configuration/InPlaceConfigurationUtilTest.java Sun Apr 16 02:44:54 2006
@@ -35,7 +35,9 @@
     private static final File baseConfigDir = new File(basedir, "target/config");
     private static final File configDir = new File(baseConfigDir, "config");
     private static final File inPlaceConfig = new File(baseConfigDir, "inPlaceConfig");
-    
+
+    private InPlaceConfigurationUtil inPlaceConfUtil;
+
 	public void testWriteReadInPlaceLocation() throws Exception {
 		ConfigurationData configurationData = new ConfigurationData(null,
 				null,
@@ -46,20 +48,38 @@
 				inPlaceConfig,
 				new Jsr77Naming());
 		
-		InPlaceConfigurationUtil.writeInPlaceLocation(configurationData, configDir);
+        inPlaceConfUtil.writeInPlaceLocation(configurationData, configDir);
 		
-		File actualInPlaceConfig = InPlaceConfigurationUtil.readInPlaceLocation(configDir);
+		File actualInPlaceConfig = inPlaceConfUtil.readInPlaceLocation(configDir);
 		assertEquals(inPlaceConfig, actualInPlaceConfig);
 	}
 
 	public void testAttemptReadNotExistingInPlaceLocation() throws Exception {
-		File actualInPlaceConfig = InPlaceConfigurationUtil.readInPlaceLocation(configDir);
+		File actualInPlaceConfig = inPlaceConfUtil.readInPlaceLocation(configDir);
 		assertNull(actualInPlaceConfig);
 	}
 
+    public void testIsInPlaceConfiguration() throws Exception {
+        assertFalse(inPlaceConfUtil.isInPlaceConfiguration(configDir));
+        
+        ConfigurationData configurationData = new ConfigurationData(null,
+                null,
+                Collections.EMPTY_LIST,
+                Collections.EMPTY_MAP,
+                new Environment(new Artifact("groupId", "artifactId", "version", "type")),
+                configDir,
+                inPlaceConfig,
+                new Jsr77Naming());
+        
+        inPlaceConfUtil.writeInPlaceLocation(configurationData, configDir);
+        assertTrue(inPlaceConfUtil.isInPlaceConfiguration(configDir));
+    }
+
 	protected void setUp() throws Exception {
 		configDir.mkdirs();
 		inPlaceConfig.mkdirs();
+        
+        inPlaceConfUtil = new InPlaceConfigurationUtil();
 	}
 	
 	protected void tearDown() throws Exception {

Modified: geronimo/branches/1.1/modules/tomcat-builder/src/test/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilderTest.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/tomcat-builder/src/test/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilderTest.java?rev=394448&r1=394447&r2=394448&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/tomcat-builder/src/test/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilderTest.java (original)
+++ geronimo/branches/1.1/modules/tomcat-builder/src/test/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilderTest.java Sun Apr 16 02:44:54 2006
@@ -166,6 +166,7 @@
 
     private EARContext createEARContext(File outputPath, Environment environment, Repository repository, ConfigurationStore configStore, AbstractName moduleName) throws DeploymentException {
         return new EARContext(outputPath,
+                null,
                 environment,
                 ConfigurationModuleType.WAR,
                 naming,

Modified: geronimo/branches/1.1/modules/web-builder/src/java/org/apache/geronimo/web/deployment/AbstractWebModuleBuilder.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/web-builder/src/java/org/apache/geronimo/web/deployment/AbstractWebModuleBuilder.java?rev=394448&r1=394447&r2=394448&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/web-builder/src/java/org/apache/geronimo/web/deployment/AbstractWebModuleBuilder.java (original)
+++ geronimo/branches/1.1/modules/web-builder/src/java/org/apache/geronimo/web/deployment/AbstractWebModuleBuilder.java Sun Apr 16 02:44:54 2006
@@ -44,7 +44,6 @@
 import org.apache.geronimo.gbean.AbstractName;
 import org.apache.geronimo.gbean.AbstractNameQuery;
 import org.apache.geronimo.j2ee.deployment.EARContext;
-import org.apache.geronimo.j2ee.deployment.InPlaceEARContext;
 import org.apache.geronimo.j2ee.deployment.Module;
 import org.apache.geronimo.j2ee.deployment.ModuleBuilder;
 import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
@@ -180,20 +179,16 @@
 
             // construct the web app deployment context... this is the same class used by the ear context
             try {
+                File inPlaceConfigurationDir = null;
                 if (null != earContext.getInPlaceConfigurationDir()) {
-                    moduleContext = new InPlaceEARContext(configurationDir,
-                            new File(earContext.getInPlaceConfigurationDir(), module.getTargetPath()),
-                            environment,
-                            ConfigurationModuleType.WAR,
-                            module.getModuleName(),
-                            earContext);
-                } else {
-                    moduleContext = new EARContext(configurationDir,
-                            environment,
-                            ConfigurationModuleType.WAR,
-                            module.getModuleName(),
-                            earContext);
+                    inPlaceConfigurationDir = new File(earContext.getInPlaceConfigurationDir(), module.getTargetPath());
                 }
+                moduleContext = new EARContext(configurationDir,
+                        inPlaceConfigurationDir,
+                        environment,
+                        ConfigurationModuleType.WAR,
+                        module.getModuleName(),
+                        earContext);
             } catch (DeploymentException e) {
                 DeploymentUtil.recursiveDelete(configurationDir);
                 throw e;



Mime
View raw message