Class DefaultContainerMerger

java.lang.Object
eu.europa.esig.dss.asic.common.merge.DefaultContainerMerger
All Implemented Interfaces:
ASiCContainerMerger

public abstract class DefaultContainerMerger extends Object implements ASiCContainerMerger
This class is used to load a relevant eu.europa.esig.dss.asic.common.merge.ASiCContainerMerger in order merge content of given containers.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected ASiCContent[]
    An array of ASiC contents representing containers to be merged
    protected static final eu.europa.esig.dss.enumerations.DigestAlgorithm
    Digest algo used for internal documents comparison
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    Empty constructor
    protected
    This constructor is used to create an ASiCContainerMerger from to given ASiCContents
    protected
    DefaultContainerMerger(eu.europa.esig.dss.model.DSSDocument... containers)
    This constructor is used to create an ASiCContainerMerger from provided container documents
  • Method Summary

    Modifier and Type
    Method
    Description
    protected ASiCContent
    This method creates an empty container
    protected ASiCContent
    This method creates a new ASiCContent by merging the given containers
    protected abstract void
    Verifies whether containers can be merged
    protected abstract void
    This method is used to ensure that the entry names between the containers' entries are different
    fromASiCContents(ASiCContent... asicContents)
    This method loads a relevant ASiCContainerMerger to be used to merge given ASiCContents
    fromDocuments(eu.europa.esig.dss.model.DSSDocument... containers)
    This method loads a relevant ASiCContainerMerger to be used to merge given container documents
    getContainerExtractor(eu.europa.esig.dss.model.DSSDocument container)
    This method returns a relevant ASiC container extractor
    Gets the merged container result's creation time
    protected String
    getFinalContainerName(eu.europa.esig.dss.enumerations.ASiCContainerType asicContainerType)
    This method returns a filename for the merged container
    protected abstract eu.europa.esig.dss.enumerations.ASiCContainerType
    This method returns a target ASiC Container Type of the current merger class
    protected abstract boolean
    isSupported(ASiCContent asicContent)
    This method verifies whether the provided ASiCContent is supported by the current class
    boolean
    isSupported(ASiCContent... asicContents)
    Returns whether the format of given containers is supported by the current ASiCContainerMerger
    protected abstract boolean
    isSupported(eu.europa.esig.dss.model.DSSDocument container)
    This method verifies whether the provided container is supported by the current class
    boolean
    isSupported(eu.europa.esig.dss.model.DSSDocument... containers)
    Returns whether the format of given containers is supported by the current ASiCContainerMerger
    eu.europa.esig.dss.model.DSSDocument
    Merges given containers to a new container document, when possible
    Merges given containers to a single ASiCContent, when possible
    void
    setCreationTime(Date creationTime)
    Sets the creation time of the merged container result (optional)

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • DEFAULT_DIGEST_ALGORITHM

      protected static final eu.europa.esig.dss.enumerations.DigestAlgorithm DEFAULT_DIGEST_ALGORITHM
      Digest algo used for internal documents comparison
    • asicContents

      protected ASiCContent[] asicContents
      An array of ASiC contents representing containers to be merged
  • Constructor Details

    • DefaultContainerMerger

      protected DefaultContainerMerger()
      Empty constructor
    • DefaultContainerMerger

      protected DefaultContainerMerger(eu.europa.esig.dss.model.DSSDocument... containers)
      This constructor is used to create an ASiCContainerMerger from provided container documents
      Parameters:
      containers - DSSDocuments representing containers to be merged
    • DefaultContainerMerger

      protected DefaultContainerMerger(ASiCContent... asicContents)
      This constructor is used to create an ASiCContainerMerger from to given ASiCContents
      Parameters:
      asicContents - ASiCContents to be merged
  • Method Details

    • getContainerExtractor

      protected abstract DefaultASiCContainerExtractor getContainerExtractor(eu.europa.esig.dss.model.DSSDocument container)
      This method returns a relevant ASiC container extractor
      Parameters:
      container - DSSDocument representing a container to be extracted
      Returns:
      DefaultASiCContainerExtractor
    • getCreationTime

      public Date getCreationTime()
      Gets the merged container result's creation time
      Returns:
      Date
    • setCreationTime

      public void setCreationTime(Date creationTime)
      Sets the creation time of the merged container result (optional)
      Parameters:
      creationTime - Date
    • fromDocuments

      public static ASiCContainerMerger fromDocuments(eu.europa.esig.dss.model.DSSDocument... containers)
      This method loads a relevant ASiCContainerMerger to be used to merge given container documents
      Parameters:
      containers - DSSDocument to be merged
      Returns:
      ASiCContainerMerger
    • fromASiCContents

      public static ASiCContainerMerger fromASiCContents(ASiCContent... asicContents)
      This method loads a relevant ASiCContainerMerger to be used to merge given ASiCContents
      Parameters:
      asicContents - ASiCContents to be merged
      Returns:
      ASiCContainerMerger
    • isSupported

      public boolean isSupported(eu.europa.esig.dss.model.DSSDocument... containers)
      Description copied from interface: ASiCContainerMerger
      Returns whether the format of given containers is supported by the current ASiCContainerMerger
      Specified by:
      isSupported in interface ASiCContainerMerger
      Parameters:
      containers - DSSDocuments to be merged
      Returns:
      TRUE if all documents are supported by the current container, FALSE otherwise
    • isSupported

      protected abstract boolean isSupported(eu.europa.esig.dss.model.DSSDocument container)
      This method verifies whether the provided container is supported by the current class
      Parameters:
      container - DSSDocument to verify
      Returns:
      TRUE if the container is supported, FALSE otherwise
    • isSupported

      public boolean isSupported(ASiCContent... asicContents)
      Description copied from interface: ASiCContainerMerger
      Returns whether the format of given containers is supported by the current ASiCContainerMerger
      Specified by:
      isSupported in interface ASiCContainerMerger
      Parameters:
      asicContents - ASiCContents to be merged
      Returns:
      TRUE if all containers are supported by the current container, FALSE otherwise
    • isSupported

      protected abstract boolean isSupported(ASiCContent asicContent)
      This method verifies whether the provided ASiCContent is supported by the current class
      Parameters:
      asicContent - ASiCContent to verify
      Returns:
      TRUE if the ASIC Content is supported, FALSE otherwise
    • merge

      public eu.europa.esig.dss.model.DSSDocument merge()
      Description copied from interface: ASiCContainerMerger
      Merges given containers to a new container document, when possible
      Specified by:
      merge in interface ASiCContainerMerger
      Returns:
      DSSDocument representing a merge result of the given ZIP-containers
    • mergeToASiCContent

      public ASiCContent mergeToASiCContent()
      Description copied from interface: ASiCContainerMerger
      Merges given containers to a single ASiCContent, when possible
      Specified by:
      mergeToASiCContent in interface ASiCContainerMerger
      Returns:
      ASiCContent representing a merge result
    • ensureContainerContentAllowMerge

      protected abstract void ensureContainerContentAllowMerge()
      Verifies whether containers can be merged
    • ensureSignaturesAllowMerge

      protected abstract void ensureSignaturesAllowMerge()
      This method is used to ensure that the entry names between the containers' entries are different
    • createMergedResult

      protected ASiCContent createMergedResult()
      This method creates a new ASiCContent by merging the given containers
      Returns:
      ASiCContent
    • createEmptyContainer

      protected ASiCContent createEmptyContainer()
      This method creates an empty container
      Returns:
      ASiCContent
    • getTargetASiCContainerType

      protected abstract eu.europa.esig.dss.enumerations.ASiCContainerType getTargetASiCContainerType()
      This method returns a target ASiC Container Type of the current merger class
      Returns:
      ASiCContainerType
    • getFinalContainerName

      protected String getFinalContainerName(eu.europa.esig.dss.enumerations.ASiCContainerType asicContainerType)
      This method returns a filename for the merged container
      Parameters:
      asicContainerType - ASiCContainerType ASiC type of the merged container
      Returns:
      String filename of the container