You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by jd...@apache.org on 2006/08/04 20:15:29 UTC
svn commit: r428809 - in /geronimo/sandbox/svkmerge/trunk: ./
modules/deploy-jsr88/src/java/org/apache/geronimo/deployment/plugin/
modules/deploy-jsr88/src/java/org/apache/geronimo/deployment/plugin/local/
modules/kernel/src/java/org/apache/geronimo/ke...
Author: jdillon
Date: Fri Aug 4 11:15:28 2006
New Revision: 428809
URL: http://svn.apache.org/viewvc?rev=428809&view=rev
Log:
r635@jason-dillons-computer (orig r428535): ammulder | 2006-08-03 14:36:04 -0700
Merge fixes for GERONIMO-2269 and GERONIMO-2270 to trunk.
May want to rethink these as part of subsequent refactoring efforts,
but better to not have the bugs for now.
Modified:
geronimo/sandbox/svkmerge/trunk/ (props changed)
geronimo/sandbox/svkmerge/trunk/modules/deploy-jsr88/src/java/org/apache/geronimo/deployment/plugin/ConfigIDExtractor.java
geronimo/sandbox/svkmerge/trunk/modules/deploy-jsr88/src/java/org/apache/geronimo/deployment/plugin/local/RedeployCommand.java
geronimo/sandbox/svkmerge/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/config/SimpleConfigurationManager.java
Propchange: geronimo/sandbox/svkmerge/trunk/
------------------------------------------------------------------------------
--- svk:merge (original)
+++ svk:merge Fri Aug 4 11:15:28 2006
@@ -1,2 +1,2 @@
13f79535-47bb-0310-9956-ffa450edef68:/geronimo/sandbox/svkmerge/m2migration:419395
-13f79535-47bb-0310-9956-ffa450edef68:/geronimo/trunk:428469
+13f79535-47bb-0310-9956-ffa450edef68:/geronimo/trunk:428535
Modified: geronimo/sandbox/svkmerge/trunk/modules/deploy-jsr88/src/java/org/apache/geronimo/deployment/plugin/ConfigIDExtractor.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/svkmerge/trunk/modules/deploy-jsr88/src/java/org/apache/geronimo/deployment/plugin/ConfigIDExtractor.java?rev=428809&r1=428808&r2=428809&view=diff
==============================================================================
--- geronimo/sandbox/svkmerge/trunk/modules/deploy-jsr88/src/java/org/apache/geronimo/deployment/plugin/ConfigIDExtractor.java (original)
+++ geronimo/sandbox/svkmerge/trunk/modules/deploy-jsr88/src/java/org/apache/geronimo/deployment/plugin/ConfigIDExtractor.java Fri Aug 4 11:15:28 2006
@@ -16,32 +16,29 @@
*/
package org.apache.geronimo.deployment.plugin;
-import java.io.File;
-import java.io.IOException;
-import java.io.Reader;
import java.io.BufferedReader;
+import java.io.File;
import java.io.FileReader;
+import java.io.IOException;
import java.io.InputStreamReader;
-import java.io.DataInputStream;
-import java.io.BufferedInputStream;
-import java.io.FileInputStream;
-import java.util.jar.JarFile;
-import java.util.jar.JarEntry;
-import java.util.Stack;
+import java.io.Reader;
import java.util.Collection;
-import java.util.List;
import java.util.LinkedList;
-import javax.xml.parsers.SAXParserFactory;
-import javax.xml.parsers.SAXParser;
-import javax.xml.parsers.ParserConfigurationException;
+import java.util.List;
+import java.util.Stack;
+import java.util.jar.JarEntry;
+import java.util.jar.JarFile;
import javax.enterprise.deploy.spi.TargetModuleID;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
import org.apache.geronimo.common.DeploymentException;
import org.apache.geronimo.common.FileUtils;
import org.apache.geronimo.kernel.repository.Artifact;
import org.apache.geronimo.kernel.repository.Version;
+import org.xml.sax.Attributes;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
-import org.xml.sax.Attributes;
import org.xml.sax.helpers.DefaultHandler;
/**
@@ -98,7 +95,7 @@
return name;
}
} else {
- if(!isJarFile(module)) {
+ if(!FileUtils.isZipFile(module)) {
throw new DeploymentException(module.getAbsolutePath()+" is neither a JAR file nor a directory!");
}
JarFile input = new JarFile(module);
@@ -250,8 +247,12 @@
private String inElement = null;
private Stack parent = new Stack();
private boolean formatIs10 = false;
+ private String defaultType;
public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
+ if(defaultType == null && uri != null && !uri.equals("")) {
+ setDefaultType(uri);
+ }
if(inConfigId) {
if(localName.equals("groupId") || localName.equals("artifactId") || localName.equals("version") || localName.equals("type")) {
inElement = localName;
@@ -269,6 +270,22 @@
parent.push(localName);
}
+ private void setDefaultType(String namespace) {
+ if(namespace.indexOf("web") > -1) {
+ defaultType = "war";
+ } else if(namespace.indexOf("openejb") > -1) {
+ defaultType = "jar";
+ } else if(namespace.indexOf("connector") > -1) {
+ defaultType = "rar";
+ } else if(namespace.indexOf("application-client") > -1) {
+ defaultType = "jar";
+ } else if(namespace.indexOf("application") > -1) {
+ defaultType = "ear";
+ } else {
+ defaultType = "car";
+ }
+ }
+
public void characters(char ch[], int start, int length) throws SAXException {
if(inElement != null) {
formatIs10 = false;
@@ -293,6 +310,9 @@
public void endDocument() throws SAXException {
if(!formatIs10) {
+ if(type.equals("") && defaultType != null) {
+ type = defaultType;
+ }
configId = groupId+"/"+artifactId+"/"+version+"/"+type;
}
if(configId.equals("///")) {
Modified: geronimo/sandbox/svkmerge/trunk/modules/deploy-jsr88/src/java/org/apache/geronimo/deployment/plugin/local/RedeployCommand.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/svkmerge/trunk/modules/deploy-jsr88/src/java/org/apache/geronimo/deployment/plugin/local/RedeployCommand.java?rev=428809&r1=428808&r2=428809&view=diff
==============================================================================
--- geronimo/sandbox/svkmerge/trunk/modules/deploy-jsr88/src/java/org/apache/geronimo/deployment/plugin/local/RedeployCommand.java (original)
+++ geronimo/sandbox/svkmerge/trunk/modules/deploy-jsr88/src/java/org/apache/geronimo/deployment/plugin/local/RedeployCommand.java Fri Aug 4 11:15:28 2006
@@ -169,6 +169,9 @@
}
private void redeploySameConfiguration(ConfigurationManager configurationManager, Artifact configID, Target target) throws Exception {
+ if(!configID.isResolved()) {
+ throw new IllegalStateException("Cannot redeploy same module when module ID is not fully resolved ("+configID+")");
+ }
try {
configurationManager.stopConfiguration(configID);
updateStatus("Stopped "+configID);
Modified: geronimo/sandbox/svkmerge/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/config/SimpleConfigurationManager.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/svkmerge/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/config/SimpleConfigurationManager.java?rev=428809&r1=428808&r2=428809&view=diff
==============================================================================
--- geronimo/sandbox/svkmerge/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/config/SimpleConfigurationManager.java (original)
+++ geronimo/sandbox/svkmerge/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/config/SimpleConfigurationManager.java Fri Aug 4 11:15:28 2006
@@ -53,6 +53,15 @@
protected final Collection repositories;
protected final Collection watchers;
+ /**
+ * When this is not null, it points to the "new" configuration that is
+ * part of an in-process reload operation. This configuration will
+ * definitely be loaded, but might not be started yet. It shold never be
+ * populated outside the scope of a reload operation.
+ */
+ private Configuration reloadingConfiguration;
+
+
public SimpleConfigurationManager(Collection stores, ArtifactResolver artifactResolver, Collection repositories) {
this(stores, artifactResolver, repositories, Collections.EMPTY_SET);
}
@@ -86,6 +95,9 @@
if(!configId.isResolved()) {
throw new IllegalArgumentException("Artifact "+configId+" is not fully resolved");
}
+ if(reloadingConfiguration != null && reloadingConfiguration.getId().equals(configId)) {
+ return true;
+ }
return configurationModel.isLoaded(configId);
}
@@ -228,6 +240,9 @@
if(!configurationId.isResolved()) {
throw new IllegalArgumentException("Artifact "+configurationId+" is not fully resolved");
}
+ if(reloadingConfiguration != null && reloadingConfiguration.getId().equals(configurationId)) {
+ return reloadingConfiguration;
+ }
return (Configuration) configurations.get(configurationId);
}
@@ -769,11 +784,11 @@
}
}
- public LifecycleResults reloadConfiguration(ConfigurationData configurationData) throws LifecycleException, NoSuchConfigException {
+ public synchronized LifecycleResults reloadConfiguration(ConfigurationData configurationData) throws LifecycleException, NoSuchConfigException {
return reloadConfiguration(configurationData, NullLifecycleMonitor.INSTANCE);
}
- public LifecycleResults reloadConfiguration(ConfigurationData configurationData, LifecycleMonitor monitor) throws LifecycleException, NoSuchConfigException {
+ public synchronized LifecycleResults reloadConfiguration(ConfigurationData configurationData, LifecycleMonitor monitor) throws LifecycleException, NoSuchConfigException {
Configuration configuration = getConfiguration(configurationData.getId());
if (configuration == null) {
throw new NoSuchConfigException(configurationData.getId());
@@ -942,6 +957,7 @@
if (configurationId.equals(newConfigurationId)) {
newConfiguration = configuration;
+ reloadingConfiguration = configuration;
} else {
loadedParents.put(configurationId, configuration);
}
@@ -1049,7 +1065,7 @@
configuration = load(existingUnloadedConfiguration.getConfigurationData(),
existingUnloadedConfiguration.getResolvedParentIds(),
Collections.EMPTY_MAP);
-
+ reloadingConfiguration = configuration;
// if the configuration was started before restart it
if (started.contains(existingConfigurationId)) {
start(configuration);
@@ -1081,6 +1097,8 @@
throw new LifecycleException("reload", newConfigurationId, results);
}
+ } finally {
+ reloadingConfiguration = null;
}
}
@@ -1113,6 +1131,7 @@
if (resolvedParentIds != null) {
monitor.loading(configurationId);
configuration = load(unloadedConfiguration.getConfigurationData(), resolvedParentIds, Collections.EMPTY_MAP);
+ reloadingConfiguration = configuration;
monitor.succeeded(configurationId);
@@ -1163,6 +1182,8 @@
skip.add(failedId);
}
+ } finally {
+ reloadingConfiguration = null;
}
}