You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by js...@apache.org on 2006/05/03 08:57:31 UTC
svn commit: r399178 - in /geronimo/branches/1.1/modules:
client-builder/src/java/org/apache/geronimo/client/builder/
deployment/src/java/org/apache/geronimo/deployment/
deployment/src/java/org/apache/geronimo/deployment/util/ j2ee-builder/
j2ee-builder...
Author: jsisson
Date: Tue May 2 23:57:29 2006
New Revision: 399178
URL: http://svn.apache.org/viewcvs?rev=399178&view=rev
Log:
GERONIMO-1970 - Log warning message if files cannot be cleaned up (e.g. due to file in use) during deployment to assist troubleshooting.
Modified:
geronimo/branches/1.1/modules/client-builder/src/java/org/apache/geronimo/client/builder/AppClientModuleBuilder.java
geronimo/branches/1.1/modules/deployment/src/java/org/apache/geronimo/deployment/SingleFileHotDeployer.java
geronimo/branches/1.1/modules/deployment/src/java/org/apache/geronimo/deployment/util/DeploymentUtil.java
geronimo/branches/1.1/modules/j2ee-builder/project.xml
geronimo/branches/1.1/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder.java
geronimo/branches/1.1/modules/web-builder/project.xml
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=399178&r1=399177&r2=399178&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 Tue May 2 23:57:29 2006
@@ -16,6 +16,8 @@
*/
package org.apache.geronimo.client.builder;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.apache.geronimo.client.AppClientContainer;
import org.apache.geronimo.client.StaticJndiContextPlugin;
import org.apache.geronimo.common.DeploymentException;
@@ -76,6 +78,7 @@
import java.util.Collection;
import java.util.Collections;
import java.util.Iterator;
+import java.util.LinkedList;
import java.util.Map;
import java.util.StringTokenizer;
import java.util.jar.Attributes;
@@ -88,7 +91,9 @@
* @version $Rev:385232 $ $Date$
*/
public class AppClientModuleBuilder implements ModuleBuilder {
-
+ private static final Log log = LogFactory.getLog(AppClientModuleBuilder.class);
+ private static final String LINE_SEP = System.getProperty("line.separator");
+
private final Environment defaultClientEnvironment;
private final Environment defaultServerEnvironment;
private final AbstractNameQuery corbaGBeanObjectName;
@@ -366,7 +371,7 @@
new RefContext(getEjbReferenceBuilder(), getResourceReferenceBuilder(), getServiceReferenceBuilder()));
appClientModule.setEarContext(appClientDeploymentContext);
} catch (DeploymentException e) {
- DeploymentUtil.recursiveDelete(appClientDir);
+ cleanupAppClientDir(appClientDir);
throw e;
}
@@ -580,7 +585,7 @@
} catch (Throwable e) {
File appClientDir = appClientDeploymentContext.getBaseDir();
- DeploymentUtil.recursiveDelete(appClientDir);
+ cleanupAppClientDir(appClientDir);
if (e instanceof Error) {
throw (Error) e;
} else if (e instanceof DeploymentException) {
@@ -679,6 +684,22 @@
}
+ private boolean cleanupAppClientDir(File configurationDir)
+ {
+ LinkedList cannotBeDeletedList = new LinkedList();
+
+ if (!DeploymentUtil.recursiveDelete(configurationDir,cannotBeDeletedList)) {
+ // Output a message to help user track down file problem
+ log.warn("Unable to delete " + cannotBeDeletedList.size() +
+ " files while recursively deleting directory "
+ + configurationDir + LINE_SEP +
+ "The first file that could not be deleted was:" + LINE_SEP + " "+
+ ( !cannotBeDeletedList.isEmpty() ? cannotBeDeletedList.getFirst() : "") );
+ return false;
+ }
+ return true;
+ }
+
public static final GBeanInfo GBEAN_INFO;
static {
Modified: geronimo/branches/1.1/modules/deployment/src/java/org/apache/geronimo/deployment/SingleFileHotDeployer.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/deployment/src/java/org/apache/geronimo/deployment/SingleFileHotDeployer.java?rev=399178&r1=399177&r2=399178&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/deployment/src/java/org/apache/geronimo/deployment/SingleFileHotDeployer.java (original)
+++ geronimo/branches/1.1/modules/deployment/src/java/org/apache/geronimo/deployment/SingleFileHotDeployer.java Tue May 2 23:57:29 2006
@@ -23,6 +23,7 @@
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
+import java.util.LinkedList;
import java.util.jar.JarFile;
import org.apache.commons.logging.Log;
@@ -47,6 +48,7 @@
*/
public class SingleFileHotDeployer {
private static final Log log = LogFactory.getLog(SingleFileHotDeployer.class);
+ private static final String LINE_SEP = System.getProperty("line.separator");
private final File dir;
private final String[] watchPaths;
private final Collection builders;
@@ -241,11 +243,18 @@
}
private void cleanupConfigurations(List configurations) {
+ LinkedList cannotBeDeletedList = new LinkedList();
for (Iterator iterator = configurations.iterator(); iterator.hasNext();) {
ConfigurationData configurationData = (ConfigurationData) iterator.next();
File dir = configurationData.getConfigurationDir();
- if (!DeploymentUtil.recursiveDelete(dir)) {
- log.warn("Unable delete directory " + dir);
+ cannotBeDeletedList.clear();
+ if (!DeploymentUtil.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 "
+ + dir + LINE_SEP +
+ "The first file that could not be deleted was:" + LINE_SEP + " "+
+ ( !cannotBeDeletedList.isEmpty() ? cannotBeDeletedList.getFirst() : "") );
}
}
}
Modified: geronimo/branches/1.1/modules/deployment/src/java/org/apache/geronimo/deployment/util/DeploymentUtil.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/deployment/src/java/org/apache/geronimo/deployment/util/DeploymentUtil.java?rev=399178&r1=399177&r2=399178&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/deployment/src/java/org/apache/geronimo/deployment/util/DeploymentUtil.java (original)
+++ geronimo/branches/1.1/modules/deployment/src/java/org/apache/geronimo/deployment/util/DeploymentUtil.java Tue May 2 23:57:29 2006
@@ -277,7 +277,8 @@
}
}
- public static boolean recursiveDelete(File root) {
+
+ public static boolean recursiveDelete(File root, Collection unableToDeleteCollection) {
if (root == null) {
return true;
}
@@ -290,12 +291,18 @@
if (file.isDirectory()) {
recursiveDelete(file);
} else {
- file.delete();
+ if (!file.delete() && unableToDeleteCollection != null) {
+ unableToDeleteCollection.add(file);
+ }
}
}
}
}
return root.delete();
+ }
+
+ public static boolean recursiveDelete(File root) {
+ return recursiveDelete(root,null);
}
public static Collection listRecursiveFiles(File file) {
Modified: geronimo/branches/1.1/modules/j2ee-builder/project.xml
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/j2ee-builder/project.xml?rev=399178&r1=399177&r2=399178&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/j2ee-builder/project.xml (original)
+++ geronimo/branches/1.1/modules/j2ee-builder/project.xml Tue May 2 23:57:29 2006
@@ -131,19 +131,19 @@
<version>${geronimo_spec_jaxrpc_version}</version>
</dependency>
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ <version>${commons_logging_version}</version>
+ <url>http://jakarta.apache.org/commons/logging/</url>
+ </dependency>
+
<!-- test only -->
<dependency>
<groupId>cglib</groupId>
<artifactId>cglib-nodep</artifactId>
<version>${cglib_version}</version>
<url>http://cglib.sf.net/</url>
- </dependency>
-
- <dependency>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- <version>${commons_logging_version}</version>
- <url>http://jakarta.apache.org/commons/logging/</url>
</dependency>
<dependency>
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=399178&r1=399177&r2=399178&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 Tue May 2 23:57:29 2006
@@ -28,6 +28,7 @@
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedHashSet;
+import java.util.LinkedList;
import java.util.Map;
import java.util.Set;
import java.util.LinkedHashMap;
@@ -35,6 +36,8 @@
import java.util.zip.ZipEntry;
import javax.xml.namespace.QName;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.apache.geronimo.common.DeploymentException;
import org.apache.geronimo.deployment.ConfigurationBuilder;
import org.apache.geronimo.deployment.DeploymentContext;
@@ -89,6 +92,9 @@
*/
public class EARConfigBuilder implements ConfigurationBuilder {
+ private static final Log log = LogFactory.getLog(EARConfigBuilder.class);
+ private static final String LINE_SEP = System.getProperty("line.separator");
+
private final static QName APPLICATION_QNAME = GerApplicationDocument.type.getDocumentElementName();
private final ConfigurationManager configurationManager;
@@ -451,7 +457,7 @@
corbaGBeanObjectName,
new RefContext(getEjbReferenceBuilder(), getResourceReferenceBuilder(), getServiceReferenceBuilder()));
- // Copy over all files that are _NOT_ modules
+ // Copy over all files that are _NOT_ modules (e.g. META-INF and APP-INF files)
Set moduleLocations = applicationInfo.getModuleLocations();
if (ConfigurationModuleType.EAR == applicationType && earFile != null) {
for (Enumeration e = earFile.entries(); e.hasMoreElements();) {
@@ -555,31 +561,31 @@
if (earContext != null) {
earContext.close();
}
- DeploymentUtil.recursiveDelete(configurationDir);
+ cleanupConfigurationDir(configurationDir);
throw new DeploymentException(e);
} catch (IOException e) {
if (earContext != null) {
earContext.close();
}
- DeploymentUtil.recursiveDelete(configurationDir);
+ cleanupConfigurationDir(configurationDir);
throw e;
} catch (DeploymentException e) {
if (earContext != null) {
earContext.close();
}
- DeploymentUtil.recursiveDelete(configurationDir);
+ cleanupConfigurationDir(configurationDir);
throw e;
} catch(RuntimeException e) {
if (earContext != null) {
earContext.close();
}
- DeploymentUtil.recursiveDelete(configurationDir);
+ cleanupConfigurationDir(configurationDir);
throw e;
} catch(Error e) {
if (earContext != null) {
earContext.close();
}
- DeploymentUtil.recursiveDelete(configurationDir);
+ cleanupConfigurationDir(configurationDir);
throw e;
} finally {
Set modules = applicationInfo.getModules();
@@ -590,6 +596,22 @@
}
}
+ private boolean cleanupConfigurationDir(File configurationDir)
+ {
+ LinkedList cannotBeDeletedList = new LinkedList();
+
+ if (!DeploymentUtil.recursiveDelete(configurationDir,cannotBeDeletedList)) {
+ // Output a message to help user track down file problem
+ log.warn("Unable to delete " + cannotBeDeletedList.size() +
+ " files while recursively deleting directory "
+ + configurationDir + LINE_SEP +
+ "The first file that could not be deleted was:" + LINE_SEP + " "+
+ ( !cannotBeDeletedList.isEmpty() ? cannotBeDeletedList.getFirst() : "") );
+ return false;
+ }
+ return true;
+ }
+
private static Map filter(Map original, String key, String value) {
LinkedHashMap filter = new LinkedHashMap(original);
filter.put(key, value);
Modified: geronimo/branches/1.1/modules/web-builder/project.xml
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/web-builder/project.xml?rev=399178&r1=399177&r2=399178&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/web-builder/project.xml (original)
+++ geronimo/branches/1.1/modules/web-builder/project.xml Tue May 2 23:57:29 2006
@@ -164,6 +164,13 @@
</dependency>
<dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ <version>${commons_logging_version}</version>
+ <url>http://jakarta.apache.org/commons/logging/</url>
+ </dependency>
+
+ <dependency>
<groupId>mx4j</groupId>
<artifactId>mx4j</artifactId>
<version>${mx4j_version}</version>
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=399178&r1=399177&r2=399178&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 Tue May 2 23:57:29 2006
@@ -30,6 +30,7 @@
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
+import java.util.LinkedList;
import java.util.Map;
import java.util.Set;
import java.util.jar.JarFile;
@@ -39,6 +40,8 @@
import javax.security.jacc.WebRoleRefPermission;
import javax.security.jacc.WebUserDataPermission;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.apache.geronimo.common.DeploymentException;
import org.apache.geronimo.deployment.util.DeploymentUtil;
import org.apache.geronimo.deployment.ModuleIDBuilder;
@@ -73,6 +76,9 @@
* @version $Rev$ $Date$
*/
public abstract class AbstractWebModuleBuilder implements ModuleBuilder {
+ private static final Log log = LogFactory.getLog(AbstractWebModuleBuilder.class);
+ private static final String LINE_SEP = System.getProperty("line.separator");
+
protected static final AbstractNameQuery MANAGED_CONNECTION_FACTORY_PATTERN;
private static final AbstractNameQuery ADMIN_OBJECT_PATTERN;
protected static final AbstractNameQuery STATELESS_SESSION_BEAN_PATTERN;
@@ -191,7 +197,7 @@
module.getModuleName(),
earContext);
} catch (DeploymentException e) {
- DeploymentUtil.recursiveDelete(configurationDir);
+ cleanupConfigurationDir(configurationDir);
throw e;
}
}
@@ -504,6 +510,22 @@
if (webApp.getLoginConfigArray().length > 1) throw new DeploymentException("Multiple <login-config> elements found");
}
+ private boolean cleanupConfigurationDir(File configurationDir)
+ {
+ LinkedList cannotBeDeletedList = new LinkedList();
+
+ if (!DeploymentUtil.recursiveDelete(configurationDir,cannotBeDeletedList)) {
+ // Output a message to help user track down file problem
+ log.warn("Unable to delete " + cannotBeDeletedList.size() +
+ " files while recursively deleting directory "
+ + configurationDir + LINE_SEP +
+ "The first file that could not be deleted was:" + LINE_SEP + " "+
+ ( !cannotBeDeletedList.isEmpty() ? cannotBeDeletedList.getFirst() : "") );
+ return false;
+ }
+ return true;
+ }
+
protected void processRoleRefPermissions(ServletType servletType, Set securityRoles, Map rolePermissions) {
String servletName = servletType.getServletName().getStringValue().trim();
//WebRoleRefPermissions