author | mullan |
Fri, 05 Jul 2013 15:54:42 -0400 | |
changeset 18780 | f47b920867e7 |
parent 10694 | cf59e2badd14 |
permissions | -rw-r--r-- |
2 | 1 |
/* |
2 |
* reserved comment block |
|
3 |
* DO NOT REMOVE OR ALTER! |
|
4 |
*/ |
|
18780
f47b920867e7
8011547: Update XML Signature implementation to Apache Santuario 1.5.4
mullan
parents:
10694
diff
changeset
|
5 |
/** |
f47b920867e7
8011547: Update XML Signature implementation to Apache Santuario 1.5.4
mullan
parents:
10694
diff
changeset
|
6 |
* Licensed to the Apache Software Foundation (ASF) under one |
f47b920867e7
8011547: Update XML Signature implementation to Apache Santuario 1.5.4
mullan
parents:
10694
diff
changeset
|
7 |
* or more contributor license agreements. See the NOTICE file |
f47b920867e7
8011547: Update XML Signature implementation to Apache Santuario 1.5.4
mullan
parents:
10694
diff
changeset
|
8 |
* distributed with this work for additional information |
f47b920867e7
8011547: Update XML Signature implementation to Apache Santuario 1.5.4
mullan
parents:
10694
diff
changeset
|
9 |
* regarding copyright ownership. The ASF licenses this file |
f47b920867e7
8011547: Update XML Signature implementation to Apache Santuario 1.5.4
mullan
parents:
10694
diff
changeset
|
10 |
* to you under the Apache License, Version 2.0 (the |
f47b920867e7
8011547: Update XML Signature implementation to Apache Santuario 1.5.4
mullan
parents:
10694
diff
changeset
|
11 |
* "License"); you may not use this file except in compliance |
f47b920867e7
8011547: Update XML Signature implementation to Apache Santuario 1.5.4
mullan
parents:
10694
diff
changeset
|
12 |
* with the License. You may obtain a copy of the License at |
2 | 13 |
* |
18780
f47b920867e7
8011547: Update XML Signature implementation to Apache Santuario 1.5.4
mullan
parents:
10694
diff
changeset
|
14 |
* http://www.apache.org/licenses/LICENSE-2.0 |
2 | 15 |
* |
18780
f47b920867e7
8011547: Update XML Signature implementation to Apache Santuario 1.5.4
mullan
parents:
10694
diff
changeset
|
16 |
* Unless required by applicable law or agreed to in writing, |
f47b920867e7
8011547: Update XML Signature implementation to Apache Santuario 1.5.4
mullan
parents:
10694
diff
changeset
|
17 |
* software distributed under the License is distributed on an |
f47b920867e7
8011547: Update XML Signature implementation to Apache Santuario 1.5.4
mullan
parents:
10694
diff
changeset
|
18 |
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
f47b920867e7
8011547: Update XML Signature implementation to Apache Santuario 1.5.4
mullan
parents:
10694
diff
changeset
|
19 |
* KIND, either express or implied. See the License for the |
f47b920867e7
8011547: Update XML Signature implementation to Apache Santuario 1.5.4
mullan
parents:
10694
diff
changeset
|
20 |
* specific language governing permissions and limitations |
f47b920867e7
8011547: Update XML Signature implementation to Apache Santuario 1.5.4
mullan
parents:
10694
diff
changeset
|
21 |
* under the License. |
2 | 22 |
*/ |
23 |
package com.sun.org.apache.xml.internal.security.transforms; |
|
24 |
||
25 |
import java.io.IOException; |
|
26 |
import java.io.OutputStream; |
|
27 |
import javax.xml.parsers.ParserConfigurationException; |
|
28 |
||
29 |
import com.sun.org.apache.xml.internal.security.c14n.CanonicalizationException; |
|
30 |
import com.sun.org.apache.xml.internal.security.c14n.InvalidCanonicalizerException; |
|
31 |
import com.sun.org.apache.xml.internal.security.signature.XMLSignatureInput; |
|
32 |
import org.xml.sax.SAXException; |
|
33 |
||
34 |
/** |
|
35 |
* Base class which all Transform algorithms extend. The common methods that |
|
1337 | 36 |
* have to be overridden are the |
37 |
* {@link #enginePerformTransform(XMLSignatureInput, Transform)} method. |
|
2 | 38 |
* |
39 |
* @author Christian Geuer-Pollmann |
|
40 |
*/ |
|
41 |
public abstract class TransformSpi { |
|
18780
f47b920867e7
8011547: Update XML Signature implementation to Apache Santuario 1.5.4
mullan
parents:
10694
diff
changeset
|
42 |
|
1337 | 43 |
/** |
44 |
* The mega method which MUST be implemented by the Transformation Algorithm. |
|
45 |
* |
|
46 |
* @param input {@link XMLSignatureInput} as the input of transformation |
|
47 |
* @param os where to output this transformation. |
|
18780
f47b920867e7
8011547: Update XML Signature implementation to Apache Santuario 1.5.4
mullan
parents:
10694
diff
changeset
|
48 |
* @param transformObject the Transform object |
1337 | 49 |
* @return {@link XMLSignatureInput} as the result of transformation |
50 |
* @throws CanonicalizationException |
|
51 |
* @throws IOException |
|
52 |
* @throws InvalidCanonicalizerException |
|
53 |
* @throws ParserConfigurationException |
|
54 |
* @throws SAXException |
|
55 |
* @throws TransformationException |
|
56 |
*/ |
|
57 |
protected XMLSignatureInput enginePerformTransform( |
|
18780
f47b920867e7
8011547: Update XML Signature implementation to Apache Santuario 1.5.4
mullan
parents:
10694
diff
changeset
|
58 |
XMLSignatureInput input, OutputStream os, Transform transformObject |
f47b920867e7
8011547: Update XML Signature implementation to Apache Santuario 1.5.4
mullan
parents:
10694
diff
changeset
|
59 |
) throws IOException, CanonicalizationException, InvalidCanonicalizerException, |
f47b920867e7
8011547: Update XML Signature implementation to Apache Santuario 1.5.4
mullan
parents:
10694
diff
changeset
|
60 |
TransformationException, ParserConfigurationException, SAXException { |
f47b920867e7
8011547: Update XML Signature implementation to Apache Santuario 1.5.4
mullan
parents:
10694
diff
changeset
|
61 |
throw new UnsupportedOperationException(); |
1337 | 62 |
} |
18780
f47b920867e7
8011547: Update XML Signature implementation to Apache Santuario 1.5.4
mullan
parents:
10694
diff
changeset
|
63 |
|
1337 | 64 |
/** |
65 |
* The mega method which MUST be implemented by the Transformation Algorithm. |
|
66 |
* In order to be compatible with preexisting Transform implementations, |
|
67 |
* by default this implementation invokes the deprecated, thread-unsafe |
|
68 |
* methods. Subclasses should override this with a thread-safe |
|
69 |
* implementation. |
|
70 |
* |
|
71 |
* @param input {@link XMLSignatureInput} as the input of transformation |
|
18780
f47b920867e7
8011547: Update XML Signature implementation to Apache Santuario 1.5.4
mullan
parents:
10694
diff
changeset
|
72 |
* @param transformObject the Transform object |
1337 | 73 |
* @return {@link XMLSignatureInput} as the result of transformation |
74 |
* @throws CanonicalizationException |
|
75 |
* @throws IOException |
|
76 |
* @throws InvalidCanonicalizerException |
|
77 |
* @throws ParserConfigurationException |
|
78 |
* @throws SAXException |
|
79 |
* @throws TransformationException |
|
80 |
*/ |
|
81 |
protected XMLSignatureInput enginePerformTransform( |
|
18780
f47b920867e7
8011547: Update XML Signature implementation to Apache Santuario 1.5.4
mullan
parents:
10694
diff
changeset
|
82 |
XMLSignatureInput input, Transform transformObject |
f47b920867e7
8011547: Update XML Signature implementation to Apache Santuario 1.5.4
mullan
parents:
10694
diff
changeset
|
83 |
) throws IOException, CanonicalizationException, InvalidCanonicalizerException, |
f47b920867e7
8011547: Update XML Signature implementation to Apache Santuario 1.5.4
mullan
parents:
10694
diff
changeset
|
84 |
TransformationException, ParserConfigurationException, SAXException { |
f47b920867e7
8011547: Update XML Signature implementation to Apache Santuario 1.5.4
mullan
parents:
10694
diff
changeset
|
85 |
return enginePerformTransform(input, null, transformObject); |
1337 | 86 |
} |
2 | 87 |
|
1337 | 88 |
/** |
89 |
* The mega method which MUST be implemented by the Transformation Algorithm. |
|
90 |
* @param input {@link XMLSignatureInput} as the input of transformation |
|
91 |
* @return {@link XMLSignatureInput} as the result of transformation |
|
92 |
* @throws CanonicalizationException |
|
93 |
* @throws IOException |
|
94 |
* @throws InvalidCanonicalizerException |
|
95 |
* @throws ParserConfigurationException |
|
96 |
* @throws SAXException |
|
97 |
* @throws TransformationException |
|
98 |
*/ |
|
99 |
protected XMLSignatureInput enginePerformTransform( |
|
18780
f47b920867e7
8011547: Update XML Signature implementation to Apache Santuario 1.5.4
mullan
parents:
10694
diff
changeset
|
100 |
XMLSignatureInput input |
f47b920867e7
8011547: Update XML Signature implementation to Apache Santuario 1.5.4
mullan
parents:
10694
diff
changeset
|
101 |
) throws IOException, CanonicalizationException, InvalidCanonicalizerException, |
f47b920867e7
8011547: Update XML Signature implementation to Apache Santuario 1.5.4
mullan
parents:
10694
diff
changeset
|
102 |
TransformationException, ParserConfigurationException, SAXException { |
f47b920867e7
8011547: Update XML Signature implementation to Apache Santuario 1.5.4
mullan
parents:
10694
diff
changeset
|
103 |
return enginePerformTransform(input, null); |
1337 | 104 |
} |
18780
f47b920867e7
8011547: Update XML Signature implementation to Apache Santuario 1.5.4
mullan
parents:
10694
diff
changeset
|
105 |
|
1337 | 106 |
/** |
107 |
* Returns the URI representation of <code>Transformation algorithm</code> |
|
108 |
* |
|
109 |
* @return the URI representation of <code>Transformation algorithm</code> |
|
110 |
*/ |
|
111 |
protected abstract String engineGetURI(); |
|
2 | 112 |
} |