Transformspublic class Transforms extends SignatureElementProxy Holder of the {@link com.sun.org.apache.xml.internal.security.transforms.Transform} steps to be performed on the data.
The input to the first Transform is the result of dereferencing the URI attribute of the Reference element.
The output from the last Transform is the input for the DigestMethod algorithm |
Fields Summary |
---|
static Logger | log{@link java.util.logging} logging facility | public static final String | TRANSFORM_C14N_OMIT_COMMENTSCanonicalization - Required Canonical XML (omits comments) | public static final String | TRANSFORM_C14N_WITH_COMMENTSCanonicalization - Recommended Canonical XML with Comments | public static final String | TRANSFORM_C14N_EXCL_OMIT_COMMENTSCanonicalization - Required Exclusive Canonicalization (omits comments) | public static final String | TRANSFORM_C14N_EXCL_WITH_COMMENTSCanonicalization - Recommended Exclusive Canonicalization with Comments | public static final String | TRANSFORM_XSLTTransform - Optional XSLT | public static final String | TRANSFORM_BASE64_DECODETransform - Required base64 decoding | public static final String | TRANSFORM_XPATHTransform - Recommended XPath | public static final String | TRANSFORM_ENVELOPED_SIGNATURETransform - Required Enveloped Signature | public static final String | TRANSFORM_XPOINTERTransform - XPointer | public static final String | TRANSFORM_XPATH2FILTER04Transform - XPath Filter v2.0 | public static final String | TRANSFORM_XPATH2FILTERTransform - XPath Filter | public static final String | TRANSFORM_XPATHFILTERCHGPTransform - XPath Filter CHGP private | Element[] | transforms |
Constructors Summary |
---|
public Transforms(Document doc)Consturcts {@link Transforms}
super(doc);
XMLUtils.addReturnToElement(this._constructionElement);
| public Transforms(Element element, String BaseURI)Consturcts {@link Transforms} from {@link Element} which is Transforms Element
super(element, BaseURI);
int numberOfTransformElems = this.getLength();
if (numberOfTransformElems == 0) {
// At least ont Transform element must be present. Bad.
Object exArgs[] = { Constants._TAG_TRANSFORM,
Constants._TAG_TRANSFORMS };
throw new TransformationException("xml.WrongContent", exArgs);
}
|
Methods Summary |
---|
public void | addTransform(java.lang.String transformURI)Adds the Transform with the specified Transform algorithm URI
try {
if (true)
if (log.isLoggable(java.util.logging.Level.FINE)) log.log(java.util.logging.Level.FINE, "Transforms.addTransform(" + transformURI + ")");
Transform transform = Transform.getInstance(this._doc, transformURI);
this.addTransform(transform);
} catch (InvalidTransformException ex) {
throw new TransformationException("empty", ex);
}
| public void | addTransform(java.lang.String transformURI, org.w3c.dom.Element contextElement)Adds the Transform with the specified Transform algorithm URI
try {
if (true)
if (log.isLoggable(java.util.logging.Level.FINE)) log.log(java.util.logging.Level.FINE, "Transforms.addTransform(" + transformURI + ")");
Transform transform = Transform.getInstance(this._doc, transformURI,
contextElement);
this.addTransform(transform);
} catch (InvalidTransformException ex) {
throw new TransformationException("empty", ex);
}
| public void | addTransform(java.lang.String transformURI, org.w3c.dom.NodeList contextNodes)Adds the Transform with the specified Transform algorithm URI
try {
Transform transform = Transform.getInstance(this._doc, transformURI,
contextNodes);
this.addTransform(transform);
} catch (InvalidTransformException ex) {
throw new TransformationException("empty", ex);
}
| private void | addTransform(com.sun.org.apache.xml.internal.security.transforms.Transform transform)Adds a user-provided Transform step.
if (true)
if (log.isLoggable(java.util.logging.Level.FINE)) log.log(java.util.logging.Level.FINE, "Transforms.addTransform(" + transform.getURI() + ")");
Element transformElement = transform.getElement();
this._constructionElement.appendChild(transformElement);
XMLUtils.addReturnToElement(this._constructionElement);
| public java.lang.String | getBaseLocalName()
return Constants._TAG_TRANSFORMS;
| public int | getLength()Return the nonnegative number of transformations.
/*Element nscontext = XMLUtils.createDSctx(this._doc, "ds",
Constants.SignatureSpecNS);
NodeList transformElems =
XPathAPI.selectNodeList(this._constructionElement,
"./ds:Transform", nscontext);
return transformElems.getLength();*/
if (transforms==null) {
transforms=XMLUtils.selectDsNodes(this._constructionElement.getFirstChild(),
"Transform");
}
return transforms.length;
| public com.sun.org.apache.xml.internal.security.transforms.Transform | item(int i)Return the ith {@link Transform} .
Valid i values are 0 to {@link #getLength}-1 .
try {
if (transforms==null) {
transforms=XMLUtils.selectDsNodes(this._constructionElement.getFirstChild(),
"Transform");
}
return new Transform(transforms[i], this._baseURI);
} catch (XMLSecurityException ex) {
throw new TransformationException("empty", ex);
}
| public com.sun.org.apache.xml.internal.security.signature.XMLSignatureInput | performTransforms(com.sun.org.apache.xml.internal.security.signature.XMLSignatureInput xmlSignatureInput)Applies all included Transform s to xmlSignatureInput and returns the result of these transformations.
return performTransforms(xmlSignatureInput,null);
| public com.sun.org.apache.xml.internal.security.signature.XMLSignatureInput | performTransforms(com.sun.org.apache.xml.internal.security.signature.XMLSignatureInput xmlSignatureInput, java.io.OutputStream os)Applies all included Transform s to xmlSignatureInput and returns the result of these transformations.
try {
int last=this.getLength()-1;
for (int i = 0; i < last; i++) {
Transform t = this.item(i);
if (true) {
if (log.isLoggable(java.util.logging.Level.FINE)) log.log(java.util.logging.Level.FINE, "Preform the (" + i + ")th " + t.getURI() + " transform");
}
xmlSignatureInput = t.performTransform(xmlSignatureInput);
}
if (last>=0) {
Transform t = this.item(last);
xmlSignatureInput = t.performTransform(xmlSignatureInput, os);
}
return xmlSignatureInput;
} catch (IOException ex) {
throw new TransformationException("empty", ex);
// } catch (ParserConfigurationException ex) { throw new TransformationException("empty", ex);
// } catch (SAXException ex) { throw new TransformationException("empty", ex);
} catch (CanonicalizationException ex) {
throw new TransformationException("empty", ex);
} catch (InvalidCanonicalizerException ex) {
throw new TransformationException("empty", ex);
}
|
|