geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From yunfen...@apache.org
Subject svn commit: r682314 - /geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core/jaxb/MarshallerListener.java
Date Mon, 04 Aug 2008 10:26:20 GMT
Author: yunfengma
Date: Mon Aug  4 03:26:17 2008
New Revision: 682314

URL: http://svn.apache.org/viewvc?rev=682314&view=rev
Log:
GERONIMODEVTOOLS-457 Empty Web Container setting causes 'xml problem for web app' during deployment

Modified:
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core/jaxb/MarshallerListener.java

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core/jaxb/MarshallerListener.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core/jaxb/MarshallerListener.java?rev=682314&r1=682313&r2=682314&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core/jaxb/MarshallerListener.java
(original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core/jaxb/MarshallerListener.java
Mon Aug  4 03:26:17 2008
@@ -18,7 +18,10 @@
 
 import javax.xml.bind.Marshaller;
 
+import org.apache.geronimo.jee.naming.GbeanLocator;
+import org.apache.geronimo.jee.naming.Pattern;
 import org.apache.geronimo.jee.security.Security;
+import org.apache.geronimo.jee.web.WebApp;
 
 public class MarshallerListener extends Marshaller.Listener{
 
@@ -29,6 +32,30 @@
 			if (security.getRoleMappings() != null && security.getRoleMappings().getRole().size()
== 0) {
 				security.setRoleMappings(null);
 			}
+		} else if (source instanceof WebApp) {
+			WebApp webapp = (WebApp)source;
+			GbeanLocator gbeanlocator = webapp.getWebContainer();
+			if (isEmpty(gbeanlocator.getGbeanLink()) && isEmpty(gbeanlocator.getPattern()))
{
+				webapp.setWebContainer(null);
+			}
+		}
+	}
+	
+	private boolean isEmpty(Pattern pattern) {
+		if ( pattern == null ) {
+			return true;
 		}
+		if ( ( pattern.getGroupId() == null || pattern.getGroupId().trim().equals("") ) &&
+			 ( pattern.getArtifactId() == null || pattern.getArtifactId().trim().equals("") ) &&
+			 ( pattern.getModule() == null || pattern.getModule().trim().equals("") ) &&
+			 ( pattern.getName() == null || pattern.getName().trim().equals("") ) &&
+			 ( pattern.getVersion() == null || pattern.getVersion().trim().equals("") ) ) {
+			return true;
+		}
+		return false;
+	}
+	
+	private boolean isEmpty(String value) {
+		return (value == null || value.trim().equals(""));
 	}
 }



Mime
View raw message