143 * @throws XMLSecurityException
144 */
145 public Transform(Element element, String BaseURI)
146 throws InvalidTransformException, TransformationException, XMLSecurityException {
147 super(element, BaseURI);
148
149 // retrieve Algorithm Attribute from ds:Transform
150 String algorithmURI = element.getAttributeNS(null, Constants._ATT_ALGORITHM);
151
152 if (algorithmURI == null || algorithmURI.length() == 0) {
153 Object exArgs[] = { Constants._ATT_ALGORITHM, Constants._TAG_TRANSFORM };
154 throw new TransformationException("xml.WrongContent", exArgs);
155 }
156
157 Class<? extends TransformSpi> transformSpiClass = transformSpiHash.get(algorithmURI);
158 if (transformSpiClass == null) {
159 Object exArgs[] = { algorithmURI };
160 throw new InvalidTransformException("signature.Transform.UnknownTransform", exArgs);
161 }
162 try {
163 transformSpi = transformSpiClass.newInstance();
164 } catch (InstantiationException ex) {
165 Object exArgs[] = { algorithmURI };
166 throw new InvalidTransformException(
167 "signature.Transform.UnknownTransform", exArgs, ex
168 );
169 } catch (IllegalAccessException ex) {
170 Object exArgs[] = { algorithmURI };
171 throw new InvalidTransformException(
172 "signature.Transform.UnknownTransform", exArgs, ex
173 );
174 }
175 }
176
177 /**
178 * Registers implementing class of the Transform algorithm with algorithmURI
179 *
180 * @param algorithmURI algorithmURI URI representation of <code>Transform algorithm</code>
181 * @param implementingClass <code>implementingClass</code> the implementing
182 * class of {@link TransformSpi}
183 * @throws AlgorithmAlreadyRegisteredException if specified algorithmURI
328 /** @inheritDoc */
329 public String getBaseLocalName() {
330 return Constants._TAG_TRANSFORM;
331 }
332
333 /**
334 * Initialize the transform object.
335 */
336 private TransformSpi initializeTransform(String algorithmURI, NodeList contextNodes)
337 throws InvalidTransformException {
338
339 this.constructionElement.setAttributeNS(null, Constants._ATT_ALGORITHM, algorithmURI);
340
341 Class<? extends TransformSpi> transformSpiClass = transformSpiHash.get(algorithmURI);
342 if (transformSpiClass == null) {
343 Object exArgs[] = { algorithmURI };
344 throw new InvalidTransformException("signature.Transform.UnknownTransform", exArgs);
345 }
346 TransformSpi newTransformSpi = null;
347 try {
348 newTransformSpi = transformSpiClass.newInstance();
349 } catch (InstantiationException ex) {
350 Object exArgs[] = { algorithmURI };
351 throw new InvalidTransformException(
352 "signature.Transform.UnknownTransform", exArgs, ex
353 );
354 } catch (IllegalAccessException ex) {
355 Object exArgs[] = { algorithmURI };
356 throw new InvalidTransformException(
357 "signature.Transform.UnknownTransform", exArgs, ex
358 );
359 }
360
361 if (log.isLoggable(java.util.logging.Level.FINE)) {
362 log.log(java.util.logging.Level.FINE, "Create URI \"" + algorithmURI + "\" class \""
363 + newTransformSpi.getClass() + "\"");
364 log.log(java.util.logging.Level.FINE, "The NodeList is " + contextNodes);
365 }
366
367 // give it to the current document
368 if (contextNodes != null) {
|
143 * @throws XMLSecurityException
144 */
145 public Transform(Element element, String BaseURI)
146 throws InvalidTransformException, TransformationException, XMLSecurityException {
147 super(element, BaseURI);
148
149 // retrieve Algorithm Attribute from ds:Transform
150 String algorithmURI = element.getAttributeNS(null, Constants._ATT_ALGORITHM);
151
152 if (algorithmURI == null || algorithmURI.length() == 0) {
153 Object exArgs[] = { Constants._ATT_ALGORITHM, Constants._TAG_TRANSFORM };
154 throw new TransformationException("xml.WrongContent", exArgs);
155 }
156
157 Class<? extends TransformSpi> transformSpiClass = transformSpiHash.get(algorithmURI);
158 if (transformSpiClass == null) {
159 Object exArgs[] = { algorithmURI };
160 throw new InvalidTransformException("signature.Transform.UnknownTransform", exArgs);
161 }
162 try {
163 @SuppressWarnings("deprecation")
164 TransformSpi tmp = transformSpiClass.newInstance();
165 transformSpi = tmp;
166 } catch (InstantiationException ex) {
167 Object exArgs[] = { algorithmURI };
168 throw new InvalidTransformException(
169 "signature.Transform.UnknownTransform", exArgs, ex
170 );
171 } catch (IllegalAccessException ex) {
172 Object exArgs[] = { algorithmURI };
173 throw new InvalidTransformException(
174 "signature.Transform.UnknownTransform", exArgs, ex
175 );
176 }
177 }
178
179 /**
180 * Registers implementing class of the Transform algorithm with algorithmURI
181 *
182 * @param algorithmURI algorithmURI URI representation of <code>Transform algorithm</code>
183 * @param implementingClass <code>implementingClass</code> the implementing
184 * class of {@link TransformSpi}
185 * @throws AlgorithmAlreadyRegisteredException if specified algorithmURI
330 /** @inheritDoc */
331 public String getBaseLocalName() {
332 return Constants._TAG_TRANSFORM;
333 }
334
335 /**
336 * Initialize the transform object.
337 */
338 private TransformSpi initializeTransform(String algorithmURI, NodeList contextNodes)
339 throws InvalidTransformException {
340
341 this.constructionElement.setAttributeNS(null, Constants._ATT_ALGORITHM, algorithmURI);
342
343 Class<? extends TransformSpi> transformSpiClass = transformSpiHash.get(algorithmURI);
344 if (transformSpiClass == null) {
345 Object exArgs[] = { algorithmURI };
346 throw new InvalidTransformException("signature.Transform.UnknownTransform", exArgs);
347 }
348 TransformSpi newTransformSpi = null;
349 try {
350 @SuppressWarnings("deprecation")
351 TransformSpi tmp = transformSpiClass.newInstance();
352 newTransformSpi = tmp;
353 } catch (InstantiationException ex) {
354 Object exArgs[] = { algorithmURI };
355 throw new InvalidTransformException(
356 "signature.Transform.UnknownTransform", exArgs, ex
357 );
358 } catch (IllegalAccessException ex) {
359 Object exArgs[] = { algorithmURI };
360 throw new InvalidTransformException(
361 "signature.Transform.UnknownTransform", exArgs, ex
362 );
363 }
364
365 if (log.isLoggable(java.util.logging.Level.FINE)) {
366 log.log(java.util.logging.Level.FINE, "Create URI \"" + algorithmURI + "\" class \""
367 + newTransformSpi.getClass() + "\"");
368 log.log(java.util.logging.Level.FINE, "The NodeList is " + contextNodes);
369 }
370
371 // give it to the current document
372 if (contextNodes != null) {
|