Class AbstractDocumentExtender<SP extends AbstractSignatureParameters<?>, TP extends TimestampParameters>

java.lang.Object
eu.europa.esig.dss.extension.SignedDocumentExtender
eu.europa.esig.dss.extension.AbstractDocumentExtender<SP,TP>
Type Parameters:
SP - SerializableSignatureParameters specifying the signature creation parameters
TP - SerializableTimestampParameters specifying the timestamp creation parameters, when applicable
All Implemented Interfaces:
DocumentExtender
Direct Known Subclasses:
ASiCWithCAdESDocumentExtender, ASiCWithXAdESDocumentExtender, CAdESDocumentExtender, JAdESDocumentExtender, PAdESDocumentExtender, XAdESDocumentExtender

public abstract class AbstractDocumentExtender<SP extends AbstractSignatureParameters<?>, TP extends TimestampParameters> extends SignedDocumentExtender
This class provides an abstract implementation of the eu.europa.esig.dss.spi.augmentation.DocumentExtender
  • Field Details

    • document

      protected DSSDocument document
      The document to be augmented (with the signatures)
  • Constructor Details

    • AbstractDocumentExtender

      protected AbstractDocumentExtender()
      Empty constructor
  • Method Details

    • extendDocument

      public DSSDocument extendDocument(SignatureProfile signatureProfile)
      Description copied from interface: DocumentExtender
      Performs augmentation of all signatures within the provided document according to the specified target signatureProfile.
      Parameters:
      signatureProfile - SignatureProfile identifying the desired target augmentation level
      Returns:
      DSSDocument containing the augmented signatures, if the augmentation succeeds.
    • extendDocument

      public DSSDocument extendDocument(SignatureProfile signatureProfile, List<DSSDocument> detachedContents)
      Description copied from interface: DocumentExtender
      Performs augmentation of all signatures of a detached format within the provided document according to the specified target signatureProfile.
      Parameters:
      signatureProfile - SignatureProfile identifying the desired target augmentation level
      detachedContents - list of DSSDocuments representing a signed content in case of a detached signature
      Returns:
      DSSDocument containing the augmented signatures, if the augmentation succeeds.
    • extendDocument

      public DSSDocument extendDocument(SignatureProfile signatureProfile, SerializableSignatureParameters... extensionParameters)
      Description copied from interface: DocumentExtender
      Performs augmentation of all signatures within the provided document according to the specified augmentationParameters, with format specific extensionParameters.

      If explicitParameters are provided, and they contain an implementation of parameters matching the current signature format, those signature parameters will be used explicitly on this signature augmentation. This can be useful when a signature augmentation process for a certain signature format should take into account particular signature constraints (i.e. /Contents size for a PAdES document time-stamp, etc.).

      NOTE 1: If the matching implementation of extension parameters found, and it contains signatureLevel and/or detachedContents definition, the existing values will be used. Otherwise, the content of the extension parameters will be overwritten respectively. NOTE 2: The definition of extension parameters is order dependent. The first parameters matching the signature format implementation will be used.

      Parameters:
      signatureProfile - SignatureProfile identifying the desired target augmentation level
      extensionParameters - (optional) SerializableSignatureParameters containing format specific requirements
      Returns:
      DSSDocument containing the augmented signatures, if the augmentation succeeds.
    • extendDocument

      public DSSDocument extendDocument(SignatureProfile signatureProfile, List<DSSDocument> detachedContents, SerializableSignatureParameters... extensionParameters)
      Description copied from interface: DocumentExtender
      Performs augmentation of all signatures of a detached format within the provided document according to the specified target signatureProfile, with format specific extensionParameters.

      If explicitParameters are provided, and they contain an implementation of parameters matching the current signature format, those signature parameters will be used explicitly on this signature augmentation. This can be useful when a signature augmentation process for a certain signature format should take into account particular signature constraints (i.e. /Contents size for a PAdES document time-stamp, etc.).

      NOTE 1: If the matching implementation of extension parameters found, and it contains signatureLevel and/or detachedContents definition, the existing values will be used. Otherwise, the content of the extension parameters will be overwritten respectively. NOTE 2: The definition of extension parameters is order dependent. The first parameters matching the signature format implementation will be used.

      Parameters:
      signatureProfile - SignatureProfile identifying the desired target augmentation level
      detachedContents - list of DSSDocuments representing a signed content in case of a detached signature
      extensionParameters - (optional) SerializableSignatureParameters containing format specific requirements
      Returns:
      DSSDocument containing the augmented signatures, if the augmentation succeeds.
    • initSignatureService

      protected DocumentSignatureService<SP,TP> initSignatureService()
      This method initializes a new DocumentSignatureService
      Returns:
      DocumentSignatureService
    • createSignatureService

      protected abstract DocumentSignatureService<SP,TP> createSignatureService()
      This method created a new instance of DocumentSignatureService
      Returns:
      DocumentSignatureService
    • isSupportedService

      protected abstract boolean isSupportedService(DocumentSignatureService<?,?> service)
      This method verifies whether the provided document signature service is supported by the current implementation
      Parameters:
      service - DocumentSignatureService to check
      Returns:
      TRUE if the service is supported by the current implementation, FALSE otherwise
    • initSignatureParameters

      protected SP initSignatureParameters(SignatureProfile signatureProfile, List<DSSDocument> detachedContents, SerializableSignatureParameters... extensionParameters)
      This method initializes signature parameters to be used on the signature augmentation
      Parameters:
      signatureProfile - SignatureProfile representing a target level on signature augmentation
      detachedContents - a list of DSSDocument for a detached signature
      extensionParameters - array of format specific SerializableSignatureParameters, when applicable
      Returns:
      SerializableSignatureParameters
    • emptySignatureParameters

      protected abstract SP emptySignatureParameters()
      This method returns a new instance of empty signature parameters, according to the given format implementation
      Returns:
      SerializableSignatureParameters
    • isSupportedParameters

      protected abstract boolean isSupportedParameters(SerializableSignatureParameters parameters)
      This method verifies whether the provided signature parameters are supported by the current implementation
      Parameters:
      parameters - SerializableSignatureParameters to check
      Returns:
      TRUE if the parameters are supported by the current implementation, FALSE otherwise
    • fillSignatureParameters

      protected SP fillSignatureParameters(SP signatureParameters, SignatureProfile signatureProfile, List<DSSDocument> detachedContents)
      This method fills the signatureParameters with the parameters from the augmentationParameters
      Parameters:
      signatureParameters - SerializableSignatureParameters to fill
      signatureProfile - SignatureProfile representing a target level on signature augmentation
      detachedContents - a list of DSSDocument for a detached signature
      Returns:
      SerializableSignatureParameters
    • getSignatureLevel

      protected SignatureLevel getSignatureLevel(SignatureProfile signatureProfile)
      Gets the target SignatureLevel for the given SignatureProfile relatively to the signature format
      Parameters:
      signatureProfile - SignatureProfile
      Returns:
      SignatureLevel