You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@santuario.apache.org by mu...@apache.org on 2006/09/25 22:51:40 UTC

svn commit: r449812 - /xml/security/trunk/src/org/apache/xml/security/transforms/TransformSpi.java

Author: mullan
Date: Mon Sep 25 13:51:36 2006
New Revision: 449812

URL: http://svn.apache.org/viewvc?view=rev&rev=449812
Log:
Change enginePerformTransform to throw UnsupportedOperationExc instead
of sun-specific NotImplementedExc. Also, improve javadoc a little and
use 4-space indents.

Modified:
    xml/security/trunk/src/org/apache/xml/security/transforms/TransformSpi.java

Modified: xml/security/trunk/src/org/apache/xml/security/transforms/TransformSpi.java
URL: http://svn.apache.org/viewvc/xml/security/trunk/src/org/apache/xml/security/transforms/TransformSpi.java?view=diff&rev=449812&r1=449811&r2=449812
==============================================================================
--- xml/security/trunk/src/org/apache/xml/security/transforms/TransformSpi.java (original)
+++ xml/security/trunk/src/org/apache/xml/security/transforms/TransformSpi.java Mon Sep 25 13:51:36 2006
@@ -25,109 +25,110 @@
 import org.apache.xml.security.signature.XMLSignatureInput;
 import org.xml.sax.SAXException;
 
-import sun.reflect.generics.reflectiveObjects.NotImplementedException;
-
-
 /**
  * Base class which all Transform algorithms extend. The common methods that
- * have to be overridden are the {@link #enginePerformTransform(XMLSignatureInput, Transform)} method.
+ * have to be overridden are the 
+ * {@link #enginePerformTransform(XMLSignatureInput, Transform)} method.
  *
  * @author Christian Geuer-Pollmann
  */
 public abstract class TransformSpi {
-	/**
-	 * For API compatibility not thread safe.
-	 * @deprecated
-	 */
-	protected Transform _transformObject = null;
-	/**
-	 * Set the transform object. 
-	 * Depeprecated For API compatibility.
-	 * @param 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 TODO
-    * @return {@link XMLSignatureInput} as the result of transformation
-    * @throws CanonicalizationException
-    * @throws IOException
-    * @throws InvalidCanonicalizerException
-    * @throws ParserConfigurationException
-    * @throws SAXException
-    * @throws TransformationException
-    */
-   protected XMLSignatureInput enginePerformTransform(
-      XMLSignatureInput input, OutputStream os, Transform _transformObject)
-         throws IOException,
-                CanonicalizationException, InvalidCanonicalizerException,
-                TransformationException, ParserConfigurationException,
-                SAXException {
-   	    return enginePerformTransform(input, _transformObject);
-   }
-   /**
-    * The mega method which MUST be implemented by the Transformation Algorithm.
-    *
-    * @param input {@link XMLSignatureInput} as the input of transformation
- * @param _transformObject TODO
-    * @return {@link XMLSignatureInput} as the result of transformation
-    * @throws CanonicalizationException
-    * @throws IOException
-    * @throws InvalidCanonicalizerException
-    * @throws ParserConfigurationException
-    * @throws SAXException
-    * @throws TransformationException
-    */
-   protected XMLSignatureInput enginePerformTransform(
-      XMLSignatureInput input, Transform _transformObject)
-         throws IOException,
-                CanonicalizationException, InvalidCanonicalizerException,
-                TransformationException, ParserConfigurationException,
-                SAXException {
-	   //Default implementation overide with a much better
-	   TransformSpi tmp;
+    /**
+     * For API compatibility not thread safe.
+     * @deprecated
+     */
+    protected Transform _transformObject = null;
+    /**
+     * Set the transform object. 
+     * Depeprecated 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
+     * @return {@link XMLSignatureInput} as the result of transformation
+     * @throws CanonicalizationException
+     * @throws IOException
+     * @throws InvalidCanonicalizerException
+     * @throws ParserConfigurationException
+     * @throws SAXException
+     * @throws TransformationException
+     */
+    protected XMLSignatureInput enginePerformTransform(
+        XMLSignatureInput input, OutputStream os, Transform _transformObject)
+        throws IOException,
+               CanonicalizationException, InvalidCanonicalizerException,
+               TransformationException, ParserConfigurationException,
+               SAXException {
+        return enginePerformTransform(input, _transformObject);
+    }
+    /**
+     * The mega method which MUST be implemented by the Transformation Algorithm.
+     * In order to be compatible with preexisting Transform implementations, 
+     * by default this implementation invokes the deprecated, thread-unsafe
+     * methods. Subclasses should override this with a thread-safe 
+     * implementation.
+     * 
+     * @param input {@link XMLSignatureInput} as the input of transformation
+     * @param _transformObject the Transform
+     * @return {@link XMLSignatureInput} as the result of transformation
+     * @throws CanonicalizationException
+     * @throws IOException
+     * @throws InvalidCanonicalizerException
+     * @throws ParserConfigurationException
+     * @throws SAXException
+     * @throws TransformationException
+     */
+    protected XMLSignatureInput enginePerformTransform(
+        XMLSignatureInput input, Transform _transformObject)
+        throws IOException,
+               CanonicalizationException, InvalidCanonicalizerException,
+               TransformationException, ParserConfigurationException,
+               SAXException {
+	//Default implementation overide with a much better
+	TransformSpi tmp;
 	try {
-		tmp = (TransformSpi) getClass().newInstance();
-		tmp.setTransform(_transformObject);
-		return tmp.enginePerformTransform(input);
+	    tmp = (TransformSpi) getClass().newInstance();
+	    tmp.setTransform(_transformObject);
+	    return tmp.enginePerformTransform(input);
 	} catch (InstantiationException e) {
-		throw new TransformationException("",e);
+	    throw new TransformationException("",e);
 	} catch (IllegalAccessException e) {
-		throw new TransformationException("",e);
+	    throw new TransformationException("",e);
 	}
-   }
+    }
 
-   /**
-    * The mega method which MUST be implemented by the Transformation Algorithm.
-    * @deprecated
-    * @param input {@link XMLSignatureInput} as the input of transformation
- * @param _transformObject TODO
-    * @return {@link XMLSignatureInput} as the result of transformation
-    * @throws CanonicalizationException
-    * @throws IOException
-    * @throws InvalidCanonicalizerException
-    * @throws ParserConfigurationException
-    * @throws SAXException
-    * @throws TransformationException
-    */
-   protected XMLSignatureInput enginePerformTransform(
-      XMLSignatureInput input)
-         throws IOException,
-                CanonicalizationException, InvalidCanonicalizerException,
-                TransformationException, ParserConfigurationException,
-                SAXException {
-	   throw new NotImplementedException();
-   };
-   /**
-    * Returns the URI representation of <code>Transformation algorithm</code>
-    *
-    * @return the URI representation of <code>Transformation algorithm</code>
-    */
-   protected abstract String engineGetURI();
+    /**
+     * 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
+     * @throws IOException
+     * @throws InvalidCanonicalizerException
+     * @throws ParserConfigurationException
+     * @throws SAXException
+     * @throws TransformationException
+     */
+    protected XMLSignatureInput enginePerformTransform(
+        XMLSignatureInput input)
+        throws IOException,
+               CanonicalizationException, InvalidCanonicalizerException,
+               TransformationException, ParserConfigurationException,
+               SAXException {
+	throw new UnsupportedOperationException();
+    }
+    /**
+     * Returns the URI representation of <code>Transformation algorithm</code>
+     *
+     * @return the URI representation of <code>Transformation algorithm</code>
+     */
+    protected abstract String engineGetURI();
 }