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
FieldsModifier and TypeFieldDescriptionprotected ASiCContent[]An array of ASiC contents representing containers to be mergedprotected static final DigestAlgorithmDigest algo used for internal documents comparison -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedEmpty constructorprotectedDefaultContainerMerger(ASiCContent... asicContents) This constructor is used to create anASiCContainerMergerfrom to givenASiCContentsprotectedDefaultContainerMerger(DSSDocument... containers) This constructor is used to create anASiCContainerMergerfrom provided container documents -
Method Summary
Modifier and TypeMethodDescriptionprotected ASiCContentThis method creates an empty containerprotected ASiCContentThis method creates a newASiCContentby merging the given containersprotected abstract voidVerifies whether containers can be mergedprotected abstract voidThis method is used to ensure that the entry names between the containers' entries are differentstatic ASiCContainerMergerfromASiCContents(ASiCContent... asicContents) This method loads a relevantASiCContainerMergerto be used to merge givenASiCContentsstatic ASiCContainerMergerfromDocuments(DSSDocument... containers) This method loads a relevantASiCContainerMergerto be used to merge given container documentsprotected abstract DefaultASiCContainerExtractorgetContainerExtractor(DSSDocument container) This method returns a relevant ASiC container extractorGets the merged container result's creation timeprotected StringgetFinalContainerName(ASiCContainerType asicContainerType) This method returns a filename for the merged containerprotected abstract ASiCContainerTypeThis method returns a target ASiC Container Type of the current merger classprotected abstract booleanisSupported(ASiCContent asicContent) This method verifies whether the providedASiCContentis supported by the current classbooleanisSupported(ASiCContent... asicContents) Returns whether the format of given containers is supported by the currentASiCContainerMergerprotected abstract booleanisSupported(DSSDocument container) This method verifies whether the providedcontaineris supported by the current classbooleanisSupported(DSSDocument... containers) Returns whether the format of given containers is supported by the currentASiCContainerMergermerge()Merges given containers to a new container document, when possibleMerges given containers to a singleASiCContent, when possiblevoidsetCreationTime(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 anASiCContainerMergerfrom provided container documents- Parameters:
containers-DSSDocuments representing containers to be merged
-
DefaultContainerMerger
This constructor is used to create anASiCContainerMergerfrom to givenASiCContents- Parameters:
asicContents-ASiCContents to be merged
-
-
Method Details
-
getContainerExtractor
This method returns a relevant ASiC container extractor- Parameters:
container-DSSDocumentrepresenting a container to be extracted- Returns:
DefaultASiCContainerExtractor
-
getCreationTime
-
setCreationTime
-
fromDocuments
This method loads a relevantASiCContainerMergerto be used to merge given container documents- Parameters:
containers-DSSDocumentto be merged- Returns:
ASiCContainerMerger
-
fromASiCContents
This method loads a relevantASiCContainerMergerto be used to merge givenASiCContents- Parameters:
asicContents-ASiCContents to be merged- Returns:
ASiCContainerMerger
-
isSupported
Description copied from interface:ASiCContainerMergerReturns whether the format of given containers is supported by the currentASiCContainerMerger- Specified by:
isSupportedin interfaceASiCContainerMerger- Parameters:
containers-DSSDocuments to be merged- Returns:
- TRUE if all documents are supported by the current container, FALSE otherwise
-
isSupported
This method verifies whether the providedcontaineris supported by the current class- Parameters:
container-DSSDocumentto verify- Returns:
- TRUE if the container is supported, FALSE otherwise
-
isSupported
Description copied from interface:ASiCContainerMergerReturns whether the format of given containers is supported by the currentASiCContainerMerger- Specified by:
isSupportedin interfaceASiCContainerMerger- Parameters:
asicContents-ASiCContents to be merged- Returns:
- TRUE if all containers are supported by the current container, FALSE otherwise
-
isSupported
This method verifies whether the providedASiCContentis supported by the current class- Parameters:
asicContent-ASiCContentto verify- Returns:
- TRUE if the ASIC Content is supported, FALSE otherwise
-
merge
Description copied from interface:ASiCContainerMergerMerges given containers to a new container document, when possible- Specified by:
mergein interfaceASiCContainerMerger- Returns:
DSSDocumentrepresenting a merge result of the given ZIP-containers
-
mergeToASiCContent
Description copied from interface:ASiCContainerMergerMerges given containers to a singleASiCContent, when possible- Specified by:
mergeToASiCContentin interfaceASiCContainerMerger- Returns:
ASiCContentrepresenting 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 newASiCContentby 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-ASiCContainerTypeASiC type of the merged container- Returns:
Stringfilename of the container
-