Class TransformService

java.lang.Object
javax.xml.crypto.dsig.TransformService
All Implemented Interfaces:
AlgorithmMethod, Transform, XMLStructure

public abstract class TransformService extends Object implements Transform
A Service Provider Interface for transform and canonicalization algorithms.

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 Provider 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.

Since:
1.6
External Specifications
  • Field Summary

    Fields declared in interface Transform

    BASE64, ENVELOPED, XPATH, XPATH2, XSLT
    Modifier and Type
    Field
    Description
    static final String
    The Base64 transform algorithm URI.
    static final String
    The Enveloped Signature transform algorithm URI.
    static final String
    The XPath transform algorithm URI.
    static final String
    The XPath Filter 2 transform algorithm URI.
    static final String
    The XSLT transform algorithm URI.
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    Default constructor, for invocation by subclasses.
  • Method Summary

    Modifier and Type
    Method
    Description
    final String
    Returns the URI of the algorithm supported by this TransformService.
    getInstance(String algorithm, String mechanismType)
    Returns a TransformService that supports the specified algorithm URI (ex: Transform.XPATH2) and mechanism type (ex: DOM).
    getInstance(String algorithm, String mechanismType, String provider)
    Returns a TransformService that supports the specified algorithm URI (ex: Transform.XPATH2) and mechanism type (ex: DOM) as supplied by the specified provider.
    getInstance(String algorithm, String mechanismType, Provider provider)
    Returns a TransformService that supports the specified algorithm URI (ex: Transform.XPATH2) and mechanism type (ex: DOM) as supplied by the specified provider.
    final String
    Returns the mechanism type supported by this TransformService.
    final Provider
    Returns the provider of this TransformService.
    abstract void
    Initializes this TransformService with the specified parameters.
    abstract void
    Initializes this TransformService with the specified parameters and document context.
    abstract void
    Marshals the algorithm-specific parameters.

    Methods declared in class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    Modifier and Type
    Method
    Description
    protected Object
    Answers a new instance of the same class as the receiver, whose slots have been filled in with the values in the slots of the receiver.
    boolean
    Compares the argument to the receiver, and answers true if they represent the same object using a class specific comparison.
    protected void
    Deprecated, for removal: This API element is subject to removal in a future version.
    May cause performance issues, deadlocks and hangs.
    final Class<? extends Object>
    Answers the unique instance of java.lang.Class which represents the class of the receiver.
    int
    Answers an integer hash code for the receiver.
    final void
    Causes one thread which is waiting on the receiver to be made ready to run.
    final void
    Causes all threads which are waiting on the receiver to be made ready to run.
    Answers a string containing a concise, human-readable description of the receiver.
    final void
    Causes the thread which sent this message to be made not ready to run pending some change in the receiver (as indicated by notify or notifyAll).
    final void
    wait(long time)
    Causes the thread which sent this message to be made not ready to run either pending some change in the receiver (as indicated by notify or notifyAll) or the expiration of the timeout.
    final void
    wait(long time, int frac)
    Causes the thread which sent this message to be made not ready to run either pending some change in the receiver (as indicated by notify or notifyAll) or the expiration of the timeout.

    Methods declared in interface Transform

    getParameterSpec, transform, transform
    Modifier and Type
    Method
    Description
    Returns the algorithm-specific input parameters associated with this Transform.
    Transforms the specified data using the underlying transform algorithm.
    Transforms the specified data using the underlying transform algorithm.

    Methods declared in interface XMLStructure

    isFeatureSupported
    Modifier and Type
    Method
    Description
    boolean
    Indicates whether a specified feature is supported.
  • Constructor Details

    • TransformService

      protected TransformService()
      Default constructor, for invocation by subclasses.
  • Method Details