Each instance of TransformService supports a specific
transform or canonicalization algorithm and XML mechanism type. To create a
TransformService, call one of the static
getInstance methods, passing in the algorithm URI and
XML mechanism type desired, for example:
TransformService ts = TransformService.getInstance(Transform.XPATH2, "DOM");
TransformService implementations are registered and loaded
using the java. mechanism. Each
TransformService service provider implementation should include
a MechanismType service attribute that identifies the XML
mechanism type that it supports. If the attribute is not specified,
"DOM" is assumed. For example, a service provider that supports the
XPath Filter 2 Transform and DOM mechanism would be specified in the
Provider subclass as:
put("TransformService." + Transform.XPATH2,
"org.example.XPath2TransformService");
put("TransformService." + Transform.XPATH2 + " MechanismType", "DOM");
TransformService implementations that support the DOM
mechanism type must abide by the DOM interoperability requirements defined
in the DOM Mechanism
Requirements. See the TransformService section in the
Java Security Standard Algorithm Names Specification for a list of
standard algorithm URIs and mechanism types.
Once a TransformService has been created, it can be used
to process Transform or CanonicalizationMethod
objects. If the Transform or CanonicalizationMethod
exists in XML form (for example, when validating an existing
XMLSignature), the init(XMLStructure, XMLCryptoContext)
method must be first called to initialize the transform and provide document
context (even if there are no parameters). Alternatively, if the
Transform or CanonicalizationMethod is being
created from scratch, the init(TransformParameterSpec) method
is called to initialize the transform with parameters and the
marshalParams method is called to marshal the
parameters to XML and provide the transform with document context. Finally,
the transform method is called to perform the
transformation.
Concurrent Access
The static methods of this class are guaranteed to be thread-safe. Multiple threads may concurrently invoke the static methods defined in this class with no ill effects.
However, this is not true for the non-static methods defined by this
class. Unless otherwise documented by a specific provider, threads that
need to access a single TransformService instance
concurrently should synchronize amongst themselves and provide the
necessary locking. Multiple threads each manipulating a different
TransformService instance need not synchronize.
| Modifier and Type | Class and Description |
|---|---|
| private static class |
| Access | Constructor and Description |
|---|---|
| protected |
| Modifier and Type | Method and Description |
|---|---|
| public final String | Returns: the algorithm URIImplements javax. Returns the URI of the algorithm supported by this
|
| public static TransformService | Returns: a newTransformServicethe URI of the algorithm. See the
algorithm, String TransformService section in the
Java Security Standard Algorithm Names Specification for a list of
standard transform algorithms.the type of the XML processing mechanism and
representation. See the mechanismType)TransformService section in the
Java Security Standard Algorithm Names Specification for a list of
standard mechanism types.Returns a |
| public static TransformService | Returns: a newTransformServicethe URI of the algorithm. See the
algorithm, String TransformService section in the
Java Security Standard Algorithm Names Specification for a list of
standard transform algorithms.the type of the XML processing mechanism and
representation. See the mechanismType, Provider TransformService section in the
Java Security Standard Algorithm Names Specification for a list of
standard mechanism types.the provider)Provider objectReturns a |
| public static TransformService | Returns: a newTransformServicethe URI of the algorithm. See the
algorithm, String TransformService section in the
Java Security Standard Algorithm Names Specification for a list of
standard transform algorithms.the type of the XML processing mechanism and
representation. See the mechanismType, String TransformService section in the
Java Security Standard Algorithm Names Specification for a list of
standard mechanism types.the string name of the provider provider)Returns a |
| public final String | Returns: the mechanism typeReturns the mechanism type supported by this |
| public final Provider | |
| public abstract void | init(TransformParameterSpec
the algorithm parameters (may be params)null if
not required or optional)Initializes this |
| public abstract void | init(XMLStructure
a mechanism-specific structure containing the parent
structure parent, XMLCryptoContext the context)XMLCryptoContext containing
additional context (may be null if not applicable)Initializes this |
| public abstract void | marshalParams(XMLStructure
a mechanism-specific structure containing the parent
node that the marshalled parameters should be appended to parent, XMLCryptoContext the context)XMLCryptoContext containing
additional context (may be null if not applicable)Marshals the algorithm-specific parameters. |
| algorithm | back to summary |
|---|---|
| private String algorithm | |
| mechanism | back to summary |
|---|---|
| private String mechanism | |
| provider | back to summary |
|---|---|
| private Provider provider | |
| TransformService | back to summary |
|---|---|
| protected TransformService() Default constructor, for invocation by subclasses. | |
| getAlgorithm | back to summary |
|---|---|
| public final String getAlgorithm() Implements javax. Returns the URI of the algorithm supported by this
| |
| getInstance | back to summary |
|---|---|
| public static TransformService getInstance(String algorithm, String mechanismType) throws NoSuchAlgorithmException Returns a This method uses the standard JCA provider lookup mechanism to
locate and instantiate a Note that the list of registered providers may be retrieved via
the Implementation Note The JDK Reference Implementation additionally uses the
| |
| getInstance | back to summary |
|---|---|
| public static TransformService getInstance(String algorithm, String mechanismType, Provider provider) throws NoSuchAlgorithmException Returns a
| |
| getInstance | back to summary |
|---|---|
| public static TransformService getInstance(String algorithm, String mechanismType, String provider) throws NoSuchAlgorithmException, NoSuchProviderException Returns a Note that the list of registered providers may be retrieved via
the
| |
| getMechanismType | back to summary |
|---|---|
| public final String getMechanismType() Returns the mechanism type supported by this
| |
| getProvider | back to summary |
|---|---|
| public final Provider getProvider() Returns the provider of this
| |
| init | back to summary |
|---|---|
| public abstract void init(TransformParameterSpec params) throws InvalidAlgorithmParameterException Initializes this If the parameters exist in XML form, the
| |
| init | back to summary |
|---|---|
| public abstract void init(XMLStructure parent, XMLCryptoContext context) throws InvalidAlgorithmParameterException Initializes this
| |
| marshalParams | back to summary |
|---|---|
| public abstract void marshalParams(XMLStructure parent, XMLCryptoContext context) throws MarshalException Marshals the algorithm-specific parameters. If there are no parameters to be marshalled, this method returns without throwing an exception.
| |
| Modifier and Type | Field and Description |
|---|---|
| private final String | |
| private final String | |
| private final String |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | equals(Object o)
Overrides java. Implements java. Compares the specified object with this entry for equality. |
| public String | |
| public String | |
| public int | hashCode()
Overrides java. Implements java. Returns the hash code value for this map entry. |
| public String | setValue(String value)
Implements java. Replaces the value corresponding to this entry with the specified value (optional operation). |
| algorithm | back to summary |
|---|---|
| private final String algorithm | |
| key | back to summary |
|---|---|
| private final String key | |
| mechanism | back to summary |
|---|---|
| private final String mechanism | |
| MechanismMapEntry | back to summary |
|---|---|
| pack-priv MechanismMapEntry(String algorithm, String mechanism) | |
| equals | back to summary |
|---|---|
| public boolean equals(Object o) Overrides java. Implements java. Doc from java. Compares the specified object with this entry for equality.
Returns
(e1.getKey()==null ?
e2.getKey()==null : e1.getKey().equals(e2.getKey())) &&
(e1.getValue()==null ?
e2.getValue()==null : e1.getValue().equals(e2.getValue()))
This ensures that the equals method works properly across
different implementations of the Map.Entry interface.
| |
| getKey | back to summary |
|---|---|
| public String getKey() Implements java. Doc from java. Returns the key corresponding to this entry. | |
| getValue | back to summary |
|---|---|
| public String getValue() Implements java. Doc from java. Returns the value corresponding to this entry. If the mapping
has been removed from the backing map (by the iterator's
| |
| hashCode | back to summary |
|---|---|
| public int hashCode() Overrides java. Implements java. Doc from java. Returns the hash code value for this map entry. The hash code
of a map entry
(e.getKey()==null ? 0 : e.getKey().hashCode()) ^
(e.getValue()==null ? 0 : e.getValue().hashCode())
This ensures that e1.equals(e2) implies that
e1.hashCode()==e2.hashCode() for any two Entries
e1 and e2, as required by the general
contract of Object.hashCode.
| |
| setValue | back to summary |
|---|---|
| public String setValue(String value) Implements java. Doc from java. Replaces the value corresponding to this entry with the specified
value (optional operation). (Writes through to the map.) The
behavior of this call is undefined if the mapping has already been
removed from the map (by the iterator's | |