ws-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gi...@apache.org
Subject svn commit: r1337974 - in /webservices/wss4j/branches/swssf: streaming-ws-security/src/main/java/org/swssf/wss/impl/transformer/ streaming-xml-security/src/main/java/org/swssf/xmlsec/ext/ streaming-xml-security/src/main/java/org/swssf/xmlsec/impl/trans...
Date Sun, 13 May 2012 19:50:46 GMT
Author: giger
Date: Sun May 13 19:50:45 2012
New Revision: 1337974

URL: http://svn.apache.org/viewvc?rev=1337974&view=rev
Log:
Use default constructor and an api for transformers.
Todo: TransformerFactory

Modified:
    webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/transformer/STRTransformer.java
    webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/ext/Transformer.java
    webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/ext/XMLSecurityUtils.java
    webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/impl/transformer/canonicalizer/Canonicalizer11.java
    webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/impl/transformer/canonicalizer/Canonicalizer11_OmitCommentsTransformer.java
    webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/impl/transformer/canonicalizer/Canonicalizer11_WithCommentsTransformer.java
    webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/impl/transformer/canonicalizer/Canonicalizer20010315.java
    webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/impl/transformer/canonicalizer/Canonicalizer20010315_Excl.java
    webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/impl/transformer/canonicalizer/Canonicalizer20010315_ExclOmitCommentsTransformer.java
    webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/impl/transformer/canonicalizer/Canonicalizer20010315_ExclWithCommentsTransformer.java
    webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/impl/transformer/canonicalizer/Canonicalizer20010315_OmitCommentsTransformer.java
    webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/impl/transformer/canonicalizer/Canonicalizer20010315_WithCommentsTransformer.java
    webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/impl/transformer/canonicalizer/CanonicalizerBase.java
    webservices/wss4j/branches/swssf/streaming-xml-security/src/test/java/org/swssf/xmlsec/test/Canonicalizer11Test.java
    webservices/wss4j/branches/swssf/streaming-xml-security/src/test/java/org/swssf/xmlsec/test/Canonicalizer20010315ExclusiveTest.java
    webservices/wss4j/branches/swssf/streaming-xml-security/src/test/java/org/swssf/xmlsec/test/Canonicalizer20010315Test.java
    webservices/wss4j/branches/swssf/streaming-xml-security/src/test/java/org/swssf/xmlsec/test/Santuario191Test.java

Modified: webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/transformer/STRTransformer.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/transformer/STRTransformer.java?rev=1337974&r1=1337973&r2=1337974&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/transformer/STRTransformer.java
(original)
+++ webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/transformer/STRTransformer.java
Sun May 13 19:50:45 2012
@@ -19,9 +19,12 @@
 package org.swssf.wss.impl.transformer;
 
 import org.swssf.xmlsec.ext.Transformer;
+import org.swssf.xmlsec.ext.XMLSecurityException;
 
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.events.XMLEvent;
+import java.io.OutputStream;
+import java.util.List;
 
 /**
  * @author $Author$
@@ -31,7 +34,21 @@ public class STRTransformer implements T
 
     private Transformer transformer;
 
-    public STRTransformer(Transformer transformer) {
+    public STRTransformer() {
+    }
+
+    @Override
+    public void setOutputStream(OutputStream outputStream) throws XMLSecurityException {
+        throw new UnsupportedOperationException("OutputStream not supported");
+    }
+
+    @Override
+    public void setList(List list) throws XMLSecurityException {
+        throw new UnsupportedOperationException("List not supported");
+    }
+
+    @Override
+    public void setTransformer(Transformer transformer) throws XMLSecurityException {
         this.transformer = transformer;
     }
 

Modified: webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/ext/Transformer.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/ext/Transformer.java?rev=1337974&r1=1337973&r2=1337974&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/ext/Transformer.java
(original)
+++ webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/ext/Transformer.java
Sun May 13 19:50:45 2012
@@ -20,6 +20,8 @@ package org.swssf.xmlsec.ext;
 
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.events.XMLEvent;
+import java.io.OutputStream;
+import java.util.List;
 
 /**
  * @author $Author$
@@ -27,5 +29,11 @@ import javax.xml.stream.events.XMLEvent;
  */
 public interface Transformer {
 
-    public void transform(XMLEvent xmlEvent) throws XMLStreamException;
+    void setOutputStream(OutputStream outputStream) throws XMLSecurityException;
+
+    void setList(List list) throws XMLSecurityException;
+
+    void setTransformer(Transformer transformer) throws XMLSecurityException;
+
+    void transform(XMLEvent xmlEvent) throws XMLStreamException;
 }

Modified: webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/ext/XMLSecurityUtils.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/ext/XMLSecurityUtils.java?rev=1337974&r1=1337973&r2=1337974&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/ext/XMLSecurityUtils.java
(original)
+++ webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/ext/XMLSecurityUtils.java
Sun May 13 19:50:45 2012
@@ -31,7 +31,6 @@ import javax.xml.stream.events.StartElem
 import javax.xml.stream.events.XMLEvent;
 import java.io.IOException;
 import java.io.OutputStream;
-import java.lang.reflect.Constructor;
 import java.lang.reflect.InvocationTargetException;
 import java.util.*;
 
@@ -211,19 +210,20 @@ public class XMLSecurityUtils {
         return xmlEvent;
     }
 
-    //todo optimize?
-    public static Transformer getTransformer(Object methodParameter1, Object methodParameter2,
String algorithm) throws XMLSecurityException, InstantiationException, IllegalAccessException,
InvocationTargetException, NoSuchMethodException {
+    //todo transformer factory?
+    public static Transformer getTransformer(Object methodParameter1, Object methodParameter2,
String algorithm)
+            throws XMLSecurityException, InstantiationException, IllegalAccessException,
InvocationTargetException, NoSuchMethodException {
+
         Class<Transformer> transformerClass = (Class<Transformer>) TransformerAlgorithmMapper.getTransformerClass(algorithm,
null);
         if (transformerClass == null) {
-            return null;
+            throw new XMLSecurityException(XMLSecurityException.ErrorCode.UNSUPPORTED_ALGORITHM);
         }
-        Transformer childTransformer;
-        try {
-            Constructor<Transformer> constructor = transformerClass.getConstructor(Transformer.class);
-            childTransformer = constructor.newInstance(methodParameter1);
-        } catch (NoSuchMethodException e) {
-            Constructor<Transformer> constructor = transformerClass.getConstructor(List.class,
OutputStream.class);
-            childTransformer = constructor.newInstance(methodParameter1, methodParameter2);
+        Transformer childTransformer = transformerClass.newInstance();
+        if (methodParameter2 != null) {
+            childTransformer.setList((List) methodParameter1);
+            childTransformer.setOutputStream((OutputStream) methodParameter2);
+        } else {
+            childTransformer.setTransformer((Transformer) methodParameter1);
         }
         return childTransformer;
     }

Modified: webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/impl/transformer/canonicalizer/Canonicalizer11.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/impl/transformer/canonicalizer/Canonicalizer11.java?rev=1337974&r1=1337973&r2=1337974&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/impl/transformer/canonicalizer/Canonicalizer11.java
(original)
+++ webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/impl/transformer/canonicalizer/Canonicalizer11.java
Sun May 13 19:50:45 2012
@@ -24,7 +24,6 @@ import org.swssf.xmlsec.ext.XMLEventNS;
 import javax.xml.namespace.QName;
 import javax.xml.stream.events.Attribute;
 import javax.xml.stream.events.StartElement;
-import java.io.OutputStream;
 import java.util.Iterator;
 import java.util.List;
 import java.util.SortedSet;
@@ -34,8 +33,8 @@ import java.util.SortedSet;
  * @version $Revision$ $Date$
  */
 public class Canonicalizer11 extends CanonicalizerBase {
-    public Canonicalizer11(List<String> inclusiveNamespaces, boolean includeComments,
OutputStream outputStream) {
-        super(inclusiveNamespaces, includeComments, outputStream);
+    public Canonicalizer11(boolean includeComments) {
+        super(includeComments);
     }
 
     @Override

Modified: webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/impl/transformer/canonicalizer/Canonicalizer11_OmitCommentsTransformer.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/impl/transformer/canonicalizer/Canonicalizer11_OmitCommentsTransformer.java?rev=1337974&r1=1337973&r2=1337974&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/impl/transformer/canonicalizer/Canonicalizer11_OmitCommentsTransformer.java
(original)
+++ webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/impl/transformer/canonicalizer/Canonicalizer11_OmitCommentsTransformer.java
Sun May 13 19:50:45 2012
@@ -18,9 +18,6 @@
  */
 package org.swssf.xmlsec.impl.transformer.canonicalizer;
 
-import java.io.OutputStream;
-import java.util.List;
-
 /**
  * @author $Author$
  * @version $Revision$ $Date$
@@ -30,10 +27,8 @@ public class Canonicalizer11_OmitComment
     /**
      * Canonicalizer not complete. We are missing special handling for xml:base. But since
      * we don't support document subsets we don't need it!
-     *
-     * @param inclusiveNamespaces
      */
-    public Canonicalizer11_OmitCommentsTransformer(List<String> inclusiveNamespaces,
OutputStream outputStream) {
-        super(inclusiveNamespaces, false, outputStream);
+    public Canonicalizer11_OmitCommentsTransformer() {
+        super(false);
     }
 }

Modified: webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/impl/transformer/canonicalizer/Canonicalizer11_WithCommentsTransformer.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/impl/transformer/canonicalizer/Canonicalizer11_WithCommentsTransformer.java?rev=1337974&r1=1337973&r2=1337974&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/impl/transformer/canonicalizer/Canonicalizer11_WithCommentsTransformer.java
(original)
+++ webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/impl/transformer/canonicalizer/Canonicalizer11_WithCommentsTransformer.java
Sun May 13 19:50:45 2012
@@ -18,9 +18,6 @@
  */
 package org.swssf.xmlsec.impl.transformer.canonicalizer;
 
-import java.io.OutputStream;
-import java.util.List;
-
 /**
  * @author $Author$
  * @version $Revision$ $Date$
@@ -30,10 +27,8 @@ public class Canonicalizer11_WithComment
     /**
      * Canonicalizer not complete. We are missing special handling for xml:base. But since
      * we don't support document subsets we don't need it!
-     *
-     * @param inclusiveNamespaces
      */
-    public Canonicalizer11_WithCommentsTransformer(List<String> inclusiveNamespaces,
OutputStream outputStream) {
-        super(inclusiveNamespaces, true, outputStream);
+    public Canonicalizer11_WithCommentsTransformer() {
+        super(true);
     }
 }

Modified: webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/impl/transformer/canonicalizer/Canonicalizer20010315.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/impl/transformer/canonicalizer/Canonicalizer20010315.java?rev=1337974&r1=1337973&r2=1337974&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/impl/transformer/canonicalizer/Canonicalizer20010315.java
(original)
+++ webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/impl/transformer/canonicalizer/Canonicalizer20010315.java
Sun May 13 19:50:45 2012
@@ -18,16 +18,13 @@
  */
 package org.swssf.xmlsec.impl.transformer.canonicalizer;
 
-import java.io.OutputStream;
-import java.util.List;
-
 /**
  * @author $Author$
  * @version $Revision$ $Date$
  */
 public abstract class Canonicalizer20010315 extends CanonicalizerBase {
 
-    public Canonicalizer20010315(List<String> inclusiveNamespaces, boolean includeComments,
OutputStream outputStream) {
-        super(inclusiveNamespaces, includeComments, outputStream);
+    public Canonicalizer20010315(boolean includeComments) {
+        super(includeComments);
     }
 }

Modified: webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/impl/transformer/canonicalizer/Canonicalizer20010315_Excl.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/impl/transformer/canonicalizer/Canonicalizer20010315_Excl.java?rev=1337974&r1=1337973&r2=1337974&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/impl/transformer/canonicalizer/Canonicalizer20010315_Excl.java
(original)
+++ webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/impl/transformer/canonicalizer/Canonicalizer20010315_Excl.java
Sun May 13 19:50:45 2012
@@ -24,7 +24,6 @@ import org.swssf.xmlsec.ext.XMLEventNS;
 
 import javax.xml.stream.events.Attribute;
 import javax.xml.stream.events.StartElement;
-import java.io.OutputStream;
 import java.util.Iterator;
 import java.util.List;
 import java.util.SortedSet;
@@ -35,8 +34,8 @@ import java.util.SortedSet;
  */
 public abstract class Canonicalizer20010315_Excl extends CanonicalizerBase {
 
-    public Canonicalizer20010315_Excl(List<String> inclusiveNamespaces, boolean includeComments,
OutputStream outputStream) {
-        super(inclusiveNamespaces, includeComments, outputStream);
+    public Canonicalizer20010315_Excl(boolean includeComments) {
+        super(includeComments);
     }
 
     @Override

Modified: webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/impl/transformer/canonicalizer/Canonicalizer20010315_ExclOmitCommentsTransformer.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/impl/transformer/canonicalizer/Canonicalizer20010315_ExclOmitCommentsTransformer.java?rev=1337974&r1=1337973&r2=1337974&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/impl/transformer/canonicalizer/Canonicalizer20010315_ExclOmitCommentsTransformer.java
(original)
+++ webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/impl/transformer/canonicalizer/Canonicalizer20010315_ExclOmitCommentsTransformer.java
Sun May 13 19:50:45 2012
@@ -18,16 +18,13 @@
  */
 package org.swssf.xmlsec.impl.transformer.canonicalizer;
 
-import java.io.OutputStream;
-import java.util.List;
-
 /**
  * @author $Author$
  * @version $Revision$ $Date$
  */
 public class Canonicalizer20010315_ExclOmitCommentsTransformer extends Canonicalizer20010315_Excl
{
 
-    public Canonicalizer20010315_ExclOmitCommentsTransformer(List<String> inclusiveNamespaces,
OutputStream outputStream) {
-        super(inclusiveNamespaces, false, outputStream);
+    public Canonicalizer20010315_ExclOmitCommentsTransformer() {
+        super(false);
     }
 }

Modified: webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/impl/transformer/canonicalizer/Canonicalizer20010315_ExclWithCommentsTransformer.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/impl/transformer/canonicalizer/Canonicalizer20010315_ExclWithCommentsTransformer.java?rev=1337974&r1=1337973&r2=1337974&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/impl/transformer/canonicalizer/Canonicalizer20010315_ExclWithCommentsTransformer.java
(original)
+++ webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/impl/transformer/canonicalizer/Canonicalizer20010315_ExclWithCommentsTransformer.java
Sun May 13 19:50:45 2012
@@ -18,16 +18,13 @@
  */
 package org.swssf.xmlsec.impl.transformer.canonicalizer;
 
-import java.io.OutputStream;
-import java.util.List;
-
 /**
  * @author $Author$
  * @version $Revision$ $Date$
  */
 public class Canonicalizer20010315_ExclWithCommentsTransformer extends Canonicalizer20010315_Excl
{
 
-    public Canonicalizer20010315_ExclWithCommentsTransformer(List<String> inclusiveNamespaces,
OutputStream outputStream) {
-        super(inclusiveNamespaces, true, outputStream);
+    public Canonicalizer20010315_ExclWithCommentsTransformer() {
+        super(true);
     }
 }

Modified: webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/impl/transformer/canonicalizer/Canonicalizer20010315_OmitCommentsTransformer.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/impl/transformer/canonicalizer/Canonicalizer20010315_OmitCommentsTransformer.java?rev=1337974&r1=1337973&r2=1337974&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/impl/transformer/canonicalizer/Canonicalizer20010315_OmitCommentsTransformer.java
(original)
+++ webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/impl/transformer/canonicalizer/Canonicalizer20010315_OmitCommentsTransformer.java
Sun May 13 19:50:45 2012
@@ -18,16 +18,13 @@
  */
 package org.swssf.xmlsec.impl.transformer.canonicalizer;
 
-import java.io.OutputStream;
-import java.util.List;
-
 /**
  * @author $Author$
  * @version $Revision$ $Date$
  */
 public class Canonicalizer20010315_OmitCommentsTransformer extends Canonicalizer20010315
{
 
-    public Canonicalizer20010315_OmitCommentsTransformer(List<String> inclusiveNamespaces,
OutputStream outputStream) {
-        super(inclusiveNamespaces, false, outputStream);
+    public Canonicalizer20010315_OmitCommentsTransformer() {
+        super(false);
     }
 }

Modified: webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/impl/transformer/canonicalizer/Canonicalizer20010315_WithCommentsTransformer.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/impl/transformer/canonicalizer/Canonicalizer20010315_WithCommentsTransformer.java?rev=1337974&r1=1337973&r2=1337974&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/impl/transformer/canonicalizer/Canonicalizer20010315_WithCommentsTransformer.java
(original)
+++ webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/impl/transformer/canonicalizer/Canonicalizer20010315_WithCommentsTransformer.java
Sun May 13 19:50:45 2012
@@ -18,16 +18,13 @@
  */
 package org.swssf.xmlsec.impl.transformer.canonicalizer;
 
-import java.io.OutputStream;
-import java.util.List;
-
 /**
  * @author $Author$
  * @version $Revision$ $Date$
  */
 public class Canonicalizer20010315_WithCommentsTransformer extends Canonicalizer20010315
{
 
-    public Canonicalizer20010315_WithCommentsTransformer(List<String> inclusiveNamespaces,
OutputStream outputStream) {
-        super(inclusiveNamespaces, true, outputStream);
+    public Canonicalizer20010315_WithCommentsTransformer() {
+        super(true);
     }
 }

Modified: webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/impl/transformer/canonicalizer/CanonicalizerBase.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/impl/transformer/canonicalizer/CanonicalizerBase.java?rev=1337974&r1=1337973&r2=1337974&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/impl/transformer/canonicalizer/CanonicalizerBase.java
(original)
+++ webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/impl/transformer/canonicalizer/CanonicalizerBase.java
Sun May 13 19:50:45 2012
@@ -69,12 +69,25 @@ public abstract class CanonicalizerBase 
     private boolean firstCall = true;
     private SortedSet<String> inclusiveNamespaces = null;
 
-    public CanonicalizerBase(List<String> inclusiveNamespaces, boolean includeComments,
OutputStream outputStream) {
+    public CanonicalizerBase(boolean includeComments) {
         this.includeComments = includeComments;
-        this.inclusiveNamespaces = prefixList2Set(inclusiveNamespaces);
+    }
+
+    @Override
+    public void setOutputStream(OutputStream outputStream) throws XMLSecurityException {
         this.outputStream = outputStream;
     }
 
+    @Override
+    public void setList(List list) throws XMLSecurityException {
+        this.inclusiveNamespaces = prefixList2Set(list);
+    }
+
+    @Override
+    public void setTransformer(Transformer transformer) throws XMLSecurityException {
+        throw new UnsupportedOperationException("Transformer not supported");
+    }
+
     public static SortedSet<String> prefixList2Set(List<String> inclusiveNamespaces)
{
 
         if ((inclusiveNamespaces == null) || (inclusiveNamespaces.size() == 0)) {

Modified: webservices/wss4j/branches/swssf/streaming-xml-security/src/test/java/org/swssf/xmlsec/test/Canonicalizer11Test.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-xml-security/src/test/java/org/swssf/xmlsec/test/Canonicalizer11Test.java?rev=1337974&r1=1337973&r2=1337974&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-xml-security/src/test/java/org/swssf/xmlsec/test/Canonicalizer11Test.java
(original)
+++ webservices/wss4j/branches/swssf/streaming-xml-security/src/test/java/org/swssf/xmlsec/test/Canonicalizer11Test.java
Sun May 13 19:50:45 2012
@@ -183,7 +183,8 @@ public class Canonicalizer11Test {
     public void test38() throws Exception {
 
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
-        Canonicalizer11_OmitCommentsTransformer c = new Canonicalizer11_OmitCommentsTransformer(null,
baos);
+        Canonicalizer11_OmitCommentsTransformer c = new Canonicalizer11_OmitCommentsTransformer();
+        c.setOutputStream(baos);
         XMLEventReader xmlEventReader = xmlInputFactory.createXMLEventReader(
                 this.getClass().getClassLoader().getResourceAsStream("testdata/c14n/in/38_input.xml")
         );
@@ -578,9 +579,11 @@ public class Canonicalizer11Test {
 
         CanonicalizerBase canonicalizerBase;
         if (omitComments) {
-            canonicalizerBase = new Canonicalizer11_OmitCommentsTransformer(null, baos);
+            canonicalizerBase = new Canonicalizer11_OmitCommentsTransformer();
+            canonicalizerBase.setOutputStream(baos);
         } else {
-            canonicalizerBase = new Canonicalizer11_WithCommentsTransformer(null, baos);
+            canonicalizerBase = new Canonicalizer11_WithCommentsTransformer();
+            canonicalizerBase.setOutputStream(baos);
         }
 
         XMLEventReader xmlEventReader = xmlInputFactory.createXMLEventReader(fileIn.openStream());

Modified: webservices/wss4j/branches/swssf/streaming-xml-security/src/test/java/org/swssf/xmlsec/test/Canonicalizer20010315ExclusiveTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-xml-security/src/test/java/org/swssf/xmlsec/test/Canonicalizer20010315ExclusiveTest.java?rev=1337974&r1=1337973&r2=1337974&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-xml-security/src/test/java/org/swssf/xmlsec/test/Canonicalizer20010315ExclusiveTest.java
(original)
+++ webservices/wss4j/branches/swssf/streaming-xml-security/src/test/java/org/swssf/xmlsec/test/Canonicalizer20010315ExclusiveTest.java
Sun May 13 19:50:45 2012
@@ -57,7 +57,8 @@ public class Canonicalizer20010315Exclus
     public void test221excl() throws Exception {
 
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
-        Canonicalizer20010315_ExclWithCommentsTransformer c = new Canonicalizer20010315_ExclWithCommentsTransformer(null,
baos);
+        Canonicalizer20010315_ExclWithCommentsTransformer c = new Canonicalizer20010315_ExclWithCommentsTransformer();
+        c.setOutputStream(baos);
         XMLEventReader xmlEventReader = xmlInputFactory.createXMLEventReader(
                 this.getClass().getClassLoader().getResourceAsStream("testdata/c14n/inExcl/example2_2_1.xml")
         );
@@ -95,7 +96,8 @@ public class Canonicalizer20010315Exclus
     public void test222excl() throws Exception {
 
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
-        Canonicalizer20010315_ExclWithCommentsTransformer c = new Canonicalizer20010315_ExclWithCommentsTransformer(null,
baos);
+        Canonicalizer20010315_ExclWithCommentsTransformer c = new Canonicalizer20010315_ExclWithCommentsTransformer();
+        c.setOutputStream(baos);
         XMLEventReader xmlEventReader = xmlInputFactory.createXMLEventReader(
                 this.getClass().getClassLoader().getResourceAsStream("testdata/c14n/inExcl/example2_2_2.xml")
         );
@@ -133,7 +135,8 @@ public class Canonicalizer20010315Exclus
     public void test24excl() throws Exception {
 
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
-        Canonicalizer20010315_ExclWithCommentsTransformer c = new Canonicalizer20010315_ExclWithCommentsTransformer(null,
baos);
+        Canonicalizer20010315_ExclWithCommentsTransformer c = new Canonicalizer20010315_ExclWithCommentsTransformer();
+        c.setOutputStream(baos);
         XMLEventReader xmlEventReader = xmlInputFactory.createXMLEventReader(
                 this.getClass().getClassLoader().getResourceAsStream("testdata/c14n/inExcl/example2_4.xml")
         );
@@ -173,7 +176,8 @@ public class Canonicalizer20010315Exclus
         QName TAG_soap11_Body = new QName("http://schemas.xmlsoap.org/soap/envelope/", "Body",
"env");
 
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
-        Canonicalizer20010315_ExclWithCommentsTransformer c = new Canonicalizer20010315_ExclWithCommentsTransformer(null,
baos);
+        Canonicalizer20010315_ExclWithCommentsTransformer c = new Canonicalizer20010315_ExclWithCommentsTransformer();
+        c.setOutputStream(baos);
         XMLEventReader xmlEventReader = xmlInputFactory.createXMLEventReader(
                 this.getClass().getClassLoader().getResourceAsStream("testdata/plain-soap-1.1.xml")
         );
@@ -257,7 +261,9 @@ public class Canonicalizer20010315Exclus
         inclusiveNamespaces.add("ns0");
         inclusiveNamespaces.add("xsi");
         inclusiveNamespaces.add("wsu");
-        Canonicalizer20010315_ExclOmitCommentsTransformer c = new Canonicalizer20010315_ExclOmitCommentsTransformer(inclusiveNamespaces,
baos);
+        Canonicalizer20010315_ExclOmitCommentsTransformer c = new Canonicalizer20010315_ExclOmitCommentsTransformer();
+        c.setList(inclusiveNamespaces);
+        c.setOutputStream(baos);
         XMLEventReader xmlEventReader = xmlInputFactory.createXMLEventReader(
                 new StringReader(XML)
         );

Modified: webservices/wss4j/branches/swssf/streaming-xml-security/src/test/java/org/swssf/xmlsec/test/Canonicalizer20010315Test.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-xml-security/src/test/java/org/swssf/xmlsec/test/Canonicalizer20010315Test.java?rev=1337974&r1=1337973&r2=1337974&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-xml-security/src/test/java/org/swssf/xmlsec/test/Canonicalizer20010315Test.java
(original)
+++ webservices/wss4j/branches/swssf/streaming-xml-security/src/test/java/org/swssf/xmlsec/test/Canonicalizer20010315Test.java
Sun May 13 19:50:45 2012
@@ -60,7 +60,8 @@ public class Canonicalizer20010315Test {
     public void test221() throws Exception {
 
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
-        Canonicalizer20010315_WithCommentsTransformer c = new Canonicalizer20010315_WithCommentsTransformer(null,
baos);
+        Canonicalizer20010315_WithCommentsTransformer c = new Canonicalizer20010315_WithCommentsTransformer();
+        c.setOutputStream(baos);
         XMLEventReader xmlEventReader = xmlInputFactory.createXMLEventReader(
                 this.getClass().getClassLoader().getResourceAsStream("testdata/c14n/inExcl/example2_2_1.xml")
         );
@@ -98,7 +99,8 @@ public class Canonicalizer20010315Test {
     public void test222() throws Exception {
 
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
-        Canonicalizer20010315_WithCommentsTransformer c = new Canonicalizer20010315_WithCommentsTransformer(null,
baos);
+        Canonicalizer20010315_WithCommentsTransformer c = new Canonicalizer20010315_WithCommentsTransformer();
+        c.setOutputStream(baos);
         XMLEventReader xmlEventReader = xmlInputFactory.createXMLEventReader(
                 this.getClass().getClassLoader().getResourceAsStream("testdata/c14n/inExcl/example2_2_2.xml")
         );
@@ -609,9 +611,11 @@ public class Canonicalizer20010315Test {
         CanonicalizerBase canonicalizerBase;
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
         if (ommitComments) {
-            canonicalizerBase = new Canonicalizer20010315_OmitCommentsTransformer(null, baos);
+            canonicalizerBase = new Canonicalizer20010315_OmitCommentsTransformer();
+            canonicalizerBase.setOutputStream(baos);
         } else {
-            canonicalizerBase = new Canonicalizer20010315_WithCommentsTransformer(null, baos);
+            canonicalizerBase = new Canonicalizer20010315_WithCommentsTransformer();
+            canonicalizerBase.setOutputStream(baos);
         }
 
         XMLEventReader xmlEventReader = xmlInputFactory.createXMLEventReader(fileIn.openStream());

Modified: webservices/wss4j/branches/swssf/streaming-xml-security/src/test/java/org/swssf/xmlsec/test/Santuario191Test.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-xml-security/src/test/java/org/swssf/xmlsec/test/Santuario191Test.java?rev=1337974&r1=1337973&r2=1337974&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-xml-security/src/test/java/org/swssf/xmlsec/test/Santuario191Test.java
(original)
+++ webservices/wss4j/branches/swssf/streaming-xml-security/src/test/java/org/swssf/xmlsec/test/Santuario191Test.java
Sun May 13 19:50:45 2012
@@ -70,7 +70,8 @@ public class Santuario191Test {
         //
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
         Canonicalizer11_OmitCommentsTransformer c =
-                new Canonicalizer11_OmitCommentsTransformer(null, baos);
+                new Canonicalizer11_OmitCommentsTransformer();
+        c.setOutputStream(baos);
         XMLEventReader xmlEventReader = xmlInputFactory.createXMLEventReader(
                 new StringReader(INPUT_DATA)
         );



Mime
View raw message