Class Transform
java.lang.Object
org.apache.xml.security.utils.ElementProxy
org.apache.xml.security.utils.SignatureElementProxy
org.apache.xml.security.transforms.Transform
Implements the behaviour of the
ds:Transform
element.
This Transform
(Factory) class acts as the Factory and Proxy of
the implementing class that supports the functionality of a Transform
algorithm.
Implements the Factory and Proxy pattern for ds:Transform algorithms.- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final org.slf4j.Logger
private boolean
private final TransformSpi
private static Map
<String, Class<? extends TransformSpi>> All available Transform classes are registered hereFields inherited from class org.apache.xml.security.utils.ElementProxy
baseURI
-
Constructor Summary
ConstructorsConstructorDescriptionGenerates a Transform object that implements the specifiedTransform algorithm
URI.Generates a Transform object that implements the specifiedTransform algorithm
URI.ConstructsTransform
-
Method Summary
Modifier and TypeMethodDescriptionReturns the localname of the Elements of the sub-class.getURI()
Returns the URI representation of Transformation algorithmprivate TransformSpi
initializeTransform
(String algorithmURI, NodeList contextNodes) Initialize the transform object.boolean
Transforms the input, and generatesXMLSignatureInput
as output.performTransform
(XMLSignatureInput input, OutputStream os) Transforms the input, and generatesXMLSignatureInput
as output.static void
register
(String algorithmURI, Class<? extends TransformSpi> implementingClass) Registers implementing class of the Transform algorithm with algorithmURIstatic void
Registers implementing class of the Transform algorithm with algorithmURIstatic void
This method registers the default algorithms.void
setSecureValidation
(boolean secureValidation) Methods inherited from class org.apache.xml.security.utils.SignatureElementProxy
getBaseNamespace
Methods inherited from class org.apache.xml.security.utils.ElementProxy
addBase64Element, addBase64Text, addBigIntegerElement, addReturnToSelf, addText, addTextElement, appendOther, appendSelf, appendSelf, createElementForFamily, createElementForFamilyLocal, createText, getBaseURI, getBigIntegerFromChildElement, getBytesFromTextChild, getDefaultPrefix, getDocument, getElement, getElementPlusReturns, getFirstChild, getLocalAttribute, getTextFromChildElement, getTextFromTextChild, length, registerDefaultPrefixes, setDefaultPrefix, setDocument, setElement, setElement, setLocalAttribute, setLocalIdAttribute, setXPathNamespaceContext
-
Field Details
-
LOG
private static final org.slf4j.Logger LOG -
transformSpiHash
All available Transform classes are registered here -
transformSpi
-
secureValidation
private boolean secureValidation
-
-
Constructor Details
-
Transform
Generates a Transform object that implements the specifiedTransform algorithm
URI.- Parameters:
doc
- the proxyDocument
algorithmURI
-Transform algorithm
URI representation, such as specified in Transform algorithm- Throws:
InvalidTransformException
-
Transform
public Transform(Document doc, String algorithmURI, Element contextChild) throws InvalidTransformException Generates a Transform object that implements the specifiedTransform algorithm
URI.- Parameters:
doc
- the proxyDocument
algorithmURI
-Transform algorithm
URI representation, such as specified in Transform algorithmcontextChild
- the child element ofTransform
element- Throws:
InvalidTransformException
-
Transform
public Transform(Document doc, String algorithmURI, NodeList contextNodes) throws InvalidTransformException ConstructsTransform
- Parameters:
doc
- theDocument
in whichTransform
will be placedalgorithmURI
- URI representation ofTransform algorithm
contextNodes
- the child node list ofTransform
element- Throws:
InvalidTransformException
-
Transform
public Transform(Element element, String baseURI) throws InvalidTransformException, TransformationException, XMLSecurityException - Parameters:
element
-ds:Transform
elementbaseURI
- the URI of the resource where the XML instance was stored- Throws:
InvalidTransformException
TransformationException
XMLSecurityException
-
-
Method Details
-
register
public static void register(String algorithmURI, String implementingClass) throws AlgorithmAlreadyRegisteredException, ClassNotFoundException, InvalidTransformException Registers implementing class of the Transform algorithm with algorithmURI- Parameters:
algorithmURI
- algorithmURI URI representation ofTransform algorithm
implementingClass
-implementingClass
the implementing class ofTransformSpi
- Throws:
AlgorithmAlreadyRegisteredException
- if specified algorithmURI is already registeredSecurityException
- if a security manager is installed and the caller does not have permission to register the transformClassNotFoundException
InvalidTransformException
-
register
public static void register(String algorithmURI, Class<? extends TransformSpi> implementingClass) throws AlgorithmAlreadyRegisteredException Registers implementing class of the Transform algorithm with algorithmURI- Parameters:
algorithmURI
- algorithmURI URI representation ofTransform algorithm
implementingClass
-implementingClass
the implementing class ofTransformSpi
- Throws:
AlgorithmAlreadyRegisteredException
- if specified algorithmURI is already registeredSecurityException
- if a security manager is installed and the caller does not have permission to register the transform
-
registerDefaultAlgorithms
public static void registerDefaultAlgorithms()This method registers the default algorithms. -
getURI
Returns the URI representation of Transformation algorithm- Returns:
- the URI representation of Transformation algorithm
-
performTransform
public XMLSignatureInput performTransform(XMLSignatureInput input) throws IOException, CanonicalizationException, InvalidCanonicalizerException, TransformationException Transforms the input, and generatesXMLSignatureInput
as output.- Parameters:
input
- inputXMLSignatureInput
which can supplied Octet Stream and NodeSet as Input of Transformation- Returns:
- the
XMLSignatureInput
class as the result of transformation - Throws:
CanonicalizationException
IOException
InvalidCanonicalizerException
TransformationException
-
performTransform
public XMLSignatureInput performTransform(XMLSignatureInput input, OutputStream os) throws IOException, CanonicalizationException, InvalidCanonicalizerException, TransformationException Transforms the input, and generatesXMLSignatureInput
as output.- Parameters:
input
- inputXMLSignatureInput
which can supplied Octect Stream and NodeSet as Input of Transformationos
- where to output the result of the last transformation- Returns:
- the
XMLSignatureInput
class as the result of transformation - Throws:
CanonicalizationException
IOException
InvalidCanonicalizerException
TransformationException
-
getBaseLocalName
Returns the localname of the Elements of the sub-class.- Specified by:
getBaseLocalName
in classElementProxy
- Returns:
- the localname of the Elements of the sub-class.
-
initializeTransform
private TransformSpi initializeTransform(String algorithmURI, NodeList contextNodes) throws InvalidTransformException Initialize the transform object.- Throws:
InvalidTransformException
-
isSecureValidation
public boolean isSecureValidation() -
setSecureValidation
public void setSecureValidation(boolean secureValidation)
-