blob: 332e6ce0a21c5cc01620aaec053f1cf81f247959 [file] [log] [blame]
J. Duke319a3b92007-12-01 00:00:00 +00001/*
2 * reserved comment block
3 * DO NOT REMOVE OR ALTER!
4 */
5
6/*
7 * Copyright 1999-2004 The Apache Software Foundation.
8 *
9 * Licensed under the Apache License, Version 2.0 (the "License");
10 * you may not use this file except in compliance with the License.
11 * You may obtain a copy of the License at
12 *
13 * http://www.apache.org/licenses/LICENSE-2.0
14 *
15 * Unless required by applicable law or agreed to in writing, software
16 * distributed under the License is distributed on an "AS IS" BASIS,
17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * See the License for the specific language governing permissions and
19 * limitations under the License.
20 *
21 */
22package com.sun.org.apache.xml.internal.security.transforms;
23
24
25
26import java.io.IOException;
27import java.io.OutputStream;
28
29import javax.xml.parsers.ParserConfigurationException;
30
31import com.sun.org.apache.xml.internal.security.c14n.CanonicalizationException;
32import com.sun.org.apache.xml.internal.security.c14n.InvalidCanonicalizerException;
33import com.sun.org.apache.xml.internal.security.signature.XMLSignatureInput;
34import org.xml.sax.SAXException;
35
36
37/**
38 * Base class which all Transform algorithms extend. The common methods that
39 * have to be overridden are the {@link #enginePerformTransform(XMLSignatureInput)} method.
40 *
41 * @author Christian Geuer-Pollmann
42 */
43public abstract class TransformSpi {
44
45 /** {@link java.util.logging} logging facility */
46 static java.util.logging.Logger log =
47 java.util.logging.Logger.getLogger(TransformSpi.class.getName());
48
49 protected Transform _transformObject = null;
50 protected void setTransform(Transform transform) {
51 this._transformObject = transform;
52 }
53
54 /**
55 * The mega method which MUST be implemented by the Transformation Algorithm.
56 *
57 * @param input {@link XMLSignatureInput} as the input of transformation
58 * @param os where to output this transformation.
59 * @return {@link XMLSignatureInput} as the result of transformation
60 * @throws CanonicalizationException
61 * @throws IOException
62 * @throws InvalidCanonicalizerException
63 * @throws ParserConfigurationException
64 * @throws SAXException
65 * @throws TransformationException
66 */
67 protected XMLSignatureInput enginePerformTransform(
68 XMLSignatureInput input, OutputStream os)
69 throws IOException,
70 CanonicalizationException, InvalidCanonicalizerException,
71 TransformationException, ParserConfigurationException,
72 SAXException {
73 return enginePerformTransform(input);
74 }
75 /**
76 * The mega method which MUST be implemented by the Transformation Algorithm.
77 *
78 * @param input {@link XMLSignatureInput} as the input of transformation
79 * @return {@link XMLSignatureInput} as the result of transformation
80 * @throws CanonicalizationException
81 * @throws IOException
82 * @throws InvalidCanonicalizerException
83 * @throws ParserConfigurationException
84 * @throws SAXException
85 * @throws TransformationException
86 */
87 protected abstract XMLSignatureInput enginePerformTransform(
88 XMLSignatureInput input)
89 throws IOException,
90 CanonicalizationException, InvalidCanonicalizerException,
91 TransformationException, ParserConfigurationException,
92 SAXException;
93
94 /**
95 * Returns the URI representation of <code>Transformation algorithm</code>
96 *
97 * @return the URI representation of <code>Transformation algorithm</code>
98 */
99 protected abstract String engineGetURI();
100}