geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From yunfen...@apache.org
Subject svn commit: r680895 - in /geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core/jaxb: JAXBUtils.java MarshallerListener.java
Date Wed, 30 Jul 2008 01:14:17 GMT
Author: yunfengma
Date: Tue Jul 29 18:14:16 2008
New Revision: 680895

URL: http://svn.apache.org/viewvc?rev=680895&view=rev
Log:
GERONIMODEVTOOLS-451 Emptying the Security Roles will cause 'xml problem for web app' in deployment

Added:
    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/JAXBUtils.java

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core/jaxb/JAXBUtils.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/JAXBUtils.java?rev=680895&r1=680894&r2=680895&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core/jaxb/JAXBUtils.java
(original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core/jaxb/JAXBUtils.java
Tue Jul 29 18:14:16 2008
@@ -47,6 +47,7 @@
 
     // JAXBContext instantiation is costly - must be done only once!
     private static final JAXBContext jaxbContext = newJAXBContext();
+    private static final MarshallerListener marshellerListener = new MarshallerListener();
     private static JAXBContext newJAXBContext() {
         try {
             return JAXBContext.newInstance( 
@@ -68,6 +69,7 @@
     public static void marshalDeploymentPlan(JAXBElement jaxbElement, IFile file) {
         try {
             Marshaller marshaller = jaxbContext.createMarshaller();
+            marshaller.setListener(marshellerListener);
             marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
             marshaller.setProperty(Marshaller.JAXB_ENCODING, "UTF-8");
             marshaller.setProperty("com.sun.xml.bind.namespacePrefixMapper", new NamespacePrefixMapperImpl());

Added: 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=680895&view=auto
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core/jaxb/MarshallerListener.java
(added)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core/jaxb/MarshallerListener.java
Tue Jul 29 18:14:16 2008
@@ -0,0 +1,34 @@
+/*
+ * 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.st.core.jaxb;
+
+import javax.xml.bind.Marshaller;
+
+import org.apache.geronimo.jee.security.Security;
+
+public class MarshallerListener extends Marshaller.Listener{
+
+	@Override
+	public void beforeMarshal(Object source) {
+		if (source instanceof Security) {
+			Security security = (Security)source;
+			if (security.getRoleMappings() != null && security.getRoleMappings().getRole().size()
== 0) {
+				security.setRoleMappings(null);
+			}
+		}
+	}
+}



Mime
View raw message