cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a.@apache.org
Subject cxf git commit: [CXF-6399] Add attributes transform handling in transform feature
Date Mon, 11 May 2015 14:55:53 GMT
Repository: cxf
Updated Branches:
  refs/heads/master 5aa98c1c2 -> e016693ee


[CXF-6399] Add attributes transform handling in transform feature


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/e016693e
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/e016693e
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/e016693e

Branch: refs/heads/master
Commit: e016693ee4489f4836426f0c7d7af885ef32368f
Parents: 5aa98c1
Author: Akitoshi Yoshida <ay@apache.org>
Authored: Mon May 11 16:55:29 2015 +0200
Committer: Akitoshi Yoshida <ay@apache.org>
Committed: Mon May 11 16:55:29 2015 +0200

----------------------------------------------------------------------
 .../cxf/feature/StaxTransformFeature.java       | 12 ++++++++--
 .../transform/TransformInInterceptor.java       | 12 +++++++---
 .../transform/TransformOutInterceptor.java      |  6 +++++
 .../cxf/staxutils/transform/TransformUtils.java | 23 ++++++++++++++++++--
 4 files changed, 46 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/e016693e/core/src/main/java/org/apache/cxf/feature/StaxTransformFeature.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/cxf/feature/StaxTransformFeature.java b/core/src/main/java/org/apache/cxf/feature/StaxTransformFeature.java
index eb1392a..2a9bf83 100644
--- a/core/src/main/java/org/apache/cxf/feature/StaxTransformFeature.java
+++ b/core/src/main/java/org/apache/cxf/feature/StaxTransformFeature.java
@@ -59,7 +59,11 @@ public class StaxTransformFeature extends AbstractFeature {
     public void setOutTransformElements(Map<String, String> outElements) {
         out.setOutTransformElements(outElements);
     }
-    
+
+    public void setOutTransformAttributes(Map<String, String> outAttributes) {
+        out.setOutTransformAttributes(outAttributes);
+    }
+
     public void setAttributesToElements(boolean value) {
         out.setAttributesToElements(value);
     }
@@ -75,7 +79,7 @@ public class StaxTransformFeature extends AbstractFeature {
     public void setOutDropElements(List<String> dropElementsSet) {
         out.setOutDropElements(dropElementsSet);
     }
-    
+
     public void setInAppendElements(Map<String, String> inElements) {
         in.setInAppendElements(inElements);
     }
@@ -88,6 +92,10 @@ public class StaxTransformFeature extends AbstractFeature {
         in.setInTransformElements(inElements);
     }
     
+    public void setInTransformAttributes(Map<String, String> inAttributes) {
+        in.setInTransformAttributes(inAttributes);
+    }
+    
     public void setOutDefaultNamespace(String ns) {
         out.setDefaultNamespace(ns);
     }

http://git-wip-us.apache.org/repos/asf/cxf/blob/e016693e/core/src/main/java/org/apache/cxf/interceptor/transform/TransformInInterceptor.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/cxf/interceptor/transform/TransformInInterceptor.java
b/core/src/main/java/org/apache/cxf/interceptor/transform/TransformInInterceptor.java
index a481f6a..fab2026 100644
--- a/core/src/main/java/org/apache/cxf/interceptor/transform/TransformInInterceptor.java
+++ b/core/src/main/java/org/apache/cxf/interceptor/transform/TransformInInterceptor.java
@@ -42,6 +42,7 @@ public class TransformInInterceptor extends AbstractPhaseInterceptor<Message>
{
     private List<String> inDropElements;
     private Map<String, String> inElementsMap;
     private Map<String, String> inAppendMap;
+    private Map<String, String> inAttributesMap;
     private boolean blockOriginalReader = true;
     private String contextPropertyName;
     
@@ -82,15 +83,16 @@ public class TransformInInterceptor extends AbstractPhaseInterceptor<Message>
{
         }
          
     }
-    
+
     protected XMLStreamReader createTransformReaderIfNeeded(XMLStreamReader reader, InputStream
is) {
         return TransformUtils.createTransformReaderIfNeeded(reader, is,
                                                             inDropElements,
                                                             inElementsMap,
                                                             inAppendMap,
+                                                            inAttributesMap,
                                                             blockOriginalReader);
     }
-    
+
     public void setInAppendElements(Map<String, String> inElements) {
         this.inAppendMap = inElements;
     }
@@ -102,7 +104,11 @@ public class TransformInInterceptor extends AbstractPhaseInterceptor<Message>
{
     public void setInTransformElements(Map<String, String> inElements) {
         this.inElementsMap = inElements;
     }
-   
+
+    public void setInTransformAttributes(Map<String, String> inAttributes) {
+        this.inAttributesMap = inAttributes;
+    }
+
     public void setBlockOriginalReader(boolean blockOriginalReader) {
         this.blockOriginalReader = blockOriginalReader;
     }

http://git-wip-us.apache.org/repos/asf/cxf/blob/e016693e/core/src/main/java/org/apache/cxf/interceptor/transform/TransformOutInterceptor.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/cxf/interceptor/transform/TransformOutInterceptor.java
b/core/src/main/java/org/apache/cxf/interceptor/transform/TransformOutInterceptor.java
index 49156d5..a0fff5b 100644
--- a/core/src/main/java/org/apache/cxf/interceptor/transform/TransformOutInterceptor.java
+++ b/core/src/main/java/org/apache/cxf/interceptor/transform/TransformOutInterceptor.java
@@ -50,6 +50,7 @@ public class TransformOutInterceptor extends AbstractPhaseInterceptor<Message>
{
     private Map<String, String> outElementsMap;
     private Map<String, String> outAppendMap;
     private List<String> outDropElements;
+    private Map<String, String> outAttributesMap;
     private boolean attributesToElements;
     private boolean skipOnFault;
     private String contextPropertyName;
@@ -112,6 +113,7 @@ public class TransformOutInterceptor extends AbstractPhaseInterceptor<Message>
{
                                                       outElementsMap,
                                                       outDropElements,
                                                       outAppendMap,
+                                                      outAttributesMap,
                                                       attributesToElements,
                                                       defaultNamespace);
     }
@@ -128,6 +130,10 @@ public class TransformOutInterceptor extends AbstractPhaseInterceptor<Message>
{
         this.outDropElements = dropElementsSet;
     }
 
+    public void setOutTransformAttributes(Map<String, String> outAttributes) {
+        this.outAttributesMap = outAttributes;
+    }
+
     public void setAttributesToElements(boolean value) {
         this.attributesToElements = value;
     }

http://git-wip-us.apache.org/repos/asf/cxf/blob/e016693e/core/src/main/java/org/apache/cxf/staxutils/transform/TransformUtils.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/cxf/staxutils/transform/TransformUtils.java b/core/src/main/java/org/apache/cxf/staxutils/transform/TransformUtils.java
index 1553527..9dc2649 100644
--- a/core/src/main/java/org/apache/cxf/staxutils/transform/TransformUtils.java
+++ b/core/src/main/java/org/apache/cxf/staxutils/transform/TransformUtils.java
@@ -57,11 +57,30 @@ public final class TransformUtils {
             || outAppendMap != null || attributesToElements) {
             writer = createNewWriterIfNeeded(writer, os);
             writer = new OutTransformWriter(writer, outElementsMap, outAppendMap,
-                                            outDropElements, attributesToElements, defaultNamespace);
+                                            outDropElements, null, attributesToElements,
defaultNamespace);
         }
         return writer;
     }
-    
+
+    //CHECKSTYLE:OFF ParameterNumber
+    public static XMLStreamWriter createTransformWriterIfNeeded(XMLStreamWriter writer,
+                                                                OutputStream os,
+                                                                Map<String, String>
outElementsMap,
+                                                                List<String> outDropElements,
+                                                                Map<String, String>
outAppendMap,
+                                                                Map<String, String>
outAttributesMap,
+                                                                boolean attributesToElements,
+                                                                String defaultNamespace)
{
+        if (outElementsMap != null || outDropElements != null 
+            || outAppendMap != null || attributesToElements) {
+            writer = createNewWriterIfNeeded(writer, os);
+            writer = new OutTransformWriter(writer, outElementsMap, outAppendMap,
+                                            outDropElements, outAttributesMap, attributesToElements,
defaultNamespace);
+        }
+        return writer;
+    }
+    //CHECKSTYLE:ON
+
     public static XMLStreamReader createTransformReaderIfNeeded(XMLStreamReader reader, 
                                                                 InputStream is,
                                                                 List<String> inDropElements,


Mime
View raw message