Class DefaultContainerMerger
java.lang.Object
eu.europa.esig.dss.asic.common.merge.DefaultContainerMerger
- All Implemented Interfaces:
ASiCContainerMerger
- Direct Known Subclasses:
AbstractASiCWithCAdESContainerMerger
,AbstractASiCWithXAdESContainerMerger
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
Modifier and TypeFieldDescriptionprotected ASiCContent[]
An array of ASiC contents representing containers to be mergedprotected static final DigestAlgorithm
Digest algo used for internal documents comparison -
Constructor Summary
ModifierConstructorDescriptionprotected
Empty constructorprotected
DefaultContainerMerger
(ASiCContent... asicContents) This constructor is used to create anASiCContainerMerger
from to givenASiCContent
sprotected
DefaultContainerMerger
(DSSDocument... containers) This constructor is used to create anASiCContainerMerger
from provided container documents -
Method Summary
Modifier and TypeMethodDescriptionprotected ASiCContent
This method creates an empty containerprotected ASiCContent
This method creates a newASiCContent
by merging the given containersprotected abstract void
Verifies whether containers can be mergedprotected abstract void
This method is used to ensure that the entry names between the containers' entries are differentstatic ASiCContainerMerger
fromASiCContents
(ASiCContent... asicContents) This method loads a relevantASiCContainerMerger
to be used to merge givenASiCContent
sstatic ASiCContainerMerger
fromDocuments
(DSSDocument... containers) This method loads a relevantASiCContainerMerger
to be used to merge given container documentsprotected abstract DefaultASiCContainerExtractor
getContainerExtractor
(DSSDocument container) This method returns a relevant ASiC container extractorGets the merged container result's creation timeprotected String
getFinalContainerName
(ASiCContainerType asicContainerType) This method returns a filename for the merged containerprotected abstract ASiCContainerType
This method returns a target ASiC Container Type of the current merger classprotected abstract boolean
isSupported
(ASiCContent asicContent) This method verifies whether the providedASiCContent
is supported by the current classboolean
isSupported
(ASiCContent... asicContents) Returns whether the format of given containers is supported by the currentASiCContainerMerger
protected abstract boolean
isSupported
(DSSDocument container) This method verifies whether the providedcontainer
is supported by the current classboolean
isSupported
(DSSDocument... containers) Returns whether the format of given containers is supported by the currentASiCContainerMerger
merge()
Merges given containers to a new container document, when possibleMerges given containers to a singleASiCContent
, when possiblevoid
setCreationTime
(Date creationTime) Sets the creation time of the merged container result (optional)
-
Field Details
-
DEFAULT_DIGEST_ALGORITHM
Digest algo used for internal documents comparison -
asicContents
An array of ASiC contents representing containers to be merged
-
-
Constructor Details
-
DefaultContainerMerger
protected DefaultContainerMerger()Empty constructor -
DefaultContainerMerger
This constructor is used to create anASiCContainerMerger
from provided container documents- Parameters:
containers
-DSSDocument
s representing containers to be merged
-
DefaultContainerMerger
This constructor is used to create anASiCContainerMerger
from to givenASiCContent
s- Parameters:
asicContents
-ASiCContent
s to be merged
-
-
Method Details
-
getContainerExtractor
This method returns a relevant ASiC container extractor- Parameters:
container
-DSSDocument
representing a container to be extracted- Returns:
DefaultASiCContainerExtractor
-
getCreationTime
-
setCreationTime
-
fromDocuments
This method loads a relevantASiCContainerMerger
to be used to merge given container documents- Parameters:
containers
-DSSDocument
to be merged- Returns:
ASiCContainerMerger
-
fromASiCContents
This method loads a relevantASiCContainerMerger
to be used to merge givenASiCContent
s- Parameters:
asicContents
-ASiCContent
s to be merged- Returns:
ASiCContainerMerger
-
isSupported
Description copied from interface:ASiCContainerMerger
Returns whether the format of given containers is supported by the currentASiCContainerMerger
- Specified by:
isSupported
in interfaceASiCContainerMerger
- Parameters:
containers
-DSSDocument
s to be merged- Returns:
- TRUE if all documents are supported by the current container, FALSE otherwise
-
isSupported
This method verifies whether the providedcontainer
is supported by the current class- Parameters:
container
-DSSDocument
to verify- Returns:
- TRUE if the container is supported, FALSE otherwise
-
isSupported
Description copied from interface:ASiCContainerMerger
Returns whether the format of given containers is supported by the currentASiCContainerMerger
- Specified by:
isSupported
in interfaceASiCContainerMerger
- Parameters:
asicContents
-ASiCContent
s to be merged- Returns:
- TRUE if all containers are supported by the current container, FALSE otherwise
-
isSupported
This method verifies whether the providedASiCContent
is supported by the current class- Parameters:
asicContent
-ASiCContent
to verify- Returns:
- TRUE if the ASIC Content is supported, FALSE otherwise
-
merge
Description copied from interface:ASiCContainerMerger
Merges given containers to a new container document, when possible- Specified by:
merge
in interfaceASiCContainerMerger
- Returns:
DSSDocument
representing a merge result of the given ZIP-containers
-
mergeToASiCContent
Description copied from interface:ASiCContainerMerger
Merges given containers to a singleASiCContent
, when possible- Specified by:
mergeToASiCContent
in interfaceASiCContainerMerger
- 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
This method creates a newASiCContent
by merging the given containers- Returns:
ASiCContent
-
createEmptyContainer
This method creates an empty container- Returns:
ASiCContent
-
getTargetASiCContainerType
This method returns a target ASiC Container Type of the current merger class- Returns:
ASiCContainerType
-
getFinalContainerName
This method returns a filename for the merged container- Parameters:
asicContainerType
-ASiCContainerType
ASiC type of the merged container- Returns:
String
filename of the container
-