cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r820871 - in /cxf/branches/2.2.x-fixes: ./ api/src/main/java/org/apache/cxf/message/ rt/core/src/main/java/org/apache/cxf/interceptor/ rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/io/
Date Fri, 02 Oct 2009 02:56:56 GMT
Author: dkulp
Date: Fri Oct  2 02:56:56 2009
New Revision: 820871

URL: http://svn.apache.org/viewvc?rev=820871&view=rev
Log:
Merged revisions 820865 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/trunk

........
  r820865 | dkulp | 2009-10-01 21:57:04 -0400 (Thu, 01 Oct 2009) | 2 lines
  
  [CXF-2455] Add some flags/properties to turn off the JAXB
  ValidationEventHandler
........

Modified:
    cxf/branches/2.2.x-fixes/   (props changed)
    cxf/branches/2.2.x-fixes/api/src/main/java/org/apache/cxf/message/MessageUtils.java
    cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/AbstractInDatabindingInterceptor.java
    cxf/branches/2.2.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/io/DataReaderImpl.java

Propchange: cxf/branches/2.2.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: cxf/branches/2.2.x-fixes/api/src/main/java/org/apache/cxf/message/MessageUtils.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/api/src/main/java/org/apache/cxf/message/MessageUtils.java?rev=820871&r1=820870&r2=820871&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/api/src/main/java/org/apache/cxf/message/MessageUtils.java (original)
+++ cxf/branches/2.2.x-fixes/api/src/main/java/org/apache/cxf/message/MessageUtils.java Fri
Oct  2 02:56:56 2009
@@ -117,6 +117,15 @@
         return false;
     }
     
+    
+    public static boolean getContextualBoolean(Message m, String key, boolean defaultValue)
{
+        Object o = m.getContextualProperty(key);
+        if (o != null) {
+            return isTrue(o);
+        }
+        return defaultValue;
+    }
+    
     /**
      * Returns true if the underlying content format is a W3C DOM or a SAAJ message.
      */

Modified: cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/AbstractInDatabindingInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/AbstractInDatabindingInterceptor.java?rev=820871&r1=820870&r2=820871&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/AbstractInDatabindingInterceptor.java
(original)
+++ cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/AbstractInDatabindingInterceptor.java
Fri Oct  2 02:56:56 2009
@@ -37,6 +37,7 @@
 import org.apache.cxf.endpoint.Endpoint;
 import org.apache.cxf.message.Exchange;
 import org.apache.cxf.message.Message;
+import org.apache.cxf.message.MessageUtils;
 import org.apache.cxf.phase.AbstractPhaseInterceptor;
 import org.apache.cxf.service.Service;
 import org.apache.cxf.service.model.BindingMessageInfo;
@@ -89,9 +90,8 @@
         }
         dataReader.setAttachments(message.getAttachments());
         dataReader.setProperty(DataReader.ENDPOINT, message.getExchange().get(Endpoint.class));
-        setSchemaInMessage(service, message, dataReader);
-
-        
+        dataReader.setProperty(Message.class.getName(), message);
+        setSchemaInMessage(service, message, dataReader);   
         return dataReader;
     }
 
@@ -104,8 +104,7 @@
     }
 
     private void setSchemaInMessage(Service service, Message message, DataReader<?>
reader) {
-        Object en = message.getContextualProperty(Message.SCHEMA_VALIDATION_ENABLED);
-        if (Boolean.TRUE.equals(en) || "true".equals(en)) {
+        if (MessageUtils.getContextualBoolean(message, Message.SCHEMA_VALIDATION_ENABLED,
Boolean.FALSE)) {
             //all serviceInfos have the same schemas
             Schema schema = EndpointReferenceUtils.getSchema(service.getServiceInfos().get(0));
             reader.setSchema(schema);

Modified: cxf/branches/2.2.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/io/DataReaderImpl.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/io/DataReaderImpl.java?rev=820871&r1=820870&r2=820871&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/io/DataReaderImpl.java
(original)
+++ cxf/branches/2.2.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/io/DataReaderImpl.java
Fri Oct  2 02:56:56 2009
@@ -27,6 +27,7 @@
 import javax.xml.bind.JAXBException;
 import javax.xml.bind.PropertyException;
 import javax.xml.bind.Unmarshaller;
+import javax.xml.bind.ValidationEventHandler;
 import javax.xml.namespace.QName;
 
 import org.apache.cxf.common.i18n.Message;
@@ -36,12 +37,15 @@
 import org.apache.cxf.jaxb.JAXBDataBase;
 import org.apache.cxf.jaxb.JAXBDataBinding;
 import org.apache.cxf.jaxb.JAXBEncoderDecoder;
+import org.apache.cxf.message.MessageUtils;
 import org.apache.cxf.service.model.MessagePartInfo;
 
 public class DataReaderImpl<T> extends JAXBDataBase implements DataReader<T>
{
     private static final Logger LOG = LogUtils.getLogger(JAXBDataBinding.class);
     JAXBDataBinding databinding;
     boolean unwrapJAXBElement = true;
+    ValidationEventHandler veventHandler;
+    boolean setEventHandler = true;
     
     public DataReaderImpl(JAXBDataBinding binding, boolean unwrap) {
         super(binding.getContext());
@@ -55,6 +59,13 @@
     public void setProperty(String prop, Object value) {
         if (prop.equals(JAXBDataBinding.UNWRAP_JAXB_ELEMENT)) {
             unwrapJAXBElement = Boolean.TRUE.equals(value);
+        } else if (prop.equals(org.apache.cxf.message.Message.class.getName())) {
+            org.apache.cxf.message.Message m = (org.apache.cxf.message.Message)value;
+            veventHandler = (ValidationEventHandler)m.getContextualProperty("jaxb-validation-event-handler");
+            if (veventHandler == null) {
+                veventHandler = databinding.getValidationEventHandler();
+            }
+            setEventHandler = MessageUtils.getContextualBoolean(m, "set-jaxb-validation-event-handler",
true);
         }
     }
     private Unmarshaller createUnmarshaller() {
@@ -64,10 +75,8 @@
             if (databinding.getUnmarshallerListener() != null) {
                 um.setListener(databinding.getUnmarshallerListener());
             }
-            if (databinding.getValidationEventHandler() != null) {
-                um.setEventHandler(databinding.getValidationEventHandler());
-            } else {
-                um.setEventHandler(null);
+            if (setEventHandler) {
+                um.setEventHandler(veventHandler);
             }
             if (databinding.getUnmarshallerProperties() != null) {
                 for (Map.Entry<String, Object> propEntry 



Mime
View raw message