You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@santuario.apache.org by co...@apache.org on 2011/04/14 13:23:25 UTC
svn commit: r1092138 - in /santuario/xml-security-java/trunk/src:
main/java/org/apache/xml/security/
main/java/org/apache/xml/security/encryption/
main/java/org/apache/xml/security/keys/keyresolver/
main/java/org/apache/xml/security/keys/keyresolver/im...
Author: coheigea
Date: Thu Apr 14 11:23:24 2011
New Revision: 1092138
URL: http://svn.apache.org/viewvc?rev=1092138&view=rev
Log:
More refactoring.
Modified:
santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/Init.java
santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/encryption/XMLCipher.java
santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/keys/keyresolver/KeyResolverSpi.java
santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/keys/keyresolver/implementations/RSAKeyValueResolver.java
santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/keys/keyresolver/implementations/X509SKIResolver.java
santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/keys/keyresolver/implementations/X509SubjectNameResolver.java
santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/keys/storage/StorageResolver.java
santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/keys/storage/StorageResolverException.java
santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/keys/storage/implementations/CertsInFilesystemDirectoryResolver.java
santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/keys/storage/implementations/KeyStoreResolver.java
santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/keys/storage/implementations/SingleCertificateResolver.java
santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/signature/MissingResourceFailureException.java
santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/transforms/Transform.java
santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/transforms/TransformParam.java
santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/transforms/TransformSpi.java
santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/transforms/Transforms.java
santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/transforms/implementations/TransformC14N.java
santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/transforms/implementations/TransformC14N11.java
santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/transforms/implementations/TransformC14N11_WithComments.java
santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/transforms/implementations/TransformC14NExclusive.java
santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/transforms/implementations/TransformC14NExclusiveWithComments.java
santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/transforms/implementations/TransformC14NWithComments.java
santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/transforms/implementations/TransformEnvelopedSignature.java
santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/transforms/implementations/TransformXPath.java
santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/transforms/implementations/TransformXPath2Filter.java
santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/transforms/implementations/TransformXPointer.java
santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/transforms/implementations/TransformXSLT.java
santuario/xml-security-java/trunk/src/main/java/org/jcp/xml/dsig/internal/dom/ApacheCanonicalizer.java
santuario/xml-security-java/trunk/src/main/java/org/jcp/xml/dsig/internal/dom/ApacheTransform.java
santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/encryption/BaltimoreEncTest.java
santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/encryption/XMLCipherTester.java
santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/transforms/implementations/TransformXSLTTest.java
santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/utils/OldApiTest.java
Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/Init.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/Init.java?rev=1092138&r1=1092137&r2=1092138&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/Init.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/Init.java Thu Apr 14 11:23:24 2011
@@ -30,6 +30,19 @@ import org.apache.xml.security.algorithm
import org.apache.xml.security.c14n.Canonicalizer;
import org.apache.xml.security.keys.keyresolver.KeyResolver;
import org.apache.xml.security.transforms.Transform;
+import org.apache.xml.security.transforms.TransformSpi;
+import org.apache.xml.security.transforms.Transforms;
+import org.apache.xml.security.transforms.implementations.TransformBase64Decode;
+import org.apache.xml.security.transforms.implementations.TransformC14N;
+import org.apache.xml.security.transforms.implementations.TransformC14N11;
+import org.apache.xml.security.transforms.implementations.TransformC14N11_WithComments;
+import org.apache.xml.security.transforms.implementations.TransformC14NExclusive;
+import org.apache.xml.security.transforms.implementations.TransformC14NExclusiveWithComments;
+import org.apache.xml.security.transforms.implementations.TransformC14NWithComments;
+import org.apache.xml.security.transforms.implementations.TransformEnvelopedSignature;
+import org.apache.xml.security.transforms.implementations.TransformXPath;
+import org.apache.xml.security.transforms.implementations.TransformXPath2Filter;
+import org.apache.xml.security.transforms.implementations.TransformXSLT;
import org.apache.xml.security.utils.ElementProxy;
import org.apache.xml.security.utils.I18n;
import org.apache.xml.security.utils.XMLUtils;
@@ -59,8 +72,13 @@ public class Init {
private static boolean alreadyInitialized = false;
private static Map<String, String> defaultNamespacePrefixes = new HashMap<String, String>();
+ private static Map<String, Class<? extends TransformSpi>> defaultTransforms =
+ new HashMap<String, Class<? extends TransformSpi>>();
static {
+ //
+ // Default Namespace-prefix pairs
+ //
defaultNamespacePrefixes.put("http://www.w3.org/2000/09/xmldsig#", "ds");
defaultNamespacePrefixes.put("http://www.w3.org/2001/04/xmlenc#", "xenc");
defaultNamespacePrefixes.put("http://www.xmlsecurity.org/experimental#", "experimental");
@@ -70,6 +88,46 @@ public class Init {
defaultNamespacePrefixes.put(
"http://www.nue.et-inf.uni-siegen.de/~geuer-pollmann/#xpathFilter", "xx"
);
+
+ //
+ // Default URI-TransformSpi class pairs
+ //
+ defaultTransforms.put(
+ Transforms.TRANSFORM_BASE64_DECODE, TransformBase64Decode.class
+ );
+ defaultTransforms.put(
+ Transforms.TRANSFORM_C14N_OMIT_COMMENTS, TransformC14N.class
+ );
+ defaultTransforms.put(
+ Transforms.TRANSFORM_C14N_WITH_COMMENTS, TransformC14NWithComments.class
+ );
+ defaultTransforms.put(
+ Transforms.TRANSFORM_C14N11_OMIT_COMMENTS, TransformC14N11.class
+ );
+ defaultTransforms.put(
+ Transforms.TRANSFORM_C14N11_WITH_COMMENTS, TransformC14N11_WithComments.class
+ );
+ defaultTransforms.put(
+ Transforms.TRANSFORM_C14N_EXCL_OMIT_COMMENTS, TransformC14NExclusive.class
+ );
+ defaultTransforms.put(
+ Transforms.TRANSFORM_C14N_EXCL_WITH_COMMENTS, TransformC14NExclusiveWithComments.class
+ );
+ defaultTransforms.put(
+ Transforms.TRANSFORM_XPATH, TransformXPath.class
+ );
+ defaultTransforms.put(
+ Transforms.TRANSFORM_ENVELOPED_SIGNATURE, TransformEnvelopedSignature.class
+ );
+ defaultTransforms.put(
+ Transforms.TRANSFORM_XSLT, TransformXSLT.class
+ );
+ defaultTransforms.put(
+ Transforms.TRANSFORM_XPATH2FILTER, TransformXPath2Filter.class
+ );
+ defaultTransforms.put(
+ Transforms.TRANSFORM_XPATH2FILTER04, TransformXPath2Filter.class
+ );
}
/**
@@ -291,6 +349,7 @@ public class Init {
/**
* TODO
*/
+ @SuppressWarnings("unchecked")
public synchronized static void dynamicInit() {
if (alreadyInitialized) {
return;
@@ -303,14 +362,22 @@ public class Init {
//
I18n.init("en", "US");
- //
- // Bind the default prefixes
- // TODO possibly move the default Map into ElementProxy?
- //
try {
+ //
+ // Bind the default prefixes
+ // TODO possibly move the default Map into ElementProxy?
+ //
for (String key : defaultNamespacePrefixes.keySet()) {
ElementProxy.setDefaultPrefix(key, defaultNamespacePrefixes.get(key));
}
+
+ //
+ // Set the default Transforms
+ //
+ for (String key : defaultTransforms.keySet()) {
+ Transform.register(key, (Class<TransformSpi>)defaultTransforms.get(key));
+ }
+
} catch (Exception ex) {
log.error(ex);
ex.printStackTrace();
Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/encryption/XMLCipher.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/encryption/XMLCipher.java?rev=1092138&r1=1092137&r2=1092138&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/encryption/XMLCipher.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/encryption/XMLCipher.java Thu Apr 14 11:23:24 2011
@@ -321,7 +321,7 @@ public class XMLCipher {
if (null == transformation) {
throw new NullPointerException("Transformation unexpectedly null...");
}
- if(!isValidEncryptionAlgorithm(transformation)) {
+ if (!isValidEncryptionAlgorithm(transformation)) {
logger.warn("Algorithm non-standard, expected one of " + ENC_ALGORITHMS);
}
}
Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/keys/keyresolver/KeyResolverSpi.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/keys/keyresolver/KeyResolverSpi.java?rev=1092138&r1=1092137&r2=1092138&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/keys/keyresolver/KeyResolverSpi.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/keys/keyresolver/KeyResolverSpi.java Thu Apr 14 11:23:24 2011
@@ -38,8 +38,8 @@ import org.w3c.dom.Element;
*/
public abstract class KeyResolverSpi {
- /** Field _properties */
- protected java.util.Map<String, String> _properties = null;
+ /** Field properties */
+ protected java.util.Map<String, String> properties = null;
protected boolean globalResolver = false;
@@ -205,10 +205,10 @@ public abstract class KeyResolverSpi {
* @param value
*/
public void engineSetProperty(String key, String value) {
- if (_properties == null) {
- _properties = new HashMap<String, String>();
+ if (properties == null) {
+ properties = new HashMap<String, String>();
}
- this._properties.put(key, value);
+ properties.put(key, value);
}
/**
@@ -218,11 +218,11 @@ public abstract class KeyResolverSpi {
* @return obtain the property appointed by key
*/
public String engineGetProperty(String key) {
- if (_properties == null) {
+ if (properties == null) {
return null;
}
- return (String) this._properties.get(key);
+ return (String)properties.get(key);
}
/**
@@ -232,11 +232,11 @@ public abstract class KeyResolverSpi {
* @return true if understood the property
*/
public boolean understandsProperty(String propertyToTest) {
- if (_properties == null) {
+ if (properties == null) {
return false;
}
- return this._properties.get(propertyToTest) != null;
+ return properties.get(propertyToTest) != null;
}
public void setGlobalResolver(boolean globalResolver) {
Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/keys/keyresolver/implementations/RSAKeyValueResolver.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/keys/keyresolver/implementations/RSAKeyValueResolver.java?rev=1092138&r1=1092137&r2=1092138&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/keys/keyresolver/implementations/RSAKeyValueResolver.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/keys/keyresolver/implementations/RSAKeyValueResolver.java Thu Apr 14 11:23:24 2011
@@ -57,7 +57,6 @@ public class RSAKeyValueResolver extends
rsaKeyElement = element;
}
-
if (rsaKeyElement == null) {
return null;
}
Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/keys/keyresolver/implementations/X509SKIResolver.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/keys/keyresolver/implementations/X509SKIResolver.java?rev=1092138&r1=1092137&r2=1092138&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/keys/keyresolver/implementations/X509SKIResolver.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/keys/keyresolver/implementations/X509SKIResolver.java Thu Apr 14 11:23:24 2011
@@ -88,8 +88,7 @@ public class X509SKIResolver extends Key
Element x509childNodes[] = null;
x509childNodes = XMLUtils.selectDsNodes(element.getFirstChild(), Constants._TAG_X509SKI);
- if (!((x509childNodes != null)
- && (x509childNodes.length > 0))) {
+ if (!((x509childNodes != null) && (x509childNodes.length > 0))) {
if (log.isDebugEnabled()) {
log.debug("I can't");
}
@@ -111,8 +110,7 @@ public class X509SKIResolver extends Key
x509childObject = new XMLX509SKI[x509childNodes.length];
for (int i = 0; i < x509childNodes.length; i++) {
- x509childObject[i] =
- new XMLX509SKI(x509childNodes[i], BaseURI);
+ x509childObject[i] = new XMLX509SKI(x509childNodes[i], BaseURI);
}
Iterator<Certificate> storageIterator = storage.getIterator();
@@ -123,8 +121,7 @@ public class X509SKIResolver extends Key
for (int i = 0; i < x509childObject.length; i++) {
if (certSKI.equals(x509childObject[i])) {
if (log.isDebugEnabled()) {
- log.debug("Return PublicKey from "
- + cert.getSubjectDN().getName());
+ log.debug("Return PublicKey from " + cert.getSubjectDN().getName());
}
return cert;
Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/keys/keyresolver/implementations/X509SubjectNameResolver.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/keys/keyresolver/implementations/X509SubjectNameResolver.java?rev=1092138&r1=1092137&r2=1092138&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/keys/keyresolver/implementations/X509SubjectNameResolver.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/keys/keyresolver/implementations/X509SubjectNameResolver.java Thu Apr 14 11:23:24 2011
@@ -79,8 +79,7 @@ public class X509SubjectNameResolver ext
Element[] x509childNodes = null;
XMLX509SubjectName x509childObject[] = null;
- if (!XMLUtils.elementIsInSignatureSpace(element,
- Constants._TAG_X509DATA) ) {
+ if (!XMLUtils.elementIsInSignatureSpace(element, Constants._TAG_X509DATA)) {
if (log.isDebugEnabled()) {
log.debug("I can't");
}
@@ -113,8 +112,7 @@ public class X509SubjectNameResolver ext
x509childObject = new XMLX509SubjectName[x509childNodes.length];
for (int i = 0; i < x509childNodes.length; i++) {
- x509childObject[i] =
- new XMLX509SubjectName(x509childNodes[i], BaseURI);
+ x509childObject[i] = new XMLX509SubjectName(x509childNodes[i], BaseURI);
}
Iterator<Certificate> storageIterator = storage.getIterator();
Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/keys/storage/StorageResolver.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/keys/storage/StorageResolver.java?rev=1092138&r1=1092137&r2=1092138&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/keys/storage/StorageResolver.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/keys/storage/StorageResolver.java Thu Apr 14 11:23:24 2011
@@ -37,7 +37,7 @@ public class StorageResolver {
org.apache.commons.logging.LogFactory.getLog(StorageResolver.class);
/** Field storageResolvers */
- List<StorageResolverSpi> storageResolvers = null;
+ private List<StorageResolverSpi> storageResolvers = null;
/**
* Constructor StorageResolver
Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/keys/storage/StorageResolverException.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/keys/storage/StorageResolverException.java?rev=1092138&r1=1092137&r2=1092138&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/keys/storage/StorageResolverException.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/keys/storage/StorageResolverException.java Thu Apr 14 11:23:24 2011
@@ -1,4 +1,3 @@
-
/*
* Copyright 1999-2004 The Apache Software Foundation.
*
@@ -17,68 +16,62 @@
*/
package org.apache.xml.security.keys.storage;
-
-
import org.apache.xml.security.exceptions.XMLSecurityException;
-/**
- *
- * @author $Author$
- */
public class StorageResolverException extends XMLSecurityException {
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- /**
- * Constructor StorageResolverException
- *
- */
- public StorageResolverException() {
- super();
- }
-
- /**
- * Constructor StorageResolverException
- *
- * @param msgID
- */
- public StorageResolverException(String msgID) {
- super(msgID);
- }
-
- /**
- * Constructor StorageResolverException
- *
- * @param msgID
- * @param exArgs
- */
- public StorageResolverException(String msgID, Object exArgs[]) {
- super(msgID, exArgs);
- }
-
- /**
- * Constructor StorageResolverException
- *
- * @param msgID
- * @param originalException
- */
- public StorageResolverException(String msgID, Exception originalException) {
- super(msgID, originalException);
- }
-
- /**
- * Constructor StorageResolverException
- *
- * @param msgID
- * @param exArgs
- * @param originalException
- */
- public StorageResolverException(String msgID, Object exArgs[],
- Exception originalException) {
- super(msgID, exArgs, originalException);
- }
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * Constructor StorageResolverException
+ *
+ */
+ public StorageResolverException() {
+ super();
+ }
+
+ /**
+ * Constructor StorageResolverException
+ *
+ * @param msgID
+ */
+ public StorageResolverException(String msgID) {
+ super(msgID);
+ }
+
+ /**
+ * Constructor StorageResolverException
+ *
+ * @param msgID
+ * @param exArgs
+ */
+ public StorageResolverException(String msgID, Object exArgs[]) {
+ super(msgID, exArgs);
+ }
+
+ /**
+ * Constructor StorageResolverException
+ *
+ * @param msgID
+ * @param originalException
+ */
+ public StorageResolverException(String msgID, Exception originalException) {
+ super(msgID, originalException);
+ }
+
+ /**
+ * Constructor StorageResolverException
+ *
+ * @param msgID
+ * @param exArgs
+ * @param originalException
+ */
+ public StorageResolverException(String msgID, Object exArgs[],
+ Exception originalException) {
+ super(msgID, exArgs, originalException);
+ }
}
Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/keys/storage/implementations/CertsInFilesystemDirectoryResolver.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/keys/storage/implementations/CertsInFilesystemDirectoryResolver.java?rev=1092138&r1=1092137&r2=1092138&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/keys/storage/implementations/CertsInFilesystemDirectoryResolver.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/keys/storage/implementations/CertsInFilesystemDirectoryResolver.java Thu Apr 14 11:23:24 2011
@@ -36,7 +36,8 @@ import org.apache.xml.security.utils.Bas
/**
* This {@link StorageResolverSpi} makes all raw (binary) {@link X509Certificate}s
- * which reside as files in a single directory available to the {@link org.apache.xml.security.keys.storage.StorageResolver}.
+ * which reside as files in a single directory available to the
+ * {@link org.apache.xml.security.keys.storage.StorageResolver}.
*/
public class CertsInFilesystemDirectoryResolver extends StorageResolverSpi {
@@ -47,7 +48,7 @@ public class CertsInFilesystemDirectoryR
);
/** Field merlinsCertificatesDir */
- String merlinsCertificatesDir = null;
+ private String merlinsCertificatesDir = null;
/** Field certs */
private List<X509Certificate> certs = new ArrayList<X509Certificate>();
@@ -58,7 +59,6 @@ public class CertsInFilesystemDirectoryR
*/
public CertsInFilesystemDirectoryResolver(String directoryName)
throws StorageResolverException {
-
this.merlinsCertificatesDir = directoryName;
this.readCertsFromHarddrive();
Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/keys/storage/implementations/KeyStoreResolver.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/keys/storage/implementations/KeyStoreResolver.java?rev=1092138&r1=1092137&r2=1092138&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/keys/storage/implementations/KeyStoreResolver.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/keys/storage/implementations/KeyStoreResolver.java Thu Apr 14 11:23:24 2011
@@ -33,7 +33,7 @@ import org.apache.xml.security.keys.stor
public class KeyStoreResolver extends StorageResolverSpi {
/** Field keyStore */
- KeyStore keyStore = null;
+ private KeyStore keyStore = null;
/**
* Constructor KeyStoreResolver
Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/keys/storage/implementations/SingleCertificateResolver.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/keys/storage/implementations/SingleCertificateResolver.java?rev=1092138&r1=1092137&r2=1092138&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/keys/storage/implementations/SingleCertificateResolver.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/keys/storage/implementations/SingleCertificateResolver.java Thu Apr 14 11:23:24 2011
@@ -30,7 +30,7 @@ import org.apache.xml.security.keys.stor
public class SingleCertificateResolver extends StorageResolverSpi {
/** Field certificate */
- X509Certificate certificate = null;
+ private X509Certificate certificate = null;
/**
* @param x509cert the single {@link X509Certificate}
Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/signature/MissingResourceFailureException.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/signature/MissingResourceFailureException.java?rev=1092138&r1=1092137&r2=1092138&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/signature/MissingResourceFailureException.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/signature/MissingResourceFailureException.java Thu Apr 14 11:23:24 2011
@@ -32,7 +32,7 @@ public class MissingResourceFailureExcep
private static final long serialVersionUID = 1L;
/** Field uninitializedReference */
- Reference uninitializedReference = null;
+ private Reference uninitializedReference = null;
/**
* MissingKeyResourceFailureException constructor.
Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/transforms/Transform.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/transforms/Transform.java?rev=1092138&r1=1092137&r2=1092138&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/transforms/Transform.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/transforms/Transform.java Thu Apr 14 11:23:24 2011
@@ -57,93 +57,26 @@ public final class Transform extends Sig
org.apache.commons.logging.LogFactory.getLog(Transform.class);
/** All available Transform classes are registered here */
- private static Map<String, TransformSpi> transformSpiHash =
- new ConcurrentHashMap<String, TransformSpi>();
+ private static Map<String, Class<TransformSpi>> transformSpiHash =
+ new ConcurrentHashMap<String, Class<TransformSpi>>();
private TransformSpi transformSpi;
-
- /**
- * Constructs {@link Transform}
- *
- * @param doc the {@link Document} in which <code>Transform</code> will be
- * placed
- * @param algorithmURI URI representation of
- * <code>Transform algorithm</code> which will be specified as parameter of
- * {@link #getInstance(Document, String)}, when generated. </br>
- * @param contextNodes the child node list of <code>Transform</code> element
- * @throws InvalidTransformException
- */
- public Transform(Document doc, String algorithmURI, NodeList contextNodes)
- throws InvalidTransformException {
- super(doc);
-
- this.constructionElement.setAttributeNS(null, Constants._ATT_ALGORITHM, algorithmURI);
-
- transformSpi = transformSpiHash.get(algorithmURI);
- if (transformSpi == null) {
- Object exArgs[] = { algorithmURI };
- throw new InvalidTransformException("signature.Transform.UnknownTransform", exArgs);
- }
-
- if (log.isDebugEnabled()) {
- log.debug("Create URI \"" + algorithmURI + "\" class \""
- + transformSpi.getClass() + "\"");
- log.debug("The NodeList is " + contextNodes);
- }
-
- // give it to the current document
- if (contextNodes != null) {
- for (int i = 0; i < contextNodes.getLength(); i++) {
- this.constructionElement.appendChild(contextNodes.item(i).cloneNode(true));
- }
- }
- }
-
- /**
- * @param element <code>ds:Transform</code> element
- * @param BaseURI the URI of the resource where the XML instance was stored
- * @throws InvalidTransformException
- * @throws TransformationException
- * @throws XMLSecurityException
- */
- public Transform(Element element, String BaseURI)
- throws InvalidTransformException, TransformationException, XMLSecurityException {
- super(element, BaseURI);
-
- // retrieve Algorithm Attribute from ds:Transform
- String algorithmURI = element.getAttributeNS(null, Constants._ATT_ALGORITHM);
-
- if (algorithmURI == null || algorithmURI.length() == 0) {
- Object exArgs[] = { Constants._ATT_ALGORITHM, Constants._TAG_TRANSFORM };
- throw new TransformationException("xml.WrongContent", exArgs);
- }
-
-
- transformSpi = transformSpiHash.get(algorithmURI);
- if (transformSpi == null) {
- Object exArgs[] = { algorithmURI };
- throw new InvalidTransformException(
- "signature.Transform.UnknownTransform", exArgs);
- }
- }
-
+
/**
* Generates a Transform object that implements the specified
* <code>Transform algorithm</code> URI.
*
+ * @param doc the proxy {@link Document}
* @param algorithmURI <code>Transform algorithm</code> URI representation,
* such as specified in
* <a href=http://www.w3.org/TR/xmldsig-core/#sec-TransformAlg>Transform algorithm </a>
- * @param doc the proxy {@link Document}
* @return <code>{@link Transform}</code> object
* @throws InvalidTransformException
*/
- public static Transform getInstance(
- Document doc, String algorithmURI
- ) throws InvalidTransformException {
- return getInstance(doc, algorithmURI, (NodeList) null);
+ public Transform(Document doc, String algorithmURI) throws InvalidTransformException {
+ this(doc, algorithmURI, (NodeList)null);
}
-
+
/**
* Generates a Transform object that implements the specified
* <code>Transform algorithm</code> URI.
@@ -156,10 +89,9 @@ public final class Transform extends Sig
* @return <code>{@link Transform}</code> object
* @throws InvalidTransformException
*/
- public static Transform getInstance(
- Document doc, String algorithmURI, Element contextChild
- ) throws InvalidTransformException {
-
+ public Transform(Document doc, String algorithmURI, Element contextChild)
+ throws InvalidTransformException {
+ super(doc);
HelperNodeList contextNodes = null;
if (contextChild != null) {
@@ -170,28 +102,66 @@ public final class Transform extends Sig
XMLUtils.addReturnToElement(doc, contextNodes);
}
- return getInstance(doc, algorithmURI, contextNodes);
+ initializeTransform(doc, algorithmURI, contextNodes);
}
/**
- * Generates a Transform object that implements the specified
- * <code>Transform algorithm</code> URI.
+ * Constructs {@link Transform}
*
- * @param algorithmURI <code>Transform algorithm</code> URI form, such as
- * specified in <a href=http://www.w3.org/TR/xmldsig-core/#sec-TransformAlg>
- * Transform algorithm </a>
+ * @param doc the {@link Document} in which <code>Transform</code> will be
+ * placed
+ * @param algorithmURI URI representation of
+ * <code>Transform algorithm</code> which will be specified as parameter of
+ * {@link #getInstance(Document, String)}, when generated. </br>
* @param contextNodes the child node list of <code>Transform</code> element
- * @param doc the proxy {@link Document}
- * @return <code>{@link Transform}</code> object
* @throws InvalidTransformException
*/
- public static Transform getInstance(
- Document doc, String algorithmURI, NodeList contextNodes
- ) throws InvalidTransformException {
- return new Transform(doc, algorithmURI, contextNodes);
+ public Transform(Document doc, String algorithmURI, NodeList contextNodes)
+ throws InvalidTransformException {
+ super(doc);
+ initializeTransform(doc, algorithmURI, contextNodes);
}
/**
+ * @param element <code>ds:Transform</code> element
+ * @param BaseURI the URI of the resource where the XML instance was stored
+ * @throws InvalidTransformException
+ * @throws TransformationException
+ * @throws XMLSecurityException
+ */
+ public Transform(Element element, String BaseURI)
+ throws InvalidTransformException, TransformationException, XMLSecurityException {
+ super(element, BaseURI);
+
+ // retrieve Algorithm Attribute from ds:Transform
+ String algorithmURI = element.getAttributeNS(null, Constants._ATT_ALGORITHM);
+
+ if (algorithmURI == null || algorithmURI.length() == 0) {
+ Object exArgs[] = { Constants._ATT_ALGORITHM, Constants._TAG_TRANSFORM };
+ throw new TransformationException("xml.WrongContent", exArgs);
+ }
+
+ Class<TransformSpi> transformSpiClass = transformSpiHash.get(algorithmURI);
+ if (transformSpiClass == null) {
+ Object exArgs[] = { algorithmURI };
+ throw new InvalidTransformException("signature.Transform.UnknownTransform", exArgs);
+ }
+ try {
+ transformSpi = transformSpiClass.newInstance();
+ } catch (InstantiationException ex) {
+ Object exArgs[] = { algorithmURI };
+ throw new InvalidTransformException(
+ "signature.Transform.UnknownTransform", exArgs, ex
+ );
+ } catch (IllegalAccessException ex) {
+ Object exArgs[] = { algorithmURI };
+ throw new InvalidTransformException(
+ "signature.Transform.UnknownTransform", exArgs, ex
+ );
+ }
+ }
+
+ /**
* Registers implementing class of the Transform algorithm with algorithmURI
*
* @param algorithmURI algorithmURI URI representation of
@@ -207,27 +177,36 @@ public final class Transform extends Sig
throws AlgorithmAlreadyRegisteredException, ClassNotFoundException,
InvalidTransformException {
// are we already registered?
- TransformSpi transformSpi = transformSpiHash.get(algorithmURI);
- if ((transformSpi != null) ) {
- Object exArgs[] = { algorithmURI, transformSpi.getClass() };
- throw new AlgorithmAlreadyRegisteredException(
- "algorithm.alreadyRegistered", exArgs);
+ Class<TransformSpi> transformSpi = transformSpiHash.get(algorithmURI);
+ if (transformSpi != null) {
+ Object exArgs[] = { algorithmURI, transformSpi };
+ throw new AlgorithmAlreadyRegisteredException("algorithm.alreadyRegistered", exArgs);
}
- try {
- Class<TransformSpi> transformSpiClass =
- (Class<TransformSpi>)ClassLoaderUtils.loadClass(implementingClass, Transform.class);
- transformSpiHash.put(algorithmURI, transformSpiClass.newInstance());
- } catch (InstantiationException ex) {
- Object exArgs[] = { algorithmURI };
- throw new InvalidTransformException(
- "signature.Transform.UnknownTransform", exArgs, ex
- );
- } catch (IllegalAccessException ex) {
- Object exArgs[] = { algorithmURI };
- throw new InvalidTransformException(
- "signature.Transform.UnknownTransform", exArgs, ex
- );
+ Class<TransformSpi> transformSpiClass =
+ (Class<TransformSpi>)ClassLoaderUtils.loadClass(implementingClass, Transform.class);
+ transformSpiHash.put(algorithmURI, transformSpiClass);
+ }
+
+ /**
+ * Registers implementing class of the Transform algorithm with algorithmURI
+ *
+ * @param algorithmURI algorithmURI URI representation of
+ * <code>Transform algorithm</code> will be specified as parameter of
+ * {@link #getInstance(Document, String)}, when generate. </br>
+ * @param implementingClass <code>implementingClass</code> the implementing
+ * class of {@link TransformSpi}
+ * @throws AlgorithmAlreadyRegisteredException if specified algorithmURI
+ * is already registered
+ */
+ public static void register(String algorithmURI, Class<TransformSpi> implementingClass)
+ throws AlgorithmAlreadyRegisteredException {
+ // are we already registered?
+ Class<TransformSpi> transformSpi = transformSpiHash.get(algorithmURI);
+ if (transformSpi != null) {
+ Object exArgs[] = { algorithmURI, transformSpi };
+ throw new AlgorithmAlreadyRegisteredException("algorithm.alreadyRegistered", exArgs);
}
+ transformSpiHash.put(algorithmURI, implementingClass);
}
/**
@@ -254,22 +233,7 @@ public final class Transform extends Sig
public XMLSignatureInput performTransform(XMLSignatureInput input)
throws IOException, CanonicalizationException,
InvalidCanonicalizerException, TransformationException {
-
- XMLSignatureInput result = null;
-
- try {
- result = transformSpi.enginePerformTransform(input, this);
- } catch (ParserConfigurationException ex) {
- Object exArgs[] = { this.getURI(), "ParserConfigurationException" };
- throw new CanonicalizationException(
- "signature.Transform.ErrorDuringTransform", exArgs, ex);
- } catch (SAXException ex) {
- Object exArgs[] = { this.getURI(), "SAXException" };
- throw new CanonicalizationException(
- "signature.Transform.ErrorDuringTransform", exArgs, ex);
- }
-
- return result;
+ return performTransform(input, null);
}
/**
@@ -285,8 +249,8 @@ public final class Transform extends Sig
* @throws InvalidCanonicalizerException
* @throws TransformationException
*/
- public XMLSignatureInput performTransform(XMLSignatureInput input,
- OutputStream os
+ public XMLSignatureInput performTransform(
+ XMLSignatureInput input, OutputStream os
) throws IOException, CanonicalizationException,
InvalidCanonicalizerException, TransformationException {
XMLSignatureInput result = null;
@@ -310,4 +274,46 @@ public final class Transform extends Sig
public String getBaseLocalName() {
return Constants._TAG_TRANSFORM;
}
+
+ /**
+ * Initialize the transform object.
+ */
+ private void initializeTransform(Document doc, String algorithmURI, NodeList contextNodes)
+ throws InvalidTransformException {
+
+ this.constructionElement.setAttributeNS(null, Constants._ATT_ALGORITHM, algorithmURI);
+
+ Class<TransformSpi> transformSpiClass = transformSpiHash.get(algorithmURI);
+ if (transformSpiClass == null) {
+ Object exArgs[] = { algorithmURI };
+ throw new InvalidTransformException("signature.Transform.UnknownTransform", exArgs);
+ }
+ try {
+ transformSpi = transformSpiClass.newInstance();
+ } catch (InstantiationException ex) {
+ Object exArgs[] = { algorithmURI };
+ throw new InvalidTransformException(
+ "signature.Transform.UnknownTransform", exArgs, ex
+ );
+ } catch (IllegalAccessException ex) {
+ Object exArgs[] = { algorithmURI };
+ throw new InvalidTransformException(
+ "signature.Transform.UnknownTransform", exArgs, ex
+ );
+ }
+
+ if (log.isDebugEnabled()) {
+ log.debug("Create URI \"" + algorithmURI + "\" class \""
+ + transformSpi.getClass() + "\"");
+ log.debug("The NodeList is " + contextNodes);
+ }
+
+ // give it to the current document
+ if (contextNodes != null) {
+ for (int i = 0; i < contextNodes.getLength(); i++) {
+ this.constructionElement.appendChild(contextNodes.item(i).cloneNode(true));
+ }
+ }
+ }
+
}
Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/transforms/TransformParam.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/transforms/TransformParam.java?rev=1092138&r1=1092137&r2=1092138&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/transforms/TransformParam.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/transforms/TransformParam.java Thu Apr 14 11:23:24 2011
@@ -17,9 +17,5 @@
package org.apache.xml.security.transforms;
-/**
- *
- * @author $Author$
- */
public interface TransformParam {
}
\ No newline at end of file
Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/transforms/TransformSpi.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/transforms/TransformSpi.java?rev=1092138&r1=1092137&r2=1092138&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/transforms/TransformSpi.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/transforms/TransformSpi.java Thu Apr 14 11:23:24 2011
@@ -35,27 +35,11 @@ import org.xml.sax.SAXException;
public abstract class TransformSpi {
/**
- * For API compatibility not thread safe.
- * @deprecated
- */
- protected Transform transformObject = null;
-
- /**
- * Set the transform object.
- * Deprecated For API compatibility.
- * @param transform the Transform
- * @deprecated
- */
- protected void setTransform(Transform transform) {
- this.transformObject = transform;
- }
-
- /**
* The mega method which MUST be implemented by the Transformation Algorithm.
*
* @param input {@link XMLSignatureInput} as the input of transformation
* @param os where to output this transformation.
- * @param _transformObject the Transform
+ * @param transformObject the Transform object
* @return {@link XMLSignatureInput} as the result of transformation
* @throws CanonicalizationException
* @throws IOException
@@ -68,7 +52,7 @@ public abstract class TransformSpi {
XMLSignatureInput input, OutputStream os, Transform transformObject
) throws IOException, CanonicalizationException, InvalidCanonicalizerException,
TransformationException, ParserConfigurationException, SAXException {
- return enginePerformTransform(input, transformObject);
+ throw new UnsupportedOperationException();
}
/**
@@ -79,7 +63,7 @@ public abstract class TransformSpi {
* implementation.
*
* @param input {@link XMLSignatureInput} as the input of transformation
- * @param transformObject the Transform
+ * @param transformObject the Transform object
* @return {@link XMLSignatureInput} as the result of transformation
* @throws CanonicalizationException
* @throws IOException
@@ -92,20 +76,11 @@ public abstract class TransformSpi {
XMLSignatureInput input, Transform transformObject
) throws IOException, CanonicalizationException, InvalidCanonicalizerException,
TransformationException, ParserConfigurationException, SAXException {
- try {
- TransformSpi tmp = (TransformSpi) getClass().newInstance();
- tmp.setTransform(transformObject);
- return tmp.enginePerformTransform(input);
- } catch (InstantiationException e) {
- throw new TransformationException("",e);
- } catch (IllegalAccessException e) {
- throw new TransformationException("",e);
- }
+ return enginePerformTransform(input, null, transformObject);
}
/**
* The mega method which MUST be implemented by the Transformation Algorithm.
- * @deprecated
* @param input {@link XMLSignatureInput} as the input of transformation
* @return {@link XMLSignatureInput} as the result of transformation
* @throws CanonicalizationException
@@ -119,7 +94,7 @@ public abstract class TransformSpi {
XMLSignatureInput input
) throws IOException, CanonicalizationException, InvalidCanonicalizerException,
TransformationException, ParserConfigurationException, SAXException {
- throw new UnsupportedOperationException();
+ return enginePerformTransform(input, null);
}
/**
Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/transforms/Transforms.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/transforms/Transforms.java?rev=1092138&r1=1092137&r2=1092138&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/transforms/Transforms.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/transforms/Transforms.java Thu Apr 14 11:23:24 2011
@@ -163,7 +163,7 @@ public class Transforms extends Signatur
log.debug("Transforms.addTransform(" + transformURI + ")");
}
- Transform transform = Transform.getInstance(this.doc, transformURI);
+ Transform transform = new Transform(this.doc, transformURI);
this.addTransform(transform);
} catch (InvalidTransformException ex) {
@@ -188,8 +188,7 @@ public class Transforms extends Signatur
log.debug("Transforms.addTransform(" + transformURI + ")");
}
- Transform transform =
- Transform.getInstance(this.doc, transformURI, contextElement);
+ Transform transform = new Transform(this.doc, transformURI, contextElement);
this.addTransform(transform);
} catch (InvalidTransformException ex) {
@@ -211,8 +210,7 @@ public class Transforms extends Signatur
throws TransformationException {
try {
- Transform transform =
- Transform.getInstance(this.doc, transformURI, contextNodes);
+ Transform transform = new Transform(this.doc, transformURI, contextNodes);
this.addTransform(transform);
} catch (InvalidTransformException ex) {
throw new TransformationException("empty", ex);
Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/transforms/implementations/TransformC14N.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/transforms/implementations/TransformC14N.java?rev=1092138&r1=1092137&r2=1092138&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/transforms/implementations/TransformC14N.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/transforms/implementations/TransformC14N.java Thu Apr 14 11:23:24 2011
@@ -44,17 +44,8 @@ public class TransformC14N extends Trans
return TransformC14N.implementedTransformURI;
}
- /**
- * @inheritDoc
- */
protected XMLSignatureInput enginePerformTransform(
- XMLSignatureInput input, Transform transformObject
- ) throws CanonicalizationException {
- return enginePerformTransform(input, null, transformObject);
- }
-
- protected XMLSignatureInput enginePerformTransform(
- XMLSignatureInput input,OutputStream os, Transform transformObject
+ XMLSignatureInput input, OutputStream os, Transform transformObject
) throws CanonicalizationException {
Canonicalizer20010315OmitComments c14n = new Canonicalizer20010315OmitComments();
if (os != null) {
@@ -63,7 +54,7 @@ public class TransformC14N extends Trans
byte[] result = null;
result = c14n.engineCanonicalize(input);
XMLSignatureInput output = new XMLSignatureInput(result);
- if (os !=null) {
+ if (os != null) {
output.setOutputStream(os);
}
return output;
Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/transforms/implementations/TransformC14N11.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/transforms/implementations/TransformC14N11.java?rev=1092138&r1=1092137&r2=1092138&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/transforms/implementations/TransformC14N11.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/transforms/implementations/TransformC14N11.java Thu Apr 14 11:23:24 2011
@@ -38,12 +38,6 @@ public class TransformC14N11 extends Tra
}
protected XMLSignatureInput enginePerformTransform(
- XMLSignatureInput input, Transform transform
- ) throws CanonicalizationException {
- return enginePerformTransform(input, null, transform);
- }
-
- protected XMLSignatureInput enginePerformTransform(
XMLSignatureInput input, OutputStream os, Transform transform
) throws CanonicalizationException {
Canonicalizer11_OmitComments c14n = new Canonicalizer11_OmitComments();
Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/transforms/implementations/TransformC14N11_WithComments.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/transforms/implementations/TransformC14N11_WithComments.java?rev=1092138&r1=1092137&r2=1092138&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/transforms/implementations/TransformC14N11_WithComments.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/transforms/implementations/TransformC14N11_WithComments.java Thu Apr 14 11:23:24 2011
@@ -38,13 +38,6 @@ public class TransformC14N11_WithComment
}
protected XMLSignatureInput enginePerformTransform(
- XMLSignatureInput input, Transform transform
- )
- throws CanonicalizationException {
- return enginePerformTransform(input, null, transform);
- }
-
- protected XMLSignatureInput enginePerformTransform(
XMLSignatureInput input, OutputStream os, Transform transform
) throws CanonicalizationException {
Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/transforms/implementations/TransformC14NExclusive.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/transforms/implementations/TransformC14NExclusive.java?rev=1092138&r1=1092137&r2=1092138&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/transforms/implementations/TransformC14NExclusive.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/transforms/implementations/TransformC14NExclusive.java Thu Apr 14 11:23:24 2011
@@ -48,19 +48,6 @@ public class TransformC14NExclusive exte
return implementedTransformURI;
}
- /**
- * Method enginePerformTransform
- *
- * @param input
- * @return the transformed of the input
- * @throws CanonicalizationException
- */
- protected XMLSignatureInput enginePerformTransform(
- XMLSignatureInput input, Transform transformObject
- ) throws CanonicalizationException {
- return enginePerformTransform(input, null, transformObject);
- }
-
protected XMLSignatureInput enginePerformTransform(
XMLSignatureInput input, OutputStream os, Transform transformObject
) throws CanonicalizationException {
Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/transforms/implementations/TransformC14NExclusiveWithComments.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/transforms/implementations/TransformC14NExclusiveWithComments.java?rev=1092138&r1=1092137&r2=1092138&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/transforms/implementations/TransformC14NExclusiveWithComments.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/transforms/implementations/TransformC14NExclusiveWithComments.java Thu Apr 14 11:23:24 2011
@@ -50,17 +50,8 @@ public class TransformC14NExclusiveWithC
return implementedTransformURI;
}
- /**
- * @inheritDoc
- */
protected XMLSignatureInput enginePerformTransform(
- XMLSignatureInput input, Transform transformObject
- ) throws CanonicalizationException {
- return enginePerformTransform(input, null, transformObject);
- }
-
- protected XMLSignatureInput enginePerformTransform(
- XMLSignatureInput input,OutputStream os, Transform transformObject
+ XMLSignatureInput input, OutputStream os, Transform transformObject
) throws CanonicalizationException {
try {
String inclusiveNamespaces = null;
Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/transforms/implementations/TransformC14NWithComments.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/transforms/implementations/TransformC14NWithComments.java?rev=1092138&r1=1092137&r2=1092138&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/transforms/implementations/TransformC14NWithComments.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/transforms/implementations/TransformC14NWithComments.java Thu Apr 14 11:23:24 2011
@@ -44,19 +44,12 @@ public class TransformC14NWithComments e
/** @inheritDoc */
protected XMLSignatureInput enginePerformTransform(
- XMLSignatureInput input, Transform transformObject
- ) throws CanonicalizationException {
- return enginePerformTransform(input, null, transformObject);
- }
-
- /** @inheritDoc */
- protected XMLSignatureInput enginePerformTransform(
XMLSignatureInput input,OutputStream os, Transform transformObject
) throws CanonicalizationException {
Canonicalizer20010315WithComments c14n = new Canonicalizer20010315WithComments();
if (os != null) {
- c14n.setWriter( os);
+ c14n.setWriter(os);
}
byte[] result = null;
Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/transforms/implementations/TransformEnvelopedSignature.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/transforms/implementations/TransformEnvelopedSignature.java?rev=1092138&r1=1092137&r2=1092138&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/transforms/implementations/TransformEnvelopedSignature.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/transforms/implementations/TransformEnvelopedSignature.java Thu Apr 14 11:23:24 2011
@@ -16,6 +16,8 @@
*/
package org.apache.xml.security.transforms.implementations;
+import java.io.OutputStream;
+
import org.apache.xml.security.signature.NodeFilter;
import org.apache.xml.security.signature.XMLSignatureInput;
import org.apache.xml.security.transforms.Transform;
@@ -52,7 +54,7 @@ public class TransformEnvelopedSignature
* @inheritDoc
*/
protected XMLSignatureInput enginePerformTransform(
- XMLSignatureInput input, Transform transformObject
+ XMLSignatureInput input, OutputStream os, Transform transformObject
) throws TransformationException {
/**
* If the actual input is an octet stream, then the application MUST
Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/transforms/implementations/TransformXPath.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/transforms/implementations/TransformXPath.java?rev=1092138&r1=1092137&r2=1092138&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/transforms/implementations/TransformXPath.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/transforms/implementations/TransformXPath.java Thu Apr 14 11:23:24 2011
@@ -16,6 +16,8 @@
*/
package org.apache.xml.security.transforms.implementations;
+import java.io.OutputStream;
+
import javax.xml.transform.TransformerException;
import org.apache.xml.security.exceptions.XMLSecurityRuntimeException;
@@ -68,7 +70,7 @@ public class TransformXPath extends Tran
* @throws TransformationException
*/
protected XMLSignatureInput enginePerformTransform(
- XMLSignatureInput input, Transform transformObject
+ XMLSignatureInput input, OutputStream os, Transform transformObject
) throws TransformationException {
try {
/**
Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/transforms/implementations/TransformXPath2Filter.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/transforms/implementations/TransformXPath2Filter.java?rev=1092138&r1=1092137&r2=1092138&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/transforms/implementations/TransformXPath2Filter.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/transforms/implementations/TransformXPath2Filter.java Thu Apr 14 11:23:24 2011
@@ -17,9 +17,9 @@
package org.apache.xml.security.transforms.implementations;
import java.io.IOException;
+import java.io.OutputStream;
import java.util.ArrayList;
import java.util.HashSet;
-import java.util.Iterator;
import java.util.List;
import java.util.Set;
@@ -76,7 +76,7 @@ public class TransformXPath2Filter exten
* @throws TransformationException
*/
protected XMLSignatureInput enginePerformTransform(
- XMLSignatureInput input, Transform transformObject
+ XMLSignatureInput input, OutputStream os, Transform transformObject
) throws TransformationException {
CachedXPathAPIHolder.setDoc(transformObject.getElement().getOwnerDocument());
try {
Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/transforms/implementations/TransformXPointer.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/transforms/implementations/TransformXPointer.java?rev=1092138&r1=1092137&r2=1092138&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/transforms/implementations/TransformXPointer.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/transforms/implementations/TransformXPointer.java Thu Apr 14 11:23:24 2011
@@ -17,6 +17,8 @@
*/
package org.apache.xml.security.transforms.implementations;
+import java.io.OutputStream;
+
import org.apache.xml.security.signature.XMLSignatureInput;
import org.apache.xml.security.transforms.Transform;
import org.apache.xml.security.transforms.TransformSpi;
@@ -46,10 +48,9 @@ public class TransformXPointer extends T
* @param input
* @return {@link XMLSignatureInput} as the result of transformation
* @throws TransformationException
- *
*/
protected XMLSignatureInput enginePerformTransform(
- XMLSignatureInput input, Transform transformObject
+ XMLSignatureInput input, OutputStream os, Transform transformObject
) throws TransformationException {
Object exArgs[] = { implementedTransformURI };
Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/transforms/implementations/TransformXSLT.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/transforms/implementations/TransformXSLT.java?rev=1092138&r1=1092137&r2=1092138&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/transforms/implementations/TransformXSLT.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/transforms/implementations/TransformXSLT.java Thu Apr 14 11:23:24 2011
@@ -69,26 +69,12 @@ public class TransformXSLT extends Trans
return implementedTransformURI;
}
- /**
- * Method enginePerformTransform
- *
- * @param input the input for this transform
- * @return the result of this Transform
- * @throws IOException
- * @throws TransformationException
- */
- protected XMLSignatureInput enginePerformTransform(
- XMLSignatureInput input, Transform transformObject
- ) throws IOException, TransformationException {
- return enginePerformTransform(input, null, transformObject);
- }
-
protected XMLSignatureInput enginePerformTransform(
XMLSignatureInput input, OutputStream baos, Transform transformObject
) throws IOException, TransformationException {
try {
- Element transformElement = transformObject.getElement();
-
+ Element transformElement = transformObject.getElement();
+
Element xsltElement =
XMLUtils.selectNode(transformElement.getFirstChild(), XSLTSpecNS, "stylesheet", 0);
Modified: santuario/xml-security-java/trunk/src/main/java/org/jcp/xml/dsig/internal/dom/ApacheCanonicalizer.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/jcp/xml/dsig/internal/dom/ApacheCanonicalizer.java?rev=1092138&r1=1092137&r2=1092138&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/jcp/xml/dsig/internal/dom/ApacheCanonicalizer.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/jcp/xml/dsig/internal/dom/ApacheCanonicalizer.java Thu Apr 14 11:23:24 2011
@@ -189,8 +189,8 @@ public abstract class ApacheCanonicalize
if (apacheTransform == null) {
try {
- apacheTransform = Transform.getInstance
- (ownerDoc, getAlgorithm(), transformElem.getChildNodes());
+ apacheTransform =
+ new Transform(ownerDoc, getAlgorithm(), transformElem.getChildNodes());
apacheTransform.setElement(transformElem, xc.getBaseURI());
if (log.isDebugEnabled()) {
log.debug("Created transform for algorithm: " + getAlgorithm());
Modified: santuario/xml-security-java/trunk/src/main/java/org/jcp/xml/dsig/internal/dom/ApacheTransform.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/jcp/xml/dsig/internal/dom/ApacheTransform.java?rev=1092138&r1=1092137&r2=1092138&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/jcp/xml/dsig/internal/dom/ApacheTransform.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/jcp/xml/dsig/internal/dom/ApacheTransform.java Thu Apr 14 11:23:24 2011
@@ -116,8 +116,8 @@ public abstract class ApacheTransform ex
if (apacheTransform == null) {
try {
- apacheTransform = Transform.getInstance
- (ownerDoc, getAlgorithm(), transformElem.getChildNodes());
+ apacheTransform =
+ new Transform(ownerDoc, getAlgorithm(), transformElem.getChildNodes());
apacheTransform.setElement(transformElem, xc.getBaseURI());
if (log.isDebugEnabled()) {
log.debug("Created transform for algorithm: " +
Modified: santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/encryption/BaltimoreEncTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/encryption/BaltimoreEncTest.java?rev=1092138&r1=1092137&r2=1092138&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/encryption/BaltimoreEncTest.java (original)
+++ santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/encryption/BaltimoreEncTest.java Thu Apr 14 11:23:24 2011
@@ -585,7 +585,7 @@ public class BaltimoreEncTest extends or
*
* Retrieve the credit card number from the payment info document
*
- * @param doc The document to retreive the card number from
+ * @param doc The document to retrieve the card number from
* @return The retrieved credit card number
* @throws XPathExpressionException
*/
Modified: santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/encryption/XMLCipherTester.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/encryption/XMLCipherTester.java?rev=1092138&r1=1092137&r2=1092138&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/encryption/XMLCipherTester.java (original)
+++ santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/encryption/XMLCipherTester.java Thu Apr 14 11:23:24 2011
@@ -687,7 +687,7 @@ public class XMLCipherTester extends org
@org.junit.Test
public void testEncryptedKeyWithRecipient() throws Exception {
String filename =
- "data/org/apache/xml/security/encryption/encryptedKey.xml";
+ "src/test/resources/org/apache/xml/security/encryption/encryptedKey.xml";
if (basedir != null && !"".equals(basedir)) {
filename = basedir + "/" + filename;
}
Modified: santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/transforms/implementations/TransformXSLTTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/transforms/implementations/TransformXSLTTest.java?rev=1092138&r1=1092137&r2=1092138&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/transforms/implementations/TransformXSLTTest.java (original)
+++ santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/transforms/implementations/TransformXSLTTest.java Thu Apr 14 11:23:24 2011
@@ -81,7 +81,7 @@ public class TransformXSLTTest extends o
(Element) xpath.evaluate(expression, doc1, XPathConstants.NODE);
Transform transform =
- Transform.getInstance(doc1, Transforms.TRANSFORM_XSLT, transformEl.getChildNodes());
+ new Transform(doc1, Transforms.TRANSFORM_XSLT, transformEl.getChildNodes());
transform.performTransform(new XMLSignatureInput(doc2));
}
Modified: santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/utils/OldApiTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/utils/OldApiTest.java?rev=1092138&r1=1092137&r2=1092138&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/utils/OldApiTest.java (original)
+++ santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/utils/OldApiTest.java Thu Apr 14 11:23:24 2011
@@ -16,53 +16,27 @@
*/
package org.apache.xml.security.test.utils;
-import java.io.IOException;
import java.security.PublicKey;
import java.security.cert.X509Certificate;
import javax.crypto.SecretKey;
import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
-import org.apache.xml.security.Init;
-import org.apache.xml.security.c14n.CanonicalizationException;
-import org.apache.xml.security.c14n.InvalidCanonicalizerException;
import org.apache.xml.security.keys.KeyInfo;
import org.apache.xml.security.keys.keyresolver.KeyResolver;
import org.apache.xml.security.keys.keyresolver.KeyResolverException;
import org.apache.xml.security.keys.keyresolver.KeyResolverSpi;
import org.apache.xml.security.keys.storage.StorageResolver;
import org.apache.xml.security.signature.XMLSignatureInput;
-import org.apache.xml.security.transforms.Transform;
-import org.apache.xml.security.transforms.TransformSpi;
-import org.apache.xml.security.transforms.TransformationException;
import org.apache.xml.security.utils.resolver.ResourceResolver;
import org.apache.xml.security.utils.resolver.ResourceResolverException;
import org.apache.xml.security.utils.resolver.ResourceResolverSpi;
import org.w3c.dom.Attr;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
-import org.xml.sax.SAXException;
public class OldApiTest extends org.junit.Assert {
- public static class OldTransform extends TransformSpi {
- static Transform compare;
-
- @SuppressWarnings("deprecation")
- protected XMLSignatureInput enginePerformTransform(
- XMLSignatureInput input
- ) throws IOException, CanonicalizationException, InvalidCanonicalizerException,
- TransformationException, ParserConfigurationException, SAXException {
- assertEquals(compare, transformObject);
- return null ;
- }
-
- protected String engineGetURI() {
- return null;
- };
- }
-
public static class OldResourceResolverSpi extends ResourceResolverSpi {
Attr uriCompare;
String baseCompare;
@@ -155,17 +129,6 @@ public class OldApiTest extends org.juni
}
@org.junit.Test
- public void testOldTransformSpiApi() throws Exception {
- Init.init();
- Document doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
- Transform.register("old", OldTransform.class.getName());
-
- Transform a = new Transform(doc, "old", null);
- OldTransform.compare = a;
- a.performTransform(null);
- }
-
- @org.junit.Test
public void testOldResourceResolverSpi() throws Exception {
Document doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
Attr uri = doc.createAttribute("id");