0N/A/*
0N/A * reserved comment block
0N/A * DO NOT REMOVE OR ALTER!
0N/A */
0N/A/*
0N/A * Copyright 1999-2004 The Apache Software Foundation.
0N/A *
0N/A * Licensed under the Apache License, Version 2.0 (the "License");
0N/A * you may not use this file except in compliance with the License.
0N/A * You may obtain a copy of the License at
0N/A *
0N/A * http://www.apache.org/licenses/LICENSE-2.0
0N/A *
0N/A * Unless required by applicable law or agreed to in writing, software
0N/A * distributed under the License is distributed on an "AS IS" BASIS,
0N/A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
0N/A * See the License for the specific language governing permissions and
0N/A * limitations under the License.
0N/A *
0N/A */
0N/Apackage com.sun.org.apache.xml.internal.security.transforms;
0N/A
0N/Aimport java.io.IOException;
0N/Aimport java.io.OutputStream;
0N/Aimport javax.xml.parsers.ParserConfigurationException;
0N/A
0N/Aimport com.sun.org.apache.xml.internal.security.c14n.CanonicalizationException;
0N/Aimport com.sun.org.apache.xml.internal.security.c14n.InvalidCanonicalizerException;
0N/Aimport com.sun.org.apache.xml.internal.security.signature.XMLSignatureInput;
0N/Aimport org.xml.sax.SAXException;
0N/A
0N/A/**
0N/A * Base class which all Transform algorithms extend. The common methods that
661N/A * have to be overridden are the
661N/A * {@link #enginePerformTransform(XMLSignatureInput, Transform)} method.
0N/A *
0N/A * @author Christian Geuer-Pollmann
0N/A */
0N/Apublic abstract class TransformSpi {
661N/A /**
661N/A * For API compatibility not thread safe.
661N/A * @deprecated
661N/A */
661N/A protected Transform _transformObject = null;
661N/A /**
661N/A * Set the transform object.
661N/A * Depeprecated For API compatibility.
661N/A * @param transform the Transform
661N/A * @deprecated
661N/A */
661N/A protected void setTransform(Transform transform) {
661N/A this._transformObject = transform;
661N/A }
661N/A /**
661N/A * The mega method which MUST be implemented by the Transformation Algorithm.
661N/A *
661N/A * @param input {@link XMLSignatureInput} as the input of transformation
661N/A * @param os where to output this transformation.
661N/A * @param _transformObject the Transform
661N/A * @return {@link XMLSignatureInput} as the result of transformation
661N/A * @throws CanonicalizationException
661N/A * @throws IOException
661N/A * @throws InvalidCanonicalizerException
661N/A * @throws ParserConfigurationException
661N/A * @throws SAXException
661N/A * @throws TransformationException
661N/A */
661N/A protected XMLSignatureInput enginePerformTransform(
661N/A XMLSignatureInput input, OutputStream os, Transform _transformObject)
661N/A throws IOException,
661N/A CanonicalizationException, InvalidCanonicalizerException,
661N/A TransformationException, ParserConfigurationException,
661N/A SAXException {
661N/A return enginePerformTransform(input, _transformObject);
661N/A }
661N/A /**
661N/A * The mega method which MUST be implemented by the Transformation Algorithm.
661N/A * In order to be compatible with preexisting Transform implementations,
661N/A * by default this implementation invokes the deprecated, thread-unsafe
661N/A * methods. Subclasses should override this with a thread-safe
661N/A * implementation.
661N/A *
661N/A * @param input {@link XMLSignatureInput} as the input of transformation
661N/A * @param _transformObject the Transform
661N/A * @return {@link XMLSignatureInput} as the result of transformation
661N/A * @throws CanonicalizationException
661N/A * @throws IOException
661N/A * @throws InvalidCanonicalizerException
661N/A * @throws ParserConfigurationException
661N/A * @throws SAXException
661N/A * @throws TransformationException
661N/A */
661N/A protected XMLSignatureInput enginePerformTransform(
661N/A XMLSignatureInput input, Transform _transformObject)
661N/A throws IOException,
661N/A CanonicalizationException, InvalidCanonicalizerException,
661N/A TransformationException, ParserConfigurationException,
661N/A SAXException {
661N/A //Default implementation overide with a much better
661N/A try {
661N/A TransformSpi tmp = (TransformSpi) getClass().newInstance();
661N/A tmp.setTransform(_transformObject);
661N/A return tmp.enginePerformTransform(input);
661N/A } catch (InstantiationException e) {
661N/A throw new TransformationException("",e);
661N/A } catch (IllegalAccessException e) {
661N/A throw new TransformationException("",e);
661N/A }
661N/A }
0N/A
661N/A /**
661N/A * The mega method which MUST be implemented by the Transformation Algorithm.
661N/A * @deprecated
661N/A * @param input {@link XMLSignatureInput} as the input of transformation
661N/A * @return {@link XMLSignatureInput} as the result of transformation
661N/A * @throws CanonicalizationException
661N/A * @throws IOException
661N/A * @throws InvalidCanonicalizerException
661N/A * @throws ParserConfigurationException
661N/A * @throws SAXException
661N/A * @throws TransformationException
661N/A */
661N/A protected XMLSignatureInput enginePerformTransform(
661N/A XMLSignatureInput input)
661N/A throws IOException,
661N/A CanonicalizationException, InvalidCanonicalizerException,
661N/A TransformationException, ParserConfigurationException,
661N/A SAXException {
661N/A throw new UnsupportedOperationException();
661N/A }
661N/A /**
661N/A * Returns the URI representation of <code>Transformation algorithm</code>
661N/A *
661N/A * @return the URI representation of <code>Transformation algorithm</code>
661N/A */
661N/A protected abstract String engineGetURI();
0N/A}