Class AbstractASiCManifestBuilder

java.lang.Object
eu.europa.esig.dss.asic.common.AbstractASiCManifestBuilder
Direct Known Subclasses:
ASiCEvidenceRecordManifestBuilder, ASiCEWithCAdESArchiveManifestBuilder, ASiCEWithCAdESManifestBuilder

public abstract class AbstractASiCManifestBuilder extends Object
The abstract class to build a Manifest for ASiC
  • Field Details

    • asicContent

      protected final ASiCContent asicContent
      The container representation
    • sigReferenceUri

      protected final String sigReferenceUri
      The URI of a document signing the manifest
    • digestAlgorithm

      protected final DigestAlgorithm digestAlgorithm
      The DigestAlgorithm to use for reference digests computation
  • Constructor Details

    • AbstractASiCManifestBuilder

      protected AbstractASiCManifestBuilder(ASiCContent asicContent, String sigReferenceUri)
      Constructor to instantiate AbstractASiCManifestBuilder with a default SHA-256 digest algorithm
      Parameters:
      asicContent - ASiCContent
      sigReferenceUri - String
    • AbstractASiCManifestBuilder

      protected AbstractASiCManifestBuilder(ASiCContent asicContent, String sigReferenceUri, DigestAlgorithm digestAlgorithm)
      Constructor to instantiate AbstractASiCManifestBuilder with a provided digest algorithm
      Parameters:
      asicContent - ASiCContent representing the structure of the ASiC container
      sigReferenceUri - String name of the document to be linked to the manifest (e.g. name of the signature file)
      digestAlgorithm - DigestAlgorithm to be used for digest computation of DataObjectReference's
  • Method Details

    • build

      public DSSDocument build()
      Builds the ArchiveManifest and returns the Document Node
      Returns:
      DSSDocument archive manifest
    • buildDom

      protected Document buildDom()
      Builds the initial XML document
      Returns:
      Document
    • createRootElement

      protected Element createRootElement(Document documentDom)
      Creates a root element <asic:ASiCManifest xmlns:asic="http://uri.etsi.org/02918/v1.2.1#">
      Parameters:
      documentDom - Document
      Returns:
      Element
    • addSigReference

      protected void addSigReference(Document documentDom, Element asicManifestDom)
      Adds a <SigReference> element
      Parameters:
      documentDom - Document to add the SigReference to
      asicManifestDom - Element containing an asicManifestDom to incorporate the SigReference within
    • getSigReferenceMimeType

      protected abstract MimeType getSigReferenceMimeType()
      (Optional) Returns the MimeType to be used for a signature reference (signature or timestamp)
      Returns:
      MimeType
    • addDataObjectReferences

      protected void addDataObjectReferences(Document documentDom, Element asicManifestDom)
      This method adds references to data objects, corresponding to the ASiCContentDocumentFilter configuration
      Parameters:
      documentDom - Document
      asicManifestDom - Element the root element to add the references to
    • getAsicContentDocumentFilter

      protected ASiCContentDocumentFilter getAsicContentDocumentFilter()
      Gets an ASiCContentDocumentFilter used to filter the documents to be referenced within ASiC Manifest
      Returns:
      ASiCContentDocumentFilter
    • setAsicContentDocumentFilter

      public AbstractASiCManifestBuilder setAsicContentDocumentFilter(ASiCContentDocumentFilter asicContentDocumentFilter)
      Sets an ASiCContentDocumentFilter used to filter the documents to compute hashes for. When not set, a default ASiCContentDocumentFilter is used for the given manifest type.
      Parameters:
      asicContentDocumentFilter - ASiCContentDocumentFilter
      Returns:
      this ASiCEvidenceRecordDigestBuilder
    • initDefaultAsicContentDocumentFilter

      protected abstract ASiCContentDocumentFilter initDefaultAsicContentDocumentFilter()
      Gets an ASiCContentDocumentFilter used to filter the documents to be referenced within ASiC Manifest
      Returns:
      ASiCContentDocumentFilter
    • addDataObjectReference

      protected Element addDataObjectReference(Document documentDom, Element asicManifestDom, DSSDocument document, DigestAlgorithm digestAlgorithm)
      Adds a <DataObjectReference> element
      Parameters:
      documentDom - Document to add the DataObjectReference to
      asicManifestDom - Element containing an asicManifestDom to incorporate the DataObjectReference within
      document - DSSDocument to refer
      digestAlgorithm - DigestAlgorithm to use for digest calculation
      Returns:
      Element
    • isRootfile

      protected boolean isRootfile(DSSDocument document)
      Specifies whether the document is a Rootfile document
      Parameters:
      document - DSSDocument to check
      Returns:
      TRUE if the Rootfile attribute shall be added for the document's reference, FALSE otherwise
    • toDSSDocument

      protected DSSDocument toDSSDocument(Document documentDom)
      Transforms Document to DSSDocument
      Parameters:
      documentDom - Document
      Returns:
      DSSDocument
    • getManifestFilename

      protected abstract String getManifestFilename()
      Returns a final filename of the manifest
      Returns:
      String