geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From xuhaih...@apache.org
Subject svn commit: r896339 [1/4] - in /geronimo/server/trunk: framework/modules/geronimo-common/src/main/java/org/apache/geronimo/common/ framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/ framework/modules/geronimo-deplo...
Date Wed, 06 Jan 2010 07:30:40 GMT
Author: xuhaihong
Date: Wed Jan  6 07:29:20 2010
New Revision: 896339

URL: http://svn.apache.org/viewvc?rev=896339&view=rev
Log:
GERONIMO-5008 Create util methods for all the Geronimo components

Added:
    geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/util/FileUtils.java   (with props)
    geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/util/JarUtils.java   (with props)
    geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/util/NestedJarEntry.java   (with props)
    geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/util/NestedJarFile.java   (with props)
    geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/util/UnpackedJarEntry.java   (with props)
    geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/util/UnpackedJarFile.java   (with props)
Removed:
    geronimo/server/trunk/framework/modules/geronimo-common/src/main/java/org/apache/geronimo/common/FileUtils.java
    geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/util/DeploymentUtil.java
    geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/util/NestedJarEntry.java
    geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/util/NestedJarFile.java
    geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/util/UnpackedJarEntry.java
    geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/util/UnpackedJarFile.java
Modified:
    geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/CommandDistribute.java
    geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/CommandRedeploy.java
    geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/ServerConnection.java
    geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/ConfigurationBuilder.java
    geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/CopyResourceContext.java
    geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/Deployer.java
    geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/DeploymentConfigurationManager.java
    geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/InPlaceResourceContext.java
    geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/ModuleIDBuilder.java
    geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/NamespaceDrivenBuilder.java
    geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/NamespaceDrivenBuilderCollection.java
    geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/SingleFileHotDeployer.java
    geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/util/URLInfo.java
    geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/util/UnclosableInputStream.java
    geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/util/XMLUtil.java
    geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/xml/LocalEntityResolver.java
    geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/xml/ParserFactoryImpl.java
    geronimo/server/trunk/framework/modules/geronimo-deployment/src/test/java/org/apache/geronimo/deployment/DeploymentContextTest.java
    geronimo/server/trunk/framework/modules/geronimo-deployment/src/test/java/org/apache/geronimo/deployment/SingleFileHotDeployerTest.java
    geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/gbean/runtime/GBeanOperation.java
    geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/ConfigurationResolver.java
    geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/repository/CopyArtifactTypeHandler.java
    geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/repository/UnpackArtifactTypeHandler.java
    geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/util/IOUtils.java
    geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/util/InputUtils.java
    geronimo/server/trunk/framework/modules/geronimo-kernel/src/test/java/org/apache/geronimo/kernel/mock/MockConfigStore.java
    geronimo/server/trunk/framework/modules/geronimo-plugin/src/main/java/org/apache/geronimo/system/plugin/ArchiverGBean.java
    geronimo/server/trunk/framework/modules/geronimo-service-builder/src/main/java/org/apache/geronimo/deployment/service/ServiceConfigBuilder.java
    geronimo/server/trunk/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/RepositoryConfigurationStore.java
    geronimo/server/trunk/plugins/aries/geronimo-aries-builder/src/main/java/org/apache/geronimo/aries/builder/AriesAppConfigBuilder.java
    geronimo/server/trunk/plugins/axis/geronimo-axis-builder/src/main/java/org/apache/geronimo/axis/builder/AxisBuilder.java
    geronimo/server/trunk/plugins/client/geronimo-client-builder/src/main/java/org/apache/geronimo/client/builder/AppClientModuleBuilder.java
    geronimo/server/trunk/plugins/clustering/geronimo-deploy-farm/src/main/java/org/apache/geronimo/farm/deployment/BasicClusterConfigurationStore.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/connector-1_6/geronimo-connector-builder-1_6/src/test/java/org/apache/geronimo/connector/deployment/ConnectorModuleBuilderTest.java
    geronimo/server/trunk/plugins/hotdeploy/geronimo-hot-deploy/src/main/java/org/apache/geronimo/deployment/hot/DirectoryHotDeployer.java
    geronimo/server/trunk/plugins/hotdeploy/geronimo-hot-deploy/src/main/java/org/apache/geronimo/deployment/hot/DirectoryMonitor.java
    geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder.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/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/EARConfigBuilderTestSupport.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/security/SecurityConfigTest.java
    geronimo/server/trunk/plugins/jaxws/geronimo-jaxws-builder/src/main/java/org/apache/geronimo/jaxws/builder/JAXWSServiceBuilder.java
    geronimo/server/trunk/plugins/jaxws/geronimo-jaxws-builder/src/main/java/org/apache/geronimo/jaxws/builder/WARWebServiceFinder.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/JettyModuleBuilderTest.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/tomcat/geronimo-tomcat7-builder/src/main/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java
    geronimo/server/trunk/plugins/tomcat/geronimo-tomcat7-builder/src/test/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilderTest.java
    geronimo/server/trunk/plugins/tomcat/geronimo-tomcat7/src/main/java/org/apache/geronimo/tomcat/TomcatContainer.java

Modified: geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/CommandDistribute.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/CommandDistribute.java?rev=896339&r1=896338&r2=896339&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/CommandDistribute.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/CommandDistribute.java Wed Jan  6 07:29:20 2010
@@ -33,6 +33,7 @@
 import org.apache.geronimo.common.DeploymentException;
 import org.apache.geronimo.common.FileUtils;
 import org.apache.geronimo.deployment.plugin.jmx.JMXDeploymentManager;
+import org.apache.geronimo.kernel.util.JarUtils;
 
 /**
  * The CLI deployer logic to distribute.
@@ -99,7 +100,7 @@
         if (args.length > 1) {
             File test = new File(args[1]);
             try {
-                if (FileUtils.isJarFile(test) || test.isDirectory()) {
+                if (JarUtils.isJarFile(test) || test.isDirectory()) {
                     if (module != null) {
                         throw new DeploymentSyntaxException("Module and plan cannot both be JAR files or directories!");
                     }

Modified: geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/CommandRedeploy.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/CommandRedeploy.java?rev=896339&r1=896338&r2=896339&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/CommandRedeploy.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/CommandRedeploy.java Wed Jan  6 07:29:20 2010
@@ -30,8 +30,8 @@
 
 import org.apache.geronimo.cli.deployer.CommandArgs;
 import org.apache.geronimo.common.DeploymentException;
-import org.apache.geronimo.common.FileUtils;
 import org.apache.geronimo.kernel.repository.Artifact;
+import org.apache.geronimo.kernel.util.JarUtils;
 
 /**
  * The CLI deployer logic to redeploy.
@@ -69,7 +69,7 @@
                 throw new DeploymentException("Cannot read file " + test.getAbsolutePath());
             }
             try {
-                if (FileUtils.isJarFile(test) || test.isDirectory()) {
+                if (JarUtils.isJarFile(test) || test.isDirectory()) {
                     module = test;
                 } else {
                     plan = test;
@@ -81,7 +81,7 @@
                 test = new File(args[1]);
                 if (test.exists() && test.canRead() && !args[1].equals(args[0])) {
                     try {
-                        if (FileUtils.isJarFile(test) || test.isDirectory()) {
+                        if (JarUtils.isJarFile(test) || test.isDirectory()) {
                             if (module != null) {
                                 throw new DeploymentSyntaxException("Module and plan cannot both be JAR files or directories!");
                             }

Modified: geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/ServerConnection.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/ServerConnection.java?rev=896339&r1=896338&r2=896339&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/ServerConnection.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/ServerConnection.java Wed Jan  6 07:29:20 2010
@@ -31,13 +31,13 @@
 
 import org.apache.geronimo.cli.deployer.ConnectionParams;
 import org.apache.geronimo.common.DeploymentException;
-import org.apache.geronimo.common.FileUtils;
 import org.apache.geronimo.deployment.cli.DeployUtils.SavedAuthentication;
 import org.apache.geronimo.deployment.plugin.factories.AuthenticationFailedException;
 import org.apache.geronimo.deployment.plugin.jmx.JMXDeploymentManager;
 import org.apache.geronimo.deployment.plugin.jmx.LocalDeploymentManager;
 import org.apache.geronimo.kernel.GBeanNotFoundException;
 import org.apache.geronimo.kernel.Kernel;
+import org.apache.geronimo.kernel.util.JarUtils;
 
 /**
  * Supports online connections to the server, via JSR-88, valid only
@@ -58,7 +58,7 @@
     public ServerConnection(ConnectionParams params, PrintWriter out, InputStream in, Kernel kernel, DeploymentFactory geronimoDeploymentFactory) throws DeploymentException {
         this(params, new DefaultUserPasswordHandler(in, out), kernel, geronimoDeploymentFactory);
     }
-    
+
     public ServerConnection(ConnectionParams params, UsernamePasswordHandler handler, Kernel kernel, DeploymentFactory geronimoDeploymentFactory) throws DeploymentException {
         if (null == kernel) {
             throw new IllegalArgumentException("kernel is required");
@@ -76,7 +76,7 @@
         logToSysErr = params.isSyserr();
         boolean offline = params.isOffline();
         boolean secure = params.isSecure();
-        
+
         if ((driver != null) && uri == null) {
             throw new DeploymentSyntaxException("A custom driver requires a custom URI");
         }
@@ -94,9 +94,9 @@
 
             ClassLoader OldCL = Thread.currentThread().getContextClassLoader();
             Thread.currentThread().setContextClassLoader(DeployUtils.class.getClassLoader());
-           
+
             tryToConnect(uri, driver, user, password, secure);
-            
+
             Thread.currentThread().setContextClassLoader(OldCL);
 
         }
@@ -113,7 +113,7 @@
             throw new DeploymentException(e);
         }
     }
-    
+
     public void close() throws DeploymentException {
         if (manager != null) {
             manager.release();
@@ -143,10 +143,10 @@
                 if (savedAuthentication != null) {
                     user = savedAuthentication.getUser();
                     password = new String(savedAuthentication.getPassword());
-                }  
+                }
             } catch (IOException e) {
                 System.out.println("Warning: " + e.getMessage());
-            }          
+            }
         }
 
         if (user == null || password == null) {
@@ -180,7 +180,7 @@
     private void loadDriver(String driver, DeploymentFactoryManager mgr) throws DeploymentException {
         File file = new File(driver);
         try {
-            if (!file.exists() || !file.canRead() || !FileUtils.isJarFile(file)) {
+            if (!file.exists() || !file.canRead() || !JarUtils.isJarFile(file)) {
                 throw new DeploymentSyntaxException("Driver '" + file.getAbsolutePath() + "' is not a readable JAR file");
             }
         } catch (IOException e) {
@@ -215,7 +215,7 @@
         String getUsername() throws IOException;
         String getPassword() throws IOException;
     }
-    
+
     private static class DefaultUserPasswordHandler implements UsernamePasswordHandler {
 
         private PrintWriter out;
@@ -226,12 +226,12 @@
             this.out = out;
             this.in = in;
         }
-        
+
         private void initPrompt() throws IOException {
             this.prompt = new InputPrompt(this.in, this.out);
         }
-        
-        public String getPassword() throws IOException {   
+
+        public String getPassword() throws IOException {
             initPrompt();
             return this.prompt.getPassword("Password: ");
         }
@@ -240,6 +240,6 @@
             initPrompt();
             return this.prompt.getInput("Username: ");
         }
-        
+
     }
 }

Modified: geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/ConfigurationBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/ConfigurationBuilder.java?rev=896339&r1=896338&r2=896339&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/ConfigurationBuilder.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/ConfigurationBuilder.java Wed Jan  6 07:29:20 2010
@@ -20,11 +20,9 @@
 import java.io.File;
 import java.io.IOException;
 import java.util.Collection;
-import java.util.List;
 import java.util.jar.JarFile;
 
 import org.apache.geronimo.common.DeploymentException;
-import org.apache.geronimo.deployment.DeploymentContext;
 import org.apache.geronimo.kernel.config.ConfigurationStore;
 import org.apache.geronimo.kernel.repository.Artifact;
 import org.apache.geronimo.kernel.repository.ArtifactResolver;

Modified: geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/CopyResourceContext.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/CopyResourceContext.java?rev=896339&r1=896338&r2=896339&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/CopyResourceContext.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/CopyResourceContext.java Wed Jan  6 07:29:20 2010
@@ -30,7 +30,8 @@
 import java.util.zip.ZipFile;
 
 import org.apache.geronimo.common.DeploymentException;
-import org.apache.geronimo.deployment.util.DeploymentUtil;
+import org.apache.geronimo.kernel.util.IOUtils;
+import org.apache.geronimo.kernel.util.JarUtils;
 
 class CopyResourceContext implements ResourceContext {
     private final DeploymentContext deploymentContext;
@@ -59,7 +60,7 @@
         if (targetPath.getPath().endsWith("/")) throw new IllegalStateException("target path must not end with a '/' character: " + targetPath);
 
         File targetFile = getTargetFile(targetPath);
-        DeploymentUtil.copyToPackedJar(jarFile, targetFile);
+        JarUtils.copyToPackedJar(jarFile, targetFile);
 
         if (!targetFile.isFile()) throw new IllegalStateException("target file should be a file: " + targetFile);
         deploymentContext.addToClassPath(targetPath.toString());
@@ -148,7 +149,7 @@
         try {
             out.write(contents);
         } finally {
-            DeploymentUtil.close(out);
+            IOUtils.close(out);
         }
     }
 
@@ -170,7 +171,7 @@
             try {
                 addFile(targetFile, is);
             } finally {
-                DeploymentUtil.close(is);
+                IOUtils.close(is);
             }
         }
     }
@@ -181,7 +182,7 @@
             in = source.openStream();
             addFile(targetFile, in);
         } finally {
-            DeploymentUtil.close(in);
+            IOUtils.close(in);
         }
     }
 
@@ -191,7 +192,7 @@
             in = new FileInputStream(source);
             addFile(targetFile, in);
         } finally {
-            DeploymentUtil.close(in);
+            IOUtils.close(in);
         }
     }
 
@@ -205,7 +206,7 @@
                 out.write(buffer, 0, count);
             }
         } finally {
-            DeploymentUtil.close(out);
+            IOUtils.close(out);
         }
     }
 }
\ No newline at end of file

Modified: geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/Deployer.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/Deployer.java?rev=896339&r1=896338&r2=896339&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/Deployer.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/Deployer.java Wed Jan  6 07:29:20 2010
@@ -37,10 +37,7 @@
 
 import javax.management.ObjectName;
 
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 import org.apache.geronimo.common.DeploymentException;
-import org.apache.geronimo.deployment.util.DeploymentUtil;
 import org.apache.geronimo.gbean.AbstractName;
 import org.apache.geronimo.gbean.AbstractNameQuery;
 import org.apache.geronimo.gbean.GBeanInfo;
@@ -48,18 +45,23 @@
 import org.apache.geronimo.gbean.GBeanLifecycle;
 import org.apache.geronimo.kernel.GBeanNotFoundException;
 import org.apache.geronimo.kernel.Kernel;
-import org.apache.geronimo.kernel.osgi.BundleClassLoader;
 import org.apache.geronimo.kernel.config.Configuration;
 import org.apache.geronimo.kernel.config.ConfigurationData;
 import org.apache.geronimo.kernel.config.ConfigurationManager;
 import org.apache.geronimo.kernel.config.ConfigurationStore;
 import org.apache.geronimo.kernel.config.ConfigurationUtil;
-import org.apache.geronimo.kernel.config.InvalidConfigException;
 import org.apache.geronimo.kernel.config.DeploymentWatcher;
+import org.apache.geronimo.kernel.config.InvalidConfigException;
+import org.apache.geronimo.kernel.osgi.BundleClassLoader;
 import org.apache.geronimo.kernel.repository.Artifact;
 import org.apache.geronimo.kernel.repository.ArtifactResolver;
+import org.apache.geronimo.kernel.util.FileUtils;
+import org.apache.geronimo.kernel.util.IOUtils;
+import org.apache.geronimo.kernel.util.JarUtils;
 import org.apache.geronimo.system.configuration.ExecutableConfigurationUtil;
 import org.apache.geronimo.system.main.CommandLineManifest;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * GBean that knows how to deploy modules (by consulting available module builders)
@@ -68,7 +70,7 @@
  */
 public class Deployer implements GBeanLifecycle {
     private static final Logger log = LoggerFactory.getLogger(Deployer.class);
-    
+
     private final int REAPER_INTERVAL = 60 * 1000;
     private DeployerReaper reaper;
     private final String remoteDeployAddress;
@@ -119,14 +121,14 @@
                 tmpDir.delete();
                 tmpDir.mkdir();
                 File tmpFile = new File(tmpDir, moduleFile.getName());
-                DeploymentUtil.copyFile(moduleFile, tmpFile);
+                FileUtils.copyFile(moduleFile, tmpFile);
                 moduleFile = tmpFile;
                 cleanup = false;
             } catch (IOException e) {
                 throw new DeploymentException(e);
             } finally {
-                // If an Exception is thrown in the try block above, we will need to cleanup here. 
-                if(cleanup && tmpDir != null && !DeploymentUtil.recursiveDelete(tmpDir)) {
+                // If an Exception is thrown in the try block above, we will need to cleanup here.
+                if(cleanup && tmpDir != null && !FileUtils.recursiveDelete(tmpDir)) {
                     reaper.delete(tmpDir.getAbsolutePath(), "delete");
                 }
             }
@@ -139,7 +141,7 @@
             throw e.cleanse();
         } finally {
             if (tmpDir != null) {
-                if (!DeploymentUtil.recursiveDelete(tmpDir)) {
+                if (!FileUtils.recursiveDelete(tmpDir)) {
                     reaper.delete(tmpDir.getAbsolutePath(), "delete");
                 }
             }
@@ -283,11 +285,11 @@
             }
             throw new Error(e);
         } finally {
-            DeploymentUtil.close(module);
+            JarUtils.close(module);
         }
     }
 
-    private ConfigurationStore getConfigurationStore(String targetConfigurationStore) 
+    private ConfigurationStore getConfigurationStore(String targetConfigurationStore)
             throws URISyntaxException, GBeanNotFoundException {
         if (targetConfigurationStore != null) {
             AbstractName targetStoreName = new AbstractName(new URI(targetConfigurationStore));
@@ -297,16 +299,16 @@
         }
     }
 
-    private Artifact getConfigID(JarFile module, 
-            ModuleIDBuilder idBuilder, 
-            Object plan, 
+    private Artifact getConfigID(JarFile module,
+            ModuleIDBuilder idBuilder,
+            Object plan,
             ConfigurationBuilder builder) throws IOException, DeploymentException, InvalidConfigException {
         Artifact configID = builder.getConfigurationID(plan, module, idBuilder);
         // If the Config ID isn't fully resolved, populate it with defaults
         if (!configID.isResolved()) {
             configID = idBuilder.resolve(configID, "car");
         }
-        
+
         // Make sure this configuration doesn't already exist
         try {
             kernel.getGBeanState(Configuration.getConfigurationAbstractName(configID));
@@ -323,12 +325,12 @@
             ConfigurationStore store,
             DeploymentContext context) throws DeploymentException, IOException, Throwable {
         List<ConfigurationData> configurationDatas = new ArrayList<ConfigurationData>();
-        
+
         boolean configsCleanupRequired = false;
 
         // Set TCCL to the classloader for the configuration being deployed
-        // so that any static blocks invoked during the loading of classes 
-        // during serialization of the configuration have the correct TCCL 
+        // so that any static blocks invoked during the loading of classes
+        // during serialization of the configuration have the correct TCCL
         // ( a TCCL that is consistent with what is set when the same
         // classes are loaded when the configuration is started.
         Thread thread = Thread.currentThread();
@@ -339,7 +341,7 @@
             try {
                 configurationDatas.add(context.getConfigurationData());
             } catch (DeploymentException e) {
-                Configuration configuration = context.getConfiguration(); 
+                Configuration configuration = context.getConfiguration();
                 if (configuration != null) {
                     ConfigurationData dumbConfigurationData = new ConfigurationData(null, null, null,
                             configuration.getEnvironment(), context.getBaseDir(), null, context.getNaming());
@@ -348,7 +350,7 @@
                 configurationDatas.addAll(context.getAdditionalDeployment());
                 throw e;
             }
-            
+
             configurationDatas.addAll(context.getAdditionalDeployment());
 
             if (configurationDatas.isEmpty()) {
@@ -445,7 +447,7 @@
                 throw new DeploymentException("Module file does not exist: " + moduleFile.getAbsolutePath());
             }
             try {
-                module = DeploymentUtil.createJarFile(moduleFile);
+                module = JarUtils.createJarFile(moduleFile);
             } catch (IOException e) {
                 throw new DeploymentException("Cound not open module file: " + moduleFile.getAbsolutePath(), e);
             }
@@ -483,15 +485,15 @@
         for (Iterator iterator = configurations.iterator(); iterator.hasNext();) {
             ConfigurationData configurationData = (ConfigurationData) iterator.next();
             File configurationDir = configurationData.getConfigurationDir();
-            if (!DeploymentUtil.recursiveDelete(configurationDir)) {
+            if (!FileUtils.recursiveDelete(configurationDir)) {
                 reaper.delete(configurationDir.getAbsolutePath(), "delete");
             }
         }
     }
-    
+
     public void doStart() throws Exception {
     }
-    
+
     public void doFail() {
         if (reaper != null) {
             reaper.close();
@@ -521,7 +523,7 @@
             log.debug("Queued deployment directory to be reaped " + dir);
             startThread();
         }
-        
+
         private synchronized void startThread() {
             if (this.thread == null) {
                 this.thread = new Thread(this, "Geronimo Config Store Reaper");
@@ -529,7 +531,7 @@
                 this.thread.start();
             }
         }
-        
+
         public void close() {
             this.done = true;
         }
@@ -565,7 +567,7 @@
                     }});
                 for(String dir: backlog) {
                     File deleteDir = new File(tempDir, dir);
-                    DeploymentUtil.recursiveDelete(deleteDir);
+                    FileUtils.recursiveDelete(deleteDir);
                     log.debug("Reaped deployment directory from previous runs " + deleteDir);
                 }
             } catch (IOException ignored) {
@@ -586,7 +588,7 @@
                 String dirName = (String) list.nextElement();
                 File deleteDir = new File(dirName);
 
-                if (DeploymentUtil.recursiveDelete(deleteDir)) {
+                if (FileUtils.recursiveDelete(deleteDir)) {
                     pendingDeletionIndex.remove(dirName);
                     log.debug("Reaped deployment directory " + deleteDir);
                 }

Modified: geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/DeploymentConfigurationManager.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/DeploymentConfigurationManager.java?rev=896339&r1=896338&r2=896339&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/DeploymentConfigurationManager.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/DeploymentConfigurationManager.java Wed Jan  6 07:29:20 2010
@@ -29,7 +29,9 @@
 import org.apache.geronimo.kernel.config.ConfigurationData;
 import org.apache.geronimo.kernel.config.ConfigurationInfo;
 import org.apache.geronimo.kernel.config.ConfigurationManager;
+import org.apache.geronimo.kernel.config.ConfigurationModel;
 import org.apache.geronimo.kernel.config.ConfigurationStore;
+import org.apache.geronimo.kernel.config.DeploymentWatcher;
 import org.apache.geronimo.kernel.config.InvalidConfigException;
 import org.apache.geronimo.kernel.config.LifecycleException;
 import org.apache.geronimo.kernel.config.LifecycleMonitor;
@@ -37,14 +39,12 @@
 import org.apache.geronimo.kernel.config.NoSuchConfigException;
 import org.apache.geronimo.kernel.config.NoSuchStoreException;
 import org.apache.geronimo.kernel.config.SimpleConfigurationManager;
-import org.apache.geronimo.kernel.config.ConfigurationModel;
-import org.apache.geronimo.kernel.config.DeploymentWatcher;
 import org.apache.geronimo.kernel.repository.Artifact;
 import org.apache.geronimo.kernel.repository.ArtifactResolver;
 import org.apache.geronimo.kernel.repository.Repository;
 import org.apache.geronimo.kernel.repository.Version;
-import org.osgi.framework.BundleContext;
 import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
 
 /**
  * @version $Rev$ $Date$

Modified: geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/InPlaceResourceContext.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/InPlaceResourceContext.java?rev=896339&r1=896338&r2=896339&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/InPlaceResourceContext.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/InPlaceResourceContext.java Wed Jan  6 07:29:20 2010
@@ -17,8 +17,8 @@
 package org.apache.geronimo.deployment;
 
 import java.io.File;
-import java.io.IOException;
 import java.io.FileOutputStream;
+import java.io.IOException;
 import java.net.URI;
 import java.net.URISyntaxException;
 import java.net.URL;
@@ -29,12 +29,13 @@
 import java.util.zip.ZipFile;
 
 import org.apache.geronimo.common.DeploymentException;
-import org.apache.geronimo.deployment.util.DeploymentUtil;
-import org.apache.geronimo.deployment.util.NestedJarFile;
+import org.apache.geronimo.kernel.util.IOUtils;
+import org.apache.geronimo.kernel.util.JarUtils;
+import org.apache.geronimo.kernel.util.NestedJarFile;
 
 class InPlaceResourceContext implements ResourceContext {
     private static final String PACKED_MODULED_SAVED_SUFFIX = ".saved";
-    
+
     private final DeploymentContext deploymentContext;
     private final URI inPlaceBaseConfigurationUri;
     private final Set<ZipFile> zipFilesToExpand = new HashSet<ZipFile>();
@@ -59,7 +60,7 @@
                 zipFilesToExpand.add(zipFile);
             }
         }
-        
+
         deploymentContext.addToClassPath(targetPath.toString());
     }
 
@@ -99,7 +100,7 @@
         try {
             out.write(contents);
         } finally {
-            DeploymentUtil.close(out);
+            IOUtils.close(out);
         }
     }
 
@@ -109,7 +110,7 @@
         if (targetPath.isOpaque()) throw new IllegalArgumentException("targetPath is opaque");
         return new File(inPlaceBaseConfigurationUri.resolve(targetPath));
     }
-    
+
     public void flush() throws IOException {
         for (ZipFile zipFile : zipFilesToExpand) {
             String name = zipFile.getName();
@@ -132,9 +133,9 @@
                         name + " to " + targetFile.getAbsolutePath());
             }
 
-            DeploymentUtil.unzipToDirectory(new ZipFile(targetFile), srcFile);
+            JarUtils.unzipToDirectory(new ZipFile(targetFile), srcFile);
         }
     }
-    
-    
+
+
 }
\ No newline at end of file

Modified: geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/ModuleIDBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/ModuleIDBuilder.java?rev=896339&r1=896338&r2=896339&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/ModuleIDBuilder.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/ModuleIDBuilder.java Wed Jan  6 07:29:20 2010
@@ -17,8 +17,8 @@
 package org.apache.geronimo.deployment;
 
 import org.apache.geronimo.kernel.repository.Artifact;
-import org.apache.geronimo.kernel.repository.Version;
 import org.apache.geronimo.kernel.repository.Environment;
+import org.apache.geronimo.kernel.repository.Version;
 
 /**
  * A utility class to flesh out any incomplete Module IDs (formerly known as

Modified: geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/NamespaceDrivenBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/NamespaceDrivenBuilder.java?rev=896339&r1=896338&r2=896339&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/NamespaceDrivenBuilder.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/NamespaceDrivenBuilder.java Wed Jan  6 07:29:20 2010
@@ -17,12 +17,9 @@
 
 package org.apache.geronimo.deployment;
 
-import java.util.List;
-
-import org.apache.xmlbeans.XmlObject;
 import org.apache.geronimo.common.DeploymentException;
-import org.apache.geronimo.gbean.AbstractName;
 import org.apache.geronimo.kernel.repository.Environment;
+import org.apache.xmlbeans.XmlObject;
 
 /**
  * @version $Rev$ $Date$

Modified: geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/NamespaceDrivenBuilderCollection.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/NamespaceDrivenBuilderCollection.java?rev=896339&r1=896338&r2=896339&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/NamespaceDrivenBuilderCollection.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/NamespaceDrivenBuilderCollection.java Wed Jan  6 07:29:20 2010
@@ -18,9 +18,6 @@
 package org.apache.geronimo.deployment;
 
 import java.util.Collection;
-import java.util.Iterator;
-
-import javax.xml.namespace.QName;
 
 import org.apache.geronimo.common.DeploymentException;
 import org.apache.geronimo.kernel.repository.Environment;

Modified: geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/SingleFileHotDeployer.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/SingleFileHotDeployer.java?rev=896339&r1=896338&r2=896339&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/SingleFileHotDeployer.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/SingleFileHotDeployer.java Wed Jan  6 07:29:20 2010
@@ -22,14 +22,13 @@
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.Iterator;
-import java.util.List;
 import java.util.LinkedList;
+import java.util.List;
 import java.util.jar.JarFile;
 
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 import org.apache.geronimo.common.DeploymentException;
-import org.apache.geronimo.deployment.util.DeploymentUtil;
+import org.apache.geronimo.gbean.GBeanInfo;
+import org.apache.geronimo.gbean.GBeanInfoBuilder;
 import org.apache.geronimo.kernel.config.ConfigurationData;
 import org.apache.geronimo.kernel.config.ConfigurationInfo;
 import org.apache.geronimo.kernel.config.ConfigurationManager;
@@ -39,9 +38,11 @@
 import org.apache.geronimo.kernel.repository.Artifact;
 import org.apache.geronimo.kernel.repository.ArtifactResolver;
 import org.apache.geronimo.kernel.repository.Version;
+import org.apache.geronimo.kernel.util.FileUtils;
+import org.apache.geronimo.kernel.util.JarUtils;
 import org.apache.geronimo.system.serverinfo.ServerInfo;
-import org.apache.geronimo.gbean.GBeanInfo;
-import org.apache.geronimo.gbean.GBeanInfoBuilder;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * @version $Rev$ $Date$
@@ -82,8 +83,8 @@
         }
 
         // take no action if there is nothing in the directory to deploy.   Perhaps we should
-        // consider doing an undeploy in this case if the application is already deployed. Howevr 
-        // for now this is to handle the case where the application is not already laid down at the 
+        // consider doing an undeploy in this case if the application is already deployed. Howevr
+        // for now this is to handle the case where the application is not already laid down at the
         // time of the initial deploy of this gbean.
         if (dir.list().length == 0) {
             return null;
@@ -123,7 +124,7 @@
 
         JarFile module = null;
         try {
-            module = DeploymentUtil.createJarFile(dir);
+            module = JarUtils.createJarFile(dir);
         } catch (IOException e) {
             throw new DeploymentException("Cound not open module file: " + dir.getAbsolutePath(), e);
         }
@@ -180,7 +181,7 @@
         } catch (Exception e) {
             throw new DeploymentException("Unable to deploy " + dir, e);
         } finally {
-            DeploymentUtil.close(module);
+            JarUtils.close(module);
         }
 
     }
@@ -265,7 +266,7 @@
             }
             throw new Error(e);
         } finally {
-            DeploymentUtil.close(module);
+            JarUtils.close(module);
         }
     }
 
@@ -275,10 +276,10 @@
             ConfigurationData configurationData = (ConfigurationData) iterator.next();
             File dir = configurationData.getConfigurationDir();
             cannotBeDeletedList.clear();
-            if (!DeploymentUtil.recursiveDelete(dir,cannotBeDeletedList)) {
+            if (!FileUtils.recursiveDelete(dir,cannotBeDeletedList)) {
                 // Output a message to help user track down file problem
-                log.warn("Unable to delete " + cannotBeDeletedList.size() + 
-                        " files while recursively deleting directory " 
+                log.warn("Unable to delete " + cannotBeDeletedList.size() +
+                        " files while recursively deleting directory "
                         + dir + LINE_SEP +
                         "The first file that could not be deleted was:" + LINE_SEP + "  "+
                         ( !cannotBeDeletedList.isEmpty() ? cannotBeDeletedList.getFirst() : "") );

Modified: geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/util/URLInfo.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/util/URLInfo.java?rev=896339&r1=896338&r2=896339&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/util/URLInfo.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/util/URLInfo.java Wed Jan  6 07:29:20 2010
@@ -17,8 +17,8 @@
 
 package org.apache.geronimo.deployment.util;
 
-import java.net.URL;
 import java.io.IOException;
+import java.net.URL;
 
 /**
  *

Modified: geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/util/UnclosableInputStream.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/util/UnclosableInputStream.java?rev=896339&r1=896338&r2=896339&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/util/UnclosableInputStream.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/util/UnclosableInputStream.java Wed Jan  6 07:29:20 2010
@@ -17,8 +17,8 @@
 
 package org.apache.geronimo.deployment.util;
 
-import java.io.InputStream;
 import java.io.IOException;
+import java.io.InputStream;
 
 /**
  * This class is a workaround for XMLBeans unfortunate habit of closing streams it reads from

Modified: geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/util/XMLUtil.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/util/XMLUtil.java?rev=896339&r1=896338&r2=896339&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/util/XMLUtil.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/util/XMLUtil.java Wed Jan  6 07:29:20 2010
@@ -18,8 +18,8 @@
 package org.apache.geronimo.deployment.util;
 
 import org.w3c.dom.Element;
-import org.w3c.dom.NodeList;
 import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
 
 /**
  * 

Modified: geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/xml/LocalEntityResolver.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/xml/LocalEntityResolver.java?rev=896339&r1=896338&r2=896339&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/xml/LocalEntityResolver.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/xml/LocalEntityResolver.java Wed Jan  6 07:29:20 2010
@@ -24,14 +24,14 @@
 import java.net.URI;
 import java.util.Vector;
 
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 import org.apache.geronimo.gbean.GBeanInfo;
 import org.apache.geronimo.gbean.GBeanInfoBuilder;
 import org.apache.xml.resolver.Catalog;
 import org.apache.xml.resolver.CatalogEntry;
 import org.apache.xml.resolver.CatalogException;
 import org.apache.xml.resolver.CatalogManager;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.xml.sax.EntityResolver;
 import org.xml.sax.InputSource;
 import org.xml.sax.SAXException;

Modified: geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/xml/ParserFactoryImpl.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/xml/ParserFactoryImpl.java?rev=896339&r1=896338&r2=896339&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/xml/ParserFactoryImpl.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/xml/ParserFactoryImpl.java Wed Jan  6 07:29:20 2010
@@ -21,11 +21,11 @@
 import javax.xml.parsers.DocumentBuilderFactory;
 import javax.xml.parsers.ParserConfigurationException;
 
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 import org.apache.geronimo.gbean.GBeanInfo;
 import org.apache.geronimo.gbean.GBeanInfoBuilder;
 import org.apache.geronimo.kernel.util.XmlUtil;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.xml.sax.EntityResolver;
 import org.xml.sax.ErrorHandler;
 import org.xml.sax.SAXParseException;

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=896339&r1=896338&r2=896339&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 Wed Jan  6 07:29:20 2010
@@ -25,16 +25,17 @@
 import java.util.jar.JarFile;
 
 import junit.framework.TestCase;
+
 import org.apache.geronimo.common.DeploymentException;
-import org.apache.geronimo.deployment.util.DeploymentUtil;
 import org.apache.geronimo.gbean.AbstractName;
 import org.apache.geronimo.kernel.Jsr77Naming;
-import org.apache.geronimo.kernel.osgi.MockBundleContext;
-import org.apache.geronimo.kernel.config.ConfigurationModuleType;
 import org.apache.geronimo.kernel.config.ConfigurationData;
+import org.apache.geronimo.kernel.config.ConfigurationModuleType;
 import org.apache.geronimo.kernel.mock.MockConfigurationManager;
+import org.apache.geronimo.kernel.osgi.MockBundleContext;
 import org.apache.geronimo.kernel.repository.Artifact;
 import org.apache.geronimo.kernel.repository.Environment;
+import org.apache.geronimo.kernel.util.JarUtils;
 import org.osgi.framework.BundleContext;
 
 /**
@@ -104,7 +105,7 @@
          * @throws IOException ain't gonna happen.
          */
         public MockJarFile(URI relativeURI, String manifestClasspath) throws IOException {
-            super(DeploymentUtil.DUMMY_JAR_FILE);
+            super(JarUtils.DUMMY_JAR_FILE);
             this.relativeURI = relativeURI;
             this.manifestClasspath = manifestClasspath;
         }
@@ -121,9 +122,9 @@
     static class MockJarFileFactory implements DeploymentContext.JarFileFactory {
 
         private final Map<URI, String> data;
-        
+
         private File[] filesInLib2 = {new File("../../libfolder/a.jar") ,new File( "../../libfolder/b.jar"),new File( "../../libfolder/c.txt"), new File("../../libfolder/subfolder")};
-        
+
         public MockJarFileFactory(Map<URI, String> data) {
             this.data = data;
         }
@@ -136,7 +137,7 @@
         public String getManifestClassPath(JarFile jarFile) throws IOException {
             return ((MockJarFile)jarFile).getManifestClasspath();
         }
-        
+
         public boolean isDirectory(URI relativeURI) throws IOException {
             return relativeURI.equals(URI.create("libfolder")) || relativeURI.equals(URI.create("libfolder/"))
                     || relativeURI.equals(URI.create("libfolder/subfolder"))
@@ -151,7 +152,7 @@
             }
         }
     }
-    
+
     public void testManifestClassPath1() throws Exception {
         MockJarFile start = new MockJarFile(URI.create("ejb.jar"), "lib1.jar");
         URI resolutionURI = URI.create(".");
@@ -185,7 +186,7 @@
         assertEquals("lib2/lib2a.jar", classPathList.get(2));
         assertEquals("lib3.jar", classPathList.get(3));
     }
-    
+
     public void testMainfestClassPath3() throws Exception {
         MockJarFile start = new MockJarFile(URI.create("ejb1/ejb1/ejb1.jar"), "../../lib1/lib1/lib1.jar ../../libfolder");
         URI resolutionURI = URI.create(".");
@@ -200,17 +201,17 @@
         DeploymentContext.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>());       
-        assertEquals(6, classPathList.size());        
+        context.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));
         assertEquals("lib2/lib2a.jar", classPathList.get(2));
         assertEquals("lib3.jar", classPathList.get(3));
         assertEquals("libfolder/a.jar", classPathList.get(4));
         assertEquals("libfolder/b.jar", classPathList.get(5));
-        
-    }    
-    
+
+    }
+
     public void testManifestClassPathWar1() throws Exception {
         MockJarFile start = new MockJarFile(URI.create("war1.war"), "lib1.jar");
         URI resolutionURI = URI.create("../");

Modified: geronimo/server/trunk/framework/modules/geronimo-deployment/src/test/java/org/apache/geronimo/deployment/SingleFileHotDeployerTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-deployment/src/test/java/org/apache/geronimo/deployment/SingleFileHotDeployerTest.java?rev=896339&r1=896338&r2=896339&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-deployment/src/test/java/org/apache/geronimo/deployment/SingleFileHotDeployerTest.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-deployment/src/test/java/org/apache/geronimo/deployment/SingleFileHotDeployerTest.java Wed Jan  6 07:29:20 2010
@@ -27,7 +27,6 @@
 
 import org.apache.geronimo.common.DeploymentException;
 import org.apache.geronimo.kernel.Jsr77Naming;
-import org.apache.geronimo.kernel.osgi.MockBundleContext;
 import org.apache.geronimo.kernel.config.Configuration;
 import org.apache.geronimo.kernel.config.ConfigurationData;
 import org.apache.geronimo.kernel.config.ConfigurationInfo;
@@ -38,8 +37,8 @@
 import org.apache.geronimo.kernel.config.LifecycleResults;
 import org.apache.geronimo.kernel.config.NoSuchConfigException;
 import org.apache.geronimo.kernel.config.SimpleConfigurationManager;
-import org.apache.geronimo.kernel.config.ConfigurationResolver;
 import org.apache.geronimo.kernel.mock.MockConfigStore;
+import org.apache.geronimo.kernel.osgi.MockBundleContext;
 import org.apache.geronimo.kernel.repository.Artifact;
 import org.apache.geronimo.kernel.repository.ArtifactResolver;
 import org.apache.geronimo.kernel.repository.DefaultArtifactResolver;

Modified: geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/gbean/runtime/GBeanOperation.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/gbean/runtime/GBeanOperation.java?rev=896339&r1=896338&r2=896339&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/gbean/runtime/GBeanOperation.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/gbean/runtime/GBeanOperation.java Wed Jan  6 07:29:20 2010
@@ -36,7 +36,7 @@
 public final class GBeanOperation {
     private final GBeanInstance gbeanInstance;
     private final String name;
-    private final List parameterTypes;
+    private List parameterTypes;
     private final MethodInvoker methodInvoker;
     private final boolean framework;
     private final GOperationInfo operationInfo;

Modified: geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/ConfigurationResolver.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/ConfigurationResolver.java?rev=896339&r1=896338&r2=896339&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/ConfigurationResolver.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/ConfigurationResolver.java Wed Jan  6 07:29:20 2010
@@ -31,7 +31,7 @@
 import org.apache.geronimo.kernel.repository.Dependency;
 import org.apache.geronimo.kernel.repository.MissingDependencyException;
 import org.apache.geronimo.kernel.repository.Repository;
-import org.apache.geronimo.kernel.util.IOUtils;
+import org.apache.geronimo.kernel.util.FileUtils;
 
 /**
  * @version $Rev$ $Date$
@@ -51,7 +51,7 @@
      * For nested configurations, the module name will be non-null.
      */
     private final String moduleName;
-   
+
 
     public ConfigurationResolver(Artifact configurationId, File baseDir) {
         if (configurationId == null)  throw new NullPointerException("configurationId is null");
@@ -120,7 +120,7 @@
             Set<URL> matches = configurationStore.resolve(configurationId, moduleName, pattern);
             return matches;
         } else if (baseDir != null) {
-            Set<URL> matches = IOUtils.search(baseDir, pattern);
+            Set<URL> matches = FileUtils.search(baseDir, pattern);
             return matches;
         } else {
             throw new IllegalStateException("No configurationStore or baseDir supplied so paths can not be resolved");
@@ -155,7 +155,7 @@
             }
             throw new MissingDependencyException("Artifact is not resolved and there no artifact resolver available: ", artifact, parentStack);
         }
-        
+
         // resolve the artifact
         try {
             artifact = artifactResolver.resolveInClassLoader(artifact, parents);

Modified: geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/repository/CopyArtifactTypeHandler.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/repository/CopyArtifactTypeHandler.java?rev=896339&r1=896338&r2=896339&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/repository/CopyArtifactTypeHandler.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/repository/CopyArtifactTypeHandler.java Wed Jan  6 07:29:20 2010
@@ -26,6 +26,7 @@
 import org.apache.geronimo.kernel.repository.ArtifactTypeHandler;
 import org.apache.geronimo.kernel.repository.Artifact;
 import org.apache.geronimo.kernel.repository.FileWriteMonitor;
+import org.apache.geronimo.kernel.util.IOUtils;
 
 /**
  * @version $Rev: 476049 $ $Date: 2006-11-17 15:35:17 +1100 (Fri, 17 Nov 2006) $
@@ -64,23 +65,9 @@
                     }
                 }
             }
-            out.close(); // also flushes the stream
-            out = null;
-            in.close();
-            in = null;
         } finally {
-            if (out != null) {
-                try {
-                    out.close();
-                } catch (IOException ignored) {
-                }
-            }
-            if (in != null) {
-                try {
-                    in.close();
-                } catch (IOException ignored) {
-                }
-            }
+            IOUtils.close(in);
+            IOUtils.close(out);
             if (monitor != null) {
                 monitor.writeComplete(total);
             }

Modified: geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/repository/UnpackArtifactTypeHandler.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/repository/UnpackArtifactTypeHandler.java?rev=896339&r1=896338&r2=896339&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/repository/UnpackArtifactTypeHandler.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/repository/UnpackArtifactTypeHandler.java Wed Jan  6 07:29:20 2010
@@ -24,6 +24,7 @@
 import java.util.zip.ZipEntry;
 import java.util.zip.ZipInputStream;
 
+import org.apache.geronimo.kernel.util.FileUtils;
 import org.apache.geronimo.kernel.util.IOUtils;
 
 /**
@@ -81,7 +82,7 @@
                 }
             }
         } catch (IOException e) {
-            IOUtils.recursiveDelete(target);
+            FileUtils.recursiveDelete(target);
             throw e;
         } finally {
             in.close();

Added: geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/util/FileUtils.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/util/FileUtils.java?rev=896339&view=auto
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/util/FileUtils.java (added)
+++ geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/util/FileUtils.java Wed Jan  6 07:29:20 2010
@@ -0,0 +1,359 @@
+/**
+ *  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.kernel.util;
+
+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.MalformedURLException;
+import java.net.URL;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.LinkedHashSet;
+import java.util.LinkedList;
+import java.util.Map;
+import java.util.Set;
+import java.util.jar.JarFile;
+import java.util.zip.ZipEntry;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class FileUtils {
+
+    private static final Logger logger = LoggerFactory.getLogger(FileUtils.class);
+
+    public static void copyFile(File source, File destination) throws IOException {
+        copyFile(source, destination, IOUtils.DEFAULT_COPY_BUFFER_SIZE);
+    }
+
+    public static void copyFile(File source, File destination, int bufferSizeInBytes) throws IOException {
+        if (!source.exists() || source.isFile()) {
+            throw new IllegalArgumentException("Source does not exist or it is not a file");
+        }
+        File destinationDir = destination.getParentFile();
+        if (!destinationDir.exists() && !destinationDir.mkdirs()) {
+            throw new java.io.IOException("Cannot create directory : " + destinationDir);
+        }
+        InputStream in = null;
+        OutputStream out = null;
+        try {
+            in = new FileInputStream(source);
+            out = new FileOutputStream(destination);
+            IOUtils.copy(in, out);
+        } finally {
+            IOUtils.close(in);
+            IOUtils.close(out);
+        }
+    }
+
+    // be careful to clean up the temp directory
+    public static File createTempDir() throws IOException {
+        File tempDir = File.createTempFile("geronimo-fileutils", ".tmpdir");
+        tempDir.delete();
+        tempDir.mkdirs();
+        return tempDir;
+    }
+
+    // be careful to clean up the temp file... we tell the vm to delete this on exit
+    // but VMs can't be trusted to acutally delete the file
+    public static File createTempFile() throws IOException {
+        File tempFile = File.createTempFile("geronimo-fileutils", ".tmpfile");
+        tempFile.deleteOnExit();
+        return tempFile;
+    }
+
+    // be careful to clean up the temp file... we tell the vm to delete this on exit
+    // but VMs can't be trusted to acutally delete the file
+    public static File createTempFile(String extension) throws IOException {
+        File tempFile = File.createTempFile("geronimo-fileutils", extension == null ? ".tmpdir" : extension);
+        tempFile.deleteOnExit();
+        return tempFile;
+    }
+
+    public static Map<String, File> find(File root, String pattern) {
+        Map<String, File> matches = new HashMap<String, File>();
+        find(root, pattern, matches);
+        return matches;
+    }
+
+    public static void find(File root, String pattern, Map<String, File> matches) {
+        if (!SelectorUtils.hasWildcards(pattern)) {
+            File match = new File(root, pattern);
+            if (match.exists() && match.canRead()) {
+                matches.put(pattern, match);
+            }
+        } else {
+            Map<String, File> files = listAllFileNames(root);
+            for (Map.Entry<String, File> entry : files.entrySet()) {
+                String fileName = entry.getKey();
+                if (SelectorUtils.matchPath(pattern, fileName)) {
+                    matches.put(fileName, entry.getValue());
+                }
+            }
+        }
+    }
+
+    public static Map<String, File> listAllFileNames(File base) {
+        return listAllFileNames(base, "");
+    }
+
+    public static Collection<File> listRecursiveFiles(File file) {
+        Collection<File> list = new LinkedList<File>();
+        listRecursiveFiles(file, list);
+        return Collections.unmodifiableCollection(list);
+    }
+
+    public static void listRecursiveFiles(File file, Collection<File> collection) {
+        File[] files = file.listFiles();
+        if (null == files) {
+            return;
+        }
+        for (File file1 : files) {
+            collection.add(file1);
+            if (file1.isDirectory()) {
+                listRecursiveFiles(file1, collection);
+            }
+        }
+    }
+
+    public static void recursiveCopy(File srcDir, File destDir) throws IOException {
+        if (srcDir == null)
+            throw new NullPointerException("sourceDir is null");
+        if (destDir == null)
+            throw new NullPointerException("destDir is null");
+        if (!srcDir.isDirectory() || !srcDir.canRead()) {
+            throw new IllegalArgumentException("Source directory must be a readable directory " + srcDir);
+        }
+        if (destDir.exists()) {
+            throw new IllegalArgumentException("Destination directory already exists " + destDir);
+        }
+        if (srcDir.equals(destDir)) {
+            throw new IllegalArgumentException("Source and destination directory are the same " + srcDir);
+        }
+        destDir.mkdirs();
+        if (!destDir.exists()) {
+            throw new IOException("Could not create destination directory " + destDir);
+        }
+        File[] srcFiles = srcDir.listFiles();
+        if (srcFiles != null) {
+            for (int i = 0; i < srcFiles.length; i++) {
+                File srcFile = srcFiles[i];
+                File destFile = new File(destDir, srcFile.getName());
+                if (srcFile.isDirectory()) {
+                    recursiveCopy(srcFile, destFile);
+                } else {
+                    copyFile(srcFile, destFile);
+                }
+            }
+        }
+    }
+
+    public static boolean recursiveDelete(File root) {
+        return recursiveDelete(root, null);
+    }
+
+    public static boolean recursiveDelete(File root, Collection<String> unableToDeleteCollection) {
+        if (root == null) {
+            return true;
+        }
+        if (root.isDirectory()) {
+            File[] files = root.listFiles();
+            if (files != null) {
+                for (int i = 0; i < files.length; i++) {
+                    File file = files[i];
+                    if (file.isDirectory()) {
+                        recursiveDelete(file, unableToDeleteCollection);
+                    } else {
+                        if (!file.delete() && unableToDeleteCollection != null) {
+                            unableToDeleteCollection.add(file.getAbsolutePath());
+                        }
+                    }
+                    // help out the GC of file handles by nulling the references
+                    files[i] = null;
+                }
+            }
+        }
+        boolean rootDeleteStatus;
+        if (!(rootDeleteStatus = root.delete()) && unableToDeleteCollection != null)
+            unableToDeleteCollection.add(root.getAbsolutePath());
+        return rootDeleteStatus;
+    }
+
+    public static boolean recursiveDelete2(File root) {
+        if (root == null) {
+            return true;
+        }
+        if (root.isDirectory()) {
+            File[] files = root.listFiles();
+            if (files != null) {
+                for (int i = 0; i < files.length; i++) {
+                    File file = files[i];
+                    if (file.isDirectory()) {
+                        recursiveDelete(file);
+                    } else {
+                        deleteFile(file);
+                    }
+                }
+            }
+        }
+        return deleteFile(root);
+    }
+
+    public static Set<URL> search(File root, String pattern) throws MalformedURLException {
+        if (root.isDirectory()) {
+            if (pattern == null || pattern.length() == 0) {
+                return Collections.singleton(new URL("file:" + root.toURI().normalize().getPath()));
+            }
+            if (!SelectorUtils.hasWildcards(pattern)) {
+                File match = new File(root, pattern);
+                if (match.exists() && match.canRead()) {
+                    return Collections.singleton(new URL("file:" + match.toURI().normalize().getPath()));
+                } else {
+                    return Collections.emptySet();
+                }
+            } else {
+                Set<URL> matches = new LinkedHashSet<URL>();
+                Map<String, File> files = listAllFileNames(root);
+                for (Map.Entry<String, File> entry : files.entrySet()) {
+                    String fileName = entry.getKey();
+                    if (SelectorUtils.matchPath(pattern, fileName)) {
+                        File file = entry.getValue();
+                        matches.add(new URL("file:" + file.toURI().normalize().getPath()));
+                    }
+                }
+                return matches;
+            }
+        } else {
+            JarFile jarFile = null;
+            try {
+                jarFile = new JarFile(root);
+                URL baseURL = new URL("jar:" + root.toURI().toURL().toString() + "!/");
+                if (pattern == null || pattern.length() == 0) {
+                    return Collections.singleton(baseURL);
+                }
+                if (!SelectorUtils.hasWildcards(pattern)) {
+                    ZipEntry entry = jarFile.getEntry(pattern);
+                    if (entry != null) {
+                        URL match = new URL(baseURL, entry.getName());
+                        return Collections.singleton(match);
+                    } else {
+                        return Collections.emptySet();
+                    }
+                } else {
+                    Set<URL> matches = new LinkedHashSet<URL>();
+                    Enumeration entries = jarFile.entries();
+                    while (entries.hasMoreElements()) {
+                        ZipEntry entry = (ZipEntry) entries.nextElement();
+                        String fileName = entry.getName();
+                        if (SelectorUtils.matchPath(pattern, fileName)) {
+                            URL url = new URL(baseURL, fileName);
+                            matches.add(url);
+                        }
+                    }
+                    return matches;
+                }
+            } catch (MalformedURLException e) {
+                throw e;
+            } catch (IOException e) {
+                return Collections.emptySet();
+            } finally {
+                JarUtils.close(jarFile);
+            }
+        }
+    }
+
+    private static boolean deleteFile(File file) {
+        boolean fileDeleted = file.delete();
+        if (fileDeleted) {
+            return true;
+        }
+        // special retry code to handle occasional Windows JDK and Unix NFS timing failures
+        int retryLimit = 5;
+        int retries;
+        int interruptions = 0;
+        for (retries = 1; !fileDeleted && retries <= retryLimit; retries++) {
+            if (logger.isDebugEnabled()) {
+                listFiles(file);
+            }
+            System.runFinalization();
+            try {
+                Thread.sleep(1000);
+            } catch (InterruptedException ie) {
+                interruptions++;
+            }
+            System.gc();
+            try {
+                Thread.sleep(1000);
+            } catch (InterruptedException ie) {
+                interruptions++;
+            }
+            fileDeleted = file.delete();
+        }
+        if (fileDeleted) {
+            if (logger.isDebugEnabled()) {
+                logger.debug(file.getPath() + " deleted after " + retries + " retries, with " + interruptions + " interruptions.");
+            }
+        } else {
+            logger.warn(file.getPath() + " not deleted after " + retryLimit + " retries, with " + interruptions + " interruptions.");
+        }
+        return fileDeleted;
+    }
+
+    private static Map<String, File> listAllFileNames(File base, String prefix) {
+        if (!base.canRead() || !base.isDirectory()) {
+            throw new IllegalArgumentException(base.getAbsolutePath());
+        }
+        Map<String, File> map = new LinkedHashMap<String, File>();
+        File[] hits = base.listFiles();
+        for (File hit : hits) {
+            if (hit.canRead()) {
+                if (hit.isDirectory()) {
+                    map.putAll(listAllFileNames(hit, prefix.equals("") ? hit.getName() : prefix + "/" + hit.getName()));
+                } else {
+                    map.put(prefix.equals("") ? hit.getName() : prefix + "/" + hit.getName(), hit);
+                }
+            }
+        }
+        map.put(prefix, base);
+        return map;
+    }
+
+    private static void listFiles(File directory) {
+        if (!logger.isDebugEnabled() || !directory.isDirectory()) {
+            return;
+        }
+        File[] files = directory.listFiles();
+        logger.debug(directory.getPath() + " has " + files.length + " files:");
+        for (File file : files) {
+            logger.debug(file.getPath());
+        }
+    }
+
+    private FileUtils() {
+    }
+}

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

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

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



Mime
View raw message